From e258303d0897165b43aaadfb18e846ed266212ef Mon Sep 17 00:00:00 2001 From: Pawel Hofman Date: Tue, 6 May 2014 15:13:54 +0200 Subject: [PATCH 001/851] Samples open in VS2013 by default now --- samples/FallingBlocks/FallingBlocks.sln | 26 ++++++------------- .../HelloWorldDisplay/HelloWorldDisplay.sln | 2 +- 2 files changed, 9 insertions(+), 19 deletions(-) diff --git a/samples/FallingBlocks/FallingBlocks.sln b/samples/FallingBlocks/FallingBlocks.sln index 9e6120b3..a2d27f9b 100644 --- a/samples/FallingBlocks/FallingBlocks.sln +++ b/samples/FallingBlocks/FallingBlocks.sln @@ -1,6 +1,6 @@  -Microsoft Visual Studio Solution File, Format Version 11.00 -# Visual Studio 2010 +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 2013 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "FallingBlocks", "FallingBlocks\FallingBlocks.vcxproj", "{90124CDE-5D40-4B1B-ADCD-4DCF309A4FC8}" EndProject Global @@ -16,26 +16,16 @@ Global Simulator-Debug|Win32 = Simulator-Debug|Win32 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {90124CDE-5D40-4B1B-ADCD-4DCF309A4FC8}.Debug|BlackBerry.ActiveCfg = Debug|BlackBerry - {90124CDE-5D40-4B1B-ADCD-4DCF309A4FC8}.Debug|BlackBerry.Build.0 = Debug|BlackBerry - {90124CDE-5D40-4B1B-ADCD-4DCF309A4FC8}.Debug|BlackBerry.Deploy.0 = Debug|BlackBerry - {90124CDE-5D40-4B1B-ADCD-4DCF309A4FC8}.Debug|BlackBerrySimulator.ActiveCfg = Debug|BlackBerrySimulator - {90124CDE-5D40-4B1B-ADCD-4DCF309A4FC8}.Debug|BlackBerrySimulator.Build.0 = Debug|BlackBerrySimulator - {90124CDE-5D40-4B1B-ADCD-4DCF309A4FC8}.Debug|BlackBerrySimulator.Deploy.0 = Debug|BlackBerrySimulator + {90124CDE-5D40-4B1B-ADCD-4DCF309A4FC8}.Debug|BlackBerry.ActiveCfg = Debug|Win32 + {90124CDE-5D40-4B1B-ADCD-4DCF309A4FC8}.Debug|BlackBerrySimulator.ActiveCfg = Debug|Win32 {90124CDE-5D40-4B1B-ADCD-4DCF309A4FC8}.Debug|Win32.ActiveCfg = Debug|Win32 {90124CDE-5D40-4B1B-ADCD-4DCF309A4FC8}.Debug|Win32.Build.0 = Debug|Win32 - {90124CDE-5D40-4B1B-ADCD-4DCF309A4FC8}.Release|BlackBerry.ActiveCfg = Release|BlackBerry - {90124CDE-5D40-4B1B-ADCD-4DCF309A4FC8}.Release|BlackBerry.Build.0 = Release|BlackBerry - {90124CDE-5D40-4B1B-ADCD-4DCF309A4FC8}.Release|BlackBerrySimulator.ActiveCfg = Release|BlackBerrySimulator - {90124CDE-5D40-4B1B-ADCD-4DCF309A4FC8}.Release|BlackBerrySimulator.Build.0 = Release|BlackBerrySimulator - {90124CDE-5D40-4B1B-ADCD-4DCF309A4FC8}.Release|BlackBerrySimulator.Deploy.0 = Release|BlackBerrySimulator + {90124CDE-5D40-4B1B-ADCD-4DCF309A4FC8}.Release|BlackBerry.ActiveCfg = Release|Win32 + {90124CDE-5D40-4B1B-ADCD-4DCF309A4FC8}.Release|BlackBerrySimulator.ActiveCfg = Release|Win32 {90124CDE-5D40-4B1B-ADCD-4DCF309A4FC8}.Release|Win32.ActiveCfg = Release|Win32 {90124CDE-5D40-4B1B-ADCD-4DCF309A4FC8}.Release|Win32.Build.0 = Release|Win32 - {90124CDE-5D40-4B1B-ADCD-4DCF309A4FC8}.Simulator-Debug|BlackBerry.ActiveCfg = Simulator-Debug|BlackBerry - {90124CDE-5D40-4B1B-ADCD-4DCF309A4FC8}.Simulator-Debug|BlackBerry.Build.0 = Simulator-Debug|BlackBerry - {90124CDE-5D40-4B1B-ADCD-4DCF309A4FC8}.Simulator-Debug|BlackBerrySimulator.ActiveCfg = Simulator-Debug|BlackBerrySimulator - {90124CDE-5D40-4B1B-ADCD-4DCF309A4FC8}.Simulator-Debug|BlackBerrySimulator.Build.0 = Simulator-Debug|BlackBerrySimulator - {90124CDE-5D40-4B1B-ADCD-4DCF309A4FC8}.Simulator-Debug|BlackBerrySimulator.Deploy.0 = Simulator-Debug|BlackBerrySimulator + {90124CDE-5D40-4B1B-ADCD-4DCF309A4FC8}.Simulator-Debug|BlackBerry.ActiveCfg = Simulator-Debug|Win32 + {90124CDE-5D40-4B1B-ADCD-4DCF309A4FC8}.Simulator-Debug|BlackBerrySimulator.ActiveCfg = Simulator-Debug|Win32 {90124CDE-5D40-4B1B-ADCD-4DCF309A4FC8}.Simulator-Debug|Win32.ActiveCfg = Simulator-Debug|Win32 {90124CDE-5D40-4B1B-ADCD-4DCF309A4FC8}.Simulator-Debug|Win32.Build.0 = Simulator-Debug|Win32 EndGlobalSection diff --git a/samples/HelloWorldDisplay/HelloWorldDisplay.sln b/samples/HelloWorldDisplay/HelloWorldDisplay.sln index fadfcf17..b64fe081 100644 --- a/samples/HelloWorldDisplay/HelloWorldDisplay.sln +++ b/samples/HelloWorldDisplay/HelloWorldDisplay.sln @@ -1,6 +1,6 @@  Microsoft Visual Studio Solution File, Format Version 11.00 -# Visual Studio 2010 +# Visual Studio 2013 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "HelloWorldDisplay", "HelloWorldDisplay\HelloWorldDisplay.vcxproj", "{92A45A6C-CC44-42BF-895E-93C1FD0F1842}" EndProject Global From 3f07e2b77c7c0a9be0c431e512a19a291cd6e74a Mon Sep 17 00:00:00 2001 From: Pawel Hofman Date: Tue, 6 May 2014 15:20:11 +0200 Subject: [PATCH 002/851] Typo in macro definition --- samples/HelloWorldDisplay/HelloWorldDisplay/bbutil.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/samples/HelloWorldDisplay/HelloWorldDisplay/bbutil.c b/samples/HelloWorldDisplay/HelloWorldDisplay/bbutil.c index 830d2c85..35ec1fd2 100644 --- a/samples/HelloWorldDisplay/HelloWorldDisplay/bbutil.c +++ b/samples/HelloWorldDisplay/HelloWorldDisplay/bbutil.c @@ -24,7 +24,7 @@ #include #include "bbutil.h" -#define USING_GL11; +#define USING_GL11 //#include //#include From 6e3b1368019d366f48d98a070a9cbdab324a8747 Mon Sep 17 00:00:00 2001 From: Pawel Hofman Date: Tue, 6 May 2014 15:32:38 +0200 Subject: [PATCH 003/851] Ignoring some temporary files --- .gitignore | 60 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..95ea0856 --- /dev/null +++ b/.gitignore @@ -0,0 +1,60 @@ + +# samples +samples/FallingBlocks/FallingBlocks.sdf +samples/FallingBlocks/FallingBlocks.sln.DotSettings +samples/FallingBlocks/FallingBlocks.suo +samples/FallingBlocks/FallingBlocks.v11.suo +samples/FallingBlocks/FallingBlocks.v12.suo +samples/FallingBlocks/FallingBlocks/Debug/ +samples/HelloWorldDisplay/HelloWorldDisplay.sdf +samples/HelloWorldDisplay/HelloWorldDisplay.v12.suo +samples/HelloWorldDisplay/HelloWorldDisplay/Simulator-Debug/ + + +# user configuration files +src_vs2012/VSNDK.sdf +src_vs2012/VSNDK.sln.DotSettings +src_vs2012/VSNDK.v11.suo + +src_vs2013/VSNDK.sdf +src_vs2013/VSNDK.sln.DotSettings +src_vs2013/VSNDK.v12.suo + + +# build temp outputs +src_vs2012/Debug/ +src_vs2012/GDBParser/Debug/ +src_vs2012/GDBParser.UnitTests/obj/ +src_vs2012/GDBWrapper/Debug/ +src_vs2012/VSNDK.AddIn/bin/ +src_vs2012/VSNDK.AddIn/obj/ +src_vs2012/VSNDK.DebugEngine/bin/ +src_vs2012/VSNDK.DebugEngine/obj/ +src_vs2012/VSNDK.Package.Test/bin/ +src_vs2012/VSNDK.Package.Test/obj/ +src_vs2012/VSNDK.Package/bin/ +src_vs2012/VSNDK.Package/obj/ +src_vs2012/VSNDK.Tasks.Test/bin/ +src_vs2012/VSNDK.Tasks.Test/obj/ +src_vs2012/VSNDK.Tasks/bin/ +src_vs2012/VSNDK.Tasks/obj/ + +src_vs2013/Debug/ +src_vs2013/GDBParser.UnitTests/bin/ +src_vs2013/GDBParser.UnitTests/obj/ +src_vs2013/GDBParser/Debug/ +src_vs2013/GDBWrapper/Debug/ +src_vs2013/VSNDK.AddIn/bin/ +src_vs2013/VSNDK.AddIn/obj/ +src_vs2013/VSNDK.DebugEngine/bin/ +src_vs2013/VSNDK.DebugEngine/obj/ +src_vs2013/VSNDK.Package.Test/bin/ +src_vs2013/VSNDK.Package.Test/obj/ +src_vs2013/VSNDK.Package/bin/ +src_vs2013/VSNDK.Package/obj/ +src_vs2013/VSNDK.Tasks.Test/bin/ +src_vs2013/VSNDK.Tasks.Test/obj/ +src_vs2013/VSNDK.Tasks/bin/ +src_vs2013/VSNDK.Tasks/obj/ + + From 25cdf55988862029686106d20c35a7d62a8fe196 Mon Sep 17 00:00:00 2001 From: Pawel Hofman Date: Tue, 6 May 2014 15:53:58 +0200 Subject: [PATCH 004/851] Removed unncecessary user files --- .gitignore | 21 +++++++++++++++++++ .../FallingBlocks/FallingBlocks.vcxproj.user | 3 --- .../HelloWorldDisplay.vcxproj.user | 3 --- src/GDBParser/GDBParser.vcxproj.user | 3 --- src/GDBWrapper/GDBWrapper.vcxproj.user | 8 ------- src/VSNDK.AddIn/VSNDK.AddIn.csproj.user | 15 ------------- .../VSNDK.DebugEngine.csproj.user | 7 ------- src/VSNDK.Package/VSNDK.Package.csproj.user | 13 ------------ src/VSNDK.Tasks/VSNDK.Tasks.csproj.user | 13 ------------ src_vs2012/GDBParser/GDBParser.vcxproj.user | 3 --- src_vs2012/GDBWrapper/GDBWrapper.vcxproj.user | 8 ------- .../VSNDK.AddIn/VSNDK.AddIn.csproj.user | 15 ------------- .../VSNDK.DebugEngine.csproj.user | 7 ------- .../VSNDK.Package/VSNDK.Package.csproj.user | 16 -------------- .../VSNDK.Tasks/VSNDK.Tasks.csproj.user | 13 ------------ src_vs2013/GDBParser/GDBParser.vcxproj.user | 3 --- .../VSNDK.AddIn/VSNDK.AddIn.csproj.user | 15 ------------- 17 files changed, 21 insertions(+), 145 deletions(-) delete mode 100644 samples/FallingBlocks/FallingBlocks/FallingBlocks.vcxproj.user delete mode 100644 samples/HelloWorldDisplay/HelloWorldDisplay/HelloWorldDisplay.vcxproj.user delete mode 100644 src/GDBParser/GDBParser.vcxproj.user delete mode 100644 src/GDBWrapper/GDBWrapper.vcxproj.user delete mode 100644 src/VSNDK.AddIn/VSNDK.AddIn.csproj.user delete mode 100644 src/VSNDK.DebugEngine/VSNDK.DebugEngine.csproj.user delete mode 100644 src/VSNDK.Package/VSNDK.Package.csproj.user delete mode 100644 src/VSNDK.Tasks/VSNDK.Tasks.csproj.user delete mode 100644 src_vs2012/GDBParser/GDBParser.vcxproj.user delete mode 100644 src_vs2012/GDBWrapper/GDBWrapper.vcxproj.user delete mode 100644 src_vs2012/VSNDK.AddIn/VSNDK.AddIn.csproj.user delete mode 100644 src_vs2012/VSNDK.DebugEngine/VSNDK.DebugEngine.csproj.user delete mode 100644 src_vs2012/VSNDK.Package/VSNDK.Package.csproj.user delete mode 100644 src_vs2012/VSNDK.Tasks/VSNDK.Tasks.csproj.user delete mode 100644 src_vs2013/GDBParser/GDBParser.vcxproj.user delete mode 100644 src_vs2013/VSNDK.AddIn/VSNDK.AddIn.csproj.user diff --git a/.gitignore b/.gitignore index 95ea0856..8e752dc8 100644 --- a/.gitignore +++ b/.gitignore @@ -6,26 +6,47 @@ samples/FallingBlocks/FallingBlocks.suo samples/FallingBlocks/FallingBlocks.v11.suo samples/FallingBlocks/FallingBlocks.v12.suo samples/FallingBlocks/FallingBlocks/Debug/ +samples/FallingBlocks/FallingBlocks/FallingBlocks.vcxproj.user samples/HelloWorldDisplay/HelloWorldDisplay.sdf samples/HelloWorldDisplay/HelloWorldDisplay.v12.suo +samples/HelloWorldDisplay/HelloWorldDisplay/HelloWorldDisplay.vcxproj.user samples/HelloWorldDisplay/HelloWorldDisplay/Simulator-Debug/ # user configuration files +src/GDBParser/GDBParser.vcxproj.user +src/GDBWrapper/GDBWrapper.vcxproj.user +src/VSNDK.AddIn/VSNDK.AddIn.csproj.user +src/VSNDK.DebugEngine/VSNDK.DebugEngine.csproj.user +src/VSNDK.Package/VSNDK.Package.csproj.user +src/VSNDK.Tasks/VSNDK.Tasks.csproj.user + src_vs2012/VSNDK.sdf +src_vs2012/VSNDK.opensdf src_vs2012/VSNDK.sln.DotSettings src_vs2012/VSNDK.v11.suo +src_vs2012/GDBParser/GDBParser.vcxproj.user +src_vs2012/GDBWrapper/GDBWrapper.vcxproj.user +src_vs2012/VSNDK.AddIn/VSNDK.AddIn.csproj.user +src_vs2012/VSNDK.DebugEngine/VSNDK.DebugEngine.csproj.user +src_vs2012/VSNDK.Package/VSNDK.Package.csproj.user +src_vs2012/VSNDK.Tasks/VSNDK.Tasks.csproj.user src_vs2013/VSNDK.sdf +src_vs2013/VSNDK.opensdf src_vs2013/VSNDK.sln.DotSettings src_vs2013/VSNDK.v12.suo +src_vs2013/GDBParser/GDBParser.vcxproj.user +src_vs2013/VSNDK.AddIn/VSNDK.AddIn.csproj.user # build temp outputs src_vs2012/Debug/ src_vs2012/GDBParser/Debug/ +src_vs2012/GDBParser.UnitTests/bin/ src_vs2012/GDBParser.UnitTests/obj/ src_vs2012/GDBWrapper/Debug/ +src_vs2012/ipch/ src_vs2012/VSNDK.AddIn/bin/ src_vs2012/VSNDK.AddIn/obj/ src_vs2012/VSNDK.DebugEngine/bin/ diff --git a/samples/FallingBlocks/FallingBlocks/FallingBlocks.vcxproj.user b/samples/FallingBlocks/FallingBlocks/FallingBlocks.vcxproj.user deleted file mode 100644 index 695b5c78..00000000 --- a/samples/FallingBlocks/FallingBlocks/FallingBlocks.vcxproj.user +++ /dev/null @@ -1,3 +0,0 @@ - - - \ No newline at end of file diff --git a/samples/HelloWorldDisplay/HelloWorldDisplay/HelloWorldDisplay.vcxproj.user b/samples/HelloWorldDisplay/HelloWorldDisplay/HelloWorldDisplay.vcxproj.user deleted file mode 100644 index 695b5c78..00000000 --- a/samples/HelloWorldDisplay/HelloWorldDisplay/HelloWorldDisplay.vcxproj.user +++ /dev/null @@ -1,3 +0,0 @@ - - - \ No newline at end of file diff --git a/src/GDBParser/GDBParser.vcxproj.user b/src/GDBParser/GDBParser.vcxproj.user deleted file mode 100644 index ace9a86a..00000000 --- a/src/GDBParser/GDBParser.vcxproj.user +++ /dev/null @@ -1,3 +0,0 @@ - - - \ No newline at end of file diff --git a/src/GDBWrapper/GDBWrapper.vcxproj.user b/src/GDBWrapper/GDBWrapper.vcxproj.user deleted file mode 100644 index 79ff5bc5..00000000 --- a/src/GDBWrapper/GDBWrapper.vcxproj.user +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - WindowsLocalDebugger - - \ No newline at end of file diff --git a/src/VSNDK.AddIn/VSNDK.AddIn.csproj.user b/src/VSNDK.AddIn/VSNDK.AddIn.csproj.user deleted file mode 100644 index ce8d3677..00000000 --- a/src/VSNDK.AddIn/VSNDK.AddIn.csproj.user +++ /dev/null @@ -1,15 +0,0 @@ - - - - Program - C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\devenv.exe - - - - - Program - C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\devenv.exe - - - - \ No newline at end of file diff --git a/src/VSNDK.DebugEngine/VSNDK.DebugEngine.csproj.user b/src/VSNDK.DebugEngine/VSNDK.DebugEngine.csproj.user deleted file mode 100644 index 59536a59..00000000 --- a/src/VSNDK.DebugEngine/VSNDK.DebugEngine.csproj.user +++ /dev/null @@ -1,7 +0,0 @@ - - - - Program - C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\devenv.exe - - \ No newline at end of file diff --git a/src/VSNDK.Package/VSNDK.Package.csproj.user b/src/VSNDK.Package/VSNDK.Package.csproj.user deleted file mode 100644 index e7613c65..00000000 --- a/src/VSNDK.Package/VSNDK.Package.csproj.user +++ /dev/null @@ -1,13 +0,0 @@ - - - - Program - C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\devenv.exe - /rootsuffix Exp - - - Program - C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\devenv.exe - /rootsuffix Exp - - \ No newline at end of file diff --git a/src/VSNDK.Tasks/VSNDK.Tasks.csproj.user b/src/VSNDK.Tasks/VSNDK.Tasks.csproj.user deleted file mode 100644 index e7613c65..00000000 --- a/src/VSNDK.Tasks/VSNDK.Tasks.csproj.user +++ /dev/null @@ -1,13 +0,0 @@ - - - - Program - C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\devenv.exe - /rootsuffix Exp - - - Program - C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\devenv.exe - /rootsuffix Exp - - \ No newline at end of file diff --git a/src_vs2012/GDBParser/GDBParser.vcxproj.user b/src_vs2012/GDBParser/GDBParser.vcxproj.user deleted file mode 100644 index ace9a86a..00000000 --- a/src_vs2012/GDBParser/GDBParser.vcxproj.user +++ /dev/null @@ -1,3 +0,0 @@ - - - \ No newline at end of file diff --git a/src_vs2012/GDBWrapper/GDBWrapper.vcxproj.user b/src_vs2012/GDBWrapper/GDBWrapper.vcxproj.user deleted file mode 100644 index 79ff5bc5..00000000 --- a/src_vs2012/GDBWrapper/GDBWrapper.vcxproj.user +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - WindowsLocalDebugger - - \ No newline at end of file diff --git a/src_vs2012/VSNDK.AddIn/VSNDK.AddIn.csproj.user b/src_vs2012/VSNDK.AddIn/VSNDK.AddIn.csproj.user deleted file mode 100644 index 2049613c..00000000 --- a/src_vs2012/VSNDK.AddIn/VSNDK.AddIn.csproj.user +++ /dev/null @@ -1,15 +0,0 @@ - - - - Program - C:\Program Files %28x86%29\Microsoft Visual Studio 11.0\Common7\IDE\devenv.exe - - - - - Program - C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\devenv.exe - - - - \ No newline at end of file diff --git a/src_vs2012/VSNDK.DebugEngine/VSNDK.DebugEngine.csproj.user b/src_vs2012/VSNDK.DebugEngine/VSNDK.DebugEngine.csproj.user deleted file mode 100644 index 59536a59..00000000 --- a/src_vs2012/VSNDK.DebugEngine/VSNDK.DebugEngine.csproj.user +++ /dev/null @@ -1,7 +0,0 @@ - - - - Program - C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\devenv.exe - - \ No newline at end of file diff --git a/src_vs2012/VSNDK.Package/VSNDK.Package.csproj.user b/src_vs2012/VSNDK.Package/VSNDK.Package.csproj.user deleted file mode 100644 index 5a0d800e..00000000 --- a/src_vs2012/VSNDK.Package/VSNDK.Package.csproj.user +++ /dev/null @@ -1,16 +0,0 @@ - - - - Program - C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\devenv.exe - /rootsuffix Exp - - - Program - C:\Program Files %28x86%29\Microsoft Visual Studio 11.0\Common7\IDE\devenv.exe - /rootsuffix Exp - - - ProjectFiles - - \ No newline at end of file diff --git a/src_vs2012/VSNDK.Tasks/VSNDK.Tasks.csproj.user b/src_vs2012/VSNDK.Tasks/VSNDK.Tasks.csproj.user deleted file mode 100644 index 495ab0c9..00000000 --- a/src_vs2012/VSNDK.Tasks/VSNDK.Tasks.csproj.user +++ /dev/null @@ -1,13 +0,0 @@ - - - - Program - C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\devenv.exe - /rootsuffix Exp - - - Program - C:\Program Files %28x86%29\Microsoft Visual Studio 11.0\Common7\IDE\devenv.exe - /rootsuffix Exp - - \ No newline at end of file diff --git a/src_vs2013/GDBParser/GDBParser.vcxproj.user b/src_vs2013/GDBParser/GDBParser.vcxproj.user deleted file mode 100644 index ace9a86a..00000000 --- a/src_vs2013/GDBParser/GDBParser.vcxproj.user +++ /dev/null @@ -1,3 +0,0 @@ - - - \ No newline at end of file diff --git a/src_vs2013/VSNDK.AddIn/VSNDK.AddIn.csproj.user b/src_vs2013/VSNDK.AddIn/VSNDK.AddIn.csproj.user deleted file mode 100644 index 2049613c..00000000 --- a/src_vs2013/VSNDK.AddIn/VSNDK.AddIn.csproj.user +++ /dev/null @@ -1,15 +0,0 @@ - - - - Program - C:\Program Files %28x86%29\Microsoft Visual Studio 11.0\Common7\IDE\devenv.exe - - - - - Program - C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\devenv.exe - - - - \ No newline at end of file From 96d998c03b3873420f3f32897fd6900b8839ef17 Mon Sep 17 00:00:00 2001 From: Pawel Hofman Date: Tue, 6 May 2014 16:27:28 +0200 Subject: [PATCH 005/851] Added NUnit binaries (and updated proj reference paths) --- ext/NUnit/license.txt | 15 + ext/NUnit/nunit.framework.dll | Bin 0 -> 151552 bytes ext/NUnit/nunit.framework.xml | 10960 ++++++++++++++++ ext/NUnit/nunit.mocks.dll | Bin 0 -> 11264 bytes .../GDBParser_UnitTests.csproj | 5 +- .../VSNDK.Package.Test.csproj | 5 +- .../VSNDK.Tasks.Test/VSNDK.Tasks.Test.csproj | 5 +- .../GDBParser_UnitTests.csproj | 5 +- .../VSNDK.Package.Test.csproj | 5 +- .../VSNDK.Tasks.Test/VSNDK.Tasks.Test.csproj | 5 +- 10 files changed, 10999 insertions(+), 6 deletions(-) create mode 100644 ext/NUnit/license.txt create mode 100644 ext/NUnit/nunit.framework.dll create mode 100644 ext/NUnit/nunit.framework.xml create mode 100644 ext/NUnit/nunit.mocks.dll diff --git a/ext/NUnit/license.txt b/ext/NUnit/license.txt new file mode 100644 index 00000000..b12903af --- /dev/null +++ b/ext/NUnit/license.txt @@ -0,0 +1,15 @@ +Copyright 2002-2013 Charlie Poole +Copyright 2002-2004 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov +Copyright 2000-2002 Philip A. Craig + +This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. + +Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: + +1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment (see the following) in the product documentation is required. + +Portions Copyright 2002-2013 Charlie Poole or Copyright 2002-2004 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov or Copyright 2000-2002 Philip A. Craig + +2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. + +3. This notice may not be removed or altered from any source distribution. diff --git a/ext/NUnit/nunit.framework.dll b/ext/NUnit/nunit.framework.dll new file mode 100644 index 0000000000000000000000000000000000000000..780727f219d08aa635e12a56a326850ef82dbec5 GIT binary patch literal 151552 zcmeEvd4OD1vG?hFZ!gocWF|A2$wD%d{W3k11wtGWS&Xvp5MvSogb=m}bnH$L(oPJr zh!~Jf6a<6_2!bFA0*VNV;DQ)Y5S2F|PknAE?w|~(X@v#?jM+wF3gw)!A8NMJ(yZY z;D}H2uQ*}-PRIP@^V`pk?L6(k@0a#>f3bOo+jrUUdH05I3>|%D!-THOANb>_k6fQy@yXYw zy|-zPFaF`cz0UgWCBJ#{s4J&;A2;LSZ(s1h#qYoHt`kq4cSqls|8)QEuN-{o`csyf zb9)`X&6pze>)pvzGRCZ}wgcV(;MfpAY&+)A1Na3+n{hf`&2+w+DdzecHgzdKVaB48VU|{u816#-w}&|84nC zhVomI@)i8Iv zrC5a7^OJGBd_J&51 zG%%`eE1rCW=Ln!ci^08pI9r95{T_05%MKH3>CEcvG z6Vjb9$1_};f+B6Eqv-nQ!~SRn?b)_$|8Bn%_Md^CG-v36AHFY0t&|n;xbcl37P1^VNZtjGShK!nW?x?<^qlr*%r_5p-a&_U%-wy1X7Jd)gP7d$DzYM zCB|`h92=0vks<%y#&wcPN0>m>5ECl+K3j>TZfi{{?~j%f)}#>$0+}NbB$ANY#AfM8 z^{P)|Sb}&G!x1EskjkY=@UcFLVF}_%3`dYiLh70(!N>X}h9!t6F&sf638{LT1Rv{@ z7?vQO#Bcf>Y=~ zToN4$k+!f)ywi*@0c(f}xguc)#9K)U9q=d7p%9L8lEK;WK_ZC_L?o~Y379fZ@arT* z*tmoc8%n_VQoT4nM23ifFF+(%&P}rjBF;iY$O7$k)Z9DHm&69l3G9DR0`rlHyHOz` zNI5{n6BU-~D=D>O*nk;oN7zt;)SN|iwM#GoXGjxrtuapIbNVC>{efYk0y*_jp}?pD zE=5klPCbPV1SQd-kd3wwBh|{37OFN3WO8J2b$qFlnU0IgOvNQ+a>REx%eY@BGaVO~nTiW#a(ydVG7%== z4>2KEswQD6IqK4eiwh(T6PJ(~t4Vb-({XW`skns9SWT*vnU0IgOvNQ+#%fZX%ye8_ zW-2ZrGgg!8WTxZdGE;F0nX#HwCo>%vmzj!7$c)vbI+^LXxXe^sC{t=zLQ;eY_(M#{ zm8wZ^+C~kOxIoe{dA1MeR9r%4tR~gTOvlA#rs5JZ zV>PKxW;!k|GZmMR8LLTkGShK!nW?yh%vepTlbMc-%S^?EGNpDUBt@8jKg5JwshYH4 z8#Pek0!hR0C1l2GQk~3nTwG=xqA1MeR9r%4tR~gTOvlA#rs5JZV>PKxW;!k|GZh!gl-iY$6k!7X5EJ8ao$9Z!4Hix( z=$tDi;$5T(i``rOL)L-#E zBj6{GfS;1U$I_h|L~xG=C86oYC#titxEbypsjaZ!&}ORGLQ2^RJLSM%SBFP_fd2ss zGO(=!gq$yLGo3Q;s6HFUvaB?|nS3_>7m0Y)qebMt6vhN)JWB8%sKd7k{u6cjK^N%v zLv9b-{XUhCy(Hjoj?wG+eRK^dv+75K1gI}GhcCDe^C}$*mx6-eT+nMw|ia$MF$A-hRJqx}%3u1iq&^fn!Tp-bex?zu# zd0Cs5IUJrc1s|8Wx?U#sSt;|wK}=A8hQm{);Nvn+2sk4>r>e|D(s~Yur%b`eWu8?#vqP2;g!P5hb&?;5mAgH3qgy(-GHC;slD_`6N^Eb895dbq^XeA4QDgt#E9soKtQKZFC^QO zA3-_#YKLQj@dMdC4kJZ)P)d%^1P7%oAm?=6Et_R>Or*nCfcxxoVM9k`>N%b5IH9BG zg0Msz*$rx{$RsvMD1n9Dl$KslU^loGsS`SiL0cJCN2t8blQXJgJOwxcsT350{Ev_Z zjx%gW8ogX~Sue&7svgT~KgdO4!&gEw9?sFg4_jz9!i^xH2h}ER#R#qENrcKr=Tlrq z+$Pcqu~Y5=5+~tehvGQiava~0@|`leg`$66%0(dNu~^&7u}9BOk2cZsi_cFMlwbJVn}Svcb36d zRPh$rfa6jk^=|FPje$e1pnd_Dc1<0BOu(@O!LS3dzHB*-$G1kk2pbO~ROyz3u zJLTCRF3(|rmP;2OrPi(J%2rU6cLLf`q3bYk;c(KZt_zv7rb4H)r4aOyG%h=h7r~>a zE73@6FqenU^cqB#KS~>+dvx9dojreN$en@BaQv`hv5wx3oQMK#jO-K5gWS5l0_ z12*7eK{1W;RU-Ugr+PIW28nWf92o=&=F~MfdY)SzAnerO-Ff9*@jQddbPl2zQ2a40 zbjd`zl*S;nk4d6Rw1BLTLq0UZpV(NN2bj{J0NPAxyiK^g5De=uwm8LH`C1AJBHoM$ z943Xuzu$Yi)1{hJcLUbn9l;>gb~>wj@R|DAW30Wag7d77I|!f6bG$(elb-3tnS+`j zYJ|&sf-ySsTHljnOU<<>$37wUv%R?j%MmO7Vf71ecEXWt_wY>9O~Nw^WF5Xf!`2<* zPRpL0@P#`Y5#KE_K7Hoi9^LsEF{Y;U%k5~zj@PrQ-XZLZIGrVh$Md(bV;dSRvt5Y} z&M>Zu7;XYvG+@W9@Y%Q(6c9o58bbpd9te_54x`|`A_Zf+Dkx-WEtLj4O>vq))zbsC z=TlV?Fs!~`jO(j_h@`%nY#=h0$p_+03eddC)q)uPLveZqq-xLw9x;)J<4g(&6aDNF znI4TZDIl7WDKtOp3a5l&UC|2ob>WRFnZjt`LM%z9IKGwQP?+NB^{0p*PZ2AOEGe=7 zhq#Ki8GToHVwO}yFsf^x$GL#a9dvQVj(a)}?O{LSRKqz!z!@B3uW!+@LA|~Oz)N&+ z9`?spEjKuus0ir6wI9r-48{beiy^;Qbma$!s!;$+XmdA|&YdDgsM0p=pQO`P#CD{u zgf{J;rqd1))eGyZ#{UR)R5cW4K{JOaXhmo}`c;ZpVb&u`9f`XP+bJgH$<-}v{pXLs6Rzf<+n0#5~Ae( zA}O(a|C4e%Vsa1t&*^LXdDU5}F=uaK2Vm=fM#oy$|4tsW{wx1Wwu|Kc=WVC5r7hBS z$sX4lP-$WYRK&mBxnP9u@Eyz}O>a!7BH%Zo?!66l1YRcELm7|7B0O3CHX7+&gwhPP z@+ARyv$0nMhFWtLmkVAS=*?gP;ow4xmPvA}1)d9Zby|^xu^G&!bx}lG7k@9+MSlOc zbSb2DQN)P7r5Lj@&7_F!u%!_GCvDl1Rz(rpW6S@zE^TRD6tO#|j{0vC7C^n;V6KaTE)BR~z#lhUnt#l&v_hxrl-3Q@@UeaTFV(DGKlL_i*>F)~)osb0V3nF&um7|0? zk6?ww1QctD;o4m|w@ty6>?1ec0#vX}N4Yxpo{BHLii8I0;iL?ECBt2So;k<=9 zu#HYueBJ&8)(%*VN4i@kft)?!dEun41L;w9k4(i!@W{XoWbC&rfd2Y@#k_i6LW2jH<0Z>d6Z z(e0jRSMk)_mzN|*R~|rjnRk8o?8WLq2sY#jc(Ib}d*y=>%)pD0T1|+da-;sNU(s(t$f;0*Kv0d8ntpP2hV^x7GqVGI$&SsLL{9jb~cupb9txycCcKZ?^@cJcVG3I8~T5p zYbu$7zUMg?JXip1!@}RPVpjMXJDW;v`GWH0mb*)@FLW(!Dr8^v+PyZf|7ZEYKJ9a| zTnp#B;B6**A{KfZIVe5k_g*dI+046UJ;TA>4!~ZeVR!Tk_a1bI*~Kd^oo!~ zNIz^MwKS6=LQmPha+s7hrkNChH|2Eb5~g93J1fnp2+0#Wo^+nDbe}Y|B1ApX51YvQ z(@ctpd=!WK0|txIZ9#Y9YRkd`bF0&Jp^GZmm>)z(<&{tg<-x#D^<*DqL5$B57jvEN zmRyXk2l5kiV@0Uab$JO|`pOB~aVgrd*%-Z^e<3|OIcjM84aH;en|SO*CGonpQG;4Z zJl4cXkD(%o$ErB-7%GOvW2hJwkE|r|HeKui4U0!tlf>I}(Mbn**P!P%yNf>lRVdkw zI4j_lm!ZvTnPEM@(}`ka04Ogz`Tc-%o68QTaw{80)WzsARCXjp8M&Y?USGa%$R*Ak=KRve8z5+4m7kAt6R z_4BWUt=#eoq&!0@*tbXei*3-q9wnBF^mk=Va?i-#t|v#0l7y5M<*(!#Z~VB{UD>98pF6f$@^C2#p5u% zpCd1$oEpQ3SKt5NO?jD2_CQ!rQ%z*wR2`$#;zqbQz07|$|uYVcg6cmk<-c#2Ux zfiRx^t5buw7{wEi_*UdRk9fNl5?k*We!qk50UMd7C*r|~hZ7|uoqckWXP?N6{w_#Q zc}F_ql$w8#cS@Rfq_a$^ISP4EJCf;!XO@CdACB)zv~K@c_ID^ktXg)W`}+EST zsd+Q74Jav!&+eLoZ939Lz!P~J&aXI?Kd=QHN2T5AUCUZ=_QcZ#v7cu98ndbEk>Ea| zM=Z8Fj#pkS8SUL4srY}OF8KYkfup~30d(4zwsp#nA#x+y zoVRT3vSLdXN?@#P8kHI4s1A5X>63Pm%dxOqCKxon`3+!WX>xwbx$5>WM9@ zVjCTKNwv^c49cn(^$r7=V^*7Q&CbAu)3pgW1-8w~wqbKSGb zWjtshfV{)WRpyfha*J9JrP07GNa8q`Or-rTkoPybeno_#oH}jVRUmBIi^8lTxCU)s&@^EHloNp&F|?T(hT*U4r4~0x$Bf~#%T-; z5Ylh=>R!8yBq&4X6E#=MEY22;0bXChD}Nj_c^x_TFivG9R4IR-T@FUED-fllg;%~D z&s}m9v&*TR1S&;sz7O?8%QV!2I>L{%0}gb&C9Y#K7OFfgso5O74?0vJy}MtAJ9p{W zWnD|F@1_CHKp=jBi!uF57wP|lg+{FlvUX=&= z#BrQw`!Fa+^NiR&l>ahJQN|`)v^Pe6UB6#~f|LWN{%fF$^G7t8 zdA}|V@;w4gBho@{;mdspYHAAfOWOh+L_eo|c%UHg^sl1y3s?{yPDho2Rbjlx#5_7> z-UN`&gT%-7zVKNLr3u`~<&IxtC7@UF9y|;l0ZX$zXAK-X^%DaM-17m7@?b#b)JR-e zg90jV1QH!5+`Jx4A&KwQpE7Gpcf+#sdjmFBxWI?Bb3D?E>QIa7a1&I1F|i8N8(b`! z)$tN7yg0q2w5Ip;;1M1v3NT!crcg>%WH5;TNjG*+Ku5;TM`EeNbx!3poRgDZi= zMU)}dwU{~^lTh-OmT+vH1jVFmLu9&);>lvR5zLtrHYGl?DWUp&VlEM*AyiL;xkHSG z5D&2Tun)!5iF*c(CMHv^4Fo>(EM%%4h|;gNk7r$eK$thVxkZ!kb_pIQ;{wfPz^_mA|T~po_M$S(Y7G zgt&ri$w^01d71{m=uqq%Q;_>)E29e*W8GKYe+u7S#dT~MV2_)#BF+LMol(+c2Y!xZ z3+v&L+X<7PzZIRn$?}#`pys-o!bh}CH8^^yfTr|R9KH8ic*_P$LF@T zCy0ciyRe?svcJ6`GsFJIkON*$b7@X)>y81_EF=R5bC_g`%FJXMf?Rdjj2CkLN@Ui5 zAA&7LcE>d4qLbmkBmWC7c=ff{6lHI8-QaY}wt~MI;+v{ zAPmA2?=XeujD0;~SewMKC|AZ+GU|nAJ`G#LPobZE99;*e#z@Y@_Hq&B;EzLmAO7$z zsZ*nFqwrZiefvmT`f|`7s}_* zanaz0ity8K19`AI%dHx0b3wxqSN>6tyUYiZHR#gc1un@Skd zrQUOzTaZ3&OCh_oDUWFuwlbgBzUctSM0FWf<{Aq9{x+pzh|8$dH7fQe=#*&lV<8v) zUP^9uD$vI4`Jp|JEQ;Q_rHU~x?y>abMkgOjtO+&TW}$#AG&RTy|CWaA(&j?m&f1?7 zf0*elgIG8w>GY-;v*B%FT7WifM>?=^rY@bj9x*;7z6&*m_Dqb2L`q-0$f@jrp2Q9N zVIbxu5JB%c(l7je{7?CLpwiSZleOhTzmX8SjrI7!uo~JEJv`GP+NR^ld4abp9)7adH{Pl7 zx9dVQH!LZ3cK2PAFQ1DxUdnU`Q%s)q_ed{M;(roCqCp<4UyE6<(uiM62+lfx)UU;y z5KIA&l}n_^<+0pBLQcmZdE$Apw3tuEbRZPd!TPS455#B)#b~UY4G9`T^)x8hm>fbe z8f)YCBxnfzYczuiIfP7ws@+9y!PwxxxQl|*PS?=)935F2V71u05 zUBoy7pDfU!5APD@ba)=bz~rH0nd#=PTE7Dn#12F5svG$PCqSJb_@$nk>)3+j(jrDc za&X)S`kQfo)ary$Fjnq_>h1jg1PvjfNwhO!+0OX8UG2>F4^%HbbO8I8ZeW?HN zc~~|V0vnv-Sa22a#)(bG$|&LDAZe7cvKHo-m6QH47IS)lk(R+#({9udvcPZQk4)ai z+SQbpsQ1Je!Noq#%7fj<4J}{-HSK;o$^*VoNRa8?_k@02lEzwu>ptm=IZAf z;K{jVw4UPT0*K{<4e~jS#-VBH7cQ{46cO^18#vl$c(yM%OE`YEzI#DGq6=win{wYp z$ts>)qV4X`vBq-NRZfmq4);sVQYnM-tt516ETF#T%B8SN&POZ3$Y~E0(znCVME{Ou z#yW!ib{7~2e_VOn8Gj`sE02!91@c5dv9wR+E{Ic+S5SeatQ=^U zqiRvw4t+Rtl-iWWkDcypHPtRIPGXUAJbp35t=^Ah%Hs&+s67)<;~HNo_)<)S;`ZkMk#{>y&Lc#snUP)q;74C-mBI^2I`5i%^Wkb ze33k>dM~oJiG7y%;Emvs@vZVx)FB~3C*FqA)%x9yc(w_6o*xGz_T5ltu-Mv!mcuek<=|&i2{CH@*-2%fj80xV;ZbcQmR};IPQDds9;;Ka`#+O$vm`hD~W)pn`(fj`Q`&^zI*)E%e9Of#Td4bakww(&hOuCZ+(k>*K=Z zSF8nCSDn~HjGE4P7t zm=?kVBPcpaTXy}}U+DcP+MhfSCaZed!AknnSXl)93hLf9$Va>^2&c<}xRJ_YALRMC z5z7L-!pLPov04^#5J(0ER@0w{nMYnlAFZaC_uzeIbcay;TJWNC_&9#pA2@PX$?CWs z{Vh(7R65*Z>5>xpTEc-2G?wg4A9*3t#{gYRLeZ#dmd*i+mUsn_$7{)urr%R!`|oewvVIl1x> zs)$r2>|S-jFBrUDvil?3b7BiL!n*#CgASE-r~~PpB&L?VZt$pxRA$*RefFD{yKg zjbQPF;3}1-V^YQ_|Cclx>Ir(PTp!%@e`uC@Oop#KvB$eBt~8mf(wLuTz%_USP>!!v z*s0*=uE^5V8zUKgcg%0P20uyCSY4YI#<@OTVYagDKt6}v!HppYWyR^yhm^nm*o5OruN`D`uRI5fjL!J* z_lh#o>bu!ajR~N8mE&3a+Pyl(%2id|!711~uo|=*7E&v<*fg9}d4quNZ?}a}MO6#`3G&j)*FJB88o z_w7i-mIcu`BmxiJdXT6P7*lm7c2-)N zF{hCluALl;uDBs0_w*>jS-=YUERcI?a&f4O?u|^uldudYS#^!;2B-J`fo@DSq1$zV zZgAUVB)lE=4X4gr0*Rx8#RDxDN6H2MGunt9`-D5H8!WdV9`&a*xQ%!j+oJdj!iMft zC!uTy@1SB%bt<1f6V{FR9KCiY(Cgoh+Jo0L75FLuI2ITuL@Cxwwnuc^Sc6rX@~2RJ z(E5b=OG>Z(ZvnZQz-on6p-;1p?I1vnnz-f38Z$^ftz(W^7|7nXxEl3$%QIpUuuyzG z+A9o89Z!Uus@PQ$EBAm>R6zH})CJ*|Z&S@fjF9ByfIPYiADNPbj@)>+99F5)W_C_9RG`7`F_cBWRoT^cWqLzT#9d@)id_7t;aG`dt8n_7T&CRAr39 zb-Em*x=1{RKPwx$5aX87{o~ypr$(_s6_Gl^@#pjy@2AL{>rk4&O2J?$3&w+Yi)!eF z+9;H>e8oUsM&9k(P2~|Q>$lRm*+Gx>lJm2CMC0m`v$GEN3|wN-Z4&4T^>j4~t{#Ef z5|c?ASsO6g)irHbC@^{UQRJYICA1ywv!sDMSY4`LgG9fCNGtZAjsN`X@PGSt;vcS$ z*SVeA%B?<>A_(SwY9qJ$O~%I#UDMXgpT_IuKgqj+67g~Y&^F>P=0!i-h`+8rUiA<3 z`|>dQb%y$Jb;};Aj$IfO;}eH&NBpkIs=P&U(VkUA#& zClb95&Qnkk0~%Cxj8F0b1*Q2yJq^Yt((q#nO0zjmqw9YdpFk7)u!2%v98j`MF+JeD zV?V~W7B#*%={&Fa<+#?%R@i#plO9g5vGN@1pDa69+c+ty0o^32Kg5`TSJ}CPsr(k zeUv6@Gjbb}CK?h4Ho*KzQ16-J$)ICMItf;y@n8NYU?wP~Hg%d91H!vqHmrZ8go4Vl>)TCkl<+ zE~_Lbh9qGf!k8y=coVM@9Ul?}`fLwPx0SOtEc4UrvB3 z#q3S{Y!A&8D~I>Us6K;ra<+$Ns+GgLTU5@?b#k_c25W3$A6`nOa&D`WGu_hgN=~JL z2b#+J3`?^nr1^A=#*_7pnM$J{sZc=}a&R*{mI^pWe-Ji&x6st?fq#SL2l%vH7+dgh z#K6zPSmVWB5tjE)cLM(Nz{@=jdgriHyB7${+n>*sFNLwO&O1n{rnJ~{$j#A>0PX|2 zjBMjRs#5FdtPjnLO*q=jrSe9=m}+5D0k6RR_t2=(*;hN!PA3FwUQS-6LJXzLac5l< zsF}%E8w^Xv%%K0s*xu8fDymI!kST^!M?^9Mx_5-J&S<^v8e}f4nZ*Y{y4GK}`^^4n z$e8XbixF{Gutn)cG3YtAW4y95?H<6Hw1+Oxq~i-*qu)k6{D^JF%O1cs_)*|>{Pb%z z&r%d_8PzM;#^BNMPM_x-K-8=26Z7!Mc?&G4XAV%-b|J8}auX&_l@~dCS_CN@urUWO z#&fcR80@W$-v|D+TF)3)EbYRR@{C`GStEaabP~|Onpw^ssF`(=h5dmN4y6id=iEkp zz?pGO>o5iTET&>yRK;UHH=-n&oS`D2e6COHv)@Si_!y!~a>f9uV}QdJFx!M|{)Vaz zz1<9D(H@5&b|f9I9ZttcdYy1+Yj|u**8li=LC=9E>jI?y`vZT5*wa5Bmkz5UCC5J( z0FU0hAI98_ils-j8iyv;ozjX(f`qgUjWHcN>iI0DgGo=a+>RK@PSNqLxUtfwx+04m z^ZFLMd^n4x(owUelL@k9Z8z6UUt+T87&5opLbPX2+{)M%u1K>^$}0}C&uuqa(X?$f zlw%vR#*OjDp4~Y-$*82!hCAqjvz%-SJG!>A7x>Q9 zc9QCOv8Y#&FT5AAx1`;24>F`1QxeHr$8kMO_1vhdk@25xceTj0=R~xZ2TyCIf?ULo zNI3p^U`};!iqh^4%3e!l=`$Pyxf|kg*HfXy{w!>s5T7f578UcNlLz6xd)TeTDgvP| zNwXpj7g*H@p`HXgWHi@1Ajg`EcJ*X!xfZiiJY{4oI&0Hs+?<}EaVvw6;?$Uol(nWL zkLA1A`Iz42I7cd~b*fIfJ1%{oBYP=QmbR19t26Wz@4nz4p>V}si32|mKm)rT#Iff+ zl8>&zF9RJPdsx>FNZ5Bjv2R}kEO$A|DX2lG zQ`g{E_*3mA=Bs>+oj`dIu#UqW)LqMzM0NY`w3Wtps=(NITE{y9X<3Jfb+sS7@cQ6) z)u@uZwGWFlR(_3~>7pNISeJ$>ThU_6v0=KF`J+iP+NzG`Bili9<#y0qwH-7c+YTCB zcx6jNvNo*F*K7yPwe>U@AZ@w0@)44_?IwkBHI}KKnUGTv$%7NrXLwqAN83wFPicE; z={0RHExLv}xt@WKp7aeRi%#u9WYl%uBlV0YD#RW~!?n>U?Yukv+u35Zy}IVZfh84G36Q`9wP zmLcAceL2ukCj@;h+1SKD^%@7)QDy~M3H>{m#{ralc$^}eJWheMCXlBKrp!u+TbJ$> zt_y_=izpeU#NY4`2DrwOi^!~m;JTY!rRCoG$(Dt`bu2_?*D(akXM|;@S_Pvb)NYr&nK@(nLg`8%0ANEfz#`T+5knLeJ%5cmKE0sc26YHG1oPt)XZ; zn7B;NRXz?$vBN}C%;J&Cj&Ct5{Ega#aDiHiKQH{+isW!oiXUI*3GN(1ayz&!-o~#( z+3+2M+?EEtQm!aoYrn~@o z0h$X9TwBQX<#^~3nU=#W^SiJFFgb@So8F1y&D&pl(#6I7QEgdV;)Jtq_`N0Wh*f=joXsl2%FoCwd3GSXIsvH5p-K{a7Hf8Go?KYs#r`yo?PDw zvz+4UYRjhtzy>@EdIM~Lxh?z(wLz}0MRVRI)fAb;A&1sn&J{h&_aci;rK+oT@) zLi{L4Zg+L%#qK69mIQ|?cL)wuy0};?xId4_Ci00xmOtF~AB{fLea zI>9kvl5n=BGMn&wwv>PM%WT`akE`cMEdHSp@K})2DFc0kSShs9%&MDdt|wc(kE zNpR~synf6_(06i5fqc5M_mmNxYDC-fC>+?SU7YLN!bKkV)xo|rk>J5JNRt!W?GnUC z2To$=Q~J6hbnF}o8f)BEE4L{FWA8t6#w8@LJLAGPBxx7s6jRBf*yjO0So_Qf^uS2r zV|Ij9C(eG7M^7FEBCuB|`DLb8FbO&9Ju59Fk z1uynKJp2_M@qTLCy$^g6>V(BPeO1DqXWPZhIxgskJf5cy&QOuKmSq@j}TQIURAyq@(54Z|~?V&)$wKS#fh(C z5k-!YqSKiSAEE^*H*v_J=FZ>=+|(rqkt{GvB3;)F@3yq8;UPJWj8k3e;G-*{?O4y|%6=Tk@! z>y@hShpfKx3w?iN^_5>!dxrY%A^O_KW)>I!QD@@fIujP1`4ACilrW|@<3(>iK+uo* zlaZfgJ_eh5y>&h4{6KH9b6{W1w_R?QIyDgrejuPtVXn(yzBMNwz0_5oOCbu(A3fzc$98(~Ep# zySs>6T>HE96(;FcWrow99k?I#RXA)#yd{B|QLzcPwl?F~KAf0h6K{CM^ND!oHL(5v zgU!ND0D4k9-+g2meoJu%<_o1+(bck~Y{+-_X=EPL1es-&A15uycs*eG%<1l?j*426dyc)NgR(FE|;4YaZ9wZVl;51$;_L zQqZa&+2LsDd8pXoP)XX=A0Iv$mXR>%LkFj{yBE_K%Mr`?NhO<|rp|1B?2*faqseg& z^$PwUFmfE`y5VE5_A9LQmq=Qgl!QLkU5dqQzw4B+{R#J{*a!eu)99W@6OIW?Hh8as z4X&U+STK;=_8QP<^hb9-6ZfPV&=t`ET@G~FF$mCfLyru)aQ?OsziiXN2DU4g==C+* zOU@@C)&8;WdYC9fB!B&P0f_+xHAVVu?sL75?czA##pRQoqxft77a%$suju1%Lb@vx z>DoCfR(R@s{J4kTT$(h@d;Vw{U`)R1|Md2}>aS}HJDI+tqj&Klk3H#r(@oYx1iJ6D zL&|mmHE#h4MidUXm(w`12^CQ2o@9ETc9GK|S8IfRG2R}aDbY(*u8vudeZ_uA8&iX* z+;ohh5pdvOj;<6Wwlwd8gxHR0F53SSUyG&qA{EtADo_HKwKutepY@QVMoi8Ej;RoZt|tJL(eb3%*BB|@TukSs$0y0Aq$p(!NSn< z8-(R$*ugtgF6|x{tl~FT#&?E$g<>O$i)^Lh#yLJ#oFR^(cc@{1K)OE^EJI*h z1S^YMwD+E{+hx)=KBh;{TC^(%Xg%{)2p%J%bTDIqr zR?ZA8AK7>oga1Q}R*j|B$_1z;mB(0B;Kmg<|;L$b)0n4`j$zd$yjz<5JWJQc z3}EtCY#R6!PcD5G?;W0`&$ zW0I^&8m0XL{+}WK6vvkztwW7@n>cNjszOcml?68;Xg<+S4IHf?pLA5hoOU4Y2>cD) zfPh;59J1TJfg1tZ)Yy?At81i`WX3WM#W*kPI?GBf3Z@aaxbnIYI5U+Rl0z+v%q`r=OykY;G7ilSrYiNx*$#S>6YIKN96JRhAr?!-oA! zq}epUhHX<~i<1n}dz3=N(L`OTv9Fkwj-mR(SXvzBi$_YO6g0b}Kx$@+{NUqYxkzE3?uuWhg zHmh!d|9fFMU}UENEUbI&xzX63yOc< zReaG$x4(eTnzz8#R}*g+38jfPdwuR0*s^(G8lq!|&EZNk4`4QoS|BCU=*h2GzDrrL zRWk}HG|P1m?)uKqRg~z_?mA+;@}Hn-^T5|&T`x`3?g@=6G{-j&Tn8du*Tc8&;!I%C$&Aw<rYL~UvN1nKq3>38yVfKU$SE!(DkIWnd#n0q$i;d z>C%1sFX5rVf0>{+a5e35LCZL)Uzp)r_v0( zVv&f#AZ4RKCD*6fMKZPn$GjE#TrX|Pp9~4O3ay#T^xX|@-c|S>d-?CsAV|jRY8vVa z*5w<5FGBQxA0I%#3&(m!p6k0?C=bh=uYi~P1PclcR~2!&62QLkx$>*{-P#O8$=8&E z6j5`_nmo=4oKdGYAQ__?Z~T8xG>5q z--|X3yI|$i%QX&7M%3-l8sLxcPLz{;C#u8htm|+srgs3o82+&zVp=yct>F88p6+*u zWEgfHR=Rd@^Rhne>5rz0xUuqm4*fR6Gt$ekiR!xV1jxP$Dmh%MA%dl`#>L0SiN0*Oo0k4B;Dy@Q^y?m;^PmS7u*;yw zT#+?XZT&m^-mLsT2Q^Bu&o&}_Y_K1Fdv4&{AkhoaU@p{)Vk0c|86eS9qo|6__6jHu z=HP+1u6AL?*AE9S1rb`!&SUTbzyToDTZPmRFrW~wHq|HD`J*Q)3_bxJ+OiFUPvTcT z#6nTcZCPa>#H19_ZQdZfO{B#}XbDvEAlwbS@5I5b6K;%)QZdK^cjfR!4JbCSFYc(~ zMn2p5QP6I+E-Ec67kENWH_s66%dFF>;7(7`U8WbGZP?f@`hZfQDIlf-cn}2;Jb-#YNYA zy5)w5@26?LbX=V8Ziv=nv4Jj~&;?qUjhHrj7rqnKtr$Hvy4505YVzc#*)2CRUC-0s zEH*lufCz7lY)FEgYfuIoO(EAQ63fk?ozakwL#PX-x0qa8{t^`EC03^$ZPmc#Vr{vT z+wx1Legx%P2+Fr%=m^|HhOJSsN&?s!rFlPt{Y8P-ET!}7>iJ=bTTn(lFhgSuwzbN* zcdW>Ir4PIgxV-^AYFh&uiMF|?%zYoqjA50Z)x&qqHql1CxS;Ye`c`zv?1=?gCzuVo zPia|KXLA5?@Jg(S3d9;N#T|;%g}RONUaUegG2|Z z;fhi8$VGNqgTEx+8~hc1_oJgg**7rKl~8=NK75>qgsy~w>fbS-Vnm9H?1EBP z$X0CX%e+b(>TrbsRU55>*OQKS*Iy6CaC@n{jt@RYC%yp`_{LbT1@F$(&nnpOc9!ru z6%#9uMpk<+g!ao-QyWL!VsXccu*7A{kV(CI@vC_cUeLS@toouDuUbVOH3lM|ZwcbODLcj`!9BULETA;(NV*f5BjM*)U>rBPD zW+wR1TcX^8b8!2yHRk$8;leYffNw^sEp>$ExIYIxyOF0d7HS8#z?0aiQOW*%WdISl zt^H8^_#Z&65pBr35Qe&qyppet9mt&RSVubo3BEiA_*Nqy=i|8mj13K?d1#rsIf+97 zLZ-bNd*xBNynF%H$7h?7n1fB_Hux_*soYl3jY?0t?=LzVe+?Do6Eg6P;A@#edy(ST zwH4bMuEI>cE!*DM*4VdCTce~e$HMz30Xl)X*%!I#Zw0g_gz}{c@SRG12r!PwN)C1M zuz!uuEJZ^{w$RX)#aZ#C&C=qndU(eVeFzv9)X-1lBxCJOqnmszc^3N$TcnP*?5X&GpE!Nbl1qx3Tge9;{e(uec`H)jj)~+$P$S=Sl50qB}Sqsj*Rz z4}-QH_k#MRQ*#$BcUomFY#5!6m797cr?EXmr$%vlp85e<-t&H0NxPEkn$v9Ne?=$u|5cB+3cx==i{2g*7eVZpILf~CSZA8@bJNfd6 zyPgXo!6qmS44>VHG~SCv5k2$Jg_rw*32rk6&4kKJNL2~sfKO%CxL^o&@~&RHIrt*j zbu-tg@i~5_w%B$FaxeXkTNwbqmA94|kL?6w83gBn|HbRHC0%=+wxqcO($uzpV3?#T z8NJ@iLtbGo_4~k%diLaw5$x!wAqW2;nPwPnHuGwKnlu*Y)F?KxZD4=tqfWpsv)Y41 zQlD%A%b8Tl4!)S7{Wn&}Y@RBTCt*9Eg~&7Em*R7cth2$I4@O}b11F+JVGP73UvOR- zZ7osPof>I`xeqTxky3%=>A+Sw9hj){sBI|vklU3@R6FN%>*2weC>vw1RMqkBQsn`Ws zgV+Dz=ydBjJA047d1x->9^~2H5>pyu^OHbI{uB2MTou=1d-__c7o8>3cIj#Vh{e%h z{oauiwW_o0pM`u6GS;av4EInt%fj$;DR7+7@mDFtD+%T`+6G4lcEzm$labH(0tIaZ zZ^*WJk)vtAN5Ng&4}^Iv;l*yI619)m*iE~2j8wxLHdE2 zW>}l7NgrSuOVOIR33zkCQ49-{|8#Fz*8IoxhVE&wp}ECc5lkB@cJl z)3FN2iqA#y5)qd*1@%Yg5_-?6l|^)UDgtq+R9spfX(WbqZUXeM782Yo}(Z?cHdxru$2*iTkgUPgI_XM#aXALP^c{XFZA+~JRRAcI|p6N6m` zF3a~KMI6hYh&4@gpv5L9UkE;3BIj?s&gP*L5qStA1@Y7nX!W}dSoL6U$74DLeBGf7 zBv=x~*1^Ge;yWl2*Jf~e+v39a*RcU0eIh2Qyj^_O;rfXO2g|5uoUhM3g6vKV1`3`a zcoyBdeiyEc{2niD#jaIAH(fPJeY;5Kqty~}K8Tfj^dk(h=!?^|$&VQczT6LV(6u%V zHOa?}qE8x`3@6pNaqcZEP3|lyCOn^Da{J<$`c9AZ-2m{P_`cCT;FNL>x}C6(v~3kz z4%$}bPC!C1V9;+^8f-+wXb8n<;2X1V$6|ia=C#kUcx($O9tyCN>Ro~xvE4Fn122CT z{ej-3&SLlspxzT4|8vr-;aVh$bh?X!6cNowWM1J`zYvVY;Jk~R^cA~d#nY*eCV(|D zxpmxiaOL6`qQs=X;drk)`nMu#{g+W?c=-I&065t5x4XDB?8io;=LPDd=WjqChA~{}qs1Y^9mLLzlui83=Ngf2 z_1h?7?Si3;zQb?J?&TmRUUre4Yy}u5Qz<#G1agMA^SC;raGVL};;{41$c9xBI%>VO z^IGgM1@(DYyEFbjVs{Fv?gK?)b|=o-eNh-AZ7yNQQv>w_JEHa2iV?J))wcEM7#ofG z+pZ6z+>Yv*VZtSx&Xa}|!_ntRHq`N9JI!znN7q^ODtJyqX0v02uOizgFm(jXwZQ*< zDzoT_{TF4}Lhz4k9jEU!YtF1)=DcaAHxZNN_pZz{Uo>XwMw~0VAMb1Kj^`uRRZc$b z#40Ji5AX35Od_Yg{Rp!sR_R-To4U{2_j?BBw=v^F>jUdL*118BMDbcql80e zOrDW5m&_pk+8Lz$%nYVAW#&brissuh`TXKc#_l(3)ua zUpRT;OtT-H5Tv`1nxDUr@;|fil7%P>3BN00{>{WU>_$1qN%$#*Mf1C!7j`R}rrlrI zEoY9|oiytavOQ?4VB5!`B&>b+p|uCln*lXgxD{ud`p}-T0=MEV&Q*YNW*XR9aX(NW z?#$1b)dF24lsQw)Y(m_JEp&Fq1#~OY?19wH0)0)OM)M)0-D;i%Tsy_DuKqDPJvFc&^YIM zqgT20)5;th$e2Lp+;|`a&ivTSJl(_E+w4=Gjq5uA@SYnpBL!e&^G~0YmC|?%JIp*_{Le^mlyO@Ur z8YR%~gdk-+pk}NoKIEJQsM}eENx@sqw{&(6MHsOU;G^T4j19 z?k|8I#>~VQsNgEpE6_MVlM&Y^Pzlghe3x`5ffiY4XMq-5XdX0cH78kU7fJ6-K$F2Y zUnnmI^ix0s0$m5_7x=ExZZ1Ic84NU8e2MTa68A-kdzXd231}-;!}gZA9|4*SXdi)o zFL4#KpFmlUlohkTKobB>26TWxy%su9pgk>gkU)o6=wSDH)YD@D@heq_NFGkLafb`# zSr%F%(1!%7nq>lAFVH6Q9)a!?=xlSgK#vRb0dt8!zp&7y0%fz*^8@BGfyMyZ3g~iy zW?1OM0xh)A6#^Yyg;8YF9?*$lkx`hqCgV?U7Weuye!ZFpk|zDdqrgKE6}Yt z=}Rjuhr4-m=2nvzXbqs-GPjuqfzFn=+i(Pelphx8)27K|8~Z$@EXJMJEnWuo`dfe+ z%pIm3r}J9PPb7sqOqa*L=a1lP#>(j=fimKqea=i3DQyL6cDM0`uNTnP%;(K4f%X8j z7|>|~9S&$k<_l(nK&t_5&fIU#7HFeT-fzwm=pqYUAkZfTdca&H>3zvUmq^^>fL_cz zXg(~^PbBU^^HHJvJ)maX8+lJ?rB^bKnJ){JX)xxM%(u-$-r30CIDsBFUzNC>0Ojzm z^dkb%f;saY^L2p^l(?QA|j=8*we>2j(e>dj!xqnID)R2=o-7X2d=1wWH7a4N~6`(6a*l zO`snEVu=-ttIYkG|FTezKttwviQ5g(+RU@&X96vexM$5T1Ugxu=ghAKIvY^4`HA_h zK$`(A&OC4aBG6TURsecgpj$2Uia_@PItOtE>piXJ>y|Gg&`$w1o9A&MD&t+V1!>)dddr&e^j-c^aU_ zfaXiwpg_MhdkAzHpcR?lnMDHKByqnt`v~-9K=)_xXXR}hEc0h|We=(~Cng(dI^H+1CKyR|p8i5W2v?B9YbE-hc19}nAT7foL%Bnz{ zZQSVsU1#|)Cq@451k`L^GMlp3!CH?1GJvq3g1BdF9CjuE{aK)w&G{mwy_tIc&3sUx z5};=DcXM%;t$!ClV98u3ac>254hm19!vS3k=z57e3D9CdH;Ap@2MGRP<`#iI4Cqfz zF>|LtHvoDG&|SiJ51>~7-7RrnwUqZr+!KI2x0tzK;)ZP80}}TqKuw7IvOu{ON@>hI zB+xj4nlfJ%Xa=B{oTkjz1lkFZ=Qd>?6=*j=O@O{3(Eh^LoOw*3cSu}w=5c{e0Q8d6 zoY|Vq^t764OCNUnn=?-cbe@Ht6zB>IJuT2}7W%Q&qoFgAsZ5yo9#HN)k@N>i zc-+K2a)E9~wVq#Gvgxvk3_mX6m&ft>lk$9rg!f4JC4>>zO+wG`(TNNnM>yBqGikug zH{Y6ccXqycTEhPZX0CY=&vVVI5;k@7d7Ok(B-}~Dy(K(M!sQa4DB*g98FNESc&6KL|wo*9ixHqFj3{GB|vcFe#E;h%dVtL7(@t7|gxljXTz!ckL**U*>eIWY|F z@0kxyVR>CVnyrv-6U+S3Gv}Ds?fLXHX?+B-v z%#1T2jbX;L%-9w5iWxhDl9{{7X61|nn>)DULORT5r@a2j;D8~3f<49bA_UjO|#bpI9MWnSi* z$9>lDAqjsg;j0q1>_~jKgmWa^10nOf5L#7d9Es_8b;gMj?j@LaAp8MdC(4N^JEU45%t=bA_QXpJSa{@Oa(oH2_fxDnx8bIGi>HqYELE3(Ni zXZdZD%^!iun3sf7pPkvP56!dRhS<>(?mK%@Q((hmW?u^YS7zTM;X`d1L(E~D9-Yk| z?^y}|f^f1KHRrdZC!3Bru!HUSztr*D(MvX+4E&N!XZ13C55f#;S2vEfZviD*C_>MC zaSr>CZy`k8p39m^+p4x0PO!##-q^p6Iv6Fc&?A|Dj9M%!pNxAX)7`o>29;V@VocxK zL)vq|w-~nnu|QXtU0SidW`1FzH@BXG?{&Upp#xhh@M_;Y8Elv}9oTxNX)^nS&_;~+ zOD%L5D4WgIA#^5QEBj;!ZG;DMuZ5O?vemp2LT6%yCqG3~Skk%?rzFN&=qOOOn-w8+ zCRTq=455u!GCtixYg*q2=0IM+}gdT$6lZ)TazA@l;?3b;CiUdGl`}W|6r+geGS8Hcy9;pV`m66hb>?4lrY>rFX?Zo-$Z&JCg4@C~AmS?E$w*36wDbQ9Ju z9}S_~%qH_+7P=CYXPG~S&`r20xxrV>u57&x_vdz7=;NS#zu6^(ZZa2`148IFv)LSL zp-;A6ow?AwJA`h?Tx>23p-*95;}aIT1C*DU`$Fi3%oXN4A@r%tN6pXv4|`_ytMv}^uS4n$G>)@$F4?zd~-cnYRQId8lYspke@57UY zS0o*Prw8v!I;w0T6_QRU+sIW(Un@I^FMNWBqx^thrSdLmBI%;Chjf#4McGSICEZfW z$YPac(&LVqBcl19_NlVVAk4c&xgCu1CQLW7j> zX0Gx~T1)9DDS(D4k4p-pk;>DO#?feHrKE{8R@o=1gf>wACTRw3q^QkZCCsPIlvqhG z(3VOUNh$O`Ww@l#^Z_MLQYLAqJS*t3UkdG@tdKOCKBT-UDU&>`>=pD2cqS?pl19_+ z%HJhrk{*iQg4c}rzeIZ}VUkwUzDg@e>uG5}fy`N~U@bakP!Rg#ywSUD~!NL{L2lN7GLs5tK9d1gSK%a!_)?$B41I7zzt zs`7}S@!(me43~6=u2Hfi>FRoAicIIFZd8^_3Q{*I+a-moTa?cP&44`LR?bVhLw6{5 zCF$xrN-(^jgV+87c3yX(T_EXeC7f=QRH;PM!;&s4b?JAK4k+~~93J7{67s(PQKb=$kaR+6O4~`g zqBN%iCEZf)qvIqgv<;mr$)s)RT1f%413e%qj6O)uNSZ-A(L0jn(?l8?=c>yKv>R_upDvfwOdUiwN_qgkUGaTE<gpUCLp6rqLFXDwTBFL()ZM3>_uufHIa&m2^}YM_-Y2LdmD^O1h$qrxlWJDHG{c zNeX?6`nGqKZqlb|6G;JdD(xmIj83Pil4j7E^l3@+=^VOT(hKxCx)M7t}&|P`yY`Nb0WsNWYiVSN)mZX0(W0^sh^= z(KL8>3hHUI2Mktk(y5FVkf4BK_=Np=P9cxCMOwjVy6wJz5#YI1PXTp2JE=!T%R0rPR=+qMKO0%|B|cfgB4-31*ESP7Ia=*xiDfu;!h zHedtLQbFefwg7DsbTwcn&>=w{fqQ^Xb0U#}hE)ngxEY{!SYT zY8UvGdY5(*)EkJXLj(;9Jgq8fj-U~N-@^;MGX;$UQq`4$CItRn)zqDmuB*CwO3>4R zcYv-*(&2UKkcW9)o`pC=Z7E6DOf^~1vOq7OOi2#Srp_0%CNKjB94s5S^s*cXQ^oqbvKura;P&#Q|YNDiWnzuS!(6@oTH6Jx!(2qdA z>Ks9eqqpX#ZW83@7^wNHhXjQI1*oS5H3kY)wM1Te2gh*Dp@s`e1PW4H3+e|HtPT-0 z(vhmwQgZ~Q1BIwF1r-8?sv88AI!0@?)p9{|9pkhx^^~B+jtN@0dQH%3$J1Jb>fMFa zg*_vSQiC{=)aMsNv#yrA!wZbuzH&lyQ0pj))lXh zKlSUZ`U}FReqGc^LHIPSo7zOuv+$-$oTP=Mr&=KCWztujE$MYKKwTwi0~x69khGZ$ zQV&boONOYYBpoBe)X;9cW~2T7Mnm2nsBVLyr6&}lBI>J5u1Ys^YYEKJ|Q%^ElK;8{* zWaO%?9>H`xmpru{ql4tP;5Z{s?J9`WiZcq-;ezy9$)r%t7Zl8B9i!>wd=SR%;>22_ zQ2j*24XO2rQK()JG!oKHQ1MUya8=A^6vwE96fw%@aV(b!>Pks*#sqbjNQcj%C#pvo z@o_d${aO%?v&rgtK`UzwHj34ol13O)RHG-BzJ#o-m2ON`BLux$>oT38Hj{LY&Q#k; z`i4HM4it10Jm;!TN$2Q1b)2Mc=zR4VK?nTujD_m+k|r68)iO!bjHT)}N%M^5>V8Sf zj91hXlFE$N)V~WlT`SL6qu!M?%~+>;_2O4_y4EsdqZ%pb43xfEy zb(o}i#x6BO(lX;cb&8}iW1sr6pua=u2i3PEO*0OuyCp3%K32aF)I!;8e5zJT+G%{I zUXirdIIgO_d94-4X5*ylkhIhIiy9+ouknoaU{HVSp$ngJ$URB?ebdFwE-;s2g-cUahR2w{Rs;4ELqqo&dk}lKV z)!TwXLcXDQRqsCh`a(j^QL2SXx=b~#k))3dUF#(2gkjfuN&43C(jI5TXR42uF5>Eh zoP*z$og%0~$YsMb8v#~Z(68t2qmMuq$NuFls=+8A*q7)(y}BKkv`fKK@WvoGx};LB`IdI*0Mh@ z{h<&qbFel?Qm{Exds$MH`Ixp|QUx8U?H1G>@_a&b4B)wR4^hk~wMUiVGh4ePse1Ik= zWp2|p2&xD?XKd5T8S!h_u3`RoMp+xO)!eQf;hu2cINjW#ofm{xv_sQ|qURFZ%7Ax( z!Ue4j*bCHJ(3XIMKs^QR4mbjoDd=#(=Rk7=eHm~Ps7%ne0p9}c7IZ$K66m;~s{ua% zT@vIG_!E%!D60$Hom~eC7gRs+j=587EvOm%6xJ@Sr=WI$p0;7_ZCIfh~YSB(=5e)8Yj^3vv6j zWJzspA7~Q$NB_RqAR zcsiR$?ZN8jn%CpJxyN>Y;jxHg9q=~TP7{e-qxQnDSs z_N&85UA9(((ostw~Ue_*2s-QQuTY?&c=Wm+-NZu}u9Z}|8 zEmBeirFsiN9l%r56C_2MHodo`3hJqk5Y!Jmz4h^uqTmPIr%I}z4t7 zA=I;#{)nU~vyDDjQU#6E(;4wG(O%DyG|t{$Un8l|-a$VmX|g?Dzb)w*`-6JZC$MJc z>^Q3u^h7~8s}l6#f^b$P==p+hRwd|j1mUbo(8~njtV+;#3&L5IpdS~6vnoNqBnW3! zg07|V(s5QL=;4f}+mga&*`Yi^L&BZ|TEmHq3R?_xM9@QYx&2}Nnxt3loprx7%oFY# z!(O!~>P-a|0(H^53z`npRZkc6eApU$H+_zzx9my!R!Q6KJ@iw82Kl{b@1@_6^eRxe zlb82$*n9TgdYq(Jfrc{TGp>*BPq&TYB}@wM z=h0tpDQH^wV4z}7P(lXKRuT77_|LY%`p1k)Y-_^{?Su8>B5qrFp2raVqKMlYJ^|>O zh{L)J)jiX(yb{~T;l&<9bqAyAwv!O|sNO`xoq@PV_0}Tphw$sRVR{b{cRk!&AEqZW zT4KZV#Be=_6KSDbHiqjn1u2fp#$);hL4L4TJ+7AvY78_&KQE{Q>|7&tl7Tf_Liz!v z=&^!E!anwd9xtd6C{=%)5ubl)`jd?KSvXC{Jm3`MeIjDLhnv2SNV2Et<9RxAGvX}| zr^{2n8L{01zCN0#(>)^hc#O8tWcwHk9q@oZGZ&r_kw-mpBs~yW>`@@83($B;$&rQj zLP?__Zi1u&h{HGe@!vsxI?zN(3nD8#Ch1cxS6i&Fko1;Ev3{D-K^tD}6#a%EyxJ+c zHk#!LSG(P#M1NcmUSFv`PSRxiG`&>P0goB_QbBlq&+5&`@Lcfvp3@%`gx5D;?=1+g zXo3E?AiUb=^$bCHeGBz`L3n+O^plx9PrSax`tGqvC1i2bS&yZ9!)#6~ql!J2>8XM? zME&6LqCP>;_NX5{mh0C9eGqlcV}+iR!_$2db<^V|eX*dkQFlFF);9^d61B(U75%8B zLi&xr<@LWu{#8xMIq4~N# zMG&6nU)NU%Y8mb0`MSPWP;W++g3=h-@^~)KL_5GUniIj3>g#$ZNeyjp=xKuRr22+l zDygk)jlP-@pB-!TjgpEz*68Jo_*_}5$L3>s(`~qBt<~c>u_t?L^~5UFQ&O?VT79HQ zhr7%=eS(ZjChPR6lA3s~(^p9<_E@iP73pvv+n^s2)F!5h=LY?}Al%j9+eQj_&3eQX zdu-Ib1UX~w+TPS-1rQnAMty%Y`8$IQUOR}HQ z+e<3;_?zC7lkG3iw`cVdFA2i+?7FT^;dR0F?7HqJ2-mD% z^@f6Q&H7bu&FGvR+w+FrQ^a9=-q44LIJ^(Ispp8e84!0GmDA{~vrYg3IfLH@C~fOZSQUQvzX zg0NRq<6BN_WNF4FN#pFA(f1i%Pi#TmNEd`Hs2ll$Fi*pnBM9>}jHQBbOqj+oL3rn8 z8s`OJ>%t$gOywnD>zam_AZ!Vn5i1B=!e;ap^ib?tPrH#WsAue3K)IaQHFy{ktI#u5 z=vhfgb`N8@q-5f0yjO+(T7`a+wA<6u2q|T?X1(HNG?w&|r?-*F$%g&lYYZ2J{Q!Tg z!~PxA$HngV^fmHX9H0HZ#sW!&c3)$gq{((a<20kGWPR*W&j8~RkF#xu5(16Q(=gLg z+rijk_=dc9868x6uHG%rFk_{lZa@*nAwkLY z46i8T8l&m9C+dw*qmB5Pn9FqAXhz9`@))h)L?+hr^@=u*NDB6fF>W(DqfDu{-?Od} zJB!tYeX?BFXvqjZONM&ZHM%k4r@XpGUq;ySb-n5ulVsc;k62@oNQZ4!&uIB9=6R4{ zyVN&&GQxC?y&4#!7-61`y&4($!V}XqG2XYNYigVqgzeePXgeG8#9W$qHa8w&bP)a? z<%DMoV>Bbovx#R*V}gjoJX;xS1Yuq7Gs-QV_Z!D7p6~@jbKJFVV}vupJUed4jMmiN+#Eye?gg^^CAC$)t<%J|ip-=_5&n_AbUr zMvLJ0dir^FHHOURC172;i7{WUkEuV{tGn?ci{rT@8Ji>(+LMe!jHcTr*MGw65#v0g zsbqHjbRfS4nCEn$ab7))mXeCRdK!HtP50_$~h7q>Qey>5sA&ci=BVi$?lV@xdXAVJS8BZ?7k-5jHZq+Z@RMxw=Y zobj=Y8|j^AoVLW}8>3!i*TDLHyiqJ^vc1q)$_e^tjCYZ-Q&OJyMB}8SDc+OVHMsuv zak3!%+sAp{#gg!EAKlc%Z=v@T<5yW;GAS{_m$SOqiW*$El^8uak!Kr}d6yV#B<=Bd z#`uX*30csf&_2~jTY>3H$c6?<_EKXjqv-_qziCF$ORnoX3e=R7?c0Fsw&_MsL0>o6 z<~`lW;6%7H%ynfJ5CCP{zso^70xbk=*0ahns% zbFN{&;=bCshJzD(Pj#NrS`facI?qTJgzu@&Gx7!Dd#dw{MS}1>)p^ENPVjl^CGUC0 zaY6W=>T||5;fe35&Nmz@S?MrykXj4E_f+Q_$%61b)%iv~C-$D|d}EQM5_N&GQ+VP& zy}≺zl~odM_}pNxJI&yx~|y;NNuk%yg!@(1;U+Z?rBnh6}r!L5h{HEpml;z8;Tx?l8fAj; zjn?JHAxYQO6~;9|_(tmrBczO%@N}TAy<{W`!Z%u9GSVgK+RMfwLHI`N%f?Pg4(%1A zQV_n;`ify&>FnSXWzVv=)SKw5~LU2*Nj7R~eHzu{T;@HCBo^e53VMqg)Wa(fXQk zUQ#!$%jS_}1z=qf!vQ zr@G#-y}?Vs_f$6+O$FhbsT+;Hg7D4MH;sHj_-5)`#!^A}X6hzmH=`0;gNFM(w-`&; zV4fwm_6_%VY%yMCge!ER{cU3}C)nRTe6|{=7#$>dO4tft&w}arezeVSFv8v5&u6>Q zT2hG54kKAoJ)fOMzNGtob{UH##rwQtY-LnJdNq8+=UwACkAu1l_1SGyN=otBW5llG zrDI+88CxZt@%+HZUypGM$n1urefArt7-6k1dzKrUHt=+KRy<&w5`<@|gT^IBd@ugc z2;YdFeAoWaXw8UU?IEKxBfgIvHhMDR?RnT(DLk=ehmF&gbRQW%S<-!M+^~3lY^1*F zuGtYIUl7*p6XR1xyu72vc@c*t95wvka;N*$h-Sn+j~NXa;m%y_am6_V~hB#HbuvaI(*FhQMjf1$8hPIjIX`9HXp`huEdJ1}uQI4Qxj1~!6 z&1k2f&5TY7`hXGsU<01djx>56$_p1XyZ-Y&Um4vcz3B57BVW=RK3^LvC2jLLWgL;T z$LAa41|vQ@zBL-XjU^l;c)$5qBT*2x*=gfEqY~l~dBo?8@zYlHEFlq*U;2D!tl7rt zM5Dj@oHx2}=k)hRmwhf7(K|SKHoocelW{{(bYtE3nsIw4#w{SN8#{b&8oPIK&mQ3U zo6-Fp7RT=Y?uwp1s2}iK?{(K$!{QDqI~uR|Qq0?omcR)x##c2R?_xTnM!uTaRMLIE zx|t}c6Z}Tca7n#$&7G>JmhUN=QBD8f3LmX%WiIwaU*>_&2meemsu$Y zYvyA%+>Lc9B_A|~`+jo~C&)9I1ehxrVF@|D0p=z~yo5mWZ!)fzcaV9_5*KVXdJpr& zbR)e(%y>pTU8p%u#wC+5vq;h;-!OBj@Wh!DVJ7auT=>cmX>MbLc{cHkGLMNk^o%y| zSUh7)@AqA$H}R}vhBM-KyLHV`GA^0Kn%PyTunNs*w1m`eGSxTM?6ep2M0(b@fq6qv zyCw^K8=JBFc-$jRmiRU?`wAM~WVvrsbF!f9CM$iLnX4J`cio$tn;790722Dd`x)`8 zZDF1kgxA;7Z1Dk>z&%@;4>RJP_n9LFq38YP7U|iQqabjKB$7>53X6|=8jk(tcmFwYFX$z~?^gdOj?ZL(P^=<}xD`ebvy zpfgRc+nzGl2)YSzPnlZ<`8Uhjb^YS63*sFKk+1(z=u=1w zNY`dl{YuRoLFvtA`%O1b37XdINixH1{S8m|Mze)}v&@x(-fgzrZ?<_`(1*>|`pq+s ze9Jw*YPQ2~f$8;EPUo7v=eN+bokm(ferf8n>(?D;p0<1P52*@+SV zB>P2kB#$G*n^XT6%@vGF$e89H{wvIPEa_e{k4ld*WgcgQr8o9kWmbwf9J{ZXwJUi#oGWE!XGZ)KwAxH(gwL#k{9iXq z1#NGRv{IzQTwWLbUarrsy~FPf^Eiv+r^B_T-*;HTB66_#PT#fWkaL{AXddRj&OF43 zx5P&C5+kf6-c{=ob+uS1v=k!+d z7$aV@ZRQO|mHY`I(~RKnVO!+;e`so#u=FLiZjkP<87(Q@ z|6?;=(s2Jz%pr^xkQR{cQ**M2ORhJ?|1)znBfN&XUZ0!0McjZEv;4m>k2B)WLynu* z7@bq_na*+3>$20vXhwWTIAL}XguU{mnIb)lJu1u`M&oUQVZ_Jv74sw`zCT_AaWJs&cU<8pKaI7Xij$Y zyk^ERLeGzYdRjbxF>@@QznC)_@iFm>xk=I)&+Fz$_n(u3_m|LNd8& zhBI0MPYbUG+%)3_g|$R_RC*TLZ%bULDLzP3VM#wPC?5UT@tjKQS^15=VnI9f<9n0Q&6v# z@aeJn8YgzOx6R#*_&xeO*^GEDifs`m+bL)X#kN7vrIv+u#kNz>ZHS|`V}iU}722uo6r+Ro$X4q;RNFN{ ztr%fVaGZ5%6&tA9ylx`#dne82V04gRoMyuq^ek<4)?2qVws;!0`>Ie+kq$i#TN)#N z4W=zq#9^MMZ7C-k*34!*BnWF}ljY5C)g;hnyTRgk%{*-67S@I5>0xWg=paE)4_g8w z?&)RgDLtEbdf6rmPb}Tr_N9zVvisQ1i#V*cug&%wyIO+eXNzXU%k#H2tU`S)p8mFU zOI(0$zKFw`1=u$5IQFKR!&WXmi#;5+Yr+$27G&#t+g*CFEu9fBy_PMf3e6Fon68%X zYfD^+?V5=9}Ul+-q`wk?_ww%LP$;kITnuGk~e)=pB}z$jZ+i)V~& zfQ&2lsB0S`scm4aEz{yz-&Q2!iai?Irb%iW*vR(0#j}a*_XB?21DgRUX_V^|^on&s(O%pbo|Nr7)|b%j-yTTP2bc!{l8 z=~yECJ{3#rwkQO{3hBUn9;z000i_0$^lyd zehU|5)%sMoE3B=!Cw|lNy;D`UTRjz43S}+qYCT?m-j5jmb3WBeaa~Jw`@g4jcaOWS z!fkPl0k`Gf?~}xO&^jjF7KLD#%c?E^@AJX$-lS|!RUJ{)?f4D4E>COt|J_vmp)WKx z{&lf>xLZIa?%1lWf%ck~{~h_@m~qV=YfbokbX%&H{-0Ftmid2otp5349s;AN>e}MA zCt3d!G463!o1;|V&W@i?{u#+r{gK4d z|C!wWjDH?GF#prztB>`m(Kn&2 zzu39D=F_%+E&u>$57`KGhg~D8y2aJ1Zo5L<;r}WX zuc7sB)NOIyce^dtk;(7G|9KxAMfYkYx82oN?lH{AQq|83taH#kqN?Ux-EJL|*6{z- zRL9szu=bAIq7V#oS@o&NzuO0ALDd%HCA#gdTJiZ(J=Qg1tK0w2rLvACYq zwVYpDSHwBkhl#J>Fum{Bw5v9Un+_zk9^~4xjDf@0_9x13QIZpZrH* zUp9KVjAi*)WmA>|p0QQZ8p0am-@g`7tIhur}fK8O1Do7t3K`eiq7yu*&8* z{#vfPR{VPZ-F4%&;x+uob(_fQJcY?;n8f=Xg_K&t(^=TvdahRDE#`g$L18WCdIG@L zRlXAPab+EEf7I_*yLEImWFyTQ%fqu+-4-%=8FmCpR{X;-k6p)n_{xkk#riD88dk|I z)*AeM5AOd*EA}d=VbxWg`&;)2cUUDmSRMW~3$Mcw)+W1IK3tZwa81eE>SZ>&|IGSO zvz`C@mP>3^!QT{B*e{Dx_~m5`TkH0ZOF71_?j)1$++6w8ysp<+&+`i!9Z3Oa44JYg%iV*TGsYu8Iob z79O_x+}lFox1{fV6*c|&n#Sj#HD_y>m(JTzZ|%+*S2KlhyC1Xjd#*o{A>czvZRYt5 zYZL1##7n7ZshJzj<*I#j?^KkyOX2%0{H8W5m)mRR%v*zBJCFTmEj344%~JmH8*bsO zefWravn5_>6tnOV%VT+%`&jMPwA^0voXk^M_bJ|be@6ay&dGl!f9tMY)8D-wx>g46 zV;!qCTia^kqZDTch2I~?wsnV9F=u&hd>#0s)qszDK4PtCT(d;XhqAMZ%AQMWq$L|a)$M#$`7@q>l!HbdxM$89{Bk{>i+C(Q^K|?JPhL0c z%3uxu(N$aRHT|uYKMM04tg(N_g0qQ|n(KMZb(LFqpSo9gm2_t9P}A~9yBi-5JRj?r zv07@D{%2D4U^U^VyFM&z?J2ZVG8pVC8O35TPuJbbIIw8qL}#@>!|Zq}uDU+gY_UJu zp{(PX*U&1hWz{^B|DUwLxfib8wY%LrtP);BYhVAFE1CfJ6qFRRI}6^|R!fz#EPeD} zw}$Jij&1I$o4Y>N*s9@KY&=-&FppVyPr1i-)iJP^)t~n-hACOZQoX`t8AwXjfm8_} zKYWL>jt9J7_~Ww;znif7^EqPOHLS6Gud!PAj%ls`zaz}|-)Ai65Nz|RZN)9tR^r$4 zNA{ZY>z~cj+78ya$#+0rI+vSRe{uhsyJSs&zL%k-#Fy=B*0QW&p1*Z=oM?b8!zFJw zF1h88dWX*u?!(VN*0elqP0L4)wG?X@pAxwKn&4e_?fckRpsPqQSqrvx@P8XQMz_QN%?kdV)-I6V`aTvu%)+06 zEcW<{$umq|VDbu+HW1vMgNZC8QZ)b{nDP_W;!p?yox zDtgEF-Jl{eH(-f>8adJSF!*0=`)SZx`fFRXb5Hzc`6SxLZ?X@@o)6kZz2a^|ZupyY zyJ#>A<1f-RV%Kf;3Qfa_eAg&7Mny@#bpE+fqyde;;y*t;G49p z?axrd%MTO;V-Ce0MaqY9lfnKml-`OQk6Z5%s+?%MMh{iKikob2r2H-JmEcxTdXl{r zxg56+!pGzGF-tNDWjVKE{;in5qGDO?Se~s=+U@GpI==<`Gkd5yzunbZ?I5?CwUX$z zb{WBq)T8Z+JsPRUg@l#?iypFoeB16iwET}C6O>G7jRfUxJCwHewL%gUycYEQ(PI|% ztk*mwi3YTP0Ay)ghmaB&16@H5XxlXeeXeM1z9e)P>#26o0!u=Z z=)Csd)=r{}AZ;e})I4u&=e}VmhcTHRR-|rgzdbCJ{WUnYKYafhYnh?Sm+k)&W>+q@ z|6ABl<)`*PfW+9z}|~B6;<@c*jDxyI&a@&|t9l2B=kczpd;Vx3ZdVC5av8d2fYpUz-%P6}~TR zp7(ARyPL)CX0f|j>~0oY4zaEL9Wa(ohaZ8NGSB-6!I9%&sT{1fo7G_*JR=k(r9&jh z(H-hVU@x?eutPuQL>y;x=M>97LHV`qx`;|ho8x;4WH0Y)AV+#BKJXy4T<~=WRiUW z8Sj6}6WcHu{yz3xhg;B|&o&qliSo(FB>GE-$sikqltJ3N9kzf}Rg^85}hZe6dM+UA;&Be{j>j>7f>|!acLbjo+jfa=rQD3q zjt(cZ2$60WFkbu?nGs0TqN(bFA$L6*h^#k5j! zMkLYm9mBu^-SvXg?_?9`gUl zKT-Lh#XkR@?AsDE)X)d_$7HB=m~6^q9FvJm4t(&Vm?F03EQ7R7JeRTAx{S?Je+@@e z5%e#tr6Ah|qI@vWMr`CE`0qs$LHdy-;zOE}ow^Tc3E%GSLt2xgAmfN)*hoBy1(^f> zKBSBswfm4YM2A06J;`!7#d0_eIoL=gnG5#wRSPjzlNSR4L!XyEXz-u>j6h;_{r3eI;aPbFPKgxx0vogevd)>7}D8+I*)kPMLmf) zm=1&MM803d2a>bQzccY>>FWx66LKM@Gx$vf|Gl6Wk~@KE3L&1rTzXtjuX;!PQPRJMP;~|}yo*k0P^p=pROn((p1{(9(&zOXs6?VlSSg{U69UFr(m2=qmAwpM4ssZ7@nD+i6~PJ<4F zegCfK`HKAfxQ_Mb zx>D$}01+Q3;vHOTL0sPnY}yEtV0{0sGI(6}B|!o3{xYa`+x5ZqSiIAL!mxINdT15dBTbB^uEb>f3u zr#-~=Y0y|sX(!HQ30#*y%ylI!kXXLfh3nX^Tqkzpnsn#w70vYbjx^BdUz)^q*&|$+ z_u#s+C)b^NiTd^C9NUNM#J*go_2as%?54^SQ1R z8h!D5Hx=iTuBH=et#82ir_9?Cti@7cnI_+r@KZR?pgzL&@1ec2VX zpUHK((516Dr#;K{UeGx2PBZpvi8;*^Rw;j72?>k745#$vV5EK#=85A4TIH+aN13~dY4+nJ* z>K!yZ=*ggxpy@#yf=&kg7(|2PgS!Ox3oZ#>82m!;>fkqncLaYJd@T6O;ID)K8eAEC zKKRGr>%pX!UdyXiV6D(vQMDS@A|ak3;UNhj{X!aq&JJB3x-N8c=+4l+p<8NySKASm z6gDU=1N`7k(h z4ksggN2H*FyoqR}kl0)P@a)RuGQFWN$XlfiV49=??9g8(WHZ!@E$(>BT$K(f&djsS$zl|WzIo<~OqhlAy8;BT$K(f&H^F|G$xoTAU~;3yf0y5S8m>=4MN;hj7Px#ZggWJYKYkR8IY4oOUoWippZ?ms{L zG4NRuj%VA+5m^7yh^Y|fJ_UZ5c6J0_5pUbIk$;6)ETNrv~}q^;&z1*NXR7bS&o6Bo_OZ=gHIZFfWVOgy+Lk4UOFnwY8?* zQ4jOkUk~TYhfE$}@bvRLf0Njzd!X*$sQ9sO=ko3kVvzeUCWC@eAn4HJtA|_WbS;pjMCM$g( z_QMwV2IPtQcWFMso$WYo0WNq34WEgD)GMwHIGK#hV z8BN=QjG^s7)}b9hHl!UvHiBm?lr*LZAe+$6Ae+)IAe+%{Ae+Ne7fM>t9w1xNULaf1 zJ|OR-{XpJN2Y~EO2ZHQR2ZJ0yhk{I|!$1zCkAWOSM}QnmQ$P-(sUU|^C&)+XD3HTw z2FMgT2IO;eEXesZ8{`5y4&?JR59C5x0CEv61i6?Nfm}i-fqa2J1#&5U8ssus0`f&V z734ZP4di+{1LOue3*<&R8|0gGF33&vIgp#_0+3tiLXcbOVvyVD3m|vUWw3|u1WDl& zlI0M7hsoXaC9u59J_y$W32(co`ym_(62^df0A!Tv z3Nlqa12RoL3w9?+N}g1|gYYPjl%%WQLpTE@C8N~~5FP`Pl1%j?gvWxUBul*v;cSqU zJ_l$GMTSl1$zNVO2(_dK)4VjB@@(NAzZ}dB=sg(CNlZ7`Wu9&sCOXt z8TBrNOF$}Qx~eFYOk;9}3X04GNy#i#2l=dOf}E|whh1b2NJ{3ao)De~62`6S4dMA9 zDOs-if?T2cgM3vD1p8|sVbrNXAUCVEKyFb(L7q{=KweQJK;BWKKq^`c$PleA$SAEI z$Y`wr$XKlr$a-26kS(=lAX{lIK;Ead0(rl7KgiZv8<1_awjkrQb|Bkn9YD6%I)dz| zJp{6omH;wA>kRT?tqaJ`S~rl1S`x@ES`Uz2wO$~*X?;L;*ZP4>(guKhTpI{7OB)PV zlns)SaoSLj)3sqBpVuA(xl9`Y@+)|yl704C(Yan0JSA%?6e*@$z`dW}{_4QE0bs%B2(KkYP14vkH^tV91sc#0kQ-2%e zE`1xw!}<vJ_*A<#sRJkfR%D)bzazd`I}f@RQ*`gy%<0k0_5g5^+4@R77ROwTRmh=b|5uc_bz+W=hN(F>l3a zQ}F!*1KutLJtsnpwOv8JB1!4bf(Y+LKg~MB=oC7r%+zc zSwhbhdV$c3gUs zCP_%m&&bY7PRSkR%+Dje2ckz;mj_99=H(|kGo7PS@|`3hFVC5qPdaC3<>lw5WMt)c zO-aqq&Mm5*s=3=EPb7jOx;ry-oVmyaV==Fytkk5e@!6>n&3gkN{6IoKrqQ?k;s$7W1~-~dRSk&-zmB@=2oAU_wf7e!Xd zgn_t53@49fggN54C!t05ZbM$;pOca1T?S#pcXQ&COt~;WmmQdZpy2rW4*~&NSI- zZa;|1%t+0!6p=J4D?8We_DIS~%`8ZBLRwUAd*95I{3o+>$GR<@p=k=NN&DtzL-Xfb zE~#_&*e5cwQlQhJ6Wl5Lrex$6X5?9NAK)BU;LOUe;?*l)o))CQ9aBVLoG_Li8MbxcloRvEn5Q`rTUYKgYY8<3pfu9?f&>t4p>^jv33 zn%kN6YxQeLf+?AuIo|1B5-sZ|8JLyl%s%3w4F54kNrTPD+9U$Px$3NXDqFlqWKsU30U?-ZLUO+iG@o*u89BCcqL_ zrD7?08L1XeUeN(goJX)GL#dWX_mX>0BfID>;|fwT?->n7wm#o85|U+%PsxO-dC%xR zxoJ+AFZYZaQ1AqF#yz8wQ!+D)px?&kq~vDgWoNmTTW)dYx;WAKWC|=Y|E1%|Ry8y0 znw{%TSH;0nC74;zENq~;c4g-3+K?YE$jF2%Bz$|z&V_Y86<&0a8+LVuEImt<+s25izbBa+X_bbw|GCS*$e-U9!^h2501_ zTYRdI6~-B`u8UpK#nrp3n==arXsRn(xI=@wEY%WJ>6Mz^!oqgF_N={G7vNWH?+9#J?x+O9RIxZzE)!FCCY8C7Wq21dgYB8n2*Ph z-YLB;nfK1dxn9L!oq)XyGObGhB4mvtt;VR34Zsetu72YOQx`$^C9&x0-OJr-So=Fu z3vzL8z!{1i1Yx<(<_k!F=aaCGK(pYze=_jeZLRgENY#DJr$J5y$;R&(@0Q=i;{S+J&9 zowLU}tM5#(vgGDhpO~mXedRGvQtV`jyBK+&cl~7FaqE#z6)g|Ef2^kg;$_ z@CO^7Yk0U8X0h8#bT6IK1lzw1^X*h3?D{f1z?u0Z9{_ME(kf3S(&Ao`q^WmymeT_H zGTbLu263cH7yunFfw!SVT$3g6dlr~FvMUKcw_7+XH5-rac^TvJ@Gfqb1{9>G!ouP< z+N95I53lLtF~6Lw%H&GFuq-~<@sBuNQ)zYXIA8i?N&cZM^~ z6L>m!7;e3@gd1$Gt`MHT@?fbE3msb>^GM&6JlJI5m?`=b@^^P5OskZ9@^BGcEIWPT zJtN%SC1yMGV5+h4!e$cO6yt<~d|*oh;2K(n{%WdO1xS9Egt=QV#1b0;;BE-(hY_2d24cD-Pp2a6LeA~~HO_qx15I7aW6P^+5 zOafu(w_N8~I4AQY%nV08w$>;DZ7~eY5j2@?n+W#p0tV3DB?T!MhMcd}U_F znzta#Ty2%+XT9WXu_d}18c#OXuxM=XOUUo(gaw9m0rRSM>R~RuvcUs;v=97|gFHc5 zf~>cz4Iei`9x$54jSSX}-I_pNc!}a3hV*ideF8dC9)<9bj;k4LXY9O=iP%=_nt&n# zQnFpXJIP3Yy5ToKABcl3fa5XL*pYWa> z9?~cnsT_o#NS&1Zz6qbMdr4I3*(=?jrj-SuaU@9^TgD6D53P z$96#{839F)&&V#oQx|(sIs%TmaG=H0H)DL#ius8uBl68d&UAk538O~kvWLU&>0Gs6 z@?-*NeH=YqGgIJ+Y0V6)L?_`b542D>XFiMsnRgx;k?nez%Ljv-Vf?{`_sNBE01sQm z-i9WE7I8-m&BO+`GtF&qHBK5Ckz0^O#6#kO{A{>jXMUIQ&?=T<^Ag6x?#FhIE?IC0 zgl()>O70juOp7+=8z>H79;(qFWCSdl*kL2`*aKN`Wk*R^uU%_J9>3kfY2b>2iNO|0 zi%AS?zRru)LTr5Q<%91tas^4svjknE9m`;gj94#R55CzrPGYC}41AOgb-)=9VOVvX zDPsvf5@$~0{88nmR34$BPNQJY&B~Y8P?cSqYP)j(T_!nXm~RbhZ#*Jk_V~7gJYpP6W1w&)e7b}e$e3_gejR->`8fiJLsH{ z+@)Ke{z+X15cuGUjg36wWNWVM&h#1`>~fHu%XZNkR@RjHu8vJ}fBZn;E`ZHEc!mm# zFD@nd8L)9>{5j>St3@eC5>X3a4=fOh`f>Sa4zIafRShCvHFqfOhdXABM0y zjCQg4pxF|vk~tdz=)eM)2p6~vC=iXVaJ(qt!7(F7JPf-rZbKRWtG#oLjq^J5`uj?{(zHMpiGl2{KRAGk-M0P^v@YOn{XxC_{?9pQ-gh`u z>`jX;&{CK4p8I*ubDs0u&UxRdEzY|`zTeLLI7nxS2I|ZWBXtzSsRj5WKrq777njW& z@1`%*IR%`D|C;G*))h{CH?g+HMm{2M1o}N)>kLUJieIZzNI^=AulI69?bb&QS9a#3RFH5$ZSErqptGj4qr-je!49ktXd zq}ya^nG*q5DuG+67K}=mOjX1*MUMv8N+&>CUaI)W`RbbG9fi7em}Ci?pOK=vh(`HR z+q}lt)~Z(nev)YD+GAaPTg>xaA2-<=vV#rW8rxTnkXS0B$rj#nJg$=Tk?LA)-I5}v z7E?9S^7jFxz|7gvd3$LTdF{E>=CCJtrjViSrI5UwZD@YFX|P?-oxR?;$JiUt*{QU# z9kWK^!+1wq!XyEr7N|Aa4@+`R*jimg3y-~1 zaJuffX((4qP@?1ZfTkoKSeTN zsU+v%T6T)z<7>6liFcSoI;ZVK9M={%0BR=u#us$((Gr73gfc_?wHM(zEvzG1+5EOq zFGE&(fm5}D6h~UqZCgSBw8+IP9Uir&Y^0*|7H46-GNO)r^?=~GN!*QwzW^;)s zLM(#*PI_xR{@}e2FbV_ z4Yycrte?8rI3IMh$%bD~BdBo{JrEC-&m^ZRwni+d`CU%e<}Y&CYEF)LeBaguJ8bR( z2x-{KzR*ioP6OiSScSkz#3M(lt<~CYQPhpk*iyhqk=Ct4@?adcSJ!Tb;iL~?xoQ-T z)wh()>r%kv^6~m2NUVX9`G#A?HO-3KIUdSE@QAcLSqr!i8m@8i?0kIp_>|8eUaBb8t&~Oldq5ZRM%-7)uzv<=PH(uq9*6pVcHCm`)dy zV@60PR*nFXMdkR39oiN}glSb~7oiJ9PU!>_W~cbk>Q$flAiUYfj@OsDOXuU$0c)z- zhDK$~)aNd63omZ0z#aT-(|UU-NTAxLP&049Q>L-@TPA=`by}B)9;mI`y!~CF)&xW6 z$q`Dr^MI8$j2Ids3T*m*>T%j}%5BpPQ`IE}F$#`fbwWJ30IRi}^|}skB3JW{K=1x# zKSs%D;LFzvnfrJw!8c;ch%alUxEZ*(gsafFjKO`nR@b=+0)kT#Xc*Npm7!}D?KxgU zZ>tm(cweF}W)*~7>tWWyiK(f{Q`3{v@~~)iwuq&P#$45IbFHtfEXwrYL?AXNVGt-m5F_F@fjFoA7 zgpS&XPwZ>EeAS=m06@9vJ^O*>W3Z_8N%?rC=roek*^>*Nh=qC4j=9~!@h>`4 zaBj)qxlr?+v}zftHB!yD0EHio6%GKjd{;P|tYKt*K9TInR(*ecIbB_x&{y9MFP%7P z$43i-t6v&(-n)3@d~J@Cfv{MxCx7;2*J2igG1f|=K**6#@`!FzwA@Y8HMY0>m7b*I zj99;I7LYvs#)v#3sTw3dptYn3i_?uN!E9af|R zSMaKAOsGI-Rdcm@-L~?D=?sA*O*b~smQSZu-lkxgN+Yc}wun8THN{a{jZ%4DG2d6{M?ch*TQQZ}BSWh58j|@knKET}pX8NZd{XM_mk;ilmR5N8U?))Sx(t6@P_z z$xa`k$Z-6%=AFV-J}a@rErKe>H0G9Wad0u+cuR7Nh0RBGU3Zf@JI{$bG0~k0$P&>k zhubt{W5-v67^?*HCJ$TR&L4<|MA_l8VQSMrYgV zfquxU@jxq91ZB~Dl2_d&dre}=AB2mQfB?uzMZOY~6yJUw1fK?Ue*F zm_NgyActFjegiF~b!Toht;UKD6_L{f&h@#IBO{Hg>#oX-&FXfS{kt10h)r4EW^3RB zPv5MpCAVIx;acn!z6*l60HhFnidN^ji*??i0!VGu_nN0a+r?k&V$qE9WU%KhJ?U;TQu%uOm@ziV$*~eq?G|GHbD3 zO}}swHVz{6A~?9J1Jjkukhk8^GPSvtFT^{7miX^f)IBF-mccD4F#f@&K4$7ms2m3#8EiO!Kh2UY7h&KtgK#L6Qk(tjQaxfwIv-acL4AZ zQ(;?l7Kk;-R;Lh^_eQl~84LAu7ZJN{oowMinheI-8ocL{t+vmwMyJ8r6^o@%8k`4) z1oZQ|nU*csx4d}9HDxXVBr^zut1;I-me(ay7Tp9)Xl3nwT@DpRC)KwUKy--wz=XV8 z!ri}u+~W#Q083ln`#&Xcm6Bc@auCLMkICK0PdZ3FC!q(aX?8f4#>unnDmY65fi8C~ zaNP!q8=13vcK%WZ1m&5Xi4Z#wG_Ip-swgeE5|FH>3|Tg?go7c~4`*+358U8JqOWXM z_0_t}_uLy?s5nXum%8(>z(fROz!OB8`oAiXs>Rqbq z4Gw9T%V6AmG;W4jnTIo+3wd{E>+FWxi6&|6P|CV**wP!3DUI{|g3uZG@uZkK*U4Hy z&q_CFrIP#^lMM|#V)Z5O&4@zQx;}cp9iKs92S3iePwherbsjdo%Ju_Ymmp5GN_q0F z%`_|=7u(9z%4Md>D`}1OmEOA+UTtjU^=Ds}ZFYDJ7$t6ew=AJw%KqH^p- zk7TQsv8#mQQguwPH6829OvaMb(|tbe|gwVFV+y!z$(Hwn>^Y!@qz%% zDct_zcoRW4eij#&-B=!p{#M(cE2}M5%LEY@Q`M_&@2C0n=a9Z^I?k?7E-XO*$(jK~ zI7n@+y0@y1bDn~`#dsRaG_w-62flF6-pC2(i8CvK@y)Dw2IwOp}7~ zmW{2e6sg)qu!!phTn~y^H)hpBm>+FR(zrNs(GGOav2muVyt-)T@~tckQR8bWCT=9> zUE<1yrd81LnkXTL9jMk?if^?lh@({N%MD%XI3)^+6m+%CI!3ceE^f4!;44}LeeSco z_7`bOw9HAuxr>WcZrVo8zTpo?Puk14+~YG%-ZS&Eo(EI7| z%1vKfU0qp2(@J(&+@9@{o6n(*^Nk4Z`tY@gb-sBw!S^CAx+>q1Xz-1R2H(3|A9R3 z0bP@-FqsC5wFWy+T3~5PetH-Ay!NVruZh(yH%_z4r~0boEfSt3)TI4HtMs9M*ZEuH za~tUFr28$W;x02v)%vYd@0`{2$Xn(oG!kekw5%DND~4XxzQhP~){jS^VDe-6FwUgH z7~J8ZRP)i8>bF8aO4nTG;xu!{G%@&u_KW0WJ=mBd?g;e+w`M0SO0RaSW0N+Ddc<0!?^6b+C$CG?@O{nksgfB=)Elk( z9ww$0a|Mw{gWeXEy1RW2E6j8UT2rf$&B*_dl!R}@gS zXQVm5wU!M7d>eL8XB#&j`xExosVO{Hj8+#(iAvw2*Fw6b+cOSS=V&Qv6pd7z`>^`Z z9#QHBuzmW*b^P9|(4XHMnyLB{t!PKM!jz45j=b}HK~>b~>C^2xPKg*&m3q*|@Gn|V zH~u&IJm=%|F1lB{1lsfTAd1sIt?)7VgH~@97*<#z(Z@QNcQ>D5FN{Nt6MWS3B>QBN z*fih2Il)JDmVsAH@ffwMhM&u{UW0l^Xrb}Yq{tE0JUzHuWB$>O)poZ&99nNvwkNh5 zaVNr9Nne6MdxDp2V%cp;eeJPiPIZIJ-ICr(BVpeOO4m~XAMVyV_|?kBHK{;N;vuSW zmumDJQkWZIt|Qj!Go&5>kDuUIv!H8AMn&H}54d~D;fu$Xqvr!|%<`6qf0U1?9&njH zt%26c6*Rt&|E6=dD5agMH4!~)&wNTFTgm;*TQunToAN0ci0z5@MG9~Of;x=R*V;kD zhisMNEG6I~O){TdhZrxF9{5n`;X{maM~L6yGQY-8iP+x*@WA8DXP&v<3*1}EZX0I~N$gErG4b~9b)`tW~lwO z!d$eAg>8>hVKQP>dD_?H-MTeTWn;ct|dK z(%r9vyLG$VfRSC|6(0MhecTy$bGwEhta;s1b*~V2pH6CSm6Gq-_V(@Pv;~$M%)Gsp z%nRi5Ucn_tz2+<}$nY_A2;8;JFQ?i-f3tLeZCZ3u)}?ijW_H$AO8W{awI`h;&7Qp5 zj<8PBAHAWYS!ow&m9+!i?Z3F(>yqyC zWZOuK_S%i7F<~j{!G3MMUMt82jrgp)Ls*hUgJ+L<9;c0H(aVz94^(=udS0M~C_CA+ zOWW4>xc9xf+q5S;TekM%#rD(OF<*h)u2M?)Z_k>e(blPS2?1g{na}@n5Z$;( zcl$Vfw=2L}9xZI5{<{a#>?ks=1w*mOL`xvz7y7;Wy0wp>?A<=iLPZrvqb6G>8NvOn zhv``gw>FcMcbT1aFrZ$v$dMSm@yhX{<%&=jZIdac4H=0`inS-1b`dTJI*C0|^#p6x zlsu_(Y%5dsM2dcEXsZWR@Ad@#ga}2ziCBVI8}0K~srt}dJr@1;JSc<)xVE!NFef|6CV9c<~b48oi?Ao|=c$tU&VHBGlqBlwvm z8`W>qPy@}Wy@sr?*q#kki29L9LCW?AZTn8_pkwqccOWC*;{7ku9z4s?cG4=j&ux`Z z?UGYkqp+8F!y*&cTDCg`-N74;5?OhN9=KP1H-Jj8h(*~vZr++3r2HQ35V0CB9}WJG zcIMr1w4T529>s?FB0mtKkni&nRxLbhA({j^V1*DZm=MWJ$glSdeUX(A?R?5T!cU4o zcRAVgC$PJ;s5(>K=V6R%CQS=zahyEFEg%r4r$TWYS%vg)gb zr6?E@QQ&*$x&&~|v9ex>NK{2<@B*z@n3*&ZzwYw0DlRUfJ)HJAL4)J+w_M==3Oc$3 zl(Z?WiiAZJJYHytwmZjmeX-QtcRy`CtM42s?YHvt5Kg>3C;zA0bA;B3-Zw+aEu8=o zFFrlx%QqbTZJoA~XiL^o(obUdX*F+DdI(DyZM86wa*DeH?R?d9El(rf56pW!Koe{e z+v{m>$}euOeO&|Zt@b^FPg-15NaPa{|M?J5w`}U0MUin0xN}E);}Gn`=vNYDgxoHq zRFCT9QFV0UpS+o$XU^kquE6UX9Ua7%i>Npn}`ATeQNW ze|bX_zI<0$6ZrFOo;u<#>%hn^`BFvQ!a4iwR(X*8-sq@%ASv^fxTkebu^qMh(&CURTCV7;n*j7BGh>SMPv=gPFvv#L~Xl~QHPuPSe zAeHv1dPW&f<&w!TxuqEXhz zF^A_qF>=|Hi9)2)O*#L)Th;C3!kyI+?zVLZefSXTqB=LK0b#ixy>)Ki_LesD{00rr+cTx+b^qMl-@CVT&}V-vQ`&rj-b zz4@-*p?o)8@_W7tvIISqY^MAH{2iHGC0iOVO_X~onM`TC$7QqSGGV4%?j@79Fm-(Qh(yrZ^u2ix( zv^&$CP7jy+)nK<(9#CZ;Ef!QU#D~jy1}F{E-=OO*-N&;u$guscD<=9}Hbe)k#-vr~ zvkHpS0p-LPu8YCcJkQ7$&F#(zT7ExB{i%paTddb*^wiufU&tZS!%RzqnteIUzHGAx z&hAV;PaePPpokEY&nvgTKjacoZa+V++@0y`3%Nv;+t;Vufq{@qM7aY4!uingq2uHW z7K>_O6zOw4nL?pJQI1-QX>gte73>}QJaG!aODhH9VqD{uH48N&qV%9ppfnMUKL`TU zbI2v4+(JPJP^P5}0fhmwY)G*W#NE0QS}dswy%L_qZ~l)gZH>rYXkMtSP0TzWKgrI@Lx;;F^v7 z+tz>c^`e3BegAmX9?f@r>Kp#?ZU6Y5f4p2Qj%Kp(ooj3l{Wa$DLD#ciSW^gM6wX`t zmW87h9=34G!bcQ>7}fl_#h>H3$qwl_P^u#e~5yfH4@M=sX0{Tbks5HOG`|@Bkyt`+8lbR4LW{qe@=31uE@penwn1h~lYR%5CXK0=$gr)V&8U5--O1krq1J4yMOG_H zgF*O=uSml7>MR4Oak*%lnWvaF`&2E%K2-Ej(=Dl!cEdWMin#&n^C>#oso3z%eui z977K{h8}PXJ>VF6z%ld?$1pG|mK4XZ8 z;WFBZ{%1+B1uL%DyvCRnHBA_-U8__~FvQ@TO{VQJD5 z@XKuJN-;c;BuW)Dg)3rmG*tNf$KUJ3JsJq|3M4m1K9J@i>5CeIctgPx00X^0-^~&} zW+V&+kB$M6qy$E<(%S(q;8ifqOWCX=KrBT`3N19nr}e4 zl)aJ9tJ4|Z>8UhllbjPGd03Bf>; z%OVIP>;+)|DFuokK>qfiOakUtj^Hc4}@%bHG9v<=ye0~^$6taX&^}$kk;Sp zrMNuG*7Ahx=5>REj*MLL+M5C^kMWf$2ST*5-WGipt@hiZls7H+U4!7=2*JB)2uLIl zyxW36*@B=Cy{@$JT)FHA-FU88Ech(sF#qxcA@ykK(N-J@&HZ^)3{?2M zLH4c@#dYZ@Oyj!7G=jJu#`Ls8%E-7?Br;}B8?V^fZMSi&Py4XFtL9=3oLW~U#Du%(9m8~ZpN_1c#MEd(fq^~bT@_8Z{WZDMemaE1g zSD8$H55(J7iNk0~KcL_)1shiRF|Od57TLTWW1IVdKMNO`1k*4zo?<@N%jE)H!MFJ* z2z}~#WROzg1;yfkYOsKQF7#r09E^&X7TiF4tZ#p7%n;k$-><#&Z?mP%CtxU4rxR96 zX#{nb?XRb`Ac!lG!RFJpfImnUP*E*lkp=AP^>NKVa8)+m<_igjZN!l2NibXo%%u6f7GM@#{HyeWG1y<7 zgYPr{dmc9=*QQs8-_+ujl|tHDD5}b{)Niuj%F(jFsXhEhPzHPdM+2hEATUi2Dcxr> zapSe2jXxGCYW+ou8{cprL1)?E7va%edb0$iPfw2@MDn@}e}DYhfq(h2&nfxUa{JXy~_WNJI^qH@A|M#yw`<(-8^`G_qtAG8QKYZxWpZ&d;{^2cq{@|PU{mI`i zoLm0WpZ)Mx-#vEyKb&{}qHD6N`a8G&FzJKtEPks1L4?gsty8h&czxVXVU)y)vOPbM8b2u+p z^rzQB=_tXuOtvrArCDw~m+kI{i4}6an0ytPeWm-d-8rZcpH>cfoE&N%AdOtMK6>`b z5hPYq=+0%)bEt|9Pl&;yaNfeVEF87)u!U0=KB5rKT{VAh@h2_*w#DDI_)8WZweXaM z6$>BSmvLpjZ&!(5NV&QWZe#63R z7XG${uPfaAzJ;$^&N~*jnw#IY`1dS)S)NpRH2QLA0~QnB&a+W#pfB&Tr8<1hRNy`6 zx0zCRtTuv+$(1k=NEMm-(=B zWv=y!iv#-1*nEW-^4EEP%;jlm99PrcX!gLJnqM~h`7#mfviW5UDa4Xwl{mK5dEBzf zGJ^8up7Av!zE%&BwE)A*e8)g9;Z*i&@p*cvd)CME%F4>c+krE-Va@bh(qX_0)E>r9ktY6RC<9VawE6^%lRVqAYxf{Ol3A$i5&l6&i zFhwj6nI>db_w%dSMn#Rv9G~=RRCu?#(y(t&rLe^LR+%5)_7z8X$BQ@W!V6t`W7JhL z?$%JqYf{@(_!WM}yREgoL2qqabj)k3*71aWKi#>GHoRD<57RT=u8ivs-SH+oBo9S3 zzv`J9sLg^j39|A)t~Z}&A+!csn*3010F?5loP{u(kC%oZ$|4f)SrvD&qO2<&VA8Se zkw@7~m+kw_H#~#+=C5Yl1nh+$WX={Cd*yQcE=gu4+c&w)OaFY4U_L`j)D8;)Ay3sd-n*K?Mt7a--!_E|J8?*~vOR!pb!AEo7l*rYw)uyU^{FL)bC;u&yEskFAz45SrZ5m=>-uCsq;xbo+I&Vb7=vS|`Nxut_GDH!Gx6rz z-W#F5Vm?ePlecBWt*r%_K_cU4*?7u7nwr%{GfOT`VH|g&s-~aQ+t%RS>@690Q+V~( z3s0meO!y8|EFr+WkNv=gBYkr}*dgpEH(;E@R$+X9c2BO~TRv=fSTJ&pLon8FI4^x{ zhJdXn>XT^eMQ{yM=cOZEy5%_Pc8U(=qq1f{QS^yy3G$L=vP1^ zX3D?={e51*uI>Uu*vh3Uq*0nQ>cIXMJ#0Q^dM6Zyku43>XbqclsQC)6PX3`(5%1F! z$!fk5$}BE*O#L>mQ(zUKI5W#NP9Cn&!*KR54~s#&A_2^(q+&!>56zI6%ys_7z2&7B z>x4e{sA#zPLPBxqhthpBOkj78MSh%rFbi#jtik$U6mERWAhsEZx@6x=JN!zn(v=_X z!C6UW|K8ldaL;g0sreWD!@~;SpqIY1wGYMb$!ITcKB4|I?1^k|m!a-yX(C;w+2BPI z{~m_MhH`~s7ZG?mR61Pb5WsaoeNrP4F2-s6E|XV4yBhq#O^plcNsVii$g@%`4sA-n zVC!pTiz<7ay(*k+{-jhXo1HZv&hQh?3pamax@z55vq73N_N|9E385R2X7iPTfAkN5 zLG)?QAdDwtpCQU_%D7!4BfrK!|J|JiAOCR046oYpi!tjXD|{Kt^=DjB}tv7m4<+FSgsZn`&q;jHm`9gi| z!d;c)^||xa+G6F%NM+{o%3YQ5#oCoxy)r&hd1!^7YF}@xT-vU`QN|q|tDHK|H-uIz zN7kzKb5uj6tk?(F8Wlbtre95(=aL_Sd!NmsQg2kM6+T4aznWB8S*WBY%NfmVA#5i5*B)N0uJTh;t?w7u7e^ZzH+65;>M2-OywXaxMZT1( zmlW{z$+e@4i^uuCga5t4T5V)rdO3go=k2a?*kU`u4hD8Gu!Dge4D4Xw{~iW1j+;O3 z1E>S-FnDJJFP(JctKNhBf8=o1z0|Fg|MOD!JwzUI)9wu61TW`L^K!yTUOG9$^MpG_ zTz|gX{h$Ab+(5nf0sidnuGaI{trV|1&qVtA%%eOq^s1}f$G9=88^pTRq#L~Y^AT&M zV+vi>=4QKdw8t&do} z8EUOq`8c_H4MH#3RQR-jdU=R4UCb8_^@71Aa^D|(qhY?IHs4c>E6UXRYGh$s*z>(< zWI=S=@`O>%!{5r$YWvSmpxaXGLv3r}sah`t>eUF%6!$ZK5}MPUa({PTchfa)y0(8E zP1w?_Pr7|RVlx(vo-+D5NgF|`*B!L_k!D-3p}cQ8x{KYMp;zH^9@^7e$lLD|=MEXo zx7XcD`8T5b!`613S?eaeUc&LOB);GFhQOU*2Ln48*ulUK26iy8gMl3k>|kIA1OGo@ zU^I*NjA76B6nFmYU|FtCGx9SrPXU + + + nunit.framework + + + + + The different targets a test action attribute can be applied to + + + + + Default target, which is determined by where the action attribute is attached + + + + + Target a individual test case + + + + + Target a suite of test cases + + + + + Delegate used by tests that execute code and + capture any thrown exception. + + + + + The Assert class contains a collection of static methods that + implement the most common assertions used in NUnit. + + + + + We don't actually want any instances of this object, but some people + like to inherit from it to add other static methods. Hence, the + protected constructor disallows any instances of this object. + + + + + The Equals method throws an AssertionException. This is done + to make sure there is no mistake by calling this function. + + + + + + + override the default ReferenceEquals to throw an AssertionException. This + implementation makes sure there is no mistake in calling this function + as part of Assert. + + + + + + + Throws a with the message and arguments + that are passed in. This allows a test to be cut short, with a result + of success returned to NUnit. + + The message to initialize the with. + Arguments to be used in formatting the message + + + + Throws a with the message and arguments + that are passed in. This allows a test to be cut short, with a result + of success returned to NUnit. + + The message to initialize the with. + + + + Throws a with the message and arguments + that are passed in. This allows a test to be cut short, with a result + of success returned to NUnit. + + + + + Throws an with the message and arguments + that are passed in. This is used by the other Assert functions. + + The message to initialize the with. + Arguments to be used in formatting the message + + + + Throws an with the message that is + passed in. This is used by the other Assert functions. + + The message to initialize the with. + + + + Throws an . + This is used by the other Assert functions. + + + + + Throws an with the message and arguments + that are passed in. This causes the test to be reported as ignored. + + The message to initialize the with. + Arguments to be used in formatting the message + + + + Throws an with the message that is + passed in. This causes the test to be reported as ignored. + + The message to initialize the with. + + + + Throws an . + This causes the test to be reported as ignored. + + + + + Throws an with the message and arguments + that are passed in. This causes the test to be reported as inconclusive. + + The message to initialize the with. + Arguments to be used in formatting the message + + + + Throws an with the message that is + passed in. This causes the test to be reported as inconclusive. + + The message to initialize the with. + + + + Throws an . + This causes the test to be reported as Inconclusive. + + + + + Apply a constraint to an actual value, succeeding if the constraint + is satisfied and throwing an assertion exception on failure. + + The actual value to test + A Constraint to be applied + + + + Apply a constraint to an actual value, succeeding if the constraint + is satisfied and throwing an assertion exception on failure. + + The actual value to test + A Constraint to be applied + The message that will be displayed on failure + + + + Apply a constraint to an actual value, succeeding if the constraint + is satisfied and throwing an assertion exception on failure. + + The actual value to test + A Constraint expression to be applied + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Asserts that a condition is true. If the condition is false the method throws + an . + + The evaluated condition + The message to display if the condition is false + Arguments to be used in formatting the message + + + + Asserts that a condition is true. If the condition is false the method throws + an . + + The evaluated condition + The message to display if the condition is false + + + + Asserts that a condition is true. If the condition is false the method throws + an . + + The evaluated condition + + + + Apply a constraint to an actual value, succeeding if the constraint + is satisfied and throwing an assertion exception on failure. + + An ActualValueDelegate returning the value to be tested + A Constraint expression to be applied + + + + Apply a constraint to an actual value, succeeding if the constraint + is satisfied and throwing an assertion exception on failure. + + An ActualValueDelegate returning the value to be tested + A Constraint expression to be applied + The message that will be displayed on failure + + + + Apply a constraint to an actual value, succeeding if the constraint + is satisfied and throwing an assertion exception on failure. + + An ActualValueDelegate returning the value to be tested + A Constraint expression to be applied + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Apply a constraint to a referenced value, succeeding if the constraint + is satisfied and throwing an assertion exception on failure. + + The actual value to test + A Constraint to be applied + + + + Apply a constraint to a referenced value, succeeding if the constraint + is satisfied and throwing an assertion exception on failure. + + The actual value to test + A Constraint to be applied + The message that will be displayed on failure + + + + Apply a constraint to a referenced value, succeeding if the constraint + is satisfied and throwing an assertion exception on failure. + + The actual value to test + A Constraint to be applied + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Asserts that the code represented by a delegate throws an exception + that satisfies the constraint provided. + + A TestDelegate to be executed + A ThrowsConstraint used in the test + + + + Apply a constraint to an actual value, succeeding if the constraint + is satisfied and throwing an assertion exception on failure. + Used as a synonym for That in rare cases where a private setter + causes a Visual Basic compilation error. + + The actual value to test + A Constraint to be applied + + + + Apply a constraint to an actual value, succeeding if the constraint + is satisfied and throwing an assertion exception on failure. + Used as a synonym for That in rare cases where a private setter + causes a Visual Basic compilation error. + + The actual value to test + A Constraint to be applied + The message that will be displayed on failure + + + + Apply a constraint to an actual value, succeeding if the constraint + is satisfied and throwing an assertion exception on failure. + Used as a synonym for That in rare cases where a private setter + causes a Visual Basic compilation error. + + + This method is provided for use by VB developers needing to test + the value of properties with private setters. + + The actual value to test + A Constraint expression to be applied + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Verifies that a delegate throws a particular exception when called. + + A constraint to be satisfied by the exception + A TestDelegate + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Verifies that a delegate throws a particular exception when called. + + A constraint to be satisfied by the exception + A TestDelegate + The message that will be displayed on failure + + + + Verifies that a delegate throws a particular exception when called. + + A constraint to be satisfied by the exception + A TestDelegate + + + + Verifies that a delegate throws a particular exception when called. + + The exception Type expected + A TestDelegate + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Verifies that a delegate throws a particular exception when called. + + The exception Type expected + A TestDelegate + The message that will be displayed on failure + + + + Verifies that a delegate throws a particular exception when called. + + The exception Type expected + A TestDelegate + + + + Verifies that a delegate throws a particular exception when called. + + Type of the expected exception + A TestDelegate + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Verifies that a delegate throws a particular exception when called. + + Type of the expected exception + A TestDelegate + The message that will be displayed on failure + + + + Verifies that a delegate throws a particular exception when called. + + Type of the expected exception + A TestDelegate + + + + Verifies that a delegate throws an exception when called + and returns it. + + A TestDelegate + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Verifies that a delegate throws an exception when called + and returns it. + + A TestDelegate + The message that will be displayed on failure + + + + Verifies that a delegate throws an exception when called + and returns it. + + A TestDelegate + + + + Verifies that a delegate throws an exception of a certain Type + or one derived from it when called and returns it. + + The expected Exception Type + A TestDelegate + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Verifies that a delegate throws an exception of a certain Type + or one derived from it when called and returns it. + + The expected Exception Type + A TestDelegate + The message that will be displayed on failure + + + + Verifies that a delegate throws an exception of a certain Type + or one derived from it when called and returns it. + + The expected Exception Type + A TestDelegate + + + + Verifies that a delegate throws an exception of a certain Type + or one derived from it when called and returns it. + + The expected Exception Type + A TestDelegate + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Verifies that a delegate throws an exception of a certain Type + or one derived from it when called and returns it. + + The expected Exception Type + A TestDelegate + The message that will be displayed on failure + + + + Verifies that a delegate throws an exception of a certain Type + or one derived from it when called and returns it. + + The expected Exception Type + A TestDelegate + + + + Verifies that a delegate does not throw an exception + + A TestDelegate + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Verifies that a delegate does not throw an exception. + + A TestDelegate + The message that will be displayed on failure + + + + Verifies that a delegate does not throw an exception. + + A TestDelegate + + + + Asserts that a condition is true. If the condition is false the method throws + an . + + The evaluated condition + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Asserts that a condition is true. If the condition is false the method throws + an . + + The evaluated condition + The message to display in case of failure + + + + Asserts that a condition is true. If the condition is false the method throws + an . + + The evaluated condition + + + + Asserts that a condition is true. If the condition is false the method throws + an . + + The evaluated condition + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Asserts that a condition is true. If the condition is false the method throws + an . + + The evaluated condition + The message to display in case of failure + + + + Asserts that a condition is true. If the condition is false the method throws + an . + + The evaluated condition + + + + Asserts that a condition is false. If the condition is true the method throws + an . + + The evaluated condition + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Asserts that a condition is false. If the condition is true the method throws + an . + + The evaluated condition + The message to display in case of failure + + + + Asserts that a condition is false. If the condition is true the method throws + an . + + The evaluated condition + + + + Asserts that a condition is false. If the condition is true the method throws + an . + + The evaluated condition + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Asserts that a condition is false. If the condition is true the method throws + an . + + The evaluated condition + The message to display in case of failure + + + + Asserts that a condition is false. If the condition is true the method throws + an . + + The evaluated condition + + + + Verifies that the object that is passed in is not equal to null + If the object is null then an + is thrown. + + The object that is to be tested + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the object that is passed in is not equal to null + If the object is null then an + is thrown. + + The object that is to be tested + The message to display in case of failure + + + + Verifies that the object that is passed in is not equal to null + If the object is null then an + is thrown. + + The object that is to be tested + + + + Verifies that the object that is passed in is not equal to null + If the object is null then an + is thrown. + + The object that is to be tested + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the object that is passed in is not equal to null + If the object is null then an + is thrown. + + The object that is to be tested + The message to display in case of failure + + + + Verifies that the object that is passed in is not equal to null + If the object is null then an + is thrown. + + The object that is to be tested + + + + Verifies that the object that is passed in is equal to null + If the object is not null then an + is thrown. + + The object that is to be tested + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the object that is passed in is equal to null + If the object is not null then an + is thrown. + + The object that is to be tested + The message to display in case of failure + + + + Verifies that the object that is passed in is equal to null + If the object is not null then an + is thrown. + + The object that is to be tested + + + + Verifies that the object that is passed in is equal to null + If the object is not null then an + is thrown. + + The object that is to be tested + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the object that is passed in is equal to null + If the object is not null then an + is thrown. + + The object that is to be tested + The message to display in case of failure + + + + Verifies that the object that is passed in is equal to null + If the object is not null then an + is thrown. + + The object that is to be tested + + + + Verifies that two ints are equal. If they are not, then an + is thrown. + + The expected value + The actual value + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that two ints are equal. If they are not, then an + is thrown. + + The expected value + The actual value + The message to display in case of failure + + + + Verifies that two ints are equal. If they are not, then an + is thrown. + + The expected value + The actual value + + + + Verifies that two longs are equal. If they are not, then an + is thrown. + + The expected value + The actual value + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that two longs are equal. If they are not, then an + is thrown. + + The expected value + The actual value + The message to display in case of failure + + + + Verifies that two longs are equal. If they are not, then an + is thrown. + + The expected value + The actual value + + + + Verifies that two unsigned ints are equal. If they are not, then an + is thrown. + + The expected value + The actual value + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that two unsigned ints are equal. If they are not, then an + is thrown. + + The expected value + The actual value + The message to display in case of failure + + + + Verifies that two unsigned ints are equal. If they are not, then an + is thrown. + + The expected value + The actual value + + + + Verifies that two unsigned longs are equal. If they are not, then an + is thrown. + + The expected value + The actual value + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that two unsigned longs are equal. If they are not, then an + is thrown. + + The expected value + The actual value + The message to display in case of failure + + + + Verifies that two unsigned longs are equal. If they are not, then an + is thrown. + + The expected value + The actual value + + + + Verifies that two decimals are equal. If they are not, then an + is thrown. + + The expected value + The actual value + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that two decimals are equal. If they are not, then an + is thrown. + + The expected value + The actual value + The message to display in case of failure + + + + Verifies that two decimals are equal. If they are not, then an + is thrown. + + The expected value + The actual value + + + + Verifies that two doubles are equal considering a delta. If the + expected value is infinity then the delta value is ignored. If + they are not equal then an is + thrown. + + The expected value + The actual value + The maximum acceptable difference between the + the expected and the actual + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that two doubles are equal considering a delta. If the + expected value is infinity then the delta value is ignored. If + they are not equal then an is + thrown. + + The expected value + The actual value + The maximum acceptable difference between the + the expected and the actual + The message to display in case of failure + + + + Verifies that two doubles are equal considering a delta. If the + expected value is infinity then the delta value is ignored. If + they are not equal then an is + thrown. + + The expected value + The actual value + The maximum acceptable difference between the + the expected and the actual + + + + Verifies that two doubles are equal considering a delta. If the + expected value is infinity then the delta value is ignored. If + they are not equal then an is + thrown. + + The expected value + The actual value + The maximum acceptable difference between the + the expected and the actual + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that two doubles are equal considering a delta. If the + expected value is infinity then the delta value is ignored. If + they are not equal then an is + thrown. + + The expected value + The actual value + The maximum acceptable difference between the + the expected and the actual + The message to display in case of failure + + + + Verifies that two doubles are equal considering a delta. If the + expected value is infinity then the delta value is ignored. If + they are not equal then an is + thrown. + + The expected value + The actual value + The maximum acceptable difference between the + the expected and the actual + + + + Verifies that two objects are equal. Two objects are considered + equal if both are null, or if both have the same value. NUnit + has special semantics for some object types. + If they are not equal an is thrown. + + The value that is expected + The actual value + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that two objects are equal. Two objects are considered + equal if both are null, or if both have the same value. NUnit + has special semantics for some object types. + If they are not equal an is thrown. + + The value that is expected + The actual value + The message to display in case of failure + + + + Verifies that two objects are equal. Two objects are considered + equal if both are null, or if both have the same value. NUnit + has special semantics for some object types. + If they are not equal an is thrown. + + The value that is expected + The actual value + + + + Verifies that two ints are not equal. If they are equal, then an + is thrown. + + The expected value + The actual value + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that two ints are not equal. If they are equal, then an + is thrown. + + The expected value + The actual value + The message to display in case of failure + + + + Verifies that two ints are not equal. If they are equal, then an + is thrown. + + The expected value + The actual value + + + + Verifies that two longs are not equal. If they are equal, then an + is thrown. + + The expected value + The actual value + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that two longs are not equal. If they are equal, then an + is thrown. + + The expected value + The actual value + The message to display in case of failure + + + + Verifies that two longs are not equal. If they are equal, then an + is thrown. + + The expected value + The actual value + + + + Verifies that two unsigned ints are not equal. If they are equal, then an + is thrown. + + The expected value + The actual value + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that two unsigned ints are not equal. If they are equal, then an + is thrown. + + The expected value + The actual value + The message to display in case of failure + + + + Verifies that two unsigned ints are not equal. If they are equal, then an + is thrown. + + The expected value + The actual value + + + + Verifies that two unsigned longs are not equal. If they are equal, then an + is thrown. + + The expected value + The actual value + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that two unsigned longs are not equal. If they are equal, then an + is thrown. + + The expected value + The actual value + The message to display in case of failure + + + + Verifies that two unsigned longs are not equal. If they are equal, then an + is thrown. + + The expected value + The actual value + + + + Verifies that two decimals are not equal. If they are equal, then an + is thrown. + + The expected value + The actual value + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that two decimals are not equal. If they are equal, then an + is thrown. + + The expected value + The actual value + The message to display in case of failure + + + + Verifies that two decimals are not equal. If they are equal, then an + is thrown. + + The expected value + The actual value + + + + Verifies that two floats are not equal. If they are equal, then an + is thrown. + + The expected value + The actual value + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that two floats are not equal. If they are equal, then an + is thrown. + + The expected value + The actual value + The message to display in case of failure + + + + Verifies that two floats are not equal. If they are equal, then an + is thrown. + + The expected value + The actual value + + + + Verifies that two doubles are not equal. If they are equal, then an + is thrown. + + The expected value + The actual value + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that two doubles are not equal. If they are equal, then an + is thrown. + + The expected value + The actual value + The message to display in case of failure + + + + Verifies that two doubles are not equal. If they are equal, then an + is thrown. + + The expected value + The actual value + + + + Verifies that two objects are not equal. Two objects are considered + equal if both are null, or if both have the same value. NUnit + has special semantics for some object types. + If they are equal an is thrown. + + The value that is expected + The actual value + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that two objects are not equal. Two objects are considered + equal if both are null, or if both have the same value. NUnit + has special semantics for some object types. + If they are equal an is thrown. + + The value that is expected + The actual value + The message to display in case of failure + + + + Verifies that two objects are not equal. Two objects are considered + equal if both are null, or if both have the same value. NUnit + has special semantics for some object types. + If they are equal an is thrown. + + The value that is expected + The actual value + + + + Asserts that two objects refer to the same object. If they + are not the same an is thrown. + + The expected object + The actual object + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Asserts that two objects refer to the same object. If they + are not the same an is thrown. + + The expected object + The actual object + The message to display in case of failure + + + + Asserts that two objects refer to the same object. If they + are not the same an is thrown. + + The expected object + The actual object + + + + Asserts that two objects do not refer to the same object. If they + are the same an is thrown. + + The expected object + The actual object + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Asserts that two objects do not refer to the same object. If they + are the same an is thrown. + + The expected object + The actual object + The message to display in case of failure + + + + Asserts that two objects do not refer to the same object. If they + are the same an is thrown. + + The expected object + The actual object + + + + Verifies that the double that is passed in is an NaN value. + If the object is not NaN then an + is thrown. + + The value that is to be tested + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the double that is passed in is an NaN value. + If the object is not NaN then an + is thrown. + + The value that is to be tested + The message to display in case of failure + + + + Verifies that the double that is passed in is an NaN value. + If the object is not NaN then an + is thrown. + + The value that is to be tested + + + + Verifies that the double that is passed in is an NaN value. + If the object is not NaN then an + is thrown. + + The value that is to be tested + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the double that is passed in is an NaN value. + If the object is not NaN then an + is thrown. + + The value that is to be tested + The message to display in case of failure + + + + Verifies that the double that is passed in is an NaN value. + If the object is not NaN then an + is thrown. + + The value that is to be tested + + + + Assert that a string is empty - that is equal to string.Empty + + The string to be tested + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Assert that a string is empty - that is equal to string.Empty + + The string to be tested + The message to display in case of failure + + + + Assert that a string is empty - that is equal to string.Empty + + The string to be tested + + + + Assert that an array, list or other collection is empty + + An array, list or other collection implementing ICollection + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Assert that an array, list or other collection is empty + + An array, list or other collection implementing ICollection + The message to display in case of failure + + + + Assert that an array, list or other collection is empty + + An array, list or other collection implementing ICollection + + + + Assert that a string is not empty - that is not equal to string.Empty + + The string to be tested + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Assert that a string is not empty - that is not equal to string.Empty + + The string to be tested + The message to display in case of failure + + + + Assert that a string is not empty - that is not equal to string.Empty + + The string to be tested + + + + Assert that an array, list or other collection is not empty + + An array, list or other collection implementing ICollection + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Assert that an array, list or other collection is not empty + + An array, list or other collection implementing ICollection + The message to display in case of failure + + + + Assert that an array, list or other collection is not empty + + An array, list or other collection implementing ICollection + + + + Assert that a string is either null or equal to string.Empty + + The string to be tested + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Assert that a string is either null or equal to string.Empty + + The string to be tested + The message to display in case of failure + + + + Assert that a string is either null or equal to string.Empty + + The string to be tested + + + + Assert that a string is not null or empty + + The string to be tested + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Assert that a string is not null or empty + + The string to be tested + The message to display in case of failure + + + + Assert that a string is not null or empty + + The string to be tested + + + + Asserts that an object may be assigned a value of a given Type. + + The expected Type. + The object under examination + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Asserts that an object may be assigned a value of a given Type. + + The expected Type. + The object under examination + The message to display in case of failure + + + + Asserts that an object may be assigned a value of a given Type. + + The expected Type. + The object under examination + + + + Asserts that an object may be assigned a value of a given Type. + + The expected Type. + The object under examination + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Asserts that an object may be assigned a value of a given Type. + + The expected Type. + The object under examination + The message to display in case of failure + + + + Asserts that an object may be assigned a value of a given Type. + + The expected Type. + The object under examination + + + + Asserts that an object may not be assigned a value of a given Type. + + The expected Type. + The object under examination + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Asserts that an object may not be assigned a value of a given Type. + + The expected Type. + The object under examination + The message to display in case of failure + + + + Asserts that an object may not be assigned a value of a given Type. + + The expected Type. + The object under examination + + + + Asserts that an object may not be assigned a value of a given Type. + + The expected Type. + The object under examination + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Asserts that an object may not be assigned a value of a given Type. + + The expected Type. + The object under examination + The message to display in case of failure + + + + Asserts that an object may not be assigned a value of a given Type. + + The expected Type. + The object under examination + + + + Asserts that an object is an instance of a given type. + + The expected Type + The object being examined + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Asserts that an object is an instance of a given type. + + The expected Type + The object being examined + The message to display in case of failure + + + + Asserts that an object is an instance of a given type. + + The expected Type + The object being examined + + + + Asserts that an object is an instance of a given type. + + The expected Type + The object being examined + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Asserts that an object is an instance of a given type. + + The expected Type + The object being examined + The message to display in case of failure + + + + Asserts that an object is an instance of a given type. + + The expected Type + The object being examined + + + + Asserts that an object is an instance of a given type. + + The expected Type + The object being examined + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Asserts that an object is an instance of a given type. + + The expected Type + The object being examined + The message to display in case of failure + + + + Asserts that an object is an instance of a given type. + + The expected Type + The object being examined + + + + Asserts that an object is not an instance of a given type. + + The expected Type + The object being examined + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Asserts that an object is not an instance of a given type. + + The expected Type + The object being examined + The message to display in case of failure + + + + Asserts that an object is not an instance of a given type. + + The expected Type + The object being examined + + + + Asserts that an object is not an instance of a given type. + + The expected Type + The object being examined + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Asserts that an object is not an instance of a given type. + + The expected Type + The object being examined + The message to display in case of failure + + + + Asserts that an object is not an instance of a given type. + + The expected Type + The object being examined + + + + Asserts that an object is not an instance of a given type. + + The expected Type + The object being examined + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Asserts that an object is not an instance of a given type. + + The expected Type + The object being examined + The message to display in case of failure + + + + Asserts that an object is not an instance of a given type. + + The expected Type + The object being examined + + + + Verifies that the first value is greater than the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is greater than the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + The message to display in case of failure + + + + Verifies that the first value is greater than the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + + + + Verifies that the first value is greater than the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is greater than the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + The message to display in case of failure + + + + Verifies that the first value is greater than the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + + + + Verifies that the first value is greater than the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is greater than the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + The message to display in case of failure + + + + Verifies that the first value is greater than the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + + + + Verifies that the first value is greater than the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is greater than the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + The message to display in case of failure + + + + Verifies that the first value is greater than the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + + + + Verifies that the first value is greater than the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is greater than the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + The message to display in case of failure + + + + Verifies that the first value is greater than the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + + + + Verifies that the first value is greater than the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is greater than the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + The message to display in case of failure + + + + Verifies that the first value is greater than the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + + + + Verifies that the first value is greater than the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is greater than the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + The message to display in case of failure + + + + Verifies that the first value is greater than the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + + + + Verifies that the first value is greater than the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is greater than the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + The message to display in case of failure + + + + Verifies that the first value is greater than the second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + + + + Verifies that the first value is less than the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is less than the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + The message to display in case of failure + + + + Verifies that the first value is less than the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + + + + Verifies that the first value is less than the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is less than the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + The message to display in case of failure + + + + Verifies that the first value is less than the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + + + + Verifies that the first value is less than the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is less than the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + The message to display in case of failure + + + + Verifies that the first value is less than the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + + + + Verifies that the first value is less than the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is less than the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + The message to display in case of failure + + + + Verifies that the first value is less than the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + + + + Verifies that the first value is less than the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is less than the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + The message to display in case of failure + + + + Verifies that the first value is less than the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + + + + Verifies that the first value is less than the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is less than the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + The message to display in case of failure + + + + Verifies that the first value is less than the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + + + + Verifies that the first value is less than the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is less than the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + The message to display in case of failure + + + + Verifies that the first value is less than the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + + + + Verifies that the first value is less than the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is less than the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + The message to display in case of failure + + + + Verifies that the first value is less than the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + + + + Verifies that the first value is greater than or equal tothe second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is greater than or equal tothe second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + The message to display in case of failure + + + + Verifies that the first value is greater than or equal tothe second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + + + + Verifies that the first value is greater than or equal tothe second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is greater than or equal tothe second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + The message to display in case of failure + + + + Verifies that the first value is greater than or equal tothe second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + + + + Verifies that the first value is greater than or equal tothe second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is greater than or equal tothe second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + The message to display in case of failure + + + + Verifies that the first value is greater than or equal tothe second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + + + + Verifies that the first value is greater than or equal tothe second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is greater than or equal tothe second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + The message to display in case of failure + + + + Verifies that the first value is greater than or equal tothe second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + + + + Verifies that the first value is greater than or equal tothe second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is greater than or equal tothe second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + The message to display in case of failure + + + + Verifies that the first value is greater than or equal tothe second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + + + + Verifies that the first value is greater than or equal tothe second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is greater than or equal tothe second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + The message to display in case of failure + + + + Verifies that the first value is greater than or equal tothe second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + + + + Verifies that the first value is greater than or equal tothe second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is greater than or equal tothe second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + The message to display in case of failure + + + + Verifies that the first value is greater than or equal tothe second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + + + + Verifies that the first value is greater than or equal tothe second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is greater than or equal tothe second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + The message to display in case of failure + + + + Verifies that the first value is greater than or equal tothe second + value. If it is not, then an + is thrown. + + The first value, expected to be greater + The second value, expected to be less + + + + Verifies that the first value is less than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is less than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + The message to display in case of failure + + + + Verifies that the first value is less than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + + + + Verifies that the first value is less than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is less than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + The message to display in case of failure + + + + Verifies that the first value is less than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + + + + Verifies that the first value is less than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is less than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + The message to display in case of failure + + + + Verifies that the first value is less than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + + + + Verifies that the first value is less than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is less than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + The message to display in case of failure + + + + Verifies that the first value is less than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + + + + Verifies that the first value is less than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is less than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + The message to display in case of failure + + + + Verifies that the first value is less than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + + + + Verifies that the first value is less than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is less than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + The message to display in case of failure + + + + Verifies that the first value is less than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + + + + Verifies that the first value is less than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is less than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + The message to display in case of failure + + + + Verifies that the first value is less than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + + + + Verifies that the first value is less than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Verifies that the first value is less than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + The message to display in case of failure + + + + Verifies that the first value is less than or equal to the second + value. If it is not, then an + is thrown. + + The first value, expected to be less + The second value, expected to be greater + + + + Asserts that an object is contained in a list. + + The expected object + The list to be examined + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Asserts that an object is contained in a list. + + The expected object + The list to be examined + The message to display in case of failure + + + + Asserts that an object is contained in a list. + + The expected object + The list to be examined + + + + Helper for Assert.AreEqual(double expected, double actual, ...) + allowing code generation to work consistently. + + The expected value + The actual value + The maximum acceptable difference between the + the expected and the actual + The message to display in case of failure + Array of objects to be used in formatting the message + + + + Gets the number of assertions executed so far and + resets the counter to zero. + + + + + AssertionHelper is an optional base class for user tests, + allowing the use of shorter names for constraints and + asserts and avoiding conflict with the definition of + , from which it inherits much of its + behavior, in certain mock object frameworks. + + + + + Helper class with properties and methods that supply + a number of constraints used in Asserts. + + + + + Returns a ConstraintExpression, which will apply + the following constraint to all members of a collection, + succeeding only if a specified number of them succeed. + + + + + Returns a new PropertyConstraintExpression, which will either + test for the existence of the named property on the object + being tested or apply any following constraint to that property. + + + + + Returns a new AttributeConstraint checking for the + presence of a particular attribute on an object. + + + + + Returns a new AttributeConstraint checking for the + presence of a particular attribute on an object. + + + + + Returns a constraint that tests two items for equality + + + + + Returns a constraint that tests that two references are the same object + + + + + Returns a constraint that tests whether the + actual value is greater than the suppled argument + + + + + Returns a constraint that tests whether the + actual value is greater than or equal to the suppled argument + + + + + Returns a constraint that tests whether the + actual value is greater than or equal to the suppled argument + + + + + Returns a constraint that tests whether the + actual value is less than the suppled argument + + + + + Returns a constraint that tests whether the + actual value is less than or equal to the suppled argument + + + + + Returns a constraint that tests whether the + actual value is less than or equal to the suppled argument + + + + + Returns a constraint that tests whether the actual + value is of the exact type supplied as an argument. + + + + + Returns a constraint that tests whether the actual + value is of the exact type supplied as an argument. + + + + + Returns a constraint that tests whether the actual value + is of the type supplied as an argument or a derived type. + + + + + Returns a constraint that tests whether the actual value + is of the type supplied as an argument or a derived type. + + + + + Returns a constraint that tests whether the actual value + is of the type supplied as an argument or a derived type. + + + + + Returns a constraint that tests whether the actual value + is of the type supplied as an argument or a derived type. + + + + + Returns a constraint that tests whether the actual value + is assignable from the type supplied as an argument. + + + + + Returns a constraint that tests whether the actual value + is assignable from the type supplied as an argument. + + + + + Returns a constraint that tests whether the actual value + is assignable from the type supplied as an argument. + + + + + Returns a constraint that tests whether the actual value + is assignable from the type supplied as an argument. + + + + + Returns a constraint that tests whether the actual value + is a collection containing the same elements as the + collection supplied as an argument. + + + + + Returns a constraint that tests whether the actual value + is a subset of the collection supplied as an argument. + + + + + Returns a new CollectionContainsConstraint checking for the + presence of a particular object in the collection. + + + + + Returns a new CollectionContainsConstraint checking for the + presence of a particular object in the collection. + + + + + Returns a new ContainsConstraint. This constraint + will, in turn, make use of the appropriate second-level + constraint, depending on the type of the actual argument. + This overload is only used if the item sought is a string, + since any other type implies that we are looking for a + collection member. + + + + + Returns a constraint that succeeds if the actual + value contains the substring supplied as an argument. + + + + + Returns a constraint that succeeds if the actual + value contains the substring supplied as an argument. + + + + + Returns a constraint that fails if the actual + value contains the substring supplied as an argument. + + + + + Returns a constraint that succeeds if the actual + value starts with the substring supplied as an argument. + + + + + Returns a constraint that succeeds if the actual + value starts with the substring supplied as an argument. + + + + + Returns a constraint that fails if the actual + value starts with the substring supplied as an argument. + + + + + Returns a constraint that succeeds if the actual + value ends with the substring supplied as an argument. + + + + + Returns a constraint that succeeds if the actual + value ends with the substring supplied as an argument. + + + + + Returns a constraint that fails if the actual + value ends with the substring supplied as an argument. + + + + + Returns a constraint that succeeds if the actual + value matches the regular expression supplied as an argument. + + + + + Returns a constraint that succeeds if the actual + value matches the regular expression supplied as an argument. + + + + + Returns a constraint that fails if the actual + value matches the pattern supplied as an argument. + + + + + Returns a constraint that tests whether the path provided + is the same as an expected path after canonicalization. + + + + + Returns a constraint that tests whether the path provided + is the same path or under an expected path after canonicalization. + + + + + Returns a constraint that tests whether the path provided + is the same path or under an expected path after canonicalization. + + + + + Returns a constraint that tests whether the actual value falls + within a specified range. + + + + + Returns a ConstraintExpression that negates any + following constraint. + + + + + Returns a ConstraintExpression that negates any + following constraint. + + + + + Returns a ConstraintExpression, which will apply + the following constraint to all members of a collection, + succeeding if all of them succeed. + + + + + Returns a ConstraintExpression, which will apply + the following constraint to all members of a collection, + succeeding if at least one of them succeeds. + + + + + Returns a ConstraintExpression, which will apply + the following constraint to all members of a collection, + succeeding if all of them fail. + + + + + Returns a new ConstraintExpression, which will apply the following + constraint to the Length property of the object being tested. + + + + + Returns a new ConstraintExpression, which will apply the following + constraint to the Count property of the object being tested. + + + + + Returns a new ConstraintExpression, which will apply the following + constraint to the Message property of the object being tested. + + + + + Returns a new ConstraintExpression, which will apply the following + constraint to the InnerException property of the object being tested. + + + + + Returns a constraint that tests for null + + + + + Returns a constraint that tests for True + + + + + Returns a constraint that tests for False + + + + + Returns a constraint that tests for a positive value + + + + + Returns a constraint that tests for a negative value + + + + + Returns a constraint that tests for NaN + + + + + Returns a constraint that tests for empty + + + + + Returns a constraint that tests whether a collection + contains all unique items. + + + + + Returns a constraint that tests whether an object graph is serializable in binary format. + + + + + Returns a constraint that tests whether an object graph is serializable in xml format. + + + + + Returns a constraint that tests whether a collection is ordered + + + + + Apply a constraint to an actual value, succeeding if the constraint + is satisfied and throwing an assertion exception on failure. Works + identically to Assert.That. + + The actual value to test + A Constraint to be applied + + + + Apply a constraint to an actual value, succeeding if the constraint + is satisfied and throwing an assertion exception on failure. Works + identically to Assert.That. + + The actual value to test + A Constraint to be applied + The message to be displayed in case of failure + + + + Apply a constraint to an actual value, succeeding if the constraint + is satisfied and throwing an assertion exception on failure. Works + identically to Assert.That. + + The actual value to test + A Constraint to be applied + The message to be displayed in case of failure + Arguments to use in formatting the message + + + + Asserts that a condition is true. If the condition is false the method throws + an . Works Identically to + . + + The evaluated condition + The message to display if the condition is false + Arguments to be used in formatting the message + + + + Asserts that a condition is true. If the condition is false the method throws + an . Works Identically to + . + + The evaluated condition + The message to display if the condition is false + + + + Asserts that a condition is true. If the condition is false the method throws + an . Works Identically to . + + The evaluated condition + + + + Apply a constraint to an actual value, succeeding if the constraint + is satisfied and throwing an assertion exception on failure. + + A Constraint expression to be applied + An ActualValueDelegate returning the value to be tested + + + + Apply a constraint to an actual value, succeeding if the constraint + is satisfied and throwing an assertion exception on failure. + + A Constraint expression to be applied + An ActualValueDelegate returning the value to be tested + The message that will be displayed on failure + + + + Apply a constraint to an actual value, succeeding if the constraint + is satisfied and throwing an assertion exception on failure. + + An ActualValueDelegate returning the value to be tested + A Constraint expression to be applied + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Apply a constraint to a referenced value, succeeding if the constraint + is satisfied and throwing an assertion exception on failure. + + The actual value to test + A Constraint to be applied + + + + Apply a constraint to a referenced value, succeeding if the constraint + is satisfied and throwing an assertion exception on failure. + + The actual value to test + A Constraint to be applied + The message that will be displayed on failure + + + + Apply a constraint to a referenced value, succeeding if the constraint + is satisfied and throwing an assertion exception on failure. + + The actual value to test + A Constraint to be applied + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Asserts that the code represented by a delegate throws an exception + that satisfies the constraint provided. + + A TestDelegate to be executed + A ThrowsConstraint used in the test + + + + Returns a ListMapper based on a collection. + + The original collection + + + + + Provides static methods to express the assumptions + that must be met for a test to give a meaningful + result. If an assumption is not met, the test + should produce an inconclusive result. + + + + + The Equals method throws an AssertionException. This is done + to make sure there is no mistake by calling this function. + + + + + + + override the default ReferenceEquals to throw an AssertionException. This + implementation makes sure there is no mistake in calling this function + as part of Assert. + + + + + + + Apply a constraint to an actual value, succeeding if the constraint + is satisfied and throwing an InconclusiveException on failure. + + A Constraint expression to be applied + The actual value to test + + + + Apply a constraint to an actual value, succeeding if the constraint + is satisfied and throwing an InconclusiveException on failure. + + A Constraint expression to be applied + The actual value to test + The message that will be displayed on failure + + + + Apply a constraint to an actual value, succeeding if the constraint + is satisfied and throwing an InconclusiveException on failure. + + A Constraint expression to be applied + The actual value to test + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Asserts that a condition is true. If the condition is false the method throws + an . + + The evaluated condition + The message to display if the condition is false + Arguments to be used in formatting the message + + + + Asserts that a condition is true. If the condition is false the method throws + an . + + The evaluated condition + The message to display if the condition is false + + + + Asserts that a condition is true. If the condition is false the + method throws an . + + The evaluated condition + + + + Apply a constraint to an actual value, succeeding if the constraint + is satisfied and throwing an InconclusiveException on failure. + + A Constraint expression to be applied + An ActualValueDelegate returning the value to be tested + + + + Apply a constraint to an actual value, succeeding if the constraint + is satisfied and throwing an InconclusiveException on failure. + + A Constraint expression to be applied + An ActualValueDelegate returning the value to be tested + The message that will be displayed on failure + + + + Apply a constraint to an actual value, succeeding if the constraint + is satisfied and throwing an InconclusiveException on failure. + + An ActualValueDelegate returning the value to be tested + A Constraint expression to be applied + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Apply a constraint to a referenced value, succeeding if the constraint + is satisfied and throwing an InconclusiveException on failure. + + A Constraint expression to be applied + The actual value to test + + + + Apply a constraint to a referenced value, succeeding if the constraint + is satisfied and throwing an InconclusiveException on failure. + + A Constraint expression to be applied + The actual value to test + The message that will be displayed on failure + + + + Apply a constraint to a referenced value, succeeding if the constraint + is satisfied and throwing an InconclusiveException on failure. + + A Constraint expression to be applied + The actual value to test + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Asserts that the code represented by a delegate throws an exception + that satisfies the constraint provided. + + A TestDelegate to be executed + A ThrowsConstraint used in the test + + + + Waits for pending asynchronous operations to complete, if appropriate, + and returns a proper result of the invocation by unwrapping task results + + The raw result of the method invocation + The unwrapped result, if necessary + + + + A set of Assert methods operationg on one or more collections + + + + + The Equals method throws an AssertionException. This is done + to make sure there is no mistake by calling this function. + + + + + + + override the default ReferenceEquals to throw an AssertionException. This + implementation makes sure there is no mistake in calling this function + as part of Assert. + + + + + + + Asserts that all items contained in collection are of the type specified by expectedType. + + IEnumerable containing objects to be considered + System.Type that all objects in collection must be instances of + + + + Asserts that all items contained in collection are of the type specified by expectedType. + + IEnumerable containing objects to be considered + System.Type that all objects in collection must be instances of + The message that will be displayed on failure + + + + Asserts that all items contained in collection are of the type specified by expectedType. + + IEnumerable containing objects to be considered + System.Type that all objects in collection must be instances of + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Asserts that all items contained in collection are not equal to null. + + IEnumerable containing objects to be considered + + + + Asserts that all items contained in collection are not equal to null. + + IEnumerable containing objects to be considered + The message that will be displayed on failure + + + + Asserts that all items contained in collection are not equal to null. + + IEnumerable of objects to be considered + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Ensures that every object contained in collection exists within the collection + once and only once. + + IEnumerable of objects to be considered + + + + Ensures that every object contained in collection exists within the collection + once and only once. + + IEnumerable of objects to be considered + The message that will be displayed on failure + + + + Ensures that every object contained in collection exists within the collection + once and only once. + + IEnumerable of objects to be considered + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Asserts that expected and actual are exactly equal. The collections must have the same count, + and contain the exact same objects in the same order. + + The first IEnumerable of objects to be considered + The second IEnumerable of objects to be considered + + + + Asserts that expected and actual are exactly equal. The collections must have the same count, + and contain the exact same objects in the same order. + If comparer is not null then it will be used to compare the objects. + + The first IEnumerable of objects to be considered + The second IEnumerable of objects to be considered + The IComparer to use in comparing objects from each IEnumerable + + + + Asserts that expected and actual are exactly equal. The collections must have the same count, + and contain the exact same objects in the same order. + + The first IEnumerable of objects to be considered + The second IEnumerable of objects to be considered + The message that will be displayed on failure + + + + Asserts that expected and actual are exactly equal. The collections must have the same count, + and contain the exact same objects in the same order. + If comparer is not null then it will be used to compare the objects. + + The first IEnumerable of objects to be considered + The second IEnumerable of objects to be considered + The IComparer to use in comparing objects from each IEnumerable + The message that will be displayed on failure + + + + Asserts that expected and actual are exactly equal. The collections must have the same count, + and contain the exact same objects in the same order. + + The first IEnumerable of objects to be considered + The second IEnumerable of objects to be considered + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Asserts that expected and actual are exactly equal. The collections must have the same count, + and contain the exact same objects in the same order. + If comparer is not null then it will be used to compare the objects. + + The first IEnumerable of objects to be considered + The second IEnumerable of objects to be considered + The IComparer to use in comparing objects from each IEnumerable + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Asserts that expected and actual are equivalent, containing the same objects but the match may be in any order. + + The first IEnumerable of objects to be considered + The second IEnumerable of objects to be considered + + + + Asserts that expected and actual are equivalent, containing the same objects but the match may be in any order. + + The first IEnumerable of objects to be considered + The second IEnumerable of objects to be considered + The message that will be displayed on failure + + + + Asserts that expected and actual are equivalent, containing the same objects but the match may be in any order. + + The first IEnumerable of objects to be considered + The second IEnumerable of objects to be considered + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Asserts that expected and actual are not exactly equal. + + The first IEnumerable of objects to be considered + The second IEnumerable of objects to be considered + + + + Asserts that expected and actual are not exactly equal. + If comparer is not null then it will be used to compare the objects. + + The first IEnumerable of objects to be considered + The second IEnumerable of objects to be considered + The IComparer to use in comparing objects from each IEnumerable + + + + Asserts that expected and actual are not exactly equal. + + The first IEnumerable of objects to be considered + The second IEnumerable of objects to be considered + The message that will be displayed on failure + + + + Asserts that expected and actual are not exactly equal. + If comparer is not null then it will be used to compare the objects. + + The first IEnumerable of objects to be considered + The second IEnumerable of objects to be considered + The IComparer to use in comparing objects from each IEnumerable + The message that will be displayed on failure + + + + Asserts that expected and actual are not exactly equal. + + The first IEnumerable of objects to be considered + The second IEnumerable of objects to be considered + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Asserts that expected and actual are not exactly equal. + If comparer is not null then it will be used to compare the objects. + + The first IEnumerable of objects to be considered + The second IEnumerable of objects to be considered + The IComparer to use in comparing objects from each IEnumerable + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Asserts that expected and actual are not equivalent. + + The first IEnumerable of objects to be considered + The second IEnumerable of objects to be considered + + + + Asserts that expected and actual are not equivalent. + + The first IEnumerable of objects to be considered + The second IEnumerable of objects to be considered + The message that will be displayed on failure + + + + Asserts that expected and actual are not equivalent. + + The first IEnumerable of objects to be considered + The second IEnumerable of objects to be considered + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Asserts that collection contains actual as an item. + + IEnumerable of objects to be considered + Object to be found within collection + + + + Asserts that collection contains actual as an item. + + IEnumerable of objects to be considered + Object to be found within collection + The message that will be displayed on failure + + + + Asserts that collection contains actual as an item. + + IEnumerable of objects to be considered + Object to be found within collection + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Asserts that collection does not contain actual as an item. + + IEnumerable of objects to be considered + Object that cannot exist within collection + + + + Asserts that collection does not contain actual as an item. + + IEnumerable of objects to be considered + Object that cannot exist within collection + The message that will be displayed on failure + + + + Asserts that collection does not contain actual as an item. + + IEnumerable of objects to be considered + Object that cannot exist within collection + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Asserts that superset is not a subject of subset. + + The IEnumerable superset to be considered + The IEnumerable subset to be considered + + + + Asserts that superset is not a subject of subset. + + The IEnumerable superset to be considered + The IEnumerable subset to be considered + The message that will be displayed on failure + + + + Asserts that superset is not a subject of subset. + + The IEnumerable superset to be considered + The IEnumerable subset to be considered + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Asserts that superset is a subset of subset. + + The IEnumerable superset to be considered + The IEnumerable subset to be considered + + + + Asserts that superset is a subset of subset. + + The IEnumerable superset to be considered + The IEnumerable subset to be considered + The message that will be displayed on failure + + + + Asserts that superset is a subset of subset. + + The IEnumerable superset to be considered + The IEnumerable subset to be considered + The message that will be displayed on failure + Arguments to be used in formatting the message + + + + Assert that an array, list or other collection is empty + + An array, list or other collection implementing IEnumerable + The message to be displayed on failure + Arguments to be used in formatting the message + + + + Assert that an array, list or other collection is empty + + An array, list or other collection implementing IEnumerable + The message to be displayed on failure + + + + Assert that an array,list or other collection is empty + + An array, list or other collection implementing IEnumerable + + + + Assert that an array, list or other collection is empty + + An array, list or other collection implementing IEnumerable + The message to be displayed on failure + Arguments to be used in formatting the message + + + + Assert that an array, list or other collection is empty + + An array, list or other collection implementing IEnumerable + The message to be displayed on failure + + + + Assert that an array,list or other collection is empty + + An array, list or other collection implementing IEnumerable + + + + Assert that an array, list or other collection is ordered + + An array, list or other collection implementing IEnumerable + The message to be displayed on failure + Arguments to be used in formatting the message + + + + Assert that an array, list or other collection is ordered + + An array, list or other collection implementing IEnumerable + The message to be displayed on failure + + + + Assert that an array, list or other collection is ordered + + An array, list or other collection implementing IEnumerable + + + + Assert that an array, list or other collection is ordered + + An array, list or other collection implementing IEnumerable + A custom comparer to perform the comparisons + The message to be displayed on failure + Arguments to be used in formatting the message + + + + Assert that an array, list or other collection is ordered + + An array, list or other collection implementing IEnumerable + A custom comparer to perform the comparisons + The message to be displayed on failure + + + + Assert that an array, list or other collection is ordered + + An array, list or other collection implementing IEnumerable + A custom comparer to perform the comparisons + + + + Helper class with properties and methods that supply + a number of constraints used in Asserts. + + + + + Returns a new CollectionContainsConstraint checking for the + presence of a particular object in the collection. + + + + + Returns a constraint that succeeds if the actual + value contains the substring supplied as an argument. + + + + + Summary description for DirectoryAssert + + + + + The Equals method throws an AssertionException. This is done + to make sure there is no mistake by calling this function. + + + + + + + override the default ReferenceEquals to throw an AssertionException. This + implementation makes sure there is no mistake in calling this function + as part of Assert. + + + + + + + We don't actually want any instances of this object, but some people + like to inherit from it to add other static methods. Hence, the + protected constructor disallows any instances of this object. + + + + + Verifies that two directories are equal. Two directories are considered + equal if both are null, or if both have the same value byte for byte. + If they are not equal an is thrown. + + A directory containing the value that is expected + A directory containing the actual value + The message to display if directories are not equal + Arguments to be used in formatting the message + + + + Verifies that two directories are equal. Two directories are considered + equal if both are null, or if both have the same value byte for byte. + If they are not equal an is thrown. + + A directory containing the value that is expected + A directory containing the actual value + The message to display if directories are not equal + + + + Verifies that two directories are equal. Two directories are considered + equal if both are null, or if both have the same value byte for byte. + If they are not equal an is thrown. + + A directory containing the value that is expected + A directory containing the actual value + + + + Verifies that two directories are equal. Two directories are considered + equal if both are null, or if both have the same value byte for byte. + If they are not equal an is thrown. + + A directory path string containing the value that is expected + A directory path string containing the actual value + The message to display if directories are not equal + Arguments to be used in formatting the message + + + + Verifies that two directories are equal. Two directories are considered + equal if both are null, or if both have the same value byte for byte. + If they are not equal an is thrown. + + A directory path string containing the value that is expected + A directory path string containing the actual value + The message to display if directories are not equal + + + + Verifies that two directories are equal. Two directories are considered + equal if both are null, or if both have the same value byte for byte. + If they are not equal an is thrown. + + A directory path string containing the value that is expected + A directory path string containing the actual value + + + + Asserts that two directories are not equal. If they are equal + an is thrown. + + A directory containing the value that is expected + A directory containing the actual value + The message to display if directories are not equal + Arguments to be used in formatting the message + + + + Asserts that two directories are not equal. If they are equal + an is thrown. + + A directory containing the value that is expected + A directory containing the actual value + The message to display if directories are not equal + + + + Asserts that two directories are not equal. If they are equal + an is thrown. + + A directory containing the value that is expected + A directory containing the actual value + + + + Asserts that two directories are not equal. If they are equal + an is thrown. + + A directory path string containing the value that is expected + A directory path string containing the actual value + The message to display if directories are equal + Arguments to be used in formatting the message + + + + Asserts that two directories are not equal. If they are equal + an is thrown. + + A directory path string containing the value that is expected + A directory path string containing the actual value + The message to display if directories are equal + + + + Asserts that two directories are not equal. If they are equal + an is thrown. + + A directory path string containing the value that is expected + A directory path string containing the actual value + + + + Asserts that the directory is empty. If it is not empty + an is thrown. + + A directory to search + The message to display if directories are not equal + Arguments to be used in formatting the message + + + + Asserts that the directory is empty. If it is not empty + an is thrown. + + A directory to search + The message to display if directories are not equal + + + + Asserts that the directory is empty. If it is not empty + an is thrown. + + A directory to search + + + + Asserts that the directory is empty. If it is not empty + an is thrown. + + A directory to search + The message to display if directories are not equal + Arguments to be used in formatting the message + + + + Asserts that the directory is empty. If it is not empty + an is thrown. + + A directory to search + The message to display if directories are not equal + + + + Asserts that the directory is empty. If it is not empty + an is thrown. + + A directory to search + + + + Asserts that the directory is not empty. If it is empty + an is thrown. + + A directory to search + The message to display if directories are not equal + Arguments to be used in formatting the message + + + + Asserts that the directory is not empty. If it is empty + an is thrown. + + A directory to search + The message to display if directories are not equal + + + + Asserts that the directory is not empty. If it is empty + an is thrown. + + A directory to search + + + + Asserts that the directory is not empty. If it is empty + an is thrown. + + A directory to search + The message to display if directories are not equal + Arguments to be used in formatting the message + + + + Asserts that the directory is not empty. If it is empty + an is thrown. + + A directory to search + The message to display if directories are not equal + + + + Asserts that the directory is not empty. If it is empty + an is thrown. + + A directory to search + + + + Asserts that path contains actual as a subdirectory or + an is thrown. + + A directory to search + sub-directory asserted to exist under directory + The message to display if directory is not within the path + Arguments to be used in formatting the message + + + + Asserts that path contains actual as a subdirectory or + an is thrown. + + A directory to search + sub-directory asserted to exist under directory + The message to display if directory is not within the path + + + + Asserts that path contains actual as a subdirectory or + an is thrown. + + A directory to search + sub-directory asserted to exist under directory + + + + Asserts that path contains actual as a subdirectory or + an is thrown. + + A directory to search + sub-directory asserted to exist under directory + The message to display if directory is not within the path + Arguments to be used in formatting the message + + + + Asserts that path contains actual as a subdirectory or + an is thrown. + + A directory to search + sub-directory asserted to exist under directory + The message to display if directory is not within the path + + + + Asserts that path contains actual as a subdirectory or + an is thrown. + + A directory to search + sub-directory asserted to exist under directory + + + + Asserts that path does not contain actual as a subdirectory or + an is thrown. + + A directory to search + sub-directory asserted to exist under directory + The message to display if directory is not within the path + Arguments to be used in formatting the message + + + + Asserts that path does not contain actual as a subdirectory or + an is thrown. + + A directory to search + sub-directory asserted to exist under directory + The message to display if directory is not within the path + + + + Asserts that path does not contain actual as a subdirectory or + an is thrown. + + A directory to search + sub-directory asserted to exist under directory + + + + Asserts that path does not contain actual as a subdirectory or + an is thrown. + + A directory to search + sub-directory asserted to exist under directory + The message to display if directory is not within the path + Arguments to be used in formatting the message + + + + Asserts that path does not contain actual as a subdirectory or + an is thrown. + + A directory to search + sub-directory asserted to exist under directory + The message to display if directory is not within the path + + + + Asserts that path does not contain actual as a subdirectory or + an is thrown. + + A directory to search + sub-directory asserted to exist under directory + + + + Summary description for FileAssert. + + + + + The Equals method throws an AssertionException. This is done + to make sure there is no mistake by calling this function. + + + + + + + override the default ReferenceEquals to throw an AssertionException. This + implementation makes sure there is no mistake in calling this function + as part of Assert. + + + + + + + We don't actually want any instances of this object, but some people + like to inherit from it to add other static methods. Hence, the + protected constructor disallows any instances of this object. + + + + + Verifies that two Streams are equal. Two Streams are considered + equal if both are null, or if both have the same value byte for byte. + If they are not equal an is thrown. + + The expected Stream + The actual Stream + The message to display if Streams are not equal + Arguments to be used in formatting the message + + + + Verifies that two Streams are equal. Two Streams are considered + equal if both are null, or if both have the same value byte for byte. + If they are not equal an is thrown. + + The expected Stream + The actual Stream + The message to display if objects are not equal + + + + Verifies that two Streams are equal. Two Streams are considered + equal if both are null, or if both have the same value byte for byte. + If they are not equal an is thrown. + + The expected Stream + The actual Stream + + + + Verifies that two files are equal. Two files are considered + equal if both are null, or if both have the same value byte for byte. + If they are not equal an is thrown. + + A file containing the value that is expected + A file containing the actual value + The message to display if Streams are not equal + Arguments to be used in formatting the message + + + + Verifies that two files are equal. Two files are considered + equal if both are null, or if both have the same value byte for byte. + If they are not equal an is thrown. + + A file containing the value that is expected + A file containing the actual value + The message to display if objects are not equal + + + + Verifies that two files are equal. Two files are considered + equal if both are null, or if both have the same value byte for byte. + If they are not equal an is thrown. + + A file containing the value that is expected + A file containing the actual value + + + + Verifies that two files are equal. Two files are considered + equal if both are null, or if both have the same value byte for byte. + If they are not equal an is thrown. + + The path to a file containing the value that is expected + The path to a file containing the actual value + The message to display if Streams are not equal + Arguments to be used in formatting the message + + + + Verifies that two files are equal. Two files are considered + equal if both are null, or if both have the same value byte for byte. + If they are not equal an is thrown. + + The path to a file containing the value that is expected + The path to a file containing the actual value + The message to display if objects are not equal + + + + Verifies that two files are equal. Two files are considered + equal if both are null, or if both have the same value byte for byte. + If they are not equal an is thrown. + + The path to a file containing the value that is expected + The path to a file containing the actual value + + + + Asserts that two Streams are not equal. If they are equal + an is thrown. + + The expected Stream + The actual Stream + The message to be displayed when the two Stream are the same. + Arguments to be used in formatting the message + + + + Asserts that two Streams are not equal. If they are equal + an is thrown. + + The expected Stream + The actual Stream + The message to be displayed when the Streams are the same. + + + + Asserts that two Streams are not equal. If they are equal + an is thrown. + + The expected Stream + The actual Stream + + + + Asserts that two files are not equal. If they are equal + an is thrown. + + A file containing the value that is expected + A file containing the actual value + The message to display if Streams are not equal + Arguments to be used in formatting the message + + + + Asserts that two files are not equal. If they are equal + an is thrown. + + A file containing the value that is expected + A file containing the actual value + The message to display if objects are not equal + + + + Asserts that two files are not equal. If they are equal + an is thrown. + + A file containing the value that is expected + A file containing the actual value + + + + Asserts that two files are not equal. If they are equal + an is thrown. + + The path to a file containing the value that is expected + The path to a file containing the actual value + The message to display if Streams are not equal + Arguments to be used in formatting the message + + + + Asserts that two files are not equal. If they are equal + an is thrown. + + The path to a file containing the value that is expected + The path to a file containing the actual value + The message to display if objects are not equal + + + + Asserts that two files are not equal. If they are equal + an is thrown. + + The path to a file containing the value that is expected + The path to a file containing the actual value + + + + GlobalSettings is a place for setting default values used + by the framework in performing asserts. + + + + + Default tolerance for floating point equality + + + + + Class used to guard against unexpected argument values + by throwing an appropriate exception. + + + + + Throws an exception if an argument is null + + The value to be tested + The name of the argument + + + + Throws an exception if a string argument is null or empty + + The value to be tested + The name of the argument + + + + Helper class with properties and methods that supply + a number of constraints used in Asserts. + + + + + Returns a ConstraintExpression, which will apply + the following constraint to all members of a collection, + succeeding only if a specified number of them succeed. + + + + + Returns a new PropertyConstraintExpression, which will either + test for the existence of the named property on the object + being tested or apply any following constraint to that property. + + + + + Returns a new AttributeConstraint checking for the + presence of a particular attribute on an object. + + + + + Returns a new AttributeConstraint checking for the + presence of a particular attribute on an object. + + + + + Returns a new CollectionContainsConstraint checking for the + presence of a particular object in the collection. + + + + + Returns a ConstraintExpression that negates any + following constraint. + + + + + Returns a ConstraintExpression, which will apply + the following constraint to all members of a collection, + succeeding if all of them succeed. + + + + + Returns a ConstraintExpression, which will apply + the following constraint to all members of a collection, + succeeding if at least one of them succeeds. + + + + + Returns a ConstraintExpression, which will apply + the following constraint to all members of a collection, + succeeding if all of them fail. + + + + + Returns a new ConstraintExpression, which will apply the following + constraint to the Length property of the object being tested. + + + + + Returns a new ConstraintExpression, which will apply the following + constraint to the Count property of the object being tested. + + + + + Returns a new ConstraintExpression, which will apply the following + constraint to the Message property of the object being tested. + + + + + Returns a new ConstraintExpression, which will apply the following + constraint to the InnerException property of the object being tested. + + + + + Interface implemented by a user fixture in order to + validate any expected exceptions. It is only called + for test methods marked with the ExpectedException + attribute. + + + + + Method to handle an expected exception + + The exception to be handled + + + + Helper class with properties and methods that supply + a number of constraints used in Asserts. + + + + + Returns a constraint that tests two items for equality + + + + + Returns a constraint that tests that two references are the same object + + + + + Returns a constraint that tests whether the + actual value is greater than the suppled argument + + + + + Returns a constraint that tests whether the + actual value is greater than or equal to the suppled argument + + + + + Returns a constraint that tests whether the + actual value is greater than or equal to the suppled argument + + + + + Returns a constraint that tests whether the + actual value is less than the suppled argument + + + + + Returns a constraint that tests whether the + actual value is less than or equal to the suppled argument + + + + + Returns a constraint that tests whether the + actual value is less than or equal to the suppled argument + + + + + Returns a constraint that tests whether the actual + value is of the exact type supplied as an argument. + + + + + Returns a constraint that tests whether the actual + value is of the exact type supplied as an argument. + + + + + Returns a constraint that tests whether the actual value + is of the type supplied as an argument or a derived type. + + + + + Returns a constraint that tests whether the actual value + is of the type supplied as an argument or a derived type. + + + + + Returns a constraint that tests whether the actual value + is of the type supplied as an argument or a derived type. + + + + + Returns a constraint that tests whether the actual value + is of the type supplied as an argument or a derived type. + + + + + Returns a constraint that tests whether the actual value + is assignable from the type supplied as an argument. + + + + + Returns a constraint that tests whether the actual value + is assignable from the type supplied as an argument. + + + + + Returns a constraint that tests whether the actual value + is assignable from the type supplied as an argument. + + + + + Returns a constraint that tests whether the actual value + is assignable from the type supplied as an argument. + + + + + Returns a constraint that tests whether the actual value + is a collection containing the same elements as the + collection supplied as an argument. + + + + + Returns a constraint that tests whether the actual value + is a subset of the collection supplied as an argument. + + + + + Returns a constraint that succeeds if the actual + value contains the substring supplied as an argument. + + + + + Returns a constraint that succeeds if the actual + value starts with the substring supplied as an argument. + + + + + Returns a constraint that succeeds if the actual + value ends with the substring supplied as an argument. + + + + + Returns a constraint that succeeds if the actual + value matches the regular expression supplied as an argument. + + + + + Returns a constraint that tests whether the path provided + is the same as an expected path after canonicalization. + + + + + Returns a constraint that tests whether the path provided + is under an expected path after canonicalization. + + + + + Returns a constraint that tests whether the path provided + is the same path or under an expected path after canonicalization. + + + + + Returns a constraint that tests whether the actual value falls + within a specified range. + + + + + Returns a ConstraintExpression that negates any + following constraint. + + + + + Returns a ConstraintExpression, which will apply + the following constraint to all members of a collection, + succeeding if all of them succeed. + + + + + Returns a constraint that tests for null + + + + + Returns a constraint that tests for True + + + + + Returns a constraint that tests for False + + + + + Returns a constraint that tests for a positive value + + + + + Returns a constraint that tests for a negative value + + + + + Returns a constraint that tests for NaN + + + + + Returns a constraint that tests for empty + + + + + Returns a constraint that tests whether a collection + contains all unique items. + + + + + Returns a constraint that tests whether an object graph is serializable in binary format. + + + + + Returns a constraint that tests whether an object graph is serializable in xml format. + + + + + Returns a constraint that tests whether a collection is ordered + + + + + The ITestCaseData interface is implemented by a class + that is able to return complete testcases for use by + a parameterized test method. + + NOTE: This interface is used in both the framework + and the core, even though that results in two different + types. However, sharing the source code guarantees that + the various implementations will be compatible and that + the core is able to reflect successfully over the + framework implementations of ITestCaseData. + + + + + Gets the argument list to be provided to the test + + + + + Gets the expected result + + + + + Indicates whether a result has been specified. + This is necessary because the result may be + null, so it's value cannot be checked. + + + + + Gets the expected exception Type + + + + + Gets the FullName of the expected exception + + + + + Gets the name to be used for the test + + + + + Gets the description of the test + + + + + Gets a value indicating whether this is ignored. + + true if ignored; otherwise, false. + + + + Gets a value indicating whether this is explicit. + + true if explicit; otherwise, false. + + + + Gets the ignore reason. + + The ignore reason. + + + + The Iz class is a synonym for Is intended for use in VB, + which regards Is as a keyword. + + + + + The List class is a helper class with properties and methods + that supply a number of constraints used with lists and collections. + + + + + List.Map returns a ListMapper, which can be used to map + the original collection to another collection. + + + + + + + ListMapper is used to transform a collection used as an actual argument + producing another collection to be used in the assertion. + + + + + Construct a ListMapper based on a collection + + The collection to be transformed + + + + Produces a collection containing all the values of a property + + The collection of property values + + + + + Randomizer returns a set of random values in a repeatable + way, to allow re-running of tests if necessary. + + + + + Get a randomizer for a particular member, returning + one that has already been created if it exists. + This ensures that the same values are generated + each time the tests are reloaded. + + + + + Get a randomizer for a particular parameter, returning + one that has already been created if it exists. + This ensures that the same values are generated + each time the tests are reloaded. + + + + + Construct a randomizer using a random seed + + + + + Construct a randomizer using a specified seed + + + + + Return an array of random doubles between 0.0 and 1.0. + + + + + + + Return an array of random doubles with values in a specified range. + + + + + Return an array of random ints with values in a specified range. + + + + + Get a random seed for use in creating a randomizer. + + + + + The SpecialValue enum is used to represent TestCase arguments + that cannot be used as arguments to an Attribute. + + + + + Null represents a null value, which cannot be used as an + argument to an attribute under .NET 1.x + + + + + Basic Asserts on strings. + + + + + The Equals method throws an AssertionException. This is done + to make sure there is no mistake by calling this function. + + + + + + + override the default ReferenceEquals to throw an AssertionException. This + implementation makes sure there is no mistake in calling this function + as part of Assert. + + + + + + + Asserts that a string is found within another string. + + The expected string + The string to be examined + The message to display in case of failure + Arguments used in formatting the message + + + + Asserts that a string is found within another string. + + The expected string + The string to be examined + The message to display in case of failure + + + + Asserts that a string is found within another string. + + The expected string + The string to be examined + + + + Asserts that a string is not found within another string. + + The expected string + The string to be examined + The message to display in case of failure + Arguments used in formatting the message + + + + Asserts that a string is found within another string. + + The expected string + The string to be examined + The message to display in case of failure + + + + Asserts that a string is found within another string. + + The expected string + The string to be examined + + + + Asserts that a string starts with another string. + + The expected string + The string to be examined + The message to display in case of failure + Arguments used in formatting the message + + + + Asserts that a string starts with another string. + + The expected string + The string to be examined + The message to display in case of failure + + + + Asserts that a string starts with another string. + + The expected string + The string to be examined + + + + Asserts that a string does not start with another string. + + The expected string + The string to be examined + The message to display in case of failure + Arguments used in formatting the message + + + + Asserts that a string does not start with another string. + + The expected string + The string to be examined + The message to display in case of failure + + + + Asserts that a string does not start with another string. + + The expected string + The string to be examined + + + + Asserts that a string ends with another string. + + The expected string + The string to be examined + The message to display in case of failure + Arguments used in formatting the message + + + + Asserts that a string ends with another string. + + The expected string + The string to be examined + The message to display in case of failure + + + + Asserts that a string ends with another string. + + The expected string + The string to be examined + + + + Asserts that a string does not end with another string. + + The expected string + The string to be examined + The message to display in case of failure + Arguments used in formatting the message + + + + Asserts that a string does not end with another string. + + The expected string + The string to be examined + The message to display in case of failure + + + + Asserts that a string does not end with another string. + + The expected string + The string to be examined + + + + Asserts that two strings are equal, without regard to case. + + The expected string + The actual string + The message to display in case of failure + Arguments used in formatting the message + + + + Asserts that two strings are equal, without regard to case. + + The expected string + The actual string + The message to display in case of failure + + + + Asserts that two strings are equal, without regard to case. + + The expected string + The actual string + + + + Asserts that two strings are not equal, without regard to case. + + The expected string + The actual string + The message to display in case of failure + Arguments used in formatting the message + + + + Asserts that two strings are Notequal, without regard to case. + + The expected string + The actual string + The message to display in case of failure + + + + Asserts that two strings are not equal, without regard to case. + + The expected string + The actual string + + + + Asserts that a string matches an expected regular expression pattern. + + The regex pattern to be matched + The actual string + The message to display in case of failure + Arguments used in formatting the message + + + + Asserts that a string matches an expected regular expression pattern. + + The regex pattern to be matched + The actual string + The message to display in case of failure + + + + Asserts that a string matches an expected regular expression pattern. + + The regex pattern to be matched + The actual string + + + + Asserts that a string does not match an expected regular expression pattern. + + The regex pattern to be used + The actual string + The message to display in case of failure + Arguments used in formatting the message + + + + Asserts that a string does not match an expected regular expression pattern. + + The regex pattern to be used + The actual string + The message to display in case of failure + + + + Asserts that a string does not match an expected regular expression pattern. + + The regex pattern to be used + The actual string + + + + The TestCaseData class represents a set of arguments + and other parameter info to be used for a parameterized + test case. It provides a number of instance modifiers + for use in initializing the test case. + + Note: Instance modifiers are getters that return + the same instance after modifying it's state. + + + + + The argument list to be provided to the test + + + + + The expected result to be returned + + + + + Set to true if this has an expected result + + + + + The expected exception Type + + + + + The FullName of the expected exception + + + + + The name to be used for the test + + + + + The description of the test + + + + + A dictionary of properties, used to add information + to tests without requiring the class to change. + + + + + If true, indicates that the test case is to be ignored + + + + + If true, indicates that the test case is marked explicit + + + + + The reason for ignoring a test case + + + + + Initializes a new instance of the class. + + The arguments. + + + + Initializes a new instance of the class. + + The argument. + + + + Initializes a new instance of the class. + + The first argument. + The second argument. + + + + Initializes a new instance of the class. + + The first argument. + The second argument. + The third argument. + + + + Sets the expected result for the test + + The expected result + A modified TestCaseData + + + + Sets the expected exception type for the test + + Type of the expected exception. + The modified TestCaseData instance + + + + Sets the expected exception type for the test + + FullName of the expected exception. + The modified TestCaseData instance + + + + Sets the name of the test case + + The modified TestCaseData instance + + + + Sets the description for the test case + being constructed. + + The description. + The modified TestCaseData instance. + + + + Applies a category to the test + + + + + + + Applies a named property to the test + + + + + + + + Applies a named property to the test + + + + + + + + Applies a named property to the test + + + + + + + + Ignores this TestCase. + + + + + + Ignores this TestCase, specifying the reason. + + The reason. + + + + + Marks this TestCase as Explicit + + + + + + Marks this TestCase as Explicit, specifying the reason. + + The reason. + + + + + Gets the argument list to be provided to the test + + + + + Gets the expected result + + + + + Returns true if the result has been set + + + + + Gets the expected exception Type + + + + + Gets the FullName of the expected exception + + + + + Gets the name to be used for the test + + + + + Gets the description of the test + + + + + Gets a value indicating whether this is ignored. + + true if ignored; otherwise, false. + + + + Gets a value indicating whether this is explicit. + + true if explicit; otherwise, false. + + + + Gets the ignore reason. + + The ignore reason. + + + + Gets a list of categories associated with this test. + + + + + Gets the property dictionary for this test + + + + + Provide the context information of the current test + + + + + Constructs a TestContext using the provided context dictionary + + A context dictionary + + + + Get the current test context. This is created + as needed. The user may save the context for + use within a test, but it should not be used + outside the test for which it is created. + + + + + Gets a TestAdapter representing the currently executing test in this context. + + + + + Gets a ResultAdapter representing the current result for the test + executing in this context. + + + + + Gets the directory containing the current test assembly. + + + + + Gets the directory to be used for outputing files created + by this test run. + + + + + TestAdapter adapts a Test for consumption by + the user test code. + + + + + Constructs a TestAdapter for this context + + The context dictionary + + + + The name of the test. + + + + + The FullName of the test + + + + + The properties of the test. + + + + + ResultAdapter adapts a TestResult for consumption by + the user test code. + + + + + Construct a ResultAdapter for a context + + The context holding the result + + + + The TestState of current test. This maps to the ResultState + used in nunit.core and is subject to change in the future. + + + + + The TestStatus of current test. This enum will be used + in future versions of NUnit and so is to be preferred + to the TestState value. + + + + + Provides details about a test + + + + + Creates an instance of TestDetails + + The fixture that the test is a member of, if available. + The method that implements the test, if available. + The full name of the test. + A string representing the type of test, e.g. "Test Case". + Indicates if the test represents a suite of tests. + + + + The fixture that the test is a member of, if available. + + + + + The method that implements the test, if available. + + + + + The full name of the test. + + + + + A string representing the type of test, e.g. "Test Case". + + + + + Indicates if the test represents a suite of tests. + + + + + The ResultState enum indicates the result of running a test + + + + + The result is inconclusive + + + + + The test was not runnable. + + + + + The test has been skipped. + + + + + The test has been ignored. + + + + + The test succeeded + + + + + The test failed + + + + + The test encountered an unexpected exception + + + + + The test was cancelled by the user + + + + + The TestStatus enum indicates the result of running a test + + + + + The test was inconclusive + + + + + The test has skipped + + + + + The test succeeded + + + + + The test failed + + + + + Helper class with static methods used to supply constraints + that operate on strings. + + + + + Returns a constraint that succeeds if the actual + value contains the substring supplied as an argument. + + + + + Returns a constraint that fails if the actual + value contains the substring supplied as an argument. + + + + + Returns a constraint that succeeds if the actual + value starts with the substring supplied as an argument. + + + + + Returns a constraint that fails if the actual + value starts with the substring supplied as an argument. + + + + + Returns a constraint that succeeds if the actual + value ends with the substring supplied as an argument. + + + + + Returns a constraint that fails if the actual + value ends with the substring supplied as an argument. + + + + + Returns a constraint that succeeds if the actual + value matches the Regex pattern supplied as an argument. + + + + + Returns a constraint that fails if the actual + value matches the pattern supplied as an argument. + + + + + Returns a ConstraintExpression, which will apply + the following constraint to all members of a collection, + succeeding if all of them succeed. + + + + + TextMessageWriter writes constraint descriptions and messages + in displayable form as a text stream. It tailors the display + of individual message components to form the standard message + format of NUnit assertion failure messages. + + + + + MessageWriter is the abstract base for classes that write + constraint descriptions and messages in some form. The + class has separate methods for writing various components + of a message, allowing implementations to tailor the + presentation as needed. + + + + + Construct a MessageWriter given a culture + + + + + Method to write single line message with optional args, usually + written to precede the general failure message. + + The message to be written + Any arguments used in formatting the message + + + + Method to write single line message with optional args, usually + written to precede the general failure message, at a givel + indentation level. + + The indentation level of the message + The message to be written + Any arguments used in formatting the message + + + + Display Expected and Actual lines for a constraint. This + is called by MessageWriter's default implementation of + WriteMessageTo and provides the generic two-line display. + + The constraint that failed + + + + Display Expected and Actual lines for given values. This + method may be called by constraints that need more control over + the display of actual and expected values than is provided + by the default implementation. + + The expected value + The actual value causing the failure + + + + Display Expected and Actual lines for given values, including + a tolerance value on the Expected line. + + The expected value + The actual value causing the failure + The tolerance within which the test was made + + + + Display the expected and actual string values on separate lines. + If the mismatch parameter is >=0, an additional line is displayed + line containing a caret that points to the mismatch point. + + The expected string value + The actual string value + The point at which the strings don't match or -1 + If true, case is ignored in locating the point where the strings differ + If true, the strings should be clipped to fit the line + + + + Writes the text for a connector. + + The connector. + + + + Writes the text for a predicate. + + The predicate. + + + + Writes the text for an expected value. + + The expected value. + + + + Writes the text for a modifier + + The modifier. + + + + Writes the text for an actual value. + + The actual value. + + + + Writes the text for a generalized value. + + The value. + + + + Writes the text for a collection value, + starting at a particular point, to a max length + + The collection containing elements to write. + The starting point of the elements to write + The maximum number of elements to write + + + + Abstract method to get the max line length + + + + + Prefix used for the expected value line of a message + + + + + Prefix used for the actual value line of a message + + + + + Length of a message prefix + + + + + Construct a TextMessageWriter + + + + + Construct a TextMessageWriter, specifying a user message + and optional formatting arguments. + + + + + + + Method to write single line message with optional args, usually + written to precede the general failure message, at a givel + indentation level. + + The indentation level of the message + The message to be written + Any arguments used in formatting the message + + + + Display Expected and Actual lines for a constraint. This + is called by MessageWriter's default implementation of + WriteMessageTo and provides the generic two-line display. + + The constraint that failed + + + + Display Expected and Actual lines for given values. This + method may be called by constraints that need more control over + the display of actual and expected values than is provided + by the default implementation. + + The expected value + The actual value causing the failure + + + + Display Expected and Actual lines for given values, including + a tolerance value on the expected line. + + The expected value + The actual value causing the failure + The tolerance within which the test was made + + + + Display the expected and actual string values on separate lines. + If the mismatch parameter is >=0, an additional line is displayed + line containing a caret that points to the mismatch point. + + The expected string value + The actual string value + The point at which the strings don't match or -1 + If true, case is ignored in string comparisons + If true, clip the strings to fit the max line length + + + + Writes the text for a connector. + + The connector. + + + + Writes the text for a predicate. + + The predicate. + + + + Write the text for a modifier. + + The modifier. + + + + Writes the text for an expected value. + + The expected value. + + + + Writes the text for an actual value. + + The actual value. + + + + Writes the text for a generalized value. + + The value. + + + + Writes the text for a collection value, + starting at a particular point, to a max length + + The collection containing elements to write. + The starting point of the elements to write + The maximum number of elements to write + + + + Write the generic 'Expected' line for a constraint + + The constraint that failed + + + + Write the generic 'Expected' line for a given value + + The expected value + + + + Write the generic 'Expected' line for a given value + and tolerance. + + The expected value + The tolerance within which the test was made + + + + Write the generic 'Actual' line for a constraint + + The constraint for which the actual value is to be written + + + + Write the generic 'Actual' line for a given value + + The actual value causing a failure + + + + Gets or sets the maximum line length for this writer + + + + + Helper class with properties and methods that supply + constraints that operate on exceptions. + + + + + Creates a constraint specifying the exact type of exception expected + + + + + Creates a constraint specifying the exact type of exception expected + + + + + Creates a constraint specifying the type of exception expected + + + + + Creates a constraint specifying the type of exception expected + + + + + Creates a constraint specifying an expected exception + + + + + Creates a constraint specifying an exception with a given InnerException + + + + + Creates a constraint specifying an expected TargetInvocationException + + + + + Creates a constraint specifying an expected TargetInvocationException + + + + + Creates a constraint specifying an expected TargetInvocationException + + + + + Creates a constraint specifying that no exception is thrown + + + + + Attribute used to apply a category to a test + + + + + The name of the category + + + + + Construct attribute for a given category based on + a name. The name may not contain the characters ',', + '+', '-' or '!'. However, this is not checked in the + constructor since it would cause an error to arise at + as the test was loaded without giving a clear indication + of where the problem is located. The error is handled + in NUnitFramework.cs by marking the test as not + runnable. + + The name of the category + + + + Protected constructor uses the Type name as the name + of the category. + + + + + The name of the category + + + + + Used to mark a field for use as a datapoint when executing a theory + within the same fixture that requires an argument of the field's Type. + + + + + Used to mark an array as containing a set of datapoints to be used + executing a theory within the same fixture that requires an argument + of the Type of the array elements. + + + + + Attribute used to provide descriptive text about a + test case or fixture. + + + + + Construct the attribute + + Text describing the test + + + + Gets the test description + + + + + Enumeration indicating how the expected message parameter is to be used + + + + Expect an exact match + + + Expect a message containing the parameter string + + + Match the regular expression provided as a parameter + + + Expect a message that starts with the parameter string + + + + ExpectedExceptionAttribute + + + + + + Constructor for a non-specific exception + + + + + Constructor for a given type of exception + + The type of the expected exception + + + + Constructor for a given exception name + + The full name of the expected exception + + + + Gets or sets the expected exception type + + + + + Gets or sets the full Type name of the expected exception + + + + + Gets or sets the expected message text + + + + + Gets or sets the user message displayed in case of failure + + + + + Gets or sets the type of match to be performed on the expected message + + + + + Gets the name of a method to be used as an exception handler + + + + + ExplicitAttribute marks a test or test fixture so that it will + only be run if explicitly executed from the gui or command line + or if it is included by use of a filter. The test will not be + run simply because an enclosing suite is run. + + + + + Default constructor + + + + + Constructor with a reason + + The reason test is marked explicit + + + + The reason test is marked explicit + + + + + Attribute used to mark a test that is to be ignored. + Ignored tests result in a warning message when the + tests are run. + + + + + Constructs the attribute without giving a reason + for ignoring the test. + + + + + Constructs the attribute giving a reason for ignoring the test + + The reason for ignoring the test + + + + The reason for ignoring a test + + + + + Abstract base for Attributes that are used to include tests + in the test run based on environmental settings. + + + + + Constructor with no included items specified, for use + with named property syntax. + + + + + Constructor taking one or more included items + + Comma-delimited list of included items + + + + Name of the item that is needed in order for + a test to run. Multiple itemss may be given, + separated by a comma. + + + + + Name of the item to be excluded. Multiple items + may be given, separated by a comma. + + + + + The reason for including or excluding the test + + + + + PlatformAttribute is used to mark a test fixture or an + individual method as applying to a particular platform only. + + + + + Constructor with no platforms specified, for use + with named property syntax. + + + + + Constructor taking one or more platforms + + Comma-deliminted list of platforms + + + + CultureAttribute is used to mark a test fixture or an + individual method as applying to a particular Culture only. + + + + + Constructor with no cultures specified, for use + with named property syntax. + + + + + Constructor taking one or more cultures + + Comma-deliminted list of cultures + + + + Marks a test to use a combinatorial join of any argument data + provided. NUnit will create a test case for every combination of + the arguments provided. This can result in a large number of test + cases and so should be used judiciously. This is the default join + type, so the attribute need not be used except as documentation. + + + + + PropertyAttribute is used to attach information to a test as a name/value pair.. + + + + + Construct a PropertyAttribute with a name and string value + + The name of the property + The property value + + + + Construct a PropertyAttribute with a name and int value + + The name of the property + The property value + + + + Construct a PropertyAttribute with a name and double value + + The name of the property + The property value + + + + Constructor for derived classes that set the + property dictionary directly. + + + + + Constructor for use by derived classes that use the + name of the type as the property name. Derived classes + must ensure that the Type of the property value is + a standard type supported by the BCL. Any custom + types will cause a serialization Exception when + in the client. + + + + + Gets the property dictionary for this attribute + + + + + Default constructor + + + + + Marks a test to use pairwise join of any argument data provided. + NUnit will attempt too excercise every pair of argument values at + least once, using as small a number of test cases as it can. With + only two arguments, this is the same as a combinatorial join. + + + + + Default constructor + + + + + Marks a test to use a sequential join of any argument data + provided. NUnit will use arguements for each parameter in + sequence, generating test cases up to the largest number + of argument values provided and using null for any arguments + for which it runs out of values. Normally, this should be + used with the same number of arguments for each parameter. + + + + + Default constructor + + + + + Summary description for MaxTimeAttribute. + + + + + Construct a MaxTimeAttribute, given a time in milliseconds. + + The maximum elapsed time in milliseconds + + + + RandomAttribute is used to supply a set of random values + to a single parameter of a parameterized test. + + + + + ValuesAttribute is used to provide literal arguments for + an individual parameter of a test. + + + + + Abstract base class for attributes that apply to parameters + and supply data for the parameter. + + + + + Gets the data to be provided to the specified parameter + + + + + The collection of data to be returned. Must + be set by any derived attribute classes. + We use an object[] so that the individual + elements may have their type changed in GetData + if necessary. + + + + + Construct with one argument + + + + + + Construct with two arguments + + + + + + + Construct with three arguments + + + + + + + + Construct with an array of arguments + + + + + + Get the collection of values to be used as arguments + + + + + Construct a set of doubles from 0.0 to 1.0, + specifying only the count. + + + + + + Construct a set of doubles from min to max + + + + + + + + Construct a set of ints from min to max + + + + + + + + Get the collection of values to be used as arguments + + + + + RangeAttribute is used to supply a range of values to an + individual parameter of a parameterized test. + + + + + Construct a range of ints using default step of 1 + + + + + + + Construct a range of ints specifying the step size + + + + + + + + Construct a range of longs + + + + + + + + Construct a range of doubles + + + + + + + + Construct a range of floats + + + + + + + + RepeatAttribute may be applied to test case in order + to run it multiple times. + + + + + Construct a RepeatAttribute + + The number of times to run the test + + + + RequiredAddinAttribute may be used to indicate the names of any addins + that must be present in order to run some or all of the tests in an + assembly. If the addin is not loaded, the entire assembly is marked + as NotRunnable. + + + + + Initializes a new instance of the class. + + The required addin. + + + + Gets the name of required addin. + + The required addin name. + + + + Summary description for SetCultureAttribute. + + + + + Construct given the name of a culture + + + + + + Summary description for SetUICultureAttribute. + + + + + Construct given the name of a culture + + + + + + SetUpAttribute is used in a TestFixture to identify a method + that is called immediately before each test is run. It is + also used in a SetUpFixture to identify the method that is + called once, before any of the subordinate tests are run. + + + + + Attribute used to mark a class that contains one-time SetUp + and/or TearDown methods that apply to all the tests in a + namespace or an assembly. + + + + + Attribute used to mark a static (shared in VB) property + that returns a list of tests. + + + + + Attribute used in a TestFixture to identify a method that is + called immediately after each test is run. It is also used + in a SetUpFixture to identify the method that is called once, + after all subordinate tests have run. In either case, the method + is guaranteed to be called, even if an exception is thrown. + + + + + Provide actions to execute before and after tests. + + + + + When implemented by an attribute, this interface implemented to provide actions to execute before and after tests. + + + + + Executed before each test is run + + Provides details about the test that is going to be run. + + + + Executed after each test is run + + Provides details about the test that has just been run. + + + + Provides the target for the action attribute + + The target for the action attribute + + + + Adding this attribute to a method within a + class makes the method callable from the NUnit test runner. There is a property + called Description which is optional which you can provide a more detailed test + description. This class cannot be inherited. + + + + [TestFixture] + public class Fixture + { + [Test] + public void MethodToTest() + {} + + [Test(Description = "more detailed description")] + publc void TestDescriptionMethod() + {} + } + + + + + + Descriptive text for this test + + + + + TestCaseAttribute is used to mark parameterized test cases + and provide them with their arguments. + + + + + Construct a TestCaseAttribute with a list of arguments. + This constructor is not CLS-Compliant + + + + + + Construct a TestCaseAttribute with a single argument + + + + + + Construct a TestCaseAttribute with a two arguments + + + + + + + Construct a TestCaseAttribute with a three arguments + + + + + + + + Gets the list of arguments to a test case + + + + + Gets or sets the expected result. Use + ExpectedResult by preference. + + The result. + + + + Gets or sets the expected result. + + The result. + + + + Gets a flag indicating whether an expected + result has been set. + + + + + Gets a list of categories associated with this test; + + + + + Gets or sets the category associated with this test. + May be a single category or a comma-separated list. + + + + + Gets or sets the expected exception. + + The expected exception. + + + + Gets or sets the name the expected exception. + + The expected name of the exception. + + + + Gets or sets the expected message of the expected exception + + The expected message of the exception. + + + + Gets or sets the type of match to be performed on the expected message + + + + + Gets or sets the description. + + The description. + + + + Gets or sets the name of the test. + + The name of the test. + + + + Gets or sets the ignored status of the test + + + + + Gets or sets the ignored status of the test + + + + + Gets or sets the explicit status of the test + + + + + Gets or sets the reason for not running the test + + + + + Gets or sets the reason for not running the test. + Set has the side effect of marking the test as ignored. + + The ignore reason. + + + + FactoryAttribute indicates the source to be used to + provide test cases for a test method. + + + + + Construct with the name of the data source, which must + be a property, field or method of the test class itself. + + An array of the names of the factories that will provide data + + + + Construct with a Type, which must implement IEnumerable + + The Type that will provide data + + + + Construct with a Type and name. + that don't support params arrays. + + The Type that will provide data + The name of the method, property or field that will provide data + + + + The name of a the method, property or fiend to be used as a source + + + + + A Type to be used as a source + + + + + Gets or sets the category associated with this test. + May be a single category or a comma-separated list. + + + + + [TestFixture] + public class ExampleClass + {} + + + + + Default constructor + + + + + Construct with a object[] representing a set of arguments. + In .NET 2.0, the arguments may later be separated into + type arguments and constructor arguments. + + + + + + Descriptive text for this fixture + + + + + Gets and sets the category for this fixture. + May be a comma-separated list of categories. + + + + + Gets a list of categories for this fixture + + + + + The arguments originally provided to the attribute + + + + + Gets or sets a value indicating whether this should be ignored. + + true if ignore; otherwise, false. + + + + Gets or sets the ignore reason. May set Ignored as a side effect. + + The ignore reason. + + + + Get or set the type arguments. If not set + explicitly, any leading arguments that are + Types are taken as type arguments. + + + + + Attribute used to identify a method that is + called before any tests in a fixture are run. + + + + + Attribute used to identify a method that is called after + all the tests in a fixture have run. The method is + guaranteed to be called, even if an exception is thrown. + + + + + Adding this attribute to a method within a + class makes the method callable from the NUnit test runner. There is a property + called Description which is optional which you can provide a more detailed test + description. This class cannot be inherited. + + + + [TestFixture] + public class Fixture + { + [Test] + public void MethodToTest() + {} + + [Test(Description = "more detailed description")] + publc void TestDescriptionMethod() + {} + } + + + + + + Used on a method, marks the test with a timeout value in milliseconds. + The test will be run in a separate thread and is cancelled if the timeout + is exceeded. Used on a method or assembly, sets the default timeout + for all contained test methods. + + + + + Construct a TimeoutAttribute given a time in milliseconds + + The timeout value in milliseconds + + + + Marks a test that must run in the STA, causing it + to run in a separate thread if necessary. + + On methods, you may also use STAThreadAttribute + to serve the same purpose. + + + + + Construct a RequiresSTAAttribute + + + + + Marks a test that must run in the MTA, causing it + to run in a separate thread if necessary. + + On methods, you may also use MTAThreadAttribute + to serve the same purpose. + + + + + Construct a RequiresMTAAttribute + + + + + Marks a test that must run on a separate thread. + + + + + Construct a RequiresThreadAttribute + + + + + Construct a RequiresThreadAttribute, specifying the apartment + + + + + ValueSourceAttribute indicates the source to be used to + provide data for one parameter of a test method. + + + + + Construct with the name of the factory - for use with languages + that don't support params arrays. + + The name of the data source to be used + + + + Construct with a Type and name - for use with languages + that don't support params arrays. + + The Type that will provide data + The name of the method, property or field that will provide data + + + + The name of a the method, property or fiend to be used as a source + + + + + A Type to be used as a source + + + + + AllItemsConstraint applies another constraint to each + item in a collection, succeeding if they all succeed. + + + + + Abstract base class used for prefixes + + + + + The Constraint class is the base of all built-in constraints + within NUnit. It provides the operator overloads used to combine + constraints. + + + + + The IConstraintExpression interface is implemented by all + complete and resolvable constraints and expressions. + + + + + Return the top-level constraint for this expression + + + + + + Static UnsetObject used to detect derived constraints + failing to set the actual value. + + + + + The actual value being tested against a constraint + + + + + The display name of this Constraint for use by ToString() + + + + + Argument fields used by ToString(); + + + + + The builder holding this constraint + + + + + Construct a constraint with no arguments + + + + + Construct a constraint with one argument + + + + + Construct a constraint with two arguments + + + + + Sets the ConstraintBuilder holding this constraint + + + + + Write the failure message to the MessageWriter provided + as an argument. The default implementation simply passes + the constraint and the actual value to the writer, which + then displays the constraint description and the value. + + Constraints that need to provide additional details, + such as where the error occured can override this. + + The MessageWriter on which to display the message + + + + Test whether the constraint is satisfied by a given value + + The value to be tested + True for success, false for failure + + + + Test whether the constraint is satisfied by an + ActualValueDelegate that returns the value to be tested. + The default implementation simply evaluates the delegate + but derived classes may override it to provide for delayed + processing. + + An + True for success, false for failure + + + + Test whether the constraint is satisfied by a given reference. + The default implementation simply dereferences the value but + derived classes may override it to provide for delayed processing. + + A reference to the value to be tested + True for success, false for failure + + + + Write the constraint description to a MessageWriter + + The writer on which the description is displayed + + + + Write the actual value for a failing constraint test to a + MessageWriter. The default implementation simply writes + the raw value of actual, leaving it to the writer to + perform any formatting. + + The writer on which the actual value is displayed + + + + Default override of ToString returns the constraint DisplayName + followed by any arguments within angle brackets. + + + + + + Returns the string representation of this constraint + + + + + This operator creates a constraint that is satisfied only if both + argument constraints are satisfied. + + + + + This operator creates a constraint that is satisfied if either + of the argument constraints is satisfied. + + + + + This operator creates a constraint that is satisfied if the + argument constraint is not satisfied. + + + + + Returns a DelayedConstraint with the specified delay time. + + The delay in milliseconds. + + + + + Returns a DelayedConstraint with the specified delay time + and polling interval. + + The delay in milliseconds. + The interval at which to test the constraint. + + + + + The display name of this Constraint for use by ToString(). + The default value is the name of the constraint with + trailing "Constraint" removed. Derived classes may set + this to another name in their constructors. + + + + + Returns a ConstraintExpression by appending And + to the current constraint. + + + + + Returns a ConstraintExpression by appending And + to the current constraint. + + + + + Returns a ConstraintExpression by appending Or + to the current constraint. + + + + + Class used to detect any derived constraints + that fail to set the actual value in their + Matches override. + + + + + The base constraint + + + + + Construct given a base constraint + + + + + + Construct an AllItemsConstraint on top of an existing constraint + + + + + + Apply the item constraint to each item in the collection, + failing if any item fails. + + + + + + + Write a description of this constraint to a MessageWriter + + + + + + AndConstraint succeeds only if both members succeed. + + + + + BinaryConstraint is the abstract base of all constraints + that combine two other constraints in some fashion. + + + + + The first constraint being combined + + + + + The second constraint being combined + + + + + Construct a BinaryConstraint from two other constraints + + The first constraint + The second constraint + + + + Create an AndConstraint from two other constraints + + The first constraint + The second constraint + + + + Apply both member constraints to an actual value, succeeding + succeeding only if both of them succeed. + + The actual value + True if the constraints both succeeded + + + + Write a description for this contraint to a MessageWriter + + The MessageWriter to receive the description + + + + Write the actual value for a failing constraint test to a + MessageWriter. The default implementation simply writes + the raw value of actual, leaving it to the writer to + perform any formatting. + + The writer on which the actual value is displayed + + + + AssignableFromConstraint is used to test that an object + can be assigned from a given Type. + + + + + TypeConstraint is the abstract base for constraints + that take a Type as their expected value. + + + + + The expected Type used by the constraint + + + + + Construct a TypeConstraint for a given Type + + + + + + Write the actual value for a failing constraint test to a + MessageWriter. TypeConstraints override this method to write + the name of the type. + + The writer on which the actual value is displayed + + + + Construct an AssignableFromConstraint for the type provided + + + + + + Test whether an object can be assigned from the specified type + + The object to be tested + True if the object can be assigned a value of the expected Type, otherwise false. + + + + Write a description of this constraint to a MessageWriter + + The MessageWriter to use + + + + AssignableToConstraint is used to test that an object + can be assigned to a given Type. + + + + + Construct an AssignableToConstraint for the type provided + + + + + + Test whether an object can be assigned to the specified type + + The object to be tested + True if the object can be assigned a value of the expected Type, otherwise false. + + + + Write a description of this constraint to a MessageWriter + + The MessageWriter to use + + + + AttributeConstraint tests that a specified attribute is present + on a Type or other provider and that the value of the attribute + satisfies some other constraint. + + + + + Constructs an AttributeConstraint for a specified attriute + Type and base constraint. + + + + + + + Determines whether the Type or other provider has the + expected attribute and if its value matches the + additional constraint specified. + + + + + Writes a description of the attribute to the specified writer. + + + + + Writes the actual value supplied to the specified writer. + + + + + Returns a string representation of the constraint. + + + + + AttributeExistsConstraint tests for the presence of a + specified attribute on a Type. + + + + + Constructs an AttributeExistsConstraint for a specific attribute Type + + + + + + Tests whether the object provides the expected attribute. + + A Type, MethodInfo, or other ICustomAttributeProvider + True if the expected attribute is present, otherwise false + + + + Writes the description of the constraint to the specified writer + + + + + BasicConstraint is the abstract base for constraints that + perform a simple comparison to a constant value. + + + + + Initializes a new instance of the class. + + The expected. + The description. + + + + Test whether the constraint is satisfied by a given value + + The value to be tested + True for success, false for failure + + + + Write the constraint description to a MessageWriter + + The writer on which the description is displayed + + + + BinarySerializableConstraint tests whether + an object is serializable in binary format. + + + + + Test whether the constraint is satisfied by a given value + + The value to be tested + True for success, false for failure + + + + Write the constraint description to a MessageWriter + + The writer on which the description is displayed + + + + Write the actual value for a failing constraint test to a + MessageWriter. The default implementation simply writes + the raw value of actual, leaving it to the writer to + perform any formatting. + + The writer on which the actual value is displayed + + + + Returns the string representation + + + + + CollectionConstraint is the abstract base class for + constraints that operate on collections. + + + + + Construct an empty CollectionConstraint + + + + + Construct a CollectionConstraint + + + + + + Determines whether the specified enumerable is empty. + + The enumerable. + + true if the specified enumerable is empty; otherwise, false. + + + + + Test whether the constraint is satisfied by a given value + + The value to be tested + True for success, false for failure + + + + Protected method to be implemented by derived classes + + + + + + + CollectionContainsConstraint is used to test whether a collection + contains an expected object as a member. + + + + + CollectionItemsEqualConstraint is the abstract base class for all + collection constraints that apply some notion of item equality + as a part of their operation. + + + + + Construct an empty CollectionConstraint + + + + + Construct a CollectionConstraint + + + + + + Flag the constraint to use the supplied EqualityAdapter. + NOTE: For internal use only. + + The EqualityAdapter to use. + Self. + + + + Flag the constraint to use the supplied IComparer object. + + The IComparer object to use. + Self. + + + + Flag the constraint to use the supplied IComparer object. + + The IComparer object to use. + Self. + + + + Flag the constraint to use the supplied Comparison object. + + The IComparer object to use. + Self. + + + + Flag the constraint to use the supplied IEqualityComparer object. + + The IComparer object to use. + Self. + + + + Flag the constraint to use the supplied IEqualityComparer object. + + The IComparer object to use. + Self. + + + + Compares two collection members for equality + + + + + Return a new CollectionTally for use in making tests + + The collection to be included in the tally + + + + Flag the constraint to ignore case and return self. + + + + + Construct a CollectionContainsConstraint + + + + + + Test whether the expected item is contained in the collection + + + + + + + Write a descripton of the constraint to a MessageWriter + + + + + + CollectionEquivalentCOnstraint is used to determine whether two + collections are equivalent. + + + + + Construct a CollectionEquivalentConstraint + + + + + + Test whether two collections are equivalent + + + + + + + Write a description of this constraint to a MessageWriter + + + + + + CollectionOrderedConstraint is used to test whether a collection is ordered. + + + + + Construct a CollectionOrderedConstraint + + + + + Modifies the constraint to use an IComparer and returns self. + + + + + Modifies the constraint to use an IComparer<T> and returns self. + + + + + Modifies the constraint to use a Comparison<T> and returns self. + + + + + Modifies the constraint to test ordering by the value of + a specified property and returns self. + + + + + Test whether the collection is ordered + + + + + + + Write a description of the constraint to a MessageWriter + + + + + + Returns the string representation of the constraint. + + + + + + If used performs a reverse comparison + + + + + CollectionSubsetConstraint is used to determine whether + one collection is a subset of another + + + + + Construct a CollectionSubsetConstraint + + The collection that the actual value is expected to be a subset of + + + + Test whether the actual collection is a subset of + the expected collection provided. + + + + + + + Write a description of this constraint to a MessageWriter + + + + + + CollectionTally counts (tallies) the number of + occurences of each object in one or more enumerations. + + + + + Construct a CollectionTally object from a comparer and a collection + + + + + Try to remove an object from the tally + + The object to remove + True if successful, false if the object was not found + + + + Try to remove a set of objects from the tally + + The objects to remove + True if successful, false if any object was not found + + + + The number of objects remaining in the tally + + + + + ComparisonAdapter class centralizes all comparisons of + values in NUnit, adapting to the use of any provided + IComparer, IComparer<T> or Comparison<T> + + + + + Returns a ComparisonAdapter that wraps an IComparer + + + + + Returns a ComparisonAdapter that wraps an IComparer<T> + + + + + Returns a ComparisonAdapter that wraps a Comparison<T> + + + + + Compares two objects + + + + + Gets the default ComparisonAdapter, which wraps an + NUnitComparer object. + + + + + Construct a ComparisonAdapter for an IComparer + + + + + Compares two objects + + + + + + + + Construct a default ComparisonAdapter + + + + + ComparisonAdapter<T> extends ComparisonAdapter and + allows use of an IComparer<T> or Comparison<T> + to actually perform the comparison. + + + + + Construct a ComparisonAdapter for an IComparer<T> + + + + + Compare a Type T to an object + + + + + Construct a ComparisonAdapter for a Comparison<T> + + + + + Compare a Type T to an object + + + + + Abstract base class for constraints that compare values to + determine if one is greater than, equal to or less than + the other. This class supplies the Using modifiers. + + + + + ComparisonAdapter to be used in making the comparison + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class. + + + + + Modifies the constraint to use an IComparer and returns self + + + + + Modifies the constraint to use an IComparer<T> and returns self + + + + + Modifies the constraint to use a Comparison<T> and returns self + + + + + Delegate used to delay evaluation of the actual value + to be used in evaluating a constraint + + + + + ConstraintBuilder maintains the stacks that are used in + processing a ConstraintExpression. An OperatorStack + is used to hold operators that are waiting for their + operands to be reognized. a ConstraintStack holds + input constraints as well as the results of each + operator applied. + + + + + Initializes a new instance of the class. + + + + + Appends the specified operator to the expression by first + reducing the operator stack and then pushing the new + operator on the stack. + + The operator to push. + + + + Appends the specified constraint to the expresson by pushing + it on the constraint stack. + + The constraint to push. + + + + Sets the top operator right context. + + The right context. + + + + Reduces the operator stack until the topmost item + precedence is greater than or equal to the target precedence. + + The target precedence. + + + + Resolves this instance, returning a Constraint. If the builder + is not currently in a resolvable state, an exception is thrown. + + The resolved constraint + + + + Gets a value indicating whether this instance is resolvable. + + + true if this instance is resolvable; otherwise, false. + + + + + OperatorStack is a type-safe stack for holding ConstraintOperators + + + + + Initializes a new instance of the class. + + The builder. + + + + Pushes the specified operator onto the stack. + + The op. + + + + Pops the topmost operator from the stack. + + + + + + Gets a value indicating whether this is empty. + + true if empty; otherwise, false. + + + + Gets the topmost operator without modifying the stack. + + The top. + + + + ConstraintStack is a type-safe stack for holding Constraints + + + + + Initializes a new instance of the class. + + The builder. + + + + Pushes the specified constraint. As a side effect, + the constraint's builder field is set to the + ConstraintBuilder owning this stack. + + The constraint. + + + + Pops this topmost constrait from the stack. + As a side effect, the constraint's builder + field is set to null. + + + + + + Gets a value indicating whether this is empty. + + true if empty; otherwise, false. + + + + Gets the topmost constraint without modifying the stack. + + The topmost constraint + + + + ConstraintExpression represents a compound constraint in the + process of being constructed from a series of syntactic elements. + + Individual elements are appended to the expression as they are + reognized. Once an actual Constraint is appended, the expression + returns a resolvable Constraint. + + + + + ConstraintExpressionBase is the abstract base class for the + ConstraintExpression class, which represents a + compound constraint in the process of being constructed + from a series of syntactic elements. + + NOTE: ConstraintExpressionBase is separate because the + ConstraintExpression class was generated in earlier + versions of NUnit. The two classes may be combined + in a future version. + + + + + The ConstraintBuilder holding the elements recognized so far + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the + class passing in a ConstraintBuilder, which may be pre-populated. + + The builder. + + + + Returns a string representation of the expression as it + currently stands. This should only be used for testing, + since it has the side-effect of resolving the expression. + + + + + + Appends an operator to the expression and returns the + resulting expression itself. + + + + + Appends a self-resolving operator to the expression and + returns a new ResolvableConstraintExpression. + + + + + Appends a constraint to the expression and returns that + constraint, which is associated with the current state + of the expression being built. + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the + class passing in a ConstraintBuilder, which may be pre-populated. + + The builder. + + + + Returns a ConstraintExpression, which will apply + the following constraint to all members of a collection, + succeeding only if a specified number of them succeed. + + + + + Returns a new PropertyConstraintExpression, which will either + test for the existence of the named property on the object + being tested or apply any following constraint to that property. + + + + + Returns a new AttributeConstraint checking for the + presence of a particular attribute on an object. + + + + + Returns a new AttributeConstraint checking for the + presence of a particular attribute on an object. + + + + + Returns the constraint provided as an argument - used to allow custom + custom constraints to easily participate in the syntax. + + + + + Returns the constraint provided as an argument - used to allow custom + custom constraints to easily participate in the syntax. + + + + + Returns a constraint that tests two items for equality + + + + + Returns a constraint that tests that two references are the same object + + + + + Returns a constraint that tests whether the + actual value is greater than the suppled argument + + + + + Returns a constraint that tests whether the + actual value is greater than or equal to the suppled argument + + + + + Returns a constraint that tests whether the + actual value is greater than or equal to the suppled argument + + + + + Returns a constraint that tests whether the + actual value is less than the suppled argument + + + + + Returns a constraint that tests whether the + actual value is less than or equal to the suppled argument + + + + + Returns a constraint that tests whether the + actual value is less than or equal to the suppled argument + + + + + Returns a constraint that tests whether the actual + value is of the exact type supplied as an argument. + + + + + Returns a constraint that tests whether the actual + value is of the exact type supplied as an argument. + + + + + Returns a constraint that tests whether the actual value + is of the type supplied as an argument or a derived type. + + + + + Returns a constraint that tests whether the actual value + is of the type supplied as an argument or a derived type. + + + + + Returns a constraint that tests whether the actual value + is of the type supplied as an argument or a derived type. + + + + + Returns a constraint that tests whether the actual value + is of the type supplied as an argument or a derived type. + + + + + Returns a constraint that tests whether the actual value + is assignable from the type supplied as an argument. + + + + + Returns a constraint that tests whether the actual value + is assignable from the type supplied as an argument. + + + + + Returns a constraint that tests whether the actual value + is assignable from the type supplied as an argument. + + + + + Returns a constraint that tests whether the actual value + is assignable from the type supplied as an argument. + + + + + Returns a constraint that tests whether the actual value + is a collection containing the same elements as the + collection supplied as an argument. + + + + + Returns a constraint that tests whether the actual value + is a subset of the collection supplied as an argument. + + + + + Returns a new CollectionContainsConstraint checking for the + presence of a particular object in the collection. + + + + + Returns a new CollectionContainsConstraint checking for the + presence of a particular object in the collection. + + + + + Returns a new ContainsConstraint. This constraint + will, in turn, make use of the appropriate second-level + constraint, depending on the type of the actual argument. + This overload is only used if the item sought is a string, + since any other type implies that we are looking for a + collection member. + + + + + Returns a constraint that succeeds if the actual + value contains the substring supplied as an argument. + + + + + Returns a constraint that succeeds if the actual + value contains the substring supplied as an argument. + + + + + Returns a constraint that succeeds if the actual + value starts with the substring supplied as an argument. + + + + + Returns a constraint that succeeds if the actual + value starts with the substring supplied as an argument. + + + + + Returns a constraint that succeeds if the actual + value ends with the substring supplied as an argument. + + + + + Returns a constraint that succeeds if the actual + value ends with the substring supplied as an argument. + + + + + Returns a constraint that succeeds if the actual + value matches the regular expression supplied as an argument. + + + + + Returns a constraint that succeeds if the actual + value matches the regular expression supplied as an argument. + + + + + Returns a constraint that tests whether the path provided + is the same as an expected path after canonicalization. + + + + + Returns a constraint that tests whether the path provided + is the same path or under an expected path after canonicalization. + + + + + Returns a constraint that tests whether the path provided + is the same path or under an expected path after canonicalization. + + + + + Returns a constraint that tests whether the actual value falls + within a specified range. + + + + + Returns a ConstraintExpression that negates any + following constraint. + + + + + Returns a ConstraintExpression that negates any + following constraint. + + + + + Returns a ConstraintExpression, which will apply + the following constraint to all members of a collection, + succeeding if all of them succeed. + + + + + Returns a ConstraintExpression, which will apply + the following constraint to all members of a collection, + succeeding if at least one of them succeeds. + + + + + Returns a ConstraintExpression, which will apply + the following constraint to all members of a collection, + succeeding if all of them fail. + + + + + Returns a new ConstraintExpression, which will apply the following + constraint to the Length property of the object being tested. + + + + + Returns a new ConstraintExpression, which will apply the following + constraint to the Count property of the object being tested. + + + + + Returns a new ConstraintExpression, which will apply the following + constraint to the Message property of the object being tested. + + + + + Returns a new ConstraintExpression, which will apply the following + constraint to the InnerException property of the object being tested. + + + + + With is currently a NOP - reserved for future use. + + + + + Returns a constraint that tests for null + + + + + Returns a constraint that tests for True + + + + + Returns a constraint that tests for False + + + + + Returns a constraint that tests for a positive value + + + + + Returns a constraint that tests for a negative value + + + + + Returns a constraint that tests for NaN + + + + + Returns a constraint that tests for empty + + + + + Returns a constraint that tests whether a collection + contains all unique items. + + + + + Returns a constraint that tests whether an object graph is serializable in binary format. + + + + + Returns a constraint that tests whether an object graph is serializable in xml format. + + + + + Returns a constraint that tests whether a collection is ordered + + + + + ContainsConstraint tests a whether a string contains a substring + or a collection contains an object. It postpones the decision of + which test to use until the type of the actual argument is known. + This allows testing whether a string is contained in a collection + or as a substring of another string using the same syntax. + + + + + Initializes a new instance of the class. + + The expected. + + + + Test whether the constraint is satisfied by a given value + + The value to be tested + True for success, false for failure + + + + Write the constraint description to a MessageWriter + + The writer on which the description is displayed + + + + Flag the constraint to use the supplied IComparer object. + + The IComparer object to use. + Self. + + + + Flag the constraint to use the supplied IComparer object. + + The IComparer object to use. + Self. + + + + Flag the constraint to use the supplied Comparison object. + + The IComparer object to use. + Self. + + + + Flag the constraint to use the supplied IEqualityComparer object. + + The IComparer object to use. + Self. + + + + Flag the constraint to use the supplied IEqualityComparer object. + + The IComparer object to use. + Self. + + + + Flag the constraint to ignore case and return self. + + + + + Applies a delay to the match so that a match can be evaluated in the future. + + + + + Creates a new DelayedConstraint + + The inner constraint two decorate + The time interval after which the match is performed + If the value of is less than 0 + + + + Creates a new DelayedConstraint + + The inner constraint two decorate + The time interval after which the match is performed + The time interval used for polling + If the value of is less than 0 + + + + Test whether the constraint is satisfied by a given value + + The value to be tested + True for if the base constraint fails, false if it succeeds + + + + Test whether the constraint is satisfied by a delegate + + The delegate whose value is to be tested + True for if the base constraint fails, false if it succeeds + + + + Test whether the constraint is satisfied by a given reference. + Overridden to wait for the specified delay period before + calling the base constraint with the dereferenced value. + + A reference to the value to be tested + True for success, false for failure + + + + Write the constraint description to a MessageWriter + + The writer on which the description is displayed + + + + Write the actual value for a failing constraint test to a MessageWriter. + + The writer on which the actual value is displayed + + + + Returns the string representation of the constraint. + + + + + EmptyCollectionConstraint tests whether a collection is empty. + + + + + Check that the collection is empty + + + + + + + Write the constraint description to a MessageWriter + + + + + + EmptyConstraint tests a whether a string or collection is empty, + postponing the decision about which test is applied until the + type of the actual argument is known. + + + + + Test whether the constraint is satisfied by a given value + + The value to be tested + True for success, false for failure + + + + Write the constraint description to a MessageWriter + + The writer on which the description is displayed + + + + EmptyDirectoryConstraint is used to test that a directory is empty + + + + + Test whether the constraint is satisfied by a given value + + The value to be tested + True for success, false for failure + + + + Write the constraint description to a MessageWriter + + The writer on which the description is displayed + + + + Write the actual value for a failing constraint test to a + MessageWriter. The default implementation simply writes + the raw value of actual, leaving it to the writer to + perform any formatting. + + The writer on which the actual value is displayed + + + + EmptyStringConstraint tests whether a string is empty. + + + + + Test whether the constraint is satisfied by a given value + + The value to be tested + True for success, false for failure + + + + Write the constraint description to a MessageWriter + + The writer on which the description is displayed + + + + EndsWithConstraint can test whether a string ends + with an expected substring. + + + + + StringConstraint is the abstract base for constraints + that operate on strings. It supports the IgnoreCase + modifier for string operations. + + + + + The expected value + + + + + Indicates whether tests should be case-insensitive + + + + + Constructs a StringConstraint given an expected value + + The expected value + + + + Test whether the constraint is satisfied by a given value + + The value to be tested + True for success, false for failure + + + + Test whether the constraint is satisfied by a given string + + The string to be tested + True for success, false for failure + + + + Modify the constraint to ignore case in matching. + + + + + Initializes a new instance of the class. + + The expected string + + + + Test whether the constraint is matched by the actual value. + This is a template method, which calls the IsMatch method + of the derived class. + + + + + + + Write the constraint description to a MessageWriter + + The writer on which the description is displayed + + + + EqualConstraint is able to compare an actual value with the + expected value provided in its constructor. Two objects are + considered equal if both are null, or if both have the same + value. NUnit has special semantics for some object types. + + + + + If true, strings in error messages will be clipped + + + + + NUnitEqualityComparer used to test equality. + + + + + Initializes a new instance of the class. + + The expected value. + + + + Flag the constraint to use a tolerance when determining equality. + + Tolerance value to be used + Self. + + + + Flag the constraint to use the supplied IComparer object. + + The IComparer object to use. + Self. + + + + Flag the constraint to use the supplied IComparer object. + + The IComparer object to use. + Self. + + + + Flag the constraint to use the supplied IComparer object. + + The IComparer object to use. + Self. + + + + Flag the constraint to use the supplied Comparison object. + + The IComparer object to use. + Self. + + + + Flag the constraint to use the supplied IEqualityComparer object. + + The IComparer object to use. + Self. + + + + Flag the constraint to use the supplied IEqualityComparer object. + + The IComparer object to use. + Self. + + + + Test whether the constraint is satisfied by a given value + + The value to be tested + True for success, false for failure + + + + Write a failure message. Overridden to provide custom + failure messages for EqualConstraint. + + The MessageWriter to write to + + + + Write description of this constraint + + The MessageWriter to write to + + + + Display the failure information for two collections that did not match. + + The MessageWriter on which to display + The expected collection. + The actual collection + The depth of this failure in a set of nested collections + + + + Displays a single line showing the types and sizes of the expected + and actual enumerations, collections or arrays. If both are identical, + the value is only shown once. + + The MessageWriter on which to display + The expected collection or array + The actual collection or array + The indentation level for the message line + + + + Displays a single line showing the point in the expected and actual + arrays at which the comparison failed. If the arrays have different + structures or dimensions, both values are shown. + + The MessageWriter on which to display + The expected array + The actual array + Index of the failure point in the underlying collections + The indentation level for the message line + + + + Display the failure information for two IEnumerables that did not match. + + The MessageWriter on which to display + The expected enumeration. + The actual enumeration + The depth of this failure in a set of nested collections + + + + Flag the constraint to ignore case and return self. + + + + + Flag the constraint to suppress string clipping + and return self. + + + + + Flag the constraint to compare arrays as collections + and return self. + + + + + Switches the .Within() modifier to interpret its tolerance as + a distance in representable values (see remarks). + + Self. + + Ulp stands for "unit in the last place" and describes the minimum + amount a given value can change. For any integers, an ulp is 1 whole + digit. For floating point values, the accuracy of which is better + for smaller numbers and worse for larger numbers, an ulp depends + on the size of the number. Using ulps for comparison of floating + point results instead of fixed tolerances is safer because it will + automatically compensate for the added inaccuracy of larger numbers. + + + + + Switches the .Within() modifier to interpret its tolerance as + a percentage that the actual values is allowed to deviate from + the expected value. + + Self + + + + Causes the tolerance to be interpreted as a TimeSpan in days. + + Self + + + + Causes the tolerance to be interpreted as a TimeSpan in hours. + + Self + + + + Causes the tolerance to be interpreted as a TimeSpan in minutes. + + Self + + + + Causes the tolerance to be interpreted as a TimeSpan in seconds. + + Self + + + + Causes the tolerance to be interpreted as a TimeSpan in milliseconds. + + Self + + + + Causes the tolerance to be interpreted as a TimeSpan in clock ticks. + + Self + + + + EqualityAdapter class handles all equality comparisons + that use an IEqualityComparer, IEqualityComparer<T> + or a ComparisonAdapter. + + + + + Compares two objects, returning true if they are equal + + + + + Returns true if the two objects can be compared by this adapter. + The base adapter cannot handle IEnumerables except for strings. + + + + + Returns an EqualityAdapter that wraps an IComparer. + + + + + Returns an EqualityAdapter that wraps an IEqualityComparer. + + + + + Returns an EqualityAdapter that wraps an IEqualityComparer<T>. + + + + + Returns an EqualityAdapter that wraps an IComparer<T>. + + + + + Returns an EqualityAdapter that wraps a Comparison<T>. + + + + + EqualityAdapter that wraps an IComparer. + + + + + Returns true if the two objects can be compared by this adapter. + Generic adapter requires objects of the specified type. + + + + + EqualityAdapter that wraps an IComparer. + + + + + EqualityAdapterList represents a list of EqualityAdapters + in a common class across platforms. + + + + + ExactCountConstraint applies another constraint to each + item in a collection, succeeding only if a specified + number of items succeed. + + + + + Construct an ExactCountConstraint on top of an existing constraint + + + + + + + Apply the item constraint to each item in the collection, + succeeding only if the expected number of items pass. + + + + + + + Write a description of this constraint to a MessageWriter + + + + + + ExactTypeConstraint is used to test that an object + is of the exact type provided in the constructor + + + + + Construct an ExactTypeConstraint for a given Type + + The expected Type. + + + + Test that an object is of the exact type specified + + The actual value. + True if the tested object is of the exact type provided, otherwise false. + + + + Write the description of this constraint to a MessageWriter + + The MessageWriter to use + + + + ExceptionTypeConstraint is a special version of ExactTypeConstraint + used to provided detailed info about the exception thrown in + an error message. + + + + + Constructs an ExceptionTypeConstraint + + + + + Write the actual value for a failing constraint test to a + MessageWriter. Overriden to write additional information + in the case of an Exception. + + The MessageWriter to use + + + + FailurePoint class represents one point of failure + in an equality test. + + + + + The location of the failure + + + + + The expected value + + + + + The actual value + + + + + Indicates whether the expected value is valid + + + + + Indicates whether the actual value is valid + + + + + FailurePointList represents a set of FailurePoints + in a cross-platform way. + + + + + FalseConstraint tests that the actual value is false + + + + + Initializes a new instance of the class. + + + + Helper routines for working with floating point numbers + + + The floating point comparison code is based on this excellent article: + http://www.cygnus-software.com/papers/comparingfloats/comparingfloats.htm + + + "ULP" means Unit in the Last Place and in the context of this library refers to + the distance between two adjacent floating point numbers. IEEE floating point + numbers can only represent a finite subset of natural numbers, with greater + accuracy for smaller numbers and lower accuracy for very large numbers. + + + If a comparison is allowed "2 ulps" of deviation, that means the values are + allowed to deviate by up to 2 adjacent floating point values, which might be + as low as 0.0000001 for small numbers or as high as 10.0 for large numbers. + + + + + Compares two floating point values for equality + First floating point value to be compared + Second floating point value t be compared + + Maximum number of representable floating point values that are allowed to + be between the left and the right floating point values + + True if both numbers are equal or close to being equal + + + Floating point values can only represent a finite subset of natural numbers. + For example, the values 2.00000000 and 2.00000024 can be stored in a float, + but nothing inbetween them. + + + This comparison will count how many possible floating point values are between + the left and the right number. If the number of possible values between both + numbers is less than or equal to maxUlps, then the numbers are considered as + being equal. + + + Implementation partially follows the code outlined here: + http://www.anttirt.net/2007/08/19/proper-floating-point-comparisons/ + + + + + Compares two double precision floating point values for equality + First double precision floating point value to be compared + Second double precision floating point value t be compared + + Maximum number of representable double precision floating point values that are + allowed to be between the left and the right double precision floating point values + + True if both numbers are equal or close to being equal + + + Double precision floating point values can only represent a limited series of + natural numbers. For example, the values 2.0000000000000000 and 2.0000000000000004 + can be stored in a double, but nothing inbetween them. + + + This comparison will count how many possible double precision floating point + values are between the left and the right number. If the number of possible + values between both numbers is less than or equal to maxUlps, then the numbers + are considered as being equal. + + + Implementation partially follows the code outlined here: + http://www.anttirt.net/2007/08/19/proper-floating-point-comparisons/ + + + + + + Reinterprets the memory contents of a floating point value as an integer value + + + Floating point value whose memory contents to reinterpret + + + The memory contents of the floating point value interpreted as an integer + + + + + Reinterprets the memory contents of a double precision floating point + value as an integer value + + + Double precision floating point value whose memory contents to reinterpret + + + The memory contents of the double precision floating point value + interpreted as an integer + + + + + Reinterprets the memory contents of an integer as a floating point value + + Integer value whose memory contents to reinterpret + + The memory contents of the integer value interpreted as a floating point value + + + + + Reinterprets the memory contents of an integer value as a double precision + floating point value + + Integer whose memory contents to reinterpret + + The memory contents of the integer interpreted as a double precision + floating point value + + + + Union of a floating point variable and an integer + + + The union's value as a floating point variable + + + The union's value as an integer + + + The union's value as an unsigned integer + + + Union of a double precision floating point variable and a long + + + The union's value as a double precision floating point variable + + + The union's value as a long + + + The union's value as an unsigned long + + + + Tests whether a value is greater than the value supplied to its constructor + + + + + The value against which a comparison is to be made + + + + + Initializes a new instance of the class. + + The expected value. + + + + Write the constraint description to a MessageWriter + + The writer on which the description is displayed + + + + Test whether the constraint is satisfied by a given value + + The value to be tested + True for success, false for failure + + + + Tests whether a value is greater than or equal to the value supplied to its constructor + + + + + The value against which a comparison is to be made + + + + + Initializes a new instance of the class. + + The expected value. + + + + Write the constraint description to a MessageWriter + + The writer on which the description is displayed + + + + Test whether the constraint is satisfied by a given value + + The value to be tested + True for success, false for failure + + + + InstanceOfTypeConstraint is used to test that an object + is of the same type provided or derived from it. + + + + + Construct an InstanceOfTypeConstraint for the type provided + + The expected Type + + + + Test whether an object is of the specified type or a derived type + + The object to be tested + True if the object is of the provided type or derives from it, otherwise false. + + + + Write a description of this constraint to a MessageWriter + + The MessageWriter to use + + + + Tests whether a value is less than the value supplied to its constructor + + + + + The value against which a comparison is to be made + + + + + Initializes a new instance of the class. + + The expected value. + + + + Write the constraint description to a MessageWriter + + The writer on which the description is displayed + + + + Test whether the constraint is satisfied by a given value + + The value to be tested + True for success, false for failure + + + + Tests whether a value is less than or equal to the value supplied to its constructor + + + + + The value against which a comparison is to be made + + + + + Initializes a new instance of the class. + + The expected value. + + + + Write the constraint description to a MessageWriter + + The writer on which the description is displayed + + + + Test whether the constraint is satisfied by a given value + + The value to be tested + True for success, false for failure + + + + Static methods used in creating messages + + + + + Static string used when strings are clipped + + + + + Returns the representation of a type as used in NUnitLite. + This is the same as Type.ToString() except for arrays, + which are displayed with their declared sizes. + + + + + + + Converts any control characters in a string + to their escaped representation. + + The string to be converted + The converted string + + + + Return the a string representation for a set of indices into an array + + Array of indices for which a string is needed + + + + Get an array of indices representing the point in a enumerable, + collection or array corresponding to a single int index into the + collection. + + The collection to which the indices apply + Index in the collection + Array of indices + + + + Clip a string to a given length, starting at a particular offset, returning the clipped + string with ellipses representing the removed parts + + The string to be clipped + The maximum permitted length of the result string + The point at which to start clipping + The clipped string + + + + Clip the expected and actual strings in a coordinated fashion, + so that they may be displayed together. + + + + + + + + + Shows the position two strings start to differ. Comparison + starts at the start index. + + The expected string + The actual string + The index in the strings at which comparison should start + Boolean indicating whether case should be ignored + -1 if no mismatch found, or the index where mismatch found + + + + NaNConstraint tests that the actual value is a double or float NaN + + + + + Test that the actual value is an NaN + + + + + + + Write the constraint description to a specified writer + + + + + + NoItemConstraint applies another constraint to each + item in a collection, failing if any of them succeeds. + + + + + Construct a NoItemConstraint on top of an existing constraint + + + + + + Apply the item constraint to each item in the collection, + failing if any item fails. + + + + + + + Write a description of this constraint to a MessageWriter + + + + + + NotConstraint negates the effect of some other constraint + + + + + Initializes a new instance of the class. + + The base constraint to be negated. + + + + Test whether the constraint is satisfied by a given value + + The value to be tested + True for if the base constraint fails, false if it succeeds + + + + Write the constraint description to a MessageWriter + + The writer on which the description is displayed + + + + Write the actual value for a failing constraint test to a MessageWriter. + + The writer on which the actual value is displayed + + + + NullConstraint tests that the actual value is null + + + + + Initializes a new instance of the class. + + + + + NullEmptyStringConstraint tests whether a string is either null or empty. + + + + + Constructs a new NullOrEmptyStringConstraint + + + + + Test whether the constraint is satisfied by a given value + + The value to be tested + True for success, false for failure + + + + Write the constraint description to a MessageWriter + + The writer on which the description is displayed + + + + The Numerics class contains common operations on numeric values. + + + + + Checks the type of the object, returning true if + the object is a numeric type. + + The object to check + true if the object is a numeric type + + + + Checks the type of the object, returning true if + the object is a floating point numeric type. + + The object to check + true if the object is a floating point numeric type + + + + Checks the type of the object, returning true if + the object is a fixed point numeric type. + + The object to check + true if the object is a fixed point numeric type + + + + Test two numeric values for equality, performing the usual numeric + conversions and using a provided or default tolerance. If the tolerance + provided is Empty, this method may set it to a default tolerance. + + The expected value + The actual value + A reference to the tolerance in effect + True if the values are equal + + + + Compare two numeric values, performing the usual numeric conversions. + + The expected value + The actual value + The relationship of the values to each other + + + + NUnitComparer encapsulates NUnit's default behavior + in comparing two objects. + + + + + Compares two objects + + + + + + + + Returns the default NUnitComparer. + + + + + Generic version of NUnitComparer + + + + + + Compare two objects of the same type + + + + + NUnitEqualityComparer encapsulates NUnit's handling of + equality tests between objects. + + + + + + + + + + Compares two objects for equality within a tolerance + + The first object to compare + The second object to compare + The tolerance to use in the comparison + + + + + If true, all string comparisons will ignore case + + + + + If true, arrays will be treated as collections, allowing + those of different dimensions to be compared + + + + + Comparison objects used in comparisons for some constraints. + + + + + List of points at which a failure occured. + + + + + RecursionDetector used to check for recursion when + evaluating self-referencing enumerables. + + + + + Compares two objects for equality within a tolerance, setting + the tolerance to the actual tolerance used if an empty + tolerance is supplied. + + + + + Helper method to compare two arrays + + + + + Method to compare two DirectoryInfo objects + + first directory to compare + second directory to compare + true if equivalent, false if not + + + + Returns the default NUnitEqualityComparer + + + + + Gets and sets a flag indicating whether case should + be ignored in determining equality. + + + + + Gets and sets a flag indicating that arrays should be + compared as collections, without regard to their shape. + + + + + Gets the list of external comparers to be used to + test for equality. They are applied to members of + collections, in place of NUnit's own logic. + + + + + Gets the list of failure points for the last Match performed. + The list consists of objects to be interpreted by the caller. + This generally means that the caller may only make use of + objects it has placed on the list at a particular depthy. + + + + + RecursionDetector detects when a comparison + between two enumerables has reached a point + where the same objects that were previously + compared are again being compared. This allows + the caller to stop the comparison if desired. + + + + + Check whether two objects have previously + been compared, returning true if they have. + The two objects are remembered, so that a + second call will always return true. + + + + + OrConstraint succeeds if either member succeeds + + + + + Create an OrConstraint from two other constraints + + The first constraint + The second constraint + + + + Apply the member constraints to an actual value, succeeding + succeeding as soon as one of them succeeds. + + The actual value + True if either constraint succeeded + + + + Write a description for this contraint to a MessageWriter + + The MessageWriter to receive the description + + + + PathConstraint serves as the abstract base of constraints + that operate on paths and provides several helper methods. + + + + + The expected path used in the constraint + + + + + Flag indicating whether a caseInsensitive comparison should be made + + + + + Construct a PathConstraint for a give expected path + + The expected path + + + + Test whether the constraint is satisfied by a given value + + The value to be tested + True for success, false for failure + + + + Returns true if the expected path and actual path match + + + + + Returns the string representation of this constraint + + + + + Transform the provided path to its canonical form so that it + may be more easily be compared with other paths. + + The original path + The path in canonical form + + + + Test whether one path in canonical form is under another. + + The first path - supposed to be the parent path + The second path - supposed to be the child path + Indicates whether case should be ignored + + + + + Modifies the current instance to be case-insensitve + and returns it. + + + + + Modifies the current instance to be case-sensitve + and returns it. + + + + + Predicate constraint wraps a Predicate in a constraint, + returning success if the predicate is true. + + + + + Construct a PredicateConstraint from a predicate + + + + + Determines whether the predicate succeeds when applied + to the actual value. + + + + + Writes the description to a MessageWriter + + + + + PropertyConstraint extracts a named property and uses + its value as the actual value for a chained constraint. + + + + + Initializes a new instance of the class. + + The name. + The constraint to apply to the property. + + + + Test whether the constraint is satisfied by a given value + + The value to be tested + True for success, false for failure + + + + Write the constraint description to a MessageWriter + + The writer on which the description is displayed + + + + Write the actual value for a failing constraint test to a + MessageWriter. The default implementation simply writes + the raw value of actual, leaving it to the writer to + perform any formatting. + + The writer on which the actual value is displayed + + + + Returns the string representation of the constraint. + + + + + + PropertyExistsConstraint tests that a named property + exists on the object provided through Match. + + Originally, PropertyConstraint provided this feature + in addition to making optional tests on the vaue + of the property. The two constraints are now separate. + + + + + Initializes a new instance of the class. + + The name of the property. + + + + Test whether the property exists for a given object + + The object to be tested + True for success, false for failure + + + + Write the constraint description to a MessageWriter + + The writer on which the description is displayed + + + + Write the actual value for a failing constraint test to a + MessageWriter. + + The writer on which the actual value is displayed + + + + Returns the string representation of the constraint. + + + + + + RangeConstraint tests whether two values are within a + specified range. + + + + + Initializes a new instance of the class. + + From. + To. + + + + Test whether the constraint is satisfied by a given value + + The value to be tested + True for success, false for failure + + + + Write the constraint description to a MessageWriter + + The writer on which the description is displayed + + + + RegexConstraint can test whether a string matches + the pattern provided. + + + + + Initializes a new instance of the class. + + The pattern. + + + + Test whether the constraint is satisfied by a given value + + The value to be tested + True for success, false for failure + + + + Write the constraint description to a MessageWriter + + The writer on which the description is displayed + + + + ResolvableConstraintExpression is used to represent a compound + constraint being constructed at a point where the last operator + may either terminate the expression or may have additional + qualifying constraints added to it. + + It is used, for example, for a Property element or for + an Exception element, either of which may be optionally + followed by constraints that apply to the property or + exception. + + + + + Create a new instance of ResolvableConstraintExpression + + + + + Create a new instance of ResolvableConstraintExpression, + passing in a pre-populated ConstraintBuilder. + + + + + Resolve the current expression to a Constraint + + + + + This operator creates a constraint that is satisfied only if both + argument constraints are satisfied. + + + + + This operator creates a constraint that is satisfied only if both + argument constraints are satisfied. + + + + + This operator creates a constraint that is satisfied only if both + argument constraints are satisfied. + + + + + This operator creates a constraint that is satisfied if either + of the argument constraints is satisfied. + + + + + This operator creates a constraint that is satisfied if either + of the argument constraints is satisfied. + + + + + This operator creates a constraint that is satisfied if either + of the argument constraints is satisfied. + + + + + This operator creates a constraint that is satisfied if the + argument constraint is not satisfied. + + + + + Appends an And Operator to the expression + + + + + Appends an Or operator to the expression. + + + + + ReusableConstraint wraps a constraint expression after + resolving it so that it can be reused consistently. + + + + + Construct a ReusableConstraint from a constraint expression + + The expression to be resolved and reused + + + + Converts a constraint to a ReusableConstraint + + The constraint to be converted + A ReusableConstraint + + + + Returns the string representation of the constraint. + + A string representing the constraint + + + + Resolves the ReusableConstraint by returning the constraint + that it originally wrapped. + + A resolved constraint + + + + SameAsConstraint tests whether an object is identical to + the object passed to its constructor + + + + + Initializes a new instance of the class. + + The expected object. + + + + Test whether the constraint is satisfied by a given value + + The value to be tested + True for success, false for failure + + + + Write the constraint description to a MessageWriter + + The writer on which the description is displayed + + + + Summary description for SamePathConstraint. + + + + + Initializes a new instance of the class. + + The expected path + + + + Test whether the constraint is satisfied by a given value + + The expected path + The actual path + True for success, false for failure + + + + Write the constraint description to a MessageWriter + + The writer on which the description is displayed + + + + SamePathOrUnderConstraint tests that one path is under another + + + + + Initializes a new instance of the class. + + The expected path + + + + Test whether the constraint is satisfied by a given value + + The expected path + The actual path + True for success, false for failure + + + + Write the constraint description to a MessageWriter + + The writer on which the description is displayed + + + + SomeItemsConstraint applies another constraint to each + item in a collection, succeeding if any of them succeeds. + + + + + Construct a SomeItemsConstraint on top of an existing constraint + + + + + + Apply the item constraint to each item in the collection, + succeeding if any item succeeds. + + + + + + + Write a description of this constraint to a MessageWriter + + + + + + StartsWithConstraint can test whether a string starts + with an expected substring. + + + + + Initializes a new instance of the class. + + The expected string + + + + Test whether the constraint is matched by the actual value. + This is a template method, which calls the IsMatch method + of the derived class. + + + + + + + Write the constraint description to a MessageWriter + + The writer on which the description is displayed + + + + SubPathConstraint tests that the actual path is under the expected path + + + + + Initializes a new instance of the class. + + The expected path + + + + Test whether the constraint is satisfied by a given value + + The expected path + The actual path + True for success, false for failure + + + + Write the constraint description to a MessageWriter + + The writer on which the description is displayed + + + + SubstringConstraint can test whether a string contains + the expected substring. + + + + + Initializes a new instance of the class. + + The expected. + + + + Test whether the constraint is satisfied by a given value + + The value to be tested + True for success, false for failure + + + + Write the constraint description to a MessageWriter + + The writer on which the description is displayed + + + + ThrowsConstraint is used to test the exception thrown by + a delegate by applying a constraint to it. + + + + + Initializes a new instance of the class, + using a constraint to be applied to the exception. + + A constraint to apply to the caught exception. + + + + Executes the code of the delegate and captures any exception. + If a non-null base constraint was provided, it applies that + constraint to the exception. + + A delegate representing the code to be tested + True if an exception is thrown and the constraint succeeds, otherwise false + + + + Converts an ActualValueDelegate to a TestDelegate + before calling the primary overload. + + + + + Write the constraint description to a MessageWriter + + The writer on which the description is displayed + + + + Write the actual value for a failing constraint test to a + MessageWriter. The default implementation simply writes + the raw value of actual, leaving it to the writer to + perform any formatting. + + The writer on which the actual value is displayed + + + + Returns the string representation of this constraint + + + + + Get the actual exception thrown - used by Assert.Throws. + + + + + ThrowsNothingConstraint tests that a delegate does not + throw an exception. + + + + + Test whether the constraint is satisfied by a given value + + The value to be tested + True if no exception is thrown, otherwise false + + + + Write the constraint description to a MessageWriter + + The writer on which the description is displayed + + + + Write the actual value for a failing constraint test to a + MessageWriter. Overridden in ThrowsNothingConstraint to write + information about the exception that was actually caught. + + The writer on which the actual value is displayed + + + + The Tolerance class generalizes the notion of a tolerance + within which an equality test succeeds. Normally, it is + used with numeric types, but it can be used with any + type that supports taking a difference between two + objects and comparing that difference to a value. + + + + + Constructs a linear tolerance of a specdified amount + + + + + Constructs a tolerance given an amount and ToleranceMode + + + + + Tests that the current Tolerance is linear with a + numeric value, throwing an exception if it is not. + + + + + Returns an empty Tolerance object, equivalent to + specifying no tolerance. In most cases, it results + in an exact match but for floats and doubles a + default tolerance may be used. + + + + + Returns a zero Tolerance object, equivalent to + specifying an exact match. + + + + + Gets the ToleranceMode for the current Tolerance + + + + + Gets the value of the current Tolerance instance. + + + + + Returns a new tolerance, using the current amount as a percentage. + + + + + Returns a new tolerance, using the current amount in Ulps. + + + + + Returns a new tolerance with a TimeSpan as the amount, using + the current amount as a number of days. + + + + + Returns a new tolerance with a TimeSpan as the amount, using + the current amount as a number of hours. + + + + + Returns a new tolerance with a TimeSpan as the amount, using + the current amount as a number of minutes. + + + + + Returns a new tolerance with a TimeSpan as the amount, using + the current amount as a number of seconds. + + + + + Returns a new tolerance with a TimeSpan as the amount, using + the current amount as a number of milliseconds. + + + + + Returns a new tolerance with a TimeSpan as the amount, using + the current amount as a number of clock ticks. + + + + + Returns true if the current tolerance is empty. + + + + + Modes in which the tolerance value for a comparison can be interpreted. + + + + + The tolerance was created with a value, without specifying + how the value would be used. This is used to prevent setting + the mode more than once and is generally changed to Linear + upon execution of the test. + + + + + The tolerance is used as a numeric range within which + two compared values are considered to be equal. + + + + + Interprets the tolerance as the percentage by which + the two compared values my deviate from each other. + + + + + Compares two values based in their distance in + representable numbers. + + + + + TrueConstraint tests that the actual value is true + + + + + Initializes a new instance of the class. + + + + + UniqueItemsConstraint tests whether all the items in a + collection are unique. + + + + + Check that all items are unique. + + + + + + + Write a description of this constraint to a MessageWriter + + + + + + XmlSerializableConstraint tests whether + an object is serializable in XML format. + + + + + Test whether the constraint is satisfied by a given value + + The value to be tested + True for success, false for failure + + + + Write the constraint description to a MessageWriter + + The writer on which the description is displayed + + + + Write the actual value for a failing constraint test to a + MessageWriter. The default implementation simply writes + the raw value of actual, leaving it to the writer to + perform any formatting. + + The writer on which the actual value is displayed + + + + Returns the string representation of this constraint + + + + + Represents a constraint that succeeds if all the + members of a collection match a base constraint. + + + + + Abstract base for operators that indicate how to + apply a constraint to items in a collection. + + + + + PrefixOperator takes a single constraint and modifies + it's action in some way. + + + + + The ConstraintOperator class is used internally by a + ConstraintBuilder to represent an operator that + modifies or combines constraints. + + Constraint operators use left and right precedence + values to determine whether the top operator on the + stack should be reduced before pushing a new operator. + + + + + The precedence value used when the operator + is about to be pushed to the stack. + + + + + The precedence value used when the operator + is on the top of the stack. + + + + + Reduce produces a constraint from the operator and + any arguments. It takes the arguments from the constraint + stack and pushes the resulting constraint on it. + + + + + + The syntax element preceding this operator + + + + + The syntax element folowing this operator + + + + + The precedence value used when the operator + is about to be pushed to the stack. + + + + + The precedence value used when the operator + is on the top of the stack. + + + + + Reduce produces a constraint from the operator and + any arguments. It takes the arguments from the constraint + stack and pushes the resulting constraint on it. + + + + + + Returns the constraint created by applying this + prefix to another constraint. + + + + + + + Constructs a CollectionOperator + + + + + Returns a constraint that will apply the argument + to the members of a collection, succeeding if + they all succeed. + + + + + Operator that requires both it's arguments to succeed + + + + + Abstract base class for all binary operators + + + + + Reduce produces a constraint from the operator and + any arguments. It takes the arguments from the constraint + stack and pushes the resulting constraint on it. + + + + + + Abstract method that produces a constraint by applying + the operator to its left and right constraint arguments. + + + + + Gets the left precedence of the operator + + + + + Gets the right precedence of the operator + + + + + Construct an AndOperator + + + + + Apply the operator to produce an AndConstraint + + + + + Operator that tests for the presence of a particular attribute + on a type and optionally applies further tests to the attribute. + + + + + Abstract base class for operators that are able to reduce to a + constraint whether or not another syntactic element follows. + + + + + Construct an AttributeOperator for a particular Type + + The Type of attribute tested + + + + Reduce produces a constraint from the operator and + any arguments. It takes the arguments from the constraint + stack and pushes the resulting constraint on it. + + + + + Represents a constraint that succeeds if the specified + count of members of a collection match a base constraint. + + + + + Construct an ExactCountOperator for a specified count + + The expected count + + + + Returns a constraint that will apply the argument + to the members of a collection, succeeding if + none of them succeed. + + + + + Represents a constraint that succeeds if none of the + members of a collection match a base constraint. + + + + + Returns a constraint that will apply the argument + to the members of a collection, succeeding if + none of them succeed. + + + + + Negates the test of the constraint it wraps. + + + + + Constructs a new NotOperator + + + + + Returns a NotConstraint applied to its argument. + + + + + Operator that requires at least one of it's arguments to succeed + + + + + Construct an OrOperator + + + + + Apply the operator to produce an OrConstraint + + + + + Operator used to test for the presence of a named Property + on an object and optionally apply further tests to the + value of that property. + + + + + Constructs a PropOperator for a particular named property + + + + + Reduce produces a constraint from the operator and + any arguments. It takes the arguments from the constraint + stack and pushes the resulting constraint on it. + + + + + + Gets the name of the property to which the operator applies + + + + + Represents a constraint that succeeds if any of the + members of a collection match a base constraint. + + + + + Returns a constraint that will apply the argument + to the members of a collection, succeeding if + any of them succeed. + + + + + Operator that tests that an exception is thrown and + optionally applies further tests to the exception. + + + + + Construct a ThrowsOperator + + + + + Reduce produces a constraint from the operator and + any arguments. It takes the arguments from the constraint + stack and pushes the resulting constraint on it. + + + + + Represents a constraint that simply wraps the + constraint provided as an argument, without any + further functionality, but which modifes the + order of evaluation because of its precedence. + + + + + Constructor for the WithOperator + + + + + Returns a constraint that wraps its argument + + + + + Thrown when an assertion failed. + + + + The error message that explains + the reason for the exception + + + The error message that explains + the reason for the exception + The exception that caused the + current exception + + + + Serialization Constructor + + + + + Thrown when an assertion failed. + + + + + + + The error message that explains + the reason for the exception + The exception that caused the + current exception + + + + Serialization Constructor + + + + + Thrown when a test executes inconclusively. + + + + The error message that explains + the reason for the exception + + + The error message that explains + the reason for the exception + The exception that caused the + current exception + + + + Serialization Constructor + + + + + Thrown when an assertion failed. + + + + + + + The error message that explains + the reason for the exception + The exception that caused the + current exception + + + + Serialization Constructor + + + + + + + + + + + Compares two objects of a given Type for equality within a tolerance + + The first object to compare + The second object to compare + The tolerance to use in the comparison + + + + diff --git a/ext/NUnit/nunit.mocks.dll b/ext/NUnit/nunit.mocks.dll new file mode 100644 index 0000000000000000000000000000000000000000..50393b3f73a10ee149694c92f116b22b78e605ad GIT binary patch literal 11264 zcmeHNe|Qx2nSWLE%mO&`c!@J&VoIyr-yfX6g=y%YqeVLsP^uG_Bq?L>fwFfcV@Fo zz&ro16Xu=o`{Vom`o7;EGfUgLyU9mH8tzX%A^H)Xd@U0Ae}hr5i>DqgrpF78R{uy@ zd9-?Uf5I^aY^%?Xr;MI>I&Ec)Zqu*_(?%j~v|QI|q^w>u77mA|d#YD0AzG>U=;eiL zI3&#q-^DhHl#cap! z0a1M0fQF7cn>;l6T7-Ww+e}&z6kkU{WL>qm^R7iii}O%vzRh{X#lETJr?oXitICNA zgqj1Z45HB-`l+pl3x2XL{o|4PW6?`1CT;rJ?H?a)J@xIv`P*K+Z{MDgn=dK*WXr_I zf3V}1b=#lo{^7~VJCy3JUw&ok)@Q?)Kl$5LFFfCVy7a;Seyep-V&4_}hWj5pGq0lg z<%3lp*avS)9e%7m`1+hz|m)gBl5q__-M^K@+L)jX+$Z z+N?gLll3uC^kwPj&vdX|`V8*MSZxDZWm@z?Hs~T{9<`g}RMkL* zFs_u=>vR(+m{vJ|@=PNSu8oQ0bE1$7dH#7Rr(!KS4dg;Kih9z00jC;|B0Z@2i#2CD z+Li$zQ?V3dGY_@`t}Q$?S3NR486m(2)Zz??hg9hn8eti5_)%C#f!efN#y$&HLXv1- z6xriNp?10I^U7P*Mpzfs-j-L-NTmh_Cbp*fM^NM76R}S#&>P$m^4*zGw=w6=gbc7& zURc*y9;&N$srp`@zSp`KmMw(L1;YXned5}Xj;?1kP+plRenPKC>!BCskk_#+7L@OX zXG&4sGWE`cG(%7^3&Xm1OlE=}IF7nhqR3uoe_f#-09VZJr@+Lug#n#yVc7pk$FK%5 zm2;C8(}{z`D#$^G`BAKmVA6B2Jl0RZCq&3&%~TjI3SRkVAbNy56Nto4pspwGW+%c0 zelyWm=nc-hN!M2O9Vf9sW>5t zbID%zegLKHw74}Z;38YqZ5)r}mB$!WhzJlR3QopwGUB=jYYyDR7-mo!N~o+*hmz7j zN#M#qA`T9Z#dWI&y>$yCAF|LzFABPO7s*FiQn%{B97OUFyfqW;QmsTgj=0?skqN=# zvjXM2m|6rbVmuF*smw*V=ixGyxrk>xx2W8i1;e|T#UgNeyvPKUpnL6NE=wV(@lu7T zR-#?ZVF^SwUIIZdmAQ!ZJY1$S7Y>c*2Fq{R#bjp3&d+8tvoAZB4a-brZvA<=Ol9uu zbGgB(3wJTOh=OJ1Wx4}1p+b6VLaCoh{JI0Zj3V?vsa{7VdTkTdW4^G`)2}hipWsG8 z;EY7dT<)7UTYs?fVVzXnjgb~aV_NcI~-7}Nj ztL(qwO)82(*4>>6X$^TY-mVqG^uW5#ew15CYX}Ruh0@luYne)@M9x*7F9@K*?c-Te z?4QF@RMgil?p(fDA(?q{9vNzg)yFQcpVz<}0CvA5;8(GvOuLQfeLPzNXm@7pM7qym ziTMbo4Be;Q&`B#19}-H_uDzkP1|FTb#7ISr`}cuB@53Ux6y350ys3cF)%5 z;6@Iy0~4W0=xW@BxDh2`vlN~m&meB3LHa70y1;sY>;25#>1XaiKkIo-D2A@-I?dPFw-o|yow>UN{h?KL4a*l0&))B400WO2iPQep~+$~4^xGA zm52EtdjT~8^P^QH*iv9+@N}|Bc8Fwl_AFfH^-y zusel!0qRxlnfF=lRt7<-3`b6EH!&S)rcxsHTSQ$-&3 zAywrtzhAi+E08A%tOl9NVnx6(vE(}9uTWyy*GbrGROZS|VCE73Vr3!hA2%4=89b=0 zN5H>j<)Y4=U!Zv3?IwjrTUXlde(^ z&`es3a|6*gXr=lH&7x-o+X;J5WA*t@!A`=@yQqO45tGdODK*k_f*qm5>Z^1)X=0Lj zH8htZW7tBRpN%o>O}c`X3FeN&0@~nW$n`z6fd10M*xuDN9jP!!zpqI$6fmc0Qf1hELO(?_186PkhikuTF_w zwyt8{vMo0{&ByI2;xqU4QGLsn;j^kr=-W;N?66AJ6ek0QVAdZpkM z*Y!ceywk9n`7v|+X#3F)%3mc$qY{`Qlp?g7i04}?U=>{tSVLbB7#Eljc&or+fwv31 zL*O2P-vay%R!7!zKq!w%yGCGvz(e$c_LTCBaH~o4A62TU!vC`J5-sq*uDn6Z{afh` z>hf36JG99kLY+JQH{r{O{~hH$+U-9H`LFqZ4>;og5cGTfpC~2tZS?vb@tROTPx+^+ zvoU9;1HR|4SKp(L{EGn_^%c_YR7+s}HY!op=~zRQgdSH*lo5TSTCIFjpQ<(~9K{~M zq{?tBdd&`eQ>~%-f!|;@ZK79vG3@IPsxj;g4*~YjKZ7z&D0TESD2?<}z^mvDz-Ib7 zxSjMQ;Ej-JCI{MEum=7+dUAWa!0!rtQ0UJ}`-DIr_JKXhG=a?mTNLRl?d<{|6iTnk zbj`=GSKz-1oUSwFG39TS!^(dsni^IwQft+D>KD}Q>V2w)YVxBpb^HafYIB7UU9T(w z>{40*f3Bp*QA*T5AEU6OivB)84VqY+AMGOOQnBw90A7Ho6s*bkj)0tn0jGka5{}5E zjdF$S=zpRS#ZIT`UTiBU^07;yZ%I2V#mIBYOOW!e1#MREVA8yX(u3(lCYG{#HaW50 zWRhCDOgpi0nA&e(dK=TJwK<+lE{msolcr6rOd|m;!|8Y`(Iah<0n^O%TfO8yIum{A zcxKQxMVysLqcxo|?TzssGpmvncpXztk7Xwl-PAekWXu#@*L{oGlku=v$6z{>NSUz? zGi7CP{*0}%tt|=Dp$;>iU46MY`h2L6gLcX97tv$#KoOVZ@rPWD>oh2ia_a zA85txVM$v+w3CUad)$O@*2f5EAuKNex$a3bZuhY+xbHMuseyPV(VaBcBr^SUt(j@c zGM%vzw1$xB7vf`r-cSV=RJm%(Lmr#}-%>5=;e3S;S>c*a}CHlhN| z&6d5%TfUZ#;haaC!_CbyUI|)xjcLuzPMKvgqfzKf(t|0}7Gv2qPdL=O$6<_@mgYg* zHq#j_ZbN1}|5$=4?hIItbak8Vlxw!IfJqlI>^enDr?kGY; zi!F?PJWY#-F_k+7wwOJM6r69d2BiqFHlP-;qck?q4ekSQ?i@kz05W^7Ab2$Q$8BsC zys&58U1{|tun=%SJOVO!u0v({X)wmuIEVmhv*tm0cIAWsvKYDiWu6@5< zbo*DX{mGLpgSSxdiLGDks+jZk9X^8;-B2rwt18hf#;t0GqNt!LpmDo6VEB~c%BspB zKO^C)Nu_l254k#K>bL5RiiE++H}Rc9mUt|*ZTu@I?% z1|~qgkSjI4DpDbqiqQZ~t*Q)=f;K$VBh!6)Rb>dOBhy7UNJRm-6RC(4>4p-iid4Do zM#7qc$T@)E=mY$Nr#4FTb&zxw0C-1d(`4zH>{% z;roWJ*{%K0J$nw#vJ-C>{QZ%epYK|5;x8WlUPb9s-?{qL{o%g!Yi~Y3OM@ zIFl9^7YDy_eD9Pe-e10%N23xWMG=!h3MmdE?8=}<7`%dj7BM0zHF7IxDi0{jD#6O2 zFv68;h#SanWV)&ce36-zr~qlxXyjLZb)Ac4Z^lTw^rU*Eh^+ zsGr?n@IsSJn8qqzz+&OhdFATo7|XF;ImVip(QarJ;(NJ_Tt0p z427!Q62Sj}h#Oe)-Q$B{Z8Y+Ny+EPDhS=O#V{CR~!~8~kcU9yyhiD2H@@lnwjU69o z&)ZSuVC*Qz7jiz`>lC*Q4;lB!{+^#BuWz>O7VIq8gGgQkOjF)TSmKjQ$XJvU{k-)j zo&o+&EWZ(ro}CD;O~PJB=g?Vh8Sb?ki1uMQ&R+X8{^g;II`J!T7cHRK{ICu^exl6YAY+XH9$WrI_G}_ z^v=cIhB^y5QNh9Z3T23>rUnzLTrz{6LdLhNXN9|G`NB@=R z+b2Ca!U3FSI759nVetX&T$+I|!p-U?*=XR^33O@HPB%oJ`*RWP0()x&IF|m?H;jf!V>$ya;qU_3BO6~Z$ZBV z=uN`y0?)?Hr#%PHq0j7Jy%#S>&hhm_D@QvZmbnHwdv3IBnLX+d8fTQ_=zu2s4t>~D zo()_#*;-}Ht?d7=er96!D#!rmu@|+*XZBq6<@-wbI?pwJw(R&y|MWWNzD4 - + + False + ..\..\ext\NUnit\nunit.framework.dll + diff --git a/src_vs2012/VSNDK.Package.Test/VSNDK.Package.Test.csproj b/src_vs2012/VSNDK.Package.Test/VSNDK.Package.Test.csproj index 46db729b..af97b80b 100644 --- a/src_vs2012/VSNDK.Package.Test/VSNDK.Package.Test.csproj +++ b/src_vs2012/VSNDK.Package.Test/VSNDK.Package.Test.csproj @@ -34,7 +34,10 @@ false - + + False + ..\..\ext\NUnit\nunit.framework.dll + diff --git a/src_vs2012/VSNDK.Tasks.Test/VSNDK.Tasks.Test.csproj b/src_vs2012/VSNDK.Tasks.Test/VSNDK.Tasks.Test.csproj index b752e5a6..e657f44c 100644 --- a/src_vs2012/VSNDK.Tasks.Test/VSNDK.Tasks.Test.csproj +++ b/src_vs2012/VSNDK.Tasks.Test/VSNDK.Tasks.Test.csproj @@ -35,7 +35,10 @@ - + + False + ..\..\ext\NUnit\nunit.framework.dll + diff --git a/src_vs2013/GDBParser.UnitTests/GDBParser_UnitTests.csproj b/src_vs2013/GDBParser.UnitTests/GDBParser_UnitTests.csproj index e5408b1d..a71b9057 100644 --- a/src_vs2013/GDBParser.UnitTests/GDBParser_UnitTests.csproj +++ b/src_vs2013/GDBParser.UnitTests/GDBParser_UnitTests.csproj @@ -31,7 +31,10 @@ 4 - + + False + ..\..\ext\NUnit\nunit.framework.dll + diff --git a/src_vs2013/VSNDK.Package.Test/VSNDK.Package.Test.csproj b/src_vs2013/VSNDK.Package.Test/VSNDK.Package.Test.csproj index 46db729b..af97b80b 100644 --- a/src_vs2013/VSNDK.Package.Test/VSNDK.Package.Test.csproj +++ b/src_vs2013/VSNDK.Package.Test/VSNDK.Package.Test.csproj @@ -34,7 +34,10 @@ false - + + False + ..\..\ext\NUnit\nunit.framework.dll + diff --git a/src_vs2013/VSNDK.Tasks.Test/VSNDK.Tasks.Test.csproj b/src_vs2013/VSNDK.Tasks.Test/VSNDK.Tasks.Test.csproj index b752e5a6..e657f44c 100644 --- a/src_vs2013/VSNDK.Tasks.Test/VSNDK.Tasks.Test.csproj +++ b/src_vs2013/VSNDK.Tasks.Test/VSNDK.Tasks.Test.csproj @@ -35,7 +35,10 @@ - + + False + ..\..\ext\NUnit\nunit.framework.dll + From 7c80b35bc38380ece5c82cc4310e0b1a1a429b46 Mon Sep 17 00:00:00 2001 From: Pawel Hofman Date: Tue, 6 May 2014 16:40:10 +0200 Subject: [PATCH 006/851] Patched issue around DIA SDK in VS2013 and removed some paths from proj settings --- README.md | 4 ++++ src_vs2012/GDBParser/GDBParser.vcxproj | 2 +- src_vs2013/GDBParser/GDBParser.vcxproj | 10 +++++----- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 77982f0d..071bcea0 100644 --- a/README.md +++ b/README.md @@ -12,6 +12,10 @@ or * [Microsoft Visual Studio Professional 2013 SDK] (http://www.microsoft.com/en-us/download/details.aspx?id=40758) +Please note, that currently there is a bug in DIA SDK of Visual Studio 2013. +If Visual Studio 2013 is installed on a machine, where Visual Studio 2012 did already existed, DIA SDK will be by placed inside it. +More info [here] (http://connect.microsoft.com/VisualStudio/feedback/details/814147/dia-sdk-installed-into-wrong-directory). + ##Build commands 1. VSNDKPluginBuild.bat – A batch file that builds the various components of the BlackBerry Native Plug-in to the ..\buildresults folder. 2. VSNDKPluginSetup.bat – A batch file that installs the newly built components of the BlackBerry Native Plug-in to the correct locations on your computer. diff --git a/src_vs2012/GDBParser/GDBParser.vcxproj b/src_vs2012/GDBParser/GDBParser.vcxproj index 7266d145..51136e1b 100644 --- a/src_vs2012/GDBParser/GDBParser.vcxproj +++ b/src_vs2012/GDBParser/GDBParser.vcxproj @@ -76,7 +76,7 @@ $(IntDir)GDBParser.res - true + false psapi.lib;$(ProgramFiles)\Microsoft Visual Studio 11.0\DIA SDK\lib\diaguids.lib;%(AdditionalDependencies) GDBParser.def true diff --git a/src_vs2013/GDBParser/GDBParser.vcxproj b/src_vs2013/GDBParser/GDBParser.vcxproj index e21696ce..a8d58dfe 100644 --- a/src_vs2013/GDBParser/GDBParser.vcxproj +++ b/src_vs2013/GDBParser/GDBParser.vcxproj @@ -54,10 +54,10 @@ AllRules.ruleset - C:\Users\guarnold.RIMNET\vsplugin-ndk\src\gdb-connect;$(SourcePath) - C:\Users\guarnold.RIMNET\vsplugin-ndk\src\gdb-connect;$(IncludePath) + $(SourcePath) + $(IncludePath) $(ReferencePath) - $(LibraryPath) + $(ProgramFiles)\Microsoft Visual Studio 12.0\DIA SDK\lib\;$(ProgramFiles)\Microsoft Visual Studio 11.0\DIA SDK\lib\;$(LibraryPath) @@ -76,8 +76,8 @@ $(IntDir)GDBParser.res - true - psapi.lib;$(ProgramFiles)\Microsoft Visual Studio 12.0\DIA SDK\lib\diaguids.lib;%(AdditionalDependencies) + false + psapi.lib;diaguids.lib;%(AdditionalDependencies) GDBParser.def true true From 6ce2203d3f558ba16ba441c266b5edd2b38ca367 Mon Sep 17 00:00:00 2001 From: Pawel Hofman Date: Wed, 7 May 2014 00:38:49 +0200 Subject: [PATCH 007/851] Made the VS2010 projects compile --- .gitignore | 23 +++++++++++++++++++ .../GDBParser_UnitTests.csproj | 4 +++- src/GDBParser/GDBParser.vcxproj | 8 +++---- .../VSNDK.Package.Test.csproj | 4 +++- src/VSNDK.Tasks.Test/VSNDK.Tasks.Test.csproj | 4 +++- src/VSNDK.Tasks/VSNDK.Tasks.csproj | 2 +- 6 files changed, 37 insertions(+), 8 deletions(-) diff --git a/.gitignore b/.gitignore index 8e752dc8..bb02706e 100644 --- a/.gitignore +++ b/.gitignore @@ -14,6 +14,11 @@ samples/HelloWorldDisplay/HelloWorldDisplay/Simulator-Debug/ # user configuration files +src/VSNDK.opensdf +src/VSNDK.sdf +src/VSNDK.sln.DotSettings +src/VSNDK.sln.DotSettings.user +src/VSNDK.suo src/GDBParser/GDBParser.vcxproj.user src/GDBWrapper/GDBWrapper.vcxproj.user src/VSNDK.AddIn/VSNDK.AddIn.csproj.user @@ -41,6 +46,24 @@ src_vs2013/VSNDK.AddIn/VSNDK.AddIn.csproj.user # build temp outputs +src/Debug/ +src/GDBParser.UnitTests/bin/ +src/GDBParser.UnitTests/obj/ +src/GDBParser/Debug/ +src/GDBWrapper/Debug/ +src/VSNDK.AddIn/bin/ +src/VSNDK.AddIn/obj/ +src/VSNDK.DebugEngine/bin/ +src/VSNDK.DebugEngine/obj/ +src/VSNDK.Package.Test/bin/ +src/VSNDK.Package.Test/obj/ +src/VSNDK.Package/bin/ +src/VSNDK.Package/obj/ +src/VSNDK.Tasks.Test/bin/ +src/VSNDK.Tasks.Test/obj/ +src/VSNDK.Tasks/bin/ +src/VSNDK.Tasks/obj/ + src_vs2012/Debug/ src_vs2012/GDBParser/Debug/ src_vs2012/GDBParser.UnitTests/bin/ diff --git a/src/GDBParser.UnitTests/GDBParser_UnitTests.csproj b/src/GDBParser.UnitTests/GDBParser_UnitTests.csproj index e5408b1d..356e507e 100644 --- a/src/GDBParser.UnitTests/GDBParser_UnitTests.csproj +++ b/src/GDBParser.UnitTests/GDBParser_UnitTests.csproj @@ -31,7 +31,9 @@ 4 - + + ..\..\ext\NUnit\nunit.framework.dll + diff --git a/src/GDBParser/GDBParser.vcxproj b/src/GDBParser/GDBParser.vcxproj index 6a577dc1..7fda1742 100644 --- a/src/GDBParser/GDBParser.vcxproj +++ b/src/GDBParser/GDBParser.vcxproj @@ -52,15 +52,15 @@ AllRules.ruleset - C:\Users\guarnold.RIMNET\vsplugin-ndk\src\gdb-connect;$(SourcePath) - C:\Users\guarnold.RIMNET\vsplugin-ndk\src\gdb-connect;$(IncludePath) + $(SourcePath) + $(IncludePath) $(ReferencePath) $(LibraryPath) Disabled - C:\VSPlugin-Git\vsplugin-ndk\src\gdb-connect;$(ProgramFiles)\Microsoft Visual Studio 10.0\DIA SDK\include;%(AdditionalIncludeDirectories) + $(ProgramFiles)\Microsoft Visual Studio 10.0\DIA SDK\include;%(AdditionalIncludeDirectories) WIN32;_DEBUG;_WINDOWS;_USRDLL;DEBUG;%(PreprocessorDefinitions) false Default @@ -74,7 +74,7 @@ $(IntDir)GDBParser.res - true + false psapi.lib;$(ProgramFiles)\Microsoft Visual Studio 10.0\DIA SDK\lib\diaguids.lib;%(AdditionalDependencies) GDBParser.def true diff --git a/src/VSNDK.Package.Test/VSNDK.Package.Test.csproj b/src/VSNDK.Package.Test/VSNDK.Package.Test.csproj index 89f9ca10..d6e18cf2 100644 --- a/src/VSNDK.Package.Test/VSNDK.Package.Test.csproj +++ b/src/VSNDK.Package.Test/VSNDK.Package.Test.csproj @@ -31,7 +31,9 @@ 4 - + + ..\..\ext\NUnit\nunit.framework.dll + diff --git a/src/VSNDK.Tasks.Test/VSNDK.Tasks.Test.csproj b/src/VSNDK.Tasks.Test/VSNDK.Tasks.Test.csproj index fb0a0c4a..dbabd771 100644 --- a/src/VSNDK.Tasks.Test/VSNDK.Tasks.Test.csproj +++ b/src/VSNDK.Tasks.Test/VSNDK.Tasks.Test.csproj @@ -32,7 +32,9 @@ - + + ..\..\ext\NUnit\nunit.framework.dll + diff --git a/src/VSNDK.Tasks/VSNDK.Tasks.csproj b/src/VSNDK.Tasks/VSNDK.Tasks.csproj index da22f1de..f51c60cd 100644 --- a/src/VSNDK.Tasks/VSNDK.Tasks.csproj +++ b/src/VSNDK.Tasks/VSNDK.Tasks.csproj @@ -57,7 +57,7 @@ False - ..\..\..\..\..\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Microsoft.Build.CPPTasks.Common.dll + C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Microsoft.Build.CPPTasks.Common.dll From 95c03db0f387051e4f48969e5c9d9323bdfd9210 Mon Sep 17 00:00:00 2001 From: Pawel Hofman Date: Wed, 7 May 2014 02:21:58 +0200 Subject: [PATCH 008/851] Removed duplicated GDB parser tests --- .../Properties/AssemblyInfo.cs | 36 -- src_vs2012/GDBParser.UnitTests/UnitTest.cs | 381 ------------------ .../Properties/AssemblyInfo.cs | 36 -- src_vs2013/GDBParser.UnitTests/UnitTest.cs | 381 ------------------ 4 files changed, 834 deletions(-) delete mode 100644 src_vs2012/GDBParser.UnitTests/Properties/AssemblyInfo.cs delete mode 100644 src_vs2012/GDBParser.UnitTests/UnitTest.cs delete mode 100644 src_vs2013/GDBParser.UnitTests/Properties/AssemblyInfo.cs delete mode 100644 src_vs2013/GDBParser.UnitTests/UnitTest.cs diff --git a/src_vs2012/GDBParser.UnitTests/Properties/AssemblyInfo.cs b/src_vs2012/GDBParser.UnitTests/Properties/AssemblyInfo.cs deleted file mode 100644 index 7dfe25ba..00000000 --- a/src_vs2012/GDBParser.UnitTests/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,36 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("GDBParser.UnitTests")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("GDBParser.UnitTests")] -[assembly: AssemblyCopyright("Copyright © 2013")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("80f98dd4-ce03-42f3-b852-346148df4493")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Build and Revision Numbers -// by using the '*' as shown below: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/src_vs2012/GDBParser.UnitTests/UnitTest.cs b/src_vs2012/GDBParser.UnitTests/UnitTest.cs deleted file mode 100644 index 42cc7323..00000000 --- a/src_vs2012/GDBParser.UnitTests/UnitTest.cs +++ /dev/null @@ -1,381 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using VSNDK.Parser; -using NUnit.Framework; - -namespace GDBParser_UnitTests -{ - public class UnitTests - { - [Test] - public void GetNextChar() - { - Assert.AreEqual(0, GDBParserUnitTests.get_Next_Char(Convert.ToSByte('a'), "abcdefghij", 0), "Error: char 'a', string 'abcdefghij', int '0'"); - Assert.AreEqual(10, GDBParserUnitTests.get_Next_Char(Convert.ToSByte('a'), "abcdefghij", 1), "Error: char 'a', string 'abcdefghij', int '1'"); - Assert.AreEqual(3, GDBParserUnitTests.get_Next_Char(Convert.ToSByte('d'), "abcdefghij", 0), "Error: char 'd', string 'abcdefghij', int '0'"); - Assert.AreEqual(3, GDBParserUnitTests.get_Next_Char(Convert.ToSByte('d'), "abcdefghij", 1), "Error: char 'd', string 'abcdefghij', int '1'"); - Assert.AreEqual(10, GDBParserUnitTests.get_Next_Char(Convert.ToSByte('z'), "abcdefghij", 1), "Error: char 'z', string 'abcdefghij', int '1'"); - Assert.AreEqual(0, GDBParserUnitTests.get_Next_Char(Convert.ToSByte('d'), "", 1), "Error: char 'd', string '', int '1'"); - Assert.AreEqual(10, GDBParserUnitTests.get_Next_Char(Convert.ToSByte('d'), "abcdefghij", 12), "Error: char 'd', string 'abcdefghij', int '12'"); - Assert.AreEqual(10, GDBParserUnitTests.get_Next_Char(Convert.ToSByte(null), "abcdefghij", 1), "Error: char NULL, string 'abcdefghij', int '1'"); - } - - [Test] - public void findClosing() - { - Assert.AreEqual(1, GDBParserUnitTests.find_Closing(Convert.ToSByte('('), Convert.ToSByte(')'), "()cdefghij", 0), "Error: char '(', char '), string '()cdefghij', int '0'"); - Assert.AreEqual(10, GDBParserUnitTests.find_Closing(Convert.ToSByte('('), Convert.ToSByte(')'), "(bcdefghij", 2), "Error: char '(', char '), string '(bcdefghij', int '2'"); - Assert.AreEqual(10, GDBParserUnitTests.find_Closing(Convert.ToSByte('('), Convert.ToSByte(')'), "(bcdefghij", 0), "Error: char '(', char '), string '(bcdefghij', int '0'"); - Assert.AreEqual(5, GDBParserUnitTests.find_Closing(Convert.ToSByte('('), Convert.ToSByte(')'), "(()())ghij", 0), "Error: char '(', char '), string '(()())ghij', int '0'"); - Assert.AreEqual(7, GDBParserUnitTests.find_Closing(Convert.ToSByte('('), Convert.ToSByte(')'), "((\\()())hij", 0), "Error: char '(', char '), string '((\\()())hij', int '0'"); - Assert.AreEqual(2, GDBParserUnitTests.find_Closing(Convert.ToSByte('('), Convert.ToSByte(')'), "(()())ghij", 1), "Error: char '(', char '), string '(()())ghij', int '1'"); - Assert.AreEqual(4, GDBParserUnitTests.find_Closing(Convert.ToSByte('('), Convert.ToSByte(')'), "((\\()())hij", 1), "Error: char '(', char '), string '((\\()())hij', int '1'"); - Assert.AreEqual(4, GDBParserUnitTests.find_Closing(Convert.ToSByte('('), Convert.ToSByte(')'), "(()())ghij", 3), "Error: char '(', char '), string '(()())ghij', int '3'"); - Assert.AreEqual(6, GDBParserUnitTests.find_Closing(Convert.ToSByte('('), Convert.ToSByte(')'), "(()(())hij", 3), "Error: char '(', char '), string '(()(())hij', int '3'"); - Assert.AreEqual(1, GDBParserUnitTests.find_Closing(Convert.ToSByte('('), Convert.ToSByte(')'), "()())fghij", 0), "Error: char '(', char '), string '()())fghij', int '0'"); - Assert.AreEqual(3, GDBParserUnitTests.find_Closing(Convert.ToSByte('('), Convert.ToSByte(')'), "()())fghij", 2), "Error: char '(', char '), string '()())fghij', int '2'"); - Assert.AreEqual(10, GDBParserUnitTests.find_Closing(Convert.ToSByte('('), Convert.ToSByte(')'), "((())fghij", 0), "Error: char '(', char '), string '(()())ghij', int '0'"); - Assert.AreEqual(4, GDBParserUnitTests.find_Closing(Convert.ToSByte('('), Convert.ToSByte(')'), "((())fghij", 1), "Error: char '(', char '), string '((())fghij', int '1'"); - } - - [Test] - public void searchResponse() - { - // Add the values you want to test. - Assert.AreEqual(3, GDBParserUnitTests.search_Response("aabbbcaabaccabcababaababc", "ab", 0, 1, true, Convert.ToSByte('?')), "Error: string 'aabbbcaabaccabcababaababc', string 'ab', int '0', int '1', bool 'TRUE', char '?'"); - Assert.AreEqual(1, GDBParserUnitTests.search_Response("aabbbcaabaccabcababaababc", "ab", 0, 1, true, Convert.ToSByte('@')), "Error: string 'aabbbcaabaccabcababaababc', string 'ab', int '0', int '1', bool 'TRUE', char '@'"); - Assert.AreEqual(14, GDBParserUnitTests.search_Response("aabbbcaabaccabcababaababc", "ab", 0, 3, true, Convert.ToSByte('?')), "Error: string 'aabbbcaabaccabcababaababc', string 'ab', int '0', int '3', bool 'TRUE', char '?'"); - Assert.AreEqual(12, GDBParserUnitTests.search_Response("aabbbcaabaccabcababaababc", "ab", 0, 3, true, Convert.ToSByte('@')), "Error: string 'aabbbcaabaccabcababaababc', string 'ab', int '0', int '3', bool 'TRUE', char '@'"); - Assert.AreEqual(19, GDBParserUnitTests.search_Response("aabbbcaabaccabcababaababc", "ab", 10, 3, true, Convert.ToSByte('?')), "Error: string 'aabbbcaabaccabcababaababc', string 'ab', int '10', int '3', bool 'TRUE', char '?'"); - Assert.AreEqual(17, GDBParserUnitTests.search_Response("aabbbcaabaccabcababaababc", "ab", 10, 3, true, Convert.ToSByte('@')), "Error: string 'aabbbcaabaccabcababaababc', string 'ab', int '10', int '3', bool 'TRUE', char '@'"); - Assert.AreEqual(24, GDBParserUnitTests.search_Response("aabbbcaabaccabcababaababc", "ab", 24, 1, false, Convert.ToSByte('?')), "Error: string 'aabbbcaabaccabcababaababc', string 'ab', int '24', int '1', bool 'TRUE', char '?'"); - Assert.AreEqual(24, GDBParserUnitTests.search_Response("aabbbcaabaccabcababaababc", "ab", 24, 1, false, Convert.ToSByte('@')), "Error: string 'aabbbcaabaccabcababaababc', string 'ab', int '24', int '1', bool 'TRUE', char '@'"); - Assert.AreEqual(19, GDBParserUnitTests.search_Response("aabbbcaabaccabcababaababc", "ab", 24, 3, false, Convert.ToSByte('?')), "Error: string 'aabbbcaabaccabcababaababc', string 'ab', int '24', int '3', bool 'TRUE', char '?'"); - Assert.AreEqual(19, GDBParserUnitTests.search_Response("aabbbcaabaccabcababaababc", "ab", 24, 3, false, Convert.ToSByte('@')), "Error: string 'aabbbcaabaccabcababaababc', string 'ab', int '24', int '3', bool 'TRUE', char '@'"); - } - - [Test] - public void substituteVariables() - { - string[] v = new string[10]; - v[0] = "The"; - v[1] = "text"; - v[2] = ""; - v[3] = ""; - v[4] = ""; - v[5] = "the"; - v[6] = ""; - v[7] = ""; - v[8] = ""; - v[9] = "number"; - // Add the values you want to test. - StringAssert.AreEqualIgnoringCase("The number of the words in the following text is smaller than the number of the letters in the same text\r\n", GDBParserUnitTests.substitute_Variables("$0$ $9$ of $5$ words in $5$ following $1$ is smaller $3$than $5$ $9$ of $5$ letters in $5$ same $1$$EOL$", v), "Error: string '', Variables array not printed."); - } - - [Test] - public void insertingCommandCodes() - { - string[,] map = new string[48, 2]; // The value for the first column of this array corresponds to the value of NumberOfInstructions constant, in gdb-connect.h. - string[] v = new string[48]; // The size of this array corresponds to the value of NumberOfInstructions constant, in gdb-connect.h. - bool result = GDBParserUnitTests.inserting_Command_Codes(map, v); - Assert.AreEqual(true, result); - Assert.IsNotEmpty(map, "Hash table could not be empty!"); - Assert.IsNotEmpty(v, "Parsing instructions array could not be empty!"); - } - - [Test] - public void getInstructionCode() - { - // The instruction code returned from get_Instruction_Code() function depends on the position the associated parsing instruction - // was stored in the respective data structure. That's why the following unit tests just compares the instruction code with -1 - // (-1 means that the instruction was not found). - string param = ""; - // Add the values you want to test. - Assert.AreEqual(-1, GDBParserUnitTests.get_Instruction_Code("", out param), "Error: string '', string ''"); - StringAssert.AreEqualIgnoringCase("", param, "Param should be empty."); - - param = ""; - Assert.AreNotEqual(-1, GDBParserUnitTests.get_Instruction_Code("-exec-continue --thread-group i1", out param), "Error: string '-exec-continue --thread-group i1', string ''"); - StringAssert.AreEqualIgnoringCase("", param, "Param should be empty for command '-exec-continue --thread-group i1'."); - - param = ""; - Assert.AreNotEqual(-1, GDBParserUnitTests.get_Instruction_Code("-break-delete 3", out param), "Error: string '-break-delete 3', string ''"); - StringAssert.AreEqualIgnoringCase(";3", param, "Param should not be empty for command '-break-delete 3'."); - - param = ""; - Assert.AreNotEqual(-1, GDBParserUnitTests.get_Instruction_Code("-break-after 4 10", out param), "Error: string '-break-after 4 10', string ''"); - StringAssert.AreEqualIgnoringCase(";4;10", param, "Param should not be empty for command '-break-after 4 10'."); - } - - [Test] - public void get_SeqID() - { - // Add the values you want to test. - Assert.AreEqual(211, GDBParserUnitTests.get_Seq_ID("211^done,value=\"1\""), "Error: string '211^done,value=\"1\"'"); - Assert.AreEqual(111, GDBParserUnitTests.get_Seq_ID("111^running"), "Error: string '111^running'"); - Assert.AreEqual(-3, GDBParserUnitTests.get_Seq_ID("=breakpoint-modified,bkpt={number=\"1\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"0xf7fd8502\",func=\"pendfunc1\",file=\"gdb/testsuite/gdb.mi/pendshr1.c\",fullname=\"/unsafegdb/testsuite/gdb.mi/pendshr1.c\",line=\"21\",times=\"0\",original-location=\"pendfunc1\"}"), "Error: string '=breakpoint-modified,bkpt={number=\"1\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"0xf7fd8502\",func=\"pendfunc1\",file=\"gdb/testsuite/gdb.mi/pendshr1.c\",fullname=\"/unsafegdb/testsuite/gdb.mi/pendshr1.c\",line=\"21\",times=\"0\",original-location=\"pendfunc1\"}'"); - Assert.AreEqual(-2, GDBParserUnitTests.get_Seq_ID("*stopped,reason=\"breakpoint-hit\",disp=\"keep\",bkptno=\"2\",frame={func=\"foo\",args=[],file=\"hello.c\",fullname=\"/home/foo/bar/hello.c\",line=\"13\"}"), "Error: string '*stopped,reason=\"breakpoint-hit\",disp=\"keep\",bkptno=\"2\",frame={func=\"foo\",args=[],file=\"hello.c\",fullname=\"/home/foo/bar/hello.c\",line=\"13\"}'"); - Assert.AreEqual(-2, GDBParserUnitTests.get_Seq_ID("111*stopped,signal-name=\"SIGINT\",signal-meaning=\"Interrupt\",frame={addr=\"0x00010140\",func=\"foo\",args=[],file=\"try.c\",line=\"13\"}"), "Error: string '111*stopped,signal-name=\"SIGINT\",signal-meaning=\"Interrupt\",frame={addr=\"0x00010140\",func=\"foo\",args=[],file=\"try.c\",line=\"13\"}'"); - Assert.AreEqual(-1, GDBParserUnitTests.get_Seq_ID("abcde"), "Error: string 'abcde'"); - Assert.AreEqual(-1, GDBParserUnitTests.get_Seq_ID(""), "Error: string ''"); - } - - [Test] - public void parseGDB1() - { - string asyncInst = "??=thread-exited,id;{#51\\;;??\";@@\";#$EOL$;};??thread-created,id;{#40\\;;??\";@@\";#\\;;??pid ;@@ ;#$EOL$;};0;??*running;{#41\\;;??thread-id=\"all;{#0;}{??thread-id=\";@@\";};#$EOL$;};0;??*stopped;{??breakpoint-hit;{#27\\;;??bkptno=\";@@\";#\\;;??file=\";@@\";#\\;;??line=\";@@\";}{??end-stepping-range;{#45;??file=\";{#\\;;@@\";0;#\\;;??line=\";@@\";};}{??function-finished;{#46;??file=;{#\\;;??\";@@\";#\\;;??line=\";@@\";};}{??exited-normally;{#42;}{??exit-code;{#43\\;;??\";@@\";}{??signal-received;{??signal-meaning=\"Killed\";{#47;}{??signal-meaning=\"Segmentation fault\";{#54\\;;??addr=\";@@\";#\\;;??func=\";@@\";0;??file=;{#\\;;??\";@@\";#\\;;??line=\";@@\";};}{#44\\;;??addr=\";@@\";#\\;;??func=\";@@\";0;??file=;{#\\;;??\";@@\";#\\;;??line=\";@@\";};};};}{??exited-signalled;{#55\\;??signal-name=\";@@\";#\\;;??signal-meaning=\";@@\";}{#44\\;;??addr=\";@@\";#\\;;??func=\";@@\";0;??file=;{#\\;;??\";@@\";#\\;;??line=\";@@\";};};};};};};};};#\\;;??thread-id=;{??\";@@\";};#$EOL$;};0;??=breakpoint-modified,bkpt=\\{number=\";{0;($EOR$;$1=? Date: Wed, 7 May 2014 02:22:32 +0200 Subject: [PATCH 009/851] Tweaked projects to force x86 architecture (as dependant native binaries) --- src/GDBParser.UnitTests/GDBParser_UnitTests.csproj | 2 ++ src/VSNDK.DebugEngine/VSNDK.DebugEngine.csproj | 2 ++ .../GDBParser.UnitTests/GDBParser_UnitTests.csproj | 14 ++++++++++---- src_vs2012/GDBParser/GDBParser.vcxproj | 6 +++--- src_vs2012/VSNDK.AddIn/VSNDK.AddIn.csproj | 1 + .../VSNDK.DebugEngine/VSNDK.DebugEngine.csproj | 2 ++ .../VSNDK.Package.Test/VSNDK.Package.Test.csproj | 2 ++ src_vs2012/VSNDK.Package/VSNDK.Package.csproj | 2 ++ .../VSNDK.Tasks.Test/VSNDK.Tasks.Test.csproj | 2 ++ src_vs2012/VSNDK.Tasks/VSNDK.Tasks.csproj | 2 ++ .../GDBParser.UnitTests/GDBParser_UnitTests.csproj | 14 ++++++++++---- .../VSNDK.DebugEngine/VSNDK.DebugEngine.csproj | 2 ++ .../VSNDK.Package.Test/VSNDK.Package.Test.csproj | 2 ++ src_vs2013/VSNDK.Package/VSNDK.Package.csproj | 2 ++ 14 files changed, 44 insertions(+), 11 deletions(-) diff --git a/src/GDBParser.UnitTests/GDBParser_UnitTests.csproj b/src/GDBParser.UnitTests/GDBParser_UnitTests.csproj index 356e507e..8925c13e 100644 --- a/src/GDBParser.UnitTests/GDBParser_UnitTests.csproj +++ b/src/GDBParser.UnitTests/GDBParser_UnitTests.csproj @@ -21,6 +21,7 @@ DEBUG;TRACE prompt 4 + x86 pdbonly @@ -29,6 +30,7 @@ TRACE prompt 4 + x86 diff --git a/src/VSNDK.DebugEngine/VSNDK.DebugEngine.csproj b/src/VSNDK.DebugEngine/VSNDK.DebugEngine.csproj index 438496ec..97565c86 100644 --- a/src/VSNDK.DebugEngine/VSNDK.DebugEngine.csproj +++ b/src/VSNDK.DebugEngine/VSNDK.DebugEngine.csproj @@ -22,6 +22,7 @@ prompt 4 true + x86 pdbonly @@ -30,6 +31,7 @@ TRACE prompt 4 + x86 diff --git a/src_vs2012/GDBParser.UnitTests/GDBParser_UnitTests.csproj b/src_vs2012/GDBParser.UnitTests/GDBParser_UnitTests.csproj index a71b9057..84010dd6 100644 --- a/src_vs2012/GDBParser.UnitTests/GDBParser_UnitTests.csproj +++ b/src_vs2012/GDBParser.UnitTests/GDBParser_UnitTests.csproj @@ -21,6 +21,7 @@ DEBUG;TRACE prompt 4 + x86 pdbonly @@ -29,6 +30,7 @@ TRACE prompt 4 + x86 @@ -43,10 +45,6 @@ - - - - @@ -56,6 +54,14 @@ GDBParser + + + Properties\AssemblyInfo.cs + + + UnitTest.cs + + - - - - - - - - - - - - - - - - - true - - - - true - - - - true - - - - - $(BuildLinkTargets); - - $(CommonBuildOnlyTargets);$(BeforeBuildLinkTargets);$(BuildLinkTargets);$(AfterBuildLinkTargets) - - - - - - - - - - - - - - - - - - $([System.IO.Path]::Combine($(ProjectDir),$(OutDir)$(LibPrefix)$(TargetName)$(TargetExt))) - $([System.IO.Path]::GetFileName('$(TargetPath)')) - $([System.IO.Path]::GetDirectoryName('$(TargetPath)')) - $(LibPrefix)$(ProjectName) - false - false - - - - - - - - - - - - - - - - - - - - - - - false - true - $(BuildBarToolPath) - $(OptimizedDeployToolPath) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - false - true - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/VSNDK.Tasks/BlackBerry/Microsoft.Cpp.BlackBerry.Packager.targets b/src/VSNDK.Tasks/BlackBerry/Microsoft.Cpp.BlackBerry.Packager.targets index 5eb31d68..b37a5e2c 100644 --- a/src/VSNDK.Tasks/BlackBerry/Microsoft.Cpp.BlackBerry.Packager.targets +++ b/src/VSNDK.Tasks/BlackBerry/Microsoft.Cpp.BlackBerry.Packager.targets @@ -25,7 +25,6 @@ Copyright (C) Microsoft Corporation. All rights reserved. - true @@ -173,19 +172,6 @@ Copyright (C) Microsoft Corporation. All rights reserved. - - - - @@ -366,8 +352,8 @@ Copyright (C) Microsoft Corporation. All rights reserved. Device ="$(Registry:HKEY_CURRENT_USER\SOFTWARE\BlackBerry\BlackBerryVSPlugin@device_IP)" Password ="$(Registry:HKEY_CURRENT_USER\SOFTWARE\BlackBerry\BlackBerryVSPlugin@device_password)" LaunchApp ="true" - FlagFile ="$(AppDataPath)\BlackBerry\vsndk-debugNative.txt" - DebugNative ="false" + FlagFile ="$(AppDataPath)\BlackBerry\vsndk-debugNative.txt" + DebugNative ="false" /> diff --git a/src/VSNDK.Tasks/BlackBerry/Microsoft.Cpp.BlackBerry.bak b/src/VSNDK.Tasks/BlackBerry/Microsoft.Cpp.BlackBerry.bak deleted file mode 100644 index 5d62f2b8..00000000 --- a/src/VSNDK.Tasks/BlackBerry/Microsoft.Cpp.BlackBerry.bak +++ /dev/null @@ -1,146 +0,0 @@ - - - - - - - - - - QCC;__QCC__;__QNX__ - false - - - - - true - false - - - - - true - .a - lib - - - - true - - - - - - true - .so - true - lib - - - - - $([System.IO.Path]::Combine($(ProjectDir),$(OutDir)$(LibPrefix)$(TargetName)$(TargetExt))) - $([System.IO.Path]::GetFileName('$(TargetPath)')) - $([System.IO.Path]::GetDirectoryName('$(TargetPath)')) - $(LibPrefix)$(ProjectName) - - - - - - $(IntDir)%(FileName).o - $(QccDefines) - WIN32;_WINDOWS - NormalWarnings - false - false - - true - - false - false - Default - true - - - - - - - O2 - true - - - - - - - O2 - false - - - - - - - $(OutDir)$(LibPrefix)$(TargetName)$(TargetExt) - $(TargetPath) - - - false - false - true - false - true - Default - - - - - - - $(OutDir)$(LibPrefix)$(TargetName)$(TargetExt) - false - - - - - - - $(IntDir) - true - $(OutDir)$(TargetName).bar - true - false - bar-debug - bar - true - false - None - Install - false - 1 - - - - - 169.254.0.1 - - bar-descriptor.xml - $(AppData) - - - - diff --git a/src/VSNDK.Tasks/BlackBerry/Microsoft.Cpp.BlackBerry.default.bak b/src/VSNDK.Tasks/BlackBerry/Microsoft.Cpp.BlackBerry.default.bak deleted file mode 100644 index 40c79c30..00000000 --- a/src/VSNDK.Tasks/BlackBerry/Microsoft.Cpp.BlackBerry.default.bak +++ /dev/null @@ -1,23 +0,0 @@ - - - - - BlackBerry - qcc - - $(IntermediateOutputPath) - Device-$(Configuration)\ - Device-$(Configuration)\ - $(IntDir) - - diff --git a/src/VSNDK.Tasks/BlackBerry/Microsoft.Cpp.BlackBerry.default.props b/src/VSNDK.Tasks/BlackBerry/Microsoft.Cpp.BlackBerry.default.props index 40c79c30..54e39098 100644 --- a/src/VSNDK.Tasks/BlackBerry/Microsoft.Cpp.BlackBerry.default.props +++ b/src/VSNDK.Tasks/BlackBerry/Microsoft.Cpp.BlackBerry.default.props @@ -20,4 +20,7 @@ Copyright (C) Microsoft Corporation. All rights reserved. Device-$(Configuration)\ $(IntDir) + + + diff --git a/src/VSNDK.Tasks/BlackBerry/Microsoft.Cpp.BlackBerry.props b/src/VSNDK.Tasks/BlackBerry/Microsoft.Cpp.BlackBerry.props index 5d62f2b8..5753b774 100644 --- a/src/VSNDK.Tasks/BlackBerry/Microsoft.Cpp.BlackBerry.props +++ b/src/VSNDK.Tasks/BlackBerry/Microsoft.Cpp.BlackBerry.props @@ -52,6 +52,7 @@ Copyright (C) Microsoft Corporation. All rights reserved. $([System.IO.Path]::Combine($(ProjectDir),$(OutDir)$(LibPrefix)$(TargetName)$(TargetExt))) + $(TargetPath.TrimEnd('\')) $([System.IO.Path]::GetFileName('$(TargetPath)')) $([System.IO.Path]::GetDirectoryName('$(TargetPath)')) $(LibPrefix)$(ProjectName) diff --git a/src/VSNDK.Tasks/BlackBerry/Microsoft.Cpp.BlackBerry.targets b/src/VSNDK.Tasks/BlackBerry/Microsoft.Cpp.BlackBerry.targets index 8ed03106..120f45ab 100644 --- a/src/VSNDK.Tasks/BlackBerry/Microsoft.Cpp.BlackBerry.targets +++ b/src/VSNDK.Tasks/BlackBerry/Microsoft.Cpp.BlackBerry.targets @@ -17,6 +17,9 @@ Copyright (C) Microsoft Corporation. All rights reserved. + + + @@ -88,6 +91,7 @@ Copyright (C) Microsoft Corporation. All rights reserved. Platform ="$(Platform)" AdditionalIncludeDirectories ="$(IncludePath)" AdditionalLibraryDirectories ="$(LibraryPath)" + ExcludeDirectories ="$(ExcludePath)" ConfigurationType ="$(ConfigurationType)" /> diff --git a/src/VSNDK.Tasks/BlackBerry/PlatformToolsets/qcc/Microsoft.Cpp.BlackBerry.qcc.bak b/src/VSNDK.Tasks/BlackBerry/PlatformToolsets/qcc/Microsoft.Cpp.BlackBerry.qcc.bak deleted file mode 100644 index 0f92e06d..00000000 --- a/src/VSNDK.Tasks/BlackBerry/PlatformToolsets/qcc/Microsoft.Cpp.BlackBerry.qcc.bak +++ /dev/null @@ -1,66 +0,0 @@ - - - - - - - $(Registry:HKEY_CURRENT_USER\SOFTWARE\Research In Motion\BlackBerryVSPlugin@NDKPath) - $(NativeSDKDir)\target\qnx6 - $(NativeSDKDir)\host\win32\x86 - $(QNX_HOST)\etc\qcc\gcc - armle-v7 - 4.6.3 - gcc_ntoarmv7le - $(QNX_TARGET)\$(CPUVARDIR)\lib - - - - qcc2.0 - $(QNX_HOST)\usr\bin - qcc.exe - qcc.exe - qcc.exe - blackberry-nativepackager.bat - blackberry-signer.bat - blackberry-deploy.bat - $(QccToolsPath) - - $(Registry:HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\10.0\Setup\VC@ProductDir) - $(Registry:HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\10.0\Setup\VC@ProductDir) - $(Registry:HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VCExpress\10.0\Setup\VC@ProductDir) - $(Registry:HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VCExpress\10.0\Setup\VC@ProductDir) - - $(Registry:HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\10.0\Setup\VS@ProductDir) - $(Registry:HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\10.0\Setup\VS@ProductDir) - $(Registry:HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VCExpress\10.0\Setup\VS@ProductDir) - $(Registry:HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VCExpress\10.0\Setup\VS@ProductDir) - - $(Registry:HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SDKs\Windows\v7.0A@InstallationFolder) - $(Registry:HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Microsoft SDKs\Windows\v7.0A@InstallationFolder) - - $(Registry:HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework@InstallRoot) - $(Registry:HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\.NETFramework@InstallRoot) - - $(Registry:HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SDKs\Windows\v7.0A@InstallationFolder) - $(Registry:HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Microsoft SDKs\Windows\v7.0A@InstallationFolder) - - $(QNX_HOST)\usr\bin;$(PATH); - $(QNX_TARGET)\usr\include;$(QNX_TARGET)\usr\include\freetype2;$(QNX_TARGET)\..\target-override\usr\include; - $(QccLibPath);$(QNX_TARGET)\..\target-override\$(CPUVARDIR)\lib;$(QNX_TARGET)\..\target-override\$(CPUVARDIR)\usr\lib; - $(ExecutablePath) - - - - diff --git a/src/VSNDK.Tasks/BlackBerrySimulator/Microsoft.Cpp.BlackBerrySimulator.Packager.bak b/src/VSNDK.Tasks/BlackBerrySimulator/Microsoft.Cpp.BlackBerrySimulator.Packager.bak deleted file mode 100644 index daea93ed..00000000 --- a/src/VSNDK.Tasks/BlackBerrySimulator/Microsoft.Cpp.BlackBerrySimulator.Packager.bak +++ /dev/null @@ -1,360 +0,0 @@ - - - - - - - - - - - - - - - - - - true - - - - true - - - - true - - - - - $(BuildLinkTargets); - - $(CommonBuildOnlyTargets);$(BeforeBuildLinkTargets);$(BuildLinkTargets);$(AfterBuildLinkTargets) - - - - - - - - - - - - - - - - - - $([System.IO.Path]::Combine($(ProjectDir),$(OutDir)$(LibPrefix)$(TargetName)$(TargetExt))) - $([System.IO.Path]::GetFileName('$(TargetPath)')) - $([System.IO.Path]::GetDirectoryName('$(TargetPath)')) - $(LibPrefix)$(ProjectName) - false - - - - - - - - - - - - - - - - - - - - - - false - true - $(BuildBarToolPath) - $(OptimizedDeployToolPath) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/VSNDK.Tasks/BlackBerrySimulator/Microsoft.Cpp.BlackBerrySimulator.Packager.targets b/src/VSNDK.Tasks/BlackBerrySimulator/Microsoft.Cpp.BlackBerrySimulator.Packager.targets index 1fa145fb..9799f837 100644 --- a/src/VSNDK.Tasks/BlackBerrySimulator/Microsoft.Cpp.BlackBerrySimulator.Packager.targets +++ b/src/VSNDK.Tasks/BlackBerrySimulator/Microsoft.Cpp.BlackBerrySimulator.Packager.targets @@ -25,7 +25,6 @@ Copyright (C) Microsoft Corporation. All rights reserved. - true @@ -165,19 +164,6 @@ Copyright (C) Microsoft Corporation. All rights reserved. - - - - @@ -340,8 +326,8 @@ Copyright (C) Microsoft Corporation. All rights reserved. Device ="$(Registry:HKEY_CURRENT_USER\SOFTWARE\BlackBerry\BlackBerryVSPlugin@simulator_IP)" Password ="$(Registry:HKEY_CURRENT_USER\SOFTWARE\BlackBerry\BlackBerryVSPlugin@simulator_password)" LaunchApp ="true" - FlagFile ="$(AppDataPath)\BlackBerry\vsndk-debugNative.txt" - DebugNative ="false" + FlagFile ="$(AppDataPath)\BlackBerry\vsndk-debugNative.txt" + DebugNative ="false" /> diff --git a/src/VSNDK.Tasks/BlackBerrySimulator/Microsoft.Cpp.BlackBerrySimulator.bak b/src/VSNDK.Tasks/BlackBerrySimulator/Microsoft.Cpp.BlackBerrySimulator.bak deleted file mode 100644 index 4c83562c..00000000 --- a/src/VSNDK.Tasks/BlackBerrySimulator/Microsoft.Cpp.BlackBerrySimulator.bak +++ /dev/null @@ -1,160 +0,0 @@ - - - - - - - - - - QCC;__QCC__;__QNX__ - false - - - - - true - false - - - - - true - .a - lib - - - - true - - - - - - true - .so - true - lib - - - - x86 - - - armle-v7 - - - - $(from_file) - gcc_ntox86 - gcc_ntoarmv7le - $(QNX_TARGET)\$(CPUVARDIR)\lib - - - - - $([System.IO.Path]::Combine($(ProjectDir),$(OutDir)$(LibPrefix)$(TargetName)$(TargetExt))) - $([System.IO.Path]::GetFileName('$(TargetPath)')) - $([System.IO.Path]::GetDirectoryName('$(TargetPath)')) - $(LibPrefix)$(ProjectName) - - - - - - $(IntDir)%(FileName).o - $(QccDefines) - WIN32;_WINDOWS - NormalWarnings - false - false - - true - - false - false - Default - true - - - - - - - O2 - true - - - - - - - O2 - false - - - - - - - $(OutDir)$(LibPrefix)$(TargetName)$(TargetExt) - $(TargetPath) - - - false - false - true - false - true - Default - - - - - - - $(OutDir)$(LibPrefix)$(TargetName)$(TargetExt) - false - - - - - - - $(IntDir) - true - $(OutDir)$(TargetName).bar - true - false - bar-debug - bar - true - false - None - Install - false - 1 - - - - - 169.254.0.1 - - bar-descriptor.xml - $(AppData) - - - - diff --git a/src/VSNDK.Tasks/BlackBerrySimulator/Microsoft.Cpp.BlackBerrySimulator.default.bak b/src/VSNDK.Tasks/BlackBerrySimulator/Microsoft.Cpp.BlackBerrySimulator.default.bak deleted file mode 100644 index 9f18d577..00000000 --- a/src/VSNDK.Tasks/BlackBerrySimulator/Microsoft.Cpp.BlackBerrySimulator.default.bak +++ /dev/null @@ -1,23 +0,0 @@ - - - - - BlackBerrySimulator - qcc - - $(IntermediateOutputPath) - Simulator-$(Configuration)\ - Simulator-$(Configuration)\ - $(IntDir) - - diff --git a/src/VSNDK.Tasks/BlackBerrySimulator/Microsoft.Cpp.BlackBerrySimulator.default.props b/src/VSNDK.Tasks/BlackBerrySimulator/Microsoft.Cpp.BlackBerrySimulator.default.props index 9f18d577..c633738b 100644 --- a/src/VSNDK.Tasks/BlackBerrySimulator/Microsoft.Cpp.BlackBerrySimulator.default.props +++ b/src/VSNDK.Tasks/BlackBerrySimulator/Microsoft.Cpp.BlackBerrySimulator.default.props @@ -20,4 +20,7 @@ Copyright (C) Microsoft Corporation. All rights reserved. Simulator-$(Configuration)\ $(IntDir) + + + diff --git a/src/VSNDK.Tasks/BlackBerrySimulator/Microsoft.Cpp.BlackBerrySimulator.props b/src/VSNDK.Tasks/BlackBerrySimulator/Microsoft.Cpp.BlackBerrySimulator.props index 4c83562c..843193fd 100644 --- a/src/VSNDK.Tasks/BlackBerrySimulator/Microsoft.Cpp.BlackBerrySimulator.props +++ b/src/VSNDK.Tasks/BlackBerrySimulator/Microsoft.Cpp.BlackBerrySimulator.props @@ -66,6 +66,7 @@ Copyright (C) Microsoft Corporation. All rights reserved. $([System.IO.Path]::Combine($(ProjectDir),$(OutDir)$(LibPrefix)$(TargetName)$(TargetExt))) + $(TargetPath.TrimEnd('\')) $([System.IO.Path]::GetFileName('$(TargetPath)')) $([System.IO.Path]::GetDirectoryName('$(TargetPath)')) $(LibPrefix)$(ProjectName) diff --git a/src/VSNDK.Tasks/BlackBerrySimulator/Microsoft.Cpp.BlackBerrySimulator.targets b/src/VSNDK.Tasks/BlackBerrySimulator/Microsoft.Cpp.BlackBerrySimulator.targets index 78ba5e84..9a2d32f4 100644 --- a/src/VSNDK.Tasks/BlackBerrySimulator/Microsoft.Cpp.BlackBerrySimulator.targets +++ b/src/VSNDK.Tasks/BlackBerrySimulator/Microsoft.Cpp.BlackBerrySimulator.targets @@ -17,6 +17,9 @@ Copyright (C) Microsoft Corporation. All rights reserved. + + + @@ -88,7 +91,7 @@ Copyright (C) Microsoft Corporation. All rights reserved. Platform ="$(Platform)" AdditionalIncludeDirectories ="$(IncludePath)" AdditionalLibraryDirectories ="$(LibraryPath)" - ExcludeDirectories ="$(ExcludePath)" + ExcludeDirectories ="$(ExcludePath)" ConfigurationType ="$(ConfigurationType)" /> @@ -141,6 +144,7 @@ Copyright (C) Microsoft Corporation. All rights reserved. Platform ="$(Platform)" AdditionalIncludeDirectories ="$(IncludePath)" AdditionalLibraryDirectories ="$(LibraryPath)" + ExcludeDirectories ="$(ExcludePath)" ConfigurationType ="$(ConfigurationType)" /> diff --git a/src/VSNDK.Tasks/BlackBerrySimulator/PlatformToolsets/qcc/Microsoft.Cpp.BlackBerrySimulator.qcc.bak b/src/VSNDK.Tasks/BlackBerrySimulator/PlatformToolsets/qcc/Microsoft.Cpp.BlackBerrySimulator.qcc.bak deleted file mode 100644 index a83fb376..00000000 --- a/src/VSNDK.Tasks/BlackBerrySimulator/PlatformToolsets/qcc/Microsoft.Cpp.BlackBerrySimulator.qcc.bak +++ /dev/null @@ -1,65 +0,0 @@ - - - - - - - $(Registry:HKEY_CURRENT_USER\SOFTWARE\Research In Motion\BlackBerryVSPlugin@NDKPath) - $(NativeSDKDir)\target\qnx6 - $(NativeSDKDir)\host\win32\x86 - $(QNX_HOST)\etc\qcc\gcc - x86 - 4.6.3 - gcc_ntox86 - $(QNX_TARGET)\$(CPUVARDIR)\lib - - - - qcc2.0 - $(QNX_HOST)\usr\bin - qcc.exe - qcc.exe - qcc.exe - blackberry-nativepackager.bat - blackberry-deploy.bat - $(QccToolsPath) - - $(Registry:HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\10.0\Setup\VC@ProductDir) - $(Registry:HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\10.0\Setup\VC@ProductDir) - $(Registry:HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VCExpress\10.0\Setup\VC@ProductDir) - $(Registry:HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VCExpress\10.0\Setup\VC@ProductDir) - - $(Registry:HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\10.0\Setup\VS@ProductDir) - $(Registry:HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\10.0\Setup\VS@ProductDir) - $(Registry:HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VCExpress\10.0\Setup\VS@ProductDir) - $(Registry:HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VCExpress\10.0\Setup\VS@ProductDir) - - $(Registry:HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SDKs\Windows\v7.0A@InstallationFolder) - $(Registry:HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Microsoft SDKs\Windows\v7.0A@InstallationFolder) - - $(Registry:HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework@InstallRoot) - $(Registry:HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\.NETFramework@InstallRoot) - - $(Registry:HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SDKs\Windows\v7.0A@InstallationFolder) - $(Registry:HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Microsoft SDKs\Windows\v7.0A@InstallationFolder) - - $(QNX_HOST)\usr\bin;$(PATH); - $(QNX_TARGET)\usr\include;$(QNX_TARGET)\usr\include\freetype2;$(QNX_TARGET)\..\target-override\usr\include; - $(QccLibPath);$(QNX_TARGET)\..\target-override\$(CPUVARDIR)\lib;$(QNX_TARGET)\..\target-override\$(CPUVARDIR)\usr\lib; - $(ExecutablePath) - - - - diff --git a/src/VSNDK.Tasks/Properties/Resources.Designer.cs b/src/VSNDK.Tasks/Properties/Resources.Designer.cs index fac27f14..4afee5d4 100644 --- a/src/VSNDK.Tasks/Properties/Resources.Designer.cs +++ b/src/VSNDK.Tasks/Properties/Resources.Designer.cs @@ -1,7 +1,7 @@ //------------------------------------------------------------------------------ // // This code was generated by a tool. -// Runtime Version:4.0.30319.18408 +// Runtime Version:4.0.30319.34014 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. diff --git a/src/VSNDK.Tasks/QccCompiler.cs b/src/VSNDK.Tasks/QccCompiler.cs index 45fc19bd..46798742 100644 --- a/src/VSNDK.Tasks/QccCompiler.cs +++ b/src/VSNDK.Tasks/QccCompiler.cs @@ -316,7 +316,7 @@ public string FavorSizeOrSpeed switch2.SwitchValue = base.ReadSwitchMap("FavorSizeOrSpeed", switchMap, value); switch2.Name = "FavorSizeOrSpeed"; switch2.Value = value; - switch2.MultiValues = true; + switch2.MultipleValues = true; base.ActiveToolSwitches.Add("FavorSizeOrSpeed", switch2); base.AddActiveSwitchToolValue(switch2); } diff --git a/src/VSNDK.Tasks/VSNDK.Tasks.csproj b/src/VSNDK.Tasks/VSNDK.Tasks.csproj index f51c60cd..5ec4b691 100644 --- a/src/VSNDK.Tasks/VSNDK.Tasks.csproj +++ b/src/VSNDK.Tasks/VSNDK.Tasks.csproj @@ -35,7 +35,7 @@ full false bin\Debug\ - DEBUG;TRACE + TRACE;DEBUG;PLATFORM_VS2010 prompt 4 @@ -43,7 +43,7 @@ pdbonly true bin\Release\ - TRACE + TRACE;PLATFORM_VS2010 prompt 4 @@ -82,7 +82,6 @@ - diff --git a/src/VSNDK.Tasks/VSNDKTasks.cs b/src/VSNDK.Tasks/VSNDKTasks.cs index 13c4ad04..97a766aa 100644 --- a/src/VSNDK.Tasks/VSNDKTasks.cs +++ b/src/VSNDK.Tasks/VSNDKTasks.cs @@ -276,7 +276,11 @@ public virtual string WarningLevel switch2.SwitchValue = base.ReadSwitchMap(WARING_LEVEL, switchMap, value); switch2.Name = WARING_LEVEL; switch2.Value = value; +#if PLATFORM_VS2010 switch2.MultiValues = true; +#else + switch2.MultipleValues = true; +#endif base.ActiveToolSwitches.Add(WARING_LEVEL, switch2); base.AddActiveSwitchToolValue(switch2); } @@ -362,7 +366,11 @@ public virtual string GccExceptionHandling switch2.SwitchValue = base.ReadSwitchMap("ExceptionHandling", switchMap, value); switch2.Name = "ExceptionHandling"; switch2.Value = value; +#if PLATFORM_VS2010 switch2.MultiValues = true; +#else + switch2.MultipleValues = true; +#endif base.ActiveToolSwitches.Add("ExceptionHandling", switch2); base.AddActiveSwitchToolValue(switch2); } @@ -395,7 +403,11 @@ public virtual string Optimization switch2.SwitchValue = base.ReadSwitchMap(OPTIMIZATION, switchMap, value); switch2.Name = OPTIMIZATION; switch2.Value = value; +#if PLATFORM_VS2010 switch2.MultiValues = true; +#else + switch2.MultipleValues = true; +#endif base.ActiveToolSwitches.Add(OPTIMIZATION, switch2); base.AddActiveSwitchToolValue(switch2); } @@ -466,7 +478,11 @@ public virtual string TargetMachine switch2.SwitchValue = base.ReadSwitchMap("TargetMachine", switchMap, value); switch2.Name = "TargetMachine"; switch2.Value = value; +#if PLATFORM_VS2010 switch2.MultiValues = true; +#else + switch2.MultipleValues = true; +#endif base.ActiveToolSwitches.Add("TargetMachine", switch2); base.AddActiveSwitchToolValue(switch2); } @@ -498,7 +514,11 @@ public virtual string CompileAs switch2.SwitchValue = base.ReadSwitchMap(COMPILE_AS, switchMap, value); switch2.Name = COMPILE_AS; switch2.Value = value; +#if PLATFORM_VS2010 switch2.MultiValues = true; +#else + switch2.MultipleValues = true; +#endif base.ActiveToolSwitches.Add(COMPILE_AS, switch2); base.AddActiveSwitchToolValue(switch2); } diff --git a/src/VSNDK.Tasks/WriteDebuggerArgs.cs b/src/VSNDK.Tasks/WriteDebuggerArgs.cs deleted file mode 100644 index c712be98..00000000 --- a/src/VSNDK.Tasks/WriteDebuggerArgs.cs +++ /dev/null @@ -1,174 +0,0 @@ -//* Copyright 2010-2011 Research In Motion Limited. -//* -//* Licensed under the Apache License, Version 2.0 (the "License"); -//* you may not use this file except in compliance with the License. -//* You may obtain a copy of the License at -//* -//* http://www.apache.org/licenses/LICENSE-2.0 -//* -//* Unless required by applicable law or agreed to in writing, software -//* distributed under the License is distributed on an "AS IS" BASIS, -//* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//* See the License for the specific language governing permissions and -//* limitations under the License. - -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.IO; -using System.Collections; -using System.Text.RegularExpressions; -using Microsoft.Build.Framework; -using Microsoft.Build.Utilities; - -namespace VSNDK.Tasks -{ - public class WriteDebuggerArgs : Task - { - #region Member Variables and Constants - - private string _projectDir; - private string _outDir; - private string _appName; - private string _device; - private bool _isSimulator; - private string _appData; - - #endregion - - #region Public Propeties - - /// - /// Getter/Setter for the ProjectDir property - /// - [Required] - public string ProjectDir - { - set { _projectDir = value.Replace('\\', '/'); } - get { return _projectDir; } - } - - /// - /// Getter/Setter for the _appData property - /// -// [Required] - public string AppData - { - set { _appData = value; } - get { return _appData; } - } - - /// - /// Getter/Setter for the OutDir property - /// - [Required] - public string OutDir - { - set { _outDir = value.Replace('\\', '/'); } - get { return _outDir; } - } - - /// - /// Getter/Setter for the AppName property - /// - [Required] - public string AppName - { - set { _appName = value; } - get { return _appName; } - } - - /// - /// Getter/Setter for the Device property - /// - [Required] - public string Device - { - set - { - _device = value; - } - } - - /// - /// Getter/Setter for the isSimulator property - /// - [Required] - public bool isSimulator - { - set - { - _isSimulator = value; - } - } - - /// - /// Getter/Setter for the ToolsPath property - /// - [Required] - public string ToolsPath - { - get; - set; - } - - /// - /// Getter/Setter for the PublicKeyPath property - /// - [Required] - public string PublicKeyPath - { - get; - set; - } - - /// - /// Getter/Setter for the Password property - /// - public string Password - { - get; - set; - } - - #endregion - - /// - /// Execute MSBuild function - /// - /// - public override bool Execute() - { - /// Initialize Variables - bool result; - - try - { - // Setting the work directory. - string rootedOutDir = (Path.IsPathRooted(OutDir)) ? OutDir + AppName : ProjectDir + OutDir + AppName; - - AppData = Environment.GetEnvironmentVariable("AppData") + @"\BlackBerry\vsndk-args-file.txt"; - - System.IO.StreamWriter file = new System.IO.StreamWriter(AppData); - - file.WriteLine(_device); - file.WriteLine(rootedOutDir.Replace(@"\\", @"\\\\")); - file.WriteLine(_isSimulator); - file.WriteLine(ToolsPath); - file.WriteLine(PublicKeyPath); - file.WriteLine(Password); - file.Close(); - - result = true; - } - catch (Exception ex) - { - result = false; - } - return result; - } - - - } -} diff --git a/src_vs2012/VSNDK.Tasks/AsyncExec.cs b/src_vs2012/VSNDK.Tasks/AsyncExec.cs deleted file mode 100644 index 27156d93..00000000 --- a/src_vs2012/VSNDK.Tasks/AsyncExec.cs +++ /dev/null @@ -1,116 +0,0 @@ -//* Copyright 2010-2011 BlackBerry Limited. -//* -//* Licensed under the Apache License, Version 2.0 (the "License"); -//* you may not use this file except in compliance with the License. -//* You may obtain a copy of the License at -//* -//* http://www.apache.org/licenses/LICENSE-2.0 -//* -//* Unless required by applicable law or agreed to in writing, software -//* distributed under the License is distributed on an "AS IS" BASIS, -//* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//* See the License for the specific language governing permissions and -//* limitations under the License. - -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using Microsoft.Build.Tasks; -using System.Diagnostics; -using System.Collections; -using System.Collections.Specialized; -using Microsoft.Build.Framework; -using System.Security.Cryptography; - -namespace VSNDK.Tasks -{ - // This task overrides Exec in order to run commands such as blackberry-connect asynchronously. - public class AsyncExec : Exec - { - private int _processId; - - /// - /// Execute given command asynchronously. - /// - /// Path of executable to be run. - /// Response file commands - /// Command Line Arguments - /// - protected override int ExecuteTool(string pathToTool, string responseFileCommands, string commandLineCommands) - { - string comm = "/Q /C " + Command + " -password " + Decrypt(Password); - - Process process = new Process(); - process.StartInfo = GetProcessStartInfo(pathToTool, comm); - process.StartInfo.UseShellExecute = false; - process.Start(); - _processId = process.Id; - return 0; - } - - /// - /// Helper function to create the ProcessStartInfo object for the running process. - /// - /// Path of executable to be run. - /// Command Line Arguments - /// - protected virtual ProcessStartInfo GetProcessStartInfo(string executable, string arguments) - { - if (arguments.Length > 0x7d00) - { - this.Log.LogWarningWithCodeFromResources("ToolTask.CommandTooLong", new object[] { base.GetType().Name }); - } - - ProcessStartInfo startInfo = new ProcessStartInfo(executable, arguments); - startInfo.WindowStyle = ProcessWindowStyle.Hidden; - startInfo.CreateNoWindow = true; - startInfo.UseShellExecute = true; - - string workingDirectory = this.GetWorkingDirectory(); - if (workingDirectory != null) - { - startInfo.WorkingDirectory = workingDirectory; - } - - StringDictionary environmentOverride = this.EnvironmentOverride; - if (environmentOverride != null) - { - foreach (DictionaryEntry entry in environmentOverride) - { - startInfo.EnvironmentVariables.Remove(entry.Key.ToString()); - startInfo.EnvironmentVariables.Add(entry.Key.ToString(), entry.Value.ToString()); - } - } - - return startInfo; - } - - /// - /// Getter/Setter for Password Property - /// - public virtual string Password - { - set; - get; - } - - /// - /// Helper Function to Decrypt Password - /// - /// - /// - public string Decrypt(string cipher) - { - if (cipher == null) throw new ArgumentNullException("cipher"); - - //parse base64 string - byte[] data = Convert.FromBase64String(cipher); - - //decrypt data - byte[] decrypted = ProtectedData.Unprotect(data, null, DataProtectionScope.LocalMachine); - - return Encoding.Unicode.GetString(decrypted); - } - } -} diff --git a/src_vs2012/VSNDK.Tasks/BBDeploy.cs b/src_vs2012/VSNDK.Tasks/BBDeploy.cs deleted file mode 100644 index 41bd1e26..00000000 --- a/src_vs2012/VSNDK.Tasks/BBDeploy.cs +++ /dev/null @@ -1,700 +0,0 @@ -//* Copyright 2010-2011 Research In Motion Limited. -//* -//* Licensed under the Apache License, Version 2.0 (the "License"); -//* you may not use this file except in compliance with the License. -//* You may obtain a copy of the License at -//* -//* http://www.apache.org/licenses/LICENSE-2.0 -//* -//* Unless required by applicable law or agreed to in writing, software -//* distributed under the License is distributed on an "AS IS" BASIS, -//* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//* See the License for the specific language governing permissions and -//* limitations under the License. - -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Reflection; -using System.Resources; -using Microsoft.Build.CPPTasks; -using System.Collections; -using Microsoft.Build.Framework; -using System.IO; -using Microsoft.Build.Utilities; -using System.Security.Cryptography; - -namespace VSNDK.Tasks -{ - public class BBDeploy : TrackedVCToolTask - { - #region Member Variable Declaration - protected ArrayList switchOrderList; - private string _localManifest; - private const string TRACKER_LOG_DIRECTORY = "TrackerLogDirectory"; - private const string GET_FILE = "GetFile"; - private const string GET_FILE_SAVE_AS = "GetFileSaveAs"; - private const string PUT_FILE = "PutFile"; - private const string PUT_FILE_SAVE_AS = "PutFileSaveAs"; - private const string DEVICE = "Device"; - private const string PASSWORD = "Password"; - private const string PACKAGE_ID = "PackageId"; - private const string PACKAGE_NAME = "PackageName"; - private const string LAUNCH_APP = "LaunchApp"; - private const string INSTALL_APP = "InstallApp"; - private const string LIST_INSTALLED_APPS = "ListInstalledApps"; - private const string DEBUG_NATIVE = "DebugNative"; - private const string PACKAGE = "Package"; - private const string WORKSPACE_LOC = "${workspace_loc:/"; - private string _flagFile; - - #endregion - - /// - /// BBDeploy Constructor - /// - public BBDeploy() - : base(new ResourceManager("VSNDK.Tasks.Properties.Resources", Assembly.GetExecutingAssembly())) - { - this.switchOrderList = new ArrayList(); - this.switchOrderList.Add(INSTALL_APP); - this.switchOrderList.Add(LAUNCH_APP); - this.switchOrderList.Add(LIST_INSTALLED_APPS); - this.switchOrderList.Add(DEBUG_NATIVE); - this.switchOrderList.Add(DEVICE); - this.switchOrderList.Add(PASSWORD); - this.switchOrderList.Add(PACKAGE); - this.switchOrderList.Add(PACKAGE_ID); - this.switchOrderList.Add(PACKAGE_NAME); - this.switchOrderList.Add(GET_FILE); - this.switchOrderList.Add(GET_FILE_SAVE_AS); - this.switchOrderList.Add(PUT_FILE); - this.switchOrderList.Add(PUT_FILE_SAVE_AS); - } - - #region overrides - - /// - /// Helper function to return Response File Switch - /// - /// Path to response file. - /// Return response file switch - protected override string GetResponseFileSwitch(string responseFilePath) - { - return string.Empty; - } - - /// - /// Helper function to generte the command line argument string. - /// - /// command line argument string - protected override string GenerateCommandLineCommands() - { - return GenerateResponseFileCommands(); - } - - /// - /// Helper function to generate response file string - /// - /// response file command line string - protected override string GenerateResponseFileCommands() - { - string cmd = base.GenerateResponseFileCommands(); - - if (ListInstalledApps) - { - cmd += " > installedApps.txt"; - } - - return cmd; - } - - /// - /// Getter for the SwitchOrderList property - /// - protected override ArrayList SwitchOrderList - { - get - { - return this.switchOrderList; - } - } - - /// - /// Getter for the CommandTLogName property - /// - protected override string CommandTLogName - { - get { return "BBDeploy.command.1.tlog"; } - } - - /// - /// Getter for the ReadTLogNames property - /// - protected override string[] ReadTLogNames - { - get { return new string[] { "BBDeploy.read.1.tlog", "BBDeploy.*.read.1.tlog" }; } - } - - /// - /// Getter for the WriteTLogNames property - /// - protected override string[] WriteTLogNames - { - get - { - return new string[] { "BBDeploy.write.1.tlog", "BBDeploy.*.write.1.tlog" }; - } - } - - /// - /// Getter for the TrackedInputFiles property - /// - protected override Microsoft.Build.Framework.ITaskItem[] TrackedInputFiles - { - get - { - // I don't know what this method does but we need to return something other than 'null' or the task doesn't run, - // and adding something like "localManifest.mf" to the list of items causes other problems. - ITaskItem[] items = new ITaskItem[1]; - return items; - } - } - - /// - /// Getter for the ToolName property - /// - protected override string ToolName - { - get - { - return ToolExe; - } - } - - /// - /// Getter for the TrackerIntermediateDirectory property - /// - protected override string TrackerIntermediateDirectory - { - get - { - if (this.TrackerLogDirectory != null) - { - return this.TrackerLogDirectory; - } - return string.Empty; - } - } - - /// - /// Function to return the full path to the tool. - /// - /// - protected override string GenerateFullPathToTool() - { - return this.ToolName; - } - - #endregion overrides - - #region properties - - /// - /// Getter/Setter for the GetFile property - /// Retrieve specified file from default application directory - /// - public virtual string GetFile - { - get - { - if (base.IsPropertySet(GET_FILE)) - { - return base.ActiveToolSwitches[GET_FILE].Value; - } - return null; - } - set - { - base.ActiveToolSwitches.Remove(GET_FILE); - - // Value passed in is the file to get, relative to our app's directory. - // We determine the app's directory from the PackageName and PackageId. - String toolValue = "../../../../apps/" + PackageName + "." + PackageId + "/" + value; - ToolSwitch toolSwitch = new ToolSwitch(ToolSwitchType.String) - { - Name = GET_FILE, - DisplayName = "GetFile", - Description = "Get the given file from the application's directory.", - SwitchValue = "-getFile ", - Value = toolValue - }; - base.ActiveToolSwitches.Add(GET_FILE, toolSwitch); - base.AddActiveSwitchToolValue(toolSwitch); - } - } - - /// - /// Getter/Setter for the GetFileSaveAs property - /// Retrieve specified file from location. - /// - public virtual string GetFileSaveAs - { - get - { - if (base.IsPropertySet(GET_FILE_SAVE_AS)) - { - return base.ActiveToolSwitches[GET_FILE_SAVE_AS].Value; - } - return null; - } - set - { - base.ActiveToolSwitches.Remove(GET_FILE_SAVE_AS); - ToolSwitch toolSwitch = new ToolSwitch(ToolSwitchType.String) - { - Name = GET_FILE_SAVE_AS, - DisplayName = "GetFileSaveAs", - Description = "Save a file retrieved using GetFile to the given location.", - Value = value - }; - base.ActiveToolSwitches.Add(GET_FILE_SAVE_AS, toolSwitch); - base.AddActiveSwitchToolValue(toolSwitch); - } - } - - /// - /// Getter/Setter for the PutFile property - /// Save given file to default application directory. - /// - public virtual string PutFile - { - get - { - if (base.IsPropertySet(PUT_FILE)) - { - return base.ActiveToolSwitches[PUT_FILE].Value; - } - return null; - } - set - { - base.ActiveToolSwitches.Remove(PUT_FILE); - //value = value.Replace(".exe", ""); - - ToolSwitch toolSwitch = new ToolSwitch(ToolSwitchType.String) - { - Name = PUT_FILE, - DisplayName = "PutFile", - Description = "Put the given file into the application's directory.", - SwitchValue = "-putFile ", - Value = value - }; - base.ActiveToolSwitches.Add(PUT_FILE, toolSwitch); - base.AddActiveSwitchToolValue(toolSwitch); - } - } - - /// - /// Getter/Setter for the PutFileSaveAs property - /// Save given file to specified location - /// - public virtual string PutFileSaveAs - { - get - { - if (base.IsPropertySet(PUT_FILE_SAVE_AS)) - { - return base.ActiveToolSwitches[PUT_FILE_SAVE_AS].Value; - } - return null; - } - set - { - base.ActiveToolSwitches.Remove(PUT_FILE_SAVE_AS); - - // We determine the app's directory from the PackageName and PackageId. - String toolValue = "../../../../apps/" + PackageName + "." + PackageId + "/" + value; - ToolSwitch toolSwitch = new ToolSwitch(ToolSwitchType.String) - { - Name = PUT_FILE_SAVE_AS, - DisplayName = "PutFileSaveAs", - Description = "Save a file retrieved using PutFile to the given location.", - Value = toolValue - }; - base.ActiveToolSwitches.Add(PUT_FILE_SAVE_AS, toolSwitch); - base.AddActiveSwitchToolValue(toolSwitch); - } - } - - /// - /// Getter/Setter for the InstallApp property - Switch to cause deploy to install a given application - /// - public virtual bool InstallApp - { - get - { - return (base.IsPropertySet(INSTALL_APP) && base.ActiveToolSwitches[INSTALL_APP].BooleanValue); - } - set - { - base.ActiveToolSwitches.Remove(INSTALL_APP); - ToolSwitch toolSwitch = new ToolSwitch(ToolSwitchType.Boolean) - { - Name = INSTALL_APP, - DisplayName = "Install App", - Description = "The -installApp option installs an app from a given package.", - SwitchValue = "-installApp", - BooleanValue = value - }; - base.ActiveToolSwitches.Add(INSTALL_APP, toolSwitch); - base.AddActiveSwitchToolValue(toolSwitch); - } - } - - /// - /// Getter/Setter for the LaunchApp Property - Switch to launch given application. - /// - public virtual bool LaunchApp - { - get - { - return (base.IsPropertySet(LAUNCH_APP) && base.ActiveToolSwitches[LAUNCH_APP].BooleanValue); - } - set - { - base.ActiveToolSwitches.Remove(LAUNCH_APP); - ToolSwitch toolSwitch = new ToolSwitch(ToolSwitchType.Boolean) - { - Name = LAUNCH_APP, - DisplayName = "Launch App", - Description = "The -launchApp option allows an app to be launched with or without being installed.", - SwitchValue = "-launchApp ", - BooleanValue = value - }; - base.ActiveToolSwitches.Add(LAUNCH_APP, toolSwitch); - base.AddActiveSwitchToolValue(toolSwitch); - } - } - - /// - /// Getter/Setter for ListInstalledApps Property. - /// Switch for command to retrieve the list of installed apps. - /// - public virtual bool ListInstalledApps - { - get - { - return (base.IsPropertySet(LIST_INSTALLED_APPS) && base.ActiveToolSwitches[LIST_INSTALLED_APPS].BooleanValue); - } - set - { - base.ActiveToolSwitches.Remove(LIST_INSTALLED_APPS); - ToolSwitch toolSwitch = new ToolSwitch(ToolSwitchType.Boolean) - { - Name = LIST_INSTALLED_APPS, - DisplayName = "List Installed Apps", - Description = "The -listInstalledApps option does just that.", - SwitchValue = "-listInstalledApps ", - BooleanValue = value - }; - base.ActiveToolSwitches.Add(LIST_INSTALLED_APPS, toolSwitch); - base.AddActiveSwitchToolValue(toolSwitch); - } - } - - /// - /// Setter for FlagFile property - /// - public string FlagFile - { - set - { - _flagFile = value; - } - } - - /// - /// Getter/Setter for DebugNative property - /// Switch to cause task to install application in debug configuration. - /// - public virtual bool DebugNative - { - get - { - return (base.IsPropertySet(DEBUG_NATIVE) && base.ActiveToolSwitches[DEBUG_NATIVE].BooleanValue); - } - - set - { - if (File.Exists(_flagFile)) - value = true; - - base.ActiveToolSwitches.Remove(DEBUG_NATIVE); - ToolSwitch toolSwitch = new ToolSwitch(ToolSwitchType.Boolean) - { - Name = DEBUG_NATIVE, - DisplayName = "Launch for debugging", - Description = "The -debugNative option launches the app in suspended, ready-to-debug state.", - SwitchValue = "-debugNative ", - BooleanValue = value - }; - base.ActiveToolSwitches.Add(DEBUG_NATIVE, toolSwitch); - base.AddActiveSwitchToolValue(toolSwitch); - } - } - - /// - /// Getter/Setter for Device property. - /// Device property designates the IP of the target device. - /// - public virtual string Device - { - get - { - if (base.IsPropertySet(DEVICE)) - { - return base.ActiveToolSwitches[DEVICE].Value; - } - return null; - } - set - { - base.ActiveToolSwitches.Remove(DEVICE); - ToolSwitch toolSwitch = new ToolSwitch(ToolSwitchType.String) - { - Name = DEVICE, - DisplayName = "Device IP", - Description = "The -device option specifies the target device's IP address.", - SwitchValue = "-device ", - Value = value - }; - base.ActiveToolSwitches.Add(DEVICE, toolSwitch); - base.AddActiveSwitchToolValue(toolSwitch); - } - } - - /// - /// Getter/Setter for Password property. - /// Password property specifies the target device password. - /// - public virtual string Password - { - get - { - if (base.IsPropertySet(PASSWORD)) - { - return base.ActiveToolSwitches[PASSWORD].Value; - } - return null; - } - set - { - - base.ActiveToolSwitches.Remove(PASSWORD); - ToolSwitch toolSwitch = new ToolSwitch(ToolSwitchType.String) - { - Name = PASSWORD, - DisplayName = "Device Password", - Description = "The -password option specifies the target device's password.", - SwitchValue = "-password ", - Value = Decrypt(value) - }; - - base.ActiveToolSwitches.Add(PASSWORD, toolSwitch); - base.AddActiveSwitchToolValue(toolSwitch); - } - } - - /// - /// Getter/Setter for Package property. - /// Package property specified package to be installed/launched on task execution. - /// - public virtual string Package - { - get - { - if (base.IsPropertySet(PACKAGE)) - { - return base.ActiveToolSwitches[PACKAGE].Value; - } - return null; - } - set - { - base.ActiveToolSwitches.Remove(PACKAGE); - ToolSwitch toolSwitch = new ToolSwitch(ToolSwitchType.String) - { - Name = PACKAGE, - DisplayName = "Package", - Description = "The -package option specifies a .bar package.", - SwitchValue = "-package ", - Value = value - }; - base.ActiveToolSwitches.Add(PACKAGE, toolSwitch); - base.AddActiveSwitchToolValue(toolSwitch); - } - } - - /// - /// Getter/Setter for PackageId property - /// - [Output] - public virtual string PackageId - { - get - { - if (base.IsPropertySet(PACKAGE_ID)) - { - return base.ActiveToolSwitches[PACKAGE_ID].Value; - } - return null; - } - set - { - base.ActiveToolSwitches.Remove(PACKAGE_ID); - ToolSwitch toolSwitch = new ToolSwitch(ToolSwitchType.String) - { - Name = PACKAGE_ID, - DisplayName = "Package ID", - Description = "The -package-id option specifies the application's package id.", - SwitchValue = "-package-id ", - Value = value - }; - base.ActiveToolSwitches.Add(PACKAGE_ID, toolSwitch); - base.AddActiveSwitchToolValue(toolSwitch); - } - } - - /// - /// Getter/Setter for PackageName property - /// - [Output] - public virtual string PackageName - { - get - { - if (base.IsPropertySet(PACKAGE_NAME)) - { - return base.ActiveToolSwitches[PACKAGE_NAME].Value; - } - return null; - } - set - { - base.ActiveToolSwitches.Remove(PACKAGE_NAME); - ToolSwitch toolSwitch = new ToolSwitch(ToolSwitchType.String) - { - Name = PACKAGE_NAME, - DisplayName = "Package Name", - Description = "The -package-name option specifies the application's package name.", - SwitchValue = "-package-name ", - Value = value - }; - base.ActiveToolSwitches.Add(PACKAGE_NAME, toolSwitch); - base.AddActiveSwitchToolValue(toolSwitch); - } - } - - /// - /// Getter/Setter for LocalManifestFile property - /// We need the local manifest in order to determine PackageId and PackageName. - /// - public virtual string LocalManifestFile - { - get - { - return _localManifest; - } - set - { - _localManifest = value; - - string[] lines = File.ReadAllLines(_localManifest); - - for (int i = 0; i < lines.Length; i++) - { - if (lines[i].StartsWith("Package-Name: ")) - { - string name = lines[i].Substring(14); - if (PackageName != name) - PackageName = name; - } - else if (lines[i].StartsWith("Package-Id: ")) - { - string id = lines[i].Substring(12); - if (PackageId != id) - PackageId = id; - } - } - } - } - - /// - /// Getter/Setter for the TargetManifestFile - /// - [Output] - public virtual string TargetManifestFile - { - get - { - return null; - } - } - - /// - /// Getter/Setter for the TrackerLogDirectory property - /// - public virtual string TrackerLogDirectory - { - get - { - if (base.IsPropertySet(TRACKER_LOG_DIRECTORY)) - { - return base.ActiveToolSwitches[TRACKER_LOG_DIRECTORY].Value; - } - return null; - } - set - { - base.ActiveToolSwitches.Remove(TRACKER_LOG_DIRECTORY); - ToolSwitch switch2 = new ToolSwitch(ToolSwitchType.Directory) - { - DisplayName = "Tracker Log Directory", - Description = "Tracker Log Directory.", - Value = VCToolTask.EnsureTrailingSlash(value) - }; - base.ActiveToolSwitches.Add(TRACKER_LOG_DIRECTORY, switch2); - base.AddActiveSwitchToolValue(switch2); - } - } - - #endregion - - /// - /// Decrypts a given string. - /// - /// A base64 encoded string that was created - /// through the or - /// extension methods. - /// The decrypted string. - /// Keep in mind that the decrypted string remains in memory - /// and makes your application vulnerable per se. If runtime protection - /// is essential, should be used. - /// If - /// is a null reference. - public string Decrypt(string cipher) - { - if (cipher == null) throw new ArgumentNullException("cipher"); - - //parse base64 string - byte[] data = Convert.FromBase64String(cipher); - - //decrypt data - byte[] decrypted = ProtectedData.Unprotect(data, null, DataProtectionScope.LocalMachine); - - return Encoding.Unicode.GetString(decrypted); - } - } -} diff --git a/src_vs2012/VSNDK.Tasks/BBNativePackager.cs b/src_vs2012/VSNDK.Tasks/BBNativePackager.cs deleted file mode 100644 index 7de2dca5..00000000 --- a/src_vs2012/VSNDK.Tasks/BBNativePackager.cs +++ /dev/null @@ -1,739 +0,0 @@ -//* Copyright 2010-2011 Research In Motion Limited. -//* -//* Licensed under the Apache License, Version 2.0 (the "License"); -//* you may not use this file except in compliance with the License. -//* You may obtain a copy of the License at -//* -//* http://www.apache.org/licenses/LICENSE-2.0 -//* -//* Unless required by applicable law or agreed to in writing, software -//* distributed under the License is distributed on an "AS IS" BASIS, -//* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//* See the License for the specific language governing permissions and -//* limitations under the License. - -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Reflection; -using System.Resources; -using Microsoft.Build.CPPTasks; -using System.Collections; -using Microsoft.Build.Framework; -using System.IO; -using Microsoft.Build.Utilities; - -namespace VSNDK.Tasks -{ - public class BBNativePackager : TrackedVCToolTask - { - #region Member Variable and Constant Declarations - protected ArrayList switchOrderList; - private static BarDescriptor.qnx _descriptor = null; - private string _projDir; - private string _appName; - private string _barDescriptorPath = ""; - private const string OUTPUT_FILE = "OutputFiles"; - private const string APP_DESCRIPTOR = "ApplicationDescriptorXml"; - private const string TARGET_FORMAT = "TargetFormat"; - private const string BUILD_ID = "BuildId"; - private const string BUILD_ID_FILE = "BuildIdFile"; - private const string DEV_MODE = "DevMode"; - private const string PACKAGE_MANIFEST_ONLY = "PackageManifestOnly"; - private const string DEBUG_TOKEN = "DebugToken"; - private const string SOURCES = "Sources"; - private const string TRACKER_LOG_DIRECTORY = "TrackerLogDirectory"; - private const string GET_TARGET_FILE_MAP = "GetTargetFileMap"; - private const string WORKSPACE_LOC = "${workspace_loc:/"; - #endregion - - /// - /// BBNativePackager Constructor - /// - public BBNativePackager() - : base(new ResourceManager("VSNDK.Tasks.Properties.Resources", Assembly.GetExecutingAssembly())) - { - this.switchOrderList = new ArrayList(); - this.switchOrderList.Add(TARGET_FORMAT); - this.switchOrderList.Add(BUILD_ID); - this.switchOrderList.Add(BUILD_ID_FILE); - this.switchOrderList.Add(DEV_MODE); - this.switchOrderList.Add(GET_TARGET_FILE_MAP); - this.switchOrderList.Add(PACKAGE_MANIFEST_ONLY); - this.switchOrderList.Add(OUTPUT_FILE); - this.switchOrderList.Add(APP_DESCRIPTOR); - this.switchOrderList.Add(TRACKER_LOG_DIRECTORY); - } - - #region overrides - - - /// - /// Return the response file switch. - /// Note: Don't use response file for msbuild because it is removed before qcc to run GCC compiler - /// - /// Response File Path - /// Response File Switch - protected override string GetResponseFileSwitch(string responseFilePath) - { - return string.Empty; - } - - /// - /// Return the Command Line String. - /// Note: pass the response file to command line commands - /// - /// Command Line String - protected override string GenerateCommandLineCommands() - { - return GenerateResponseFileCommands(); - } - - /// - /// Return the Response File Command String - /// - /// - protected override string GenerateResponseFileCommands() - { - string cmd = base.GenerateResponseFileCommands(); - PackagerCmdBuilder clb = new PackagerCmdBuilder(); - AppendResources(clb); - cmd += " " + clb.ToString(); - - // Output the .bar file's manifest to a file so we can parse it. - if (PackageManifestOnly) - { - cmd += " > localManifest.mf"; - } - else if (GetTargetFileMap) - { - cmd += " > targetFileMap.txt"; - } - - return cmd; - } - - /// - /// Helper function to read the assets from the bar-descriptor.xml file and - /// generate the command line listing the resources to be packaged into the bar file. - /// - /// Command Line Builder object - private void AppendResources(CommandLineBuilder clb) - { - ITaskItem[] sources = GetAssetsFile(); - foreach (ITaskItem item in sources) - { - string target = item.GetMetadata("target"); - if (item.ItemSpec == target) - clb.AppendFileNameIfNotNull(item); - else - { - clb.AppendSwitchIfNotNull("-e ", item); - clb.AppendFileNameIfNotNull(target); - } - } - } - - /// - /// Return the assets from the bardescriptor.xml - /// - /// - private ITaskItem[] GetAssetsFile() - { - - //make sure the _descriptor is loaded - if (_descriptor == null) - { - _descriptor = BarDescriptor.Parser.Load(Path.Combine(ProjectDir, ApplicationDescriptorXml)); - } - BarDescriptor.asset[] globalAssets = _descriptor.assets; - BarDescriptor.asset[] configAssets = null; - - // You can call a configuration whatever you like, but these are the ones Momentics uses for its various - // platform + configuration combinations. Usually this is the same as the output directory, but asset paths - // don't have anything to do with the configuration name. I've based the config names on the platform - // + configuration combination, not the output directory. - BarDescriptor.qnxConfiguration[] configs = _descriptor.configurations; - foreach (BarDescriptor.qnxConfiguration config in configs) - { - if (Configuration == "Debug" && Platform == "BlackBerry" && config.name == "Device-Debug") - { - configAssets = config.asset; - break; - } - else if (Configuration == "Release" && Platform == "BlackBerry" && config.name == "Device-Release") - { - configAssets = config.asset; - break; - } - else if (Configuration == "Profile" && Platform == "BlackBerry" && config.name == "Device-Profile") - { - configAssets = config.asset; - break; - } - else if (Configuration == "Coverage" && Platform == "BlackBerry" && config.name == "Device-Coverage") - { - configAssets = config.asset; - break; - } - else if (Configuration == "Debug" && Platform == "BlackBerrySimulator" && (config.name == "Simulator" || config.name == "Simulator-Debug")) - { - configAssets = config.asset; - break; - } - else if (Configuration == "Profile" && Platform == "BlackBerrySimulator" && config.name == "Simulator-Profile") - { - configAssets = config.asset; - break; - } - else if (Configuration == "Coverage" && Platform == "BlackBerrySimulator" && config.name == "Simulator-Coverage") - { - configAssets = config.asset; - break; - } - else if (Configuration == "Release" && Platform == "BlackBerrySimulator" && config.name == "Simulator-Release") - { - configAssets = config.asset; - break; - } - } - - ITaskItem[] items = null; - - - int clen = (configAssets == null) ? 0 : configAssets.Length; - int glen = (globalAssets == null) ? 0 : globalAssets.Length; - - items = new ITaskItem[glen + clen]; - - for (int i = 0; i < glen; i++) - { - string path = globalAssets[i].path; - path = path.Replace("}", string.Empty).Replace(WORKSPACE_LOC, SolutionDir); - string target = globalAssets[i].Value; - items[i] = new TaskItem(path); - items[i].SetMetadata("target", target); - } - - - if (configAssets != null) - { - for (int i = 0; i < configAssets.Length; i++) - { - string path = configAssets[i].path; - path = path.Replace("}", string.Empty).Replace(WORKSPACE_LOC, SolutionDir); - string target = configAssets[i].Value; - items[i + glen] = new TaskItem(path); - items[i + glen].SetMetadata("target", target); - } - } - - return items; - - } - - /// - /// Getter for the SwitchOrderList property - /// - protected override ArrayList SwitchOrderList - { - get - { - return this.switchOrderList; - } - } - - /// - /// Getter for the CommandTLogName property - /// - protected override string CommandTLogName - { - get { return "BBNativePackager.command.1.tlog"; } - } - - /// - /// Getter for the ReadTLogNames property. - /// - protected override string[] ReadTLogNames - { - get { return new string[] { "BBNativePackager.read.1.tlog", "BBNativePackager.*.read.1.tlog" }; } - } - - /// - /// Getter for the WriteTLogNames property - /// - protected override string[] WriteTLogNames - { - get - { - return new string[] { "BBNativePackager.write.1.tlog", "BBNativePackager.*.write.1.tlog" }; - } - } - - /// - /// Getter for the ToolName property - /// - protected override string ToolName - { - get - { - return ToolExe; - } - } - - #endregion overrides - - #region properties - - /// - /// Getter/Setter for Device property - /// - [Output] - public virtual string Device { get; set; } - - /// - /// Getter/Setter for Password property - /// - [Output] - public virtual string Password { get; set;} - - /// - /// Getter/Setter for BarDeploy property - /// - [Output] - public virtual string BarDeploy { get; set; } - - /// - /// Getter/Setter for OutputFile property - /// - [Required] - [Output] - public virtual string OutputFile - { - get - { - if (base.IsPropertySet(OUTPUT_FILE) && base.IsExplicitlySetToFalse(PACKAGE_MANIFEST_ONLY)) - { - return base.ActiveToolSwitches[OUTPUT_FILE].Value; - } - return null; - } - set - { - base.ActiveToolSwitches.Remove(OUTPUT_FILE); - - String switchValue = ""; - if (base.IsPropertySet(OUTPUT_FILE) && base.IsExplicitlySetToFalse(PACKAGE_MANIFEST_ONLY)) - { - switchValue = "-package "; - } - - ToolSwitch switch2 = new ToolSwitch(ToolSwitchType.File) - { - DisplayName = "Output bar file name, for example, out.bar", - Description = "The -package option specifies the bar file name.", - ArgumentRelationList = new ArrayList(), - SwitchValue = switchValue, - Name = OUTPUT_FILE, - Value = value - }; - base.ActiveToolSwitches.Add(OUTPUT_FILE, switch2); - base.AddActiveSwitchToolValue(switch2); - } - } - - /// - /// Getter/Setter for ProjectDir property - /// - [Required] - public virtual string ProjectDir - { - get - { - return _projDir; - } - set - { - _projDir = value; - _descriptor = BarDescriptor.Parser.Load(Path.Combine(ProjectDir, ApplicationDescriptorXml)); - } - } - - /// - /// Getter/Setter for AppName property - /// - [Required] - public virtual string AppName - { - get - { - return _appName; - } - set - { - _appName = value; - - if (_barDescriptorPath == "") - { - // Default location of bar-descriptor file, if not specified in the Properties Configurations. - _barDescriptorPath = "BlackBerry-" + _appName + "\\bar-descriptor.xml"; - if (!File.Exists(_barDescriptorPath)) - { - // Just to support the default locations of bar-descriptor from previous versions of the plug-in. - _barDescriptorPath = _appName + "_barDescriptor\\bar-descriptor.xml"; - if (!File.Exists(_barDescriptorPath)) - { - _barDescriptorPath = "bar-descriptor.xml"; - } - } - } - - base.ActiveToolSwitches.Remove(APP_DESCRIPTOR); - - ToolSwitch switch2 = new ToolSwitch(ToolSwitchType.File) - { - DisplayName = "Application descriptor file name, for example, bar-descriptor.xml", - Description = "Application descriptor file name, for example, bar-descriptor.xml, it must follows the out.bar file", - ArgumentRelationList = new ArrayList(), - Name = APP_DESCRIPTOR, - Value = _barDescriptorPath - }; - base.ActiveToolSwitches.Add(APP_DESCRIPTOR, switch2); - base.AddActiveSwitchToolValue(switch2); - } - } - - /// - /// Getter/Setter for SolutionDir property - /// - [Required] - public virtual string SolutionDir { get; set; } - - public virtual string ApplicationDescriptorXml - { - get - { - if (base.IsPropertySet(APP_DESCRIPTOR)) - { - return base.ActiveToolSwitches[APP_DESCRIPTOR].Value; - } - return null; - } - set - { - _barDescriptorPath = value; - } - } - - /// - /// Getter/Setter for TargetFormat property - /// - public virtual string TargetFormat - { - get - { - if (base.IsPropertySet(TARGET_FORMAT)) - { - return base.ActiveToolSwitches[TARGET_FORMAT].Value; - } - return null; - } - set - { - base.ActiveToolSwitches.Remove(TARGET_FORMAT); - ToolSwitch switch2 = new ToolSwitch(ToolSwitchType.String) - { - DisplayName = "Target format", - Description = "Select the build target format( -target bar -target bar-debug)", - ArgumentRelationList = new ArrayList() - }; - string[][] switchMap = new string[][] - { - new string[] { "bar", "-target bar" }, - new string[] { "bar-debug", "-target bar-debug" } - }; - switch2.SwitchValue = base.ReadSwitchMap(TARGET_FORMAT, switchMap, value); - switch2.Name = TARGET_FORMAT; - switch2.Value = value; - switch2.MultipleValues = true; - base.ActiveToolSwitches.Add(TARGET_FORMAT, switch2); - base.AddActiveSwitchToolValue(switch2); - } - } - - /// - /// Getter/Setter for BuildID property - /// - public virtual int BuildID - { - get - { - if (base.IsPropertySet(BUILD_ID)) - { - return base.ActiveToolSwitches[BUILD_ID].Number; - } - return 0; - } - set - { - base.ActiveToolSwitches.Remove(BUILD_ID); - ToolSwitch switch2 = new ToolSwitch(ToolSwitchType.Integer) - { - DisplayName = "Build Id", - Description = "set the build id ( the fourth segment of the version ). Must be a number from 0 to 65535" - }; - switch2.ArgumentRelationList = new ArrayList(); - switch2.IsValid = base.ValidateInteger(BUILD_ID, 0, 65535, value); - switch2.Name = BUILD_ID; - switch2.Number = value; - switch2.SwitchValue = "-buildId "; - base.ActiveToolSwitches.Add(BUILD_ID, switch2); - base.AddActiveSwitchToolValue(switch2); - } - } - - /// - /// Getter/Setter for BuildIDFile property - /// - public virtual string BuildIDFile - { - get - { - if (base.IsPropertySet(BUILD_ID_FILE)) - { - return base.ActiveToolSwitches[BUILD_ID_FILE].Value; - } - return null; - } - set - { - base.ActiveToolSwitches.Remove(BUILD_ID_FILE); - ToolSwitch switch2 = new ToolSwitch(ToolSwitchType.File) - { - DisplayName = "Build ID File", - Description = "set the build ID from an existing file", - ArgumentRelationList = new ArrayList(), - Name = BUILD_ID_FILE, - SwitchValue = "-buildIdFile ", - Value = value - }; - base.ActiveToolSwitches.Add(BUILD_ID_FILE, switch2); - base.AddActiveSwitchToolValue(switch2); - } - } - - /// - /// Getter/Setter for DevMode property - /// - public virtual bool DevMode - { - get - { - return (base.IsPropertySet(DEV_MODE) && base.ActiveToolSwitches[DEV_MODE].BooleanValue); - } - set - { - base.ActiveToolSwitches.Remove(DEV_MODE); - ToolSwitch switch2 = new ToolSwitch(ToolSwitchType.Boolean) - { - Name = DEV_MODE, - DisplayName = "Development mode", - Description = "Package in development mode ( -devMode)", - ArgumentRelationList = new ArrayList(), - SwitchValue = "-devMode", - BooleanValue = value - }; - base.ActiveToolSwitches.Add(DEV_MODE, switch2); - base.AddActiveSwitchToolValue(switch2); - } - } - - /// - /// Getter/Setter for PackageManifestOnly property - /// - public virtual bool PackageManifestOnly - { - get - { - return (base.IsPropertySet(PACKAGE_MANIFEST_ONLY) && base.ActiveToolSwitches[PACKAGE_MANIFEST_ONLY].BooleanValue); - } - set - { - base.ActiveToolSwitches.Remove(PACKAGE_MANIFEST_ONLY); - ToolSwitch switch2 = new ToolSwitch(ToolSwitchType.Boolean) - { - DisplayName = "Package manifest only.", - Description = "Package only the manifest file ( -packageManifest)", - ArgumentRelationList = new ArrayList(), - SwitchValue = "-packageManifest -listManifest ", - Name = PACKAGE_MANIFEST_ONLY, - BooleanValue = value - }; - base.ActiveToolSwitches.Add(PACKAGE_MANIFEST_ONLY, switch2); - base.AddActiveSwitchToolValue(switch2); - } - } - - /// - /// Getter/Setter for GetTargetFileMap property - /// - public virtual bool GetTargetFileMap - { - get - { - return (base.IsPropertySet(GET_TARGET_FILE_MAP) && base.ActiveToolSwitches[GET_TARGET_FILE_MAP].BooleanValue); - } - set - { - base.ActiveToolSwitches.Remove(GET_TARGET_FILE_MAP); - ToolSwitch toolSwitch = new ToolSwitch(ToolSwitchType.Boolean) - { - Name = GET_TARGET_FILE_MAP, - DisplayName = "Get target file map", - Description = "Get the mapping between local and target files with the -targetFileMap option.", - ArgumentRelationList = new ArrayList(), - SwitchValue = "-targetFileMap ", - BooleanValue = value - }; - base.ActiveToolSwitches.Add(GET_TARGET_FILE_MAP, toolSwitch); - base.AddActiveSwitchToolValue(toolSwitch); - } - } - - /// - /// Getter/Setter for DebugToken property - /// - public virtual string DebugToken - { - get - { - if (base.IsPropertySet(DEBUG_TOKEN)) - { - return base.ActiveToolSwitches[DEBUG_TOKEN].Value; - } - return null; - } - set - { - base.ActiveToolSwitches.Remove(DEBUG_TOKEN); - ToolSwitch switch2 = new ToolSwitch(ToolSwitchType.Directory) - { - DisplayName = "Debug Token", - Description = "Use debug token to generate author and author id ( -debugToken only usable with -devMode)", - ArgumentRelationList = new ArrayList(), - SwitchValue = "-debugToken ", - Value = value - }; - switch2.Parents.AddLast(DEV_MODE); - base.ActiveToolSwitches.Add(DEBUG_TOKEN, switch2); - base.AddActiveSwitchToolValue(switch2); - } - } - - /// - /// Getter/Setter for TrackerLogDirectory property. - /// - public virtual string TrackerLogDirectory - { - get - { - if (base.IsPropertySet(TRACKER_LOG_DIRECTORY)) - { - return base.ActiveToolSwitches[TRACKER_LOG_DIRECTORY].Value; - } - return null; - } - set - { - base.ActiveToolSwitches.Remove(TRACKER_LOG_DIRECTORY); - ToolSwitch switch2 = new ToolSwitch(ToolSwitchType.Directory) - { - DisplayName = "Tracker Log Directory", - Description = "Tracker Log Directory.", - ArgumentRelationList = new ArrayList(), - Value = VCToolTask.EnsureTrailingSlash(value) - }; - base.ActiveToolSwitches.Add(TRACKER_LOG_DIRECTORY, switch2); - base.AddActiveSwitchToolValue(switch2); - } - } - - #endregion properties - - /// - /// Getter for the TrackedInputFiles - /// - protected override Microsoft.Build.Framework.ITaskItem[] TrackedInputFiles - { - get - { - return Sources; - } - } - - /// - /// Getter for the TrackerIntermediateDirectory - /// - protected override string TrackerIntermediateDirectory - { - get - { - if (this.TrackerLogDirectory != null) - { - return this.TrackerLogDirectory; - } - return string.Empty; - } - } - - /// - /// Getter/Seter for the Sources property - /// - [Required] - public virtual ITaskItem[] Sources - { - get - { - if (base.IsPropertySet(SOURCES)) - { - return base.ActiveToolSwitches[SOURCES].TaskItemArray; - } - return null; - } - set - { - base.ActiveToolSwitches.Remove(SOURCES); - ToolSwitch switch2 = new ToolSwitch(ToolSwitchType.ITaskItemArray) - { - Separator = " ", - Required = true, - ArgumentRelationList = new ArrayList(), - TaskItemArray = value - }; - base.ActiveToolSwitches.Add(SOURCES, switch2); - base.AddActiveSwitchToolValue(switch2); - } - } - - /// - /// Getter/Setter for the Configuration property - /// - [Required] - public string Configuration - { - get; - set; - } - - /// - /// Getter/Setter for the Platform property - /// - [Required] - public string Platform - { - get; - set; - } - } -} diff --git a/src_vs2012/VSNDK.Tasks/BBSigner.cs b/src_vs2012/VSNDK.Tasks/BBSigner.cs deleted file mode 100644 index 5a1cc04a..00000000 --- a/src_vs2012/VSNDK.Tasks/BBSigner.cs +++ /dev/null @@ -1,411 +0,0 @@ -//* Copyright 2010-2011 Research In Motion Limited. -//* -//* Licensed under the Apache License, Version 2.0 (the "License"); -//* you may not use this file except in compliance with the License. -//* You may obtain a copy of the License at -//* -//* http://www.apache.org/licenses/LICENSE-2.0 -//* -//* Unless required by applicable law or agreed to in writing, software -//* distributed under the License is distributed on an "AS IS" BASIS, -//* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//* See the License for the specific language governing permissions and -//* limitations under the License. - -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Reflection; -using System.Resources; -using Microsoft.Build.CPPTasks; -using System.Collections; -using Microsoft.Build.Framework; -using System.IO; -using Microsoft.Build.Utilities; -using System.Security.Cryptography; - -namespace VSNDK.Tasks -{ - /// - /// MSBuild Task responsible for the signing of the BlackBerry Bar files - /// for deploy to a secure device not in development mode. - /// - public class BBSigner : TrackedVCToolTask - { - #region Member Variables and Constants Declaration - protected ArrayList switchOrderList; - private const string REGISTER = "Register"; - private const string KEYSTOREPASSWORD = "KeyStorePassword"; - private const string CSJPIN = "CSJPin"; - private const string CSJFILES = "Signing_AND_DEBUGTOKEN_CSJFiles"; - private const string SOURCES = "Sources"; - private const string OUTPUT_FILE = "OutputFiles"; - private const string TRACKER_LOG_DIRECTORY = "TrackerLogDirectory"; - #endregion - - /// - /// BBSigner Constructor Fuction - /// - public BBSigner() - : base(new ResourceManager("VSNDK.Tasks.Properties.Resources", Assembly.GetExecutingAssembly())) - { - this.switchOrderList = new ArrayList(); - this.switchOrderList.Add("AlwaysAppend"); - this.switchOrderList.Add(REGISTER); - this.switchOrderList.Add(CSJPIN); - this.switchOrderList.Add(KEYSTOREPASSWORD); - this.switchOrderList.Add(CSJFILES); - this.switchOrderList.Add(OUTPUT_FILE); - this.switchOrderList.Add(TRACKER_LOG_DIRECTORY); - } - - - #region overrides - - /// - /// Return the GetResposeFile Switch - /// Note: don't use response file for msbuild because it is removed before qcc to run GCC compiler - /// - /// - /// - protected override string GetResponseFileSwitch(string responseFilePath) - { - return string.Empty; - } - - /// - /// Return the command line argument string - /// Note: pass the response file to command line commands - /// - /// - protected override string GenerateCommandLineCommands() - { - return GenerateResponseFileCommands(); - } - - /// - /// Return the Response File Commands string. - /// - /// - protected override string GenerateResponseFileCommands() - { - if (!Register) - { - switchOrderList.Remove(REGISTER); - switchOrderList.Remove(CSJPIN); - switchOrderList.Remove(CSJFILES); - } - else - switchOrderList.Remove(OUTPUT_FILE); - return base.GenerateResponseFileCommands(); - } - - /// - /// Getter for the SwitchOrderList property - /// - protected override ArrayList SwitchOrderList - { - get - { - return this.switchOrderList; - } - } - - /// - /// Getter for the CommandTLogName property - /// - protected override string CommandTLogName - { - get { return "BBSigner.command.1.tlog"; } - } - - /// - /// Getter for the ReadTLogNames property - /// - protected override string[] ReadTLogNames - { - get { return new string[] { "BBSigner.read.1.tlog", "BBSigner.*.read.1.tlog" }; } - } - protected override string[] WriteTLogNames - { - get - { - return new string[] { "BBSigner.write.1.tlog", "BBSigner.*.write.1.tlog" }; - } - } - - /// - /// Getter for the ToolName property - /// - protected override string ToolName - { - get - { - return ToolExe; - } - } - - /// - /// Getter for the TrackerIntermediateDirectory property - /// - protected override string TrackerIntermediateDirectory - { - get - { - if (this.TrackerLogDirectory != null) - { - return this.TrackerLogDirectory; - } - return string.Empty; - } - } - - /// - /// Getter for the TrackedInputFiles property - /// - protected override ITaskItem[] TrackedInputFiles - { - get { return Sources; } - } - - #endregion overrides - - #region properties - - /// - /// Getter/Setter for the Register property - /// - [Required] - public virtual bool Register - { - get - { - return (base.IsPropertySet(REGISTER) && base.ActiveToolSwitches[REGISTER].BooleanValue); - } - set - { - base.ActiveToolSwitches.Remove(REGISTER); - ToolSwitch switch2 = new ToolSwitch(ToolSwitchType.Boolean) - { - DisplayName = "Register", - Description = "Register the computer with CSJ file to sign application( -register)", - ArgumentRelationList = new ArrayList(), - SwitchValue = "-register", - Name = REGISTER, - BooleanValue = value - }; - base.ActiveToolSwitches.Add(REGISTER, switch2); - base.AddActiveSwitchToolValue(switch2); - } - } - - /// - /// Getter/Setter for the Sources property - /// - [Required] - public virtual ITaskItem[] Sources - { - get - { - if (base.IsPropertySet(SOURCES)) - { - return base.ActiveToolSwitches[SOURCES].TaskItemArray; - } - return null; - } - set - { - base.ActiveToolSwitches.Remove(SOURCES); - ToolSwitch switch2 = new ToolSwitch(ToolSwitchType.ITaskItemArray) - { - Separator = " ", - Required = true, - ArgumentRelationList = new ArrayList(), - TaskItemArray = value - }; - base.ActiveToolSwitches.Add(SOURCES, switch2); - base.AddActiveSwitchToolValue(switch2); - } - } - - /// - /// Getter/Setter for the CSJFiles property - /// - public virtual ITaskItem[] CSJFiles - { - get - { - if (base.IsPropertySet(CSJFILES)) - { - return base.ActiveToolSwitches[CSJFILES].TaskItemArray; - } - return null; - } - set - { - base.ActiveToolSwitches.Remove(CSJFILES); - ToolSwitch switch2 = new ToolSwitch(ToolSwitchType.ITaskItemArray) - { - Separator = " ", - Required = true, - ArgumentRelationList = new ArrayList(), - Name = CSJFILES, - TaskItemArray = value - }; - base.ActiveToolSwitches.Add(CSJFILES, switch2); - base.AddActiveSwitchToolValue(switch2); - } - } - - /// - /// Getter/Setter for the KeyStorePassword property - /// - public virtual string KeyStorePassword - { - get - { - if (base.IsPropertySet(KEYSTOREPASSWORD)) - { - return base.ActiveToolSwitches[KEYSTOREPASSWORD].Value; - } - return null; - } - set - { - base.ActiveToolSwitches.Remove(KEYSTOREPASSWORD); - - ToolSwitch switch2 = new ToolSwitch(ToolSwitchType.File) - { - DisplayName = "Keystore password", - Description = "The -storepass option specifies the password.", - ArgumentRelationList = new ArrayList(), - SwitchValue = "-storepass ", - Name = KEYSTOREPASSWORD, - Value = Decrypt(value) - }; - - base.ActiveToolSwitches.Add(KEYSTOREPASSWORD, switch2); - base.AddActiveSwitchToolValue(switch2); - } - } - - /// - /// Decrypts a given string. - /// - /// A base64 encoded string that was created - /// through the or - /// extension methods. - /// The decrypted string. - /// Keep in mind that the decrypted string remains in memory - /// and makes your application vulnerable per se. If runtime protection - /// is essential, should be used. - /// If - /// is a null reference. - public string Decrypt(string cipher) - { - if (cipher == null) throw new ArgumentNullException("cipher"); - - //parse base64 string - byte[] data = Convert.FromBase64String(cipher); - - //decrypt data - byte[] decrypted = ProtectedData.Unprotect(data, null, DataProtectionScope.LocalMachine); - - return Encoding.Unicode.GetString(decrypted); - } - - /// - /// Getter/Setter for the CSJPin property - /// - public virtual string CSJPin - { - get - { - if (base.IsPropertySet(CSJPIN)) - { - return base.ActiveToolSwitches[CSJPIN].Value; - } - return null; - } - set - { - base.ActiveToolSwitches.Remove(CSJPIN); - ToolSwitch switch2 = new ToolSwitch(ToolSwitchType.File) - { - DisplayName = "Keystore password", - Description = "The -csjpin option specifies the password.", - ArgumentRelationList = new ArrayList(), - SwitchValue = "-csjpin ", - Name = CSJPIN, - Value = value - }; - base.ActiveToolSwitches.Add(CSJPIN, switch2); - base.AddActiveSwitchToolValue(switch2); - } - } - - /// - /// Getter/Setter for the OutputFile property - /// - [Required] - [Output] - public virtual string OutputFile - { - get - { - if (base.IsPropertySet(OUTPUT_FILE)) - { - return base.ActiveToolSwitches[OUTPUT_FILE].Value; - } - return null; - } - set - { - base.ActiveToolSwitches.Remove(OUTPUT_FILE); - ToolSwitch switch2 = new ToolSwitch(ToolSwitchType.File) - { - DisplayName = "Output bar file name to be signed", - Description = "Specifies the bar file name to be signed", - ArgumentRelationList = new ArrayList(), - Name = OUTPUT_FILE, - Value = value - }; - base.ActiveToolSwitches.Add(OUTPUT_FILE, switch2); - base.AddActiveSwitchToolValue(switch2); - } - } - - /// - /// Getter/Setter for the TrackerLogDirectory property - /// - public virtual string TrackerLogDirectory - { - get - { - if (base.IsPropertySet(TRACKER_LOG_DIRECTORY)) - { - return base.ActiveToolSwitches[TRACKER_LOG_DIRECTORY].Value; - } - return null; - } - set - { - base.ActiveToolSwitches.Remove(TRACKER_LOG_DIRECTORY); - ToolSwitch switch2 = new ToolSwitch(ToolSwitchType.Directory) - { - DisplayName = "Tracker Log Directory", - Description = "Tracker Log Directory.", - ArgumentRelationList = new ArrayList(), - Value = VCToolTask.EnsureTrailingSlash(value) - }; - base.ActiveToolSwitches.Add(TRACKER_LOG_DIRECTORY, switch2); - base.AddActiveSwitchToolValue(switch2); - } - } - - #endregion properties - - } -} - \ No newline at end of file diff --git a/src_vs2012/VSNDK.Tasks/BarDescriptor/Parser.cs b/src_vs2012/VSNDK.Tasks/BarDescriptor/Parser.cs deleted file mode 100644 index a3ed76de..00000000 --- a/src_vs2012/VSNDK.Tasks/BarDescriptor/Parser.cs +++ /dev/null @@ -1,54 +0,0 @@ -//* Copyright 2010-2011 Research In Motion Limited. -//* -//* Licensed under the Apache License, Version 2.0 (the "License"); -//* you may not use this file except in compliance with the License. -//* You may obtain a copy of the License at -//* -//* http://www.apache.org/licenses/LICENSE-2.0 -//* -//* Unless required by applicable law or agreed to in writing, software -//* distributed under the License is distributed on an "AS IS" BASIS, -//* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//* See the License for the specific language governing permissions and -//* limitations under the License. - -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.IO; -using System.Xml; -using System.Xml.Serialization; -using System.Diagnostics; - -namespace VSNDK.Tasks.BarDescriptor -{ - public class Parser - { - /// - /// Helper function to to deserialize the bar-descriptor.xml file for read. - /// - /// Path to the bar-descriptor.xml file - /// BarDescriptor.qnx object containing the deserialized data from the bar-descriptor. - public static BarDescriptor.qnx Load(string filename) - { - if (!string.IsNullOrEmpty(filename)) - { - try - { - using (FileStream fs = new FileStream(filename, FileMode.Open, FileAccess.Read)) - { - XmlTextReader reader = new XmlTextReader(fs); - XmlSerializer serializer = new XmlSerializer(typeof(BarDescriptor.qnx)); - return serializer.Deserialize(reader) as BarDescriptor.qnx; - } - } - catch (Exception ex) - { - Debug.WriteLine(ex.Message); - } - } - return null; - } - } -} diff --git a/src_vs2012/VSNDK.Tasks/BarDescriptor/Schema/bar-descriptor.cs b/src_vs2012/VSNDK.Tasks/BarDescriptor/Schema/bar-descriptor.cs deleted file mode 100644 index 75f4b3a0..00000000 --- a/src_vs2012/VSNDK.Tasks/BarDescriptor/Schema/bar-descriptor.cs +++ /dev/null @@ -1,459 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// Runtime Version:4.0.30319.239 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -// -// This source code was auto-generated by xsd, Version=4.0.30319.1. -// -namespace VSNDK.Tasks.BarDescriptor { - using System.Xml.Serialization; - - - /// - [System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.0.30319.1")] - [System.SerializableAttribute()] - [System.Diagnostics.DebuggerStepThroughAttribute()] - [System.ComponentModel.DesignerCategoryAttribute("code")] - [System.Xml.Serialization.XmlTypeAttribute(AnonymousType=true, Namespace="http://www.qnx.com/schemas/application/1.0")] - [System.Xml.Serialization.XmlRootAttribute(Namespace="http://www.qnx.com/schemas/application/1.0", IsNullable=true)] - public partial class asset { - - private string pathField; - - private string entryField; - - private string typeField; - - private string valueField; - - /// - [System.Xml.Serialization.XmlAttributeAttribute()] - public string path { - get { - return this.pathField; - } - set { - this.pathField = value; - } - } - - /// - [System.Xml.Serialization.XmlAttributeAttribute()] - public string entry { - get { - return this.entryField; - } - set { - this.entryField = value; - } - } - - /// - [System.Xml.Serialization.XmlAttributeAttribute()] - public string type { - get { - return this.typeField; - } - set { - this.typeField = value; - } - } - - /// - [System.Xml.Serialization.XmlTextAttribute()] - public string Value { - get { - return this.valueField; - } - set { - this.valueField = value; - } - } - } - - /// - [System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.0.30319.1")] - [System.SerializableAttribute()] - [System.Diagnostics.DebuggerStepThroughAttribute()] - [System.ComponentModel.DesignerCategoryAttribute("code")] - [System.Xml.Serialization.XmlTypeAttribute(AnonymousType=true, Namespace="http://www.qnx.com/schemas/application/1.0")] - [System.Xml.Serialization.XmlRootAttribute(Namespace="http://www.qnx.com/schemas/application/1.0", IsNullable=false)] - public partial class qnx { - - private string idField; - - private string nameField; - - private string versionNumberField; - - private string buildIdField; - - private string descriptionField; - - private string authorField; - - private string categoryField; - - private qnxInitialWindow[] initialWindowField; - - private asset[] assetField; - - private qnxConfiguration[] configurationField; - - private qnxIcon[] iconField; - - private qnxAction[] actionField; - - private qnxEnv[] envField; - - /// - public string id { - get { - return this.idField; - } - set { - this.idField = value; - } - } - - /// - public string name { - get { - return this.nameField; - } - set { - this.nameField = value; - } - } - - /// - public string versionNumber { - get { - return this.versionNumberField; - } - set { - this.versionNumberField = value; - } - } - - /// - public string buildId { - get { - return this.buildIdField; - } - set { - this.buildIdField = value; - } - } - - /// - public string description { - get { - return this.descriptionField; - } - set { - this.descriptionField = value; - } - } - - /// - public string author { - get { - return this.authorField; - } - set { - this.authorField = value; - } - } - - /// - public string category { - get { - return this.categoryField; - } - set { - this.categoryField = value; - } - } - - /// - [System.Xml.Serialization.XmlElementAttribute("initialWindow")] - public qnxInitialWindow[] initialWindows { - get { - return this.initialWindowField; - } - set { - this.initialWindowField = value; - } - } - - /// - [System.Xml.Serialization.XmlElementAttribute("asset", IsNullable=true)] - public asset[] assets { - get { - return this.assetField; - } - set { - this.assetField = value; - } - } - - /// - [System.Xml.Serialization.XmlElementAttribute("configuration")] - public qnxConfiguration[] configurations { - get { - return this.configurationField; - } - set { - this.configurationField = value; - } - } - - /// - [System.Xml.Serialization.XmlElementAttribute("icon")] - public qnxIcon[] icons { - get { - return this.iconField; - } - set { - this.iconField = value; - } - } - - /// - [System.Xml.Serialization.XmlElementAttribute("action", IsNullable=true)] - public qnxAction[] actions { - get { - return this.actionField; - } - set { - this.actionField = value; - } - } - - /// - [System.Xml.Serialization.XmlElementAttribute("env")] - public qnxEnv[] envs { - get { - return this.envField; - } - set { - this.envField = value; - } - } - } - - /// - [System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.0.30319.1")] - [System.SerializableAttribute()] - [System.Diagnostics.DebuggerStepThroughAttribute()] - [System.ComponentModel.DesignerCategoryAttribute("code")] - [System.Xml.Serialization.XmlTypeAttribute(AnonymousType=true, Namespace="http://www.qnx.com/schemas/application/1.0")] - public partial class qnxInitialWindow { - - private string aspectRatioField; - - private string autoOrientsField; - - private string systemChromeField; - - private string transparentField; - - /// - public string aspectRatio { - get { - return this.aspectRatioField; - } - set { - this.aspectRatioField = value; - } - } - - /// - public string autoOrients { - get { - return this.autoOrientsField; - } - set { - this.autoOrientsField = value; - } - } - - /// - public string systemChrome { - get { - return this.systemChromeField; - } - set { - this.systemChromeField = value; - } - } - - /// - public string transparent { - get { - return this.transparentField; - } - set { - this.transparentField = value; - } - } - } - - /// - [System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.0.30319.1")] - [System.SerializableAttribute()] - [System.Diagnostics.DebuggerStepThroughAttribute()] - [System.ComponentModel.DesignerCategoryAttribute("code")] - [System.Xml.Serialization.XmlTypeAttribute(AnonymousType=true, Namespace="http://www.qnx.com/schemas/application/1.0")] - public partial class qnxConfiguration { - - private string platformArchitectureField; - - private asset[] assetField; - - private string idField; - - private string nameField; - - /// - public string platformArchitecture { - get { - return this.platformArchitectureField; - } - set { - this.platformArchitectureField = value; - } - } - - /// - [System.Xml.Serialization.XmlElementAttribute("asset", IsNullable=true)] - public asset[] asset { - get { - return this.assetField; - } - set { - this.assetField = value; - } - } - - /// - [System.Xml.Serialization.XmlAttributeAttribute()] - public string id { - get { - return this.idField; - } - set { - this.idField = value; - } - } - - /// - [System.Xml.Serialization.XmlAttributeAttribute()] - public string name { - get { - return this.nameField; - } - set { - this.nameField = value; - } - } - } - - /// - [System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.0.30319.1")] - [System.SerializableAttribute()] - [System.Diagnostics.DebuggerStepThroughAttribute()] - [System.ComponentModel.DesignerCategoryAttribute("code")] - [System.Xml.Serialization.XmlTypeAttribute(AnonymousType=true, Namespace="http://www.qnx.com/schemas/application/1.0")] - public partial class qnxIcon { - - private string imageField; - - /// - public string image { - get { - return this.imageField; - } - set { - this.imageField = value; - } - } - } - - /// - [System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.0.30319.1")] - [System.SerializableAttribute()] - [System.Diagnostics.DebuggerStepThroughAttribute()] - [System.ComponentModel.DesignerCategoryAttribute("code")] - [System.Xml.Serialization.XmlTypeAttribute(AnonymousType=true, Namespace="http://www.qnx.com/schemas/application/1.0")] - public partial class qnxAction { - - private string systemField; - - private string valueField; - - /// - [System.Xml.Serialization.XmlAttributeAttribute()] - public string system { - get { - return this.systemField; - } - set { - this.systemField = value; - } - } - - /// - [System.Xml.Serialization.XmlTextAttribute()] - public string Value { - get { - return this.valueField; - } - set { - this.valueField = value; - } - } - } - - /// - [System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.0.30319.1")] - [System.SerializableAttribute()] - [System.Diagnostics.DebuggerStepThroughAttribute()] - [System.ComponentModel.DesignerCategoryAttribute("code")] - [System.Xml.Serialization.XmlTypeAttribute(AnonymousType=true, Namespace="http://www.qnx.com/schemas/application/1.0")] - public partial class qnxEnv { - - private string varField; - - private string valueField; - - /// - [System.Xml.Serialization.XmlAttributeAttribute()] - public string var { - get { - return this.varField; - } - set { - this.varField = value; - } - } - - /// - [System.Xml.Serialization.XmlAttributeAttribute()] - public string value { - get { - return this.valueField; - } - set { - this.valueField = value; - } - } - } -} diff --git a/src_vs2012/VSNDK.Tasks/BarDescriptor/Schema/bar-descriptor.xml b/src_vs2012/VSNDK.Tasks/BarDescriptor/Schema/bar-descriptor.xml deleted file mode 100644 index 3255bb8c..00000000 --- a/src_vs2012/VSNDK.Tasks/BarDescriptor/Schema/bar-descriptor.xml +++ /dev/null @@ -1,110 +0,0 @@ - - - - - - - com.rim.sample00_mesh - - - Mesh - - - 1.0.0 - - - 1 - - - - - - Mesh Sample - - - - - - BlackBerry - - - - - - landscape - false - none - false - - - - core.games - - res - res/shaders/diffuse-specular.fsh - res/shaders/diffuse-specular.vsh - - - armle-v7 - sample00-mesh - - - armle-v7 - sample00-mesh - - - armle-v7 - sample00-mesh - - - armle-v7 - sample00-mesh - - - x86 - sample00-mesh - - - x86 - sample00-mesh - - - x86 - sample00-mesh - - - - - - - - - - - run_native - - - - - - - - - - - - - - - - diff --git a/src_vs2012/VSNDK.Tasks/BarDescriptor/Schema/bar-descriptor.xsd b/src_vs2012/VSNDK.Tasks/BarDescriptor/Schema/bar-descriptor.xsd deleted file mode 100644 index 5601be8a..00000000 --- a/src_vs2012/VSNDK.Tasks/BarDescriptor/Schema/bar-descriptor.xsd +++ /dev/null @@ -1,72 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src_vs2012/VSNDK.Tasks/BlackBerry/Microsoft.Cpp.BlackBerry.Packager.bak b/src_vs2012/VSNDK.Tasks/BlackBerry/Microsoft.Cpp.BlackBerry.Packager.bak deleted file mode 100644 index 9b820843..00000000 --- a/src_vs2012/VSNDK.Tasks/BlackBerry/Microsoft.Cpp.BlackBerry.Packager.bak +++ /dev/null @@ -1,422 +0,0 @@ - - - - - - - - - - - - - - - - - - true - - - - true - - - - true - - - - - $(BuildLinkTargets); - - $(CommonBuildOnlyTargets);$(BeforeBuildLinkTargets);$(BuildLinkTargets);$(AfterBuildLinkTargets) - - - - - - - - - - - - - - - - - - $([System.IO.Path]::Combine($(ProjectDir),$(OutDir)$(LibPrefix)$(TargetName)$(TargetExt))) - $([System.IO.Path]::GetFileName('$(TargetPath)')) - $([System.IO.Path]::GetDirectoryName('$(TargetPath)')) - $(LibPrefix)$(ProjectName) - false - false - - - - - - - - - - - - - - - - - - - - - - - false - true - $(BuildBarToolPath) - $(OptimizedDeployToolPath) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - false - true - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src_vs2012/VSNDK.Tasks/BlackBerry/Microsoft.Cpp.BlackBerry.Packager.targets b/src_vs2012/VSNDK.Tasks/BlackBerry/Microsoft.Cpp.BlackBerry.Packager.targets deleted file mode 100644 index b37a5e2c..00000000 --- a/src_vs2012/VSNDK.Tasks/BlackBerry/Microsoft.Cpp.BlackBerry.Packager.targets +++ /dev/null @@ -1,398 +0,0 @@ - - - - - - - - - - - - - - - - - true - - - - true - - - - true - - - - - $(BuildLinkTargets); - - $(CommonBuildOnlyTargets);$(BeforeBuildLinkTargets);$(BuildLinkTargets);$(AfterBuildLinkTargets) - - - - - - - - - - - - - - - - - - $([System.IO.Path]::Combine($(ProjectDir),$(OutDir)$(LibPrefix)$(TargetName)$(TargetExt))) - $([System.IO.Path]::GetFileName('$(TargetPath)')) - $([System.IO.Path]::GetDirectoryName('$(TargetPath)')) - $(LibPrefix)$(ProjectName) - false - false - - - - - - - - - - - - - - - - - - - - - - - false - true - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - false - true - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src_vs2012/VSNDK.Tasks/BlackBerry/Microsoft.Cpp.BlackBerry.bak b/src_vs2012/VSNDK.Tasks/BlackBerry/Microsoft.Cpp.BlackBerry.bak deleted file mode 100644 index 5d62f2b8..00000000 --- a/src_vs2012/VSNDK.Tasks/BlackBerry/Microsoft.Cpp.BlackBerry.bak +++ /dev/null @@ -1,146 +0,0 @@ - - - - - - - - - - QCC;__QCC__;__QNX__ - false - - - - - true - false - - - - - true - .a - lib - - - - true - - - - - - true - .so - true - lib - - - - - $([System.IO.Path]::Combine($(ProjectDir),$(OutDir)$(LibPrefix)$(TargetName)$(TargetExt))) - $([System.IO.Path]::GetFileName('$(TargetPath)')) - $([System.IO.Path]::GetDirectoryName('$(TargetPath)')) - $(LibPrefix)$(ProjectName) - - - - - - $(IntDir)%(FileName).o - $(QccDefines) - WIN32;_WINDOWS - NormalWarnings - false - false - - true - - false - false - Default - true - - - - - - - O2 - true - - - - - - - O2 - false - - - - - - - $(OutDir)$(LibPrefix)$(TargetName)$(TargetExt) - $(TargetPath) - - - false - false - true - false - true - Default - - - - - - - $(OutDir)$(LibPrefix)$(TargetName)$(TargetExt) - false - - - - - - - $(IntDir) - true - $(OutDir)$(TargetName).bar - true - false - bar-debug - bar - true - false - None - Install - false - 1 - - - - - 169.254.0.1 - - bar-descriptor.xml - $(AppData) - - - - diff --git a/src_vs2012/VSNDK.Tasks/BlackBerry/Microsoft.Cpp.BlackBerry.default.bak b/src_vs2012/VSNDK.Tasks/BlackBerry/Microsoft.Cpp.BlackBerry.default.bak deleted file mode 100644 index 40c79c30..00000000 --- a/src_vs2012/VSNDK.Tasks/BlackBerry/Microsoft.Cpp.BlackBerry.default.bak +++ /dev/null @@ -1,23 +0,0 @@ - - - - - BlackBerry - qcc - - $(IntermediateOutputPath) - Device-$(Configuration)\ - Device-$(Configuration)\ - $(IntDir) - - diff --git a/src_vs2012/VSNDK.Tasks/BlackBerry/Microsoft.Cpp.BlackBerry.default.props b/src_vs2012/VSNDK.Tasks/BlackBerry/Microsoft.Cpp.BlackBerry.default.props deleted file mode 100644 index 54e39098..00000000 --- a/src_vs2012/VSNDK.Tasks/BlackBerry/Microsoft.Cpp.BlackBerry.default.props +++ /dev/null @@ -1,26 +0,0 @@ - - - - - BlackBerry - qcc - - $(IntermediateOutputPath) - Device-$(Configuration)\ - Device-$(Configuration)\ - $(IntDir) - - - - - diff --git a/src_vs2012/VSNDK.Tasks/BlackBerry/Microsoft.Cpp.BlackBerry.props b/src_vs2012/VSNDK.Tasks/BlackBerry/Microsoft.Cpp.BlackBerry.props deleted file mode 100644 index 5753b774..00000000 --- a/src_vs2012/VSNDK.Tasks/BlackBerry/Microsoft.Cpp.BlackBerry.props +++ /dev/null @@ -1,147 +0,0 @@ - - - - - - - - - - QCC;__QCC__;__QNX__ - false - - - - - true - false - - - - - true - .a - lib - - - - true - - - - - - true - .so - true - lib - - - - - $([System.IO.Path]::Combine($(ProjectDir),$(OutDir)$(LibPrefix)$(TargetName)$(TargetExt))) - $(TargetPath.TrimEnd('\')) - $([System.IO.Path]::GetFileName('$(TargetPath)')) - $([System.IO.Path]::GetDirectoryName('$(TargetPath)')) - $(LibPrefix)$(ProjectName) - - - - - - $(IntDir)%(FileName).o - $(QccDefines) - WIN32;_WINDOWS - NormalWarnings - false - false - - true - - false - false - Default - true - - - - - - - O2 - true - - - - - - - O2 - false - - - - - - - $(OutDir)$(LibPrefix)$(TargetName)$(TargetExt) - $(TargetPath) - - - false - false - true - false - true - Default - - - - - - - $(OutDir)$(LibPrefix)$(TargetName)$(TargetExt) - false - - - - - - - $(IntDir) - true - $(OutDir)$(TargetName).bar - true - false - bar-debug - bar - true - false - None - Install - false - 1 - - - - - 169.254.0.1 - - bar-descriptor.xml - $(AppData) - - - - diff --git a/src_vs2012/VSNDK.Tasks/BlackBerry/Microsoft.Cpp.BlackBerry.targets b/src_vs2012/VSNDK.Tasks/BlackBerry/Microsoft.Cpp.BlackBerry.targets deleted file mode 100644 index 120f45ab..00000000 --- a/src_vs2012/VSNDK.Tasks/BlackBerry/Microsoft.Cpp.BlackBerry.targets +++ /dev/null @@ -1,192 +0,0 @@ - - - - - - - - - - - - - - - - true - - - - - - - CompileAsC - CompileAsCpp - false - - - - - - - $(DefaultToolArchitecture) - - - - - - - - - - - - - - - - - - false - - - - - $(DefaultToolArchitecture) - - - - - - - - - - - - - false - false - true - $(DefaultToolArchitecture) - true - - - - - - CompileAsC - CompileAsCpp - - - - - - - - - - - - - - - $(CleanDependsOn); - MakeClean; - - - - - - - - - - - - PlatformPrepareForBuild;$(PrepareForBuildDependsOn) - PlatformPrepareForBuild;$(PrepareForBuildDependsOn) - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src_vs2012/VSNDK.Tasks/BlackBerry/Microsoft.CppBuild.BlackBerry.targets b/src_vs2012/VSNDK.Tasks/BlackBerry/Microsoft.CppBuild.BlackBerry.targets deleted file mode 100644 index 196ff386..00000000 --- a/src_vs2012/VSNDK.Tasks/BlackBerry/Microsoft.CppBuild.BlackBerry.targets +++ /dev/null @@ -1,93 +0,0 @@ - - - - - - - false - false - false - - - - - - - - - - - - - - - - - - PropertySheet - - - - - - - - - - - - - - - - Project - - - PropertySheet - - - - - - - - - - - - - - - - - - - - - diff --git a/src_vs2012/VSNDK.Tasks/BlackBerry/Rules/debugger_ndk.xml b/src_vs2012/VSNDK.Tasks/BlackBerry/Rules/debugger_ndk.xml deleted file mode 100644 index cb53a5b7..00000000 --- a/src_vs2012/VSNDK.Tasks/BlackBerry/Rules/debugger_ndk.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - diff --git a/src_vs2012/VSNDK.Tasks/BlackBerry/Rules/ndkProjectItemsSchema.xml b/src_vs2012/VSNDK.Tasks/BlackBerry/Rules/ndkProjectItemsSchema.xml deleted file mode 100644 index ec753493..00000000 --- a/src_vs2012/VSNDK.Tasks/BlackBerry/Rules/ndkProjectItemsSchema.xml +++ /dev/null @@ -1,299 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src_vs2012/VSNDK.Tasks/BlackBerry/Rules/ndk_directories.xml b/src_vs2012/VSNDK.Tasks/BlackBerry/Rules/ndk_directories.xml deleted file mode 100644 index f86fda30..00000000 --- a/src_vs2012/VSNDK.Tasks/BlackBerry/Rules/ndk_directories.xml +++ /dev/null @@ -1,32 +0,0 @@ - - - - - - - - - - - - - - diff --git a/src_vs2012/VSNDK.Tasks/BlackBerry/Rules/ndk_general.xml b/src_vs2012/VSNDK.Tasks/BlackBerry/Rules/ndk_general.xml deleted file mode 100644 index 2b834759..00000000 --- a/src_vs2012/VSNDK.Tasks/BlackBerry/Rules/ndk_general.xml +++ /dev/null @@ -1,155 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src_vs2012/VSNDK.Tasks/BlackBerry/Rules/ndk_general_ps.xml b/src_vs2012/VSNDK.Tasks/BlackBerry/Rules/ndk_general_ps.xml deleted file mode 100644 index d7389bc0..00000000 --- a/src_vs2012/VSNDK.Tasks/BlackBerry/Rules/ndk_general_ps.xml +++ /dev/null @@ -1,75 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src_vs2012/VSNDK.Tasks/BlackBerry/Rules/packager.xml b/src_vs2012/VSNDK.Tasks/BlackBerry/Rules/packager.xml deleted file mode 100644 index 22e801e8..00000000 --- a/src_vs2012/VSNDK.Tasks/BlackBerry/Rules/packager.xml +++ /dev/null @@ -1,39 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src_vs2012/VSNDK.Tasks/BlackBerry/Rules/qcc_cl.xml b/src_vs2012/VSNDK.Tasks/BlackBerry/Rules/qcc_cl.xml deleted file mode 100644 index 90de68d9..00000000 --- a/src_vs2012/VSNDK.Tasks/BlackBerry/Rules/qcc_cl.xml +++ /dev/null @@ -1,196 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src_vs2012/VSNDK.Tasks/BlackBerry/Rules/qcc_lib.xml b/src_vs2012/VSNDK.Tasks/BlackBerry/Rules/qcc_lib.xml deleted file mode 100644 index aa53f443..00000000 --- a/src_vs2012/VSNDK.Tasks/BlackBerry/Rules/qcc_lib.xml +++ /dev/null @@ -1,154 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src_vs2012/VSNDK.Tasks/BlackBerry/Rules/qcc_link.xml b/src_vs2012/VSNDK.Tasks/BlackBerry/Rules/qcc_link.xml deleted file mode 100644 index c35bcb63..00000000 --- a/src_vs2012/VSNDK.Tasks/BlackBerry/Rules/qcc_link.xml +++ /dev/null @@ -1,390 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src_vs2012/VSNDK.Tasks/BlackBerrySimulator/Microsoft.Cpp.BlackBerrySimulator.Packager.bak b/src_vs2012/VSNDK.Tasks/BlackBerrySimulator/Microsoft.Cpp.BlackBerrySimulator.Packager.bak deleted file mode 100644 index daea93ed..00000000 --- a/src_vs2012/VSNDK.Tasks/BlackBerrySimulator/Microsoft.Cpp.BlackBerrySimulator.Packager.bak +++ /dev/null @@ -1,360 +0,0 @@ - - - - - - - - - - - - - - - - - - true - - - - true - - - - true - - - - - $(BuildLinkTargets); - - $(CommonBuildOnlyTargets);$(BeforeBuildLinkTargets);$(BuildLinkTargets);$(AfterBuildLinkTargets) - - - - - - - - - - - - - - - - - - $([System.IO.Path]::Combine($(ProjectDir),$(OutDir)$(LibPrefix)$(TargetName)$(TargetExt))) - $([System.IO.Path]::GetFileName('$(TargetPath)')) - $([System.IO.Path]::GetDirectoryName('$(TargetPath)')) - $(LibPrefix)$(ProjectName) - false - - - - - - - - - - - - - - - - - - - - - - false - true - $(BuildBarToolPath) - $(OptimizedDeployToolPath) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src_vs2012/VSNDK.Tasks/BlackBerrySimulator/Microsoft.Cpp.BlackBerrySimulator.Packager.targets b/src_vs2012/VSNDK.Tasks/BlackBerrySimulator/Microsoft.Cpp.BlackBerrySimulator.Packager.targets deleted file mode 100644 index 9799f837..00000000 --- a/src_vs2012/VSNDK.Tasks/BlackBerrySimulator/Microsoft.Cpp.BlackBerrySimulator.Packager.targets +++ /dev/null @@ -1,336 +0,0 @@ - - - - - - - - - - - - - - - - - true - - - - true - - - - true - - - - - $(BuildLinkTargets); - - $(CommonBuildOnlyTargets);$(BeforeBuildLinkTargets);$(BuildLinkTargets);$(AfterBuildLinkTargets) - - - - - - - - - - - - - - - - - - $([System.IO.Path]::Combine($(ProjectDir),$(OutDir)$(LibPrefix)$(TargetName)$(TargetExt))) - $([System.IO.Path]::GetFileName('$(TargetPath)')) - $([System.IO.Path]::GetDirectoryName('$(TargetPath)')) - $(LibPrefix)$(ProjectName) - false - - - - - - - - - - - - - - - - - - - - - - false - true - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src_vs2012/VSNDK.Tasks/BlackBerrySimulator/Microsoft.Cpp.BlackBerrySimulator.bak b/src_vs2012/VSNDK.Tasks/BlackBerrySimulator/Microsoft.Cpp.BlackBerrySimulator.bak deleted file mode 100644 index 4c83562c..00000000 --- a/src_vs2012/VSNDK.Tasks/BlackBerrySimulator/Microsoft.Cpp.BlackBerrySimulator.bak +++ /dev/null @@ -1,160 +0,0 @@ - - - - - - - - - - QCC;__QCC__;__QNX__ - false - - - - - true - false - - - - - true - .a - lib - - - - true - - - - - - true - .so - true - lib - - - - x86 - - - armle-v7 - - - - $(from_file) - gcc_ntox86 - gcc_ntoarmv7le - $(QNX_TARGET)\$(CPUVARDIR)\lib - - - - - $([System.IO.Path]::Combine($(ProjectDir),$(OutDir)$(LibPrefix)$(TargetName)$(TargetExt))) - $([System.IO.Path]::GetFileName('$(TargetPath)')) - $([System.IO.Path]::GetDirectoryName('$(TargetPath)')) - $(LibPrefix)$(ProjectName) - - - - - - $(IntDir)%(FileName).o - $(QccDefines) - WIN32;_WINDOWS - NormalWarnings - false - false - - true - - false - false - Default - true - - - - - - - O2 - true - - - - - - - O2 - false - - - - - - - $(OutDir)$(LibPrefix)$(TargetName)$(TargetExt) - $(TargetPath) - - - false - false - true - false - true - Default - - - - - - - $(OutDir)$(LibPrefix)$(TargetName)$(TargetExt) - false - - - - - - - $(IntDir) - true - $(OutDir)$(TargetName).bar - true - false - bar-debug - bar - true - false - None - Install - false - 1 - - - - - 169.254.0.1 - - bar-descriptor.xml - $(AppData) - - - - diff --git a/src_vs2012/VSNDK.Tasks/BlackBerrySimulator/Microsoft.Cpp.BlackBerrySimulator.default.bak b/src_vs2012/VSNDK.Tasks/BlackBerrySimulator/Microsoft.Cpp.BlackBerrySimulator.default.bak deleted file mode 100644 index 9f18d577..00000000 --- a/src_vs2012/VSNDK.Tasks/BlackBerrySimulator/Microsoft.Cpp.BlackBerrySimulator.default.bak +++ /dev/null @@ -1,23 +0,0 @@ - - - - - BlackBerrySimulator - qcc - - $(IntermediateOutputPath) - Simulator-$(Configuration)\ - Simulator-$(Configuration)\ - $(IntDir) - - diff --git a/src_vs2012/VSNDK.Tasks/BlackBerrySimulator/Microsoft.Cpp.BlackBerrySimulator.default.props b/src_vs2012/VSNDK.Tasks/BlackBerrySimulator/Microsoft.Cpp.BlackBerrySimulator.default.props deleted file mode 100644 index c633738b..00000000 --- a/src_vs2012/VSNDK.Tasks/BlackBerrySimulator/Microsoft.Cpp.BlackBerrySimulator.default.props +++ /dev/null @@ -1,26 +0,0 @@ - - - - - BlackBerrySimulator - qcc - - $(IntermediateOutputPath) - Simulator-$(Configuration)\ - Simulator-$(Configuration)\ - $(IntDir) - - - - - diff --git a/src_vs2012/VSNDK.Tasks/BlackBerrySimulator/Microsoft.Cpp.BlackBerrySimulator.props b/src_vs2012/VSNDK.Tasks/BlackBerrySimulator/Microsoft.Cpp.BlackBerrySimulator.props deleted file mode 100644 index 843193fd..00000000 --- a/src_vs2012/VSNDK.Tasks/BlackBerrySimulator/Microsoft.Cpp.BlackBerrySimulator.props +++ /dev/null @@ -1,161 +0,0 @@ - - - - - - - - - - QCC;__QCC__;__QNX__ - false - - - - - true - false - - - - - true - .a - lib - - - - true - - - - - - true - .so - true - lib - - - - x86 - - - armle-v7 - - - - $(from_file) - gcc_ntox86 - gcc_ntoarmv7le - $(QNX_TARGET)\$(CPUVARDIR)\lib - - - - - $([System.IO.Path]::Combine($(ProjectDir),$(OutDir)$(LibPrefix)$(TargetName)$(TargetExt))) - $(TargetPath.TrimEnd('\')) - $([System.IO.Path]::GetFileName('$(TargetPath)')) - $([System.IO.Path]::GetDirectoryName('$(TargetPath)')) - $(LibPrefix)$(ProjectName) - - - - - - $(IntDir)%(FileName).o - $(QccDefines) - WIN32;_WINDOWS - NormalWarnings - false - false - - true - - false - false - Default - true - - - - - - - O2 - true - - - - - - - O2 - false - - - - - - - $(OutDir)$(LibPrefix)$(TargetName)$(TargetExt) - $(TargetPath) - - - false - false - true - false - true - Default - - - - - - - $(OutDir)$(LibPrefix)$(TargetName)$(TargetExt) - false - - - - - - - $(IntDir) - true - $(OutDir)$(TargetName).bar - true - false - bar-debug - bar - true - false - None - Install - false - 1 - - - - - 169.254.0.1 - - bar-descriptor.xml - $(AppData) - - - - diff --git a/src_vs2012/VSNDK.Tasks/BlackBerrySimulator/Microsoft.Cpp.BlackBerrySimulator.targets b/src_vs2012/VSNDK.Tasks/BlackBerrySimulator/Microsoft.Cpp.BlackBerrySimulator.targets deleted file mode 100644 index 9a2d32f4..00000000 --- a/src_vs2012/VSNDK.Tasks/BlackBerrySimulator/Microsoft.Cpp.BlackBerrySimulator.targets +++ /dev/null @@ -1,199 +0,0 @@ - - - - - - - - - - - - - - - - true - - - - - - - CompileAsC - CompileAsCpp - false - - - - - - - $(DefaultToolArchitecture) - - - - - - - - - - - - - - - - - - false - - - - - $(DefaultToolArchitecture) - - - - - - - - - - - - - - - - false - false - true - $(DefaultToolArchitecture) - true - - - - - - CompileAsC - CompileAsCpp - - - - - - - - - - - - - - - - - - $(CleanDependsOn); - MakeClean; - - - - - - - - - - - - - PlatformPrepareForBuild;$(PrepareForBuildDependsOn) - PlatformPrepareForBuild;$(PrepareForBuildDependsOn) - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src_vs2012/VSNDK.Tasks/BlackBerrySimulator/Microsoft.CppBuild.BlackBerrySimulator.targets b/src_vs2012/VSNDK.Tasks/BlackBerrySimulator/Microsoft.CppBuild.BlackBerrySimulator.targets deleted file mode 100644 index 4ab9e314..00000000 --- a/src_vs2012/VSNDK.Tasks/BlackBerrySimulator/Microsoft.CppBuild.BlackBerrySimulator.targets +++ /dev/null @@ -1,93 +0,0 @@ - - - - - - - false - false - false - - - - - - - - - - - - - - - - - - PropertySheet - - - - - - - - - - - - - - - - Project - - - PropertySheet - - - - - - - - - - - - - - - - - - - - - diff --git a/src_vs2012/VSNDK.Tasks/BlackBerrySimulator/PlatformToolsets/qcc/Microsoft.Cpp.BlackBerrySimulator.qcc.bak b/src_vs2012/VSNDK.Tasks/BlackBerrySimulator/PlatformToolsets/qcc/Microsoft.Cpp.BlackBerrySimulator.qcc.bak deleted file mode 100644 index 5318dd09..00000000 --- a/src_vs2012/VSNDK.Tasks/BlackBerrySimulator/PlatformToolsets/qcc/Microsoft.Cpp.BlackBerrySimulator.qcc.bak +++ /dev/null @@ -1,75 +0,0 @@ - - - - - - - $(Registry:HKEY_CURRENT_USER\SOFTWARE\BlackBerry\BlackBerryVSPlugin@NDKTargetPath) - $(Registry:HKEY_CURRENT_USER\SOFTWARE\BlackBerry\BlackBerryVSPlugin@NDKHostPath) - $([System.IO.File]::ReadAllText("$(QNX_HOST)\etc\qcc\gcc\default").Substring(4,5)) - $(QNX_HOST)\etc\qcc\gcc - x86 - $(from_file) - gcc_ntox86 - $(QNX_TARGET)\$(CPUVARDIR)\lib - $(AppData) - $(AppDataPath)/BlackBerry/bbt_id_rsa.pub - $(AppDataPath)/BlackBerry/bbt_id_rsa - - - - qcc2.0 - $(QNX_HOST)\usr\bin - qcc.exe - qcc.exe - qcc.exe - blackberry-nativepackager.bat - $(MSBuildProgramFiles32)\BlackBerry\VSPlugin-NDK\qnxtools\bin\blackberry-signer.bat - blackberry-deploy.bat - $(QccToolsPath) - $(QccToolsPath) - $(QccToolsPath) - ssh.exe - $(QccToolsPath) - $(QccToolsPath)\ssh-keygen.exe - $(QccToolsPath)\blackberry-connect.bat - - $(Registry:HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\10.0\Setup\VC@ProductDir) - $(Registry:HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\10.0\Setup\VC@ProductDir) - $(Registry:HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VCExpress\10.0\Setup\VC@ProductDir) - $(Registry:HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VCExpress\10.0\Setup\VC@ProductDir) - - $(Registry:HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\10.0\Setup\VS@ProductDir) - $(Registry:HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\10.0\Setup\VS@ProductDir) - $(Registry:HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VCExpress\10.0\Setup\VS@ProductDir) - $(Registry:HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VCExpress\10.0\Setup\VS@ProductDir) - - $(Registry:HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SDKs\Windows\v7.0A@InstallationFolder) - $(Registry:HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Microsoft SDKs\Windows\v7.0A@InstallationFolder) - - $(Registry:HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework@InstallRoot) - $(Registry:HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\.NETFramework@InstallRoot) - - $(Registry:HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SDKs\Windows\v7.0A@InstallationFolder) - $(Registry:HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Microsoft SDKs\Windows\v7.0A@InstallationFolder) - - $(QNX_HOST)\usr\bin;$(PATH); - $(QNX_TARGET)\usr\include;$(QNX_TARGET)\usr\include\freetype2;$(QNX_TARGET)\..\target-override\usr\include; - $(QccLibPath);$(QNX_TARGET)\..\target-override\$(CPUVARDIR)\lib;$(QNX_TARGET)\..\target-override\$(CPUVARDIR)\usr\lib; - $(ExecutablePath) - - - - diff --git a/src_vs2012/VSNDK.Tasks/BlackBerrySimulator/Rules/debugger_ndk.xml b/src_vs2012/VSNDK.Tasks/BlackBerrySimulator/Rules/debugger_ndk.xml deleted file mode 100644 index cb53a5b7..00000000 --- a/src_vs2012/VSNDK.Tasks/BlackBerrySimulator/Rules/debugger_ndk.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - diff --git a/src_vs2012/VSNDK.Tasks/BlackBerrySimulator/Rules/ndkProjectItemsSchema.xml b/src_vs2012/VSNDK.Tasks/BlackBerrySimulator/Rules/ndkProjectItemsSchema.xml deleted file mode 100644 index ec753493..00000000 --- a/src_vs2012/VSNDK.Tasks/BlackBerrySimulator/Rules/ndkProjectItemsSchema.xml +++ /dev/null @@ -1,299 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src_vs2012/VSNDK.Tasks/BlackBerrySimulator/Rules/ndk_directories.xml b/src_vs2012/VSNDK.Tasks/BlackBerrySimulator/Rules/ndk_directories.xml deleted file mode 100644 index aa32e836..00000000 --- a/src_vs2012/VSNDK.Tasks/BlackBerrySimulator/Rules/ndk_directories.xml +++ /dev/null @@ -1,32 +0,0 @@ - - - - - - - - - - - - - - diff --git a/src_vs2012/VSNDK.Tasks/BlackBerrySimulator/Rules/ndk_general.xml b/src_vs2012/VSNDK.Tasks/BlackBerrySimulator/Rules/ndk_general.xml deleted file mode 100644 index 4a7e8cb8..00000000 --- a/src_vs2012/VSNDK.Tasks/BlackBerrySimulator/Rules/ndk_general.xml +++ /dev/null @@ -1,174 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src_vs2012/VSNDK.Tasks/BlackBerrySimulator/Rules/ndk_general_ps.xml b/src_vs2012/VSNDK.Tasks/BlackBerrySimulator/Rules/ndk_general_ps.xml deleted file mode 100644 index 5b40a328..00000000 --- a/src_vs2012/VSNDK.Tasks/BlackBerrySimulator/Rules/ndk_general_ps.xml +++ /dev/null @@ -1,75 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src_vs2012/VSNDK.Tasks/BlackBerrySimulator/Rules/packager.xml b/src_vs2012/VSNDK.Tasks/BlackBerrySimulator/Rules/packager.xml deleted file mode 100644 index 22e801e8..00000000 --- a/src_vs2012/VSNDK.Tasks/BlackBerrySimulator/Rules/packager.xml +++ /dev/null @@ -1,39 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src_vs2012/VSNDK.Tasks/BlackBerrySimulator/Rules/qcc_cl.xml b/src_vs2012/VSNDK.Tasks/BlackBerrySimulator/Rules/qcc_cl.xml deleted file mode 100644 index 9a799fa8..00000000 --- a/src_vs2012/VSNDK.Tasks/BlackBerrySimulator/Rules/qcc_cl.xml +++ /dev/null @@ -1,196 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src_vs2012/VSNDK.Tasks/BlackBerrySimulator/Rules/qcc_lib.xml b/src_vs2012/VSNDK.Tasks/BlackBerrySimulator/Rules/qcc_lib.xml deleted file mode 100644 index aa53f443..00000000 --- a/src_vs2012/VSNDK.Tasks/BlackBerrySimulator/Rules/qcc_lib.xml +++ /dev/null @@ -1,154 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src_vs2012/VSNDK.Tasks/BlackBerrySimulator/Rules/qcc_link.xml b/src_vs2012/VSNDK.Tasks/BlackBerrySimulator/Rules/qcc_link.xml deleted file mode 100644 index c35bcb63..00000000 --- a/src_vs2012/VSNDK.Tasks/BlackBerrySimulator/Rules/qcc_link.xml +++ /dev/null @@ -1,390 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src_vs2012/VSNDK.Tasks/CheckIfInstalled.cs b/src_vs2012/VSNDK.Tasks/CheckIfInstalled.cs deleted file mode 100644 index 88266c3d..00000000 --- a/src_vs2012/VSNDK.Tasks/CheckIfInstalled.cs +++ /dev/null @@ -1,104 +0,0 @@ -//* Copyright 2010-2011 Research In Motion Limited. -//* -//* Licensed under the Apache License, Version 2.0 (the "License"); -//* you may not use this file except in compliance with the License. -//* You may obtain a copy of the License at -//* -//* http://www.apache.org/licenses/LICENSE-2.0 -//* -//* Unless required by applicable law or agreed to in writing, software -//* distributed under the License is distributed on an "AS IS" BASIS, -//* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//* See the License for the specific language governing permissions and -//* limitations under the License. - -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.IO; -using System.Collections; -using Microsoft.Build.Framework; -using Microsoft.Build.Utilities; - -namespace VSNDK.Tasks -{ - /// - /// MSBuild Task to check to see if the application was previously installed. - /// - public class CheckIfInstalled : Task - { - #region Member Variables and Constants - private string _listFile; - private string _appName; - private bool _isAppInstalled; - #endregion - - /// - /// Execute the MSBuild task - /// - /// True on successful execution - public override bool Execute() - { - - try - { - _isAppInstalled = false; - - string[] installedApps = File.ReadAllLines(_listFile); - foreach (string app in installedApps) - { - if (app.Contains(_appName)) - { - _isAppInstalled = true; - break; - } - } - - return true; - } - catch (Exception ex) - { - return false; - } - - - } - - /// - /// Setter for the ListFile property - /// - [Required] - public string ListFile - { - set - { - _listFile = value; - } - } - - /// - /// Setter for the AppName property - /// - [Required] - public string AppName - { - set - { - _appName = value; - } - } - - /// - /// Getter for the IsAppInstalled property - /// - [Output] - public bool IsAppInstalled - { - get - { - return _isAppInstalled; - } - } - } -} diff --git a/src_vs2012/VSNDK.Tasks/DiffManifests.cs b/src_vs2012/VSNDK.Tasks/DiffManifests.cs deleted file mode 100644 index bb0ede14..00000000 --- a/src_vs2012/VSNDK.Tasks/DiffManifests.cs +++ /dev/null @@ -1,239 +0,0 @@ -//* Copyright 2010-2011 Research In Motion Limited. -//* -//* Licensed under the Apache License, Version 2.0 (the "License"); -//* you may not use this file except in compliance with the License. -//* You may obtain a copy of the License at -//* -//* http://www.apache.org/licenses/LICENSE-2.0 -//* -//* Unless required by applicable law or agreed to in writing, software -//* distributed under the License is distributed on an "AS IS" BASIS, -//* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//* See the License for the specific language governing permissions and -//* limitations under the License. - -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.IO; -using System.Collections; -using Microsoft.Build.Framework; -using Microsoft.Build.Utilities; - -namespace VSNDK.Tasks -{ - /// - /// MSBuild task to compare the manifest file from the bar file being uploaded against the one already installed on the device. - /// - public class DiffManifests : Task - { - #region Member Variables and Constants - private string _localManifestFile; - private string _targetManifestFile; - private string _targetFileMap; - private ArrayList _modifiedFiles; - private ArrayList _deletedFiles; - private int _modifiedFilesCount; - private int _deletedFilesCount; - #endregion - - /// - /// Execute the MSBuild Task. - /// - /// - public override bool Execute() - { - _modifiedFiles = new ArrayList(); - _deletedFiles = new ArrayList(); - - // Parse local manifest to retrieve list of files and their hashes. - string[] localManifest = File.ReadAllLines(_localManifestFile); - Dictionary localFiles = new Dictionary(); - for (int i = 0; i < localManifest.Length; i++) - { - if (localManifest[i].StartsWith("Archive-Asset-Name: ")) - { - string assetName = localManifest[i].Substring(20); - i++; - if (localManifest[i].StartsWith("Archive-Asset-SHA-512-Digest: ")) - { - string assetHash = localManifest[i].Substring(30); - localFiles.Add(assetName, assetHash); - } - else - { - return false; - } - } - } - - // Do the same for the target manifest. - string[] targetManifest = File.ReadAllLines(_targetManifestFile); - Dictionary targetFiles = new Dictionary(); - for (int i = 0; i < targetManifest.Length; i++) - { - if (targetManifest[i].StartsWith("Archive-Asset-Name: ")) - { - string assetName = targetManifest[i].Substring(20); - i++; - if (targetManifest[i].StartsWith("Archive-Asset-SHA-512-Digest: ")) - { - string assetHash = targetManifest[i].Substring(30); - targetFiles.Add(assetName, assetHash); - } - else - { - return false; - } - } - } - - // Compare hashes and populate the lists of modified and deleted files. - string[] targetFileMap = File.ReadAllLines(_targetFileMap); - foreach (KeyValuePair file in localFiles) - { - // For some reason this MANIFEST.bbr file appears in the manifest, even though - // it doesn't actually exist anywhere...? It doesn't seem to correspond to - // MANIFEST.MF either. - if (file.Key == "META-INF/MANIFEST.bbr") - { - continue; - } - - // If the target manifest doesn't contain the same key/value pair, - // that means the local file has been either added or modified. - if (!targetFiles.Contains(file)) - { - TaskItem item = new TaskItem(file.Key); - item.SetMetadata("SourcePath", getSourcePath(file.Key, targetFileMap)); - _modifiedFiles.Add(item); - } - } - - IDictionaryEnumerator targetEnum = targetFiles.GetEnumerator(); - while (targetEnum.MoveNext()) - { - // If the local manifest doesn't contain the same key, - // that means the target file has been deleted from the project. - if (!localFiles.ContainsKey((string)targetEnum.Key)) - { - TaskItem item = new TaskItem((string)targetEnum.Key); - _deletedFiles.Add(item); - } - } - - // For some reason the manifest file doesn't show up in the target file map - // or the manifest itself, so we add it manually here and always upload it. - TaskItem manifestItem = new TaskItem("META-INF/MANIFEST.MF"); - manifestItem.SetMetadata("SourcePath", "localManifest.mf"); - _modifiedFiles.Add(manifestItem); - - return true; - } - - /// - /// Helper function to parse the target file map to add the source path of each modified file as metadata. - /// - /// Path to the source file - /// Target file map - /// - private string getSourcePath(string sourcePath, string[] targetFileMap) - { - foreach (string line in targetFileMap) - { - if (line.Contains(sourcePath)) - { - int startIndex = line.IndexOf('='); - return line.Substring(startIndex + 1); - } - } - - return ""; - } - - /// - /// Getter for the ModifiedFiles property. - /// - [Output] - public ITaskItem[] ModifiedFiles - { - get - { - ITaskItem[] items = (ITaskItem[])_modifiedFiles.ToArray(typeof(ITaskItem)); - _modifiedFilesCount = items.Length; - return items; - } - } - - /// - /// Getter for the ModifiedFilesCount property - /// - [Output] - public int ModifiedFilesCount - { - get { return _modifiedFilesCount; } - set { _modifiedFilesCount = value; } - } - - /// - /// Getter for the DeletedFiles property - /// - [Output] - public ITaskItem[] DeletedFiles - { - get - { - ITaskItem[] items = (ITaskItem[])_deletedFiles.ToArray(typeof(ITaskItem)); - _deletedFilesCount = items.Length; - return items; - } - } - - /// - /// Getter/Setter for the DeletedFilesCount property - /// - [Output] - public int DeletedFilesCount - { - get { return _deletedFilesCount; } - set { _deletedFilesCount = value; } - } - - /// - /// Setter for the LocalManifestFile property - /// - [Required] - public string LocalManifestFile - { - set - { - _localManifestFile = value; - } - } - - /// - /// Setter for the TargetManifestFile property - /// - [Required] - public string TargetManifestFile - { - set - { - _targetManifestFile = value; - } - } - - /// - /// Setter for the targetFileMap property - /// - [Required] - public string targetFileMap - { - set - { - _targetFileMap = value; - } - } - } -} diff --git a/src_vs2012/VSNDK.Tasks/GenerateMakefile.cs b/src_vs2012/VSNDK.Tasks/GenerateMakefile.cs deleted file mode 100644 index 9f523095..00000000 --- a/src_vs2012/VSNDK.Tasks/GenerateMakefile.cs +++ /dev/null @@ -1,521 +0,0 @@ -//* Copyright 2010-2011 Research In Motion Limited. -//* -//* Licensed under the Apache License, Version 2.0 (the "License"); -//* you may not use this file except in compliance with the License. -//* You may obtain a copy of the License at -//* -//* http://www.apache.org/licenses/LICENSE-2.0 -//* -//* Unless required by applicable law or agreed to in writing, software -//* distributed under the License is distributed on an "AS IS" BASIS, -//* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//* See the License for the specific language governing permissions and -//* limitations under the License. - -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Collections; -using System.IO; -using Microsoft.Build.Framework; -using Microsoft.Build.Utilities; -using System.Runtime.InteropServices; - -namespace VSNDK.Tasks -{ - /// - /// MSBuild Task for generating a make file for packaging the bar file. - /// - public class GenerateMakefile : Task - { - #region Member Variables and Constants - private string _projectDir; - private string _intDir; - private string _outDir; - - private const string INITIAL_DEFINITIONS = - "RM := rm -rf\n\n" + - - "# Empty variable definitions.\n" + - "O_SRCS := \n" + - "CPP_SRCS := \n" + - "C_UPPER_SRCS := \n" + - "C_SRCS := \n" + - "S_UPPER_SRCS := \n" + - "OBJ_SRCS := \n" + - "II_SRCS := \n" + - "ASM_SRCS := \n" + - "CXX_SRCS := \n" + - "I_SRCS := \n" + - "CC_SRCS := \n" + - "OBJS := \n" + - "C_DEPS := \n" + - "CC_DEPS := \n" + - "ARCHIVES := \n" + - "CPP_DEPS := \n" + - "I_DEPS := \n" + - "CXX_DEPS := \n" + - "C_UPPER_DEPS := \n" + - "II_DEPS := \n\n" + - - "USER_OBJS := \n" + - "LIBS := \n\n"; - - private const string DEPENDENCY_INCLUDES = - "# Include all dependency files\n" + - "ifneq ($(MAKECMDGOALS),clean)\n" + - "ifneq ($(strip $(C_DEPS)),)\n" + - "-include $(C_DEPS)\n" + - "endif\n" + - "ifneq ($(strip $(CC_DEPS)),)\n" + - "-include $(CC_DEPS)\n" + - "endif\n" + - "ifneq ($(strip $(CPP_DEPS)),)\n" + - "-include $(CPP_DEPS)\n" + - "endif\n" + - "ifneq ($(strip $(I_DEPS)),)\n" + - "-include $(I_DEPS)\n" + - "endif\n" + - "ifneq ($(strip $(CXX_DEPS)),)\n" + - "-include $(CXX_DEPS)\n" + - "endif\n" + - "ifneq ($(strip $(C_UPPER_DEPS)),)\n" + - "-include $(C_UPPER_DEPS)\n" + - "endif\n" + - "ifneq ($(strip $(II_DEPS)),)\n" + - "-include $(II_DEPS)\n" + - "endif\n" + - "endif\n\n"; - #endregion - - #region properties - - /// - /// Getter/Setter for CompileItems property - /// - public ITaskItem[] CompileItems - { - set; - get; - } - - /// - /// Getter/Setter for LinkItems - /// - public ITaskItem[] LinkItems - { - set; - get; - } - - /// - /// Getter/Setter for ProjectDir property - /// - public string ProjectDir - { - set { _projectDir = value.Replace('\\', '/'); } - get { return _projectDir; } - } - - /// - /// Getter/Setter for IntDir property - /// - public string IntDir - { - set { _intDir = value.Replace('\\', '/'); } - get { return _intDir; } - } - - /// - /// Getter/Setter for OutDir property - /// - public string OutDir - { - set { _outDir = value.Replace('\\', '/'); } - get { return _outDir; } - } - - /// - /// Getter/Setter for AdditionalIncludeDirectories property - /// - public string[] AdditionalIncludeDirectories - { - set; - get; - } - - /// - /// Getter/Setter for AdditionLibraryDirectories - /// - public string[] AdditionalLibraryDirectories - { - set; - get; - } - - /// - /// Getter/Setter for ExcludeDirectories - /// - public string[] ExcludeDirectories - { - set; - get; - } - - - /// - /// Getter/Setter for TargetName property - /// - public string TargetName - { - set; - get; - } - - /// - /// Getter/Setter for TargetExtension property - /// - public string TargetExtension - { - set; - get; - } - - /// - /// Getter/Setter for ConfigurationType property - /// - public string ConfigurationType - { - set; - get; - } - - /// - /// Getter/Setter for CompilerVersion property - /// - public string CompilerVersion - { - set; - get; - } - - /// - /// Getter/Setter for Platform property - /// - public string Platform - { - set; - get; - } - - #endregion - - /// - /// Interface to unmanaged code for getting the SHortPathName for a given directory. - /// - /// Path to be converted - /// Returned ShortPathName - /// Length of the ShortPathName - /// - [DllImport("kernel32.dll", CharSet = CharSet.Auto)] - public static extern int GetShortPathName( - [MarshalAs(UnmanagedType.LPTStr)] - string path, - [MarshalAs(UnmanagedType.LPTStr)] - StringBuilder shortPath, - int shortPathLength - ); - - /// - /// Execute MSBuild Task - /// - /// - public override bool Execute() - { - string targetString = TargetName + TargetExtension; - targetString = targetString.Replace(".exe", ""); - string compilerFlag = "-V\"" + CompilerVersion; - - if (Platform == "BlackBerry") - compilerFlag += ",gcc_ntoarmv7le\""; - else if (Platform == "BlackBerrySimulator") - compilerFlag += ",gcc_ntox86\""; - - using (StreamWriter outFile = new StreamWriter(IntDir + "makefile")) - { - outFile.Write(INITIAL_DEFINITIONS); - // System.Diagnostics.Debugger.Launch(); - foreach (ITaskItem compileItem in CompileItems) - { - // Get the metadata we need from this compile item. - string id = compileItem.GetMetadata("Identity").Replace('\\', '/'); - string filename = compileItem.GetMetadata("Filename"); - string extension = compileItem.GetMetadata("Extension"); - string relativeDir = compileItem.GetMetadata("RelativeDir").Replace('\\', '/'); - string compileAs = compileItem.GetMetadata("CompileAs"); - string warningLevel = compileItem.GetMetadata("WarningLevel"); - string ansi = compileItem.GetMetadata("Ansi"); - string optimizationLevel = compileItem.GetMetadata("OptimizationLevel"); - string generateDebugInfo = compileItem.GetMetadata("GenerateDebugInformation"); - string runtimeTypeInfo = compileItem.GetMetadata("RuntimeTypeInfo"); - string enhancedSecurity = compileItem.GetMetadata("EnhancedSecurity"); - string additionalOptions = compileItem.GetMetadata("AdditionalOptions"); - string fullPath = compileItem.GetMetadata("FullPath").Replace('\\', '/'); - - /// if CompileItem is in the ExcludedPath then continue. - if (isExcludedPath(fullPath)) - { - - continue; - } - - StringBuilder shortPath = new StringBuilder(1024); - GetShortPathName(fullPath, shortPath, shortPath.Capacity); - string fullPathShortened = shortPath.ToString(); - - string handleExceptions = compileItem.GetMetadata("GccExceptionHandling"); - - string[] preprocessorDefs = compileItem.GetMetadata("PreprocessorDefinitions").Split(';'); - string[] preprocessorUndefs = compileItem.GetMetadata("UndefinePreprocessorDefinitions").Split(';'); - - string[] additionalIncludeDirs = compileItem.GetMetadata("AdditionalIncludeDirectories").Split(';'); - for (int i = 0; i < additionalIncludeDirs.Length; i++) - { - // Prepend ProjectDir to relative paths -- otherwise they will be interpreted - // as being relative to the build dir, e.g. ProjectDir/BlackBerry/Debug - if (additionalIncludeDirs[i] != "" && !additionalIncludeDirs[i].Contains(':')) - additionalIncludeDirs[i] = ProjectDir + additionalIncludeDirs[i]; - } - - // Add this compile item to the source definition. - if (compileAs == "CompileAsC") - outFile.Write("C_SRCS += "); - else if (compileAs == "CompileAsCpp") - outFile.Write("CPP_SRCS += "); - - // Source file location. - outFile.WriteLine(fullPathShortened); - - // Add this compile item's dependency file to the DEPS definition. - if (compileAs == "CompileAsC") - outFile.Write("C_DEPS += "); - else if (compileAs == "CompileAsCpp") - outFile.Write("CPP_DEPS += "); - - outFile.WriteLine("./" + filename + ".d"); - - // Add the object file to the OBJS definition. - outFile.WriteLine("OBJS += ./" + filename + ".o\n"); - - // Now add a compile rule for this item. - outFile.WriteLine(filename + ".o: " + fullPathShortened); - outFile.Write("\tqcc -o $@ " + fullPathShortened + " " + compilerFlag + " -c -Wp,-MMD,$(basename $@).d -Wp,-MT,$@ "); - - if (generateDebugInfo == "true") - outFile.Write("-g "); - - Dictionary warningMap = new Dictionary(); - warningMap.Add("TurnOffAllWarnings", "-w0 "); - warningMap.Add("Level1", "-w1 "); - warningMap.Add("Level2", "-w2 "); - warningMap.Add("Level3", "-w3 "); - warningMap.Add("Level4", "-w4 "); - warningMap.Add("Level5", "-w5 "); - warningMap.Add("Level6", "-w6 "); - warningMap.Add("Level7", "-w7 "); - warningMap.Add("Level8", "-w8 "); - warningMap.Add("Level9", "-w9 "); - warningMap.Add("EnableAllWarnings", "-Wall "); - - string warningLevelSwitch; - warningMap.TryGetValue(warningLevel, out warningLevelSwitch); - outFile.Write(warningLevelSwitch); - - if (compileAs == "CompileAsC") - outFile.Write("-lang-c "); - else if (compileAs == "CompileAsCpp") - outFile.Write("-lang-c++ "); - - if (runtimeTypeInfo == "false" && compileAs == "CompileAsCpp") - outFile.Write("-fno-rtti "); - - if (handleExceptions == "true") - outFile.Write("-fexceptions "); - else - outFile.Write("-fno-exceptions "); - - if (enhancedSecurity == "true") - outFile.Write("-fstack-protector-all "); - - // Note: Consider letting user decide between "-fpic" and "-fPIC" - // For now we use the safe, cross-platform "-fPIC" - if (ConfigurationType == "DynamicLibrary") - outFile.Write("-fPIC "); - - foreach (string includeDir in AdditionalIncludeDirectories) - { - if (includeDir != "") - outFile.Write("-I\"" + includeDir + "\" "); - } - - foreach (string includeDir in additionalIncludeDirs) - { - if (includeDir != "") - outFile.Write("-I\"" + includeDir + "\" "); - } - - foreach (string def in preprocessorDefs) - { - if (def != "") - outFile.Write("-D" + def + " "); - } - - foreach (string undef in preprocessorUndefs) - { - if (undef != "") - outFile.Write("-U" + undef + " "); - } - - outFile.WriteLine(additionalOptions); - outFile.WriteLine(); - } - - outFile.Write(DEPENDENCY_INCLUDES); - - // Now write out all the targets. - outFile.WriteLine("all: " + targetString); - outFile.WriteLine(); - outFile.Write(targetString + ": $(OBJS) $(USER_OBJS) $(LIB_DEPS) "); - outFile.WriteLine(); - - string rootedOutDir = (Path.IsPathRooted(OutDir)) ? OutDir : ProjectDir + OutDir; - - StringBuilder shortOutPath = new StringBuilder(1024); - GetShortPathName(rootedOutDir, shortOutPath, shortOutPath.Capacity); - rootedOutDir = shortOutPath.ToString(); - - if (ConfigurationType == "StaticLibrary") - { - outFile.Write("\tqcc -A " + rootedOutDir + targetString + " $(OBJS) $(USER_OBJS) $(LIBS) " + compilerFlag + " -w1"); - } - else if (ConfigurationType == "DynamicLibrary") - { - // In case of reverse dependencies, may need to add "-Wl,-export-dynamic" - // Also note that the soname is currently the same as the target name, and no version information is added. - outFile.Write("\tqcc -shared -Wl,-soname," + targetString + - " -o " + rootedOutDir + targetString + - " $(OBJS) $(USER_OBJS) $(LIBS) " + compilerFlag); - } - else if (ConfigurationType == "Utility") - { - // As far as I know, we don't support utilities. - } - else if (ConfigurationType == "Application") - { - // For now, collect linker metadata from the first link item. - // (Why do we have multiple link items anyhow?) - string[] libs = LinkItems[0].GetMetadata("AdditionalDependencies").Split(';'); - string generateDebugInfo = LinkItems[0].GetMetadata("GenerateDebugInformation"); - string compileAs = LinkItems[0].GetMetadata("CompileAs"); - - string[] libDirs = LinkItems[0].GetMetadata("AdditionalLibraryDirectories").Split(';'); - for (int i = 0; i < libDirs.Length; i++) - { - // Prepend ProjectDir to relative paths. - if (libDirs[i] != "" && !libDirs[i].Contains(':')) - libDirs[i] = ProjectDir + libDirs[i]; - } - - // This is the linker's tool invocation. - outFile.Write("\tqcc -o " + rootedOutDir + targetString + " $(OBJS) $(USER_OBJS) $(LIBS) " + compilerFlag + " "); - - if (compileAs == "CompileAsCpp") - outFile.Write("-lang-c++ "); - else if (compileAs == "CompileAsC") - outFile.Write("-lang-c "); - - if (generateDebugInfo == "true") - outFile.Write("-g "); - - // For added security, remap some sections of ELF as read-only. - outFile.Write("-Wl,-z,relro,-z,now "); - - // Visual Studio doesn't have separate lists for static vs. dynamic dependencies. - // To differentiate between the two, include the extension in the list. - // (.a for static, .so for dynamic) - // If no extension is included in the name it will be treated as the same type - // as the last declared type, and the default type is static. This is the way - // qcc would work if you were using it from the command line with the - // "-Bstatic" and "-Bdynamic" flags. - for (int i = 0; i < libs.Length; i++) - { - if (libs[i].EndsWith(".so")) - { - outFile.Write("-Bdynamic "); - libs[i] = libs[i].Remove(libs[i].Length - 3); - } - else if (libs[i].EndsWith(".a")) - { - outFile.Write("-Bstatic "); - libs[i] = libs[i].Remove(libs[i].Length - 2); - } - - if (libs[i] != "") - outFile.Write("-l" + libs[i] + " "); - } - - foreach (string libDir in libDirs) - { - if (libDir != "") - outFile.Write("-L\"" + libDir + "\" "); - } - - foreach (string libDir in AdditionalLibraryDirectories) - { - if (libDir != "") - outFile.Write("-L\"" + libDir + "\" "); - } - } - - outFile.WriteLine("\n"); - outFile.WriteLine("clean:"); - outFile.Write("\t-$(RM) $(OBJS)$(C_DEPS)$(CC_DEPS)$(COM_QNX_QCC_OUTPUTTYPE_LINKER_OUTPUTS)$(CPP_DEPS)$(I_DEPS)$(CXX_DEPS)$(C_UPPER_DEPS)$(II_DEPS) " + rootedOutDir + targetString); - - if (ConfigurationType == "Application") - { - outFile.WriteLine(" " + rootedOutDir + TargetName + ".bar"); - } - - outFile.WriteLine(); - outFile.WriteLine(".PHONY: all clean dependents\n"); - } - - return true; - } - - /// - /// Check to see if path is in the excluded list - /// - /// - /// - private bool isExcludedPath(string path) - { - if (ExcludeDirectories != null) - { - foreach (string exDir in ExcludeDirectories) - { - if (Path.GetFullPath(path).Contains(Path.GetFullPath(exDir))) - { - return true; - } -/* else - { - return false; - }*/ - } - } - return false; - } - } -} diff --git a/src_vs2012/VSNDK.Tasks/GetAppInfo.cs b/src_vs2012/VSNDK.Tasks/GetAppInfo.cs deleted file mode 100644 index 353f09de..00000000 --- a/src_vs2012/VSNDK.Tasks/GetAppInfo.cs +++ /dev/null @@ -1,124 +0,0 @@ -//* Copyright 2010-2011 Research In Motion Limited. -//* -//* Licensed under the Apache License, Version 2.0 (the "License"); -//* you may not use this file except in compliance with the License. -//* You may obtain a copy of the License at -//* -//* http://www.apache.org/licenses/LICENSE-2.0 -//* -//* Unless required by applicable law or agreed to in writing, software -//* distributed under the License is distributed on an "AS IS" BASIS, -//* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//* See the License for the specific language governing permissions and -//* limitations under the License. - -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.IO; -using System.Xml; -using Microsoft.Build.Framework; -using Microsoft.Build.Utilities; - -namespace VSNDK.Tasks -{ - /// - /// MSBuid Task to retrieve the application info - /// - public class GetAppInfo : Task - { - #region Member Variables and Constants - private string _projectDir; - private string _appName; - private string _barDescriptorPath = ""; - private string _appId; - #endregion - - /// - /// Execute the MSBuild Task - /// - /// - public override bool Execute() - { - string rootedOutDir = (Path.IsPathRooted(_barDescriptorPath)) ? _barDescriptorPath : _projectDir + _barDescriptorPath; - XmlReader reader = XmlReader.Create(rootedOutDir); - reader.ReadToFollowing("id"); - _appId = reader.ReadElementContentAsString(); - - return true; - } - - /// - /// Getter/Setter for the ApplicationDescriptorXml property - /// - public string ApplicationDescriptorXml - { - set - { - _barDescriptorPath = value; - } - get - { - return _barDescriptorPath; - } - } - - /// - /// Getter/Setter for the ProjectDir property - /// - public string ProjectDir - { - set - { - _projectDir = value; - } - get - { - return _projectDir; - } - } - - /// - /// Getter/Setter for the AppName property - /// - public string AppName - { - set - { - _appName = value; - - if (_barDescriptorPath == "") - { - // Default location of bar-descriptor file, if not specified in the Properties Configurations. - _barDescriptorPath = "BlackBerry-" + _appName + "\\bar-descriptor.xml"; - if (!File.Exists(_barDescriptorPath)) - { - // Just to support the default locations of bar-descriptor from previous versions of the plug-in. - _barDescriptorPath = _appName + "_barDescriptor\\bar-descriptor.xml"; - if (!File.Exists(_barDescriptorPath)) - { - _barDescriptorPath = "bar-descriptor.xml"; - } - } - } - } - get - { - return _appName; - } - } - - /// - /// Getter/Setter for the AppId property - /// - [Output] - public string AppId - { - get - { - return _appId; - } - } - } -} diff --git a/src_vs2012/VSNDK.Tasks/LaunchDebugEngine.cs b/src_vs2012/VSNDK.Tasks/LaunchDebugEngine.cs deleted file mode 100644 index bd688a79..00000000 --- a/src_vs2012/VSNDK.Tasks/LaunchDebugEngine.cs +++ /dev/null @@ -1,83 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using Microsoft.Build.Utilities; -using Microsoft.Build.Framework; - -using EnvDTE; -using EnvDTE80; -using Microsoft.VisualStudio.Shell; -using Microsoft.VisualStudio.Shell.Interop; -using Microsoft.VisualStudio.OLE.Interop; -using System.Runtime.InteropServices; - -namespace VSNDK.Tasks -{ - /*[ComImport] - [Guid("23EB4AF8-BE9C-4b49-B3A4-24F4FF657B27")] - * */ - - public abstract class LaunchDebugEngine : Microsoft.Build.Utilities.Task - { - /* - [DllImport("ole32.dll")] - static extern int CoInitializeEx(IntPtr pvReserved, uint dwCoInit); - */ - private DTE2 _applicationObject; - private string _filePath; - - public override bool Execute() - { - System.Diagnostics.Debugger.Launch(); - //CoInitializeEx(NULL, COINIT_MULTITHREADED); - //enum comEnum = {COINIT_MULTITHREADED=0}; - //CoInitializeEx((IntPtr)null, (uint)0); - - _applicationObject = (EnvDTE80.DTE2)System.Runtime.InteropServices.Marshal.GetActiveObject("VisualStudio.DTE.10.0"); - - Microsoft.VisualStudio.Shell.ServiceProvider sp = - new Microsoft.VisualStudio.Shell.ServiceProvider((Microsoft.VisualStudio.OLE.Interop.IServiceProvider)_applicationObject); - - IVsDebugger dbg = (IVsDebugger)sp.GetService(typeof(SVsShellDebugger)); - - VsDebugTargetInfo info = new VsDebugTargetInfo(); - info.cbSize = (uint)System.Runtime.InteropServices.Marshal.SizeOf(info); - info.dlo = Microsoft.VisualStudio.Shell.Interop.DEBUG_LAUNCH_OPERATION.DLO_CreateProcess; - - info.bstrExe = _filePath; - info.bstrCurDir = System.IO.Path.GetDirectoryName(info.bstrExe); - info.bstrArg = null; // no command line parameters - info.bstrRemoteMachine = null; // debug locally - info.fSendStdoutToOutputWindow = 0; // Let stdout stay with the application. - info.clsidCustom = new Guid("{D951924A-4999-42a0-9217-1EB5233D1D5A}"); // Set the launching engine the sample engine guid - info.grfLaunch = 0; - - IntPtr pInfo = System.Runtime.InteropServices.Marshal.AllocCoTaskMem((int)info.cbSize); - System.Runtime.InteropServices.Marshal.StructureToPtr(info, pInfo, false); - - try - { - dbg.LaunchDebugTargets(1, pInfo); - } - finally - { - if (pInfo != IntPtr.Zero) - { - System.Runtime.InteropServices.Marshal.FreeCoTaskMem(pInfo); - } - } - - return true; - } - - [Required] - public string FilePath - { - set - { - _filePath = value; - } - } - } -} diff --git a/src_vs2012/VSNDK.Tasks/MakeAllAndFormatOutputMessages.cs b/src_vs2012/VSNDK.Tasks/MakeAllAndFormatOutputMessages.cs deleted file mode 100644 index 2dfcefe2..00000000 --- a/src_vs2012/VSNDK.Tasks/MakeAllAndFormatOutputMessages.cs +++ /dev/null @@ -1,556 +0,0 @@ -//* Copyright 2010-2011 Research In Motion Limited. -//* -//* Licensed under the Apache License, Version 2.0 (the "License"); -//* you may not use this file except in compliance with the License. -//* You may obtain a copy of the License at -//* -//* http://www.apache.org/licenses/LICENSE-2.0 -//* -//* Unless required by applicable law or agreed to in writing, software -//* distributed under the License is distributed on an "AS IS" BASIS, -//* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//* See the License for the specific language governing permissions and -//* limitations under the License. - -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using EnvDTE; -using EnvDTE80; -using System.Runtime.InteropServices; -using System.IO; -using System.Runtime.Serialization.Formatters.Binary; -using System.Runtime.Serialization; -using System.Diagnostics; -using Microsoft.Build.Utilities; -using Microsoft.Build.Framework; -using System.Text.RegularExpressions; - -namespace VSNDK.Tasks -{ - /// - /// Cancelabe MSBuild Task for Running the Make file for the build. - /// - public class MakeAllAndFormatOutputMessages : ICancelableTask - { - #region Member Variables and Constants - - private string _projectDir; - private string _intDir; - private string _outDir; - - private static StringBuilder stdOutput = null; - private static StringBuilder errorOutput = null; - private IBuildEngine buildEngine; - private System.Diagnostics.Process proc = null; - private ITaskHost hostObject; - - private string _numProcessors; - - #endregion - - /// - /// Getter/Setter for the BuildEngine property - /// - public IBuildEngine BuildEngine - { - get { return buildEngine; } - set { buildEngine = value; } - } - - /// - /// Getter/Setter for the HostObject property - /// - public ITaskHost HostObject - { - get { return hostObject; } - set { hostObject = value; } - } - - /// - /// Getter/Setter for CompileItems property - /// - public ITaskItem[] CompileItems - { - set; - get; - } - - /// - /// Getter/Setter for the number of processors property. - /// - public string numProcessors - { - get - { - _numProcessors = Environment.ProcessorCount.ToString(); - return _numProcessors; - } - set { _numProcessors = value; } - } - - /// - /// Perform Task Execution - /// - /// Return true on successful task completion - public bool Execute() - { - string pCommand = ""; - string pArgs = ""; - bool mprocess = false; - - try - { - foreach (ITaskItem compileItem in CompileItems) - { - // Get the metadata we need from this compile item. - mprocess = (compileItem.GetMetadata("MultiProcess") == "true"); - } - - pCommand = "cmd"; - if (mprocess) - pArgs = "/c " + ToolsPath + @"\make -j" + numProcessors + " all"; - else - pArgs = "/c " + ToolsPath + @"\make all"; - - System.Diagnostics.ProcessStartInfo procStartInfo = new System.Diagnostics.ProcessStartInfo(pCommand, pArgs); - - // Set UseShellExecute to false for redirection. - procStartInfo.UseShellExecute = false; - - // The following commands are needed to redirect the standard and error outputs. - // These streams are read asynchronously using an event handler. - procStartInfo.RedirectStandardOutput = true; - stdOutput = new StringBuilder(""); - procStartInfo.RedirectStandardError = true; - errorOutput = new StringBuilder(""); - - // Setting the work directory. - string rootedOutDir = (Path.IsPathRooted(OutDir)) ? OutDir : ProjectDir + OutDir; - procStartInfo.WorkingDirectory = rootedOutDir; - - // Do not create the black window. - procStartInfo.CreateNoWindow = true; - - // Create a process and assign its ProcessStartInfo - proc = new System.Diagnostics.Process(); - proc.StartInfo = procStartInfo; - - // Set ours events handlers to asynchronously read the standard and error outputs. - proc.OutputDataReceived += new DataReceivedEventHandler(StdOutputHandler); - proc.ErrorDataReceived += new DataReceivedEventHandler(ErrorOutputHandler); - - // Start the process - proc.Start(); - - // Start the asynchronous read of the standard and error output stream. - proc.BeginOutputReadLine(); - proc.BeginErrorReadLine(); - - do - { - // Wait until finished - // This code is correct, don't remove it. WaitForExit freezes the IDE while waiting for the end of the build process. - // With this loop and the time out, the IDE won't be frozen enabling the build process to be cancelled. - } - while (!proc.WaitForExit(1000)); - - } - catch (Exception e) - { - Console.WriteLine("Failed to execute make all. Reason: " + e.Message); - return false; - } - - if (errorOutput.ToString().IndexOf(": error:") == -1) - { - int pos = errorOutput.ToString().LastIndexOf("\\make:"); - if (pos == -1) - return true; - else - { - pos = errorOutput.ToString().IndexOf("Error ", pos); - if (pos == -1) - return true; - } - } - - return false; - - } - - /// - /// Standard Output Event Handler - /// - /// Sending Process - /// Output Text - private void StdOutputHandler(object sendingProcess, DataReceivedEventArgs outLine) - { - if (!String.IsNullOrEmpty(outLine.Data)) - { - string outputText = outLine.Data; - - int tilde = outputText.IndexOf("~"); - while (tilde != -1) - { - int end = outputText.IndexOf(':', tilde); - int end1 = outputText.IndexOf(' ', tilde); - int end2 = outputText.IndexOf('\n', tilde); - if ((end == -1) && (end1 == -1) && (end2 == -1)) - break; - if (end == -1) - end = outputText.Length - 1; - if (end1 == -1) - end1 = outputText.Length - 1; - if (end2 == -1) - end2 = outputText.Length - 1; - if (end > end1) - end = end1; - if (end > end2) - end = end2; - int begin = outputText.LastIndexOf('\n', tilde) + 1; - int begin1 = outputText.LastIndexOf(' ', tilde) + 1; - if (begin < begin1) - begin = begin1; - StringBuilder longPathName = new StringBuilder(1024); - string shortPathName = outputText.Substring(begin, end - begin); - GetLongPathName(shortPathName, longPathName, longPathName.Capacity); - if (longPathName.ToString() == "") - { - int sep = shortPathName.LastIndexOf('/'); - int sep2 = shortPathName.LastIndexOf('\\'); - if (sep2 > sep) - sep = sep2; - if (sep != -1) - { - shortPathName = shortPathName.Remove(sep + 1); - GetLongPathName(shortPathName, longPathName, longPathName.Capacity); - } - } - if (longPathName.ToString() != "") - outputText = outputText.Replace(shortPathName, longPathName.ToString()); - - tilde = outputText.IndexOf("~", tilde + 1); - } - - - BuildMessageEventArgs taskEvent = new BuildMessageEventArgs(outputText, "", "", MessageImportance.High); - BuildEngine.LogMessageEvent(taskEvent); - - } - } - - /// - /// Error Output Event Handler - /// - /// Sending process - /// Error Message - private void ErrorOutputHandler(object sendingProcess, DataReceivedEventArgs outLine) - { - if (!String.IsNullOrEmpty(outLine.Data)) - { - string outputText = outLine.Data; - int pos = outputText.IndexOf(": warning:"); - if (pos == -1) - pos = outputText.IndexOf(": note:"); - int diff = 10; - int tilde; - while (pos != -1) - { - if (outputText[pos - 1] != ')') - { - int end = pos; - int begin = outputText.LastIndexOf('\n', end) + 1; - string oldPath = outputText.Substring(begin, end - begin + 1); - string newPath = oldPath; - newPath = newPath.Insert(newPath.Length - 1, ")"); - end = newPath.LastIndexOf(":", newPath.Length - 2); - if (end != -1) - { - newPath = newPath.Remove(end, 1); - newPath = newPath.Insert(end, ","); - end = newPath.LastIndexOf(":", end - 1); - if (end != -1) - { - if (end > 5) - { - newPath = newPath.Remove(end, 1); - newPath = newPath.Insert(end, "("); - } - else - { - end = newPath.IndexOf(",", end); - newPath = newPath.Remove(end, 1); - newPath = newPath.Insert(end, "("); - } - - tilde = newPath.IndexOf("~"); - if (tilde != -1) - { - StringBuilder longPathName = new StringBuilder(1024); - string shortPathName = newPath.Substring(0, end); - GetLongPathName(shortPathName, longPathName, longPathName.Capacity); - newPath = longPathName.ToString() + newPath.Substring(end); - } - - diff += (newPath.Length - oldPath.Length); - outputText = outputText.Replace(oldPath, newPath); - } - } - } - pos = outputText.IndexOf(": warning:", pos + diff); - } - - pos = outputText.IndexOf(": error:"); - diff = 8; - while (pos != -1) - { - if (outputText[pos - 1] != ')') - { - int end = pos; - int begin = outputText.LastIndexOf('\n', end) + 1; - string oldPath = outputText.Substring(begin, end - begin + 1); - string newPath = oldPath; - newPath = newPath.Insert(newPath.Length - 1, ")"); - end = newPath.LastIndexOf(":", newPath.Length - 2); - if (end != -1) - { - newPath = newPath.Remove(end, 1); - newPath = newPath.Insert(end, ","); - end = newPath.LastIndexOf(":", end - 1); - if (end != -1) - { - if (end > 5) - { - newPath = newPath.Remove(end, 1); - newPath = newPath.Insert(end, "("); - } - else - { - end = newPath.IndexOf(",", end); - newPath = newPath.Remove(end, 1); - newPath = newPath.Insert(end, "("); - } - - tilde = newPath.IndexOf("~"); - if (tilde != -1) - { - StringBuilder longPathName = new StringBuilder(1024); - string shortPathName = newPath.Substring(0, end); - GetLongPathName(shortPathName, longPathName, longPathName.Capacity); - newPath = longPathName.ToString() + newPath.Substring(end); - } - - diff += (newPath.Length - oldPath.Length); - outputText = outputText.Replace(oldPath, newPath); - } - } - } - pos = outputText.IndexOf(": error:", pos + diff); - } - - tilde = outputText.IndexOf("~"); - while (tilde != -1) - { - int end = outputText.IndexOf(':', tilde); - int end1 = outputText.IndexOf(' ', tilde); - int end2 = outputText.IndexOf('\n', tilde); - if ((end == -1) && (end1 == -1) && (end2 == -1)) - break; - if (end == -1) - end = outputText.Length - 1; - if (end1 == -1) - end1 = outputText.Length - 1; - if (end2 == -1) - end2 = outputText.Length - 1; - if (end > end1) - end = end1; - if (end > end2) - end = end2; - int begin = outputText.LastIndexOf('\n', tilde) + 1; - int begin1 = outputText.LastIndexOf(' ', tilde) + 1; - if (begin < begin1) - begin = begin1; - StringBuilder longPathName = new StringBuilder(1024); - string shortPathName = outputText.Substring(begin, end - begin); - GetLongPathName(shortPathName, longPathName, longPathName.Capacity); - if (longPathName.ToString() == "") - { - int sep = shortPathName.LastIndexOf('/'); - int sep2 = shortPathName.LastIndexOf('\\'); - if (sep2 > sep) - sep = sep2; - if (sep != -1) - { - shortPathName = shortPathName.Remove(sep + 1); - GetLongPathName(shortPathName, longPathName, longPathName.Capacity); - } - } - if (longPathName.ToString() != "") - outputText = outputText.Replace(shortPathName, longPathName.ToString()); - - tilde = outputText.IndexOf("~", tilde + 1); - } - - /// Send build output to the Output window and to the ErrorList window - if (outputText.IndexOf(": error:") > 0) - { - string fileName = outputText.Substring(0, outputText.IndexOf(": error:")); - int lineNum = 0; - - int ini = fileName.IndexOf('(') + 1; - int end = fileName.IndexOf(')'); - - if (fileName.IndexOf(',', ini) > 0) - { - if (fileName.IndexOf(',', ini) < end) - { - end = fileName.IndexOf(',', ini); - } - } - end = end - fileName.IndexOf('(') - 1; - - try - { - lineNum = Convert.ToInt16(fileName.Substring(ini, end)); - } - catch - { - lineNum = 0; - } - - int colNum = 0; - string messageErr = outputText.Substring(outputText.IndexOf(": error:") + 9); - fileName = fileName.Substring(0, fileName.IndexOf('(')); - BuildErrorEventArgs errorEvent = new BuildErrorEventArgs("", "", fileName, lineNum, colNum, 0, 0, messageErr, "", ""); - BuildEngine.LogErrorEvent(errorEvent); - } - else if (outputText.IndexOf(": warning:") > 0) - { - string fileName = outputText.Substring(0, outputText.IndexOf(": warning:")); - int lineNum = 0; - - int ini = fileName.IndexOf('(') + 1; - int end = fileName.IndexOf(')'); - if (fileName.IndexOf(',', ini) > 0) - { - if (fileName.IndexOf(',', ini) < end) - { - end = fileName.IndexOf(',', ini); - } - } - end = end - fileName.IndexOf('(') - 1; - - try - { - lineNum = Convert.ToInt16(fileName.Substring(ini, end)); - } - catch - { - lineNum = 0; - } - - int colNum = 0; - string messageErr = outputText.Substring(outputText.IndexOf(": warning:") + 11); - fileName = fileName.Substring(0, fileName.IndexOf('(')); - BuildWarningEventArgs warningEvent = new BuildWarningEventArgs("", "", fileName, lineNum, colNum, 0, 0, messageErr, "", ""); - BuildEngine.LogWarningEvent(warningEvent); - } - else if (outputText.Contains("undefined reference")) - { - Regex re = new Regex(@":\d+:"); - Match m = re.Match(outputText); - string fileName = ""; - int lineNum = 0; - string message = ""; - - if (m.Success) - { - fileName = outputText.Substring(0, m.Index); - try - { - lineNum = Convert.ToInt16(m.Value.Trim(':')); - } - catch - { - lineNum = 0; - } - message = outputText.Substring(m.Index + m.Length).Trim(); - } - else - { - lineNum = 0; - fileName = outputText.Substring(0, outputText.IndexOf(':')); - message = outputText.Substring(outputText.LastIndexOf(':') + 1).Trim(); - } - - BuildErrorEventArgs errorEvent = new BuildErrorEventArgs("", "", fileName, lineNum, 1, 0, 0, message, "", ""); - BuildEngine.LogErrorEvent(errorEvent); - } - else - { - BuildMessageEventArgs taskEvent = new BuildMessageEventArgs(outputText, "", "", MessageImportance.High); - BuildEngine.LogMessageEvent(taskEvent); - } - - // Add the text to the collected output. - errorOutput.Append(Environment.NewLine + outputText); - } - } - - - /// GDB works with short path names only, which requires converting the path names to/from long ones. This function - /// returns the long path name for a given short one. - /// Short path name. - /// Returns this long path name. - /// Lenght of this long path name. - /// - [DllImport("kernel32.dll", CharSet = CharSet.Auto)] - public static extern int GetLongPathName( - [MarshalAs(UnmanagedType.LPTStr)] - string path, - [MarshalAs(UnmanagedType.LPTStr)] - StringBuilder longPath, - int longPathLength - ); - - [Required] - public string ProjectDir - { - set { _projectDir = value.Replace('\\', '/'); } - get { return _projectDir; } - } - - [Required] - public string OutDir - { - set { _outDir = value.Replace('\\', '/'); } - get { return _outDir; } - } - - [Required] - public string ToolsPath - { - get; - set; - } - - /// - /// Perform Cancel Code - /// - public void Cancel() - { - try - { - proc.Kill(); - } - catch (Exception ex) - { - BuildMessageEventArgs taskEvent2 = new BuildMessageEventArgs(ex.Message, "", "", MessageImportance.High); - BuildEngine.LogMessageEvent(taskEvent2); - } - - } - } -} diff --git a/src_vs2012/VSNDK.Tasks/PackagerCmdBuilder.cs b/src_vs2012/VSNDK.Tasks/PackagerCmdBuilder.cs deleted file mode 100644 index 37b9b905..00000000 --- a/src_vs2012/VSNDK.Tasks/PackagerCmdBuilder.cs +++ /dev/null @@ -1,44 +0,0 @@ -//* Copyright 2010-2011 Research In Motion Limited. -//* -//* Licensed under the Apache License, Version 2.0 (the "License"); -//* you may not use this file except in compliance with the License. -//* You may obtain a copy of the License at -//* -//* http://www.apache.org/licenses/LICENSE-2.0 -//* -//* Unless required by applicable law or agreed to in writing, software -//* distributed under the License is distributed on an "AS IS" BASIS, -//* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//* See the License for the specific language governing permissions and -//* limitations under the License. - -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using Microsoft.Build.Utilities; - -namespace VSNDK.Tasks -{ - class PackagerCmdBuilder : CommandLineBuilder - { - - /// - /// Constructor - /// - public PackagerCmdBuilder() - : base(true) - { - } - - /// - /// Override of IsQuotingRequired function. Always return true. - /// - /// - /// - protected override bool IsQuotingRequired(string parameter) - { - return true; - } - } -} diff --git a/src_vs2012/VSNDK.Tasks/Properties/AssemblyInfo.cs b/src_vs2012/VSNDK.Tasks/Properties/AssemblyInfo.cs deleted file mode 100644 index ebb81dcb..00000000 --- a/src_vs2012/VSNDK.Tasks/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,50 +0,0 @@ -//* Copyright 2010-2011 Research In Motion Limited. -//* -//* Licensed under the Apache License, Version 2.0 (the "License"); -//* you may not use this file except in compliance with the License. -//* You may obtain a copy of the License at -//* -//* http://www.apache.org/licenses/LICENSE-2.0 -//* -//* Unless required by applicable law or agreed to in writing, software -//* distributed under the License is distributed on an "AS IS" BASIS, -//* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//* See the License for the specific language governing permissions and -//* limitations under the License. - -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("VSNDK.Tasks")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("BlackBerry")] -[assembly: AssemblyProduct("VSNDK.Tasks")] -[assembly: AssemblyCopyright("Copyright © BlackBerry 2011")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("d4362271-7b17-4734-86bb-39564f3e29fc")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Build and Revision Numbers -// by using the '*' as shown below: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/src_vs2012/VSNDK.Tasks/Properties/Resources.Designer.cs b/src_vs2012/VSNDK.Tasks/Properties/Resources.Designer.cs deleted file mode 100644 index 0585af56..00000000 --- a/src_vs2012/VSNDK.Tasks/Properties/Resources.Designer.cs +++ /dev/null @@ -1,144 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// Runtime Version:4.0.30319.18051 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -namespace VSNDK.Tasks.Properties { - using System; - - - /// - /// A strongly-typed resource class, for looking up localized strings, etc. - /// - // This class was auto-generated by the StronglyTypedResourceBuilder - // class via a tool like ResGen or Visual Studio. - // To add or remove a member, edit your .ResX file then rerun ResGen - // with the /str option, or rebuild your VS project. - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - internal class Resources { - - private static global::System.Resources.ResourceManager resourceMan; - - private static global::System.Globalization.CultureInfo resourceCulture; - - [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - internal Resources() { - } - - /// - /// Returns the cached ResourceManager instance used by this class. - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Resources.ResourceManager ResourceManager { - get { - if (object.ReferenceEquals(resourceMan, null)) { - global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("VSNDK.Tasks.Properties.Resources", typeof(Resources).Assembly); - resourceMan = temp; - } - return resourceMan; - } - } - - /// - /// Overrides the current thread's CurrentUICulture property for all - /// resource lookups using this strongly typed resource class. - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Globalization.CultureInfo Culture { - get { - return resourceCulture; - } - set { - resourceCulture = value; - } - } - - /// - /// Looks up a localized string similar to # This file is automatically generated by vs-ndk. - ///# Do not modify this file -- YOUR CHANGES WILL BE ERASED! - ///# - ///# This file must *NOT* be checked in Version Control Systems, - ///# as it contains information specific to your local configuration. - /// - ///# location of the SDK. This is only used by Ant - ///# For customization when using a Version Control System, please read the - ///# header note. - ///sdk.dir={SDKDIR}. - /// - internal static string localproperties_ant_file { - get { - return ResourceManager.GetString("localproperties_ant_file", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Tracking command:. - /// - internal static string Native_TrackingCommandMessage { - get { - return ResourceManager.GetString("Native_TrackingCommandMessage", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to MSB8016: Can not turn on Unicode output for "{0}". Some Unicode characters will be improperly displayed.. - /// - internal static string TrackedVCToolTask_CreateUnicodeOutputPipeFailed { - get { - return ResourceManager.GetString("TrackedVCToolTask.CreateUnicodeOutputPipeFailed", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Forcing rebuild of all source files due to a change in the command line since the last build.. - /// - internal static string TrackedVCToolTask_RebuildingAllSourcesCommandLineChanged { - get { - return ResourceManager.GetString("TrackedVCToolTask.RebuildingAllSourcesCommandLineChanged", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to MSB8014: Forcing a rebuild of all sources due to an error with the tracking logs. {0}. - /// - internal static string TrackedVCToolTask_RebuildingDueToInvalidTLog { - get { - return ResourceManager.GetString("TrackedVCToolTask.RebuildingDueToInvalidTLog", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to MSB8015: Forcing a rebuild of all source files due to the contents of "{0}" being invalid.. - /// - internal static string TrackedVCToolTask_RebuildingDueToInvalidTLogContents { - get { - return ResourceManager.GetString("TrackedVCToolTask.RebuildingDueToInvalidTLogContents", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Forcing rebuild of all source files due to missing command tlog "{0}".. - /// - internal static string TrackedVCToolTask_RebuildingNoCommandTLog { - get { - return ResourceManager.GetString("TrackedVCToolTask.RebuildingNoCommandTLog", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Forcing rebuild of source file "{0}" due to a change in the command line since the last build.. - /// - internal static string TrackedVCToolTask_RebuildingSourceCommandLineChanged { - get { - return ResourceManager.GetString("TrackedVCToolTask.RebuildingSourceCommandLineChanged", resourceCulture); - } - } - } -} diff --git a/src_vs2012/VSNDK.Tasks/Properties/Resources.resx b/src_vs2012/VSNDK.Tasks/Properties/Resources.resx deleted file mode 100644 index 9419c2d4..00000000 --- a/src_vs2012/VSNDK.Tasks/Properties/Resources.resx +++ /dev/null @@ -1,153 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - # This file is automatically generated by vs-ndk. -# Do not modify this file -- YOUR CHANGES WILL BE ERASED! -# -# This file must *NOT* be checked in Version Control Systems, -# as it contains information specific to your local configuration. - -# location of the SDK. This is only used by Ant -# For customization when using a Version Control System, please read the -# header note. -sdk.dir={SDKDIR} - - - Tracking command: - - - MSB8016: Can not turn on Unicode output for "{0}". Some Unicode characters will be improperly displayed. - - - Forcing rebuild of all source files due to a change in the command line since the last build. - - - MSB8014: Forcing a rebuild of all sources due to an error with the tracking logs. {0} - - - MSB8015: Forcing a rebuild of all source files due to the contents of "{0}" being invalid. - - - Forcing rebuild of all source files due to missing command tlog "{0}". - - - Forcing rebuild of source file "{0}" due to a change in the command line since the last build. - - \ No newline at end of file diff --git a/src_vs2012/VSNDK.Tasks/QccCompiler.cs b/src_vs2012/VSNDK.Tasks/QccCompiler.cs deleted file mode 100644 index 46798742..00000000 --- a/src_vs2012/VSNDK.Tasks/QccCompiler.cs +++ /dev/null @@ -1,513 +0,0 @@ -//* Copyright 2010-2011 Research In Motion Limited. -//* -//* Licensed under the Apache License, Version 2.0 (the "License"); -//* you may not use this file except in compliance with the License. -//* You may obtain a copy of the License at -//* -//* http://www.apache.org/licenses/LICENSE-2.0 -//* -//* Unless required by applicable law or agreed to in writing, software -//* distributed under the License is distributed on an "AS IS" BASIS, -//* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//* See the License for the specific language governing permissions and -//* limitations under the License. - -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using Microsoft.Build.Utilities; -using Microsoft.Build.CPPTasks; -using System.Resources; -using System.Reflection; -using Microsoft.Build.Framework; -using System.Collections; -using System.IO; - -namespace VSNDK.Tasks -{ - public class QccCompiler : VSNDKTasks - { - #region fields - // Fields - private ITaskItem[] preprocessOutput; - - //constant fields - private const string ADDITIONAL_INCLUDEDIRECTORIES = "AdditionalIncludeDirectories"; - private const string PREPROCESSOR_DEFINITIONS = "PreprocessorDefinitions"; - private const string UNDEFINE_PREPROCESSOR_DEFINITION = "UndefinePreprocessorDefinition"; - private const string PREPROCESS_TO_FILE = "PreprocessToFile"; - private const string PREPROCESS_TO_STDOUT = "PreprocessToStdout"; - private const string PREPROCESS_KEEP_COMMENTS = "PreprocessKeepComments"; - private const string RUNTIME_TYPE_INFO = "RuntimeTypeInfo"; - private const string OBJECT_FILE_NAME = "ObjectFileName"; - private const string ANSI = "Ansi"; - #endregion - - #region ctors - public QccCompiler() - : base(new ResourceManager("VSNDK.Tasks.Properties.Resources", Assembly.GetExecutingAssembly())) - { - this.preprocessOutput = new ITaskItem[0]; - this.switchOrderList.Add(ADDITIONAL_INCLUDEDIRECTORIES); - this.switchOrderList.Add(ANSI); - this.switchOrderList.Add(PREPROCESSOR_DEFINITIONS); - this.switchOrderList.Add(UNDEFINE_PREPROCESSOR_DEFINITION); - this.switchOrderList.Add(PREPROCESS_TO_FILE); - this.switchOrderList.Add(PREPROCESS_TO_STDOUT); - this.switchOrderList.Add(PREPROCESS_KEEP_COMMENTS); - this.switchOrderList.Add(RUNTIME_TYPE_INFO); - this.switchOrderList.Add(OBJECT_FILE_NAME); - this.switchOrderList.Add(SOURCES); - } - #endregion - - #region overrides - /// - /// Getter/Setter for the AlwaysAppend property - /// - protected override string AlwaysAppend - { - get - { - return LinkSharedLibrary ? "-c -shared" : "-c"; - } - } - - /// - /// Getter/Setter for the AttributeFileTracking property - /// - public override bool AttributeFileTracking - { - get - { - return true; - } - } - - /// - /// Getter/Setter for the TrackedInputFiles property - /// - protected override Microsoft.Build.Framework.ITaskItem[] TrackedInputFiles - { - get - { - return Sources; - } - } - - /// - /// Execute the specified tool for building - /// - /// - /// - /// - /// - protected override int ExecuteTool(string pathToTool, string responseFileCommands, string commandLineCommands) - { - foreach (ITaskItem item in this.Sources) - { - string source = item.ItemSpec; - base.LogEventsFromTextOutput(source, MessageImportance.High); - } - return base.ExecuteTool(pathToTool, responseFileCommands, commandLineCommands); - } - - /// - /// Getter/Setter for the WriteTLogNames property - /// - protected override string[] WriteTLogNames - { - get - { - return new string[] { "qcc_compiler.write.1.tlog", "qcc_compiler.*.write.1.tlog" }; - } - } - - /// - /// Getter/Setter for the CommandTLogName property - /// - protected override string CommandTLogName - { - get - { - return "qcc_compiler.command.1.tlog"; - } - } - - /// - /// Getter/Setter for the ReadTLogNames property - /// - protected override string[] ReadTLogNames - { - get - { - return new string[] { "qcc_compiler.read.1.tlog", "qcc_compiler.*.read.1.tlog" }; - } - } - #endregion //override - - #region properties - - /// - /// GetterSetter for the AdditionalIncludeDirectories property. - /// - public string[] AdditionalIncludeDirectories - { - get - { - if (base.IsPropertySet(ADDITIONAL_INCLUDEDIRECTORIES)) - { - return base.ActiveToolSwitches[ADDITIONAL_INCLUDEDIRECTORIES].StringList; - } - return null; - } - set - { - base.ActiveToolSwitches.Remove(ADDITIONAL_INCLUDEDIRECTORIES); - ToolSwitch switch2 = new ToolSwitch(ToolSwitchType.StringArray) - { - DisplayName = "Additional Include Directories", - Description = "Specifies one or more directories to add to the include path; separate with semi-colons if more than one. (-I[path])", - ArgumentRelationList = new ArrayList(), - SwitchValue = "-I", - Name = ADDITIONAL_INCLUDEDIRECTORIES, - StringList = value - }; - base.ActiveToolSwitches.Add(ADDITIONAL_INCLUDEDIRECTORIES, switch2); - base.AddActiveSwitchToolValue(switch2); - } - } - - /// - /// Getter/Setter for the Ansi property - /// - public bool Ansi - { - get - { - return (base.IsPropertySet(ANSI) && base.ActiveToolSwitches[ANSI].BooleanValue); - } - set - { - base.ActiveToolSwitches.Remove(ANSI); - ToolSwitch switch2 = new ToolSwitch(ToolSwitchType.Boolean) - { - DisplayName = "Compile ANSI code", - Description = "Compile ansi code", - ArgumentRelationList = new ArrayList(), - SwitchValue = "-ansi", - Name = ANSI, - BooleanValue = value - }; - base.ActiveToolSwitches.Add(ANSI, switch2); - base.AddActiveSwitchToolValue(switch2); - } - } - - /// - /// Getter/Setter for the MinimalRebuild property - /// - public virtual bool MinimalRebuild - { - get - { - return (base.IsPropertySet("MinimalRebuild") && base.ActiveToolSwitches["MinimalRebuild"].BooleanValue); - } - set - { - base.ActiveToolSwitches.Remove("MinimalRebuild"); - ToolSwitch switch2 = new ToolSwitch(ToolSwitchType.Boolean) - { - DisplayName = "Enable Minimal Rebuild", - Description = "Enables minimal rebuild, which determines whether C++ source files that include changed C++ class definitions (stored in header (.h) files) need to be recompiled.", - ArgumentRelationList = new ArrayList(), - SwitchValue = "/Gm", - ReverseSwitchValue = "/Gm-", - Name = "MinimalRebuild", - BooleanValue = value - }; - base.ActiveToolSwitches.Add("MinimalRebuild", switch2); - base.AddActiveSwitchToolValue(switch2); - switch2.Overrides.AddLast(new KeyValuePair("Gm", "Gm-")); - switch2.Overrides.AddLast(new KeyValuePair("Gm-", "Gm")); - } - } - - /// - /// Getter/Setter for the ObjectFileName property - /// - public string ObjectFileName - { - get - { - if (base.IsPropertySet(OBJECT_FILE_NAME)) - { - return base.ActiveToolSwitches[OBJECT_FILE_NAME].Value; - } - return null; - } - set - { - base.ActiveToolSwitches.Remove(OBJECT_FILE_NAME); - ToolSwitch switch2 = new ToolSwitch(ToolSwitchType.File) - { - DisplayName = "Object File Name", - Description = "Specifies a name to override the default object file name; can be file or directory name. (-o[name])", - ArgumentRelationList = new ArrayList(), - SwitchValue = "-o", - Name = OBJECT_FILE_NAME, - Value = value - }; - base.ActiveToolSwitches.Add(OBJECT_FILE_NAME, switch2); - base.AddActiveSwitchToolValue(switch2); - } - } - - /// - /// Getter/Setter for the ExpandAttributedSource property - /// - public bool ExpandAttributedSource - { - get - { - return (base.IsPropertySet("ExpandAttributedSource") && base.ActiveToolSwitches["ExpandAttributedSource"].BooleanValue); - } - set - { - base.ActiveToolSwitches.Remove("ExpandAttributedSource"); - ToolSwitch switch2 = new ToolSwitch(ToolSwitchType.Boolean) - { - DisplayName = "Expand Attributed Source", - Description = "Create listing file with expanded attributes injected into source file. (/Fx)", - ArgumentRelationList = new ArrayList(), - SwitchValue = "/Fx", - Name = "ExpandAttributedSource", - BooleanValue = value - }; - base.ActiveToolSwitches.Add("ExpandAttributedSource", switch2); - base.AddActiveSwitchToolValue(switch2); - } - } - - /// - /// Getter/Setter for the FavorSizeOrSpeed property - /// - public string FavorSizeOrSpeed - { - get - { - if (base.IsPropertySet("FavorSizeOrSpeed")) - { - return base.ActiveToolSwitches["FavorSizeOrSpeed"].Value; - } - return null; - } - set - { - base.ActiveToolSwitches.Remove("FavorSizeOrSpeed"); - ToolSwitch switch2 = new ToolSwitch(ToolSwitchType.String) - { - DisplayName = "Favor Size Or Speed", - Description = "Whether to favor code size or code speed; 'Global Optimization' must be turned on. (/Ot, /Os)", - ArgumentRelationList = new ArrayList() - }; - string[][] switchMap = new string[][] { new string[] { "Size", "/Os" }, new string[] { "Speed", "/Ot" }, new string[] { "Neither", "" } }; - switch2.SwitchValue = base.ReadSwitchMap("FavorSizeOrSpeed", switchMap, value); - switch2.Name = "FavorSizeOrSpeed"; - switch2.Value = value; - switch2.MultipleValues = true; - base.ActiveToolSwitches.Add("FavorSizeOrSpeed", switch2); - base.AddActiveSwitchToolValue(switch2); - } - } - - /// - /// Getter/Setter for the PreprocessKeepComments property - /// - public bool PreprocessKeepComments - { - get - { - return (base.IsPropertySet(PREPROCESS_KEEP_COMMENTS) && base.ActiveToolSwitches[PREPROCESS_KEEP_COMMENTS].BooleanValue); - } - set - { - base.ActiveToolSwitches.Remove(PREPROCESS_KEEP_COMMENTS); - ToolSwitch switch2 = new ToolSwitch(ToolSwitchType.Boolean) - { - DisplayName = "Keep Comments", - Description = "Suppresses comment strip from source code; requires that one of the 'Preprocessing' options be set. (-C)", - ArgumentRelationList = new ArrayList(), - SwitchValue = "-C", - Name = PREPROCESS_KEEP_COMMENTS, - BooleanValue = value - }; - base.ActiveToolSwitches.Add(PREPROCESS_KEEP_COMMENTS, switch2); - base.AddActiveSwitchToolValue(switch2); - } - } - - /// - /// Getter/Setter for hte PreprocessorDefinitions property - /// - public string[] PreprocessorDefinitions - { - get - { - if (base.IsPropertySet(PREPROCESSOR_DEFINITIONS)) - { - return base.ActiveToolSwitches[PREPROCESSOR_DEFINITIONS].StringList; - } - return null; - } - set - { - base.ActiveToolSwitches.Remove(PREPROCESSOR_DEFINITIONS); - ToolSwitch switch2 = new ToolSwitch(ToolSwitchType.StringArray) - { - DisplayName = "Preprocessor Definitions", - Description = "Defines a preprocessing symbols for your source file.", - ArgumentRelationList = new ArrayList(), - SwitchValue = "-D", - Name = PREPROCESSOR_DEFINITIONS, - StringList = value - }; - base.ActiveToolSwitches.Add(PREPROCESSOR_DEFINITIONS, switch2); - base.AddActiveSwitchToolValue(switch2); - } - } - - /// - /// Getter/Setter for the PreprocessOutput property - /// - [Output] - public ITaskItem[] PreprocessOutput - { - get - { - return this.preprocessOutput; - } - set - { - this.preprocessOutput = value; - } - } - - /// - /// Getter/Setter for the PreprocessOutputPath - /// - public string PreprocessOutputPath - { - get - { - if (base.IsPropertySet(PREPROCESS_TO_STDOUT)) - { - return base.ActiveToolSwitches[PREPROCESS_TO_STDOUT].Value; - } - return null; - } - set - { - base.ActiveToolSwitches.Remove(PREPROCESS_TO_STDOUT); - ToolSwitch switch2 = new ToolSwitch(ToolSwitchType.String) - { - DisplayName = "Preprocess Output Path", - Description = "Specify the output path for the preprocesser. The default location is the same as the source file(s).", - ArgumentRelationList = new ArrayList(), - Name = PREPROCESS_TO_STDOUT, - Value = value, - SwitchValue = "E" - }; - base.ActiveToolSwitches.Add(PREPROCESS_TO_STDOUT, switch2); - base.AddActiveSwitchToolValue(switch2); - } - } - - /// - /// Getter/Setter for the PreprocessSuppressLineNumbers property - /// - public bool PreprocessSuppressLineNumbers - { - get - { - return (base.IsPropertySet("PreprocessSuppressLineNumbers") && base.ActiveToolSwitches["PreprocessSuppressLineNumbers"].BooleanValue); - } - set - { - base.ActiveToolSwitches.Remove("PreprocessSuppressLineNumbers"); - ToolSwitch switch2 = new ToolSwitch(ToolSwitchType.Boolean) - { - DisplayName = "Preprocess Suppress Line Numbers", - Description = "Preprocess without #line directives.", - ArgumentRelationList = new ArrayList(), - SwitchValue = "/EP", - Name = "PreprocessSuppressLineNumbers", - BooleanValue = value - }; - base.ActiveToolSwitches.Add("PreprocessSuppressLineNumbers", switch2); - base.AddActiveSwitchToolValue(switch2); - } - } - - /// - /// Getter/Setter for the PreprocessToFile property - /// - public bool PreprocessToFile - { - get - { - return (base.IsPropertySet(PREPROCESS_TO_FILE) && base.ActiveToolSwitches[PREPROCESS_TO_FILE].BooleanValue); - } - set - { - base.ActiveToolSwitches.Remove(PREPROCESS_TO_FILE); - ToolSwitch switch2 = new ToolSwitch(ToolSwitchType.Boolean) - { - DisplayName = "Preprocess to a File", - Description = "Preprocesses C and C++ source files and writes the preprocessed output to a file. This option suppresses compilation, thus it does not produce an .obj file.", - ArgumentRelationList = new ArrayList(), - SwitchValue = "-P", - Name = PREPROCESS_TO_FILE, - BooleanValue = value - }; - base.ActiveToolSwitches.Add(PREPROCESS_TO_FILE, switch2); - base.AddActiveSwitchToolValue(switch2); - } - } - - /// - /// Getter/Setter for the UndefinePreprocessorDefinition property - /// - public string[] UndefinePreprocessorDefinition - { - get - { - if (base.IsPropertySet(UNDEFINE_PREPROCESSOR_DEFINITION)) - { - return base.ActiveToolSwitches[UNDEFINE_PREPROCESSOR_DEFINITION].StringList; - } - return null; - } - set - { - base.ActiveToolSwitches.Remove(UNDEFINE_PREPROCESSOR_DEFINITION); - ToolSwitch switch2 = new ToolSwitch(ToolSwitchType.StringArray) - { - DisplayName = "Undefine Preprocessor Definitions", - Description = "Specifies one or more preprocessor undefines. (-U[macro])", - ArgumentRelationList = new ArrayList(), - SwitchValue = "-U", - Name = UNDEFINE_PREPROCESSOR_DEFINITION, - StringList = value - }; - base.ActiveToolSwitches.Add(UNDEFINE_PREPROCESSOR_DEFINITION, switch2); - base.AddActiveSwitchToolValue(switch2); - } - } - - public bool RuntimeTypeInfo { get; set; } - public bool ShortEnums { get; set; } - #endregion //properties - } -} diff --git a/src_vs2012/VSNDK.Tasks/QccLib.cs b/src_vs2012/VSNDK.Tasks/QccLib.cs deleted file mode 100644 index e446e89b..00000000 --- a/src_vs2012/VSNDK.Tasks/QccLib.cs +++ /dev/null @@ -1,244 +0,0 @@ -//* Copyright 2010-2011 Research In Motion Limited. -//* -//* Licensed under the Apache License, Version 2.0 (the "License"); -//* you may not use this file except in compliance with the License. -//* You may obtain a copy of the License at -//* -//* http://www.apache.org/licenses/LICENSE-2.0 -//* -//* Unless required by applicable law or agreed to in writing, software -//* distributed under the License is distributed on an "AS IS" BASIS, -//* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//* See the License for the specific language governing permissions and -//* limitations under the License. - -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using Microsoft.Build.CPPTasks; -using System.Resources; -using System.Reflection; -using System.Collections; - -namespace VSNDK.Tasks -{ - public class QccLib : VSNDKTasks - { - #region Member Variables and Constants - private const string ADDITIONAL_DEPENDENCIES = "AdditionalDependencies"; - private const string ADDITIONAL_LIB_DIR = "AdditionalLibraryDirectories"; - private const string OUTPUT_FILE = "OutputFile"; - private const string LINK_STATIC = "LinkStatic"; - private const string TREAT_LIB_WARNING_AS_ERROR = "TreatLibWarningAsErrors"; - #endregion - - /// - /// QccLib Constructor - /// - public QccLib() - : base(new ResourceManager("VSNDK.Tasks.Properties.Resources", Assembly.GetExecutingAssembly())) - { - this.switchOrderList.Add(ADDITIONAL_DEPENDENCIES); - this.switchOrderList.Add(ADDITIONAL_LIB_DIR); - this.switchOrderList.Add(TREAT_LIB_WARNING_AS_ERROR); - this.switchOrderList.Add(OUTPUT_FILE); - this.switchOrderList.Add(SOURCES); - } - - #region overrides - - /// - /// Getter/Setter for the AlwaysAppend property - /// - protected override string AlwaysAppend - { - get - { - return string.Empty; - } - } - - /// - /// Getter/Setter for the CommandTLogName property - /// - protected override string CommandTLogName - { - get { return "qcc_lib.command.1.tlog"; } - } - - /// - /// Getter/Setter for the ReadTLogNames property - /// - protected override string[] ReadTLogNames - { - get { return new string[] { "qcc_lib.read.1.tlog", "qcc_lib.*.read.1.tlog" }; } - } - - /// - /// Getter/Setter for the WriteTLogNames - /// - protected override string[] WriteTLogNames - { - get - { - return new string[] { "qcc_lib.write.1.tlog", "qcc_lib.*.write.1.tlog" }; - } - } - - /// - /// Method return the EnhancedSecuritySwitch - /// - /// - protected override string GetEnhancedSecuritySwitchValue() - { - return string.Empty; - } - #endregion overrides - - #region properties - /// - /// Getter/Setter for the LinkStatic property - /// - public bool LinkStatic - { - get - { - return (base.IsPropertySet(LINK_STATIC) && base.ActiveToolSwitches[LINK_STATIC].BooleanValue); - } - set - { - base.ActiveToolSwitches.Remove(LINK_STATIC); - ToolSwitch switch2 = new ToolSwitch(ToolSwitchType.Boolean) - { - DisplayName = "Link Static", - Description = "Static link Lib", - ArgumentRelationList = new ArrayList(), - SwitchValue = "-static", - Name = LINK_STATIC, - BooleanValue = value - }; - base.ActiveToolSwitches.Add(LINK_STATIC, switch2); - base.AddActiveSwitchToolValue(switch2); - } - } - - /// - /// Getter/Setter for the AdditionalDependencies property - /// - public virtual string[] AdditionalDependencies - { - get - { - if (base.IsPropertySet(ADDITIONAL_DEPENDENCIES)) - { - return base.ActiveToolSwitches[ADDITIONAL_DEPENDENCIES].StringList; - } - return null; - } - set - { - base.ActiveToolSwitches.Remove(ADDITIONAL_DEPENDENCIES); - ToolSwitch switch2 = new ToolSwitch(ToolSwitchType.StringArray) - { - DisplayName = "Additional Dependencies", - Description = "Specifies additional items to add to the link command line [i.e. bps] ", - ArgumentRelationList = new ArrayList(), - SwitchValue = "-l", - Name = ADDITIONAL_DEPENDENCIES, - StringList = value - }; - base.ActiveToolSwitches.Add(ADDITIONAL_DEPENDENCIES, switch2); - base.AddActiveSwitchToolValue(switch2); - } - } - - /// - /// Getter/Setter for the AdditionalLibraryDirectories property - /// - public virtual string[] AdditionalLibraryDirectories - { - get - { - if (base.IsPropertySet(ADDITIONAL_LIB_DIR)) - { - return base.ActiveToolSwitches[ADDITIONAL_LIB_DIR].StringList; - } - return null; - } - set - { - base.ActiveToolSwitches.Remove(ADDITIONAL_LIB_DIR); - ToolSwitch switch2 = new ToolSwitch(ToolSwitchType.StringArray) - { - DisplayName = "Additional Library Directories", - Description = "Allows the user to override the environmental library path (-Lfolder)", - ArgumentRelationList = new ArrayList(), - SwitchValue = "-L", - Name = ADDITIONAL_LIB_DIR, - StringList = value - }; - base.ActiveToolSwitches.Add(ADDITIONAL_LIB_DIR, switch2); - base.AddActiveSwitchToolValue(switch2); - } - } - - /// - /// Getter/Setter for the TreatLibWarningAsErrors property - /// - public virtual bool TreatLibWarningAsErrors - { - get - { - return (base.IsPropertySet(TREAT_LIB_WARNING_AS_ERROR) && base.ActiveToolSwitches[TREAT_LIB_WARNING_AS_ERROR].BooleanValue); - } - set - { - base.ActiveToolSwitches.Remove(TREAT_LIB_WARNING_AS_ERROR); - ToolSwitch switch2 = new ToolSwitch(ToolSwitchType.Boolean) - { - DisplayName = "Treat Lib Warning As Errors", - Description = "-Werror causes no output file to be generated if lib generates a warning.", - ArgumentRelationList = new ArrayList(), - SwitchValue = "-Werror", - Name = TREAT_LIB_WARNING_AS_ERROR, - BooleanValue = value - }; - base.ActiveToolSwitches.Add(TREAT_LIB_WARNING_AS_ERROR, switch2); - base.AddActiveSwitchToolValue(switch2); - } - } - - /// - /// GetterSetter for the OutputFile property - /// - public virtual string OutputFile - { - get - { - if (base.IsPropertySet(OUTPUT_FILE)) - { - return base.ActiveToolSwitches[OUTPUT_FILE].Value; - } - return null; - } - set - { - base.ActiveToolSwitches.Remove(OUTPUT_FILE); - ToolSwitch switch2 = new ToolSwitch(ToolSwitchType.File) - { - //Separator = ":", - DisplayName = "Output File", - Description = "The -A option overrides the default name and location of the program that the linker creates.", - ArgumentRelationList = new ArrayList(), - SwitchValue = "-A ", - Name = OUTPUT_FILE, - Value = value - }; - base.ActiveToolSwitches.Add(OUTPUT_FILE, switch2); - base.AddActiveSwitchToolValue(switch2); - } - } - #endregion properties - } -} diff --git a/src_vs2012/VSNDK.Tasks/QccLink.cs b/src_vs2012/VSNDK.Tasks/QccLink.cs deleted file mode 100644 index cc8eda2f..00000000 --- a/src_vs2012/VSNDK.Tasks/QccLink.cs +++ /dev/null @@ -1,401 +0,0 @@ -//* Copyright 2010-2011 Research In Motion Limited. -//* -//* Licensed under the Apache License, Version 2.0 (the "License"); -//* you may not use this file except in compliance with the License. -//* You may obtain a copy of the License at -//* -//* http://www.apache.org/licenses/LICENSE-2.0 -//* -//* Unless required by applicable law or agreed to in writing, software -//* distributed under the License is distributed on an "AS IS" BASIS, -//* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//* See the License for the specific language governing permissions and -//* limitations under the License. - -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using Microsoft.Build.CPPTasks; -using System.Resources; -using System.Reflection; -using Microsoft.Build.Framework; -using System.Collections; -using Microsoft.Build.Utilities; -using System.IO; - -namespace VSNDK.Tasks -{ - public class QccLink : VSNDKTasks - { - #region Member Variables and Constants - private const string ADDITIONAL_DEPENDENCIES = "AdditionalDependencies"; - private const string LINK_ERROR_REPORTING = "LinkErrorReporting"; - private const string ADDITIONAL_LIB_DIR = "AdditionalLibraryDirectories"; - private const string GENERATE_MAP_FILE = "GenerateMapFile"; - private const string IGNORE_ALL_DEFAULT_LIB = "IgnoreAllDefaultLibraries"; - private const string IGNOR_ALL_DEFAULT_CPP_LIB = "IgnoreAllDefaultCppLibraries"; - private const string LINK_INCREMENTAL = "LinkIncremental"; - private const string LINK_STATUS = "LinkStatus"; - private const string LINK_LIB_DEP = "LinkLibraryDependencies"; - private const string OUTPUT_FILE = "OutputFile"; - private const string TREAT_LINK_WARNING_AS_ERR = "TreatLinkerWarningAsErrors"; - #endregion - - /// - /// QccLink Constructor - /// - public QccLink() - : base(new ResourceManager("VSNDK.Tasks.Properties.Resources", Assembly.GetExecutingAssembly())) - { - this.switchOrderList.Add(ADDITIONAL_DEPENDENCIES); - this.switchOrderList.Add(LINK_ERROR_REPORTING); - this.switchOrderList.Add(ADDITIONAL_LIB_DIR); - this.switchOrderList.Add(GENERATE_MAP_FILE); - this.switchOrderList.Add(IGNORE_ALL_DEFAULT_LIB); - this.switchOrderList.Add(IGNOR_ALL_DEFAULT_CPP_LIB); - this.switchOrderList.Add(LINK_INCREMENTAL); - this.switchOrderList.Add(LINK_STATUS); - this.switchOrderList.Add(LINK_LIB_DEP); - this.switchOrderList.Add(OUTPUT_FILE); - this.switchOrderList.Add(TREAT_LINK_WARNING_AS_ERR); - this.switchOrderList.Add(SOURCES); - } - - #region overrides - - /// - /// Getter/Setter for AlwaysAppend property - /// - protected override string AlwaysAppend - { - get - { - return LinkSharedLibrary? "-shared" : string.Empty; - } - } - - /// - /// Getter/Setter for CommandTLogName property - /// - protected override string CommandTLogName - { - get { return "qcc_linker.command.1.tlog"; } - } - - /// - /// Getter/Setter for ReadTLog - /// - protected override string[] ReadTLogNames - { - get { return new string[] { "qcc_linker.read.1.tlog", "qcc_linker.*.read.1.tlog" }; } - } - - /// - /// Getter/Setter WriteTLogNames property - /// - protected override string[] WriteTLogNames - { - get - { - return new string[] { "qcc_linker.write.1.tlog", "qcc_linker.*.write.1.tlog" }; - } - } - - /// - /// Function to return the Enhanced Security value. - /// - /// - protected override string GetEnhancedSecuritySwitchValue() - { - return "-Wl,-z,relro -Wl,-z,now"; - } - #endregion - - #region properties - - /// - /// Getter/Setter for the AdditionalDependencies property - /// - public virtual string[] AdditionalDependencies - { - get - { - if (base.IsPropertySet(ADDITIONAL_DEPENDENCIES)) - { - return base.ActiveToolSwitches[ADDITIONAL_DEPENDENCIES].StringList; - } - return null; - } - set - { - base.ActiveToolSwitches.Remove(ADDITIONAL_DEPENDENCIES); - ToolSwitch switch2 = new ToolSwitch(ToolSwitchType.StringArray) - { - DisplayName = "Additional Dependencies", - Description = "Specifies additional items to add to the link command line [i.e. bps] ", - ArgumentRelationList = new ArrayList(), - SwitchValue = "-l", - Name = ADDITIONAL_DEPENDENCIES, - StringList = value - }; - base.ActiveToolSwitches.Add(ADDITIONAL_DEPENDENCIES, switch2); - base.AddActiveSwitchToolValue(switch2); - } - } - - /// - /// Getter/Setter for the AdditionalLibraryDirectories property - /// - public virtual string[] AdditionalLibraryDirectories - { - get - { - if (base.IsPropertySet(ADDITIONAL_LIB_DIR)) - { - return base.ActiveToolSwitches[ADDITIONAL_LIB_DIR].StringList; - } - return null; - } - set - { - base.ActiveToolSwitches.Remove(ADDITIONAL_LIB_DIR); - ToolSwitch switch2 = new ToolSwitch(ToolSwitchType.StringArray) - { - DisplayName = "Additional Library Directories", - Description = "Allows the user to override the environmental library path (-Lfolder)", - ArgumentRelationList = new ArrayList(), - SwitchValue = "-L", - Name = ADDITIONAL_LIB_DIR, - StringList = value - }; - base.ActiveToolSwitches.Add(ADDITIONAL_LIB_DIR, switch2); - base.AddActiveSwitchToolValue(switch2); - } - } - - /// - /// Getter/Setter for the GenerateMapFile property - /// - public virtual bool GenerateMapFile - { - get - { - return (base.IsPropertySet(GENERATE_MAP_FILE) && base.ActiveToolSwitches[GENERATE_MAP_FILE].BooleanValue); - } - set - { - base.ActiveToolSwitches.Remove(GENERATE_MAP_FILE); - ToolSwitch switch2 = new ToolSwitch(ToolSwitchType.Boolean) - { - DisplayName = "Generate Map File", - Description = "The -M option tells the linker to create a mapfile.", - ArgumentRelationList = new ArrayList() - }; - switch2.ArgumentRelationList.Add(new ArgumentRelation("MapFileName", "true", false, "")); - switch2.SwitchValue = "-M"; - switch2.Name = GENERATE_MAP_FILE; - switch2.BooleanValue = value; - base.ActiveToolSwitches.Add(GENERATE_MAP_FILE, switch2); - base.AddActiveSwitchToolValue(switch2); - } - } - - /// - /// Getter/Setter for the IgnoreAllDefaultLibraries - /// - public virtual bool IgnoreAllDefaultLibraries - { - get - { - return (base.IsPropertySet(IGNORE_ALL_DEFAULT_LIB) && base.ActiveToolSwitches[IGNORE_ALL_DEFAULT_LIB].BooleanValue); - } - set - { - base.ActiveToolSwitches.Remove(IGNORE_ALL_DEFAULT_LIB); - ToolSwitch switch2 = new ToolSwitch(ToolSwitchType.Boolean) - { - DisplayName = "Ignore All Default Libraries", - Description = "The -nostdlib option tells the linker to remove one or more default libraries from the list of libraries it searches when resolving external references. ", - ArgumentRelationList = new ArrayList(), - SwitchValue = "-nostdlib", - Name = IGNORE_ALL_DEFAULT_LIB, - BooleanValue = value - }; - base.ActiveToolSwitches.Add(IGNORE_ALL_DEFAULT_LIB, switch2); - base.AddActiveSwitchToolValue(switch2); - } - } - - /// - /// Getter/Setter for the IgnoreAllDefaultCppLibraries property - /// - public virtual bool IgnoreAllDefaultCppLibraries - { - get - { - return (base.IsPropertySet(IGNOR_ALL_DEFAULT_CPP_LIB) && base.ActiveToolSwitches[IGNOR_ALL_DEFAULT_CPP_LIB].BooleanValue); - } - set - { - base.ActiveToolSwitches.Remove(IGNOR_ALL_DEFAULT_CPP_LIB); - ToolSwitch switch2 = new ToolSwitch(ToolSwitchType.Boolean) - { - DisplayName = "Ignore All Default C++ Libraries", - Description = "The -nostdlib++ option tells the linker to remove one or more default libraries from the list of libraries it searches when resolving external references. ", - ArgumentRelationList = new ArrayList(), - SwitchValue = "-nostdlib++", - Name = IGNOR_ALL_DEFAULT_CPP_LIB, - BooleanValue = value - }; - base.ActiveToolSwitches.Add(IGNOR_ALL_DEFAULT_CPP_LIB, switch2); - base.AddActiveSwitchToolValue(switch2); - } - } - - /// - /// Getter/Setter for the LinkIncremental Property - /// - public virtual bool LinkIncremental - { - get - { - return (base.IsPropertySet(LINK_INCREMENTAL) && base.ActiveToolSwitches[LINK_INCREMENTAL].BooleanValue); - } - set - { - base.ActiveToolSwitches.Remove(LINK_INCREMENTAL); - ToolSwitch switch2 = new ToolSwitch(ToolSwitchType.Boolean) - { - DisplayName = "Enable Incremental Linking", - Description = "Enables incremental linking. (/INCREMENTAL, /INCREMENTAL:NO)", - ArgumentRelationList = new ArrayList(), - SwitchValue = "/INCREMENTAL", - ReverseSwitchValue = "/INCREMENTAL:NO", - Name = LINK_INCREMENTAL, - BooleanValue = value - }; - base.ActiveToolSwitches.Add(LINK_INCREMENTAL, switch2); - base.AddActiveSwitchToolValue(switch2); - switch2.Overrides.AddLast(new KeyValuePair("INCREMENTAL", "INCREMENTAL:NO")); - switch2.Overrides.AddLast(new KeyValuePair("INCREMENTAL:NO", "INCREMENTAL")); - } - } - - /// - /// Getter/Setter for the LinkStatus property - /// - public virtual bool LinkStatus - { - get - { - return (base.IsPropertySet(LINK_STATUS) && base.ActiveToolSwitches[LINK_STATUS].BooleanValue); - } - set - { - base.ActiveToolSwitches.Remove(LINK_STATUS); - ToolSwitch switch2 = new ToolSwitch(ToolSwitchType.Boolean) - { - DisplayName = "Link Status", - Description = "Specifies whether the linker should display a progress indicator showing what percentage of the link is complete. The default is to not display this status information. (/LTCG:STATUS|LTCG:NOSTATUS)", - ArgumentRelationList = new ArrayList(), - SwitchValue = "/LTCG:STATUS", - ReverseSwitchValue = "/LTCG:NOSTATUS", - Name = LINK_STATUS, - BooleanValue = value - }; - base.ActiveToolSwitches.Add(LINK_STATUS, switch2); - base.AddActiveSwitchToolValue(switch2); - switch2.Overrides.AddLast(new KeyValuePair("LTCG:STATUS", "LTCG:NOSTATUS")); - switch2.Overrides.AddLast(new KeyValuePair("LTCG:NOSTATUS", "LTCG:STATUS")); - } - } - - /// - /// Getter/Setter for the LinkLibraryDependencies - /// - public virtual bool LinkLibraryDependencies - { - get - { - return (base.IsPropertySet(LINK_LIB_DEP) && base.ActiveToolSwitches[LINK_LIB_DEP].BooleanValue); - } - set - { - base.ActiveToolSwitches.Remove(LINK_LIB_DEP); - ToolSwitch switch2 = new ToolSwitch(ToolSwitchType.Boolean) - { - DisplayName = "Link Library Dependencies", - Description = "Specifies whether or not library outputs from project dependencies are automatically linked in.", - ArgumentRelationList = new ArrayList(), - Name = LINK_LIB_DEP, - BooleanValue = value - }; - base.ActiveToolSwitches.Add(LINK_LIB_DEP, switch2); - base.AddActiveSwitchToolValue(switch2); - } - } - - /// - /// Getter/Setter for the OutputFile property - /// - public virtual string OutputFile - { - get - { - if (base.IsPropertySet(OUTPUT_FILE)) - { - return base.ActiveToolSwitches[OUTPUT_FILE].Value; - } - return null; - } - set - { - base.ActiveToolSwitches.Remove(OUTPUT_FILE); - - ToolSwitch switch2 = new ToolSwitch(ToolSwitchType.File) - { - DisplayName = "Output File", - Description = "The -o option overrides the default name and location of the program that the linker creates.", - ArgumentRelationList = new ArrayList(), - SwitchValue = "-o ", - Name = OUTPUT_FILE, - Value = value - }; - base.ActiveToolSwitches.Add(OUTPUT_FILE, switch2); - base.AddActiveSwitchToolValue(switch2); - } - } - - /// - /// Getter/Setter for the TreatLinkerWarningAsErrors property. - /// - public virtual bool TreatLinkerWarningAsErrors - { - get - { - return (base.IsPropertySet(TREAT_LINK_WARNING_AS_ERR) && base.ActiveToolSwitches[TREAT_LINK_WARNING_AS_ERR].BooleanValue); - } - set - { - base.ActiveToolSwitches.Remove(TREAT_LINK_WARNING_AS_ERR); - ToolSwitch switch2 = new ToolSwitch(ToolSwitchType.Boolean) - { - DisplayName = "Treat Linker Warning As Errors", - Description = "/WX causes no output file to be generated if the linker generates a warning.", - ArgumentRelationList = new ArrayList(), - SwitchValue = "/WX", - ReverseSwitchValue = "/WX:NO", - Name = TREAT_LINK_WARNING_AS_ERR, - BooleanValue = value - }; - base.ActiveToolSwitches.Add(TREAT_LINK_WARNING_AS_ERR, switch2); - base.AddActiveSwitchToolValue(switch2); - switch2.Overrides.AddLast(new KeyValuePair("WX", "WX:NO")); - switch2.Overrides.AddLast(new KeyValuePair("WX:NO", "WX")); - } - } - #endregion - - } -} diff --git a/src_vs2012/VSNDK.Tasks/RemoveFlagFile.cs b/src_vs2012/VSNDK.Tasks/RemoveFlagFile.cs deleted file mode 100644 index 89548707..00000000 --- a/src_vs2012/VSNDK.Tasks/RemoveFlagFile.cs +++ /dev/null @@ -1,68 +0,0 @@ -//* Copyright 2010-2011 Research In Motion Limited. -//* -//* Licensed under the Apache License, Version 2.0 (the "License"); -//* you may not use this file except in compliance with the License. -//* You may obtain a copy of the License at -//* -//* http://www.apache.org/licenses/LICENSE-2.0 -//* -//* Unless required by applicable law or agreed to in writing, software -//* distributed under the License is distributed on an "AS IS" BASIS, -//* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//* See the License for the specific language governing permissions and -//* limitations under the License. - -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.IO; -using System.Collections; -using Microsoft.Build.Framework; -using Microsoft.Build.Utilities; - -namespace VSNDK.Tasks -{ - - /// - /// MSBuild Task for reading in the flag file from the start debugging button. - /// - public class RemoveFlagFile : Task - { - #region Member Variables and Constants. - private string _flagFile; - #endregion - - /// - /// Execute the MSBuild Task - /// - /// - public override bool Execute() - { - bool removed; - try - { - File.Delete(_flagFile); - removed = true; - } - catch (DirectoryNotFoundException dirNotFound) - { - Console.WriteLine(dirNotFound.Message); - removed = false; - } - return removed; - } - - /// - /// Setter for FlagFile property - /// - [Required] - public string FlagFile - { - set - { - _flagFile = value; - } - } - } -} diff --git a/src_vs2012/VSNDK.Tasks/SSHDelete.cs b/src_vs2012/VSNDK.Tasks/SSHDelete.cs deleted file mode 100644 index 6eeff091..00000000 --- a/src_vs2012/VSNDK.Tasks/SSHDelete.cs +++ /dev/null @@ -1,325 +0,0 @@ -//* Copyright 2010-2011 Research In Motion Limited. -//* -//* Licensed under the Apache License, Version 2.0 (the "License"); -//* you may not use this file except in compliance with the License. -//* You may obtain a copy of the License at -//* -//* http://www.apache.org/licenses/LICENSE-2.0 -//* -//* Unless required by applicable law or agreed to in writing, software -//* distributed under the License is distributed on an "AS IS" BASIS, -//* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//* See the License for the specific language governing permissions and -//* limitations under the License. - -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using Microsoft.Build.CPPTasks; -using System.Resources; -using System.Reflection; -using System.Collections; -using Microsoft.Build.Framework; -using Microsoft.Build.Utilities; - -namespace VSNDK.Tasks -{ - public class SSHDelete : TrackedVCToolTask - { - #region Member Variables and Constants - protected ArrayList switchOrderList; - - private const string DEVICE = "Device"; - private const string PRIVATE_KEY_PATH = "PrivateKeyPath"; - private const string DELETE_FILES = "DeleteFiles"; - private const string PACKAGE_ID = "PackageId"; - private const string PACKAGE_NAME = "PackageName"; - #endregion - - /// - /// SSHDelete Constructor - /// - public SSHDelete() - : base(new ResourceManager("VSNDK.Tasks.Properties.Resources", Assembly.GetExecutingAssembly())) - { - this.switchOrderList = new ArrayList(); - this.switchOrderList.Add(PRIVATE_KEY_PATH); - } - - /// - /// Return the Response File Switch string - /// - /// - /// - protected override string GetResponseFileSwitch(string responseFilePath) - { - return string.Empty; - } - - /// - /// Return the command line string - /// - /// - protected override string GenerateCommandLineCommands() - { - return GenerateResponseFileCommands(); - } - - /// - /// Getter/Setter for the CommandTLogName property - /// - protected override string CommandTLogName - { - get { return "SSHDelete.command.1.tlog"; } - } - - /// - /// Getter/Setter for the ReadTLogNames string - /// - protected override string[] ReadTLogNames - { - get { return new string[] { "SSHDelete.read.1.tlog", "SSHDelete.*.read.1.tlog" }; } - } - - /// - /// Getter/Setter for the WriteTLogNames string - /// - protected override string[] WriteTLogNames - { - get - { - return new string[] { "SSHDelete.write.1.tlog", "SSHDelete.*.write.1.tlog" }; - } - } - - /// - /// Getter/Setter for the TrackedInputFiles string - /// - protected override Microsoft.Build.Framework.ITaskItem[] TrackedInputFiles - { - get - { - if (base.IsPropertySet(DELETE_FILES)) - { - return base.ActiveToolSwitches[DELETE_FILES].TaskItemArray; - } - return null; - } - } - - /// - /// Getter/Setter for the ToolName property - /// - protected override string ToolName - { - get - { - return ToolExe; - } - } - - /// - /// Getter/Setter for the TrackerIntermediateDirectory property - /// - protected override string TrackerIntermediateDirectory - { - get - { - return string.Empty; - } - } - - /// - /// Function to generate the response file commands string - /// - /// - protected override string GenerateResponseFileCommands() - { - string cmd = base.GenerateResponseFileCommands(); - - cmd += " -o \"StrictHostKeyChecking no\""; - - if (base.IsPropertySet(DEVICE)) - { - cmd += " devuser@" + base.ActiveToolSwitches[DEVICE].Value; - } - - if (base.IsPropertySet(DELETE_FILES)) - { - string path = "../../../../apps/" + PackageName + "." + PackageId + "/"; - cmd += " '"; - foreach (ITaskItem taskItem in base.ActiveToolSwitches[DELETE_FILES].TaskItemArray) - { - cmd += "rm " + path + taskItem.GetMetadata("Identity") + "; "; - } - cmd += "'"; - } - else - { - cmd += "'pwd;'"; - } - - return cmd; - } - - /// - /// Getter/Setter for the SwitchOrderList property. - /// - protected override ArrayList SwitchOrderList - { - get - { - return this.switchOrderList; - } - } - - /// - /// Getter/Setter for the Device property - /// - public virtual string Device - { - get - { - if (base.IsPropertySet(DEVICE)) - { - return base.ActiveToolSwitches[DEVICE].Value; - } - return null; - } - set - { - base.ActiveToolSwitches.Remove(DEVICE); - ToolSwitch toolSwitch = new ToolSwitch(ToolSwitchType.String) - { - Name = DEVICE, - DisplayName = "Device IP", - Description = "Specifies the target device's IP address.", - ArgumentRelationList = new ArrayList(), - SwitchValue = "devuser@", - Value = value - }; - base.ActiveToolSwitches.Add(DEVICE, toolSwitch); - base.AddActiveSwitchToolValue(toolSwitch); - } - } - - /// - /// Getter/Setter for the PrivateKeyPath property - /// - public virtual string PrivateKeyPath - { - get - { - if (base.IsPropertySet(PRIVATE_KEY_PATH)) - { - return base.ActiveToolSwitches[PRIVATE_KEY_PATH].Value; - } - return null; - } - set - { - base.ActiveToolSwitches.Remove(PRIVATE_KEY_PATH); - ToolSwitch toolSwitch = new ToolSwitch(ToolSwitchType.String) - { - Name = PRIVATE_KEY_PATH, - DisplayName = "Path to public key", - Description = "The -i option specifies the public SSH key to use.", - ArgumentRelationList = new ArrayList(), - SwitchValue = "-i ", - Value = value - }; - base.ActiveToolSwitches.Add(PRIVATE_KEY_PATH, toolSwitch); - base.AddActiveSwitchToolValue(toolSwitch); - } - } - - /// - /// Getter/Setter for the PackageId property - /// - public virtual string PackageId - { - get - { - if (base.IsPropertySet(PACKAGE_ID)) - { - return base.ActiveToolSwitches[PACKAGE_ID].Value; - } - return null; - } - set - { - base.ActiveToolSwitches.Remove(PACKAGE_ID); - ToolSwitch toolSwitch = new ToolSwitch(ToolSwitchType.String) - { - Name = PACKAGE_ID, - DisplayName = "Package ID", - Description = "The -package-id option specifies the application's package id.", - ArgumentRelationList = new ArrayList(), - SwitchValue = "-package-id ", - Value = value - }; - base.ActiveToolSwitches.Add(PACKAGE_ID, toolSwitch); - base.AddActiveSwitchToolValue(toolSwitch); - } - } - - /// - /// Getter/Setter for the PackageName property - /// - public virtual string PackageName - { - get - { - if (base.IsPropertySet(PACKAGE_NAME)) - { - return base.ActiveToolSwitches[PACKAGE_NAME].Value; - } - return null; - } - set - { - base.ActiveToolSwitches.Remove(PACKAGE_NAME); - ToolSwitch toolSwitch = new ToolSwitch(ToolSwitchType.String) - { - Name = PACKAGE_NAME, - DisplayName = "Package Name", - Description = "The -package-name option specifies the application's package name.", - ArgumentRelationList = new ArrayList(), - SwitchValue = "-package-name ", - Value = value - }; - base.ActiveToolSwitches.Add(PACKAGE_NAME, toolSwitch); - base.AddActiveSwitchToolValue(toolSwitch); - } - } - - /// - /// Getter/Setter for the DeleteFiles property - /// - public virtual ITaskItem[] DeleteFiles - { - get - { - if (base.IsPropertySet(DELETE_FILES)) - { - return base.ActiveToolSwitches[DELETE_FILES].TaskItemArray; - } - return null; - } - set - { - base.ActiveToolSwitches.Remove(DELETE_FILES); - ToolSwitch toolSwitch = new ToolSwitch(ToolSwitchType.ITaskItemArray) - { - Name = DELETE_FILES, - DisplayName = "Files to delete", - Description = "Delete all items in the array from the device.", - TaskItemArray = value - }; - base.ActiveToolSwitches.Add(DELETE_FILES, toolSwitch); - base.AddActiveSwitchToolValue(toolSwitch); - } - } - } -} diff --git a/src_vs2012/VSNDK.Tasks/VSNDK.Tasks.csproj b/src_vs2012/VSNDK.Tasks/VSNDK.Tasks.csproj index 8f8dac20..d8cfead8 100644 --- a/src_vs2012/VSNDK.Tasks/VSNDK.Tasks.csproj +++ b/src_vs2012/VSNDK.Tasks/VSNDK.Tasks.csproj @@ -34,7 +34,7 @@ full false bin\Debug\ - DEBUG;TRACE + TRACE;DEBUG;PLATFORM_VS2012 prompt 4 false @@ -44,7 +44,7 @@ pdbonly true bin\Release\ - TRACE + TRACE;PLATFORM_VS2012 prompt 4 false @@ -75,89 +75,111 @@ - - + + AsyncExec.cs + + + BarDescriptor\Parser.cs + + + BarDescriptor\Schema\bar-descriptor.cs bar-descriptor.xsd - - - - - - - - - - - - - - + + BBDeploy.cs + + + BBNativePackager.cs + + + BBSigner.cs + + + CheckIfInstalled.cs + + + DiffManifests.cs + + + GenerateMakefile.cs + + + GetAppInfo.cs + + + MakeAllAndFormatOutputMessages.cs + + + PackagerCmdBuilder.cs + + + Properties\AssemblyInfo.cs + + + Properties\Resources.Designer.cs True True Resources.resx - - - - - - - - ResXFileCodeGenerator - Resources.Designer.cs - Designer - + + QccCompiler.cs + + + QccLib.cs + + + QccLink.cs + + + RemoveFlagFile.cs + + + SSHDelete.cs + + + VSNDKTasks.cs + - + + BarDescriptor\Schema\bar-descriptor.xsd Designer - - Designer - Always + + BlackBerrySimulator\Microsoft.Cpp.BlackBerrySimulator.default.props - - Designer - Always + + BlackBerrySimulator\Microsoft.Cpp.BlackBerrySimulator.Packager.targets - - Designer - Always + + BlackBerrySimulator\Microsoft.Cpp.BlackBerrySimulator.props - - Designer - Always + + BlackBerrySimulator\Microsoft.Cpp.BlackBerrySimulator.targets - - Designer - Always + + BlackBerrySimulator\Microsoft.CppBuild.BlackBerrySimulator.targets - - Designer - Always + + BlackBerry\Microsoft.Cpp.BlackBerry.default.props - - Designer - Always + + BlackBerry\Microsoft.Cpp.BlackBerry.Packager.targets - - Always + + BlackBerry\Microsoft.Cpp.BlackBerry.props - - Designer - Always + + BlackBerry\Microsoft.Cpp.BlackBerry.targets - - Designer - Always + + BlackBerry\Microsoft.CppBuild.BlackBerry.targets - + Designer Always - - Designer + Always @@ -169,74 +191,62 @@ - - Designer + + BarDescriptor\Schema\bar-descriptor.xml - - Always + + BlackBerrySimulator\Rules\debugger_ndk.xml - - Always + + BlackBerrySimulator\Rules\ndkProjectItemsSchema.xml - - Always - Designer + + BlackBerrySimulator\Rules\ndk_directories.xml - - Always - Designer + + BlackBerrySimulator\Rules\ndk_general.xml - - Designer - Always + + BlackBerrySimulator\Rules\ndk_general_ps.xml - - Always + + BlackBerrySimulator\Rules\packager.xml - - Designer - Always + + BlackBerrySimulator\Rules\qcc_cl.xml - - Designer - Always + + BlackBerrySimulator\Rules\qcc_lib.xml - - Designer - Always + + BlackBerrySimulator\Rules\qcc_link.xml - - Always - Designer + + BlackBerry\Rules\debugger_ndk.xml - - Always + + BlackBerry\Rules\ndkProjectItemsSchema.xml - - Always + + BlackBerry\Rules\ndk_directories.xml - - Designer - Always + + BlackBerry\Rules\ndk_general.xml - - Always + + BlackBerry\Rules\ndk_general_ps.xml - - Always - Designer + + BlackBerry\Rules\packager.xml - - Designer - Always + + BlackBerry\Rules\qcc_cl.xml - - Designer - Always + + BlackBerry\Rules\qcc_lib.xml - - Designer - Always + + BlackBerry\Rules\qcc_link.xml @@ -261,6 +271,13 @@ true + + + Properties\Resources.resx + ResXFileCodeGenerator + Resources.Designer.cs + + diff --git a/src_vs2012/VSNDK.Tasks/VSNDKTasks.cs b/src_vs2012/VSNDK.Tasks/VSNDKTasks.cs deleted file mode 100644 index e17c8019..00000000 --- a/src_vs2012/VSNDK.Tasks/VSNDKTasks.cs +++ /dev/null @@ -1,680 +0,0 @@ -//* Copyright 2010-2011 Research In Motion Limited. -//* -//* Licensed under the Apache License, Version 2.0 (the "License"); -//* you may not use this file except in compliance with the License. -//* You may obtain a copy of the License at -//* -//* http://www.apache.org/licenses/LICENSE-2.0 -//* -//* Unless required by applicable law or agreed to in writing, software -//* distributed under the License is distributed on an "AS IS" BASIS, -//* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//* See the License for the specific language governing permissions and -//* limitations under the License. - -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using Microsoft.Build.Utilities; -using Microsoft.Build.CPPTasks; -using System.Resources; -using System.Reflection; -using Microsoft.Build.Framework; -using System.Collections; -using System.IO; - -namespace VSNDK.Tasks -{ - public abstract class VSNDKTasks : TrackedVCToolTask - { - #region fields - // Fields - protected ArrayList switchOrderList; - - //constant fields - protected const string GENERATE_DEBUG_INFORMATION = "GenerateDebugInformation"; - protected const string WARING_LEVEL = "WarningLevel"; - protected const string TREAT_WARNING_AS_ERROR = "TreatWarningAsError"; - protected const string TRACKER_LOG_DIRECTORY = "TrackerLogDirectory"; - protected const string OPTIMIZATION = "Optimization"; - protected const string GCC_EXCEPTION_HANDLING = "GccExceptionHandling"; - protected const string SOURCES = "Sources"; - protected const string ADDITIONAL_OPTIONS = "AdditionalOptions"; - protected const string BUILDING_IN_IDE = "BuildingInIDE"; - protected const string ENHANCED_SECURITY = "EnhancedSecurity"; - protected const string POSITION_INDEPENDENT_EXECUTABLE = "PIE"; - protected const string COMPILER_VERSION_TARGET = "CompilerVersionTarget"; - protected const string VERBOSE = "Verbose"; - protected const string COMPILE_AS = "CompileAs"; - - private static string ERROR = " error:"; - private static string WARNING = " warning:"; - #endregion - - #region ctors - - /// - /// VSNDKTasks Constructor - /// - /// - public VSNDKTasks(ResourceManager res) - : base(res) - { - this.switchOrderList = new ArrayList(); - this.switchOrderList.Add(COMPILER_VERSION_TARGET); - this.switchOrderList.Add("AlwaysAppend"); - this.switchOrderList.Add(GENERATE_DEBUG_INFORMATION); - this.switchOrderList.Add(VERBOSE); - this.switchOrderList.Add(WARING_LEVEL); - this.switchOrderList.Add(TREAT_WARNING_AS_ERROR); - this.switchOrderList.Add(TRACKER_LOG_DIRECTORY); - this.switchOrderList.Add(OPTIMIZATION); - this.switchOrderList.Add(GCC_EXCEPTION_HANDLING); - this.switchOrderList.Add(ADDITIONAL_OPTIONS); - this.switchOrderList.Add(BUILDING_IN_IDE); - this.switchOrderList.Add(ENHANCED_SECURITY); - this.switchOrderList.Add(POSITION_INDEPENDENT_EXECUTABLE); - this.switchOrderList.Add(COMPILE_AS); - } - #endregion - - #region overrides - /// - /// don't use response file for msbuild because it is removed before qcc to run GCC compiler - /// - /// - /// - protected override string GetResponseFileSwitch(string responseFilePath) - { - return string.Empty; - } - - /// - /// instead pass the response file to command line commands - /// - /// - protected override string GenerateCommandLineCommands() - { - string cmd = GenerateResponseFileCommands(); - return cmd; - } - - /// - /// Function to assign out of date sources - /// - /// - /// - protected override ITaskItem[] AssignOutOfDateSources(ITaskItem[] sources) - { - base.ActiveToolSwitches[SOURCES].TaskItemArray = sources; - return sources; - } - - /// - /// Getter/Setter for SwitchOrderList property - /// - protected override ArrayList SwitchOrderList - { - get - { - return this.switchOrderList; - } - } - - /// - /// Getter/Setter for TrackedInputFiles property - /// - protected override Microsoft.Build.Framework.ITaskItem[] TrackedInputFiles - { - get - { - return Sources; - } - } - - /// - /// Getter/Setter for TrackerIntermediateDirectory - /// - protected override string TrackerIntermediateDirectory - { - get - { - if (this.TrackerLogDirectory != null) - { - return this.TrackerLogDirectory; - } - return string.Empty; - } - } - - /// - /// Getter/Setter for ToolName property - /// - protected override string ToolName - { - get { return QccExe; } - } - - /// - /// Getter/Setter for LogEventsFromTextOutput - /// - /// - /// - protected override void LogEventsFromTextOutput(string singleLine, MessageImportance messageImportance) - { - base.LogEventsFromTextOutput(Reformat(singleLine), messageImportance); - } - - - - /// - /// Reformat the qcc compiler error to msbuild known error format - /// singeLine: main.c:53: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'int' - /// or main.c:38:19: error: hello.h: No such file or directory - /// output: main.c(53): error QCC001: expected '=', ',', ';', 'asm' or '__attribute__' before 'int' - /// TODO: this method need to be updated in case any more error formats of qcc compiler - /// - /// - /// - private string Reformat(string singleLine) - { - string msbuilError = singleLine; - string[] separators = { ERROR, WARNING }; - string errCode = singleLine.Contains(ERROR) ? "error qcc" : "warning qcc"; - string[] parts = singleLine.Split(separators, StringSplitOptions.None); - if (parts != null && parts.Length > 1) - { - string[] segments = parts[0].Split(new Char[]{':'}, StringSplitOptions.RemoveEmptyEntries); - if (segments.Length == 3) - msbuilError = String.Format("{0}({1}-{2}): {3}: {4}", segments[0], segments[1], segments[2], errCode, parts[1]); - if ( segments.Length == 2 ) - msbuilError = String.Format("{0}({1}): {2}: {3}", segments[0], segments[1], errCode, parts[1]); - } - return msbuilError; - } - - /// - /// getter/setter for UseUnicodeOutput - /// - protected override bool UseUnicodeOutput - { - get - { - return this.BuildingInIDE; - } - } - - #endregion //override - - #region properties - - /// - /// Getter/Setter for GenerateDebugInformation property - /// - public virtual bool GenerateDebugInformation - { - get - { - if (base.IsPropertySet(GENERATE_DEBUG_INFORMATION)) - { - return base.ActiveToolSwitches[GENERATE_DEBUG_INFORMATION].BooleanValue; - } - return false; - } - set - { - base.ActiveToolSwitches.Remove(GENERATE_DEBUG_INFORMATION); - ToolSwitch switch2 = new ToolSwitch(ToolSwitchType.Boolean) - { - DisplayName = "Generate Debug Info", - Description = "Generate Debug Info (-g)", - ArgumentRelationList = new ArrayList() - }; - switch2.SwitchValue = "-g"; - switch2.Name = GENERATE_DEBUG_INFORMATION; - switch2.BooleanValue = value; - base.ActiveToolSwitches.Add(GENERATE_DEBUG_INFORMATION, switch2); - base.AddActiveSwitchToolValue(switch2); - } - } - - /// - /// Getter/Setter for WarningLevel property - /// - public virtual string WarningLevel - { - get - { - if (base.IsPropertySet(WARING_LEVEL)) - { - return base.ActiveToolSwitches[WARING_LEVEL].Value; - } - return null; - } - set - { - base.ActiveToolSwitches.Remove(WARING_LEVEL); - ToolSwitch switch2 = new ToolSwitch(ToolSwitchType.String) - { - DisplayName = "Warning Level", - Description = "Select how strict you want the compiler to be about code errors. (-w0 - -w4)", - ArgumentRelationList = new ArrayList() - }; - string[][] switchMap = new string[][] - { new string[] { "TurnOffAllWarnings", "-w0" }, - new string[] { "Level1", "-w1" }, - new string[] { "Level2", "-w2" }, - new string[] { "Level3", "-w3" }, - new string[] { "Level4", "-w4" }, - new string[] { "Level5", "-w5" }, - new string[] { "Level6", "-w6" }, - new string[] { "Level7", "-w7" }, - new string[] { "Level8", "-w8" }, - new string[] { "Level9", "-w9" }, - new string[] { "EnableAllWarnings", "-Wall" } }; - switch2.SwitchValue = base.ReadSwitchMap(WARING_LEVEL, switchMap, value); - switch2.Name = WARING_LEVEL; - switch2.Value = value; - switch2.MultipleValues = true; - base.ActiveToolSwitches.Add(WARING_LEVEL, switch2); - base.AddActiveSwitchToolValue(switch2); - } - } - - /// - /// Getter/Setter for TreatWarningAsError property - /// - public virtual bool TreatWarningAsError - { - get - { - if (base.IsPropertySet(TREAT_WARNING_AS_ERROR)) - { - return base.ActiveToolSwitches[TREAT_WARNING_AS_ERROR].BooleanValue; - } - return false; - } - set - { - base.ActiveToolSwitches.Remove(TREAT_WARNING_AS_ERROR); - ToolSwitch switch2 = new ToolSwitch(ToolSwitchType.Boolean) - { - DisplayName = "Treat Warnings as Errors", - Description = "Treat Warnings as Errors", - ArgumentRelationList = new ArrayList() - }; - switch2.ArgumentRelationList.Add(new ArgumentRelation(TREAT_WARNING_AS_ERROR, "true", false, "")); - switch2.SwitchValue = "-Werror"; - switch2.Name = TREAT_WARNING_AS_ERROR; - switch2.BooleanValue = value; - base.ActiveToolSwitches.Add(TREAT_WARNING_AS_ERROR, switch2); - base.AddActiveSwitchToolValue(switch2); - } - } - - /// - /// Getter/Setter for BuildingInIDE property - /// - public virtual bool BuildingInIDE - { - get - { - return (base.IsPropertySet(BUILDING_IN_IDE) && base.ActiveToolSwitches[BUILDING_IN_IDE].BooleanValue); - } - set - { - base.ActiveToolSwitches.Remove(BUILDING_IN_IDE); - ToolSwitch switch2 = new ToolSwitch(ToolSwitchType.Boolean) - { - ArgumentRelationList = new ArrayList(), - Name = BUILDING_IN_IDE, - BooleanValue = value - }; - base.ActiveToolSwitches.Add(BUILDING_IN_IDE, switch2); - base.AddActiveSwitchToolValue(switch2); - } - } - - /// - /// Getter/Setter for GccExceptHandling property - /// - public virtual string GccExceptionHandling - { - get - { - if (base.IsPropertySet("ExceptionHandling")) - { - return base.ActiveToolSwitches["ExceptionHandling"].Value; - } - return null; - } - set - { - base.ActiveToolSwitches.Remove("ExceptionHandling"); - ToolSwitch switch2 = new ToolSwitch(ToolSwitchType.String) - { - DisplayName = "Enable C++ Exceptions", - Description = "Specifies the model of exception handling to be used by the compiler.", - ArgumentRelationList = new ArrayList() - }; - string[][] switchMap = new string[][] { new string[] { "Async", "/EHa" }, new string[] { "Sync", "/EHsc" }, new string[] { "SyncCThrow", "/EHs" }, new string[] { "false", "" } }; - switch2.SwitchValue = base.ReadSwitchMap("ExceptionHandling", switchMap, value); - switch2.Name = "ExceptionHandling"; - switch2.Value = value; - switch2.MultipleValues = true; - base.ActiveToolSwitches.Add("ExceptionHandling", switch2); - base.AddActiveSwitchToolValue(switch2); - } - } - - /// - /// Getter/Setter for Optimization property - /// - public virtual string Optimization - { - get - { - if (base.IsPropertySet(OPTIMIZATION)) - { - return base.ActiveToolSwitches[OPTIMIZATION].Value; - } - return null; - } - set - { - base.ActiveToolSwitches.Remove(OPTIMIZATION); - ToolSwitch switch2 = new ToolSwitch(ToolSwitchType.String) - { - DisplayName = OPTIMIZATION, - Description = "Select option for code optimization; choose Custom to use specific optimization options. (-O0, -O1, -O2, -O3)", - ArgumentRelationList = new ArrayList() - }; - string[][] switchMap = new string[][] { new string[] { "Disabled", "-O0" }, new string[] { "MinSpace", "-O1" }, - new string[] { "MaxSpeed", "-O2" }, new string[] { "Full", "-O3" } }; - switch2.SwitchValue = base.ReadSwitchMap(OPTIMIZATION, switchMap, value); - switch2.Name = OPTIMIZATION; - switch2.Value = value; - switch2.MultipleValues = true; - base.ActiveToolSwitches.Add(OPTIMIZATION, switch2); - base.AddActiveSwitchToolValue(switch2); - } - } - - /// - /// Getter/Setter for PlatformToolset property - /// - public virtual string PlatformToolset - { - get - { - return "qcc"; - } - } - - /// - /// Getter/Setter for TrackerLogDirectory - /// - public virtual string TrackerLogDirectory - { - get - { - if ( base.IsPropertySet( TRACKER_LOG_DIRECTORY ) ) - { - return base.ActiveToolSwitches[TRACKER_LOG_DIRECTORY].Value; - } - return null; - } - set - { - base.ActiveToolSwitches.Remove( TRACKER_LOG_DIRECTORY ); - ToolSwitch switch2 = new ToolSwitch( ToolSwitchType.Directory ) - { - DisplayName = "Tracker Log Directory", - Description = "Tracker Log Directory.", - ArgumentRelationList = new ArrayList(), - Value = VCToolTask.EnsureTrailingSlash( value ) - }; - base.ActiveToolSwitches.Add( TRACKER_LOG_DIRECTORY, switch2 ); - base.AddActiveSwitchToolValue( switch2 ); - } - } - - /// - /// Getter/Setter for TargetMachine property - /// - public virtual string TargetMachine - { - get - { - if (base.IsPropertySet("TargetMachine")) - { - return base.ActiveToolSwitches["TargetMachine"].Value; - } - return null; - } - set - { - base.ActiveToolSwitches.Remove("TargetMachine"); - ToolSwitch switch2 = new ToolSwitch(ToolSwitchType.String) - { - DisplayName = "Target Machine", - Description = "The /MACHINE option specifies the target platform for the program.", - ArgumentRelationList = new ArrayList() - }; - string[][] switchMap = new string[][] { new string[] { "MachineARM", "/MACHINE:ARM" }, new string[] { "MachineEBC", "/MACHINE:EBC" }, new string[] { "MachineIA64", "/MACHINE:IA64" }, new string[] { "MachineMIPS", "/MACHINE:MIPS" }, new string[] { "MachineMIPS16", "/MACHINE:MIPS16" }, new string[] { "MachineMIPSFPU", "/MACHINE:MIPSFPU" }, new string[] { "MachineMIPSFPU16", "/MACHINE:MIPSFPU16" }, new string[] { "MachineSH4", "/MACHINE:SH4" }, new string[] { "MachineTHUMB", "/MACHINE:THUMB" }, new string[] { "MachineX64", "/MACHINE:X64" }, new string[] { "MachineX86", "/MACHINE:X86" } }; - switch2.SwitchValue = base.ReadSwitchMap("TargetMachine", switchMap, value); - switch2.Name = "TargetMachine"; - switch2.Value = value; - switch2.MultipleValues = true; - base.ActiveToolSwitches.Add("TargetMachine", switch2); - base.AddActiveSwitchToolValue(switch2); - } - } - - /// - /// Getter/Setter for CompileAs property - /// - public virtual string CompileAs - { - get - { - if (base.IsPropertySet(COMPILE_AS)) - { - return base.ActiveToolSwitches[COMPILE_AS].Value; - } - return null; - } - set - { - base.ActiveToolSwitches.Remove(COMPILE_AS); - ToolSwitch switch2 = new ToolSwitch(ToolSwitchType.String) - { - DisplayName = "Compile As", - Description = "Select compile language option for .c and .cpp files. (-lang-c, -lang-c++)", - ArgumentRelationList = new ArrayList() - }; - string[][] switchMap = new string[][] { new string[] { "CompileAsC", "-lang-c" }, new string[] { "CompileAsCpp", "-lang-c++" } }; - switch2.SwitchValue = base.ReadSwitchMap(COMPILE_AS, switchMap, value); - switch2.Name = COMPILE_AS; - switch2.Value = value; - switch2.MultipleValues = true; - base.ActiveToolSwitches.Add(COMPILE_AS, switch2); - base.AddActiveSwitchToolValue(switch2); - } - } - - /// - /// Getter/Setter for Verbose property - /// - public bool Verbose - { - get - { - return (base.IsPropertySet(VERBOSE) && base.ActiveToolSwitches[VERBOSE].BooleanValue); - } - set - { - base.ActiveToolSwitches.Remove(VERBOSE); - ToolSwitch switch2 = new ToolSwitch(ToolSwitchType.Boolean) - { - DisplayName = "Verbose", - Description = "Verbose", - ArgumentRelationList = new ArrayList(), - SwitchValue = "-v", - Name = VERBOSE, - BooleanValue = value - }; - base.ActiveToolSwitches.Add(VERBOSE, switch2); - base.AddActiveSwitchToolValue(switch2); - } - } - - /// - /// Getter/Setter for EnhancedSecutiry property - /// - public virtual bool EnhancedSecurity - { - get - { - return (base.IsPropertySet(ENHANCED_SECURITY) && base.ActiveToolSwitches[ENHANCED_SECURITY].BooleanValue); - } - set - { - base.ActiveToolSwitches.Remove(ENHANCED_SECURITY); - ToolSwitch switch2 = new ToolSwitch(ToolSwitchType.Boolean) - { - DisplayName = "Enhanced Security(-fstack-protector-all)", - Description = " ", - ArgumentRelationList = new ArrayList(), - SwitchValue = GetEnhancedSecuritySwitchValue(), - Name = ENHANCED_SECURITY, - BooleanValue = value - }; - base.ActiveToolSwitches.Add(ENHANCED_SECURITY, switch2); - base.AddActiveSwitchToolValue(switch2); - } - } - - /// - /// Return the Get Enhanced Security string. - /// - /// - protected virtual string GetEnhancedSecuritySwitchValue() - { - return "-fstack-protector-all"; - } - - /// - /// Getter/Setter for the PIE property - /// - public bool PIE - { - get - { - return (base.IsPropertySet(POSITION_INDEPENDENT_EXECUTABLE) && base.ActiveToolSwitches[POSITION_INDEPENDENT_EXECUTABLE].BooleanValue); - } - set - { - base.ActiveToolSwitches.Remove(POSITION_INDEPENDENT_EXECUTABLE); - ToolSwitch switch2 = new ToolSwitch(ToolSwitchType.Boolean) - { - DisplayName = "Position Independent Executable(fPIE)", - Description = " ", - ArgumentRelationList = new ArrayList(), - SwitchValue = "-fPIE", - Name = POSITION_INDEPENDENT_EXECUTABLE, - BooleanValue = value - }; - base.ActiveToolSwitches.Add(POSITION_INDEPENDENT_EXECUTABLE, switch2); - base.AddActiveSwitchToolValue(switch2); - } - } - - /// - /// Getter/Setter for the ProfilingCall property - /// - public bool ProfilingCall { get; set; } - - /// - /// Getter/Setter for the CodeCoverage property - /// - public bool CodeCoverage { get; set; } - - /// - /// Getter/Setter for the Mudflap property - /// - public bool Mudflap { get; set; } - - /// - /// Getter/Setter for the QccExe property - /// - public string QccExe { get; set; } - - /// - /// Getter/Setter for the CompilerVersionTarget property - /// - public string CompilerVersionTarget - { - get - { - if (base.IsPropertySet(COMPILER_VERSION_TARGET)) - { - return base.ActiveToolSwitches[COMPILER_VERSION_TARGET].Value; - } - return null; - } - set - { - base.ActiveToolSwitches.Remove(COMPILER_VERSION_TARGET); - ToolSwitch switch2 = new ToolSwitch(ToolSwitchType.String) - { - DisplayName = "Compiler version and target", - Description = " ", - ArgumentRelationList = new ArrayList(), - SwitchValue = "-V", - }; - switch2.Name = COMPILER_VERSION_TARGET; - switch2.Value = value; - - base.ActiveToolSwitches.Add(COMPILER_VERSION_TARGET, switch2); - base.AddActiveSwitchToolValue(switch2); - } - } - - /// - /// Getter/Setter for the LinkSharedLibrary property - /// - public virtual bool LinkSharedLibrary { get; set; } - - /// - /// Getter/Setter for the Sources property - /// - [Required] - public virtual ITaskItem[] Sources - { - get - { - if (base.IsPropertySet(SOURCES)) - { - return base.ActiveToolSwitches[SOURCES].TaskItemArray; - } - return null; - } - set - { - base.ActiveToolSwitches.Remove(SOURCES); - ToolSwitch switch2 = new ToolSwitch(ToolSwitchType.ITaskItemArray) - { - Separator = " ", - Required = true, - ArgumentRelationList = new ArrayList(), - TaskItemArray = value - }; - base.ActiveToolSwitches.Add(SOURCES, switch2); - base.AddActiveSwitchToolValue(switch2); - } - } - #endregion //properties - } -} diff --git a/src_vs2013/VSNDK.Tasks/AsyncExec.cs b/src_vs2013/VSNDK.Tasks/AsyncExec.cs deleted file mode 100644 index 27156d93..00000000 --- a/src_vs2013/VSNDK.Tasks/AsyncExec.cs +++ /dev/null @@ -1,116 +0,0 @@ -//* Copyright 2010-2011 BlackBerry Limited. -//* -//* Licensed under the Apache License, Version 2.0 (the "License"); -//* you may not use this file except in compliance with the License. -//* You may obtain a copy of the License at -//* -//* http://www.apache.org/licenses/LICENSE-2.0 -//* -//* Unless required by applicable law or agreed to in writing, software -//* distributed under the License is distributed on an "AS IS" BASIS, -//* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//* See the License for the specific language governing permissions and -//* limitations under the License. - -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using Microsoft.Build.Tasks; -using System.Diagnostics; -using System.Collections; -using System.Collections.Specialized; -using Microsoft.Build.Framework; -using System.Security.Cryptography; - -namespace VSNDK.Tasks -{ - // This task overrides Exec in order to run commands such as blackberry-connect asynchronously. - public class AsyncExec : Exec - { - private int _processId; - - /// - /// Execute given command asynchronously. - /// - /// Path of executable to be run. - /// Response file commands - /// Command Line Arguments - /// - protected override int ExecuteTool(string pathToTool, string responseFileCommands, string commandLineCommands) - { - string comm = "/Q /C " + Command + " -password " + Decrypt(Password); - - Process process = new Process(); - process.StartInfo = GetProcessStartInfo(pathToTool, comm); - process.StartInfo.UseShellExecute = false; - process.Start(); - _processId = process.Id; - return 0; - } - - /// - /// Helper function to create the ProcessStartInfo object for the running process. - /// - /// Path of executable to be run. - /// Command Line Arguments - /// - protected virtual ProcessStartInfo GetProcessStartInfo(string executable, string arguments) - { - if (arguments.Length > 0x7d00) - { - this.Log.LogWarningWithCodeFromResources("ToolTask.CommandTooLong", new object[] { base.GetType().Name }); - } - - ProcessStartInfo startInfo = new ProcessStartInfo(executable, arguments); - startInfo.WindowStyle = ProcessWindowStyle.Hidden; - startInfo.CreateNoWindow = true; - startInfo.UseShellExecute = true; - - string workingDirectory = this.GetWorkingDirectory(); - if (workingDirectory != null) - { - startInfo.WorkingDirectory = workingDirectory; - } - - StringDictionary environmentOverride = this.EnvironmentOverride; - if (environmentOverride != null) - { - foreach (DictionaryEntry entry in environmentOverride) - { - startInfo.EnvironmentVariables.Remove(entry.Key.ToString()); - startInfo.EnvironmentVariables.Add(entry.Key.ToString(), entry.Value.ToString()); - } - } - - return startInfo; - } - - /// - /// Getter/Setter for Password Property - /// - public virtual string Password - { - set; - get; - } - - /// - /// Helper Function to Decrypt Password - /// - /// - /// - public string Decrypt(string cipher) - { - if (cipher == null) throw new ArgumentNullException("cipher"); - - //parse base64 string - byte[] data = Convert.FromBase64String(cipher); - - //decrypt data - byte[] decrypted = ProtectedData.Unprotect(data, null, DataProtectionScope.LocalMachine); - - return Encoding.Unicode.GetString(decrypted); - } - } -} diff --git a/src_vs2013/VSNDK.Tasks/BBDeploy.cs b/src_vs2013/VSNDK.Tasks/BBDeploy.cs deleted file mode 100644 index 41bd1e26..00000000 --- a/src_vs2013/VSNDK.Tasks/BBDeploy.cs +++ /dev/null @@ -1,700 +0,0 @@ -//* Copyright 2010-2011 Research In Motion Limited. -//* -//* Licensed under the Apache License, Version 2.0 (the "License"); -//* you may not use this file except in compliance with the License. -//* You may obtain a copy of the License at -//* -//* http://www.apache.org/licenses/LICENSE-2.0 -//* -//* Unless required by applicable law or agreed to in writing, software -//* distributed under the License is distributed on an "AS IS" BASIS, -//* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//* See the License for the specific language governing permissions and -//* limitations under the License. - -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Reflection; -using System.Resources; -using Microsoft.Build.CPPTasks; -using System.Collections; -using Microsoft.Build.Framework; -using System.IO; -using Microsoft.Build.Utilities; -using System.Security.Cryptography; - -namespace VSNDK.Tasks -{ - public class BBDeploy : TrackedVCToolTask - { - #region Member Variable Declaration - protected ArrayList switchOrderList; - private string _localManifest; - private const string TRACKER_LOG_DIRECTORY = "TrackerLogDirectory"; - private const string GET_FILE = "GetFile"; - private const string GET_FILE_SAVE_AS = "GetFileSaveAs"; - private const string PUT_FILE = "PutFile"; - private const string PUT_FILE_SAVE_AS = "PutFileSaveAs"; - private const string DEVICE = "Device"; - private const string PASSWORD = "Password"; - private const string PACKAGE_ID = "PackageId"; - private const string PACKAGE_NAME = "PackageName"; - private const string LAUNCH_APP = "LaunchApp"; - private const string INSTALL_APP = "InstallApp"; - private const string LIST_INSTALLED_APPS = "ListInstalledApps"; - private const string DEBUG_NATIVE = "DebugNative"; - private const string PACKAGE = "Package"; - private const string WORKSPACE_LOC = "${workspace_loc:/"; - private string _flagFile; - - #endregion - - /// - /// BBDeploy Constructor - /// - public BBDeploy() - : base(new ResourceManager("VSNDK.Tasks.Properties.Resources", Assembly.GetExecutingAssembly())) - { - this.switchOrderList = new ArrayList(); - this.switchOrderList.Add(INSTALL_APP); - this.switchOrderList.Add(LAUNCH_APP); - this.switchOrderList.Add(LIST_INSTALLED_APPS); - this.switchOrderList.Add(DEBUG_NATIVE); - this.switchOrderList.Add(DEVICE); - this.switchOrderList.Add(PASSWORD); - this.switchOrderList.Add(PACKAGE); - this.switchOrderList.Add(PACKAGE_ID); - this.switchOrderList.Add(PACKAGE_NAME); - this.switchOrderList.Add(GET_FILE); - this.switchOrderList.Add(GET_FILE_SAVE_AS); - this.switchOrderList.Add(PUT_FILE); - this.switchOrderList.Add(PUT_FILE_SAVE_AS); - } - - #region overrides - - /// - /// Helper function to return Response File Switch - /// - /// Path to response file. - /// Return response file switch - protected override string GetResponseFileSwitch(string responseFilePath) - { - return string.Empty; - } - - /// - /// Helper function to generte the command line argument string. - /// - /// command line argument string - protected override string GenerateCommandLineCommands() - { - return GenerateResponseFileCommands(); - } - - /// - /// Helper function to generate response file string - /// - /// response file command line string - protected override string GenerateResponseFileCommands() - { - string cmd = base.GenerateResponseFileCommands(); - - if (ListInstalledApps) - { - cmd += " > installedApps.txt"; - } - - return cmd; - } - - /// - /// Getter for the SwitchOrderList property - /// - protected override ArrayList SwitchOrderList - { - get - { - return this.switchOrderList; - } - } - - /// - /// Getter for the CommandTLogName property - /// - protected override string CommandTLogName - { - get { return "BBDeploy.command.1.tlog"; } - } - - /// - /// Getter for the ReadTLogNames property - /// - protected override string[] ReadTLogNames - { - get { return new string[] { "BBDeploy.read.1.tlog", "BBDeploy.*.read.1.tlog" }; } - } - - /// - /// Getter for the WriteTLogNames property - /// - protected override string[] WriteTLogNames - { - get - { - return new string[] { "BBDeploy.write.1.tlog", "BBDeploy.*.write.1.tlog" }; - } - } - - /// - /// Getter for the TrackedInputFiles property - /// - protected override Microsoft.Build.Framework.ITaskItem[] TrackedInputFiles - { - get - { - // I don't know what this method does but we need to return something other than 'null' or the task doesn't run, - // and adding something like "localManifest.mf" to the list of items causes other problems. - ITaskItem[] items = new ITaskItem[1]; - return items; - } - } - - /// - /// Getter for the ToolName property - /// - protected override string ToolName - { - get - { - return ToolExe; - } - } - - /// - /// Getter for the TrackerIntermediateDirectory property - /// - protected override string TrackerIntermediateDirectory - { - get - { - if (this.TrackerLogDirectory != null) - { - return this.TrackerLogDirectory; - } - return string.Empty; - } - } - - /// - /// Function to return the full path to the tool. - /// - /// - protected override string GenerateFullPathToTool() - { - return this.ToolName; - } - - #endregion overrides - - #region properties - - /// - /// Getter/Setter for the GetFile property - /// Retrieve specified file from default application directory - /// - public virtual string GetFile - { - get - { - if (base.IsPropertySet(GET_FILE)) - { - return base.ActiveToolSwitches[GET_FILE].Value; - } - return null; - } - set - { - base.ActiveToolSwitches.Remove(GET_FILE); - - // Value passed in is the file to get, relative to our app's directory. - // We determine the app's directory from the PackageName and PackageId. - String toolValue = "../../../../apps/" + PackageName + "." + PackageId + "/" + value; - ToolSwitch toolSwitch = new ToolSwitch(ToolSwitchType.String) - { - Name = GET_FILE, - DisplayName = "GetFile", - Description = "Get the given file from the application's directory.", - SwitchValue = "-getFile ", - Value = toolValue - }; - base.ActiveToolSwitches.Add(GET_FILE, toolSwitch); - base.AddActiveSwitchToolValue(toolSwitch); - } - } - - /// - /// Getter/Setter for the GetFileSaveAs property - /// Retrieve specified file from location. - /// - public virtual string GetFileSaveAs - { - get - { - if (base.IsPropertySet(GET_FILE_SAVE_AS)) - { - return base.ActiveToolSwitches[GET_FILE_SAVE_AS].Value; - } - return null; - } - set - { - base.ActiveToolSwitches.Remove(GET_FILE_SAVE_AS); - ToolSwitch toolSwitch = new ToolSwitch(ToolSwitchType.String) - { - Name = GET_FILE_SAVE_AS, - DisplayName = "GetFileSaveAs", - Description = "Save a file retrieved using GetFile to the given location.", - Value = value - }; - base.ActiveToolSwitches.Add(GET_FILE_SAVE_AS, toolSwitch); - base.AddActiveSwitchToolValue(toolSwitch); - } - } - - /// - /// Getter/Setter for the PutFile property - /// Save given file to default application directory. - /// - public virtual string PutFile - { - get - { - if (base.IsPropertySet(PUT_FILE)) - { - return base.ActiveToolSwitches[PUT_FILE].Value; - } - return null; - } - set - { - base.ActiveToolSwitches.Remove(PUT_FILE); - //value = value.Replace(".exe", ""); - - ToolSwitch toolSwitch = new ToolSwitch(ToolSwitchType.String) - { - Name = PUT_FILE, - DisplayName = "PutFile", - Description = "Put the given file into the application's directory.", - SwitchValue = "-putFile ", - Value = value - }; - base.ActiveToolSwitches.Add(PUT_FILE, toolSwitch); - base.AddActiveSwitchToolValue(toolSwitch); - } - } - - /// - /// Getter/Setter for the PutFileSaveAs property - /// Save given file to specified location - /// - public virtual string PutFileSaveAs - { - get - { - if (base.IsPropertySet(PUT_FILE_SAVE_AS)) - { - return base.ActiveToolSwitches[PUT_FILE_SAVE_AS].Value; - } - return null; - } - set - { - base.ActiveToolSwitches.Remove(PUT_FILE_SAVE_AS); - - // We determine the app's directory from the PackageName and PackageId. - String toolValue = "../../../../apps/" + PackageName + "." + PackageId + "/" + value; - ToolSwitch toolSwitch = new ToolSwitch(ToolSwitchType.String) - { - Name = PUT_FILE_SAVE_AS, - DisplayName = "PutFileSaveAs", - Description = "Save a file retrieved using PutFile to the given location.", - Value = toolValue - }; - base.ActiveToolSwitches.Add(PUT_FILE_SAVE_AS, toolSwitch); - base.AddActiveSwitchToolValue(toolSwitch); - } - } - - /// - /// Getter/Setter for the InstallApp property - Switch to cause deploy to install a given application - /// - public virtual bool InstallApp - { - get - { - return (base.IsPropertySet(INSTALL_APP) && base.ActiveToolSwitches[INSTALL_APP].BooleanValue); - } - set - { - base.ActiveToolSwitches.Remove(INSTALL_APP); - ToolSwitch toolSwitch = new ToolSwitch(ToolSwitchType.Boolean) - { - Name = INSTALL_APP, - DisplayName = "Install App", - Description = "The -installApp option installs an app from a given package.", - SwitchValue = "-installApp", - BooleanValue = value - }; - base.ActiveToolSwitches.Add(INSTALL_APP, toolSwitch); - base.AddActiveSwitchToolValue(toolSwitch); - } - } - - /// - /// Getter/Setter for the LaunchApp Property - Switch to launch given application. - /// - public virtual bool LaunchApp - { - get - { - return (base.IsPropertySet(LAUNCH_APP) && base.ActiveToolSwitches[LAUNCH_APP].BooleanValue); - } - set - { - base.ActiveToolSwitches.Remove(LAUNCH_APP); - ToolSwitch toolSwitch = new ToolSwitch(ToolSwitchType.Boolean) - { - Name = LAUNCH_APP, - DisplayName = "Launch App", - Description = "The -launchApp option allows an app to be launched with or without being installed.", - SwitchValue = "-launchApp ", - BooleanValue = value - }; - base.ActiveToolSwitches.Add(LAUNCH_APP, toolSwitch); - base.AddActiveSwitchToolValue(toolSwitch); - } - } - - /// - /// Getter/Setter for ListInstalledApps Property. - /// Switch for command to retrieve the list of installed apps. - /// - public virtual bool ListInstalledApps - { - get - { - return (base.IsPropertySet(LIST_INSTALLED_APPS) && base.ActiveToolSwitches[LIST_INSTALLED_APPS].BooleanValue); - } - set - { - base.ActiveToolSwitches.Remove(LIST_INSTALLED_APPS); - ToolSwitch toolSwitch = new ToolSwitch(ToolSwitchType.Boolean) - { - Name = LIST_INSTALLED_APPS, - DisplayName = "List Installed Apps", - Description = "The -listInstalledApps option does just that.", - SwitchValue = "-listInstalledApps ", - BooleanValue = value - }; - base.ActiveToolSwitches.Add(LIST_INSTALLED_APPS, toolSwitch); - base.AddActiveSwitchToolValue(toolSwitch); - } - } - - /// - /// Setter for FlagFile property - /// - public string FlagFile - { - set - { - _flagFile = value; - } - } - - /// - /// Getter/Setter for DebugNative property - /// Switch to cause task to install application in debug configuration. - /// - public virtual bool DebugNative - { - get - { - return (base.IsPropertySet(DEBUG_NATIVE) && base.ActiveToolSwitches[DEBUG_NATIVE].BooleanValue); - } - - set - { - if (File.Exists(_flagFile)) - value = true; - - base.ActiveToolSwitches.Remove(DEBUG_NATIVE); - ToolSwitch toolSwitch = new ToolSwitch(ToolSwitchType.Boolean) - { - Name = DEBUG_NATIVE, - DisplayName = "Launch for debugging", - Description = "The -debugNative option launches the app in suspended, ready-to-debug state.", - SwitchValue = "-debugNative ", - BooleanValue = value - }; - base.ActiveToolSwitches.Add(DEBUG_NATIVE, toolSwitch); - base.AddActiveSwitchToolValue(toolSwitch); - } - } - - /// - /// Getter/Setter for Device property. - /// Device property designates the IP of the target device. - /// - public virtual string Device - { - get - { - if (base.IsPropertySet(DEVICE)) - { - return base.ActiveToolSwitches[DEVICE].Value; - } - return null; - } - set - { - base.ActiveToolSwitches.Remove(DEVICE); - ToolSwitch toolSwitch = new ToolSwitch(ToolSwitchType.String) - { - Name = DEVICE, - DisplayName = "Device IP", - Description = "The -device option specifies the target device's IP address.", - SwitchValue = "-device ", - Value = value - }; - base.ActiveToolSwitches.Add(DEVICE, toolSwitch); - base.AddActiveSwitchToolValue(toolSwitch); - } - } - - /// - /// Getter/Setter for Password property. - /// Password property specifies the target device password. - /// - public virtual string Password - { - get - { - if (base.IsPropertySet(PASSWORD)) - { - return base.ActiveToolSwitches[PASSWORD].Value; - } - return null; - } - set - { - - base.ActiveToolSwitches.Remove(PASSWORD); - ToolSwitch toolSwitch = new ToolSwitch(ToolSwitchType.String) - { - Name = PASSWORD, - DisplayName = "Device Password", - Description = "The -password option specifies the target device's password.", - SwitchValue = "-password ", - Value = Decrypt(value) - }; - - base.ActiveToolSwitches.Add(PASSWORD, toolSwitch); - base.AddActiveSwitchToolValue(toolSwitch); - } - } - - /// - /// Getter/Setter for Package property. - /// Package property specified package to be installed/launched on task execution. - /// - public virtual string Package - { - get - { - if (base.IsPropertySet(PACKAGE)) - { - return base.ActiveToolSwitches[PACKAGE].Value; - } - return null; - } - set - { - base.ActiveToolSwitches.Remove(PACKAGE); - ToolSwitch toolSwitch = new ToolSwitch(ToolSwitchType.String) - { - Name = PACKAGE, - DisplayName = "Package", - Description = "The -package option specifies a .bar package.", - SwitchValue = "-package ", - Value = value - }; - base.ActiveToolSwitches.Add(PACKAGE, toolSwitch); - base.AddActiveSwitchToolValue(toolSwitch); - } - } - - /// - /// Getter/Setter for PackageId property - /// - [Output] - public virtual string PackageId - { - get - { - if (base.IsPropertySet(PACKAGE_ID)) - { - return base.ActiveToolSwitches[PACKAGE_ID].Value; - } - return null; - } - set - { - base.ActiveToolSwitches.Remove(PACKAGE_ID); - ToolSwitch toolSwitch = new ToolSwitch(ToolSwitchType.String) - { - Name = PACKAGE_ID, - DisplayName = "Package ID", - Description = "The -package-id option specifies the application's package id.", - SwitchValue = "-package-id ", - Value = value - }; - base.ActiveToolSwitches.Add(PACKAGE_ID, toolSwitch); - base.AddActiveSwitchToolValue(toolSwitch); - } - } - - /// - /// Getter/Setter for PackageName property - /// - [Output] - public virtual string PackageName - { - get - { - if (base.IsPropertySet(PACKAGE_NAME)) - { - return base.ActiveToolSwitches[PACKAGE_NAME].Value; - } - return null; - } - set - { - base.ActiveToolSwitches.Remove(PACKAGE_NAME); - ToolSwitch toolSwitch = new ToolSwitch(ToolSwitchType.String) - { - Name = PACKAGE_NAME, - DisplayName = "Package Name", - Description = "The -package-name option specifies the application's package name.", - SwitchValue = "-package-name ", - Value = value - }; - base.ActiveToolSwitches.Add(PACKAGE_NAME, toolSwitch); - base.AddActiveSwitchToolValue(toolSwitch); - } - } - - /// - /// Getter/Setter for LocalManifestFile property - /// We need the local manifest in order to determine PackageId and PackageName. - /// - public virtual string LocalManifestFile - { - get - { - return _localManifest; - } - set - { - _localManifest = value; - - string[] lines = File.ReadAllLines(_localManifest); - - for (int i = 0; i < lines.Length; i++) - { - if (lines[i].StartsWith("Package-Name: ")) - { - string name = lines[i].Substring(14); - if (PackageName != name) - PackageName = name; - } - else if (lines[i].StartsWith("Package-Id: ")) - { - string id = lines[i].Substring(12); - if (PackageId != id) - PackageId = id; - } - } - } - } - - /// - /// Getter/Setter for the TargetManifestFile - /// - [Output] - public virtual string TargetManifestFile - { - get - { - return null; - } - } - - /// - /// Getter/Setter for the TrackerLogDirectory property - /// - public virtual string TrackerLogDirectory - { - get - { - if (base.IsPropertySet(TRACKER_LOG_DIRECTORY)) - { - return base.ActiveToolSwitches[TRACKER_LOG_DIRECTORY].Value; - } - return null; - } - set - { - base.ActiveToolSwitches.Remove(TRACKER_LOG_DIRECTORY); - ToolSwitch switch2 = new ToolSwitch(ToolSwitchType.Directory) - { - DisplayName = "Tracker Log Directory", - Description = "Tracker Log Directory.", - Value = VCToolTask.EnsureTrailingSlash(value) - }; - base.ActiveToolSwitches.Add(TRACKER_LOG_DIRECTORY, switch2); - base.AddActiveSwitchToolValue(switch2); - } - } - - #endregion - - /// - /// Decrypts a given string. - /// - /// A base64 encoded string that was created - /// through the or - /// extension methods. - /// The decrypted string. - /// Keep in mind that the decrypted string remains in memory - /// and makes your application vulnerable per se. If runtime protection - /// is essential, should be used. - /// If - /// is a null reference. - public string Decrypt(string cipher) - { - if (cipher == null) throw new ArgumentNullException("cipher"); - - //parse base64 string - byte[] data = Convert.FromBase64String(cipher); - - //decrypt data - byte[] decrypted = ProtectedData.Unprotect(data, null, DataProtectionScope.LocalMachine); - - return Encoding.Unicode.GetString(decrypted); - } - } -} diff --git a/src_vs2013/VSNDK.Tasks/BBNativePackager.cs b/src_vs2013/VSNDK.Tasks/BBNativePackager.cs deleted file mode 100644 index 7de2dca5..00000000 --- a/src_vs2013/VSNDK.Tasks/BBNativePackager.cs +++ /dev/null @@ -1,739 +0,0 @@ -//* Copyright 2010-2011 Research In Motion Limited. -//* -//* Licensed under the Apache License, Version 2.0 (the "License"); -//* you may not use this file except in compliance with the License. -//* You may obtain a copy of the License at -//* -//* http://www.apache.org/licenses/LICENSE-2.0 -//* -//* Unless required by applicable law or agreed to in writing, software -//* distributed under the License is distributed on an "AS IS" BASIS, -//* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//* See the License for the specific language governing permissions and -//* limitations under the License. - -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Reflection; -using System.Resources; -using Microsoft.Build.CPPTasks; -using System.Collections; -using Microsoft.Build.Framework; -using System.IO; -using Microsoft.Build.Utilities; - -namespace VSNDK.Tasks -{ - public class BBNativePackager : TrackedVCToolTask - { - #region Member Variable and Constant Declarations - protected ArrayList switchOrderList; - private static BarDescriptor.qnx _descriptor = null; - private string _projDir; - private string _appName; - private string _barDescriptorPath = ""; - private const string OUTPUT_FILE = "OutputFiles"; - private const string APP_DESCRIPTOR = "ApplicationDescriptorXml"; - private const string TARGET_FORMAT = "TargetFormat"; - private const string BUILD_ID = "BuildId"; - private const string BUILD_ID_FILE = "BuildIdFile"; - private const string DEV_MODE = "DevMode"; - private const string PACKAGE_MANIFEST_ONLY = "PackageManifestOnly"; - private const string DEBUG_TOKEN = "DebugToken"; - private const string SOURCES = "Sources"; - private const string TRACKER_LOG_DIRECTORY = "TrackerLogDirectory"; - private const string GET_TARGET_FILE_MAP = "GetTargetFileMap"; - private const string WORKSPACE_LOC = "${workspace_loc:/"; - #endregion - - /// - /// BBNativePackager Constructor - /// - public BBNativePackager() - : base(new ResourceManager("VSNDK.Tasks.Properties.Resources", Assembly.GetExecutingAssembly())) - { - this.switchOrderList = new ArrayList(); - this.switchOrderList.Add(TARGET_FORMAT); - this.switchOrderList.Add(BUILD_ID); - this.switchOrderList.Add(BUILD_ID_FILE); - this.switchOrderList.Add(DEV_MODE); - this.switchOrderList.Add(GET_TARGET_FILE_MAP); - this.switchOrderList.Add(PACKAGE_MANIFEST_ONLY); - this.switchOrderList.Add(OUTPUT_FILE); - this.switchOrderList.Add(APP_DESCRIPTOR); - this.switchOrderList.Add(TRACKER_LOG_DIRECTORY); - } - - #region overrides - - - /// - /// Return the response file switch. - /// Note: Don't use response file for msbuild because it is removed before qcc to run GCC compiler - /// - /// Response File Path - /// Response File Switch - protected override string GetResponseFileSwitch(string responseFilePath) - { - return string.Empty; - } - - /// - /// Return the Command Line String. - /// Note: pass the response file to command line commands - /// - /// Command Line String - protected override string GenerateCommandLineCommands() - { - return GenerateResponseFileCommands(); - } - - /// - /// Return the Response File Command String - /// - /// - protected override string GenerateResponseFileCommands() - { - string cmd = base.GenerateResponseFileCommands(); - PackagerCmdBuilder clb = new PackagerCmdBuilder(); - AppendResources(clb); - cmd += " " + clb.ToString(); - - // Output the .bar file's manifest to a file so we can parse it. - if (PackageManifestOnly) - { - cmd += " > localManifest.mf"; - } - else if (GetTargetFileMap) - { - cmd += " > targetFileMap.txt"; - } - - return cmd; - } - - /// - /// Helper function to read the assets from the bar-descriptor.xml file and - /// generate the command line listing the resources to be packaged into the bar file. - /// - /// Command Line Builder object - private void AppendResources(CommandLineBuilder clb) - { - ITaskItem[] sources = GetAssetsFile(); - foreach (ITaskItem item in sources) - { - string target = item.GetMetadata("target"); - if (item.ItemSpec == target) - clb.AppendFileNameIfNotNull(item); - else - { - clb.AppendSwitchIfNotNull("-e ", item); - clb.AppendFileNameIfNotNull(target); - } - } - } - - /// - /// Return the assets from the bardescriptor.xml - /// - /// - private ITaskItem[] GetAssetsFile() - { - - //make sure the _descriptor is loaded - if (_descriptor == null) - { - _descriptor = BarDescriptor.Parser.Load(Path.Combine(ProjectDir, ApplicationDescriptorXml)); - } - BarDescriptor.asset[] globalAssets = _descriptor.assets; - BarDescriptor.asset[] configAssets = null; - - // You can call a configuration whatever you like, but these are the ones Momentics uses for its various - // platform + configuration combinations. Usually this is the same as the output directory, but asset paths - // don't have anything to do with the configuration name. I've based the config names on the platform - // + configuration combination, not the output directory. - BarDescriptor.qnxConfiguration[] configs = _descriptor.configurations; - foreach (BarDescriptor.qnxConfiguration config in configs) - { - if (Configuration == "Debug" && Platform == "BlackBerry" && config.name == "Device-Debug") - { - configAssets = config.asset; - break; - } - else if (Configuration == "Release" && Platform == "BlackBerry" && config.name == "Device-Release") - { - configAssets = config.asset; - break; - } - else if (Configuration == "Profile" && Platform == "BlackBerry" && config.name == "Device-Profile") - { - configAssets = config.asset; - break; - } - else if (Configuration == "Coverage" && Platform == "BlackBerry" && config.name == "Device-Coverage") - { - configAssets = config.asset; - break; - } - else if (Configuration == "Debug" && Platform == "BlackBerrySimulator" && (config.name == "Simulator" || config.name == "Simulator-Debug")) - { - configAssets = config.asset; - break; - } - else if (Configuration == "Profile" && Platform == "BlackBerrySimulator" && config.name == "Simulator-Profile") - { - configAssets = config.asset; - break; - } - else if (Configuration == "Coverage" && Platform == "BlackBerrySimulator" && config.name == "Simulator-Coverage") - { - configAssets = config.asset; - break; - } - else if (Configuration == "Release" && Platform == "BlackBerrySimulator" && config.name == "Simulator-Release") - { - configAssets = config.asset; - break; - } - } - - ITaskItem[] items = null; - - - int clen = (configAssets == null) ? 0 : configAssets.Length; - int glen = (globalAssets == null) ? 0 : globalAssets.Length; - - items = new ITaskItem[glen + clen]; - - for (int i = 0; i < glen; i++) - { - string path = globalAssets[i].path; - path = path.Replace("}", string.Empty).Replace(WORKSPACE_LOC, SolutionDir); - string target = globalAssets[i].Value; - items[i] = new TaskItem(path); - items[i].SetMetadata("target", target); - } - - - if (configAssets != null) - { - for (int i = 0; i < configAssets.Length; i++) - { - string path = configAssets[i].path; - path = path.Replace("}", string.Empty).Replace(WORKSPACE_LOC, SolutionDir); - string target = configAssets[i].Value; - items[i + glen] = new TaskItem(path); - items[i + glen].SetMetadata("target", target); - } - } - - return items; - - } - - /// - /// Getter for the SwitchOrderList property - /// - protected override ArrayList SwitchOrderList - { - get - { - return this.switchOrderList; - } - } - - /// - /// Getter for the CommandTLogName property - /// - protected override string CommandTLogName - { - get { return "BBNativePackager.command.1.tlog"; } - } - - /// - /// Getter for the ReadTLogNames property. - /// - protected override string[] ReadTLogNames - { - get { return new string[] { "BBNativePackager.read.1.tlog", "BBNativePackager.*.read.1.tlog" }; } - } - - /// - /// Getter for the WriteTLogNames property - /// - protected override string[] WriteTLogNames - { - get - { - return new string[] { "BBNativePackager.write.1.tlog", "BBNativePackager.*.write.1.tlog" }; - } - } - - /// - /// Getter for the ToolName property - /// - protected override string ToolName - { - get - { - return ToolExe; - } - } - - #endregion overrides - - #region properties - - /// - /// Getter/Setter for Device property - /// - [Output] - public virtual string Device { get; set; } - - /// - /// Getter/Setter for Password property - /// - [Output] - public virtual string Password { get; set;} - - /// - /// Getter/Setter for BarDeploy property - /// - [Output] - public virtual string BarDeploy { get; set; } - - /// - /// Getter/Setter for OutputFile property - /// - [Required] - [Output] - public virtual string OutputFile - { - get - { - if (base.IsPropertySet(OUTPUT_FILE) && base.IsExplicitlySetToFalse(PACKAGE_MANIFEST_ONLY)) - { - return base.ActiveToolSwitches[OUTPUT_FILE].Value; - } - return null; - } - set - { - base.ActiveToolSwitches.Remove(OUTPUT_FILE); - - String switchValue = ""; - if (base.IsPropertySet(OUTPUT_FILE) && base.IsExplicitlySetToFalse(PACKAGE_MANIFEST_ONLY)) - { - switchValue = "-package "; - } - - ToolSwitch switch2 = new ToolSwitch(ToolSwitchType.File) - { - DisplayName = "Output bar file name, for example, out.bar", - Description = "The -package option specifies the bar file name.", - ArgumentRelationList = new ArrayList(), - SwitchValue = switchValue, - Name = OUTPUT_FILE, - Value = value - }; - base.ActiveToolSwitches.Add(OUTPUT_FILE, switch2); - base.AddActiveSwitchToolValue(switch2); - } - } - - /// - /// Getter/Setter for ProjectDir property - /// - [Required] - public virtual string ProjectDir - { - get - { - return _projDir; - } - set - { - _projDir = value; - _descriptor = BarDescriptor.Parser.Load(Path.Combine(ProjectDir, ApplicationDescriptorXml)); - } - } - - /// - /// Getter/Setter for AppName property - /// - [Required] - public virtual string AppName - { - get - { - return _appName; - } - set - { - _appName = value; - - if (_barDescriptorPath == "") - { - // Default location of bar-descriptor file, if not specified in the Properties Configurations. - _barDescriptorPath = "BlackBerry-" + _appName + "\\bar-descriptor.xml"; - if (!File.Exists(_barDescriptorPath)) - { - // Just to support the default locations of bar-descriptor from previous versions of the plug-in. - _barDescriptorPath = _appName + "_barDescriptor\\bar-descriptor.xml"; - if (!File.Exists(_barDescriptorPath)) - { - _barDescriptorPath = "bar-descriptor.xml"; - } - } - } - - base.ActiveToolSwitches.Remove(APP_DESCRIPTOR); - - ToolSwitch switch2 = new ToolSwitch(ToolSwitchType.File) - { - DisplayName = "Application descriptor file name, for example, bar-descriptor.xml", - Description = "Application descriptor file name, for example, bar-descriptor.xml, it must follows the out.bar file", - ArgumentRelationList = new ArrayList(), - Name = APP_DESCRIPTOR, - Value = _barDescriptorPath - }; - base.ActiveToolSwitches.Add(APP_DESCRIPTOR, switch2); - base.AddActiveSwitchToolValue(switch2); - } - } - - /// - /// Getter/Setter for SolutionDir property - /// - [Required] - public virtual string SolutionDir { get; set; } - - public virtual string ApplicationDescriptorXml - { - get - { - if (base.IsPropertySet(APP_DESCRIPTOR)) - { - return base.ActiveToolSwitches[APP_DESCRIPTOR].Value; - } - return null; - } - set - { - _barDescriptorPath = value; - } - } - - /// - /// Getter/Setter for TargetFormat property - /// - public virtual string TargetFormat - { - get - { - if (base.IsPropertySet(TARGET_FORMAT)) - { - return base.ActiveToolSwitches[TARGET_FORMAT].Value; - } - return null; - } - set - { - base.ActiveToolSwitches.Remove(TARGET_FORMAT); - ToolSwitch switch2 = new ToolSwitch(ToolSwitchType.String) - { - DisplayName = "Target format", - Description = "Select the build target format( -target bar -target bar-debug)", - ArgumentRelationList = new ArrayList() - }; - string[][] switchMap = new string[][] - { - new string[] { "bar", "-target bar" }, - new string[] { "bar-debug", "-target bar-debug" } - }; - switch2.SwitchValue = base.ReadSwitchMap(TARGET_FORMAT, switchMap, value); - switch2.Name = TARGET_FORMAT; - switch2.Value = value; - switch2.MultipleValues = true; - base.ActiveToolSwitches.Add(TARGET_FORMAT, switch2); - base.AddActiveSwitchToolValue(switch2); - } - } - - /// - /// Getter/Setter for BuildID property - /// - public virtual int BuildID - { - get - { - if (base.IsPropertySet(BUILD_ID)) - { - return base.ActiveToolSwitches[BUILD_ID].Number; - } - return 0; - } - set - { - base.ActiveToolSwitches.Remove(BUILD_ID); - ToolSwitch switch2 = new ToolSwitch(ToolSwitchType.Integer) - { - DisplayName = "Build Id", - Description = "set the build id ( the fourth segment of the version ). Must be a number from 0 to 65535" - }; - switch2.ArgumentRelationList = new ArrayList(); - switch2.IsValid = base.ValidateInteger(BUILD_ID, 0, 65535, value); - switch2.Name = BUILD_ID; - switch2.Number = value; - switch2.SwitchValue = "-buildId "; - base.ActiveToolSwitches.Add(BUILD_ID, switch2); - base.AddActiveSwitchToolValue(switch2); - } - } - - /// - /// Getter/Setter for BuildIDFile property - /// - public virtual string BuildIDFile - { - get - { - if (base.IsPropertySet(BUILD_ID_FILE)) - { - return base.ActiveToolSwitches[BUILD_ID_FILE].Value; - } - return null; - } - set - { - base.ActiveToolSwitches.Remove(BUILD_ID_FILE); - ToolSwitch switch2 = new ToolSwitch(ToolSwitchType.File) - { - DisplayName = "Build ID File", - Description = "set the build ID from an existing file", - ArgumentRelationList = new ArrayList(), - Name = BUILD_ID_FILE, - SwitchValue = "-buildIdFile ", - Value = value - }; - base.ActiveToolSwitches.Add(BUILD_ID_FILE, switch2); - base.AddActiveSwitchToolValue(switch2); - } - } - - /// - /// Getter/Setter for DevMode property - /// - public virtual bool DevMode - { - get - { - return (base.IsPropertySet(DEV_MODE) && base.ActiveToolSwitches[DEV_MODE].BooleanValue); - } - set - { - base.ActiveToolSwitches.Remove(DEV_MODE); - ToolSwitch switch2 = new ToolSwitch(ToolSwitchType.Boolean) - { - Name = DEV_MODE, - DisplayName = "Development mode", - Description = "Package in development mode ( -devMode)", - ArgumentRelationList = new ArrayList(), - SwitchValue = "-devMode", - BooleanValue = value - }; - base.ActiveToolSwitches.Add(DEV_MODE, switch2); - base.AddActiveSwitchToolValue(switch2); - } - } - - /// - /// Getter/Setter for PackageManifestOnly property - /// - public virtual bool PackageManifestOnly - { - get - { - return (base.IsPropertySet(PACKAGE_MANIFEST_ONLY) && base.ActiveToolSwitches[PACKAGE_MANIFEST_ONLY].BooleanValue); - } - set - { - base.ActiveToolSwitches.Remove(PACKAGE_MANIFEST_ONLY); - ToolSwitch switch2 = new ToolSwitch(ToolSwitchType.Boolean) - { - DisplayName = "Package manifest only.", - Description = "Package only the manifest file ( -packageManifest)", - ArgumentRelationList = new ArrayList(), - SwitchValue = "-packageManifest -listManifest ", - Name = PACKAGE_MANIFEST_ONLY, - BooleanValue = value - }; - base.ActiveToolSwitches.Add(PACKAGE_MANIFEST_ONLY, switch2); - base.AddActiveSwitchToolValue(switch2); - } - } - - /// - /// Getter/Setter for GetTargetFileMap property - /// - public virtual bool GetTargetFileMap - { - get - { - return (base.IsPropertySet(GET_TARGET_FILE_MAP) && base.ActiveToolSwitches[GET_TARGET_FILE_MAP].BooleanValue); - } - set - { - base.ActiveToolSwitches.Remove(GET_TARGET_FILE_MAP); - ToolSwitch toolSwitch = new ToolSwitch(ToolSwitchType.Boolean) - { - Name = GET_TARGET_FILE_MAP, - DisplayName = "Get target file map", - Description = "Get the mapping between local and target files with the -targetFileMap option.", - ArgumentRelationList = new ArrayList(), - SwitchValue = "-targetFileMap ", - BooleanValue = value - }; - base.ActiveToolSwitches.Add(GET_TARGET_FILE_MAP, toolSwitch); - base.AddActiveSwitchToolValue(toolSwitch); - } - } - - /// - /// Getter/Setter for DebugToken property - /// - public virtual string DebugToken - { - get - { - if (base.IsPropertySet(DEBUG_TOKEN)) - { - return base.ActiveToolSwitches[DEBUG_TOKEN].Value; - } - return null; - } - set - { - base.ActiveToolSwitches.Remove(DEBUG_TOKEN); - ToolSwitch switch2 = new ToolSwitch(ToolSwitchType.Directory) - { - DisplayName = "Debug Token", - Description = "Use debug token to generate author and author id ( -debugToken only usable with -devMode)", - ArgumentRelationList = new ArrayList(), - SwitchValue = "-debugToken ", - Value = value - }; - switch2.Parents.AddLast(DEV_MODE); - base.ActiveToolSwitches.Add(DEBUG_TOKEN, switch2); - base.AddActiveSwitchToolValue(switch2); - } - } - - /// - /// Getter/Setter for TrackerLogDirectory property. - /// - public virtual string TrackerLogDirectory - { - get - { - if (base.IsPropertySet(TRACKER_LOG_DIRECTORY)) - { - return base.ActiveToolSwitches[TRACKER_LOG_DIRECTORY].Value; - } - return null; - } - set - { - base.ActiveToolSwitches.Remove(TRACKER_LOG_DIRECTORY); - ToolSwitch switch2 = new ToolSwitch(ToolSwitchType.Directory) - { - DisplayName = "Tracker Log Directory", - Description = "Tracker Log Directory.", - ArgumentRelationList = new ArrayList(), - Value = VCToolTask.EnsureTrailingSlash(value) - }; - base.ActiveToolSwitches.Add(TRACKER_LOG_DIRECTORY, switch2); - base.AddActiveSwitchToolValue(switch2); - } - } - - #endregion properties - - /// - /// Getter for the TrackedInputFiles - /// - protected override Microsoft.Build.Framework.ITaskItem[] TrackedInputFiles - { - get - { - return Sources; - } - } - - /// - /// Getter for the TrackerIntermediateDirectory - /// - protected override string TrackerIntermediateDirectory - { - get - { - if (this.TrackerLogDirectory != null) - { - return this.TrackerLogDirectory; - } - return string.Empty; - } - } - - /// - /// Getter/Seter for the Sources property - /// - [Required] - public virtual ITaskItem[] Sources - { - get - { - if (base.IsPropertySet(SOURCES)) - { - return base.ActiveToolSwitches[SOURCES].TaskItemArray; - } - return null; - } - set - { - base.ActiveToolSwitches.Remove(SOURCES); - ToolSwitch switch2 = new ToolSwitch(ToolSwitchType.ITaskItemArray) - { - Separator = " ", - Required = true, - ArgumentRelationList = new ArrayList(), - TaskItemArray = value - }; - base.ActiveToolSwitches.Add(SOURCES, switch2); - base.AddActiveSwitchToolValue(switch2); - } - } - - /// - /// Getter/Setter for the Configuration property - /// - [Required] - public string Configuration - { - get; - set; - } - - /// - /// Getter/Setter for the Platform property - /// - [Required] - public string Platform - { - get; - set; - } - } -} diff --git a/src_vs2013/VSNDK.Tasks/BBSigner.cs b/src_vs2013/VSNDK.Tasks/BBSigner.cs deleted file mode 100644 index 5a1cc04a..00000000 --- a/src_vs2013/VSNDK.Tasks/BBSigner.cs +++ /dev/null @@ -1,411 +0,0 @@ -//* Copyright 2010-2011 Research In Motion Limited. -//* -//* Licensed under the Apache License, Version 2.0 (the "License"); -//* you may not use this file except in compliance with the License. -//* You may obtain a copy of the License at -//* -//* http://www.apache.org/licenses/LICENSE-2.0 -//* -//* Unless required by applicable law or agreed to in writing, software -//* distributed under the License is distributed on an "AS IS" BASIS, -//* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//* See the License for the specific language governing permissions and -//* limitations under the License. - -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Reflection; -using System.Resources; -using Microsoft.Build.CPPTasks; -using System.Collections; -using Microsoft.Build.Framework; -using System.IO; -using Microsoft.Build.Utilities; -using System.Security.Cryptography; - -namespace VSNDK.Tasks -{ - /// - /// MSBuild Task responsible for the signing of the BlackBerry Bar files - /// for deploy to a secure device not in development mode. - /// - public class BBSigner : TrackedVCToolTask - { - #region Member Variables and Constants Declaration - protected ArrayList switchOrderList; - private const string REGISTER = "Register"; - private const string KEYSTOREPASSWORD = "KeyStorePassword"; - private const string CSJPIN = "CSJPin"; - private const string CSJFILES = "Signing_AND_DEBUGTOKEN_CSJFiles"; - private const string SOURCES = "Sources"; - private const string OUTPUT_FILE = "OutputFiles"; - private const string TRACKER_LOG_DIRECTORY = "TrackerLogDirectory"; - #endregion - - /// - /// BBSigner Constructor Fuction - /// - public BBSigner() - : base(new ResourceManager("VSNDK.Tasks.Properties.Resources", Assembly.GetExecutingAssembly())) - { - this.switchOrderList = new ArrayList(); - this.switchOrderList.Add("AlwaysAppend"); - this.switchOrderList.Add(REGISTER); - this.switchOrderList.Add(CSJPIN); - this.switchOrderList.Add(KEYSTOREPASSWORD); - this.switchOrderList.Add(CSJFILES); - this.switchOrderList.Add(OUTPUT_FILE); - this.switchOrderList.Add(TRACKER_LOG_DIRECTORY); - } - - - #region overrides - - /// - /// Return the GetResposeFile Switch - /// Note: don't use response file for msbuild because it is removed before qcc to run GCC compiler - /// - /// - /// - protected override string GetResponseFileSwitch(string responseFilePath) - { - return string.Empty; - } - - /// - /// Return the command line argument string - /// Note: pass the response file to command line commands - /// - /// - protected override string GenerateCommandLineCommands() - { - return GenerateResponseFileCommands(); - } - - /// - /// Return the Response File Commands string. - /// - /// - protected override string GenerateResponseFileCommands() - { - if (!Register) - { - switchOrderList.Remove(REGISTER); - switchOrderList.Remove(CSJPIN); - switchOrderList.Remove(CSJFILES); - } - else - switchOrderList.Remove(OUTPUT_FILE); - return base.GenerateResponseFileCommands(); - } - - /// - /// Getter for the SwitchOrderList property - /// - protected override ArrayList SwitchOrderList - { - get - { - return this.switchOrderList; - } - } - - /// - /// Getter for the CommandTLogName property - /// - protected override string CommandTLogName - { - get { return "BBSigner.command.1.tlog"; } - } - - /// - /// Getter for the ReadTLogNames property - /// - protected override string[] ReadTLogNames - { - get { return new string[] { "BBSigner.read.1.tlog", "BBSigner.*.read.1.tlog" }; } - } - protected override string[] WriteTLogNames - { - get - { - return new string[] { "BBSigner.write.1.tlog", "BBSigner.*.write.1.tlog" }; - } - } - - /// - /// Getter for the ToolName property - /// - protected override string ToolName - { - get - { - return ToolExe; - } - } - - /// - /// Getter for the TrackerIntermediateDirectory property - /// - protected override string TrackerIntermediateDirectory - { - get - { - if (this.TrackerLogDirectory != null) - { - return this.TrackerLogDirectory; - } - return string.Empty; - } - } - - /// - /// Getter for the TrackedInputFiles property - /// - protected override ITaskItem[] TrackedInputFiles - { - get { return Sources; } - } - - #endregion overrides - - #region properties - - /// - /// Getter/Setter for the Register property - /// - [Required] - public virtual bool Register - { - get - { - return (base.IsPropertySet(REGISTER) && base.ActiveToolSwitches[REGISTER].BooleanValue); - } - set - { - base.ActiveToolSwitches.Remove(REGISTER); - ToolSwitch switch2 = new ToolSwitch(ToolSwitchType.Boolean) - { - DisplayName = "Register", - Description = "Register the computer with CSJ file to sign application( -register)", - ArgumentRelationList = new ArrayList(), - SwitchValue = "-register", - Name = REGISTER, - BooleanValue = value - }; - base.ActiveToolSwitches.Add(REGISTER, switch2); - base.AddActiveSwitchToolValue(switch2); - } - } - - /// - /// Getter/Setter for the Sources property - /// - [Required] - public virtual ITaskItem[] Sources - { - get - { - if (base.IsPropertySet(SOURCES)) - { - return base.ActiveToolSwitches[SOURCES].TaskItemArray; - } - return null; - } - set - { - base.ActiveToolSwitches.Remove(SOURCES); - ToolSwitch switch2 = new ToolSwitch(ToolSwitchType.ITaskItemArray) - { - Separator = " ", - Required = true, - ArgumentRelationList = new ArrayList(), - TaskItemArray = value - }; - base.ActiveToolSwitches.Add(SOURCES, switch2); - base.AddActiveSwitchToolValue(switch2); - } - } - - /// - /// Getter/Setter for the CSJFiles property - /// - public virtual ITaskItem[] CSJFiles - { - get - { - if (base.IsPropertySet(CSJFILES)) - { - return base.ActiveToolSwitches[CSJFILES].TaskItemArray; - } - return null; - } - set - { - base.ActiveToolSwitches.Remove(CSJFILES); - ToolSwitch switch2 = new ToolSwitch(ToolSwitchType.ITaskItemArray) - { - Separator = " ", - Required = true, - ArgumentRelationList = new ArrayList(), - Name = CSJFILES, - TaskItemArray = value - }; - base.ActiveToolSwitches.Add(CSJFILES, switch2); - base.AddActiveSwitchToolValue(switch2); - } - } - - /// - /// Getter/Setter for the KeyStorePassword property - /// - public virtual string KeyStorePassword - { - get - { - if (base.IsPropertySet(KEYSTOREPASSWORD)) - { - return base.ActiveToolSwitches[KEYSTOREPASSWORD].Value; - } - return null; - } - set - { - base.ActiveToolSwitches.Remove(KEYSTOREPASSWORD); - - ToolSwitch switch2 = new ToolSwitch(ToolSwitchType.File) - { - DisplayName = "Keystore password", - Description = "The -storepass option specifies the password.", - ArgumentRelationList = new ArrayList(), - SwitchValue = "-storepass ", - Name = KEYSTOREPASSWORD, - Value = Decrypt(value) - }; - - base.ActiveToolSwitches.Add(KEYSTOREPASSWORD, switch2); - base.AddActiveSwitchToolValue(switch2); - } - } - - /// - /// Decrypts a given string. - /// - /// A base64 encoded string that was created - /// through the or - /// extension methods. - /// The decrypted string. - /// Keep in mind that the decrypted string remains in memory - /// and makes your application vulnerable per se. If runtime protection - /// is essential, should be used. - /// If - /// is a null reference. - public string Decrypt(string cipher) - { - if (cipher == null) throw new ArgumentNullException("cipher"); - - //parse base64 string - byte[] data = Convert.FromBase64String(cipher); - - //decrypt data - byte[] decrypted = ProtectedData.Unprotect(data, null, DataProtectionScope.LocalMachine); - - return Encoding.Unicode.GetString(decrypted); - } - - /// - /// Getter/Setter for the CSJPin property - /// - public virtual string CSJPin - { - get - { - if (base.IsPropertySet(CSJPIN)) - { - return base.ActiveToolSwitches[CSJPIN].Value; - } - return null; - } - set - { - base.ActiveToolSwitches.Remove(CSJPIN); - ToolSwitch switch2 = new ToolSwitch(ToolSwitchType.File) - { - DisplayName = "Keystore password", - Description = "The -csjpin option specifies the password.", - ArgumentRelationList = new ArrayList(), - SwitchValue = "-csjpin ", - Name = CSJPIN, - Value = value - }; - base.ActiveToolSwitches.Add(CSJPIN, switch2); - base.AddActiveSwitchToolValue(switch2); - } - } - - /// - /// Getter/Setter for the OutputFile property - /// - [Required] - [Output] - public virtual string OutputFile - { - get - { - if (base.IsPropertySet(OUTPUT_FILE)) - { - return base.ActiveToolSwitches[OUTPUT_FILE].Value; - } - return null; - } - set - { - base.ActiveToolSwitches.Remove(OUTPUT_FILE); - ToolSwitch switch2 = new ToolSwitch(ToolSwitchType.File) - { - DisplayName = "Output bar file name to be signed", - Description = "Specifies the bar file name to be signed", - ArgumentRelationList = new ArrayList(), - Name = OUTPUT_FILE, - Value = value - }; - base.ActiveToolSwitches.Add(OUTPUT_FILE, switch2); - base.AddActiveSwitchToolValue(switch2); - } - } - - /// - /// Getter/Setter for the TrackerLogDirectory property - /// - public virtual string TrackerLogDirectory - { - get - { - if (base.IsPropertySet(TRACKER_LOG_DIRECTORY)) - { - return base.ActiveToolSwitches[TRACKER_LOG_DIRECTORY].Value; - } - return null; - } - set - { - base.ActiveToolSwitches.Remove(TRACKER_LOG_DIRECTORY); - ToolSwitch switch2 = new ToolSwitch(ToolSwitchType.Directory) - { - DisplayName = "Tracker Log Directory", - Description = "Tracker Log Directory.", - ArgumentRelationList = new ArrayList(), - Value = VCToolTask.EnsureTrailingSlash(value) - }; - base.ActiveToolSwitches.Add(TRACKER_LOG_DIRECTORY, switch2); - base.AddActiveSwitchToolValue(switch2); - } - } - - #endregion properties - - } -} - \ No newline at end of file diff --git a/src_vs2013/VSNDK.Tasks/BarDescriptor/Parser.cs b/src_vs2013/VSNDK.Tasks/BarDescriptor/Parser.cs deleted file mode 100644 index a3ed76de..00000000 --- a/src_vs2013/VSNDK.Tasks/BarDescriptor/Parser.cs +++ /dev/null @@ -1,54 +0,0 @@ -//* Copyright 2010-2011 Research In Motion Limited. -//* -//* Licensed under the Apache License, Version 2.0 (the "License"); -//* you may not use this file except in compliance with the License. -//* You may obtain a copy of the License at -//* -//* http://www.apache.org/licenses/LICENSE-2.0 -//* -//* Unless required by applicable law or agreed to in writing, software -//* distributed under the License is distributed on an "AS IS" BASIS, -//* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//* See the License for the specific language governing permissions and -//* limitations under the License. - -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.IO; -using System.Xml; -using System.Xml.Serialization; -using System.Diagnostics; - -namespace VSNDK.Tasks.BarDescriptor -{ - public class Parser - { - /// - /// Helper function to to deserialize the bar-descriptor.xml file for read. - /// - /// Path to the bar-descriptor.xml file - /// BarDescriptor.qnx object containing the deserialized data from the bar-descriptor. - public static BarDescriptor.qnx Load(string filename) - { - if (!string.IsNullOrEmpty(filename)) - { - try - { - using (FileStream fs = new FileStream(filename, FileMode.Open, FileAccess.Read)) - { - XmlTextReader reader = new XmlTextReader(fs); - XmlSerializer serializer = new XmlSerializer(typeof(BarDescriptor.qnx)); - return serializer.Deserialize(reader) as BarDescriptor.qnx; - } - } - catch (Exception ex) - { - Debug.WriteLine(ex.Message); - } - } - return null; - } - } -} diff --git a/src_vs2013/VSNDK.Tasks/BarDescriptor/Schema/bar-descriptor.cs b/src_vs2013/VSNDK.Tasks/BarDescriptor/Schema/bar-descriptor.cs deleted file mode 100644 index 75f4b3a0..00000000 --- a/src_vs2013/VSNDK.Tasks/BarDescriptor/Schema/bar-descriptor.cs +++ /dev/null @@ -1,459 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// Runtime Version:4.0.30319.239 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -// -// This source code was auto-generated by xsd, Version=4.0.30319.1. -// -namespace VSNDK.Tasks.BarDescriptor { - using System.Xml.Serialization; - - - /// - [System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.0.30319.1")] - [System.SerializableAttribute()] - [System.Diagnostics.DebuggerStepThroughAttribute()] - [System.ComponentModel.DesignerCategoryAttribute("code")] - [System.Xml.Serialization.XmlTypeAttribute(AnonymousType=true, Namespace="http://www.qnx.com/schemas/application/1.0")] - [System.Xml.Serialization.XmlRootAttribute(Namespace="http://www.qnx.com/schemas/application/1.0", IsNullable=true)] - public partial class asset { - - private string pathField; - - private string entryField; - - private string typeField; - - private string valueField; - - /// - [System.Xml.Serialization.XmlAttributeAttribute()] - public string path { - get { - return this.pathField; - } - set { - this.pathField = value; - } - } - - /// - [System.Xml.Serialization.XmlAttributeAttribute()] - public string entry { - get { - return this.entryField; - } - set { - this.entryField = value; - } - } - - /// - [System.Xml.Serialization.XmlAttributeAttribute()] - public string type { - get { - return this.typeField; - } - set { - this.typeField = value; - } - } - - /// - [System.Xml.Serialization.XmlTextAttribute()] - public string Value { - get { - return this.valueField; - } - set { - this.valueField = value; - } - } - } - - /// - [System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.0.30319.1")] - [System.SerializableAttribute()] - [System.Diagnostics.DebuggerStepThroughAttribute()] - [System.ComponentModel.DesignerCategoryAttribute("code")] - [System.Xml.Serialization.XmlTypeAttribute(AnonymousType=true, Namespace="http://www.qnx.com/schemas/application/1.0")] - [System.Xml.Serialization.XmlRootAttribute(Namespace="http://www.qnx.com/schemas/application/1.0", IsNullable=false)] - public partial class qnx { - - private string idField; - - private string nameField; - - private string versionNumberField; - - private string buildIdField; - - private string descriptionField; - - private string authorField; - - private string categoryField; - - private qnxInitialWindow[] initialWindowField; - - private asset[] assetField; - - private qnxConfiguration[] configurationField; - - private qnxIcon[] iconField; - - private qnxAction[] actionField; - - private qnxEnv[] envField; - - /// - public string id { - get { - return this.idField; - } - set { - this.idField = value; - } - } - - /// - public string name { - get { - return this.nameField; - } - set { - this.nameField = value; - } - } - - /// - public string versionNumber { - get { - return this.versionNumberField; - } - set { - this.versionNumberField = value; - } - } - - /// - public string buildId { - get { - return this.buildIdField; - } - set { - this.buildIdField = value; - } - } - - /// - public string description { - get { - return this.descriptionField; - } - set { - this.descriptionField = value; - } - } - - /// - public string author { - get { - return this.authorField; - } - set { - this.authorField = value; - } - } - - /// - public string category { - get { - return this.categoryField; - } - set { - this.categoryField = value; - } - } - - /// - [System.Xml.Serialization.XmlElementAttribute("initialWindow")] - public qnxInitialWindow[] initialWindows { - get { - return this.initialWindowField; - } - set { - this.initialWindowField = value; - } - } - - /// - [System.Xml.Serialization.XmlElementAttribute("asset", IsNullable=true)] - public asset[] assets { - get { - return this.assetField; - } - set { - this.assetField = value; - } - } - - /// - [System.Xml.Serialization.XmlElementAttribute("configuration")] - public qnxConfiguration[] configurations { - get { - return this.configurationField; - } - set { - this.configurationField = value; - } - } - - /// - [System.Xml.Serialization.XmlElementAttribute("icon")] - public qnxIcon[] icons { - get { - return this.iconField; - } - set { - this.iconField = value; - } - } - - /// - [System.Xml.Serialization.XmlElementAttribute("action", IsNullable=true)] - public qnxAction[] actions { - get { - return this.actionField; - } - set { - this.actionField = value; - } - } - - /// - [System.Xml.Serialization.XmlElementAttribute("env")] - public qnxEnv[] envs { - get { - return this.envField; - } - set { - this.envField = value; - } - } - } - - /// - [System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.0.30319.1")] - [System.SerializableAttribute()] - [System.Diagnostics.DebuggerStepThroughAttribute()] - [System.ComponentModel.DesignerCategoryAttribute("code")] - [System.Xml.Serialization.XmlTypeAttribute(AnonymousType=true, Namespace="http://www.qnx.com/schemas/application/1.0")] - public partial class qnxInitialWindow { - - private string aspectRatioField; - - private string autoOrientsField; - - private string systemChromeField; - - private string transparentField; - - /// - public string aspectRatio { - get { - return this.aspectRatioField; - } - set { - this.aspectRatioField = value; - } - } - - /// - public string autoOrients { - get { - return this.autoOrientsField; - } - set { - this.autoOrientsField = value; - } - } - - /// - public string systemChrome { - get { - return this.systemChromeField; - } - set { - this.systemChromeField = value; - } - } - - /// - public string transparent { - get { - return this.transparentField; - } - set { - this.transparentField = value; - } - } - } - - /// - [System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.0.30319.1")] - [System.SerializableAttribute()] - [System.Diagnostics.DebuggerStepThroughAttribute()] - [System.ComponentModel.DesignerCategoryAttribute("code")] - [System.Xml.Serialization.XmlTypeAttribute(AnonymousType=true, Namespace="http://www.qnx.com/schemas/application/1.0")] - public partial class qnxConfiguration { - - private string platformArchitectureField; - - private asset[] assetField; - - private string idField; - - private string nameField; - - /// - public string platformArchitecture { - get { - return this.platformArchitectureField; - } - set { - this.platformArchitectureField = value; - } - } - - /// - [System.Xml.Serialization.XmlElementAttribute("asset", IsNullable=true)] - public asset[] asset { - get { - return this.assetField; - } - set { - this.assetField = value; - } - } - - /// - [System.Xml.Serialization.XmlAttributeAttribute()] - public string id { - get { - return this.idField; - } - set { - this.idField = value; - } - } - - /// - [System.Xml.Serialization.XmlAttributeAttribute()] - public string name { - get { - return this.nameField; - } - set { - this.nameField = value; - } - } - } - - /// - [System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.0.30319.1")] - [System.SerializableAttribute()] - [System.Diagnostics.DebuggerStepThroughAttribute()] - [System.ComponentModel.DesignerCategoryAttribute("code")] - [System.Xml.Serialization.XmlTypeAttribute(AnonymousType=true, Namespace="http://www.qnx.com/schemas/application/1.0")] - public partial class qnxIcon { - - private string imageField; - - /// - public string image { - get { - return this.imageField; - } - set { - this.imageField = value; - } - } - } - - /// - [System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.0.30319.1")] - [System.SerializableAttribute()] - [System.Diagnostics.DebuggerStepThroughAttribute()] - [System.ComponentModel.DesignerCategoryAttribute("code")] - [System.Xml.Serialization.XmlTypeAttribute(AnonymousType=true, Namespace="http://www.qnx.com/schemas/application/1.0")] - public partial class qnxAction { - - private string systemField; - - private string valueField; - - /// - [System.Xml.Serialization.XmlAttributeAttribute()] - public string system { - get { - return this.systemField; - } - set { - this.systemField = value; - } - } - - /// - [System.Xml.Serialization.XmlTextAttribute()] - public string Value { - get { - return this.valueField; - } - set { - this.valueField = value; - } - } - } - - /// - [System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.0.30319.1")] - [System.SerializableAttribute()] - [System.Diagnostics.DebuggerStepThroughAttribute()] - [System.ComponentModel.DesignerCategoryAttribute("code")] - [System.Xml.Serialization.XmlTypeAttribute(AnonymousType=true, Namespace="http://www.qnx.com/schemas/application/1.0")] - public partial class qnxEnv { - - private string varField; - - private string valueField; - - /// - [System.Xml.Serialization.XmlAttributeAttribute()] - public string var { - get { - return this.varField; - } - set { - this.varField = value; - } - } - - /// - [System.Xml.Serialization.XmlAttributeAttribute()] - public string value { - get { - return this.valueField; - } - set { - this.valueField = value; - } - } - } -} diff --git a/src_vs2013/VSNDK.Tasks/BarDescriptor/Schema/bar-descriptor.xml b/src_vs2013/VSNDK.Tasks/BarDescriptor/Schema/bar-descriptor.xml deleted file mode 100644 index 3255bb8c..00000000 --- a/src_vs2013/VSNDK.Tasks/BarDescriptor/Schema/bar-descriptor.xml +++ /dev/null @@ -1,110 +0,0 @@ - - - - - - - com.rim.sample00_mesh - - - Mesh - - - 1.0.0 - - - 1 - - - - - - Mesh Sample - - - - - - BlackBerry - - - - - - landscape - false - none - false - - - - core.games - - res - res/shaders/diffuse-specular.fsh - res/shaders/diffuse-specular.vsh - - - armle-v7 - sample00-mesh - - - armle-v7 - sample00-mesh - - - armle-v7 - sample00-mesh - - - armle-v7 - sample00-mesh - - - x86 - sample00-mesh - - - x86 - sample00-mesh - - - x86 - sample00-mesh - - - - - - - - - - - run_native - - - - - - - - - - - - - - - - diff --git a/src_vs2013/VSNDK.Tasks/BarDescriptor/Schema/bar-descriptor.xsd b/src_vs2013/VSNDK.Tasks/BarDescriptor/Schema/bar-descriptor.xsd deleted file mode 100644 index 5601be8a..00000000 --- a/src_vs2013/VSNDK.Tasks/BarDescriptor/Schema/bar-descriptor.xsd +++ /dev/null @@ -1,72 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src_vs2013/VSNDK.Tasks/BlackBerry/Microsoft.Cpp.BlackBerry.Packager.targets b/src_vs2013/VSNDK.Tasks/BlackBerry/Microsoft.Cpp.BlackBerry.Packager.targets deleted file mode 100644 index b37a5e2c..00000000 --- a/src_vs2013/VSNDK.Tasks/BlackBerry/Microsoft.Cpp.BlackBerry.Packager.targets +++ /dev/null @@ -1,398 +0,0 @@ - - - - - - - - - - - - - - - - - true - - - - true - - - - true - - - - - $(BuildLinkTargets); - - $(CommonBuildOnlyTargets);$(BeforeBuildLinkTargets);$(BuildLinkTargets);$(AfterBuildLinkTargets) - - - - - - - - - - - - - - - - - - $([System.IO.Path]::Combine($(ProjectDir),$(OutDir)$(LibPrefix)$(TargetName)$(TargetExt))) - $([System.IO.Path]::GetFileName('$(TargetPath)')) - $([System.IO.Path]::GetDirectoryName('$(TargetPath)')) - $(LibPrefix)$(ProjectName) - false - false - - - - - - - - - - - - - - - - - - - - - - - false - true - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - false - true - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src_vs2013/VSNDK.Tasks/BlackBerry/Microsoft.CppBuild.BlackBerry.targets b/src_vs2013/VSNDK.Tasks/BlackBerry/Microsoft.CppBuild.BlackBerry.targets deleted file mode 100644 index 196ff386..00000000 --- a/src_vs2013/VSNDK.Tasks/BlackBerry/Microsoft.CppBuild.BlackBerry.targets +++ /dev/null @@ -1,93 +0,0 @@ - - - - - - - false - false - false - - - - - - - - - - - - - - - - - - PropertySheet - - - - - - - - - - - - - - - - Project - - - PropertySheet - - - - - - - - - - - - - - - - - - - - - diff --git a/src_vs2013/VSNDK.Tasks/BlackBerry/Rules/debugger_ndk.xml b/src_vs2013/VSNDK.Tasks/BlackBerry/Rules/debugger_ndk.xml deleted file mode 100644 index cb53a5b7..00000000 --- a/src_vs2013/VSNDK.Tasks/BlackBerry/Rules/debugger_ndk.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - diff --git a/src_vs2013/VSNDK.Tasks/BlackBerry/Rules/ndkProjectItemsSchema.xml b/src_vs2013/VSNDK.Tasks/BlackBerry/Rules/ndkProjectItemsSchema.xml deleted file mode 100644 index ec753493..00000000 --- a/src_vs2013/VSNDK.Tasks/BlackBerry/Rules/ndkProjectItemsSchema.xml +++ /dev/null @@ -1,299 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src_vs2013/VSNDK.Tasks/BlackBerry/Rules/ndk_directories.xml b/src_vs2013/VSNDK.Tasks/BlackBerry/Rules/ndk_directories.xml deleted file mode 100644 index f86fda30..00000000 --- a/src_vs2013/VSNDK.Tasks/BlackBerry/Rules/ndk_directories.xml +++ /dev/null @@ -1,32 +0,0 @@ - - - - - - - - - - - - - - diff --git a/src_vs2013/VSNDK.Tasks/BlackBerry/Rules/ndk_general.xml b/src_vs2013/VSNDK.Tasks/BlackBerry/Rules/ndk_general.xml deleted file mode 100644 index 2b834759..00000000 --- a/src_vs2013/VSNDK.Tasks/BlackBerry/Rules/ndk_general.xml +++ /dev/null @@ -1,155 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src_vs2013/VSNDK.Tasks/BlackBerry/Rules/ndk_general_ps.xml b/src_vs2013/VSNDK.Tasks/BlackBerry/Rules/ndk_general_ps.xml deleted file mode 100644 index d7389bc0..00000000 --- a/src_vs2013/VSNDK.Tasks/BlackBerry/Rules/ndk_general_ps.xml +++ /dev/null @@ -1,75 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src_vs2013/VSNDK.Tasks/BlackBerry/Rules/packager.xml b/src_vs2013/VSNDK.Tasks/BlackBerry/Rules/packager.xml deleted file mode 100644 index 22e801e8..00000000 --- a/src_vs2013/VSNDK.Tasks/BlackBerry/Rules/packager.xml +++ /dev/null @@ -1,39 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src_vs2013/VSNDK.Tasks/BlackBerry/Rules/qcc_cl.xml b/src_vs2013/VSNDK.Tasks/BlackBerry/Rules/qcc_cl.xml deleted file mode 100644 index 90de68d9..00000000 --- a/src_vs2013/VSNDK.Tasks/BlackBerry/Rules/qcc_cl.xml +++ /dev/null @@ -1,196 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src_vs2013/VSNDK.Tasks/BlackBerry/Rules/qcc_lib.xml b/src_vs2013/VSNDK.Tasks/BlackBerry/Rules/qcc_lib.xml deleted file mode 100644 index aa53f443..00000000 --- a/src_vs2013/VSNDK.Tasks/BlackBerry/Rules/qcc_lib.xml +++ /dev/null @@ -1,154 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src_vs2013/VSNDK.Tasks/BlackBerry/Rules/qcc_link.xml b/src_vs2013/VSNDK.Tasks/BlackBerry/Rules/qcc_link.xml deleted file mode 100644 index c35bcb63..00000000 --- a/src_vs2013/VSNDK.Tasks/BlackBerry/Rules/qcc_link.xml +++ /dev/null @@ -1,390 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src_vs2013/VSNDK.Tasks/BlackBerrySimulator/Microsoft.Cpp.BlackBerrySimulator.Packager.targets b/src_vs2013/VSNDK.Tasks/BlackBerrySimulator/Microsoft.Cpp.BlackBerrySimulator.Packager.targets deleted file mode 100644 index 9799f837..00000000 --- a/src_vs2013/VSNDK.Tasks/BlackBerrySimulator/Microsoft.Cpp.BlackBerrySimulator.Packager.targets +++ /dev/null @@ -1,336 +0,0 @@ - - - - - - - - - - - - - - - - - true - - - - true - - - - true - - - - - $(BuildLinkTargets); - - $(CommonBuildOnlyTargets);$(BeforeBuildLinkTargets);$(BuildLinkTargets);$(AfterBuildLinkTargets) - - - - - - - - - - - - - - - - - - $([System.IO.Path]::Combine($(ProjectDir),$(OutDir)$(LibPrefix)$(TargetName)$(TargetExt))) - $([System.IO.Path]::GetFileName('$(TargetPath)')) - $([System.IO.Path]::GetDirectoryName('$(TargetPath)')) - $(LibPrefix)$(ProjectName) - false - - - - - - - - - - - - - - - - - - - - - - false - true - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src_vs2013/VSNDK.Tasks/BlackBerrySimulator/Microsoft.CppBuild.BlackBerrySimulator.targets b/src_vs2013/VSNDK.Tasks/BlackBerrySimulator/Microsoft.CppBuild.BlackBerrySimulator.targets deleted file mode 100644 index 4ab9e314..00000000 --- a/src_vs2013/VSNDK.Tasks/BlackBerrySimulator/Microsoft.CppBuild.BlackBerrySimulator.targets +++ /dev/null @@ -1,93 +0,0 @@ - - - - - - - false - false - false - - - - - - - - - - - - - - - - - - PropertySheet - - - - - - - - - - - - - - - - Project - - - PropertySheet - - - - - - - - - - - - - - - - - - - - - diff --git a/src_vs2013/VSNDK.Tasks/BlackBerrySimulator/Rules/debugger_ndk.xml b/src_vs2013/VSNDK.Tasks/BlackBerrySimulator/Rules/debugger_ndk.xml deleted file mode 100644 index cb53a5b7..00000000 --- a/src_vs2013/VSNDK.Tasks/BlackBerrySimulator/Rules/debugger_ndk.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - diff --git a/src_vs2013/VSNDK.Tasks/BlackBerrySimulator/Rules/ndkProjectItemsSchema.xml b/src_vs2013/VSNDK.Tasks/BlackBerrySimulator/Rules/ndkProjectItemsSchema.xml deleted file mode 100644 index ec753493..00000000 --- a/src_vs2013/VSNDK.Tasks/BlackBerrySimulator/Rules/ndkProjectItemsSchema.xml +++ /dev/null @@ -1,299 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src_vs2013/VSNDK.Tasks/BlackBerrySimulator/Rules/ndk_directories.xml b/src_vs2013/VSNDK.Tasks/BlackBerrySimulator/Rules/ndk_directories.xml deleted file mode 100644 index aa32e836..00000000 --- a/src_vs2013/VSNDK.Tasks/BlackBerrySimulator/Rules/ndk_directories.xml +++ /dev/null @@ -1,32 +0,0 @@ - - - - - - - - - - - - - - diff --git a/src_vs2013/VSNDK.Tasks/BlackBerrySimulator/Rules/ndk_general.xml b/src_vs2013/VSNDK.Tasks/BlackBerrySimulator/Rules/ndk_general.xml deleted file mode 100644 index 4a7e8cb8..00000000 --- a/src_vs2013/VSNDK.Tasks/BlackBerrySimulator/Rules/ndk_general.xml +++ /dev/null @@ -1,174 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src_vs2013/VSNDK.Tasks/BlackBerrySimulator/Rules/ndk_general_ps.xml b/src_vs2013/VSNDK.Tasks/BlackBerrySimulator/Rules/ndk_general_ps.xml deleted file mode 100644 index 5b40a328..00000000 --- a/src_vs2013/VSNDK.Tasks/BlackBerrySimulator/Rules/ndk_general_ps.xml +++ /dev/null @@ -1,75 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src_vs2013/VSNDK.Tasks/BlackBerrySimulator/Rules/packager.xml b/src_vs2013/VSNDK.Tasks/BlackBerrySimulator/Rules/packager.xml deleted file mode 100644 index 22e801e8..00000000 --- a/src_vs2013/VSNDK.Tasks/BlackBerrySimulator/Rules/packager.xml +++ /dev/null @@ -1,39 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src_vs2013/VSNDK.Tasks/BlackBerrySimulator/Rules/qcc_cl.xml b/src_vs2013/VSNDK.Tasks/BlackBerrySimulator/Rules/qcc_cl.xml deleted file mode 100644 index 9a799fa8..00000000 --- a/src_vs2013/VSNDK.Tasks/BlackBerrySimulator/Rules/qcc_cl.xml +++ /dev/null @@ -1,196 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src_vs2013/VSNDK.Tasks/BlackBerrySimulator/Rules/qcc_lib.xml b/src_vs2013/VSNDK.Tasks/BlackBerrySimulator/Rules/qcc_lib.xml deleted file mode 100644 index aa53f443..00000000 --- a/src_vs2013/VSNDK.Tasks/BlackBerrySimulator/Rules/qcc_lib.xml +++ /dev/null @@ -1,154 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src_vs2013/VSNDK.Tasks/BlackBerrySimulator/Rules/qcc_link.xml b/src_vs2013/VSNDK.Tasks/BlackBerrySimulator/Rules/qcc_link.xml deleted file mode 100644 index c35bcb63..00000000 --- a/src_vs2013/VSNDK.Tasks/BlackBerrySimulator/Rules/qcc_link.xml +++ /dev/null @@ -1,390 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src_vs2013/VSNDK.Tasks/CheckIfInstalled.cs b/src_vs2013/VSNDK.Tasks/CheckIfInstalled.cs deleted file mode 100644 index 88266c3d..00000000 --- a/src_vs2013/VSNDK.Tasks/CheckIfInstalled.cs +++ /dev/null @@ -1,104 +0,0 @@ -//* Copyright 2010-2011 Research In Motion Limited. -//* -//* Licensed under the Apache License, Version 2.0 (the "License"); -//* you may not use this file except in compliance with the License. -//* You may obtain a copy of the License at -//* -//* http://www.apache.org/licenses/LICENSE-2.0 -//* -//* Unless required by applicable law or agreed to in writing, software -//* distributed under the License is distributed on an "AS IS" BASIS, -//* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//* See the License for the specific language governing permissions and -//* limitations under the License. - -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.IO; -using System.Collections; -using Microsoft.Build.Framework; -using Microsoft.Build.Utilities; - -namespace VSNDK.Tasks -{ - /// - /// MSBuild Task to check to see if the application was previously installed. - /// - public class CheckIfInstalled : Task - { - #region Member Variables and Constants - private string _listFile; - private string _appName; - private bool _isAppInstalled; - #endregion - - /// - /// Execute the MSBuild task - /// - /// True on successful execution - public override bool Execute() - { - - try - { - _isAppInstalled = false; - - string[] installedApps = File.ReadAllLines(_listFile); - foreach (string app in installedApps) - { - if (app.Contains(_appName)) - { - _isAppInstalled = true; - break; - } - } - - return true; - } - catch (Exception ex) - { - return false; - } - - - } - - /// - /// Setter for the ListFile property - /// - [Required] - public string ListFile - { - set - { - _listFile = value; - } - } - - /// - /// Setter for the AppName property - /// - [Required] - public string AppName - { - set - { - _appName = value; - } - } - - /// - /// Getter for the IsAppInstalled property - /// - [Output] - public bool IsAppInstalled - { - get - { - return _isAppInstalled; - } - } - } -} diff --git a/src_vs2013/VSNDK.Tasks/DiffManifests.cs b/src_vs2013/VSNDK.Tasks/DiffManifests.cs deleted file mode 100644 index bb0ede14..00000000 --- a/src_vs2013/VSNDK.Tasks/DiffManifests.cs +++ /dev/null @@ -1,239 +0,0 @@ -//* Copyright 2010-2011 Research In Motion Limited. -//* -//* Licensed under the Apache License, Version 2.0 (the "License"); -//* you may not use this file except in compliance with the License. -//* You may obtain a copy of the License at -//* -//* http://www.apache.org/licenses/LICENSE-2.0 -//* -//* Unless required by applicable law or agreed to in writing, software -//* distributed under the License is distributed on an "AS IS" BASIS, -//* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//* See the License for the specific language governing permissions and -//* limitations under the License. - -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.IO; -using System.Collections; -using Microsoft.Build.Framework; -using Microsoft.Build.Utilities; - -namespace VSNDK.Tasks -{ - /// - /// MSBuild task to compare the manifest file from the bar file being uploaded against the one already installed on the device. - /// - public class DiffManifests : Task - { - #region Member Variables and Constants - private string _localManifestFile; - private string _targetManifestFile; - private string _targetFileMap; - private ArrayList _modifiedFiles; - private ArrayList _deletedFiles; - private int _modifiedFilesCount; - private int _deletedFilesCount; - #endregion - - /// - /// Execute the MSBuild Task. - /// - /// - public override bool Execute() - { - _modifiedFiles = new ArrayList(); - _deletedFiles = new ArrayList(); - - // Parse local manifest to retrieve list of files and their hashes. - string[] localManifest = File.ReadAllLines(_localManifestFile); - Dictionary localFiles = new Dictionary(); - for (int i = 0; i < localManifest.Length; i++) - { - if (localManifest[i].StartsWith("Archive-Asset-Name: ")) - { - string assetName = localManifest[i].Substring(20); - i++; - if (localManifest[i].StartsWith("Archive-Asset-SHA-512-Digest: ")) - { - string assetHash = localManifest[i].Substring(30); - localFiles.Add(assetName, assetHash); - } - else - { - return false; - } - } - } - - // Do the same for the target manifest. - string[] targetManifest = File.ReadAllLines(_targetManifestFile); - Dictionary targetFiles = new Dictionary(); - for (int i = 0; i < targetManifest.Length; i++) - { - if (targetManifest[i].StartsWith("Archive-Asset-Name: ")) - { - string assetName = targetManifest[i].Substring(20); - i++; - if (targetManifest[i].StartsWith("Archive-Asset-SHA-512-Digest: ")) - { - string assetHash = targetManifest[i].Substring(30); - targetFiles.Add(assetName, assetHash); - } - else - { - return false; - } - } - } - - // Compare hashes and populate the lists of modified and deleted files. - string[] targetFileMap = File.ReadAllLines(_targetFileMap); - foreach (KeyValuePair file in localFiles) - { - // For some reason this MANIFEST.bbr file appears in the manifest, even though - // it doesn't actually exist anywhere...? It doesn't seem to correspond to - // MANIFEST.MF either. - if (file.Key == "META-INF/MANIFEST.bbr") - { - continue; - } - - // If the target manifest doesn't contain the same key/value pair, - // that means the local file has been either added or modified. - if (!targetFiles.Contains(file)) - { - TaskItem item = new TaskItem(file.Key); - item.SetMetadata("SourcePath", getSourcePath(file.Key, targetFileMap)); - _modifiedFiles.Add(item); - } - } - - IDictionaryEnumerator targetEnum = targetFiles.GetEnumerator(); - while (targetEnum.MoveNext()) - { - // If the local manifest doesn't contain the same key, - // that means the target file has been deleted from the project. - if (!localFiles.ContainsKey((string)targetEnum.Key)) - { - TaskItem item = new TaskItem((string)targetEnum.Key); - _deletedFiles.Add(item); - } - } - - // For some reason the manifest file doesn't show up in the target file map - // or the manifest itself, so we add it manually here and always upload it. - TaskItem manifestItem = new TaskItem("META-INF/MANIFEST.MF"); - manifestItem.SetMetadata("SourcePath", "localManifest.mf"); - _modifiedFiles.Add(manifestItem); - - return true; - } - - /// - /// Helper function to parse the target file map to add the source path of each modified file as metadata. - /// - /// Path to the source file - /// Target file map - /// - private string getSourcePath(string sourcePath, string[] targetFileMap) - { - foreach (string line in targetFileMap) - { - if (line.Contains(sourcePath)) - { - int startIndex = line.IndexOf('='); - return line.Substring(startIndex + 1); - } - } - - return ""; - } - - /// - /// Getter for the ModifiedFiles property. - /// - [Output] - public ITaskItem[] ModifiedFiles - { - get - { - ITaskItem[] items = (ITaskItem[])_modifiedFiles.ToArray(typeof(ITaskItem)); - _modifiedFilesCount = items.Length; - return items; - } - } - - /// - /// Getter for the ModifiedFilesCount property - /// - [Output] - public int ModifiedFilesCount - { - get { return _modifiedFilesCount; } - set { _modifiedFilesCount = value; } - } - - /// - /// Getter for the DeletedFiles property - /// - [Output] - public ITaskItem[] DeletedFiles - { - get - { - ITaskItem[] items = (ITaskItem[])_deletedFiles.ToArray(typeof(ITaskItem)); - _deletedFilesCount = items.Length; - return items; - } - } - - /// - /// Getter/Setter for the DeletedFilesCount property - /// - [Output] - public int DeletedFilesCount - { - get { return _deletedFilesCount; } - set { _deletedFilesCount = value; } - } - - /// - /// Setter for the LocalManifestFile property - /// - [Required] - public string LocalManifestFile - { - set - { - _localManifestFile = value; - } - } - - /// - /// Setter for the TargetManifestFile property - /// - [Required] - public string TargetManifestFile - { - set - { - _targetManifestFile = value; - } - } - - /// - /// Setter for the targetFileMap property - /// - [Required] - public string targetFileMap - { - set - { - _targetFileMap = value; - } - } - } -} diff --git a/src_vs2013/VSNDK.Tasks/GenerateMakefile.cs b/src_vs2013/VSNDK.Tasks/GenerateMakefile.cs deleted file mode 100644 index 9f523095..00000000 --- a/src_vs2013/VSNDK.Tasks/GenerateMakefile.cs +++ /dev/null @@ -1,521 +0,0 @@ -//* Copyright 2010-2011 Research In Motion Limited. -//* -//* Licensed under the Apache License, Version 2.0 (the "License"); -//* you may not use this file except in compliance with the License. -//* You may obtain a copy of the License at -//* -//* http://www.apache.org/licenses/LICENSE-2.0 -//* -//* Unless required by applicable law or agreed to in writing, software -//* distributed under the License is distributed on an "AS IS" BASIS, -//* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//* See the License for the specific language governing permissions and -//* limitations under the License. - -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Collections; -using System.IO; -using Microsoft.Build.Framework; -using Microsoft.Build.Utilities; -using System.Runtime.InteropServices; - -namespace VSNDK.Tasks -{ - /// - /// MSBuild Task for generating a make file for packaging the bar file. - /// - public class GenerateMakefile : Task - { - #region Member Variables and Constants - private string _projectDir; - private string _intDir; - private string _outDir; - - private const string INITIAL_DEFINITIONS = - "RM := rm -rf\n\n" + - - "# Empty variable definitions.\n" + - "O_SRCS := \n" + - "CPP_SRCS := \n" + - "C_UPPER_SRCS := \n" + - "C_SRCS := \n" + - "S_UPPER_SRCS := \n" + - "OBJ_SRCS := \n" + - "II_SRCS := \n" + - "ASM_SRCS := \n" + - "CXX_SRCS := \n" + - "I_SRCS := \n" + - "CC_SRCS := \n" + - "OBJS := \n" + - "C_DEPS := \n" + - "CC_DEPS := \n" + - "ARCHIVES := \n" + - "CPP_DEPS := \n" + - "I_DEPS := \n" + - "CXX_DEPS := \n" + - "C_UPPER_DEPS := \n" + - "II_DEPS := \n\n" + - - "USER_OBJS := \n" + - "LIBS := \n\n"; - - private const string DEPENDENCY_INCLUDES = - "# Include all dependency files\n" + - "ifneq ($(MAKECMDGOALS),clean)\n" + - "ifneq ($(strip $(C_DEPS)),)\n" + - "-include $(C_DEPS)\n" + - "endif\n" + - "ifneq ($(strip $(CC_DEPS)),)\n" + - "-include $(CC_DEPS)\n" + - "endif\n" + - "ifneq ($(strip $(CPP_DEPS)),)\n" + - "-include $(CPP_DEPS)\n" + - "endif\n" + - "ifneq ($(strip $(I_DEPS)),)\n" + - "-include $(I_DEPS)\n" + - "endif\n" + - "ifneq ($(strip $(CXX_DEPS)),)\n" + - "-include $(CXX_DEPS)\n" + - "endif\n" + - "ifneq ($(strip $(C_UPPER_DEPS)),)\n" + - "-include $(C_UPPER_DEPS)\n" + - "endif\n" + - "ifneq ($(strip $(II_DEPS)),)\n" + - "-include $(II_DEPS)\n" + - "endif\n" + - "endif\n\n"; - #endregion - - #region properties - - /// - /// Getter/Setter for CompileItems property - /// - public ITaskItem[] CompileItems - { - set; - get; - } - - /// - /// Getter/Setter for LinkItems - /// - public ITaskItem[] LinkItems - { - set; - get; - } - - /// - /// Getter/Setter for ProjectDir property - /// - public string ProjectDir - { - set { _projectDir = value.Replace('\\', '/'); } - get { return _projectDir; } - } - - /// - /// Getter/Setter for IntDir property - /// - public string IntDir - { - set { _intDir = value.Replace('\\', '/'); } - get { return _intDir; } - } - - /// - /// Getter/Setter for OutDir property - /// - public string OutDir - { - set { _outDir = value.Replace('\\', '/'); } - get { return _outDir; } - } - - /// - /// Getter/Setter for AdditionalIncludeDirectories property - /// - public string[] AdditionalIncludeDirectories - { - set; - get; - } - - /// - /// Getter/Setter for AdditionLibraryDirectories - /// - public string[] AdditionalLibraryDirectories - { - set; - get; - } - - /// - /// Getter/Setter for ExcludeDirectories - /// - public string[] ExcludeDirectories - { - set; - get; - } - - - /// - /// Getter/Setter for TargetName property - /// - public string TargetName - { - set; - get; - } - - /// - /// Getter/Setter for TargetExtension property - /// - public string TargetExtension - { - set; - get; - } - - /// - /// Getter/Setter for ConfigurationType property - /// - public string ConfigurationType - { - set; - get; - } - - /// - /// Getter/Setter for CompilerVersion property - /// - public string CompilerVersion - { - set; - get; - } - - /// - /// Getter/Setter for Platform property - /// - public string Platform - { - set; - get; - } - - #endregion - - /// - /// Interface to unmanaged code for getting the SHortPathName for a given directory. - /// - /// Path to be converted - /// Returned ShortPathName - /// Length of the ShortPathName - /// - [DllImport("kernel32.dll", CharSet = CharSet.Auto)] - public static extern int GetShortPathName( - [MarshalAs(UnmanagedType.LPTStr)] - string path, - [MarshalAs(UnmanagedType.LPTStr)] - StringBuilder shortPath, - int shortPathLength - ); - - /// - /// Execute MSBuild Task - /// - /// - public override bool Execute() - { - string targetString = TargetName + TargetExtension; - targetString = targetString.Replace(".exe", ""); - string compilerFlag = "-V\"" + CompilerVersion; - - if (Platform == "BlackBerry") - compilerFlag += ",gcc_ntoarmv7le\""; - else if (Platform == "BlackBerrySimulator") - compilerFlag += ",gcc_ntox86\""; - - using (StreamWriter outFile = new StreamWriter(IntDir + "makefile")) - { - outFile.Write(INITIAL_DEFINITIONS); - // System.Diagnostics.Debugger.Launch(); - foreach (ITaskItem compileItem in CompileItems) - { - // Get the metadata we need from this compile item. - string id = compileItem.GetMetadata("Identity").Replace('\\', '/'); - string filename = compileItem.GetMetadata("Filename"); - string extension = compileItem.GetMetadata("Extension"); - string relativeDir = compileItem.GetMetadata("RelativeDir").Replace('\\', '/'); - string compileAs = compileItem.GetMetadata("CompileAs"); - string warningLevel = compileItem.GetMetadata("WarningLevel"); - string ansi = compileItem.GetMetadata("Ansi"); - string optimizationLevel = compileItem.GetMetadata("OptimizationLevel"); - string generateDebugInfo = compileItem.GetMetadata("GenerateDebugInformation"); - string runtimeTypeInfo = compileItem.GetMetadata("RuntimeTypeInfo"); - string enhancedSecurity = compileItem.GetMetadata("EnhancedSecurity"); - string additionalOptions = compileItem.GetMetadata("AdditionalOptions"); - string fullPath = compileItem.GetMetadata("FullPath").Replace('\\', '/'); - - /// if CompileItem is in the ExcludedPath then continue. - if (isExcludedPath(fullPath)) - { - - continue; - } - - StringBuilder shortPath = new StringBuilder(1024); - GetShortPathName(fullPath, shortPath, shortPath.Capacity); - string fullPathShortened = shortPath.ToString(); - - string handleExceptions = compileItem.GetMetadata("GccExceptionHandling"); - - string[] preprocessorDefs = compileItem.GetMetadata("PreprocessorDefinitions").Split(';'); - string[] preprocessorUndefs = compileItem.GetMetadata("UndefinePreprocessorDefinitions").Split(';'); - - string[] additionalIncludeDirs = compileItem.GetMetadata("AdditionalIncludeDirectories").Split(';'); - for (int i = 0; i < additionalIncludeDirs.Length; i++) - { - // Prepend ProjectDir to relative paths -- otherwise they will be interpreted - // as being relative to the build dir, e.g. ProjectDir/BlackBerry/Debug - if (additionalIncludeDirs[i] != "" && !additionalIncludeDirs[i].Contains(':')) - additionalIncludeDirs[i] = ProjectDir + additionalIncludeDirs[i]; - } - - // Add this compile item to the source definition. - if (compileAs == "CompileAsC") - outFile.Write("C_SRCS += "); - else if (compileAs == "CompileAsCpp") - outFile.Write("CPP_SRCS += "); - - // Source file location. - outFile.WriteLine(fullPathShortened); - - // Add this compile item's dependency file to the DEPS definition. - if (compileAs == "CompileAsC") - outFile.Write("C_DEPS += "); - else if (compileAs == "CompileAsCpp") - outFile.Write("CPP_DEPS += "); - - outFile.WriteLine("./" + filename + ".d"); - - // Add the object file to the OBJS definition. - outFile.WriteLine("OBJS += ./" + filename + ".o\n"); - - // Now add a compile rule for this item. - outFile.WriteLine(filename + ".o: " + fullPathShortened); - outFile.Write("\tqcc -o $@ " + fullPathShortened + " " + compilerFlag + " -c -Wp,-MMD,$(basename $@).d -Wp,-MT,$@ "); - - if (generateDebugInfo == "true") - outFile.Write("-g "); - - Dictionary warningMap = new Dictionary(); - warningMap.Add("TurnOffAllWarnings", "-w0 "); - warningMap.Add("Level1", "-w1 "); - warningMap.Add("Level2", "-w2 "); - warningMap.Add("Level3", "-w3 "); - warningMap.Add("Level4", "-w4 "); - warningMap.Add("Level5", "-w5 "); - warningMap.Add("Level6", "-w6 "); - warningMap.Add("Level7", "-w7 "); - warningMap.Add("Level8", "-w8 "); - warningMap.Add("Level9", "-w9 "); - warningMap.Add("EnableAllWarnings", "-Wall "); - - string warningLevelSwitch; - warningMap.TryGetValue(warningLevel, out warningLevelSwitch); - outFile.Write(warningLevelSwitch); - - if (compileAs == "CompileAsC") - outFile.Write("-lang-c "); - else if (compileAs == "CompileAsCpp") - outFile.Write("-lang-c++ "); - - if (runtimeTypeInfo == "false" && compileAs == "CompileAsCpp") - outFile.Write("-fno-rtti "); - - if (handleExceptions == "true") - outFile.Write("-fexceptions "); - else - outFile.Write("-fno-exceptions "); - - if (enhancedSecurity == "true") - outFile.Write("-fstack-protector-all "); - - // Note: Consider letting user decide between "-fpic" and "-fPIC" - // For now we use the safe, cross-platform "-fPIC" - if (ConfigurationType == "DynamicLibrary") - outFile.Write("-fPIC "); - - foreach (string includeDir in AdditionalIncludeDirectories) - { - if (includeDir != "") - outFile.Write("-I\"" + includeDir + "\" "); - } - - foreach (string includeDir in additionalIncludeDirs) - { - if (includeDir != "") - outFile.Write("-I\"" + includeDir + "\" "); - } - - foreach (string def in preprocessorDefs) - { - if (def != "") - outFile.Write("-D" + def + " "); - } - - foreach (string undef in preprocessorUndefs) - { - if (undef != "") - outFile.Write("-U" + undef + " "); - } - - outFile.WriteLine(additionalOptions); - outFile.WriteLine(); - } - - outFile.Write(DEPENDENCY_INCLUDES); - - // Now write out all the targets. - outFile.WriteLine("all: " + targetString); - outFile.WriteLine(); - outFile.Write(targetString + ": $(OBJS) $(USER_OBJS) $(LIB_DEPS) "); - outFile.WriteLine(); - - string rootedOutDir = (Path.IsPathRooted(OutDir)) ? OutDir : ProjectDir + OutDir; - - StringBuilder shortOutPath = new StringBuilder(1024); - GetShortPathName(rootedOutDir, shortOutPath, shortOutPath.Capacity); - rootedOutDir = shortOutPath.ToString(); - - if (ConfigurationType == "StaticLibrary") - { - outFile.Write("\tqcc -A " + rootedOutDir + targetString + " $(OBJS) $(USER_OBJS) $(LIBS) " + compilerFlag + " -w1"); - } - else if (ConfigurationType == "DynamicLibrary") - { - // In case of reverse dependencies, may need to add "-Wl,-export-dynamic" - // Also note that the soname is currently the same as the target name, and no version information is added. - outFile.Write("\tqcc -shared -Wl,-soname," + targetString + - " -o " + rootedOutDir + targetString + - " $(OBJS) $(USER_OBJS) $(LIBS) " + compilerFlag); - } - else if (ConfigurationType == "Utility") - { - // As far as I know, we don't support utilities. - } - else if (ConfigurationType == "Application") - { - // For now, collect linker metadata from the first link item. - // (Why do we have multiple link items anyhow?) - string[] libs = LinkItems[0].GetMetadata("AdditionalDependencies").Split(';'); - string generateDebugInfo = LinkItems[0].GetMetadata("GenerateDebugInformation"); - string compileAs = LinkItems[0].GetMetadata("CompileAs"); - - string[] libDirs = LinkItems[0].GetMetadata("AdditionalLibraryDirectories").Split(';'); - for (int i = 0; i < libDirs.Length; i++) - { - // Prepend ProjectDir to relative paths. - if (libDirs[i] != "" && !libDirs[i].Contains(':')) - libDirs[i] = ProjectDir + libDirs[i]; - } - - // This is the linker's tool invocation. - outFile.Write("\tqcc -o " + rootedOutDir + targetString + " $(OBJS) $(USER_OBJS) $(LIBS) " + compilerFlag + " "); - - if (compileAs == "CompileAsCpp") - outFile.Write("-lang-c++ "); - else if (compileAs == "CompileAsC") - outFile.Write("-lang-c "); - - if (generateDebugInfo == "true") - outFile.Write("-g "); - - // For added security, remap some sections of ELF as read-only. - outFile.Write("-Wl,-z,relro,-z,now "); - - // Visual Studio doesn't have separate lists for static vs. dynamic dependencies. - // To differentiate between the two, include the extension in the list. - // (.a for static, .so for dynamic) - // If no extension is included in the name it will be treated as the same type - // as the last declared type, and the default type is static. This is the way - // qcc would work if you were using it from the command line with the - // "-Bstatic" and "-Bdynamic" flags. - for (int i = 0; i < libs.Length; i++) - { - if (libs[i].EndsWith(".so")) - { - outFile.Write("-Bdynamic "); - libs[i] = libs[i].Remove(libs[i].Length - 3); - } - else if (libs[i].EndsWith(".a")) - { - outFile.Write("-Bstatic "); - libs[i] = libs[i].Remove(libs[i].Length - 2); - } - - if (libs[i] != "") - outFile.Write("-l" + libs[i] + " "); - } - - foreach (string libDir in libDirs) - { - if (libDir != "") - outFile.Write("-L\"" + libDir + "\" "); - } - - foreach (string libDir in AdditionalLibraryDirectories) - { - if (libDir != "") - outFile.Write("-L\"" + libDir + "\" "); - } - } - - outFile.WriteLine("\n"); - outFile.WriteLine("clean:"); - outFile.Write("\t-$(RM) $(OBJS)$(C_DEPS)$(CC_DEPS)$(COM_QNX_QCC_OUTPUTTYPE_LINKER_OUTPUTS)$(CPP_DEPS)$(I_DEPS)$(CXX_DEPS)$(C_UPPER_DEPS)$(II_DEPS) " + rootedOutDir + targetString); - - if (ConfigurationType == "Application") - { - outFile.WriteLine(" " + rootedOutDir + TargetName + ".bar"); - } - - outFile.WriteLine(); - outFile.WriteLine(".PHONY: all clean dependents\n"); - } - - return true; - } - - /// - /// Check to see if path is in the excluded list - /// - /// - /// - private bool isExcludedPath(string path) - { - if (ExcludeDirectories != null) - { - foreach (string exDir in ExcludeDirectories) - { - if (Path.GetFullPath(path).Contains(Path.GetFullPath(exDir))) - { - return true; - } -/* else - { - return false; - }*/ - } - } - return false; - } - } -} diff --git a/src_vs2013/VSNDK.Tasks/GetAppInfo.cs b/src_vs2013/VSNDK.Tasks/GetAppInfo.cs deleted file mode 100644 index 353f09de..00000000 --- a/src_vs2013/VSNDK.Tasks/GetAppInfo.cs +++ /dev/null @@ -1,124 +0,0 @@ -//* Copyright 2010-2011 Research In Motion Limited. -//* -//* Licensed under the Apache License, Version 2.0 (the "License"); -//* you may not use this file except in compliance with the License. -//* You may obtain a copy of the License at -//* -//* http://www.apache.org/licenses/LICENSE-2.0 -//* -//* Unless required by applicable law or agreed to in writing, software -//* distributed under the License is distributed on an "AS IS" BASIS, -//* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//* See the License for the specific language governing permissions and -//* limitations under the License. - -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.IO; -using System.Xml; -using Microsoft.Build.Framework; -using Microsoft.Build.Utilities; - -namespace VSNDK.Tasks -{ - /// - /// MSBuid Task to retrieve the application info - /// - public class GetAppInfo : Task - { - #region Member Variables and Constants - private string _projectDir; - private string _appName; - private string _barDescriptorPath = ""; - private string _appId; - #endregion - - /// - /// Execute the MSBuild Task - /// - /// - public override bool Execute() - { - string rootedOutDir = (Path.IsPathRooted(_barDescriptorPath)) ? _barDescriptorPath : _projectDir + _barDescriptorPath; - XmlReader reader = XmlReader.Create(rootedOutDir); - reader.ReadToFollowing("id"); - _appId = reader.ReadElementContentAsString(); - - return true; - } - - /// - /// Getter/Setter for the ApplicationDescriptorXml property - /// - public string ApplicationDescriptorXml - { - set - { - _barDescriptorPath = value; - } - get - { - return _barDescriptorPath; - } - } - - /// - /// Getter/Setter for the ProjectDir property - /// - public string ProjectDir - { - set - { - _projectDir = value; - } - get - { - return _projectDir; - } - } - - /// - /// Getter/Setter for the AppName property - /// - public string AppName - { - set - { - _appName = value; - - if (_barDescriptorPath == "") - { - // Default location of bar-descriptor file, if not specified in the Properties Configurations. - _barDescriptorPath = "BlackBerry-" + _appName + "\\bar-descriptor.xml"; - if (!File.Exists(_barDescriptorPath)) - { - // Just to support the default locations of bar-descriptor from previous versions of the plug-in. - _barDescriptorPath = _appName + "_barDescriptor\\bar-descriptor.xml"; - if (!File.Exists(_barDescriptorPath)) - { - _barDescriptorPath = "bar-descriptor.xml"; - } - } - } - } - get - { - return _appName; - } - } - - /// - /// Getter/Setter for the AppId property - /// - [Output] - public string AppId - { - get - { - return _appId; - } - } - } -} diff --git a/src_vs2013/VSNDK.Tasks/LaunchDebugEngine.cs b/src_vs2013/VSNDK.Tasks/LaunchDebugEngine.cs deleted file mode 100644 index bd688a79..00000000 --- a/src_vs2013/VSNDK.Tasks/LaunchDebugEngine.cs +++ /dev/null @@ -1,83 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using Microsoft.Build.Utilities; -using Microsoft.Build.Framework; - -using EnvDTE; -using EnvDTE80; -using Microsoft.VisualStudio.Shell; -using Microsoft.VisualStudio.Shell.Interop; -using Microsoft.VisualStudio.OLE.Interop; -using System.Runtime.InteropServices; - -namespace VSNDK.Tasks -{ - /*[ComImport] - [Guid("23EB4AF8-BE9C-4b49-B3A4-24F4FF657B27")] - * */ - - public abstract class LaunchDebugEngine : Microsoft.Build.Utilities.Task - { - /* - [DllImport("ole32.dll")] - static extern int CoInitializeEx(IntPtr pvReserved, uint dwCoInit); - */ - private DTE2 _applicationObject; - private string _filePath; - - public override bool Execute() - { - System.Diagnostics.Debugger.Launch(); - //CoInitializeEx(NULL, COINIT_MULTITHREADED); - //enum comEnum = {COINIT_MULTITHREADED=0}; - //CoInitializeEx((IntPtr)null, (uint)0); - - _applicationObject = (EnvDTE80.DTE2)System.Runtime.InteropServices.Marshal.GetActiveObject("VisualStudio.DTE.10.0"); - - Microsoft.VisualStudio.Shell.ServiceProvider sp = - new Microsoft.VisualStudio.Shell.ServiceProvider((Microsoft.VisualStudio.OLE.Interop.IServiceProvider)_applicationObject); - - IVsDebugger dbg = (IVsDebugger)sp.GetService(typeof(SVsShellDebugger)); - - VsDebugTargetInfo info = new VsDebugTargetInfo(); - info.cbSize = (uint)System.Runtime.InteropServices.Marshal.SizeOf(info); - info.dlo = Microsoft.VisualStudio.Shell.Interop.DEBUG_LAUNCH_OPERATION.DLO_CreateProcess; - - info.bstrExe = _filePath; - info.bstrCurDir = System.IO.Path.GetDirectoryName(info.bstrExe); - info.bstrArg = null; // no command line parameters - info.bstrRemoteMachine = null; // debug locally - info.fSendStdoutToOutputWindow = 0; // Let stdout stay with the application. - info.clsidCustom = new Guid("{D951924A-4999-42a0-9217-1EB5233D1D5A}"); // Set the launching engine the sample engine guid - info.grfLaunch = 0; - - IntPtr pInfo = System.Runtime.InteropServices.Marshal.AllocCoTaskMem((int)info.cbSize); - System.Runtime.InteropServices.Marshal.StructureToPtr(info, pInfo, false); - - try - { - dbg.LaunchDebugTargets(1, pInfo); - } - finally - { - if (pInfo != IntPtr.Zero) - { - System.Runtime.InteropServices.Marshal.FreeCoTaskMem(pInfo); - } - } - - return true; - } - - [Required] - public string FilePath - { - set - { - _filePath = value; - } - } - } -} diff --git a/src_vs2013/VSNDK.Tasks/MakeAllAndFormatOutputMessages.cs b/src_vs2013/VSNDK.Tasks/MakeAllAndFormatOutputMessages.cs deleted file mode 100644 index 2dfcefe2..00000000 --- a/src_vs2013/VSNDK.Tasks/MakeAllAndFormatOutputMessages.cs +++ /dev/null @@ -1,556 +0,0 @@ -//* Copyright 2010-2011 Research In Motion Limited. -//* -//* Licensed under the Apache License, Version 2.0 (the "License"); -//* you may not use this file except in compliance with the License. -//* You may obtain a copy of the License at -//* -//* http://www.apache.org/licenses/LICENSE-2.0 -//* -//* Unless required by applicable law or agreed to in writing, software -//* distributed under the License is distributed on an "AS IS" BASIS, -//* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//* See the License for the specific language governing permissions and -//* limitations under the License. - -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using EnvDTE; -using EnvDTE80; -using System.Runtime.InteropServices; -using System.IO; -using System.Runtime.Serialization.Formatters.Binary; -using System.Runtime.Serialization; -using System.Diagnostics; -using Microsoft.Build.Utilities; -using Microsoft.Build.Framework; -using System.Text.RegularExpressions; - -namespace VSNDK.Tasks -{ - /// - /// Cancelabe MSBuild Task for Running the Make file for the build. - /// - public class MakeAllAndFormatOutputMessages : ICancelableTask - { - #region Member Variables and Constants - - private string _projectDir; - private string _intDir; - private string _outDir; - - private static StringBuilder stdOutput = null; - private static StringBuilder errorOutput = null; - private IBuildEngine buildEngine; - private System.Diagnostics.Process proc = null; - private ITaskHost hostObject; - - private string _numProcessors; - - #endregion - - /// - /// Getter/Setter for the BuildEngine property - /// - public IBuildEngine BuildEngine - { - get { return buildEngine; } - set { buildEngine = value; } - } - - /// - /// Getter/Setter for the HostObject property - /// - public ITaskHost HostObject - { - get { return hostObject; } - set { hostObject = value; } - } - - /// - /// Getter/Setter for CompileItems property - /// - public ITaskItem[] CompileItems - { - set; - get; - } - - /// - /// Getter/Setter for the number of processors property. - /// - public string numProcessors - { - get - { - _numProcessors = Environment.ProcessorCount.ToString(); - return _numProcessors; - } - set { _numProcessors = value; } - } - - /// - /// Perform Task Execution - /// - /// Return true on successful task completion - public bool Execute() - { - string pCommand = ""; - string pArgs = ""; - bool mprocess = false; - - try - { - foreach (ITaskItem compileItem in CompileItems) - { - // Get the metadata we need from this compile item. - mprocess = (compileItem.GetMetadata("MultiProcess") == "true"); - } - - pCommand = "cmd"; - if (mprocess) - pArgs = "/c " + ToolsPath + @"\make -j" + numProcessors + " all"; - else - pArgs = "/c " + ToolsPath + @"\make all"; - - System.Diagnostics.ProcessStartInfo procStartInfo = new System.Diagnostics.ProcessStartInfo(pCommand, pArgs); - - // Set UseShellExecute to false for redirection. - procStartInfo.UseShellExecute = false; - - // The following commands are needed to redirect the standard and error outputs. - // These streams are read asynchronously using an event handler. - procStartInfo.RedirectStandardOutput = true; - stdOutput = new StringBuilder(""); - procStartInfo.RedirectStandardError = true; - errorOutput = new StringBuilder(""); - - // Setting the work directory. - string rootedOutDir = (Path.IsPathRooted(OutDir)) ? OutDir : ProjectDir + OutDir; - procStartInfo.WorkingDirectory = rootedOutDir; - - // Do not create the black window. - procStartInfo.CreateNoWindow = true; - - // Create a process and assign its ProcessStartInfo - proc = new System.Diagnostics.Process(); - proc.StartInfo = procStartInfo; - - // Set ours events handlers to asynchronously read the standard and error outputs. - proc.OutputDataReceived += new DataReceivedEventHandler(StdOutputHandler); - proc.ErrorDataReceived += new DataReceivedEventHandler(ErrorOutputHandler); - - // Start the process - proc.Start(); - - // Start the asynchronous read of the standard and error output stream. - proc.BeginOutputReadLine(); - proc.BeginErrorReadLine(); - - do - { - // Wait until finished - // This code is correct, don't remove it. WaitForExit freezes the IDE while waiting for the end of the build process. - // With this loop and the time out, the IDE won't be frozen enabling the build process to be cancelled. - } - while (!proc.WaitForExit(1000)); - - } - catch (Exception e) - { - Console.WriteLine("Failed to execute make all. Reason: " + e.Message); - return false; - } - - if (errorOutput.ToString().IndexOf(": error:") == -1) - { - int pos = errorOutput.ToString().LastIndexOf("\\make:"); - if (pos == -1) - return true; - else - { - pos = errorOutput.ToString().IndexOf("Error ", pos); - if (pos == -1) - return true; - } - } - - return false; - - } - - /// - /// Standard Output Event Handler - /// - /// Sending Process - /// Output Text - private void StdOutputHandler(object sendingProcess, DataReceivedEventArgs outLine) - { - if (!String.IsNullOrEmpty(outLine.Data)) - { - string outputText = outLine.Data; - - int tilde = outputText.IndexOf("~"); - while (tilde != -1) - { - int end = outputText.IndexOf(':', tilde); - int end1 = outputText.IndexOf(' ', tilde); - int end2 = outputText.IndexOf('\n', tilde); - if ((end == -1) && (end1 == -1) && (end2 == -1)) - break; - if (end == -1) - end = outputText.Length - 1; - if (end1 == -1) - end1 = outputText.Length - 1; - if (end2 == -1) - end2 = outputText.Length - 1; - if (end > end1) - end = end1; - if (end > end2) - end = end2; - int begin = outputText.LastIndexOf('\n', tilde) + 1; - int begin1 = outputText.LastIndexOf(' ', tilde) + 1; - if (begin < begin1) - begin = begin1; - StringBuilder longPathName = new StringBuilder(1024); - string shortPathName = outputText.Substring(begin, end - begin); - GetLongPathName(shortPathName, longPathName, longPathName.Capacity); - if (longPathName.ToString() == "") - { - int sep = shortPathName.LastIndexOf('/'); - int sep2 = shortPathName.LastIndexOf('\\'); - if (sep2 > sep) - sep = sep2; - if (sep != -1) - { - shortPathName = shortPathName.Remove(sep + 1); - GetLongPathName(shortPathName, longPathName, longPathName.Capacity); - } - } - if (longPathName.ToString() != "") - outputText = outputText.Replace(shortPathName, longPathName.ToString()); - - tilde = outputText.IndexOf("~", tilde + 1); - } - - - BuildMessageEventArgs taskEvent = new BuildMessageEventArgs(outputText, "", "", MessageImportance.High); - BuildEngine.LogMessageEvent(taskEvent); - - } - } - - /// - /// Error Output Event Handler - /// - /// Sending process - /// Error Message - private void ErrorOutputHandler(object sendingProcess, DataReceivedEventArgs outLine) - { - if (!String.IsNullOrEmpty(outLine.Data)) - { - string outputText = outLine.Data; - int pos = outputText.IndexOf(": warning:"); - if (pos == -1) - pos = outputText.IndexOf(": note:"); - int diff = 10; - int tilde; - while (pos != -1) - { - if (outputText[pos - 1] != ')') - { - int end = pos; - int begin = outputText.LastIndexOf('\n', end) + 1; - string oldPath = outputText.Substring(begin, end - begin + 1); - string newPath = oldPath; - newPath = newPath.Insert(newPath.Length - 1, ")"); - end = newPath.LastIndexOf(":", newPath.Length - 2); - if (end != -1) - { - newPath = newPath.Remove(end, 1); - newPath = newPath.Insert(end, ","); - end = newPath.LastIndexOf(":", end - 1); - if (end != -1) - { - if (end > 5) - { - newPath = newPath.Remove(end, 1); - newPath = newPath.Insert(end, "("); - } - else - { - end = newPath.IndexOf(",", end); - newPath = newPath.Remove(end, 1); - newPath = newPath.Insert(end, "("); - } - - tilde = newPath.IndexOf("~"); - if (tilde != -1) - { - StringBuilder longPathName = new StringBuilder(1024); - string shortPathName = newPath.Substring(0, end); - GetLongPathName(shortPathName, longPathName, longPathName.Capacity); - newPath = longPathName.ToString() + newPath.Substring(end); - } - - diff += (newPath.Length - oldPath.Length); - outputText = outputText.Replace(oldPath, newPath); - } - } - } - pos = outputText.IndexOf(": warning:", pos + diff); - } - - pos = outputText.IndexOf(": error:"); - diff = 8; - while (pos != -1) - { - if (outputText[pos - 1] != ')') - { - int end = pos; - int begin = outputText.LastIndexOf('\n', end) + 1; - string oldPath = outputText.Substring(begin, end - begin + 1); - string newPath = oldPath; - newPath = newPath.Insert(newPath.Length - 1, ")"); - end = newPath.LastIndexOf(":", newPath.Length - 2); - if (end != -1) - { - newPath = newPath.Remove(end, 1); - newPath = newPath.Insert(end, ","); - end = newPath.LastIndexOf(":", end - 1); - if (end != -1) - { - if (end > 5) - { - newPath = newPath.Remove(end, 1); - newPath = newPath.Insert(end, "("); - } - else - { - end = newPath.IndexOf(",", end); - newPath = newPath.Remove(end, 1); - newPath = newPath.Insert(end, "("); - } - - tilde = newPath.IndexOf("~"); - if (tilde != -1) - { - StringBuilder longPathName = new StringBuilder(1024); - string shortPathName = newPath.Substring(0, end); - GetLongPathName(shortPathName, longPathName, longPathName.Capacity); - newPath = longPathName.ToString() + newPath.Substring(end); - } - - diff += (newPath.Length - oldPath.Length); - outputText = outputText.Replace(oldPath, newPath); - } - } - } - pos = outputText.IndexOf(": error:", pos + diff); - } - - tilde = outputText.IndexOf("~"); - while (tilde != -1) - { - int end = outputText.IndexOf(':', tilde); - int end1 = outputText.IndexOf(' ', tilde); - int end2 = outputText.IndexOf('\n', tilde); - if ((end == -1) && (end1 == -1) && (end2 == -1)) - break; - if (end == -1) - end = outputText.Length - 1; - if (end1 == -1) - end1 = outputText.Length - 1; - if (end2 == -1) - end2 = outputText.Length - 1; - if (end > end1) - end = end1; - if (end > end2) - end = end2; - int begin = outputText.LastIndexOf('\n', tilde) + 1; - int begin1 = outputText.LastIndexOf(' ', tilde) + 1; - if (begin < begin1) - begin = begin1; - StringBuilder longPathName = new StringBuilder(1024); - string shortPathName = outputText.Substring(begin, end - begin); - GetLongPathName(shortPathName, longPathName, longPathName.Capacity); - if (longPathName.ToString() == "") - { - int sep = shortPathName.LastIndexOf('/'); - int sep2 = shortPathName.LastIndexOf('\\'); - if (sep2 > sep) - sep = sep2; - if (sep != -1) - { - shortPathName = shortPathName.Remove(sep + 1); - GetLongPathName(shortPathName, longPathName, longPathName.Capacity); - } - } - if (longPathName.ToString() != "") - outputText = outputText.Replace(shortPathName, longPathName.ToString()); - - tilde = outputText.IndexOf("~", tilde + 1); - } - - /// Send build output to the Output window and to the ErrorList window - if (outputText.IndexOf(": error:") > 0) - { - string fileName = outputText.Substring(0, outputText.IndexOf(": error:")); - int lineNum = 0; - - int ini = fileName.IndexOf('(') + 1; - int end = fileName.IndexOf(')'); - - if (fileName.IndexOf(',', ini) > 0) - { - if (fileName.IndexOf(',', ini) < end) - { - end = fileName.IndexOf(',', ini); - } - } - end = end - fileName.IndexOf('(') - 1; - - try - { - lineNum = Convert.ToInt16(fileName.Substring(ini, end)); - } - catch - { - lineNum = 0; - } - - int colNum = 0; - string messageErr = outputText.Substring(outputText.IndexOf(": error:") + 9); - fileName = fileName.Substring(0, fileName.IndexOf('(')); - BuildErrorEventArgs errorEvent = new BuildErrorEventArgs("", "", fileName, lineNum, colNum, 0, 0, messageErr, "", ""); - BuildEngine.LogErrorEvent(errorEvent); - } - else if (outputText.IndexOf(": warning:") > 0) - { - string fileName = outputText.Substring(0, outputText.IndexOf(": warning:")); - int lineNum = 0; - - int ini = fileName.IndexOf('(') + 1; - int end = fileName.IndexOf(')'); - if (fileName.IndexOf(',', ini) > 0) - { - if (fileName.IndexOf(',', ini) < end) - { - end = fileName.IndexOf(',', ini); - } - } - end = end - fileName.IndexOf('(') - 1; - - try - { - lineNum = Convert.ToInt16(fileName.Substring(ini, end)); - } - catch - { - lineNum = 0; - } - - int colNum = 0; - string messageErr = outputText.Substring(outputText.IndexOf(": warning:") + 11); - fileName = fileName.Substring(0, fileName.IndexOf('(')); - BuildWarningEventArgs warningEvent = new BuildWarningEventArgs("", "", fileName, lineNum, colNum, 0, 0, messageErr, "", ""); - BuildEngine.LogWarningEvent(warningEvent); - } - else if (outputText.Contains("undefined reference")) - { - Regex re = new Regex(@":\d+:"); - Match m = re.Match(outputText); - string fileName = ""; - int lineNum = 0; - string message = ""; - - if (m.Success) - { - fileName = outputText.Substring(0, m.Index); - try - { - lineNum = Convert.ToInt16(m.Value.Trim(':')); - } - catch - { - lineNum = 0; - } - message = outputText.Substring(m.Index + m.Length).Trim(); - } - else - { - lineNum = 0; - fileName = outputText.Substring(0, outputText.IndexOf(':')); - message = outputText.Substring(outputText.LastIndexOf(':') + 1).Trim(); - } - - BuildErrorEventArgs errorEvent = new BuildErrorEventArgs("", "", fileName, lineNum, 1, 0, 0, message, "", ""); - BuildEngine.LogErrorEvent(errorEvent); - } - else - { - BuildMessageEventArgs taskEvent = new BuildMessageEventArgs(outputText, "", "", MessageImportance.High); - BuildEngine.LogMessageEvent(taskEvent); - } - - // Add the text to the collected output. - errorOutput.Append(Environment.NewLine + outputText); - } - } - - - /// GDB works with short path names only, which requires converting the path names to/from long ones. This function - /// returns the long path name for a given short one. - /// Short path name. - /// Returns this long path name. - /// Lenght of this long path name. - /// - [DllImport("kernel32.dll", CharSet = CharSet.Auto)] - public static extern int GetLongPathName( - [MarshalAs(UnmanagedType.LPTStr)] - string path, - [MarshalAs(UnmanagedType.LPTStr)] - StringBuilder longPath, - int longPathLength - ); - - [Required] - public string ProjectDir - { - set { _projectDir = value.Replace('\\', '/'); } - get { return _projectDir; } - } - - [Required] - public string OutDir - { - set { _outDir = value.Replace('\\', '/'); } - get { return _outDir; } - } - - [Required] - public string ToolsPath - { - get; - set; - } - - /// - /// Perform Cancel Code - /// - public void Cancel() - { - try - { - proc.Kill(); - } - catch (Exception ex) - { - BuildMessageEventArgs taskEvent2 = new BuildMessageEventArgs(ex.Message, "", "", MessageImportance.High); - BuildEngine.LogMessageEvent(taskEvent2); - } - - } - } -} diff --git a/src_vs2013/VSNDK.Tasks/PackagerCmdBuilder.cs b/src_vs2013/VSNDK.Tasks/PackagerCmdBuilder.cs deleted file mode 100644 index 37b9b905..00000000 --- a/src_vs2013/VSNDK.Tasks/PackagerCmdBuilder.cs +++ /dev/null @@ -1,44 +0,0 @@ -//* Copyright 2010-2011 Research In Motion Limited. -//* -//* Licensed under the Apache License, Version 2.0 (the "License"); -//* you may not use this file except in compliance with the License. -//* You may obtain a copy of the License at -//* -//* http://www.apache.org/licenses/LICENSE-2.0 -//* -//* Unless required by applicable law or agreed to in writing, software -//* distributed under the License is distributed on an "AS IS" BASIS, -//* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//* See the License for the specific language governing permissions and -//* limitations under the License. - -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using Microsoft.Build.Utilities; - -namespace VSNDK.Tasks -{ - class PackagerCmdBuilder : CommandLineBuilder - { - - /// - /// Constructor - /// - public PackagerCmdBuilder() - : base(true) - { - } - - /// - /// Override of IsQuotingRequired function. Always return true. - /// - /// - /// - protected override bool IsQuotingRequired(string parameter) - { - return true; - } - } -} diff --git a/src_vs2013/VSNDK.Tasks/Properties/AssemblyInfo.cs b/src_vs2013/VSNDK.Tasks/Properties/AssemblyInfo.cs deleted file mode 100644 index ebb81dcb..00000000 --- a/src_vs2013/VSNDK.Tasks/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,50 +0,0 @@ -//* Copyright 2010-2011 Research In Motion Limited. -//* -//* Licensed under the Apache License, Version 2.0 (the "License"); -//* you may not use this file except in compliance with the License. -//* You may obtain a copy of the License at -//* -//* http://www.apache.org/licenses/LICENSE-2.0 -//* -//* Unless required by applicable law or agreed to in writing, software -//* distributed under the License is distributed on an "AS IS" BASIS, -//* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//* See the License for the specific language governing permissions and -//* limitations under the License. - -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("VSNDK.Tasks")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("BlackBerry")] -[assembly: AssemblyProduct("VSNDK.Tasks")] -[assembly: AssemblyCopyright("Copyright © BlackBerry 2011")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("d4362271-7b17-4734-86bb-39564f3e29fc")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Build and Revision Numbers -// by using the '*' as shown below: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/src_vs2013/VSNDK.Tasks/Properties/Resources.Designer.cs b/src_vs2013/VSNDK.Tasks/Properties/Resources.Designer.cs deleted file mode 100644 index 0585af56..00000000 --- a/src_vs2013/VSNDK.Tasks/Properties/Resources.Designer.cs +++ /dev/null @@ -1,144 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// Runtime Version:4.0.30319.18051 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -namespace VSNDK.Tasks.Properties { - using System; - - - /// - /// A strongly-typed resource class, for looking up localized strings, etc. - /// - // This class was auto-generated by the StronglyTypedResourceBuilder - // class via a tool like ResGen or Visual Studio. - // To add or remove a member, edit your .ResX file then rerun ResGen - // with the /str option, or rebuild your VS project. - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - internal class Resources { - - private static global::System.Resources.ResourceManager resourceMan; - - private static global::System.Globalization.CultureInfo resourceCulture; - - [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - internal Resources() { - } - - /// - /// Returns the cached ResourceManager instance used by this class. - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Resources.ResourceManager ResourceManager { - get { - if (object.ReferenceEquals(resourceMan, null)) { - global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("VSNDK.Tasks.Properties.Resources", typeof(Resources).Assembly); - resourceMan = temp; - } - return resourceMan; - } - } - - /// - /// Overrides the current thread's CurrentUICulture property for all - /// resource lookups using this strongly typed resource class. - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Globalization.CultureInfo Culture { - get { - return resourceCulture; - } - set { - resourceCulture = value; - } - } - - /// - /// Looks up a localized string similar to # This file is automatically generated by vs-ndk. - ///# Do not modify this file -- YOUR CHANGES WILL BE ERASED! - ///# - ///# This file must *NOT* be checked in Version Control Systems, - ///# as it contains information specific to your local configuration. - /// - ///# location of the SDK. This is only used by Ant - ///# For customization when using a Version Control System, please read the - ///# header note. - ///sdk.dir={SDKDIR}. - /// - internal static string localproperties_ant_file { - get { - return ResourceManager.GetString("localproperties_ant_file", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Tracking command:. - /// - internal static string Native_TrackingCommandMessage { - get { - return ResourceManager.GetString("Native_TrackingCommandMessage", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to MSB8016: Can not turn on Unicode output for "{0}". Some Unicode characters will be improperly displayed.. - /// - internal static string TrackedVCToolTask_CreateUnicodeOutputPipeFailed { - get { - return ResourceManager.GetString("TrackedVCToolTask.CreateUnicodeOutputPipeFailed", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Forcing rebuild of all source files due to a change in the command line since the last build.. - /// - internal static string TrackedVCToolTask_RebuildingAllSourcesCommandLineChanged { - get { - return ResourceManager.GetString("TrackedVCToolTask.RebuildingAllSourcesCommandLineChanged", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to MSB8014: Forcing a rebuild of all sources due to an error with the tracking logs. {0}. - /// - internal static string TrackedVCToolTask_RebuildingDueToInvalidTLog { - get { - return ResourceManager.GetString("TrackedVCToolTask.RebuildingDueToInvalidTLog", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to MSB8015: Forcing a rebuild of all source files due to the contents of "{0}" being invalid.. - /// - internal static string TrackedVCToolTask_RebuildingDueToInvalidTLogContents { - get { - return ResourceManager.GetString("TrackedVCToolTask.RebuildingDueToInvalidTLogContents", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Forcing rebuild of all source files due to missing command tlog "{0}".. - /// - internal static string TrackedVCToolTask_RebuildingNoCommandTLog { - get { - return ResourceManager.GetString("TrackedVCToolTask.RebuildingNoCommandTLog", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Forcing rebuild of source file "{0}" due to a change in the command line since the last build.. - /// - internal static string TrackedVCToolTask_RebuildingSourceCommandLineChanged { - get { - return ResourceManager.GetString("TrackedVCToolTask.RebuildingSourceCommandLineChanged", resourceCulture); - } - } - } -} diff --git a/src_vs2013/VSNDK.Tasks/Properties/Resources.resx b/src_vs2013/VSNDK.Tasks/Properties/Resources.resx deleted file mode 100644 index 9419c2d4..00000000 --- a/src_vs2013/VSNDK.Tasks/Properties/Resources.resx +++ /dev/null @@ -1,153 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - # This file is automatically generated by vs-ndk. -# Do not modify this file -- YOUR CHANGES WILL BE ERASED! -# -# This file must *NOT* be checked in Version Control Systems, -# as it contains information specific to your local configuration. - -# location of the SDK. This is only used by Ant -# For customization when using a Version Control System, please read the -# header note. -sdk.dir={SDKDIR} - - - Tracking command: - - - MSB8016: Can not turn on Unicode output for "{0}". Some Unicode characters will be improperly displayed. - - - Forcing rebuild of all source files due to a change in the command line since the last build. - - - MSB8014: Forcing a rebuild of all sources due to an error with the tracking logs. {0} - - - MSB8015: Forcing a rebuild of all source files due to the contents of "{0}" being invalid. - - - Forcing rebuild of all source files due to missing command tlog "{0}". - - - Forcing rebuild of source file "{0}" due to a change in the command line since the last build. - - \ No newline at end of file diff --git a/src_vs2013/VSNDK.Tasks/QccCompiler.cs b/src_vs2013/VSNDK.Tasks/QccCompiler.cs deleted file mode 100644 index 46798742..00000000 --- a/src_vs2013/VSNDK.Tasks/QccCompiler.cs +++ /dev/null @@ -1,513 +0,0 @@ -//* Copyright 2010-2011 Research In Motion Limited. -//* -//* Licensed under the Apache License, Version 2.0 (the "License"); -//* you may not use this file except in compliance with the License. -//* You may obtain a copy of the License at -//* -//* http://www.apache.org/licenses/LICENSE-2.0 -//* -//* Unless required by applicable law or agreed to in writing, software -//* distributed under the License is distributed on an "AS IS" BASIS, -//* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//* See the License for the specific language governing permissions and -//* limitations under the License. - -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using Microsoft.Build.Utilities; -using Microsoft.Build.CPPTasks; -using System.Resources; -using System.Reflection; -using Microsoft.Build.Framework; -using System.Collections; -using System.IO; - -namespace VSNDK.Tasks -{ - public class QccCompiler : VSNDKTasks - { - #region fields - // Fields - private ITaskItem[] preprocessOutput; - - //constant fields - private const string ADDITIONAL_INCLUDEDIRECTORIES = "AdditionalIncludeDirectories"; - private const string PREPROCESSOR_DEFINITIONS = "PreprocessorDefinitions"; - private const string UNDEFINE_PREPROCESSOR_DEFINITION = "UndefinePreprocessorDefinition"; - private const string PREPROCESS_TO_FILE = "PreprocessToFile"; - private const string PREPROCESS_TO_STDOUT = "PreprocessToStdout"; - private const string PREPROCESS_KEEP_COMMENTS = "PreprocessKeepComments"; - private const string RUNTIME_TYPE_INFO = "RuntimeTypeInfo"; - private const string OBJECT_FILE_NAME = "ObjectFileName"; - private const string ANSI = "Ansi"; - #endregion - - #region ctors - public QccCompiler() - : base(new ResourceManager("VSNDK.Tasks.Properties.Resources", Assembly.GetExecutingAssembly())) - { - this.preprocessOutput = new ITaskItem[0]; - this.switchOrderList.Add(ADDITIONAL_INCLUDEDIRECTORIES); - this.switchOrderList.Add(ANSI); - this.switchOrderList.Add(PREPROCESSOR_DEFINITIONS); - this.switchOrderList.Add(UNDEFINE_PREPROCESSOR_DEFINITION); - this.switchOrderList.Add(PREPROCESS_TO_FILE); - this.switchOrderList.Add(PREPROCESS_TO_STDOUT); - this.switchOrderList.Add(PREPROCESS_KEEP_COMMENTS); - this.switchOrderList.Add(RUNTIME_TYPE_INFO); - this.switchOrderList.Add(OBJECT_FILE_NAME); - this.switchOrderList.Add(SOURCES); - } - #endregion - - #region overrides - /// - /// Getter/Setter for the AlwaysAppend property - /// - protected override string AlwaysAppend - { - get - { - return LinkSharedLibrary ? "-c -shared" : "-c"; - } - } - - /// - /// Getter/Setter for the AttributeFileTracking property - /// - public override bool AttributeFileTracking - { - get - { - return true; - } - } - - /// - /// Getter/Setter for the TrackedInputFiles property - /// - protected override Microsoft.Build.Framework.ITaskItem[] TrackedInputFiles - { - get - { - return Sources; - } - } - - /// - /// Execute the specified tool for building - /// - /// - /// - /// - /// - protected override int ExecuteTool(string pathToTool, string responseFileCommands, string commandLineCommands) - { - foreach (ITaskItem item in this.Sources) - { - string source = item.ItemSpec; - base.LogEventsFromTextOutput(source, MessageImportance.High); - } - return base.ExecuteTool(pathToTool, responseFileCommands, commandLineCommands); - } - - /// - /// Getter/Setter for the WriteTLogNames property - /// - protected override string[] WriteTLogNames - { - get - { - return new string[] { "qcc_compiler.write.1.tlog", "qcc_compiler.*.write.1.tlog" }; - } - } - - /// - /// Getter/Setter for the CommandTLogName property - /// - protected override string CommandTLogName - { - get - { - return "qcc_compiler.command.1.tlog"; - } - } - - /// - /// Getter/Setter for the ReadTLogNames property - /// - protected override string[] ReadTLogNames - { - get - { - return new string[] { "qcc_compiler.read.1.tlog", "qcc_compiler.*.read.1.tlog" }; - } - } - #endregion //override - - #region properties - - /// - /// GetterSetter for the AdditionalIncludeDirectories property. - /// - public string[] AdditionalIncludeDirectories - { - get - { - if (base.IsPropertySet(ADDITIONAL_INCLUDEDIRECTORIES)) - { - return base.ActiveToolSwitches[ADDITIONAL_INCLUDEDIRECTORIES].StringList; - } - return null; - } - set - { - base.ActiveToolSwitches.Remove(ADDITIONAL_INCLUDEDIRECTORIES); - ToolSwitch switch2 = new ToolSwitch(ToolSwitchType.StringArray) - { - DisplayName = "Additional Include Directories", - Description = "Specifies one or more directories to add to the include path; separate with semi-colons if more than one. (-I[path])", - ArgumentRelationList = new ArrayList(), - SwitchValue = "-I", - Name = ADDITIONAL_INCLUDEDIRECTORIES, - StringList = value - }; - base.ActiveToolSwitches.Add(ADDITIONAL_INCLUDEDIRECTORIES, switch2); - base.AddActiveSwitchToolValue(switch2); - } - } - - /// - /// Getter/Setter for the Ansi property - /// - public bool Ansi - { - get - { - return (base.IsPropertySet(ANSI) && base.ActiveToolSwitches[ANSI].BooleanValue); - } - set - { - base.ActiveToolSwitches.Remove(ANSI); - ToolSwitch switch2 = new ToolSwitch(ToolSwitchType.Boolean) - { - DisplayName = "Compile ANSI code", - Description = "Compile ansi code", - ArgumentRelationList = new ArrayList(), - SwitchValue = "-ansi", - Name = ANSI, - BooleanValue = value - }; - base.ActiveToolSwitches.Add(ANSI, switch2); - base.AddActiveSwitchToolValue(switch2); - } - } - - /// - /// Getter/Setter for the MinimalRebuild property - /// - public virtual bool MinimalRebuild - { - get - { - return (base.IsPropertySet("MinimalRebuild") && base.ActiveToolSwitches["MinimalRebuild"].BooleanValue); - } - set - { - base.ActiveToolSwitches.Remove("MinimalRebuild"); - ToolSwitch switch2 = new ToolSwitch(ToolSwitchType.Boolean) - { - DisplayName = "Enable Minimal Rebuild", - Description = "Enables minimal rebuild, which determines whether C++ source files that include changed C++ class definitions (stored in header (.h) files) need to be recompiled.", - ArgumentRelationList = new ArrayList(), - SwitchValue = "/Gm", - ReverseSwitchValue = "/Gm-", - Name = "MinimalRebuild", - BooleanValue = value - }; - base.ActiveToolSwitches.Add("MinimalRebuild", switch2); - base.AddActiveSwitchToolValue(switch2); - switch2.Overrides.AddLast(new KeyValuePair("Gm", "Gm-")); - switch2.Overrides.AddLast(new KeyValuePair("Gm-", "Gm")); - } - } - - /// - /// Getter/Setter for the ObjectFileName property - /// - public string ObjectFileName - { - get - { - if (base.IsPropertySet(OBJECT_FILE_NAME)) - { - return base.ActiveToolSwitches[OBJECT_FILE_NAME].Value; - } - return null; - } - set - { - base.ActiveToolSwitches.Remove(OBJECT_FILE_NAME); - ToolSwitch switch2 = new ToolSwitch(ToolSwitchType.File) - { - DisplayName = "Object File Name", - Description = "Specifies a name to override the default object file name; can be file or directory name. (-o[name])", - ArgumentRelationList = new ArrayList(), - SwitchValue = "-o", - Name = OBJECT_FILE_NAME, - Value = value - }; - base.ActiveToolSwitches.Add(OBJECT_FILE_NAME, switch2); - base.AddActiveSwitchToolValue(switch2); - } - } - - /// - /// Getter/Setter for the ExpandAttributedSource property - /// - public bool ExpandAttributedSource - { - get - { - return (base.IsPropertySet("ExpandAttributedSource") && base.ActiveToolSwitches["ExpandAttributedSource"].BooleanValue); - } - set - { - base.ActiveToolSwitches.Remove("ExpandAttributedSource"); - ToolSwitch switch2 = new ToolSwitch(ToolSwitchType.Boolean) - { - DisplayName = "Expand Attributed Source", - Description = "Create listing file with expanded attributes injected into source file. (/Fx)", - ArgumentRelationList = new ArrayList(), - SwitchValue = "/Fx", - Name = "ExpandAttributedSource", - BooleanValue = value - }; - base.ActiveToolSwitches.Add("ExpandAttributedSource", switch2); - base.AddActiveSwitchToolValue(switch2); - } - } - - /// - /// Getter/Setter for the FavorSizeOrSpeed property - /// - public string FavorSizeOrSpeed - { - get - { - if (base.IsPropertySet("FavorSizeOrSpeed")) - { - return base.ActiveToolSwitches["FavorSizeOrSpeed"].Value; - } - return null; - } - set - { - base.ActiveToolSwitches.Remove("FavorSizeOrSpeed"); - ToolSwitch switch2 = new ToolSwitch(ToolSwitchType.String) - { - DisplayName = "Favor Size Or Speed", - Description = "Whether to favor code size or code speed; 'Global Optimization' must be turned on. (/Ot, /Os)", - ArgumentRelationList = new ArrayList() - }; - string[][] switchMap = new string[][] { new string[] { "Size", "/Os" }, new string[] { "Speed", "/Ot" }, new string[] { "Neither", "" } }; - switch2.SwitchValue = base.ReadSwitchMap("FavorSizeOrSpeed", switchMap, value); - switch2.Name = "FavorSizeOrSpeed"; - switch2.Value = value; - switch2.MultipleValues = true; - base.ActiveToolSwitches.Add("FavorSizeOrSpeed", switch2); - base.AddActiveSwitchToolValue(switch2); - } - } - - /// - /// Getter/Setter for the PreprocessKeepComments property - /// - public bool PreprocessKeepComments - { - get - { - return (base.IsPropertySet(PREPROCESS_KEEP_COMMENTS) && base.ActiveToolSwitches[PREPROCESS_KEEP_COMMENTS].BooleanValue); - } - set - { - base.ActiveToolSwitches.Remove(PREPROCESS_KEEP_COMMENTS); - ToolSwitch switch2 = new ToolSwitch(ToolSwitchType.Boolean) - { - DisplayName = "Keep Comments", - Description = "Suppresses comment strip from source code; requires that one of the 'Preprocessing' options be set. (-C)", - ArgumentRelationList = new ArrayList(), - SwitchValue = "-C", - Name = PREPROCESS_KEEP_COMMENTS, - BooleanValue = value - }; - base.ActiveToolSwitches.Add(PREPROCESS_KEEP_COMMENTS, switch2); - base.AddActiveSwitchToolValue(switch2); - } - } - - /// - /// Getter/Setter for hte PreprocessorDefinitions property - /// - public string[] PreprocessorDefinitions - { - get - { - if (base.IsPropertySet(PREPROCESSOR_DEFINITIONS)) - { - return base.ActiveToolSwitches[PREPROCESSOR_DEFINITIONS].StringList; - } - return null; - } - set - { - base.ActiveToolSwitches.Remove(PREPROCESSOR_DEFINITIONS); - ToolSwitch switch2 = new ToolSwitch(ToolSwitchType.StringArray) - { - DisplayName = "Preprocessor Definitions", - Description = "Defines a preprocessing symbols for your source file.", - ArgumentRelationList = new ArrayList(), - SwitchValue = "-D", - Name = PREPROCESSOR_DEFINITIONS, - StringList = value - }; - base.ActiveToolSwitches.Add(PREPROCESSOR_DEFINITIONS, switch2); - base.AddActiveSwitchToolValue(switch2); - } - } - - /// - /// Getter/Setter for the PreprocessOutput property - /// - [Output] - public ITaskItem[] PreprocessOutput - { - get - { - return this.preprocessOutput; - } - set - { - this.preprocessOutput = value; - } - } - - /// - /// Getter/Setter for the PreprocessOutputPath - /// - public string PreprocessOutputPath - { - get - { - if (base.IsPropertySet(PREPROCESS_TO_STDOUT)) - { - return base.ActiveToolSwitches[PREPROCESS_TO_STDOUT].Value; - } - return null; - } - set - { - base.ActiveToolSwitches.Remove(PREPROCESS_TO_STDOUT); - ToolSwitch switch2 = new ToolSwitch(ToolSwitchType.String) - { - DisplayName = "Preprocess Output Path", - Description = "Specify the output path for the preprocesser. The default location is the same as the source file(s).", - ArgumentRelationList = new ArrayList(), - Name = PREPROCESS_TO_STDOUT, - Value = value, - SwitchValue = "E" - }; - base.ActiveToolSwitches.Add(PREPROCESS_TO_STDOUT, switch2); - base.AddActiveSwitchToolValue(switch2); - } - } - - /// - /// Getter/Setter for the PreprocessSuppressLineNumbers property - /// - public bool PreprocessSuppressLineNumbers - { - get - { - return (base.IsPropertySet("PreprocessSuppressLineNumbers") && base.ActiveToolSwitches["PreprocessSuppressLineNumbers"].BooleanValue); - } - set - { - base.ActiveToolSwitches.Remove("PreprocessSuppressLineNumbers"); - ToolSwitch switch2 = new ToolSwitch(ToolSwitchType.Boolean) - { - DisplayName = "Preprocess Suppress Line Numbers", - Description = "Preprocess without #line directives.", - ArgumentRelationList = new ArrayList(), - SwitchValue = "/EP", - Name = "PreprocessSuppressLineNumbers", - BooleanValue = value - }; - base.ActiveToolSwitches.Add("PreprocessSuppressLineNumbers", switch2); - base.AddActiveSwitchToolValue(switch2); - } - } - - /// - /// Getter/Setter for the PreprocessToFile property - /// - public bool PreprocessToFile - { - get - { - return (base.IsPropertySet(PREPROCESS_TO_FILE) && base.ActiveToolSwitches[PREPROCESS_TO_FILE].BooleanValue); - } - set - { - base.ActiveToolSwitches.Remove(PREPROCESS_TO_FILE); - ToolSwitch switch2 = new ToolSwitch(ToolSwitchType.Boolean) - { - DisplayName = "Preprocess to a File", - Description = "Preprocesses C and C++ source files and writes the preprocessed output to a file. This option suppresses compilation, thus it does not produce an .obj file.", - ArgumentRelationList = new ArrayList(), - SwitchValue = "-P", - Name = PREPROCESS_TO_FILE, - BooleanValue = value - }; - base.ActiveToolSwitches.Add(PREPROCESS_TO_FILE, switch2); - base.AddActiveSwitchToolValue(switch2); - } - } - - /// - /// Getter/Setter for the UndefinePreprocessorDefinition property - /// - public string[] UndefinePreprocessorDefinition - { - get - { - if (base.IsPropertySet(UNDEFINE_PREPROCESSOR_DEFINITION)) - { - return base.ActiveToolSwitches[UNDEFINE_PREPROCESSOR_DEFINITION].StringList; - } - return null; - } - set - { - base.ActiveToolSwitches.Remove(UNDEFINE_PREPROCESSOR_DEFINITION); - ToolSwitch switch2 = new ToolSwitch(ToolSwitchType.StringArray) - { - DisplayName = "Undefine Preprocessor Definitions", - Description = "Specifies one or more preprocessor undefines. (-U[macro])", - ArgumentRelationList = new ArrayList(), - SwitchValue = "-U", - Name = UNDEFINE_PREPROCESSOR_DEFINITION, - StringList = value - }; - base.ActiveToolSwitches.Add(UNDEFINE_PREPROCESSOR_DEFINITION, switch2); - base.AddActiveSwitchToolValue(switch2); - } - } - - public bool RuntimeTypeInfo { get; set; } - public bool ShortEnums { get; set; } - #endregion //properties - } -} diff --git a/src_vs2013/VSNDK.Tasks/QccLib.cs b/src_vs2013/VSNDK.Tasks/QccLib.cs deleted file mode 100644 index e446e89b..00000000 --- a/src_vs2013/VSNDK.Tasks/QccLib.cs +++ /dev/null @@ -1,244 +0,0 @@ -//* Copyright 2010-2011 Research In Motion Limited. -//* -//* Licensed under the Apache License, Version 2.0 (the "License"); -//* you may not use this file except in compliance with the License. -//* You may obtain a copy of the License at -//* -//* http://www.apache.org/licenses/LICENSE-2.0 -//* -//* Unless required by applicable law or agreed to in writing, software -//* distributed under the License is distributed on an "AS IS" BASIS, -//* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//* See the License for the specific language governing permissions and -//* limitations under the License. - -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using Microsoft.Build.CPPTasks; -using System.Resources; -using System.Reflection; -using System.Collections; - -namespace VSNDK.Tasks -{ - public class QccLib : VSNDKTasks - { - #region Member Variables and Constants - private const string ADDITIONAL_DEPENDENCIES = "AdditionalDependencies"; - private const string ADDITIONAL_LIB_DIR = "AdditionalLibraryDirectories"; - private const string OUTPUT_FILE = "OutputFile"; - private const string LINK_STATIC = "LinkStatic"; - private const string TREAT_LIB_WARNING_AS_ERROR = "TreatLibWarningAsErrors"; - #endregion - - /// - /// QccLib Constructor - /// - public QccLib() - : base(new ResourceManager("VSNDK.Tasks.Properties.Resources", Assembly.GetExecutingAssembly())) - { - this.switchOrderList.Add(ADDITIONAL_DEPENDENCIES); - this.switchOrderList.Add(ADDITIONAL_LIB_DIR); - this.switchOrderList.Add(TREAT_LIB_WARNING_AS_ERROR); - this.switchOrderList.Add(OUTPUT_FILE); - this.switchOrderList.Add(SOURCES); - } - - #region overrides - - /// - /// Getter/Setter for the AlwaysAppend property - /// - protected override string AlwaysAppend - { - get - { - return string.Empty; - } - } - - /// - /// Getter/Setter for the CommandTLogName property - /// - protected override string CommandTLogName - { - get { return "qcc_lib.command.1.tlog"; } - } - - /// - /// Getter/Setter for the ReadTLogNames property - /// - protected override string[] ReadTLogNames - { - get { return new string[] { "qcc_lib.read.1.tlog", "qcc_lib.*.read.1.tlog" }; } - } - - /// - /// Getter/Setter for the WriteTLogNames - /// - protected override string[] WriteTLogNames - { - get - { - return new string[] { "qcc_lib.write.1.tlog", "qcc_lib.*.write.1.tlog" }; - } - } - - /// - /// Method return the EnhancedSecuritySwitch - /// - /// - protected override string GetEnhancedSecuritySwitchValue() - { - return string.Empty; - } - #endregion overrides - - #region properties - /// - /// Getter/Setter for the LinkStatic property - /// - public bool LinkStatic - { - get - { - return (base.IsPropertySet(LINK_STATIC) && base.ActiveToolSwitches[LINK_STATIC].BooleanValue); - } - set - { - base.ActiveToolSwitches.Remove(LINK_STATIC); - ToolSwitch switch2 = new ToolSwitch(ToolSwitchType.Boolean) - { - DisplayName = "Link Static", - Description = "Static link Lib", - ArgumentRelationList = new ArrayList(), - SwitchValue = "-static", - Name = LINK_STATIC, - BooleanValue = value - }; - base.ActiveToolSwitches.Add(LINK_STATIC, switch2); - base.AddActiveSwitchToolValue(switch2); - } - } - - /// - /// Getter/Setter for the AdditionalDependencies property - /// - public virtual string[] AdditionalDependencies - { - get - { - if (base.IsPropertySet(ADDITIONAL_DEPENDENCIES)) - { - return base.ActiveToolSwitches[ADDITIONAL_DEPENDENCIES].StringList; - } - return null; - } - set - { - base.ActiveToolSwitches.Remove(ADDITIONAL_DEPENDENCIES); - ToolSwitch switch2 = new ToolSwitch(ToolSwitchType.StringArray) - { - DisplayName = "Additional Dependencies", - Description = "Specifies additional items to add to the link command line [i.e. bps] ", - ArgumentRelationList = new ArrayList(), - SwitchValue = "-l", - Name = ADDITIONAL_DEPENDENCIES, - StringList = value - }; - base.ActiveToolSwitches.Add(ADDITIONAL_DEPENDENCIES, switch2); - base.AddActiveSwitchToolValue(switch2); - } - } - - /// - /// Getter/Setter for the AdditionalLibraryDirectories property - /// - public virtual string[] AdditionalLibraryDirectories - { - get - { - if (base.IsPropertySet(ADDITIONAL_LIB_DIR)) - { - return base.ActiveToolSwitches[ADDITIONAL_LIB_DIR].StringList; - } - return null; - } - set - { - base.ActiveToolSwitches.Remove(ADDITIONAL_LIB_DIR); - ToolSwitch switch2 = new ToolSwitch(ToolSwitchType.StringArray) - { - DisplayName = "Additional Library Directories", - Description = "Allows the user to override the environmental library path (-Lfolder)", - ArgumentRelationList = new ArrayList(), - SwitchValue = "-L", - Name = ADDITIONAL_LIB_DIR, - StringList = value - }; - base.ActiveToolSwitches.Add(ADDITIONAL_LIB_DIR, switch2); - base.AddActiveSwitchToolValue(switch2); - } - } - - /// - /// Getter/Setter for the TreatLibWarningAsErrors property - /// - public virtual bool TreatLibWarningAsErrors - { - get - { - return (base.IsPropertySet(TREAT_LIB_WARNING_AS_ERROR) && base.ActiveToolSwitches[TREAT_LIB_WARNING_AS_ERROR].BooleanValue); - } - set - { - base.ActiveToolSwitches.Remove(TREAT_LIB_WARNING_AS_ERROR); - ToolSwitch switch2 = new ToolSwitch(ToolSwitchType.Boolean) - { - DisplayName = "Treat Lib Warning As Errors", - Description = "-Werror causes no output file to be generated if lib generates a warning.", - ArgumentRelationList = new ArrayList(), - SwitchValue = "-Werror", - Name = TREAT_LIB_WARNING_AS_ERROR, - BooleanValue = value - }; - base.ActiveToolSwitches.Add(TREAT_LIB_WARNING_AS_ERROR, switch2); - base.AddActiveSwitchToolValue(switch2); - } - } - - /// - /// GetterSetter for the OutputFile property - /// - public virtual string OutputFile - { - get - { - if (base.IsPropertySet(OUTPUT_FILE)) - { - return base.ActiveToolSwitches[OUTPUT_FILE].Value; - } - return null; - } - set - { - base.ActiveToolSwitches.Remove(OUTPUT_FILE); - ToolSwitch switch2 = new ToolSwitch(ToolSwitchType.File) - { - //Separator = ":", - DisplayName = "Output File", - Description = "The -A option overrides the default name and location of the program that the linker creates.", - ArgumentRelationList = new ArrayList(), - SwitchValue = "-A ", - Name = OUTPUT_FILE, - Value = value - }; - base.ActiveToolSwitches.Add(OUTPUT_FILE, switch2); - base.AddActiveSwitchToolValue(switch2); - } - } - #endregion properties - } -} diff --git a/src_vs2013/VSNDK.Tasks/QccLink.cs b/src_vs2013/VSNDK.Tasks/QccLink.cs deleted file mode 100644 index cc8eda2f..00000000 --- a/src_vs2013/VSNDK.Tasks/QccLink.cs +++ /dev/null @@ -1,401 +0,0 @@ -//* Copyright 2010-2011 Research In Motion Limited. -//* -//* Licensed under the Apache License, Version 2.0 (the "License"); -//* you may not use this file except in compliance with the License. -//* You may obtain a copy of the License at -//* -//* http://www.apache.org/licenses/LICENSE-2.0 -//* -//* Unless required by applicable law or agreed to in writing, software -//* distributed under the License is distributed on an "AS IS" BASIS, -//* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//* See the License for the specific language governing permissions and -//* limitations under the License. - -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using Microsoft.Build.CPPTasks; -using System.Resources; -using System.Reflection; -using Microsoft.Build.Framework; -using System.Collections; -using Microsoft.Build.Utilities; -using System.IO; - -namespace VSNDK.Tasks -{ - public class QccLink : VSNDKTasks - { - #region Member Variables and Constants - private const string ADDITIONAL_DEPENDENCIES = "AdditionalDependencies"; - private const string LINK_ERROR_REPORTING = "LinkErrorReporting"; - private const string ADDITIONAL_LIB_DIR = "AdditionalLibraryDirectories"; - private const string GENERATE_MAP_FILE = "GenerateMapFile"; - private const string IGNORE_ALL_DEFAULT_LIB = "IgnoreAllDefaultLibraries"; - private const string IGNOR_ALL_DEFAULT_CPP_LIB = "IgnoreAllDefaultCppLibraries"; - private const string LINK_INCREMENTAL = "LinkIncremental"; - private const string LINK_STATUS = "LinkStatus"; - private const string LINK_LIB_DEP = "LinkLibraryDependencies"; - private const string OUTPUT_FILE = "OutputFile"; - private const string TREAT_LINK_WARNING_AS_ERR = "TreatLinkerWarningAsErrors"; - #endregion - - /// - /// QccLink Constructor - /// - public QccLink() - : base(new ResourceManager("VSNDK.Tasks.Properties.Resources", Assembly.GetExecutingAssembly())) - { - this.switchOrderList.Add(ADDITIONAL_DEPENDENCIES); - this.switchOrderList.Add(LINK_ERROR_REPORTING); - this.switchOrderList.Add(ADDITIONAL_LIB_DIR); - this.switchOrderList.Add(GENERATE_MAP_FILE); - this.switchOrderList.Add(IGNORE_ALL_DEFAULT_LIB); - this.switchOrderList.Add(IGNOR_ALL_DEFAULT_CPP_LIB); - this.switchOrderList.Add(LINK_INCREMENTAL); - this.switchOrderList.Add(LINK_STATUS); - this.switchOrderList.Add(LINK_LIB_DEP); - this.switchOrderList.Add(OUTPUT_FILE); - this.switchOrderList.Add(TREAT_LINK_WARNING_AS_ERR); - this.switchOrderList.Add(SOURCES); - } - - #region overrides - - /// - /// Getter/Setter for AlwaysAppend property - /// - protected override string AlwaysAppend - { - get - { - return LinkSharedLibrary? "-shared" : string.Empty; - } - } - - /// - /// Getter/Setter for CommandTLogName property - /// - protected override string CommandTLogName - { - get { return "qcc_linker.command.1.tlog"; } - } - - /// - /// Getter/Setter for ReadTLog - /// - protected override string[] ReadTLogNames - { - get { return new string[] { "qcc_linker.read.1.tlog", "qcc_linker.*.read.1.tlog" }; } - } - - /// - /// Getter/Setter WriteTLogNames property - /// - protected override string[] WriteTLogNames - { - get - { - return new string[] { "qcc_linker.write.1.tlog", "qcc_linker.*.write.1.tlog" }; - } - } - - /// - /// Function to return the Enhanced Security value. - /// - /// - protected override string GetEnhancedSecuritySwitchValue() - { - return "-Wl,-z,relro -Wl,-z,now"; - } - #endregion - - #region properties - - /// - /// Getter/Setter for the AdditionalDependencies property - /// - public virtual string[] AdditionalDependencies - { - get - { - if (base.IsPropertySet(ADDITIONAL_DEPENDENCIES)) - { - return base.ActiveToolSwitches[ADDITIONAL_DEPENDENCIES].StringList; - } - return null; - } - set - { - base.ActiveToolSwitches.Remove(ADDITIONAL_DEPENDENCIES); - ToolSwitch switch2 = new ToolSwitch(ToolSwitchType.StringArray) - { - DisplayName = "Additional Dependencies", - Description = "Specifies additional items to add to the link command line [i.e. bps] ", - ArgumentRelationList = new ArrayList(), - SwitchValue = "-l", - Name = ADDITIONAL_DEPENDENCIES, - StringList = value - }; - base.ActiveToolSwitches.Add(ADDITIONAL_DEPENDENCIES, switch2); - base.AddActiveSwitchToolValue(switch2); - } - } - - /// - /// Getter/Setter for the AdditionalLibraryDirectories property - /// - public virtual string[] AdditionalLibraryDirectories - { - get - { - if (base.IsPropertySet(ADDITIONAL_LIB_DIR)) - { - return base.ActiveToolSwitches[ADDITIONAL_LIB_DIR].StringList; - } - return null; - } - set - { - base.ActiveToolSwitches.Remove(ADDITIONAL_LIB_DIR); - ToolSwitch switch2 = new ToolSwitch(ToolSwitchType.StringArray) - { - DisplayName = "Additional Library Directories", - Description = "Allows the user to override the environmental library path (-Lfolder)", - ArgumentRelationList = new ArrayList(), - SwitchValue = "-L", - Name = ADDITIONAL_LIB_DIR, - StringList = value - }; - base.ActiveToolSwitches.Add(ADDITIONAL_LIB_DIR, switch2); - base.AddActiveSwitchToolValue(switch2); - } - } - - /// - /// Getter/Setter for the GenerateMapFile property - /// - public virtual bool GenerateMapFile - { - get - { - return (base.IsPropertySet(GENERATE_MAP_FILE) && base.ActiveToolSwitches[GENERATE_MAP_FILE].BooleanValue); - } - set - { - base.ActiveToolSwitches.Remove(GENERATE_MAP_FILE); - ToolSwitch switch2 = new ToolSwitch(ToolSwitchType.Boolean) - { - DisplayName = "Generate Map File", - Description = "The -M option tells the linker to create a mapfile.", - ArgumentRelationList = new ArrayList() - }; - switch2.ArgumentRelationList.Add(new ArgumentRelation("MapFileName", "true", false, "")); - switch2.SwitchValue = "-M"; - switch2.Name = GENERATE_MAP_FILE; - switch2.BooleanValue = value; - base.ActiveToolSwitches.Add(GENERATE_MAP_FILE, switch2); - base.AddActiveSwitchToolValue(switch2); - } - } - - /// - /// Getter/Setter for the IgnoreAllDefaultLibraries - /// - public virtual bool IgnoreAllDefaultLibraries - { - get - { - return (base.IsPropertySet(IGNORE_ALL_DEFAULT_LIB) && base.ActiveToolSwitches[IGNORE_ALL_DEFAULT_LIB].BooleanValue); - } - set - { - base.ActiveToolSwitches.Remove(IGNORE_ALL_DEFAULT_LIB); - ToolSwitch switch2 = new ToolSwitch(ToolSwitchType.Boolean) - { - DisplayName = "Ignore All Default Libraries", - Description = "The -nostdlib option tells the linker to remove one or more default libraries from the list of libraries it searches when resolving external references. ", - ArgumentRelationList = new ArrayList(), - SwitchValue = "-nostdlib", - Name = IGNORE_ALL_DEFAULT_LIB, - BooleanValue = value - }; - base.ActiveToolSwitches.Add(IGNORE_ALL_DEFAULT_LIB, switch2); - base.AddActiveSwitchToolValue(switch2); - } - } - - /// - /// Getter/Setter for the IgnoreAllDefaultCppLibraries property - /// - public virtual bool IgnoreAllDefaultCppLibraries - { - get - { - return (base.IsPropertySet(IGNOR_ALL_DEFAULT_CPP_LIB) && base.ActiveToolSwitches[IGNOR_ALL_DEFAULT_CPP_LIB].BooleanValue); - } - set - { - base.ActiveToolSwitches.Remove(IGNOR_ALL_DEFAULT_CPP_LIB); - ToolSwitch switch2 = new ToolSwitch(ToolSwitchType.Boolean) - { - DisplayName = "Ignore All Default C++ Libraries", - Description = "The -nostdlib++ option tells the linker to remove one or more default libraries from the list of libraries it searches when resolving external references. ", - ArgumentRelationList = new ArrayList(), - SwitchValue = "-nostdlib++", - Name = IGNOR_ALL_DEFAULT_CPP_LIB, - BooleanValue = value - }; - base.ActiveToolSwitches.Add(IGNOR_ALL_DEFAULT_CPP_LIB, switch2); - base.AddActiveSwitchToolValue(switch2); - } - } - - /// - /// Getter/Setter for the LinkIncremental Property - /// - public virtual bool LinkIncremental - { - get - { - return (base.IsPropertySet(LINK_INCREMENTAL) && base.ActiveToolSwitches[LINK_INCREMENTAL].BooleanValue); - } - set - { - base.ActiveToolSwitches.Remove(LINK_INCREMENTAL); - ToolSwitch switch2 = new ToolSwitch(ToolSwitchType.Boolean) - { - DisplayName = "Enable Incremental Linking", - Description = "Enables incremental linking. (/INCREMENTAL, /INCREMENTAL:NO)", - ArgumentRelationList = new ArrayList(), - SwitchValue = "/INCREMENTAL", - ReverseSwitchValue = "/INCREMENTAL:NO", - Name = LINK_INCREMENTAL, - BooleanValue = value - }; - base.ActiveToolSwitches.Add(LINK_INCREMENTAL, switch2); - base.AddActiveSwitchToolValue(switch2); - switch2.Overrides.AddLast(new KeyValuePair("INCREMENTAL", "INCREMENTAL:NO")); - switch2.Overrides.AddLast(new KeyValuePair("INCREMENTAL:NO", "INCREMENTAL")); - } - } - - /// - /// Getter/Setter for the LinkStatus property - /// - public virtual bool LinkStatus - { - get - { - return (base.IsPropertySet(LINK_STATUS) && base.ActiveToolSwitches[LINK_STATUS].BooleanValue); - } - set - { - base.ActiveToolSwitches.Remove(LINK_STATUS); - ToolSwitch switch2 = new ToolSwitch(ToolSwitchType.Boolean) - { - DisplayName = "Link Status", - Description = "Specifies whether the linker should display a progress indicator showing what percentage of the link is complete. The default is to not display this status information. (/LTCG:STATUS|LTCG:NOSTATUS)", - ArgumentRelationList = new ArrayList(), - SwitchValue = "/LTCG:STATUS", - ReverseSwitchValue = "/LTCG:NOSTATUS", - Name = LINK_STATUS, - BooleanValue = value - }; - base.ActiveToolSwitches.Add(LINK_STATUS, switch2); - base.AddActiveSwitchToolValue(switch2); - switch2.Overrides.AddLast(new KeyValuePair("LTCG:STATUS", "LTCG:NOSTATUS")); - switch2.Overrides.AddLast(new KeyValuePair("LTCG:NOSTATUS", "LTCG:STATUS")); - } - } - - /// - /// Getter/Setter for the LinkLibraryDependencies - /// - public virtual bool LinkLibraryDependencies - { - get - { - return (base.IsPropertySet(LINK_LIB_DEP) && base.ActiveToolSwitches[LINK_LIB_DEP].BooleanValue); - } - set - { - base.ActiveToolSwitches.Remove(LINK_LIB_DEP); - ToolSwitch switch2 = new ToolSwitch(ToolSwitchType.Boolean) - { - DisplayName = "Link Library Dependencies", - Description = "Specifies whether or not library outputs from project dependencies are automatically linked in.", - ArgumentRelationList = new ArrayList(), - Name = LINK_LIB_DEP, - BooleanValue = value - }; - base.ActiveToolSwitches.Add(LINK_LIB_DEP, switch2); - base.AddActiveSwitchToolValue(switch2); - } - } - - /// - /// Getter/Setter for the OutputFile property - /// - public virtual string OutputFile - { - get - { - if (base.IsPropertySet(OUTPUT_FILE)) - { - return base.ActiveToolSwitches[OUTPUT_FILE].Value; - } - return null; - } - set - { - base.ActiveToolSwitches.Remove(OUTPUT_FILE); - - ToolSwitch switch2 = new ToolSwitch(ToolSwitchType.File) - { - DisplayName = "Output File", - Description = "The -o option overrides the default name and location of the program that the linker creates.", - ArgumentRelationList = new ArrayList(), - SwitchValue = "-o ", - Name = OUTPUT_FILE, - Value = value - }; - base.ActiveToolSwitches.Add(OUTPUT_FILE, switch2); - base.AddActiveSwitchToolValue(switch2); - } - } - - /// - /// Getter/Setter for the TreatLinkerWarningAsErrors property. - /// - public virtual bool TreatLinkerWarningAsErrors - { - get - { - return (base.IsPropertySet(TREAT_LINK_WARNING_AS_ERR) && base.ActiveToolSwitches[TREAT_LINK_WARNING_AS_ERR].BooleanValue); - } - set - { - base.ActiveToolSwitches.Remove(TREAT_LINK_WARNING_AS_ERR); - ToolSwitch switch2 = new ToolSwitch(ToolSwitchType.Boolean) - { - DisplayName = "Treat Linker Warning As Errors", - Description = "/WX causes no output file to be generated if the linker generates a warning.", - ArgumentRelationList = new ArrayList(), - SwitchValue = "/WX", - ReverseSwitchValue = "/WX:NO", - Name = TREAT_LINK_WARNING_AS_ERR, - BooleanValue = value - }; - base.ActiveToolSwitches.Add(TREAT_LINK_WARNING_AS_ERR, switch2); - base.AddActiveSwitchToolValue(switch2); - switch2.Overrides.AddLast(new KeyValuePair("WX", "WX:NO")); - switch2.Overrides.AddLast(new KeyValuePair("WX:NO", "WX")); - } - } - #endregion - - } -} diff --git a/src_vs2013/VSNDK.Tasks/RemoveFlagFile.cs b/src_vs2013/VSNDK.Tasks/RemoveFlagFile.cs deleted file mode 100644 index 89548707..00000000 --- a/src_vs2013/VSNDK.Tasks/RemoveFlagFile.cs +++ /dev/null @@ -1,68 +0,0 @@ -//* Copyright 2010-2011 Research In Motion Limited. -//* -//* Licensed under the Apache License, Version 2.0 (the "License"); -//* you may not use this file except in compliance with the License. -//* You may obtain a copy of the License at -//* -//* http://www.apache.org/licenses/LICENSE-2.0 -//* -//* Unless required by applicable law or agreed to in writing, software -//* distributed under the License is distributed on an "AS IS" BASIS, -//* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//* See the License for the specific language governing permissions and -//* limitations under the License. - -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.IO; -using System.Collections; -using Microsoft.Build.Framework; -using Microsoft.Build.Utilities; - -namespace VSNDK.Tasks -{ - - /// - /// MSBuild Task for reading in the flag file from the start debugging button. - /// - public class RemoveFlagFile : Task - { - #region Member Variables and Constants. - private string _flagFile; - #endregion - - /// - /// Execute the MSBuild Task - /// - /// - public override bool Execute() - { - bool removed; - try - { - File.Delete(_flagFile); - removed = true; - } - catch (DirectoryNotFoundException dirNotFound) - { - Console.WriteLine(dirNotFound.Message); - removed = false; - } - return removed; - } - - /// - /// Setter for FlagFile property - /// - [Required] - public string FlagFile - { - set - { - _flagFile = value; - } - } - } -} diff --git a/src_vs2013/VSNDK.Tasks/SSHDelete.cs b/src_vs2013/VSNDK.Tasks/SSHDelete.cs deleted file mode 100644 index 6eeff091..00000000 --- a/src_vs2013/VSNDK.Tasks/SSHDelete.cs +++ /dev/null @@ -1,325 +0,0 @@ -//* Copyright 2010-2011 Research In Motion Limited. -//* -//* Licensed under the Apache License, Version 2.0 (the "License"); -//* you may not use this file except in compliance with the License. -//* You may obtain a copy of the License at -//* -//* http://www.apache.org/licenses/LICENSE-2.0 -//* -//* Unless required by applicable law or agreed to in writing, software -//* distributed under the License is distributed on an "AS IS" BASIS, -//* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//* See the License for the specific language governing permissions and -//* limitations under the License. - -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using Microsoft.Build.CPPTasks; -using System.Resources; -using System.Reflection; -using System.Collections; -using Microsoft.Build.Framework; -using Microsoft.Build.Utilities; - -namespace VSNDK.Tasks -{ - public class SSHDelete : TrackedVCToolTask - { - #region Member Variables and Constants - protected ArrayList switchOrderList; - - private const string DEVICE = "Device"; - private const string PRIVATE_KEY_PATH = "PrivateKeyPath"; - private const string DELETE_FILES = "DeleteFiles"; - private const string PACKAGE_ID = "PackageId"; - private const string PACKAGE_NAME = "PackageName"; - #endregion - - /// - /// SSHDelete Constructor - /// - public SSHDelete() - : base(new ResourceManager("VSNDK.Tasks.Properties.Resources", Assembly.GetExecutingAssembly())) - { - this.switchOrderList = new ArrayList(); - this.switchOrderList.Add(PRIVATE_KEY_PATH); - } - - /// - /// Return the Response File Switch string - /// - /// - /// - protected override string GetResponseFileSwitch(string responseFilePath) - { - return string.Empty; - } - - /// - /// Return the command line string - /// - /// - protected override string GenerateCommandLineCommands() - { - return GenerateResponseFileCommands(); - } - - /// - /// Getter/Setter for the CommandTLogName property - /// - protected override string CommandTLogName - { - get { return "SSHDelete.command.1.tlog"; } - } - - /// - /// Getter/Setter for the ReadTLogNames string - /// - protected override string[] ReadTLogNames - { - get { return new string[] { "SSHDelete.read.1.tlog", "SSHDelete.*.read.1.tlog" }; } - } - - /// - /// Getter/Setter for the WriteTLogNames string - /// - protected override string[] WriteTLogNames - { - get - { - return new string[] { "SSHDelete.write.1.tlog", "SSHDelete.*.write.1.tlog" }; - } - } - - /// - /// Getter/Setter for the TrackedInputFiles string - /// - protected override Microsoft.Build.Framework.ITaskItem[] TrackedInputFiles - { - get - { - if (base.IsPropertySet(DELETE_FILES)) - { - return base.ActiveToolSwitches[DELETE_FILES].TaskItemArray; - } - return null; - } - } - - /// - /// Getter/Setter for the ToolName property - /// - protected override string ToolName - { - get - { - return ToolExe; - } - } - - /// - /// Getter/Setter for the TrackerIntermediateDirectory property - /// - protected override string TrackerIntermediateDirectory - { - get - { - return string.Empty; - } - } - - /// - /// Function to generate the response file commands string - /// - /// - protected override string GenerateResponseFileCommands() - { - string cmd = base.GenerateResponseFileCommands(); - - cmd += " -o \"StrictHostKeyChecking no\""; - - if (base.IsPropertySet(DEVICE)) - { - cmd += " devuser@" + base.ActiveToolSwitches[DEVICE].Value; - } - - if (base.IsPropertySet(DELETE_FILES)) - { - string path = "../../../../apps/" + PackageName + "." + PackageId + "/"; - cmd += " '"; - foreach (ITaskItem taskItem in base.ActiveToolSwitches[DELETE_FILES].TaskItemArray) - { - cmd += "rm " + path + taskItem.GetMetadata("Identity") + "; "; - } - cmd += "'"; - } - else - { - cmd += "'pwd;'"; - } - - return cmd; - } - - /// - /// Getter/Setter for the SwitchOrderList property. - /// - protected override ArrayList SwitchOrderList - { - get - { - return this.switchOrderList; - } - } - - /// - /// Getter/Setter for the Device property - /// - public virtual string Device - { - get - { - if (base.IsPropertySet(DEVICE)) - { - return base.ActiveToolSwitches[DEVICE].Value; - } - return null; - } - set - { - base.ActiveToolSwitches.Remove(DEVICE); - ToolSwitch toolSwitch = new ToolSwitch(ToolSwitchType.String) - { - Name = DEVICE, - DisplayName = "Device IP", - Description = "Specifies the target device's IP address.", - ArgumentRelationList = new ArrayList(), - SwitchValue = "devuser@", - Value = value - }; - base.ActiveToolSwitches.Add(DEVICE, toolSwitch); - base.AddActiveSwitchToolValue(toolSwitch); - } - } - - /// - /// Getter/Setter for the PrivateKeyPath property - /// - public virtual string PrivateKeyPath - { - get - { - if (base.IsPropertySet(PRIVATE_KEY_PATH)) - { - return base.ActiveToolSwitches[PRIVATE_KEY_PATH].Value; - } - return null; - } - set - { - base.ActiveToolSwitches.Remove(PRIVATE_KEY_PATH); - ToolSwitch toolSwitch = new ToolSwitch(ToolSwitchType.String) - { - Name = PRIVATE_KEY_PATH, - DisplayName = "Path to public key", - Description = "The -i option specifies the public SSH key to use.", - ArgumentRelationList = new ArrayList(), - SwitchValue = "-i ", - Value = value - }; - base.ActiveToolSwitches.Add(PRIVATE_KEY_PATH, toolSwitch); - base.AddActiveSwitchToolValue(toolSwitch); - } - } - - /// - /// Getter/Setter for the PackageId property - /// - public virtual string PackageId - { - get - { - if (base.IsPropertySet(PACKAGE_ID)) - { - return base.ActiveToolSwitches[PACKAGE_ID].Value; - } - return null; - } - set - { - base.ActiveToolSwitches.Remove(PACKAGE_ID); - ToolSwitch toolSwitch = new ToolSwitch(ToolSwitchType.String) - { - Name = PACKAGE_ID, - DisplayName = "Package ID", - Description = "The -package-id option specifies the application's package id.", - ArgumentRelationList = new ArrayList(), - SwitchValue = "-package-id ", - Value = value - }; - base.ActiveToolSwitches.Add(PACKAGE_ID, toolSwitch); - base.AddActiveSwitchToolValue(toolSwitch); - } - } - - /// - /// Getter/Setter for the PackageName property - /// - public virtual string PackageName - { - get - { - if (base.IsPropertySet(PACKAGE_NAME)) - { - return base.ActiveToolSwitches[PACKAGE_NAME].Value; - } - return null; - } - set - { - base.ActiveToolSwitches.Remove(PACKAGE_NAME); - ToolSwitch toolSwitch = new ToolSwitch(ToolSwitchType.String) - { - Name = PACKAGE_NAME, - DisplayName = "Package Name", - Description = "The -package-name option specifies the application's package name.", - ArgumentRelationList = new ArrayList(), - SwitchValue = "-package-name ", - Value = value - }; - base.ActiveToolSwitches.Add(PACKAGE_NAME, toolSwitch); - base.AddActiveSwitchToolValue(toolSwitch); - } - } - - /// - /// Getter/Setter for the DeleteFiles property - /// - public virtual ITaskItem[] DeleteFiles - { - get - { - if (base.IsPropertySet(DELETE_FILES)) - { - return base.ActiveToolSwitches[DELETE_FILES].TaskItemArray; - } - return null; - } - set - { - base.ActiveToolSwitches.Remove(DELETE_FILES); - ToolSwitch toolSwitch = new ToolSwitch(ToolSwitchType.ITaskItemArray) - { - Name = DELETE_FILES, - DisplayName = "Files to delete", - Description = "Delete all items in the array from the device.", - TaskItemArray = value - }; - base.ActiveToolSwitches.Add(DELETE_FILES, toolSwitch); - base.AddActiveSwitchToolValue(toolSwitch); - } - } - } -} diff --git a/src_vs2013/VSNDK.Tasks/VSNDK.Tasks.csproj b/src_vs2013/VSNDK.Tasks/VSNDK.Tasks.csproj index bad643a6..88b3fd1b 100644 --- a/src_vs2013/VSNDK.Tasks/VSNDK.Tasks.csproj +++ b/src_vs2013/VSNDK.Tasks/VSNDK.Tasks.csproj @@ -76,51 +76,87 @@ - - + + AsyncExec.cs + + + BarDescriptor\Parser.cs + + + BarDescriptor\Schema\bar-descriptor.cs bar-descriptor.xsd - - - - - - - - - - - - - - + + BBDeploy.cs + + + BBNativePackager.cs + + + BBSigner.cs + + + CheckIfInstalled.cs + + + DiffManifests.cs + + + GenerateMakefile.cs + + + GetAppInfo.cs + + + MakeAllAndFormatOutputMessages.cs + + + PackagerCmdBuilder.cs + + + Properties\AssemblyInfo.cs + + + Properties\Resources.Designer.cs True True Resources.resx - - - - - - - - ResXFileCodeGenerator - Resources.Designer.cs - Designer - + + QccCompiler.cs + + + QccLib.cs + + + QccLink.cs + + + RemoveFlagFile.cs + + + SSHDelete.cs + + + VSNDKTasks.cs + - + + BarDescriptor\Schema\bar-descriptor.xsd Designer - - Designer - Always + + BlackBerrySimulator\Microsoft.Cpp.BlackBerrySimulator.Packager.targets - - Designer - Always + + BlackBerrySimulator\Microsoft.CppBuild.BlackBerrySimulator.targets + + + BlackBerry\Microsoft.Cpp.BlackBerry.Packager.targets + + + BlackBerry\Microsoft.CppBuild.BlackBerry.targets Designer @@ -134,10 +170,6 @@ Designer Always - - Designer - Always - Designer Always @@ -157,10 +189,6 @@ Designer Always - - Designer - Always - Always Designer @@ -170,74 +198,62 @@ - - Designer + + BarDescriptor\Schema\bar-descriptor.xml - - Always + + BlackBerrySimulator\Rules\debugger_ndk.xml - - Always + + BlackBerrySimulator\Rules\ndkProjectItemsSchema.xml - - Always - Designer + + BlackBerrySimulator\Rules\ndk_directories.xml - - Always - Designer + + BlackBerrySimulator\Rules\ndk_general.xml - - Designer - Always + + BlackBerrySimulator\Rules\ndk_general_ps.xml - - Always + + BlackBerrySimulator\Rules\packager.xml - - Designer - Always + + BlackBerrySimulator\Rules\qcc_cl.xml - - Designer - Always + + BlackBerrySimulator\Rules\qcc_lib.xml - - Designer - Always + + BlackBerrySimulator\Rules\qcc_link.xml - - Always - Designer + + BlackBerry\Rules\debugger_ndk.xml - - Always + + BlackBerry\Rules\ndkProjectItemsSchema.xml - - Always + + BlackBerry\Rules\ndk_directories.xml - - Designer - Always + + BlackBerry\Rules\ndk_general.xml - - Always + + BlackBerry\Rules\ndk_general_ps.xml - - Always - Designer + + BlackBerry\Rules\packager.xml - - Designer - Always + + BlackBerry\Rules\qcc_cl.xml - - Designer - Always + + BlackBerry\Rules\qcc_lib.xml - - Designer - Always + + BlackBerry\Rules\qcc_link.xml @@ -262,6 +278,14 @@ true + + + + Properties\Resources.resx + ResXFileCodeGenerator + Resources.Designer.cs + + diff --git a/src_vs2013/VSNDK.Tasks/VSNDKTasks.cs b/src_vs2013/VSNDK.Tasks/VSNDKTasks.cs deleted file mode 100644 index e17c8019..00000000 --- a/src_vs2013/VSNDK.Tasks/VSNDKTasks.cs +++ /dev/null @@ -1,680 +0,0 @@ -//* Copyright 2010-2011 Research In Motion Limited. -//* -//* Licensed under the Apache License, Version 2.0 (the "License"); -//* you may not use this file except in compliance with the License. -//* You may obtain a copy of the License at -//* -//* http://www.apache.org/licenses/LICENSE-2.0 -//* -//* Unless required by applicable law or agreed to in writing, software -//* distributed under the License is distributed on an "AS IS" BASIS, -//* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//* See the License for the specific language governing permissions and -//* limitations under the License. - -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using Microsoft.Build.Utilities; -using Microsoft.Build.CPPTasks; -using System.Resources; -using System.Reflection; -using Microsoft.Build.Framework; -using System.Collections; -using System.IO; - -namespace VSNDK.Tasks -{ - public abstract class VSNDKTasks : TrackedVCToolTask - { - #region fields - // Fields - protected ArrayList switchOrderList; - - //constant fields - protected const string GENERATE_DEBUG_INFORMATION = "GenerateDebugInformation"; - protected const string WARING_LEVEL = "WarningLevel"; - protected const string TREAT_WARNING_AS_ERROR = "TreatWarningAsError"; - protected const string TRACKER_LOG_DIRECTORY = "TrackerLogDirectory"; - protected const string OPTIMIZATION = "Optimization"; - protected const string GCC_EXCEPTION_HANDLING = "GccExceptionHandling"; - protected const string SOURCES = "Sources"; - protected const string ADDITIONAL_OPTIONS = "AdditionalOptions"; - protected const string BUILDING_IN_IDE = "BuildingInIDE"; - protected const string ENHANCED_SECURITY = "EnhancedSecurity"; - protected const string POSITION_INDEPENDENT_EXECUTABLE = "PIE"; - protected const string COMPILER_VERSION_TARGET = "CompilerVersionTarget"; - protected const string VERBOSE = "Verbose"; - protected const string COMPILE_AS = "CompileAs"; - - private static string ERROR = " error:"; - private static string WARNING = " warning:"; - #endregion - - #region ctors - - /// - /// VSNDKTasks Constructor - /// - /// - public VSNDKTasks(ResourceManager res) - : base(res) - { - this.switchOrderList = new ArrayList(); - this.switchOrderList.Add(COMPILER_VERSION_TARGET); - this.switchOrderList.Add("AlwaysAppend"); - this.switchOrderList.Add(GENERATE_DEBUG_INFORMATION); - this.switchOrderList.Add(VERBOSE); - this.switchOrderList.Add(WARING_LEVEL); - this.switchOrderList.Add(TREAT_WARNING_AS_ERROR); - this.switchOrderList.Add(TRACKER_LOG_DIRECTORY); - this.switchOrderList.Add(OPTIMIZATION); - this.switchOrderList.Add(GCC_EXCEPTION_HANDLING); - this.switchOrderList.Add(ADDITIONAL_OPTIONS); - this.switchOrderList.Add(BUILDING_IN_IDE); - this.switchOrderList.Add(ENHANCED_SECURITY); - this.switchOrderList.Add(POSITION_INDEPENDENT_EXECUTABLE); - this.switchOrderList.Add(COMPILE_AS); - } - #endregion - - #region overrides - /// - /// don't use response file for msbuild because it is removed before qcc to run GCC compiler - /// - /// - /// - protected override string GetResponseFileSwitch(string responseFilePath) - { - return string.Empty; - } - - /// - /// instead pass the response file to command line commands - /// - /// - protected override string GenerateCommandLineCommands() - { - string cmd = GenerateResponseFileCommands(); - return cmd; - } - - /// - /// Function to assign out of date sources - /// - /// - /// - protected override ITaskItem[] AssignOutOfDateSources(ITaskItem[] sources) - { - base.ActiveToolSwitches[SOURCES].TaskItemArray = sources; - return sources; - } - - /// - /// Getter/Setter for SwitchOrderList property - /// - protected override ArrayList SwitchOrderList - { - get - { - return this.switchOrderList; - } - } - - /// - /// Getter/Setter for TrackedInputFiles property - /// - protected override Microsoft.Build.Framework.ITaskItem[] TrackedInputFiles - { - get - { - return Sources; - } - } - - /// - /// Getter/Setter for TrackerIntermediateDirectory - /// - protected override string TrackerIntermediateDirectory - { - get - { - if (this.TrackerLogDirectory != null) - { - return this.TrackerLogDirectory; - } - return string.Empty; - } - } - - /// - /// Getter/Setter for ToolName property - /// - protected override string ToolName - { - get { return QccExe; } - } - - /// - /// Getter/Setter for LogEventsFromTextOutput - /// - /// - /// - protected override void LogEventsFromTextOutput(string singleLine, MessageImportance messageImportance) - { - base.LogEventsFromTextOutput(Reformat(singleLine), messageImportance); - } - - - - /// - /// Reformat the qcc compiler error to msbuild known error format - /// singeLine: main.c:53: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'int' - /// or main.c:38:19: error: hello.h: No such file or directory - /// output: main.c(53): error QCC001: expected '=', ',', ';', 'asm' or '__attribute__' before 'int' - /// TODO: this method need to be updated in case any more error formats of qcc compiler - /// - /// - /// - private string Reformat(string singleLine) - { - string msbuilError = singleLine; - string[] separators = { ERROR, WARNING }; - string errCode = singleLine.Contains(ERROR) ? "error qcc" : "warning qcc"; - string[] parts = singleLine.Split(separators, StringSplitOptions.None); - if (parts != null && parts.Length > 1) - { - string[] segments = parts[0].Split(new Char[]{':'}, StringSplitOptions.RemoveEmptyEntries); - if (segments.Length == 3) - msbuilError = String.Format("{0}({1}-{2}): {3}: {4}", segments[0], segments[1], segments[2], errCode, parts[1]); - if ( segments.Length == 2 ) - msbuilError = String.Format("{0}({1}): {2}: {3}", segments[0], segments[1], errCode, parts[1]); - } - return msbuilError; - } - - /// - /// getter/setter for UseUnicodeOutput - /// - protected override bool UseUnicodeOutput - { - get - { - return this.BuildingInIDE; - } - } - - #endregion //override - - #region properties - - /// - /// Getter/Setter for GenerateDebugInformation property - /// - public virtual bool GenerateDebugInformation - { - get - { - if (base.IsPropertySet(GENERATE_DEBUG_INFORMATION)) - { - return base.ActiveToolSwitches[GENERATE_DEBUG_INFORMATION].BooleanValue; - } - return false; - } - set - { - base.ActiveToolSwitches.Remove(GENERATE_DEBUG_INFORMATION); - ToolSwitch switch2 = new ToolSwitch(ToolSwitchType.Boolean) - { - DisplayName = "Generate Debug Info", - Description = "Generate Debug Info (-g)", - ArgumentRelationList = new ArrayList() - }; - switch2.SwitchValue = "-g"; - switch2.Name = GENERATE_DEBUG_INFORMATION; - switch2.BooleanValue = value; - base.ActiveToolSwitches.Add(GENERATE_DEBUG_INFORMATION, switch2); - base.AddActiveSwitchToolValue(switch2); - } - } - - /// - /// Getter/Setter for WarningLevel property - /// - public virtual string WarningLevel - { - get - { - if (base.IsPropertySet(WARING_LEVEL)) - { - return base.ActiveToolSwitches[WARING_LEVEL].Value; - } - return null; - } - set - { - base.ActiveToolSwitches.Remove(WARING_LEVEL); - ToolSwitch switch2 = new ToolSwitch(ToolSwitchType.String) - { - DisplayName = "Warning Level", - Description = "Select how strict you want the compiler to be about code errors. (-w0 - -w4)", - ArgumentRelationList = new ArrayList() - }; - string[][] switchMap = new string[][] - { new string[] { "TurnOffAllWarnings", "-w0" }, - new string[] { "Level1", "-w1" }, - new string[] { "Level2", "-w2" }, - new string[] { "Level3", "-w3" }, - new string[] { "Level4", "-w4" }, - new string[] { "Level5", "-w5" }, - new string[] { "Level6", "-w6" }, - new string[] { "Level7", "-w7" }, - new string[] { "Level8", "-w8" }, - new string[] { "Level9", "-w9" }, - new string[] { "EnableAllWarnings", "-Wall" } }; - switch2.SwitchValue = base.ReadSwitchMap(WARING_LEVEL, switchMap, value); - switch2.Name = WARING_LEVEL; - switch2.Value = value; - switch2.MultipleValues = true; - base.ActiveToolSwitches.Add(WARING_LEVEL, switch2); - base.AddActiveSwitchToolValue(switch2); - } - } - - /// - /// Getter/Setter for TreatWarningAsError property - /// - public virtual bool TreatWarningAsError - { - get - { - if (base.IsPropertySet(TREAT_WARNING_AS_ERROR)) - { - return base.ActiveToolSwitches[TREAT_WARNING_AS_ERROR].BooleanValue; - } - return false; - } - set - { - base.ActiveToolSwitches.Remove(TREAT_WARNING_AS_ERROR); - ToolSwitch switch2 = new ToolSwitch(ToolSwitchType.Boolean) - { - DisplayName = "Treat Warnings as Errors", - Description = "Treat Warnings as Errors", - ArgumentRelationList = new ArrayList() - }; - switch2.ArgumentRelationList.Add(new ArgumentRelation(TREAT_WARNING_AS_ERROR, "true", false, "")); - switch2.SwitchValue = "-Werror"; - switch2.Name = TREAT_WARNING_AS_ERROR; - switch2.BooleanValue = value; - base.ActiveToolSwitches.Add(TREAT_WARNING_AS_ERROR, switch2); - base.AddActiveSwitchToolValue(switch2); - } - } - - /// - /// Getter/Setter for BuildingInIDE property - /// - public virtual bool BuildingInIDE - { - get - { - return (base.IsPropertySet(BUILDING_IN_IDE) && base.ActiveToolSwitches[BUILDING_IN_IDE].BooleanValue); - } - set - { - base.ActiveToolSwitches.Remove(BUILDING_IN_IDE); - ToolSwitch switch2 = new ToolSwitch(ToolSwitchType.Boolean) - { - ArgumentRelationList = new ArrayList(), - Name = BUILDING_IN_IDE, - BooleanValue = value - }; - base.ActiveToolSwitches.Add(BUILDING_IN_IDE, switch2); - base.AddActiveSwitchToolValue(switch2); - } - } - - /// - /// Getter/Setter for GccExceptHandling property - /// - public virtual string GccExceptionHandling - { - get - { - if (base.IsPropertySet("ExceptionHandling")) - { - return base.ActiveToolSwitches["ExceptionHandling"].Value; - } - return null; - } - set - { - base.ActiveToolSwitches.Remove("ExceptionHandling"); - ToolSwitch switch2 = new ToolSwitch(ToolSwitchType.String) - { - DisplayName = "Enable C++ Exceptions", - Description = "Specifies the model of exception handling to be used by the compiler.", - ArgumentRelationList = new ArrayList() - }; - string[][] switchMap = new string[][] { new string[] { "Async", "/EHa" }, new string[] { "Sync", "/EHsc" }, new string[] { "SyncCThrow", "/EHs" }, new string[] { "false", "" } }; - switch2.SwitchValue = base.ReadSwitchMap("ExceptionHandling", switchMap, value); - switch2.Name = "ExceptionHandling"; - switch2.Value = value; - switch2.MultipleValues = true; - base.ActiveToolSwitches.Add("ExceptionHandling", switch2); - base.AddActiveSwitchToolValue(switch2); - } - } - - /// - /// Getter/Setter for Optimization property - /// - public virtual string Optimization - { - get - { - if (base.IsPropertySet(OPTIMIZATION)) - { - return base.ActiveToolSwitches[OPTIMIZATION].Value; - } - return null; - } - set - { - base.ActiveToolSwitches.Remove(OPTIMIZATION); - ToolSwitch switch2 = new ToolSwitch(ToolSwitchType.String) - { - DisplayName = OPTIMIZATION, - Description = "Select option for code optimization; choose Custom to use specific optimization options. (-O0, -O1, -O2, -O3)", - ArgumentRelationList = new ArrayList() - }; - string[][] switchMap = new string[][] { new string[] { "Disabled", "-O0" }, new string[] { "MinSpace", "-O1" }, - new string[] { "MaxSpeed", "-O2" }, new string[] { "Full", "-O3" } }; - switch2.SwitchValue = base.ReadSwitchMap(OPTIMIZATION, switchMap, value); - switch2.Name = OPTIMIZATION; - switch2.Value = value; - switch2.MultipleValues = true; - base.ActiveToolSwitches.Add(OPTIMIZATION, switch2); - base.AddActiveSwitchToolValue(switch2); - } - } - - /// - /// Getter/Setter for PlatformToolset property - /// - public virtual string PlatformToolset - { - get - { - return "qcc"; - } - } - - /// - /// Getter/Setter for TrackerLogDirectory - /// - public virtual string TrackerLogDirectory - { - get - { - if ( base.IsPropertySet( TRACKER_LOG_DIRECTORY ) ) - { - return base.ActiveToolSwitches[TRACKER_LOG_DIRECTORY].Value; - } - return null; - } - set - { - base.ActiveToolSwitches.Remove( TRACKER_LOG_DIRECTORY ); - ToolSwitch switch2 = new ToolSwitch( ToolSwitchType.Directory ) - { - DisplayName = "Tracker Log Directory", - Description = "Tracker Log Directory.", - ArgumentRelationList = new ArrayList(), - Value = VCToolTask.EnsureTrailingSlash( value ) - }; - base.ActiveToolSwitches.Add( TRACKER_LOG_DIRECTORY, switch2 ); - base.AddActiveSwitchToolValue( switch2 ); - } - } - - /// - /// Getter/Setter for TargetMachine property - /// - public virtual string TargetMachine - { - get - { - if (base.IsPropertySet("TargetMachine")) - { - return base.ActiveToolSwitches["TargetMachine"].Value; - } - return null; - } - set - { - base.ActiveToolSwitches.Remove("TargetMachine"); - ToolSwitch switch2 = new ToolSwitch(ToolSwitchType.String) - { - DisplayName = "Target Machine", - Description = "The /MACHINE option specifies the target platform for the program.", - ArgumentRelationList = new ArrayList() - }; - string[][] switchMap = new string[][] { new string[] { "MachineARM", "/MACHINE:ARM" }, new string[] { "MachineEBC", "/MACHINE:EBC" }, new string[] { "MachineIA64", "/MACHINE:IA64" }, new string[] { "MachineMIPS", "/MACHINE:MIPS" }, new string[] { "MachineMIPS16", "/MACHINE:MIPS16" }, new string[] { "MachineMIPSFPU", "/MACHINE:MIPSFPU" }, new string[] { "MachineMIPSFPU16", "/MACHINE:MIPSFPU16" }, new string[] { "MachineSH4", "/MACHINE:SH4" }, new string[] { "MachineTHUMB", "/MACHINE:THUMB" }, new string[] { "MachineX64", "/MACHINE:X64" }, new string[] { "MachineX86", "/MACHINE:X86" } }; - switch2.SwitchValue = base.ReadSwitchMap("TargetMachine", switchMap, value); - switch2.Name = "TargetMachine"; - switch2.Value = value; - switch2.MultipleValues = true; - base.ActiveToolSwitches.Add("TargetMachine", switch2); - base.AddActiveSwitchToolValue(switch2); - } - } - - /// - /// Getter/Setter for CompileAs property - /// - public virtual string CompileAs - { - get - { - if (base.IsPropertySet(COMPILE_AS)) - { - return base.ActiveToolSwitches[COMPILE_AS].Value; - } - return null; - } - set - { - base.ActiveToolSwitches.Remove(COMPILE_AS); - ToolSwitch switch2 = new ToolSwitch(ToolSwitchType.String) - { - DisplayName = "Compile As", - Description = "Select compile language option for .c and .cpp files. (-lang-c, -lang-c++)", - ArgumentRelationList = new ArrayList() - }; - string[][] switchMap = new string[][] { new string[] { "CompileAsC", "-lang-c" }, new string[] { "CompileAsCpp", "-lang-c++" } }; - switch2.SwitchValue = base.ReadSwitchMap(COMPILE_AS, switchMap, value); - switch2.Name = COMPILE_AS; - switch2.Value = value; - switch2.MultipleValues = true; - base.ActiveToolSwitches.Add(COMPILE_AS, switch2); - base.AddActiveSwitchToolValue(switch2); - } - } - - /// - /// Getter/Setter for Verbose property - /// - public bool Verbose - { - get - { - return (base.IsPropertySet(VERBOSE) && base.ActiveToolSwitches[VERBOSE].BooleanValue); - } - set - { - base.ActiveToolSwitches.Remove(VERBOSE); - ToolSwitch switch2 = new ToolSwitch(ToolSwitchType.Boolean) - { - DisplayName = "Verbose", - Description = "Verbose", - ArgumentRelationList = new ArrayList(), - SwitchValue = "-v", - Name = VERBOSE, - BooleanValue = value - }; - base.ActiveToolSwitches.Add(VERBOSE, switch2); - base.AddActiveSwitchToolValue(switch2); - } - } - - /// - /// Getter/Setter for EnhancedSecutiry property - /// - public virtual bool EnhancedSecurity - { - get - { - return (base.IsPropertySet(ENHANCED_SECURITY) && base.ActiveToolSwitches[ENHANCED_SECURITY].BooleanValue); - } - set - { - base.ActiveToolSwitches.Remove(ENHANCED_SECURITY); - ToolSwitch switch2 = new ToolSwitch(ToolSwitchType.Boolean) - { - DisplayName = "Enhanced Security(-fstack-protector-all)", - Description = " ", - ArgumentRelationList = new ArrayList(), - SwitchValue = GetEnhancedSecuritySwitchValue(), - Name = ENHANCED_SECURITY, - BooleanValue = value - }; - base.ActiveToolSwitches.Add(ENHANCED_SECURITY, switch2); - base.AddActiveSwitchToolValue(switch2); - } - } - - /// - /// Return the Get Enhanced Security string. - /// - /// - protected virtual string GetEnhancedSecuritySwitchValue() - { - return "-fstack-protector-all"; - } - - /// - /// Getter/Setter for the PIE property - /// - public bool PIE - { - get - { - return (base.IsPropertySet(POSITION_INDEPENDENT_EXECUTABLE) && base.ActiveToolSwitches[POSITION_INDEPENDENT_EXECUTABLE].BooleanValue); - } - set - { - base.ActiveToolSwitches.Remove(POSITION_INDEPENDENT_EXECUTABLE); - ToolSwitch switch2 = new ToolSwitch(ToolSwitchType.Boolean) - { - DisplayName = "Position Independent Executable(fPIE)", - Description = " ", - ArgumentRelationList = new ArrayList(), - SwitchValue = "-fPIE", - Name = POSITION_INDEPENDENT_EXECUTABLE, - BooleanValue = value - }; - base.ActiveToolSwitches.Add(POSITION_INDEPENDENT_EXECUTABLE, switch2); - base.AddActiveSwitchToolValue(switch2); - } - } - - /// - /// Getter/Setter for the ProfilingCall property - /// - public bool ProfilingCall { get; set; } - - /// - /// Getter/Setter for the CodeCoverage property - /// - public bool CodeCoverage { get; set; } - - /// - /// Getter/Setter for the Mudflap property - /// - public bool Mudflap { get; set; } - - /// - /// Getter/Setter for the QccExe property - /// - public string QccExe { get; set; } - - /// - /// Getter/Setter for the CompilerVersionTarget property - /// - public string CompilerVersionTarget - { - get - { - if (base.IsPropertySet(COMPILER_VERSION_TARGET)) - { - return base.ActiveToolSwitches[COMPILER_VERSION_TARGET].Value; - } - return null; - } - set - { - base.ActiveToolSwitches.Remove(COMPILER_VERSION_TARGET); - ToolSwitch switch2 = new ToolSwitch(ToolSwitchType.String) - { - DisplayName = "Compiler version and target", - Description = " ", - ArgumentRelationList = new ArrayList(), - SwitchValue = "-V", - }; - switch2.Name = COMPILER_VERSION_TARGET; - switch2.Value = value; - - base.ActiveToolSwitches.Add(COMPILER_VERSION_TARGET, switch2); - base.AddActiveSwitchToolValue(switch2); - } - } - - /// - /// Getter/Setter for the LinkSharedLibrary property - /// - public virtual bool LinkSharedLibrary { get; set; } - - /// - /// Getter/Setter for the Sources property - /// - [Required] - public virtual ITaskItem[] Sources - { - get - { - if (base.IsPropertySet(SOURCES)) - { - return base.ActiveToolSwitches[SOURCES].TaskItemArray; - } - return null; - } - set - { - base.ActiveToolSwitches.Remove(SOURCES); - ToolSwitch switch2 = new ToolSwitch(ToolSwitchType.ITaskItemArray) - { - Separator = " ", - Required = true, - ArgumentRelationList = new ArrayList(), - TaskItemArray = value - }; - base.ActiveToolSwitches.Add(SOURCES, switch2); - base.AddActiveSwitchToolValue(switch2); - } - } - #endregion //properties - } -} From aec852cd94503af17c8de7b5190253cbcfb2f6b5 Mon Sep 17 00:00:00 2001 From: Pawel Hofman Date: Thu, 8 May 2014 01:45:29 +0200 Subject: [PATCH 021/851] Removed duplicated code from Package project --- .gitignore | 2 +- .../DebugToken/DebugTokenDialog.xaml | 16 +- .../DebugToken/DebugTokenDialog.xaml.cs | 77 +- .../DebugToken/DebugTokenDictionary.xaml | 5 - .../DebugToken/Model/DebugTokenData.cs | 58 +- src/VSNDK.Package/Import/Import.xaml | 10 +- src/VSNDK.Package/Import/Import.xaml.cs | 7 + .../Import/ImportDictionary.xaml | 7 - src/VSNDK.Package/Import/Model/ImportModel.cs | 1 - .../NameValueCollectionHelper.cs | 2 +- src/VSNDK.Package/Resources.Designer.cs | 4 +- src/VSNDK.Package/Resources.resx | 2 +- .../Settings/Model/SettingsData.cs | 17 +- .../Settings/SettingsDialog.xaml | 6 +- .../Settings/SettingsDialog.xaml.cs | 13 +- src/VSNDK.Package/Signing/Browser.Designer.cs | 2 +- .../Signing/DeRegisterWindow.xaml | 2 +- .../Signing/Models/PasswordBoxAssistant.cs | 110 - .../Signing/Models/SigningData.cs | 7 +- .../Signing/RegistrationWindow.xaml | 2 +- .../Signing/RegistrationWindow.xaml.cs | 4 +- src/VSNDK.Package/Signing/SigningDialog.xaml | 2 +- .../Signing/SigningDialog.xaml.cs | 2 +- .../UpdateManager/Model/UpdateManagerData.cs | 442 ++-- .../UpdateManager/SimulatorManager.xaml | 2 +- .../UpdateManager/SimulatorManager.xaml.cs | 18 +- .../UpdateManager/UpdateManager.xaml | 2 +- .../UpdateManager/UpdateManager.xaml.cs | 51 +- .../UpdateManager/UpdateManagerDialog.xaml | 29 +- .../UpdateManager/UpdateManagerDialog.xaml.cs | 10 + src/VSNDK.Package/VSNDK.Package.csproj | 19 +- src/VSNDK.Package/VSNDK.PackagePackage.cs | 657 ++++-- src/VSNDK.Package/VSNDKCommandEvents.cs | 2 +- src/VSNDK.Package/VSNDKConstants.cs | 56 +- src/VSNDK.Package/ViewModel.cs | 149 +- src/VSNDK.Package/VsDesignerControl.xaml | 14 +- .../VSNDK.Package/ControlDebugEngine.cs | 12 - .../DebugToken/DebugTokenDialog.xaml | 59 - .../DebugToken/DebugTokenDialog.xaml.cs | 143 -- .../DebugToken/Model/DebugTokenData.cs | 866 -------- src_vs2012/VSNDK.Package/EditorFactory.cs | 223 --- .../EditorFactoryNotifyForProject.cs | 177 -- src_vs2012/VSNDK.Package/EditorPane.cs | 478 ----- src_vs2012/VSNDK.Package/GlobalFunctions.cs | 84 - .../VSNDK.Package/GlobalSuppressions.cs | 25 - src_vs2012/VSNDK.Package/Guids.cs | 37 - src_vs2012/VSNDK.Package/IViewModel.cs | 67 - src_vs2012/VSNDK.Package/Import/Import.xaml | 17 - .../VSNDK.Package/Import/Import.xaml.cs | 111 -- .../VSNDK.Package/Import/Model/ImportModel.cs | 295 --- src_vs2012/VSNDK.Package/Key.snk | Bin 596 -> 0 bytes src_vs2012/VSNDK.Package/Logger.cs | 24 - .../NameValueCollectionHelper.cs | 76 - src_vs2012/VSNDK.Package/NativeMethods.cs | 42 - src_vs2012/VSNDK.Package/PkgCmdID.cs | 33 - .../VSNDK.Package/Properties/AssemblyInfo.cs | 50 - .../VSNDK.Package/Resources.Designer.cs | 225 --- src_vs2012/VSNDK.Package/Resources.resx | 174 -- .../Resources/BlackBerryMessager.bmp | Bin 822 -> 0 bytes .../VSNDK.Package/Resources/Calendar.bmp | Bin 938 -> 0 bytes src_vs2012/VSNDK.Package/Resources/Camera.bmp | Bin 822 -> 0 bytes .../VSNDK.Package/Resources/CaptureScreen.bmp | Bin 822 -> 0 bytes .../VSNDK.Package/Resources/Contacts.bmp | Bin 822 -> 0 bytes .../Resources/DeviceIdentifyingInfo.bmp | Bin 822 -> 0 bytes .../Resources/EmailPINMessages.bmp | Bin 822 -> 0 bytes src_vs2012/VSNDK.Package/Resources/File.ico | Bin 1078 -> 0 bytes .../VSNDK.Package/Resources/GPSLocation.bmp | Bin 822 -> 0 bytes .../VSNDK.Package/Resources/Gamepad.bmp | Bin 822 -> 0 bytes .../VSNDK.Package/Resources/Images_24bit.bmp | Bin 3896 -> 0 bytes .../VSNDK.Package/Resources/Images_32bit.bmp | Bin 5176 -> 0 bytes .../VSNDK.Package/Resources/Internet.bmp | Bin 822 -> 0 bytes .../VSNDK.Package/Resources/Location.bmp | Bin 822 -> 0 bytes .../VSNDK.Package/Resources/Mircrophone.bmp | Bin 822 -> 0 bytes .../VSNDK.Package/Resources/MyContactInfo.bmp | Bin 822 -> 0 bytes .../VSNDK.Package/Resources/Notebooks.bmp | Bin 822 -> 0 bytes .../VSNDK.Package/Resources/Package.ico | Bin 1078 -> 0 bytes src_vs2012/VSNDK.Package/Resources/Phone.bmp | Bin 822 -> 0 bytes .../VSNDK.Package/Resources/PhoneControl.bmp | Bin 822 -> 0 bytes .../Resources/PostNotifications.bmp | Bin 822 -> 0 bytes src_vs2012/VSNDK.Package/Resources/Push.bmp | Bin 822 -> 0 bytes .../Resources/RunBackgrounded.bmp | Bin 822 -> 0 bytes .../VSNDK.Package/Resources/SharedFiles.bmp | Bin 822 -> 0 bytes .../VSNDK.Package/Resources/TextMessages.bmp | Bin 822 -> 0 bytes src_vs2012/VSNDK.Package/Resources/info.png | Bin 4639 -> 0 bytes .../Settings/Model/SettingsData.cs | 442 ---- .../Settings/SettingsDialog.xaml | 49 - .../Settings/SettingsDialog.xaml.cs | 108 - .../VSNDK.Package/Signing/Browser.Designer.cs | 158 -- src_vs2012/VSNDK.Package/Signing/Browser.cs | 22 - src_vs2012/VSNDK.Package/Signing/Browser.resx | 120 -- .../Signing/DeRegisterWindow.xaml | 18 - .../Signing/DeRegisterWindow.xaml.cs | 77 - .../Signing/Models/SigningData.cs | 465 ----- .../Signing/RegistrationWindow.xaml | 25 - .../Signing/RegistrationWindow.xaml.cs | 84 - .../VSNDK.Package/Signing/SigningDialog.xaml | 35 - .../Signing/SigningDialog.xaml.cs | 126 -- .../BarDescriptor/Scripts/1033/default.js | 64 - .../Templates/1033/bar-descriptor.cs | 560 ------ .../Templates/1033/bar-descriptor.xml | 72 - .../Templates/1033/bar-descriptor.xsd | 76 - .../Templates/1033/templates.inf | 1 - .../VSNDK.Package/Templates/bar-descriptor.cs | 560 ------ .../UpdateManager/Model/UpdateManagerData.cs | 1190 ----------- .../UpdateManager/SimulatorManager.xaml | 61 - .../UpdateManager/SimulatorManager.xaml.cs | 163 -- .../UpdateManager/UpdateManager.xaml | 48 - .../UpdateManager/UpdateManager.xaml.cs | 228 --- .../UpdateManager/UpdateManagerDialog.xaml | 30 - .../UpdateManager/UpdateManagerDialog.xaml.cs | 161 -- src_vs2012/VSNDK.Package/VSMacroRecorder.cs | 277 --- src_vs2012/VSNDK.Package/VSNDK.Package.csproj | 372 ++-- src_vs2012/VSNDK.Package/VSNDK.Package.vsct | 2 +- .../VSNDK.Package/VSNDK.PackagePackage.cs | 1774 ----------------- .../VSNDK.Package/VSNDKCommandEvents.cs | 64 - src_vs2012/VSNDK.Package/VSNDKConstants.cs | 44 - src_vs2012/VSNDK.Package/VSPackage.resx | 168 -- src_vs2012/VSNDK.Package/ViewModel.cs | 1737 ---------------- .../VSNDK.Package/VsDesignerControl.xaml | 204 -- .../VSNDK.Package/VsDesignerControl.xaml.cs | 323 --- .../XmlEditorDesignerViewRegistration.cs | 205 -- src_vs2012/VSNDK.Package/bar-descriptor.cs | 919 --------- src_vs2012/VSNDK.PackagePackage.cs | 1288 ------------ src_vs2012/ViewModel.cs | 1706 ---------------- .../VSNDK.Package/ControlDebugEngine.cs | 12 - .../DebugToken/DebugTokenDialog.xaml | 59 - .../DebugToken/DebugTokenDialog.xaml.cs | 143 -- .../DebugToken/Model/DebugTokenData.cs | 866 -------- src_vs2013/VSNDK.Package/EditorFactory.cs | 223 --- .../EditorFactoryNotifyForProject.cs | 177 -- src_vs2013/VSNDK.Package/EditorPane.cs | 478 ----- src_vs2013/VSNDK.Package/GlobalFunctions.cs | 84 - .../VSNDK.Package/GlobalSuppressions.cs | 25 - src_vs2013/VSNDK.Package/Guids.cs | 37 - src_vs2013/VSNDK.Package/IViewModel.cs | 67 - src_vs2013/VSNDK.Package/Import/Import.xaml | 17 - .../VSNDK.Package/Import/Import.xaml.cs | 111 -- .../VSNDK.Package/Import/Model/ImportModel.cs | 295 --- src_vs2013/VSNDK.Package/Key.snk | Bin 596 -> 0 bytes src_vs2013/VSNDK.Package/Logger.cs | 24 - .../NameValueCollectionHelper.cs | 76 - src_vs2013/VSNDK.Package/NativeMethods.cs | 42 - src_vs2013/VSNDK.Package/PkgCmdID.cs | 33 - .../VSNDK.Package/Properties/AssemblyInfo.cs | 50 - .../VSNDK.Package/Resources.Designer.cs | 225 --- src_vs2013/VSNDK.Package/Resources.resx | 174 -- .../Resources/BlackBerryMessager.bmp | Bin 822 -> 0 bytes .../VSNDK.Package/Resources/Calendar.bmp | Bin 938 -> 0 bytes src_vs2013/VSNDK.Package/Resources/Camera.bmp | Bin 822 -> 0 bytes .../VSNDK.Package/Resources/CaptureScreen.bmp | Bin 822 -> 0 bytes .../VSNDK.Package/Resources/Contacts.bmp | Bin 822 -> 0 bytes .../Resources/DeviceIdentifyingInfo.bmp | Bin 822 -> 0 bytes .../Resources/EmailPINMessages.bmp | Bin 822 -> 0 bytes src_vs2013/VSNDK.Package/Resources/File.ico | Bin 1078 -> 0 bytes .../VSNDK.Package/Resources/GPSLocation.bmp | Bin 822 -> 0 bytes .../VSNDK.Package/Resources/Gamepad.bmp | Bin 822 -> 0 bytes .../VSNDK.Package/Resources/Images_24bit.bmp | Bin 3896 -> 0 bytes .../VSNDK.Package/Resources/Images_32bit.bmp | Bin 5176 -> 0 bytes .../VSNDK.Package/Resources/Internet.bmp | Bin 822 -> 0 bytes .../VSNDK.Package/Resources/Location.bmp | Bin 822 -> 0 bytes .../VSNDK.Package/Resources/Mircrophone.bmp | Bin 822 -> 0 bytes .../VSNDK.Package/Resources/MyContactInfo.bmp | Bin 822 -> 0 bytes .../VSNDK.Package/Resources/Notebooks.bmp | Bin 822 -> 0 bytes .../VSNDK.Package/Resources/Package.ico | Bin 1078 -> 0 bytes src_vs2013/VSNDK.Package/Resources/Phone.bmp | Bin 822 -> 0 bytes .../VSNDK.Package/Resources/PhoneControl.bmp | Bin 822 -> 0 bytes .../Resources/PostNotifications.bmp | Bin 822 -> 0 bytes src_vs2013/VSNDK.Package/Resources/Push.bmp | Bin 822 -> 0 bytes .../Resources/RunBackgrounded.bmp | Bin 822 -> 0 bytes .../VSNDK.Package/Resources/SharedFiles.bmp | Bin 822 -> 0 bytes .../VSNDK.Package/Resources/TextMessages.bmp | Bin 822 -> 0 bytes src_vs2013/VSNDK.Package/Resources/info.png | Bin 4639 -> 0 bytes .../Settings/Model/SettingsData.cs | 442 ---- .../Settings/SettingsDialog.xaml | 49 - .../Settings/SettingsDialog.xaml.cs | 108 - .../VSNDK.Package/Signing/Browser.Designer.cs | 158 -- src_vs2013/VSNDK.Package/Signing/Browser.cs | 22 - src_vs2013/VSNDK.Package/Signing/Browser.resx | 120 -- .../Signing/DeRegisterWindow.xaml | 18 - .../Signing/DeRegisterWindow.xaml.cs | 77 - .../Signing/Models/SigningData.cs | 465 ----- .../Signing/RegistrationWindow.xaml | 25 - .../Signing/RegistrationWindow.xaml.cs | 84 - .../VSNDK.Package/Signing/SigningDialog.xaml | 35 - .../Signing/SigningDialog.xaml.cs | 126 -- .../BarDescriptor/Scripts/1033/default.js | 64 - .../Templates/1033/bar-descriptor.cs | 560 ------ .../Templates/1033/bar-descriptor.xml | 72 - .../Templates/1033/bar-descriptor.xsd | 76 - .../Templates/1033/templates.inf | 1 - .../VSNDK.Package/Templates/bar-descriptor.cs | 560 ------ .../UpdateManager/Model/UpdateManagerData.cs | 1190 ----------- .../UpdateManager/SimulatorManager.xaml | 61 - .../UpdateManager/SimulatorManager.xaml.cs | 163 -- .../UpdateManager/UpdateManager.xaml | 48 - .../UpdateManager/UpdateManager.xaml.cs | 228 --- .../UpdateManager/UpdateManagerDialog.xaml | 30 - .../UpdateManager/UpdateManagerDialog.xaml.cs | 161 -- src_vs2013/VSNDK.Package/VSMacroRecorder.cs | 277 --- src_vs2013/VSNDK.Package/VSNDK.Package.csproj | 382 ++-- src_vs2013/VSNDK.Package/VSNDK.Package.vsct | 2 +- .../VSNDK.Package/VSNDK.PackagePackage.cs | 1774 ----------------- .../VSNDK.Package/VSNDKCommandEvents.cs | 64 - src_vs2013/VSNDK.Package/VSNDKConstants.cs | 44 - src_vs2013/VSNDK.Package/VSPackage.resx | 168 -- src_vs2013/VSNDK.Package/ViewModel.cs | 1737 ---------------- .../VSNDK.Package/VsDesignerControl.xaml | 204 -- .../XmlEditorDesignerViewRegistration.cs | 205 -- src_vs2013/VSNDK.Package/bar-descriptor.cs | 919 --------- 209 files changed, 1668 insertions(+), 31322 deletions(-) delete mode 100644 src/VSNDK.Package/DebugToken/DebugTokenDictionary.xaml delete mode 100644 src/VSNDK.Package/Import/ImportDictionary.xaml delete mode 100644 src/VSNDK.Package/Signing/Models/PasswordBoxAssistant.cs delete mode 100644 src_vs2012/VSNDK.Package/ControlDebugEngine.cs delete mode 100644 src_vs2012/VSNDK.Package/DebugToken/DebugTokenDialog.xaml delete mode 100644 src_vs2012/VSNDK.Package/DebugToken/DebugTokenDialog.xaml.cs delete mode 100644 src_vs2012/VSNDK.Package/DebugToken/Model/DebugTokenData.cs delete mode 100644 src_vs2012/VSNDK.Package/EditorFactory.cs delete mode 100644 src_vs2012/VSNDK.Package/EditorFactoryNotifyForProject.cs delete mode 100644 src_vs2012/VSNDK.Package/EditorPane.cs delete mode 100644 src_vs2012/VSNDK.Package/GlobalFunctions.cs delete mode 100644 src_vs2012/VSNDK.Package/GlobalSuppressions.cs delete mode 100644 src_vs2012/VSNDK.Package/Guids.cs delete mode 100644 src_vs2012/VSNDK.Package/IViewModel.cs delete mode 100644 src_vs2012/VSNDK.Package/Import/Import.xaml delete mode 100644 src_vs2012/VSNDK.Package/Import/Import.xaml.cs delete mode 100644 src_vs2012/VSNDK.Package/Import/Model/ImportModel.cs delete mode 100644 src_vs2012/VSNDK.Package/Key.snk delete mode 100644 src_vs2012/VSNDK.Package/Logger.cs delete mode 100644 src_vs2012/VSNDK.Package/NameValueCollectionHelper.cs delete mode 100644 src_vs2012/VSNDK.Package/NativeMethods.cs delete mode 100644 src_vs2012/VSNDK.Package/PkgCmdID.cs delete mode 100644 src_vs2012/VSNDK.Package/Properties/AssemblyInfo.cs delete mode 100644 src_vs2012/VSNDK.Package/Resources.Designer.cs delete mode 100644 src_vs2012/VSNDK.Package/Resources.resx delete mode 100644 src_vs2012/VSNDK.Package/Resources/BlackBerryMessager.bmp delete mode 100644 src_vs2012/VSNDK.Package/Resources/Calendar.bmp delete mode 100644 src_vs2012/VSNDK.Package/Resources/Camera.bmp delete mode 100644 src_vs2012/VSNDK.Package/Resources/CaptureScreen.bmp delete mode 100644 src_vs2012/VSNDK.Package/Resources/Contacts.bmp delete mode 100644 src_vs2012/VSNDK.Package/Resources/DeviceIdentifyingInfo.bmp delete mode 100644 src_vs2012/VSNDK.Package/Resources/EmailPINMessages.bmp delete mode 100644 src_vs2012/VSNDK.Package/Resources/File.ico delete mode 100644 src_vs2012/VSNDK.Package/Resources/GPSLocation.bmp delete mode 100644 src_vs2012/VSNDK.Package/Resources/Gamepad.bmp delete mode 100644 src_vs2012/VSNDK.Package/Resources/Images_24bit.bmp delete mode 100644 src_vs2012/VSNDK.Package/Resources/Images_32bit.bmp delete mode 100644 src_vs2012/VSNDK.Package/Resources/Internet.bmp delete mode 100644 src_vs2012/VSNDK.Package/Resources/Location.bmp delete mode 100644 src_vs2012/VSNDK.Package/Resources/Mircrophone.bmp delete mode 100644 src_vs2012/VSNDK.Package/Resources/MyContactInfo.bmp delete mode 100644 src_vs2012/VSNDK.Package/Resources/Notebooks.bmp delete mode 100644 src_vs2012/VSNDK.Package/Resources/Package.ico delete mode 100644 src_vs2012/VSNDK.Package/Resources/Phone.bmp delete mode 100644 src_vs2012/VSNDK.Package/Resources/PhoneControl.bmp delete mode 100644 src_vs2012/VSNDK.Package/Resources/PostNotifications.bmp delete mode 100644 src_vs2012/VSNDK.Package/Resources/Push.bmp delete mode 100644 src_vs2012/VSNDK.Package/Resources/RunBackgrounded.bmp delete mode 100644 src_vs2012/VSNDK.Package/Resources/SharedFiles.bmp delete mode 100644 src_vs2012/VSNDK.Package/Resources/TextMessages.bmp delete mode 100644 src_vs2012/VSNDK.Package/Resources/info.png delete mode 100644 src_vs2012/VSNDK.Package/Settings/Model/SettingsData.cs delete mode 100644 src_vs2012/VSNDK.Package/Settings/SettingsDialog.xaml delete mode 100644 src_vs2012/VSNDK.Package/Settings/SettingsDialog.xaml.cs delete mode 100644 src_vs2012/VSNDK.Package/Signing/Browser.Designer.cs delete mode 100644 src_vs2012/VSNDK.Package/Signing/Browser.cs delete mode 100644 src_vs2012/VSNDK.Package/Signing/Browser.resx delete mode 100644 src_vs2012/VSNDK.Package/Signing/DeRegisterWindow.xaml delete mode 100644 src_vs2012/VSNDK.Package/Signing/DeRegisterWindow.xaml.cs delete mode 100644 src_vs2012/VSNDK.Package/Signing/Models/SigningData.cs delete mode 100644 src_vs2012/VSNDK.Package/Signing/RegistrationWindow.xaml delete mode 100644 src_vs2012/VSNDK.Package/Signing/RegistrationWindow.xaml.cs delete mode 100644 src_vs2012/VSNDK.Package/Signing/SigningDialog.xaml delete mode 100644 src_vs2012/VSNDK.Package/Signing/SigningDialog.xaml.cs delete mode 100644 src_vs2012/VSNDK.Package/Templates/VCWizards/BlackBerry/BarDescriptor/Scripts/1033/default.js delete mode 100644 src_vs2012/VSNDK.Package/Templates/VCWizards/BlackBerry/BarDescriptor/Templates/1033/bar-descriptor.cs delete mode 100644 src_vs2012/VSNDK.Package/Templates/VCWizards/BlackBerry/BarDescriptor/Templates/1033/bar-descriptor.xml delete mode 100644 src_vs2012/VSNDK.Package/Templates/VCWizards/BlackBerry/BarDescriptor/Templates/1033/bar-descriptor.xsd delete mode 100644 src_vs2012/VSNDK.Package/Templates/VCWizards/BlackBerry/BarDescriptor/Templates/1033/templates.inf delete mode 100644 src_vs2012/VSNDK.Package/Templates/bar-descriptor.cs delete mode 100644 src_vs2012/VSNDK.Package/UpdateManager/Model/UpdateManagerData.cs delete mode 100644 src_vs2012/VSNDK.Package/UpdateManager/SimulatorManager.xaml delete mode 100644 src_vs2012/VSNDK.Package/UpdateManager/SimulatorManager.xaml.cs delete mode 100644 src_vs2012/VSNDK.Package/UpdateManager/UpdateManager.xaml delete mode 100644 src_vs2012/VSNDK.Package/UpdateManager/UpdateManager.xaml.cs delete mode 100644 src_vs2012/VSNDK.Package/UpdateManager/UpdateManagerDialog.xaml delete mode 100644 src_vs2012/VSNDK.Package/UpdateManager/UpdateManagerDialog.xaml.cs delete mode 100644 src_vs2012/VSNDK.Package/VSMacroRecorder.cs delete mode 100644 src_vs2012/VSNDK.Package/VSNDK.PackagePackage.cs delete mode 100644 src_vs2012/VSNDK.Package/VSNDKCommandEvents.cs delete mode 100644 src_vs2012/VSNDK.Package/VSNDKConstants.cs delete mode 100644 src_vs2012/VSNDK.Package/VSPackage.resx delete mode 100644 src_vs2012/VSNDK.Package/ViewModel.cs delete mode 100644 src_vs2012/VSNDK.Package/VsDesignerControl.xaml delete mode 100644 src_vs2012/VSNDK.Package/VsDesignerControl.xaml.cs delete mode 100644 src_vs2012/VSNDK.Package/XmlEditorDesignerViewRegistration.cs delete mode 100644 src_vs2012/VSNDK.Package/bar-descriptor.cs delete mode 100644 src_vs2012/VSNDK.PackagePackage.cs delete mode 100644 src_vs2012/ViewModel.cs delete mode 100644 src_vs2013/VSNDK.Package/ControlDebugEngine.cs delete mode 100644 src_vs2013/VSNDK.Package/DebugToken/DebugTokenDialog.xaml delete mode 100644 src_vs2013/VSNDK.Package/DebugToken/DebugTokenDialog.xaml.cs delete mode 100644 src_vs2013/VSNDK.Package/DebugToken/Model/DebugTokenData.cs delete mode 100644 src_vs2013/VSNDK.Package/EditorFactory.cs delete mode 100644 src_vs2013/VSNDK.Package/EditorFactoryNotifyForProject.cs delete mode 100644 src_vs2013/VSNDK.Package/EditorPane.cs delete mode 100644 src_vs2013/VSNDK.Package/GlobalFunctions.cs delete mode 100644 src_vs2013/VSNDK.Package/GlobalSuppressions.cs delete mode 100644 src_vs2013/VSNDK.Package/Guids.cs delete mode 100644 src_vs2013/VSNDK.Package/IViewModel.cs delete mode 100644 src_vs2013/VSNDK.Package/Import/Import.xaml delete mode 100644 src_vs2013/VSNDK.Package/Import/Import.xaml.cs delete mode 100644 src_vs2013/VSNDK.Package/Import/Model/ImportModel.cs delete mode 100644 src_vs2013/VSNDK.Package/Key.snk delete mode 100644 src_vs2013/VSNDK.Package/Logger.cs delete mode 100644 src_vs2013/VSNDK.Package/NameValueCollectionHelper.cs delete mode 100644 src_vs2013/VSNDK.Package/NativeMethods.cs delete mode 100644 src_vs2013/VSNDK.Package/PkgCmdID.cs delete mode 100644 src_vs2013/VSNDK.Package/Properties/AssemblyInfo.cs delete mode 100644 src_vs2013/VSNDK.Package/Resources.Designer.cs delete mode 100644 src_vs2013/VSNDK.Package/Resources.resx delete mode 100644 src_vs2013/VSNDK.Package/Resources/BlackBerryMessager.bmp delete mode 100644 src_vs2013/VSNDK.Package/Resources/Calendar.bmp delete mode 100644 src_vs2013/VSNDK.Package/Resources/Camera.bmp delete mode 100644 src_vs2013/VSNDK.Package/Resources/CaptureScreen.bmp delete mode 100644 src_vs2013/VSNDK.Package/Resources/Contacts.bmp delete mode 100644 src_vs2013/VSNDK.Package/Resources/DeviceIdentifyingInfo.bmp delete mode 100644 src_vs2013/VSNDK.Package/Resources/EmailPINMessages.bmp delete mode 100644 src_vs2013/VSNDK.Package/Resources/File.ico delete mode 100644 src_vs2013/VSNDK.Package/Resources/GPSLocation.bmp delete mode 100644 src_vs2013/VSNDK.Package/Resources/Gamepad.bmp delete mode 100644 src_vs2013/VSNDK.Package/Resources/Images_24bit.bmp delete mode 100644 src_vs2013/VSNDK.Package/Resources/Images_32bit.bmp delete mode 100644 src_vs2013/VSNDK.Package/Resources/Internet.bmp delete mode 100644 src_vs2013/VSNDK.Package/Resources/Location.bmp delete mode 100644 src_vs2013/VSNDK.Package/Resources/Mircrophone.bmp delete mode 100644 src_vs2013/VSNDK.Package/Resources/MyContactInfo.bmp delete mode 100644 src_vs2013/VSNDK.Package/Resources/Notebooks.bmp delete mode 100644 src_vs2013/VSNDK.Package/Resources/Package.ico delete mode 100644 src_vs2013/VSNDK.Package/Resources/Phone.bmp delete mode 100644 src_vs2013/VSNDK.Package/Resources/PhoneControl.bmp delete mode 100644 src_vs2013/VSNDK.Package/Resources/PostNotifications.bmp delete mode 100644 src_vs2013/VSNDK.Package/Resources/Push.bmp delete mode 100644 src_vs2013/VSNDK.Package/Resources/RunBackgrounded.bmp delete mode 100644 src_vs2013/VSNDK.Package/Resources/SharedFiles.bmp delete mode 100644 src_vs2013/VSNDK.Package/Resources/TextMessages.bmp delete mode 100644 src_vs2013/VSNDK.Package/Resources/info.png delete mode 100644 src_vs2013/VSNDK.Package/Settings/Model/SettingsData.cs delete mode 100644 src_vs2013/VSNDK.Package/Settings/SettingsDialog.xaml delete mode 100644 src_vs2013/VSNDK.Package/Settings/SettingsDialog.xaml.cs delete mode 100644 src_vs2013/VSNDK.Package/Signing/Browser.Designer.cs delete mode 100644 src_vs2013/VSNDK.Package/Signing/Browser.cs delete mode 100644 src_vs2013/VSNDK.Package/Signing/Browser.resx delete mode 100644 src_vs2013/VSNDK.Package/Signing/DeRegisterWindow.xaml delete mode 100644 src_vs2013/VSNDK.Package/Signing/DeRegisterWindow.xaml.cs delete mode 100644 src_vs2013/VSNDK.Package/Signing/Models/SigningData.cs delete mode 100644 src_vs2013/VSNDK.Package/Signing/RegistrationWindow.xaml delete mode 100644 src_vs2013/VSNDK.Package/Signing/RegistrationWindow.xaml.cs delete mode 100644 src_vs2013/VSNDK.Package/Signing/SigningDialog.xaml delete mode 100644 src_vs2013/VSNDK.Package/Signing/SigningDialog.xaml.cs delete mode 100644 src_vs2013/VSNDK.Package/Templates/VCWizards/BlackBerry/BarDescriptor/Scripts/1033/default.js delete mode 100644 src_vs2013/VSNDK.Package/Templates/VCWizards/BlackBerry/BarDescriptor/Templates/1033/bar-descriptor.cs delete mode 100644 src_vs2013/VSNDK.Package/Templates/VCWizards/BlackBerry/BarDescriptor/Templates/1033/bar-descriptor.xml delete mode 100644 src_vs2013/VSNDK.Package/Templates/VCWizards/BlackBerry/BarDescriptor/Templates/1033/bar-descriptor.xsd delete mode 100644 src_vs2013/VSNDK.Package/Templates/VCWizards/BlackBerry/BarDescriptor/Templates/1033/templates.inf delete mode 100644 src_vs2013/VSNDK.Package/Templates/bar-descriptor.cs delete mode 100644 src_vs2013/VSNDK.Package/UpdateManager/Model/UpdateManagerData.cs delete mode 100644 src_vs2013/VSNDK.Package/UpdateManager/SimulatorManager.xaml delete mode 100644 src_vs2013/VSNDK.Package/UpdateManager/SimulatorManager.xaml.cs delete mode 100644 src_vs2013/VSNDK.Package/UpdateManager/UpdateManager.xaml delete mode 100644 src_vs2013/VSNDK.Package/UpdateManager/UpdateManager.xaml.cs delete mode 100644 src_vs2013/VSNDK.Package/UpdateManager/UpdateManagerDialog.xaml delete mode 100644 src_vs2013/VSNDK.Package/UpdateManager/UpdateManagerDialog.xaml.cs delete mode 100644 src_vs2013/VSNDK.Package/VSMacroRecorder.cs delete mode 100644 src_vs2013/VSNDK.Package/VSNDK.PackagePackage.cs delete mode 100644 src_vs2013/VSNDK.Package/VSNDKCommandEvents.cs delete mode 100644 src_vs2013/VSNDK.Package/VSNDKConstants.cs delete mode 100644 src_vs2013/VSNDK.Package/VSPackage.resx delete mode 100644 src_vs2013/VSNDK.Package/ViewModel.cs delete mode 100644 src_vs2013/VSNDK.Package/VsDesignerControl.xaml delete mode 100644 src_vs2013/VSNDK.Package/XmlEditorDesignerViewRegistration.cs delete mode 100644 src_vs2013/VSNDK.Package/bar-descriptor.cs diff --git a/.gitignore b/.gitignore index 72a0b144..4f3bec2c 100644 --- a/.gitignore +++ b/.gitignore @@ -44,7 +44,7 @@ src_vs2013/VSNDK.sln.DotSettings src_vs2013/VSNDK.v12.suo src_vs2013/GDBParser/GDBParser.vcxproj.user src_vs2013/VSNDK.AddIn/VSNDK.AddIn.csproj.user - +src_vs2013/VSNDK.Package/VSNDK.Package.csproj.user # build temp outputs src/Debug/ diff --git a/src/VSNDK.Package/DebugToken/DebugTokenDialog.xaml b/src/VSNDK.Package/DebugToken/DebugTokenDialog.xaml index ef1720f5..32105fca 100644 --- a/src/VSNDK.Package/DebugToken/DebugTokenDialog.xaml +++ b/src/VSNDK.Package/DebugToken/DebugTokenDialog.xaml @@ -1,19 +1,11 @@ - + Title="Debug Tokens" Height="198" Width="620" ShowInTaskbar="False" WindowStartupLocation="CenterOwner" ResizeMode="NoResize"> - - - - - - - - - + @@ -64,4 +56,4 @@ - + diff --git a/src/VSNDK.Package/DebugToken/DebugTokenDialog.xaml.cs b/src/VSNDK.Package/DebugToken/DebugTokenDialog.xaml.cs index ff3bc42a..3d6908b5 100644 --- a/src/VSNDK.Package/DebugToken/DebugTokenDialog.xaml.cs +++ b/src/VSNDK.Package/DebugToken/DebugTokenDialog.xaml.cs @@ -35,10 +35,11 @@ namespace RIM.VSNDK_Package.DebugToken /// /// Interaction logic for DebugTokenDialog.xaml /// - public partial class DebugTokenDialog : DialogWindow + public partial class DebugTokenDialog : Window { #region Member Variables and Constants private DebugTokenData deployTokenData; + private bool isRegistering = false; public bool IsClosing = false; #endregion @@ -47,23 +48,22 @@ public partial class DebugTokenDialog : DialogWindow /// public DebugTokenDialog() { - DebugTokenData._initializedCorrectly = true; + Mouse.OverrideCursor = Cursors.Wait; + deployTokenData = new DebugTokenData(); - InitializeComponent(); - - if (DebugTokenData._initializedCorrectly == false) + if (!DebugTokenData._initializedCorrectly) { - btnAdd.IsEnabled = false; - btnRefresh.IsEnabled = false; - IsClosing = true; - this.Close(); + Mouse.OverrideCursor = Cursors.Arrow; return; } - deployTokenData = gridMain.DataContext as DebugTokenData; + + InitializeComponent(); + + gridMain.DataContext = deployTokenData; if (deployTokenData.Error != "") { - MessageBox.Show(deployTokenData.Error, PkgResources.Errors); + MessageBox.Show(deployTokenData.Error, "Debug Tokens", MessageBoxButton.OK, MessageBoxImage.Error, MessageBoxResult.OK); deployTokenData.Error = ""; IsClosing = true; @@ -74,6 +74,7 @@ public DebugTokenDialog() btnAdd.IsEnabled = !deployTokenData.AlreadyRegistered; btnRefresh.IsEnabled = deployTokenData.AlreadyRegistered; + Mouse.OverrideCursor = Cursors.Arrow; } /// @@ -85,24 +86,26 @@ private void btnAdd_Click(object sender, RoutedEventArgs e) { try { - this.Cursor = Cursors.Wait; + Mouse.OverrideCursor = Cursors.Wait; - if (!(deployTokenData.addDevice(this))) + if (!isRegistering) { - deployTokenData.Error = ""; - e.Handled = true; - btnAdd.IsEnabled = false; - btnRefresh.IsEnabled = false; - } - else - { - btnAdd.IsEnabled = false; - btnRefresh.IsEnabled = true; + isRegistering = true; + + if (!(deployTokenData.addDevice(this))) + { + deployTokenData.Error = ""; + e.Handled = true; + } + + btnAdd.IsEnabled = !deployTokenData.AlreadyRegistered; + btnRefresh.IsEnabled = deployTokenData.AlreadyRegistered; } } finally { - this.Cursor = Cursors.Arrow; + isRegistering = false; + Mouse.OverrideCursor = Cursors.Arrow; } } @@ -114,22 +117,26 @@ private void btnAdd_Click(object sender, RoutedEventArgs e) /// private void btnRefresh_Click(object sender, RoutedEventArgs e) { - this.Cursor = Cursors.Wait; + Mouse.OverrideCursor = Cursors.Wait; - if (!(deployTokenData.refreshDevice(this))) - { - deployTokenData.Error = ""; - e.Handled = true; - btnAdd.IsEnabled = false; - btnRefresh.IsEnabled = false; - } - else + if (!isRegistering) { - btnAdd.IsEnabled = false; - btnRefresh.IsEnabled = true; + isRegistering = true; + + if (!(deployTokenData.refreshDevice(this))) + { + deployTokenData.Error = ""; + e.Handled = true; + } + + btnAdd.IsEnabled = !deployTokenData.AlreadyRegistered; + btnRefresh.IsEnabled = deployTokenData.AlreadyRegistered; + } - this.Cursor = Cursors.Arrow; + isRegistering = false; + Mouse.OverrideCursor = Cursors.Arrow; + } } diff --git a/src/VSNDK.Package/DebugToken/DebugTokenDictionary.xaml b/src/VSNDK.Package/DebugToken/DebugTokenDictionary.xaml deleted file mode 100644 index 77a99673..00000000 --- a/src/VSNDK.Package/DebugToken/DebugTokenDictionary.xaml +++ /dev/null @@ -1,5 +0,0 @@ - - - \ No newline at end of file diff --git a/src/VSNDK.Package/DebugToken/Model/DebugTokenData.cs b/src/VSNDK.Package/DebugToken/Model/DebugTokenData.cs index 8d1a004a..d545d1cc 100644 --- a/src/VSNDK.Package/DebugToken/Model/DebugTokenData.cs +++ b/src/VSNDK.Package/DebugToken/Model/DebugTokenData.cs @@ -24,6 +24,7 @@ using RIM.VSNDK_Package.Signing; using System.Windows.Forms; using System.ComponentModel; +using System.Windows.Input; namespace RIM.VSNDK_Package.DebugToken.Model { @@ -38,7 +39,7 @@ public class DebugTokenData : INotifyPropertyChanged private static string _deviceIP; private static string _devicePassword; - private static string _errors; + private static string _errors = ""; private static string _devicePin = "Not Attached"; private static string _companyName = ""; private static string _authorID = ""; @@ -204,11 +205,15 @@ public string AttachedDevice /// public DebugTokenData() { + _initializedCorrectly = true; refreshScreen(); } public bool resetPassword() { + System.Windows.Forms.Cursor currentCursor = System.Windows.Forms.Cursor.Current; + Mouse.OverrideCursor = System.Windows.Input.Cursors.Arrow; + _errors = ""; RegistrationWindow win = new RegistrationWindow(); win.ResizeMode = System.Windows.ResizeMode.NoResize; @@ -216,6 +221,9 @@ public bool resetPassword() if (res == true) KeyStorePassword = win.tbPassword.Password; + if (currentCursor.ToString().Contains("Wait")) + Mouse.OverrideCursor = System.Windows.Input.Cursors.Wait; + return res == true; } @@ -259,12 +267,10 @@ private void refreshScreen() _authorID = ""; _companyName = ""; _tmpTokenAuthor = ""; - if (_errors == null) - _errors = ""; if ((DeviceIP == "") || (DeviceIP == null)) { - MessageBox.Show("Missing Device IP", "Missing Device IP", MessageBoxButtons.OK, MessageBoxIcon.Error); + this.Error = "You have a missing or incorrect Device IP. Please check BlackBerry - Settings."; rkPluginRegKey.Close(); rkHKCU.Close(); _initializedCorrectly = false; @@ -327,6 +333,7 @@ private void refreshScreen() /// public bool addDevice(DebugTokenDialog parent) { + if (DevicePIN == "Not Attached") { _errors = "No device attached.\n"; @@ -339,30 +346,34 @@ public bool addDevice(DebugTokenDialog parent) return false; } - if (createDebugToken()) uploadDebugToken(); + bool validatePW = true; - if ((_errors.Contains("invalid password")) || (_errors.Contains("password is not valid")) || (_errors.Contains("invalid store password"))) + while (validatePW) { - MessageBox.Show("The specified password is invalid.\n\nPlease, enter the same one that you used to generate your BB ID Token.\n\nIf you don't remember it, you might close the next window, unregister and register again using BlackBerry -> Signing menu.",_errors, MessageBoxButtons.OK, MessageBoxIcon.Error); + if (createDebugToken()) uploadDebugToken(); - parent.Close(); - if (resetPassword()) + if ((_errors.Contains("invalid password")) || (_errors.Contains("password is not valid")) || (_errors.Contains("invalid store password"))) { - restart = true; + if (MessageBox.Show("The specified password is invalid.\n\nPlease, enter the same one that you used to generate your BB ID Token.\n\nIf you don't remember it, you can unregister and register again using BlackBerry -> Signing menu.", "Debug Tokens", MessageBoxButtons.RetryCancel, MessageBoxIcon.Error) == DialogResult.Cancel) + return false; + validatePW = true; + resetPassword(); + } + else + { + validatePW = false; } - return false; } - if (_errors.Contains("Cannot connect:")) + if (_errors != "") { - MessageBox.Show(_errors, "Cannot connect", MessageBoxButtons.OK, MessageBoxIcon.Error); + MessageBox.Show(_errors, "Debug Tokens", MessageBoxButtons.OK, MessageBoxIcon.Error); _initializedCorrectly = false; _tmpTokenAuthor = ""; _tmpAuthorID = ""; _authorID = ""; _companyName = ""; _tokenExpiryDate = ""; - DevicePIN = "Not Attached"; return false; } @@ -387,18 +398,23 @@ public bool refreshDevice(DebugTokenDialog parent) return false; } - if (createDebugToken()) uploadDebugToken(); + bool validatePW = true; - if ((_errors.Contains("invalid password")) || (_errors.Contains("password is not valid")) || (_errors.Contains("invalid store password"))) + while (validatePW) { - MessageBox.Show("The specified password is invalid.\n\nPlease, enter the same one that you used to generate your BB ID Token.\n\nIf you don't remember it, you might close the next window, unregister and register again using BlackBerry -> Signing menu.",_errors, MessageBoxButtons.OK, MessageBoxIcon.Error); + if (createDebugToken()) uploadDebugToken(); - parent.Close(); - if (resetPassword()) + if ((_errors.Contains("invalid password")) || (_errors.Contains("password is not valid")) || (_errors.Contains("invalid store password"))) { - restart = true; + if (MessageBox.Show("The specified password is invalid.\n\nPlease, enter the same one that you used to generate your BB ID Token.\n\nIf you don't remember it, you can unregister and register again using BlackBerry -> Signing menu.", _errors, MessageBoxButtons.RetryCancel, MessageBoxIcon.Error) == DialogResult.Cancel) + return false; + validatePW = true; + resetPassword(); + } + else + { + validatePW = false; } - return false; } if (_errors.Contains("Cannot connect:")) diff --git a/src/VSNDK.Package/Import/Import.xaml b/src/VSNDK.Package/Import/Import.xaml index 184245fd..b468edc3 100644 --- a/src/VSNDK.Package/Import/Import.xaml +++ b/src/VSNDK.Package/Import/Import.xaml @@ -4,15 +4,7 @@ xmlns:ui="clr-namespace:Microsoft.VisualStudio.PlatformUI;assembly=Microsoft.VisualStudio.Shell.10.0" Title="Import Summary" Height="335" Width="729" ResizeMode="NoResize"> - - - - - - - - - + diff --git a/src/VSNDK.Package/Import/Import.xaml.cs b/src/VSNDK.Package/Import/Import.xaml.cs index 5222f1b5..9dc2d670 100644 --- a/src/VSNDK.Package/Import/Import.xaml.cs +++ b/src/VSNDK.Package/Import/Import.xaml.cs @@ -44,6 +44,7 @@ public partial class Import : DialogWindow private Project _project; private string _sourceDir; private string _destDir; + private ImportModel _data; /// /// Import Constructor @@ -51,6 +52,9 @@ public partial class Import : DialogWindow public Import() { InitializeComponent(); + + _data = new ImportModel(); + gridMain.DataContext = _data; } /// @@ -63,6 +67,9 @@ public Import(Project project, string sourceDir, string destDir) { InitializeComponent(); + _data = new ImportModel(); + gridMain.DataContext = _data; + _project = project; _sourceDir = sourceDir; _destDir = destDir; diff --git a/src/VSNDK.Package/Import/ImportDictionary.xaml b/src/VSNDK.Package/Import/ImportDictionary.xaml deleted file mode 100644 index ffd88866..00000000 --- a/src/VSNDK.Package/Import/ImportDictionary.xaml +++ /dev/null @@ -1,7 +0,0 @@ - - - - - \ No newline at end of file diff --git a/src/VSNDK.Package/Import/Model/ImportModel.cs b/src/VSNDK.Package/Import/Model/ImportModel.cs index 743d0a1b..dcf27168 100644 --- a/src/VSNDK.Package/Import/Model/ImportModel.cs +++ b/src/VSNDK.Package/Import/Model/ImportModel.cs @@ -266,7 +266,6 @@ public void AddBlackBerryConfigurations(Project proj) AddSummaryString("Added BlackBerry Configuration"); cfgs = mgr.AddPlatform(BLACKBERRYSIMULATOR, "Win32", true); AddSummaryString("Added BlackBerry Simulator Configuration"); - mgr.DeletePlatform("Win32"); } catch (Exception e) { diff --git a/src/VSNDK.Package/NameValueCollectionHelper.cs b/src/VSNDK.Package/NameValueCollectionHelper.cs index 2ab96a9f..078f5364 100644 --- a/src/VSNDK.Package/NameValueCollectionHelper.cs +++ b/src/VSNDK.Package/NameValueCollectionHelper.cs @@ -18,7 +18,7 @@ using System.Text; using System.Collections.Specialized; -namespace VSNDK.Package +namespace RIM.VSNDK_Package { /// /// diff --git a/src/VSNDK.Package/Resources.Designer.cs b/src/VSNDK.Package/Resources.Designer.cs index e3460bdb..b1ab3cd2 100644 --- a/src/VSNDK.Package/Resources.Designer.cs +++ b/src/VSNDK.Package/Resources.Designer.cs @@ -1,7 +1,7 @@ //------------------------------------------------------------------------------ // // This code was generated by a tool. -// Runtime Version:4.0.30319.18052 +// Runtime Version:4.0.30319.34014 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. @@ -97,7 +97,7 @@ internal static string CSJConfirmPasswordMissing { } /// - /// Looks up a localized string similar to You have to specify BlackBerry ID token password and it must be at least 6 characters long. + /// Looks up a localized string similar to You have to specify a BlackBerry ID token password and it must be at least 6 characters long. /// internal static string CSJPasswordMissing { get { diff --git a/src/VSNDK.Package/Resources.resx b/src/VSNDK.Package/Resources.resx index f36f2e36..88124891 100644 --- a/src/VSNDK.Package/Resources.resx +++ b/src/VSNDK.Package/Resources.resx @@ -124,7 +124,7 @@ You have to specify a confirm password - You have to specify BlackBerry ID token password and it must be at least 6 characters long + You have to specify a BlackBerry ID token password and it must be at least 6 characters long You have to provide the Pin diff --git a/src/VSNDK.Package/Settings/Model/SettingsData.cs b/src/VSNDK.Package/Settings/Model/SettingsData.cs index 0bfeefdd..03e21cd0 100644 --- a/src/VSNDK.Package/Settings/Model/SettingsData.cs +++ b/src/VSNDK.Package/Settings/Model/SettingsData.cs @@ -265,13 +265,19 @@ public void getDeviceInfo() if (pwd != null) DevicePassword = GlobalFunctions.Decrypt(pwd.ToString()); + } + catch + { + } + + try + { object ip = rkSettingsPath.GetValue("device_IP"); if (ip != null) DeviceIP = ip.ToString(); } catch { - } rkSettingsPath.Close(); @@ -294,14 +300,19 @@ public void getSimulatorInfo() object pwd = rkSettingsPath.GetValue("simulator_password"); if (pwd != null) SimulatorPassword = GlobalFunctions.Decrypt(pwd.ToString()); - + } + catch + { + } + + try + { object ip = rkSettingsPath.GetValue("simulator_IP"); if (ip != null) SimulatorIP = ip.ToString(); } catch { - } rkSettingsPath.Close(); diff --git a/src/VSNDK.Package/Settings/SettingsDialog.xaml b/src/VSNDK.Package/Settings/SettingsDialog.xaml index 74898472..e11d80ea 100644 --- a/src/VSNDK.Package/Settings/SettingsDialog.xaml +++ b/src/VSNDK.Package/Settings/SettingsDialog.xaml @@ -1,8 +1,8 @@ - + Title="Settings" Height="334" Width="627" ResizeMode="NoResize"> @@ -45,5 +45,5 @@ - + diff --git a/src/VSNDK.Package/Settings/SettingsDialog.xaml.cs b/src/VSNDK.Package/Settings/SettingsDialog.xaml.cs index 4ed8cb98..b32f926f 100644 --- a/src/VSNDK.Package/Settings/SettingsDialog.xaml.cs +++ b/src/VSNDK.Package/Settings/SettingsDialog.xaml.cs @@ -42,7 +42,7 @@ namespace RIM.VSNDK_Package.Settings /// /// Interaction logic for Settings.xaml /// - public partial class SettingsDialog : DialogWindow + public partial class SettingsDialog : Window { private SettingsData _data; @@ -92,9 +92,14 @@ private void Update_Click(object sender, RoutedEventArgs e) UpdateManager.UpdateManager updateManager = UpdateManager.UpdateManager.create(); - _data.RefreshScreen(); - NDKEntry.ItemsSource = null; - NDKEntry.ItemsSource = _data.NDKEntries; + if (updateManager != null) + { + updateManager.ShowDialog(); + + _data.RefreshScreen(); + NDKEntry.ItemsSource = null; + NDKEntry.ItemsSource = _data.NDKEntries; + } this.Cursor = System.Windows.Input.Cursors.Hand; diff --git a/src/VSNDK.Package/Signing/Browser.Designer.cs b/src/VSNDK.Package/Signing/Browser.Designer.cs index 7053adac..5c5d178f 100644 --- a/src/VSNDK.Package/Signing/Browser.Designer.cs +++ b/src/VSNDK.Package/Signing/Browser.Designer.cs @@ -116,7 +116,7 @@ public void webBrowser1_Navigating(object sender, WebBrowserNavigatingEventArgs System.Text.Encoding ec = System.Text.Encoding.GetEncoding("utf-8"); System.IO.StreamReader reader = new System.IO.StreamReader(stream, ec); - // Creating the bbidtoken.csk file + // Save the CSK file.. File.WriteAllText(signingData.bbidtokenPath, reader.ReadToEnd()); reader.Close(); diff --git a/src/VSNDK.Package/Signing/DeRegisterWindow.xaml b/src/VSNDK.Package/Signing/DeRegisterWindow.xaml index 7ed307e3..80a36323 100644 --- a/src/VSNDK.Package/Signing/DeRegisterWindow.xaml +++ b/src/VSNDK.Package/Signing/DeRegisterWindow.xaml @@ -2,7 +2,7 @@ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:ui="clr-namespace:Microsoft.VisualStudio.PlatformUI;assembly=Microsoft.VisualStudio.Shell.10.0" - Title="Unregister Window" Height="96" Width="403"> + Title="Unregister Window" Height="96" Width="403" ResizeMode="NoResize"> diff --git a/src/VSNDK.Package/Signing/Models/PasswordBoxAssistant.cs b/src/VSNDK.Package/Signing/Models/PasswordBoxAssistant.cs deleted file mode 100644 index d1f9fa31..00000000 --- a/src/VSNDK.Package/Signing/Models/PasswordBoxAssistant.cs +++ /dev/null @@ -1,110 +0,0 @@ -//* Copyright 2010-2011 Research In Motion Limited. -//* -//* Licensed under the Apache License, Version 2.0 (the "License"); -//* you may not use this file except in compliance with the License. -//* You may obtain a copy of the License at -//* -//* http://www.apache.org/licenses/LICENSE-2.0 -//* -//* Unless required by applicable law or agreed to in writing, software -//* distributed under the License is distributed on an "AS IS" BASIS, -//* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//* See the License for the specific language governing permissions and -//* limitations under the License. - -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Windows; -using System.Windows.Controls; - -namespace RIM.VSNDK_Package.Signing.Models -{ - //Attache property for binding passwordbox - //see src @ http://blog.functionalfun.net/2008/06/wpf-passwordbox-and-data-binding.html - public static class PasswordBoxAssistant - { - public static readonly DependencyProperty BoundPassword = DependencyProperty.RegisterAttached("BoundPassword", typeof(string), - typeof(PasswordBoxAssistant), new PropertyMetadata(string.Empty, OnBoundPasswordChanged)); - public static readonly DependencyProperty BindPassword = DependencyProperty.RegisterAttached("BindPassword", typeof (bool), - typeof (PasswordBoxAssistant), new PropertyMetadata(false, OnBindPasswordChanged)); - private static readonly DependencyProperty UpdatingPassword = DependencyProperty.RegisterAttached("UpdatingPassword", - typeof(bool), typeof(PasswordBoxAssistant), new PropertyMetadata(false)); - - private static void OnBoundPasswordChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) - { - PasswordBox box = d as PasswordBox; - // only handle this event when the property is attached to a PasswordBox - // and when the BindPassword attached property has been set to true - if (d == null || !GetBindPassword(d)) - { - return; - } - // avoid recursive updating by ignoring the box's changed event - box.PasswordChanged -= HandlePasswordChanged; - string newPassword = (string)e.NewValue; - if (!GetUpdatingPassword(box)) - { - box.Password = newPassword; - } - box.PasswordChanged += HandlePasswordChanged; - } - - private static void OnBindPasswordChanged(DependencyObject dp, DependencyPropertyChangedEventArgs e) - { - // when the BindPassword attached property is set on a PasswordBox, - // start listening to its PasswordChanged event - PasswordBox box = dp as PasswordBox; - if (box == null) - { - return; - } - bool wasBound = (bool)(e.OldValue); - bool needToBind = (bool)(e.NewValue); - if (wasBound) - { - box.PasswordChanged -= HandlePasswordChanged; - } - if (needToBind) - { - box.PasswordChanged += HandlePasswordChanged; - } - } - private static void HandlePasswordChanged(object sender, RoutedEventArgs e) - { - PasswordBox box = sender as PasswordBox; - // set a flag to indicate that we're updating the password - SetUpdatingPassword(box, true); - // push the new password into the BoundPassword property - SetBoundPassword(box, box.Password); - SetUpdatingPassword(box, false); - } - - public static void SetBindPassword(DependencyObject dp, bool value) - { - dp.SetValue(BindPassword, value); - } - public static bool GetBindPassword(DependencyObject dp) - { - return (bool)dp.GetValue(BindPassword); - } - public static string GetBoundPassword(DependencyObject dp) - { - return (string)dp.GetValue(BoundPassword); - } - public static void SetBoundPassword(DependencyObject dp, string value) - { - dp.SetValue(BoundPassword, value); - } - - private static bool GetUpdatingPassword(DependencyObject dp) - { - return (bool)dp.GetValue(UpdatingPassword); - } - private static void SetUpdatingPassword(DependencyObject dp, bool value) - { - dp.SetValue(UpdatingPassword, value); - } - } -} diff --git a/src/VSNDK.Package/Signing/Models/SigningData.cs b/src/VSNDK.Package/Signing/Models/SigningData.cs index 6d7b5c67..7f6336cd 100644 --- a/src/VSNDK.Package/Signing/Models/SigningData.cs +++ b/src/VSNDK.Package/Signing/Models/SigningData.cs @@ -140,7 +140,7 @@ public string Messages /// Path to destination zip file public void Backup(string toZipFile) { - using (Package pkg = Package.Open(CertPath + toZipFile, FileMode.Create)) + using (Package pkg = Package.Open(toZipFile, FileMode.Create)) { AddUriToPackage(_p12, pkg); AddUriToPackage(_tokencsk, pkg); @@ -173,6 +173,11 @@ private void setPassword(string password) public bool Register(string authorID, string password) { bool success = false; + if (authorID.Trim().ToUpper().Contains("BLACKBERRY")) + { + _errors += "BlackBerry is a reserved word and cannot be used in \"author name\".\n"; + return false; + } System.Diagnostics.Process p = new System.Diagnostics.Process(); System.Diagnostics.ProcessStartInfo startInfo = p.StartInfo; startInfo.UseShellExecute = false; diff --git a/src/VSNDK.Package/Signing/RegistrationWindow.xaml b/src/VSNDK.Package/Signing/RegistrationWindow.xaml index df712e55..f4f0b7f5 100644 --- a/src/VSNDK.Package/Signing/RegistrationWindow.xaml +++ b/src/VSNDK.Package/Signing/RegistrationWindow.xaml @@ -3,7 +3,7 @@ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="Registration Window" mc:Ignorable="d" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" - d:DesignHeight="155" d:DesignWidth="536" SizeToContent="WidthAndHeight" ShowInTaskbar="False" WindowStartupLocation="CenterOwner"> + d:DesignHeight="155" d:DesignWidth="536" SizeToContent="WidthAndHeight" ShowInTaskbar="False" WindowStartupLocation="CenterOwner" ResizeMode="NoResize"> diff --git a/src/VSNDK.Package/Signing/RegistrationWindow.xaml.cs b/src/VSNDK.Package/Signing/RegistrationWindow.xaml.cs index a07778a3..41f8fa22 100644 --- a/src/VSNDK.Package/Signing/RegistrationWindow.xaml.cs +++ b/src/VSNDK.Package/Signing/RegistrationWindow.xaml.cs @@ -68,9 +68,7 @@ private void btnOk_Click(object sender, RoutedEventArgs e) MessageBox.Show(signingData.Messages, "Registration Window", MessageBoxButton.OK, MessageBoxImage.Information, MessageBoxResult.OK); signingData.Messages = null; } - - signingData.Register("", ""); - + DialogResult = true; } diff --git a/src/VSNDK.Package/Signing/SigningDialog.xaml b/src/VSNDK.Package/Signing/SigningDialog.xaml index d4a092f6..6b1c91c5 100644 --- a/src/VSNDK.Package/Signing/SigningDialog.xaml +++ b/src/VSNDK.Package/Signing/SigningDialog.xaml @@ -2,7 +2,7 @@ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:ui="clr-namespace:Microsoft.VisualStudio.PlatformUI;assembly=Microsoft.VisualStudio.Shell.10.0" - Title="Code Signing Properties" Height="285" Width="660" WindowStartupLocation="CenterOwner" ShowInTaskbar="False"> + Title="Code Signing Properties" Height="285" Width="660" WindowStartupLocation="CenterOwner" ShowInTaskbar="False" ResizeMode="NoResize"> diff --git a/src/VSNDK.Package/Signing/SigningDialog.xaml.cs b/src/VSNDK.Package/Signing/SigningDialog.xaml.cs index c6ab82ab..3009d379 100644 --- a/src/VSNDK.Package/Signing/SigningDialog.xaml.cs +++ b/src/VSNDK.Package/Signing/SigningDialog.xaml.cs @@ -58,7 +58,7 @@ private void btnRegister_Click(object sender, RoutedEventArgs e) Browser wb = new Browser(this); wb.ShowDialog(); - if (!signingData.Registered) + if ((!signingData.Registered) && (File.Exists(signingData.bbidtokenPath))) { RegistrationWindow win = new RegistrationWindow(); win.ResizeMode = System.Windows.ResizeMode.NoResize; diff --git a/src/VSNDK.Package/UpdateManager/Model/UpdateManagerData.cs b/src/VSNDK.Package/UpdateManager/Model/UpdateManagerData.cs index 5a4e46df..7219b99a 100644 --- a/src/VSNDK.Package/UpdateManager/Model/UpdateManagerData.cs +++ b/src/VSNDK.Package/UpdateManager/Model/UpdateManagerData.cs @@ -74,6 +74,7 @@ public class UpdateManagerData : INotifyPropertyChanged private List installedNDKList; private List installedRuntimeList; private string _deviceosversion; + private string _outputPath = ""; #endregion @@ -88,9 +89,54 @@ public UpdateManagerData() installedAPIList = InstalledAPIListSingleton.Instance._installedAPIList; installedNDKList = InstalledNDKListSingleton.Instance._installedNDKList; - APITargets = new CollectionView(APITargetListSingleton.Instance._tempAPITargetList); - Simulators = new CollectionView(SimulatorListSingleton.Instance._simulatorList); - + + if (APITargetListSingleton.Instance._tempAPITargetList == null) + { + APITargetListSingleton.Instance.RefreshData(); + } + if (APITargetListSingleton.Instance._tempAPITargetList != null) + { + APITargets = new CollectionView(APITargetListSingleton.Instance._tempAPITargetList); + + if (SimulatorListSingleton.Instance._simulatorList == null) + { + SimulatorListSingleton.Instance.RefreshData(); + } + if (SimulatorListSingleton.Instance._simulatorList != null) + { + Simulators = new CollectionView(SimulatorListSingleton.Instance._simulatorList); + } + } + } + + /// + /// Constructor + /// + public UpdateManagerData(string outputPath) + { + Status = ""; + + installedAPIList = InstalledAPIListSingleton.Instance._installedAPIList; + installedNDKList = InstalledNDKListSingleton.Instance._installedNDKList; + + if (APITargetListSingleton.Instance._tempAPITargetList == null) + { + APITargetListSingleton.Instance.RefreshData(); + } + if (APITargetListSingleton.Instance._tempAPITargetList != null) + { + APITargets = new CollectionView(APITargetListSingleton.Instance._tempAPITargetList); + + if (SimulatorListSingleton.Instance._simulatorList == null) + { + SimulatorListSingleton.Instance.RefreshData(); + } + if (SimulatorListSingleton.Instance._simulatorList != null) + { + Simulators = new CollectionView(SimulatorListSingleton.Instance._simulatorList); + } + } + _outputPath = outputPath; } /// @@ -102,20 +148,26 @@ public void FilterSubList(string apiLevel) Simulators2 = new CollectionView(SimulatorListSingleton.Instance._simulatorList.FindAll(i => i.APILevel.Contains(apiLevel))); } + /// /// Refresh all the lists /// public void RefreshScreen() { - //((VSNDK_PackagePackage)_pkg).GetInstalledAPIList(); - //// ((VSNDK_PackagePackage)_pkg).GetAvailableAPIList(); - //((VSNDK_PackagePackage)_pkg).GetInstalledSimulatorList(); - //((VSNDK_PackagePackage)_pkg).GetSimulatorList(); + InstalledAPIListSingleton.Instance.RefreshData(); + installedAPIList = InstalledAPIListSingleton.Instance._installedAPIList; + APITargetListSingleton.Instance.RefreshData(); + APITargets = new CollectionView(APITargetListSingleton.Instance._tempAPITargetList); + } - //installedAPIList = ((VSNDK_PackagePackage)_pkg).InstalledAPIList; - //installedNDKList = ((VSNDK_PackagePackage)_pkg).InstalledNDKList; - //APITargets = new CollectionView(((VSNDK_PackagePackage)_pkg).APITargetList); - //Simulators = new CollectionView(((VSNDK_PackagePackage)_pkg).SimulatorList); + /// + /// Refresh all the lists + /// + public void RefreshSimulatorScreen() + { + InstalledSimulatorListSingleton.Instance.RefreshData(); + SimulatorListSingleton.Instance.RefreshData(); + Simulators = new CollectionView(SimulatorListSingleton.Instance._simulatorList); } /// @@ -130,9 +182,17 @@ public bool InstallAPI(string version, bool isRuntime, bool isSimulator) _isSimulator = isSimulator; _error = ""; - installVersion = version; + if (version == "default") + { + installVersion = GetDefaultLevel(); + } + else + { + installVersion = version; + } + - Status = "Installing API Level"; + Status = "Installing..."; System.Diagnostics.Process p = new System.Diagnostics.Process(); System.Diagnostics.ProcessStartInfo startInfo = p.StartInfo; @@ -147,7 +207,7 @@ public bool InstallAPI(string version, bool isRuntime, bool isSimulator) /// Get Device PIN startInfo.FileName = "cmd.exe"; - startInfo.Arguments = string.Format(@"/C " + bbndkPathConst + @"\eclipsec --install {0} {1} {2}", version, isRuntime ? "--runtime" : "", isSimulator ? "--simulator" : ""); + startInfo.Arguments = string.Format(@"/C " + bbndkPathConst + @"\eclipsec --install {0} {1} {2}", installVersion, isRuntime ? "--runtime" : "", isSimulator ? "--simulator" : ""); try { @@ -203,8 +263,15 @@ public void cancelInstallation() { foreach (int pid in installProcessID) { - var p = System.Diagnostics.Process.GetProcessById(pid); - p.Kill(); + try + { + var p = System.Diagnostics.Process.GetProcessById(pid); + p.Kill(); + } + catch + { + + } } } @@ -215,6 +282,27 @@ public void cancelInstallation() /// true if successful public bool UninstallAPI(string version, bool isSimulator) { + if (isSimulator) + { + string name = bbndkPathConst + @"\simulator_" + version.Replace('.', '_'); + ManagementObjectSearcher searcher = new ManagementObjectSearcher("SELECT * FROM Win32_Process"); + ManagementObjectCollection collection = searcher.Get(); + foreach (ManagementObject item in collection) + { + try + { + if (item["CommandLine"].ToString().Contains(name)) + { + MessageBox.Show("The selected simulator is being used.\n\nPlease, close the simulator and try again.", "Cannot uninstall the simulator", MessageBoxButton.OK, MessageBoxImage.Warning); + return false; + } + } + catch + { + } + } + } + bool success = false; _error = ""; _isSimulator = isSimulator; @@ -301,7 +389,7 @@ public void getDeviceSimInfo(bool isSim) /// Check version number /// Check API name /// true if installed - private int IsAPIInstalled(string version, string name, bool allowSubstringVersion) + private int IsAPIInstalled(string version, string name) { int success = 0; @@ -309,34 +397,23 @@ private int IsAPIInstalled(string version, string name, bool allowSubstringVersi if (version.StartsWith("2.1.0")) version = "2.1.0"; - while ((success == 0) && (version.Contains('.'))) + if (InstalledAPIListSingleton.Instance._installedAPIList != null) { - if (InstalledAPIListSingleton.Instance._installedAPIList != null) - { - APIClass result = InstalledAPIListSingleton.Instance._installedAPIList.Find(i => i.Version.Contains(version)); - - if (result != null) - { - success = 1; - } - } + APIClass result = InstalledAPIListSingleton.Instance._installedAPIList.FindLast(i => i.Version.Contains(version)); - if (InstalledNDKListSingleton.Instance._installedNDKList != null) + if (result != null) { - APIClass result = InstalledNDKListSingleton.Instance._installedNDKList.Find(i => i.Version.Contains(version)); - - if (result != null) - { - success = 2; - } + success = 1; } + } - if (!allowSubstringVersion) - break; + if (InstalledNDKListSingleton.Instance._installedNDKList != null) + { + APIClass result = InstalledNDKListSingleton.Instance._installedNDKList.FindLast(i => i.Version.Contains(version)); - if (success == 0) + if (result != null) { - version = version.Substring(0, version.LastIndexOf('.')); + success = 2; } } @@ -352,98 +429,166 @@ public bool validateDeviceVersion(bool isSim) { bool retVal = false; string baseVersion = "10.2.0.0"; + string currentAPIVersion = getCurrentAPIVersion(); DebugTokenData dtokenData; if (!isSim) + { dtokenData = new DebugTokenData(); + string LocalFolder = System.Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + @"\Research In Motion\"; + string CertPath = LocalFolder + "author.p12"; + + if (!File.Exists(CertPath)) + { + return false; + } + } getDeviceSimInfo(isSim); if (getDeviceInfo()) - { //** Device Info retrieved - validate API's - if (getCurrentAPIVersion() != _deviceosversion) - { //** Currently selected API version is different from attached device OS version. - if (IsAPIInstalled(_deviceosversion, "", false) > 0) + { + string buildVersion = getBuildVersion(); + if ((buildVersion != "") && (_deviceosversion != "") && (compareVersions(_deviceosversion, buildVersion) < 0)) + { + if (isSim) + { + MessageBox.Show("The simulator operating system does not support the API level used to build the app.\n\nSimulator operating system version: " + _deviceosversion + "\nAPI level version used to build the app: " + buildVersion + "\n\nPlease select an API level that is supported by the operating system and rebuild the project before start debugging.", "API level not supported by the simulator's operating system", MessageBoxButton.OK, MessageBoxImage.Error); + } + else + { + MessageBox.Show("The device operating system does not support the API level used to build the app.\n\nDevice operating system version: " + _deviceosversion + "\nAPI level version used to build the app: " + buildVersion + "\n\nPlease select an API level that is supported by the operating system and rebuild the project before start debugging.", "API level not supported by the device's operating system", MessageBoxButton.OK, MessageBoxImage.Error); + } + return false; + } + + if (_deviceosversion == currentAPIVersion) + { + SetRuntime(""); + retVal = true; + } + else if ((_deviceosversion.Substring(0, 4) == "10.1") || (_deviceosversion.Substring(0, 4) == "10.0")) + { + SetRuntime(""); + if (IsAPIInstalled(_deviceosversion, "") > 0) { retVal = true; } else { - if (baseVersion.CompareTo(_deviceosversion) > 0) + UpdateManagerDialog umd = new UpdateManagerDialog("The API Level for the operating system version of the attached device is not currently installed. Would you like to install it now?", _deviceosversion, false, false); + + if (umd.ShowDialog() == true) { - UpdateManagerDialog umd = new UpdateManagerDialog("The API Level for the operating system version of the attached device is not currently installed. Would you like to install it now?", _deviceosversion, false, false); - - if (umd.ShowDialog() == true) - { - retVal = true; - } - else - { - retVal = false; - } + retVal = true; } else { - if (IsRuntimeInstalled(_deviceosversion)) - { - retVal = true; - } - else - { - if (IsAPIInstalled(_deviceosversion.Substring(0, _deviceosversion.LastIndexOf('.')), "", true) == 0) - { - string apiLevel = GetAPILevel(_deviceosversion.Substring(0, _deviceosversion.LastIndexOf('.'))); - - if (apiLevel != "") - { - UpdateManagerDialog umd = new UpdateManagerDialog("The API Level for the operating system version of the attached device is not currently installed. Would you like to install it now?", apiLevel, false, false); - if (umd.ShowDialog() == true) - { - umd = new UpdateManagerDialog("The Runtime Libraries for the operating system version of the attached device are not currently installed. Would you like to install them now?", _deviceosversion, true, false); - if (umd.ShowDialog() == true) - { - retVal = true; - } - else - { - retVal = false; - } - } - else - { - retVal = false; - } - } - else - MessageBox.Show("API level not supported at this moment.\n\nAborting...", "API level not supported", MessageBoxButton.OK, MessageBoxImage.Error); - } - else - { - UpdateManagerDialog umd = new UpdateManagerDialog("The Runtime Libraries for the operating system version of the attached device are not currently installed. Would you like to install them now?", _deviceosversion, true, false); - if (umd.ShowDialog() == true) - { - retVal = true; - } - else - { - retVal = false; - } - } - } + retVal = false; } } } - else + else if (IsRuntimeInstalled(_deviceosversion)) { + SetRuntime(_deviceosversion); retVal = true; } + else + { + UpdateManagerDialog umd = new UpdateManagerDialog("The Runtime Libraries for the operating system version of the attached device are not currently installed. Would you like to install them now?", _deviceosversion, true, false); + if (umd.ShowDialog() == true) + { + // runtime was already set by the Update Manager. + retVal = true; + } + else + { + SetRuntime(""); + retVal = false; + } + } } - else + + return retVal; + } + + private string getBuildVersion() + { + string makefile = ""; + System.IO.StreamReader readMakefile = null; + try + { + readMakefile = new System.IO.StreamReader(_outputPath + @"\makefile"); + makefile = readMakefile.ReadToEnd(); + readMakefile.Close(); + } + catch (Exception e) { - retVal = false; + return ""; } - return retVal; + int pos = makefile.IndexOf(bbndkPathConst.Replace('\\','/') + @"/target_"); + if (pos == -1) + return ""; + pos += 19; + int end = makefile.IndexOf('/', pos); + if (end == -1) + return ""; + + return (makefile.Substring(pos, end - pos).Replace('_','.')); + + } + + private int compareVersions(string str1, string str2) + { + int n1, n2; + do + { + int pos = str1.IndexOf('.'); + if (pos == -1) + { + n1 = Convert.ToInt32(str1); + str1 = ""; + } + else + { + n1 = Convert.ToInt32(str1.Substring(0, pos)); + str1 = str1.Substring(pos + 1); + } + + pos = str2.IndexOf('.'); + if (pos == -1) + { + n2 = Convert.ToInt32(str2); + str2 = ""; + } + else + { + n2 = Convert.ToInt32(str2.Substring(0, pos)); + str2 = str2.Substring(pos + 1); + } + + if (n1 > n2) + return 1; + else if (n2 > n1) + return -1; + + } while ((str1 != "") && (str2 != "")); + + if (str1 != "") + { + str1 = str1.Replace(".",""); + if (Convert.ToInt32(str1) != 0) + return 1; + } + else if (str2 != "") + { + str2 = str2.Replace(".", ""); + if (Convert.ToInt32(str2) != 0) + return -1; + } + + return 0; } /// @@ -735,7 +880,10 @@ public void SetRuntime(string version) try { - string remotePath = bbndkPathConst + @"\runtime_" + version.Replace('.', '_') + @"\qnx6\armle-v7\"; + string remotePath = ""; + + if (version != "") + remotePath = bbndkPathConst + @"\runtime_" + version.Replace('.', '_') + @"\qnx6\armle-v7\"; rkNDKPath = rkHKCU.CreateSubKey("Software\\BlackBerry\\BlackBerryVSPlugin"); rkNDKPath.SetValue("NDKRemotePath", remotePath); @@ -755,9 +903,19 @@ public void SetRuntime(string version) public void SetSelectedAPI(string version) { + /// Set default version + if (version == "default") + { + installVersion = GetDefaultLevel(); + } + else + { + installVersion = version; + } + if (installedAPIList != null) { - APIClass result = installedAPIList.Find(i => i.Version.Contains(version)); + APIClass result = installedAPIList.Find(i => i.Version.Contains(installVersion)); if (result != null) { @@ -859,7 +1017,7 @@ public string GetAPILevel(string version) { string retVal = ""; - while ((retVal == "") && (version.Contains('.'))) + while (retVal == "") { if (APITargetListSingleton.Instance._tempAPITargetList != null) { @@ -873,7 +1031,33 @@ public string GetAPILevel(string version) if (retVal == "") { - version = version.Substring(0, version.LastIndexOf('.')); + int lastDot = version.LastIndexOf('.'); + if (lastDot != -1) + version = version.Substring(0, lastDot); + else + break; + } + } + + return retVal; + } + + /// + /// Given a runtime version get the associated API Level version. + /// + /// + /// + public string GetDefaultLevel() + { + string retVal = ""; + + if (APITargetListSingleton.Instance._tempAPITargetList != null) + { + APITargetClass apiLevel = APITargetListSingleton.Instance._tempAPITargetList.FindLast(i => i.IsDefault.Contains("True")); + + if (apiLevel != null) + { + retVal = apiLevel.TargetVersion; } } @@ -889,9 +1073,28 @@ private void p_Exited(object sender, System.EventArgs e) { isConfiguring = false; - if (_error != "") + if (_errors != "") + { + Status = "Error"; + IsInstalling = false; + installed = true; + + if (!GlobalFunctions.isOnline()) + { + MessageBox.Show("You are currently experiencing internet connection issues and cannot access the Update Manager server. Please check your connection or try again later.", "Settings", MessageBoxButton.OK, MessageBoxImage.Warning, MessageBoxResult.OK); + } + else + { + MessageBox.Show(_errors, "Update Manager", MessageBoxButton.OK, MessageBoxImage.Error, MessageBoxResult.OK); + } + + RefreshScreen(); + } + else if (_error != "") { Status = "Error"; + IsInstalling = false; + installed = true; MessageBox.Show(_error, "Update Manager", MessageBoxButton.OK, MessageBoxImage.Error, MessageBoxResult.OK); @@ -901,26 +1104,25 @@ private void p_Exited(object sender, System.EventArgs e) else { Status = "Complete"; - - RefreshScreen(); - - //if (installVersion != "") - //{ - // SetSelectedAPI(installVersion); + IsInstalling = false; + installed = true; if (_isRuntime) { SetRuntime(installVersion); _isRuntime = false; } + else if (_isSimulator) + { + RefreshSimulatorScreen(); + } + else + { + RefreshScreen(); + SetSelectedAPI(installVersion); + } - // installVersion = ""; - - installVersion = ""; - - installed = true; } - // IsInstalling = false; } /// diff --git a/src/VSNDK.Package/UpdateManager/SimulatorManager.xaml b/src/VSNDK.Package/UpdateManager/SimulatorManager.xaml index e276e8bf..5de1e504 100644 --- a/src/VSNDK.Package/UpdateManager/SimulatorManager.xaml +++ b/src/VSNDK.Package/UpdateManager/SimulatorManager.xaml @@ -3,7 +3,7 @@ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:ui="clr-namespace:Microsoft.VisualStudio.PlatformUI;assembly=Microsoft.VisualStudio.Shell.10.0" xmlns:pa="clr-namespace:RIM.VSNDK_Package.UpdateManager.Model" - Title="Simulators" Height="483" Width="613" ShowInTaskbar="False" WindowStartupLocation="CenterOwner" ResizeMode="NoResize" Topmost="True" Closing="Window_Closing"> + Title="Simulators" Height="483" Width="613" ShowInTaskbar="False" WindowStartupLocation="CenterOwner" ResizeMode="NoResize" Closing="Window_Closing"> diff --git a/src/VSNDK.Package/UpdateManager/SimulatorManager.xaml.cs b/src/VSNDK.Package/UpdateManager/SimulatorManager.xaml.cs index a2bc2320..c7228e12 100644 --- a/src/VSNDK.Package/UpdateManager/SimulatorManager.xaml.cs +++ b/src/VSNDK.Package/UpdateManager/SimulatorManager.xaml.cs @@ -72,7 +72,14 @@ private void Install_Click(object sender, RoutedEventArgs e) } else { - umData.InstallAPI(((SimulatorsClass)((StackPanel)((Button)sender).Parent).DataContext).TargetVersion, false, true); + if (!GlobalFunctions.isOnline()) + { + System.Windows.MessageBox.Show("You are currently experiencing internet connection issues and cannot access the Update Manager server. Please check your connection or try again later.", "Settings", MessageBoxButton.OK, MessageBoxImage.Warning, MessageBoxResult.OK); + } + else + { + umData.InstallAPI(((SimulatorsClass)((StackPanel)((Button)sender).Parent).DataContext).TargetVersion, false, true); + } } } @@ -89,7 +96,14 @@ private void Uninstall_Click(object sender, RoutedEventArgs e) } else { - umData.UninstallAPI(((SimulatorsClass)((StackPanel)((Button)sender).Parent).DataContext).TargetVersion, true); + if (!GlobalFunctions.isOnline()) + { + System.Windows.MessageBox.Show("You are currently experiencing internet connection issues and cannot access the Update Manager server. Please check your connection or try again later.", "Settings", MessageBoxButton.OK, MessageBoxImage.Warning, MessageBoxResult.OK); + } + else + { + umData.UninstallAPI(((SimulatorsClass)((StackPanel)((Button)sender).Parent).DataContext).TargetVersion, true); + } } } diff --git a/src/VSNDK.Package/UpdateManager/UpdateManager.xaml b/src/VSNDK.Package/UpdateManager/UpdateManager.xaml index efba0fd1..badd1a3f 100644 --- a/src/VSNDK.Package/UpdateManager/UpdateManager.xaml +++ b/src/VSNDK.Package/UpdateManager/UpdateManager.xaml @@ -3,7 +3,7 @@ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:ui="clr-namespace:Microsoft.VisualStudio.PlatformUI;assembly=Microsoft.VisualStudio.Shell.10.0" xmlns:pa="clr-namespace:RIM.VSNDK_Package.UpdateManager.Model" - Title="API Level" Height="483" Width="613" ShowInTaskbar="False" WindowStartupLocation="CenterOwner" ResizeMode="NoResize" Topmost="True" Closing="Window_Closing"> + Title="API Level" Height="483" Width="613" ShowInTaskbar="False" WindowStartupLocation="CenterOwner" ResizeMode="NoResize" Closing="Window_Closing"> diff --git a/src/VSNDK.Package/UpdateManager/UpdateManager.xaml.cs b/src/VSNDK.Package/UpdateManager/UpdateManager.xaml.cs index 97633471..ea1dea37 100644 --- a/src/VSNDK.Package/UpdateManager/UpdateManager.xaml.cs +++ b/src/VSNDK.Package/UpdateManager/UpdateManager.xaml.cs @@ -93,8 +93,15 @@ private void Install_Click(object sender, RoutedEventArgs e) } else { - this.Simulators.IsEnabled = false; - data.InstallAPI(((APITargetClass)((StackPanel)((Button)sender).Parent).DataContext).TargetVersion, false, false); + if (!GlobalFunctions.isOnline()) + { + System.Windows.MessageBox.Show("You are currently experiencing internet connection issues and cannot access the Update Manager server. Please check your connection or try again later.", "Settings", MessageBoxButton.OK, MessageBoxImage.Warning, MessageBoxResult.OK); + } + else + { + this.Simulators.IsEnabled = false; + data.InstallAPI(((APITargetClass)((StackPanel)((Button)sender).Parent).DataContext).TargetVersion, false, false); + } } } } @@ -115,14 +122,23 @@ private void Uninstall_Click(object sender, RoutedEventArgs e) } else { - if (((APITargetClass)((StackPanel)((Button)sender).Parent).DataContext).IsInstalled == 2) + + List apiList = APITargetListSingleton.Instance._tempAPITargetList.FindAll(i => i.IsInstalled > 0); + if (apiList.Count <= 1) { - MessageBox.Show("The API Level that you are currently trying to uninstall was not added via the Update Manager. Please remove via the Windows Add/Remove programs utility.", "Update Manager", MessageBoxButton.OK, MessageBoxImage.Warning, MessageBoxResult.OK); + MessageBox.Show("The BlackBerry Plug-in for Microsoft Visual Studio requires at least one API Target to function correctly. Removal of the last API Target is prohibited.", "Update Manager", MessageBoxButton.OK, MessageBoxImage.Warning, MessageBoxResult.OK); } else { - this.Simulators.IsEnabled = false; - data.UninstallAPI(((APITargetClass)((StackPanel)((Button)sender).Parent).DataContext).TargetVersion, false); + if (!GlobalFunctions.isOnline()) + { + System.Windows.MessageBox.Show("You are currently experiencing internet connection issues and cannot access the Update Manager server. Please check your connection or try again later.", "Settings", MessageBoxButton.OK, MessageBoxImage.Warning, MessageBoxResult.OK); + } + else + { + this.Simulators.IsEnabled = false; + data.UninstallAPI(((APITargetClass)((StackPanel)((Button)sender).Parent).DataContext).LatestVersion, false); + } } } } @@ -144,8 +160,15 @@ private void Update_Click(object sender, RoutedEventArgs e) } else { - this.Simulators.IsEnabled = false; - data.UpdateAPI(((APITargetClass)((StackPanel)((Button)sender).Parent).DataContext).TargetVersion, ((APITargetClass)((StackPanel)((Button)sender).Parent).DataContext).LatestVersion); + if (!GlobalFunctions.isOnline()) + { + System.Windows.MessageBox.Show("You are currently experiencing internet connection issues and cannot access the Update Manager server. Please check your connection or try again later.", "Settings", MessageBoxButton.OK, MessageBoxImage.Warning, MessageBoxResult.OK); + } + else + { + this.Simulators.IsEnabled = false; + data.UpdateAPI(((APITargetClass)((StackPanel)((Button)sender).Parent).DataContext).TargetVersion, ((APITargetClass)((StackPanel)((Button)sender).Parent).DataContext).LatestVersion); + } } } @@ -190,8 +213,16 @@ private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs private void Simulators_Click(object sender, RoutedEventArgs e) { - SimulatorManager sm = new SimulatorManager(); - sm.ShowDialog(); + if (!GlobalFunctions.isOnline()) + { + System.Windows.MessageBox.Show("You are currently experiencing internet connection issues and cannot access the Update Manager server. Please check your connection or try again later.", "Settings", MessageBoxButton.OK, MessageBoxImage.Warning, MessageBoxResult.OK); + } + else + { + SimulatorManager sm = new SimulatorManager(); + sm.ShowDialog(); + } + } } } diff --git a/src/VSNDK.Package/UpdateManager/UpdateManagerDialog.xaml b/src/VSNDK.Package/UpdateManager/UpdateManagerDialog.xaml index 91de6f4c..7a04ebfe 100644 --- a/src/VSNDK.Package/UpdateManager/UpdateManagerDialog.xaml +++ b/src/VSNDK.Package/UpdateManager/UpdateManagerDialog.xaml @@ -3,13 +3,28 @@ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:ui="clr-namespace:Microsoft.VisualStudio.PlatformUI;assembly=Microsoft.VisualStudio.Shell.10.0" xmlns:pa="clr-namespace:RIM.VSNDK_Package.UpdateManager.Model" - Title="API Levels" Height="188" Width="613" ShowInTaskbar="False" WindowStartupLocation="CenterOwner" ResizeMode="NoResize" Topmost="False" Closing="Window_Closing"> + Title="API Levels" Height="189" Width="628" ShowInTaskbar="False" WindowStartupLocation="CenterOwner" ResizeMode="NoResize" Closing="Window_Closing"> - - public class APITargetClass { + private string DefaultVersion = "10.2.0.1155"; + public string TargetName { get; set; } public string TargetDescription { get; set; } public string TargetVersion { get; set; } public string LatestVersion { get; set; } public int IsInstalled { get; set; } + public bool IsAPIDefault { get; set; } public bool IsUpdate { get; set; } - public bool IsBeta { get; set; } + + + public string IsDefault + { + get { return TargetVersion == DefaultVersion ? "True" : "False"; } + set + { + if (value == "True") + DefaultVersion = TargetVersion; + else + DefaultVersion = ""; + } + } public string InstalledVisibility { @@ -78,7 +94,7 @@ public string InstalledVisibility public string AvailableVisibility { - get { return IsInstalled == 0 ? "visible" : "collapsed"; } + get { return ((IsAPIDefault) && (IsInstalled == 0)) ? "visible" : "collapsed"; } } public string UpdateVisibility @@ -89,7 +105,7 @@ public string UpdateVisibility public string NoUpdateVisibility { get { return IsUpdate ? "collapsed" : "visible"; } - } + } public APITargetClass(string name, string description, string version) { @@ -99,7 +115,6 @@ public APITargetClass(string name, string description, string version) LatestVersion = version; IsInstalled = 0; IsUpdate = false; - IsBeta = false; } } @@ -176,6 +191,14 @@ private InstalledAPIListSingleton() GetInstalledAPIList(); } + /// + /// Public function to refresh data. + /// + public void RefreshData() + { + _instance.GetInstalledAPIList(); + } + /// /// Public property to retrieve the singleton instance /// @@ -187,6 +210,7 @@ public static InstalledAPIListSingleton Instance { _instance = new InstalledAPIListSingleton(); } + return _instance; } } @@ -250,6 +274,16 @@ private InstalledNDKListSingleton() GetInstalledNDKList(); } + + /// + /// Public function to refresh data. + /// + public void RefreshData() + { + _instance.GetInstalledNDKList(); + } + + /// /// Public property to retrieve the singleton instance /// @@ -261,6 +295,8 @@ public static InstalledNDKListSingleton Instance { _instance = new InstalledNDKListSingleton(); } + + return _instance; } } @@ -317,8 +353,108 @@ public class APITargetListSingleton private APITargetListSingleton() { GetAvailableAPIList(); + GetDefaultAPIList(); + } + + + /// + /// Public function to refresh data. + /// + public void RefreshData() + { + _instance.GetAvailableAPIList(); + _instance.GetDefaultAPIList(); } + /// + /// Retrieve list of API's from + /// + /// + private void GetDefaultAPIList() + { + if (GlobalFunctions.isOnline()) + { + System.Diagnostics.Process p = new System.Diagnostics.Process(); + System.Diagnostics.ProcessStartInfo startInfo = p.StartInfo; + startInfo.UseShellExecute = false; + startInfo.CreateNoWindow = true; + startInfo.RedirectStandardError = true; + startInfo.RedirectStandardOutput = true; + p.ErrorDataReceived += new System.Diagnostics.DataReceivedEventHandler(ErrorDataReceived); + p.OutputDataReceived += new System.Diagnostics.DataReceivedEventHandler(APIListDefaultsDataReceived); + + + /// Get Device PIN + startInfo.FileName = "cmd.exe"; + startInfo.Arguments = string.Format(@"/C " + GlobalFunctions.bbndkPathConst + @"\eclipsec --list"); + + try + { + p.Start(); + p.BeginErrorReadLine(); + p.BeginOutputReadLine(); + p.WaitForExit(); + p.Close(); + if (_error != "") + { + if (!GlobalFunctions.isOnline()) + { + MessageBox.Show("You are currently experiencing internet connection issues and cannot access the Update Manager server. Please check your connection or try again later.", "Settings", MessageBoxButtons.OK, MessageBoxIcon.Warning); + } + else + { + MessageBox.Show(_error, "Get default API list failed", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + _error = ""; + _tempAPITargetList = null; + } + } + catch (Exception e) + { + System.Diagnostics.Debug.WriteLine(startInfo.Arguments); + System.Diagnostics.Debug.WriteLine(e.Message); + } + } + + } + + /// + /// On Data Received event handler + /// + /// + /// + private void APIListDefaultsDataReceived(object sender, System.Diagnostics.DataReceivedEventArgs e) + { + string version = ""; + string name = ""; + + if (e.Data != null) + { + if ((e.Data.ToLower().Contains("error")) || (_error != "")) + { + _error = _error + e.Data; + } + else if ((e.Data.Contains("Location:")) || (e.Data.Contains("Available")) || (e.Data.Contains("Beta"))) + { + // Do Nothing + } + else + { + version = e.Data.Substring(0, e.Data.LastIndexOf(" - ")); + name = e.Data.Substring(e.Data.LastIndexOf(" - ") + 3); + + APITargetClass api = _tempAPITargetList.Find(i => i.TargetVersion == version); + + if (api != null) + { + api.IsAPIDefault = true; + api.TargetName = name; + } + } + } + } + + /// /// Retrieve list of API's from /// @@ -339,7 +475,7 @@ private void GetAvailableAPIList() /// Get Device PIN startInfo.FileName = "cmd.exe"; - startInfo.Arguments = string.Format(@"/C " + GlobalFunctions.bbndkPathConst + @"\eclipsec --list"); + startInfo.Arguments = string.Format(@"/C " + GlobalFunctions.bbndkPathConst + @"\eclipsec --list-all"); try { @@ -350,6 +486,19 @@ private void GetAvailableAPIList() p.BeginOutputReadLine(); p.WaitForExit(); p.Close(); + if (_error != "") + { + if (!GlobalFunctions.isOnline()) + { + MessageBox.Show("You are currently experiencing internet connection issues and cannot access the Update Manager server. Please check your connection or try again later.", "Settings", MessageBoxButtons.OK, MessageBoxIcon.Warning); + } + else + { + MessageBox.Show(_error, "Get available API list failed", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + _error = ""; + _tempAPITargetList = null; + } } catch (Exception e) { @@ -378,7 +527,7 @@ private void APIListDataReceived(object sender, System.Diagnostics.DataReceivedE { _error = _error + e.Data; } - else if ((e.Data.Contains("Location:")) || (e.Data.Contains("Available"))) + else if ((e.Data.Contains("Location:")) || (e.Data.Contains("Available")) || (e.Data.Contains("Beta"))) { // Do Nothing } @@ -386,6 +535,7 @@ private void APIListDataReceived(object sender, System.Diagnostics.DataReceivedE { version = e.Data.Substring(0, e.Data.LastIndexOf(" - ")); name = e.Data.Substring(e.Data.LastIndexOf(" - ") + 3); + name = name.Replace("(EXTERNAL_NDK)", ""); description = "Device Support Unknown."; @@ -416,8 +566,6 @@ private void APIListDataReceived(object sender, System.Diagnostics.DataReceivedE } } - api.IsBeta = name.Contains("Beta"); - } } } @@ -469,8 +617,8 @@ private void ErrorDataReceived(object sender, System.Diagnostics.DataReceivedEve if (e.Data != null) { System.Diagnostics.Debug.WriteLine(e.Data); - - MessageBox.Show(e.Data); + _error += e.Data + "\n"; +// MessageBox.Show(e.Data); } } @@ -485,6 +633,7 @@ public static APITargetListSingleton Instance { _instance = new APITargetListSingleton(); } + return _instance; } } @@ -507,6 +656,15 @@ private SimulatorListSingleton() GetSimulatorList(); } + /// + /// Public function to refresh data. + /// + public void RefreshData() + { + _instance.GetSimulatorList(); + } + + /// /// Public property to retrieve the singleton instance /// @@ -518,6 +676,7 @@ public static SimulatorListSingleton Instance { _instance = new SimulatorListSingleton(); } + return _instance; } } @@ -552,6 +711,19 @@ private void GetSimulatorList() p.BeginOutputReadLine(); p.WaitForExit(); p.Close(); + if (_error != "") + { + if (!GlobalFunctions.isOnline()) + { + MessageBox.Show("You are currently experiencing internet connection issues and cannot access the Update Manager server. Please check your connection or try again later.", "Settings", MessageBoxButtons.OK, MessageBoxIcon.Warning); + } + else + { + MessageBox.Show(_error, "Get simulator list failed", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + _error = ""; + _simulatorList = null; + } } catch (Exception e) { @@ -571,8 +743,8 @@ private void ErrorDataReceived(object sender, System.Diagnostics.DataReceivedEve if (e.Data != null) { System.Diagnostics.Debug.WriteLine(e.Data); - - MessageBox.Show(e.Data); + _error += e.Data + "\n"; +// MessageBox.Show(e.Data); } } @@ -668,6 +840,14 @@ private InstalledSimulatorListSingleton() GetInstalledSimulatorList(); } + /// + /// Public function to refresh data. + /// + public void RefreshData() + { + _instance.GetInstalledSimulatorList(); + } + /// /// Public property to retrieve the singleton instance /// @@ -746,7 +926,7 @@ public bool GetInstalledSimulatorList() // This attribute is needed to let the shell know that this package exposes some menus. [ProvideMenuResource("Menus.ctmenu", 1)] // This attribute registers a tool window exposed by this package. - [ProvideAutoLoad(VSConstants.UICONTEXT.NoSolution_string)] + [ProvideAutoLoad(Microsoft.VisualStudio.Shell.Interop.UIContextGuids80.SolutionExists)] [Guid(GuidList.guidVSNDK_PackagePkgString)] public sealed class VSNDK_PackagePackage : Package { @@ -758,12 +938,14 @@ public sealed class VSNDK_PackagePackage : Package private bool _isSimulator; private BuildEvents _buildEvents; private List _targetDir = null; + private List buildThese = null; private bool _hitPlay = false; private int _amountOfProjects = 0; private string _error = ""; private bool _isDeploying = false; private OutputWindowPane _owP; private bool isDebugConfiguration = true; + private string processName = ""; #endregion @@ -793,9 +975,6 @@ protected override void Initialize() //Create Editor Factory. Note that the base Package class will call Dispose on it. base.RegisterEditorFactory(new EditorFactory(this)); - _dte = (EnvDTE.DTE)GetService(typeof(EnvDTE.DTE)); - - SetNDKPath(); APITargetListSingleton api = APITargetListSingleton.Instance; InstalledAPIListSingleton apiList = InstalledAPIListSingleton.Instance; @@ -803,6 +982,17 @@ protected override void Initialize() SimulatorListSingleton simList = SimulatorListSingleton.Instance; InstalledSimulatorListSingleton installedSimList = InstalledSimulatorListSingleton.Instance; + _dte = (EnvDTE.DTE)GetService(typeof(EnvDTE.DTE)); + + if ((IsBlackBerrySolution(_dte)) && (apiList._installedAPIList.Count == 0)) + { + UpdateManager.UpdateManagerDialog ud = new UpdateManager.UpdateManagerDialog("Please choose your default API Level to be used by the Visual Studio Plug-in.", "default", false, false); + ud.ShowDialog(); + } + + + SetNDKPath(); + _commandEvents = new VSNDKCommandEvents((DTE2)_dte); _commandEvents.RegisterCommand(GuidList.guidVSStd97String, CommandConstants.cmdidStartDebug, startDebugCommandEvents_AfterExecute, startDebugCommandEvents_BeforeExecute); _commandEvents.RegisterCommand(GuidList.guidVSStd97String, CommandConstants.cmdidStartDebug, startDebugCommandEvents_AfterExecute, startDebugCommandEvents_BeforeExecute); @@ -843,6 +1033,32 @@ protected override void Initialize() #region private methods + /// + /// Check to see if current solution is configured with a BlackBerry Configuration. + /// + /// + /// + private bool IsBlackBerrySolution(EnvDTE.DTE dte) + { + bool res = false; + + if (dte.Solution.FullName != "") + { + string fileText = System.IO.File.ReadAllText(dte.Solution.FullName); + + if (fileText.Contains("Debug|BlackBerry")) + { + return true; + } + else + { + return false; + } + } + + return res; + } + /// /// Set the NDK path into the registry if not already set. /// @@ -911,61 +1127,31 @@ private bool BuildBar() bool success = true; try { - Microsoft.Win32.RegistryKey key; - key = Microsoft.Win32.Registry.CurrentUser.CreateSubKey("VSNDK"); - key.SetValue("Run", "True"); - key.Close(); - - _buildEvents.OnBuildDone += new _dispBuildEvents_OnBuildDoneEventHandler(this.OnBuildDone); - - try + if (buildThese.Count != 0) { - Solution2 soln = (Solution2)_dte.Solution; - List buildThese = new List(); - _targetDir = new List(); - - foreach (String startupProject in (Array)soln.SolutionBuild.StartupProjects) - { - foreach (Project p1 in soln.Projects) - { - if (p1.UniqueName == startupProject) - { - buildThese.Add(p1.FullName); + Microsoft.Win32.RegistryKey key; + key = Microsoft.Win32.Registry.CurrentUser.CreateSubKey("VSNDK"); + key.SetValue("Run", "True"); + key.Close(); - ConfigurationManager config = p1.ConfigurationManager; - Configuration active = config.ActiveConfiguration; - - foreach (Property prop in active.Properties) - { - try - { - if (prop.Name == "OutputPath") - { - string[] path = new string[2]; - path[0] = p1.Name + "_" + _isSimulator.ToString(); - path[1] = prop.Value.ToString(); - _targetDir.Add(path); - break; - } - } - catch - { - } - } + _buildEvents.OnBuildDone += new _dispBuildEvents_OnBuildDoneEventHandler(this.OnBuildDone); - break; - } - } + try + { + Solution2 soln = (Solution2)_dte.Solution; + _hitPlay = true; + _amountOfProjects = buildThese.Count; // OnBuildDone will call build() only after receiving "amountOfProjects" events + foreach (string projectName in buildThese) + soln.SolutionBuild.BuildProject("Debug", projectName, false); + } + catch (Exception ex) + { + Debug.WriteLine(ex.Message); + success = false; } - - _hitPlay = true; - _amountOfProjects = buildThese.Count; // OnBuildDone will call build() only after receiving "amountOfProjects" events - foreach (string projectName in buildThese) - soln.SolutionBuild.BuildProject("Debug", projectName, false); } - catch (Exception ex) + else { - Debug.WriteLine(ex.Message); success = false; } } @@ -1031,9 +1217,19 @@ private void Deployed() key.Close(); string pidString = ""; - getPID((DTE2)_dte, ref pidString); - - bool CancelDefault = LaunchDebugTarget(pidString); + string toolsPath = ""; + string publicKeyPath = ""; + string targetIP = ""; + string password = ""; + string executablePath = ""; + if (getProcessInfo((DTE2)_dte, ref pidString, ref toolsPath, ref publicKeyPath, ref targetIP, ref password, ref executablePath)) + { + bool CancelDefault = LaunchDebugTarget(pidString, toolsPath, publicKeyPath, targetIP, password, executablePath); + } + else + { + MessageBox.Show("Failed to debug the application.\n\nPlease, close the app in case it was launched in the device/simulator.", "Failed to launch debugger", MessageBoxButtons.OK, MessageBoxIcon.Error); + } } /// @@ -1041,7 +1237,7 @@ private void Deployed() /// /// Process ID in string format. /// TRUE if successful, False if not. - private bool LaunchDebugTarget(string pidString) + private bool LaunchDebugTarget(string pidString, string toolsPath, string publicKeyPath, string targetIP, string password, string executablePath) { Microsoft.VisualStudio.Shell.ServiceProvider sp = new Microsoft.VisualStudio.Shell.ServiceProvider((Microsoft.VisualStudio.OLE.Interop.IServiceProvider)_dte); @@ -1053,37 +1249,17 @@ private bool LaunchDebugTarget(string pidString) info.cbSize = (uint)System.Runtime.InteropServices.Marshal.SizeOf(info); info.dlo = Microsoft.VisualStudio.Shell.Interop.DEBUG_LAUNCH_OPERATION.DLO_CreateProcess; - // Read debugger args from a file (it is set when the Deploy task is run) - System.IO.StreamReader argsFile = null; - try - { - string localAppData = Environment.GetEnvironmentVariable("AppData"); - argsFile = new System.IO.StreamReader(localAppData + @"\BlackBerry\vsndk-args-file.txt"); - } - catch (Exception e) - { - Debug.Fail("Unexpected exception in LaunchDebugTarget"); - } - // Store all debugger arguments in a string var nvc = new NameValueCollection(); nvc.Add("pid", pidString); - nvc.Add("targetIP", argsFile.ReadLine()); // The device (IP address) - info.bstrExe = argsFile.ReadLine(); // The executable path - nvc.Add("isSimulator", argsFile.ReadLine()); - nvc.Add("ToolsPath", argsFile.ReadLine()); - nvc.Add("PublicKeyPath", argsFile.ReadLine()); - - // Decrypt stored password. - byte[] data = Convert.FromBase64String(argsFile.ReadLine()); - if (data.Length > 0) - { - byte[] decrypted = ProtectedData.Unprotect(data, null, DataProtectionScope.LocalMachine); - nvc.Add("Password", Encoding.Unicode.GetString(decrypted)); - } + nvc.Add("targetIP", targetIP); // The device (IP address) + info.bstrExe = executablePath; // The executable path + nvc.Add("isSimulator", _isSimulator.ToString()); + nvc.Add("ToolsPath", toolsPath); + nvc.Add("PublicKeyPath", publicKeyPath); + nvc.Add("Password", password); info.bstrArg = NameValueCollectionHelper.DumpToString(nvc); - argsFile.Close(); info.bstrRemoteMachine = null; // debug locally info.fSendStdoutToOutputWindow = 0; // Let stdout stay with the application. @@ -1124,98 +1300,186 @@ private bool LaunchDebugTarget(string pidString) /// Application Object. /// Returns the Process ID as a string. /// TRUE if successful, False if not. - private bool getPID(DTE2 dte, ref string pidString) + private bool getProcessInfo(DTE2 dte, ref string pidString, ref string toolsPath, ref string publicKeyPath, ref string targetIP, ref string password, ref string executablePath) { - // Select all of the text - _owP.TextDocument.Selection.SelectAll(); - string outputText = _owP.TextDocument.Selection.Text; + string currentPath = ""; - // Check for successful deployment - if (System.Text.RegularExpressions.Regex.IsMatch(outputText, "Info: done")) + foreach (string[] paths in _targetDir) { - string pattern = @"\s+result::(\d+)\r\n.+"; - Regex r = new Regex(pattern, RegexOptions.IgnoreCase); + if (paths[0] == processName) + { + currentPath = paths[1]; + break; + } + } - // Match the regular expression pattern against a text string. - Match m = r.Match(outputText); + executablePath = currentPath + processName; // The executable path + executablePath = executablePath.Replace('\\', '/'); + publicKeyPath = Environment.GetEnvironmentVariable("AppData") + @"\BlackBerry\bbt_id_rsa.pub"; + publicKeyPath = publicKeyPath.Replace('\\', '/'); - // Take first match - if (m.Success) + try + { + RegistryKey rkHKCU = Registry.CurrentUser; + RegistryKey rkPluginRegKey = rkHKCU.OpenSubKey("Software\\BlackBerry\\BlackBerryVSPlugin"); + toolsPath = rkPluginRegKey.GetValue("NDKHostPath").ToString() + "/usr/bin"; + toolsPath = toolsPath.Replace('\\', '/'); + + if (_isSimulator) { - Group g = m.Groups[1]; - CaptureCollection cc = g.Captures; - Capture c = cc[0]; - pidString = c.ToString(); - - // Store proccess name and file location into ProcessesPath.txt, so "Attach To Process" would be able to find the - // source code for a running process. - // First read the file. - string processesPaths = ""; - System.IO.StreamReader readProcessesPathsFile = null; - try - { - readProcessesPathsFile = new System.IO.StreamReader(System.Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + @"\Research In Motion\ProcessesPath.txt"); - processesPaths = readProcessesPathsFile.ReadToEnd(); - readProcessesPathsFile.Close(); - } - catch (Exception e) - { - processesPaths = ""; - } + targetIP = rkPluginRegKey.GetValue("simulator_IP").ToString(); + password = rkPluginRegKey.GetValue("simulator_password").ToString(); + } + else + { + targetIP = rkPluginRegKey.GetValue("device_IP").ToString(); + password = rkPluginRegKey.GetValue("device_password").ToString(); + } + + // Decrypt stored password. + byte[] data = Convert.FromBase64String(password); + if (data.Length > 0) + { + byte[] decrypted = ProtectedData.Unprotect(data, null, DataProtectionScope.LocalMachine); + password = Encoding.Unicode.GetString(decrypted); + } + } + catch (Exception ex) + { + System.Windows.Forms.MessageBox.Show(ex.Message, "Microsoft Visual Studio", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error); + } - // Updating the contents. - int begin = outputText.IndexOf("Deploy started: Project: ") + 25; - if (begin == -1) - begin = outputText.IndexOf("Project: ") + 9; - int end = outputText.IndexOf(", Configuration:", begin); - string processName = outputText.Substring(begin, end - begin) + "_" + _isSimulator.ToString(); - begin = processesPaths.IndexOf(processName + ":>"); + pidString = getPIDfromGDB(processName, targetIP, password, _isSimulator, toolsPath, publicKeyPath); - // string currentPath = dte.ActiveDocument.Path; - string currentPath = ""; + if (pidString == "") + { + // Select all of the text + _owP.TextDocument.Selection.SelectAll(); + string outputText = _owP.TextDocument.Selection.Text; + + // Check for successful deployment + if (System.Text.RegularExpressions.Regex.IsMatch(outputText, "Info: done")) + { + string pattern = @"\s+result::(\d+)\r\n.+|\s+result::(\d+) \(TaskId:"; + Regex r = new Regex(pattern, RegexOptions.IgnoreCase); - foreach (string[] paths in _targetDir) + // Match the regular expression pattern against a text string. + Match m = r.Match(outputText); + + // Take first match + if (m.Success) { - if (paths[0] == processName) + Group g = m.Groups[1]; + CaptureCollection cc = g.Captures; + if (cc.Count == 0) + { // Diagnostic verbosity mode + g = m.Groups[2]; + cc = g.Captures; + } + + if (cc.Count != 0) { - currentPath = paths[1]; - break; + Capture c = cc[0]; + pidString = c.ToString(); } } + } + } - if (begin != -1) - { - begin += processName.Length + 2; - end = processesPaths.IndexOf("\r\n", begin); - processesPaths = processesPaths.Substring(0, begin) + currentPath + processesPaths.Substring(end); - } - else - { - processesPaths = processesPaths + processName + ":>" + currentPath + "\r\n"; - } + if (pidString != "") + { - // Writing contents to file. - System.IO.StreamWriter writeProcessesPathsFile = null; - try - { - writeProcessesPathsFile = new System.IO.StreamWriter(System.Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + @"\Research In Motion\ProcessesPath.txt", false); - writeProcessesPathsFile.Write(processesPaths); - writeProcessesPathsFile.Close(); - } - catch (Exception e) - { - } + // Store proccess name and file location into ProcessesPath.txt, so "Attach To Process" would be able to find the + // source code for a running process. + // First read the file. + processName += "_" + _isSimulator.ToString(); - return true; + string processesPaths = ""; + System.IO.StreamReader readProcessesPathsFile = null; + try + { + readProcessesPathsFile = new System.IO.StreamReader(System.Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + @"\Research In Motion\ProcessesPath.txt"); + processesPaths = readProcessesPathsFile.ReadToEnd(); + readProcessesPathsFile.Close(); + } + catch (Exception e) + { + processesPaths = ""; + } + + // Updating the contents. + int begin = processesPaths.IndexOf(processName + ":>"); + + if (begin != -1) + { + begin += processName.Length + 2; + int end = processesPaths.IndexOf("\r\n", begin); + processesPaths = processesPaths.Substring(0, begin) + currentPath + processesPaths.Substring(end); } else { - return false; + processesPaths = processesPaths + processName + ":>" + currentPath + "\r\n"; } + + // Writing contents to file. + System.IO.StreamWriter writeProcessesPathsFile = null; + try + { + writeProcessesPathsFile = new System.IO.StreamWriter(System.Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + @"\Research In Motion\ProcessesPath.txt", false); + writeProcessesPathsFile.Write(processesPaths); + writeProcessesPathsFile.Close(); + } + catch (Exception e) + { + } + + return true; } return false; } + private string getPIDfromGDB(string processName, string IP, string password, bool isSimulator, string toolsPath, string publicKeyPath) + { + string PID = ""; + string response = GDBParser.GetPIDsThroughGDB(IP, password, isSimulator, toolsPath, publicKeyPath, 7); + + if ((response == "TIMEOUT!") || (response.IndexOf("1^error,msg=", 0) != -1)) //found an error + { + if (response == "TIMEOUT!") // Timeout error, normally happen when the device is not connected. + { + MessageBox.Show("Please, verify if the Device/Simulator IP in \"BlackBerry -> Settings\" menu is correct and check if it is connected.", "Device/Simulator not connected or not configured properly", MessageBoxButtons.OK, MessageBoxIcon.Warning); + } + else + if (response[29] == ':') // error: 1^error,msg="169.254.0.3:8000: The requested address is not valid in its context." + { + string txt = response.Substring(13, response.IndexOf(':', 13) - 13) + response.Substring(29, response.IndexOf('"', 31) - 29); + string caption = ""; + if (txt.IndexOf("The requested address is not valid in its context.") != -1) + { + txt += "\n\nPlease, verify the BlackBerry device/simulator IP settings."; + caption = "Invalid IP"; + } + else + { + txt += "\n\nPlease, verify if the device/simulator is connected."; + caption = "Connection failed"; + } + MessageBox.Show(txt, caption, MessageBoxButtons.OK, MessageBoxIcon.Warning); + } + response = ""; + } + else if (response.Contains("^done")) + { + int i = response.IndexOf(processName + " - "); + if (i != -1) + { + i += processName.Length + 3; + PID = response.Substring(i, response.IndexOf('/', i) - i); + } + } + return PID; + } + /// /// Verify if the app configuration is Debug. @@ -1247,7 +1511,6 @@ private bool checkDebugConfiguration() #endregion - #region Event Handlers /// @@ -1302,6 +1565,53 @@ private void startDebugCommandEvents_BeforeExecute(string Guid, int ID, object C } else { + try + { + Solution2 soln = (Solution2)_dte.Solution; + buildThese = new List(); + _targetDir = new List(); + + foreach (String startupProject in (Array)soln.SolutionBuild.StartupProjects) + { + foreach (Project p1 in soln.Projects) + { + if (p1.UniqueName == startupProject) + { + buildThese.Add(p1.FullName); + processName = p1.Name; + + ConfigurationManager config = p1.ConfigurationManager; + Configuration active = config.ActiveConfiguration; + + foreach (Property prop in active.Properties) + { + try + { + if (prop.Name == "OutputPath") + { + string[] path = new string[2]; + path[0] = p1.Name; + path[1] = prop.Value.ToString(); + _targetDir.Add(path); + break; + } + } + catch + { + } + } + + break; + } + } + } + } + catch (Exception ex) + { + Debug.WriteLine(ex.Message); + } + + // Create a reference to the Output window. // Create a tool window reference for the Output window // and window pane. @@ -1314,7 +1624,11 @@ private void startDebugCommandEvents_BeforeExecute(string Guid, int ID, object C if (isDebugConfiguration) { - UpdateManagerData upData = new UpdateManagerData(); + UpdateManagerData upData; + if (_targetDir.Count > 0) + upData = new UpdateManagerData(_targetDir[0][1]); + else + upData = new UpdateManagerData(); if (!upData.validateDeviceVersion(_isSimulator)) { @@ -1366,6 +1680,13 @@ public void OnBuildDone(EnvDTE.vsBuildScope Scope, EnvDTE.vsBuildAction Action) /// Represents the type of build action that is occurring, such as a build or a deploy action. public void OnBuildBegin(EnvDTE.vsBuildScope Scope, EnvDTE.vsBuildAction Action) { + InstalledAPIListSingleton apiList = InstalledAPIListSingleton.Instance; + if ((IsBlackBerrySolution(_dte)) && (apiList._installedAPIList.Count == 0)) + { + UpdateManager.UpdateManagerDialog ud = new UpdateManager.UpdateManagerDialog("Please choose your default API Level to be used by the Visual Studio Plug-in.", "default", false, false); + ud.ShowDialog(); + } + if ((Action == vsBuildAction.vsBuildActionBuild) || (Action == vsBuildAction.vsBuildActionRebuildAll)) { if ((_hitPlay == false) && (_isDeploying == false)) // means that the "play" building and deploying process was cancelled before, so we have to disable the @@ -1398,7 +1719,7 @@ private void ShowToolWindow(object sender, EventArgs e) private void ShowSettingsWindow(object sender, EventArgs e) { var SettingsDialog = new Settings.SettingsDialog(); - var m = SettingsDialog.ShowModal(); + var m = SettingsDialog.ShowDialog(); } /// @@ -1411,8 +1732,8 @@ private void ShowDebugTokenWindow(object sender, EventArgs e) // Create the dialog instance without Help support. var DebugTokenDialog = new DebugToken.DebugTokenDialog(); // Show the dialog. - if (!DebugTokenDialog.IsClosing) - DebugTokenDialog.ShowModal(); + if ((!DebugTokenDialog.IsClosing) && (VSNDK_Package.DebugToken.Model.DebugTokenData._initializedCorrectly)) + DebugTokenDialog.ShowDialog(); } private void MenuItemCallback(object sender, EventArgs e) diff --git a/src/VSNDK.Package/VSNDKCommandEvents.cs b/src/VSNDK.Package/VSNDKCommandEvents.cs index b6291609..4e0d8b46 100644 --- a/src/VSNDK.Package/VSNDKCommandEvents.cs +++ b/src/VSNDK.Package/VSNDKCommandEvents.cs @@ -20,7 +20,7 @@ using Microsoft.VisualStudio.Shell; using EnvDTE80; -namespace VSNDK.Package +namespace RIM.VSNDK_Package { /// diff --git a/src/VSNDK.Package/VSNDKConstants.cs b/src/VSNDK.Package/VSNDKConstants.cs index 7640dbfd..c76d2071 100644 --- a/src/VSNDK.Package/VSNDKConstants.cs +++ b/src/VSNDK.Package/VSNDKConstants.cs @@ -12,33 +12,33 @@ //* See the License for the specific language governing permissions and //* limitations under the License. -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; - -namespace VSNDK.Package -{ - /// - /// Command IDs exposed by VisualStudio. - /// - public static class CommandConstants - { - public const int cmdidAddSolutionSCC = 21016; - public const int cmdidUndoCheckoutSCC = 21009; - public const int cmdidGetLatestVersionSCC = 21011; - public const int cmdidGetSCC = 21501; - public const int cmdidViewHistorySCC = 21508; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace RIM.VSNDK_Package +{ + /// + /// Command IDs exposed by VisualStudio. + /// + public static class CommandConstants + { + public const int cmdidAddSolutionSCC = 21016; + public const int cmdidUndoCheckoutSCC = 21009; + public const int cmdidGetLatestVersionSCC = 21011; + public const int cmdidGetSCC = 21501; + public const int cmdidViewHistorySCC = 21508; public const int cmdidStartDebug = 295; - public const int cmdidStartDebugContext = 356; - public const int cmdidRestartDebug = 296; - public const int cmdidStopDebug = 179; - public const int cmdidPreviewInBrowser = 334; - public const int cmdidBrowseWith = 336; - public const int cmdidStartNoDebug = 368; - public const int cmdidSolutionCfg = 684; - public const int cmdidSolutionPlatform = 1990; + public const int cmdidStartDebugContext = 356; + public const int cmdidRestartDebug = 296; + public const int cmdidStopDebug = 179; + public const int cmdidPreviewInBrowser = 334; + public const int cmdidBrowseWith = 336; + public const int cmdidStartNoDebug = 368; + public const int cmdidSolutionCfg = 684; + public const int cmdidSolutionPlatform = 1990; public const int cmdidSolutionPlatformGetList = 1991; - public const int cmdidDebugBreakatFunction = 311; - } -} + public const int cmdidDebugBreakatFunction = 311; + } +} diff --git a/src/VSNDK.Package/ViewModel.cs b/src/VSNDK.Package/ViewModel.cs index 7c12c640..8a818e09 100644 --- a/src/VSNDK.Package/ViewModel.cs +++ b/src/VSNDK.Package/ViewModel.cs @@ -92,11 +92,25 @@ public class PermissionItemClass : INotifyPropertyChanged private string _permission; private string _identifier; private string _permisionImagePath; + private string _description; + private ViewModel _viewModel; public bool IsChecked { - get { return _isChecked; } + get + { + return this._viewModel.isPermissionChecked(this._identifier); + } set { + if (value) + { + this._viewModel.CheckPermission(this._identifier); + } + else + { + if (this._viewModel.isPermissionChecked(this._identifier)) + this._viewModel.UnCheckPermission(this._identifier); + } _isChecked = value; OnPropertyChanged("IsChecked"); } @@ -132,12 +146,24 @@ public string Identifier } } - public PermissionItemClass(bool isChecked, string permission, string identifier, string permissionImagePath) + public string Description + { + get { return _description; } + set + { + _description = value; + OnPropertyChanged("Description"); + } + } + + public PermissionItemClass(bool isChecked, string permission, string identifier, string description, string permissionImagePath, ViewModel vm) { _isChecked = isChecked; _permission = permission; _identifier = identifier; + _description = description; _permisionImagePath = permissionImagePath; + _viewModel = vm; } public event PropertyChangedEventHandler PropertyChanged; @@ -221,7 +247,7 @@ public class ViewModel : IViewModel, IDataErrorInfo, INotifyPropertyChanged private CollectionView _iconImageList; private CollectionView _splashScreenImageList; private CollectionView _assetTypeList; - private CollectionView _permissionList; + private CollectionView _permissionList = null; private CollectionView _configurationList; private ConfigurationItemClass _config; private PermissionItemClass _permission; @@ -512,57 +538,61 @@ private void LoadPermissions() oldListMethod = false; } - IList PermissionList = new List(); - - if (oldListMethod) // Old Listing Method - { - PermissionItemClass permissionItem = new PermissionItemClass(isPermissionChecked("bbm_connect"), "BlackBerry Messenger", "bbm_connect", getPermissionIcon("bbm_connect")); - PermissionList.Add(permissionItem); - permissionItem = new PermissionItemClass(isPermissionChecked("access_pimdomain_calendars"), "Calendar", "access_pimdomain_calendars", getPermissionIcon("access_pimdomain_calendars")); - PermissionList.Add(permissionItem); - permissionItem = new PermissionItemClass(isPermissionChecked("use_camera"), "Camera", "use_camera", getPermissionIcon("use_camera")); - PermissionList.Add(permissionItem); - permissionItem = new PermissionItemClass(isPermissionChecked("access_pimdomain_contacts"), "Contacts", "access_pimdomain_contacts", getPermissionIcon("access_pimdomain_contacts")); - PermissionList.Add(permissionItem); - permissionItem = new PermissionItemClass(isPermissionChecked("read_device_identifying_information"), "Device Identifying Information", "read_device_identifying_information", getPermissionIcon("read_device_identifying_information")); - PermissionList.Add(permissionItem); - permissionItem = new PermissionItemClass(isPermissionChecked("access_pimdomain_messages"), "Email and PIN Message", "access_pimdomain_messages", getPermissionIcon("access_pimdomain_messages")); - PermissionList.Add(permissionItem); - permissionItem = new PermissionItemClass(isPermissionChecked("access_internet"), "Internet", "access_internet", getPermissionIcon("access_internet")); - PermissionList.Add(permissionItem); - permissionItem = new PermissionItemClass(isPermissionChecked("read_geolocation"), "GPS Location", "read_geolocation", getPermissionIcon("read_geolocation")); - PermissionList.Add(permissionItem); - permissionItem = new PermissionItemClass(isPermissionChecked("access_location_services"), "Location", "access_location_services", getPermissionIcon("access_location_services")); - PermissionList.Add(permissionItem); - permissionItem = new PermissionItemClass(isPermissionChecked("record_audio"), "Microphone", "record_audio", getPermissionIcon("record_audio")); - PermissionList.Add(permissionItem); - permissionItem = new PermissionItemClass(isPermissionChecked("access_pimdomain_notebooks"), "Notebooks", "access_pimdomain_notebooks", getPermissionIcon("access_pimdomain_notebooks")); - PermissionList.Add(permissionItem); - permissionItem = new PermissionItemClass(isPermissionChecked("post_notification"), "Post Notifications", "post_notification", getPermissionIcon("post_notification")); - PermissionList.Add(permissionItem); - permissionItem = new PermissionItemClass(isPermissionChecked("run_when_backgrounded"), "Run When Backgrounded", "run_when_backgrounded", getPermissionIcon("run_when_backgrounded")); - PermissionList.Add(permissionItem); - permissionItem = new PermissionItemClass(isPermissionChecked("access_shared"), "Shared Files", "access_shared", getPermissionIcon("access_shared")); - PermissionList.Add(permissionItem); - permissionItem = new PermissionItemClass(isPermissionChecked("access_sms_mms"), "Text Messages", "access_sms_mms", getPermissionIcon("access_sms_mms")); - PermissionList.Add(permissionItem); - permissionItem = new PermissionItemClass(isPermissionChecked("_sys_use_consumer_push"), "Consumer Push", "_sys_use_consumer_push", getPermissionIcon("_sys_use_consumer_push")); - PermissionList.Add(permissionItem); - permissionItem = new PermissionItemClass(isPermissionChecked("narrow_landscape_exit"), "Narrow Swipe Up", "narrow_landscape_exit", getPermissionIcon("narrow_landscape_exit")); - PermissionList.Add(permissionItem); - permissionItem = new PermissionItemClass(isPermissionChecked("access_phone"), "Phone", "access_phone", getPermissionIcon("access_phone")); - PermissionList.Add(permissionItem); - } - else + if (_permissionList == null) { - foreach (XmlNode p in pList) + + IList PermissionList = new List(); + + if (oldListMethod) // Old Listing Method { - PermissionItemClass permissionItem = new PermissionItemClass(isPermissionChecked(p["id"].InnerText), p["name"].InnerText, p["id"].InnerText, getPermissionIcon(p["id"].InnerText)); + PermissionItemClass permissionItem = new PermissionItemClass(isPermissionChecked("bbm_connect"), "BlackBerry Messenger", "bbm_connect", "Allows this app to connect to the BBM Social Platform to access BBM contact lists and user profiles, invite BBM contacts to download your app, initiate BBM chats and share content from within your app, or stream data between apps in real time.", getPermissionIcon("bbm_connect"),this); + PermissionList.Add(permissionItem); + permissionItem = new PermissionItemClass(isPermissionChecked("access_pimdomain_calendars"), "Calendar", "access_pimdomain_calendars", "Allows this app to access the calendar on the device. This access includes viewing, adding, and deleting calendar appointments.", getPermissionIcon("access_pimdomain_calendars"), this); + PermissionList.Add(permissionItem); + permissionItem = new PermissionItemClass(isPermissionChecked("use_camera"), "Camera", "use_camera", "Allows this app to take pictures, record video, and use the flash.", getPermissionIcon("use_camera"), this); + PermissionList.Add(permissionItem); + permissionItem = new PermissionItemClass(isPermissionChecked("access_pimdomain_contacts"), "Contacts", "access_pimdomain_contacts", "Allows this app to access the contacts stored on the device. This access includes viewing, creating, and deleting the contacts.", getPermissionIcon("access_pimdomain_contacts"), this); + PermissionList.Add(permissionItem); + permissionItem = new PermissionItemClass(isPermissionChecked("read_device_identifying_information"), "Device Identifying Information", "read_device_identifying_information", "Allows this app to access device identifiers such as serial number and PIN.", getPermissionIcon("read_device_identifying_information"), this); + PermissionList.Add(permissionItem); + permissionItem = new PermissionItemClass(isPermissionChecked("access_pimdomain_messages"), "Email and PIN Message", "access_pimdomain_messages", "Allows this app to access the email and PIN messages stored on the device. This access includes viewing, creating, sending, and deleting the messages.", getPermissionIcon("access_pimdomain_messages"), this); + PermissionList.Add(permissionItem); + permissionItem = new PermissionItemClass(isPermissionChecked("access_internet"), "Internet", "access_internet", "Allows this app to use Wi-fi, wired, or other connections to a destination that is not local on the user's device.", getPermissionIcon("access_internet"), this); + PermissionList.Add(permissionItem); + permissionItem = new PermissionItemClass(isPermissionChecked("read_geolocation"), "GPS Location", "read_geolocation", "Allows this app to access the current GPS location of the device.", getPermissionIcon("read_geolocation"), this); + PermissionList.Add(permissionItem); + permissionItem = new PermissionItemClass(isPermissionChecked("access_location_services"), "Location", "access_location_services", "Allows this app to access the device’s current or saved locations.", getPermissionIcon("access_location_services"), this); + PermissionList.Add(permissionItem); + permissionItem = new PermissionItemClass(isPermissionChecked("record_audio"), "Microphone", "record_audio", "Allows this app to record sound using the microphone.", getPermissionIcon("record_audio"), this); + PermissionList.Add(permissionItem); + permissionItem = new PermissionItemClass(isPermissionChecked("access_pimdomain_notebooks"), "Notebooks", "access_pimdomain_notebooks", "Allows this app to access the content stored in the notebooks on the device. This access includes adding and deleting entries and content.", getPermissionIcon("access_pimdomain_notebooks"), this); + PermissionList.Add(permissionItem); + permissionItem = new PermissionItemClass(isPermissionChecked("post_notification"), "Post Notifications", "post_notification", "Post a notification to the notifications area of the screen.", getPermissionIcon("post_notification"), this); + PermissionList.Add(permissionItem); + permissionItem = new PermissionItemClass(isPermissionChecked("run_when_backgrounded"), "Run When Backgrounded", "run_when_backgrounded", "Allows background processing. Without this permission, the app is stopped when the user switches focus to another app. Apps that use this permission are rigorously reviewed for acceptance to BlackBerry App World storefront for their use of power.", getPermissionIcon("run_when_backgrounded"), this); + PermissionList.Add(permissionItem); + permissionItem = new PermissionItemClass(isPermissionChecked("access_shared"), "Shared Files", "access_shared", "Allows this app to access pictures, music, documents, and other files stored on the user's device, at a remote storage provider, on a media card, or in the cloud.", getPermissionIcon("access_shared"), this); + PermissionList.Add(permissionItem); + permissionItem = new PermissionItemClass(isPermissionChecked("access_sms_mms"), "Text Messages", "access_sms_mms", "Allows this app to access the text messages stored on the device. The access includes viewing, creating, sending, and deleting text messages.", getPermissionIcon("access_sms_mms"), this); + PermissionList.Add(permissionItem); + permissionItem = new PermissionItemClass(isPermissionChecked("_sys_use_consumer_push"), "Consumer Push", "_sys_use_consumer_push", "Allows this app to use the Push Service with the BlackBerry Internet Service. This access allows the app to receive and request push messages. To use the Push Service with the BlackBerry Internet Service, you must register with Research In Motion. When you register, you receive a confirmation email message that contains information that your application needs to receive and request push messages. For more information about registering, visit https://developer.blackberry.com/services/push/. If you're using the Push Service with the BlackBerry Enterprise Server or the BlackBerry Device Service, you don't need to register with RIM.", getPermissionIcon("_sys_use_consumer_push"), this); + PermissionList.Add(permissionItem); + permissionItem = new PermissionItemClass(isPermissionChecked("narrow_landscape_exit"), "Narrow Swipe Up", "narrow_landscape_exit", "", getPermissionIcon("narrow_landscape_exit"), this); + PermissionList.Add(permissionItem); + permissionItem = new PermissionItemClass(isPermissionChecked("access_phone"), "Phone", "access_phone", "Determine when a user is on a phone call. This access includes access to the phone number assigned to the device and the BlackBerry ID of the user.", getPermissionIcon("access_phone"), this); PermissionList.Add(permissionItem); } - } + else + { + foreach (XmlNode p in pList) + { + PermissionItemClass permissionItem = new PermissionItemClass(isPermissionChecked(p["id"].InnerText), p["name"].InnerText, p["id"].InnerText, p["description"].InnerText, getPermissionIcon(p["id"].InnerText), this); + PermissionList.Add(permissionItem); + } + } - _permissionList = new CollectionView(PermissionList); + _permissionList = new CollectionView(PermissionList); + } } /// @@ -924,7 +954,7 @@ public void setAuthorInfo() var DebugTokenDialog = new DebugToken.DebugTokenDialog(); // Show the dialog. if (!DebugTokenDialog.IsClosing) - DebugTokenDialog.ShowModal(); + DebugTokenDialog.ShowDialog(); } System.Diagnostics.Process p = new System.Diagnostics.Process(); @@ -1038,7 +1068,7 @@ public string Description { get { - return _qnxSchema.description.Trim(); + return _qnxSchema.description; } set { @@ -1451,10 +1481,13 @@ public void DeleteSplashScreen(object splashScreenName) public void CheckPermission(string identifier) { - /// add new perm to xml - qnxPermission perm = new qnxPermission(); - perm.Value = identifier; - _qnxSchema.AddPermission(perm); + if (!isPermissionChecked(identifier)) + { + /// add new perm to xml + qnxPermission perm = new qnxPermission(); + perm.Value = identifier; + _qnxSchema.AddPermission(perm); + } DesignerDirty = true; } @@ -1469,19 +1502,17 @@ public void UnCheckPermission(string identifier) public bool isPermissionChecked(string identifier) { - bool result = false; - if (_qnxSchema.permission != null) { foreach (qnxPermission permEntry in _qnxSchema.permission) { if (permEntry.Value == identifier) { - result = true; + return true; } } } - return result; + return false; } diff --git a/src/VSNDK.Package/VsDesignerControl.xaml b/src/VSNDK.Package/VsDesignerControl.xaml index 2095cb83..78b1f46f 100644 --- a/src/VSNDK.Package/VsDesignerControl.xaml +++ b/src/VSNDK.Package/VsDesignerControl.xaml @@ -165,7 +165,7 @@ - + @@ -181,8 +181,16 @@ - - + + + + + + + + + + diff --git a/src_vs2012/VSNDK.Package/ControlDebugEngine.cs b/src_vs2012/VSNDK.Package/ControlDebugEngine.cs deleted file mode 100644 index 0398c696..00000000 --- a/src_vs2012/VSNDK.Package/ControlDebugEngine.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; - -namespace VSNDK.Package -{ - public static class ControlDebugEngine - { - public static bool isDebugEngineRunning = false; - } -} diff --git a/src_vs2012/VSNDK.Package/DebugToken/DebugTokenDialog.xaml b/src_vs2012/VSNDK.Package/DebugToken/DebugTokenDialog.xaml deleted file mode 100644 index 32105fca..00000000 --- a/src_vs2012/VSNDK.Package/DebugToken/DebugTokenDialog.xaml +++ /dev/null @@ -1,59 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src_vs2012/VSNDK.Package/Signing/RegistrationWindow.xaml.cs b/src_vs2012/VSNDK.Package/Signing/RegistrationWindow.xaml.cs deleted file mode 100644 index 41f8fa22..00000000 --- a/src_vs2012/VSNDK.Package/Signing/RegistrationWindow.xaml.cs +++ /dev/null @@ -1,84 +0,0 @@ -//* Copyright 2010-2011 Research In Motion Limited. -//* -//* Licensed under the Apache License, Version 2.0 (the "License"); -//* you may not use this file except in compliance with the License. -//* You may obtain a copy of the License at -//* -//* http://www.apache.org/licenses/LICENSE-2.0 -//* -//* Unless required by applicable law or agreed to in writing, software -//* distributed under the License is distributed on an "AS IS" BASIS, -//* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//* See the License for the specific language governing permissions and -//* limitations under the License. - -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Windows; -using System.Windows.Controls; -using System.Windows.Data; -using System.Windows.Documents; -using System.Windows.Input; -using System.Windows.Media; -using System.Windows.Media.Imaging; -using System.Windows.Shapes; -using RIM.VSNDK_Package.Signing.Models; -using System.IO; -using System.ComponentModel; - -namespace RIM.VSNDK_Package.Signing -{ - /// - /// Interaction logic for RegistrationWindow.xaml - /// - public partial class RegistrationWindow : Window - { - private SigningData signingData = null; - - /// - /// RegistrationWindow Constructor - /// - public RegistrationWindow() - { - InitializeComponent(); - - signingData = new SigningData(); - gridMain.DataContext = signingData; - } - - /// - /// Perform actions on the OK button click - /// - /// - /// - private void btnOk_Click(object sender, RoutedEventArgs e) - { - if (!signingData.Register(tbAuthor.Text, tbPassword.Password)) - { - MessageBox.Show(signingData.Errors, "Registration Window", MessageBoxButton.OK, MessageBoxImage.Exclamation, MessageBoxResult.OK); - signingData.Errors = null; - e.Handled = true; - return; - } - else if (!string.IsNullOrEmpty(signingData.Messages)) - { - signingData.Messages = signingData.Messages.Replace("CSK", "BB ID Token"); - MessageBox.Show(signingData.Messages, "Registration Window", MessageBoxButton.OK, MessageBoxImage.Information, MessageBoxResult.OK); - signingData.Messages = null; - } - - DialogResult = true; - } - - /// - /// Perform actions on close of dialog. - /// - /// - protected override void OnClosing(CancelEventArgs e) - { - signingData.CleanUp(); - } - } -} \ No newline at end of file diff --git a/src_vs2012/VSNDK.Package/Signing/SigningDialog.xaml b/src_vs2012/VSNDK.Package/Signing/SigningDialog.xaml deleted file mode 100644 index 6b1c91c5..00000000 --- a/src_vs2012/VSNDK.Package/Signing/SigningDialog.xaml +++ /dev/null @@ -1,35 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src_vs2012/VSNDK.Package/VsDesignerControl.xaml.cs b/src_vs2012/VSNDK.Package/VsDesignerControl.xaml.cs deleted file mode 100644 index 7de1ae8c..00000000 --- a/src_vs2012/VSNDK.Package/VsDesignerControl.xaml.cs +++ /dev/null @@ -1,323 +0,0 @@ -//* Copyright 2010-2011 Research In Motion Limited. -//* -//* Licensed under the Apache License, Version 2.0 (the "License"); -//* you may not use this file except in compliance with the License. -//* You may obtain a copy of the License at -//* -//* http://www.apache.org/licenses/LICENSE-2.0 -//* -//* Unless required by applicable law or agreed to in writing, software -//* distributed under the License is distributed on an "AS IS" BASIS, -//* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//* See the License for the specific language governing permissions and -//* limitations under the License. - -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Windows; -using System.Windows.Controls; -using System.Windows.Data; -using System.Windows.Documents; -using System.Windows.Input; -using System.Windows.Media; -using System.Windows.Media.Imaging; -using System.Windows.Navigation; -using System.Windows.Shapes; -using EnvDTE; -using Microsoft.VisualStudio.Shell; -using System.IO; - -namespace RIM.VSNDK_Package -{ - /// - /// Interaction logic for VsDesignerControl.xaml - /// - public partial class VsDesignerControl : UserControl - { - private ServiceProvider _serviceProvider; - /// - /// Primary Constructor - /// - public VsDesignerControl() - { - InitializeComponent(); - } - - /// - /// Overloaded Constructor - /// - /// - public VsDesignerControl(ServiceProvider serviceProvider, IViewModel viewModel) - { - _serviceProvider = serviceProvider; - DataContext = viewModel; - InitializeComponent(); - // wait until we're initialized to handle events - viewModel.ViewModelChanged += new EventHandler(ViewModelChanged); - } - - internal void DoIdle() - { - // only call the view model DoIdle if this control has focus - // otherwise, we should skip and this will be called again - // once focus is regained - IViewModel viewModel = DataContext as IViewModel; - if (viewModel != null && this.IsKeyboardFocusWithin) - { - viewModel.DoIdle(); - } - } - - /// - /// ViewModel Changerd Event - /// - /// - /// - private void ViewModelChanged(object sender, EventArgs e) - { - // this gets called when the view model is updated because the Xml Document was updated - // since we don't get individual PropertyChanged events, just re-set the DataContext - IViewModel viewModel = DataContext as IViewModel; - DataContext = null; // first, set to null so that we see the change and rebind - DataContext = viewModel; - } - - /// - /// Check to see if the inputed text is allowed - /// - /// - /// - private Boolean IsTextAllowed(String text) - { - return Array.TrueForAll(text.ToCharArray(), - delegate(Char c) { return Char.IsDigit(c) || Char.IsControl(c); }); - } - - /// - /// Use the PreviewTextInputHandler to respond to key presses - /// - /// - /// - - private void PreviewTextInputHandler(object sender, TextCompositionEventArgs e) - { - e.Handled = !IsTextAllowed(e.Text); - } - - /// - /// Use the DataObject.Pasting Handler - /// - /// - /// - private void PastingHandler(object sender, DataObjectPastingEventArgs e) - { - if (e.DataObject.GetDataPresent(typeof(String))) - { - String text = (String)e.DataObject.GetData(typeof(String)); - if (!IsTextAllowed(text)) e.CancelCommand(); - } - else e.CancelCommand(); - } - - /// - /// GetAuthor Button Click Event - /// - /// - /// - private void btGetAuthor_Click(object sender, RoutedEventArgs e) - { - IViewModel viewModel = DataContext as IViewModel; - viewModel.setAuthorInfo(); - } - - private void btnAddIC_Click(object sender, RoutedEventArgs e) - { - string filename = string.Empty; - Microsoft.Win32.OpenFileDialog dlg = new Microsoft.Win32.OpenFileDialog(); - dlg.DefaultExt = ".png"; // Default file extension - dlg.Filter = "Image Files (*.png, *.jpg, *.gif)|*.png;*.jpg;*.gif"; - bool? result = dlg.ShowDialog(); - if (result == true) - { - filename = dlg.FileName; - - AddIconToProject(filename); - - IViewModel viewModel = DataContext as IViewModel; - if (viewModel != null) - { - FileInfo fileInfo = new FileInfo(filename); - viewModel.AddIcon(fileInfo); - } - } - } - - private void AddIconToProject(string path) - { - try - { - DTE dte = (DTE)_serviceProvider.GetService(typeof(DTE)); - string solutionDir = System.IO.Path.GetDirectoryName(dte.Solution.FullName); - - - Projects projs = dte.Solution.Projects; - foreach (Project proj in projs) - { - IViewModel viewModel = DataContext as IViewModel; - if (viewModel != null) - { - - FileInfo fileInfo1 = new FileInfo(proj.FullName); - FileInfo fileInfo2 = new FileInfo(viewModel.Model.Name); - FileInfo fileInfo3 = new FileInfo(path); - - if (viewModel.AppName == proj.Name) - { - proj.ProjectItems.AddFromFile(path); - viewModel.AddLocalAsset(path); - } - } - } - } - catch (Exception e) - { - - } - } - - private void btnRemoveIC_Click(object sender, RoutedEventArgs e) - { - if (grdIcon.SelectedItem != null) - { - IViewModel viewModel = DataContext as IViewModel; - if (viewModel != null) - { - viewModel.DeleteIcon(grdIcon.SelectedItem); - } - } - } - - - private void btnAddSS_Click(object sender, RoutedEventArgs e) - { - string filename = string.Empty; - Microsoft.Win32.OpenFileDialog dlg = new Microsoft.Win32.OpenFileDialog(); - dlg.DefaultExt = ".png"; // Default file extension - dlg.Filter = "Image Files (*.png, *.jpg, *.gif)|*.png;*.jpg;*.gif"; - bool? result = dlg.ShowDialog(); - if (result == true) - { - filename = dlg.FileName; - - AddIconToProject(filename); - - IViewModel viewModel = DataContext as IViewModel; - if (viewModel != null) - { - FileInfo fileInfo = new FileInfo(filename); - viewModel.AddSplashScreen(fileInfo); - } - } - - } - - private void btnRemoveSS_Click(object sender, RoutedEventArgs e) - { - if (grdSplashScreen.SelectedItem != null) - { - IViewModel viewModel = DataContext as IViewModel; - if (viewModel != null) - { - viewModel.DeleteSplashScreen(grdSplashScreen.SelectedItem); - } - } - } - - private void CheckBox_Click(object sender, RoutedEventArgs e) - { - if ((sender as CheckBox).IsChecked == true) - { - IViewModel viewModel = DataContext as IViewModel; - if (viewModel != null) - { - viewModel.CheckPermission((grdPermissions.SelectedItem as PermissionItemClass).Identifier); - }; - } - else - { - IViewModel viewModel = DataContext as IViewModel; - if (viewModel != null) - { - viewModel.UnCheckPermission((grdPermissions.SelectedItem as PermissionItemClass).Identifier); - }; - } - - } - - private void btnAddAsset_Click(object sender, RoutedEventArgs e) - { - string filename = string.Empty; - Microsoft.Win32.OpenFileDialog dlg = new Microsoft.Win32.OpenFileDialog(); - - bool? result = dlg.ShowDialog(); - if (result == true) - { - filename = dlg.FileName; - - - IViewModel viewModel = DataContext as IViewModel; - if (viewModel != null) - { - viewModel.AddLocalAsset(filename); - } - } - - } - - private void btnRemoveAsset_Click(object sender, RoutedEventArgs e) - { - if (grdAssets.SelectedItem != null) - { - IViewModel viewModel = DataContext as IViewModel; - if (viewModel != null) - { - viewModel.DeleteLocalAsset(grdAssets.SelectedItem); - } - } - } - - private void CheckBox_Click_1(object sender, RoutedEventArgs e) - { - bool isPublic = false; - - IViewModel viewModel = DataContext as IViewModel; - if (viewModel != null) - { - isPublic = (sender as CheckBox).IsChecked == true; - viewModel.EditLocalAsset((grdAssets.SelectedItem as asset).Value, isPublic, ""); - } - } - - private void ComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e) - { - string assetType = ""; - - if (e.RemovedItems.Count != 0) - { - if (grdAssets.SelectedItems.Count != 0) - { - IViewModel viewModel = DataContext as IViewModel; - if (viewModel != null) - { - assetType = (sender as ComboBox).SelectedValue.ToString(); - viewModel.EditLocalAsset((grdAssets.SelectedItem as asset).Value, null, assetType); - } - } - } - } - - - } -} diff --git a/src_vs2012/VSNDK.Package/XmlEditorDesignerViewRegistration.cs b/src_vs2012/VSNDK.Package/XmlEditorDesignerViewRegistration.cs deleted file mode 100644 index aa8f25ac..00000000 --- a/src_vs2012/VSNDK.Package/XmlEditorDesignerViewRegistration.cs +++ /dev/null @@ -1,205 +0,0 @@ -//* Copyright 2010-2011 Research In Motion Limited. -//* -//* Licensed under the Apache License, Version 2.0 (the "License"); -//* you may not use this file except in compliance with the License. -//* You may obtain a copy of the License at -//* -//* http://www.apache.org/licenses/LICENSE-2.0 -//* -//* Unless required by applicable law or agreed to in writing, software -//* distributed under the License is distributed on an "AS IS" BASIS, -//* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//* See the License for the specific language governing permissions and -//* limitations under the License. - -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using Microsoft.VisualStudio.Shell; -using System.IO; -using Microsoft.VisualStudio; - -namespace RIM.VSNDK_Package -{ - /// - /// Register our bardescriptor.xml custom editor - /// - [AttributeUsage(AttributeTargets.Class, AllowMultiple = true, Inherited = true)] - public sealed class XmlEditorDesignerViewRegistrationAttribute : RegistrationAttribute - { - /// Declare Constants - const string XmlChooserFactory = "XmlChooserFactory"; - const string XmlChooserEditorExtensionsKeyPath = @"Editors\{32CC8DFA-2D70-49b2-94CD-22D57349B778}\Extensions"; - const string XmlEditorFactoryGuid = "{FA3CD31E-987B-443A-9B81-186104E8DAC1}"; - - /// Declare Private Member Variables - private string keyName; - private string defaultExtension; - private Guid defaultLogicalView; - private int xmlChooserPriority; - - /// - /// Construtor - /// - /// Registry key name - /// Default extension for editor - /// Default Editor Factory - /// XML Priority - public XmlEditorDesignerViewRegistrationAttribute(string keyName, string defaultExtension, object defaultLogicalViewEditorFactory, int xmlChooserPriority) - { - /// Validate parameter input - if (string.IsNullOrWhiteSpace(keyName)) - { - throw new ArgumentException("Editor description cannot be null or empty.", "editorDescription"); - } - if (string.IsNullOrWhiteSpace(defaultExtension)) - { - throw new ArgumentException("Extension cannot be null or empty.", "extension"); - } - if (defaultLogicalViewEditorFactory == null) - { - throw new ArgumentNullException("defaultLogicalViewEditorFactory"); - } - - /// Set Member Variables - this.keyName = keyName; - this.defaultExtension = defaultExtension; - this.defaultLogicalView = TryGetGuidFromObject(defaultLogicalViewEditorFactory); - this.xmlChooserPriority = xmlChooserPriority; - - this.CodeLogicalViewEditor = XmlEditorFactoryGuid; - this.DebuggingLogicalViewEditor = XmlEditorFactoryGuid; - this.DesignerLogicalViewEditor = XmlEditorFactoryGuid; - this.TextLogicalViewEditor = XmlEditorFactoryGuid; - } - - /// - /// Register the custom editor - /// - /// - public override void Register(RegistrationAttribute.RegistrationContext context) - { - /// Validate parameter input - if (context == null) - { - throw new ArgumentNullException("context"); - } - - /// Set extension key - Key extensionKey = context.CreateKey(XmlChooserEditorExtensionsKeyPath); - extensionKey.SetValue(defaultExtension, xmlChooserPriority); - extensionKey.Close(); - - /// set editor key - Key editorKey = context.CreateKey(Path.Combine(XmlChooserFactory, keyName)); - editorKey.SetValue("DefaultLogicalView", defaultLogicalView.ToString("B").ToUpperInvariant()); - editorKey.SetValue("Extension", defaultExtension); - if (!string.IsNullOrWhiteSpace(Namespace)) - { - editorKey.SetValue("Namespace", Namespace); - } - if (MatchExtensionAndNamespace) - { - editorKey.SetValue("Match", "both"); - } - if (IsDataSet.HasValue) - { - editorKey.SetValue("IsDataSet", Convert.ToInt32(IsDataSet.Value)); - } - /// Set DebuggingLogicalViewEditor Mapping - if (DebuggingLogicalViewEditor != null) - { - editorKey.SetValue(VSConstants.LOGVIEWID_Debugging.ToString("B").ToUpperInvariant(), TryGetGuidFromObject(DebuggingLogicalViewEditor).ToString("B").ToUpperInvariant()); - } - /// Set CodeLogicalViewEditor Mapping - if (CodeLogicalViewEditor != null) - { - editorKey.SetValue(VSConstants.LOGVIEWID_Code.ToString("B").ToUpperInvariant(), TryGetGuidFromObject(CodeLogicalViewEditor).ToString("B").ToUpperInvariant()); - } - /// Set DesignerLogicalViewEditor Mapping - if (DesignerLogicalViewEditor != null) - { - editorKey.SetValue(VSConstants.LOGVIEWID_Designer.ToString("B").ToUpperInvariant(), TryGetGuidFromObject(DesignerLogicalViewEditor).ToString("B").ToUpperInvariant()); - } - /// Set TextLogicalViewEditor Mapping - if (TextLogicalViewEditor != null) - { - editorKey.SetValue(VSConstants.LOGVIEWID_TextView.ToString("B").ToUpperInvariant(), TryGetGuidFromObject(TextLogicalViewEditor).ToString("B").ToUpperInvariant()); - } - editorKey.Close(); - } - - /// - /// Unregister the custom editor - /// - /// - public override void Unregister(RegistrationContext context) - { - /// Validate parameter input - if (context == null) - { - throw new ArgumentNullException("context"); - } - - /// Remove Key - context.RemoveKey(Path.Combine(XmlChooserFactory, keyName)); - context.RemoveValue(XmlChooserEditorExtensionsKeyPath, defaultExtension); - context.RemoveKeyIfEmpty(XmlChooserEditorExtensionsKeyPath); - } - - - /// - /// Private member function to return the GUID of an object. - /// - /// - /// - private Guid TryGetGuidFromObject(object guidObject) - { - // figure out what type of object they passed in and get the GUID from it - if (guidObject is string) - return new Guid((string)guidObject); - else if (guidObject is Type) - return ((Type)guidObject).GUID; - else if (guidObject is Guid) - return (Guid)guidObject; - else - throw new ArgumentException("Could not determine Guid from supplied object.", "guidObject"); - } - - /// - /// The editor factor for the Code View Editor - /// - public object CodeLogicalViewEditor { get; set; } - - /// - /// The editor factory for the Debugging View Editor - /// - public object DebuggingLogicalViewEditor { get; set; } - - /// - /// The editor factor for the Designer View Editor - /// - public object DesignerLogicalViewEditor { get; set; } - - /// - /// The edtior factgory for the Text View Editor - /// - public object TextLogicalViewEditor { get; set; } - - /// - /// Namespace property - /// - public string Namespace { get; set; } - - /// - /// Property - /// - public bool MatchExtensionAndNamespace { get; set; } - - /// - /// Special value used only by the DataSet designer. - /// - public bool? IsDataSet { get; set; } - } -} diff --git a/src_vs2012/VSNDK.Package/bar-descriptor.cs b/src_vs2012/VSNDK.Package/bar-descriptor.cs deleted file mode 100644 index 5ab7560d..00000000 --- a/src_vs2012/VSNDK.Package/bar-descriptor.cs +++ /dev/null @@ -1,919 +0,0 @@ -//* Copyright 2010-2011 Research In Motion Limited. -//* -//* Licensed under the Apache License, Version 2.0 (the "License"); -//* you may not use this file except in compliance with the License. -//* You may obtain a copy of the License at -//* -//* http://www.apache.org/licenses/LICENSE-2.0 -//* -//* Unless required by applicable law or agreed to in writing, software -//* distributed under the License is distributed on an "AS IS" BASIS, -//* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//* See the License for the specific language governing permissions and -//* limitations under the License. - -namespace RIM.VSNDK_Package -{ - using System.Xml.Serialization; - using System; - using System.Collections; - using System.Collections.Generic; - - - /// - [System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.0.30319.1")] - [System.SerializableAttribute()] - [System.Diagnostics.DebuggerStepThroughAttribute()] - [System.ComponentModel.DesignerCategoryAttribute("code")] - [System.Xml.Serialization.XmlTypeAttribute(AnonymousType=true, Namespace="http://www.qnx.com/schemas/application/1.0")] - [System.Xml.Serialization.XmlRootAttribute(Namespace="http://www.qnx.com/schemas/application/1.0", IsNullable=true)] - public partial class asset : object, System.ComponentModel.INotifyPropertyChanged { - - private string pathField; - - private string publicAssetField; - - private string entryField; - - private string typeField; - - private string[] _assettypeList = {"Other", "Library", "Executable", "Entry-point"}; - - private string _assettype = "Other"; - - private string valueField; - - [System.Xml.Serialization.XmlIgnore] - public string assettype - { - get - { - _assettype = getAssetType(); - return _assettype; - } - set - { - if (value != _assettype) - _assettype = value; - } - } - - [System.Xml.Serialization.XmlIgnore] - public string[] assettypelist - { - get - { - return this._assettypeList; - } - } - - /// - [System.Xml.Serialization.XmlAttributeAttribute()] - public string path { - get { - return this.pathField; - } - set { - this.pathField = value; - this.RaisePropertyChanged("path"); - } - } - - /// - [System.Xml.Serialization.XmlAttributeAttribute("public")] - public string publicAsset - { - get - { - return this.publicAssetField; - } - set - { - this.publicAssetField = value; - this.RaisePropertyChanged("publicAsset"); - } - } - - /// - [System.Xml.Serialization.XmlAttributeAttribute()] - public string entry { - get { - return this.entryField; - } - set { - this.entryField = value; - this.RaisePropertyChanged("entry"); - } - } - - /// - [System.Xml.Serialization.XmlAttributeAttribute()] - public string type { - get { - return this.typeField; - } - set { - this.typeField = value; - this.RaisePropertyChanged("type"); - } - } - - /// - [System.Xml.Serialization.XmlTextAttribute()] - public string Value { - get { - return this.valueField; - } - set { - this.valueField = value; - this.RaisePropertyChanged("Value"); - } - } - - public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged; - - protected void RaisePropertyChanged(string propertyName) - { - System.ComponentModel.PropertyChangedEventHandler propertyChanged = this.PropertyChanged; - if ((propertyChanged != null)) { - propertyChanged(this, new System.ComponentModel.PropertyChangedEventArgs(propertyName)); - } - } - - private string getAssetType() - { - if (this.valueField.StartsWith("lib/")) - { - return "Library"; - } - else if (this.typeField == "Qnx/Elf") - { - if (this.entry == "true") - { - return "Entry-point"; - } - else - { - return "Executable"; - } - } - else - { - return "Other"; - } - } - } - - /// - [System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.0.30319.1")] - [System.SerializableAttribute()] - [System.Diagnostics.DebuggerStepThroughAttribute()] - [System.ComponentModel.DesignerCategoryAttribute("code")] - [System.Xml.Serialization.XmlTypeAttribute(AnonymousType=true, Namespace="http://www.qnx.com/schemas/application/1.0")] - [System.Xml.Serialization.XmlRootAttribute(Namespace="http://www.qnx.com/schemas/application/1.0", IsNullable=false)] - public partial class qnx : object, System.ComponentModel.INotifyPropertyChanged { - - private string idField; - - private string nameField; - - private string versionNumberField; - - private string buildIdField; - - private string descriptionField; - - private string authorField; - - private string authorIdField; - - private string categoryField; - - private qnxInitialWindow initialWindowField; - - private asset[] assetField; - - private qnxConfiguration[] configurationField; - - private qnxPermission[] permissionField; - - private qnxIcon iconField; - - private qnxSplashScreens splashScreenField; - - private qnxAction[] actionField; - - private qnxEnv[] envField; - - /// - public string id { - get { - return this.idField; - } - set { - this.idField = value; - this.RaisePropertyChanged("id"); - } - } - - /// - public string name { - get { - return this.nameField; - } - set { - this.nameField = value; - this.RaisePropertyChanged("name"); - } - } - - /// - public string versionNumber { - get { - return this.versionNumberField; - } - set { - this.versionNumberField = value; - this.RaisePropertyChanged("versionNumber"); - } - } - - /// - public string buildId { - get { - return this.buildIdField; - } - set { - this.buildIdField = value; - this.RaisePropertyChanged("buildId"); - } - } - - /// - public string description { - get { - return this.descriptionField; - } - set { - this.descriptionField = value; - this.RaisePropertyChanged("description"); - } - } - - /// - public string author { - get { - return this.authorField; - } - set { - this.authorField = value; - this.RaisePropertyChanged("author"); - } - } - - /// - public string authorId - { - get - { - return this.authorIdField; - } - set - { - this.authorIdField = value; - this.RaisePropertyChanged("authorId"); - } - } - - /// - public string category { - get { - return this.categoryField; - } - set { - this.categoryField = value; - this.RaisePropertyChanged("category"); - } - } - - /// - [System.Xml.Serialization.XmlElementAttribute("initialWindow")] - public qnxInitialWindow initialWindow { - get { - return this.initialWindowField; - } - set { - this.initialWindowField = value; - this.RaisePropertyChanged("initialWindow"); - } - } - - /// - [System.Xml.Serialization.XmlElementAttribute("asset", IsNullable=true)] - public asset[] asset { - get { - return this.assetField; - } - set { - this.assetField = value; - this.RaisePropertyChanged("asset"); - } - } - - /// - [System.Xml.Serialization.XmlElementAttribute("configuration")] - public qnxConfiguration[] configuration { - get { - return this.configurationField; - } - set { - this.configurationField = value; - this.RaisePropertyChanged("configuration"); - } - } - - /// - [System.Xml.Serialization.XmlElementAttribute("permission", IsNullable = true)] - public qnxPermission[] permission - { - get - { - return this.permissionField; - } - set - { - this.permissionField = value; - this.RaisePropertyChanged("permission"); - } - } - - public void AddPermission(qnxPermission newPermission) - { - if (permission == null) - { - permission = new qnxPermission[0]; - } - - var newPermissionsList = permission; - Array.Resize(ref newPermissionsList, newPermissionsList.Length + 1); - newPermissionsList[newPermissionsList.Length - 1] = newPermission; - permission = newPermissionsList; - } - - public void DeletePermission(qnxPermission oldPermission) - { - foreach (qnxPermission perm in permission) - { - if (perm.Value == oldPermission.Value) - { - List permissionList = new List(permission); - permissionList.Remove(perm); - permission = permissionList.ToArray(); - } - } - } - - /// - [System.Xml.Serialization.XmlElementAttribute("icon")] - public qnxIcon icon { - get { - return this.iconField; - } - set { - this.iconField = value; - this.RaisePropertyChanged("icon"); - } - } - - /// - [System.Xml.Serialization.XmlElementAttribute("splashScreens")] - public qnxSplashScreens splashScreens - { - get - { - return this.splashScreenField; - } - set - { - this.splashScreenField = value; - this.RaisePropertyChanged("splashScreens"); - } - } - - /// - [System.Xml.Serialization.XmlElementAttribute("action", IsNullable=true)] - public qnxAction[] action { - get { - return this.actionField; - } - set { - this.actionField = value; - this.RaisePropertyChanged("action"); - } - } - - /// - [System.Xml.Serialization.XmlElementAttribute("env")] - public qnxEnv[] env { - get { - return this.envField; - } - set { - this.envField = value; - this.RaisePropertyChanged("env"); - } - } - - public void AddLocalAsset(asset newAsset) - { - if (asset == null) - { - asset = new asset[0]; - } - - var local_asset = asset; - Array.Resize(ref local_asset, local_asset.Length + 1); - local_asset[local_asset.Length - 1] = newAsset; - asset = local_asset; - } - - public void DeleteLocalAsset(asset removeAsset) - { - List assetList = new List(asset); - assetList.Remove(removeAsset); - asset = assetList.ToArray(); - } - - - public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged; - - protected void RaisePropertyChanged(string propertyName) { - System.ComponentModel.PropertyChangedEventHandler propertyChanged = this.PropertyChanged; - if ((propertyChanged != null)) { - propertyChanged(this, new System.ComponentModel.PropertyChangedEventArgs(propertyName)); - } - } - } - - /// - [System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.0.30319.1")] - [System.SerializableAttribute()] - [System.Diagnostics.DebuggerStepThroughAttribute()] - [System.ComponentModel.DesignerCategoryAttribute("code")] - [System.Xml.Serialization.XmlTypeAttribute(AnonymousType=true, Namespace="http://www.qnx.com/schemas/application/1.0")] - public partial class qnxInitialWindow : object, System.ComponentModel.INotifyPropertyChanged { - - private string autoOrientsField; - - private string aspectRatioField; - - private string systemChromeField; - - private string transparentField; - - /// - [System.Xml.Serialization.XmlElementAttribute("autoOrients", IsNullable = true)] - public string autoOrients - { - get - { - return this.autoOrientsField; - } - set - { - this.autoOrientsField = value; - this.RaisePropertyChanged("autoOrients"); - } - } - - /// - [System.Xml.Serialization.XmlElementAttribute("aspectRatio", IsNullable = true)] - public string aspectRatio - { - get - { - return this.aspectRatioField; - } - set - { - this.aspectRatioField = value; - this.RaisePropertyChanged("aspectRatio"); - } - } - - /// - public string systemChrome { - get { - return this.systemChromeField; - } - set { - this.systemChromeField = value; - this.RaisePropertyChanged("systemChrome"); - } - } - - /// - public string transparent { - get { - return this.transparentField; - } - set { - this.transparentField = value; - this.RaisePropertyChanged("transparent"); - } - } - - public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged; - - protected void RaisePropertyChanged(string propertyName) { - System.ComponentModel.PropertyChangedEventHandler propertyChanged = this.PropertyChanged; - if ((propertyChanged != null)) { - propertyChanged(this, new System.ComponentModel.PropertyChangedEventArgs(propertyName)); - } - } - } - - /// - [System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.0.30319.1")] - [System.SerializableAttribute()] - [System.Diagnostics.DebuggerStepThroughAttribute()] - [System.ComponentModel.DesignerCategoryAttribute("code")] - [System.Xml.Serialization.XmlTypeAttribute(AnonymousType=true, Namespace="http://www.qnx.com/schemas/application/1.0")] - public partial class qnxConfiguration : object, System.ComponentModel.INotifyPropertyChanged { - - private string platformArchitectureField; - - private asset[] assetField; - - private string idField; - - private string nameField; - - /// - public string platformArchitecture { - get { - return this.platformArchitectureField; - } - set { - this.platformArchitectureField = value; - this.RaisePropertyChanged("platformArchitecture"); - } - } - - /// - [System.Xml.Serialization.XmlElementAttribute("asset", IsNullable=true)] - public asset[] asset { - get { - return this.assetField; - } - set { - this.assetField = value; - this.RaisePropertyChanged("asset"); - } - } - - /// - [System.Xml.Serialization.XmlAttributeAttribute()] - public string id { - get { - return this.idField; - } - set { - this.idField = value; - this.RaisePropertyChanged("id"); - } - } - - /// - [System.Xml.Serialization.XmlAttributeAttribute()] - public string name { - get { - return this.nameField; - } - set { - this.nameField = value; - this.RaisePropertyChanged("name"); - } - } - - public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged; - - protected void RaisePropertyChanged(string propertyName) { - System.ComponentModel.PropertyChangedEventHandler propertyChanged = this.PropertyChanged; - if ((propertyChanged != null)) { - propertyChanged(this, new System.ComponentModel.PropertyChangedEventArgs(propertyName)); - } - } - - public void AddAsset(asset newAsset) - { - if (asset == null) - { - asset = new asset[0]; - } - - var local_asset = asset; - Array.Resize(ref local_asset, local_asset.Length + 1); - local_asset[local_asset.Length - 1] = newAsset; - asset = local_asset; - } - - public void DeleteAsset(asset removeAsset) - { - List assetList = new List(asset); - assetList.Remove(removeAsset); - asset = assetList.ToArray(); - } - } - - /// - [System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.0.30319.1")] - [System.SerializableAttribute()] - [System.Diagnostics.DebuggerStepThroughAttribute()] - [System.ComponentModel.DesignerCategoryAttribute("code")] - [System.Xml.Serialization.XmlTypeAttribute(AnonymousType = true, Namespace = "http://www.qnx.com/schemas/application/1.0")] - public partial class qnxPermission : object, System.ComponentModel.INotifyPropertyChanged - { - - private string systemField; - - private string valueField; - - /// - [System.Xml.Serialization.XmlAttributeAttribute()] - public string system - { - get - { - return this.systemField; - } - set - { - this.systemField = value; - this.RaisePropertyChanged("system"); - } - } - - /// - [System.Xml.Serialization.XmlTextAttribute()] - public string Value - { - get - { - return this.valueField; - } - set - { - this.valueField = value; - this.RaisePropertyChanged("Value"); - } - } - - public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged; - - protected void RaisePropertyChanged(string propertyName) - { - System.ComponentModel.PropertyChangedEventHandler propertyChanged = this.PropertyChanged; - if ((propertyChanged != null)) - { - propertyChanged(this, new System.ComponentModel.PropertyChangedEventArgs(propertyName)); - } - } - } - - /// - [System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.0.30319.1")] - [System.SerializableAttribute()] - [System.Diagnostics.DebuggerStepThroughAttribute()] - [System.ComponentModel.DesignerCategoryAttribute("code")] - [System.Xml.Serialization.XmlTypeAttribute(AnonymousType=true, Namespace="http://www.qnx.com/schemas/application/1.0")] - public partial class qnxIcon : object, System.ComponentModel.INotifyPropertyChanged { - - private string[] imageField; - - /// - [System.Xml.Serialization.XmlElementAttribute("image", IsNullable = true)] - public string[] image { - get { - return this.imageField; - } - set { - this.imageField = value; - this.RaisePropertyChanged("image"); - } - } - - public void AddIconImage(string iconImage) - { - if (image == null) - { - image = new string[0]; - } - - var iconImages = image; - Array.Resize(ref iconImages, iconImages.Length + 1); - iconImages[iconImages.Length - 1] = iconImage; - image = iconImages; - } - - public void DeleteIconImage(string iconImage) - { - List iconList = new List(image); - iconList.Remove(iconImage); - image = iconList.ToArray(); - } - - public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged; - - protected void RaisePropertyChanged(string propertyName) { - System.ComponentModel.PropertyChangedEventHandler propertyChanged = this.PropertyChanged; - if ((propertyChanged != null)) { - propertyChanged(this, new System.ComponentModel.PropertyChangedEventArgs(propertyName)); - } - } - } - - /// - [System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.0.30319.1")] - [System.SerializableAttribute()] - [System.Diagnostics.DebuggerStepThroughAttribute()] - [System.ComponentModel.DesignerCategoryAttribute("code")] - [System.Xml.Serialization.XmlTypeAttribute(AnonymousType = true, Namespace = "http://www.qnx.com/schemas/application/1.0")] - public partial class qnxSplashScreens : object, System.ComponentModel.INotifyPropertyChanged - { - - private string[] imageField; - - [System.Xml.Serialization.XmlElementAttribute("image", IsNullable = true)] - public string[] image - { - get - { - return this.imageField; - } - set - { - this.imageField = value; - this.RaisePropertyChanged("image"); - } - } - - public void AddSplashScreenImage(string iconImage) - { - if (image == null) - { - image = new string[0]; - } - - var iconImages = image; - Array.Resize(ref iconImages, iconImages.Length + 1); - iconImages[iconImages.Length - 1] = iconImage; - image = iconImages; - } - - public void DeleteSplashScreenImage(string iconImage) - { - List iconList = new List(image); - iconList.Remove(iconImage); - image = iconList.ToArray(); - } - - public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged; - - protected void RaisePropertyChanged(string propertyName) - { - System.ComponentModel.PropertyChangedEventHandler propertyChanged = this.PropertyChanged; - if ((propertyChanged != null)) - { - propertyChanged(this, new System.ComponentModel.PropertyChangedEventArgs(propertyName)); - } - } - } - - - /// - [System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.0.30319.1")] - [System.SerializableAttribute()] - [System.Diagnostics.DebuggerStepThroughAttribute()] - [System.ComponentModel.DesignerCategoryAttribute("code")] - [System.Xml.Serialization.XmlTypeAttribute(AnonymousType=true, Namespace="http://www.qnx.com/schemas/application/1.0")] - public partial class qnxAction : object, System.ComponentModel.INotifyPropertyChanged { - - private string systemField; - - private string valueField; - - /// - [System.Xml.Serialization.XmlAttributeAttribute()] - public string system { - get { - return this.systemField; - } - set { - this.systemField = value; - this.RaisePropertyChanged("system"); - } - } - - /// - [System.Xml.Serialization.XmlTextAttribute()] - public string Value { - get { - return this.valueField; - } - set { - this.valueField = value; - this.RaisePropertyChanged("Value"); - } - } - - public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged; - - protected void RaisePropertyChanged(string propertyName) { - System.ComponentModel.PropertyChangedEventHandler propertyChanged = this.PropertyChanged; - if ((propertyChanged != null)) { - propertyChanged(this, new System.ComponentModel.PropertyChangedEventArgs(propertyName)); - } - } - } - - /// - [System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.0.30319.1")] - [System.SerializableAttribute()] - [System.Diagnostics.DebuggerStepThroughAttribute()] - [System.ComponentModel.DesignerCategoryAttribute("code")] - [System.Xml.Serialization.XmlTypeAttribute(AnonymousType=true, Namespace="http://www.qnx.com/schemas/application/1.0")] - public partial class qnxEnv : object, System.ComponentModel.INotifyPropertyChanged { - - private string varField; - - private string valueField; - - /// - [System.Xml.Serialization.XmlAttributeAttribute()] - public string var { - get { - return this.varField; - } - set { - this.varField = value; - this.RaisePropertyChanged("var"); - } - } - - /// - [System.Xml.Serialization.XmlAttributeAttribute()] - public string value { - get { - return this.valueField; - } - set { - this.valueField = value; - this.RaisePropertyChanged("value"); - } - } - - public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged; - - protected void RaisePropertyChanged(string propertyName) { - System.ComponentModel.PropertyChangedEventHandler propertyChanged = this.PropertyChanged; - if ((propertyChanged != null)) { - propertyChanged(this, new System.ComponentModel.PropertyChangedEventArgs(propertyName)); - } - } - } - - /// - [System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.0.30319.1")] - [System.SerializableAttribute()] - [System.Diagnostics.DebuggerStepThroughAttribute()] - [System.ComponentModel.DesignerCategoryAttribute("code")] - [System.Xml.Serialization.XmlTypeAttribute(AnonymousType=true, Namespace="http://www.qnx.com/schemas/application/1.0")] - [System.Xml.Serialization.XmlRootAttribute(Namespace="http://www.qnx.com/schemas/application/1.0", IsNullable=false)] - public partial class NewDataSet : object, System.ComponentModel.INotifyPropertyChanged { - - private object[] itemsField; - - /// - [System.Xml.Serialization.XmlElementAttribute("asset", typeof(asset), IsNullable=true)] - [System.Xml.Serialization.XmlElementAttribute("qnx", typeof(qnx))] - public object[] Items { - get { - return this.itemsField; - } - set { - this.itemsField = value; - this.RaisePropertyChanged("Items"); - } - } - - public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged; - - protected void RaisePropertyChanged(string propertyName) { - System.ComponentModel.PropertyChangedEventHandler propertyChanged = this.PropertyChanged; - if ((propertyChanged != null)) { - propertyChanged(this, new System.ComponentModel.PropertyChangedEventArgs(propertyName)); - } - } - } -} diff --git a/src_vs2012/VSNDK.PackagePackage.cs b/src_vs2012/VSNDK.PackagePackage.cs deleted file mode 100644 index 4ecebad3..00000000 --- a/src_vs2012/VSNDK.PackagePackage.cs +++ /dev/null @@ -1,1288 +0,0 @@ -//* Copyright 2010-2011 Research In Motion Limited. -//* -//* Licensed under the Apache License, Version 2.0 (the "License"); -//* you may not use this file except in compliance with the License. -//* You may obtain a copy of the License at -//* -//* http://www.apache.org/licenses/LICENSE-2.0 -//* -//* Unless required by applicable law or agreed to in writing, software -//* distributed under the License is distributed on an "AS IS" BASIS, -//* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//* See the License for the specific language governing permissions and -//* limitations under the License. - -using System; -using System.Diagnostics; -using System.Globalization; -using System.Runtime.InteropServices; -using System.ComponentModel.Design; -using Microsoft.Win32; -using Microsoft.VisualStudio; -using Microsoft.VisualStudio.VCProjectEngine; -using Microsoft.VisualStudio.Shell.Interop; -using Microsoft.VisualStudio.OLE.Interop; -using Microsoft.VisualStudio.Shell; -using System.Xml; -using System.IO; -using System.Collections.Generic; -using System.Linq; -using EnvDTE; -using System.Windows.Forms; -using VSNDK.Package; -using EnvDTE80; -using System.Text.RegularExpressions; -using System.Collections.Specialized; -using System.Security.Cryptography; -using System.Text; -using RIM.VSNDK_Package.UpdateManager.Model; - -namespace RIM.VSNDK_Package -{ - /// - /// Class to store Installed APIs - /// - public class APIClass - { - public string Name { get; set; } - public string HostName { get; set; } - public string TargetName { get; set; } - public string Version { get; set; } - - public APIClass(string name, string hostName, string targetName, string version) - { - Name = name; - Version = version; - HostName = hostName; - TargetName = targetName; - } - } - /// - /// Class to store Simulators - /// - public class SimulatorsClass - { - public string APILevel { get; set; } - public string TargetVersion { get; set; } - public bool LatestVersion { get; set; } - public bool IsInstalled { get; set; } - - public string TargetVersionText - { - get { return LatestVersion ? "Latest Version " + TargetVersion : TargetVersion; } - } - - public string InstalledVersionText - { - get { return "BlackBerry Native SDK Simulator (" + TargetVersion + ")"; } - } - - public string LabelAPIVersion - { - get { return LatestVersion ? "visible" : "collapsed"; } - } - - public string SubAPIVersion - { - get { return LatestVersion ? "collapsed" : "visible"; } - } - - public string LabelAPIVersionText - { - get - { - return "Simulator for BlackBerry Native SDK " + APILevel; - } - } - - public string AvailableVisibility - { - get { return IsInstalled ? "visible" : "collapsed"; } - } - - public string InstalledVisibility - { - get { return IsInstalled ? "collapsed" : "visible"; } - } - - public SimulatorsClass(string version, string apilevel, bool latest) - { - TargetVersion = version; - LatestVersion = latest; - APILevel = apilevel; - IsInstalled = false; - } - } - - /// - /// Class to store API Targets - /// - public class APITargetClass - { - public string TargetName { get; set; } - public string TargetDescription { get; set; } - public string TargetVersion { get; set; } - public string LatestVersion { get; set; } - public int IsInstalled { get; set; } - public bool IsUpdate { get; set; } - public bool IsBeta { get; set; } - - public string InstalledVisibility - { - get { return IsInstalled > 0 ? "visible" : "collapsed"; } - } - - public string AvailableVisibility - { - get { return IsInstalled == 0 ? "visible" : "collapsed"; } - } - - public string UpdateVisibility - { - get { return IsUpdate ? "visible" : "collapsed"; } - } - - public string NoUpdateVisibility - { - get { return IsUpdate ? "collapsed" : "visible"; } - } - - public APITargetClass(string name, string description, string version) - { - TargetName = name; - TargetDescription = description; - TargetVersion = version; - LatestVersion = version; - IsInstalled = 0; - IsUpdate = false; - IsBeta = false; - } - } - - - /// - /// This is the class that implements the package exposed by this assembly. - /// - /// The minimum requirement for a class to be considered a valid package for Visual Studio - /// is to implement the IVsPackage interface and register itself with the shell. - /// This package uses the helper classes defined inside the Managed Package Framework (MPF) - /// to do it: it derives from the Package class that provides the implementation of the - /// IVsPackage interface and uses the registration attributes defined in the framework to - /// register itself and its components with the shell. - /// - // This attribute tells the PkgDef creation utility (CreatePkgDef.exe) that this class is - // a package. - [PackageRegistration(UseManagedResourcesOnly = true)] - - ///Register the editor factory - [XmlEditorDesignerViewRegistration("XML", "xml", LogicalViewID.Designer, 0x60, - DesignerLogicalViewEditor = typeof(EditorFactory), - Namespace = "http://www.qnx.com/schemas/application/1.0", - MatchExtensionAndNamespace = true)] - // And which type of files we want to handle - [ProvideEditorExtension(typeof(EditorFactory), EditorFactory.defaultExtension, 0x40, NameResourceID = 106)] - // We register that our editor supports LOGVIEWID_Designer logical view - [ProvideEditorLogicalView(typeof(EditorFactory), LogicalViewID.Designer)] - - // Microsoft Visual C# Project - [EditorFactoryNotifyForProject("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}", EditorFactory.defaultExtension, GuidList.guidVSNDK_PackageEditorFactoryString)] - - // This attribute is used to register the informations needed to show the this package - // in the Help/About dialog of Visual Studio. - [InstalledProductRegistration("#110", "#112", "1.0", IconResourceID = 400)] - // This attribute is needed to let the shell know that this package exposes some menus. - [ProvideMenuResource("Menus.ctmenu", 1)] - // This attribute registers a tool window exposed by this package. - [ProvideAutoLoad(VSConstants.UICONTEXT.NoSolution_string)] - [Guid(GuidList.guidVSNDK_PackagePkgString)] - public sealed class VSNDK_PackagePackage : Package - { - - #region private member variables - - private EnvDTE.DTE _dte; - private VSNDKCommandEvents _commandEvents; - private bool _isSimulator; - private BuildEvents _buildEvents; - private List _targetDir = null; - private bool _hitPlay = false; - private int _amountOfProjects = 0; - private string _error = ""; - private bool _isDeploying = false; - private OutputWindowPane _owP; - private string bbndkPathConst = Path.GetPathRoot(Environment.GetFolderPath(Environment.SpecialFolder.System)) + "bbndk_vs"; - private List _installedAPIList; - private List _installedNDKList; - private List _simulatorList; - private List _tempAPITargetList; - private List installedSimulatorList; - - #endregion - - #region Package Members - - /// - /// Default constructor of the package. - /// Inside this method you can place any initialization code that does not require - /// any Visual Studio service because at this point the package object is created but - /// not sited yet inside Visual Studio environment. The place to do all the other - /// initialization is the Initialize method. - /// - public VSNDK_PackagePackage() - { - Trace.WriteLine(string.Format(CultureInfo.CurrentCulture, "Entering constructor for: {0}", this.ToString())); - } - - /// - /// Initialization of the package; this method is called right after the package is sited, so this is the place - /// where you can put all the initilaization code that rely on services provided by VisualStudio. - /// - protected override void Initialize() - { - Trace.WriteLine (string.Format(CultureInfo.CurrentCulture, "Entering Initialize() of: {0}", this.ToString())); - base.Initialize(); - - //Create Editor Factory. Note that the base Package class will call Dispose on it. - base.RegisterEditorFactory(new EditorFactory(this)); - - _dte = (EnvDTE.DTE)GetService(typeof(EnvDTE.DTE)); - - SetNDKPath(); - GetInstalledAPIList(); - GetAvailableAPIList(); - GetInstalledSimulatorList(); - GetSimulatorList(); - - _commandEvents = new VSNDKCommandEvents((DTE2)_dte); - _commandEvents.RegisterCommand(GuidList.guidVSStd97String, CommandConstants.cmdidStartDebug, startDebugCommandEvents_AfterExecute, startDebugCommandEvents_BeforeExecute); - - _buildEvents = _dte.Events.BuildEvents; - _buildEvents.OnBuildBegin += new _dispBuildEvents_OnBuildBeginEventHandler(this.OnBuildBegin); - - - - // Add our command handlers for menu (commands must exist in the .vsct file) - OleMenuCommandService mcs = GetService(typeof(IMenuCommandService)) as OleMenuCommandService; - if ( null != mcs ) - { - // Create the command for the tool window - CommandID toolwndCommandID = new CommandID(GuidList.guidVSNDK_PackageCmdSet, (int)PkgCmdIDList.cmdidBlackBerryTools); - MenuCommand menuToolWin = new MenuCommand(ShowToolWindow, toolwndCommandID); - mcs.AddCommand( menuToolWin ); - - // Create the command for the settings window - CommandID wndSettingsCommandID = new CommandID(GuidList.guidVSNDK_PackageCmdSet, (int)PkgCmdIDList.cmdidBlackBerrySettings); - MenuCommand menuSettingsWin = new MenuCommand(ShowSettingsWindow, wndSettingsCommandID); - mcs.AddCommand(menuSettingsWin); - - // Create the command for the Debug Token window - CommandID wndDebugTokenCommandID = new CommandID(GuidList.guidVSNDK_PackageCmdSet, (int)PkgCmdIDList.cmdidBlackBerryDebugToken); - MenuCommand menuDebugTokenWin = new MenuCommand(ShowDebugTokenWindow, wndDebugTokenCommandID); - mcs.AddCommand(menuDebugTokenWin); - - // Create the command for the menu item. - CommandID projCommandID = new CommandID(GuidList.guidVSNDK_PackageCmdSet, (int)PkgCmdIDList.cmdidfooLocalBox); - OleMenuCommand projItem = new OleMenuCommand(MenuItemCallback, projCommandID); - mcs.AddCommand(projItem); - } - - } - #endregion - - #region public methods - - /// - /// Public property for the list of installed API's - /// - public List InstalledAPIList - { - get - { - return _installedAPIList; - } - } - - /// - /// Public property for the list of installed NDK's - /// - public List InstalledNDKList - { - get - { - return _installedNDKList; - } - } - - /// - /// Public property for the list of installed NDK's - /// - public List APITargetList - { - get - { - return _tempAPITargetList; - } - } - - /// - /// Public property for the list of installed NDK's - /// - public List SimulatorList - { - get - { - return _simulatorList; - } - } - - #endregion - - #region private methods - - /// - /// Set the NDK path into the registry if not already set. - /// - private void SetNDKPath() - { - //Initialize NDK if possible. - RegistryKey rkHKCU = Registry.CurrentUser; - RegistryKey rkNDKPath = null; - string qnx_target = ""; - string qnx_host = ""; - - try - { - - rkNDKPath = rkHKCU.CreateSubKey("Software\\BlackBerry\\BlackBerryVSPlugin"); - qnx_host = rkNDKPath.GetValue("NDKHostPath").ToString(); - qnx_target = rkNDKPath.GetValue("NDKHostPath").ToString(); - - if (qnx_host == "") - { - string[] filePaths = Directory.GetFiles(System.Environment.GetFolderPath(System.Environment.SpecialFolder.LocalApplicationData) + @"\Research In Motion\BlackBerry Native SDK\qconfig\", "*.xml"); - - if (filePaths.Length >= 1) - { - XmlDocument xmlDoc = new XmlDocument(); - xmlDoc.Load(filePaths[0]); - XmlNodeList name = xmlDoc.GetElementsByTagName("name"); - XmlNodeList hostpath = xmlDoc.GetElementsByTagName("host"); - XmlNodeList targetpath = xmlDoc.GetElementsByTagName("target"); - - qnx_target = targetpath[0].InnerText; - qnx_host = hostpath[0].InnerText; - - rkNDKPath.SetValue("NDKHostPath", qnx_host); - rkNDKPath.SetValue("NDKTargetPath", qnx_target); - - } - } - - string qnx_config = bbndkPathConst + @"\features\com.qnx.tools.jre.win32_1.6.0.43\jre\bin"; - - System.Environment.SetEnvironmentVariable("QNX_TARGET", qnx_target); - System.Environment.SetEnvironmentVariable("QNX_HOST", qnx_host); - - string ndkpath = string.Format(@"{0}/usr/bin;{1}", qnx_host, qnx_config) + - System.Environment.GetEnvironmentVariable("PATH"); - System.Environment.SetEnvironmentVariable("PATH", ndkpath); - - - } - catch (Exception ex) - { - string e = ex.ToString(); - } - - rkNDKPath.Close(); - rkHKCU.Close(); - } - - /// - /// Identify the projects to be build and start the build process. - /// - /// TRUE if successful, FALSE if not. - private bool BuildBar() - { - bool success = true; - try - { - Microsoft.Win32.RegistryKey key; - key = Microsoft.Win32.Registry.CurrentUser.CreateSubKey("VSNDK"); - key.SetValue("Run", "True"); - key.Close(); - - _buildEvents.OnBuildDone += new _dispBuildEvents_OnBuildDoneEventHandler(this.OnBuildDone); - - try - { - Solution2 soln = (Solution2)_dte.Solution; - List buildThese = new List(); - _targetDir = new List(); - - foreach (String startupProject in (Array)soln.SolutionBuild.StartupProjects) - { - foreach (Project p1 in soln.Projects) - { - if (p1.UniqueName == startupProject) - { - buildThese.Add(p1.FullName); - - ConfigurationManager config = p1.ConfigurationManager; - Configuration active = config.ActiveConfiguration; - foreach (Property prop in active.Properties) - { - try - { - if (prop.Name == "OutputPath") - { - string[] path = new string[2]; - path[0] = p1.Name + "_" + _isSimulator.ToString(); - path[1] = prop.Value.ToString(); - _targetDir.Add(path); - break; - } - } - catch - { - } - } - - break; - } - } - } - - _hitPlay = true; - _amountOfProjects = buildThese.Count; // OnBuildDone will call build() only after receiving "amountOfProjects" events - foreach (string projectName in buildThese) - soln.SolutionBuild.BuildProject("Debug", projectName, false); - } - catch (Exception ex) - { - Debug.WriteLine(ex.Message); - success = false; - } - } - catch (Exception e) - { - Debug.WriteLine(e.Message); - success = false; - } - return success; - } - - /// - /// Verify if the build process was successful. If so, start deploying the app. - /// - private void Built() - { - string outputText = ""; - - _owP.TextDocument.Selection.SelectAll(); - outputText = _owP.TextDocument.Selection.Text; - - if ((outputText == "") || (System.Text.RegularExpressions.Regex.IsMatch(outputText, ">Build succeeded.\r\n")) || (!outputText.Contains("): error :"))) - { - // Write file to flag the deploy task that it should use the -debugNative option - string fileContent = "Use -debugNative.\r\n"; - string appData = Environment.GetEnvironmentVariable("AppData"); - System.IO.StreamWriter file = new System.IO.StreamWriter(appData + @"\BlackBerry\vsndk-debugNative.txt"); - file.WriteLine(fileContent); - file.Close(); - - _buildEvents.OnBuildDone += new _dispBuildEvents_OnBuildDoneEventHandler(this.OnBuildDone); - - - foreach (String startupProject in (Array)_dte.Solution.SolutionBuild.StartupProjects) - { - foreach (SolutionContext sc in _dte.Solution.SolutionBuild.ActiveConfiguration.SolutionContexts) - { - if (sc.ProjectName == startupProject) - { - sc.ShouldDeploy = true; - } - else - { - sc.ShouldDeploy = false; - } - } - } - _isDeploying = true; - _dte.Solution.SolutionBuild.Deploy(true); - } - } - - /// - /// Get the process ID and launch an executable using the VSNDK debug engine. - /// - private void Deployed() - { - Microsoft.Win32.RegistryKey key; - key = Microsoft.Win32.Registry.CurrentUser.CreateSubKey("VSNDK"); - key.SetValue("Run", "False"); - key.Close(); - - string pidString = ""; - getPID((DTE2)_dte, ref pidString); - - bool CancelDefault = LaunchDebugTarget(pidString); - } - - /// - /// Launch an executable using the VSNDK debug engine. - /// - /// Process ID in string format. - /// TRUE if successful, False if not. - private bool LaunchDebugTarget(string pidString) - { - Microsoft.VisualStudio.Shell.ServiceProvider sp = - new Microsoft.VisualStudio.Shell.ServiceProvider((Microsoft.VisualStudio.OLE.Interop.IServiceProvider)_dte); - - IVsDebugger dbg = (IVsDebugger)sp.GetService(typeof(SVsShellDebugger)); - - VsDebugTargetInfo info = new VsDebugTargetInfo(); - - info.cbSize = (uint)System.Runtime.InteropServices.Marshal.SizeOf(info); - info.dlo = Microsoft.VisualStudio.Shell.Interop.DEBUG_LAUNCH_OPERATION.DLO_CreateProcess; - - // Read debugger args from a file (it is set when the Deploy task is run) - System.IO.StreamReader argsFile = null; - try - { - string localAppData = Environment.GetEnvironmentVariable("AppData"); - argsFile = new System.IO.StreamReader(localAppData + @"\BlackBerry\vsndk-args-file.txt"); - } - catch (Exception e) - { - Debug.Fail("Unexpected exception in LaunchDebugTarget"); - } - - // Store all debugger arguments in a string - var nvc = new NameValueCollection(); - nvc.Add("pid", pidString); - nvc.Add("targetIP", argsFile.ReadLine()); // The device (IP address) - info.bstrExe = argsFile.ReadLine(); // The executable path - nvc.Add("isSimulator", argsFile.ReadLine()); - nvc.Add("ToolsPath", argsFile.ReadLine()); - nvc.Add("PublicKeyPath", argsFile.ReadLine()); - - // Decrypt stored password. - byte[] data = Convert.FromBase64String(argsFile.ReadLine()); - if (data.Length > 0) - { - byte[] decrypted = ProtectedData.Unprotect(data, null, DataProtectionScope.LocalMachine); - nvc.Add("Password", Encoding.Unicode.GetString(decrypted)); - } - - info.bstrArg = NameValueCollectionHelper.DumpToString(nvc); - argsFile.Close(); - - info.bstrRemoteMachine = null; // debug locally - info.fSendStdoutToOutputWindow = 0; // Let stdout stay with the application. - info.clsidCustom = new Guid("{E5A37609-2F43-4830-AA85-D94CFA035DD2}"); // Set the launching engine the VSNDK engine guid - info.grfLaunch = 0; - - IntPtr pInfo = System.Runtime.InteropServices.Marshal.AllocCoTaskMem((int)info.cbSize); - System.Runtime.InteropServices.Marshal.StructureToPtr(info, pInfo, false); - - try - { - int result = dbg.LaunchDebugTargets(1, pInfo); - - if (result != VSConstants.S_OK) - { - string msg; - IVsUIShell sh = (IVsUIShell)sp.GetService(typeof(SVsUIShell)); - sh.GetErrorInfo(out msg); - Debug.WriteLine("LaunchDebugTargets: " + msg); - - return true; - } - } - finally - { - if (pInfo != IntPtr.Zero) - { - System.Runtime.InteropServices.Marshal.FreeCoTaskMem(pInfo); - } - } - - return false; - } - - /// - /// Get list of installed APIs - /// - /// - public void GetInstalledAPIList() - { - try - { - _installedAPIList = new List(); - _installedNDKList = new List(); - - string[] dirPaths = new string[2]; - dirPaths[0] = bbndkPathConst + @"\..\qconfig\"; - dirPaths[1] = System.Environment.GetFolderPath(System.Environment.SpecialFolder.LocalApplicationData) + @"\Research In Motion\BlackBerry Native SDK\qconfig\"; - - for (int i = 0; i < 2; i++) - { - string[] filePaths = Directory.GetFiles(dirPaths[i], "*.xml"); - foreach (string file in filePaths) - { - try - { - XmlDocument xmlDoc = new XmlDocument(); - xmlDoc.Load(file); - XmlNodeList name = xmlDoc.GetElementsByTagName("name"); - XmlNodeList version = xmlDoc.GetElementsByTagName("version"); - XmlNodeList hostpath = xmlDoc.GetElementsByTagName("host"); - XmlNodeList targetpath = xmlDoc.GetElementsByTagName("target"); - - if (i == 0) - { - APIClass aclass = new APIClass(name.Item(0).InnerText, hostpath.Item(0).InnerText, targetpath.Item(0).InnerText, version.Item(0).InnerText); - _installedAPIList.Add(aclass); - } - else - { - APIClass aclass = new APIClass(name.Item(0).InnerText, hostpath.Item(0).InnerText, targetpath.Item(0).InnerText, version.Item(0) == null ? "2.1.0" : version.Item(0).InnerText); - _installedNDKList.Add(aclass); - } - } - catch - { - break; - } - } - } - } - catch (Exception ex) - { - - } - } - - /// - /// Retrieve a list of the installed runtimes on the PC. - /// - /// - public bool GetInstalledSimulatorList() - { - bool success = false; - - installedSimulatorList = new List(); - - string[] directories = Directory.GetFiles(bbndkPathConst, "*.vmxf", SearchOption.AllDirectories); - - foreach (string directory in directories) - { - if (directory.Contains("simulator_")) - { - installedSimulatorList.Add(directory.Substring(0, directory.LastIndexOf("\\")).Substring(directory.IndexOf("simulator_") + 10).Replace('_', '.')); - success = true; - } - else - { - continue; - } - } - - return success; - - } - - /// - /// Check to see if Simulator is installed - /// - /// Check version number - /// true if installed - private bool IsSimulatorInstalled(string version) - { - bool success = false; - - if (installedSimulatorList != null) - { - string result = installedSimulatorList.FirstOrDefault(s => s.Contains(version)); - - if (result != null) - { - success = true; - } - } - - return success; - } - - /// - /// Get the PID of the launched native app by parsing text from the output window. - /// - /// Application Object. - /// Returns the Process ID as a string. - /// TRUE if successful, False if not. - private bool getPID(DTE2 dte, ref string pidString) - { - // Select all of the text - _owP.TextDocument.Selection.SelectAll(); - string outputText = _owP.TextDocument.Selection.Text; - - // Check for successful deployment - if (System.Text.RegularExpressions.Regex.IsMatch(outputText, "Info: done")) - { - string pattern = @"\s+result::(\d+)\r\n.+"; - Regex r = new Regex(pattern, RegexOptions.IgnoreCase); - - // Match the regular expression pattern against a text string. - Match m = r.Match(outputText); - - // Take first match - if (m.Success) - { - Group g = m.Groups[1]; - CaptureCollection cc = g.Captures; - Capture c = cc[0]; - pidString = c.ToString(); - - // Store proccess name and file location into ProcessesPath.txt, so "Attach To Process" would be able to find the - // source code for a running process. - // First read the file. - string processesPaths = ""; - System.IO.StreamReader readProcessesPathsFile = null; - try - { - readProcessesPathsFile = new System.IO.StreamReader(System.Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + @"\Research In Motion\ProcessesPath.txt"); - processesPaths = readProcessesPathsFile.ReadToEnd(); - readProcessesPathsFile.Close(); - } - catch (Exception e) - { - processesPaths = ""; - } - - // Updating the contents. - int begin = outputText.IndexOf("Deploy started: Project: ") + 25; - if (begin == -1) - begin = outputText.IndexOf("Project: ") + 9; - int end = outputText.IndexOf(", Configuration:", begin); - string processName = outputText.Substring(begin, end - begin) + "_" + _isSimulator.ToString(); - begin = processesPaths.IndexOf(processName + ":>"); - - // string currentPath = dte.ActiveDocument.Path; - string currentPath = ""; - - foreach (string[] paths in _targetDir) - { - if (paths[0] == processName) - { - currentPath = paths[1]; - break; - } - } - - if (begin != -1) - { - begin += processName.Length + 2; - end = processesPaths.IndexOf("\r\n", begin); - processesPaths = processesPaths.Substring(0, begin) + currentPath + processesPaths.Substring(end); - } - else - { - processesPaths = processesPaths + processName + ":>" + currentPath + "\r\n"; - } - - // Writing contents to file. - System.IO.StreamWriter writeProcessesPathsFile = null; - try - { - writeProcessesPathsFile = new System.IO.StreamWriter(System.Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + @"\Research In Motion\ProcessesPath.txt", false); - writeProcessesPathsFile.Write(processesPaths); - writeProcessesPathsFile.Close(); - } - catch (Exception e) - { - } - - return true; - } - else - { - return false; - } - } - return false; - } - - - - #endregion - - #region Get Simulator List command - - /// - /// Retrieve list of Available Simulators - /// - /// - public bool GetSimulatorList() - { - bool success = false; - - System.Diagnostics.Process p = new System.Diagnostics.Process(); - System.Diagnostics.ProcessStartInfo startInfo = p.StartInfo; - startInfo.UseShellExecute = false; - startInfo.CreateNoWindow = true; - startInfo.RedirectStandardError = true; - startInfo.RedirectStandardOutput = true; - p.ErrorDataReceived += new System.Diagnostics.DataReceivedEventHandler(ErrorDataReceived); - p.OutputDataReceived += new System.Diagnostics.DataReceivedEventHandler(SimulatorListDataReceived); - - - /// Get Device PIN - startInfo.FileName = "cmd.exe"; - startInfo.Arguments = string.Format(@"/C " + bbndkPathConst + @"\eclipsec --list-all --simulator"); - - try - { - _simulatorList = new List(); - - p.Start(); - p.BeginErrorReadLine(); - p.BeginOutputReadLine(); - p.WaitForExit(); - if (p.ExitCode != 0) - { - success = false; - } - else - { - success = true; - } - p.Close(); - } - catch (Exception e) - { - System.Diagnostics.Debug.WriteLine(startInfo.Arguments); - System.Diagnostics.Debug.WriteLine(e.Message); - success = false; - } - - return success; - - } - - /// - /// On Data Received event handler - /// - /// - /// - private void SimulatorListDataReceived(object sender, System.Diagnostics.DataReceivedEventArgs e) - { - string apilevel = ""; - string version = ""; - - SimulatorsClass sim = null; - - if (e.Data != null) - { - if ((e.Data.ToLower().Contains("error")) || (_error != "")) - { - _error = _error + e.Data; - } - else if ((e.Data.Contains("Location:")) || (e.Data.Contains("Available"))) - { - // Do Nothing - } - else - { - version = e.Data.Substring(0, e.Data.LastIndexOf(" - ")); - apilevel = version.Split('.')[0] + "." + version.Split('.')[1]; - - sim = _simulatorList.Find(i => i.APILevel == apilevel); - - if (sim == null) - { - sim = new SimulatorsClass(version, apilevel, true); - sim.IsInstalled = IsSimulatorInstalled(version); - _simulatorList.Add(sim); - } - else - { - //sim not the latest... mark it as false - sim.LatestVersion = false; - - //create new sim - SimulatorsClass sim2 = new SimulatorsClass(version, apilevel, true); - sim2.IsInstalled = IsSimulatorInstalled(version); - - // insert before found sim. - _simulatorList.Insert(_simulatorList.IndexOf(sim), sim2); - } - } - } - } - - - #endregion - - #region Get Available API List command - - /// - /// Retrieve list of API's from - /// - /// - public bool GetAvailableAPIList() - { - bool success = false; - - System.Diagnostics.Process p = new System.Diagnostics.Process(); - System.Diagnostics.ProcessStartInfo startInfo = p.StartInfo; - startInfo.UseShellExecute = false; - startInfo.CreateNoWindow = true; - startInfo.RedirectStandardError = true; - startInfo.RedirectStandardOutput = true; - p.ErrorDataReceived += new System.Diagnostics.DataReceivedEventHandler(ErrorDataReceived); - p.OutputDataReceived += new System.Diagnostics.DataReceivedEventHandler(APIListDataReceived); - - - /// Get Device PIN - startInfo.FileName = "cmd.exe"; - startInfo.Arguments = string.Format(@"/C " + bbndkPathConst + @"\eclipsec --list"); - - try - { - _tempAPITargetList = new List(); - - p.Start(); - p.BeginErrorReadLine(); - p.BeginOutputReadLine(); - p.WaitForExit(); - if (p.ExitCode != 0) - { - success = false; - } - else - { - success = true; - } - p.Close(); - } - catch (Exception e) - { - System.Diagnostics.Debug.WriteLine(startInfo.Arguments); - System.Diagnostics.Debug.WriteLine(e.Message); - success = false; - } - - return success; - - } - - /// - /// On Data Received event handler - /// - /// - /// - private void APIListDataReceived(object sender, System.Diagnostics.DataReceivedEventArgs e) - { - string name = ""; - string description = ""; - string version = ""; - string error = ""; - APITargetClass api = null; - - if (e.Data != null) - { - if ((e.Data.ToLower().Contains("error")) || (_error != "")) - { - _error = _error + e.Data; - } - else if ((e.Data.Contains("Location:")) || (e.Data.Contains("Available"))) - { - // Do Nothing - } - else - { - version = e.Data.Substring(0, e.Data.LastIndexOf(" - ")); - name = e.Data.Substring(e.Data.LastIndexOf(" - ") + 3); - description = "Device Support Unknown."; - - api = _tempAPITargetList.Find(i => i.TargetName == name); - - if (api == null) - { - api = new APITargetClass(name, description, version); - _tempAPITargetList.Add(api); - } - else - { - switch (api.IsInstalled) - { - case 0: - api.TargetVersion = version; - api.LatestVersion = version; - break; - case 1: - api.IsUpdate = true; - api.LatestVersion = version; - break; - case 2: - api.TargetVersion = version; - api.LatestVersion = "NDK"; - break; - } - } - - api.IsInstalled = IsAPIInstalled(api.TargetVersion, api.TargetName); - - api.IsBeta = name.Contains("Beta"); - - } - } - } - - /// - /// On Error received event handler - /// - /// - /// - private void ErrorDataReceived(object sender, System.Diagnostics.DataReceivedEventArgs e) - { - if (e.Data != null) - { - System.Diagnostics.Debug.WriteLine(e.Data); - - MessageBox.Show(e.Data); - } - } - - /// - /// Check to see if API is installed - /// - /// Check version number - /// Check API name - /// true if installed - public int IsAPIInstalled(string version, string name) - { - int success = 0; - - /// Check for 2.1 version - if (version.StartsWith("2.1.0")) - version = "2.1.0"; - - if (_installedAPIList != null) - { - APIClass result = _installedAPIList.Find(i => i.Version.Contains(version)); - - if (result != null) - { - success = 1; - } - } - - if (_installedNDKList != null) - { - APIClass result = _installedNDKList.Find(i => i.Version.Contains(version)); - - if (result != null) - { - success = 2; - } - } - - return success; - } - - #endregion - - #region Event Handlers - - /// - /// New Start Debug Command Events After Execution Event Handler. - /// - /// Command GUID. - /// Command ID. - /// Custom IN Object. - /// Custom OUT Object. - private void startDebugCommandEvents_AfterExecute(string Guid, int ID, object CustomIn, object CustomOut) - { - Debug.WriteLine("After Start Debug"); - } - - - /// - /// New Start Debug Command Events Before Execution Event Handler. Call the method responsible for building the app. - /// - /// Command GUID. - /// Command ID. - /// Custom IN Object. - /// Custom OUT Object. - /// Cancel the default execution of the command. - private void startDebugCommandEvents_BeforeExecute(string Guid, int ID, object CustomIn, object CustomOut, ref bool CancelDefault) - { - - bool bbPlatform = false; - if (_dte.Solution.SolutionBuild.ActiveConfiguration != null) - { - SolutionContexts scCollection = _dte.Solution.SolutionBuild.ActiveConfiguration.SolutionContexts; - foreach (SolutionContext sc in scCollection) - { - if (sc.PlatformName == "BlackBerry" || sc.PlatformName == "BlackBerrySimulator") - { - bbPlatform = true; - if (sc.PlatformName == "BlackBerrySimulator") - _isSimulator = true; - else - _isSimulator = false; - } - } - } - - Debug.WriteLine("Before Start Debug"); - - if (VSNDK.Package.ControlDebugEngine.isDebugEngineRunning || !bbPlatform) - { - // Disable the override of F5 (this allows the debugged process to continue execution) - CancelDefault = false; - } - else - { - // Create a reference to the Output window. - // Create a tool window reference for the Output window - // and window pane. - OutputWindow ow = ((DTE2)_dte).ToolWindows.OutputWindow; - - // Select the Build pane in the Output window. - _owP = ow.OutputWindowPanes.Item("Build"); - _owP.Activate(); - - - UpdateManagerData upData = new UpdateManagerData(this); - - if (!upData.validateDeviceVersion(_isSimulator)) - { - CancelDefault = true; - } - else - { - BuildBar(); - CancelDefault = true; - } - } - } - - /// - /// This event is fired only when the build/rebuild/clean process ends. - /// - /// Represents the scope of the build. - /// Represents the type of build action that is occurring, such as a build or a deploy action. - public void OnBuildDone(EnvDTE.vsBuildScope Scope, EnvDTE.vsBuildAction Action) - { - if (Action == vsBuildAction.vsBuildActionBuild) - { - _amountOfProjects -= 1; - if (_amountOfProjects == 0) - { - _buildEvents.OnBuildDone -= new _dispBuildEvents_OnBuildDoneEventHandler(this.OnBuildDone); - Built(); - } - } - else if (Action == vsBuildAction.vsBuildActionDeploy) - { - _buildEvents.OnBuildDone -= new _dispBuildEvents_OnBuildDoneEventHandler(this.OnBuildDone); - _isDeploying = false; - Deployed(); - } - } - - /// - /// This event is fired only when user wants to build, rebuild or clean the project. - /// - /// Represents the scope of the build. - /// Represents the type of build action that is occurring, such as a build or a deploy action. - public void OnBuildBegin(EnvDTE.vsBuildScope Scope, EnvDTE.vsBuildAction Action) - { - if ((Action == vsBuildAction.vsBuildActionBuild) || (Action == vsBuildAction.vsBuildActionRebuildAll)) - { - if ((_hitPlay == false) && (_isDeploying == false)) // means that the "play" building and deploying process was cancelled before, so we have to disable the - // OnBuildDone event to avoid deploying in case user only wants to build. - { - _buildEvents.OnBuildDone -= new _dispBuildEvents_OnBuildDoneEventHandler(this.OnBuildDone); - } - _hitPlay = false; - } - } - - /// - /// This function is called when the user clicks the menu item that shows the - /// tool window. See the Initialize method to see how the menu item is associated to - /// this function using the OleMenuCommandService service and the MenuCommand class. - /// - private void ShowToolWindow(object sender, EventArgs e) - { - // Create the dialog instance without Help support. - var SigningToolDialog = new Signing.SigningDialog(); - // Show the dialog. - var m = SigningToolDialog.ShowModal(); - } - - /// - /// This function is called when the user clicks the menu item that shows the - /// tool window. See the Initialize method to see how the menu item is associated to - /// this function using the OleMenuCommandService service and the MenuCommand class. - /// - private void ShowSettingsWindow(object sender, EventArgs e) - { - var SettingsDialog = new Settings.SettingsDialog(this); - var m = SettingsDialog.ShowModal(); - } - - /// - /// This function is called when the user clicks the menu item that shows the - /// tool window. See the Initialize method to see how the menu item is associated to - /// this function using the OleMenuCommandService service and the MenuCommand class. - /// - private void ShowDebugTokenWindow(object sender, EventArgs e) - { - // Create the dialog instance without Help support. - var DebugTokenDialog = new DebugToken.DebugTokenDialog(); - // Show the dialog. - if (!DebugTokenDialog.IsClosing) - DebugTokenDialog.ShowModal(); - } - - private void MenuItemCallback(object sender, EventArgs e) - { - string filename = ""; - string folderName = ""; - string name = ""; - - Microsoft.Win32.OpenFileDialog dlg = new Microsoft.Win32.OpenFileDialog(); - dlg.DefaultExt = ".cproject"; // Default file extension - dlg.Filter = "Native Core Application Project Files (*.cproject, *.project)|*.cproject;*.project;"; - dlg.Title = "Open BlackBerry Core Native Application Project Files"; - dlg.Multiselect = false; - dlg.InitialDirectory = Environment.SpecialFolder.MyComputer.ToString(); - dlg.CheckFileExists = true; - - bool? result = dlg.ShowDialog(); - if (result == true) - { - filename = dlg.FileName; - FileInfo fi = new FileInfo(filename); - folderName = fi.DirectoryName; - - Array projs = (Array)_dte.ActiveSolutionProjects; - Project project = (Project)projs.GetValue(0); - name = project.FullName; - - // Create the dialog instance without Help support. - var ImportSummary = new Import.Import(project, folderName, name); - ImportSummary.ShowModel2(); - } - - } - - #endregion - - } -} diff --git a/src_vs2012/ViewModel.cs b/src_vs2012/ViewModel.cs deleted file mode 100644 index 9b463f43..00000000 --- a/src_vs2012/ViewModel.cs +++ /dev/null @@ -1,1706 +0,0 @@ -//* Copyright 2010-2011 Research In Motion Limited. -//* -//* Licensed under the Apache License, Version 2.0 (the "License"); -//* you may not use this file except in compliance with the License. -//* You may obtain a copy of the License at -//* -//* http://www.apache.org/licenses/LICENSE-2.0 -//* -//* Unless required by applicable law or agreed to in writing, software -//* distributed under the License is distributed on an "AS IS" BASIS, -//* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//* See the License for the specific language governing permissions and -//* limitations under the License. - -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.ComponentModel; -using Microsoft.VisualStudio.Package; -using IOleServiceProvider = Microsoft.VisualStudio.OLE.Interop.IServiceProvider; -using Microsoft.VisualStudio; -using System.Runtime.InteropServices; -using System.Xml.Serialization; -using System.Xml.Linq; -using System.Xml; -using Microsoft.VisualStudio.XmlEditor; -using Microsoft.VisualStudio.TextManager.Interop; -using System.Reflection; -using Microsoft.VisualStudio.Shell.Interop; -using Microsoft.VisualStudio.Shell; -using System.Collections; -using System.IO; -using System.Windows.Data; -using System.Collections.ObjectModel; -using RIM.VSNDK_Package.Settings.Models; -using EnvDTE; - -namespace RIM.VSNDK_Package -{ - public class OrientationItemClass - { - private string _name; - - public string Name - { - get { return _name; } - set { _name = value; } - } - - public OrientationItemClass(string name) - { - _name = name; - } - } - - public class ConfigurationItemClass - { - private string _name; - - public string Name - { - get { return _name; } - set { _name = value; } - } - - public ConfigurationItemClass(string name) - { - _name = name; - } - } - - public class AssetTypeItemClass - { - private string _type; - - public string Type - { - get { return _type; } - set { _type = value; } - } - - public AssetTypeItemClass(string type) - { - _type = type; - } - } - - public class PermissionItemClass : INotifyPropertyChanged - { - private bool _isChecked; - private string _permission; - private string _identifier; - private string _permisionImagePath; - - public bool IsChecked - { - get { return _isChecked; } - set { - _isChecked = value; - OnPropertyChanged("IsChecked"); - } - } - - public string Permission - { - get { return _permission; } - set - { - _permission = value; - OnPropertyChanged("Permission"); - } - } - - public string PermissionImagePath - { - get { return _permisionImagePath; } - set - { - _permisionImagePath = value; - OnPropertyChanged("PermissionImagePath"); - } - } - - public string Identifier - { - get { return _identifier; } - set - { - _identifier = value; - OnPropertyChanged("Identifier"); - } - } - - public PermissionItemClass(bool isChecked, string permission, string identifier, string permissionImagePath) - { - _isChecked = isChecked; - _permission = permission; - _identifier = identifier; - _permisionImagePath = permissionImagePath; - } - - public event PropertyChangedEventHandler PropertyChanged; - protected void OnPropertyChanged(string propertyname) - { - var handler = PropertyChanged; - if (handler != null) - handler(this, new PropertyChangedEventArgs(propertyname)); - } - } - - public class ImageItemClass - { - private string _imageName; - private string _imagePath; - private string _imageSize; - - public string ImageName - { - get { return _imageName; } - set { _imageName = value; } - } - - public string ImagePath - { - get { return _imagePath; } - set { _imagePath = value; } - } - - public string ImageSize - { - get { return _imageSize; } - set { _imageSize = value; } - } - - /// - /// Class to store the splashscreen and icon images data. - /// - /// - /// - /// - public ImageItemClass(string imageName, string imagePath, string activeProjectDirectory) - { - _imageName = imageName; - _imagePath = imagePath; - - if (!File.Exists(_imagePath)) - { - if (File.Exists(activeProjectDirectory + "\\" + _imagePath)) - { - _imagePath = activeProjectDirectory + "\\" + _imagePath; - - } - } - - try - { - System.Drawing.Image objImage = System.Drawing.Image.FromFile(_imagePath); - _imageSize = objImage.Width.ToString() + "X" + objImage.Height.ToString(); - } - catch - { - - } - } - } - - /// - /// ViewModel is where the interesting portion of the VsTemplate Designer lives. The View binds to an instance of this class. - /// - /// The View binds the various designer controls to the methods derived from IViewModel that get and set values in the XmlModel. - /// The ViewModel and an underlying XmlModel manage how an IVsTextBuffer is shared between the designer and the XML editor (if opened). - /// - public class ViewModel : IViewModel, IDataErrorInfo, INotifyPropertyChanged - { - private static string _localRIMFolder; - private static string _tmpAuthor = ""; - private static string _tmpAuthorID = ""; - private readonly CollectionView _orientationList; - private OrientationItemClass _orientationItem; - private CollectionView _iconImageList; - private CollectionView _splashScreenImageList; - private CollectionView _assetTypeList; - private CollectionView _permissionList; - private CollectionView _configurationList; - private ConfigurationItemClass _config; - private PermissionItemClass _permission; - private DTE _dte; - private string _activeProjectDirectory; - private Package _pkg; - - long _dirtyTime; - LanguageService _xmlLanguageService; - IServiceProvider _serviceProvider; - qnx _qnxSchema; - bool _synchronizing; - XmlModel _xmlModel; - XmlStore _xmlStore; - IVsTextLines _buffer; - - bool? _canEditFile; - bool _gettingCheckoutStatus; - - EventHandler _editingScopeCompletedHandler; - EventHandler _undoRedoCompletedHandler; - EventHandler _bufferReloadedHandler; - - /// - /// Constructor - /// - /// - /// - /// - /// - public ViewModel(Package pkg, XmlStore xmlStore, XmlModel xmlModel, IServiceProvider provider, IVsTextLines buffer) - { - _pkg = pkg; - /// Initialize Asset Type List - IList AssetTypeListItem = new List(); - AssetTypeItemClass assetType = new AssetTypeItemClass("Other"); - AssetTypeListItem.Add(assetType); - assetType = new AssetTypeItemClass("Entry-point"); - AssetTypeListItem.Add(assetType); - assetType = new AssetTypeItemClass("Library"); - AssetTypeListItem.Add(assetType); - assetType = new AssetTypeItemClass("Executable"); - AssetTypeListItem.Add(assetType); - _assetTypeList = new CollectionView(AssetTypeListItem); - - if (xmlModel == null) - throw new ArgumentNullException("xmlModel"); - if (xmlStore == null) - throw new ArgumentNullException("xmlStore"); - if (provider == null) - throw new ArgumentNullException("provider"); - if (buffer == null) - throw new ArgumentNullException("buffer"); - - this.BufferDirty = false; - this.DesignerDirty = false; - - this._serviceProvider = provider; - this._buffer = buffer; - - _dte = (DTE)_serviceProvider.GetService(typeof(DTE)); - Array activeProjects = (Array)_dte.ActiveSolutionProjects; - Project activeProject = (Project)activeProjects.GetValue(0); - FileInfo activeProjectFileInfo = new FileInfo(activeProject.FullName); - _activeProjectDirectory = activeProjectFileInfo.DirectoryName; - - this._xmlStore = xmlStore; - // OnUnderlyingEditCompleted - _editingScopeCompletedHandler = new EventHandler(OnUnderlyingEditCompleted); - this._xmlStore.EditingScopeCompleted += _editingScopeCompletedHandler; - // OnUndoRedoCompleted - _undoRedoCompletedHandler = new EventHandler(OnUndoRedoCompleted); - this._xmlStore.UndoRedoCompleted += _undoRedoCompletedHandler; - - this._xmlModel = xmlModel; - // BufferReloaded - _bufferReloadedHandler += new EventHandler(BufferReloaded); - this._xmlModel.BufferReloaded += _bufferReloadedHandler; - - _localRIMFolder = System.Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + @"\Research In Motion\"; - - LoadModelFromXmlModel(); - - IList IconImageList = new List(); - if ((_qnxSchema.icon != null) && (_qnxSchema.icon.image != null)) - { - string iconPNG_Path = ""; //added to avoid duplication. That's because I didn't find the template to remove teh ICON.PNG. - foreach (string iconImage in _qnxSchema.icon.image) - { - ImageItemClass imageItem = new ImageItemClass(iconImage, getImagePath(iconImage), _activeProjectDirectory); - if (imageItem.ImageName != null) //added because I didn't find the template to remove teh ICON.PNG. - if (imageItem.ImageName == "icon.png") - { - if (iconPNG_Path != imageItem.ImagePath) //added because I didn't find the template to remove teh ICON.PNG. - { - IconImageList.Add(imageItem); - iconPNG_Path = imageItem.ImagePath; - } - } - else - IconImageList.Add(imageItem); - - } - } - _iconImageList = new CollectionView(IconImageList); - - LoadPermissions(); - - IList SplashScreenImageList = new List(); - if ((_qnxSchema.splashScreens != null) && (_qnxSchema.splashScreens.image != null)) - { - foreach (string splashScreenImage in _qnxSchema.splashScreens.image) - { - ImageItemClass imageItem = new ImageItemClass(splashScreenImage, getImagePath(splashScreenImage), _activeProjectDirectory); - SplashScreenImageList.Add(imageItem); - } - } - _splashScreenImageList = new CollectionView(SplashScreenImageList); - - IList ConfigurationList = new List(); - ConfigurationItemClass configItem = new ConfigurationItemClass("All Configurations"); - ConfigurationList.Add(configItem); - foreach (qnxConfiguration config in _qnxSchema.configuration) - { - configItem = new ConfigurationItemClass(config.name); - ConfigurationList.Add(configItem); - } - _configurationList = new CollectionView(ConfigurationList); - - IList OrientationList = new List(); - OrientationItemClass OrientationItem = new OrientationItemClass("Default"); - OrientationList.Add(OrientationItem); - if (_qnxSchema.initialWindow.autoOrients == "") - { - _orientationItem = OrientationItem; - } - - OrientationItem = new OrientationItemClass("Auto-orient"); - OrientationList.Add(OrientationItem); - if (_qnxSchema.initialWindow.autoOrients == "true") - { - _orientationItem = OrientationItem; - } - - - OrientationItem = new OrientationItemClass("Landscape"); - OrientationList.Add(OrientationItem); - if (_qnxSchema.initialWindow.aspectRatio == "landscape") - { - _orientationItem = OrientationItem; - } - - OrientationItem = new OrientationItemClass("Portrait"); - OrientationList.Add(OrientationItem); - if (_qnxSchema.initialWindow.aspectRatio == "portrait") - { - _orientationItem = OrientationItem; - } - - _orientationList = new CollectionView(OrientationList); - } - - private string getImagePath(string imgName) - { - string imagePath = ""; - - foreach (asset assetItem in _qnxSchema.asset) - { - if (assetItem.Value == imgName) - { - imagePath = assetItem.path; - } - } - - return imagePath; - } - - /// - /// Close View Model - /// - public void Close() - { - //Unhook the events from the underlying XmlStore/XmlModel - if (_xmlStore != null) - { - this._xmlStore.EditingScopeCompleted -= _editingScopeCompletedHandler; - this._xmlStore.UndoRedoCompleted -= _undoRedoCompletedHandler; - } - if (this._xmlModel != null) - { - this._xmlModel.BufferReloaded -= _bufferReloadedHandler; - } - } - - /// - /// Given the permission ID return the appropriate Icon - /// - /// - /// - private string getPermissionIcon(string ID) - { - string retVal = ""; - - switch (ID) - { - case "bbm_connect": - retVal = "/VSNDK.Package;component/Resources/BlackBerryMessager.bmp"; - break; - case "access_pimdomain_calendars": - retVal = "/VSNDK.Package;component/Resources/Calendar.bmp"; - break; - case "use_camera": - retVal = "/VSNDK.Package;component/Resources/Camera.bmp"; - break; - case "access_pimdomain_contacts": - retVal = "/VSNDK.Package;component/Resources/Contacts.bmp"; - break; - case "read_device_identifying_information": - retVal = "/VSNDK.Package;component/Resources/DeviceIdentifyingInfo.bmp"; - break; - case "access_pimdomain_messages": - retVal = "/VSNDK.Package;component/Resources/EmailPINMessages.bmp"; - break; - case "access_internet": - retVal = "/VSNDK.Package;component/Resources/Internet.bmp"; - break; - case "read_geolocation": - retVal = "/VSNDK.Package;component/Resources/GPSLocation.bmp"; - break; - case "access_location_services": - retVal = "/VSNDK.Package;component/Resources/Location.bmp"; - break; - case "record_audio": - retVal = "/VSNDK.Package;component/Resources/Mircrophone.bmp"; - break; - case "access_pimdomain_notebooks": - retVal = "/VSNDK.Package;component/Resources/Notebooks.bmp"; - break; - case "post_notification": - retVal = "/VSNDK.Package;component/Resources/PostNotifications.bmp"; - break; - case "run_when_backgrounded": - retVal = "/VSNDK.Package;component/Resources/RunBackgrounded.bmp"; - break; - case "access_shared": - retVal = "/VSNDK.Package;component/Resources/SharedFiles.bmp"; - break; - case "access_sms_mms": - retVal = "/VSNDK.Package;component/Resources/TextMessages.bmp"; - break; - case "read_personally_identifiable_information": - retVal = "/VSNDK.Package;component/Resources/MyContactInfo.bmp"; - break; - case "access_phone": - retVal = "/VSNDK.Package;component/Resources/Phone.bmp"; - break; - case "control_phone": - retVal = "/VSNDK.Package;component/Resources/PhoneControl.bmp"; - break; - case "_sys_use_consumer_push": - retVal = "/VSNDK.Package;component/Resources/Push.bmp"; - break; - case "use_camera_desktop": - retVal = "/VSNDK.Package;component/Resources/CaptureScreen.bmp"; - break; - case "use_gamepad": - retVal = "/VSNDK.Package;component/Resources/Gamepad.bmp"; - break; - } - - return retVal; - } - - /// - /// Load the permissions list - /// - private void LoadPermissions() - { - SettingsData settingsData = new SettingsData(_pkg); - bool oldListMethod = true; - XmlNodeList pList = null; - - if (settingsData.TargetPath != "") - { - XmlDocument xmlDoc = new XmlDocument(); - xmlDoc.Load(settingsData.TargetPath + @"\..\blackberry-sdk-descriptor.xml"); - pList = xmlDoc.GetElementsByTagName("permission"); - oldListMethod = false; - } - - IList PermissionList = new List(); - - if (oldListMethod) // Old Listing Method - { - PermissionItemClass permissionItem = new PermissionItemClass(isPermissionChecked("bbm_connect"), "BlackBerry Messenger", "bbm_connect", getPermissionIcon("bbm_connect")); - PermissionList.Add(permissionItem); - permissionItem = new PermissionItemClass(isPermissionChecked("access_pimdomain_calendars"), "Calendar", "access_pimdomain_calendars", getPermissionIcon("access_pimdomain_calendars")); - PermissionList.Add(permissionItem); - permissionItem = new PermissionItemClass(isPermissionChecked("use_camera"), "Camera", "use_camera", getPermissionIcon("use_camera")); - PermissionList.Add(permissionItem); - permissionItem = new PermissionItemClass(isPermissionChecked("access_pimdomain_contacts"), "Contacts", "access_pimdomain_contacts", getPermissionIcon("access_pimdomain_contacts")); - PermissionList.Add(permissionItem); - permissionItem = new PermissionItemClass(isPermissionChecked("read_device_identifying_information"), "Device Identifying Information", "read_device_identifying_information", getPermissionIcon("read_device_identifying_information")); - PermissionList.Add(permissionItem); - permissionItem = new PermissionItemClass(isPermissionChecked("access_pimdomain_messages"), "Email and PIN Message", "access_pimdomain_messages", getPermissionIcon("access_pimdomain_messages")); - PermissionList.Add(permissionItem); - permissionItem = new PermissionItemClass(isPermissionChecked("access_internet"), "Internet", "access_internet", getPermissionIcon("access_internet")); - PermissionList.Add(permissionItem); - permissionItem = new PermissionItemClass(isPermissionChecked("read_geolocation"), "GPS Location", "read_geolocation", getPermissionIcon("read_geolocation")); - PermissionList.Add(permissionItem); - permissionItem = new PermissionItemClass(isPermissionChecked("access_location_services"), "Location", "access_location_services", getPermissionIcon("access_location_services")); - PermissionList.Add(permissionItem); - permissionItem = new PermissionItemClass(isPermissionChecked("record_audio"), "Microphone", "record_audio", getPermissionIcon("record_audio")); - PermissionList.Add(permissionItem); - permissionItem = new PermissionItemClass(isPermissionChecked("access_pimdomain_notebooks"), "Notebooks", "access_pimdomain_notebooks", getPermissionIcon("access_pimdomain_notebooks")); - PermissionList.Add(permissionItem); - permissionItem = new PermissionItemClass(isPermissionChecked("post_notification"), "Post Notifications", "post_notification", getPermissionIcon("post_notification")); - PermissionList.Add(permissionItem); - permissionItem = new PermissionItemClass(isPermissionChecked("run_when_backgrounded"), "Run When Backgrounded", "run_when_backgrounded", getPermissionIcon("run_when_backgrounded")); - PermissionList.Add(permissionItem); - permissionItem = new PermissionItemClass(isPermissionChecked("access_shared"), "Shared Files", "access_shared", getPermissionIcon("access_shared")); - PermissionList.Add(permissionItem); - permissionItem = new PermissionItemClass(isPermissionChecked("access_sms_mms"), "Text Messages", "access_sms_mms", getPermissionIcon("access_sms_mms")); - PermissionList.Add(permissionItem); - permissionItem = new PermissionItemClass(isPermissionChecked("_sys_use_consumer_push"), "Consumer Push", "_sys_use_consumer_push", getPermissionIcon("_sys_use_consumer_push")); - PermissionList.Add(permissionItem); - permissionItem = new PermissionItemClass(isPermissionChecked("narrow_landscape_exit"), "Narrow Swipe Up", "narrow_landscape_exit", getPermissionIcon("narrow_landscape_exit")); - PermissionList.Add(permissionItem); - permissionItem = new PermissionItemClass(isPermissionChecked("access_phone"), "Phone", "access_phone", getPermissionIcon("access_phone")); - PermissionList.Add(permissionItem); - } - else - { - foreach (XmlNode p in pList) - { - PermissionItemClass permissionItem = new PermissionItemClass(isPermissionChecked(p["id"].InnerText), p["name"].InnerText, p["id"].InnerText, getPermissionIcon(p["id"].InnerText)); - PermissionList.Add(permissionItem); - } - } - - _permissionList = new CollectionView(PermissionList); - } - - /// - /// Called on idle time. This is when we check if the designer is out of sync with the underlying text buffer. - /// - public void DoIdle() - { - if (BufferDirty || DesignerDirty) - { - int delay = 100; - - if ((Environment.TickCount - _dirtyTime) > delay) - { - // Must not try and sync while XML editor is parsing otherwise we just confuse matters. - if (IsXmlEditorParsing) - { - _dirtyTime = System.Environment.TickCount; - return; - } - - //If there is contention, give the preference to the designer. - if (DesignerDirty) - { - SaveModelToXmlModel(Resources.SynchronizeBuffer); - //We don't do any merging, so just overwrite whatever was in the buffer. - BufferDirty = false; - } - else if (BufferDirty) - { - LoadModelFromXmlModel(); - } - } - } - } - - /// - /// We must not try and update the XDocument while the XML Editor is parsing as this may cause - /// a deadlock in the XML Editor! - /// - /// - bool IsXmlEditorParsing - { - get - { - LanguageService langsvc = GetXmlLanguageService(); - return langsvc != null ? langsvc.IsParsing : false; - } - } - - /// - /// Get the XML Editor language service - /// - /// - LanguageService GetXmlLanguageService() - { - if (_xmlLanguageService == null) - { - IOleServiceProvider vssp = _serviceProvider.GetService(typeof(IOleServiceProvider)) as IOleServiceProvider; - Guid xmlEditorGuid = new Guid("f6819a78-a205-47b5-be1c-675b3c7f0b8e"); - Guid iunknown = new Guid("00000000-0000-0000-C000-000000000046"); - IntPtr ptr; - if (ErrorHandler.Succeeded(vssp.QueryService(ref xmlEditorGuid, ref iunknown, out ptr))) - { - try - { - _xmlLanguageService = Marshal.GetObjectForIUnknown(ptr) as LanguageService; - } - finally - { - Marshal.Release(ptr); - } - } - } - return _xmlLanguageService; - } - - /// - /// This method is called when it is time to save the designer values to the - /// underlying buffer. - /// - /// - void SaveModelToXmlModel(string undoEntry) - { - LanguageService langsvc = GetXmlLanguageService(); - - try - { - //We can't edit this file (perhaps the user cancelled a SCC prompt, etc...) - if (!CanEditFile()) - { - DesignerDirty = false; - BufferDirty = true; - throw new Exception(); - } - - XmlSerializer serializer = new XmlSerializer(typeof(qnx)); - XDocument documentFromDesignerState = new XDocument(); - using (XmlWriter w = documentFromDesignerState.CreateWriter()) - { - serializer.Serialize(w, _qnxSchema); - } - - _synchronizing = true; - XDocument document = GetParseTree(); - Source src = GetSource(); - if (src == null || langsvc == null) - { - return; - } - - langsvc.IsParsing = true; // lock out the background parse thread. - - // Wrap the buffer sync and the formatting in one undo unit. - using (CompoundAction ca = new CompoundAction(src, Resources.SynchronizeBuffer)) - { - using (XmlEditingScope scope = _xmlStore.BeginEditingScope(Resources.SynchronizeBuffer, this)) - { - //Replace the existing XDocument with the new one we just generated. - document.Root.ReplaceWith(documentFromDesignerState.Root); - scope.Complete(); - } - ca.FlushEditActions(); - FormatBuffer(src); - } - DesignerDirty = false; - } - catch (Exception) - { - // if the synchronization fails then we'll just try again in a second. - _dirtyTime = Environment.TickCount; - } - finally - { - langsvc.IsParsing = false; - _synchronizing = false; - - LoadPermissions(); - } - } - - /// - /// Reformat the text buffer - /// - void FormatBuffer(Source src) - { - using (EditArray edits = new EditArray(src, null, false, Resources.ReformatBuffer)) - { - TextSpan span = src.GetDocumentSpan(); - src.ReformatSpan(edits, span); - } - } - - /// - /// Get the XML Editor Source object for this document. - /// - /// - Source GetSource() - { - LanguageService langsvc = GetXmlLanguageService(); - if (langsvc == null) - { - return null; - } - Source src = langsvc.GetSource(_buffer); - return src; - } - - /// - /// Get an up to date XML parse tree from the XML Editor. - /// - XDocument GetParseTree() - { - LanguageService langsvc = this.GetXmlLanguageService(); - - // don't crash if the language service is not available - if (langsvc != null) - { - Source src = langsvc.GetSource(_buffer); - - // We need to access this method to get the most up to date parse tree. - // public virtual XmlDocument GetParseTree(Source source, IVsTextView view, int line, int col, ParseReason reason) { - MethodInfo mi = langsvc.GetType().GetMethod("GetParseTree"); - int line = 0, col = 0; - mi.Invoke(langsvc, new object[] { src, null, line, col, ParseReason.Check }); - } - - // Now the XmlDocument should be up to date also. - return _xmlModel.Document; - } - - /// - /// This function asks the QueryEditQuerySave service if it is possible to edit the file. - /// This can result in an automatic checkout of the file and may even prompt the user for - /// permission to checkout the file. If the user says no or the file cannot be edited - /// this returns false. - /// - private bool CanEditFile() - { - // Cache the value so we don't keep asking the user over and over. - if (_canEditFile.HasValue) - { - return (bool)_canEditFile; - } - - // Check the status of the recursion guard - if (_gettingCheckoutStatus) - return false; - - _canEditFile = false; // assume the worst - try - { - // Set the recursion guard - _gettingCheckoutStatus = true; - - // Get the QueryEditQuerySave service - IVsQueryEditQuerySave2 queryEditQuerySave = _serviceProvider.GetService(typeof(SVsQueryEditQuerySave)) as IVsQueryEditQuerySave2; - - string filename = _xmlModel.Name; - - // Now call the QueryEdit method to find the edit status of this file - string[] documents = { filename }; - uint result; - uint outFlags; - - // Note that this function can popup a dialog to ask the user to checkout the file. - // When this dialog is visible, it is possible to receive other request to change - // the file and this is the reason for the recursion guard - int hr = queryEditQuerySave.QueryEditFiles( - 0, // Flags - 1, // Number of elements in the array - documents, // Files to edit - null, // Input flags - null, // Input array of VSQEQS_FILE_ATTRIBUTE_DATA - out result, // result of the checkout - out outFlags // Additional flags - ); - if (ErrorHandler.Succeeded(hr) && (result == (uint)tagVSQueryEditResult.QER_EditOK)) - { - // In this case (and only in this case) we can return true from this function - _canEditFile = true; - } - } - finally - { - _gettingCheckoutStatus = false; - } - return (bool)_canEditFile; - } - - /// - /// Load the model from the underlying text buffer. - /// - private void LoadModelFromXmlModel() - { - try - { - XmlSerializer serializer = new XmlSerializer(typeof(qnx)); - - using (XmlReader reader = GetParseTree().CreateReader()) - { - _qnxSchema = (qnx)serializer.Deserialize(reader); - } - - if (_qnxSchema == null) - { - throw new Exception(Resources.InvalidVsTemplateData); - } - } - catch (Exception e) - { - //Display error message - ErrorHandler.ThrowOnFailure(VsShellUtilities.ShowMessageBox(_serviceProvider, - Resources.InvalidVsTemplateData + e.Message, - Resources.ErrorMessageBoxTitle, - OLEMSGICON.OLEMSGICON_CRITICAL, - OLEMSGBUTTON.OLEMSGBUTTON_OK, - OLEMSGDEFBUTTON.OLEMSGDEFBUTTON_FIRST)); - } - - BufferDirty = false; - - if (ViewModelChanged != null) - { - // Update the Designer View - ViewModelChanged(this, new EventArgs()); - - LoadPermissions(); - } - } - - /// - /// BufferDirty Property - /// - public bool BufferDirty { get; set; } - - /// - /// DesignerDirty Property - /// - public bool DesignerDirty { get; set; } - - - /// - /// Fired when all controls should be re-bound. - /// - public event EventHandler ViewModelChanged; - - /// - /// Handle edit scope completion event. This happens when the XML editor buffer decides to update - /// it's XDocument parse tree. - /// - /// - /// - void OnUnderlyingEditCompleted(object sender, XmlEditingScopeEventArgs e) - { - if (e.EditingScope.UserState != this && !_synchronizing) - { - BufferDirty = true; - _dirtyTime = Environment.TickCount; - } - } - - /// - /// Handle undo/redo completion event. This happens when the user invokes Undo/Redo on a buffer edit operation. - /// We need to resync when this happens. - /// - /// - /// - void OnUndoRedoCompleted(object sender, XmlEditingScopeEventArgs e) - { - if (!_synchronizing) - { - BufferDirty = true; - _dirtyTime = Environment.TickCount; - } - } - - /// - /// BufferReloaded event handler - /// - /// - /// - private void BufferReloaded(object sender, EventArgs e) - { - if (!_synchronizing) - { - BufferDirty = true; - _dirtyTime = Environment.TickCount; - } - } - - /// - /// Read the author information from the debug token and update the appropriate boxes. - /// - public void setAuthorInfo() - { - if (!File.Exists(_localRIMFolder + "DebugToken.bar")) - { - // Create the dialog instance without Help support. - var DebugTokenDialog = new DebugToken.DebugTokenDialog(); - // Show the dialog. - if (!DebugTokenDialog.IsClosing) - DebugTokenDialog.ShowModal(); - } - - System.Diagnostics.Process p = new System.Diagnostics.Process(); - System.Diagnostics.ProcessStartInfo startInfo = p.StartInfo; - startInfo.UseShellExecute = false; - startInfo.CreateNoWindow = true; - startInfo.RedirectStandardError = true; - startInfo.RedirectStandardOutput = true; - p.OutputDataReceived += new System.Diagnostics.DataReceivedEventHandler(p_OutputDataReceived); - - - /// Get Device PIN - startInfo.FileName = "cmd.exe"; - startInfo.Arguments = string.Format(@"/C blackberry-airpackager.bat -listManifest ""{0}""", _localRIMFolder + "DebugToken.bar"); - - try - { - p.Start(); - p.BeginErrorReadLine(); - p.BeginOutputReadLine(); - p.WaitForExit(); - p.Close(); - } - catch (Exception e) - { - System.Diagnostics.Debug.WriteLine(startInfo.Arguments); - System.Diagnostics.Debug.WriteLine(e.Message); - } - } - - /// - /// Get the author ID - /// - /// REturns the author ID - public string getAuthorID() - { - return _tmpAuthorID; - } - - /// - /// Get the author ID - /// - /// REturns the author ID - public string getAuthor() - { - return _tmpAuthor; - } - - /// - /// On Data Received event handler - /// - /// - /// - private void p_OutputDataReceived(object sender, System.Diagnostics.DataReceivedEventArgs e) - { - if (e.Data != null) - { - if (e.Data.Contains("Package-Author-Id:")) - AuthorID = e.Data.Substring(e.Data.LastIndexOf(": ") + 2); - else if (e.Data.Contains("Package-Author:")) - Author = e.Data.Substring(e.Data.LastIndexOf(": ") + 2); - } - } - - #region IViewModel - - /// - /// Name property - /// - public string Name - { - get - { - return _qnxSchema.id; - } - set - { - if (_qnxSchema.id != value) - { - _qnxSchema.id = value; - DesignerDirty = true; - NotifyPropertyChanged("Name"); - } - } - } - - /// - /// AppName property - /// - public string AppName - { - get - { - return _qnxSchema.name; - } - set - { - if (_qnxSchema.name != value) - { - _qnxSchema.name = value; - DesignerDirty = true; - NotifyPropertyChanged("AppName"); - } - } - } - - /// - /// Description property - /// - public string Description - { - get - { - return _qnxSchema.description.Trim(); - } - set - { - if (_qnxSchema.description != value) - { - _qnxSchema.description = value; - DesignerDirty = true; - NotifyPropertyChanged("Description"); - } - } - } - - /// - /// Version property - /// - public string Version - { - get - { - return _qnxSchema.versionNumber; - } - set - { - if (_qnxSchema.versionNumber != value) - { - _qnxSchema.versionNumber = value; - DesignerDirty = true; - NotifyPropertyChanged("Version"); - } - } - } - - /// - /// Build ID property - /// - public string BuildID - { - get - { - return _qnxSchema.buildId; - } - set - { - if (_qnxSchema.buildId != value) - { - _qnxSchema.buildId = value; - DesignerDirty = true; - NotifyPropertyChanged("BuildID"); - } - } - } - - /// - /// Author property - /// - public string Author - { - get - { - return _qnxSchema.author; - } - set - { - if (_qnxSchema.author != value) - { - _qnxSchema.author = value; - DesignerDirty = true; - NotifyPropertyChanged("Author"); - } - } - } - - /// - /// Build ID property - /// - public string AuthorID - { - get - { - return _qnxSchema.authorId; - } - set - { - if (_qnxSchema.authorId != value) - { - _qnxSchema.authorId = value; - DesignerDirty = true; - NotifyPropertyChanged("AuthorID"); - } - } - } - - /// - /// Chrome property - /// - public string Chrome - { - get - { - return _qnxSchema.initialWindow.systemChrome; - } - set - { - if (_qnxSchema.initialWindow.systemChrome != value) - { - _qnxSchema.initialWindow.systemChrome = value; - DesignerDirty = true; - NotifyPropertyChanged("Chrome"); - } - } - } - - /// - /// Return the AssetList - /// - public List AssetList - { - get - { - if (_config == null) - { - if (_qnxSchema.asset == null) - return null; - return _qnxSchema.asset.ToList(); - } - - if (_config.Name == "All Configurations") - { - if (_qnxSchema.asset == null) - return null; - return _qnxSchema.asset.ToList(); - } - else - { - foreach (qnxConfiguration config in _qnxSchema.configuration) - { - if (config.name == _config.Name) - { - if (config.asset == null) - return null; - return config.asset.ToList(); - } - } - - return null; - } - } - } - - - public void AddLocalAsset(string assetPath) - { - asset newAsset = new asset(); - - FileInfo fileInfo = new FileInfo(assetPath); - newAsset.Value = fileInfo.Name; - - string activeDir = _activeProjectDirectory; - string back = ""; - - // generating the relative path for the asset. - do - { - if (assetPath.Contains(activeDir + "\\")) - { - newAsset.path = back + assetPath.Replace(activeDir + "\\", ""); - break; - } - else - { - int pos = activeDir.LastIndexOf('\\', activeDir.Length - 1); - if (pos < 0) - { // file is located in a different driver. Copy the entire assetPath. - newAsset.path = assetPath; - break; - } - else - { - back += "..\\"; - activeDir = activeDir.Remove(pos); - } - } - } - while (true); - - if (_config.Name == "All Configurations") - _qnxSchema.AddLocalAsset(newAsset); - else - { - foreach (qnxConfiguration config in _qnxSchema.configuration) - { - if (config.name == _config.Name) - { - config.AddAsset(newAsset); - } - } - } - - DesignerDirty = true; - - if (ViewModelChanged != null) - { - // Update the Designer View - ViewModelChanged(this, new EventArgs()); - } - } - - public void DeleteLocalAsset(object asset) - { - if (_config.Name == "All Configurations") - _qnxSchema.DeleteLocalAsset(asset as asset); - else - { - foreach (qnxConfiguration config in _qnxSchema.configuration) - { - if (config.name == _config.Name) - { - config.DeleteAsset(asset as asset); - } - } - } - - DesignerDirty = true; - - if (ViewModelChanged != null) - { - // Update the Designer View - ViewModelChanged(this, new EventArgs()); - } - } - - public void EditLocalAsset(string identifier, bool? isPublic, string assetType) - { - if (_config.Name == "All Configurations") - { - foreach (asset assetItem in _qnxSchema.asset) - { - if (assetItem.Value == identifier) - { - if (isPublic == true) - { - assetItem.publicAsset = "true"; - } - else if (isPublic == false) - { - assetItem.publicAsset = "false"; - } - - if (assetType == "Other") - { - assetItem.type = ""; - assetItem.entry = ""; - assetItem.Value = assetItem.Value.Replace(@"lib/", ""); - } - else if (assetType == "Entry-point") - { - assetItem.type = "Qnx/Elf"; - assetItem.entry = "true"; - assetItem.Value = assetItem.Value.Replace(@"lib/", ""); - } - else if (assetType == "Executable") - { - assetItem.type = "Qnx/Elf"; - assetItem.entry = ""; - assetItem.Value = assetItem.Value.Replace(@"lib/", ""); - } - else if (assetType == "Library") - { - assetItem.type = ""; - assetItem.entry = ""; - assetItem.Value = @"lib/" + assetItem.Value; - } - } - } - } - else - { - foreach (qnxConfiguration config in _qnxSchema.configuration) - { - if (config.name == _config.Name) - { - foreach (asset assetItem in config.asset) - { - if (assetItem.Value == identifier) - { - if (isPublic == true) - { - assetItem.publicAsset = "true"; - } - else if (isPublic == false) - { - assetItem.publicAsset = "false"; - } - - if (assetType == "Other") - { - assetItem.type = ""; - assetItem.entry = ""; - assetItem.Value = assetItem.Value.Replace(@"lib/", ""); - } - else if (assetType == "Entry-point") - { - assetItem.type = "Qnx/Elf"; - assetItem.entry = "true"; - assetItem.Value = assetItem.Value.Replace(@"lib/", ""); - } - else if (assetType == "Executable") - { - assetItem.type = "Qnx/Elf"; - assetItem.entry = ""; - assetItem.Value = assetItem.Value.Replace(@"lib/", ""); - } - else if (assetType == "Library") - { - assetItem.type = ""; - assetItem.entry = ""; - assetItem.Value = @"lib/" + assetItem.Value; - } - } - } - } - } - } - - DesignerDirty = true; - - if (ViewModelChanged != null) - { - // Update the Designer View - ViewModelChanged(this, new EventArgs()); - } - } - - public void AddIcon(string iconName) - { - _qnxSchema.icon.AddIconImage(iconName); - DesignerDirty = true; - IList source = (IList)_iconImageList.SourceCollection; - ImageItemClass image = new ImageItemClass(iconName, getImagePath(iconName), _activeProjectDirectory); - source.Add(image); - _iconImageList = new CollectionView(source); - - if (ViewModelChanged != null) - { - // Update the Designer View - ViewModelChanged(this, new EventArgs()); - } - } - - public void DeleteIcon(object iconName) - { - ImageItemClass item = (ImageItemClass)iconName; - _qnxSchema.icon.DeleteIconImage(item.ImageName); - DesignerDirty = true; - IList source = (IList)_iconImageList.SourceCollection; - source.Remove(item); - _iconImageList = new CollectionView(source); - - if (ViewModelChanged != null) - { - // Update the Designer View - ViewModelChanged(this, new EventArgs()); - } - } - - public void AddSplashScreen(string splashScreenName) - { - qnxSplashScreens qnxSS; - - if (_qnxSchema.splashScreens == null) - { - qnxSS = new qnxSplashScreens(); - _qnxSchema.splashScreens = qnxSS; - } - else - { - qnxSS = _qnxSchema.splashScreens; - } - - qnxSS.AddSplashScreenImage(splashScreenName); - DesignerDirty = true; - IList source = (IList)_splashScreenImageList.SourceCollection; - ImageItemClass image = new ImageItemClass(splashScreenName, getImagePath(splashScreenName), _activeProjectDirectory); - source.Add(image); - _splashScreenImageList = new CollectionView(source); - - if (ViewModelChanged != null) - { - // Update the Designer View - ViewModelChanged(this, new EventArgs()); - } - } - - public void DeleteSplashScreen(object splashScreenName) - { - ImageItemClass item = (ImageItemClass)splashScreenName; - _qnxSchema.splashScreens.DeleteSplashScreenImage(item.ImageName); - DesignerDirty = true; - IList source = (IList)_splashScreenImageList.SourceCollection; - source.Remove(item); - _splashScreenImageList = new CollectionView(source); - - if (ViewModelChanged != null) - { - // Update the Designer View - ViewModelChanged(this, new EventArgs()); - } - } - - public void CheckPermission(string identifier) - { - - /// add new perm to xml - qnxPermission perm = new qnxPermission(); - perm.Value = identifier; - _qnxSchema.AddPermission(perm); - DesignerDirty = true; - } - - public void UnCheckPermission(string identifier) - { - /// add new perm to xml - qnxPermission perm = new qnxPermission(); - perm.Value = identifier; - _qnxSchema.DeletePermission(perm); - DesignerDirty = true; - } - - public bool isPermissionChecked(string identifier) - { - bool result = false; - - if (_qnxSchema.permission != null) - { - foreach (qnxPermission permEntry in _qnxSchema.permission) - { - if (permEntry.Value == identifier) - { - result = true; - } - } - } - return result; - } - - - public CollectionView OrientationList - { - get { return _orientationList; } - } - - public CollectionView ConfigurationList - { - get { return _configurationList; } - } - - public CollectionView PermissionList - { - get { return _permissionList; } - } - - public CollectionView IconImageList - { - get { return _iconImageList; } - } - - - public CollectionView SplashScreenImageList - { - get { return _splashScreenImageList; } - } - - public PermissionItemClass PermissionItem - { - get - { - return _permission; - } - set - { - _permission = value; - NotifyPropertyChanged("permission"); - } - } - - public ConfigurationItemClass ConfigurationItemClass - { - get - { - return _config; - } - set - { - if (_config == value) return; - _config = value; - - - if (ViewModelChanged != null) - { - // Update the Designer View - ViewModelChanged(this, new EventArgs()); - } - - NotifyPropertyChanged("ConfigurationItemClass"); - } - } - - public OrientationItemClass OrientationItemClass - { - get { - return _orientationItem; } - set - { - if (_orientationItem == value) return; - _orientationItem = value; - - if (_orientationItem.Name == "Default") - { - _qnxSchema.initialWindow.autoOrients = ""; - _qnxSchema.initialWindow.aspectRatio = ""; - } - else if (_orientationItem.Name == "Auto-orient") - { - _qnxSchema.initialWindow.autoOrients = "true"; - _qnxSchema.initialWindow.aspectRatio = ""; - } - else if (_orientationItem.Name == "Landscape") - { - _qnxSchema.initialWindow.autoOrients = "false"; - _qnxSchema.initialWindow.aspectRatio = "landscape"; - } - else if (_orientationItem.Name == "Portrait") - { - _qnxSchema.initialWindow.autoOrients = "false"; - _qnxSchema.initialWindow.aspectRatio = "portrait"; - } - - DesignerDirty = true; - NotifyPropertyChanged("OrientationItemClass"); - } - } - - public XmlModel Model - { - get - { - return _xmlModel; - } - } - /// - /// Transparent property - /// - public bool Transparent - { - get - { - if (_qnxSchema.initialWindow.transparent == "true") - { - return true; - } - else - { - return false; - } - } - set - { - if (value) - { - if (_qnxSchema.initialWindow.transparent != "true") - { - _qnxSchema.initialWindow.transparent = "true"; - DesignerDirty = true; - NotifyPropertyChanged("Chrome"); - } - } - else - { - if (_qnxSchema.initialWindow.transparent == "true") - { - _qnxSchema.initialWindow.transparent = "false"; - DesignerDirty = true; - NotifyPropertyChanged("Chrome"); - } - } - } - } - - #endregion - - #region IDataErrorInfo - - /// - /// Error Property - /// - public string Error - { - get - { - throw new NotImplementedException(); - } - } - - /// - /// - /// - /// - /// - public string this[string columnName] - { - get - { - string error = null; - return error; - } - } - - - #endregion - - #region INotifyPropertyChanged - - public event PropertyChangedEventHandler PropertyChanged; - - protected void NotifyPropertyChanged(string propertyName) - { - if (PropertyChanged != null) - { - PropertyChanged(this, new PropertyChangedEventArgs(propertyName)); - } - } - - #endregion - - #region TreeView SelectionChanged - - private ITrackSelection trackSel; - private ITrackSelection TrackSelection - { - get - { - if (trackSel == null) - trackSel = _serviceProvider.GetService(typeof(STrackSelection)) as ITrackSelection; - return trackSel; - } - } - - private Microsoft.VisualStudio.Shell.SelectionContainer selContainer; - public void OnSelectChanged(object p) - { - selContainer = new Microsoft.VisualStudio.Shell.SelectionContainer(true, false); - ArrayList items = new ArrayList(); - items.Add(p); - selContainer.SelectableObjects = items; - selContainer.SelectedObjects = items; - - ITrackSelection track = TrackSelection; - if (track != null) - track.OnSelectChange((ISelectionContainer)selContainer); - } - - #endregion - - } -} diff --git a/src_vs2013/VSNDK.Package/ControlDebugEngine.cs b/src_vs2013/VSNDK.Package/ControlDebugEngine.cs deleted file mode 100644 index 0398c696..00000000 --- a/src_vs2013/VSNDK.Package/ControlDebugEngine.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; - -namespace VSNDK.Package -{ - public static class ControlDebugEngine - { - public static bool isDebugEngineRunning = false; - } -} diff --git a/src_vs2013/VSNDK.Package/DebugToken/DebugTokenDialog.xaml b/src_vs2013/VSNDK.Package/DebugToken/DebugTokenDialog.xaml deleted file mode 100644 index 32105fca..00000000 --- a/src_vs2013/VSNDK.Package/DebugToken/DebugTokenDialog.xaml +++ /dev/null @@ -1,59 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src_vs2013/VSNDK.Package/Signing/RegistrationWindow.xaml.cs b/src_vs2013/VSNDK.Package/Signing/RegistrationWindow.xaml.cs deleted file mode 100644 index 41f8fa22..00000000 --- a/src_vs2013/VSNDK.Package/Signing/RegistrationWindow.xaml.cs +++ /dev/null @@ -1,84 +0,0 @@ -//* Copyright 2010-2011 Research In Motion Limited. -//* -//* Licensed under the Apache License, Version 2.0 (the "License"); -//* you may not use this file except in compliance with the License. -//* You may obtain a copy of the License at -//* -//* http://www.apache.org/licenses/LICENSE-2.0 -//* -//* Unless required by applicable law or agreed to in writing, software -//* distributed under the License is distributed on an "AS IS" BASIS, -//* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//* See the License for the specific language governing permissions and -//* limitations under the License. - -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Windows; -using System.Windows.Controls; -using System.Windows.Data; -using System.Windows.Documents; -using System.Windows.Input; -using System.Windows.Media; -using System.Windows.Media.Imaging; -using System.Windows.Shapes; -using RIM.VSNDK_Package.Signing.Models; -using System.IO; -using System.ComponentModel; - -namespace RIM.VSNDK_Package.Signing -{ - /// - /// Interaction logic for RegistrationWindow.xaml - /// - public partial class RegistrationWindow : Window - { - private SigningData signingData = null; - - /// - /// RegistrationWindow Constructor - /// - public RegistrationWindow() - { - InitializeComponent(); - - signingData = new SigningData(); - gridMain.DataContext = signingData; - } - - /// - /// Perform actions on the OK button click - /// - /// - /// - private void btnOk_Click(object sender, RoutedEventArgs e) - { - if (!signingData.Register(tbAuthor.Text, tbPassword.Password)) - { - MessageBox.Show(signingData.Errors, "Registration Window", MessageBoxButton.OK, MessageBoxImage.Exclamation, MessageBoxResult.OK); - signingData.Errors = null; - e.Handled = true; - return; - } - else if (!string.IsNullOrEmpty(signingData.Messages)) - { - signingData.Messages = signingData.Messages.Replace("CSK", "BB ID Token"); - MessageBox.Show(signingData.Messages, "Registration Window", MessageBoxButton.OK, MessageBoxImage.Information, MessageBoxResult.OK); - signingData.Messages = null; - } - - DialogResult = true; - } - - /// - /// Perform actions on close of dialog. - /// - /// - protected override void OnClosing(CancelEventArgs e) - { - signingData.CleanUp(); - } - } -} \ No newline at end of file diff --git a/src_vs2013/VSNDK.Package/Signing/SigningDialog.xaml b/src_vs2013/VSNDK.Package/Signing/SigningDialog.xaml deleted file mode 100644 index 6b1c91c5..00000000 --- a/src_vs2013/VSNDK.Package/Signing/SigningDialog.xaml +++ /dev/null @@ -1,35 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src_vs2013/VSNDK.Package/XmlEditorDesignerViewRegistration.cs b/src_vs2013/VSNDK.Package/XmlEditorDesignerViewRegistration.cs deleted file mode 100644 index aa8f25ac..00000000 --- a/src_vs2013/VSNDK.Package/XmlEditorDesignerViewRegistration.cs +++ /dev/null @@ -1,205 +0,0 @@ -//* Copyright 2010-2011 Research In Motion Limited. -//* -//* Licensed under the Apache License, Version 2.0 (the "License"); -//* you may not use this file except in compliance with the License. -//* You may obtain a copy of the License at -//* -//* http://www.apache.org/licenses/LICENSE-2.0 -//* -//* Unless required by applicable law or agreed to in writing, software -//* distributed under the License is distributed on an "AS IS" BASIS, -//* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//* See the License for the specific language governing permissions and -//* limitations under the License. - -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using Microsoft.VisualStudio.Shell; -using System.IO; -using Microsoft.VisualStudio; - -namespace RIM.VSNDK_Package -{ - /// - /// Register our bardescriptor.xml custom editor - /// - [AttributeUsage(AttributeTargets.Class, AllowMultiple = true, Inherited = true)] - public sealed class XmlEditorDesignerViewRegistrationAttribute : RegistrationAttribute - { - /// Declare Constants - const string XmlChooserFactory = "XmlChooserFactory"; - const string XmlChooserEditorExtensionsKeyPath = @"Editors\{32CC8DFA-2D70-49b2-94CD-22D57349B778}\Extensions"; - const string XmlEditorFactoryGuid = "{FA3CD31E-987B-443A-9B81-186104E8DAC1}"; - - /// Declare Private Member Variables - private string keyName; - private string defaultExtension; - private Guid defaultLogicalView; - private int xmlChooserPriority; - - /// - /// Construtor - /// - /// Registry key name - /// Default extension for editor - /// Default Editor Factory - /// XML Priority - public XmlEditorDesignerViewRegistrationAttribute(string keyName, string defaultExtension, object defaultLogicalViewEditorFactory, int xmlChooserPriority) - { - /// Validate parameter input - if (string.IsNullOrWhiteSpace(keyName)) - { - throw new ArgumentException("Editor description cannot be null or empty.", "editorDescription"); - } - if (string.IsNullOrWhiteSpace(defaultExtension)) - { - throw new ArgumentException("Extension cannot be null or empty.", "extension"); - } - if (defaultLogicalViewEditorFactory == null) - { - throw new ArgumentNullException("defaultLogicalViewEditorFactory"); - } - - /// Set Member Variables - this.keyName = keyName; - this.defaultExtension = defaultExtension; - this.defaultLogicalView = TryGetGuidFromObject(defaultLogicalViewEditorFactory); - this.xmlChooserPriority = xmlChooserPriority; - - this.CodeLogicalViewEditor = XmlEditorFactoryGuid; - this.DebuggingLogicalViewEditor = XmlEditorFactoryGuid; - this.DesignerLogicalViewEditor = XmlEditorFactoryGuid; - this.TextLogicalViewEditor = XmlEditorFactoryGuid; - } - - /// - /// Register the custom editor - /// - /// - public override void Register(RegistrationAttribute.RegistrationContext context) - { - /// Validate parameter input - if (context == null) - { - throw new ArgumentNullException("context"); - } - - /// Set extension key - Key extensionKey = context.CreateKey(XmlChooserEditorExtensionsKeyPath); - extensionKey.SetValue(defaultExtension, xmlChooserPriority); - extensionKey.Close(); - - /// set editor key - Key editorKey = context.CreateKey(Path.Combine(XmlChooserFactory, keyName)); - editorKey.SetValue("DefaultLogicalView", defaultLogicalView.ToString("B").ToUpperInvariant()); - editorKey.SetValue("Extension", defaultExtension); - if (!string.IsNullOrWhiteSpace(Namespace)) - { - editorKey.SetValue("Namespace", Namespace); - } - if (MatchExtensionAndNamespace) - { - editorKey.SetValue("Match", "both"); - } - if (IsDataSet.HasValue) - { - editorKey.SetValue("IsDataSet", Convert.ToInt32(IsDataSet.Value)); - } - /// Set DebuggingLogicalViewEditor Mapping - if (DebuggingLogicalViewEditor != null) - { - editorKey.SetValue(VSConstants.LOGVIEWID_Debugging.ToString("B").ToUpperInvariant(), TryGetGuidFromObject(DebuggingLogicalViewEditor).ToString("B").ToUpperInvariant()); - } - /// Set CodeLogicalViewEditor Mapping - if (CodeLogicalViewEditor != null) - { - editorKey.SetValue(VSConstants.LOGVIEWID_Code.ToString("B").ToUpperInvariant(), TryGetGuidFromObject(CodeLogicalViewEditor).ToString("B").ToUpperInvariant()); - } - /// Set DesignerLogicalViewEditor Mapping - if (DesignerLogicalViewEditor != null) - { - editorKey.SetValue(VSConstants.LOGVIEWID_Designer.ToString("B").ToUpperInvariant(), TryGetGuidFromObject(DesignerLogicalViewEditor).ToString("B").ToUpperInvariant()); - } - /// Set TextLogicalViewEditor Mapping - if (TextLogicalViewEditor != null) - { - editorKey.SetValue(VSConstants.LOGVIEWID_TextView.ToString("B").ToUpperInvariant(), TryGetGuidFromObject(TextLogicalViewEditor).ToString("B").ToUpperInvariant()); - } - editorKey.Close(); - } - - /// - /// Unregister the custom editor - /// - /// - public override void Unregister(RegistrationContext context) - { - /// Validate parameter input - if (context == null) - { - throw new ArgumentNullException("context"); - } - - /// Remove Key - context.RemoveKey(Path.Combine(XmlChooserFactory, keyName)); - context.RemoveValue(XmlChooserEditorExtensionsKeyPath, defaultExtension); - context.RemoveKeyIfEmpty(XmlChooserEditorExtensionsKeyPath); - } - - - /// - /// Private member function to return the GUID of an object. - /// - /// - /// - private Guid TryGetGuidFromObject(object guidObject) - { - // figure out what type of object they passed in and get the GUID from it - if (guidObject is string) - return new Guid((string)guidObject); - else if (guidObject is Type) - return ((Type)guidObject).GUID; - else if (guidObject is Guid) - return (Guid)guidObject; - else - throw new ArgumentException("Could not determine Guid from supplied object.", "guidObject"); - } - - /// - /// The editor factor for the Code View Editor - /// - public object CodeLogicalViewEditor { get; set; } - - /// - /// The editor factory for the Debugging View Editor - /// - public object DebuggingLogicalViewEditor { get; set; } - - /// - /// The editor factor for the Designer View Editor - /// - public object DesignerLogicalViewEditor { get; set; } - - /// - /// The edtior factgory for the Text View Editor - /// - public object TextLogicalViewEditor { get; set; } - - /// - /// Namespace property - /// - public string Namespace { get; set; } - - /// - /// Property - /// - public bool MatchExtensionAndNamespace { get; set; } - - /// - /// Special value used only by the DataSet designer. - /// - public bool? IsDataSet { get; set; } - } -} diff --git a/src_vs2013/VSNDK.Package/bar-descriptor.cs b/src_vs2013/VSNDK.Package/bar-descriptor.cs deleted file mode 100644 index 5ab7560d..00000000 --- a/src_vs2013/VSNDK.Package/bar-descriptor.cs +++ /dev/null @@ -1,919 +0,0 @@ -//* Copyright 2010-2011 Research In Motion Limited. -//* -//* Licensed under the Apache License, Version 2.0 (the "License"); -//* you may not use this file except in compliance with the License. -//* You may obtain a copy of the License at -//* -//* http://www.apache.org/licenses/LICENSE-2.0 -//* -//* Unless required by applicable law or agreed to in writing, software -//* distributed under the License is distributed on an "AS IS" BASIS, -//* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//* See the License for the specific language governing permissions and -//* limitations under the License. - -namespace RIM.VSNDK_Package -{ - using System.Xml.Serialization; - using System; - using System.Collections; - using System.Collections.Generic; - - - /// - [System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.0.30319.1")] - [System.SerializableAttribute()] - [System.Diagnostics.DebuggerStepThroughAttribute()] - [System.ComponentModel.DesignerCategoryAttribute("code")] - [System.Xml.Serialization.XmlTypeAttribute(AnonymousType=true, Namespace="http://www.qnx.com/schemas/application/1.0")] - [System.Xml.Serialization.XmlRootAttribute(Namespace="http://www.qnx.com/schemas/application/1.0", IsNullable=true)] - public partial class asset : object, System.ComponentModel.INotifyPropertyChanged { - - private string pathField; - - private string publicAssetField; - - private string entryField; - - private string typeField; - - private string[] _assettypeList = {"Other", "Library", "Executable", "Entry-point"}; - - private string _assettype = "Other"; - - private string valueField; - - [System.Xml.Serialization.XmlIgnore] - public string assettype - { - get - { - _assettype = getAssetType(); - return _assettype; - } - set - { - if (value != _assettype) - _assettype = value; - } - } - - [System.Xml.Serialization.XmlIgnore] - public string[] assettypelist - { - get - { - return this._assettypeList; - } - } - - /// - [System.Xml.Serialization.XmlAttributeAttribute()] - public string path { - get { - return this.pathField; - } - set { - this.pathField = value; - this.RaisePropertyChanged("path"); - } - } - - /// - [System.Xml.Serialization.XmlAttributeAttribute("public")] - public string publicAsset - { - get - { - return this.publicAssetField; - } - set - { - this.publicAssetField = value; - this.RaisePropertyChanged("publicAsset"); - } - } - - /// - [System.Xml.Serialization.XmlAttributeAttribute()] - public string entry { - get { - return this.entryField; - } - set { - this.entryField = value; - this.RaisePropertyChanged("entry"); - } - } - - /// - [System.Xml.Serialization.XmlAttributeAttribute()] - public string type { - get { - return this.typeField; - } - set { - this.typeField = value; - this.RaisePropertyChanged("type"); - } - } - - /// - [System.Xml.Serialization.XmlTextAttribute()] - public string Value { - get { - return this.valueField; - } - set { - this.valueField = value; - this.RaisePropertyChanged("Value"); - } - } - - public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged; - - protected void RaisePropertyChanged(string propertyName) - { - System.ComponentModel.PropertyChangedEventHandler propertyChanged = this.PropertyChanged; - if ((propertyChanged != null)) { - propertyChanged(this, new System.ComponentModel.PropertyChangedEventArgs(propertyName)); - } - } - - private string getAssetType() - { - if (this.valueField.StartsWith("lib/")) - { - return "Library"; - } - else if (this.typeField == "Qnx/Elf") - { - if (this.entry == "true") - { - return "Entry-point"; - } - else - { - return "Executable"; - } - } - else - { - return "Other"; - } - } - } - - /// - [System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.0.30319.1")] - [System.SerializableAttribute()] - [System.Diagnostics.DebuggerStepThroughAttribute()] - [System.ComponentModel.DesignerCategoryAttribute("code")] - [System.Xml.Serialization.XmlTypeAttribute(AnonymousType=true, Namespace="http://www.qnx.com/schemas/application/1.0")] - [System.Xml.Serialization.XmlRootAttribute(Namespace="http://www.qnx.com/schemas/application/1.0", IsNullable=false)] - public partial class qnx : object, System.ComponentModel.INotifyPropertyChanged { - - private string idField; - - private string nameField; - - private string versionNumberField; - - private string buildIdField; - - private string descriptionField; - - private string authorField; - - private string authorIdField; - - private string categoryField; - - private qnxInitialWindow initialWindowField; - - private asset[] assetField; - - private qnxConfiguration[] configurationField; - - private qnxPermission[] permissionField; - - private qnxIcon iconField; - - private qnxSplashScreens splashScreenField; - - private qnxAction[] actionField; - - private qnxEnv[] envField; - - /// - public string id { - get { - return this.idField; - } - set { - this.idField = value; - this.RaisePropertyChanged("id"); - } - } - - /// - public string name { - get { - return this.nameField; - } - set { - this.nameField = value; - this.RaisePropertyChanged("name"); - } - } - - /// - public string versionNumber { - get { - return this.versionNumberField; - } - set { - this.versionNumberField = value; - this.RaisePropertyChanged("versionNumber"); - } - } - - /// - public string buildId { - get { - return this.buildIdField; - } - set { - this.buildIdField = value; - this.RaisePropertyChanged("buildId"); - } - } - - /// - public string description { - get { - return this.descriptionField; - } - set { - this.descriptionField = value; - this.RaisePropertyChanged("description"); - } - } - - /// - public string author { - get { - return this.authorField; - } - set { - this.authorField = value; - this.RaisePropertyChanged("author"); - } - } - - /// - public string authorId - { - get - { - return this.authorIdField; - } - set - { - this.authorIdField = value; - this.RaisePropertyChanged("authorId"); - } - } - - /// - public string category { - get { - return this.categoryField; - } - set { - this.categoryField = value; - this.RaisePropertyChanged("category"); - } - } - - /// - [System.Xml.Serialization.XmlElementAttribute("initialWindow")] - public qnxInitialWindow initialWindow { - get { - return this.initialWindowField; - } - set { - this.initialWindowField = value; - this.RaisePropertyChanged("initialWindow"); - } - } - - /// - [System.Xml.Serialization.XmlElementAttribute("asset", IsNullable=true)] - public asset[] asset { - get { - return this.assetField; - } - set { - this.assetField = value; - this.RaisePropertyChanged("asset"); - } - } - - /// - [System.Xml.Serialization.XmlElementAttribute("configuration")] - public qnxConfiguration[] configuration { - get { - return this.configurationField; - } - set { - this.configurationField = value; - this.RaisePropertyChanged("configuration"); - } - } - - /// - [System.Xml.Serialization.XmlElementAttribute("permission", IsNullable = true)] - public qnxPermission[] permission - { - get - { - return this.permissionField; - } - set - { - this.permissionField = value; - this.RaisePropertyChanged("permission"); - } - } - - public void AddPermission(qnxPermission newPermission) - { - if (permission == null) - { - permission = new qnxPermission[0]; - } - - var newPermissionsList = permission; - Array.Resize(ref newPermissionsList, newPermissionsList.Length + 1); - newPermissionsList[newPermissionsList.Length - 1] = newPermission; - permission = newPermissionsList; - } - - public void DeletePermission(qnxPermission oldPermission) - { - foreach (qnxPermission perm in permission) - { - if (perm.Value == oldPermission.Value) - { - List permissionList = new List(permission); - permissionList.Remove(perm); - permission = permissionList.ToArray(); - } - } - } - - /// - [System.Xml.Serialization.XmlElementAttribute("icon")] - public qnxIcon icon { - get { - return this.iconField; - } - set { - this.iconField = value; - this.RaisePropertyChanged("icon"); - } - } - - /// - [System.Xml.Serialization.XmlElementAttribute("splashScreens")] - public qnxSplashScreens splashScreens - { - get - { - return this.splashScreenField; - } - set - { - this.splashScreenField = value; - this.RaisePropertyChanged("splashScreens"); - } - } - - /// - [System.Xml.Serialization.XmlElementAttribute("action", IsNullable=true)] - public qnxAction[] action { - get { - return this.actionField; - } - set { - this.actionField = value; - this.RaisePropertyChanged("action"); - } - } - - /// - [System.Xml.Serialization.XmlElementAttribute("env")] - public qnxEnv[] env { - get { - return this.envField; - } - set { - this.envField = value; - this.RaisePropertyChanged("env"); - } - } - - public void AddLocalAsset(asset newAsset) - { - if (asset == null) - { - asset = new asset[0]; - } - - var local_asset = asset; - Array.Resize(ref local_asset, local_asset.Length + 1); - local_asset[local_asset.Length - 1] = newAsset; - asset = local_asset; - } - - public void DeleteLocalAsset(asset removeAsset) - { - List assetList = new List(asset); - assetList.Remove(removeAsset); - asset = assetList.ToArray(); - } - - - public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged; - - protected void RaisePropertyChanged(string propertyName) { - System.ComponentModel.PropertyChangedEventHandler propertyChanged = this.PropertyChanged; - if ((propertyChanged != null)) { - propertyChanged(this, new System.ComponentModel.PropertyChangedEventArgs(propertyName)); - } - } - } - - /// - [System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.0.30319.1")] - [System.SerializableAttribute()] - [System.Diagnostics.DebuggerStepThroughAttribute()] - [System.ComponentModel.DesignerCategoryAttribute("code")] - [System.Xml.Serialization.XmlTypeAttribute(AnonymousType=true, Namespace="http://www.qnx.com/schemas/application/1.0")] - public partial class qnxInitialWindow : object, System.ComponentModel.INotifyPropertyChanged { - - private string autoOrientsField; - - private string aspectRatioField; - - private string systemChromeField; - - private string transparentField; - - /// - [System.Xml.Serialization.XmlElementAttribute("autoOrients", IsNullable = true)] - public string autoOrients - { - get - { - return this.autoOrientsField; - } - set - { - this.autoOrientsField = value; - this.RaisePropertyChanged("autoOrients"); - } - } - - /// - [System.Xml.Serialization.XmlElementAttribute("aspectRatio", IsNullable = true)] - public string aspectRatio - { - get - { - return this.aspectRatioField; - } - set - { - this.aspectRatioField = value; - this.RaisePropertyChanged("aspectRatio"); - } - } - - /// - public string systemChrome { - get { - return this.systemChromeField; - } - set { - this.systemChromeField = value; - this.RaisePropertyChanged("systemChrome"); - } - } - - /// - public string transparent { - get { - return this.transparentField; - } - set { - this.transparentField = value; - this.RaisePropertyChanged("transparent"); - } - } - - public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged; - - protected void RaisePropertyChanged(string propertyName) { - System.ComponentModel.PropertyChangedEventHandler propertyChanged = this.PropertyChanged; - if ((propertyChanged != null)) { - propertyChanged(this, new System.ComponentModel.PropertyChangedEventArgs(propertyName)); - } - } - } - - /// - [System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.0.30319.1")] - [System.SerializableAttribute()] - [System.Diagnostics.DebuggerStepThroughAttribute()] - [System.ComponentModel.DesignerCategoryAttribute("code")] - [System.Xml.Serialization.XmlTypeAttribute(AnonymousType=true, Namespace="http://www.qnx.com/schemas/application/1.0")] - public partial class qnxConfiguration : object, System.ComponentModel.INotifyPropertyChanged { - - private string platformArchitectureField; - - private asset[] assetField; - - private string idField; - - private string nameField; - - /// - public string platformArchitecture { - get { - return this.platformArchitectureField; - } - set { - this.platformArchitectureField = value; - this.RaisePropertyChanged("platformArchitecture"); - } - } - - /// - [System.Xml.Serialization.XmlElementAttribute("asset", IsNullable=true)] - public asset[] asset { - get { - return this.assetField; - } - set { - this.assetField = value; - this.RaisePropertyChanged("asset"); - } - } - - /// - [System.Xml.Serialization.XmlAttributeAttribute()] - public string id { - get { - return this.idField; - } - set { - this.idField = value; - this.RaisePropertyChanged("id"); - } - } - - /// - [System.Xml.Serialization.XmlAttributeAttribute()] - public string name { - get { - return this.nameField; - } - set { - this.nameField = value; - this.RaisePropertyChanged("name"); - } - } - - public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged; - - protected void RaisePropertyChanged(string propertyName) { - System.ComponentModel.PropertyChangedEventHandler propertyChanged = this.PropertyChanged; - if ((propertyChanged != null)) { - propertyChanged(this, new System.ComponentModel.PropertyChangedEventArgs(propertyName)); - } - } - - public void AddAsset(asset newAsset) - { - if (asset == null) - { - asset = new asset[0]; - } - - var local_asset = asset; - Array.Resize(ref local_asset, local_asset.Length + 1); - local_asset[local_asset.Length - 1] = newAsset; - asset = local_asset; - } - - public void DeleteAsset(asset removeAsset) - { - List assetList = new List(asset); - assetList.Remove(removeAsset); - asset = assetList.ToArray(); - } - } - - /// - [System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.0.30319.1")] - [System.SerializableAttribute()] - [System.Diagnostics.DebuggerStepThroughAttribute()] - [System.ComponentModel.DesignerCategoryAttribute("code")] - [System.Xml.Serialization.XmlTypeAttribute(AnonymousType = true, Namespace = "http://www.qnx.com/schemas/application/1.0")] - public partial class qnxPermission : object, System.ComponentModel.INotifyPropertyChanged - { - - private string systemField; - - private string valueField; - - /// - [System.Xml.Serialization.XmlAttributeAttribute()] - public string system - { - get - { - return this.systemField; - } - set - { - this.systemField = value; - this.RaisePropertyChanged("system"); - } - } - - /// - [System.Xml.Serialization.XmlTextAttribute()] - public string Value - { - get - { - return this.valueField; - } - set - { - this.valueField = value; - this.RaisePropertyChanged("Value"); - } - } - - public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged; - - protected void RaisePropertyChanged(string propertyName) - { - System.ComponentModel.PropertyChangedEventHandler propertyChanged = this.PropertyChanged; - if ((propertyChanged != null)) - { - propertyChanged(this, new System.ComponentModel.PropertyChangedEventArgs(propertyName)); - } - } - } - - /// - [System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.0.30319.1")] - [System.SerializableAttribute()] - [System.Diagnostics.DebuggerStepThroughAttribute()] - [System.ComponentModel.DesignerCategoryAttribute("code")] - [System.Xml.Serialization.XmlTypeAttribute(AnonymousType=true, Namespace="http://www.qnx.com/schemas/application/1.0")] - public partial class qnxIcon : object, System.ComponentModel.INotifyPropertyChanged { - - private string[] imageField; - - /// - [System.Xml.Serialization.XmlElementAttribute("image", IsNullable = true)] - public string[] image { - get { - return this.imageField; - } - set { - this.imageField = value; - this.RaisePropertyChanged("image"); - } - } - - public void AddIconImage(string iconImage) - { - if (image == null) - { - image = new string[0]; - } - - var iconImages = image; - Array.Resize(ref iconImages, iconImages.Length + 1); - iconImages[iconImages.Length - 1] = iconImage; - image = iconImages; - } - - public void DeleteIconImage(string iconImage) - { - List iconList = new List(image); - iconList.Remove(iconImage); - image = iconList.ToArray(); - } - - public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged; - - protected void RaisePropertyChanged(string propertyName) { - System.ComponentModel.PropertyChangedEventHandler propertyChanged = this.PropertyChanged; - if ((propertyChanged != null)) { - propertyChanged(this, new System.ComponentModel.PropertyChangedEventArgs(propertyName)); - } - } - } - - /// - [System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.0.30319.1")] - [System.SerializableAttribute()] - [System.Diagnostics.DebuggerStepThroughAttribute()] - [System.ComponentModel.DesignerCategoryAttribute("code")] - [System.Xml.Serialization.XmlTypeAttribute(AnonymousType = true, Namespace = "http://www.qnx.com/schemas/application/1.0")] - public partial class qnxSplashScreens : object, System.ComponentModel.INotifyPropertyChanged - { - - private string[] imageField; - - [System.Xml.Serialization.XmlElementAttribute("image", IsNullable = true)] - public string[] image - { - get - { - return this.imageField; - } - set - { - this.imageField = value; - this.RaisePropertyChanged("image"); - } - } - - public void AddSplashScreenImage(string iconImage) - { - if (image == null) - { - image = new string[0]; - } - - var iconImages = image; - Array.Resize(ref iconImages, iconImages.Length + 1); - iconImages[iconImages.Length - 1] = iconImage; - image = iconImages; - } - - public void DeleteSplashScreenImage(string iconImage) - { - List iconList = new List(image); - iconList.Remove(iconImage); - image = iconList.ToArray(); - } - - public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged; - - protected void RaisePropertyChanged(string propertyName) - { - System.ComponentModel.PropertyChangedEventHandler propertyChanged = this.PropertyChanged; - if ((propertyChanged != null)) - { - propertyChanged(this, new System.ComponentModel.PropertyChangedEventArgs(propertyName)); - } - } - } - - - /// - [System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.0.30319.1")] - [System.SerializableAttribute()] - [System.Diagnostics.DebuggerStepThroughAttribute()] - [System.ComponentModel.DesignerCategoryAttribute("code")] - [System.Xml.Serialization.XmlTypeAttribute(AnonymousType=true, Namespace="http://www.qnx.com/schemas/application/1.0")] - public partial class qnxAction : object, System.ComponentModel.INotifyPropertyChanged { - - private string systemField; - - private string valueField; - - /// - [System.Xml.Serialization.XmlAttributeAttribute()] - public string system { - get { - return this.systemField; - } - set { - this.systemField = value; - this.RaisePropertyChanged("system"); - } - } - - /// - [System.Xml.Serialization.XmlTextAttribute()] - public string Value { - get { - return this.valueField; - } - set { - this.valueField = value; - this.RaisePropertyChanged("Value"); - } - } - - public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged; - - protected void RaisePropertyChanged(string propertyName) { - System.ComponentModel.PropertyChangedEventHandler propertyChanged = this.PropertyChanged; - if ((propertyChanged != null)) { - propertyChanged(this, new System.ComponentModel.PropertyChangedEventArgs(propertyName)); - } - } - } - - /// - [System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.0.30319.1")] - [System.SerializableAttribute()] - [System.Diagnostics.DebuggerStepThroughAttribute()] - [System.ComponentModel.DesignerCategoryAttribute("code")] - [System.Xml.Serialization.XmlTypeAttribute(AnonymousType=true, Namespace="http://www.qnx.com/schemas/application/1.0")] - public partial class qnxEnv : object, System.ComponentModel.INotifyPropertyChanged { - - private string varField; - - private string valueField; - - /// - [System.Xml.Serialization.XmlAttributeAttribute()] - public string var { - get { - return this.varField; - } - set { - this.varField = value; - this.RaisePropertyChanged("var"); - } - } - - /// - [System.Xml.Serialization.XmlAttributeAttribute()] - public string value { - get { - return this.valueField; - } - set { - this.valueField = value; - this.RaisePropertyChanged("value"); - } - } - - public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged; - - protected void RaisePropertyChanged(string propertyName) { - System.ComponentModel.PropertyChangedEventHandler propertyChanged = this.PropertyChanged; - if ((propertyChanged != null)) { - propertyChanged(this, new System.ComponentModel.PropertyChangedEventArgs(propertyName)); - } - } - } - - /// - [System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.0.30319.1")] - [System.SerializableAttribute()] - [System.Diagnostics.DebuggerStepThroughAttribute()] - [System.ComponentModel.DesignerCategoryAttribute("code")] - [System.Xml.Serialization.XmlTypeAttribute(AnonymousType=true, Namespace="http://www.qnx.com/schemas/application/1.0")] - [System.Xml.Serialization.XmlRootAttribute(Namespace="http://www.qnx.com/schemas/application/1.0", IsNullable=false)] - public partial class NewDataSet : object, System.ComponentModel.INotifyPropertyChanged { - - private object[] itemsField; - - /// - [System.Xml.Serialization.XmlElementAttribute("asset", typeof(asset), IsNullable=true)] - [System.Xml.Serialization.XmlElementAttribute("qnx", typeof(qnx))] - public object[] Items { - get { - return this.itemsField; - } - set { - this.itemsField = value; - this.RaisePropertyChanged("Items"); - } - } - - public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged; - - protected void RaisePropertyChanged(string propertyName) { - System.ComponentModel.PropertyChangedEventHandler propertyChanged = this.PropertyChanged; - if ((propertyChanged != null)) { - propertyChanged(this, new System.ComponentModel.PropertyChangedEventArgs(propertyName)); - } - } - } -} From bd5e1cd7142d21dee8d2b7bdf9b1eacb5125a169 Mon Sep 17 00:00:00 2001 From: Pawel Hofman Date: Thu, 8 May 2014 13:07:42 +0200 Subject: [PATCH 022/851] Fixed 99.99% warnings and reduced GDBParser build time --- .gitignore | 1 + src/GDBParser/ComponentException.h | 7 +- src/GDBParser/GDBParser.vcxproj | 1 - src/GDBParser/GDBParser.vcxproj.filters | 3 - src/GDBParser/GDBParserAPI.cpp | 149 ++++++------ src/GDBParser/GDBParserAPI.h | 2 + src/GDBParser/ProjInclude.h | 33 --- src/GDBParser/WorkerUtil.h | 77 +++--- src/GDBParser/gdb-connect.cpp | 230 ++++++++++-------- src/GDBParser/gdb-connect.h | 10 +- src/GDBParser/stdafx.h | 3 +- src/GDBWrapper/GDBWrapper.cpp | 49 ++-- src/VSNDK.AddIn/VSNDKAddIn.cs | 68 ++---- src/VSNDK.DebugEngine/AD7.Impl/AD7Engine.cs | 191 +++++++-------- src/VSNDK.DebugEngine/AD7.Impl/AD7Events.cs | 4 +- src/VSNDK.DebugEngine/AD7.Impl/AD7Process.cs | 35 +-- src/VSNDK.DebugEngine/AD7.Impl/AD7Property.cs | 47 ++-- .../AD7.Impl/AD7StackFrame.cs | 56 ++--- src/VSNDK.DebugEngine/AD7.Impl/AD7Thread.cs | 20 +- .../Engine.Impl/EngineCallback.cs | 2 +- .../Engine.Impl/EventDispatcher.cs | 46 ++-- src/VSNDK.Package.Test/SettingsDataTests.cs | 22 +- .../VSNDK.Package.Test.csproj | 2 + src/VSNDK.Package/Import/Model/ImportModel.cs | 9 +- .../Settings/Model/SettingsData.cs | 74 +++--- .../Settings/SettingsDialog.xaml.cs | 12 +- .../Signing/Models/SigningData.cs | 48 ++-- .../UpdateManager/Model/UpdateManagerData.cs | 53 ++-- .../UpdateManager/SimulatorManager.xaml | 2 +- .../UpdateManager/SimulatorManager.xaml.cs | 1 - .../UpdateManager/UpdateManager.xaml | 2 +- .../UpdateManager/UpdateManager.xaml.cs | 46 ++-- src/VSNDK.Package/VSNDK.PackagePackage.cs | 188 +++++++------- src/VSNDK.Package/VsDesignerControl.xaml.cs | 29 +-- src/VSNDK.Tasks/AsyncExec.cs | 5 +- src/VSNDK.Tasks/CheckIfInstalled.cs | 6 +- .../MakeAllAndFormatOutputMessages.cs | 58 ++--- src_vs2012/GDBParser/GDBParser.vcxproj | 1 - .../GDBParser/GDBParser.vcxproj.filters | 3 - src_vs2013/GDBParser/GDBParser.vcxproj | 1 - .../GDBParser/GDBParser.vcxproj.filters | 3 - 41 files changed, 722 insertions(+), 877 deletions(-) delete mode 100644 src/GDBParser/ProjInclude.h diff --git a/.gitignore b/.gitignore index 4f3bec2c..498777f1 100644 --- a/.gitignore +++ b/.gitignore @@ -52,6 +52,7 @@ src/GDBParser.UnitTests/bin/ src/GDBParser.UnitTests/obj/ src/GDBParser/Debug/ src/GDBWrapper/Debug/ +src/ipch/ src/VSNDK.AddIn/bin/ src/VSNDK.AddIn/obj/ src/VSNDK.DebugEngine/bin/ diff --git a/src/GDBParser/ComponentException.h b/src/GDBParser/ComponentException.h index 613d2125..1b63bff2 100644 --- a/src/GDBParser/ComponentException.h +++ b/src/GDBParser/ComponentException.h @@ -14,9 +14,14 @@ #pragma once +#include + +#pragma managed(on) + + BEGIN_NAMESPACE -public ref class ComponentException : public Exception +public ref class ComponentException : public System::Exception { public: ComponentException(HRESULT hr) diff --git a/src/GDBParser/GDBParser.vcxproj b/src/GDBParser/GDBParser.vcxproj index 7fda1742..87884437 100644 --- a/src/GDBParser/GDBParser.vcxproj +++ b/src/GDBParser/GDBParser.vcxproj @@ -149,7 +149,6 @@ - diff --git a/src/GDBParser/GDBParser.vcxproj.filters b/src/GDBParser/GDBParser.vcxproj.filters index 5c165339..cbd8d9e8 100644 --- a/src/GDBParser/GDBParser.vcxproj.filters +++ b/src/GDBParser/GDBParser.vcxproj.filters @@ -47,9 +47,6 @@ Internal Header files - - Internal Header files - Internal Header files diff --git a/src/GDBParser/GDBParserAPI.cpp b/src/GDBParser/GDBParserAPI.cpp index a12853d9..67a4df03 100644 --- a/src/GDBParser/GDBParserAPI.cpp +++ b/src/GDBParser/GDBParserAPI.cpp @@ -14,25 +14,38 @@ #include "stdafx.h" -#pragma managed(on) - #include -#include < stdio.h > -#include < stdlib.h > -#include < vcclr.h > -using namespace System; -using namespace System::Text::RegularExpressions; -using namespace Microsoft::Win32; - -#include "ProjInclude.h" +#include +#include +#include -// GDBParser API header files (in alphabetical order) +#include "ComponentException.h" +#include "WorkerUtil.h" #include "GDBParserAPI.h" - #include "gdb-connect.h" +#pragma warning(push) +#pragma warning(disable:4091) +#include +#pragma warning(pop) + + using namespace std; +using namespace System; +using namespace System::Diagnostics; +using namespace System::Text::RegularExpressions; +using namespace Microsoft::Win32; + +#define ASSERT(cond) _ASSERT(cond) +#ifdef DEBUG +# define VERIFY(statement) Debug::Assert((statement) != 0, #statement) +#else +# define VERIFY(statement) statement +#endif + +#pragma managed(on) + /// /// Set an auto pointer given a String^. @@ -63,7 +76,7 @@ CAutoPtr convertToAutoPtrFromString(String^ str) { String^ GDBParser::removeGDBResponse() { char output[ParsedMessageSize] = ""; - removeFromOutputBuffer(output); + removeFromOutputBuffer(output, _countof(output)); String ^systemstring = gcnew String(output); return systemstring; } @@ -129,9 +142,9 @@ String^ GDBParser::parseCommand(String^ GDBCommand, int ID) Sleep(0); // keep trying to add into buffer while (strcmp(output,"") == 0 && s_running) - removeSyncFromOutputBuffer(output, ID); + removeSyncFromOutputBuffer(output, _countof(output), ID); if (strcmp(output,"$#@EMPTY@#$") == 0) // This string means that both GDB and the parser worked well and returned an empty string. - strcpy(output,""); + output[0] = '\0'; String ^systemstring = gcnew String(output); return systemstring; @@ -207,9 +220,9 @@ void GDBParser::BlackBerryConnect(String^ IPAddrStr, String^ toolsPath, String^ char args[256]; if (!String::IsNullOrEmpty(password)) - sprintf(args, "java.exe -Xmx512M -jar \"%s\\..\\lib\\Connect.jar\" %s -password %s -sshPublicKey \"%s\"", apTools, apDevice, apPass, apKey); + sprintf_s(args, _countof(args), "java.exe -Xmx512M -jar \"%s\\..\\lib\\Connect.jar\" %s -password %s -sshPublicKey \"%s\"", apTools, apDevice, apPass, apKey); else - sprintf(args, "java.exe -Xmx512M -jar \"%s\\..\\lib\\Connect.jar\" %s -sshPublicKey \"%s\"", apTools, apDevice, apKey); + sprintf_s(args, _countof(args), "java.exe -Xmx512M -jar \"%s\\..\\lib\\Connect.jar\" %s -sshPublicKey \"%s\"", apTools, apDevice, apKey); // Launch the process if (!CreateProcessA(NULL, args, NULL, NULL, TRUE, @@ -278,7 +291,7 @@ String^ GDBParser::GetPIDsThroughGDB(String^ IP, String^ password, bool isSimula // console->sendCommand(pcCmd); // response = console->waitForPrompt(true); - sprintf(pcCmd, "1-target-select qnx %s:8000\r\n", ip); + sprintf_s(pcCmd, _countof(pcCmd), "1-target-select qnx %s:8000\r\n", ip); console->sendCommand(pcCmd); response = console->waitForPromptWithTimeout(timeout); if ((response == "") || (response[0] == '!')) //found an error @@ -289,7 +302,7 @@ String^ GDBParser::GetPIDsThroughGDB(String^ IP, String^ password, bool isSimula if ((response != "") && (response != "TIMEOUT!") && (response.find("1^error,msg=",0) == -1)) //there is no error from previous response { - sprintf(pcCmd, "info pidlist\r\n"); + sprintf_s(pcCmd, _countof(pcCmd), "info pidlist\r\n"); console->sendCommand(pcCmd); response = console->waitForPrompt(true); if ((response == "") || (response[0] == '!')) //found an error @@ -392,7 +405,7 @@ bool GDBParser::LaunchProcess(String^ pidStr, String^ exeStr, String^ IPAddrStr, // console->sendCommand(pcCmd); // response = console->waitForPrompt(true); - sprintf(pcCmd, "1-gdb-set breakpoint pending on\r\n"); + sprintf_s(pcCmd, _countof(pcCmd), "1-gdb-set breakpoint pending on\r\n"); console->sendCommand(pcCmd); response = console->waitForPrompt(true); parsed = parseGDB(response, parsingInstructions[8]); @@ -402,7 +415,7 @@ bool GDBParser::LaunchProcess(String^ pidStr, String^ exeStr, String^ IPAddrStr, return false; } - sprintf(pcCmd, "4-target-select qnx %s:8000\r\n", apDevice); + sprintf_s(pcCmd, _countof(pcCmd), "4-target-select qnx %s:8000\r\n", apDevice); console->sendCommand(pcCmd); response = console->waitForPrompt(true); parsed = parseGDB(response, parsingInstructions[3]); @@ -412,7 +425,7 @@ bool GDBParser::LaunchProcess(String^ pidStr, String^ exeStr, String^ IPAddrStr, return false; } - sprintf(pcCmd, "5-file-exec-and-symbols %s\r\n", apBinaryFile); + sprintf_s(pcCmd, _countof(pcCmd), "5-file-exec-and-symbols %s\r\n", apBinaryFile); console->sendCommand(pcCmd); response = console->waitForPrompt(true); parsed = parseGDB(response, parsingInstructions[7]); @@ -426,7 +439,7 @@ bool GDBParser::LaunchProcess(String^ pidStr, String^ exeStr, String^ IPAddrStr, { m_remotePath = m_remotePath + "\\lib;" + m_remotePath + "\\usr\\lib;" + m_remotePath + "\\usr\\lib\\qt4"; CAutoPtr apPath = convertToAutoPtrFromString(m_remotePath); - sprintf(pcCmd, "6set solib-search-path %s\r\n", apPath); + sprintf_s(pcCmd, _countof(pcCmd), "6set solib-search-path %s\r\n", apPath); console->sendCommand(pcCmd); response = console->waitForPrompt(true); parsed = parseGDB(response, parsingInstructions[8]); @@ -437,7 +450,7 @@ bool GDBParser::LaunchProcess(String^ pidStr, String^ exeStr, String^ IPAddrStr, } } - sprintf(pcCmd, "7-target-attach %d\r\n", pid); + sprintf_s(pcCmd, _countof(pcCmd), "7-target-attach %d\r\n", pid); console->sendCommand(pcCmd); response = console->waitForPrompt(true); parsed = parseGDB(response, parsingInstructions[6]); @@ -624,7 +637,7 @@ String^ GDBParserUnitTests::parse_GDB(String^ response, String^ parsingInstructi if (aux.length() > 128) aux[127] = '\0'; - strcpy(v[i], aux.c_str()); + strcpy_s(v[i], _countof(v[0]), aux.c_str()); } string output = parseGDB(&r, p, respBegin, repeat, v, s); @@ -699,21 +712,21 @@ int GDBParserUnitTests::search_Response(String^ response, String^ txt, int begin /// Returns the new modified string. String^ GDBParserUnitTests::substitute_Variables(String^ txt, array^ variables) { - CAutoPtr apTxt = convertToAutoPtrFromString(txt); - string t = apTxt; - char v[10][128]; - for (int i = 0; i< 10; i++) - { - CAutoPtr apAux = convertToAutoPtrFromString(variables[i]); - string aux = apAux; - - if (aux.length() > 128) - aux[127] = '\0'; - strcpy(v[i], aux.c_str()); - } - string output = substituteVariables(t, v); - String ^systemstring = gcnew String(output.c_str()); - return systemstring; + CAutoPtr apTxt = convertToAutoPtrFromString(txt); + string t = apTxt; + char v[10][128]; + for (int i = 0; i< 10; i++) + { + CAutoPtr apAux = convertToAutoPtrFromString(variables[i]); + string aux = apAux; + + if (aux.length() > 128) + aux[127] = '\0'; + strcpy_s(v[i], _countof(v[0]), aux.c_str()); + } + string output = substituteVariables(t, v); + String ^systemstring = gcnew String(output.c_str()); + return systemstring; } @@ -724,10 +737,10 @@ String^ GDBParserUnitTests::substitute_Variables(String^ txt, array^ va /// Returns TRUE - successfully added; or FALSE - failed to add. bool GDBParserUnitTests::add_Into_Input_Buffer(String^ command) { - CAutoPtr apCmd = convertToAutoPtrFromString(command); - char GDBCommand[GDBCommandSize]; - strcpy(GDBCommand, apCmd); - return addIntoInputBuffer(GDBCommand); + CAutoPtr apCmd = convertToAutoPtrFromString(command); + char GDBCommand[GDBCommandSize]; + strcpy_s(GDBCommand, _countof(GDBCommand), apCmd); + return addIntoInputBuffer(GDBCommand); } @@ -737,10 +750,10 @@ bool GDBParserUnitTests::add_Into_Input_Buffer(String^ command) /// Returns the next command that would be sent to GDB. String^ GDBParserUnitTests::remove_From_Input_Buffer() { - char command[GDBCommandSize] = ""; - removeFromInputBuffer(command); - string basicstring(command); - return(gcnew String(basicstring.c_str())); + char command[GDBCommandSize] = ""; + removeFromInputBuffer(command, _countof(command)); + string basicstring(command); + return gcnew String(basicstring.c_str()); } @@ -770,9 +783,9 @@ String^ GDBParserUnitTests::remove_From_Input_Buffer() /// Returns TRUE - successfully added; or FALSE - failed to add. bool GDBParserUnitTests::add_Into_GDB_Buffer(int seq_id, int instructionCode, String^ param) { - CAutoPtr apParam = convertToAutoPtrFromString(param); - string p = apParam; - return addIntoGDBBuffer(seq_id, instructionCode, p); + CAutoPtr apParam = convertToAutoPtrFromString(param); + string p = apParam; + return addIntoGDBBuffer(seq_id, instructionCode, p); } @@ -784,10 +797,10 @@ bool GDBParserUnitTests::add_Into_GDB_Buffer(int seq_id, int instructionCode, St /// Returns the instruction code associated to the sequential id (seq). int GDBParserUnitTests::remove_From_GDB_Buffer(int seq, [Runtime::InteropServices::Out] String^ %param) { - string p = ""; - int code = removeFromGDBBuffer(seq, &p); - param = gcnew String(p.c_str()); - return code; + string p = ""; + int code = removeFromGDBBuffer(seq, &p); + param = gcnew String(p.c_str()); + return code; } @@ -797,7 +810,7 @@ int GDBParserUnitTests::remove_From_GDB_Buffer(int seq, [Runtime::InteropService /// Returns TRUE if empty; FALSE if not. bool GDBParserUnitTests::is_GDB_Buffer_Empty() { - return isGDBBufferEmpty(); + return isGDBBufferEmpty(); } @@ -809,10 +822,10 @@ bool GDBParserUnitTests::is_GDB_Buffer_Empty() /// Returns TRUE - successfully added; or FALSE - failed to add. bool GDBParserUnitTests::add_Into_Output_Buffer(int seq_stamp, String^ message) { - CAutoPtr apResp = convertToAutoPtrFromString(message); - char parsedMessage[GDBCommandSize]; - strcpy(parsedMessage, apResp); - return addIntoOutputBuffer(seq_stamp, parsedMessage); + CAutoPtr apResp = convertToAutoPtrFromString(message); + char parsedMessage[GDBCommandSize]; + strcpy_s(parsedMessage, _countof(parsedMessage), apResp); + return addIntoOutputBuffer(seq_stamp, parsedMessage); } @@ -823,10 +836,10 @@ bool GDBParserUnitTests::add_Into_Output_Buffer(int seq_stamp, String^ message) /// Returns the supposed parsed GDB response. String^ GDBParserUnitTests::remove_From_Output_Buffer() { - char response[GDBCommandSize] = ""; - removeFromOutputBuffer(response); - string basicstring(response); - return(gcnew String(basicstring.c_str())); + char response[GDBCommandSize] = ""; + removeFromOutputBuffer(response, _countof(response)); + string basicstring(response); + return gcnew String(basicstring.c_str()); } @@ -838,10 +851,10 @@ String^ GDBParserUnitTests::remove_From_Output_Buffer() /// ID of the supposed GDB command. String^ GDBParserUnitTests::remove_Sync_From_Output_Buffer(int ID) { - char response[GDBCommandSize] = ""; - removeSyncFromOutputBuffer(response, ID); - string basicstring(response); - return(gcnew String(basicstring.c_str())); + char response[GDBCommandSize] = ""; + removeSyncFromOutputBuffer(response, _countof(response), ID); + string basicstring(response); + return gcnew String(basicstring.c_str()); } diff --git a/src/GDBParser/GDBParserAPI.h b/src/GDBParser/GDBParserAPI.h index 1dfcfc97..9297aad6 100644 --- a/src/GDBParser/GDBParserAPI.h +++ b/src/GDBParser/GDBParserAPI.h @@ -15,11 +15,13 @@ #pragma once #include +#include #define NumberOfInstructions 48 #define GDBCommandSize 256 using namespace std; +using namespace System; BEGIN_NAMESPACE diff --git a/src/GDBParser/ProjInclude.h b/src/GDBParser/ProjInclude.h deleted file mode 100644 index 047d620a..00000000 --- a/src/GDBParser/ProjInclude.h +++ /dev/null @@ -1,33 +0,0 @@ -//* Copyright 2010-2011 Research In Motion Limited. -//* -//* Licensed under the Apache License, Version 2.0 (the "License"); -//* you may not use this file except in compliance with the License. -//* You may obtain a copy of the License at -//* -//* http://www.apache.org/licenses/LICENSE-2.0 -//* -//* Unless required by applicable law or agreed to in writing, software -//* distributed under the License is distributed on an "AS IS" BASIS, -//* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//* See the License for the specific language governing permissions and -//* limitations under the License. - -#pragma once - -using namespace System; -using namespace System::Diagnostics; -#include -#pragma warning(push) -#pragma warning(disable:4091) -#include -#pragma warning(pop) - -#define ASSERT(cond) _ASSERT(cond) -#ifdef DEBUG - #define VERIFY(statement) Debug::Assert((statement) != 0, #statement) -#else - #define VERIFY(statement) statement -#endif - -#include "ComponentException.h" -#include "WorkerUtil.h" diff --git a/src/GDBParser/WorkerUtil.h b/src/GDBParser/WorkerUtil.h index c070eed0..52dee0cf 100644 --- a/src/GDBParser/WorkerUtil.h +++ b/src/GDBParser/WorkerUtil.h @@ -14,9 +14,11 @@ #pragma once -BEGIN_NAMESPACE - #include +#include + + +BEGIN_NAMESPACE inline HRESULT HRFromWin32Error(LONG lError) { @@ -47,68 +49,63 @@ inline HRESULT HRWin32ErrorCall(LONG lError) inline void __declspec(noreturn) ThrowHR(HRESULT hr) { - throw gcnew ComponentException(hr); + throw gcnew ComponentException(hr); } inline void __declspec(noreturn) ThrowLastError() { - HRESULT hr = HRLastError(); + HRESULT hr = HRLastError(); - ThrowHR(hr); + ThrowHR(hr); } inline void Win32BoolCall(BOOL fCondition) { - if (!fCondition) - { - ThrowLastError(); - } + if (!fCondition) + { + ThrowLastError(); + } } inline void Win32ErrorCall(DWORD err) { - if (err != 0) - { - ThrowHR(HRESULT_FROM_WIN32(err)); - } + if (err != 0) + { + ThrowHR(HRESULT_FROM_WIN32(err)); + } } inline HANDLE Win32HandleCall(HANDLE h) { - if (h == NULL || h == INVALID_HANDLE_VALUE) - { - ThrowLastError(); - } + if (h == NULL || h == INVALID_HANDLE_VALUE) + { + ThrowLastError(); + } - return h; + return h; } -inline int StringLength(String^ s) +inline int StringLength(System::String^ s) { - if (s == nullptr) - { - return 0; - } + if (s == nullptr) + { + return 0; + } - return s->Length; + return s->Length; } -inline String^ GetProcessName(HANDLE hProcess) +inline System::String^ GetProcessName(HANDLE hProcess) { - WCHAR szProcessNameBuff[MAX_PATH+1]; - DWORD nChars = GetModuleFileNameEx( - hProcess, // process - NULL, // Module handle - szProcessNameBuff, - _countof(szProcessNameBuff) - ); + WCHAR szProcessNameBuff[MAX_PATH+1]; + DWORD nChars = GetModuleFileNameEx(hProcess, NULL, szProcessNameBuff, _countof(szProcessNameBuff)); - Win32BoolCall(nChars > 0 && nChars <= _countof(szProcessNameBuff)); + Win32BoolCall(nChars > 0 && nChars <= _countof(szProcessNameBuff)); - return gcnew String(szProcessNameBuff); + return gcnew System::String(szProcessNameBuff); } -inline LPWSTR wcsdup(String^ source) +inline LPWSTR wcsdup(System::String^ source) { pin_ptr pSource = PtrToStringChars( source ); int cch = (( source->Length+1) * 2); @@ -118,10 +115,10 @@ inline LPWSTR wcsdup(String^ source) return pDest; } -inline String^ StringPrefixReplace(int oldPrefixLen, String^ newPrefix, String^ s) +inline System::String^ StringPrefixReplace(int oldPrefixLen, System::String^ newPrefix, System::String^ s) { int lengthNeeded = s->Length + newPrefix->Length - oldPrefixLen; - Text::StringBuilder^ sb = gcnew Text::StringBuilder(lengthNeeded, lengthNeeded); + System::Text::StringBuilder^ sb = gcnew System::Text::StringBuilder(lengthNeeded, lengthNeeded); sb->Append(newPrefix); sb->Append(s, oldPrefixLen, s->Length-oldPrefixLen); @@ -129,13 +126,13 @@ inline String^ StringPrefixReplace(int oldPrefixLen, String^ newPrefix, String^ return sb->ToString(); } -inline String^ StringPrefixReplace(String^ oldPrefix, String^ newPrefix, String^ s) +inline System::String^ StringPrefixReplace(System::String^ oldPrefix, System::String^ newPrefix, System::String^ s) { return StringPrefixReplace(oldPrefix->Length, newPrefix, s); } // Note: return value does not include a trailing slash -inline int FindCommonPathSuffixLength(String^ path1, String^ path2) +inline int FindCommonPathSuffixLength(System::String^ path1, System::String^ path2) { const int len1 = path1->Length; const int len2 = path2->Length; @@ -183,4 +180,4 @@ inline int FindCommonPathSuffixLength(String^ path1, String^ path2) return commonSuffixLength; } -END_NAMESPACE \ No newline at end of file +END_NAMESPACE diff --git a/src/GDBParser/gdb-connect.cpp b/src/GDBParser/gdb-connect.cpp index a3f24d7f..f0b9d6c9 100644 --- a/src/GDBParser/gdb-connect.cpp +++ b/src/GDBParser/gdb-connect.cpp @@ -19,9 +19,8 @@ #include "stdafx.h" #include "gdb-connect.h" -#include -#include +#include #include #include #include @@ -29,7 +28,7 @@ #include #include -#include < vcclr.h > +#include using namespace std; using namespace System; @@ -135,20 +134,26 @@ char parse_log[_MAX_PATH]; /// /// Generic function to print to a log file. /// /// Message to be printed to a log file. -void GDBConsole::logPrint(char* buffer) { - if (LOG_GDB_RAW_IO) { - time_t tt = time(NULL); - struct tm tm; - char buf[32]; +void GDBConsole::logPrint(char* buffer) +{ +#if LOG_GDB_RAW_IO + time_t tt = time(NULL); + struct tm tm; + char buf[32]; - tm = *localtime(&tt); + localtime_s(&tm, &tt); + strftime(buf, 31, "%H:%M:%S", &tm); - strftime(buf, 31, "%H:%M:%S", &tm); + FILE* file = NULL; + errno_t retCode; - FILE* file = fopen((char *)path_log, "a"); - fprintf(file, "%s - %s", buf, buffer); - fclose(file); - } + retCode = fopen_s(&file, path_log, "a"); + if (file != NULL && retCode == 0) + { + fprintf(file, "%s - %s", buf, buffer); + fclose(file); + } +#endif } @@ -161,14 +166,14 @@ GDBConsole::GDBConsole() : m_hCleanupMutex(NULL) { HANDLE hOutputReadTmp = NULL; - HANDLE hInputWriteTmp = NULL; + HANDLE hInputWriteTmp = NULL; SECURITY_ATTRIBUTES sa; out_OutputBuffer = SyncInstructionsSize; in_InputBuffer = 0; - out_InputBuffer = 0; + out_InputBuffer = 0; - m_hCleanupMutex = CreateMutex(NULL, FALSE, NULL); + m_hCleanupMutex = CreateMutex(NULL, FALSE, NULL); // Set up the security attributes struct used when creating the pipes. sa.nLength = sizeof(SECURITY_ATTRIBUTES); @@ -222,14 +227,17 @@ GDBConsole::GDBConsole() : if (!CloseHandle(m_hInputRead )) DisplayError(_T("CloseHandle")); if (!CloseHandle(m_hErrorWrite)) DisplayError(_T("CloseHandle")); - String^ tempPath = Environment::GetEnvironmentVariable("APPDATA"); - tempPath += "\\BlackBerry\\gdb-output.log"; - pin_ptr path_buffer = PtrToStringChars(tempPath); + GetEnvironmentVariableA("AppData", path_log, _countof(path_log)); + strcat_s(path_log, _countof(path_log), "\\BlackBerry\\gdb-output.log"); - int ret = wcstombs ( path_log, path_buffer, _MAX_PATH ); - - FILE* file = fopen(path_log, "w"); // Delete a possible existing file. - fclose(file); + FILE* file = NULL; + errno_t retCode; + + retCode = fopen_s(&file, path_log, "w"); // Delete a possible existing file. + if (file != NULL && retCode == 0) + { + fclose(file); + } } @@ -331,7 +339,6 @@ GDBConsole::~GDBConsole() { /// void GDBConsole::prepAndLaunchRedirectedChild(void) { - HANDLE stdHandles[3]; LPCTSTR lpApplicationName = NULL; PROCESS_INFORMATION pi; STARTUPINFO si; @@ -340,8 +347,8 @@ void GDBConsole::prepAndLaunchRedirectedChild(void) TCHAR eventCtrlCName[MAX_EVENT_NAME_LENGTH]; TCHAR eventTerminateName[MAX_EVENT_NAME_LENGTH]; - _stprintf(eventCtrlCName, _T("Ctrl-C-%i"), pid); - _stprintf(eventTerminateName, _T("Terminate-%i"), pid); + _stprintf_s(eventCtrlCName, _countof(eventCtrlCName), _T("Ctrl-C-%i"), pid); + _stprintf_s(eventTerminateName, _countof(eventTerminateName), _T("Terminate-%i"), pid); // Create event for wrapper process to wait on for CTRL-C. m_eventCtrlC = CreateEventW(NULL, FALSE, FALSE, eventCtrlCName); @@ -379,7 +386,7 @@ void GDBConsole::prepAndLaunchRedirectedChild(void) DisplayError(_T("prepAndLaunchRedirectedChild: failed to allocate memory for pCmdLine")); } - _stprintf(pCmdLine, _T("\"%s\" \"%s\" \"%s\" \"%s\""), FilePath, m_pcGDBCmd, eventCtrlCName, eventTerminateName); + _stprintf_s(pCmdLine, numChars, _T("\"%s\" \"%s\" \"%s\" \"%s\""), FilePath, m_pcGDBCmd, eventCtrlCName, eventTerminateName); // Launch the process (create a new console). if (!CreateProcess(NULL, /* executable name */ @@ -415,7 +422,7 @@ void GDBConsole::prepAndLaunchRedirectedChild(void) /// One of these integer values: 0 - Error; 1 - Success; 2 - Read everything from buffer but the message was not written /// completed, maybe because the message is bigger than the buffer, maybe because GDB didn't finish writing the message. Call it /// again to keep reading. -int GDBConsole::readOutput(CHAR* lpBuffer, int bufSize, int* nCharsRead) +int GDBConsole::readOutput(CHAR* lpBuffer, int bufSize, size_t* nCharsRead) { DWORD nBytesRead; @@ -442,11 +449,14 @@ int GDBConsole::readOutput(CHAR* lpBuffer, int bufSize, int* nCharsRead) cleanup(); return 0; } else { - ErrorExit(_T("ReadFile")); + ErrorExit(_T("ReadFile")); } } - - *nCharsRead = nBytesRead / sizeof(CHAR); + + if (nCharsRead != NULL) + { + *nCharsRead = nBytesRead / sizeof(CHAR); + } const char* pLastChar = lpBuffer + nBytesRead; pLastChar -= 2; @@ -554,7 +564,7 @@ BOOL GDBConsole::isMoreOutputAvailable () { /// Returns output received from GDB or "" if there is no GDB output. string GDBConsole::waitForPromptWithTimeout(int seconds) { char lpBuffer [1024]; - int nCharsRead = 0; + size_t nCharsRead = 0; int rc = 0; BOOL isPromptReady = FALSE; const char* promptString = "(gdb) \r\n"; @@ -616,7 +626,7 @@ string GDBConsole::waitForPromptWithTimeout(int seconds) { /// Returns output received from GDB or "" if there is no GDB output. string GDBConsole::waitForPrompt(bool sync) { char lpBuffer [1024]; - int nCharsRead = 0; + size_t nCharsRead = 0; int rc = 0; BOOL isPromptReady = FALSE; const char* promptString = "(gdb) \r\n"; @@ -670,7 +680,6 @@ void DisplayError(LPCTSTR pszAPI) LPVOID lpvMessageBuffer; TCHAR szPrintBuffer[512]; DWORD bufSize = 512 * sizeof(TCHAR); - DWORD nCharsWritten; FormatMessage( FORMAT_MESSAGE_ALLOCATE_BUFFER|FORMAT_MESSAGE_FROM_SYSTEM, @@ -732,8 +741,9 @@ void cleanBuffers() { for (int i = 0; i < InputBufferSize; i++) { - strcpy(inputBuffer[i],""); + inputBuffer[i][0] = '\0'; } + in_InputBuffer = 0; out_InputBuffer = 0; for (int i = 0; i < GDBBufferSize; i++) @@ -744,7 +754,7 @@ void cleanBuffers() GDBBuffer.quantity = 0; for (int i = 0; i < OutputBufferSize; i++) { - strcpy(outputBuffer[i], ""); + outputBuffer[i][0] = '\0'; } out_OutputBuffer = SyncInstructionsSize; } @@ -849,7 +859,7 @@ bool addIntoOutputBuffer(int seq_stamp, char *parsedMessage) WaitForSingleObject( hOutputBufferMutex, INFINITE ); if (strcmp(outputBuffer[pos], "") == 0) // "" means that the [pos] entry is "empty" or "not used". { - strcpy(outputBuffer[pos], parsedMessage); + strcpy_s(outputBuffer[pos], _countof(outputBuffer[0]), parsedMessage); got = true; if (pos >= SyncInstructionsSize) SetEvent(asyncOutputEvent); // Wake up "removeFromOutputBuffer", if needed. @@ -864,13 +874,13 @@ bool addIntoOutputBuffer(int seq_stamp, char *parsedMessage) /// asynchronous GDB RESPONSE or a non synchronous GDB COMMAND. This managed part of Output buffer is circular. /// /// Returns the parsed GDB response. -void removeFromOutputBuffer(char * output) +void removeFromOutputBuffer(char * output, size_t size) { WaitForSingleObject( hOutputBufferMutex, INFINITE ); if (strcmp(outputBuffer[out_OutputBuffer], "") != 0) { - strcpy(output, outputBuffer[out_OutputBuffer]); - strcpy(outputBuffer[out_OutputBuffer], ""); + strcpy_s(output, size, outputBuffer[out_OutputBuffer]); + outputBuffer[out_OutputBuffer][0] = '\0'; out_OutputBuffer += 1; if (out_OutputBuffer == OutputBufferSize) out_OutputBuffer = SyncInstructionsSize; // Positions 0 to "SyncInstructionsSize - 1" are reserved for synchronous commands. @@ -890,17 +900,17 @@ void removeFromOutputBuffer(char * output) /// /// Returns the parsed GDB response. /// ID of the GDB command. -void removeSyncFromOutputBuffer(char * output, int ID) +void removeSyncFromOutputBuffer(char * output, size_t size, int ID) { if ((ID < 0) || (ID >= SyncInstructionsSize)) return; WaitForSingleObject( hOutputBufferMutex, INFINITE ); if (strcmp(outputBuffer[ID], "") != 0) { - strcpy(output, outputBuffer[ID]); - strcpy(outputBuffer[ID], ""); + strcpy_s(output, size, outputBuffer[ID]); + outputBuffer[ID][0] = '\0'; } - ReleaseMutex( hOutputBufferMutex); + ReleaseMutex(hOutputBufferMutex); } @@ -935,7 +945,7 @@ bool addIntoInputBuffer(char GDBCommand[GDBCommandSize]) { if (in_InputBuffer == out_InputBuffer) fireEvent = true; - strcpy(inputBuffer[in_InputBuffer], GDBCommand); + strcpy_s(inputBuffer[in_InputBuffer], _countof(inputBuffer[0]), GDBCommand); in_InputBuffer += 1; if (in_InputBuffer == InputBufferSize) in_InputBuffer = 0; @@ -952,13 +962,13 @@ bool addIntoInputBuffer(char GDBCommand[GDBCommandSize]) /// Used by sendingCommands2GDB thread to get the next command to be sent to GDB. Input buffer is a circular one. /// /// Returns the next command to be sent to GDB. -void removeFromInputBuffer(char * input) +void removeFromInputBuffer(char * input, size_t size) { WaitForSingleObject( hInputBufferMutex, INFINITE ); if (in_InputBuffer != out_InputBuffer) { - strcpy(input, inputBuffer[out_InputBuffer]); - strcpy(inputBuffer[out_InputBuffer],""); + strcpy_s(input, size, inputBuffer[out_InputBuffer]); + inputBuffer[out_InputBuffer][0] = '\0'; out_InputBuffer += 1; if (out_InputBuffer == InputBufferSize) out_InputBuffer = 0; @@ -1030,7 +1040,8 @@ int getSeqID(string response) begin--; begin++; } - response.copy(seqIDstr, end - begin, begin); + + response._Copy_s(seqIDstr, _countof(seqIDstr), end - begin, begin); seqID = atoi(seqIDstr); return(seqID); } @@ -1131,7 +1142,7 @@ string substituteVariables(string txt, char variables[10][128]) { do { - int aux = getNextChar('$', txt, 0); + size_t aux = getNextChar('$', txt, 0); if (aux < txt.length()) { aux++; @@ -1196,10 +1207,10 @@ int findClosing(char opening, char closing, string parsingInstruction, int ini) /// Returns the parsed GDB response. string parseGDB(string *response, string parsingInstruction, int respBegin, bool repeat, char variables[10][128], string separator) { - string result = ""; // This variable will be the parsed GDB response. - string originalParsingInstruction = parsingInstruction; // Backup of parsing instruction. - int parsePos = 0; // Current character to be read in parsing instruction. - int home = respBegin; // Save the current position in GDB response. + string result = ""; // This variable will be the parsed GDB response. + string originalParsingInstruction = parsingInstruction; // Backup of parsing instruction. + size_t parsePos = 0; // Current character to be read in parsing instruction. + int home = respBegin; // Save the current position in GDB response. int respEnd = 0; int limit = (*response).length(); bool found = false; @@ -1496,7 +1507,7 @@ string parseGDB(string *response, string parsingInstruction, int respBegin, bool string r = parseGDB(response, parsingInstruction.substr(parsePos, end - parsePos), respBegin, false, variables, "#"); if (r == "") break; - strcpy(variables[varNumber], r.c_str()); + strcpy_s(variables[varNumber], _countof(variables[0]), r.c_str()); parsePos = end + 3; // jump $$; } @@ -1530,7 +1541,7 @@ string parseGDB(string response, string parsingInstruction) char variables[10][128]; char result[ParsedMessageSize] = ""; - strcpy(result, parseGDB(&response, parsingInstruction, 0, false, variables, "#").substr(0, ParsedMessageSize - 1).c_str()); + strcpy_s(result, _countof(result), parseGDB(&response, parsingInstruction, 0, false, variables, "#").substr(0, ParsedMessageSize - 1).c_str()); return (result); } @@ -1550,19 +1561,19 @@ void parseGDB(string response, string parsingInstruction, int seqStamp) string parsed = ""; char print[16384] = ""; - strcpy(print, ("GDB - " + response).c_str()); + strcpy_s(print, _countof(print), ("GDB - " + response).c_str()); parsedLogPrint(print); parsed = parseGDB(&response, parsingInstruction, 0, false, variables, "#").substr(0, ParsedMessageSize - 1); - strcpy(result, parsed.c_str()); + strcpy_s(result, _countof(result), parsed.c_str()); - strcpy(print, ("Parsed - " + parsed).c_str()); + strcpy_s(print, _countof(print), ("Parsed - " + parsed).c_str()); parsedLogPrint(print); if (strcmp(result,"") == 0) { // TODO? Unexpected response. Must handle it. - strcpy(result, "$#@EMPTY@#$"); // Sending this string to be sure that the parser worked well and returned an empty string. + strcpy_s(result, _countof(result), "$#@EMPTY@#$"); // Sending this string to be sure that the parser worked well and returned an empty string. } while (!addIntoOutputBuffer(seqStamp, result)) @@ -1591,19 +1602,19 @@ unsigned __stdcall parseGDBResponseThread(void *arg) string parsed = ""; char print[4096] = ""; - strcpy(print, ("GDB - " + response).c_str()); + strcpy_s(print, _countof(print), ("GDB - " + response).c_str()); parsedLogPrint(print); parsed = parseGDB(&response, parsingInstruction, 0, false, variables, "#").substr(0, ParsedMessageSize - 1); - strcpy(result, parsed.c_str()); + strcpy_s(result, _countof(result), parsed.c_str()); - strcpy(print, ("Parsed - " + parsed).c_str()); + strcpy_s(print, _countof(print), ("Parsed - " + parsed).c_str()); parsedLogPrint(print); if (strcmp(result,"") == 0) { // TODO? Unexpected response. Must handle it. - strcpy(result, "$#@EMPTY@#$"); // Sending this string to be sure that parsed worked well and returned an empty string. + strcpy_s(result, _countof(result), "$#@EMPTY@#$"); // Sending this string to be sure that parsed worked well and returned an empty string. } while (!addIntoOutputBuffer(seqStamp, result)) @@ -1617,25 +1628,27 @@ unsigned __stdcall parseGDBResponseThread(void *arg) /// /// Message to be printed to a log file. void parsedLogPrint(char* buffer) { - if (LOG_GDB_RAW_IO) { - time_t tt = time(NULL); - struct tm tm; - char buf[32]; - - tm = *localtime(&tt); - - strftime(buf, 31, "%H:%M:%S", &tm); - - FILE* file = fopen((char *)parse_log, "a"); - if (file != NULL) - { - if (buffer[0] == 'P') - fprintf(file, "%s - %s\n\n", buf, buffer); - else - fprintf(file, "%s - %s", buf, buffer); - fclose(file); - } - } +#if LOG_GDB_RAW_IO + time_t tt = time(NULL); + struct tm tm; + char buf[32]; + + localtime_s(&tm, &tt); + strftime(buf, 31, "%H:%M:%S", &tm); + + FILE* file = NULL; + errno_t retCode; + + retCode = fopen_s(&file, parse_log, "a"); + if (file != NULL && retCode == 0) + { + if (buffer[0] == 'P') + fprintf(file, "%s - %s\n\n", buf, buffer); + else + fprintf(file, "%s - %s", buf, buffer); + fclose(file); + } +#endif } /// @@ -1728,11 +1741,11 @@ unsigned __stdcall listeningGDB(void *arg) ParsingThreadDetails *details = new(ParsingThreadDetails); - details->parsingInstruction = new(char[listen->parsingInstructions[instructionCode].length()]); - strcpy(details->parsingInstruction, listen->parsingInstructions[instructionCode].c_str()); - details->response = new(char[oneResponse.length()]); - strcpy(details->response, oneResponse.c_str()); - details->seqStamp = new(int); + details->parsingInstruction = new char[listen->parsingInstructions[instructionCode].length()]; + strcpy_s(details->parsingInstruction, listen->parsingInstructions[instructionCode].length(), listen->parsingInstructions[instructionCode].c_str()); + details->response = new char[oneResponse.length()]; + strcpy_s(details->response, oneResponse.length(), oneResponse.c_str()); + details->seqStamp = new int; if ((seqId >= 0) && (seqId < SyncInstructionsSize)) *(details->seqStamp) = seqId; else @@ -1882,16 +1895,19 @@ bool insertingCommandCodes(unordered_map *map, string parsingInstru /// 0 unsigned __stdcall sendingCommands2GDB(void *arg) { - GDBConsole *console = (GDBConsole *)arg; - - String^ tempPath = Environment::GetEnvironmentVariable("APPDATA"); - tempPath += "\\BlackBerry\\parsedGDBResponse-output.log"; - pin_ptr path_buffer = PtrToStringChars(tempPath); - - int ret = wcstombs(parse_log, path_buffer, _MAX_PATH); - - FILE* file = fopen(parse_log, "w"); // Delete a possible existing file. - fclose(file); + GDBConsole *console = (GDBConsole *)arg; + + GetEnvironmentVariableA("AppData", path_log, _countof(path_log)); + strcat_s(path_log, _countof(path_log), "\\BlackBerry\\gdb-output.log"); + + FILE* file = NULL; + errno_t retCode; + + retCode = fopen_s(&file, parse_log, "w"); // Delete a possible existing file. + if (file != NULL && retCode == 0) + { + fclose(file); + } // Initializing listeningGDB thread data. HANDLE listeningThread; @@ -1936,12 +1952,12 @@ unsigned __stdcall sendingCommands2GDB(void *arg) int previousSeqId; char print[256] = "Command - "; - removeFromInputBuffer(inputCommandSend); + removeFromInputBuffer(inputCommandSend, _countof(inputCommandSend)); while (strcmp(inputCommandSend,"") == 0) { if (in_InputBuffer == out_InputBuffer) // if true, input buffer is empty. WaitForSingleObject(inputEvent, WAIT_TIME); - removeFromInputBuffer(inputCommandSend); + removeFromInputBuffer(inputCommandSend, _countof(inputCommandSend)); } if ((inputCommandSend[0] >= '0') && (inputCommandSend[0] <= '4')) // Means that it is a synchronous command and the instruction @@ -1951,7 +1967,7 @@ unsigned __stdcall sendingCommands2GDB(void *arg) previousSeqId = seq_id; seq_id = ((inputCommandSend[0] - '0') * 10) + (inputCommandSend[1] - '0'); char *aux_str = inputCommandSend + 2; - strcpy(inputCommandSend, aux_str); + strcpy_s(inputCommandSend, _countof(inputCommandSend), aux_str); } if (strcmp(inputCommandSend, "-exec-interrupt") == 0) @@ -1983,10 +1999,10 @@ unsigned __stdcall sendingCommands2GDB(void *arg) Sleep(0); } - itoa(seq_id, commandSend, 10); + _itoa_s(seq_id, commandSend, _countof(commandSend), 10); - strcat(commandSend, inputCommandSend); - strcat(commandSend, "\r\n"); + strcat_s(commandSend, _countof(commandSend), inputCommandSend); + strcat_s(commandSend, _countof(commandSend), "\r\n"); instructionCodeSend = getInstructionCode(inputCommandSend, commandCodesMap, ¶m); if (instructionCodeSend == -1) @@ -2006,7 +2022,7 @@ unsigned __stdcall sendingCommands2GDB(void *arg) console->sendCommand(commandSend); - strcat(print, commandSend); + strcat_s(print, _countof(print), commandSend); parsedLogPrint(print); if ((strcmp(inputCommandSend, "-exec-continue") == 0) || (strcmp(inputCommandSend, "-exec-continue --thread 1") == 0)) @@ -2014,7 +2030,7 @@ unsigned __stdcall sendingCommands2GDB(void *arg) while (!isGDBBufferEmpty()) Sleep(0); } - strcpy(lastCommandSend, inputCommandSend); + strcpy_s(lastCommandSend, _countof(lastCommandSend), inputCommandSend); if (!sync) seq_id++; diff --git a/src/GDBParser/gdb-connect.h b/src/GDBParser/gdb-connect.h index 3397bc66..b329ea4b 100644 --- a/src/GDBParser/gdb-connect.h +++ b/src/GDBParser/gdb-connect.h @@ -14,8 +14,6 @@ #pragma once -#include - #include "stdafx.h" #include #include @@ -59,7 +57,7 @@ class GDBConsole { BOOL isMoreOutputAvailable (); void logPrint(char*); void prepAndLaunchRedirectedChild(); - int readOutput(CHAR*, int, int*); + int readOutput(CHAR*, int, size_t*); public: ~GDBConsole(); @@ -102,11 +100,11 @@ string substituteVariables(string, char[10][128]); // The following methods are responsible for manipulating the buffers (Input, GDB and Output). void cleanBuffers(); bool addIntoInputBuffer(char [GDBCommandSize]); -void removeFromInputBuffer(char *); +void removeFromInputBuffer(char *, size_t); bool isInputBufferEmpty(); bool addIntoGDBBuffer(int, int, string); int removeFromGDBBuffer(int, string*); bool isGDBBufferEmpty(); bool addIntoOutputBuffer(int, char *); -void removeFromOutputBuffer(char *); -void removeSyncFromOutputBuffer(char *, int); \ No newline at end of file +void removeFromOutputBuffer(char *, size_t); +void removeSyncFromOutputBuffer(char *, size_t, int); \ No newline at end of file diff --git a/src/GDBParser/stdafx.h b/src/GDBParser/stdafx.h index 09d97b98..011fd559 100644 --- a/src/GDBParser/stdafx.h +++ b/src/GDBParser/stdafx.h @@ -38,10 +38,11 @@ #endif #define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers + // Windows Header Files: +#include #include #include -//#include #include diff --git a/src/GDBWrapper/GDBWrapper.cpp b/src/GDBWrapper/GDBWrapper.cpp index 8acc8736..4fdab236 100644 --- a/src/GDBWrapper/GDBWrapper.cpp +++ b/src/GDBWrapper/GDBWrapper.cpp @@ -49,8 +49,7 @@ void DisplayError(LPCTSTR pszAPI) { LPVOID lpvMessageBuffer; TCHAR szPrintBuffer[512]; - DWORD bufSize = 512 * sizeof(TCHAR); - DWORD nCharsWritten; + DWORD bufSize = 512 * sizeof(TCHAR); FormatMessage( FORMAT_MESSAGE_ALLOCATE_BUFFER|FORMAT_MESSAGE_FROM_SYSTEM, @@ -109,12 +108,19 @@ void ErrorExit(LPTSTR lpszFunction) /// Generic function to print to a log file. /// /// Message to be printed to a log file. -void logPrint(TCHAR* buffer) { - if (LOG_GDB_RAW_IO) { - FILE* file = fopen(path_log, "a"); - _ftprintf(file, _T("%s\r\n"), buffer); - fclose(file); - } +void logPrint(TCHAR* buffer) +{ +#if LOG_GDB_RAW_IO + FILE* file = NULL; + errno_t retCode; + + retCode = fopen_s(&file, path_log, "a"); + if (file != NULL && retCode == 0) + { + _ftprintf(file, _T("%s\r\n"), buffer); + fclose(file); + } +#endif } // End region that needs to go into a library @@ -260,17 +266,16 @@ int _tmain(int argc, _TCHAR* argv[]) TCHAR msg[1024]; memset(msg, 0, 1024); - WCHAR wszThisFile[MAX_PATH + 1]; - GetModuleFileName(NULL, wszThisFile, MAX_PATH + 1); - - String^ tempPath = Environment::GetEnvironmentVariable("APPDATA"); - tempPath += "\\BlackBerry\\wrapper.log"; - pin_ptr path_buffer = PtrToStringChars(tempPath); - - int ret = wcstombs ( path_log, path_buffer, _MAX_PATH ); - - FILE* file = fopen(path_log, "w"); // just to delete a possible existing file - fclose(file); + GetEnvironmentVariableA("AppData", path_log, _countof(path_log)); + strcat_s(path_log, _countof(path_log), "\\BlackBerry\\wrapper.log"); + + FILE* file = NULL; + errno_t retCode; + retCode = fopen_s(&file, path_log, "w"); // just to delete a possible existing file + if (file != NULL && retCode == 0) + { + fclose(file); + } logPrint(_T("Starting")); @@ -278,15 +283,15 @@ int _tmain(int argc, _TCHAR* argv[]) handles[0] = OpenEventW(EVENT_ALL_ACCESS, TRUE, argv[2]); // Ctrl-C signal handles[1] = OpenEventW(EVENT_ALL_ACCESS, TRUE, argv[3]); // Signal to terminate the wrapper process - _stprintf(msg, _T("args: %s %s %s %s\r\n"), argv[0], argv[1], argv[2], argv[3]); + _stprintf_s(msg, _countof(msg), _T("args: %s %s %s %s\r\n"), argv[0], argv[1], argv[2], argv[3]); _tprintf(msg); logPrint(msg); - _stprintf(msg, _T("Ctrl-C handler: name: %s handle: %p\r\n"), argv[2], handles[0]); + _stprintf_s(msg, _countof(msg), _T("Ctrl-C handler: name: %s handle: %p\r\n"), argv[2], handles[0]); _tprintf(msg); logPrint(msg); - _stprintf(msg, _T("Terminate handler: name: %s handle: %p\r\n"), argv[3], handles[1]); + _stprintf_s(msg, _countof(msg), _T("Terminate handler: name: %s handle: %p\r\n"), argv[3], handles[1]); _tprintf(msg); logPrint(msg); diff --git a/src/VSNDK.AddIn/VSNDKAddIn.cs b/src/VSNDK.AddIn/VSNDKAddIn.cs index 3dbe1498..d5a12e51 100644 --- a/src/VSNDK.AddIn/VSNDKAddIn.cs +++ b/src/VSNDK.AddIn/VSNDKAddIn.cs @@ -15,33 +15,14 @@ using System; using System.Collections.Generic; using System.Linq; -using System.Text; using EnvDTE80; using EnvDTE; using Microsoft.VisualStudio.VCProjectEngine; using System.Diagnostics; -using System.Globalization; using Microsoft.VisualStudio.CommandBars; using Microsoft.VisualStudio.Project; -using Microsoft.Build.Execution; -using System.Xml; -using Microsoft.Win32; -using System.Security.Cryptography; using System.IO; -using Extensibility; -using System.Resources; -using System.Reflection; -using System.Text.RegularExpressions; -using Microsoft.VisualStudio; -using Microsoft.VisualStudio.Shell; -using Microsoft.VisualStudio.Shell.Interop; -using Microsoft.VisualStudio.OLE.Interop; - -using NameValueCollection = System.Collections.Specialized.NameValueCollection; -using NameValueCollectionHelper = VSNDK.AddIn.NameValueCollectionHelper; -using System.Runtime.InteropServices; - namespace VSNDK.AddIn { @@ -60,9 +41,9 @@ public class VSNDKAddIn private VSNDKCommandEvents _commandEvents; private DTE2 _applicationObject; private EnvDTE.AddIn _addInInstance; - private TokenProcessor tokenProcessor; + private TokenProcessor _tokenProcessor; - private List configTable; + private List _configTable; private const string BLACKBERRY = "BlackBerry"; @@ -75,11 +56,6 @@ public class VSNDKAddIn public static bool isDebugEngineRunning = false; - public VSNDKAddIn() - { - } - - /// /// Run initialization code on first connection of the AddIn. /// @@ -87,13 +63,13 @@ public VSNDKAddIn() /// Add In Object. public void Connect(DTE2 appObj, EnvDTE.AddIn addin) { - /// Initialize External and Internal Variables. + // Initialize External and Internal Variables. _applicationObject = appObj; _addInInstance = addin; - configTable = new List(); + _configTable = new List(); - /// Register Command Events + // Register Command Events _commandEvents = new VSNDKCommandEvents(appObj); _commandEvents.RegisterCommand(GuidList.guidVSStd2KString, CommandConstants.cmdidSolutionPlatform, cmdNewPlatform_afterExec, cmdNewPlatform_beforeExec); _commandEvents.RegisterCommand(GuidList.guidVSDebugGroup, CommandConstants.cmdidDebugBreakatFunction, cmdNewFunctionBreakpoint_afterExec, cmdNewFunctionBreakpoint_beforeExec); @@ -151,8 +127,8 @@ private void CheckSolutionPlatformCommand() private void DisableIntelliSenseErrorReport(bool disable) { DTE dte = _applicationObject as DTE; - EnvDTE.Properties txtEdCpp = dte.get_Properties("TextEditor", "C/C++ Specific"); - EnvDTE.Property prop = txtEdCpp.Item("DisableErrorReporting"); + var txtEdCpp = dte.get_Properties("TextEditor", "C/C++ Specific"); + var prop = txtEdCpp.Item("DisableErrorReporting"); if (prop != null) prop.Value = disable; } @@ -168,7 +144,7 @@ private void DisableIntelliSenseErrorReport(bool disable) /// Cancel the default execution of the command. private void cmdNewPlatform_beforeExec(string Guid, int ID, object CustomIn, object CustomOut, ref bool CancelDefault) { - getSolutionPlarformConfig(); + GetSolutionPlarformConfig(); } @@ -196,7 +172,7 @@ private void cmdNewPlatform_afterExec(string Guid, int ID, object CustomIn, obje /// Cancel the default execution of the command. private void cmdNewFunctionBreakpoint_beforeExec(string Guid, int ID, object CustomIn, object CustomOut, ref bool CancelDefault) { - /// Add Code Here + // Add Code Here } @@ -241,11 +217,11 @@ private void SolutionPlarformConfig() string pname = SC.PlatformName; string prname = SC.ProjectName; - configtableentry e = configTable.Find(i => (i.config == cname) && (i.platform == pname)); + configtableentry e = _configTable.Find(i => (i.config == cname) && (i.platform == pname)); if (e != null) { - configTable.Remove(e); + _configTable.Remove(e); } else { @@ -260,7 +236,7 @@ private void SolutionPlarformConfig() /// /// Get solution configuration before edit /// - private void getSolutionPlarformConfig() + private void GetSolutionPlarformConfig() { DTE dte = _applicationObject as DTE; @@ -282,7 +258,7 @@ private void getSolutionPlarformConfig() c.config = cname; c.deployable = SC.ShouldDeploy; - configTable.Add(c); + _configTable.Add(c); } } @@ -347,30 +323,30 @@ private void AddBarDescriptor() string n = proj.Name; if (baritem == null) { - tokenProcessor = new TokenProcessor(); + _tokenProcessor = new TokenProcessor(); Debug.WriteLine("Add bar descriptor file to the project"); string templatePath = dte.Solution.ProjectItemsTemplatePath(proj.Kind); templatePath += BAR_DESCRIPTOR_PATH + BAR_DESCRIPTOR; - tokenProcessor.AddReplace(@"[!output PROJECT_NAME]", proj.Name); - string destination = System.IO.Path.GetFileName(templatePath); + _tokenProcessor.AddReplace(@"[!output PROJECT_NAME]", proj.Name); + string destination = Path.GetFileName(templatePath); // Remove directory used in previous versions of this plug-in. - string folder = System.IO.Path.Combine(System.IO.Path.GetDirectoryName(proj.FullName), proj.Name + "_barDescriptor"); + string folder = Path.Combine(Path.GetDirectoryName(proj.FullName), proj.Name + "_barDescriptor"); if (Directory.Exists(folder)) { try { Directory.Delete(folder); } - catch (Exception e) + catch (Exception) { } } - folder = System.IO.Path.Combine(System.IO.Path.GetDirectoryName(proj.FullName), "BlackBerry-" + proj.Name); - System.IO.Directory.CreateDirectory(folder); - destination = System.IO.Path.Combine(folder, destination); - tokenProcessor.UntokenFile(templatePath, destination); + folder = Path.Combine(Path.GetDirectoryName(proj.FullName), "BlackBerry-" + proj.Name); + Directory.CreateDirectory(folder); + destination = Path.Combine(folder, destination); + _tokenProcessor.UntokenFile(templatePath, destination); ProjectItem projectitem = proj.ProjectItems.AddFromFile(destination); } } diff --git a/src/VSNDK.DebugEngine/AD7.Impl/AD7Engine.cs b/src/VSNDK.DebugEngine/AD7.Impl/AD7Engine.cs index b3d77c2c..24b83c47 100644 --- a/src/VSNDK.DebugEngine/AD7.Impl/AD7Engine.cs +++ b/src/VSNDK.DebugEngine/AD7.Impl/AD7Engine.cs @@ -13,8 +13,6 @@ //* limitations under the License. using System; -using System.Collections.Generic; -using System.Text; using System.Runtime.InteropServices; using Microsoft.VisualStudio; using Microsoft.VisualStudio.Debugger.Interop; @@ -22,11 +20,7 @@ using System.Threading; using RIM.VSNDK_Package; using VSNDK.Parser; -//using VSNDK.AddIn; -using VSNDK.Package; - using NameValueCollection = System.Collections.Specialized.NameValueCollection; -using System.Collections; using System.Windows.Forms; namespace VSNDK.DebugEngine @@ -64,7 +58,7 @@ public class AD7Engine : IDebugEngine2, IDebugEngineLaunch2, IDebugProgram3, IDe /// /// Used to send events to the debugger. Some examples of these events are thread create, exception thrown, module load. /// - EngineCallback m_engineCallback = null; + EngineCallback m_engineCallback; internal EngineCallback Callback { get { return m_engineCallback; } @@ -94,7 +88,7 @@ public EventDispatcher eDispatcher /// /// A unique identifier for the program being debugged. /// - Guid m_programGUID; + private Guid _mProgramGuid; /// /// A module loaded in the debuggee process to the debugger. It is always null because the AD7Module class is @@ -125,10 +119,10 @@ public EventDispatcher eDispatcher /// /// Array of threads of the program that is being debugged. /// - private AD7Thread[] m_threads = null; + private AD7Thread[] _threads; public AD7Thread[] thread { - get { return m_threads; } + get { return _threads; } } /// @@ -194,7 +188,7 @@ public AD7Engine() ~AD7Engine() { // Transition DE state - m_state = AD7Engine.DE_STATE.DONE; + m_state = DE_STATE.DONE; } #region IDebugEngine2 Members @@ -215,22 +209,22 @@ int IDebugEngine2.Attach(IDebugProgram2[] rgpPrograms, IDebugProgramNode2[] rgpP if (aCeltPrograms != 1) { - System.Diagnostics.Debug.Fail("VSNDK Debugger only supports one debug target at a time."); + Debug.Fail("VSNDK Debugger only supports one debug target at a time."); throw new ArgumentException(); } try { - EngineUtils.RequireOk(rgpPrograms[0].GetProgramId(out m_programGUID)); + EngineUtils.RequireOk(rgpPrograms[0].GetProgramId(out _mProgramGuid)); m_program = rgpPrograms[0]; // It is NULL when the user attached the debugger to a running process (by using Attach to Process UI). When that // happens, some objects must be instantiated, as well as GDB must be launched. Those ones are instantiated/launched // by LaunchSuspended and ResumeProcess methods when debugging an open project. - if (this.m_engineCallback == null) + if (m_engineCallback == null) { - VSNDK.Package.ControlDebugEngine.isDebugEngineRunning = true; + Package.ControlDebugEngine.isDebugEngineRunning = true; m_engineCallback = new EngineCallback(this, ad7Callback); AD7ProgramNodeAttach pnt = (AD7ProgramNodeAttach)m_program; @@ -239,17 +233,17 @@ int IDebugEngine2.Attach(IDebugProgram2[] rgpPrograms, IDebugProgramNode2[] rgpP string publicKeyPath = Environment.GetEnvironmentVariable("AppData") + @"\BlackBerry\bbt_id_rsa.pub"; string progName = pnt.m_programName.Substring(pnt.m_programName.LastIndexOf('/') + 1); - string exePath = ""; - string processesPaths = ""; - System.IO.StreamReader readProcessesPathsFile = null; + string exePath; + string processesPaths; + System.IO.StreamReader readProcessesPathsFile; // Read the file ProcessesPath.txt to try to get the file location of the executable file. try { - readProcessesPathsFile = new System.IO.StreamReader(System.Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + @"\Research In Motion\ProcessesPath.txt"); + readProcessesPathsFile = new System.IO.StreamReader(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + @"\Research In Motion\ProcessesPath.txt"); processesPaths = readProcessesPathsFile.ReadToEnd(); readProcessesPathsFile.Close(); } - catch (Exception e) + catch (Exception) { processesPaths = ""; } @@ -279,20 +273,20 @@ int IDebugEngine2.Attach(IDebugProgram2[] rgpPrograms, IDebugProgramNode2[] rgpP } m_eventDispatcher = new EventDispatcher(this); m_module = new AD7Module(); - m_progNode = new AD7ProgramNode(m_process._processGUID, m_process._processID, exePath, new Guid(AD7Engine.Id)); + m_progNode = new AD7ProgramNode(m_process._processGUID, m_process._processID, exePath, new Guid(Id)); AddThreadsToProgram(); } else { GDBParser.exitGDB(); - VSNDK.Package.ControlDebugEngine.isDebugEngineRunning = false; + Package.ControlDebugEngine.isDebugEngineRunning = false; return VSConstants.E_FAIL; } } AD7EngineCreateEvent.Send(this); AD7ProgramCreateEvent.Send(this); AD7ModuleLoadEvent.Send(this, m_module, true); - AD7LoadCompleteEvent.Send(this, currentThread()); + AD7LoadCompleteEvent.Send(this, CurrentThread()); // If the reason for attaching is ATTACH_REASON_LAUNCH, the DE needs to send the IDebugEntryPointEvent2 event. // See http://msdn.microsoft.com/en-us/library/bb145136%28v=vs.100%29.aspx @@ -301,7 +295,7 @@ int IDebugEngine2.Attach(IDebugProgram2[] rgpPrograms, IDebugProgramNode2[] rgpP AD7EntryPointEvent ad7Event = new AD7EntryPointEvent(); Guid riidEvent = new Guid(AD7EntryPointEvent.IID); uint attributes = (uint)enum_EVENTATTRIBUTES.EVENT_STOPPING | (uint)enum_EVENTATTRIBUTES.EVENT_SYNCHRONOUS; - int rc = ad7Callback.Event(this, null, m_program, currentThread(), ad7Event, ref riidEvent, attributes); + int rc = ad7Callback.Event(this, null, m_program, CurrentThread(), ad7Event, ref riidEvent, attributes); Debug.Assert(rc == VSConstants.S_OK); } } @@ -324,19 +318,17 @@ int IDebugEngine2.CauseBreak() // If not already broken, send the interrupt if (m_state != DE_STATE.DESIGN_MODE && m_state != DE_STATE.BREAK_MODE && m_state != DE_STATE.STEP_MODE) { - bool signalReceived; - bool hitBreakAll; - if (EventDispatcher.m_GDBRunMode == true) + if (EventDispatcher.m_GDBRunMode) { HandleProcessExecution.m_mre.Reset(); - hitBreakAll = m_running.WaitOne(); + m_running.WaitOne(); // Sends the GDB command that interrupts the background execution of the target. // (http://sourceware.org/gdb/onlinedocs/gdb/GDB_002fMI-Program-Execution.html) GDBParser.addGDBCommand(@"-exec-interrupt"); // Ensure the process is interrupted before returning - signalReceived = HandleProcessExecution.m_mre.WaitOne(1000); + HandleProcessExecution.m_mre.WaitOne(1000); m_running.Set(); @@ -375,9 +367,9 @@ int IDebugEngine2.ContinueFromSynchronousEvent(IDebugEvent2 eventObject) m_eventDispatcher = null; m_module = null; m_progNode = null; - m_programGUID = Guid.Empty; + _mProgramGuid = Guid.Empty; - m_threads = null; + _threads = null; GC.Collect(); } else @@ -568,13 +560,13 @@ int IDebugEngineLaunch2.CanTerminateProcess(IDebugProcess2 process) /// If successful, returns S_OK; otherwise, returns an error code. int IDebugEngineLaunch2.LaunchSuspended(string pszServer, IDebugPort2 port, string exe, string args, string dir, string env, string options, enum_LAUNCH_FLAGS launchFlags, uint hStdInput, uint hStdOutput, uint hStdError, IDebugEventCallback2 ad7Callback, out IDebugProcess2 process) { - Debug.Assert(m_programGUID == Guid.Empty); + Debug.Assert(_mProgramGuid == Guid.Empty); process = null; try { - VSNDK.Package.ControlDebugEngine.isDebugEngineRunning = true; + Package.ControlDebugEngine.isDebugEngineRunning = true; m_engineCallback = new EngineCallback(this, ad7Callback); // Read arguments back from the args string @@ -597,10 +589,10 @@ int IDebugEngineLaunch2.LaunchSuspended(string pszServer, IDebugPort2 port, stri { process = m_process = new AD7Process(this, port); m_eventDispatcher = new EventDispatcher(this); - m_programGUID = m_process._processGUID; + _mProgramGuid = m_process._processGUID; m_module = new AD7Module(); // m_progNode = new AD7ProgramNode(m_process.PhysID, pid, exePath, new Guid(AD7Engine.Id)); - m_progNode = new AD7ProgramNode(m_process._processGUID, pid, exePath, new Guid(AD7Engine.Id)); + m_progNode = new AD7ProgramNode(m_process._processGUID, pid, exePath, new Guid(Id)); AddThreadsToProgram(); AD7EngineCreateEvent.Send(this); @@ -610,7 +602,7 @@ int IDebugEngineLaunch2.LaunchSuspended(string pszServer, IDebugPort2 port, stri else { GDBParser.exitGDB(); - VSNDK.Package.ControlDebugEngine.isDebugEngineRunning = false; + Package.ControlDebugEngine.isDebugEngineRunning = false; return VSConstants.E_FAIL; } } @@ -640,19 +632,19 @@ int IDebugEngineLaunch2.ResumeProcess(IDebugProcess2 process) // Send a program node to the SDM. This will cause the SDM to turn around and call IDebugEngine2.Attach // which will complete the hookup with AD7 - IDebugPort2 port = null; + IDebugPort2 port; EngineUtils.RequireOk(process.GetPort(out port)); IDebugDefaultPort2 defaultPort = (IDebugDefaultPort2)port; - IDebugPortNotify2 portNotify = null; + IDebugPortNotify2 portNotify; EngineUtils.RequireOk(defaultPort.GetPortNotify(out portNotify)); EngineUtils.RequireOk(portNotify.AddProgramNode(m_progNode)); Callback.OnModuleLoad(m_module); - Callback.OnThreadStart(currentThread()); + Callback.OnThreadStart(CurrentThread()); } catch (Exception e) { @@ -807,77 +799,74 @@ public int EnumThreads(out IEnumDebugThreads2 ppEnum) if ((currentThread == -1) || (listThreads == null)) { ppEnum = null; - if (currentThread == 0) - return VSConstants.S_OK; - else - return VSConstants.S_FALSE; + return currentThread == 0 ? VSConstants.S_OK : VSConstants.S_FALSE; } - if (listThreads.Length != this.m_threads.Length) + if (listThreads.Length != _threads.Length) { - foreach (AD7Thread t in this.m_threads) + foreach (AD7Thread t in _threads) { AD7ThreadDestroyEvent.Send(this, 0, t); } - this.m_threads = null; - this.m_threads = new AD7Thread[listThreads.Length]; - this.m_threads = listThreads; - this._currentThreadIndex = currentThread; - foreach (AD7Thread t in this.m_threads) + _threads = null; + _threads = new AD7Thread[listThreads.Length]; + _threads = listThreads; + _currentThreadIndex = currentThread; + foreach (AD7Thread t in _threads) { m_engineCallback.OnThreadStart(t); } - ppEnum = new AD7ThreadEnum(this.m_threads); + ppEnum = new AD7ThreadEnum(_threads); } else { - if (this._currentThreadIndex != currentThread) + if (_currentThreadIndex != currentThread) { - this._currentThreadIndex = currentThread; + _currentThreadIndex = currentThread; } for (int i = 0; i < listThreads.Length; i++) { - if (this.m_threads[i]._engine != listThreads[i]._engine) + if (_threads[i]._engine != listThreads[i]._engine) { - this.m_threads[i]._engine = listThreads[i]._engine; + _threads[i]._engine = listThreads[i]._engine; } - if (this.m_threads[i]._threadDisplayName != listThreads[i]._threadDisplayName) + if (_threads[i]._threadDisplayName != listThreads[i]._threadDisplayName) { - this.m_threads[i]._threadDisplayName = listThreads[i]._threadDisplayName; + _threads[i]._threadDisplayName = listThreads[i]._threadDisplayName; } - if (this.m_threads[i]._id != listThreads[i]._id) + if (_threads[i]._id != listThreads[i]._id) { - this.m_threads[i]._id = listThreads[i]._id; + _threads[i]._id = listThreads[i]._id; } - if (this.m_threads[i]._state != listThreads[i]._state) + if (_threads[i]._state != listThreads[i]._state) { - this.m_threads[i]._state = listThreads[i]._state; + _threads[i]._state = listThreads[i]._state; } - if (this.m_threads[i]._targetID != listThreads[i]._targetID) + if (_threads[i]._targetID != listThreads[i]._targetID) { - this.m_threads[i]._targetID = listThreads[i]._targetID; + _threads[i]._targetID = listThreads[i]._targetID; } - if (this.m_threads[i]._priority != listThreads[i]._priority) + if (_threads[i]._priority != listThreads[i]._priority) { - this.m_threads[i]._priority = listThreads[i]._priority; + _threads[i]._priority = listThreads[i]._priority; } - if (this.m_threads[i]._line != listThreads[i]._line) + if (_threads[i]._line != listThreads[i]._line) { - this.m_threads[i]._line = listThreads[i]._line; + _threads[i]._line = listThreads[i]._line; } - if (this.m_threads[i]._filename != listThreads[i]._filename) + if (_threads[i]._filename != listThreads[i]._filename) { if (listThreads[i]._filename == "") - this.m_threads[i]._filename = ""; + _threads[i]._filename = ""; else - this.m_threads[i]._filename = listThreads[i]._filename; + _threads[i]._filename = listThreads[i]._filename; } - this.m_threads[i].__stackFrames = listThreads[i].__stackFrames; - this.m_threads[i]._suspendCount = listThreads[i]._suspendCount; + _threads[i].__stackFrames = listThreads[i].__stackFrames; + _threads[i]._suspendCount = listThreads[i]._suspendCount; } - ppEnum = new AD7ThreadEnum(this.m_threads); + ppEnum = new AD7ThreadEnum(this._threads); } return VSConstants.S_OK; } @@ -975,8 +964,8 @@ public int GetName(out string programName) /// VSConstants.S_OK. public int GetProgramId(out Guid guidProgramId) { - if (m_programGUID != null) - guidProgramId = m_programGUID; + if (_mProgramGuid != null) + guidProgramId = _mProgramGuid; else guidProgramId = m_process._processGUID; @@ -1008,30 +997,30 @@ public int Step(IDebugThread2 pThread, enum_STEPKIND sk, enum_STEPUNIT Step) // Equivalent to F11 hotkey. // Sends the GDB command that resumes the execution of the inferior program, stopping at the next instruction, diving // into function if it is a function call. (http://sourceware.org/gdb/onlinedocs/gdb/GDB_002fMI-Program-Execution.html) - GDBParser.addGDBCommand("-exec-step --thread " + this.m_threads[this._currentThreadIndex]._id); + GDBParser.addGDBCommand("-exec-step --thread " + this._threads[this._currentThreadIndex]._id); } else if (sk == enum_STEPKIND.STEP_OVER) { // Equivalent to F10 hotkey. // Sends the GDB command that resumes the execution of the inferior program, stopping at the next instruction, but // without diving into functions. (http://sourceware.org/gdb/onlinedocs/gdb/GDB_002fMI-Program-Execution.html) - GDBParser.addGDBCommand("-exec-next --thread " + this.m_threads[this._currentThreadIndex]._id); + GDBParser.addGDBCommand("-exec-next --thread " + this._threads[this._currentThreadIndex]._id); } else if (sk == enum_STEPKIND.STEP_OUT) { // Equivalent to Shift-F11 hotkey. - if (eDispatcher.getStackDepth(this.m_threads[this._currentThreadIndex]._id) > 1) + if (eDispatcher.getStackDepth(this._threads[this._currentThreadIndex]._id) > 1) { // Sends the GDB command that resumes the execution of the inferior program until the current function is exited. // (http://sourceware.org/gdb/onlinedocs/gdb/GDB_002fMI-Program-Execution.html) - GDBParser.addGDBCommand("-exec-finish --thread " + this.m_threads[this._currentThreadIndex]._id + " --frame 0"); + GDBParser.addGDBCommand("-exec-finish --thread " + this._threads[this._currentThreadIndex]._id + " --frame 0"); } else { // If this the only frame left, do a step-over. // Sends the GDB command that resumes the execution of the inferior program, stopping at the next instruction, but // without diving into functions. (http://sourceware.org/gdb/onlinedocs/gdb/GDB_002fMI-Program-Execution.html) - GDBParser.addGDBCommand("-exec-next --thread " + this.m_threads[this._currentThreadIndex]._id); + GDBParser.addGDBCommand("-exec-next --thread " + this._threads[this._currentThreadIndex]._id); } } else if (sk == enum_STEPKIND.STEP_BACKWARDS) @@ -1233,7 +1222,7 @@ public void cleanEvaluatedThreads() /// public void resetStackFrames() { - foreach (AD7Thread t in m_threads) + foreach (AD7Thread t in _threads) { if (t.__stackFrames != null) { @@ -1250,21 +1239,21 @@ public void resetStackFrames() /// public void UpdateListOfThreads() { - foreach (AD7Thread t in this.m_threads) + foreach (AD7Thread t in this._threads) { // Send events to VS to destroy its current debugged threads. AD7ThreadDestroyEvent.Send(this, 0, t); } - this.m_threads = null; + this._threads = null; // Get the current list of threads and store them into a temporary variable listThreads. - this._currentThreadIndex = GetListOfThreads(out this.m_threads); + this._currentThreadIndex = GetListOfThreads(out this._threads); - if ((this._currentThreadIndex == -1) || (this.m_threads == null)) + if ((this._currentThreadIndex == -1) || (this._threads == null)) return; // Send events to VS to add this list of debugged threads. - foreach (AD7Thread t in this.m_threads) + foreach (AD7Thread t in this._threads) { m_engineCallback.OnThreadStart(t); } @@ -1320,12 +1309,12 @@ public int GetListOfThreads(out AD7Thread[] threadObjects) } return currentThreadIndex; } - catch (ComponentException e) + catch (ComponentException) { threadObjects = null; return -1; } - catch (Exception e) + catch (Exception) { threadObjects = null; return -1; @@ -1337,10 +1326,10 @@ public int GetListOfThreads(out AD7Thread[] threadObjects) /// Returns the current thread. /// /// If successful, returns the current thread; otherwise, returns NULL. - public AD7Thread currentThread() + public AD7Thread CurrentThread() { if (_currentThreadIndex != -1) - return m_threads[_currentThreadIndex]; + return _threads[_currentThreadIndex]; return null; } @@ -1350,12 +1339,12 @@ public AD7Thread currentThread() /// /// The ID of the thread to search for. /// If successful, returns the selected thread; otherwise, returns NULL. - public AD7Thread selectThread(string id) + public AD7Thread SelectThread(string id) { - for (int i = 0; i < this.m_threads.Length; i++) + for (int i = 0; i < _threads.Length; i++) { - if (this.m_threads[i]._id == id) - return (m_threads[i]); + if (_threads[i]._id == id) + return (_threads[i]); } return null; } @@ -1365,13 +1354,13 @@ public AD7Thread selectThread(string id) /// Set a given thread as the current one. /// /// The ID of the thread. - public void setAsCurrentThread(string id) + public void SetAsCurrentThread(string id) { - for (int i = 0; i < this.m_threads.Length; i++) + for (int i = 0; i < _threads.Length; i++) { - if (this.m_threads[i]._id == id) + if (_threads[i]._id == id) { - this._currentThreadIndex = i; + _currentThreadIndex = i; break; } } @@ -1384,11 +1373,11 @@ public void setAsCurrentThread(string id) /// VSConstants.S_OK. public int AddThreadsToProgram() { - m_threads = null; - _currentThreadIndex = GetListOfThreads(out m_threads); + _threads = null; + _currentThreadIndex = GetListOfThreads(out _threads); if (_currentThreadIndex != -1) { - foreach (AD7Thread t in m_threads) + foreach (AD7Thread t in _threads) { m_engineCallback.OnThreadStart(t); } diff --git a/src/VSNDK.DebugEngine/AD7.Impl/AD7Events.cs b/src/VSNDK.DebugEngine/AD7.Impl/AD7Events.cs index 7588337b..33fb0774 100644 --- a/src/VSNDK.DebugEngine/AD7.Impl/AD7Events.cs +++ b/src/VSNDK.DebugEngine/AD7.Impl/AD7Events.cs @@ -725,7 +725,7 @@ sealed class AD7StepCompletedEvent : IDebugEvent2, IDebugStepCompleteEvent2 public static void Send(AD7Engine engine) { var xEvent = new AD7StepCompletedEvent(); - engine.Callback.Send(xEvent, IID, engine.currentThread()); + engine.Callback.Send(xEvent, IID, engine.CurrentThread()); } #region IDebugEvent2 Members @@ -761,7 +761,7 @@ sealed class AD7EntryPointEvent : AD7SynchronousStoppingEvent, IDebugEntryPointE public static void Send(AD7Engine engine) { var xEvent = new AD7EntryPointEvent(); - engine.Callback.Send(xEvent, IID, engine.currentThread()); + engine.Callback.Send(xEvent, IID, engine.CurrentThread()); } } } diff --git a/src/VSNDK.DebugEngine/AD7.Impl/AD7Process.cs b/src/VSNDK.DebugEngine/AD7.Impl/AD7Process.cs index 0ec91b9a..29748d18 100644 --- a/src/VSNDK.DebugEngine/AD7.Impl/AD7Process.cs +++ b/src/VSNDK.DebugEngine/AD7.Impl/AD7Process.cs @@ -13,19 +13,11 @@ //* limitations under the License. using System; -using System.Collections.Generic; -using System.Diagnostics; -using System.Linq; -using System.Text; +using System.Collections.Generic; +using System.Linq; using Microsoft.VisualStudio; -using Microsoft.VisualStudio.Debugger.Interop; -using VSNDK.Parser; -using System.Collections.Specialized; -using Microsoft.VisualStudio.Shell.Interop; -//using VSNDK.AddIn; -using System.Windows.Forms; - - +using Microsoft.VisualStudio.Debugger.Interop; + namespace VSNDK.DebugEngine { /// @@ -45,7 +37,7 @@ public class AD7Process : IDebugProcess2, IDebugProcessEx2 /// /// Identifies the session in which this process is attached to. /// - IDebugSession2 session; + private IDebugSession2 session; /// /// The name of the process. Not used till now. Has no value assigned to it. @@ -60,7 +52,7 @@ public class AD7Process : IDebugProcess2, IDebugProcessEx2 /// /// The IDebugPort2 object that represents the port on which the process was launched. /// - IDebugPort2 _port = null; + private IDebugPort2 _port; /// /// Process GUID. @@ -72,11 +64,6 @@ public class AD7Process : IDebugProcess2, IDebugProcessEx2 /// public string _processID; - /// - /// The server on which this process is running. Not used till now. Has no value assigned to it. - /// - IDebugCoreServer2 _server; - /// /// The AD7Engine object that represents the DE. /// @@ -239,22 +226,22 @@ public int GetInfo(enum_PROCESS_INFO_FIELDS Fields, PROCESS_INFO[] pProcessInfo) { if ((Fields & enum_PROCESS_INFO_FIELDS.PIF_FILE_NAME) != 0) { - pProcessInfo[0].bstrFileName = this._name; + pProcessInfo[0].bstrFileName = _name; pProcessInfo[0].Fields |= enum_PROCESS_INFO_FIELDS.PIF_FILE_NAME; } if ((Fields & enum_PROCESS_INFO_FIELDS.PIF_BASE_NAME) != 0) { - pProcessInfo[0].bstrBaseName = this._name.Substring(_name.LastIndexOf('/') + 1); + pProcessInfo[0].bstrBaseName = _name.Substring(_name.LastIndexOf('/') + 1); pProcessInfo[0].Fields |= enum_PROCESS_INFO_FIELDS.PIF_BASE_NAME; } if ((Fields & enum_PROCESS_INFO_FIELDS.PIF_TITLE) != 0) { - pProcessInfo[0].bstrTitle = this._name; + pProcessInfo[0].bstrTitle = _name; pProcessInfo[0].Fields |= enum_PROCESS_INFO_FIELDS.PIF_TITLE; } if ((Fields & enum_PROCESS_INFO_FIELDS.PIF_PROCESS_ID) != 0) { - pProcessInfo[0].ProcessId.dwProcessId = Convert.ToUInt32(this._processID); + pProcessInfo[0].ProcessId.dwProcessId = Convert.ToUInt32(_processID); pProcessInfo[0].ProcessId.ProcessIdType = (uint)enum_AD_PROCESS_ID.AD_PROCESS_ID_SYSTEM; pProcessInfo[0].Fields |= enum_PROCESS_INFO_FIELDS.PIF_PROCESS_ID; } @@ -350,7 +337,7 @@ public int GetProcessId(out Guid pguidProcessId) /// VSConstants.S_OK. public int GetServer(out IDebugCoreServer2 ppServer) { - ppServer = _server; + ppServer = null; return VSConstants.S_OK; } diff --git a/src/VSNDK.DebugEngine/AD7.Impl/AD7Property.cs b/src/VSNDK.DebugEngine/AD7.Impl/AD7Property.cs index 3a8c8f7c..2e40baf3 100644 --- a/src/VSNDK.DebugEngine/AD7.Impl/AD7Property.cs +++ b/src/VSNDK.DebugEngine/AD7.Impl/AD7Property.cs @@ -12,11 +12,8 @@ //* See the License for the specific language governing permissions and //* limitations under the License. -using System; -using System.Collections.Generic; -using System.Text; +using System; using Microsoft.VisualStudio; -using VSNDK.Parser; using Microsoft.VisualStudio.Debugger.Interop; using System.Collections; @@ -33,13 +30,13 @@ class AD7Property : IDebugProperty2 /// /// Object that contains all information about a variable / expression. /// - private VariableInfo _variableInfo; + private readonly VariableInfo _variableInfo; /// /// Object that contains all information about a stack frame. /// - private AD7StackFrame _stackFrame; + private readonly AD7StackFrame _stackFrame; /// @@ -109,7 +106,7 @@ public DEBUG_PROPERTY_INFO ConstructDebugPropertyInfo(enum_DEBUGPROP_INFO_FLAGS // then set the pProperty field so the debugger can call back when the chilren are enumerated. if ((dwFields & enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_PROP) != 0 || _variableInfo._children != null) { - propertyInfo.pProperty = (IDebugProperty2)this; + propertyInfo.pProperty = this; propertyInfo.dwFields = (enum_DEBUGPROP_INFO_FLAGS)((uint)propertyInfo.dwFields | (uint)(DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_PROP)); } @@ -139,7 +136,7 @@ public DEBUG_PROPERTY_INFO ConstructDebugPropertyInfo(enum_DEBUGPROP_INFO_FLAGS /// INFINITE to wait indefinitely. /// Returns an IEnumDebugPropertyInfo2 object containing a list of the child properties. /// If successful, returns S_OK; otherwise returns S_FALSE. - public int EnumChildren(enum_DEBUGPROP_INFO_FLAGS dwFields, uint dwRadix, ref System.Guid guidFilter, enum_DBG_ATTRIB_FLAGS dwAttribFilter, string pszNameFilter, uint dwTimeout, out IEnumDebugPropertyInfo2 ppEnum) + public int EnumChildren(enum_DEBUGPROP_INFO_FLAGS dwFields, uint dwRadix, ref Guid guidFilter, enum_DBG_ATTRIB_FLAGS dwAttribFilter, string pszNameFilter, uint dwTimeout, out IEnumDebugPropertyInfo2 ppEnum) { ppEnum = null; @@ -152,17 +149,17 @@ public int EnumChildren(enum_DEBUGPROP_INFO_FLAGS dwFields, uint dwRadix, ref Sy // This is an array, struct, union, or pointer. // Create a variable object so we can list this variable's children. - /// Some VS variable names cannot be used by GDB. When that happens, it is added the prefix VsNdK_ to the GDB variable - /// name and it is stored in the GDBNames array. At the same time, the VS name is stored in the VSNames array using the - /// same index position. This bool variable just indicate if this prefix is used or not. - bool hasVsNdK_ = false; + // Some VS variable names cannot be used by GDB. When that happens, it is added the prefix VsNdK_ to the GDB variable + // name and it is stored in the GDBNames array. At the same time, the VS name is stored in the VSNames array using the + // same index position. This bool variable just indicate if this prefix is used or not. + bool hasVsNDK = false; - string numChildren = AD7StackFrame.m_dispatcher.createVar(_variableInfo._name, ref hasVsNdK_); + string numChildren = AD7StackFrame.m_dispatcher.createVar(_variableInfo._name, ref hasVsNDK); ArrayList GDBNames = new ArrayList(); ArrayList VSNames = new ArrayList(); - if (hasVsNdK_) + if (hasVsNDK) { _variableInfo._GDBName = "VsNdK_" + _variableInfo._name; GDBNames.Add("VsNdK_" + _variableInfo._name); @@ -175,24 +172,24 @@ public int EnumChildren(enum_DEBUGPROP_INFO_FLAGS dwFields, uint dwRadix, ref Sy { if (_variableInfo._type.Contains("struct")) if (_variableInfo._type[_variableInfo._type.Length - 1] == '*') - _variableInfo.listChildren(AD7StackFrame.m_dispatcher, "*", GDBNames, VSNames, hasVsNdK_, null); + _variableInfo.listChildren(AD7StackFrame.m_dispatcher, "*", GDBNames, VSNames, hasVsNDK, null); else if (_variableInfo._type.Contains("[")) - _variableInfo.listChildren(AD7StackFrame.m_dispatcher, "struct[]", GDBNames, VSNames, hasVsNdK_, null); + _variableInfo.listChildren(AD7StackFrame.m_dispatcher, "struct[]", GDBNames, VSNames, hasVsNDK, null); else - _variableInfo.listChildren(AD7StackFrame.m_dispatcher, "struct", GDBNames, VSNames, hasVsNdK_, null); + _variableInfo.listChildren(AD7StackFrame.m_dispatcher, "struct", GDBNames, VSNames, hasVsNDK, null); else if (_variableInfo._type.Contains("[")) - _variableInfo.listChildren(AD7StackFrame.m_dispatcher, "[]", GDBNames, VSNames, hasVsNdK_, null); + _variableInfo.listChildren(AD7StackFrame.m_dispatcher, "[]", GDBNames, VSNames, hasVsNDK, null); else if (_variableInfo._type.Contains("*")) - _variableInfo.listChildren(AD7StackFrame.m_dispatcher, "*", GDBNames, VSNames, hasVsNdK_, null); + _variableInfo.listChildren(AD7StackFrame.m_dispatcher, "*", GDBNames, VSNames, hasVsNDK, null); else - _variableInfo.listChildren(AD7StackFrame.m_dispatcher, "", GDBNames, VSNames, hasVsNdK_, null); + _variableInfo.listChildren(AD7StackFrame.m_dispatcher, "", GDBNames, VSNames, hasVsNDK, null); } } - catch (FormatException e) + catch (FormatException) { } - AD7StackFrame.m_dispatcher.deleteVar(_variableInfo._name, hasVsNdK_); + AD7StackFrame.m_dispatcher.deleteVar(_variableInfo._name, hasVsNDK); } DEBUG_PROPERTY_INFO[] properties = new DEBUG_PROPERTY_INFO[_variableInfo._children.Count]; int i = 0; @@ -208,7 +205,7 @@ public int EnumChildren(enum_DEBUGPROP_INFO_FLAGS dwFields, uint dwRadix, ref Sy } else if (_stackFrame != null) { - uint elementsReturned = 0; + uint elementsReturned; _stackFrame.CreateLocalsPlusArgsProperties(dwFields, out elementsReturned, out ppEnum); return VSConstants.S_OK; } @@ -244,7 +241,7 @@ public int GetDerivedMostProperty(out IDebugProperty2 ppDerivedMost) /// information. For example, this parameter might return an IUnknown interface that can be queried for an IDebugDocumentText2 /// interface. /// Not implemented. - public int GetExtendedInfo(ref System.Guid guidExtendedInfo, out object pExtendedInfo) + public int GetExtendedInfo(ref Guid guidExtendedInfo, out object pExtendedInfo) { throw new Exception("The method or operation is not implemented."); } @@ -366,7 +363,7 @@ public int SetValueAsReference(IDebugReference2[] rgpArgs, uint dwArgCount, IDeb public int SetValueAsString(string pszValue, uint dwRadix, uint dwTimeout) { string result = ""; - VariableInfo.evaluateExpression(this._variableInfo._name + "=" + pszValue, ref result, null); + VariableInfo.evaluateExpression(_variableInfo._name + "=" + pszValue, ref result, null); return VSConstants.S_OK; } diff --git a/src/VSNDK.DebugEngine/AD7.Impl/AD7StackFrame.cs b/src/VSNDK.DebugEngine/AD7.Impl/AD7StackFrame.cs index 04c91794..5a7ed7da 100644 --- a/src/VSNDK.DebugEngine/AD7.Impl/AD7StackFrame.cs +++ b/src/VSNDK.DebugEngine/AD7.Impl/AD7StackFrame.cs @@ -13,13 +13,10 @@ //* limitations under the License. using System; -using System.Collections.Generic; using System.Collections; -using System.Text; using Microsoft.VisualStudio; using VSNDK.Parser; using Microsoft.VisualStudio.Debugger.Interop; -using System.Diagnostics; namespace VSNDK.DebugEngine { @@ -376,10 +373,8 @@ public VariableInfo(string name, string type, string value, string GDBName) /// The Names of the variables used by VS. public VariableInfo(string name, string type, string baseType, string value, EventDispatcher dispatcher, ArrayList GDBNames, ArrayList VSNames) { - /// numChildren - The result of the createvar returns ERROR or a number from 0 to "n" where "n" is the number of children - /// of the variable. - string numChildren = ""; - + // numChildren - The result of the createvar returns ERROR or a number from 0 to "n" where "n" is the number of children of the variable. + _name = name; _type = type; _value = value; @@ -400,12 +395,11 @@ public VariableInfo(string name, string type, string baseType, string value, Eve // This is an array, struct, union, or pointer. // Create a variable object so we can list this variable's children. - /// Some VS variable names cannot be used by GDB. When that happens, it is added the prefix VsNdK_ to the GDB variable - /// name and it is stored in the GDBNames array. At the same time, the VS name is stored in the VSNames array using the - /// same index position. This bool variable just indicate if this prefix is used or not. + // Some VS variable names cannot be used by GDB. When that happens, it is added the prefix VsNdK_ to the GDB variable + // name and it is stored in the GDBNames array. At the same time, the VS name is stored in the VSNames array using the + // same index position. This bool variable just indicate if this prefix is used or not. bool hasVsNdK_ = false; - - numChildren = dispatcher.createVar(_name, ref hasVsNdK_); + string numChildren = dispatcher.createVar(_name, ref hasVsNdK_); if (hasVsNdK_) { @@ -421,20 +415,20 @@ public VariableInfo(string name, string type, string baseType, string value, Eve _children = new ArrayList(); if (type.Contains("struct")) if (type[type.Length - 1] == '*') - this.listChildren(dispatcher, "*", GDBNames, VSNames, hasVsNdK_, null); + listChildren(dispatcher, "*", GDBNames, VSNames, hasVsNdK_, null); else if (type.Contains("[")) - this.listChildren(dispatcher, "struct[]", GDBNames, VSNames, hasVsNdK_, null); + listChildren(dispatcher, "struct[]", GDBNames, VSNames, hasVsNdK_, null); else - this.listChildren(dispatcher, "struct", GDBNames, VSNames, hasVsNdK_, null); + listChildren(dispatcher, "struct", GDBNames, VSNames, hasVsNdK_, null); else if (type.Contains("[")) - this.listChildren(dispatcher, "[]", GDBNames, VSNames, hasVsNdK_, null); + listChildren(dispatcher, "[]", GDBNames, VSNames, hasVsNdK_, null); else if (type.Contains("*")) - this.listChildren(dispatcher, "*", GDBNames, VSNames, hasVsNdK_, null); + listChildren(dispatcher, "*", GDBNames, VSNames, hasVsNdK_, null); else - this.listChildren(dispatcher, "", GDBNames, VSNames, hasVsNdK_, null); + listChildren(dispatcher, "", GDBNames, VSNames, hasVsNdK_, null); } } - catch (FormatException e) + catch (FormatException) { } @@ -726,14 +720,14 @@ public AD7StackFrame(AD7Engine engine, AD7Thread thread, string[] frameInfo) { m_lineNum = Convert.ToUInt32(frameInfo[4]); } - catch (Exception e) + catch (Exception) { m_lineNum = 0; } _locals = new ArrayList(); _arguments = new ArrayList(); - m_hasSource = (m_lineNum == 0) ? false : true; + m_hasSource = m_lineNum != 0; ArrayList evaluatedVars = new ArrayList(); // Add the variable filter list to the evaluatedVars list. @@ -1233,7 +1227,7 @@ int IDebugStackFrame2.GetDebugProperty(out IDebugProperty2 property) /// If successful, returns S_OK; otherwise, returns an error code. int IDebugStackFrame2.GetDocumentContext(out IDebugDocumentContext2 docContext) { - this.m_engine.cleanEvaluatedThreads(); + m_engine.cleanEvaluatedThreads(); docContext = null; try @@ -1259,8 +1253,6 @@ int IDebugStackFrame2.GetDocumentContext(out IDebugDocumentContext2 docContext) { return EngineUtils.UnexpectedException(e); } - - return VSConstants.S_FALSE; } @@ -1295,27 +1287,27 @@ int IDebugStackFrame2.GetInfo(enum_FRAMEINFO_FLAGS dwFieldSpec, uint nRadix, FRA SetFrameInfo(dwFieldSpec, out pFrameInfo[0]); int frame = 0; - if (this.m_thread.__stackFrames != null) + if (m_thread.__stackFrames != null) { - foreach (AD7StackFrame sf in this.m_thread.__stackFrames) + foreach (AD7StackFrame sf in m_thread.__stackFrames) { - if (sf.m_functionName == this.m_functionName) + if (sf.m_functionName == m_functionName) break; frame++; } } - if (this.m_thread._id != this.m_engine.currentThread()._id) - this.m_engine.eDispatcher.selectThread(this.m_thread._id); + if (m_thread._id != m_engine.CurrentThread()._id) + m_engine.eDispatcher.selectThread(m_thread._id); // Waits for the parsed response for the GDB/MI command that changes the selected frame. // (http://sourceware.org/gdb/onlinedocs/gdb/GDB_002fMI-Stack-Manipulation.html) GDBParser.parseCommand("-stack-select-frame " + frame, 5); - if (this.m_thread._id != this.m_engine.currentThread()._id) - this.m_engine.eDispatcher.selectThread(this.m_engine.currentThread()._id); + if (m_thread._id != m_engine.CurrentThread()._id) + m_engine.eDispatcher.selectThread(m_engine.CurrentThread()._id); - this.m_engine.cleanEvaluatedThreads(); + m_engine.cleanEvaluatedThreads(); return VSConstants.S_OK; } diff --git a/src/VSNDK.DebugEngine/AD7.Impl/AD7Thread.cs b/src/VSNDK.DebugEngine/AD7.Impl/AD7Thread.cs index c3bbab95..50929e38 100644 --- a/src/VSNDK.DebugEngine/AD7.Impl/AD7Thread.cs +++ b/src/VSNDK.DebugEngine/AD7.Impl/AD7Thread.cs @@ -200,7 +200,7 @@ public string getFunctionName() { string func = ""; - if ((this._id != "") && (this._id != this._engine.currentThread()._id)) + if ((this._id != "") && (this._id != this._engine.CurrentThread()._id)) _engine.eDispatcher.selectThread(this._id); string stackResponse = _engine.eDispatcher.getStackFrames().Replace("#;;;;", ""); @@ -228,8 +228,8 @@ public string getFunctionName() } } - if ((this._id != "") && (this._id != this._engine.currentThread()._id)) - _engine.eDispatcher.selectThread(this._engine.currentThread()._id); + if ((this._id != "") && (this._id != this._engine.CurrentThread()._id)) + _engine.eDispatcher.selectThread(this._engine.CurrentThread()._id); } return func; @@ -275,7 +275,7 @@ int IDebugThread2.EnumFrameInfo(enum_FRAMEINFO_FLAGS dwFieldSpec, uint nRadix, o } // Ask for general stack information. - if ((this._id != "") && (this._id != this._engine.currentThread()._id)) + if ((this._id != "") && (this._id != this._engine.CurrentThread()._id)) _engine.eDispatcher.selectThread(this._id); string stackResponse = _engine.eDispatcher.getStackFrames().Replace("#;;;;", ""); @@ -350,21 +350,21 @@ int IDebugThread2.EnumFrameInfo(enum_FRAMEINFO_FLAGS dwFieldSpec, uint nRadix, o } } - if ((this._id != "") && (this._id != this._engine.currentThread()._id)) - _engine.eDispatcher.selectThread(this._engine.currentThread()._id); + if ((this._id != "") && (this._id != this._engine.CurrentThread()._id)) + _engine.eDispatcher.selectThread(this._engine.CurrentThread()._id); return Constants.S_OK; } catch (ComponentException e) { - if ((this._id != "") && (this._id != this._engine.currentThread()._id)) - _engine.eDispatcher.selectThread(this._engine.currentThread()._id); + if ((this._id != "") && (this._id != this._engine.CurrentThread()._id)) + _engine.eDispatcher.selectThread(this._engine.CurrentThread()._id); return e.HResult; } catch (Exception e) { - if ((this._id != "") && (this._id != this._engine.currentThread()._id)) - _engine.eDispatcher.selectThread(this._engine.currentThread()._id); + if ((this._id != "") && (this._id != this._engine.CurrentThread()._id)) + _engine.eDispatcher.selectThread(this._engine.CurrentThread()._id); return EngineUtils.UnexpectedException(e); } } diff --git a/src/VSNDK.DebugEngine/Engine.Impl/EngineCallback.cs b/src/VSNDK.DebugEngine/Engine.Impl/EngineCallback.cs index 9177e65b..7167b073 100644 --- a/src/VSNDK.DebugEngine/Engine.Impl/EngineCallback.cs +++ b/src/VSNDK.DebugEngine/Engine.Impl/EngineCallback.cs @@ -64,7 +64,7 @@ public void Send(IDebugEvent2 eventObject, string iidEvent, IDebugProgram2 progr EngineUtils.RequireOk(eventObject.GetAttributes(out attributes)); - if ((thread == null) && (m_engine != null) && (m_engine.thread != null) && (program != null) && (eventObject != null) && (riidEvent != null) && (attributes != null)) + if ((thread == null) && (m_engine != null) && (m_engine.thread != null) && (program != null) && (eventObject != null) && (riidEvent != null) && (attributes != 0)) { if (m_engine._currentThreadIndex != -1) { diff --git a/src/VSNDK.DebugEngine/Engine.Impl/EventDispatcher.cs b/src/VSNDK.DebugEngine/Engine.Impl/EventDispatcher.cs index bc896faa..80f93fbf 100644 --- a/src/VSNDK.DebugEngine/Engine.Impl/EventDispatcher.cs +++ b/src/VSNDK.DebugEngine/Engine.Impl/EventDispatcher.cs @@ -35,7 +35,7 @@ public class EventDispatcher /// /// The private AD7Engine object that represents the DE. /// - private AD7Engine m_engine = null; + private AD7Engine m_engine; /// /// The public AD7Engine object that represents the DE. @@ -48,7 +48,7 @@ public AD7Engine engine /// /// Thread responsible for handling asynchronous output from GDB. /// - private Thread m_processingThread = null; + private Thread m_processingThread; /// /// Represents the object that process asynchronous GDB's output by classifying it by type (e.g. breakpoint event). @@ -142,22 +142,22 @@ public class GDBOutput /// /// This object manages debug events in the engine. /// - private EventDispatcher m_eventDispatcher = null; + private EventDispatcher m_eventDispatcher; /// /// This object manages breakpoints events. /// - private HandleBreakpoints m_hBreakpoints = null; + private HandleBreakpoints m_hBreakpoints; /// /// This object manages events related to execution control (processes, threads, programs). /// - private HandleProcessExecution m_hProcExe = null; + private HandleProcessExecution m_hProcExe; /// /// This object manages events related to output messages. /// - private HandleOutputs m_hOutputs = null; + private HandleOutputs m_hOutputs; /// /// Boolean variable that corresponds to the event dispatcher status. When false, exit the event dispatch loop. @@ -765,7 +765,7 @@ public void breakpointHit(uint ID, string threadID) m_engine.m_state = AD7Engine.DE_STATE.BREAK_MODE; // Found a bound breakpoint - m_engine.Callback.OnBreakpoint(m_engine.selectThread(threadID), xBoundBreakpoints.AsReadOnly()); + m_engine.Callback.OnBreakpoint(m_engine.SelectThread(threadID), xBoundBreakpoints.AsReadOnly()); if (bbp.m_isHitCountEqual) { @@ -976,7 +976,7 @@ public class HandleBreakpoints /// /// Boolean variable that indicates if this breakpoint is enable (true) or disable (false). /// - private bool m_enable = false; + private bool m_enable; /// /// Breakpoint address. @@ -1021,7 +1021,7 @@ public class HandleBreakpoints /// /// This object manages debug events in the engine. /// - private EventDispatcher m_eventDispatcher = null; + private EventDispatcher m_eventDispatcher; /// /// GDB_ID Property @@ -1232,8 +1232,8 @@ public void handle(string ev) { m_eventDispatcher.engine.UpdateListOfThreads(); } - m_eventDispatcher.engine.selectThread(m_threadID).setCurrentLocation(m_filename, (uint)m_line); - m_eventDispatcher.engine.setAsCurrentThread(m_threadID); + m_eventDispatcher.engine.SelectThread(m_threadID).setCurrentLocation(m_filename, (uint)m_line); + m_eventDispatcher.engine.SetAsCurrentThread(m_threadID); // A breakpoint can be hit during a step if (m_eventDispatcher.engine.m_state == AD7Engine.DE_STATE.STEP_MODE) @@ -1480,8 +1480,8 @@ public void handle(string ev) } if (m_threadId > 0) { - m_eventDispatcher.engine.selectThread(m_threadId.ToString()).setCurrentLocation(m_file, (uint)m_line); - m_eventDispatcher.engine.setAsCurrentThread(m_threadId.ToString()); + m_eventDispatcher.engine.SelectThread(m_threadId.ToString()).setCurrentLocation(m_file, (uint)m_line); + m_eventDispatcher.engine.SetAsCurrentThread(m_threadId.ToString()); } // Call the method/event that will let SDM know that the debugged program was interrupted. @@ -1537,8 +1537,8 @@ public void handle(string ev) if (m_threadId > 0) { if ((EventDispatcher.m_unknownCode == false) && (m_file != "")) - m_eventDispatcher.engine.selectThread(m_threadId.ToString()).setCurrentLocation(m_file, (uint)m_line); - m_eventDispatcher.engine.setAsCurrentThread(m_threadId.ToString()); + m_eventDispatcher.engine.SelectThread(m_threadId.ToString()).setCurrentLocation(m_file, (uint)m_line); + m_eventDispatcher.engine.SetAsCurrentThread(m_threadId.ToString()); } HandleProcessExecution.onStepCompleted(m_eventDispatcher, m_file, (uint)m_line); @@ -1579,8 +1579,8 @@ public void handle(string ev) if (m_threadId > 0) { if ((EventDispatcher.m_unknownCode == false) && (m_file != "")) - m_eventDispatcher.engine.selectThread(m_threadId.ToString()).setCurrentLocation(m_file, (uint)m_line); - m_eventDispatcher.engine.setAsCurrentThread(m_threadId.ToString()); + m_eventDispatcher.engine.SelectThread(m_threadId.ToString()).setCurrentLocation(m_file, (uint)m_line); + m_eventDispatcher.engine.SetAsCurrentThread(m_threadId.ToString()); } HandleProcessExecution.onStepCompleted(m_eventDispatcher, m_file, (uint)m_line); @@ -1602,8 +1602,8 @@ public void handle(string ev) if (m_threadId > 0) { if ((EventDispatcher.m_unknownCode == false) && (m_file != "")) - m_eventDispatcher.engine.selectThread(m_threadId.ToString()).setCurrentLocation(m_file, (uint)m_line); - m_eventDispatcher.engine.setAsCurrentThread(m_threadId.ToString()); + m_eventDispatcher.engine.SelectThread(m_threadId.ToString()).setCurrentLocation(m_file, (uint)m_line); + m_eventDispatcher.engine.SetAsCurrentThread(m_threadId.ToString()); } if (m_eventDispatcher.engine.m_state != AD7Engine.DE_STATE.BREAK_MODE) @@ -1635,7 +1635,7 @@ public void handle(string ev) { // We don't have symbols for this function so further stepping won't be possible. Return from this function. VSNDK.DebugEngine.EventDispatcher.m_unknownCode = true; - m_eventDispatcher.engine.Step(m_eventDispatcher.engine.currentThread(), enum_STEPKIND.STEP_OUT, enum_STEPUNIT.STEP_LINE); + m_eventDispatcher.engine.Step(m_eventDispatcher.engine.CurrentThread(), enum_STEPKIND.STEP_OUT, enum_STEPUNIT.STEP_LINE); } } break; @@ -1742,8 +1742,8 @@ public void handle(string ev) } if (m_threadId > 0) { - m_eventDispatcher.engine.selectThread(m_threadId.ToString()).setCurrentLocation(m_file, (uint)m_line); - m_eventDispatcher.engine.setAsCurrentThread(m_threadId.ToString()); + m_eventDispatcher.engine.SelectThread(m_threadId.ToString()).setCurrentLocation(m_file, (uint)m_line); + m_eventDispatcher.engine.SetAsCurrentThread(m_threadId.ToString()); } onInterrupt(m_threadId); @@ -1842,7 +1842,7 @@ private void onInterrupt(int threadID) // Only send OnAsyncBreakComplete if break-all was requested by the user if (!m_needsResumeAfterInterrupt) { - m_eventDispatcher.engine.Callback.OnAsyncBreakComplete(m_eventDispatcher.engine.selectThread(threadID.ToString())); + m_eventDispatcher.engine.Callback.OnAsyncBreakComplete(m_eventDispatcher.engine.SelectThread(threadID.ToString())); } } } diff --git a/src/VSNDK.Package.Test/SettingsDataTests.cs b/src/VSNDK.Package.Test/SettingsDataTests.cs index 89f80ddb..303f817c 100644 --- a/src/VSNDK.Package.Test/SettingsDataTests.cs +++ b/src/VSNDK.Package.Test/SettingsDataTests.cs @@ -112,7 +112,7 @@ public void GetDeviceInfoTest_KeyValuesNotSet() } } - settingsDataObject.getDeviceInfo(); + settingsDataObject.GetDeviceInfo(); Assert.IsNullOrEmpty(settingsDataObject.DeviceIP, "Device IP is not empty or null, " + settingsDataObject.DeviceIP); Assert.IsNullOrEmpty(settingsDataObject.DevicePassword, "Device Password is not empty or null, " + settingsDataObject.DevicePassword); @@ -146,7 +146,7 @@ public void GetDeviceInfoTest_KeyValuesSet() } } - settingsDataObject.getDeviceInfo(); + settingsDataObject.GetDeviceInfo(); Assert.IsTrue(settingsDataObject.DeviceIP == ipAddr , "Device IP value is not equal to test value, " + ipAddr + "!= " + settingsDataObject.DeviceIP); Assert.IsTrue(settingsDataObject.DevicePassword == password, "Device Password value is not equal to test value, " + password + " != " + settingsDataObject.DevicePassword); @@ -165,7 +165,7 @@ public void SetDeviceInfoTest() settingsDataObject.DeviceIP = deviceIP; settingsDataObject.DevicePassword = devicePassword; - settingsDataObject.setDeviceInfo(); + settingsDataObject.SetDeviceInfo(); string keyName = @"Software\BlackBerry\BlackBerryVSPlugin"; @@ -209,7 +209,7 @@ public void GetSimulatorInfoTest_KeyValuesNotSet() } } - settingsDataObject.getSimulatorInfo(); + settingsDataObject.GetSimulatorInfo(); Assert.IsNullOrEmpty(settingsDataObject.SimulatorIP, "Simulator IP is not empty or null, " + settingsDataObject.SimulatorIP); Assert.IsNullOrEmpty(settingsDataObject.SimulatorPassword, "Simulator Password is not empty or null, " + settingsDataObject.SimulatorPassword); @@ -243,7 +243,7 @@ public void GetSimulatorInfoTest_KeyValuesSet() } } - settingsDataObject.getSimulatorInfo(); + settingsDataObject.GetSimulatorInfo(); Assert.IsTrue(settingsDataObject.SimulatorIP == ipAddr , "Simulator IP value is not equal to test value, " + ipAddr + "!= " + settingsDataObject.SimulatorIP); Assert.IsTrue(settingsDataObject.SimulatorPassword == password, "Simulator Password value is not equal to test value, " + password + " != " + settingsDataObject.SimulatorPassword); @@ -262,7 +262,7 @@ public void SetSimulatorInfoTest() settingsDataObject.SimulatorIP = simulatorIP; settingsDataObject.SimulatorPassword = simulatorPassword; - settingsDataObject.setSimulatorInfo(); + settingsDataObject.SetSimulatorInfo(); string keyName = @"Software\BlackBerry\BlackBerryVSPlugin"; @@ -306,7 +306,7 @@ public void GetNDKPathTest_KeyValuesNotSet() } } - settingsDataObject.getNDKPath(); + settingsDataObject.GetNDKPath(); Assert.IsNullOrEmpty(settingsDataObject.HostPath, "Host Path is not empty or null, " + settingsDataObject.HostPath); Assert.IsNullOrEmpty(settingsDataObject.TargetPath, "Target Path is not empty or null, " + settingsDataObject.TargetPath); @@ -340,7 +340,7 @@ public void GetNDKPathTest_KeyValuesSet() } } - settingsDataObject.getNDKPath(); + settingsDataObject.GetNDKPath(); Assert.IsTrue(settingsDataObject.HostPath == hostPath, "Host Path value is not equal to test value, " + hostPath + "!= " + settingsDataObject.HostPath); Assert.IsTrue(settingsDataObject.TargetPath == targetPath, "Target Path value is not equal to test value, " + targetPath + " != " + settingsDataObject.TargetPath); @@ -355,7 +355,7 @@ public void GetAPINameTest_ValidVersion() string version = "10.2.0.1155"; string name = "BlackBerry Native SDK 10.2"; - string result = settingsDataObject.getAPIName(version); + string result = settingsDataObject.GetAPIName(version); Assert.IsTrue(result == name, "API Name does not matched expected result., " + result + "!= " + name); } @@ -369,7 +369,7 @@ public void GetAPINameTest_InvalidVersion() string version = "1.1.1.1"; string name = ""; - string result = settingsDataObject.getAPIName(version); + string result = settingsDataObject.GetAPIName(version); Assert.IsTrue(result == name, "API Name does not matched expected result., " + result + "!= " + name); } @@ -540,7 +540,7 @@ public void TC_setNDKPaths() regKey.SetValue("NDKHostPath", ""); // Run Test - settingsDataObject.setNDKPaths(); + settingsDataObject.SetNDKPaths(); // Validate Test Assert.IsTrue(regKey.GetValue("NDKHostPath").ToString() == hostPath, "Host path does not match expected result"); diff --git a/src/VSNDK.Package.Test/VSNDK.Package.Test.csproj b/src/VSNDK.Package.Test/VSNDK.Package.Test.csproj index d6e18cf2..8b92a324 100644 --- a/src/VSNDK.Package.Test/VSNDK.Package.Test.csproj +++ b/src/VSNDK.Package.Test/VSNDK.Package.Test.csproj @@ -21,6 +21,7 @@ DEBUG;TRACE prompt 4 + x86 pdbonly @@ -29,6 +30,7 @@ TRACE prompt 4 + x86 diff --git a/src/VSNDK.Package/Import/Model/ImportModel.cs b/src/VSNDK.Package/Import/Model/ImportModel.cs index dcf27168..3db8353a 100644 --- a/src/VSNDK.Package/Import/Model/ImportModel.cs +++ b/src/VSNDK.Package/Import/Model/ImportModel.cs @@ -109,7 +109,7 @@ public bool WalkDirectoryTree(Project proj, DirectoryInfo sourceDir, DirectoryIn } } } - catch (UnauthorizedAccessException e) + catch (UnauthorizedAccessException) { return false; } @@ -204,7 +204,7 @@ private void AddFileToProject(Project proj, string source, string destination, V } else { - AddSummaryString("Duplicate File: " + System.IO.Path.Combine(destination, fileInfo1.Name)); + AddSummaryString("Duplicate File: " + Path.Combine(destination, fileInfo1.Name)); } } @@ -212,11 +212,11 @@ private void AddFileToProject(Project proj, string source, string destination, V } else { - AddSummaryString("File Skipped: " + System.IO.Path.Combine(destination, fileInfo1.Name)); + AddSummaryString("File Skipped: " + Path.Combine(destination, fileInfo1.Name)); } } - catch (Exception e) + catch (Exception) { } @@ -225,7 +225,6 @@ private void AddFileToProject(Project proj, string source, string destination, V /// /// Add Folder to Specified Project /// - /// private VCFilter AddFolderToProject(Project proj, string dirInfo, string newDir, VCFilter filter) { VCFilter localFilter = filter; diff --git a/src/VSNDK.Package/Settings/Model/SettingsData.cs b/src/VSNDK.Package/Settings/Model/SettingsData.cs index 03e21cd0..b5047367 100644 --- a/src/VSNDK.Package/Settings/Model/SettingsData.cs +++ b/src/VSNDK.Package/Settings/Model/SettingsData.cs @@ -14,15 +14,11 @@ using System; using System.Collections.Generic; -using System.Linq; -using System.Text; using System.ComponentModel; -using System.Collections; using Microsoft.Win32; using System.Xml; using System.IO; using System.Windows.Data; -using Microsoft.VisualStudio.Shell; namespace RIM.VSNDK_Package.Settings.Models { @@ -50,7 +46,6 @@ public class SettingsData : INotifyPropertyChanged #region Member Variables and Constants private string _deviceIP; private string _devicePassword; - private Package _pkg; private string _simulatorIP; private string _simulatorPassword; private CollectionView _ndkEntries; @@ -59,11 +54,11 @@ public class SettingsData : INotifyPropertyChanged private string _targetPath; private string _hostPath; - private const string _colDeviceIP = "DeviceIP"; - private const string _colDevicePW = "DevicePassword"; - private const string _colSimulatorIP = "SimulatorIP"; - private const string _colSimulatorPW = "SimulatorPassword"; - private const string _colNDKEntry = "NDKEntry"; + private const string ColDeviceIp = "DeviceIP"; + private const string ColDevicePw = "DevicePassword"; + private const string ColSimulatorIp = "SimulatorIP"; + private const string ColSimulatorPw = "SimulatorPassword"; + private const string ColNdkEntry = "NDKEntry"; #endregion /// @@ -71,8 +66,8 @@ public class SettingsData : INotifyPropertyChanged /// public SettingsData() { - getDeviceInfo(); - getSimulatorInfo(); + GetDeviceInfo(); + GetSimulatorInfo(); RefreshScreen(); } @@ -81,13 +76,13 @@ public SettingsData() /// public void RefreshScreen() { - /// Get the NDK Path data - getNDKPath(); + // Get the NDK Path data + GetNDKPath(); - /// Refresh the NDK List + // Refresh the NDK List string[] dirPaths = new string[2]; dirPaths[0] = Path.GetPathRoot(Environment.GetFolderPath(Environment.SpecialFolder.System)) + @"bbndk_vs\..\qconfig\"; - dirPaths[1] = System.Environment.GetFolderPath(System.Environment.SpecialFolder.LocalApplicationData) + @"\Research In Motion\BlackBerry Native SDK\qconfig\"; + dirPaths[1] = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + @"\Research In Motion\BlackBerry Native SDK\qconfig\"; IList NDKList = new List(); for (int i = 0; i < 2; i++) @@ -130,23 +125,19 @@ public void RefreshScreen() /// /// version to match /// - public string getAPIName(string version) + public string GetAPIName(string version) { - string result = ""; - APITargetListSingleton ap = APITargetListSingleton.Instance; foreach (APITargetClass target in ap._tempAPITargetList) { if (target.TargetVersion == version) { - result = target.TargetName; - break; + return target.TargetName; } } - return result; - + return string.Empty; } #region Properties @@ -157,7 +148,7 @@ public string getAPIName(string version) public string DeviceIP { get { return _deviceIP; } - set { _deviceIP = value; OnPropertyChanged(_colDeviceIP); } + set { _deviceIP = value; OnPropertyChanged(ColDeviceIp); } } /// @@ -184,7 +175,7 @@ public string HostPath public string DevicePassword { get { return _devicePassword; } - set { _devicePassword = value; OnPropertyChanged(_colDevicePW); } + set { _devicePassword = value; OnPropertyChanged(ColDevicePw); } } /// @@ -193,7 +184,7 @@ public string DevicePassword public string SimulatorIP { get { return _simulatorIP; } - set { _simulatorIP = value; OnPropertyChanged(_colSimulatorIP); } + set { _simulatorIP = value; OnPropertyChanged(ColSimulatorIp); } } /// @@ -202,7 +193,7 @@ public string SimulatorIP public string SimulatorPassword { get { return _simulatorPassword; } - set { _simulatorPassword = value; OnPropertyChanged(_colSimulatorPW); } + set { _simulatorPassword = value; OnPropertyChanged(ColSimulatorPw); } } /// @@ -224,7 +215,7 @@ public NDKEntryClass NDKEntryClass { if (_ndkEntry == value) return; _ndkEntry = value; - OnPropertyChanged(_colNDKEntry); + OnPropertyChanged(ColNdkEntry); } } @@ -234,7 +225,7 @@ public NDKEntryClass NDKEntryClass /// Set Device Password and IP /// /// - public void setDeviceInfo() + public void SetDeviceInfo() { registerTargetInfo(DevicePassword, DeviceIP, "device"); } @@ -243,7 +234,7 @@ public void setDeviceInfo() /// Set Simulator Password and IP /// /// - public void setSimulatorInfo() + public void SetSimulatorInfo() { registerTargetInfo(SimulatorPassword, SimulatorIP, "simulator"); } @@ -252,7 +243,7 @@ public void setSimulatorInfo() /// Function to retrieve device info from the registry /// /// - public void getDeviceInfo() + public void GetDeviceInfo() { RegistryKey rkHKCU = Registry.CurrentUser; RegistryKey rkSettingsPath = null; @@ -288,7 +279,7 @@ public void getDeviceInfo() /// Function to retrieve simulator info from the registry /// /// - public void getSimulatorInfo() + public void GetSimulatorInfo() { RegistryKey rkHKCU = Registry.CurrentUser; RegistryKey rkSettingsPath = null; @@ -357,7 +348,7 @@ private void registerTargetInfo(string password, string IP, string type) /// /// Set the NDK Path into the register for future reference by the MSBUILD /// - public void setNDKPaths() + public void SetNDKPaths() { RegistryKey rkHKCU = Registry.CurrentUser; RegistryKey rkNDKPath = null; @@ -368,15 +359,14 @@ public void setNDKPaths() rkNDKPath.SetValue("NDKHostPath", _ndkEntry.HostPath); rkNDKPath.SetValue("NDKTargetPath", _ndkEntry.TargetPath); - string qnx_config = System.Environment.GetFolderPath(System.Environment.SpecialFolder.LocalApplicationData) + @"\Research In Motion\BlackBerry Native SDK"; + string qnx_config = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + @"\Research In Motion\BlackBerry Native SDK"; - System.Environment.SetEnvironmentVariable("QNX_TARGET", _ndkEntry.TargetPath); - System.Environment.SetEnvironmentVariable("QNX_HOST", _ndkEntry.HostPath); - System.Environment.SetEnvironmentVariable("QNX_CONFIGURATION", qnx_config); + Environment.SetEnvironmentVariable("QNX_TARGET", _ndkEntry.TargetPath); + Environment.SetEnvironmentVariable("QNX_HOST", _ndkEntry.HostPath); + Environment.SetEnvironmentVariable("QNX_CONFIGURATION", qnx_config); - string ndkpath = string.Format(@"{0}/usr/bin;{1}\bin;{0}/usr/qde/eclipse/jre/bin;", _ndkEntry.HostPath, qnx_config) + - System.Environment.GetEnvironmentVariable("PATH"); - System.Environment.SetEnvironmentVariable("PATH", ndkpath); + string ndkpath = string.Format(@"{0}/usr/bin;{1}\bin;{0}/usr/qde/eclipse/jre/bin;", _ndkEntry.HostPath, qnx_config) + Environment.GetEnvironmentVariable("PATH"); + Environment.SetEnvironmentVariable("PATH", ndkpath); } catch { @@ -391,9 +381,9 @@ public void setNDKPaths() /// Return the NDK Path from the registry /// /// - public bool getNDKPath() + public bool GetNDKPath() { - bool success = false; + bool success; RegistryKey rkHKCU = Registry.CurrentUser; RegistryKey rkNDKPath = null; diff --git a/src/VSNDK.Package/Settings/SettingsDialog.xaml.cs b/src/VSNDK.Package/Settings/SettingsDialog.xaml.cs index b32f926f..a27d4dc0 100644 --- a/src/VSNDK.Package/Settings/SettingsDialog.xaml.cs +++ b/src/VSNDK.Package/Settings/SettingsDialog.xaml.cs @@ -57,8 +57,8 @@ public SettingsDialog() _data = new SettingsData(); gridMain.DataContext = _data; - _data.getSimulatorInfo(); - _data.getDeviceInfo(); + _data.GetSimulatorInfo(); + _data.GetDeviceInfo(); tbDevicePassword.Password = _data.DevicePassword; tbSimulatorPassword.Password = _data.SimulatorPassword; } @@ -72,10 +72,10 @@ private void btnOK_Click(object sender, RoutedEventArgs e) { _data.DevicePassword = tbDevicePassword.Password; _data.SimulatorPassword = tbSimulatorPassword.Password; - _data.setDeviceInfo(); - _data.setSimulatorInfo(); + _data.SetDeviceInfo(); + _data.SetSimulatorInfo(); _data.NDKEntryClass = (NDKEntryClass)NDKEntry.SelectedItem; - _data.setNDKPaths(); + _data.SetNDKPaths(); DialogResult = true; ; @@ -90,7 +90,7 @@ private void Update_Click(object sender, RoutedEventArgs e) { this.Cursor = System.Windows.Input.Cursors.Wait; - UpdateManager.UpdateManager updateManager = UpdateManager.UpdateManager.create(); + UpdateManager.UpdateManager updateManager = UpdateManager.UpdateManager.Create(); if (updateManager != null) { diff --git a/src/VSNDK.Package/Signing/Models/SigningData.cs b/src/VSNDK.Package/Signing/Models/SigningData.cs index 7f6336cd..dd7ec973 100644 --- a/src/VSNDK.Package/Signing/Models/SigningData.cs +++ b/src/VSNDK.Package/Signing/Models/SigningData.cs @@ -1,9 +1,5 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; using System.ComponentModel; -using System.Windows.Data; using System.IO; using System.IO.Packaging; using Microsoft.Win32; @@ -308,15 +304,15 @@ void ErrorDataReceived(object sender, System.Diagnostics.DataReceivedEventArgs e /// public void CleanUp() { - if (!File.Exists(System.Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + @"\Research In Motion\author.p12")) + if (!File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + @"\Research In Motion\author.p12")) { - FileInfo fi_csk = new FileInfo(System.Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + @"\Research In Motion\bbidtoken.csk"); + FileInfo fi_csk = new FileInfo(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + @"\Research In Motion\bbidtoken.csk"); try { fi_csk.Delete(); } - catch (System.IO.IOException ex) + catch (IOException) { } @@ -332,10 +328,9 @@ private void AddUriToPackage(string file, Package pkg) { if (File.Exists(_certPath + file)) { - Uri uri = null; - PackagePart pkgPart = null; - uri = PackUriHelper.CreatePartUri(new Uri(file, UriKind.Relative)); - pkgPart = pkg.CreatePart(uri, string.Empty); + Uri uri = PackUriHelper.CreatePartUri(new Uri(file, UriKind.Relative)); + PackagePart pkgPart = pkg.CreatePart(uri, string.Empty); + using (FileStream fileStream = new FileStream(_certPath + file, FileMode.Open, FileAccess.Read)) { CopyStream(fileStream, pkgPart.GetStream()); @@ -347,7 +342,6 @@ private void AddUriToPackage(string file, Package pkg) /// Function to unzip and restore a set of singing keys /// /// - /// public void Restore(string fromZipFile) { @@ -368,49 +362,38 @@ public void Restore(string fromZipFile) /// /// Method to create file at the temp folder /// - /// - /// - /// private void createFile(ZipPackagePart contentFile) { // Initially create file under the folder specified - string contentFilePath = string.Empty; - contentFilePath = contentFile.Uri.OriginalString.Replace('/', - System.IO.Path.DirectorySeparatorChar); + string contentFilePath = contentFile.Uri.OriginalString.Replace('/', Path.DirectorySeparatorChar); - if (contentFilePath.StartsWith( - System.IO.Path.DirectorySeparatorChar.ToString())) + if (contentFilePath.StartsWith(Path.DirectorySeparatorChar.ToString())) { - contentFilePath = contentFilePath.TrimStart( - System.IO.Path.DirectorySeparatorChar); + contentFilePath = contentFilePath.TrimStart(Path.DirectorySeparatorChar); } else { //do nothing } - contentFilePath = System.IO.Path.Combine(_certPath, contentFilePath); + contentFilePath = Path.Combine(_certPath, contentFilePath); //Check for the folder already exists. If not then create that folder - if (System.IO.Directory.Exists( - System.IO.Path.GetDirectoryName(contentFilePath)) != true) + if (Directory.Exists(Path.GetDirectoryName(contentFilePath)) != true) { - System.IO.Directory.CreateDirectory( - System.IO.Path.GetDirectoryName(contentFilePath)); + Directory.CreateDirectory(Path.GetDirectoryName(contentFilePath)); } else { //do nothing } - System.IO.FileStream newFileStream = - System.IO.File.Create(contentFilePath); + var newFileStream = File.Create(contentFilePath); newFileStream.Close(); byte[] content = new byte[contentFile.GetStream().Length]; contentFile.GetStream().Read(content, 0, content.Length); - System.IO.File.WriteAllBytes(contentFilePath, content); - + File.WriteAllBytes(contentFilePath, content); } /// @@ -422,7 +405,8 @@ private void CopyStream(Stream source, Stream target) { const int bufSize = 0x1000; byte[] buf = new byte[bufSize]; - int bytesRead = 0; + int bytesRead; + while ((bytesRead = source.Read(buf, 0, bufSize)) > 0) target.Write(buf, 0, bytesRead); } diff --git a/src/VSNDK.Package/UpdateManager/Model/UpdateManagerData.cs b/src/VSNDK.Package/UpdateManager/Model/UpdateManagerData.cs index 7219b99a..960d102d 100644 --- a/src/VSNDK.Package/UpdateManager/Model/UpdateManagerData.cs +++ b/src/VSNDK.Package/UpdateManager/Model/UpdateManagerData.cs @@ -14,20 +14,14 @@ using System; using System.Collections.Generic; +using System.Diagnostics; using System.Linq; -using System.Text; using System.ComponentModel; using System.Windows.Data; -using RIM.VSNDK_Package.Settings; -using RIM.VSNDK_Package.DebugToken; using System.IO; -using System.Xml; -using System.Linq; using System.Windows; using RIM.VSNDK_Package.DebugToken.Model; using Microsoft.Win32; -using Microsoft.VisualStudio.Shell; -using System.Security.Cryptography; using System.Management; namespace RIM.VSNDK_Package.UpdateManager.Model @@ -224,7 +218,7 @@ public bool InstallAPI(string version, bool isRuntime, bool isSimulator) { installProcessID.Add(Convert.ToInt32(item["ProcessId"].ToString())); } - catch (Exception e) + catch (Exception) { } } @@ -428,7 +422,6 @@ private int IsAPIInstalled(string version, string name) public bool validateDeviceVersion(bool isSim) { bool retVal = false; - string baseVersion = "10.2.0.0"; string currentAPIVersion = getCurrentAPIVersion(); DebugTokenData dtokenData; @@ -515,14 +508,14 @@ public bool validateDeviceVersion(bool isSim) private string getBuildVersion() { string makefile = ""; - System.IO.StreamReader readMakefile = null; + StreamReader readMakefile; try { - readMakefile = new System.IO.StreamReader(_outputPath + @"\makefile"); + readMakefile = new StreamReader(_outputPath + @"\makefile"); makefile = readMakefile.ReadToEnd(); readMakefile.Close(); } - catch (Exception e) + catch (Exception) { return ""; } @@ -570,9 +563,8 @@ private int compareVersions(string str1, string str2) if (n1 > n2) return 1; - else if (n2 > n1) + if (n2 > n1) return -1; - } while ((str1 != "") && (str2 != "")); if (str1 != "") @@ -597,20 +589,21 @@ private int compareVersions(string str1, string str2) /// True if successful public bool getDeviceInfo() { - bool success = false; + bool success; + + Process p = new Process(); + ProcessStartInfo startInfo = p.StartInfo; - System.Diagnostics.Process p = new System.Diagnostics.Process(); - System.Diagnostics.ProcessStartInfo startInfo = p.StartInfo; startInfo.UseShellExecute = false; startInfo.CreateNoWindow = true; startInfo.RedirectStandardError = true; startInfo.RedirectStandardOutput = true; - p.ErrorDataReceived += new System.Diagnostics.DataReceivedEventHandler(p_ErrorDataReceived); - p.OutputDataReceived += new System.Diagnostics.DataReceivedEventHandler(DeviceInfoDataReceived); + p.ErrorDataReceived += p_ErrorDataReceived; + p.OutputDataReceived += DeviceInfoDataReceived; /// Get Device PIN startInfo.FileName = "cmd.exe"; - startInfo.WorkingDirectory = System.Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86) + "\\BlackBerry\\VSPlugin-NDK\\qnxtools\\bin\\"; + startInfo.WorkingDirectory = Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86) + "\\BlackBerry\\VSPlugin-NDK\\qnxtools\\bin\\"; startInfo.Arguments = string.Format("/C blackberry-deploy.bat -listDeviceInfo {0} {1}", DeviceIP, DevicePassword == "" ? "" : "-password " + DevicePassword); try @@ -646,8 +639,8 @@ public bool getDeviceInfo() } catch (Exception e) { - System.Diagnostics.Debug.WriteLine(startInfo.Arguments); - System.Diagnostics.Debug.WriteLine(e.Message); + Debug.WriteLine(startInfo.Arguments); + Debug.WriteLine(e.Message); success = false; if (_errors != "") { @@ -674,26 +667,28 @@ public bool getDeviceInfo() /// /// /// - private void DeviceInfoDataReceived(object sender, System.Diagnostics.DataReceivedEventArgs e) + private void DeviceInfoDataReceived(object sender, DataReceivedEventArgs e) { if (e.Data != null) { - System.Diagnostics.Debug.WriteLine(e.Data); + Debug.WriteLine(e.Data); if (e.Data.Contains("Error:")) _errors += e.Data + "\n"; else if (e.Data.Contains("scmbundle::")) _deviceosversion = e.Data.Substring(e.Data.LastIndexOf("::") + 2); } - } /// + } + + /// /// On Data Received event handler /// /// /// - private void p_OutputDataReceived(object sender, System.Diagnostics.DataReceivedEventArgs e) + private void p_OutputDataReceived(object sender, DataReceivedEventArgs e) { if (e.Data != null) { - System.Diagnostics.Debug.WriteLine(e.Data); + Debug.WriteLine(e.Data); if (e.Data.Contains("Error:")) _errors += e.Data + "\n"; else if (e.Data.Contains("scmbundle::")) @@ -705,7 +700,7 @@ private void p_OutputDataReceived(object sender, System.Diagnostics.DataReceived /// Retrieve a list of the installed runtimes on the PC. /// /// - private bool getInstalledRuntimeTargetList() + private bool GetInstalledRuntimeTargetList() { bool success = false; @@ -992,7 +987,7 @@ public bool IsRuntimeInstalled(string version) { bool success = false; - getInstalledRuntimeTargetList(); + GetInstalledRuntimeTargetList(); if (installedRuntimeList != null) { diff --git a/src/VSNDK.Package/UpdateManager/SimulatorManager.xaml b/src/VSNDK.Package/UpdateManager/SimulatorManager.xaml index 5de1e504..f495010c 100644 --- a/src/VSNDK.Package/UpdateManager/SimulatorManager.xaml +++ b/src/VSNDK.Package/UpdateManager/SimulatorManager.xaml @@ -22,7 +22,7 @@ - public partial class UpdateManager : Window { - private UpdateManagerData data = null; + private readonly UpdateManagerData _data; /// /// Constructor @@ -45,18 +34,17 @@ private UpdateManager() InitializeComponent(); - data = new UpdateManagerData(); + _data = new UpdateManagerData(); - gridMain.DataContext = data; - this.Close.IsEnabled = true; - this.Simulators.IsEnabled = true; + gridMain.DataContext = _data; + Simulators.IsEnabled = true; } - public static UpdateManager create() + public static UpdateManager Create() { if (!GlobalFunctions.isOnline()) { - System.Windows.MessageBox.Show("You are currently experiencing internet connection issues and cannot access the Update Manager server. Please check your connection or try again later.", "Settings", MessageBoxButton.OK, MessageBoxImage.Warning, MessageBoxResult.OK); + MessageBox.Show("You are currently experiencing internet connection issues and cannot access the Update Manager server. Please check your connection or try again later.", "Settings", MessageBoxButton.OK, MessageBoxImage.Warning, MessageBoxResult.OK); return null; } else @@ -73,7 +61,7 @@ public static UpdateManager create() /// private void Close_Click(object sender, RoutedEventArgs e) { - DialogResult = data.installed; + DialogResult = _data.installed; } /// @@ -95,11 +83,11 @@ private void Install_Click(object sender, RoutedEventArgs e) { if (!GlobalFunctions.isOnline()) { - System.Windows.MessageBox.Show("You are currently experiencing internet connection issues and cannot access the Update Manager server. Please check your connection or try again later.", "Settings", MessageBoxButton.OK, MessageBoxImage.Warning, MessageBoxResult.OK); + MessageBox.Show("You are currently experiencing internet connection issues and cannot access the Update Manager server. Please check your connection or try again later.", "Settings", MessageBoxButton.OK, MessageBoxImage.Warning, MessageBoxResult.OK); } else { - this.Simulators.IsEnabled = false; + Simulators.IsEnabled = false; data.InstallAPI(((APITargetClass)((StackPanel)((Button)sender).Parent).DataContext).TargetVersion, false, false); } } @@ -181,11 +169,11 @@ private void Update_Click(object sender, RoutedEventArgs e) /// private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e) { - if ((!data.installed) && (data.IsInstalling)) + if ((!_data.installed) && (_data.IsInstalling)) { - if (data.isConfiguring) + if (_data.isConfiguring) { - data.waitTerminateInstallation(); + _data.waitTerminateInstallation(); } else { @@ -196,15 +184,15 @@ private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs } else { - if (data.isConfiguring) + if (_data.isConfiguring) { - data.waitTerminateInstallation(); + _data.waitTerminateInstallation(); } else { - data.cancelInstallation(); - data.installed = false; - data.Error = "Download cancelled by the user. You must be able to debug only after completing the download."; + _data.cancelInstallation(); + _data.installed = false; + _data.Error = "Download cancelled by the user. You must be able to debug only after completing the download."; } } } diff --git a/src/VSNDK.Package/VSNDK.PackagePackage.cs b/src/VSNDK.Package/VSNDK.PackagePackage.cs index 35285080..132ccb30 100644 --- a/src/VSNDK.Package/VSNDK.PackagePackage.cs +++ b/src/VSNDK.Package/VSNDK.PackagePackage.cs @@ -19,9 +19,7 @@ using System.ComponentModel.Design; using Microsoft.Win32; using Microsoft.VisualStudio; -using Microsoft.VisualStudio.VCProjectEngine; using Microsoft.VisualStudio.Shell.Interop; -using Microsoft.VisualStudio.OLE.Interop; using Microsoft.VisualStudio.Shell; using System.Xml; using System.IO; @@ -29,7 +27,6 @@ using System.Linq; using EnvDTE; using System.Windows.Forms; -using VSNDK.Package; using EnvDTE80; using System.Text.RegularExpressions; using System.Collections.Specialized; @@ -248,7 +245,7 @@ private void GetInstalledAPIList() } } } - catch (Exception ex) + catch (Exception) { } @@ -311,7 +308,7 @@ private void GetInstalledNDKList() { _installedNDKList = new List(); - string dirPaths = System.Environment.GetFolderPath(System.Environment.SpecialFolder.LocalApplicationData) + @"\Research In Motion\BlackBerry Native SDK\qconfig\"; + string dirPaths = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + @"\Research In Motion\BlackBerry Native SDK\qconfig\"; string[] filePaths = Directory.GetFiles(dirPaths, "*.xml"); foreach (string file in filePaths) @@ -334,7 +331,7 @@ private void GetInstalledNDKList() } } } - catch (Exception ex) + catch (Exception) { } @@ -374,14 +371,15 @@ private void GetDefaultAPIList() { if (GlobalFunctions.isOnline()) { - System.Diagnostics.Process p = new System.Diagnostics.Process(); - System.Diagnostics.ProcessStartInfo startInfo = p.StartInfo; + var p = new System.Diagnostics.Process(); + ProcessStartInfo startInfo = p.StartInfo; + startInfo.UseShellExecute = false; startInfo.CreateNoWindow = true; startInfo.RedirectStandardError = true; startInfo.RedirectStandardOutput = true; - p.ErrorDataReceived += new System.Diagnostics.DataReceivedEventHandler(ErrorDataReceived); - p.OutputDataReceived += new System.Diagnostics.DataReceivedEventHandler(APIListDefaultsDataReceived); + p.ErrorDataReceived += ErrorDataReceived; + p.OutputDataReceived += APIListDefaultsDataReceived; /// Get Device PIN @@ -411,8 +409,8 @@ private void GetDefaultAPIList() } catch (Exception e) { - System.Diagnostics.Debug.WriteLine(startInfo.Arguments); - System.Diagnostics.Debug.WriteLine(e.Message); + Debug.WriteLine(startInfo.Arguments); + Debug.WriteLine(e.Message); } } @@ -423,11 +421,8 @@ private void GetDefaultAPIList() /// /// /// - private void APIListDefaultsDataReceived(object sender, System.Diagnostics.DataReceivedEventArgs e) + private void APIListDefaultsDataReceived(object sender, DataReceivedEventArgs e) { - string version = ""; - string name = ""; - if (e.Data != null) { if ((e.Data.ToLower().Contains("error")) || (_error != "")) @@ -440,8 +435,8 @@ private void APIListDefaultsDataReceived(object sender, System.Diagnostics.DataR } else { - version = e.Data.Substring(0, e.Data.LastIndexOf(" - ")); - name = e.Data.Substring(e.Data.LastIndexOf(" - ") + 3); + string version = e.Data.Substring(0, e.Data.LastIndexOf(" - ")); + string name = e.Data.Substring(e.Data.LastIndexOf(" - ") + 3); APITargetClass api = _tempAPITargetList.Find(i => i.TargetVersion == version); @@ -463,14 +458,14 @@ private void GetAvailableAPIList() { if (GlobalFunctions.isOnline()) { - System.Diagnostics.Process p = new System.Diagnostics.Process(); - System.Diagnostics.ProcessStartInfo startInfo = p.StartInfo; + var p = new System.Diagnostics.Process(); + var startInfo = p.StartInfo; startInfo.UseShellExecute = false; startInfo.CreateNoWindow = true; startInfo.RedirectStandardError = true; startInfo.RedirectStandardOutput = true; - p.ErrorDataReceived += new System.Diagnostics.DataReceivedEventHandler(ErrorDataReceived); - p.OutputDataReceived += new System.Diagnostics.DataReceivedEventHandler(APIListDataReceived); + p.ErrorDataReceived += ErrorDataReceived; + p.OutputDataReceived += APIListDataReceived; /// Get Device PIN @@ -502,8 +497,8 @@ private void GetAvailableAPIList() } catch (Exception e) { - System.Diagnostics.Debug.WriteLine(startInfo.Arguments); - System.Diagnostics.Debug.WriteLine(e.Message); + Debug.WriteLine(startInfo.Arguments); + Debug.WriteLine(e.Message); } } @@ -514,13 +509,8 @@ private void GetAvailableAPIList() /// /// /// - private void APIListDataReceived(object sender, System.Diagnostics.DataReceivedEventArgs e) + private void APIListDataReceived(object sender, DataReceivedEventArgs e) { - string name = ""; - string description = ""; - string version = ""; - APITargetClass api = null; - if (e.Data != null) { if ((e.Data.ToLower().Contains("error")) || (_error != "")) @@ -533,13 +523,10 @@ private void APIListDataReceived(object sender, System.Diagnostics.DataReceivedE } else { - version = e.Data.Substring(0, e.Data.LastIndexOf(" - ")); - name = e.Data.Substring(e.Data.LastIndexOf(" - ") + 3); - name = name.Replace("(EXTERNAL_NDK)", ""); - description = "Device Support Unknown."; - - - api = _tempAPITargetList.Find(i => i.TargetName == name); + string version = e.Data.Substring(0, e.Data.LastIndexOf(" - ")); + string name = e.Data.Substring(e.Data.LastIndexOf(" - ") + 3).Replace("(EXTERNAL_NDK)", ""); + string description = "Device Support Unknown."; + APITargetClass api = _tempAPITargetList.Find(i => i.TargetName == name); if (api == null) { @@ -612,11 +599,11 @@ private int IsAPIInstalled(string version, string name) /// /// /// - private void ErrorDataReceived(object sender, System.Diagnostics.DataReceivedEventArgs e) + private void ErrorDataReceived(object sender, DataReceivedEventArgs e) { if (e.Data != null) { - System.Diagnostics.Debug.WriteLine(e.Data); + Debug.WriteLine(e.Data); _error += e.Data + "\n"; // MessageBox.Show(e.Data); } @@ -689,14 +676,14 @@ private void GetSimulatorList() { if (GlobalFunctions.isOnline()) { - System.Diagnostics.Process p = new System.Diagnostics.Process(); - System.Diagnostics.ProcessStartInfo startInfo = p.StartInfo; + var p = new System.Diagnostics.Process(); + var startInfo = p.StartInfo; startInfo.UseShellExecute = false; startInfo.CreateNoWindow = true; startInfo.RedirectStandardError = true; startInfo.RedirectStandardOutput = true; - p.ErrorDataReceived += new System.Diagnostics.DataReceivedEventHandler(ErrorDataReceived); - p.OutputDataReceived += new System.Diagnostics.DataReceivedEventHandler(SimulatorListDataReceived); + p.ErrorDataReceived += ErrorDataReceived; + p.OutputDataReceived += SimulatorListDataReceived; /// Get Device PIN startInfo.FileName = "cmd.exe"; @@ -727,8 +714,8 @@ private void GetSimulatorList() } catch (Exception e) { - System.Diagnostics.Debug.WriteLine(startInfo.Arguments); - System.Diagnostics.Debug.WriteLine(e.Message); + Debug.WriteLine(startInfo.Arguments); + Debug.WriteLine(e.Message); } } } @@ -738,11 +725,11 @@ private void GetSimulatorList() /// /// /// - private void ErrorDataReceived(object sender, System.Diagnostics.DataReceivedEventArgs e) + private void ErrorDataReceived(object sender, DataReceivedEventArgs e) { if (e.Data != null) { - System.Diagnostics.Debug.WriteLine(e.Data); + Debug.WriteLine(e.Data); _error += e.Data + "\n"; // MessageBox.Show(e.Data); } @@ -753,13 +740,8 @@ private void ErrorDataReceived(object sender, System.Diagnostics.DataReceivedEve /// /// /// - private void SimulatorListDataReceived(object sender, System.Diagnostics.DataReceivedEventArgs e) + private void SimulatorListDataReceived(object sender, DataReceivedEventArgs e) { - string apilevel = ""; - string version = ""; - - SimulatorsClass sim = null; - if (e.Data != null) { if ((e.Data.ToLower().Contains("error")) || (_error != "")) @@ -772,10 +754,10 @@ private void SimulatorListDataReceived(object sender, System.Diagnostics.DataRec } else { - version = e.Data.Substring(0, e.Data.LastIndexOf(" - ")); - apilevel = version.Split('.')[0] + "." + version.Split('.')[1]; + string version = e.Data.Substring(0, e.Data.LastIndexOf(" - ")); + string apilevel = version.Split('.')[0] + "." + version.Split('.')[1]; - sim = _simulatorList.Find(i => i.APILevel == apilevel); + SimulatorsClass sim = _simulatorList.Find(i => i.APILevel == apilevel); if (sim == null) { @@ -926,26 +908,24 @@ public bool GetInstalledSimulatorList() // This attribute is needed to let the shell know that this package exposes some menus. [ProvideMenuResource("Menus.ctmenu", 1)] // This attribute registers a tool window exposed by this package. - [ProvideAutoLoad(Microsoft.VisualStudio.Shell.Interop.UIContextGuids80.SolutionExists)] + [ProvideAutoLoad(UIContextGuids80.SolutionExists)] [Guid(GuidList.guidVSNDK_PackagePkgString)] public sealed class VSNDK_PackagePackage : Package { - #region private member variables - private EnvDTE.DTE _dte; + private DTE _dte; private VSNDKCommandEvents _commandEvents; private bool _isSimulator; private BuildEvents _buildEvents; - private List _targetDir = null; - private List buildThese = null; - private bool _hitPlay = false; - private int _amountOfProjects = 0; - private string _error = ""; - private bool _isDeploying = false; + private List _targetDir; + private List _buildThese; + private bool _hitPlay; + private int _amountOfProjects; + private bool _isDeploying; private OutputWindowPane _owP; - private bool isDebugConfiguration = true; - private string processName = ""; + private bool _isDebugConfiguration = true; + private string _processName = ""; #endregion @@ -960,7 +940,7 @@ public sealed class VSNDK_PackagePackage : Package /// public VSNDK_PackagePackage() { - Trace.WriteLine(string.Format(CultureInfo.CurrentCulture, "Entering constructor for: {0}", this.ToString())); + Trace.WriteLine(string.Format(CultureInfo.CurrentCulture, "Entering constructor for: {0}", ToString())); } /// @@ -969,11 +949,11 @@ public VSNDK_PackagePackage() /// protected override void Initialize() { - Trace.WriteLine (string.Format(CultureInfo.CurrentCulture, "Entering Initialize() of: {0}", this.ToString())); + Trace.WriteLine (string.Format(CultureInfo.CurrentCulture, "Entering Initialize() of: {0}", ToString())); base.Initialize(); //Create Editor Factory. Note that the base Package class will call Dispose on it. - base.RegisterEditorFactory(new EditorFactory(this)); + RegisterEditorFactory(new EditorFactory(this)); APITargetListSingleton api = APITargetListSingleton.Instance; @@ -982,7 +962,7 @@ protected override void Initialize() SimulatorListSingleton simList = SimulatorListSingleton.Instance; InstalledSimulatorListSingleton installedSimList = InstalledSimulatorListSingleton.Instance; - _dte = (EnvDTE.DTE)GetService(typeof(EnvDTE.DTE)); + _dte = (DTE)GetService(typeof(DTE)); if ((IsBlackBerrySolution(_dte)) && (apiList._installedAPIList.Count == 0)) { @@ -999,7 +979,7 @@ protected override void Initialize() _commandEvents.RegisterCommand(GuidList.guidVSStd2KString, CommandConstants.cmdidStartDebugContext, startDebugCommandEvents_AfterExecute, startDebugCommandEvents_BeforeExecute); _buildEvents = _dte.Events.BuildEvents; - _buildEvents.OnBuildBegin += new _dispBuildEvents_OnBuildBeginEventHandler(this.OnBuildBegin); + _buildEvents.OnBuildBegin += OnBuildBegin; @@ -1023,7 +1003,7 @@ protected override void Initialize() mcs.AddCommand(menuDebugTokenWin); // Create the command for the menu item. - CommandID projCommandID = new CommandID(GuidList.guidVSNDK_PackageCmdSet, (int)PkgCmdIDList.cmdidfooLocalBox); + CommandID projCommandID = new CommandID(GuidList.guidVSNDK_PackageCmdSet, PkgCmdIDList.cmdidfooLocalBox); OleMenuCommand projItem = new OleMenuCommand(MenuItemCallback, projCommandID); mcs.AddCommand(projItem); } @@ -1127,7 +1107,7 @@ private bool BuildBar() bool success = true; try { - if (buildThese.Count != 0) + if (_buildThese.Count != 0) { Microsoft.Win32.RegistryKey key; key = Microsoft.Win32.Registry.CurrentUser.CreateSubKey("VSNDK"); @@ -1140,8 +1120,8 @@ private bool BuildBar() { Solution2 soln = (Solution2)_dte.Solution; _hitPlay = true; - _amountOfProjects = buildThese.Count; // OnBuildDone will call build() only after receiving "amountOfProjects" events - foreach (string projectName in buildThese) + _amountOfProjects = _buildThese.Count; // OnBuildDone will call build() only after receiving "amountOfProjects" events + foreach (string projectName in _buildThese) soln.SolutionBuild.BuildProject("Debug", projectName, false); } catch (Exception ex) @@ -1175,7 +1155,7 @@ private void Built() if ((outputText == "") || (System.Text.RegularExpressions.Regex.IsMatch(outputText, ">Build succeeded.\r\n")) || (!outputText.Contains("): error :"))) { - if (isDebugConfiguration) + if (_isDebugConfiguration) { // Write file to flag the deploy task that it should use the -debugNative option string fileContent = "Use -debugNative.\r\n"; @@ -1222,7 +1202,7 @@ private void Deployed() string targetIP = ""; string password = ""; string executablePath = ""; - if (getProcessInfo((DTE2)_dte, ref pidString, ref toolsPath, ref publicKeyPath, ref targetIP, ref password, ref executablePath)) + if (GetProcessInfo((DTE2)_dte, ref pidString, ref toolsPath, ref publicKeyPath, ref targetIP, ref password, ref executablePath)) { bool CancelDefault = LaunchDebugTarget(pidString, toolsPath, publicKeyPath, targetIP, password, executablePath); } @@ -1266,8 +1246,8 @@ private bool LaunchDebugTarget(string pidString, string toolsPath, string public info.clsidCustom = new Guid("{E5A37609-2F43-4830-AA85-D94CFA035DD2}"); // Set the launching engine the VSNDK engine guid info.grfLaunch = 0; - IntPtr pInfo = System.Runtime.InteropServices.Marshal.AllocCoTaskMem((int)info.cbSize); - System.Runtime.InteropServices.Marshal.StructureToPtr(info, pInfo, false); + IntPtr pInfo = Marshal.AllocCoTaskMem((int)info.cbSize); + Marshal.StructureToPtr(info, pInfo, false); try { @@ -1287,7 +1267,7 @@ private bool LaunchDebugTarget(string pidString, string toolsPath, string public { if (pInfo != IntPtr.Zero) { - System.Runtime.InteropServices.Marshal.FreeCoTaskMem(pInfo); + Marshal.FreeCoTaskMem(pInfo); } } @@ -1300,20 +1280,20 @@ private bool LaunchDebugTarget(string pidString, string toolsPath, string public /// Application Object. /// Returns the Process ID as a string. /// TRUE if successful, False if not. - private bool getProcessInfo(DTE2 dte, ref string pidString, ref string toolsPath, ref string publicKeyPath, ref string targetIP, ref string password, ref string executablePath) + private bool GetProcessInfo(DTE2 dte, ref string pidString, ref string toolsPath, ref string publicKeyPath, ref string targetIP, ref string password, ref string executablePath) { string currentPath = ""; foreach (string[] paths in _targetDir) { - if (paths[0] == processName) + if (paths[0] == _processName) { currentPath = paths[1]; break; } } - executablePath = currentPath + processName; // The executable path + executablePath = currentPath + _processName; // The executable path executablePath = executablePath.Replace('\\', '/'); publicKeyPath = Environment.GetEnvironmentVariable("AppData") + @"\BlackBerry\bbt_id_rsa.pub"; publicKeyPath = publicKeyPath.Replace('\\', '/'); @@ -1322,7 +1302,7 @@ private bool getProcessInfo(DTE2 dte, ref string pidString, ref string toolsPath { RegistryKey rkHKCU = Registry.CurrentUser; RegistryKey rkPluginRegKey = rkHKCU.OpenSubKey("Software\\BlackBerry\\BlackBerryVSPlugin"); - toolsPath = rkPluginRegKey.GetValue("NDKHostPath").ToString() + "/usr/bin"; + toolsPath = rkPluginRegKey.GetValue("NDKHostPath") + "/usr/bin"; toolsPath = toolsPath.Replace('\\', '/'); if (_isSimulator) @@ -1346,10 +1326,10 @@ private bool getProcessInfo(DTE2 dte, ref string pidString, ref string toolsPath } catch (Exception ex) { - System.Windows.Forms.MessageBox.Show(ex.Message, "Microsoft Visual Studio", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error); + MessageBox.Show(ex.Message, "Microsoft Visual Studio", MessageBoxButtons.OK, MessageBoxIcon.Error); } - pidString = getPIDfromGDB(processName, targetIP, password, _isSimulator, toolsPath, publicKeyPath); + pidString = getPIDfromGDB(_processName, targetIP, password, _isSimulator, toolsPath, publicKeyPath); if (pidString == "") { @@ -1358,7 +1338,7 @@ private bool getProcessInfo(DTE2 dte, ref string pidString, ref string toolsPath string outputText = _owP.TextDocument.Selection.Text; // Check for successful deployment - if (System.Text.RegularExpressions.Regex.IsMatch(outputText, "Info: done")) + if (Regex.IsMatch(outputText, "Info: done")) { string pattern = @"\s+result::(\d+)\r\n.+|\s+result::(\d+) \(TaskId:"; Regex r = new Regex(pattern, RegexOptions.IgnoreCase); @@ -1392,44 +1372,44 @@ private bool getProcessInfo(DTE2 dte, ref string pidString, ref string toolsPath // Store proccess name and file location into ProcessesPath.txt, so "Attach To Process" would be able to find the // source code for a running process. // First read the file. - processName += "_" + _isSimulator.ToString(); + _processName += "_" + _isSimulator.ToString(); - string processesPaths = ""; - System.IO.StreamReader readProcessesPathsFile = null; + string processesPaths; + StreamReader readProcessesPathsFile; try { - readProcessesPathsFile = new System.IO.StreamReader(System.Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + @"\Research In Motion\ProcessesPath.txt"); + readProcessesPathsFile = new StreamReader(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + @"\Research In Motion\ProcessesPath.txt"); processesPaths = readProcessesPathsFile.ReadToEnd(); readProcessesPathsFile.Close(); } - catch (Exception e) + catch (Exception) { processesPaths = ""; } // Updating the contents. - int begin = processesPaths.IndexOf(processName + ":>"); + int begin = processesPaths.IndexOf(_processName + ":>"); if (begin != -1) { - begin += processName.Length + 2; + begin += _processName.Length + 2; int end = processesPaths.IndexOf("\r\n", begin); processesPaths = processesPaths.Substring(0, begin) + currentPath + processesPaths.Substring(end); } else { - processesPaths = processesPaths + processName + ":>" + currentPath + "\r\n"; + processesPaths = processesPaths + _processName + ":>" + currentPath + "\r\n"; } // Writing contents to file. - System.IO.StreamWriter writeProcessesPathsFile = null; + StreamWriter writeProcessesPathsFile; try { - writeProcessesPathsFile = new System.IO.StreamWriter(System.Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + @"\Research In Motion\ProcessesPath.txt", false); + writeProcessesPathsFile = new StreamWriter(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + @"\Research In Motion\ProcessesPath.txt", false); writeProcessesPathsFile.Write(processesPaths); writeProcessesPathsFile.Close(); } - catch (Exception e) + catch (Exception) { } @@ -1540,7 +1520,7 @@ private void startDebugCommandEvents_BeforeExecute(string Guid, int ID, object C bool bbPlatform = false; if (_dte.Solution.SolutionBuild.ActiveConfiguration != null) { - isDebugConfiguration = checkDebugConfiguration(); + _isDebugConfiguration = checkDebugConfiguration(); SolutionContexts scCollection = _dte.Solution.SolutionBuild.ActiveConfiguration.SolutionContexts; foreach (SolutionContext sc in scCollection) @@ -1568,7 +1548,7 @@ private void startDebugCommandEvents_BeforeExecute(string Guid, int ID, object C try { Solution2 soln = (Solution2)_dte.Solution; - buildThese = new List(); + _buildThese = new List(); _targetDir = new List(); foreach (String startupProject in (Array)soln.SolutionBuild.StartupProjects) @@ -1577,8 +1557,8 @@ private void startDebugCommandEvents_BeforeExecute(string Guid, int ID, object C { if (p1.UniqueName == startupProject) { - buildThese.Add(p1.FullName); - processName = p1.Name; + _buildThese.Add(p1.FullName); + _processName = p1.Name; ConfigurationManager config = p1.ConfigurationManager; Configuration active = config.ActiveConfiguration; @@ -1622,7 +1602,7 @@ private void startDebugCommandEvents_BeforeExecute(string Guid, int ID, object C _owP.Activate(); - if (isDebugConfiguration) + if (_isDebugConfiguration) { UpdateManagerData upData; if (_targetDir.Count > 0) diff --git a/src/VSNDK.Package/VsDesignerControl.xaml.cs b/src/VSNDK.Package/VsDesignerControl.xaml.cs index 7de1ae8c..9c89398c 100644 --- a/src/VSNDK.Package/VsDesignerControl.xaml.cs +++ b/src/VSNDK.Package/VsDesignerControl.xaml.cs @@ -13,18 +13,9 @@ //* limitations under the License. using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; using System.Windows; using System.Windows.Controls; -using System.Windows.Data; -using System.Windows.Documents; using System.Windows.Input; -using System.Windows.Media; -using System.Windows.Media.Imaging; -using System.Windows.Navigation; -using System.Windows.Shapes; using EnvDTE; using Microsoft.VisualStudio.Shell; using System.IO; @@ -36,7 +27,7 @@ namespace RIM.VSNDK_Package /// public partial class VsDesignerControl : UserControl { - private ServiceProvider _serviceProvider; + private readonly ServiceProvider _serviceProvider; /// /// Primary Constructor /// @@ -55,7 +46,7 @@ public VsDesignerControl(ServiceProvider serviceProvider, IViewModel viewModel) DataContext = viewModel; InitializeComponent(); // wait until we're initialized to handle events - viewModel.ViewModelChanged += new EventHandler(ViewModelChanged); + viewModel.ViewModelChanged += ViewModelChanged; } internal void DoIdle() @@ -64,7 +55,7 @@ internal void DoIdle() // otherwise, we should skip and this will be called again // once focus is regained IViewModel viewModel = DataContext as IViewModel; - if (viewModel != null && this.IsKeyboardFocusWithin) + if (viewModel != null && IsKeyboardFocusWithin) { viewModel.DoIdle(); } @@ -91,7 +82,7 @@ private void ViewModelChanged(object sender, EventArgs e) /// private Boolean IsTextAllowed(String text) { - return Array.TrueForAll(text.ToCharArray(), + return Array.TrueForAll(text.ToCharArray(), delegate(Char c) { return Char.IsDigit(c) || Char.IsControl(c); }); } @@ -159,7 +150,7 @@ private void AddIconToProject(string path) try { DTE dte = (DTE)_serviceProvider.GetService(typeof(DTE)); - string solutionDir = System.IO.Path.GetDirectoryName(dte.Solution.FullName); + string solutionDir = Path.GetDirectoryName(dte.Solution.FullName); Projects projs = dte.Solution.Projects; @@ -181,7 +172,7 @@ private void AddIconToProject(string path) } } } - catch (Exception e) + catch (Exception) { } @@ -251,7 +242,7 @@ private void CheckBox_Click(object sender, RoutedEventArgs e) if (viewModel != null) { viewModel.UnCheckPermission((grdPermissions.SelectedItem as PermissionItemClass).Identifier); - }; + } } } @@ -290,19 +281,17 @@ private void btnRemoveAsset_Click(object sender, RoutedEventArgs e) private void CheckBox_Click_1(object sender, RoutedEventArgs e) { - bool isPublic = false; - IViewModel viewModel = DataContext as IViewModel; if (viewModel != null) { - isPublic = (sender as CheckBox).IsChecked == true; + bool isPublic = (sender as CheckBox).IsChecked == true; viewModel.EditLocalAsset((grdAssets.SelectedItem as asset).Value, isPublic, ""); } } private void ComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e) { - string assetType = ""; + string assetType; if (e.RemovedItems.Count != 0) { diff --git a/src/VSNDK.Tasks/AsyncExec.cs b/src/VSNDK.Tasks/AsyncExec.cs index 27156d93..ed032d95 100644 --- a/src/VSNDK.Tasks/AsyncExec.cs +++ b/src/VSNDK.Tasks/AsyncExec.cs @@ -13,14 +13,11 @@ //* limitations under the License. using System; -using System.Collections.Generic; -using System.Linq; using System.Text; using Microsoft.Build.Tasks; using System.Diagnostics; using System.Collections; using System.Collections.Specialized; -using Microsoft.Build.Framework; using System.Security.Cryptography; namespace VSNDK.Tasks @@ -73,7 +70,7 @@ protected virtual ProcessStartInfo GetProcessStartInfo(string executable, string startInfo.WorkingDirectory = workingDirectory; } - StringDictionary environmentOverride = this.EnvironmentOverride; + StringDictionary environmentOverride = EnvironmentOverride; if (environmentOverride != null) { foreach (DictionaryEntry entry in environmentOverride) diff --git a/src/VSNDK.Tasks/CheckIfInstalled.cs b/src/VSNDK.Tasks/CheckIfInstalled.cs index 88266c3d..4013bfc8 100644 --- a/src/VSNDK.Tasks/CheckIfInstalled.cs +++ b/src/VSNDK.Tasks/CheckIfInstalled.cs @@ -13,11 +13,7 @@ //* limitations under the License. using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; using System.IO; -using System.Collections; using Microsoft.Build.Framework; using Microsoft.Build.Utilities; @@ -57,7 +53,7 @@ public override bool Execute() return true; } - catch (Exception ex) + catch (Exception) { return false; } diff --git a/src/VSNDK.Tasks/MakeAllAndFormatOutputMessages.cs b/src/VSNDK.Tasks/MakeAllAndFormatOutputMessages.cs index 2dfcefe2..8c97c5c0 100644 --- a/src/VSNDK.Tasks/MakeAllAndFormatOutputMessages.cs +++ b/src/VSNDK.Tasks/MakeAllAndFormatOutputMessages.cs @@ -13,17 +13,10 @@ //* limitations under the License. using System; -using System.Collections.Generic; -using System.Linq; using System.Text; -using EnvDTE; -using EnvDTE80; using System.Runtime.InteropServices; using System.IO; -using System.Runtime.Serialization.Formatters.Binary; -using System.Runtime.Serialization; using System.Diagnostics; -using Microsoft.Build.Utilities; using Microsoft.Build.Framework; using System.Text.RegularExpressions; @@ -37,14 +30,13 @@ public class MakeAllAndFormatOutputMessages : ICancelableTask #region Member Variables and Constants private string _projectDir; - private string _intDir; private string _outDir; - private static StringBuilder stdOutput = null; - private static StringBuilder errorOutput = null; - private IBuildEngine buildEngine; - private System.Diagnostics.Process proc = null; - private ITaskHost hostObject; + private static StringBuilder _stdOutput; + private static StringBuilder _errorOutput; + private IBuildEngine _buildEngine; + private Process _proc; + private ITaskHost _hostObject; private string _numProcessors; @@ -55,8 +47,8 @@ public class MakeAllAndFormatOutputMessages : ICancelableTask /// public IBuildEngine BuildEngine { - get { return buildEngine; } - set { buildEngine = value; } + get { return _buildEngine; } + set { _buildEngine = value; } } /// @@ -64,8 +56,8 @@ public IBuildEngine BuildEngine /// public ITaskHost HostObject { - get { return hostObject; } - set { hostObject = value; } + get { return _hostObject; } + set { _hostObject = value; } } /// @@ -122,9 +114,9 @@ public bool Execute() // The following commands are needed to redirect the standard and error outputs. // These streams are read asynchronously using an event handler. procStartInfo.RedirectStandardOutput = true; - stdOutput = new StringBuilder(""); + _stdOutput = new StringBuilder(""); procStartInfo.RedirectStandardError = true; - errorOutput = new StringBuilder(""); + _errorOutput = new StringBuilder(""); // Setting the work directory. string rootedOutDir = (Path.IsPathRooted(OutDir)) ? OutDir : ProjectDir + OutDir; @@ -134,19 +126,19 @@ public bool Execute() procStartInfo.CreateNoWindow = true; // Create a process and assign its ProcessStartInfo - proc = new System.Diagnostics.Process(); - proc.StartInfo = procStartInfo; + _proc = new Process(); + _proc.StartInfo = procStartInfo; // Set ours events handlers to asynchronously read the standard and error outputs. - proc.OutputDataReceived += new DataReceivedEventHandler(StdOutputHandler); - proc.ErrorDataReceived += new DataReceivedEventHandler(ErrorOutputHandler); + _proc.OutputDataReceived += StdOutputHandler; + _proc.ErrorDataReceived += ErrorOutputHandler; // Start the process - proc.Start(); + _proc.Start(); // Start the asynchronous read of the standard and error output stream. - proc.BeginOutputReadLine(); - proc.BeginErrorReadLine(); + _proc.BeginOutputReadLine(); + _proc.BeginErrorReadLine(); do { @@ -154,7 +146,7 @@ public bool Execute() // This code is correct, don't remove it. WaitForExit freezes the IDE while waiting for the end of the build process. // With this loop and the time out, the IDE won't be frozen enabling the build process to be cancelled. } - while (!proc.WaitForExit(1000)); + while (!_proc.WaitForExit(1000)); } catch (Exception e) @@ -163,14 +155,14 @@ public bool Execute() return false; } - if (errorOutput.ToString().IndexOf(": error:") == -1) + if (_errorOutput.ToString().IndexOf(": error:") == -1) { - int pos = errorOutput.ToString().LastIndexOf("\\make:"); + int pos = _errorOutput.ToString().LastIndexOf("\\make:"); if (pos == -1) return true; else { - pos = errorOutput.ToString().IndexOf("Error ", pos); + pos = _errorOutput.ToString().IndexOf("Error ", pos); if (pos == -1) return true; } @@ -339,7 +331,7 @@ private void ErrorOutputHandler(object sendingProcess, DataReceivedEventArgs out StringBuilder longPathName = new StringBuilder(1024); string shortPathName = newPath.Substring(0, end); GetLongPathName(shortPathName, longPathName, longPathName.Capacity); - newPath = longPathName.ToString() + newPath.Substring(end); + newPath = longPathName + newPath.Substring(end); } diff += (newPath.Length - oldPath.Length); @@ -495,7 +487,7 @@ private void ErrorOutputHandler(object sendingProcess, DataReceivedEventArgs out } // Add the text to the collected output. - errorOutput.Append(Environment.NewLine + outputText); + _errorOutput.Append(Environment.NewLine + outputText); } } @@ -543,7 +535,7 @@ public void Cancel() { try { - proc.Kill(); + _proc.Kill(); } catch (Exception ex) { diff --git a/src_vs2012/GDBParser/GDBParser.vcxproj b/src_vs2012/GDBParser/GDBParser.vcxproj index b9975869..c12f8528 100644 --- a/src_vs2012/GDBParser/GDBParser.vcxproj +++ b/src_vs2012/GDBParser/GDBParser.vcxproj @@ -152,7 +152,6 @@ - diff --git a/src_vs2012/GDBParser/GDBParser.vcxproj.filters b/src_vs2012/GDBParser/GDBParser.vcxproj.filters index 65cdd82f..d5f5bfa0 100644 --- a/src_vs2012/GDBParser/GDBParser.vcxproj.filters +++ b/src_vs2012/GDBParser/GDBParser.vcxproj.filters @@ -41,9 +41,6 @@ - - Header files - Header files diff --git a/src_vs2013/GDBParser/GDBParser.vcxproj b/src_vs2013/GDBParser/GDBParser.vcxproj index dd8078a3..7c23710b 100644 --- a/src_vs2013/GDBParser/GDBParser.vcxproj +++ b/src_vs2013/GDBParser/GDBParser.vcxproj @@ -151,7 +151,6 @@ - diff --git a/src_vs2013/GDBParser/GDBParser.vcxproj.filters b/src_vs2013/GDBParser/GDBParser.vcxproj.filters index 7b7ec312..0d58d6ad 100644 --- a/src_vs2013/GDBParser/GDBParser.vcxproj.filters +++ b/src_vs2013/GDBParser/GDBParser.vcxproj.filters @@ -44,9 +44,6 @@ Header files - - Header files - Header files From cb7c00a180fc81f9d9ba88ac81e5843c5807519a Mon Sep 17 00:00:00 2001 From: Pawel Hofman Date: Thu, 8 May 2014 16:48:55 +0200 Subject: [PATCH 023/851] VS-Package internals are visible by Test project --- src/VSNDK.Package/Properties/AssemblyInfo.cs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/VSNDK.Package/Properties/AssemblyInfo.cs b/src/VSNDK.Package/Properties/AssemblyInfo.cs index 028cbfa5..4270c1b5 100644 --- a/src/VSNDK.Package/Properties/AssemblyInfo.cs +++ b/src/VSNDK.Package/Properties/AssemblyInfo.cs @@ -24,7 +24,7 @@ [assembly: AssemblyTitle("VSNDK.Package")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("RIM")] +[assembly: AssemblyCompany("BlackBerry")] [assembly: AssemblyProduct("VSNDK.Package")] [assembly: AssemblyCopyright("")] [assembly: AssemblyTrademark("")] @@ -46,5 +46,7 @@ [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")] -[assembly: InternalsVisibleTo("VSNDK.Package_IntegrationTests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f5a9bc4f77b74406a37bfd1c314ff87e73c3404311e95f1647205a3f7999c2454f3c816605cdccadcfe97dd444464057a267f838f84329235313cbaa186299f30d0db843613692df338a72829294dbba2bd2ed08e22863aeba0a5b69bb8a96cf558bb0230e590b2122555bddd35088248726a1ca953ca6f7bbfd6f8ce971aec7")] -[assembly: InternalsVisibleTo("VSNDK.Package_UnitTests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f5a9bc4f77b74406a37bfd1c314ff87e73c3404311e95f1647205a3f7999c2454f3c816605cdccadcfe97dd444464057a267f838f84329235313cbaa186299f30d0db843613692df338a72829294dbba2bd2ed08e22863aeba0a5b69bb8a96cf558bb0230e590b2122555bddd35088248726a1ca953ca6f7bbfd6f8ce971aec7")] +#if DEBUG +[assembly: InternalsVisibleTo("VSNDK.Package.IntegrationTest")] +[assembly: InternalsVisibleTo("VSNDK.Package.Test")] +#endif From 62d998a2537f6f39cdbf9b08eecc1b1a0d915c3a Mon Sep 17 00:00:00 2001 From: Pawel Hofman Date: Thu, 8 May 2014 16:51:52 +0200 Subject: [PATCH 024/851] Abstraction for tool-runners (and result parsers) First implementation consumes data returned by blackberry-airpackager to get and consume info about debug-token. Simply test-cases included. --- src_vs2012/VSNDK.Package.Test/ParserTests.cs | 59 +++++ .../VSNDK.Package.Test/ToolRunnerTests.cs | 46 ++++ .../VSNDK.Package.Test.csproj | 2 + .../VSNDK.Package/Model/DebugTokenInfo.cs | 215 ++++++++++++++++++ .../Tools/DebugTokenInfoRunner.cs | 78 +++++++ .../VSNDK.Package/Tools/RunnerDefaults.cs | 32 +++ src_vs2012/VSNDK.Package/Tools/ToolRunner.cs | 188 +++++++++++++++ .../Tools/ToolRunnerEventArgs.cs | 32 +++ src_vs2012/VSNDK.Package/VSNDK.Package.csproj | 5 + 9 files changed, 657 insertions(+) create mode 100644 src_vs2012/VSNDK.Package.Test/ParserTests.cs create mode 100644 src_vs2012/VSNDK.Package.Test/ToolRunnerTests.cs create mode 100644 src_vs2012/VSNDK.Package/Model/DebugTokenInfo.cs create mode 100644 src_vs2012/VSNDK.Package/Tools/DebugTokenInfoRunner.cs create mode 100644 src_vs2012/VSNDK.Package/Tools/RunnerDefaults.cs create mode 100644 src_vs2012/VSNDK.Package/Tools/ToolRunner.cs create mode 100644 src_vs2012/VSNDK.Package/Tools/ToolRunnerEventArgs.cs diff --git a/src_vs2012/VSNDK.Package.Test/ParserTests.cs b/src_vs2012/VSNDK.Package.Test/ParserTests.cs new file mode 100644 index 00000000..b44e47c9 --- /dev/null +++ b/src_vs2012/VSNDK.Package.Test/ParserTests.cs @@ -0,0 +1,59 @@ +using System; +using NUnit.Framework; +using RIM.VSNDK_Package.Model; + +namespace VSNDK.Package.Test +{ + [TestFixture] + public sealed class ParserTests + { + [Test] + public void ParseDebugTokenData() + { + var text = @" +Archive-Manifest-Version: 1.2 +Archive-Created-By: BlackBerry BAR Packager v1.5.14 + +Package-Author: XyXyXyXyXy +Package-Name: debug.token +Package-Version: 0.0.0.6 +Package-Type: debug-token +Package-Author-Certificate-Hash: AUnErb136VLE-eXdTgvvlfdM4gg2HIYMviNei3DoLDzeH7Ua0MJ-fayIqwRmazxAm-7Cmg_Zu138qx33shMhlA +Package-Author-Id: graAgmXcffjRiB07222W4tMFuow +Package-Id: 123XyXyQwhm4KpkL-Dy2241SOUw +Package-Version-Id: gYto8ak11kkVJ_Dwsmb83XrS0DY +Package-Issue-Date: 2013-01-17T01:47:50Z + +Debug-Token-System-Actions: execute,multi_window,multi_instance,run_air_native,run_native,_sys_use_consumer_push +Debug-Token-Expiry-Date: 2013-02-16T01:47:50Z +Debug-Token-Device-Id: 1311521222,1311052217,1354621311,128366899 +"; + + var tokenData = DebugTokenInfo.Parse(text); + Assert.IsNotNull(tokenData); + Assert.AreEqual("XyXyXyXyXy", tokenData.Author); + Assert.AreEqual("123XyXyQwhm4KpkL-Dy2241SOUw", tokenData.ID); + Assert.AreEqual(new DateTime(2013, 01, 17, 1, 47, 50, DateTimeKind.Utc), tokenData.IssueDate); + Assert.AreEqual(new DateTime(2013, 02, 16, 1, 47, 50, DateTimeKind.Utc), tokenData.ExpiryDate); + } + + [Test] + public void FailOnEmptyDebugTokenData() + { + var tokenData = DebugTokenInfo.Parse(null); + Assert.IsNull(tokenData); + + tokenData = DebugTokenInfo.Parse(""); + Assert.IsNull(tokenData); + + tokenData = DebugTokenInfo.Parse(" a b c d e f: xxx"); + Assert.IsNull(tokenData); + + tokenData = DebugTokenInfo.Parse(": yyy"); + Assert.IsNull(tokenData); + + tokenData = DebugTokenInfo.Parse("key: "); + Assert.IsNull(tokenData); + } + } +} diff --git a/src_vs2012/VSNDK.Package.Test/ToolRunnerTests.cs b/src_vs2012/VSNDK.Package.Test/ToolRunnerTests.cs new file mode 100644 index 00000000..f42fb349 --- /dev/null +++ b/src_vs2012/VSNDK.Package.Test/ToolRunnerTests.cs @@ -0,0 +1,46 @@ +using System; +using System.Threading; +using NUnit.Framework; +using RIM.VSNDK_Package.Tools; + +namespace VSNDK.Package.Test +{ + [TestFixture] + public class ToolRunnerTests + { + [Test] + public void LoadDebugTokenInfo() + { + var runner = new DebugTokenInfoRunner(RunnerDefaults.TestToolsDirectory, RunnerDefaults.ConfigFileName("debugtoken.bar")); + var result = runner.Execute(); + + Assert.IsTrue(result, "Unable to start the tool"); + Assert.IsNotNull(runner.LastOutput); + Assert.IsNull(runner.LastError); + } + + [Test] + public void LoadDebugTokenAsync() + { + var runner = new DebugTokenInfoRunner(RunnerDefaults.TestToolsDirectory, RunnerDefaults.ConfigFileName("debugtoken.bar")); + + Assert.IsFalse(runner.IsProcessing); + runner.ExecuteAsync(); + Assert.IsTrue(runner.IsProcessing); + + // wait for completion: + DateTime startTime = DateTime.Now; + TimeSpan timeout = new TimeSpan(0, 0, 5); // 5 sec + while (runner.IsProcessing) + { + Thread.Sleep(50); + if (DateTime.Now - startTime > timeout) + break; + } + + Assert.IsFalse(runner.IsProcessing, "Tool execution got too much time!"); + Assert.IsNotNull(runner.LastOutput); + Assert.IsNull(runner.LastError); + } + } +} diff --git a/src_vs2012/VSNDK.Package.Test/VSNDK.Package.Test.csproj b/src_vs2012/VSNDK.Package.Test/VSNDK.Package.Test.csproj index cb6a95ff..bd7b3ab7 100644 --- a/src_vs2012/VSNDK.Package.Test/VSNDK.Package.Test.csproj +++ b/src_vs2012/VSNDK.Package.Test/VSNDK.Package.Test.csproj @@ -73,6 +73,8 @@ UpdateManagerDataTestClass.cs + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - - VSNDK.Package - - - Package provides BlackBerry Menu items and editor - - - Resources\Package.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - [Read Only] - - - File has been changed outside the environment. Reload the new file? - - - BarDescriptorEditor - Name of the editor to show for the Keybindings - - - BarDescriptorEditor Files - - - BarDescriptorEditor - - - bar-descriptor - - - BarDescriptorEditor File (xml) - - - Resources\Images_24bit.bmp;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - Resources\File.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + VSNDK.Package + + + Package provides BlackBerry Menu items and editor + + + + Resources\Package.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + [Read Only] + + + File has been changed outside the environment. Reload the new file? + + + BarDescriptorEditor + Name of the editor to show for the Keybindings + + + BarDescriptorEditor Files + + + BarDescriptorEditor + + + bar-descriptor + + + BarDescriptorEditor File (xml) + + + Resources\Images_24bit.bmp;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + Resources\File.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + BlackBerry Settings + + + General + \ No newline at end of file diff --git a/src_vs2012/VSNDK.Package/Options/GeneralOptionControl.Designer.cs b/src_vs2012/VSNDK.Package/Options/GeneralOptionControl.Designer.cs new file mode 100644 index 00000000..527c9557 --- /dev/null +++ b/src_vs2012/VSNDK.Package/Options/GeneralOptionControl.Designer.cs @@ -0,0 +1,57 @@ +namespace RIM.VSNDK_Package.Options +{ + partial class GeneralOptionControl + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Component Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.textBox1 = new System.Windows.Forms.TextBox(); + this.SuspendLayout(); + // + // textBox1 + // + this.textBox1.Location = new System.Drawing.Point(33, 15); + this.textBox1.Name = "textBox1"; + this.textBox1.Size = new System.Drawing.Size(100, 20); + this.textBox1.TabIndex = 0; + // + // GeneralOptionControl + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.Controls.Add(this.textBox1); + this.Name = "GeneralOptionControl"; + this.Size = new System.Drawing.Size(603, 150); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.TextBox textBox1; + } +} diff --git a/src_vs2012/VSNDK.Package/Options/GeneralOptionControl.cs b/src_vs2012/VSNDK.Package/Options/GeneralOptionControl.cs new file mode 100644 index 00000000..114a0e23 --- /dev/null +++ b/src_vs2012/VSNDK.Package/Options/GeneralOptionControl.cs @@ -0,0 +1,20 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Drawing; +using System.Data; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace RIM.VSNDK_Package.Options +{ + public partial class GeneralOptionControl : UserControl + { + public GeneralOptionControl() + { + InitializeComponent(); + } + } +} diff --git a/src_vs2012/VSNDK.Package/Options/GeneralOptionControl.resx b/src_vs2012/VSNDK.Package/Options/GeneralOptionControl.resx new file mode 100644 index 00000000..29dcb1b3 --- /dev/null +++ b/src_vs2012/VSNDK.Package/Options/GeneralOptionControl.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/src_vs2012/VSNDK.Package/Options/GeneralOptionPage.cs b/src_vs2012/VSNDK.Package/Options/GeneralOptionPage.cs new file mode 100644 index 00000000..83db47d5 --- /dev/null +++ b/src_vs2012/VSNDK.Package/Options/GeneralOptionPage.cs @@ -0,0 +1,37 @@ +using System.ComponentModel; +using System.Drawing; +using System.Runtime.InteropServices; +using System.Windows.Forms; +using Microsoft.VisualStudio.Shell; + +namespace RIM.VSNDK_Package.Options +{ + [Guid("4dbdc58d-98ec-4908-b7e7-0638c71eae81")] + public class GeneralOptionPage : DialogPage + { + private GeneralOptionControl _optionsWindow; + + private GeneralOptionControl GeneralControl + { + get + { + if (_optionsWindow == null) + { + _optionsWindow = new GeneralOptionControl(); + _optionsWindow.Location = new Point(0, 0); + } + + return _optionsWindow; + } + } + + [Browsable(false)] + protected override IWin32Window Window + { + get + { + return GeneralControl; + } + } + } +} diff --git a/src_vs2012/VSNDK.Package/VSNDK.Package.csproj b/src_vs2012/VSNDK.Package/VSNDK.Package.csproj index 461d9c96..488297a0 100644 --- a/src_vs2012/VSNDK.Package/VSNDK.Package.csproj +++ b/src_vs2012/VSNDK.Package/VSNDK.Package.csproj @@ -263,6 +263,15 @@ + + UserControl + + + GeneralOptionControl.cs + + + Component + @@ -413,6 +422,9 @@ VSPackage Designer + + GeneralOptionControl.cs + From a6e10422bb8bb6ad7cc078b4184fbb5b85c09b27 Mon Sep 17 00:00:00 2001 From: Pawel Hofman Date: Mon, 12 May 2014 11:45:20 +0200 Subject: [PATCH 036/851] Added listing installed NDKs feature --- .../VSNDK.Package.Test/ToolRunnerTests.cs | 13 +- src_vs2012/VSNDK.Package/Model/ApiInfo.cs | 4 +- src_vs2012/VSNDK.Package/Model/DeviceInfo.cs | 136 +++++++++- src_vs2012/VSNDK.Package/Model/NdkInfo.cs | 232 ++++++++++++++++++ .../VSNDK.Package/Tools/RunnerDefaults.cs | 10 +- src_vs2012/VSNDK.Package/VSNDK.Package.csproj | 1 + 6 files changed, 384 insertions(+), 12 deletions(-) create mode 100644 src_vs2012/VSNDK.Package/Model/NdkInfo.cs diff --git a/src_vs2012/VSNDK.Package.Test/ToolRunnerTests.cs b/src_vs2012/VSNDK.Package.Test/ToolRunnerTests.cs index 458661d0..7d7735a6 100644 --- a/src_vs2012/VSNDK.Package.Test/ToolRunnerTests.cs +++ b/src_vs2012/VSNDK.Package.Test/ToolRunnerTests.cs @@ -11,7 +11,7 @@ public class ToolRunnerTests { const string IP = "10.0.0.127"; const string Password = "test"; - readonly static string DebugTokenPath = RunnerDefaults.ConfigFileName("debugtoken.bar"); + readonly static string DebugTokenPath = RunnerDefaults.DataFileName("debugtoken.bar"); [Test] public void LoadDebugTokenInfo() @@ -107,7 +107,7 @@ public void RemoveDebugTokenInfo() [Ignore("Keystore password and device PINs must be fixed, otherwise Signing Authority will cause it to fail")] public void CreateDebugTokenInfo() { - string debugToken = RunnerDefaults.ConfigFileName("debugtoken-new.bar"); + string debugToken = RunnerDefaults.DataFileName("debugtoken-new.bar"); var runner = new DebugTokenCreateRunner(RunnerDefaults.TestToolsDirectory, debugToken, "test", new[] { 0x1ul, 0x2ul }); var result = runner.Execute(); @@ -163,5 +163,14 @@ public void LoadSimulatorApiLevelList() Assert.IsNotNull(runner.APIs); Assert.IsTrue(runner.APIs.Length > 0); } + + [Test] + public void LoadInstalledNdkInfo() + { + var info = NdkInfo.Load(RunnerDefaults.InstallationConfigDirectory); + + Assert.IsNotNull(info); + Assert.IsTrue(info.Length > 0); + } } } diff --git a/src_vs2012/VSNDK.Package/Model/ApiInfo.cs b/src_vs2012/VSNDK.Package/Model/ApiInfo.cs index 63468db8..bc20e921 100644 --- a/src_vs2012/VSNDK.Package/Model/ApiInfo.cs +++ b/src_vs2012/VSNDK.Package/Model/ApiInfo.cs @@ -3,9 +3,9 @@ namespace RIM.VSNDK_Package.Model { /// - /// Descriptor of a NDK. + /// Descriptor of a available remotely NDK. /// - internal sealed class ApiInfo + internal class ApiInfo { public ApiInfo(string name, Version version) { diff --git a/src_vs2012/VSNDK.Package/Model/DeviceInfo.cs b/src_vs2012/VSNDK.Package/Model/DeviceInfo.cs index 02634765..a64e72ad 100644 --- a/src_vs2012/VSNDK.Package/Model/DeviceInfo.cs +++ b/src_vs2012/VSNDK.Package/Model/DeviceInfo.cs @@ -1,6 +1,8 @@ using System; +using System.Collections.Generic; using System.Windows; using System.Globalization; +using System.Xml; namespace RIM.VSNDK_Package.Model { @@ -9,6 +11,7 @@ internal sealed class DeviceInfo public DeviceInfo() { ScreenResolution = Size.Empty; + IconResolution = Size.Empty; } #region Properties @@ -79,6 +82,12 @@ public Size ScreenResolution private set; } + public Size IconResolution + { + get; + private set; + } + public DeviceDebugTokenInfo DebugToken { get; @@ -89,11 +98,19 @@ public DeviceDebugTokenInfo DebugToken public override string ToString() { + if (string.IsNullOrEmpty(ModelName)) + { + if (SystemVersion == null) + return Name; + + return string.Concat(Name, " ( OS v", SystemVersion, ")"); + } + return string.Concat(Name, " (", ModelName, ", OS v", SystemVersion, ")"); } /// - /// Parses device information out of given text. + /// Parses device information out of given PPS text. /// public static DeviceInfo Parse(string text, out string error) { @@ -186,9 +203,11 @@ public static DeviceInfo Parse(string text, out string error) if (string.IsNullOrEmpty(result.ModelNumber)) result.ModelNumber = "STL100-0"; if (result.ScreenDPI == 0) - result.ScreenDPI = 169; + result.ScreenDPI = 167; if (result.ScreenResolution.IsEmpty) result.ScreenResolution = new Size(1024, 600); + if (result.IconResolution.IsEmpty) + result.IconResolution = new Size(90, 90); // copied from Z10/Z30/Q10 } break; case "scmbundle": @@ -210,7 +229,10 @@ public static DeviceInfo Parse(string text, out string error) result.ScreenDPI = GetNumber(value); break; case "screen_res": - result.ScreenResolution = GetScreenResolution(value); + result.ScreenResolution = GetResolution(value); + break; + case "icon_res": + result.IconResolution = GetResolution(value); break; } break; @@ -301,7 +323,7 @@ private static bool GetBool(string text) throw new FormatException("Invalid boolean value"); } - private static Size GetScreenResolution(string text) + private static Size GetResolution(string text) { if (string.IsNullOrEmpty(text)) return Size.Empty; @@ -415,5 +437,111 @@ private static bool SplitLine(string line, out string name, out string value) return false; } + + /// + /// Loads info about devices from XML file, given by the reader. + /// It supports only one format - the one from NDK descriptor. + /// + public static DeviceInfo[] Load(XmlReader reader) + { + if (reader == null) + throw new ArgumentNullException("reader"); + + var result = new List(); + DeviceInfo info = null; + bool isAboutIcon = false; + + while (reader.Read()) + { + if (reader.NodeType == XmlNodeType.Element) + { + switch (reader.Name) + { + case "device": + info = new DeviceInfo(); + isAboutIcon = false; + break; + case "name": + if (info != null) + info.ModelFullName = info.Name = reader.ReadString(); + break; + case "kind": + if (info != null) + info.ModelFamily = reader.ReadString(); + break; + case "ppi": + if (info != null) + info.ScreenDPI = GetNumber(reader.ReadString()); + break; + case "icon": + if (info != null) + { + isAboutIcon = true; + } + break; + case "width": + if (info != null) + { + if (isAboutIcon) + info.IconResolution = UpdateWidth(reader.ReadString(), info.IconResolution.Height); + else + info.ScreenResolution = UpdateWidth(reader.ReadString(), info.ScreenResolution.Height); + } + break; + case "height": + if (info != null) + { + if (isAboutIcon) + info.IconResolution = UpdateHeight(info.IconResolution.Width, reader.ReadString()); + else + info.ScreenResolution = UpdateHeight(info.ScreenResolution.Width, reader.ReadString()); + } + break; + + } + } + + if (reader.NodeType == XmlNodeType.EndElement) + { + // ok, got full info about the device: + if (reader.Name == "device") + { + if (info != null && !string.IsNullOrEmpty(info.Name)) + { + result.Add(info); + info = null; + } + + continue; + } + + if (reader.Name == "icon") + { + isAboutIcon = false; + continue; + } + + // interesting section has been read, no need to parse further: + if (reader.Name == "devices") + break; + } + } + + return result.ToArray(); + } + + private static Size UpdateWidth(string width, double height) + { + var value = GetNumber(width); + + return new Size(value, height < 0 ? 0 : height); + } + + private static Size UpdateHeight(double width, string height) + { + var value = GetNumber(height); + + return new Size(width < 0 ? 0 : width, value); + } } } diff --git a/src_vs2012/VSNDK.Package/Model/NdkInfo.cs b/src_vs2012/VSNDK.Package/Model/NdkInfo.cs new file mode 100644 index 00000000..1bad80b4 --- /dev/null +++ b/src_vs2012/VSNDK.Package/Model/NdkInfo.cs @@ -0,0 +1,232 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Text; +using System.Xml; +using RIM.VSNDK_Package.Diagnostics; + +namespace RIM.VSNDK_Package.Model +{ + /// + /// Descriptor of a locally installed NDK. + /// + internal sealed class NdkInfo : ApiInfo, IComparable + { + public NdkInfo(string name, Version version, string hostPath, string targetPath, DeviceInfo[] devices) + : base(name, version) + { + if (string.IsNullOrEmpty(hostPath)) + throw new ArgumentNullException("hostPath"); + if (string.IsNullOrEmpty(targetPath)) + throw new ArgumentNullException("targetPath"); + if (devices == null) + throw new ArgumentNullException("devices"); + + HostPath = hostPath; + TargetPath = targetPath; + Devices = devices; + } + + #region Properties + + public string HostPath + { + get; + private set; + } + + public string TargetPath + { + get; + private set; + } + + public DeviceInfo[] Devices + { + get; + private set; + } + + #endregion + + /// + /// Checks if given NDK is really available. + /// + public bool Exists() + { + try + { + return Directory.Exists(HostPath) && Directory.Exists(TargetPath); + } + catch + { + return false; + } + } + + /// + /// Loads info about a single NDK from specific config file, given as XML. + /// + public static NdkInfo Load(XmlReader reader) + { + if (reader == null) + return null; + + string name = null; + Version version = null; + string hostPath = null; + string targetPath = null; + + while (reader.Read()) + { + if (reader.NodeType == XmlNodeType.Element) + { + switch (reader.Name) + { + case "name": + name = reader.ReadString(); + break; + case "version": + version = new Version(reader.ReadString()); + break; + case "host": + hostPath = reader.ReadString(); + break; + case "target": + targetPath = reader.ReadString(); + break; + } + } + + if (reader.NodeType == XmlNodeType.EndElement && reader.Name == "installation") + { + if (!string.IsNullOrEmpty(targetPath) && !string.IsNullOrEmpty(hostPath)) + { + const string DescriptorFileName = "blackberry-sdk-descriptor.xml"; + + var ndkDescriptor = Path.Combine(targetPath, DescriptorFileName); + DeviceInfo[] devices = LoadDevices(ndkDescriptor); + + // if failed to load devices, try to find one folder above: + if (devices == null) + { + ndkDescriptor = Path.Combine(targetPath, "..", DescriptorFileName); + devices = LoadDevices(ndkDescriptor); + } + + // or another above: + if (devices == null) + { + ndkDescriptor = Path.Combine(targetPath, "..", "..", DescriptorFileName); + devices = LoadDevices(ndkDescriptor); + } + + // OK, give up, and say it's unknown: + if (devices == null) + devices = new DeviceInfo[0]; + + // try to define info about the installation: + return new NdkInfo(name, version, hostPath, targetPath, devices); + } + + return null; + } + } + + return null; + } + + private static DeviceInfo[] LoadDevices(string ndkDescriptorFileName) + { + try + { + if (!File.Exists(ndkDescriptorFileName)) + return null; + + // try to load info about supported devices by the NDK: + using (var fileReader = new StreamReader(ndkDescriptorFileName, Encoding.UTF8)) + { + using (var descReader = XmlReader.Create(fileReader)) + { + return DeviceInfo.Load(descReader); + } + } + } + catch (Exception ex) + { + TraceLog.WriteLine("Unable to load NDK descriptor file: \"{0}\"", ndkDescriptorFileName); + TraceLog.WriteException(ex); + + return null; + } + } + + /// + /// Loads info about all installed NDKs. + /// + public static NdkInfo[] Load(string globalNdkConfigFolder) + { + if (string.IsNullOrEmpty(globalNdkConfigFolder)) + throw new ArgumentNullException("globalNdkConfigFolder"); + + var result = new List(); + + // list all configuration files: + if (Directory.Exists(globalNdkConfigFolder)) + { + try + { + var files = Directory.GetFiles(globalNdkConfigFolder, "*.xml", SearchOption.AllDirectories); + foreach (var file in files) + { + try + { + using (var fileReader = new StreamReader(file, Encoding.UTF8)) + { + using (var reader = XmlReader.Create(fileReader)) + { + var info = Load(reader); + if (info != null && info.Exists()) + result.Add(info); + } + } + } + catch (Exception ex) + { + TraceLog.WriteLine("Unable to open configuration file: \"{0}\"", file); + TraceLog.WriteException(ex); + } + } + } + catch (Exception ex) + { + TraceLog.WriteLine("Unable to load info about configuration files from folder: \"{0}\"", globalNdkConfigFolder); + TraceLog.WriteException(ex); + } + } + + result.Sort(); + return result.ToArray(); + } + + + /// + /// Compares the current object with another object of the same type. + /// + /// + /// A value that indicates the relative order of the objects being compared. The return value has the following meanings: Value Meaning Less than zero This object is less than the parameter.Zero This object is equal to . Greater than zero This object is greater than . + /// + /// An object to compare with this object. + public int CompareTo(NdkInfo other) + { + if (other == null) + return 1; + + int cmp = Version.CompareTo(other.Version); + if (cmp != 0) + return cmp; + + return string.Compare(Name, other.Name, StringComparison.InvariantCultureIgnoreCase); + } + } +} diff --git a/src_vs2012/VSNDK.Package/Tools/RunnerDefaults.cs b/src_vs2012/VSNDK.Package/Tools/RunnerDefaults.cs index b4367541..16978740 100644 --- a/src_vs2012/VSNDK.Package/Tools/RunnerDefaults.cs +++ b/src_vs2012/VSNDK.Package/Tools/RunnerDefaults.cs @@ -7,11 +7,13 @@ internal static class RunnerDefaults { public static readonly string TestToolsDirectory; public static readonly string TestNdkDirectory; - public static readonly string ConfigurationDirectory; + public static readonly string DataDirectory; + public static readonly string InstallationConfigDirectory; static RunnerDefaults() { - ConfigurationDirectory = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + @"\Research In Motion"; + DataDirectory = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + @"\Research In Motion"; + InstallationConfigDirectory = Path.Combine(DataDirectory, @"BlackBerry Native SDK\qconfig"); #if DEBUG // TODO: PH: 2014-05-08: for now hardcoded my repository path: @@ -23,12 +25,12 @@ static RunnerDefaults() /// /// Gets the full path to specified file within BlackBerry developer's configuration area. /// - public static string ConfigFileName(string fileName) + public static string DataFileName(string fileName) { if (string.IsNullOrEmpty(fileName)) throw new ArgumentNullException("fileName"); - return Path.Combine(ConfigurationDirectory, fileName); + return Path.Combine(DataDirectory, fileName); } } } diff --git a/src_vs2012/VSNDK.Package/VSNDK.Package.csproj b/src_vs2012/VSNDK.Package/VSNDK.Package.csproj index 488297a0..daa7ce2b 100644 --- a/src_vs2012/VSNDK.Package/VSNDK.Package.csproj +++ b/src_vs2012/VSNDK.Package/VSNDK.Package.csproj @@ -263,6 +263,7 @@ + UserControl From 0f836b98cc9be8441a490cd92da11cf928e1263b Mon Sep 17 00:00:00 2001 From: Pawel Hofman Date: Mon, 12 May 2014 12:53:17 +0200 Subject: [PATCH 037/851] Stopped loading of all available NDKs on startup This is a major flaw, as loading is done over the network each time the plugin was initialized, blocking the IDE for half a minute! --- src/VSNDK.Package/VSNDK.PackagePackage.cs | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/VSNDK.Package/VSNDK.PackagePackage.cs b/src/VSNDK.Package/VSNDK.PackagePackage.cs index 18e80883..11fd2ef8 100644 --- a/src/VSNDK.Package/VSNDK.PackagePackage.cs +++ b/src/VSNDK.Package/VSNDK.PackagePackage.cs @@ -967,12 +967,7 @@ protected override void Initialize() //Create Editor Factory. Note that the base Package class will call Dispose on it. RegisterEditorFactory(new EditorFactory(this)); - - APITargetListSingleton api = APITargetListSingleton.Instance; InstalledAPIListSingleton apiList = InstalledAPIListSingleton.Instance; - InstalledNDKListSingleton ndkList = InstalledNDKListSingleton.Instance; - SimulatorListSingleton simList = SimulatorListSingleton.Instance; - InstalledSimulatorListSingleton installedSimList = InstalledSimulatorListSingleton.Instance; _dte = (DTE)GetService(typeof(DTE)); From c37abe1b960e3fbf3d4f926050fcabf40655c765 Mon Sep 17 00:00:00 2001 From: Pawel Hofman Date: Mon, 12 May 2014 15:46:44 +0200 Subject: [PATCH 038/851] Redesigned main menu adding dynamic list of targets --- src/VSNDK.Package/Guids.cs | 5 +- src/VSNDK.Package/PkgCmdID.cs | 22 +- src/VSNDK.Package/VSNDK.PackagePackage.cs | 38 +- .../Model/Integration/DynamicMenuCommand.cs | 66 ++++ .../VSNDK.Package/VSNDK.Package.Bitmaps.vsct | 36 ++ src_vs2012/VSNDK.Package/VSNDK.Package.csproj | 2 + src_vs2012/VSNDK.Package/VSNDK.Package.vsct | 338 ++++++++++-------- 7 files changed, 331 insertions(+), 176 deletions(-) create mode 100644 src_vs2012/VSNDK.Package/Model/Integration/DynamicMenuCommand.cs create mode 100644 src_vs2012/VSNDK.Package/VSNDK.Package.Bitmaps.vsct diff --git a/src/VSNDK.Package/Guids.cs b/src/VSNDK.Package/Guids.cs index c8cdde26..3816d7c8 100644 --- a/src/VSNDK.Package/Guids.cs +++ b/src/VSNDK.Package/Guids.cs @@ -12,15 +12,13 @@ //* See the License for the specific language governing permissions and //* limitations under the License. -// Guids.cs -// MUST match guids.h using System; namespace RIM.VSNDK_Package { static class GuidList { - public const string guidVSNDK_PackagePkgString = "db9f9c5f-fb27-4297-ab44-fa8774e962ca"; + public const string guidVSNDK_PackageString = "db9f9c5f-fb27-4297-ab44-fa8774e962ca"; public const string guidVSNDK_PackageCmdSetString = "d531fe01-f48e-443d-8ea1-1530a352525f"; public const string guidToolWindowPersistanceString = "87346a4d-fbf2-46ff-8f59-31915e39cfb9"; public const string guidVSNDK_PackageEditorFactoryString = "9e985c5e-5b53-4cb1-bcd0-40a56f18eb4d"; @@ -32,7 +30,6 @@ static class GuidList public static readonly Guid guidVSNDK_PackageCmdSet = new Guid(guidVSNDK_PackageCmdSetString); public static readonly Guid guidVSNDK_PackageEditorFactory = new Guid(guidVsTemplateDesignerEditorFactoryString); - public static readonly Guid guidTest = new Guid(guidVSStd2KString); // Guid of the new pane with output messages public const string guidTraceOutputWindowPaneString = "09963e4f-18ea-40e5-ba9e-1bc375ad68d1"; diff --git a/src/VSNDK.Package/PkgCmdID.cs b/src/VSNDK.Package/PkgCmdID.cs index 552d7723..cd8704a8 100644 --- a/src/VSNDK.Package/PkgCmdID.cs +++ b/src/VSNDK.Package/PkgCmdID.cs @@ -12,22 +12,18 @@ //* See the License for the specific language governing permissions and //* limitations under the License. -// PkgCmdID.cs -// MUST match PkgCmdID.h -using System; - namespace RIM.VSNDK_Package { - static class PkgCmdIDList + internal static class PkgCmdIDList { - public const uint cmdidBlackBerryTools = 0x0100; - public const uint cmdidBlackBerrySettings = 0x0101; - public const uint cmdidBlackBerryDebugToken = 0x0103; - public const uint cmdidBlackBerryProjectImport = 0x0104; - - public const int cmdidfooLocalBox = 0x0200; - - + public const int cmdidBlackBerryTools = 0x0201; + public const int cmdidBlackBerrySettings = 0x0202; + public const int cmdidBlackBerryDebugToken = 0x0203; + public const int cmdidBlackBerryOptions = 0x0301; + public const int cmdidBlackBerryTargetsDevicesPlaceholder = 0x0401; + public const int cmdidBlackBerryTargetsConfigure = 0x0501; + public const int cmdidBlackBerryProjectImport = 0x0104; + public const int cmdidfooLocalBox = 0x0105; }; } \ No newline at end of file diff --git a/src/VSNDK.Package/VSNDK.PackagePackage.cs b/src/VSNDK.Package/VSNDK.PackagePackage.cs index 11fd2ef8..04553740 100644 --- a/src/VSNDK.Package/VSNDK.PackagePackage.cs +++ b/src/VSNDK.Package/VSNDK.PackagePackage.cs @@ -33,6 +33,7 @@ using System.Security.Cryptography; using System.Text; using RIM.VSNDK_Package.Diagnostics; +using RIM.VSNDK_Package.Model.Integration; using RIM.VSNDK_Package.Options; using RIM.VSNDK_Package.UpdateManager.Model; using VSNDK.Parser; @@ -911,7 +912,7 @@ public bool GetInstalledSimulatorList() [ProvideMenuResource("Menus.ctmenu", 1)] // This attribute registers a tool window exposed by this package. [ProvideAutoLoad(UIContextGuids80.SolutionExists)] - [Guid(GuidList.guidVSNDK_PackagePkgString)] + [Guid(GuidList.guidVSNDK_PackageString)] [ProvideOptionPage(typeof(GeneralOptionPage), "BlackBerry", "General", 113, 115, true)] public sealed class VSNDK_PackagePackage : Package { @@ -964,11 +965,14 @@ protected override void Initialize() TraceLog.Add(_traceWindow); TraceLog.WriteLine("BlackBerry plugin started"); + InstalledAPIListSingleton apiList = InstalledAPIListSingleton.Instance; + TraceLog.WriteLine(" * loaded NDK descriptions"); + //Create Editor Factory. Note that the base Package class will call Dispose on it. RegisterEditorFactory(new EditorFactory(this)); + TraceLog.WriteLine(" * registered editors"); - InstalledAPIListSingleton apiList = InstalledAPIListSingleton.Instance; - + _dte = (DTE)GetService(typeof(DTE)); if ((IsBlackBerrySolution(_dte)) && (apiList._installedAPIList.Count == 0)) @@ -988,33 +992,53 @@ protected override void Initialize() _buildEvents = _dte.Events.BuildEvents; _buildEvents.OnBuildBegin += OnBuildBegin; - + TraceLog.WriteLine(" * subscribed to IDE events"); // Add our command handlers for menu (commands must exist in the .vsct file) OleMenuCommandService mcs = GetService(typeof(IMenuCommandService)) as OleMenuCommandService; if ( null != mcs ) { // Create the command for the tool window - CommandID toolwndCommandID = new CommandID(GuidList.guidVSNDK_PackageCmdSet, (int)PkgCmdIDList.cmdidBlackBerryTools); + CommandID toolwndCommandID = new CommandID(GuidList.guidVSNDK_PackageCmdSet, PkgCmdIDList.cmdidBlackBerryTools); MenuCommand menuToolWin = new MenuCommand(ShowToolWindow, toolwndCommandID); mcs.AddCommand( menuToolWin ); // Create the command for the settings window - CommandID wndSettingsCommandID = new CommandID(GuidList.guidVSNDK_PackageCmdSet, (int)PkgCmdIDList.cmdidBlackBerrySettings); + CommandID wndSettingsCommandID = new CommandID(GuidList.guidVSNDK_PackageCmdSet, PkgCmdIDList.cmdidBlackBerrySettings); MenuCommand menuSettingsWin = new MenuCommand(ShowSettingsWindow, wndSettingsCommandID); mcs.AddCommand(menuSettingsWin); // Create the command for the Debug Token window - CommandID wndDebugTokenCommandID = new CommandID(GuidList.guidVSNDK_PackageCmdSet, (int)PkgCmdIDList.cmdidBlackBerryDebugToken); + CommandID wndDebugTokenCommandID = new CommandID(GuidList.guidVSNDK_PackageCmdSet, PkgCmdIDList.cmdidBlackBerryDebugToken); MenuCommand menuDebugTokenWin = new MenuCommand(ShowDebugTokenWindow, wndDebugTokenCommandID); mcs.AddCommand(menuDebugTokenWin); + // Create command for the 'Options...' menu + CommandID optionsCommandID = new CommandID(GuidList.guidVSNDK_PackageCmdSet, PkgCmdIDList.cmdidBlackBerryOptions); + MenuCommand optionsMenu = new MenuCommand((s, e) => ShowOptionPage(typeof(GeneralOptionPage)), optionsCommandID); + mcs.AddCommand(optionsMenu); + + // Create dynamic command for the 'devices-list' menu + CommandID devicesCommandID = new CommandID(GuidList.guidVSNDK_PackageCmdSet, PkgCmdIDList.cmdidBlackBerryTargetsDevicesPlaceholder); + DynamicMenuCommand devicesMenu = new DynamicMenuCommand(InstalledNDKListSingleton.Instance._installedNDKList, null, + (cmd, colletion, index) => + { + var item = index >= 0 && index < colletion.Count ? ((List) colletion)[index] : null; + cmd.Checked = index == 0; + cmd.Text = item != null ? item.Name : "-"; + }, + devicesCommandID); + mcs.AddCommand(devicesMenu); + // Create the command for the menu item. CommandID projCommandID = new CommandID(GuidList.guidVSNDK_PackageCmdSet, PkgCmdIDList.cmdidfooLocalBox); OleMenuCommand projItem = new OleMenuCommand(MenuItemCallback, projCommandID); mcs.AddCommand(projItem); + + TraceLog.WriteLine(" * initialized menus"); } + TraceLog.WriteLine("-------------------- DONE"); } #endregion diff --git a/src_vs2012/VSNDK.Package/Model/Integration/DynamicMenuCommand.cs b/src_vs2012/VSNDK.Package/Model/Integration/DynamicMenuCommand.cs new file mode 100644 index 00000000..00cceb89 --- /dev/null +++ b/src_vs2012/VSNDK.Package/Model/Integration/DynamicMenuCommand.cs @@ -0,0 +1,66 @@ +using System; +using System.Collections; +using System.ComponentModel.Design; +using Microsoft.VisualStudio.Shell; + +namespace RIM.VSNDK_Package.Model.Integration +{ + /// + /// Encapsulates displaying a collection of items as multiple menu items within Visual Studio. + /// + internal sealed class DynamicMenuCommand : OleMenuCommand + { + private readonly Predicate _displayPredicate; + private readonly Action _processedQueryStatus; + private readonly ICollection _collection; + + public DynamicMenuCommand(Predicate displayPredicate, EventHandler invokeHandler, EventHandler beforeQueryStatusHandler, CommandID id) + : base(invokeHandler, null, beforeQueryStatusHandler, id) + { + if (displayPredicate == null) + throw new ArgumentNullException("displayPredicate"); + + _displayPredicate = displayPredicate; + } + + public DynamicMenuCommand(ICollection collection, EventHandler invokeHandler, Action beforeQueryStatus, CommandID id) + : base(invokeHandler, null, BeforeCollectionQueryStatusUpdate, id) + { + if (collection == null) + throw new ArgumentNullException("collection"); + if (beforeQueryStatus == null) + throw new ArgumentNullException("beforeQueryStatus"); + + _displayPredicate = InternalCollectionPredicate; + _processedQueryStatus = beforeQueryStatus; + _collection = collection; + } + + public override bool DynamicItemMatch(int cmdId) + { + if (_displayPredicate(cmdId)) + { + MatchedCommandId = cmdId; + return true; + } + + MatchedCommandId = 0; + return false; + } + + private bool InternalCollectionPredicate(int cmdId) + { + return cmdId >= CommandID.ID && (cmdId - CommandID.ID) < _collection.Count; + } + + private static void BeforeCollectionQueryStatusUpdate(object sender, EventArgs e) + { + var command = (DynamicMenuCommand)sender; + + int index = command.MatchedCommandId == 0 ? 0 : command.MatchedCommandId - command.CommandID.ID; + + // and ask for further status update: + command._processedQueryStatus(command, command._collection, index); + } + } +} diff --git a/src_vs2012/VSNDK.Package/VSNDK.Package.Bitmaps.vsct b/src_vs2012/VSNDK.Package/VSNDK.Package.Bitmaps.vsct new file mode 100644 index 00000000..1c9b3bf9 --- /dev/null +++ b/src_vs2012/VSNDK.Package/VSNDK.Package.Bitmaps.vsct @@ -0,0 +1,36 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src_vs2012/VSNDK.Package/VSNDK.Package.csproj b/src_vs2012/VSNDK.Package/VSNDK.Package.csproj index daa7ce2b..444bd258 100644 --- a/src_vs2012/VSNDK.Package/VSNDK.Package.csproj +++ b/src_vs2012/VSNDK.Package/VSNDK.Package.csproj @@ -263,6 +263,7 @@ + UserControl @@ -306,6 +307,7 @@ UpdateManager\UpdateManagerDialog.xaml.cs UpdateManagerDialog.xaml + Resources\BlackBerryMessager.bmp diff --git a/src_vs2012/VSNDK.Package/VSNDK.Package.vsct b/src_vs2012/VSNDK.Package/VSNDK.Package.vsct index 8231eb32..a43c947a 100644 --- a/src_vs2012/VSNDK.Package/VSNDK.Package.vsct +++ b/src_vs2012/VSNDK.Package/VSNDK.Package.vsct @@ -1,39 +1,40 @@  - - - - + + - - + + - - + + - - - + + + - - - - - - - - - - - BlackBerry - BlackBerry - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + BlackBerry + BlackBerry + + + + + + + + Targets + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From a67c7711217fa6afd935f5c9d6bc8f43f7cd5332 Mon Sep 17 00:00:00 2001 From: Pawel Hofman Date: Mon, 12 May 2014 17:27:06 +0200 Subject: [PATCH 039/851] Added templates for plugin's option pages --- src/VSNDK.Package/VSNDK.PackagePackage.cs | 10 +- src/VSNDK.Package/VSPackage.resx | 13 +- .../Options/ApiLevelOptionControl.Designer.cs | 128 ++++++++++++++++++ .../Options/ApiLevelOptionControl.cs | 20 +++ .../Options/ApiLevelOptionControl.resx | 120 ++++++++++++++++ .../Options/ApiLevelOptionPage.cs | 44 ++++++ .../Options/GeneralOptionControl.Designer.cs | 114 ++++++++++++++-- .../Options/GeneralOptionControl.cs | 49 +++++-- .../Options/GeneralOptionPage.cs | 39 ++++-- .../Options/LogsOptionControl.Designer.cs | 128 ++++++++++++++++++ .../Options/LogsOptionControl.cs | 40 ++++++ .../Options/LogsOptionControl.resx | 120 ++++++++++++++++ .../VSNDK.Package/Options/LogsOptionPage.cs | 72 ++++++++++ .../Options/TargetsOptionControl.Designer.cs | 46 +++++++ .../Options/TargetsOptionControl.cs | 20 +++ .../Options/TargetsOptionControl.resx | 120 ++++++++++++++++ .../Options/TargetsOptionPage.cs | 44 ++++++ src_vs2012/VSNDK.Package/VSNDK.Package.csproj | 36 +++++ 18 files changed, 1133 insertions(+), 30 deletions(-) create mode 100644 src_vs2012/VSNDK.Package/Options/ApiLevelOptionControl.Designer.cs create mode 100644 src_vs2012/VSNDK.Package/Options/ApiLevelOptionControl.cs create mode 100644 src_vs2012/VSNDK.Package/Options/ApiLevelOptionControl.resx create mode 100644 src_vs2012/VSNDK.Package/Options/ApiLevelOptionPage.cs create mode 100644 src_vs2012/VSNDK.Package/Options/LogsOptionControl.Designer.cs create mode 100644 src_vs2012/VSNDK.Package/Options/LogsOptionControl.cs create mode 100644 src_vs2012/VSNDK.Package/Options/LogsOptionControl.resx create mode 100644 src_vs2012/VSNDK.Package/Options/LogsOptionPage.cs create mode 100644 src_vs2012/VSNDK.Package/Options/TargetsOptionControl.Designer.cs create mode 100644 src_vs2012/VSNDK.Package/Options/TargetsOptionControl.cs create mode 100644 src_vs2012/VSNDK.Package/Options/TargetsOptionControl.resx create mode 100644 src_vs2012/VSNDK.Package/Options/TargetsOptionPage.cs diff --git a/src/VSNDK.Package/VSNDK.PackagePackage.cs b/src/VSNDK.Package/VSNDK.PackagePackage.cs index 04553740..70f2a930 100644 --- a/src/VSNDK.Package/VSNDK.PackagePackage.cs +++ b/src/VSNDK.Package/VSNDK.PackagePackage.cs @@ -913,7 +913,10 @@ public bool GetInstalledSimulatorList() // This attribute registers a tool window exposed by this package. [ProvideAutoLoad(UIContextGuids80.SolutionExists)] [Guid(GuidList.guidVSNDK_PackageString)] - [ProvideOptionPage(typeof(GeneralOptionPage), "BlackBerry", "General", 113, 115, true)] + [ProvideOptionPage(typeof(GeneralOptionPage), "BlackBerry", "General", 1001, 1002, true)] + [ProvideOptionPage(typeof(LogsOptionPage), "BlackBerry", "Logs", 1001, 1003, true)] + [ProvideOptionPage(typeof(ApiLevelOptionPage), "BlackBerry", "API Levels", 1001, 1004, true)] + [ProvideOptionPage(typeof(TargetsOptionPage), "BlackBerry", "Targets", 1001, 1005, true)] public sealed class VSNDK_PackagePackage : Package { #region private member variables @@ -1030,6 +1033,11 @@ protected override void Initialize() devicesCommandID); mcs.AddCommand(devicesMenu); + // Create command for 'Configure...' [targets] menu + CommandID configureCommandID = new CommandID(GuidList.guidVSNDK_PackageCmdSet, PkgCmdIDList.cmdidBlackBerryTargetsConfigure); + MenuCommand configureMenu = new MenuCommand((s, e) => ShowOptionPage(typeof(TargetsOptionPage)), configureCommandID); + mcs.AddCommand(configureMenu); + // Create the command for the menu item. CommandID projCommandID = new CommandID(GuidList.guidVSNDK_PackageCmdSet, PkgCmdIDList.cmdidfooLocalBox); OleMenuCommand projItem = new OleMenuCommand(MenuItemCallback, projCommandID); diff --git a/src/VSNDK.Package/VSPackage.resx b/src/VSNDK.Package/VSPackage.resx index 2dd2b1ea..f1d746a4 100644 --- a/src/VSNDK.Package/VSPackage.resx +++ b/src/VSNDK.Package/VSPackage.resx @@ -155,10 +155,19 @@ Resources\File.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - + BlackBerry Settings - + General + + Logs + + + API Levels + + + Targets + \ No newline at end of file diff --git a/src_vs2012/VSNDK.Package/Options/ApiLevelOptionControl.Designer.cs b/src_vs2012/VSNDK.Package/Options/ApiLevelOptionControl.Designer.cs new file mode 100644 index 00000000..b5bbedd3 --- /dev/null +++ b/src_vs2012/VSNDK.Package/Options/ApiLevelOptionControl.Designer.cs @@ -0,0 +1,128 @@ +namespace RIM.VSNDK_Package.Options +{ + partial class ApiLevelOptionControl + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Component Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.textBox1 = new System.Windows.Forms.TextBox(); + this.comboBox1 = new System.Windows.Forms.ComboBox(); + this.label1 = new System.Windows.Forms.Label(); + this.button2 = new System.Windows.Forms.Button(); + this.button1 = new System.Windows.Forms.Button(); + this.label2 = new System.Windows.Forms.Label(); + this.SuspendLayout(); + // + // textBox1 + // + this.textBox1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.textBox1.Location = new System.Drawing.Point(100, 60); + this.textBox1.Multiline = true; + this.textBox1.Name = "textBox1"; + this.textBox1.ReadOnly = true; + this.textBox1.ScrollBars = System.Windows.Forms.ScrollBars.Vertical; + this.textBox1.Size = new System.Drawing.Size(434, 218); + this.textBox1.TabIndex = 8; + // + // comboBox1 + // + this.comboBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.comboBox1.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.comboBox1.FormattingEnabled = true; + this.comboBox1.Location = new System.Drawing.Point(100, 33); + this.comboBox1.MaxDropDownItems = 25; + this.comboBox1.Name = "comboBox1"; + this.comboBox1.Size = new System.Drawing.Size(434, 21); + this.comboBox1.TabIndex = 7; + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Location = new System.Drawing.Point(3, 36); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(93, 13); + this.label1.TabIndex = 6; + this.label1.Text = "Current API Level:"; + // + // button2 + // + this.button2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.button2.Location = new System.Drawing.Point(292, 284); + this.button2.Name = "button2"; + this.button2.Size = new System.Drawing.Size(118, 23); + this.button2.TabIndex = 4; + this.button2.Text = "&Add Existing..."; + this.button2.UseVisualStyleBackColor = true; + // + // button1 + // + this.button1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.button1.Location = new System.Drawing.Point(416, 284); + this.button1.Name = "button1"; + this.button1.Size = new System.Drawing.Size(118, 23); + this.button1.TabIndex = 5; + this.button1.Text = "&Install New"; + this.button1.UseVisualStyleBackColor = true; + // + // label2 + // + this.label2.AutoSize = true; + this.label2.Location = new System.Drawing.Point(3, 11); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(248, 13); + this.label2.TabIndex = 9; + this.label2.Text = "Select the API Level that your application supports."; + // + // ApiLevelOptionControl + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.Controls.Add(this.label2); + this.Controls.Add(this.textBox1); + this.Controls.Add(this.comboBox1); + this.Controls.Add(this.label1); + this.Controls.Add(this.button2); + this.Controls.Add(this.button1); + this.Name = "ApiLevelOptionControl"; + this.Size = new System.Drawing.Size(537, 310); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.TextBox textBox1; + private System.Windows.Forms.ComboBox comboBox1; + private System.Windows.Forms.Label label1; + private System.Windows.Forms.Button button2; + private System.Windows.Forms.Button button1; + private System.Windows.Forms.Label label2; + } +} diff --git a/src_vs2012/VSNDK.Package/Options/ApiLevelOptionControl.cs b/src_vs2012/VSNDK.Package/Options/ApiLevelOptionControl.cs new file mode 100644 index 00000000..75da30b4 --- /dev/null +++ b/src_vs2012/VSNDK.Package/Options/ApiLevelOptionControl.cs @@ -0,0 +1,20 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Drawing; +using System.Data; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace RIM.VSNDK_Package.Options +{ + public partial class ApiLevelOptionControl : UserControl + { + public ApiLevelOptionControl() + { + InitializeComponent(); + } + } +} diff --git a/src_vs2012/VSNDK.Package/Options/ApiLevelOptionControl.resx b/src_vs2012/VSNDK.Package/Options/ApiLevelOptionControl.resx new file mode 100644 index 00000000..29dcb1b3 --- /dev/null +++ b/src_vs2012/VSNDK.Package/Options/ApiLevelOptionControl.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/src_vs2012/VSNDK.Package/Options/ApiLevelOptionPage.cs b/src_vs2012/VSNDK.Package/Options/ApiLevelOptionPage.cs new file mode 100644 index 00000000..37e3adaf --- /dev/null +++ b/src_vs2012/VSNDK.Package/Options/ApiLevelOptionPage.cs @@ -0,0 +1,44 @@ +using System.ComponentModel; +using System.Drawing; +using System.Windows.Forms; +using System.Runtime.InteropServices; +using Microsoft.VisualStudio.Shell; + +namespace RIM.VSNDK_Package.Options +{ + /// + /// Option page to manage API levels. + /// + [Guid("5389599f-f906-4c23-b976-c7d75f1ae1ce")] + public sealed class ApiLevelOptionPage : DialogPage + { + #region Control + + private ApiLevelOptionControl _control; + + private ApiLevelOptionControl Control + { + get + { + if (_control == null) + { + _control = new ApiLevelOptionControl(); + _control.Location = new Point(0, 0); + } + + return _control; + } + } + + [Browsable(false)] + protected override IWin32Window Window + { + get + { + return Control; + } + } + + #endregion + } +} diff --git a/src_vs2012/VSNDK.Package/Options/GeneralOptionControl.Designer.cs b/src_vs2012/VSNDK.Package/Options/GeneralOptionControl.Designer.cs index 527c9557..2763cca0 100644 --- a/src_vs2012/VSNDK.Package/Options/GeneralOptionControl.Designer.cs +++ b/src_vs2012/VSNDK.Package/Options/GeneralOptionControl.Designer.cs @@ -28,30 +28,124 @@ protected override void Dispose(bool disposing) /// private void InitializeComponent() { - this.textBox1 = new System.Windows.Forms.TextBox(); + this.txtNdkPath = new System.Windows.Forms.TextBox(); + this.groupBox1 = new System.Windows.Forms.GroupBox(); + this.label1 = new System.Windows.Forms.Label(); + this.label2 = new System.Windows.Forms.Label(); + this.txtToolsPath = new System.Windows.Forms.TextBox(); + this.bttNdkBrowse = new System.Windows.Forms.Button(); + this.bttToolsBrowse = new System.Windows.Forms.Button(); + this.label3 = new System.Windows.Forms.Label(); + this.groupBox1.SuspendLayout(); this.SuspendLayout(); // - // textBox1 + // txtNdkPath // - this.textBox1.Location = new System.Drawing.Point(33, 15); - this.textBox1.Name = "textBox1"; - this.textBox1.Size = new System.Drawing.Size(100, 20); - this.textBox1.TabIndex = 0; + this.txtNdkPath.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.txtNdkPath.Location = new System.Drawing.Point(91, 23); + this.txtNdkPath.Name = "txtNdkPath"; + this.txtNdkPath.Size = new System.Drawing.Size(429, 20); + this.txtNdkPath.TabIndex = 1; + // + // groupBox1 + // + this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.groupBox1.Controls.Add(this.label3); + this.groupBox1.Controls.Add(this.bttToolsBrowse); + this.groupBox1.Controls.Add(this.bttNdkBrowse); + this.groupBox1.Controls.Add(this.txtToolsPath); + this.groupBox1.Controls.Add(this.label2); + this.groupBox1.Controls.Add(this.label1); + this.groupBox1.Controls.Add(this.txtNdkPath); + this.groupBox1.Location = new System.Drawing.Point(0, 0); + this.groupBox1.Name = "groupBox1"; + this.groupBox1.Size = new System.Drawing.Size(616, 122); + this.groupBox1.TabIndex = 0; + this.groupBox1.TabStop = false; + this.groupBox1.Text = "Locations"; + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Location = new System.Drawing.Point(15, 26); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(58, 13); + this.label1.TabIndex = 0; + this.label1.Text = "NDK Path:"; + // + // label2 + // + this.label2.AutoSize = true; + this.label2.Location = new System.Drawing.Point(15, 46); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(109, 13); + this.label2.TabIndex = 3; + this.label2.Text = "(Visual Studio Edition)"; + // + // txtToolsPath + // + this.txtToolsPath.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.txtToolsPath.Location = new System.Drawing.Point(91, 80); + this.txtToolsPath.Name = "txtToolsPath"; + this.txtToolsPath.Size = new System.Drawing.Size(429, 20); + this.txtToolsPath.TabIndex = 5; + // + // bttNdkBrowse + // + this.bttNdkBrowse.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.bttNdkBrowse.Location = new System.Drawing.Point(526, 23); + this.bttNdkBrowse.Name = "bttNdkBrowse"; + this.bttNdkBrowse.Size = new System.Drawing.Size(75, 23); + this.bttNdkBrowse.TabIndex = 2; + this.bttNdkBrowse.Text = "Browse..."; + this.bttNdkBrowse.UseVisualStyleBackColor = true; + this.bttNdkBrowse.Click += new System.EventHandler(this.bttNdkBrowse_Click); + // + // bttToolsBrowse + // + this.bttToolsBrowse.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.bttToolsBrowse.Location = new System.Drawing.Point(527, 80); + this.bttToolsBrowse.Name = "bttToolsBrowse"; + this.bttToolsBrowse.Size = new System.Drawing.Size(75, 23); + this.bttToolsBrowse.TabIndex = 6; + this.bttToolsBrowse.Text = "Browse..."; + this.bttToolsBrowse.UseVisualStyleBackColor = true; + this.bttToolsBrowse.Click += new System.EventHandler(this.bttToolsBrowse_Click); + // + // label3 + // + this.label3.AutoSize = true; + this.label3.Location = new System.Drawing.Point(15, 83); + this.label3.Name = "label3"; + this.label3.Size = new System.Drawing.Size(61, 13); + this.label3.TabIndex = 4; + this.label3.Text = "Tools Path:"; // // GeneralOptionControl // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.Controls.Add(this.textBox1); + this.Controls.Add(this.groupBox1); this.Name = "GeneralOptionControl"; - this.Size = new System.Drawing.Size(603, 150); + this.Size = new System.Drawing.Size(619, 217); + this.groupBox1.ResumeLayout(false); + this.groupBox1.PerformLayout(); this.ResumeLayout(false); - this.PerformLayout(); } #endregion - private System.Windows.Forms.TextBox textBox1; + private System.Windows.Forms.TextBox txtNdkPath; + private System.Windows.Forms.GroupBox groupBox1; + private System.Windows.Forms.Label label3; + private System.Windows.Forms.Button bttToolsBrowse; + private System.Windows.Forms.Button bttNdkBrowse; + private System.Windows.Forms.TextBox txtToolsPath; + private System.Windows.Forms.Label label2; + private System.Windows.Forms.Label label1; } } diff --git a/src_vs2012/VSNDK.Package/Options/GeneralOptionControl.cs b/src_vs2012/VSNDK.Package/Options/GeneralOptionControl.cs index 114a0e23..7ebfa7d9 100644 --- a/src_vs2012/VSNDK.Package/Options/GeneralOptionControl.cs +++ b/src_vs2012/VSNDK.Package/Options/GeneralOptionControl.cs @@ -1,12 +1,4 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Drawing; -using System.Data; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows.Forms; +using System.Windows.Forms; namespace RIM.VSNDK_Package.Options { @@ -16,5 +8,44 @@ public GeneralOptionControl() { InitializeComponent(); } + + #region Properties + + public string NdkPath + { + get { return txtNdkPath.Text; } + set { txtNdkPath.Text = value; } + } + + public string ToolsPath + { + get { return txtToolsPath.Text; } + set { txtToolsPath.Text = value; } + } + + #endregion + + private void bttNdkBrowse_Click(object sender, System.EventArgs e) + { + txtNdkPath.Text = BrowseForFolder(txtNdkPath.Text, "Browse for NDK folder"); + } + + private void bttToolsBrowse_Click(object sender, System.EventArgs e) + { + txtToolsPath.Text = BrowseForFolder(txtToolsPath.Text, "Browse for Tools folder"); + } + + private string BrowseForFolder(string startupPath, string description) + { + var browser = new FolderBrowserDialog(); + browser.ShowNewFolderButton = true; + browser.SelectedPath = startupPath; + browser.Description = description; + + if (browser.ShowDialog() == DialogResult.OK) + return browser.SelectedPath; + + return startupPath; + } } } diff --git a/src_vs2012/VSNDK.Package/Options/GeneralOptionPage.cs b/src_vs2012/VSNDK.Package/Options/GeneralOptionPage.cs index 83db47d5..1eb3339b 100644 --- a/src_vs2012/VSNDK.Package/Options/GeneralOptionPage.cs +++ b/src_vs2012/VSNDK.Package/Options/GeneralOptionPage.cs @@ -6,22 +6,27 @@ namespace RIM.VSNDK_Package.Options { + /// + /// Option page to manage general config - like PATHs!. + /// [Guid("4dbdc58d-98ec-4908-b7e7-0638c71eae81")] - public class GeneralOptionPage : DialogPage + public sealed class GeneralOptionPage : DialogPage { - private GeneralOptionControl _optionsWindow; + #region Control - private GeneralOptionControl GeneralControl + private GeneralOptionControl _control; + + private GeneralOptionControl Control { get { - if (_optionsWindow == null) + if (_control == null) { - _optionsWindow = new GeneralOptionControl(); - _optionsWindow.Location = new Point(0, 0); + _control = new GeneralOptionControl(); + _control.Location = new Point(0, 0); } - return _optionsWindow; + return _control; } } @@ -30,8 +35,26 @@ protected override IWin32Window Window { get { - return GeneralControl; + return Control; } } + + #endregion + + #region Properties + + public string NdkPath + { + get { return Control.NdkPath; } + set { Control.NdkPath = value; } + } + + public string ToolsPath + { + get { return Control.ToolsPath; } + set { Control.ToolsPath = value; } + } + + #endregion } } diff --git a/src_vs2012/VSNDK.Package/Options/LogsOptionControl.Designer.cs b/src_vs2012/VSNDK.Package/Options/LogsOptionControl.Designer.cs new file mode 100644 index 00000000..9f626409 --- /dev/null +++ b/src_vs2012/VSNDK.Package/Options/LogsOptionControl.Designer.cs @@ -0,0 +1,128 @@ +namespace RIM.VSNDK_Package.Options +{ + partial class LogsOptionControl + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Component Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.chbInjectLogs = new System.Windows.Forms.CheckBox(); + this.chbLimitLogs = new System.Windows.Forms.CheckBox(); + this.label1 = new System.Windows.Forms.Label(); + this.txtLogPath = new System.Windows.Forms.TextBox(); + this.button1 = new System.Windows.Forms.Button(); + this.numLogLimit = new System.Windows.Forms.NumericUpDown(); + ((System.ComponentModel.ISupportInitialize)(this.numLogLimit)).BeginInit(); + this.SuspendLayout(); + // + // chbInjectLogs + // + this.chbInjectLogs.AutoSize = true; + this.chbInjectLogs.Location = new System.Drawing.Point(6, 76); + this.chbInjectLogs.Name = "chbInjectLogs"; + this.chbInjectLogs.Size = new System.Drawing.Size(213, 17); + this.chbInjectLogs.TabIndex = 5; + this.chbInjectLogs.Text = "Inject device logs into standard console"; + this.chbInjectLogs.UseVisualStyleBackColor = true; + // + // chbLimitLogs + // + this.chbLimitLogs.AutoSize = true; + this.chbLimitLogs.Location = new System.Drawing.Point(6, 44); + this.chbLimitLogs.Name = "chbLimitLogs"; + this.chbLimitLogs.Size = new System.Drawing.Size(151, 17); + this.chbLimitLogs.TabIndex = 3; + this.chbLimitLogs.Text = "Limit number of old logs to:"; + this.chbLimitLogs.UseVisualStyleBackColor = true; + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Location = new System.Drawing.Point(3, 8); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(76, 13); + this.label1.TabIndex = 0; + this.label1.Text = "Logs directory:"; + // + // txtLogPath + // + this.txtLogPath.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.txtLogPath.Location = new System.Drawing.Point(85, 5); + this.txtLogPath.Name = "txtLogPath"; + this.txtLogPath.Size = new System.Drawing.Size(439, 20); + this.txtLogPath.TabIndex = 1; + // + // button1 + // + this.button1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.button1.Location = new System.Drawing.Point(530, 3); + this.button1.Name = "button1"; + this.button1.Size = new System.Drawing.Size(75, 23); + this.button1.TabIndex = 2; + this.button1.Text = "Browse..."; + this.button1.UseVisualStyleBackColor = true; + // + // numLogLimit + // + this.numLogLimit.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.numLogLimit.Location = new System.Drawing.Point(478, 41); + this.numLogLimit.Name = "numLogLimit"; + this.numLogLimit.Size = new System.Drawing.Size(46, 20); + this.numLogLimit.TabIndex = 4; + this.numLogLimit.Value = new decimal(new int[] { + 25, + 0, + 0, + 0}); + // + // LogsOptionControl + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.Controls.Add(this.numLogLimit); + this.Controls.Add(this.button1); + this.Controls.Add(this.txtLogPath); + this.Controls.Add(this.label1); + this.Controls.Add(this.chbLimitLogs); + this.Controls.Add(this.chbInjectLogs); + this.Name = "LogsOptionControl"; + this.Size = new System.Drawing.Size(608, 207); + ((System.ComponentModel.ISupportInitialize)(this.numLogLimit)).EndInit(); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.CheckBox chbInjectLogs; + private System.Windows.Forms.CheckBox chbLimitLogs; + private System.Windows.Forms.Label label1; + private System.Windows.Forms.TextBox txtLogPath; + private System.Windows.Forms.Button button1; + private System.Windows.Forms.NumericUpDown numLogLimit; + } +} diff --git a/src_vs2012/VSNDK.Package/Options/LogsOptionControl.cs b/src_vs2012/VSNDK.Package/Options/LogsOptionControl.cs new file mode 100644 index 00000000..a39d400f --- /dev/null +++ b/src_vs2012/VSNDK.Package/Options/LogsOptionControl.cs @@ -0,0 +1,40 @@ +using System.Windows.Forms; + +namespace RIM.VSNDK_Package.Options +{ + public partial class LogsOptionControl : UserControl + { + public LogsOptionControl() + { + InitializeComponent(); + } + + #region Properties + + public bool InjectLogs + { + get { return chbInjectLogs.Checked; } + set { chbInjectLogs.Checked = value; } + } + + public bool LimitLogs + { + get { return chbLimitLogs.Checked; } + set { chbLimitLogs.Checked = value; } + } + + public int LimitCount + { + get { return (int) numLogLimit.Value; } + set { numLogLimit.Value = value; } + } + + public string Path + { + get { return txtLogPath.Text; } + set { txtLogPath.Text = value; } + } + + #endregion + } +} diff --git a/src_vs2012/VSNDK.Package/Options/LogsOptionControl.resx b/src_vs2012/VSNDK.Package/Options/LogsOptionControl.resx new file mode 100644 index 00000000..29dcb1b3 --- /dev/null +++ b/src_vs2012/VSNDK.Package/Options/LogsOptionControl.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/src_vs2012/VSNDK.Package/Options/LogsOptionPage.cs b/src_vs2012/VSNDK.Package/Options/LogsOptionPage.cs new file mode 100644 index 00000000..dffff4a2 --- /dev/null +++ b/src_vs2012/VSNDK.Package/Options/LogsOptionPage.cs @@ -0,0 +1,72 @@ +using System.ComponentModel; +using System.Drawing; +using System.Windows.Forms; +using System.Runtime.InteropServices; +using Microsoft.VisualStudio.Shell; + +namespace RIM.VSNDK_Package.Options +{ + /// + /// Option page to manage log settings. + /// + [Guid("fa49d8e4-61b9-4d8f-9872-26cf73a67687")] + public sealed class LogsOptionPage : DialogPage + { + #region Control + + private LogsOptionControl _control; + + private LogsOptionControl Control + { + get + { + if (_control == null) + { + _control = new LogsOptionControl(); + _control.Location = new Point(0, 0); + } + + return _control; + } + } + + [Browsable(false)] + protected override IWin32Window Window + { + get + { + return Control; + } + } + + #endregion + + #region Properties + + public bool InjectLogs + { + get { return Control.InjectLogs; } + set { Control.InjectLogs = value; } + } + + public bool LimitLogs + { + get { return Control.LimitLogs; } + set { Control.LimitLogs = value; } + } + + public int LimitCount + { + get { return Control.LimitCount; } + set { Control.LimitCount = value; } + } + + public string Path + { + get { return Control.Path; } + set { Control.Path = value; } + } + + #endregion + } +} diff --git a/src_vs2012/VSNDK.Package/Options/TargetsOptionControl.Designer.cs b/src_vs2012/VSNDK.Package/Options/TargetsOptionControl.Designer.cs new file mode 100644 index 00000000..8f872f8b --- /dev/null +++ b/src_vs2012/VSNDK.Package/Options/TargetsOptionControl.Designer.cs @@ -0,0 +1,46 @@ +namespace RIM.VSNDK_Package.Options +{ + partial class TargetsOptionControl + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Component Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.SuspendLayout(); + // + // TargetsOptionControl + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.Name = "TargetsOptionControl"; + this.Size = new System.Drawing.Size(744, 223); + this.ResumeLayout(false); + + } + + #endregion + + } +} diff --git a/src_vs2012/VSNDK.Package/Options/TargetsOptionControl.cs b/src_vs2012/VSNDK.Package/Options/TargetsOptionControl.cs new file mode 100644 index 00000000..c42e3552 --- /dev/null +++ b/src_vs2012/VSNDK.Package/Options/TargetsOptionControl.cs @@ -0,0 +1,20 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Drawing; +using System.Data; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace RIM.VSNDK_Package.Options +{ + public partial class TargetsOptionControl : UserControl + { + public TargetsOptionControl() + { + InitializeComponent(); + } + } +} diff --git a/src_vs2012/VSNDK.Package/Options/TargetsOptionControl.resx b/src_vs2012/VSNDK.Package/Options/TargetsOptionControl.resx new file mode 100644 index 00000000..29dcb1b3 --- /dev/null +++ b/src_vs2012/VSNDK.Package/Options/TargetsOptionControl.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/src_vs2012/VSNDK.Package/Options/TargetsOptionPage.cs b/src_vs2012/VSNDK.Package/Options/TargetsOptionPage.cs new file mode 100644 index 00000000..ab87a478 --- /dev/null +++ b/src_vs2012/VSNDK.Package/Options/TargetsOptionPage.cs @@ -0,0 +1,44 @@ +using System.ComponentModel; +using System.Drawing; +using System.Windows.Forms; +using System.Runtime.InteropServices; +using Microsoft.VisualStudio.Shell; + +namespace RIM.VSNDK_Package.Options +{ + /// + /// Option page to manage list of targets and debug-tokens. + /// + [Guid("acd13513-da2b-4862-a4fc-30672233d812")] + public sealed class TargetsOptionPage : DialogPage + { + #region Control + + private TargetsOptionControl _control; + + private TargetsOptionControl Control + { + get + { + if (_control == null) + { + _control = new TargetsOptionControl(); + _control.Location = new Point(0, 0); + } + + return _control; + } + } + + [Browsable(false)] + protected override IWin32Window Window + { + get + { + return Control; + } + } + + #endregion + } +} diff --git a/src_vs2012/VSNDK.Package/VSNDK.Package.csproj b/src_vs2012/VSNDK.Package/VSNDK.Package.csproj index 444bd258..b5d56534 100644 --- a/src_vs2012/VSNDK.Package/VSNDK.Package.csproj +++ b/src_vs2012/VSNDK.Package/VSNDK.Package.csproj @@ -265,6 +265,15 @@ + + UserControl + + + ApiLevelOptionControl.cs + + + Component + UserControl @@ -274,6 +283,24 @@ Component + + UserControl + + + LogsOptionControl.cs + + + Component + + + UserControl + + + TargetsOptionControl.cs + + + Component + @@ -425,9 +452,18 @@ VSPackage Designer + + ApiLevelOptionControl.cs + GeneralOptionControl.cs + + LogsOptionControl.cs + + + TargetsOptionControl.cs + From c8e679ce5bc58be880d309f57c35b4b062ecffd4 Mon Sep 17 00:00:00 2001 From: Pawel Hofman Date: Tue, 13 May 2014 02:16:07 +0200 Subject: [PATCH 040/851] Further improvements around option pages Most of the basic functionalities has been moved to new ViewModels. Unfortunatelly all the settings screens must be ported back from WPF to WinForms. --- src/VSNDK.Package/GlobalFunctions.cs | 3 +- src/VSNDK.Package/VSNDK.PackagePackage.cs | 4 + src/VSNDK.Package/VSPackage.resx | 6 +- src_vs2012/VSNDK.Package/Model/DeviceInfo.cs | 3 + src_vs2012/VSNDK.Package/Model/NdkInfo.cs | 102 +++++++--- .../Options/ApiLevelOptionControl.Designer.cs | 51 ++--- .../Options/ApiLevelOptionControl.cs | 28 ++- .../Options/GeneralOptionControl.Designer.cs | 88 ++++----- .../Options/GeneralOptionControl.cs | 4 + .../Options/GeneralOptionPage.cs | 5 + .../Options/LogsOptionControl.Designer.cs | 2 +- .../VSNDK.Package/Options/LogsOptionPage.cs | 5 + .../Options/SigningOptionControl.Designer.cs | 45 +++++ .../Options/SigningOptionControl.cs | 20 ++ .../Options/SigningOptionControl.resx | 120 +++++++++++ .../Options/SigningOptionPage.cs | 45 +++++ .../VSNDK.Package/Tools/RunnerDefaults.cs | 13 +- src_vs2012/VSNDK.Package/VSNDK.Package.csproj | 17 ++ .../ViewModels/ApiLevelViewModel.cs | 12 ++ .../ViewModels/DeviceDefinition.cs | 187 ++++++++++++++++++ .../ViewModels/DeviceDefinitionType.cs | 8 + .../VSNDK.Package/ViewModels/NdkDefinition.cs | 135 +++++++++++++ .../ViewModels/PackageViewModel.cs | 54 +++++ 23 files changed, 850 insertions(+), 107 deletions(-) create mode 100644 src_vs2012/VSNDK.Package/Options/SigningOptionControl.Designer.cs create mode 100644 src_vs2012/VSNDK.Package/Options/SigningOptionControl.cs create mode 100644 src_vs2012/VSNDK.Package/Options/SigningOptionControl.resx create mode 100644 src_vs2012/VSNDK.Package/Options/SigningOptionPage.cs create mode 100644 src_vs2012/VSNDK.Package/ViewModels/ApiLevelViewModel.cs create mode 100644 src_vs2012/VSNDK.Package/ViewModels/DeviceDefinition.cs create mode 100644 src_vs2012/VSNDK.Package/ViewModels/DeviceDefinitionType.cs create mode 100644 src_vs2012/VSNDK.Package/ViewModels/NdkDefinition.cs create mode 100644 src_vs2012/VSNDK.Package/ViewModels/PackageViewModel.cs diff --git a/src/VSNDK.Package/GlobalFunctions.cs b/src/VSNDK.Package/GlobalFunctions.cs index fb6f5078..5b2843a6 100644 --- a/src/VSNDK.Package/GlobalFunctions.cs +++ b/src/VSNDK.Package/GlobalFunctions.cs @@ -1,6 +1,5 @@ using System; -using System.Collections.Generic; -using System.Linq; +using System.Security; using System.Text; using System.Security.Cryptography; using System.IO; diff --git a/src/VSNDK.Package/VSNDK.PackagePackage.cs b/src/VSNDK.Package/VSNDK.PackagePackage.cs index 70f2a930..e82e6aed 100644 --- a/src/VSNDK.Package/VSNDK.PackagePackage.cs +++ b/src/VSNDK.Package/VSNDK.PackagePackage.cs @@ -917,6 +917,7 @@ public bool GetInstalledSimulatorList() [ProvideOptionPage(typeof(LogsOptionPage), "BlackBerry", "Logs", 1001, 1003, true)] [ProvideOptionPage(typeof(ApiLevelOptionPage), "BlackBerry", "API Levels", 1001, 1004, true)] [ProvideOptionPage(typeof(TargetsOptionPage), "BlackBerry", "Targets", 1001, 1005, true)] + [ProvideOptionPage(typeof(SigningOptionPage), "BlackBerry", "Signing", 1001, 1006, true)] public sealed class VSNDK_PackagePackage : Package { #region private member variables @@ -968,6 +969,9 @@ protected override void Initialize() TraceLog.Add(_traceWindow); TraceLog.WriteLine("BlackBerry plugin started"); + var options = GetDialogPage(typeof(GeneralOptionPage)) as GeneralOptionPage; + var path = options.NdkPath; + InstalledAPIListSingleton apiList = InstalledAPIListSingleton.Instance; TraceLog.WriteLine(" * loaded NDK descriptions"); diff --git a/src/VSNDK.Package/VSPackage.resx b/src/VSNDK.Package/VSPackage.resx index f1d746a4..22123217 100644 --- a/src/VSNDK.Package/VSPackage.resx +++ b/src/VSNDK.Package/VSPackage.resx @@ -156,7 +156,8 @@ Resources\File.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - BlackBerry Settings + BlackBerry + Name of the section in Tools -> Options General @@ -170,4 +171,7 @@ Targets + + Signing + \ No newline at end of file diff --git a/src_vs2012/VSNDK.Package/Model/DeviceInfo.cs b/src_vs2012/VSNDK.Package/Model/DeviceInfo.cs index a64e72ad..ab8263c7 100644 --- a/src_vs2012/VSNDK.Package/Model/DeviceInfo.cs +++ b/src_vs2012/VSNDK.Package/Model/DeviceInfo.cs @@ -6,6 +6,9 @@ namespace RIM.VSNDK_Package.Model { + /// + /// Detailed info about a physical device received from BlackBerry tools and services. + /// internal sealed class DeviceInfo { public DeviceInfo() diff --git a/src_vs2012/VSNDK.Package/Model/NdkInfo.cs b/src_vs2012/VSNDK.Package/Model/NdkInfo.cs index 1bad80b4..f25c96e2 100644 --- a/src_vs2012/VSNDK.Package/Model/NdkInfo.cs +++ b/src_vs2012/VSNDK.Package/Model/NdkInfo.cs @@ -64,6 +64,55 @@ public bool Exists() } } + /// + /// Checks if specified path points to the same folder as TargetPath. + /// + public bool HasTargetPath(string path) + { + if (string.IsNullOrEmpty(path) && string.IsNullOrEmpty(TargetPath)) + return true; + + return string.Compare(path, TargetPath, StringComparison.InvariantCultureIgnoreCase) == 0; + } + + /// + /// Gets the long description for this NDK. + /// + public string ToLongDescription() + { + var result = new StringBuilder(); + + result.AppendLine(Name).AppendLine(); + result.AppendLine("Version:"); + result.Append(" - ").AppendLine(Version.ToString()); + result.AppendLine(); + + result.AppendLine("Devices:"); + if (Devices.Length > 0) + { + foreach (var device in Devices) + { + result.Append(" - ").Append(device.ModelFullName).Append(", ").AppendLine(device.ModelFamily); + result.Append(" ") + .Append(device.ScreenDPI) + .Append("ppi, icon: ") + .Append(((int) device.IconResolution.Width).ToString()) + .Append("x") + .AppendLine(((int) device.IconResolution.Height).ToString()); + } + } + else + { + result.AppendLine(" No supported device information found."); + } + result.AppendLine(); + result.AppendLine("Paths:"); + result.Append(" - host: ").AppendLine(HostPath); + result.Append(" - target: ").AppendLine(TargetPath); + + return result.ToString(); + } + /// /// Loads info about a single NDK from specific config file, given as XML. /// @@ -90,10 +139,10 @@ public static NdkInfo Load(XmlReader reader) version = new Version(reader.ReadString()); break; case "host": - hostPath = reader.ReadString(); + hostPath = Path.GetFullPath(reader.ReadString()); break; case "target": - targetPath = reader.ReadString(); + targetPath = Path.GetFullPath(reader.ReadString()); break; } } @@ -164,44 +213,47 @@ private static DeviceInfo[] LoadDevices(string ndkDescriptorFileName) /// /// Loads info about all installed NDKs. /// - public static NdkInfo[] Load(string globalNdkConfigFolder) + public static NdkInfo[] Load(params string[] globalNdkConfigFolders) { - if (string.IsNullOrEmpty(globalNdkConfigFolder)) - throw new ArgumentNullException("globalNdkConfigFolder"); + if (globalNdkConfigFolders == null) + throw new ArgumentNullException("globalNdkConfigFolders"); var result = new List(); // list all configuration files: - if (Directory.Exists(globalNdkConfigFolder)) + foreach (var folder in globalNdkConfigFolders) { - try + if (Directory.Exists(folder)) { - var files = Directory.GetFiles(globalNdkConfigFolder, "*.xml", SearchOption.AllDirectories); - foreach (var file in files) + try { - try + var files = Directory.GetFiles(folder, "*.xml", SearchOption.AllDirectories); + foreach (var file in files) { - using (var fileReader = new StreamReader(file, Encoding.UTF8)) + try { - using (var reader = XmlReader.Create(fileReader)) + using (var fileReader = new StreamReader(file, Encoding.UTF8)) { - var info = Load(reader); - if (info != null && info.Exists()) - result.Add(info); + using (var reader = XmlReader.Create(fileReader)) + { + var info = Load(reader); + if (info != null && info.Exists()) + result.Add(info); + } } } - } - catch (Exception ex) - { - TraceLog.WriteLine("Unable to open configuration file: \"{0}\"", file); - TraceLog.WriteException(ex); + catch (Exception ex) + { + TraceLog.WriteLine("Unable to open configuration file: \"{0}\"", file); + TraceLog.WriteException(ex); + } } } - } - catch (Exception ex) - { - TraceLog.WriteLine("Unable to load info about configuration files from folder: \"{0}\"", globalNdkConfigFolder); - TraceLog.WriteException(ex); + catch (Exception ex) + { + TraceLog.WriteLine("Unable to load info about configuration files from folder: \"{0}\"", folder); + TraceLog.WriteException(ex); + } } } diff --git a/src_vs2012/VSNDK.Package/Options/ApiLevelOptionControl.Designer.cs b/src_vs2012/VSNDK.Package/Options/ApiLevelOptionControl.Designer.cs index b5bbedd3..865f02b0 100644 --- a/src_vs2012/VSNDK.Package/Options/ApiLevelOptionControl.Designer.cs +++ b/src_vs2012/VSNDK.Package/Options/ApiLevelOptionControl.Designer.cs @@ -28,38 +28,39 @@ protected override void Dispose(bool disposing) /// private void InitializeComponent() { - this.textBox1 = new System.Windows.Forms.TextBox(); - this.comboBox1 = new System.Windows.Forms.ComboBox(); + this.txtDescription = new System.Windows.Forms.TextBox(); + this.cmbNDKs = new System.Windows.Forms.ComboBox(); this.label1 = new System.Windows.Forms.Label(); this.button2 = new System.Windows.Forms.Button(); this.button1 = new System.Windows.Forms.Button(); this.label2 = new System.Windows.Forms.Label(); this.SuspendLayout(); // - // textBox1 + // txtDescription // - this.textBox1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + this.txtDescription.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); - this.textBox1.Location = new System.Drawing.Point(100, 60); - this.textBox1.Multiline = true; - this.textBox1.Name = "textBox1"; - this.textBox1.ReadOnly = true; - this.textBox1.ScrollBars = System.Windows.Forms.ScrollBars.Vertical; - this.textBox1.Size = new System.Drawing.Size(434, 218); - this.textBox1.TabIndex = 8; + this.txtDescription.Location = new System.Drawing.Point(100, 60); + this.txtDescription.Multiline = true; + this.txtDescription.Name = "txtDescription"; + this.txtDescription.ReadOnly = true; + this.txtDescription.ScrollBars = System.Windows.Forms.ScrollBars.Vertical; + this.txtDescription.Size = new System.Drawing.Size(434, 218); + this.txtDescription.TabIndex = 8; // - // comboBox1 + // cmbNDKs // - this.comboBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + this.cmbNDKs.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); - this.comboBox1.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; - this.comboBox1.FormattingEnabled = true; - this.comboBox1.Location = new System.Drawing.Point(100, 33); - this.comboBox1.MaxDropDownItems = 25; - this.comboBox1.Name = "comboBox1"; - this.comboBox1.Size = new System.Drawing.Size(434, 21); - this.comboBox1.TabIndex = 7; + this.cmbNDKs.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.cmbNDKs.FormattingEnabled = true; + this.cmbNDKs.Location = new System.Drawing.Point(100, 33); + this.cmbNDKs.MaxDropDownItems = 25; + this.cmbNDKs.Name = "cmbNDKs"; + this.cmbNDKs.Size = new System.Drawing.Size(434, 21); + this.cmbNDKs.TabIndex = 7; + this.cmbNDKs.SelectedIndexChanged += new System.EventHandler(this.cmbNDKs_SelectedIndexChanged); // // label1 // @@ -87,7 +88,7 @@ private void InitializeComponent() this.button1.Name = "button1"; this.button1.Size = new System.Drawing.Size(118, 23); this.button1.TabIndex = 5; - this.button1.Text = "&Install New"; + this.button1.Text = "&Install New..."; this.button1.UseVisualStyleBackColor = true; // // label2 @@ -104,8 +105,8 @@ private void InitializeComponent() this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.Controls.Add(this.label2); - this.Controls.Add(this.textBox1); - this.Controls.Add(this.comboBox1); + this.Controls.Add(this.txtDescription); + this.Controls.Add(this.cmbNDKs); this.Controls.Add(this.label1); this.Controls.Add(this.button2); this.Controls.Add(this.button1); @@ -118,8 +119,8 @@ private void InitializeComponent() #endregion - private System.Windows.Forms.TextBox textBox1; - private System.Windows.Forms.ComboBox comboBox1; + private System.Windows.Forms.TextBox txtDescription; + private System.Windows.Forms.ComboBox cmbNDKs; private System.Windows.Forms.Label label1; private System.Windows.Forms.Button button2; private System.Windows.Forms.Button button1; diff --git a/src_vs2012/VSNDK.Package/Options/ApiLevelOptionControl.cs b/src_vs2012/VSNDK.Package/Options/ApiLevelOptionControl.cs index 75da30b4..bd81c1d7 100644 --- a/src_vs2012/VSNDK.Package/Options/ApiLevelOptionControl.cs +++ b/src_vs2012/VSNDK.Package/Options/ApiLevelOptionControl.cs @@ -1,20 +1,34 @@ using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Drawing; -using System.Data; -using System.Linq; -using System.Text; -using System.Threading.Tasks; using System.Windows.Forms; +using RIM.VSNDK_Package.Model; +using RIM.VSNDK_Package.ViewModels; namespace RIM.VSNDK_Package.Options { public partial class ApiLevelOptionControl : UserControl { + private readonly ApiLevelViewModel _vm = new ApiLevelViewModel(); + public ApiLevelOptionControl() { InitializeComponent(); + + PopulateNDKs(); + } + + private void PopulateNDKs() + { + cmbNDKs.Items.Clear(); + + foreach (var ndk in _vm.InstalledNDKs) + cmbNDKs.Items.Add(ndk); + } + + private void cmbNDKs_SelectedIndexChanged(object sender, EventArgs e) + { + var selectedItem = cmbNDKs.SelectedItem as NdkInfo; + + txtDescription.Text = selectedItem != null ? selectedItem.ToLongDescription() : string.Empty; } } } diff --git a/src_vs2012/VSNDK.Package/Options/GeneralOptionControl.Designer.cs b/src_vs2012/VSNDK.Package/Options/GeneralOptionControl.Designer.cs index 2763cca0..5d1987b1 100644 --- a/src_vs2012/VSNDK.Package/Options/GeneralOptionControl.Designer.cs +++ b/src_vs2012/VSNDK.Package/Options/GeneralOptionControl.Designer.cs @@ -30,12 +30,12 @@ private void InitializeComponent() { this.txtNdkPath = new System.Windows.Forms.TextBox(); this.groupBox1 = new System.Windows.Forms.GroupBox(); - this.label1 = new System.Windows.Forms.Label(); - this.label2 = new System.Windows.Forms.Label(); - this.txtToolsPath = new System.Windows.Forms.TextBox(); - this.bttNdkBrowse = new System.Windows.Forms.Button(); - this.bttToolsBrowse = new System.Windows.Forms.Button(); this.label3 = new System.Windows.Forms.Label(); + this.bttToolsBrowse = new System.Windows.Forms.Button(); + this.bttNdkBrowse = new System.Windows.Forms.Button(); + this.txtToolsPath = new System.Windows.Forms.TextBox(); + this.label2 = new System.Windows.Forms.Label(); + this.label1 = new System.Windows.Forms.Label(); this.groupBox1.SuspendLayout(); this.SuspendLayout(); // @@ -66,32 +66,25 @@ private void InitializeComponent() this.groupBox1.TabStop = false; this.groupBox1.Text = "Locations"; // - // label1 - // - this.label1.AutoSize = true; - this.label1.Location = new System.Drawing.Point(15, 26); - this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(58, 13); - this.label1.TabIndex = 0; - this.label1.Text = "NDK Path:"; - // - // label2 + // label3 // - this.label2.AutoSize = true; - this.label2.Location = new System.Drawing.Point(15, 46); - this.label2.Name = "label2"; - this.label2.Size = new System.Drawing.Size(109, 13); - this.label2.TabIndex = 3; - this.label2.Text = "(Visual Studio Edition)"; + this.label3.AutoSize = true; + this.label3.Location = new System.Drawing.Point(15, 83); + this.label3.Name = "label3"; + this.label3.Size = new System.Drawing.Size(61, 13); + this.label3.TabIndex = 4; + this.label3.Text = "Tools Path:"; // - // txtToolsPath + // bttToolsBrowse // - this.txtToolsPath.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.txtToolsPath.Location = new System.Drawing.Point(91, 80); - this.txtToolsPath.Name = "txtToolsPath"; - this.txtToolsPath.Size = new System.Drawing.Size(429, 20); - this.txtToolsPath.TabIndex = 5; + this.bttToolsBrowse.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.bttToolsBrowse.Location = new System.Drawing.Point(527, 80); + this.bttToolsBrowse.Name = "bttToolsBrowse"; + this.bttToolsBrowse.Size = new System.Drawing.Size(75, 23); + this.bttToolsBrowse.TabIndex = 6; + this.bttToolsBrowse.Text = "Browse..."; + this.bttToolsBrowse.UseVisualStyleBackColor = true; + this.bttToolsBrowse.Click += new System.EventHandler(this.bttToolsBrowse_Click); // // bttNdkBrowse // @@ -104,25 +97,32 @@ private void InitializeComponent() this.bttNdkBrowse.UseVisualStyleBackColor = true; this.bttNdkBrowse.Click += new System.EventHandler(this.bttNdkBrowse_Click); // - // bttToolsBrowse + // txtToolsPath // - this.bttToolsBrowse.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this.bttToolsBrowse.Location = new System.Drawing.Point(527, 80); - this.bttToolsBrowse.Name = "bttToolsBrowse"; - this.bttToolsBrowse.Size = new System.Drawing.Size(75, 23); - this.bttToolsBrowse.TabIndex = 6; - this.bttToolsBrowse.Text = "Browse..."; - this.bttToolsBrowse.UseVisualStyleBackColor = true; - this.bttToolsBrowse.Click += new System.EventHandler(this.bttToolsBrowse_Click); + this.txtToolsPath.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.txtToolsPath.Location = new System.Drawing.Point(91, 80); + this.txtToolsPath.Name = "txtToolsPath"; + this.txtToolsPath.Size = new System.Drawing.Size(429, 20); + this.txtToolsPath.TabIndex = 5; // - // label3 + // label2 // - this.label3.AutoSize = true; - this.label3.Location = new System.Drawing.Point(15, 83); - this.label3.Name = "label3"; - this.label3.Size = new System.Drawing.Size(61, 13); - this.label3.TabIndex = 4; - this.label3.Text = "Tools Path:"; + this.label2.AutoSize = true; + this.label2.Location = new System.Drawing.Point(15, 46); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(109, 13); + this.label2.TabIndex = 3; + this.label2.Text = "(Visual Studio Edition)"; + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Location = new System.Drawing.Point(15, 26); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(58, 13); + this.label1.TabIndex = 0; + this.label1.Text = "NDK Path:"; // // GeneralOptionControl // diff --git a/src_vs2012/VSNDK.Package/Options/GeneralOptionControl.cs b/src_vs2012/VSNDK.Package/Options/GeneralOptionControl.cs index 7ebfa7d9..4f119b01 100644 --- a/src_vs2012/VSNDK.Package/Options/GeneralOptionControl.cs +++ b/src_vs2012/VSNDK.Package/Options/GeneralOptionControl.cs @@ -1,4 +1,5 @@ using System.Windows.Forms; +using RIM.VSNDK_Package.Tools; namespace RIM.VSNDK_Package.Options { @@ -7,6 +8,9 @@ public partial class GeneralOptionControl : UserControl public GeneralOptionControl() { InitializeComponent(); + + txtNdkPath.Text = RunnerDefaults.NdkDirectory; + txtToolsPath.Text = RunnerDefaults.ToolsDirectory; } #region Properties diff --git a/src_vs2012/VSNDK.Package/Options/GeneralOptionPage.cs b/src_vs2012/VSNDK.Package/Options/GeneralOptionPage.cs index 1eb3339b..629a117e 100644 --- a/src_vs2012/VSNDK.Package/Options/GeneralOptionPage.cs +++ b/src_vs2012/VSNDK.Package/Options/GeneralOptionPage.cs @@ -56,5 +56,10 @@ public string ToolsPath } #endregion + + protected override void OnApply(PageApplyEventArgs e) + { + base.OnApply(e); + } } } diff --git a/src_vs2012/VSNDK.Package/Options/LogsOptionControl.Designer.cs b/src_vs2012/VSNDK.Package/Options/LogsOptionControl.Designer.cs index 9f626409..6b55ee2d 100644 --- a/src_vs2012/VSNDK.Package/Options/LogsOptionControl.Designer.cs +++ b/src_vs2012/VSNDK.Package/Options/LogsOptionControl.Designer.cs @@ -78,7 +78,7 @@ private void InitializeComponent() // button1 // this.button1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this.button1.Location = new System.Drawing.Point(530, 3); + this.button1.Location = new System.Drawing.Point(530, 5); this.button1.Name = "button1"; this.button1.Size = new System.Drawing.Size(75, 23); this.button1.TabIndex = 2; diff --git a/src_vs2012/VSNDK.Package/Options/LogsOptionPage.cs b/src_vs2012/VSNDK.Package/Options/LogsOptionPage.cs index dffff4a2..0a5ca241 100644 --- a/src_vs2012/VSNDK.Package/Options/LogsOptionPage.cs +++ b/src_vs2012/VSNDK.Package/Options/LogsOptionPage.cs @@ -68,5 +68,10 @@ public string Path } #endregion + + public override void SaveSettingsToStorage() + { + base.SaveSettingsToStorage(); + } } } diff --git a/src_vs2012/VSNDK.Package/Options/SigningOptionControl.Designer.cs b/src_vs2012/VSNDK.Package/Options/SigningOptionControl.Designer.cs new file mode 100644 index 00000000..425de4c5 --- /dev/null +++ b/src_vs2012/VSNDK.Package/Options/SigningOptionControl.Designer.cs @@ -0,0 +1,45 @@ +namespace RIM.VSNDK_Package.Options +{ + partial class SigningOptionControl + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Component Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.SuspendLayout(); + // + // SigningOptionControl + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.Name = "SigningOptionControl"; + this.Size = new System.Drawing.Size(287, 185); + this.ResumeLayout(false); + + } + + #endregion + } +} diff --git a/src_vs2012/VSNDK.Package/Options/SigningOptionControl.cs b/src_vs2012/VSNDK.Package/Options/SigningOptionControl.cs new file mode 100644 index 00000000..07b46dbf --- /dev/null +++ b/src_vs2012/VSNDK.Package/Options/SigningOptionControl.cs @@ -0,0 +1,20 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Drawing; +using System.Data; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace RIM.VSNDK_Package.Options +{ + public partial class SigningOptionControl : UserControl + { + public SigningOptionControl() + { + InitializeComponent(); + } + } +} diff --git a/src_vs2012/VSNDK.Package/Options/SigningOptionControl.resx b/src_vs2012/VSNDK.Package/Options/SigningOptionControl.resx new file mode 100644 index 00000000..29dcb1b3 --- /dev/null +++ b/src_vs2012/VSNDK.Package/Options/SigningOptionControl.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/src_vs2012/VSNDK.Package/Options/SigningOptionPage.cs b/src_vs2012/VSNDK.Package/Options/SigningOptionPage.cs new file mode 100644 index 00000000..c32973b9 --- /dev/null +++ b/src_vs2012/VSNDK.Package/Options/SigningOptionPage.cs @@ -0,0 +1,45 @@ +using System.ComponentModel; +using System.Drawing; +using System.Runtime.InteropServices; +using System.Windows.Forms; +using Microsoft.VisualStudio.Shell; + +namespace RIM.VSNDK_Package.Options +{ + /// + /// Option page to manage developer signing process. + /// + [Guid("db5d17b9-8973-498b-a32d-194e8b31e431")] + public sealed class SigningOptionPage : DialogPage + { + #region Control + + private SigningOptionControl _control; + + private SigningOptionControl Control + { + get + { + if (_control == null) + { + _control = new SigningOptionControl(); + _control.Location = new Point(0, 0); + } + + return _control; + } + } + + [Browsable(false)] + protected override IWin32Window Window + { + get + { + return Control; + } + } + + #endregion + + } +} diff --git a/src_vs2012/VSNDK.Package/Tools/RunnerDefaults.cs b/src_vs2012/VSNDK.Package/Tools/RunnerDefaults.cs index 16978740..2fa7fd9b 100644 --- a/src_vs2012/VSNDK.Package/Tools/RunnerDefaults.cs +++ b/src_vs2012/VSNDK.Package/Tools/RunnerDefaults.cs @@ -7,13 +7,22 @@ internal static class RunnerDefaults { public static readonly string TestToolsDirectory; public static readonly string TestNdkDirectory; + + public static readonly string ToolsDirectory; + public static readonly string NdkDirectory; public static readonly string DataDirectory; public static readonly string InstallationConfigDirectory; + public static readonly string SupplementaryInstallationConfigDirectory; + public static readonly string RegistryPath; static RunnerDefaults() { - DataDirectory = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + @"\Research In Motion"; - InstallationConfigDirectory = Path.Combine(DataDirectory, @"BlackBerry Native SDK\qconfig"); + ToolsDirectory = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86), "BlackBerry", "VSPlugin-NDK", "qnxtools", "bin"); + NdkDirectory = Path.Combine(Path.GetPathRoot(Environment.GetFolderPath(Environment.SpecialFolder.System)), "bbndk_vs"); + DataDirectory = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "Research In Motion"); + InstallationConfigDirectory = Path.Combine(DataDirectory, "BlackBerry Native SDK", "qconfig"); + SupplementaryInstallationConfigDirectory = Path.Combine(Path.GetPathRoot(Environment.GetFolderPath(Environment.SpecialFolder.System)), "bbndk_vs", "..", "qconfig"); + RegistryPath = @"Software\BlackBerry\BlackBerryVSPlugin"; #if DEBUG // TODO: PH: 2014-05-08: for now hardcoded my repository path: diff --git a/src_vs2012/VSNDK.Package/VSNDK.Package.csproj b/src_vs2012/VSNDK.Package/VSNDK.Package.csproj index b5d56534..01c0d900 100644 --- a/src_vs2012/VSNDK.Package/VSNDK.Package.csproj +++ b/src_vs2012/VSNDK.Package/VSNDK.Package.csproj @@ -292,6 +292,15 @@ Component + + UserControl + + + SigningOptionControl.cs + + + Component + UserControl @@ -301,6 +310,11 @@ Component + + + + + @@ -461,6 +475,9 @@ LogsOptionControl.cs + + SigningOptionControl.cs + TargetsOptionControl.cs diff --git a/src_vs2012/VSNDK.Package/ViewModels/ApiLevelViewModel.cs b/src_vs2012/VSNDK.Package/ViewModels/ApiLevelViewModel.cs new file mode 100644 index 00000000..108bb1b6 --- /dev/null +++ b/src_vs2012/VSNDK.Package/ViewModels/ApiLevelViewModel.cs @@ -0,0 +1,12 @@ +using RIM.VSNDK_Package.Model; + +namespace RIM.VSNDK_Package.ViewModels +{ + internal sealed class ApiLevelViewModel + { + public NdkInfo[] InstalledNDKs + { + get { return PackageViewModel.Instance.InstalledNDKs; } + } + } +} diff --git a/src_vs2012/VSNDK.Package/ViewModels/DeviceDefinition.cs b/src_vs2012/VSNDK.Package/ViewModels/DeviceDefinition.cs new file mode 100644 index 00000000..47332723 --- /dev/null +++ b/src_vs2012/VSNDK.Package/ViewModels/DeviceDefinition.cs @@ -0,0 +1,187 @@ +using System; +using Microsoft.Win32; +using RIM.VSNDK_Package.Tools; + +namespace RIM.VSNDK_Package.ViewModels +{ + /// + /// Short definition of the device used during development. + /// + internal sealed class DeviceDefinition + { + private const string FieldDeviceName = "device_name"; + private const string FieldDeviceIP = "device_IP"; + private const string FieldDevicePassword = "device_password"; + private const string FieldSimulatorName = "simulator_name"; + private const string FieldSimulatorIP = "simulator_IP"; + private const string FieldSimulatorPassword = "simulator_password"; + + /// + /// Init constructor. + /// + public DeviceDefinition(string name, string ip, string password, DeviceDefinitionType type) + { + if (string.IsNullOrEmpty(ip)) + throw new ArgumentNullException("ip"); + if (string.IsNullOrEmpty(password)) + throw new ArgumentNullException("password"); + + Name = name; + IP = ip; + Password = password; + Type = type; + } + + #region Properties + + public string Name + { + get; + private set; + } + + public string IP + { + get; + private set; + } + + public string Password + { + get; + private set; + } + + public DeviceDefinitionType Type + { + get; + private set; + } + + #endregion + + /// + /// Retrieves device definition from the registry. + /// + public static DeviceDefinition LoadDeviceInfo() + { + return LoadInfo(DeviceDefinitionType.Device); + } + + /// + /// Retrieves simulator definition from the registry. + /// + public static DeviceDefinition LoadSimulatorInfo() + { + return LoadInfo(DeviceDefinitionType.Simulator); + } + + /// + /// Retrieves device definition from registry. + /// + public static DeviceDefinition LoadInfo(DeviceDefinitionType type) + { + if (type != DeviceDefinitionType.Device && type != DeviceDefinitionType.Simulator) + throw new ArgumentOutOfRangeException("type", "Unspported device type"); + + RegistryKey registry = Registry.CurrentUser; + RegistryKey settings; + + string name = null; + string ip = null; + string password = null; + + try + { + settings = registry.OpenSubKey(RunnerDefaults.RegistryPath); + } + catch + { + // no device definition + return null; + } + if (settings == null) + return null; + + // NAME + try + { + object xName = settings.GetValue(type == DeviceDefinitionType.Device ? FieldDeviceName : FieldSimulatorName); + if (xName != null) + name = xName.ToString(); + } + catch + { + } + + + // IP + try + { + object xIP = settings.GetValue(type == DeviceDefinitionType.Device ? FieldDeviceIP : FieldSimulatorIP); + if (xIP != null) + ip = xIP.ToString(); + } + catch + { + } + + // PASSWORD + try + { + object xPassword = settings.GetValue(type == DeviceDefinitionType.Device ? FieldDevicePassword : FieldSimulatorPassword); + if (xPassword != null) + password = GlobalFunctions.Decrypt(xPassword.ToString()); + } + catch + { + } + + settings.Close(); + registry.Close(); + + // verify arguments: + if (string.IsNullOrEmpty(ip) || string.IsNullOrEmpty(password)) + return null; + + return new DeviceDefinition(name, ip, password, type); + } + + /// + /// Saves given data about the device or simulator into the registry. + /// + public void SaveInfo() + { + RegistryKey registry = Registry.CurrentUser; + RegistryKey settings = null; + + try + { + settings = registry.CreateSubKey(RunnerDefaults.RegistryPath); + if (settings == null) + return; + + if (Name == null) + Name = string.Empty; + if (IP == null) + IP = string.Empty; + if (Password == null) + Password = string.Empty; + + settings.SetValue(Type == DeviceDefinitionType.Device ? FieldDeviceName : FieldSimulatorName, Name); + settings.SetValue(Type == DeviceDefinitionType.Device ? FieldDeviceIP : FieldSimulatorIP, IP); + settings.SetValue(Type == DeviceDefinitionType.Device ? FieldDevicePassword : FieldSimulatorPassword, GlobalFunctions.Encrypt(Password)); + } + catch + { + + } + finally + { + if (settings != null) + settings.Close(); + registry.Close(); + } + } + } +} diff --git a/src_vs2012/VSNDK.Package/ViewModels/DeviceDefinitionType.cs b/src_vs2012/VSNDK.Package/ViewModels/DeviceDefinitionType.cs new file mode 100644 index 00000000..e0df2da2 --- /dev/null +++ b/src_vs2012/VSNDK.Package/ViewModels/DeviceDefinitionType.cs @@ -0,0 +1,8 @@ +namespace RIM.VSNDK_Package.ViewModels +{ + internal enum DeviceDefinitionType + { + Device, + Simulator + } +} diff --git a/src_vs2012/VSNDK.Package/ViewModels/NdkDefinition.cs b/src_vs2012/VSNDK.Package/ViewModels/NdkDefinition.cs new file mode 100644 index 00000000..098d1995 --- /dev/null +++ b/src_vs2012/VSNDK.Package/ViewModels/NdkDefinition.cs @@ -0,0 +1,135 @@ +using System; +using System.IO; +using Microsoft.Win32; +using RIM.VSNDK_Package.Tools; + +namespace RIM.VSNDK_Package.ViewModels +{ + /// + /// Short definition of the NDK used during development. + /// + internal sealed class NdkDefinition + { + private const string FieldHostPath = "NDKHostPath"; + private const string FieldTargetPath = "NDKTargetPath"; + + #region Properties + + public NdkDefinition(string hostPath, string targetPath) + { + if (string.IsNullOrEmpty(hostPath)) + throw new ArgumentNullException("hostPath"); + if (string.IsNullOrEmpty(targetPath)) + throw new ArgumentNullException("targetPath"); + + HostPath = hostPath; + TargetPath = targetPath; + } + + public string HostPath + { + get; + private set; + } + + public string TargetPath + { + get; + private set; + } + + #endregion + + /// + /// Retrieves info about used NDK from registry. + /// + public static NdkDefinition LoadInfo() + { + RegistryKey registry = Registry.CurrentUser; + RegistryKey settings; + + string hostPath = null; + string targetPath = null; + + try + { + settings = registry.CreateSubKey(RunnerDefaults.RegistryPath); + } + catch + { + // no pluging info found at all... + return null; + } + if (settings == null) + return null; + + try + { + var xHostPath = settings.GetValue(FieldHostPath); + if (xHostPath != null) + hostPath = xHostPath.ToString(); + } + catch + { + } + + try + { + var xTargetPath = settings.GetValue(FieldTargetPath); + if (xTargetPath != null) + targetPath = xTargetPath.ToString(); + } + catch + { + } + + settings.Close(); + registry.Close(); + + // verify arguments: + if (string.IsNullOrEmpty(hostPath) || string.IsNullOrEmpty(targetPath)) + return null; + + return new NdkDefinition(hostPath, targetPath); + } + + /// + /// Saves NDK info into the registry. + /// + public void SaveInfo() + { + RegistryKey registry = Registry.CurrentUser; + RegistryKey settings = null; + + try + { + settings = registry.CreateSubKey(RunnerDefaults.RegistryPath); + if (settings == null) + return; + + settings.SetValue(FieldHostPath, HostPath); + settings.SetValue(FieldTargetPath, TargetPath); + + string qnxConfigPath = Path.Combine(RunnerDefaults.DataDirectory, "BlackBerry Native SDK"); + + // TODO: PH: copied from 'SettingsData.cs' - I don't quite get, why we need to overwrite EV + // as this will break Android as well as installed BB10 NDKs with Momentics... + Environment.SetEnvironmentVariable("QNX_TARGET", TargetPath); + Environment.SetEnvironmentVariable("QNX_HOST", HostPath); + Environment.SetEnvironmentVariable("QNX_CONFIGURATION", qnxConfigPath); + + string ndkpath = string.Format(@"{0}/usr/bin;{1}\bin;{0}/usr/qde/eclipse/jre/bin;", HostPath, qnxConfigPath) + Environment.GetEnvironmentVariable("PATH"); + Environment.SetEnvironmentVariable("PATH", ndkpath); + } + catch + { + } + finally + { + if (settings != null) + settings.Close(); + registry.Close(); + } + } + } +} diff --git a/src_vs2012/VSNDK.Package/ViewModels/PackageViewModel.cs b/src_vs2012/VSNDK.Package/ViewModels/PackageViewModel.cs new file mode 100644 index 00000000..a06f401d --- /dev/null +++ b/src_vs2012/VSNDK.Package/ViewModels/PackageViewModel.cs @@ -0,0 +1,54 @@ +using RIM.VSNDK_Package.Model; +using RIM.VSNDK_Package.Tools; + +namespace RIM.VSNDK_Package.ViewModels +{ + /// + /// This is a global view-model, that keeps track and caches all the data. + /// + internal sealed class PackageViewModel + { + #region Singleton + + private static PackageViewModel _instance; + + /// + /// Gets the instance of the ViewModel. + /// + public static PackageViewModel Instance + { + get + { + if (_instance == null) + _instance = new PackageViewModel(); + return _instance; + } + } + + #endregion + + private NdkInfo[] _installedNDKs; + + public PackageViewModel() + { + } + + #region Properties + + public NdkInfo[] InstalledNDKs + { + get + { + if (_installedNDKs == null) + { + // load info about NDKs from specified locations: + _installedNDKs = NdkInfo.Load(RunnerDefaults.InstallationConfigDirectory, RunnerDefaults.SupplementaryInstallationConfigDirectory); + } + + return _installedNDKs; + } + } + + #endregion + } +} From a31cd0b7d888003b7460dbacd000516af5b9d461 Mon Sep 17 00:00:00 2001 From: Pawel Hofman Date: Tue, 13 May 2014 09:47:01 +0200 Subject: [PATCH 041/851] Renamed ApiLevel VM to better reflect its origin --- src_vs2012/VSNDK.Package/VSNDK.Package.csproj | 2 +- .../{ApiLevelViewModel.cs => ApiLevelOptionViewModel.cs} | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename src_vs2012/VSNDK.Package/ViewModels/{ApiLevelViewModel.cs => ApiLevelOptionViewModel.cs} (100%) diff --git a/src_vs2012/VSNDK.Package/VSNDK.Package.csproj b/src_vs2012/VSNDK.Package/VSNDK.Package.csproj index 01c0d900..1bff1c4f 100644 --- a/src_vs2012/VSNDK.Package/VSNDK.Package.csproj +++ b/src_vs2012/VSNDK.Package/VSNDK.Package.csproj @@ -310,7 +310,7 @@ Component - + diff --git a/src_vs2012/VSNDK.Package/ViewModels/ApiLevelViewModel.cs b/src_vs2012/VSNDK.Package/ViewModels/ApiLevelOptionViewModel.cs similarity index 100% rename from src_vs2012/VSNDK.Package/ViewModels/ApiLevelViewModel.cs rename to src_vs2012/VSNDK.Package/ViewModels/ApiLevelOptionViewModel.cs From 70435dd3c63d0226f1e527445a8fda6fdf074280 Mon Sep 17 00:00:00 2001 From: Pawel Hofman Date: Tue, 13 May 2014 10:13:09 +0200 Subject: [PATCH 042/851] Added more helper methods into diagnostic logs --- .../VSNDK.Package/Diagnostics/TraceLog.cs | 64 ++++++++++++++++++- 1 file changed, 62 insertions(+), 2 deletions(-) diff --git a/src_vs2012/VSNDK.Package/Diagnostics/TraceLog.cs b/src_vs2012/VSNDK.Package/Diagnostics/TraceLog.cs index 38001c34..102111d1 100644 --- a/src_vs2012/VSNDK.Package/Diagnostics/TraceLog.cs +++ b/src_vs2012/VSNDK.Package/Diagnostics/TraceLog.cs @@ -47,6 +47,30 @@ public static void WriteLine(string format, params object[] args) Trace.WriteLine(string.Format(format, args), Category); } + /// + /// Writes a warning message. + /// + [Conditional("TRACE")] + public static void WarnLine(string message) + { + if (message == null) + return; + + Trace.WriteLine("!! " + message, Category); + } + + /// + /// Writes a warning message. + /// + [Conditional("TRACE")] + public static void WarnLine(string format, params object[] args) + { + if (format == null) + return; + + Trace.WriteLine("!! " + string.Format(format, args), Category); + } + /// /// Writes info about the exception. /// @@ -56,16 +80,52 @@ public static void WriteException(Exception ex) if (ex == null) return; - Trace.WriteLine(FlatException(ex), Category); + Trace.WriteLine(FlatException(ex, null), Category); + } + + /// + /// Writes info about the exception. + /// + [Conditional("TRACE")] + public static void WriteException(Exception ex, string message) + { + if (ex == null) + { + WriteLine(message); + } + else + { + Trace.WriteLine(FlatException(ex, message), Category); + } + } + + /// + /// Writes info about the exception. + /// + [Conditional("TRACE")] + public static void WriteException(Exception ex, string format, params object[] args) + { + if (ex == null) + { + WriteLine(format, args); + } + else + { + string message = format == null ? null : string.Format(format, args); + Trace.WriteLine(FlatException(ex, message), Category); + } } /// /// Converts exception data into a single string. /// - private static string FlatException(Exception ex) + private static string FlatException(Exception ex, string message) { var result = new StringBuilder(); + if (message != null) + result.AppendLine(message); + while (ex != null) { // get info: From 238734e131d3f3e7708e7144de1e2db4f0360345 Mon Sep 17 00:00:00 2001 From: Pawel Hofman Date: Tue, 13 May 2014 12:21:18 +0200 Subject: [PATCH 043/851] Removed duplicates, when detecting installed NDKs Matching is based on paths (host & target). The NDK with longer name is preffered. --- src_vs2012/VSNDK.Package/Model/NdkInfo.cs | 72 +++++++++++++++++++---- 1 file changed, 62 insertions(+), 10 deletions(-) diff --git a/src_vs2012/VSNDK.Package/Model/NdkInfo.cs b/src_vs2012/VSNDK.Package/Model/NdkInfo.cs index f25c96e2..ab82c507 100644 --- a/src_vs2012/VSNDK.Package/Model/NdkInfo.cs +++ b/src_vs2012/VSNDK.Package/Model/NdkInfo.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Globalization; using System.IO; using System.Text; using System.Xml; @@ -64,15 +65,40 @@ public bool Exists() } } + /// + /// Compares two paths, if they are identical. + /// + private static bool HasPath(string pathA, string pathB) + { + if (string.IsNullOrEmpty(pathA) && string.IsNullOrEmpty(pathB)) + return true; + + // assuming that paths we aquired by Path.GetFullPath(...) + return string.Compare(pathA, pathB, StringComparison.InvariantCultureIgnoreCase) == 0; + } + /// /// Checks if specified path points to the same folder as TargetPath. /// public bool HasTargetPath(string path) { - if (string.IsNullOrEmpty(path) && string.IsNullOrEmpty(TargetPath)) - return true; + return HasPath(TargetPath, path); + } + + /// + /// Checks if given NDK info has identical paths. + /// + public bool Matches(string hostPath, string targetPath) + { + return HasPath(HostPath, hostPath) && HasPath(TargetPath, targetPath); + } - return string.Compare(path, TargetPath, StringComparison.InvariantCultureIgnoreCase) == 0; + /// + /// Checks if given NDKs are identical. + /// + public bool Matches(NdkInfo ndk) + { + return HasPath(HostPath, ndk != null ? ndk.HostPath : null) && HasPath(TargetPath, ndk != null ? ndk.TargetPath : null); } /// @@ -203,8 +229,7 @@ private static DeviceInfo[] LoadDevices(string ndkDescriptorFileName) } catch (Exception ex) { - TraceLog.WriteLine("Unable to load NDK descriptor file: \"{0}\"", ndkDescriptorFileName); - TraceLog.WriteException(ex); + TraceLog.WriteException(ex, "Unable to load NDK descriptor file: \"{0}\"", ndkDescriptorFileName); return null; } @@ -228,6 +253,7 @@ public static NdkInfo[] Load(params string[] globalNdkConfigFolders) try { var files = Directory.GetFiles(folder, "*.xml", SearchOption.AllDirectories); + foreach (var file in files) { try @@ -238,21 +264,36 @@ public static NdkInfo[] Load(params string[] globalNdkConfigFolders) { var info = Load(reader); if (info != null && info.Exists()) - result.Add(info); + { + var existingIndex = IndexOf(result, info); + + // if NDK info exist with exacly the same paths, prefer to keep the one with longer name: + if (existingIndex >= 0) + { + var existingItem = result[existingIndex]; + if (existingItem.Name != null && info.Name != null && existingItem.Name.Length < info.Name.Length) + { + result.RemoveAt(existingIndex); + result.Add(info); + } + } + else + { + result.Add(info); + } + } } } } catch (Exception ex) { - TraceLog.WriteLine("Unable to open configuration file: \"{0}\"", file); - TraceLog.WriteException(ex); + TraceLog.WriteException(ex, "Unable to open configuration file: \"{0}\"", file); } } } catch (Exception ex) { - TraceLog.WriteLine("Unable to load info about configuration files from folder: \"{0}\"", folder); - TraceLog.WriteException(ex); + TraceLog.WriteException(ex, "Unable to load info about configuration files from folder: \"{0}\"", folder); } } } @@ -261,6 +302,17 @@ public static NdkInfo[] Load(params string[] globalNdkConfigFolders) return result.ToArray(); } + private static int IndexOf(IEnumerable list, NdkInfo info) + { + int i = 0; + foreach (var item in list) + { + if (item.Matches(info)) + return i; + i++; + } + return -1; + } /// /// Compares the current object with another object of the same type. From 5d3d793163888d79a70dc8bda62a7f0957af05fd Mon Sep 17 00:00:00 2001 From: Pawel Hofman Date: Tue, 13 May 2014 12:22:31 +0200 Subject: [PATCH 044/851] Alignment fix on LogsOption control --- src_vs2012/VSNDK.Package/Options/LogsOptionControl.Designer.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src_vs2012/VSNDK.Package/Options/LogsOptionControl.Designer.cs b/src_vs2012/VSNDK.Package/Options/LogsOptionControl.Designer.cs index 6b55ee2d..f22432e3 100644 --- a/src_vs2012/VSNDK.Package/Options/LogsOptionControl.Designer.cs +++ b/src_vs2012/VSNDK.Package/Options/LogsOptionControl.Designer.cs @@ -78,7 +78,7 @@ private void InitializeComponent() // button1 // this.button1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this.button1.Location = new System.Drawing.Point(530, 5); + this.button1.Location = new System.Drawing.Point(530, 4); this.button1.Name = "button1"; this.button1.Size = new System.Drawing.Size(75, 23); this.button1.TabIndex = 2; From 9786f3bb1fe1f441aa33cd9a60971b139a73c18e Mon Sep 17 00:00:00 2001 From: Pawel Hofman Date: Tue, 13 May 2014 12:26:26 +0200 Subject: [PATCH 045/851] Implemented API Level selection settings --- src/VSNDK.Package/VSNDK.PackagePackage.cs | 1 + src_vs2012/VSNDK.Package/MessageBoxHelper.cs | 161 ++++++++++++++++++ .../Options/ApiLevelOptionControl.Designer.cs | 8 +- .../Options/ApiLevelOptionControl.cs | 18 +- .../Options/ApiLevelOptionPage.cs | 19 ++- src_vs2012/VSNDK.Package/VSNDK.Package.csproj | 1 + .../ViewModels/ApiLevelOptionViewModel.cs | 8 +- .../ViewModels/DeviceDefinition.cs | 42 +++-- .../VSNDK.Package/ViewModels/NdkDefinition.cs | 36 +++- .../ViewModels/PackageViewModel.cs | 90 +++++++++- 10 files changed, 358 insertions(+), 26 deletions(-) create mode 100644 src_vs2012/VSNDK.Package/MessageBoxHelper.cs diff --git a/src/VSNDK.Package/VSNDK.PackagePackage.cs b/src/VSNDK.Package/VSNDK.PackagePackage.cs index e82e6aed..b25a714f 100644 --- a/src/VSNDK.Package/VSNDK.PackagePackage.cs +++ b/src/VSNDK.Package/VSNDK.PackagePackage.cs @@ -960,6 +960,7 @@ protected override void Initialize() { Trace.WriteLine (string.Format(CultureInfo.CurrentCulture, "Entering Initialize() of: {0}", ToString())); base.Initialize(); + MessageBoxHelper.Initialise(this); // create dedicated trace-logs output window pane (available in combo-box at regular Visual Studio Output Window): _traceWindow = new BlackBerryPaneTraceListener("BlackBerry", true, GetService(typeof(SVsOutputWindow)) as IVsOutputWindow, GuidList.GUID_TraceOutputWindowPane); diff --git a/src_vs2012/VSNDK.Package/MessageBoxHelper.cs b/src_vs2012/VSNDK.Package/MessageBoxHelper.cs new file mode 100644 index 00000000..6fc657cc --- /dev/null +++ b/src_vs2012/VSNDK.Package/MessageBoxHelper.cs @@ -0,0 +1,161 @@ +using System; +using System.Windows.Forms; +using Microsoft.VisualStudio; +using Microsoft.VisualStudio.Shell.Interop; + +namespace RIM.VSNDK_Package +{ + public static class MessageBoxHelper + { + private const int IDABORT = 3; + private const int IDCANCEL = 2; + private const int IDIGNORE = 5; + private const int IDNO = 7; + private const int IDOK = 1; + private const int IDRETRY = 4; + private const int IDYES = 6; + + + private static IVsUIShell _uiShell; + + /// + /// Initialize internal structures. + /// + public static void Initialise(IServiceProvider serviceProvider) + { + if (serviceProvider == null) + throw new ArgumentNullException("serviceProvider"); + + _uiShell = serviceProvider.GetService(typeof(IVsUIShell)) as IVsUIShell; + if (_uiShell == null) + throw new InvalidOperationException("Unable to initialize UiShell"); + } + + /// + /// Shows message box. + /// + public static DialogResult Show(string text, string title, MessageBoxButtons buttons, MessageBoxIcon icon, + MessageBoxDefaultButton defaultButton) + { + // check the state: + if (_uiShell == null) + throw new InvalidOperationException("MessageBox ecosystem has not been initialized properly yet"); + + var guid = Guid.Empty; + int result; + var xButton = OLEMSGBUTTON.OLEMSGBUTTON_OKCANCEL; + var xIcon = OLEMSGICON.OLEMSGICON_INFO; + var xDefaultButton = OLEMSGDEFBUTTON.OLEMSGDEFBUTTON_FIRST; + + switch (buttons) + { + case MessageBoxButtons.OK: + xButton = OLEMSGBUTTON.OLEMSGBUTTON_OK; + break; + case MessageBoxButtons.OKCancel: + xButton = OLEMSGBUTTON.OLEMSGBUTTON_OKCANCEL; + break; + case MessageBoxButtons.RetryCancel: + xButton = OLEMSGBUTTON.OLEMSGBUTTON_RETRYCANCEL; + break; + case MessageBoxButtons.AbortRetryIgnore: + xButton = OLEMSGBUTTON.OLEMSGBUTTON_ABORTRETRYIGNORE; + break; + case MessageBoxButtons.YesNo: + xButton = OLEMSGBUTTON.OLEMSGBUTTON_YESNO; + break; + case MessageBoxButtons.YesNoCancel: + xButton = OLEMSGBUTTON.OLEMSGBUTTON_YESNOCANCEL; + break; + } + + switch (icon) + { + case MessageBoxIcon.Question: + xIcon = OLEMSGICON.OLEMSGICON_QUERY; + break; + case MessageBoxIcon.Information: + xIcon = OLEMSGICON.OLEMSGICON_INFO; + break; + case MessageBoxIcon.Error: + xIcon = OLEMSGICON.OLEMSGICON_CRITICAL; + break; + case MessageBoxIcon.Exclamation: + xIcon = OLEMSGICON.OLEMSGICON_WARNING; + break; + } + + switch (defaultButton) + { + case MessageBoxDefaultButton.Button1: + xDefaultButton = OLEMSGDEFBUTTON.OLEMSGDEFBUTTON_FIRST; + break; + case MessageBoxDefaultButton.Button2: + xDefaultButton = OLEMSGDEFBUTTON.OLEMSGDEFBUTTON_SECOND; + break; + case MessageBoxDefaultButton.Button3: + xDefaultButton = OLEMSGDEFBUTTON.OLEMSGDEFBUTTON_THIRD; + break; + } + + // show proper message box: + ErrorHandler.ThrowOnFailure(_uiShell.ShowMessageBox(0, ref guid, title, text, null, 0, + xButton, + xDefaultButton, + xIcon, 0, out result)); + + // interpret the result: + switch (result) + { + case IDOK: + return DialogResult.OK; + case IDCANCEL: + return DialogResult.Cancel; + case IDABORT: + return DialogResult.Abort; + case IDIGNORE: + return DialogResult.Ignore; + case IDNO: + return DialogResult.No; + case IDYES: + return DialogResult.Yes; + case IDRETRY: + return DialogResult.Retry; + default: + return DialogResult.None; + } + } + + /// + /// Shows message box. + /// + public static DialogResult Show(string text, string title, MessageBoxButtons buttons, MessageBoxIcon icon) + { + return Show(text, title, buttons, icon, MessageBoxDefaultButton.Button1); + } + + /// + /// Shows message box. + /// + public static DialogResult Show(string text, string title, MessageBoxButtons buttons) + { + return Show(text, title, buttons, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1); + } + + /// + /// Shows message box. + /// + public static DialogResult Show(string text, string title, MessageBoxIcon icon) + { + return Show(text, title, MessageBoxButtons.OK, icon, MessageBoxDefaultButton.Button1); + } + + /// + /// Shows message box. + /// + public static DialogResult Show(string text, string title) + { + return Show(text, title, MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1); + } + } +} diff --git a/src_vs2012/VSNDK.Package/Options/ApiLevelOptionControl.Designer.cs b/src_vs2012/VSNDK.Package/Options/ApiLevelOptionControl.Designer.cs index 865f02b0..48b4129c 100644 --- a/src_vs2012/VSNDK.Package/Options/ApiLevelOptionControl.Designer.cs +++ b/src_vs2012/VSNDK.Package/Options/ApiLevelOptionControl.Designer.cs @@ -41,12 +41,12 @@ private void InitializeComponent() this.txtDescription.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); - this.txtDescription.Location = new System.Drawing.Point(100, 60); + this.txtDescription.Location = new System.Drawing.Point(6, 85); this.txtDescription.Multiline = true; this.txtDescription.Name = "txtDescription"; this.txtDescription.ReadOnly = true; this.txtDescription.ScrollBars = System.Windows.Forms.ScrollBars.Vertical; - this.txtDescription.Size = new System.Drawing.Size(434, 218); + this.txtDescription.Size = new System.Drawing.Size(528, 193); this.txtDescription.TabIndex = 8; // // cmbNDKs @@ -55,10 +55,10 @@ private void InitializeComponent() | System.Windows.Forms.AnchorStyles.Right))); this.cmbNDKs.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.cmbNDKs.FormattingEnabled = true; - this.cmbNDKs.Location = new System.Drawing.Point(100, 33); + this.cmbNDKs.Location = new System.Drawing.Point(6, 58); this.cmbNDKs.MaxDropDownItems = 25; this.cmbNDKs.Name = "cmbNDKs"; - this.cmbNDKs.Size = new System.Drawing.Size(434, 21); + this.cmbNDKs.Size = new System.Drawing.Size(528, 21); this.cmbNDKs.TabIndex = 7; this.cmbNDKs.SelectedIndexChanged += new System.EventHandler(this.cmbNDKs_SelectedIndexChanged); // diff --git a/src_vs2012/VSNDK.Package/Options/ApiLevelOptionControl.cs b/src_vs2012/VSNDK.Package/Options/ApiLevelOptionControl.cs index bd81c1d7..b6d39498 100644 --- a/src_vs2012/VSNDK.Package/Options/ApiLevelOptionControl.cs +++ b/src_vs2012/VSNDK.Package/Options/ApiLevelOptionControl.cs @@ -7,7 +7,7 @@ namespace RIM.VSNDK_Package.Options { public partial class ApiLevelOptionControl : UserControl { - private readonly ApiLevelViewModel _vm = new ApiLevelViewModel(); + private readonly ApiLevelOptionViewModel _vm = new ApiLevelOptionViewModel(); public ApiLevelOptionControl() { @@ -22,6 +22,8 @@ private void PopulateNDKs() foreach (var ndk in _vm.InstalledNDKs) cmbNDKs.Items.Add(ndk); + + cmbNDKs.SelectedItem = _vm.ActiveNDK; } private void cmbNDKs_SelectedIndexChanged(object sender, EventArgs e) @@ -30,5 +32,19 @@ private void cmbNDKs_SelectedIndexChanged(object sender, EventArgs e) txtDescription.Text = selectedItem != null ? selectedItem.ToLongDescription() : string.Empty; } + + #region Properties + + public bool HasSelectedNDK + { + get { return cmbNDKs.SelectedItem != null; } + } + + #endregion + + internal void OnApply() + { + _vm.ActiveNDK = cmbNDKs.SelectedItem as NdkInfo; + } } } diff --git a/src_vs2012/VSNDK.Package/Options/ApiLevelOptionPage.cs b/src_vs2012/VSNDK.Package/Options/ApiLevelOptionPage.cs index 37e3adaf..22810b96 100644 --- a/src_vs2012/VSNDK.Package/Options/ApiLevelOptionPage.cs +++ b/src_vs2012/VSNDK.Package/Options/ApiLevelOptionPage.cs @@ -1,8 +1,10 @@ -using System.ComponentModel; +using System; +using System.ComponentModel; using System.Drawing; using System.Windows.Forms; using System.Runtime.InteropServices; using Microsoft.VisualStudio.Shell; +using RIM.VSNDK_Package.ViewModels; namespace RIM.VSNDK_Package.Options { @@ -40,5 +42,20 @@ protected override IWin32Window Window } #endregion + + protected override void OnApply(PageApplyEventArgs e) + { + Control.OnApply(); + + if (!Control.HasSelectedNDK || PackageViewModel.Instance.ActiveNDK == null) + { + if (MessageBoxHelper.Show("No NDK set as active or the one seems to not exist. You won't be able to compile anything. Do you want to correct it?", + "API Level Settings", + MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) + { + e.ApplyBehavior = ApplyKind.Cancel; + } + } + } } } diff --git a/src_vs2012/VSNDK.Package/VSNDK.Package.csproj b/src_vs2012/VSNDK.Package/VSNDK.Package.csproj index 1bff1c4f..7cfa0924 100644 --- a/src_vs2012/VSNDK.Package/VSNDK.Package.csproj +++ b/src_vs2012/VSNDK.Package/VSNDK.Package.csproj @@ -257,6 +257,7 @@ + diff --git a/src_vs2012/VSNDK.Package/ViewModels/ApiLevelOptionViewModel.cs b/src_vs2012/VSNDK.Package/ViewModels/ApiLevelOptionViewModel.cs index 108bb1b6..cb51d5d8 100644 --- a/src_vs2012/VSNDK.Package/ViewModels/ApiLevelOptionViewModel.cs +++ b/src_vs2012/VSNDK.Package/ViewModels/ApiLevelOptionViewModel.cs @@ -2,11 +2,17 @@ namespace RIM.VSNDK_Package.ViewModels { - internal sealed class ApiLevelViewModel + internal sealed class ApiLevelOptionViewModel { public NdkInfo[] InstalledNDKs { get { return PackageViewModel.Instance.InstalledNDKs; } } + + public NdkInfo ActiveNDK + { + get { return PackageViewModel.Instance.ActiveNDK; } + set { PackageViewModel.Instance.ActiveNDK = value; } + } } } diff --git a/src_vs2012/VSNDK.Package/ViewModels/DeviceDefinition.cs b/src_vs2012/VSNDK.Package/ViewModels/DeviceDefinition.cs index 47332723..0e8a9b28 100644 --- a/src_vs2012/VSNDK.Package/ViewModels/DeviceDefinition.cs +++ b/src_vs2012/VSNDK.Package/ViewModels/DeviceDefinition.cs @@ -63,23 +63,23 @@ public DeviceDefinitionType Type /// /// Retrieves device definition from the registry. /// - public static DeviceDefinition LoadDeviceInfo() + public static DeviceDefinition LoadDevice() { - return LoadInfo(DeviceDefinitionType.Device); + return Load(DeviceDefinitionType.Device); } /// /// Retrieves simulator definition from the registry. /// - public static DeviceDefinition LoadSimulatorInfo() + public static DeviceDefinition LoadSimulator() { - return LoadInfo(DeviceDefinitionType.Simulator); + return Load(DeviceDefinitionType.Simulator); } /// /// Retrieves device definition from registry. /// - public static DeviceDefinition LoadInfo(DeviceDefinitionType type) + public static DeviceDefinition Load(DeviceDefinitionType type) { if (type != DeviceDefinitionType.Device && type != DeviceDefinitionType.Simulator) throw new ArgumentOutOfRangeException("type", "Unspported device type"); @@ -147,10 +147,36 @@ public static DeviceDefinition LoadInfo(DeviceDefinitionType type) return new DeviceDefinition(name, ip, password, type); } + /// + /// Removes the info about selected device from the registry. + /// + public static void Delete(DeviceDefinitionType type) + { + RegistryKey registry = Registry.CurrentUser; + RegistryKey settings = null; + + try + { + settings = registry.OpenSubKey(RunnerDefaults.RegistryPath); + if (settings == null) + return; + + settings.DeleteSubKey(type == DeviceDefinitionType.Device ? FieldDeviceName : FieldSimulatorName); + settings.DeleteSubKey(type == DeviceDefinitionType.Device ? FieldDeviceIP : FieldSimulatorIP); + settings.DeleteSubKey(type == DeviceDefinitionType.Device ? FieldDevicePassword : FieldSimulatorPassword); + } + finally + { + if (settings != null) + settings.Close(); + registry.Close(); + } + } + /// /// Saves given data about the device or simulator into the registry. /// - public void SaveInfo() + public void Save() { RegistryKey registry = Registry.CurrentUser; RegistryKey settings = null; @@ -171,10 +197,6 @@ public void SaveInfo() settings.SetValue(Type == DeviceDefinitionType.Device ? FieldDeviceName : FieldSimulatorName, Name); settings.SetValue(Type == DeviceDefinitionType.Device ? FieldDeviceIP : FieldSimulatorIP, IP); settings.SetValue(Type == DeviceDefinitionType.Device ? FieldDevicePassword : FieldSimulatorPassword, GlobalFunctions.Encrypt(Password)); - } - catch - { - } finally { diff --git a/src_vs2012/VSNDK.Package/ViewModels/NdkDefinition.cs b/src_vs2012/VSNDK.Package/ViewModels/NdkDefinition.cs index 098d1995..dc724d68 100644 --- a/src_vs2012/VSNDK.Package/ViewModels/NdkDefinition.cs +++ b/src_vs2012/VSNDK.Package/ViewModels/NdkDefinition.cs @@ -43,7 +43,7 @@ public string TargetPath /// /// Retrieves info about used NDK from registry. /// - public static NdkDefinition LoadInfo() + public static NdkDefinition Load() { RegistryKey registry = Registry.CurrentUser; RegistryKey settings; @@ -67,7 +67,7 @@ public static NdkDefinition LoadInfo() { var xHostPath = settings.GetValue(FieldHostPath); if (xHostPath != null) - hostPath = xHostPath.ToString(); + hostPath = Path.GetFullPath(xHostPath.ToString()); } catch { @@ -77,7 +77,7 @@ public static NdkDefinition LoadInfo() { var xTargetPath = settings.GetValue(FieldTargetPath); if (xTargetPath != null) - targetPath = xTargetPath.ToString(); + targetPath = Path.GetFullPath(xTargetPath.ToString()); } catch { @@ -93,10 +93,35 @@ public static NdkDefinition LoadInfo() return new NdkDefinition(hostPath, targetPath); } + /// + /// Removes NDK info from the registry. + /// + public static void Delete() + { + RegistryKey registry = Registry.CurrentUser; + RegistryKey settings = null; + + try + { + settings = registry.OpenSubKey(RunnerDefaults.RegistryPath); + if (settings == null) + return; + + settings.DeleteSubKey(FieldHostPath); + settings.DeleteSubKey(FieldTargetPath); + } + finally + { + if (settings != null) + settings.Close(); + registry.Close(); + } + } + /// /// Saves NDK info into the registry. /// - public void SaveInfo() + public void Save() { RegistryKey registry = Registry.CurrentUser; RegistryKey settings = null; @@ -121,9 +146,6 @@ public void SaveInfo() string ndkpath = string.Format(@"{0}/usr/bin;{1}\bin;{0}/usr/qde/eclipse/jre/bin;", HostPath, qnxConfigPath) + Environment.GetEnvironmentVariable("PATH"); Environment.SetEnvironmentVariable("PATH", ndkpath); } - catch - { - } finally { if (settings != null) diff --git a/src_vs2012/VSNDK.Package/ViewModels/PackageViewModel.cs b/src_vs2012/VSNDK.Package/ViewModels/PackageViewModel.cs index a06f401d..1bcff5b1 100644 --- a/src_vs2012/VSNDK.Package/ViewModels/PackageViewModel.cs +++ b/src_vs2012/VSNDK.Package/ViewModels/PackageViewModel.cs @@ -1,4 +1,6 @@ -using RIM.VSNDK_Package.Model; +using System; +using RIM.VSNDK_Package.Diagnostics; +using RIM.VSNDK_Package.Model; using RIM.VSNDK_Package.Tools; namespace RIM.VSNDK_Package.ViewModels @@ -28,6 +30,7 @@ public static PackageViewModel Instance #endregion private NdkInfo[] _installedNDKs; + private NdkInfo _activeNDK; public PackageViewModel() { @@ -49,6 +52,89 @@ public NdkInfo[] InstalledNDKs } } - #endregion + /// + /// Loads info about currently used NDK from registry. + /// + public NdkInfo ActiveNDK + { + get + { + if (_activeNDK != null) + return _activeNDK; + + // or try to find it: + var settings = NdkDefinition.Load(); + + if (settings == null) + return null; + + // find matching installed NDK by comparing paths: + foreach(var info in InstalledNDKs) + if (info.Matches(settings.HostPath, settings.TargetPath)) + { + _activeNDK = info; + + TraceLog.WriteLine("Found active NDK: \"{0}\"", _activeNDK); + return info; + } + + return null; + } + set + { + if (value != null) + { + var index = Array.IndexOf(InstalledNDKs, value); + if (index < 0) + throw new ArgumentOutOfRangeException("value", "Invalid value set, it must belong to the InstalledNDKs first"); + + if (!value.Matches(_activeNDK)) + { + _activeNDK = value; + TraceLog.WriteLine("Changed active NDK to: \"{0}\"", _activeNDK); + SaveActiveNDK(); + } + } + } + } + + #endregion + + /// + /// Persists info about currently selected NDK into the registry. + /// + public void SaveActiveNDK() + { + if (_activeNDK == null || !_activeNDK.Exists()) + { + TraceLog.WarnLine("Invalid NDK to set as active!"); + return; + } + + try + { + var setting = new NdkDefinition(_activeNDK.HostPath, _activeNDK.TargetPath); + setting.Save(); + } + catch (Exception ex) + { + TraceLog.WriteException(ex, "Unable to activate NDK \"{0}\"", _activeNDK); + } + } + + /// + /// Removes info about selected NDK from the registry. + /// + public void DeleteActiveNDK() + { + try + { + NdkDefinition.Delete(); + } + catch (Exception ex) + { + TraceLog.WriteException(ex, "Unable to clear info about active NDK"); + } + } } } From 4267ec456a5b61f9175b89cfffa6e610b08558c7 Mon Sep 17 00:00:00 2001 From: Pawel Hofman Date: Tue, 13 May 2014 13:23:47 +0200 Subject: [PATCH 046/851] Logs settings now setup a path via 'Browse...' --- .../VSNDK.Package/Options/DialogHelper.cs | 23 ++++++++++++++++ .../Options/GeneralOptionControl.cs | 17 ++---------- .../Options/LogsOptionControl.Designer.cs | 27 +++++++++++-------- .../Options/LogsOptionControl.cs | 5 ++++ src_vs2012/VSNDK.Package/VSNDK.Package.csproj | 1 + 5 files changed, 47 insertions(+), 26 deletions(-) create mode 100644 src_vs2012/VSNDK.Package/Options/DialogHelper.cs diff --git a/src_vs2012/VSNDK.Package/Options/DialogHelper.cs b/src_vs2012/VSNDK.Package/Options/DialogHelper.cs new file mode 100644 index 00000000..21feb57f --- /dev/null +++ b/src_vs2012/VSNDK.Package/Options/DialogHelper.cs @@ -0,0 +1,23 @@ +using System.Windows.Forms; + +namespace RIM.VSNDK_Package.Options +{ + internal static class DialogHelper + { + /// + /// Shows 'browse-for-folder' dialog. + /// + public static string BrowseForFolder(string startupPath, string description) + { + var browser = new FolderBrowserDialog(); + browser.ShowNewFolderButton = true; + browser.SelectedPath = startupPath; + browser.Description = description; + + if (browser.ShowDialog() == DialogResult.OK) + return browser.SelectedPath; + + return startupPath; + } + } +} diff --git a/src_vs2012/VSNDK.Package/Options/GeneralOptionControl.cs b/src_vs2012/VSNDK.Package/Options/GeneralOptionControl.cs index 4f119b01..59e4550c 100644 --- a/src_vs2012/VSNDK.Package/Options/GeneralOptionControl.cs +++ b/src_vs2012/VSNDK.Package/Options/GeneralOptionControl.cs @@ -31,25 +31,12 @@ public string ToolsPath private void bttNdkBrowse_Click(object sender, System.EventArgs e) { - txtNdkPath.Text = BrowseForFolder(txtNdkPath.Text, "Browse for NDK folder"); + txtNdkPath.Text = DialogHelper.BrowseForFolder(txtNdkPath.Text, "Browse for NDK folder"); } private void bttToolsBrowse_Click(object sender, System.EventArgs e) { - txtToolsPath.Text = BrowseForFolder(txtToolsPath.Text, "Browse for Tools folder"); - } - - private string BrowseForFolder(string startupPath, string description) - { - var browser = new FolderBrowserDialog(); - browser.ShowNewFolderButton = true; - browser.SelectedPath = startupPath; - browser.Description = description; - - if (browser.ShowDialog() == DialogResult.OK) - return browser.SelectedPath; - - return startupPath; + txtToolsPath.Text = DialogHelper.BrowseForFolder(txtToolsPath.Text, "Browse for Tools folder"); } } } diff --git a/src_vs2012/VSNDK.Package/Options/LogsOptionControl.Designer.cs b/src_vs2012/VSNDK.Package/Options/LogsOptionControl.Designer.cs index f22432e3..b267fd32 100644 --- a/src_vs2012/VSNDK.Package/Options/LogsOptionControl.Designer.cs +++ b/src_vs2012/VSNDK.Package/Options/LogsOptionControl.Designer.cs @@ -32,7 +32,7 @@ private void InitializeComponent() this.chbLimitLogs = new System.Windows.Forms.CheckBox(); this.label1 = new System.Windows.Forms.Label(); this.txtLogPath = new System.Windows.Forms.TextBox(); - this.button1 = new System.Windows.Forms.Button(); + this.bttBrowse = new System.Windows.Forms.Button(); this.numLogLimit = new System.Windows.Forms.NumericUpDown(); ((System.ComponentModel.ISupportInitialize)(this.numLogLimit)).BeginInit(); this.SuspendLayout(); @@ -40,6 +40,8 @@ private void InitializeComponent() // chbInjectLogs // this.chbInjectLogs.AutoSize = true; + this.chbInjectLogs.Checked = true; + this.chbInjectLogs.CheckState = System.Windows.Forms.CheckState.Checked; this.chbInjectLogs.Location = new System.Drawing.Point(6, 76); this.chbInjectLogs.Name = "chbInjectLogs"; this.chbInjectLogs.Size = new System.Drawing.Size(213, 17); @@ -50,6 +52,8 @@ private void InitializeComponent() // chbLimitLogs // this.chbLimitLogs.AutoSize = true; + this.chbLimitLogs.Checked = true; + this.chbLimitLogs.CheckState = System.Windows.Forms.CheckState.Checked; this.chbLimitLogs.Location = new System.Drawing.Point(6, 44); this.chbLimitLogs.Name = "chbLimitLogs"; this.chbLimitLogs.Size = new System.Drawing.Size(151, 17); @@ -75,15 +79,16 @@ private void InitializeComponent() this.txtLogPath.Size = new System.Drawing.Size(439, 20); this.txtLogPath.TabIndex = 1; // - // button1 + // bttBrowse // - this.button1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this.button1.Location = new System.Drawing.Point(530, 4); - this.button1.Name = "button1"; - this.button1.Size = new System.Drawing.Size(75, 23); - this.button1.TabIndex = 2; - this.button1.Text = "Browse..."; - this.button1.UseVisualStyleBackColor = true; + this.bttBrowse.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.bttBrowse.Location = new System.Drawing.Point(530, 4); + this.bttBrowse.Name = "bttBrowse"; + this.bttBrowse.Size = new System.Drawing.Size(75, 23); + this.bttBrowse.TabIndex = 2; + this.bttBrowse.Text = "Browse..."; + this.bttBrowse.UseVisualStyleBackColor = true; + this.bttBrowse.Click += new System.EventHandler(this.bttBrowse_Click); // // numLogLimit // @@ -103,7 +108,7 @@ private void InitializeComponent() this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.Controls.Add(this.numLogLimit); - this.Controls.Add(this.button1); + this.Controls.Add(this.bttBrowse); this.Controls.Add(this.txtLogPath); this.Controls.Add(this.label1); this.Controls.Add(this.chbLimitLogs); @@ -122,7 +127,7 @@ private void InitializeComponent() private System.Windows.Forms.CheckBox chbLimitLogs; private System.Windows.Forms.Label label1; private System.Windows.Forms.TextBox txtLogPath; - private System.Windows.Forms.Button button1; + private System.Windows.Forms.Button bttBrowse; private System.Windows.Forms.NumericUpDown numLogLimit; } } diff --git a/src_vs2012/VSNDK.Package/Options/LogsOptionControl.cs b/src_vs2012/VSNDK.Package/Options/LogsOptionControl.cs index a39d400f..ea095535 100644 --- a/src_vs2012/VSNDK.Package/Options/LogsOptionControl.cs +++ b/src_vs2012/VSNDK.Package/Options/LogsOptionControl.cs @@ -36,5 +36,10 @@ public string Path } #endregion + + private void bttBrowse_Click(object sender, System.EventArgs e) + { + txtLogPath.Text = DialogHelper.BrowseForFolder(txtLogPath.Text, "Browse for Logs folder"); + } } } diff --git a/src_vs2012/VSNDK.Package/VSNDK.Package.csproj b/src_vs2012/VSNDK.Package/VSNDK.Package.csproj index 7cfa0924..092ecd90 100644 --- a/src_vs2012/VSNDK.Package/VSNDK.Package.csproj +++ b/src_vs2012/VSNDK.Package/VSNDK.Package.csproj @@ -275,6 +275,7 @@ Component + UserControl From a49b7929ca9ddb4847ed5f2153fa8580720c81b2 Mon Sep 17 00:00:00 2001 From: Pawel Hofman Date: Tue, 13 May 2014 15:22:07 +0200 Subject: [PATCH 047/851] Debug builds has hardcoded paths to my repo --- src_vs2012/VSNDK.Package/Tools/RunnerDefaults.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/src_vs2012/VSNDK.Package/Tools/RunnerDefaults.cs b/src_vs2012/VSNDK.Package/Tools/RunnerDefaults.cs index 2fa7fd9b..f0d75637 100644 --- a/src_vs2012/VSNDK.Package/Tools/RunnerDefaults.cs +++ b/src_vs2012/VSNDK.Package/Tools/RunnerDefaults.cs @@ -28,6 +28,7 @@ static RunnerDefaults() // TODO: PH: 2014-05-08: for now hardcoded my repository path: TestToolsDirectory = @"S:\vs-plugin\qnxtools\bin"; TestNdkDirectory = @"S:\vs-plugin\bbndk_vs"; + ToolsDirectory = TestToolsDirectory; #endif } From b2ac490f8ed51573fc48361296d9900c2cd24665 Mon Sep 17 00:00:00 2001 From: Pawel Hofman Date: Tue, 13 May 2014 15:25:17 +0200 Subject: [PATCH 048/851] Fixed crash, when async call to non-existing tool --- src_vs2012/VSNDK.Package/Tools/ToolRunner.cs | 32 ++++++++++++++++++-- 1 file changed, 29 insertions(+), 3 deletions(-) diff --git a/src_vs2012/VSNDK.Package/Tools/ToolRunner.cs b/src_vs2012/VSNDK.Package/Tools/ToolRunner.cs index d82d93ab..226859fa 100644 --- a/src_vs2012/VSNDK.Package/Tools/ToolRunner.cs +++ b/src_vs2012/VSNDK.Package/Tools/ToolRunner.cs @@ -1,6 +1,7 @@ using System; using System.Diagnostics; using System.Text; +using RIM.VSNDK_Package.Diagnostics; namespace RIM.VSNDK_Package.Tools { @@ -145,12 +146,15 @@ public void ExecuteAsync() _process.BeginErrorReadLine(); _process.BeginOutputReadLine(); } - catch (Exception e) + catch (Exception ex) { Debug.WriteLine(_process.StartInfo.Arguments); - Debug.WriteLine(e.Message); + TraceLog.WriteException(ex, "Unable to start {0}", GetType().Name); _process.Close(); + + if (Finished != null) + Finished(this, new ToolRunnerEventArgs(-1, null, null)); } } @@ -173,6 +177,7 @@ private void CompleteExecution() { var outputText = _output.Length > 0 ? _output.ToString() : null; var errorText = _error.Length > 0 ? _error.ToString() : null; + var exitCode = _process.ExitCode; _output = null; _error = null; @@ -189,7 +194,7 @@ private void CompleteExecution() var finishedHandler = Finished; if (finishedHandler != null) { - finishedHandler(this, new ToolRunnerEventArgs(_process.ExitCode, outputText, errorText)); + finishedHandler(this, new ToolRunnerEventArgs(exitCode, outputText, errorText)); } _isProcessing = false; @@ -199,5 +204,26 @@ protected virtual void ConsumeResults(string output, string error) { // do nothing, subclasses should handle parsing output } + + /// + /// Extracts the error messages out of the given text. + /// + protected static string ExtractErrorMessages(string error) + { + if (string.IsNullOrEmpty(error)) + return null; + + var result = new StringBuilder(); + var lines = error.Split(new[] { '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries); + foreach (var line in lines) + { + if (line.StartsWith("error: ", StringComparison.InvariantCultureIgnoreCase)) + { + result.AppendLine(line.Substring(7).Trim()); + } + } + + return result.ToString(); + } } } From a0b9233abdc794030b09ad33b54cd05ab0a5dcd7 Mon Sep 17 00:00:00 2001 From: Pawel Hofman Date: Tue, 13 May 2014 15:28:38 +0200 Subject: [PATCH 049/851] Added simple dialog to add new device target --- src_vs2012/VSNDK.Package/Model/DeviceInfo.cs | 19 ++ .../Options/Dialogs/DeviceForm.Designer.cs | 226 ++++++++++++++++++ .../Options/Dialogs/DeviceForm.cs | 192 +++++++++++++++ .../Options/Dialogs/DeviceForm.resx | 120 ++++++++++ .../Options/Dialogs/DialogDeviceClass.cs | 9 + .../Options/TargetsOptionControl.Designer.cs | 141 +++++++++++ .../Options/TargetsOptionControl.cs | 25 +- 7 files changed, 724 insertions(+), 8 deletions(-) create mode 100644 src_vs2012/VSNDK.Package/Options/Dialogs/DeviceForm.Designer.cs create mode 100644 src_vs2012/VSNDK.Package/Options/Dialogs/DeviceForm.cs create mode 100644 src_vs2012/VSNDK.Package/Options/Dialogs/DeviceForm.resx create mode 100644 src_vs2012/VSNDK.Package/Options/Dialogs/DialogDeviceClass.cs diff --git a/src_vs2012/VSNDK.Package/Model/DeviceInfo.cs b/src_vs2012/VSNDK.Package/Model/DeviceInfo.cs index ab8263c7..78ccbc32 100644 --- a/src_vs2012/VSNDK.Package/Model/DeviceInfo.cs +++ b/src_vs2012/VSNDK.Package/Model/DeviceInfo.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Text; using System.Windows; using System.Globalization; using System.Xml; @@ -112,6 +113,24 @@ public override string ToString() return string.Concat(Name, " (", ModelName, ", OS v", SystemVersion, ")"); } + /// + /// Gets the values of all fields. + /// + public string ToLongDescription() + { + var result = new StringBuilder(); + + result.Append("Name: ").AppendLine(Name); + result.Append("PIN: ").AppendLine(PIN.ToString("X")); + result.Append("Model: ").Append(ModelName).Append(" (").Append(ModelNumber).AppendLine(")"); + result.Append("Model Family: ").AppendLine(ModelFamily); + result.Append("System: ").Append(SystemName).Append(" (").Append(SystemVersion).AppendLine(")"); + result.Append("Resolution: ").Append((uint) ScreenResolution.Width).Append("x").Append((uint) ScreenResolution.Height).Append(" (").Append(ScreenDPI).AppendLine("dpi)"); + result.Append("Theme: ").Append(DefaultTheme.ToString()); + + return result.ToString(); + } + /// /// Parses device information out of given PPS text. /// diff --git a/src_vs2012/VSNDK.Package/Options/Dialogs/DeviceForm.Designer.cs b/src_vs2012/VSNDK.Package/Options/Dialogs/DeviceForm.Designer.cs new file mode 100644 index 00000000..0be4a674 --- /dev/null +++ b/src_vs2012/VSNDK.Package/Options/Dialogs/DeviceForm.Designer.cs @@ -0,0 +1,226 @@ +namespace RIM.VSNDK_Package.Options.Dialogs +{ + partial class DeviceForm + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.groupBox1 = new System.Windows.Forms.GroupBox(); + this.txtPassword = new System.Windows.Forms.TextBox(); + this.label4 = new System.Windows.Forms.Label(); + this.txtIP = new System.Windows.Forms.TextBox(); + this.label3 = new System.Windows.Forms.Label(); + this.txtName = new System.Windows.Forms.TextBox(); + this.label2 = new System.Windows.Forms.Label(); + this.label1 = new System.Windows.Forms.Label(); + this.cmbType = new System.Windows.Forms.ComboBox(); + this.txtLogs = new System.Windows.Forms.TextBox(); + this.bttTest = new System.Windows.Forms.Button(); + this.bttOK = new System.Windows.Forms.Button(); + this.bttCancel = new System.Windows.Forms.Button(); + this.groupBox1.SuspendLayout(); + this.SuspendLayout(); + // + // groupBox1 + // + this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.groupBox1.Controls.Add(this.txtPassword); + this.groupBox1.Controls.Add(this.label4); + this.groupBox1.Controls.Add(this.txtIP); + this.groupBox1.Controls.Add(this.label3); + this.groupBox1.Controls.Add(this.txtName); + this.groupBox1.Controls.Add(this.label2); + this.groupBox1.Controls.Add(this.label1); + this.groupBox1.Controls.Add(this.cmbType); + this.groupBox1.Location = new System.Drawing.Point(12, 12); + this.groupBox1.Name = "groupBox1"; + this.groupBox1.Size = new System.Drawing.Size(404, 141); + this.groupBox1.TabIndex = 0; + this.groupBox1.TabStop = false; + this.groupBox1.Text = "Device Target Properties"; + // + // txtPassword + // + this.txtPassword.Location = new System.Drawing.Point(89, 103); + this.txtPassword.Name = "txtPassword"; + this.txtPassword.PasswordChar = '*'; + this.txtPassword.Size = new System.Drawing.Size(156, 20); + this.txtPassword.TabIndex = 7; + // + // label4 + // + this.label4.AutoSize = true; + this.label4.Location = new System.Drawing.Point(17, 106); + this.label4.Name = "label4"; + this.label4.Size = new System.Drawing.Size(56, 13); + this.label4.TabIndex = 6; + this.label4.Text = "Password:"; + // + // txtIP + // + this.txtIP.Location = new System.Drawing.Point(89, 76); + this.txtIP.Name = "txtIP"; + this.txtIP.Size = new System.Drawing.Size(126, 20); + this.txtIP.TabIndex = 5; + // + // label3 + // + this.label3.AutoSize = true; + this.label3.Location = new System.Drawing.Point(17, 79); + this.label3.Name = "label3"; + this.label3.Size = new System.Drawing.Size(20, 13); + this.label3.TabIndex = 4; + this.label3.Text = "IP:"; + // + // txtName + // + this.txtName.Location = new System.Drawing.Point(89, 50); + this.txtName.Name = "txtName"; + this.txtName.Size = new System.Drawing.Size(156, 20); + this.txtName.TabIndex = 3; + // + // label2 + // + this.label2.AutoSize = true; + this.label2.Location = new System.Drawing.Point(17, 53); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(38, 13); + this.label2.TabIndex = 2; + this.label2.Text = "Name:"; + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Location = new System.Drawing.Point(17, 26); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(34, 13); + this.label1.TabIndex = 1; + this.label1.Text = "Type:"; + // + // cmbType + // + this.cmbType.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.cmbType.FormattingEnabled = true; + this.cmbType.Items.AddRange(new object[] { + "WiFi device", + "USB device", + "simulator"}); + this.cmbType.Location = new System.Drawing.Point(89, 23); + this.cmbType.Name = "cmbType"; + this.cmbType.Size = new System.Drawing.Size(126, 21); + this.cmbType.TabIndex = 0; + this.cmbType.SelectedIndexChanged += new System.EventHandler(this.cmbType_SelectedIndexChanged); + // + // txtLogs + // + this.txtLogs.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.txtLogs.Location = new System.Drawing.Point(12, 159); + this.txtLogs.Multiline = true; + this.txtLogs.Name = "txtLogs"; + this.txtLogs.ReadOnly = true; + this.txtLogs.ScrollBars = System.Windows.Forms.ScrollBars.Vertical; + this.txtLogs.Size = new System.Drawing.Size(404, 85); + this.txtLogs.TabIndex = 8; + // + // bttTest + // + this.bttTest.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this.bttTest.Location = new System.Drawing.Point(10, 250); + this.bttTest.Name = "bttTest"; + this.bttTest.Size = new System.Drawing.Size(75, 23); + this.bttTest.TabIndex = 9; + this.bttTest.Text = "&Test"; + this.bttTest.UseVisualStyleBackColor = true; + this.bttTest.Click += new System.EventHandler(this.bttTest_Click); + // + // bttOK + // + this.bttOK.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.bttOK.Location = new System.Drawing.Point(260, 250); + this.bttOK.Name = "bttOK"; + this.bttOK.Size = new System.Drawing.Size(75, 23); + this.bttOK.TabIndex = 10; + this.bttOK.Text = "&OK"; + this.bttOK.UseVisualStyleBackColor = true; + this.bttOK.Click += new System.EventHandler(this.bttOK_Click); + // + // bttCancel + // + this.bttCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.bttCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel; + this.bttCancel.Location = new System.Drawing.Point(341, 250); + this.bttCancel.Name = "bttCancel"; + this.bttCancel.Size = new System.Drawing.Size(75, 23); + this.bttCancel.TabIndex = 11; + this.bttCancel.Text = "&Cancel"; + this.bttCancel.UseVisualStyleBackColor = true; + // + // DeviceForm + // + this.AcceptButton = this.bttOK; + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.CancelButton = this.bttCancel; + this.ClientSize = new System.Drawing.Size(428, 285); + this.Controls.Add(this.bttCancel); + this.Controls.Add(this.bttOK); + this.Controls.Add(this.bttTest); + this.Controls.Add(this.txtLogs); + this.Controls.Add(this.groupBox1); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow; + this.MaximizeBox = false; + this.MinimizeBox = false; + this.Name = "DeviceForm"; + this.ShowIcon = false; + this.ShowInTaskbar = false; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; + this.Text = "DeviceForm"; + this.groupBox1.ResumeLayout(false); + this.groupBox1.PerformLayout(); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.GroupBox groupBox1; + private System.Windows.Forms.TextBox txtPassword; + private System.Windows.Forms.Label label4; + private System.Windows.Forms.TextBox txtIP; + private System.Windows.Forms.Label label3; + private System.Windows.Forms.TextBox txtName; + private System.Windows.Forms.Label label2; + private System.Windows.Forms.Label label1; + private System.Windows.Forms.ComboBox cmbType; + private System.Windows.Forms.TextBox txtLogs; + private System.Windows.Forms.Button bttTest; + private System.Windows.Forms.Button bttOK; + private System.Windows.Forms.Button bttCancel; + } +} \ No newline at end of file diff --git a/src_vs2012/VSNDK.Package/Options/Dialogs/DeviceForm.cs b/src_vs2012/VSNDK.Package/Options/Dialogs/DeviceForm.cs new file mode 100644 index 00000000..59de1693 --- /dev/null +++ b/src_vs2012/VSNDK.Package/Options/Dialogs/DeviceForm.cs @@ -0,0 +1,192 @@ +using System; +using System.Windows.Forms; +using RIM.VSNDK_Package.Diagnostics; +using RIM.VSNDK_Package.Tools; +using RIM.VSNDK_Package.ViewModels; + +namespace RIM.VSNDK_Package.Options.Dialogs +{ + /// + /// Internal dialog for adding and testing target device. + /// + internal partial class DeviceForm : Form + { + private DeviceInfoRunner _runner; + + public DeviceForm(string title) + { + InitializeComponent(); + + Name = title; + cmbType.SelectedIndex = 0; + IsConnected = false; + } + + #region Properties + + public DialogDeviceClass DeviceClass + { + get { return (DialogDeviceClass) cmbType.SelectedIndex; } + set { cmbType.SelectedIndex = (int) value; } + } + + public string DeviceName + { + get { return txtName.Text; } + set { txtName.Text = value; } + } + + public string DeviceIP + { + get { return txtIP.Text; } + set { txtIP.Text = value; } + } + + public string DevicePassword + { + get { return txtPassword.Text; } + set { txtPassword.Text = value; } + } + + public bool IsConnected + { + get; + private set; + } + + #endregion + + public DeviceDefinition ToDevice() + { + if (string.IsNullOrEmpty(DeviceIP) || string.IsNullOrEmpty(DevicePassword)) + return null; + + return new DeviceDefinition(DeviceName, DeviceIP, DevicePassword, DeviceClass == DialogDeviceClass.Simulator ? DeviceDefinitionType.Simulator : DeviceDefinitionType.Device); + } + + public void FromDevice(DeviceDefinition device) + { + if (device == null) + { + DeviceClass = DialogDeviceClass.WiFiDevice; + DeviceName = string.Empty; + DeviceIP = string.Empty; + DevicePassword = string.Empty; + return; + } + + DeviceClass = GetDeviceClass(device.Type, device.IP); + DeviceName = device.Name; + DeviceIP = device.IP; + DevicePassword = device.Password; + } + + private DialogDeviceClass GetDeviceClass(DeviceDefinitionType type, string ip) + { + if (type == DeviceDefinitionType.Simulator) + return DialogDeviceClass.Simulator; + + return ip != null && ip.StartsWith("169.254.0.") ? DialogDeviceClass.UsbDevice : DialogDeviceClass.WiFiDevice; + } + + private void ClearLog() + { + txtLogs.Text = string.Empty; + } + + private void AppendLog(string text) + { + if (InvokeRequired) + { + Invoke(new Action(AppendLog), text); + } + else + { + txtLogs.Text += text + Environment.NewLine; + } + } + + private void bttTest_Click(object sender, EventArgs e) + { + ClearLog(); + + // verify arguments: + if (_runner != null) + { + AppendLog("Operation is still in progress. Please be patient."); + return; + } + + if (string.IsNullOrEmpty(DeviceIP)) + { + AppendLog("IP address can not be empty"); + return; + } + + if (string.IsNullOrEmpty(DevicePassword)) + { + AppendLog("Password can not be empty"); + return; + } + + IsConnected = false; + _runner = new DeviceInfoRunner(RunnerDefaults.ToolsDirectory, DeviceIP, DevicePassword); + _runner.Finished += RunnerOnFinished; + + AppendLog("Testing connection..."); + _runner.ExecuteAsync(); + } + + private void RunnerOnFinished(object sender, ToolRunnerEventArgs e) + { + bool success = string.IsNullOrEmpty(_runner.LastError) && _runner.DeviceInfo != null; + AppendLog("--- DONE with " + (success ? "success" : "failure") + Environment.NewLine); + + if (success) + { + TraceLog.WriteLine("Found device: {0} with IP: {1}", _runner.DeviceInfo.ToString(), DeviceIP); + AppendLog("Device found:" + Environment.NewLine + _runner.DeviceInfo.ToLongDescription()); + IsConnected = true; + } + else + { + TraceLog.WriteLine("Failed to connect to: {0}", DeviceIP); + TraceLog.WarnLine(_runner.LastOutput); + AppendLog(_runner.LastError); + } + + _runner.Finished -= RunnerOnFinished; + _runner = null; + } + + private void cmbType_SelectedIndexChanged(object sender, EventArgs e) + { + txtIP.Enabled = DeviceClass != DialogDeviceClass.UsbDevice; + + if (DeviceClass == DialogDeviceClass.UsbDevice) + { + if (string.IsNullOrEmpty(DeviceName)) + DeviceName = "usb"; + DeviceIP = "169.254.0.1"; + + // got to Password control: + ActiveControl = txtPassword; + txtPassword.SelectionLength = 0; + txtPassword.SelectionStart = txtPassword.Text.Length; + } + } + + private void bttOK_Click(object sender, EventArgs e) + { + if (string.IsNullOrEmpty(DeviceIP) || string.IsNullOrEmpty(DevicePassword)) + { + MessageBoxHelper.Show("Sorry, some information is still missing. Please fill in all fields", "Target Device", MessageBoxIcon.Error); + ActiveControl = string.IsNullOrEmpty(DeviceIP) ? txtIP : txtPassword; + return; + } + + DialogResult = DialogResult.OK; + Close(); + } + } +} diff --git a/src_vs2012/VSNDK.Package/Options/Dialogs/DeviceForm.resx b/src_vs2012/VSNDK.Package/Options/Dialogs/DeviceForm.resx new file mode 100644 index 00000000..29dcb1b3 --- /dev/null +++ b/src_vs2012/VSNDK.Package/Options/Dialogs/DeviceForm.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/src_vs2012/VSNDK.Package/Options/Dialogs/DialogDeviceClass.cs b/src_vs2012/VSNDK.Package/Options/Dialogs/DialogDeviceClass.cs new file mode 100644 index 00000000..586fcf54 --- /dev/null +++ b/src_vs2012/VSNDK.Package/Options/Dialogs/DialogDeviceClass.cs @@ -0,0 +1,9 @@ +namespace RIM.VSNDK_Package.Options.Dialogs +{ + internal enum DialogDeviceClass + { + WiFiDevice, + UsbDevice, + Simulator + } +} diff --git a/src_vs2012/VSNDK.Package/Options/TargetsOptionControl.Designer.cs b/src_vs2012/VSNDK.Package/Options/TargetsOptionControl.Designer.cs index 8f872f8b..28b4c499 100644 --- a/src_vs2012/VSNDK.Package/Options/TargetsOptionControl.Designer.cs +++ b/src_vs2012/VSNDK.Package/Options/TargetsOptionControl.Designer.cs @@ -28,19 +28,160 @@ protected override void Dispose(bool disposing) /// private void InitializeComponent() { + this.groupBox1 = new System.Windows.Forms.GroupBox(); + this.label1 = new System.Windows.Forms.Label(); + this.bttAdd = new System.Windows.Forms.Button(); + this.bttEdit = new System.Windows.Forms.Button(); + this.bttRemove = new System.Windows.Forms.Button(); + this.lnkMoreInfo = new System.Windows.Forms.LinkLabel(); + this.bttDebugToken = new System.Windows.Forms.Button(); + this.listTargets = new System.Windows.Forms.ListView(); + this.columnActive = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); + this.columnName = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); + this.columnIP = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); + this.groupBox1.SuspendLayout(); this.SuspendLayout(); // + // groupBox1 + // + this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.groupBox1.Controls.Add(this.listTargets); + this.groupBox1.Location = new System.Drawing.Point(3, 46); + this.groupBox1.Name = "groupBox1"; + this.groupBox1.Size = new System.Drawing.Size(644, 169); + this.groupBox1.TabIndex = 0; + this.groupBox1.TabStop = false; + this.groupBox1.Text = "Known Targets"; + // + // label1 + // + this.label1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.label1.Location = new System.Drawing.Point(0, 0); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(737, 33); + this.label1.TabIndex = 1; + this.label1.Text = "In order to connect to the device, you must enable the [Development Mode]. It can" + + " be found at Settings > Security and Privacy > Development Mode."; + // + // bttAdd + // + this.bttAdd.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.bttAdd.Location = new System.Drawing.Point(653, 51); + this.bttAdd.Name = "bttAdd"; + this.bttAdd.Size = new System.Drawing.Size(88, 23); + this.bttAdd.TabIndex = 2; + this.bttAdd.Text = "&Add..."; + this.bttAdd.UseVisualStyleBackColor = true; + this.bttAdd.Click += new System.EventHandler(this.bttAdd_Click); + // + // bttEdit + // + this.bttEdit.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.bttEdit.Enabled = false; + this.bttEdit.Location = new System.Drawing.Point(653, 80); + this.bttEdit.Name = "bttEdit"; + this.bttEdit.Size = new System.Drawing.Size(88, 23); + this.bttEdit.TabIndex = 2; + this.bttEdit.Text = "&Edit..."; + this.bttEdit.UseVisualStyleBackColor = true; + // + // bttRemove + // + this.bttRemove.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.bttRemove.Enabled = false; + this.bttRemove.Location = new System.Drawing.Point(653, 109); + this.bttRemove.Name = "bttRemove"; + this.bttRemove.Size = new System.Drawing.Size(88, 23); + this.bttRemove.TabIndex = 2; + this.bttRemove.Text = "&Remove"; + this.bttRemove.UseVisualStyleBackColor = true; + // + // lnkMoreInfo + // + this.lnkMoreInfo.AutoSize = true; + this.lnkMoreInfo.Location = new System.Drawing.Point(0, 28); + this.lnkMoreInfo.Name = "lnkMoreInfo"; + this.lnkMoreInfo.Size = new System.Drawing.Size(60, 13); + this.lnkMoreInfo.TabIndex = 3; + this.lnkMoreInfo.TabStop = true; + this.lnkMoreInfo.Text = "More info..."; + this.lnkMoreInfo.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.lnkMoreInfo_LinkClicked); + // + // bttDebugToken + // + this.bttDebugToken.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.bttDebugToken.Enabled = false; + this.bttDebugToken.Location = new System.Drawing.Point(653, 167); + this.bttDebugToken.Name = "bttDebugToken"; + this.bttDebugToken.Size = new System.Drawing.Size(88, 48); + this.bttDebugToken.TabIndex = 2; + this.bttDebugToken.Text = "&Upload debug token..."; + this.bttDebugToken.UseVisualStyleBackColor = true; + // + // listTargets + // + this.listTargets.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.listTargets.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { + this.columnActive, + this.columnName, + this.columnIP}); + this.listTargets.Location = new System.Drawing.Point(6, 19); + this.listTargets.Name = "listTargets"; + this.listTargets.Size = new System.Drawing.Size(632, 144); + this.listTargets.TabIndex = 0; + this.listTargets.UseCompatibleStateImageBehavior = false; + // + // columnActive + // + this.columnActive.Text = "A"; + this.columnActive.Width = 20; + // + // columnName + // + this.columnName.Text = "Name"; + this.columnName.Width = 80; + // + // columnIP + // + this.columnIP.Text = "IP"; + // // TargetsOptionControl // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.Controls.Add(this.lnkMoreInfo); + this.Controls.Add(this.bttDebugToken); + this.Controls.Add(this.bttRemove); + this.Controls.Add(this.bttEdit); + this.Controls.Add(this.bttAdd); + this.Controls.Add(this.label1); + this.Controls.Add(this.groupBox1); this.Name = "TargetsOptionControl"; this.Size = new System.Drawing.Size(744, 223); + this.groupBox1.ResumeLayout(false); this.ResumeLayout(false); + this.PerformLayout(); } #endregion + private System.Windows.Forms.GroupBox groupBox1; + private System.Windows.Forms.Label label1; + private System.Windows.Forms.Button bttAdd; + private System.Windows.Forms.Button bttEdit; + private System.Windows.Forms.Button bttRemove; + private System.Windows.Forms.LinkLabel lnkMoreInfo; + private System.Windows.Forms.Button bttDebugToken; + private System.Windows.Forms.ListView listTargets; + private System.Windows.Forms.ColumnHeader columnActive; + private System.Windows.Forms.ColumnHeader columnName; + private System.Windows.Forms.ColumnHeader columnIP; + } } diff --git a/src_vs2012/VSNDK.Package/Options/TargetsOptionControl.cs b/src_vs2012/VSNDK.Package/Options/TargetsOptionControl.cs index c42e3552..3465634c 100644 --- a/src_vs2012/VSNDK.Package/Options/TargetsOptionControl.cs +++ b/src_vs2012/VSNDK.Package/Options/TargetsOptionControl.cs @@ -1,12 +1,6 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Drawing; -using System.Data; -using System.Linq; -using System.Text; -using System.Threading.Tasks; +using System.Diagnostics; using System.Windows.Forms; +using RIM.VSNDK_Package.Options.Dialogs; namespace RIM.VSNDK_Package.Options { @@ -16,5 +10,20 @@ public TargetsOptionControl() { InitializeComponent(); } + + private void lnkMoreInfo_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) + { + Process.Start("http://developer.blackberry.com/native/documentation/cascades/getting_started/setting_up.html"); + } + + private void bttAdd_Click(object sender, System.EventArgs e) + { + var form = new DeviceForm("Add new Target Device"); + + if (form.ShowDialog() == DialogResult.OK) + { + + } + } } } From 35bef78c2ac3f31cab12f8c5103b78bc67712b82 Mon Sep 17 00:00:00 2001 From: Pawel Hofman Date: Tue, 13 May 2014 15:29:40 +0200 Subject: [PATCH 050/851] Extended menu to have secondary section for targets The intention here is to have two sections for quick switches: - for target devices - for API levels Functionalities for the first one still are under development. --- src/VSNDK.Package/PkgCmdID.cs | 3 +- src/VSNDK.Package/VSNDK.PackagePackage.cs | 34 +++++++++-- .../Model/Integration/DynamicMenuCommand.cs | 60 +++++++++++++++++-- src_vs2012/VSNDK.Package/VSNDK.Package.csproj | 10 ++++ src_vs2012/VSNDK.Package/VSNDK.Package.vsct | 23 ++++++- 5 files changed, 116 insertions(+), 14 deletions(-) diff --git a/src/VSNDK.Package/PkgCmdID.cs b/src/VSNDK.Package/PkgCmdID.cs index cd8704a8..607d01ca 100644 --- a/src/VSNDK.Package/PkgCmdID.cs +++ b/src/VSNDK.Package/PkgCmdID.cs @@ -21,7 +21,8 @@ internal static class PkgCmdIDList public const int cmdidBlackBerryDebugToken = 0x0203; public const int cmdidBlackBerryOptions = 0x0301; public const int cmdidBlackBerryTargetsDevicesPlaceholder = 0x0401; - public const int cmdidBlackBerryTargetsConfigure = 0x0501; + public const int cmdidBlackBerryTargetsApiLevelsPlaceholder = 0x0501; + public const int cmdidBlackBerryTargetsConfigure = 0x0601; public const int cmdidBlackBerryProjectImport = 0x0104; public const int cmdidfooLocalBox = 0x0105; diff --git a/src/VSNDK.Package/VSNDK.PackagePackage.cs b/src/VSNDK.Package/VSNDK.PackagePackage.cs index b25a714f..3ec27dcd 100644 --- a/src/VSNDK.Package/VSNDK.PackagePackage.cs +++ b/src/VSNDK.Package/VSNDK.PackagePackage.cs @@ -33,9 +33,11 @@ using System.Security.Cryptography; using System.Text; using RIM.VSNDK_Package.Diagnostics; +using RIM.VSNDK_Package.Model; using RIM.VSNDK_Package.Model.Integration; using RIM.VSNDK_Package.Options; using RIM.VSNDK_Package.UpdateManager.Model; +using RIM.VSNDK_Package.ViewModels; using VSNDK.Parser; namespace RIM.VSNDK_Package @@ -970,6 +972,7 @@ protected override void Initialize() TraceLog.Add(_traceWindow); TraceLog.WriteLine("BlackBerry plugin started"); + var options = GetDialogPage(typeof(GeneralOptionPage)) as GeneralOptionPage; var path = options.NdkPath; @@ -1028,15 +1031,36 @@ protected override void Initialize() // Create dynamic command for the 'devices-list' menu CommandID devicesCommandID = new CommandID(GuidList.guidVSNDK_PackageCmdSet, PkgCmdIDList.cmdidBlackBerryTargetsDevicesPlaceholder); - DynamicMenuCommand devicesMenu = new DynamicMenuCommand(InstalledNDKListSingleton.Instance._installedNDKList, null, - (cmd, colletion, index) => + DynamicMenuCommand devicesMenu = new DynamicMenuCommand(() => PackageViewModel.Instance.InstalledNDKs, + (cmd, collection, index) => + { + var item = index >= 0 && index < collection.Count ? ((NdkInfo[])collection)[index] : null; + PackageViewModel.Instance.ActiveNDK = item; + }, + (cmd, collection, index) => { - var item = index >= 0 && index < colletion.Count ? ((List) colletion)[index] : null; - cmd.Checked = index == 0; - cmd.Text = item != null ? item.Name : "-"; + var item = index >= 0 && index < collection.Count ? ((NdkInfo[]) collection)[index] : null; + cmd.Checked = item == PackageViewModel.Instance.ActiveNDK; + cmd.Text = item != null ? item.ToString() : "-"; }, devicesCommandID); mcs.AddCommand(devicesMenu); + // Create dynamic command for the 'api-level-list' menu + CommandID apiLevelCommandID = new CommandID(GuidList.guidVSNDK_PackageCmdSet, PkgCmdIDList.cmdidBlackBerryTargetsApiLevelsPlaceholder); + DynamicMenuCommand apiLevelMenu = new DynamicMenuCommand(() => PackageViewModel.Instance.InstalledNDKs, + (cmd, collection, index) => + { + var item = index >= 0 && index < collection.Count ? ((NdkInfo[]) collection)[index] : null; + PackageViewModel.Instance.ActiveNDK = item; + }, + (cmd, collection, index) => + { + var item = index >= 0 && index < collection.Count ? ((NdkInfo[]) collection)[index] : null; + cmd.Checked = item == PackageViewModel.Instance.ActiveNDK; + cmd.Text = item != null ? item.ToString() : "-"; + }, + apiLevelCommandID); + mcs.AddCommand(apiLevelMenu); // Create command for 'Configure...' [targets] menu CommandID configureCommandID = new CommandID(GuidList.guidVSNDK_PackageCmdSet, PkgCmdIDList.cmdidBlackBerryTargetsConfigure); diff --git a/src_vs2012/VSNDK.Package/Model/Integration/DynamicMenuCommand.cs b/src_vs2012/VSNDK.Package/Model/Integration/DynamicMenuCommand.cs index 00cceb89..6ce5ab45 100644 --- a/src_vs2012/VSNDK.Package/Model/Integration/DynamicMenuCommand.cs +++ b/src_vs2012/VSNDK.Package/Model/Integration/DynamicMenuCommand.cs @@ -11,7 +11,9 @@ namespace RIM.VSNDK_Package.Model.Integration internal sealed class DynamicMenuCommand : OleMenuCommand { private readonly Predicate _displayPredicate; - private readonly Action _processedQueryStatus; + private readonly Action _invokeHandler; + private readonly Action _processedQueryStatus; + private readonly Func _getCollection; private readonly ICollection _collection; public DynamicMenuCommand(Predicate displayPredicate, EventHandler invokeHandler, EventHandler beforeQueryStatusHandler, CommandID id) @@ -24,7 +26,7 @@ public DynamicMenuCommand(Predicate displayPredicate, EventHandler invokeHa } public DynamicMenuCommand(ICollection collection, EventHandler invokeHandler, Action beforeQueryStatus, CommandID id) - : base(invokeHandler, null, BeforeCollectionQueryStatusUpdate, id) + : base(invokeHandler, null, InternalBeforeCollectionQueryStatusUpdate, id) { if (collection == null) throw new ArgumentNullException("collection"); @@ -36,6 +38,36 @@ public DynamicMenuCommand(ICollection collection, EventHandler invokeHandler, Ac _collection = collection; } + public DynamicMenuCommand(Func collectionHandler, Action invokeHandler, Action beforeQueryStatus, CommandID id) + : base(InternalInvokeHandler, null, InternalBeforeCollectionQueryStatusUpdate, id) + { + if (collectionHandler == null) + throw new ArgumentNullException("collectionHandler"); + if (beforeQueryStatus == null) + throw new ArgumentNullException("beforeQueryStatus"); + + _displayPredicate = InternalCollectionPredicate; + _invokeHandler = invokeHandler; + _processedQueryStatus = beforeQueryStatus; + _getCollection = collectionHandler; + } + + private ICollection Collection + { + get + { + ICollection result = null; + + if (_getCollection != null) + result = _getCollection(); + + if (result == null) + result = _collection; + + return result; + } + } + public override bool DynamicItemMatch(int cmdId) { if (_displayPredicate(cmdId)) @@ -50,17 +82,35 @@ public override bool DynamicItemMatch(int cmdId) private bool InternalCollectionPredicate(int cmdId) { - return cmdId >= CommandID.ID && (cmdId - CommandID.ID) < _collection.Count; + var collection = Collection; + + if (collection == null) + return false; + + return cmdId >= CommandID.ID && (cmdId - CommandID.ID) < collection.Count; } - private static void BeforeCollectionQueryStatusUpdate(object sender, EventArgs e) + private static void InternalBeforeCollectionQueryStatusUpdate(object sender, EventArgs e) { var command = (DynamicMenuCommand)sender; int index = command.MatchedCommandId == 0 ? 0 : command.MatchedCommandId - command.CommandID.ID; // and ask for further status update: - command._processedQueryStatus(command, command._collection, index); + command._processedQueryStatus(command, command.Collection, index); + } + + private static void InternalInvokeHandler(object sender, EventArgs e) + { + var command = (DynamicMenuCommand) sender; + + int index = command.MatchedCommandId == 0 ? 0 : command.MatchedCommandId - command.CommandID.ID; + + // and notify about selection made: + if (command._invokeHandler != null) + { + command._invokeHandler(command, command.Collection, index); + } } } } diff --git a/src_vs2012/VSNDK.Package/VSNDK.Package.csproj b/src_vs2012/VSNDK.Package/VSNDK.Package.csproj index 092ecd90..5645e610 100644 --- a/src_vs2012/VSNDK.Package/VSNDK.Package.csproj +++ b/src_vs2012/VSNDK.Package/VSNDK.Package.csproj @@ -276,6 +276,13 @@ Component + + Form + + + DeviceForm.cs + + UserControl @@ -471,6 +478,9 @@ ApiLevelOptionControl.cs + + DeviceForm.cs + GeneralOptionControl.cs diff --git a/src_vs2012/VSNDK.Package/VSNDK.Package.vsct b/src_vs2012/VSNDK.Package/VSNDK.Package.vsct index a43c947a..a686d588 100644 --- a/src_vs2012/VSNDK.Package/VSNDK.Package.vsct +++ b/src_vs2012/VSNDK.Package/VSNDK.Package.vsct @@ -80,7 +80,10 @@ - + + + + @@ -141,6 +144,18 @@ Select a device to run the application on + internal sealed class NdkInfo : ApiInfo, IComparable { + private const string DescriptorFileName = "blackberry-sdk-descriptor.xml"; + public NdkInfo(string name, Version version, string hostPath, string targetPath, DeviceInfo[] devices) : base(name, version) { @@ -27,6 +29,40 @@ public NdkInfo(string name, Version version, string hostPath, string targetPath, Devices = devices; } + public NdkInfo(string name, Version version, string hostPath, string targetPath) + : base(name, version) + { + if (string.IsNullOrEmpty(hostPath)) + throw new ArgumentNullException("hostPath"); + if (string.IsNullOrEmpty(targetPath)) + throw new ArgumentNullException("targetPath"); + + HostPath = hostPath; + TargetPath = targetPath; + + //////////////////////// + // and now load devices, based on some heuristics, keeping in mind, that this field can't be never null: + var ndkDescriptor = Path.Combine(targetPath, DescriptorFileName); + DeviceInfo[] devices = LoadDevices(ndkDescriptor); + + // if failed to load devices, try to find one folder above: + if (devices == null) + { + ndkDescriptor = Path.Combine(targetPath, "..", DescriptorFileName); + devices = LoadDevices(ndkDescriptor); + } + + // or another above: + if (devices == null) + { + ndkDescriptor = Path.Combine(targetPath, "..", "..", DescriptorFileName); + devices = LoadDevices(ndkDescriptor); + } + + // OK, give up, and say it's unknown: + Devices = devices ?? new DeviceInfo[0]; + } + #region Properties public string HostPath @@ -176,31 +212,8 @@ public static NdkInfo Load(XmlReader reader) { if (!string.IsNullOrEmpty(targetPath) && !string.IsNullOrEmpty(hostPath)) { - const string DescriptorFileName = "blackberry-sdk-descriptor.xml"; - - var ndkDescriptor = Path.Combine(targetPath, DescriptorFileName); - DeviceInfo[] devices = LoadDevices(ndkDescriptor); - - // if failed to load devices, try to find one folder above: - if (devices == null) - { - ndkDescriptor = Path.Combine(targetPath, "..", DescriptorFileName); - devices = LoadDevices(ndkDescriptor); - } - - // or another above: - if (devices == null) - { - ndkDescriptor = Path.Combine(targetPath, "..", "..", DescriptorFileName); - devices = LoadDevices(ndkDescriptor); - } - - // OK, give up, and say it's unknown: - if (devices == null) - devices = new DeviceInfo[0]; - // try to define info about the installation: - return new NdkInfo(name, version, hostPath, targetPath, devices); + return new NdkInfo(name, version, hostPath, targetPath); } return null; @@ -244,7 +257,7 @@ public static NdkInfo[] Load(params string[] globalNdkConfigFolders) var result = new List(); - // list all configuration files: + // list all configuration files, across all known folders: foreach (var folder in globalNdkConfigFolders) { if (Directory.Exists(folder)) @@ -257,6 +270,7 @@ public static NdkInfo[] Load(params string[] globalNdkConfigFolders) { try { + // read them: using (var fileReader = new StreamReader(file, Encoding.UTF8)) { using (var reader = XmlReader.Create(fileReader)) @@ -265,8 +279,9 @@ public static NdkInfo[] Load(params string[] globalNdkConfigFolders) if (info != null && info.Exists()) { var existingIndex = IndexOf(result, info); - - // if NDK info exist with exacly the same paths, prefer to keep the one with longer name: + + // and store only unique ones: + // (if NDK info exist with exacly the same paths, prefer to keep the one with longer name) if (existingIndex >= 0) { var existingItem = result[existingIndex]; @@ -301,14 +316,21 @@ public static NdkInfo[] Load(params string[] globalNdkConfigFolders) return result.ToArray(); } - private static int IndexOf(IEnumerable list, NdkInfo info) + /// + /// Returns an index of a given NdkInfo inside a collection. + /// The search is based by matching few critical properties of an object. + /// + public static int IndexOf(IEnumerable list, NdkInfo info) { - int i = 0; - foreach (var item in list) + if (info != null) { - if (item.Matches(info)) - return i; - i++; + int i = 0; + foreach (var item in list) + { + if (item.Matches(info)) + return i; + i++; + } } return -1; } @@ -375,8 +397,8 @@ private static NdkInfo ScanByTargetFolder(string folder) if (string.IsNullOrEmpty(parentDir)) return null; - var devicesFileName = Path.Combine(folder, "blackberry-sdk-descriptor.xml"); - if (File.Exists(devicesFileName)) + var devicesDescriptorFileName = Path.Combine(folder, DescriptorFileName); + if (File.Exists(devicesDescriptorFileName)) { // find host folder var hostDirs = Directory.GetDirectories(parentDir, "host*"); @@ -388,11 +410,8 @@ private static NdkInfo ScanByTargetFolder(string folder) if (version == null) version = new Version(10, 0, 1); - // load devices' info - var devices = LoadDevices(devicesFileName); - return new NdkInfo(string.Concat("BlackBerry Local SDK ", version, " /", DateTime.Now.ToString("yyyy-MM-dd"), "/"), - version, hostDirs[0], folder, devices); + version, Path.Combine(hostDirs[0], "win32", "x86"), Path.Combine(folder, "qnx6")); } return null; @@ -420,5 +439,61 @@ private static Version GetVersionFromFolderName(string directoryName) return new Version(versionString); } + + public void Save(string outputDirectory) + { + if (string.IsNullOrEmpty(outputDirectory)) + throw new ArgumentNullException("outputDirectory"); + + // normalize file name: + var fileName = new StringBuilder(string.IsNullOrEmpty(Name) ? "vsplugin_target_" + Version + DateTime.Now.ToString("yyyy-MM-dd_HH_mm_ss") + ".xml" : Name + ".xml"); + + for (int i = 0; i < fileName.Length; i++) + { + char c = fileName[i]; + if (!(char.IsLetterOrDigit(c) || c == '_' || c == '-' || c == '.')) + { + fileName[i] = '_'; + } + } + + // generate content: + const string content = @" + + + {0} + {1} + {2} + {3} + + + + + +"; + XmlDocument doc = new XmlDocument(); + doc.LoadXml(content); + + string name = Name ?? string.Empty; + string version = Version.ToString(); + string hostPath = HostPath.Replace('\\', '/'); + string targetPath = TargetPath.Replace('\\', '/'); + + var inst = doc.DocumentElement["installation"]; + if (inst != null) + { + inst["name"].InnerText = name; + inst["version"].InnerText = version; + inst["host"].InnerText = hostPath; + inst["target"].InnerText = targetPath; + } + else + { + throw new FormatException("Invalid data to process"); + } + + // store it: + doc.Save(Path.Combine(outputDirectory, fileName.ToString())); + } } } diff --git a/src_vs2012/VSNDK.Package/Options/ApiLevelOptionControl.Designer.cs b/src_vs2012/VSNDK.Package/Options/ApiLevelOptionControl.Designer.cs index 64d63785..68a934c1 100644 --- a/src_vs2012/VSNDK.Package/Options/ApiLevelOptionControl.Designer.cs +++ b/src_vs2012/VSNDK.Package/Options/ApiLevelOptionControl.Designer.cs @@ -91,6 +91,7 @@ private void InitializeComponent() this.bttInstallNew.TabIndex = 5; this.bttInstallNew.Text = "&Install New..."; this.bttInstallNew.UseVisualStyleBackColor = true; + this.bttInstallNew.Click += new System.EventHandler(this.bttInstallNew_Click); // // label2 // diff --git a/src_vs2012/VSNDK.Package/Options/ApiLevelOptionControl.cs b/src_vs2012/VSNDK.Package/Options/ApiLevelOptionControl.cs index 94ca2c27..9cf08129 100644 --- a/src_vs2012/VSNDK.Package/Options/ApiLevelOptionControl.cs +++ b/src_vs2012/VSNDK.Package/Options/ApiLevelOptionControl.cs @@ -2,6 +2,7 @@ using System.Windows.Forms; using RIM.VSNDK_Package.Model; using RIM.VSNDK_Package.Options.Dialogs; +using RIM.VSNDK_Package.Tools; using RIM.VSNDK_Package.ViewModels; namespace RIM.VSNDK_Package.Options @@ -54,8 +55,23 @@ private void bttAddLocal_Click(object sender, EventArgs e) if (form.ShowDialog() == DialogResult.OK) { - + var ndk = form.NewNdk; + if (ndk != null) + { + // save inside 'installation config' directory: + ndk.Save(RunnerDefaults.InstallationConfigDirectory); + + // reload NDKs + _vm.ReloadAndActivate(ndk); + PopulateNDKs(); + } } } + + private void bttInstallNew_Click(object sender, EventArgs e) + { + var form = new InstallNdkForm(); + form.ShowDialog(); + } } } diff --git a/src_vs2012/VSNDK.Package/Options/ApiLevelOptionPage.cs b/src_vs2012/VSNDK.Package/Options/ApiLevelOptionPage.cs index 22810b96..10c60c9b 100644 --- a/src_vs2012/VSNDK.Package/Options/ApiLevelOptionPage.cs +++ b/src_vs2012/VSNDK.Package/Options/ApiLevelOptionPage.cs @@ -49,7 +49,7 @@ protected override void OnApply(PageApplyEventArgs e) if (!Control.HasSelectedNDK || PackageViewModel.Instance.ActiveNDK == null) { - if (MessageBoxHelper.Show("No NDK set as active or the one seems to not exist. You won't be able to compile anything. Do you want to correct it?", + if (MessageBoxHelper.Show("No NDK is set as active. You won't be able to compile anything.\r\nDo you want to correct it manually?", "API Level Settings", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { diff --git a/src_vs2012/VSNDK.Package/Options/Dialogs/AddLocalNdkForm.Designer.cs b/src_vs2012/VSNDK.Package/Options/Dialogs/AddLocalNdkForm.Designer.cs index c7ce2f13..c289901d 100644 --- a/src_vs2012/VSNDK.Package/Options/Dialogs/AddLocalNdkForm.Designer.cs +++ b/src_vs2012/VSNDK.Package/Options/Dialogs/AddLocalNdkForm.Designer.cs @@ -31,17 +31,17 @@ private void InitializeComponent() this.bttCancel = new System.Windows.Forms.Button(); this.bttOK = new System.Windows.Forms.Button(); this.groupBox1 = new System.Windows.Forms.GroupBox(); - this.label1 = new System.Windows.Forms.Label(); - this.label2 = new System.Windows.Forms.Label(); - this.label3 = new System.Windows.Forms.Label(); - this.txtName = new System.Windows.Forms.TextBox(); - this.txtHostPath = new System.Windows.Forms.TextBox(); - this.label4 = new System.Windows.Forms.Label(); - this.txtTargetPath = new System.Windows.Forms.TextBox(); - this.label5 = new System.Windows.Forms.Label(); - this.txtVersion = new System.Windows.Forms.TextBox(); - this.bttBrowseHost = new System.Windows.Forms.Button(); this.bttBrowseTarget = new System.Windows.Forms.Button(); + this.bttBrowseHost = new System.Windows.Forms.Button(); + this.txtVersion = new System.Windows.Forms.TextBox(); + this.label5 = new System.Windows.Forms.Label(); + this.txtTargetPath = new System.Windows.Forms.TextBox(); + this.label4 = new System.Windows.Forms.Label(); + this.txtHostPath = new System.Windows.Forms.TextBox(); + this.txtName = new System.Windows.Forms.TextBox(); + this.label3 = new System.Windows.Forms.Label(); + this.label2 = new System.Windows.Forms.Label(); + this.label1 = new System.Windows.Forms.Label(); this.groupBox1.SuspendLayout(); this.SuspendLayout(); // @@ -65,6 +65,7 @@ private void InitializeComponent() this.bttOK.TabIndex = 1; this.bttOK.Text = "&OK"; this.bttOK.UseVisualStyleBackColor = true; + this.bttOK.Click += new System.EventHandler(this.bttOK_Click); // // groupBox1 // @@ -89,46 +90,50 @@ private void InitializeComponent() this.groupBox1.TabStop = false; this.groupBox1.Text = "Properties"; // - // label1 + // bttBrowseTarget // - this.label1.AutoSize = true; - this.label1.Location = new System.Drawing.Point(18, 31); - this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(275, 13); - this.label1.TabIndex = 0; - this.label1.Text = "Specify the location of a local NDK and name it uniquely."; + this.bttBrowseTarget.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.bttBrowseTarget.Location = new System.Drawing.Point(564, 123); + this.bttBrowseTarget.Name = "bttBrowseTarget"; + this.bttBrowseTarget.Size = new System.Drawing.Size(75, 23); + this.bttBrowseTarget.TabIndex = 8; + this.bttBrowseTarget.Text = "Browse..."; + this.bttBrowseTarget.UseVisualStyleBackColor = true; + this.bttBrowseTarget.Click += new System.EventHandler(this.bttBrowseTarget_Click); // - // label2 + // bttBrowseHost // - this.label2.AutoSize = true; - this.label2.Location = new System.Drawing.Point(18, 123); - this.label2.Name = "label2"; - this.label2.Size = new System.Drawing.Size(66, 13); - this.label2.TabIndex = 6; - this.label2.Text = "Target Path:"; + this.bttBrowseHost.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.bttBrowseHost.Location = new System.Drawing.Point(564, 91); + this.bttBrowseHost.Name = "bttBrowseHost"; + this.bttBrowseHost.Size = new System.Drawing.Size(75, 23); + this.bttBrowseHost.TabIndex = 5; + this.bttBrowseHost.Text = "Browse..."; + this.bttBrowseHost.UseVisualStyleBackColor = true; + this.bttBrowseHost.Click += new System.EventHandler(this.bttBrowseHost_Click); // - // label3 + // txtVersion // - this.label3.AutoSize = true; - this.label3.Location = new System.Drawing.Point(18, 94); - this.label3.Name = "label3"; - this.label3.Size = new System.Drawing.Size(57, 13); - this.label3.TabIndex = 3; - this.label3.Text = "Host Path:"; + this.txtVersion.Location = new System.Drawing.Point(106, 150); + this.txtVersion.Name = "txtVersion"; + this.txtVersion.Size = new System.Drawing.Size(100, 20); + this.txtVersion.TabIndex = 10; // - // txtName + // label5 // - this.txtName.Location = new System.Drawing.Point(106, 61); - this.txtName.Name = "txtName"; - this.txtName.Size = new System.Drawing.Size(274, 20); - this.txtName.TabIndex = 2; + this.label5.AutoSize = true; + this.label5.Location = new System.Drawing.Point(18, 153); + this.label5.Name = "label5"; + this.label5.Size = new System.Drawing.Size(45, 13); + this.label5.TabIndex = 9; + this.label5.Text = "Version:"; // - // txtHostPath + // txtTargetPath // - this.txtHostPath.Location = new System.Drawing.Point(106, 91); - this.txtHostPath.Name = "txtHostPath"; - this.txtHostPath.Size = new System.Drawing.Size(452, 20); - this.txtHostPath.TabIndex = 4; + this.txtTargetPath.Location = new System.Drawing.Point(106, 120); + this.txtTargetPath.Name = "txtTargetPath"; + this.txtTargetPath.Size = new System.Drawing.Size(452, 20); + this.txtTargetPath.TabIndex = 7; // // label4 // @@ -139,50 +144,47 @@ private void InitializeComponent() this.label4.TabIndex = 1; this.label4.Text = "Name:"; // - // txtTargetPath + // txtHostPath // - this.txtTargetPath.Location = new System.Drawing.Point(106, 120); - this.txtTargetPath.Name = "txtTargetPath"; - this.txtTargetPath.Size = new System.Drawing.Size(452, 20); - this.txtTargetPath.TabIndex = 7; + this.txtHostPath.Location = new System.Drawing.Point(106, 91); + this.txtHostPath.Name = "txtHostPath"; + this.txtHostPath.Size = new System.Drawing.Size(452, 20); + this.txtHostPath.TabIndex = 4; // - // label5 + // txtName // - this.label5.AutoSize = true; - this.label5.Location = new System.Drawing.Point(18, 153); - this.label5.Name = "label5"; - this.label5.Size = new System.Drawing.Size(45, 13); - this.label5.TabIndex = 9; - this.label5.Text = "Version:"; + this.txtName.Location = new System.Drawing.Point(106, 61); + this.txtName.Name = "txtName"; + this.txtName.Size = new System.Drawing.Size(274, 20); + this.txtName.TabIndex = 2; // - // txtVersion + // label3 // - this.txtVersion.Location = new System.Drawing.Point(106, 150); - this.txtVersion.Name = "txtVersion"; - this.txtVersion.Size = new System.Drawing.Size(100, 20); - this.txtVersion.TabIndex = 10; + this.label3.AutoSize = true; + this.label3.Location = new System.Drawing.Point(18, 94); + this.label3.Name = "label3"; + this.label3.Size = new System.Drawing.Size(57, 13); + this.label3.TabIndex = 3; + this.label3.Text = "Host Path:"; // - // bttBrowseHost + // label2 // - this.bttBrowseHost.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this.bttBrowseHost.Location = new System.Drawing.Point(564, 91); - this.bttBrowseHost.Name = "bttBrowseHost"; - this.bttBrowseHost.Size = new System.Drawing.Size(75, 23); - this.bttBrowseHost.TabIndex = 5; - this.bttBrowseHost.Text = "Browse..."; - this.bttBrowseHost.UseVisualStyleBackColor = true; - this.bttBrowseHost.Click += new System.EventHandler(this.bttBrowseHost_Click); + this.label2.AutoSize = true; + this.label2.Location = new System.Drawing.Point(18, 123); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(66, 13); + this.label2.TabIndex = 6; + this.label2.Text = "Target Path:"; // - // bttBrowseTarget + // label1 // - this.bttBrowseTarget.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this.bttBrowseTarget.Location = new System.Drawing.Point(564, 123); - this.bttBrowseTarget.Name = "bttBrowseTarget"; - this.bttBrowseTarget.Size = new System.Drawing.Size(75, 23); - this.bttBrowseTarget.TabIndex = 8; - this.bttBrowseTarget.Text = "Browse..."; - this.bttBrowseTarget.UseVisualStyleBackColor = true; - this.bttBrowseTarget.Click += new System.EventHandler(this.bttBrowseTarget_Click); + this.label1.AutoSize = true; + this.label1.Location = new System.Drawing.Point(18, 31); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(586, 13); + this.label1.TabIndex = 0; + this.label1.Text = "Specify the location of a local NDK and name it uniquely. Use Browse buttons belo" + + "w, to let them be detected automatically."; // // AddLocalNdkForm // @@ -194,13 +196,13 @@ private void InitializeComponent() this.Controls.Add(this.groupBox1); this.Controls.Add(this.bttOK); this.Controls.Add(this.bttCancel); - this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow; + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; this.MaximizeBox = false; this.MinimizeBox = false; this.Name = "AddLocalNdkForm"; this.ShowIcon = false; this.ShowInTaskbar = false; - this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; this.Text = "New NDK"; this.groupBox1.ResumeLayout(false); this.groupBox1.PerformLayout(); diff --git a/src_vs2012/VSNDK.Package/Options/Dialogs/AddLocalNdkForm.cs b/src_vs2012/VSNDK.Package/Options/Dialogs/AddLocalNdkForm.cs index f6e281ba..15738e0b 100644 --- a/src_vs2012/VSNDK.Package/Options/Dialogs/AddLocalNdkForm.cs +++ b/src_vs2012/VSNDK.Package/Options/Dialogs/AddLocalNdkForm.cs @@ -1,6 +1,8 @@ using System; +using System.IO; using System.Windows.Forms; using RIM.VSNDK_Package.Model; +using RIM.VSNDK_Package.ViewModels; namespace RIM.VSNDK_Package.Options.Dialogs { @@ -36,7 +38,7 @@ public Version NdkVersion get { if (string.IsNullOrEmpty(txtVersion.Text) || txtVersion.Text.IndexOf('.') < 0) - return new Version(10, 0); + return null; try { @@ -44,12 +46,18 @@ public Version NdkVersion } catch { - return new Version(1, 0); + return null; } } set { txtVersion.Text = value != null ? value.ToString() : string.Empty; } } + internal NdkInfo NewNdk + { + get; + private set; + } + #endregion private void bttBrowseHost_Click(object sender, EventArgs e) @@ -84,5 +92,49 @@ private void UpdateByPathSelection(TextBox sourceControl) NdkVersion = ndk.Version; } } + + private void bttOK_Click(object sender, EventArgs e) + { + // verify input data: + if (NdkVersion == null) + { + MessageBoxHelper.Show("Incorrect field value", "Version", MessageBoxButtons.OK, MessageBoxIcon.Error); + ActiveControl = txtVersion; + return; + } + + if (string.IsNullOrEmpty(NdkHostPath) || !Directory.Exists(NdkHostPath)) + { + MessageBoxHelper.Show("Incorrect path or doesn't exist, no way to set it as an NDK root", "Host Path", MessageBoxButtons.OK, MessageBoxIcon.Error); + ActiveControl = txtHostPath; + return; + } + + if (string.IsNullOrEmpty(NdkTargetPath) || !Directory.Exists(NdkTargetPath)) + { + MessageBoxHelper.Show("Incorrect path or doesn't exist, no way to set it as an NDK root", "Host Target", MessageBoxButtons.OK, MessageBoxIcon.Error); + ActiveControl = txtHostPath; + return; + } + + // create result + NewNdk = new NdkInfo(NdkName, NdkVersion, NdkHostPath, NdkTargetPath); + var existingIndex = PackageViewModel.Instance.IndexOfInstalled(NewNdk); + var existingNDK = existingIndex >= 0 ? PackageViewModel.Instance.InstalledNDKs[existingIndex] : null; + + if (existingNDK != null) + { + if (MessageBoxHelper.Show("Are you sure, you want to add it?\r\nIt won't probably show up to select as duplicates are not allowed.", + "Configuration duplicates \"" + existingNDK.Name + "\"", + MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No) + { + NewNdk = null; + return; + } + } + + DialogResult = DialogResult.OK; + Close(); + } } } diff --git a/src_vs2012/VSNDK.Package/Options/Dialogs/DeviceForm.Designer.cs b/src_vs2012/VSNDK.Package/Options/Dialogs/DeviceForm.Designer.cs index 0be4a674..2eed2543 100644 --- a/src_vs2012/VSNDK.Package/Options/Dialogs/DeviceForm.Designer.cs +++ b/src_vs2012/VSNDK.Package/Options/Dialogs/DeviceForm.Designer.cs @@ -192,13 +192,13 @@ private void InitializeComponent() this.Controls.Add(this.bttTest); this.Controls.Add(this.txtLogs); this.Controls.Add(this.groupBox1); - this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow; + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; this.MaximizeBox = false; this.MinimizeBox = false; this.Name = "DeviceForm"; this.ShowIcon = false; this.ShowInTaskbar = false; - this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; this.Text = "DeviceForm"; this.groupBox1.ResumeLayout(false); this.groupBox1.PerformLayout(); diff --git a/src_vs2012/VSNDK.Package/Options/Dialogs/InstallNdkForm.Designer.cs b/src_vs2012/VSNDK.Package/Options/Dialogs/InstallNdkForm.Designer.cs new file mode 100644 index 00000000..ef2f816e --- /dev/null +++ b/src_vs2012/VSNDK.Package/Options/Dialogs/InstallNdkForm.Designer.cs @@ -0,0 +1,68 @@ +namespace RIM.VSNDK_Package.Options.Dialogs +{ + partial class InstallNdkForm + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.bttOK = new System.Windows.Forms.Button(); + this.SuspendLayout(); + // + // bttOK + // + this.bttOK.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.bttOK.DialogResult = System.Windows.Forms.DialogResult.OK; + this.bttOK.Location = new System.Drawing.Point(591, 390); + this.bttOK.Name = "bttOK"; + this.bttOK.Size = new System.Drawing.Size(75, 23); + this.bttOK.TabIndex = 0; + this.bttOK.Text = "&OK"; + this.bttOK.UseVisualStyleBackColor = true; + // + // InstallNdkForm + // + this.AcceptButton = this.bttOK; + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.CancelButton = this.bttOK; + this.ClientSize = new System.Drawing.Size(678, 425); + this.Controls.Add(this.bttOK); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; + this.MaximizeBox = false; + this.MinimizeBox = false; + this.Name = "InstallNdkForm"; + this.ShowInTaskbar = false; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; + this.Text = "NDK Installation"; + this.ResumeLayout(false); + + } + + #endregion + + private System.Windows.Forms.Button bttOK; + } +} \ No newline at end of file diff --git a/src_vs2012/VSNDK.Package/Options/Dialogs/InstallNdkForm.cs b/src_vs2012/VSNDK.Package/Options/Dialogs/InstallNdkForm.cs new file mode 100644 index 00000000..febeaf1a --- /dev/null +++ b/src_vs2012/VSNDK.Package/Options/Dialogs/InstallNdkForm.cs @@ -0,0 +1,20 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace RIM.VSNDK_Package.Options.Dialogs +{ + public partial class InstallNdkForm : Form + { + public InstallNdkForm() + { + InitializeComponent(); + } + } +} diff --git a/src_vs2012/VSNDK.Package/Options/Dialogs/InstallNdkForm.resx b/src_vs2012/VSNDK.Package/Options/Dialogs/InstallNdkForm.resx new file mode 100644 index 00000000..29dcb1b3 --- /dev/null +++ b/src_vs2012/VSNDK.Package/Options/Dialogs/InstallNdkForm.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/src_vs2012/VSNDK.Package/VSNDK.Package.csproj b/src_vs2012/VSNDK.Package/VSNDK.Package.csproj index 32832993..0370ae34 100644 --- a/src_vs2012/VSNDK.Package/VSNDK.Package.csproj +++ b/src_vs2012/VSNDK.Package/VSNDK.Package.csproj @@ -289,6 +289,12 @@ DeviceForm.cs + + Form + + + InstallNdkForm.cs + UserControl @@ -490,6 +496,9 @@ DeviceForm.cs + + InstallNdkForm.cs + GeneralOptionControl.cs diff --git a/src_vs2012/VSNDK.Package/ViewModels/ApiLevelOptionViewModel.cs b/src_vs2012/VSNDK.Package/ViewModels/ApiLevelOptionViewModel.cs index cb51d5d8..1698358d 100644 --- a/src_vs2012/VSNDK.Package/ViewModels/ApiLevelOptionViewModel.cs +++ b/src_vs2012/VSNDK.Package/ViewModels/ApiLevelOptionViewModel.cs @@ -14,5 +14,11 @@ public NdkInfo ActiveNDK get { return PackageViewModel.Instance.ActiveNDK; } set { PackageViewModel.Instance.ActiveNDK = value; } } + + public void ReloadAndActivate(NdkInfo ndk) + { + PackageViewModel.Instance.ResetNDKs(); + ActiveNDK = ndk; + } } } diff --git a/src_vs2012/VSNDK.Package/ViewModels/PackageViewModel.cs b/src_vs2012/VSNDK.Package/ViewModels/PackageViewModel.cs index 1bcff5b1..4fd9a86b 100644 --- a/src_vs2012/VSNDK.Package/ViewModels/PackageViewModel.cs +++ b/src_vs2012/VSNDK.Package/ViewModels/PackageViewModel.cs @@ -82,28 +82,33 @@ public NdkInfo ActiveNDK } set { - if (value != null) + if (value != null && !value.Matches(_activeNDK)) { - var index = Array.IndexOf(InstalledNDKs, value); + var index = IndexOfInstalled(value); if (index < 0) throw new ArgumentOutOfRangeException("value", "Invalid value set, it must belong to the InstalledNDKs first"); - if (!value.Matches(_activeNDK)) - { - _activeNDK = value; - TraceLog.WriteLine("Changed active NDK to: \"{0}\"", _activeNDK); - SaveActiveNDK(); - } + _activeNDK = _installedNDKs[index]; + TraceLog.WriteLine("Changed active NDK to: \"{0}\"", _activeNDK); + SaveActiveNDK(); } } } #endregion + /// + /// Gets an index of identical installed NDK. + /// + public int IndexOfInstalled(NdkInfo info) + { + return NdkInfo.IndexOf(InstalledNDKs, info); + } + /// /// Persists info about currently selected NDK into the registry. /// - public void SaveActiveNDK() + private void SaveActiveNDK() { if (_activeNDK == null || !_activeNDK.Exists()) { @@ -136,5 +141,14 @@ public void DeleteActiveNDK() TraceLog.WriteException(ex, "Unable to clear info about active NDK"); } } + + /// + /// Resets the cached lists of NDKs, allowing to reload them again. + /// + public void ResetNDKs() + { + _installedNDKs = null; + _activeNDK = null; + } } } From 46e68b594655f0a436c4614574458b1eb1b0b7d4 Mon Sep 17 00:00:00 2001 From: Pawel Hofman Date: Wed, 14 May 2014 00:15:50 +0200 Subject: [PATCH 053/851] Now can copy device-name, when editing Target Device --- .../Options/Dialogs/DeviceForm.Designer.cs | 14 ++++++++ .../Options/Dialogs/DeviceForm.cs | 34 +++++++++++++++++++ 2 files changed, 48 insertions(+) diff --git a/src_vs2012/VSNDK.Package/Options/Dialogs/DeviceForm.Designer.cs b/src_vs2012/VSNDK.Package/Options/Dialogs/DeviceForm.Designer.cs index 2eed2543..2cf47e41 100644 --- a/src_vs2012/VSNDK.Package/Options/Dialogs/DeviceForm.Designer.cs +++ b/src_vs2012/VSNDK.Package/Options/Dialogs/DeviceForm.Designer.cs @@ -29,6 +29,7 @@ protected override void Dispose(bool disposing) private void InitializeComponent() { this.groupBox1 = new System.Windows.Forms.GroupBox(); + this.bttSetName = new System.Windows.Forms.Button(); this.txtPassword = new System.Windows.Forms.TextBox(); this.label4 = new System.Windows.Forms.Label(); this.txtIP = new System.Windows.Forms.TextBox(); @@ -48,6 +49,7 @@ private void InitializeComponent() // this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); + this.groupBox1.Controls.Add(this.bttSetName); this.groupBox1.Controls.Add(this.txtPassword); this.groupBox1.Controls.Add(this.label4); this.groupBox1.Controls.Add(this.txtIP); @@ -63,6 +65,17 @@ private void InitializeComponent() this.groupBox1.TabStop = false; this.groupBox1.Text = "Device Target Properties"; // + // bttSetName + // + this.bttSetName.Location = new System.Drawing.Point(260, 50); + this.bttSetName.Name = "bttSetName"; + this.bttSetName.Size = new System.Drawing.Size(138, 23); + this.bttSetName.TabIndex = 8; + this.bttSetName.Text = "Set "; + this.bttSetName.UseVisualStyleBackColor = true; + this.bttSetName.Visible = false; + this.bttSetName.Click += new System.EventHandler(this.bttSetName_Click); + // // txtPassword // this.txtPassword.Location = new System.Drawing.Point(89, 103); @@ -222,5 +235,6 @@ private void InitializeComponent() private System.Windows.Forms.Button bttTest; private System.Windows.Forms.Button bttOK; private System.Windows.Forms.Button bttCancel; + private System.Windows.Forms.Button bttSetName; } } \ No newline at end of file diff --git a/src_vs2012/VSNDK.Package/Options/Dialogs/DeviceForm.cs b/src_vs2012/VSNDK.Package/Options/Dialogs/DeviceForm.cs index 59de1693..dd350a2e 100644 --- a/src_vs2012/VSNDK.Package/Options/Dialogs/DeviceForm.cs +++ b/src_vs2012/VSNDK.Package/Options/Dialogs/DeviceForm.cs @@ -1,6 +1,7 @@ using System; using System.Windows.Forms; using RIM.VSNDK_Package.Diagnostics; +using RIM.VSNDK_Package.Model; using RIM.VSNDK_Package.Tools; using RIM.VSNDK_Package.ViewModels; @@ -12,6 +13,7 @@ namespace RIM.VSNDK_Package.Options.Dialogs internal partial class DeviceForm : Form { private DeviceInfoRunner _runner; + private string _loadedDeviceName; public DeviceForm(string title) { @@ -54,6 +56,26 @@ public bool IsConnected private set; } + public string LoadedDeviceName + { + get { return _loadedDeviceName; } + set + { + if (string.IsNullOrEmpty(value)) + { + _loadedDeviceName = null; + bttSetName.Text = string.Empty; + bttSetName.Visible = false; + } + else + { + _loadedDeviceName = value; + bttSetName.Text = "<< " + value.Substring(0, value.Length > 14 ? 14 : value.Length) + "..."; // up to 15chars + bttSetName.Visible = true; + } + } + } + #endregion public DeviceDefinition ToDevice() @@ -130,6 +152,7 @@ private void bttTest_Click(object sender, EventArgs e) } IsConnected = false; + LoadedDeviceName = null; _runner = new DeviceInfoRunner(RunnerDefaults.ToolsDirectory, DeviceIP, DevicePassword); _runner.Finished += RunnerOnFinished; @@ -146,6 +169,7 @@ private void RunnerOnFinished(object sender, ToolRunnerEventArgs e) { TraceLog.WriteLine("Found device: {0} with IP: {1}", _runner.DeviceInfo.ToString(), DeviceIP); AppendLog("Device found:" + Environment.NewLine + _runner.DeviceInfo.ToLongDescription()); + Invoke(new Action(UpdateWithDevice), _runner.DeviceInfo); IsConnected = true; } else @@ -159,6 +183,11 @@ private void RunnerOnFinished(object sender, ToolRunnerEventArgs e) _runner = null; } + private void UpdateWithDevice(DeviceInfo deviceInfo) + { + LoadedDeviceName = deviceInfo != null ? deviceInfo.Name : null; + } + private void cmbType_SelectedIndexChanged(object sender, EventArgs e) { txtIP.Enabled = DeviceClass != DialogDeviceClass.UsbDevice; @@ -188,5 +217,10 @@ private void bttOK_Click(object sender, EventArgs e) DialogResult = DialogResult.OK; Close(); } + + private void bttSetName_Click(object sender, EventArgs e) + { + txtName.Text = LoadedDeviceName; + } } } From 2227884ae51cc2a9dcf720d579b8b950449f32e9 Mon Sep 17 00:00:00 2001 From: Pawel Hofman Date: Wed, 14 May 2014 02:43:47 +0200 Subject: [PATCH 054/851] Implemented Target Devices management feature --- src/VSNDK.Package/VSNDK.PackagePackage.cs | 10 +- .../Options/ApiLevelOptionPage.cs | 3 +- .../Dialogs/AddLocalNdkForm.Designer.cs | 4 +- .../Options/TargetsOptionControl.Designer.cs | 107 ++++++++---- .../Options/TargetsOptionControl.cs | 93 +++++++++- .../Options/TargetsOptionPage.cs | 5 + src_vs2012/VSNDK.Package/VSNDK.Package.csproj | 1 + .../ViewModels/DeviceDefinition.cs | 163 +++++++++++++++++- .../ViewModels/PackageViewModel.cs | 106 ++++++++++++ .../ViewModels/TargetsOptionViewModel.cs | 159 +++++++++++++++++ 10 files changed, 604 insertions(+), 47 deletions(-) create mode 100644 src_vs2012/VSNDK.Package/ViewModels/TargetsOptionViewModel.cs diff --git a/src/VSNDK.Package/VSNDK.PackagePackage.cs b/src/VSNDK.Package/VSNDK.PackagePackage.cs index 3ec27dcd..30eb4544 100644 --- a/src/VSNDK.Package/VSNDK.PackagePackage.cs +++ b/src/VSNDK.Package/VSNDK.PackagePackage.cs @@ -1031,16 +1031,16 @@ protected override void Initialize() // Create dynamic command for the 'devices-list' menu CommandID devicesCommandID = new CommandID(GuidList.guidVSNDK_PackageCmdSet, PkgCmdIDList.cmdidBlackBerryTargetsDevicesPlaceholder); - DynamicMenuCommand devicesMenu = new DynamicMenuCommand(() => PackageViewModel.Instance.InstalledNDKs, + DynamicMenuCommand devicesMenu = new DynamicMenuCommand(() => PackageViewModel.Instance.TargetDevices, (cmd, collection, index) => { - var item = index >= 0 && index < collection.Count ? ((NdkInfo[])collection)[index] : null; - PackageViewModel.Instance.ActiveNDK = item; + var item = index >= 0 && index < collection.Count ? ((DeviceDefinition[])collection)[index] : null; + PackageViewModel.Instance.ActiveDevice = item; }, (cmd, collection, index) => { - var item = index >= 0 && index < collection.Count ? ((NdkInfo[]) collection)[index] : null; - cmd.Checked = item == PackageViewModel.Instance.ActiveNDK; + var item = index >= 0 && index < collection.Count ? ((DeviceDefinition[])collection)[index] : null; + cmd.Checked = item == PackageViewModel.Instance.ActiveDevice || item == PackageViewModel.Instance.ActiveSimulator; cmd.Text = item != null ? item.ToString() : "-"; }, devicesCommandID); diff --git a/src_vs2012/VSNDK.Package/Options/ApiLevelOptionPage.cs b/src_vs2012/VSNDK.Package/Options/ApiLevelOptionPage.cs index 10c60c9b..2f5ab78f 100644 --- a/src_vs2012/VSNDK.Package/Options/ApiLevelOptionPage.cs +++ b/src_vs2012/VSNDK.Package/Options/ApiLevelOptionPage.cs @@ -1,5 +1,4 @@ -using System; -using System.ComponentModel; +using System.ComponentModel; using System.Drawing; using System.Windows.Forms; using System.Runtime.InteropServices; diff --git a/src_vs2012/VSNDK.Package/Options/Dialogs/AddLocalNdkForm.Designer.cs b/src_vs2012/VSNDK.Package/Options/Dialogs/AddLocalNdkForm.Designer.cs index c289901d..21f1af7f 100644 --- a/src_vs2012/VSNDK.Package/Options/Dialogs/AddLocalNdkForm.Designer.cs +++ b/src_vs2012/VSNDK.Package/Options/Dialogs/AddLocalNdkForm.Designer.cs @@ -181,10 +181,10 @@ private void InitializeComponent() this.label1.AutoSize = true; this.label1.Location = new System.Drawing.Point(18, 31); this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(586, 13); + this.label1.Size = new System.Drawing.Size(558, 13); this.label1.TabIndex = 0; this.label1.Text = "Specify the location of a local NDK and name it uniquely. Use Browse buttons belo" + - "w, to let them be detected automatically."; + "w, to automate the whole process."; // // AddLocalNdkForm // diff --git a/src_vs2012/VSNDK.Package/Options/TargetsOptionControl.Designer.cs b/src_vs2012/VSNDK.Package/Options/TargetsOptionControl.Designer.cs index 28b4c499..dbc2a317 100644 --- a/src_vs2012/VSNDK.Package/Options/TargetsOptionControl.Designer.cs +++ b/src_vs2012/VSNDK.Package/Options/TargetsOptionControl.Designer.cs @@ -29,16 +29,18 @@ protected override void Dispose(bool disposing) private void InitializeComponent() { this.groupBox1 = new System.Windows.Forms.GroupBox(); + this.listTargets = new System.Windows.Forms.ListView(); + this.columnActive = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); + this.columnName = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); + this.columnIP = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.label1 = new System.Windows.Forms.Label(); this.bttAdd = new System.Windows.Forms.Button(); this.bttEdit = new System.Windows.Forms.Button(); this.bttRemove = new System.Windows.Forms.Button(); this.lnkMoreInfo = new System.Windows.Forms.LinkLabel(); this.bttDebugToken = new System.Windows.Forms.Button(); - this.listTargets = new System.Windows.Forms.ListView(); - this.columnActive = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); - this.columnName = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); - this.columnIP = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); + this.bttActivate = new System.Windows.Forms.Button(); + this.columnType = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.groupBox1.SuspendLayout(); this.SuspendLayout(); // @@ -50,18 +52,57 @@ private void InitializeComponent() this.groupBox1.Controls.Add(this.listTargets); this.groupBox1.Location = new System.Drawing.Point(3, 46); this.groupBox1.Name = "groupBox1"; - this.groupBox1.Size = new System.Drawing.Size(644, 169); + this.groupBox1.Size = new System.Drawing.Size(461, 301); this.groupBox1.TabIndex = 0; this.groupBox1.TabStop = false; this.groupBox1.Text = "Known Targets"; // + // listTargets + // + this.listTargets.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.listTargets.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { + this.columnActive, + this.columnType, + this.columnName, + this.columnIP}); + this.listTargets.FullRowSelect = true; + this.listTargets.GridLines = true; + this.listTargets.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.Nonclickable; + this.listTargets.HideSelection = false; + this.listTargets.Location = new System.Drawing.Point(6, 19); + this.listTargets.MultiSelect = false; + this.listTargets.Name = "listTargets"; + this.listTargets.Size = new System.Drawing.Size(449, 276); + this.listTargets.TabIndex = 0; + this.listTargets.UseCompatibleStateImageBehavior = false; + this.listTargets.View = System.Windows.Forms.View.Details; + this.listTargets.SelectedIndexChanged += new System.EventHandler(this.listTargets_SelectedIndexChanged); + this.listTargets.DoubleClick += new System.EventHandler(this.listTargets_DoubleClick); + // + // columnActive + // + this.columnActive.Text = "A"; + this.columnActive.Width = 20; + // + // columnName + // + this.columnName.Text = "Name"; + this.columnName.Width = 150; + // + // columnIP + // + this.columnIP.Text = "IP"; + this.columnIP.Width = 100; + // // label1 // this.label1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.label1.Location = new System.Drawing.Point(0, 0); this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(737, 33); + this.label1.Size = new System.Drawing.Size(551, 33); this.label1.TabIndex = 1; this.label1.Text = "In order to connect to the device, you must enable the [Development Mode]. It can" + " be found at Settings > Security and Privacy > Development Mode."; @@ -69,7 +110,7 @@ private void InitializeComponent() // bttAdd // this.bttAdd.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this.bttAdd.Location = new System.Drawing.Point(653, 51); + this.bttAdd.Location = new System.Drawing.Point(470, 51); this.bttAdd.Name = "bttAdd"; this.bttAdd.Size = new System.Drawing.Size(88, 23); this.bttAdd.TabIndex = 2; @@ -81,23 +122,25 @@ private void InitializeComponent() // this.bttEdit.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); this.bttEdit.Enabled = false; - this.bttEdit.Location = new System.Drawing.Point(653, 80); + this.bttEdit.Location = new System.Drawing.Point(470, 80); this.bttEdit.Name = "bttEdit"; this.bttEdit.Size = new System.Drawing.Size(88, 23); this.bttEdit.TabIndex = 2; this.bttEdit.Text = "&Edit..."; this.bttEdit.UseVisualStyleBackColor = true; + this.bttEdit.Click += new System.EventHandler(this.bttEdit_Click); // // bttRemove // this.bttRemove.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); this.bttRemove.Enabled = false; - this.bttRemove.Location = new System.Drawing.Point(653, 109); + this.bttRemove.Location = new System.Drawing.Point(470, 109); this.bttRemove.Name = "bttRemove"; this.bttRemove.Size = new System.Drawing.Size(88, 23); this.bttRemove.TabIndex = 2; this.bttRemove.Text = "&Remove"; this.bttRemove.UseVisualStyleBackColor = true; + this.bttRemove.Click += new System.EventHandler(this.bttRemove_Click); // // lnkMoreInfo // @@ -114,46 +157,36 @@ private void InitializeComponent() // this.bttDebugToken.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.bttDebugToken.Enabled = false; - this.bttDebugToken.Location = new System.Drawing.Point(653, 167); + this.bttDebugToken.Location = new System.Drawing.Point(470, 299); this.bttDebugToken.Name = "bttDebugToken"; this.bttDebugToken.Size = new System.Drawing.Size(88, 48); this.bttDebugToken.TabIndex = 2; this.bttDebugToken.Text = "&Upload debug token..."; this.bttDebugToken.UseVisualStyleBackColor = true; // - // listTargets + // bttActivate // - this.listTargets.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.listTargets.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { - this.columnActive, - this.columnName, - this.columnIP}); - this.listTargets.Location = new System.Drawing.Point(6, 19); - this.listTargets.Name = "listTargets"; - this.listTargets.Size = new System.Drawing.Size(632, 144); - this.listTargets.TabIndex = 0; - this.listTargets.UseCompatibleStateImageBehavior = false; - // - // columnActive - // - this.columnActive.Text = "A"; - this.columnActive.Width = 20; - // - // columnName + this.bttActivate.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.bttActivate.Enabled = false; + this.bttActivate.Location = new System.Drawing.Point(470, 138); + this.bttActivate.Name = "bttActivate"; + this.bttActivate.Size = new System.Drawing.Size(88, 23); + this.bttActivate.TabIndex = 4; + this.bttActivate.Text = "Set &Activate"; + this.bttActivate.UseVisualStyleBackColor = true; + this.bttActivate.Click += new System.EventHandler(this.bttActivate_Click); // - this.columnName.Text = "Name"; - this.columnName.Width = 80; + // columnType // - // columnIP - // - this.columnIP.Text = "IP"; + this.columnType.Text = "T"; + this.columnType.TextAlign = System.Windows.Forms.HorizontalAlignment.Center; + this.columnType.Width = 20; // // TargetsOptionControl // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.Controls.Add(this.bttActivate); this.Controls.Add(this.lnkMoreInfo); this.Controls.Add(this.bttDebugToken); this.Controls.Add(this.bttRemove); @@ -162,7 +195,7 @@ private void InitializeComponent() this.Controls.Add(this.label1); this.Controls.Add(this.groupBox1); this.Name = "TargetsOptionControl"; - this.Size = new System.Drawing.Size(744, 223); + this.Size = new System.Drawing.Size(558, 355); this.groupBox1.ResumeLayout(false); this.ResumeLayout(false); this.PerformLayout(); @@ -182,6 +215,8 @@ private void InitializeComponent() private System.Windows.Forms.ColumnHeader columnActive; private System.Windows.Forms.ColumnHeader columnName; private System.Windows.Forms.ColumnHeader columnIP; + private System.Windows.Forms.Button bttActivate; + private System.Windows.Forms.ColumnHeader columnType; } } diff --git a/src_vs2012/VSNDK.Package/Options/TargetsOptionControl.cs b/src_vs2012/VSNDK.Package/Options/TargetsOptionControl.cs index 3465634c..78465b51 100644 --- a/src_vs2012/VSNDK.Package/Options/TargetsOptionControl.cs +++ b/src_vs2012/VSNDK.Package/Options/TargetsOptionControl.cs @@ -1,14 +1,53 @@ using System.Diagnostics; using System.Windows.Forms; using RIM.VSNDK_Package.Options.Dialogs; +using RIM.VSNDK_Package.ViewModels; namespace RIM.VSNDK_Package.Options { public partial class TargetsOptionControl : UserControl { + private readonly TargetsOptionViewModel _vm = new TargetsOptionViewModel(); + public TargetsOptionControl() { InitializeComponent(); + + PopulateDevices(); + } + + #region Properties + + private DeviceDefinition SelectedDevice + { + get + { + if (listTargets.SelectedItems.Count != 1) + return null; + + return listTargets.SelectedItems[0].Tag as DeviceDefinition; + } + } + + #endregion + + private void PopulateDevices() + { + listTargets.Items.Clear(); + + foreach (var device in _vm.Devices) + { + ListViewItem item = new ListViewItem(); + item.Tag = device; + item.Text = _vm.IsSelected(device) ? "x" : string.Empty; + item.SubItems.Add(device.Type == DeviceDefinitionType.Simulator ? "S" : string.Empty); + item.SubItems.Add(device.Name); + item.SubItems.Add(device.IP); + + listTargets.Items.Add(item); + } + + bttDebugToken.Enabled = _vm.ActiveDevice != null; } private void lnkMoreInfo_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) @@ -16,14 +55,66 @@ private void lnkMoreInfo_LinkClicked(object sender, LinkLabelLinkClickedEventArg Process.Start("http://developer.blackberry.com/native/documentation/cascades/getting_started/setting_up.html"); } + private void listTargets_SelectedIndexChanged(object sender, System.EventArgs e) + { + var device = SelectedDevice; + + bttEdit.Enabled = bttRemove.Enabled = bttActivate.Enabled = device != null; + } + + private void listTargets_DoubleClick(object sender, System.EventArgs e) + { + if (SelectedDevice != null) + { + bttEdit_Click(sender, e); + } + } + private void bttAdd_Click(object sender, System.EventArgs e) { var form = new DeviceForm("Add new Target Device"); if (form.ShowDialog() == DialogResult.OK) { - + _vm.Add(form.ToDevice()); + PopulateDevices(); + } + } + + private void bttEdit_Click(object sender, System.EventArgs e) + { + var form = new DeviceForm("Edit Target Device"); + var device = SelectedDevice; + form.FromDevice(device); + + if (form.ShowDialog() == DialogResult.OK) + { + _vm.Update(device, form.ToDevice()); + PopulateDevices(); + } + } + + private void bttActivate_Click(object sender, System.EventArgs e) + { + _vm.SetActive(SelectedDevice); + PopulateDevices(); + } + + private void bttRemove_Click(object sender, System.EventArgs e) + { + var device = SelectedDevice; + + if (MessageBoxHelper.Show(device.Type == DeviceDefinitionType.Device ? "Remove the device?" : "Remove the simulator?", + device.ToString(), MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) + { + _vm.Remove(device); + PopulateDevices(); } } + + public void OnApply() + { + _vm.Apply(); + } } } diff --git a/src_vs2012/VSNDK.Package/Options/TargetsOptionPage.cs b/src_vs2012/VSNDK.Package/Options/TargetsOptionPage.cs index ab87a478..c38fcb3a 100644 --- a/src_vs2012/VSNDK.Package/Options/TargetsOptionPage.cs +++ b/src_vs2012/VSNDK.Package/Options/TargetsOptionPage.cs @@ -40,5 +40,10 @@ protected override IWin32Window Window } #endregion + + protected override void OnApply(PageApplyEventArgs e) + { + Control.OnApply(); + } } } diff --git a/src_vs2012/VSNDK.Package/VSNDK.Package.csproj b/src_vs2012/VSNDK.Package/VSNDK.Package.csproj index 0370ae34..67b2b8f8 100644 --- a/src_vs2012/VSNDK.Package/VSNDK.Package.csproj +++ b/src_vs2012/VSNDK.Package/VSNDK.Package.csproj @@ -345,6 +345,7 @@ + Templates\VCWizards\BlackBerry\BarDescriptor\Templates\1033\bar-descriptor.cs bar-descriptor.xsd diff --git a/src_vs2012/VSNDK.Package/ViewModels/DeviceDefinition.cs b/src_vs2012/VSNDK.Package/ViewModels/DeviceDefinition.cs index 0e8a9b28..bba6c95e 100644 --- a/src_vs2012/VSNDK.Package/ViewModels/DeviceDefinition.cs +++ b/src_vs2012/VSNDK.Package/ViewModels/DeviceDefinition.cs @@ -1,4 +1,6 @@ using System; +using System.Collections.Generic; +using System.Globalization; using Microsoft.Win32; using RIM.VSNDK_Package.Tools; @@ -7,7 +9,7 @@ namespace RIM.VSNDK_Package.ViewModels /// /// Short definition of the device used during development. /// - internal sealed class DeviceDefinition + internal sealed class DeviceDefinition : IComparable { private const string FieldDeviceName = "device_name"; private const string FieldDeviceIP = "device_IP"; @@ -15,6 +17,7 @@ internal sealed class DeviceDefinition private const string FieldSimulatorName = "simulator_name"; private const string FieldSimulatorIP = "simulator_IP"; private const string FieldSimulatorPassword = "simulator_password"; + private const string FieldAllDevices = "devices"; /// /// Init constructor. @@ -60,6 +63,73 @@ public DeviceDefinitionType Type #endregion + /// + /// Checks if given device has specified name. + /// + public bool HasIdenticalName(string name) + { + return string.Compare(Name, name, StringComparison.InvariantCultureIgnoreCase) == 0; + } + + /// + /// Checks if given device has specified IP. + /// + public bool HasIdenticalIP(string ip) + { + return string.Compare(IP, ip, StringComparison.InvariantCultureIgnoreCase) == 0; + } + + public int CompareTo(DeviceDefinition other) + { + if (other == null) + return 1; + + if (Type != other.Type) + return other.Type == DeviceDefinitionType.Device ? 1 : -1; + + int result = string.Compare(IP, other.IP, CultureInfo.CurrentCulture, CompareOptions.IgnoreWidth | CompareOptions.IgnoreCase); + if (result != 0) + return result; + + return string.Compare(Name, other.Name, StringComparison.InvariantCultureIgnoreCase); + } + + public override string ToString() + { + if (string.IsNullOrEmpty(Name)) + { + return string.Concat(IP, "/", Type == DeviceDefinitionType.Device ? "device" : "simulator", "/"); + } + + return string.Concat(Name, " (", IP, ", ", Type == DeviceDefinitionType.Device ? "device" : "simulator", ")"); + } + + /// + /// Finds identical device within given collection. + /// + public static DeviceDefinition Find(DeviceDefinition[] targetDevices, DeviceDefinition device) + { + if (device == null || targetDevices == null) + return null; + + if (!string.IsNullOrEmpty(device.Name)) + { + // search by name: + foreach (var d in targetDevices) + { + if (d.Type == device.Type && d.HasIdenticalName(device.Name) && d.HasIdenticalIP(device.IP)) + return d; + } + } + + // in case searching by name failed - try to match by IP: + foreach (var d in targetDevices) + if (d.Type == device.Type && d.HasIdenticalIP(device.IP)) + return d; + + return null; + } + /// /// Retrieves device definition from the registry. /// @@ -165,6 +235,9 @@ public static void Delete(DeviceDefinitionType type) settings.DeleteSubKey(type == DeviceDefinitionType.Device ? FieldDeviceIP : FieldSimulatorIP); settings.DeleteSubKey(type == DeviceDefinitionType.Device ? FieldDevicePassword : FieldSimulatorPassword); } + catch (UnauthorizedAccessException) + { + } finally { if (settings != null) @@ -205,5 +278,93 @@ public void Save() registry.Close(); } } + + /// + /// Loads info about all devices from registry. + /// + public static DeviceDefinition[] LoadAll() + { + RegistryKey registry = Registry.CurrentUser; + RegistryKey settings = null; + + try + { + settings = registry.OpenSubKey(RunnerDefaults.RegistryPath); + if (settings == null) + return new DeviceDefinition[0]; + + return Deserialize((string[])settings.GetValue(FieldAllDevices, null)); + } + finally + { + if (settings != null) + settings.Close(); + registry.Close(); + } + } + + /// + /// Saves info about all devices inside registry. + /// + public static void SaveAll(IEnumerable devices) + { + string[] devicesInfo = Serialize(devices); + + RegistryKey registry = Registry.CurrentUser; + RegistryKey settings = null; + + try + { + settings = registry.CreateSubKey(RunnerDefaults.RegistryPath); + if (settings == null) + return; + + settings.SetValue(FieldAllDevices, devicesInfo, RegistryValueKind.MultiString); + } + finally + { + if (settings != null) + settings.Close(); + registry.Close(); + } + } + + private static DeviceDefinition[] Deserialize(string[] values) + { + if (values == null || values.Length == 0) + return new DeviceDefinition[0]; + + if ((values.Length % 4) != 0) + throw new ArgumentOutOfRangeException("values"); + + var result = new List(); + for (int i = 0; i < values.Length; i += 4) + { + var device = new DeviceDefinition(string.IsNullOrEmpty(values[i]) ? null : values[i], + values[i + 2], GlobalFunctions.Decrypt(values[i + 3]), + values[i + 1] == "S" ? DeviceDefinitionType.Simulator : DeviceDefinitionType.Device); + result.Add(device); + } + + return result.ToArray(); + } + + private static string[] Serialize(IEnumerable devices) + { + var result = new List(); + + if (devices != null) + { + foreach (var device in devices) + { + result.Add(device.Name ?? string.Empty); + result.Add(device.Type == DeviceDefinitionType.Device ? "D" : "S"); + result.Add(device.IP); + result.Add(GlobalFunctions.Encrypt(device.Password)); + } + } + + return result.ToArray(); + } } } diff --git a/src_vs2012/VSNDK.Package/ViewModels/PackageViewModel.cs b/src_vs2012/VSNDK.Package/ViewModels/PackageViewModel.cs index 4fd9a86b..c951fc5b 100644 --- a/src_vs2012/VSNDK.Package/ViewModels/PackageViewModel.cs +++ b/src_vs2012/VSNDK.Package/ViewModels/PackageViewModel.cs @@ -1,4 +1,5 @@ using System; +using System.Collections.Generic; using RIM.VSNDK_Package.Diagnostics; using RIM.VSNDK_Package.Model; using RIM.VSNDK_Package.Tools; @@ -31,6 +32,9 @@ public static PackageViewModel Instance private NdkInfo[] _installedNDKs; private NdkInfo _activeNDK; + private DeviceDefinition[] _targetDevices; + private DeviceDefinition _activeDevice; + private DeviceDefinition _activeSimulator; public PackageViewModel() { @@ -95,6 +99,108 @@ public NdkInfo ActiveNDK } } + /// + /// Gets the list of all available target devices. + /// + public DeviceDefinition[] TargetDevices + { + get + { + if (_targetDevices == null) + { + _targetDevices = DeviceDefinition.LoadAll(); + + var device = DeviceDefinition.LoadDevice(); + var simulator = DeviceDefinition.LoadSimulator(); + + _activeDevice = DeviceDefinition.Find(_targetDevices, device); + _activeSimulator = DeviceDefinition.Find(_targetDevices, simulator); + + TraceLog.WriteLine("Loaded list of Target Devices"); + TraceLog.WriteLine("Found active Target Devices:"); + TraceLog.WriteLine(" * device - {0}", _activeDevice != null ? _activeDevice.ToString() : "none"); + TraceLog.WriteLine(" * simulator - {0}", _activeSimulator != null ? _activeSimulator.ToString() : "none"); + } + + return _targetDevices; + } + set + { + _targetDevices = value ?? new DeviceDefinition[0]; + DeviceDefinition.SaveAll(_targetDevices); + + ActiveDevice = DeviceDefinition.Find(_targetDevices, _activeDevice); + ActiveSimulator = DeviceDefinition.Find(_targetDevices, _activeSimulator); + } + } + + /// + /// Gets the reference to currently active device. + /// + public DeviceDefinition ActiveDevice + { + get { return _activeDevice; } + set + { + // check, if type is expected: + if (value != null && value.Type == DeviceDefinitionType.Simulator) + { + ActiveSimulator = value; + return; + } + + // update field and store it: + if (_activeDevice != value) + { + _activeDevice = value; + + if (_activeDevice == null) + { + DeviceDefinition.Delete(DeviceDefinitionType.Device); + TraceLog.WarnLine("No Target Device is active now"); + } + else + { + _activeDevice.Save(); + TraceLog.WriteLine("Set active Target Device: {0}", _activeDevice); + } + } + } + } + + /// + /// Gets the reference to currently active simulator. + /// + public DeviceDefinition ActiveSimulator + { + get { return _activeSimulator; } + set + { + // check if type is as expected: + if (value != null && value.Type == DeviceDefinitionType.Device) + { + ActiveDevice = value; + return; + } + + // update field and store it: + if (_activeSimulator != value) + { + _activeSimulator = value; + if (_activeSimulator == null) + { + DeviceDefinition.Delete(DeviceDefinitionType.Simulator); + TraceLog.WarnLine("No Target Simulator is active now"); + } + else + { + _activeSimulator.Save(); + TraceLog.WriteLine("Set active Target Device: {0}", _activeDevice); + } + } + } + } + #endregion /// diff --git a/src_vs2012/VSNDK.Package/ViewModels/TargetsOptionViewModel.cs b/src_vs2012/VSNDK.Package/ViewModels/TargetsOptionViewModel.cs new file mode 100644 index 00000000..947cda87 --- /dev/null +++ b/src_vs2012/VSNDK.Package/ViewModels/TargetsOptionViewModel.cs @@ -0,0 +1,159 @@ +using System; +using System.Collections.Generic; + +namespace RIM.VSNDK_Package.ViewModels +{ + /// + /// View model for editing list of target devices. + /// + internal sealed class TargetsOptionViewModel + { + private List _devices; + private DeviceDefinition _activeDevice; + private DeviceDefinition _activeSimulator; + + /// + /// Gets the list of target devices. + /// + public ICollection Devices + { + get + { + if (_devices == null) + { + // start from the global list of known devies: + _devices = new List(PackageViewModel.Instance.TargetDevices); + _activeDevice = PackageViewModel.Instance.ActiveDevice; + _activeSimulator = PackageViewModel.Instance.ActiveSimulator; + } + + return _devices; + } + } + + public DeviceDefinition ActiveDevice + { + get { return _activeDevice; } + } + + public bool IsSelected(DeviceDefinition device) + { + if (device == null) + return false; + + return device == _activeDevice || device == _activeSimulator; + } + + public void Add(DeviceDefinition device) + { + if (device == null) + return; + + _devices.Add(device); + _devices.Sort(); + + // and set as activate automatically: + if (_activeDevice == null && device.Type == DeviceDefinitionType.Device) + { + _activeDevice = device; + } + else + { + if (_activeSimulator == null && device.Type == DeviceDefinitionType.Simulator) + { + _activeSimulator = device; + } + } + } + + public void SetActive(DeviceDefinition device) + { + if (device == null) + return; + + // if is already active, then 'deactivate' it: + if (_activeDevice == device) + { + _activeDevice = null; + return; + } + + if (_activeSimulator == device) + { + _activeSimulator = null; + return; + } + + // ok, just activate it: + if (device.Type == DeviceDefinitionType.Device) + _activeDevice = device; + else + _activeSimulator = device; + } + + public void Update(DeviceDefinition oldDevice, DeviceDefinition newDevice) + { + // try to detect other operations smuggled by this one: + if (oldDevice == null) + { + Add(newDevice); + return; + } + + if (newDevice == null) + { + Remove(oldDevice); + return; + } + + // ok, replace the instance and 'active' markers: + int index = _devices.IndexOf(oldDevice); + if (index < 0) + throw new InvalidOperationException("Invalid Target Device info to update"); + + _devices[index] = newDevice; + _devices.Sort(); + + if (_activeDevice == oldDevice) + { + _activeDevice = newDevice; + } + else + { + if (_activeSimulator == oldDevice) + { + _activeSimulator = newDevice; + } + } + } + + public void Remove(DeviceDefinition device) + { + if (device == null) + return; + + _devices.Remove(device); + if (_activeDevice == device) + { + _activeDevice = null; + } + else + { + if (_activeSimulator == device) + { + _activeSimulator = null; + } + } + } + + /// + /// OK. Save it. + /// + public void Apply() + { + PackageViewModel.Instance.TargetDevices = _devices.ToArray(); + PackageViewModel.Instance.ActiveDevice = _activeDevice; + PackageViewModel.Instance.ActiveSimulator = _activeSimulator; + } + } +} From f5c9edc360954c0d28f4771fa45c786e47a387be Mon Sep 17 00:00:00 2001 From: Pawel Hofman Date: Wed, 14 May 2014 10:17:04 +0200 Subject: [PATCH 055/851] Renamed method to better reflect its purpose --- src_vs2012/VSNDK.Package/Options/TargetsOptionControl.cs | 5 +++-- .../VSNDK.Package/ViewModels/TargetsOptionViewModel.cs | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src_vs2012/VSNDK.Package/Options/TargetsOptionControl.cs b/src_vs2012/VSNDK.Package/Options/TargetsOptionControl.cs index 78465b51..f8b42247 100644 --- a/src_vs2012/VSNDK.Package/Options/TargetsOptionControl.cs +++ b/src_vs2012/VSNDK.Package/Options/TargetsOptionControl.cs @@ -39,7 +39,7 @@ private void PopulateDevices() { ListViewItem item = new ListViewItem(); item.Tag = device; - item.Text = _vm.IsSelected(device) ? "x" : string.Empty; + item.Text = _vm.IsActive(device) ? "x" : string.Empty; item.SubItems.Add(device.Type == DeviceDefinitionType.Simulator ? "S" : string.Empty); item.SubItems.Add(device.Name); item.SubItems.Add(device.IP); @@ -59,7 +59,8 @@ private void listTargets_SelectedIndexChanged(object sender, System.EventArgs e) { var device = SelectedDevice; - bttEdit.Enabled = bttRemove.Enabled = bttActivate.Enabled = device != null; + bttEdit.Enabled = bttRemove.Enabled = device != null; + bttActivate.Enabled = device != null && _vm.IsActive(device); } private void listTargets_DoubleClick(object sender, System.EventArgs e) diff --git a/src_vs2012/VSNDK.Package/ViewModels/TargetsOptionViewModel.cs b/src_vs2012/VSNDK.Package/ViewModels/TargetsOptionViewModel.cs index 947cda87..bfc021f2 100644 --- a/src_vs2012/VSNDK.Package/ViewModels/TargetsOptionViewModel.cs +++ b/src_vs2012/VSNDK.Package/ViewModels/TargetsOptionViewModel.cs @@ -36,7 +36,7 @@ public DeviceDefinition ActiveDevice get { return _activeDevice; } } - public bool IsSelected(DeviceDefinition device) + public bool IsActive(DeviceDefinition device) { if (device == null) return false; From 04fc97a0ea2adb3d4435442cc8be7b4f03fdc834 Mon Sep 17 00:00:00 2001 From: Pawel Hofman Date: Wed, 14 May 2014 11:28:13 +0200 Subject: [PATCH 056/851] Added event-dispatcher The purpose is to simplify passing data gathered from async-called tools directly to the UI. The code is a bit cleaner without another invocation checks. --- .../Options/Dialogs/DeviceForm.cs | 9 +- .../VSNDK.Package/Tools/EventDispatcher.cs | 200 ++++++++++++++++++ src_vs2012/VSNDK.Package/Tools/ToolRunner.cs | 34 ++- src_vs2012/VSNDK.Package/VSNDK.Package.csproj | 1 + 4 files changed, 229 insertions(+), 15 deletions(-) create mode 100644 src_vs2012/VSNDK.Package/Tools/EventDispatcher.cs diff --git a/src_vs2012/VSNDK.Package/Options/Dialogs/DeviceForm.cs b/src_vs2012/VSNDK.Package/Options/Dialogs/DeviceForm.cs index dd350a2e..9655fd9a 100644 --- a/src_vs2012/VSNDK.Package/Options/Dialogs/DeviceForm.cs +++ b/src_vs2012/VSNDK.Package/Options/Dialogs/DeviceForm.cs @@ -1,7 +1,6 @@ using System; using System.Windows.Forms; using RIM.VSNDK_Package.Diagnostics; -using RIM.VSNDK_Package.Model; using RIM.VSNDK_Package.Tools; using RIM.VSNDK_Package.ViewModels; @@ -154,6 +153,7 @@ private void bttTest_Click(object sender, EventArgs e) IsConnected = false; LoadedDeviceName = null; _runner = new DeviceInfoRunner(RunnerDefaults.ToolsDirectory, DeviceIP, DevicePassword); + _runner.Dispatcher = EventDispatcher.From(this); _runner.Finished += RunnerOnFinished; AppendLog("Testing connection..."); @@ -169,7 +169,7 @@ private void RunnerOnFinished(object sender, ToolRunnerEventArgs e) { TraceLog.WriteLine("Found device: {0} with IP: {1}", _runner.DeviceInfo.ToString(), DeviceIP); AppendLog("Device found:" + Environment.NewLine + _runner.DeviceInfo.ToLongDescription()); - Invoke(new Action(UpdateWithDevice), _runner.DeviceInfo); + LoadedDeviceName = _runner.DeviceInfo != null ? _runner.DeviceInfo.Name : null; IsConnected = true; } else @@ -183,11 +183,6 @@ private void RunnerOnFinished(object sender, ToolRunnerEventArgs e) _runner = null; } - private void UpdateWithDevice(DeviceInfo deviceInfo) - { - LoadedDeviceName = deviceInfo != null ? deviceInfo.Name : null; - } - private void cmbType_SelectedIndexChanged(object sender, EventArgs e) { txtIP.Enabled = DeviceClass != DialogDeviceClass.UsbDevice; diff --git a/src_vs2012/VSNDK.Package/Tools/EventDispatcher.cs b/src_vs2012/VSNDK.Package/Tools/EventDispatcher.cs new file mode 100644 index 00000000..6fc77da2 --- /dev/null +++ b/src_vs2012/VSNDK.Package/Tools/EventDispatcher.cs @@ -0,0 +1,200 @@ +using System; +using System.Windows; +using System.Windows.Forms; +using System.Windows.Threading; + +namespace RIM.VSNDK_Package.Tools +{ + /// + /// Interface simplifying events invocations. + /// + internal interface IEventDispatcher + { + void Invoke(EventHandler eventHandler, object sender, T e) where T : EventArgs; + void Invoke(Action action, T e); + } + + /// + /// Helper class for creating cross-thread event dispatchers. + /// + internal static class EventDispatcher + { + #region Windows Forms + + class WindowsFormsEventDispatcher : IEventDispatcher + { + private readonly Control _control; + + public WindowsFormsEventDispatcher(Control control) + { + if (control == null) + throw new ArgumentNullException("control"); + _control = control; + } + + #region IEventDispatcher Implementation + + public void Invoke(EventHandler eventHandler, object sender, T e) where T : EventArgs + { + if (eventHandler != null) + { + if (_control.InvokeRequired) + { + _control.Invoke(eventHandler, sender, e); + } + else + { + eventHandler(sender, e); + } + } + } + + public void Invoke(Action action, T e) + { + if (action != null) + { + if (_control.InvokeRequired) + { + _control.Invoke(action, e); + } + else + { + action(e); + } + } + } + + #endregion + } + + #endregion + + #region Classic + + /// + /// Class for calling all events synchronously in the same thread. + /// + class ClassicEventDispatcher : IEventDispatcher + { + #region IEventDispatcher Implementation + + public void Invoke(EventHandler eventHandler, object sender, T e) where T : EventArgs + { + if (eventHandler != null) + { + eventHandler(sender, e); + } + } + + public void Invoke(Action action, T e) + { + if (action != null) + { + action(e); + } + } + + #endregion + } + + #endregion + + #region Dependency Object (WPF/Silverlight) + + class DependencyObjectEventDispatcher : IEventDispatcher + { + private readonly Dispatcher _dispacher; + + public DependencyObjectEventDispatcher() + { + // PH: could use System.Windows.Deployment.Current.Dispatcher instead + // but that would require reference to System.Windows.dll... + _dispacher = Dispatcher.CurrentDispatcher; + if (_dispacher == null) + throw new InvalidOperationException("Could not create dispatcher object associated with current thread"); + } + + public DependencyObjectEventDispatcher(DependencyObject control) + { + if (control == null) + throw new ArgumentNullException("control"); + _dispacher = control.Dispatcher; + } + + + #region IEventDispatcher Implementation + + public void Invoke(EventHandler eventHandler, object sender, T e) where T : EventArgs + { + if (eventHandler != null) + { + if (_dispacher.CheckAccess()) + { + eventHandler(sender, e); + } + else + { + _dispacher.BeginInvoke(eventHandler, sender, e); + } + } + } + + public void Invoke(Action action, T e) + { + if (action != null) + { + if (_dispacher.CheckAccess()) + { + action(e); + } + else + { + _dispacher.BeginInvoke(action, e); + } + } + } + + #endregion + } + + #endregion + + /// + /// Creates an event dispatcher for invoking events in the same thread. + /// + public static IEventDispatcher New() + { + return new ClassicEventDispatcher(); + } + + /// + /// Creates an event dispatcher for WPF/Silverlight UI thread. + /// + public static IEventDispatcher NewForWPF() + { + return new DependencyObjectEventDispatcher(); + } + + /// + /// Creates an event dispatcher for Windows Forms UI thread. + /// + public static IEventDispatcher From(Control control) + { + if (control == null) + throw new ArgumentNullException("control"); + + return new WindowsFormsEventDispatcher(control); + } + + /// + /// Creates an event dispatcher for WPF/Silverlight UI thread. + /// + public static IEventDispatcher From(DependencyObject control) + { + if (control == null) + throw new ArgumentNullException("control"); + + return new DependencyObjectEventDispatcher(control); + } + } +} diff --git a/src_vs2012/VSNDK.Package/Tools/ToolRunner.cs b/src_vs2012/VSNDK.Package/Tools/ToolRunner.cs index 226859fa..c00d2de5 100644 --- a/src_vs2012/VSNDK.Package/Tools/ToolRunner.cs +++ b/src_vs2012/VSNDK.Package/Tools/ToolRunner.cs @@ -47,6 +47,12 @@ public ToolRunner(string fileName, string workingDirectory) #region Properties + public IEventDispatcher Dispatcher + { + get; + set; + } + public string FileName { get { return _process.StartInfo.FileName; } @@ -152,9 +158,7 @@ public void ExecuteAsync() TraceLog.WriteException(ex, "Unable to start {0}", GetType().Name); _process.Close(); - - if (Finished != null) - Finished(this, new ToolRunnerEventArgs(-1, null, null)); + NotifyFinished(-1, null, null); } } @@ -164,6 +168,24 @@ private void AsyncProcessExited(object sender, EventArgs e) CompleteExecution(); } + private void NotifyFinished(int exitCode, string output, string error) + { + var finishedHandler = Finished; + + if (finishedHandler != null) + { + // perform a cross-thread notification (in case we want to update UI directly from the handler) + if (Dispatcher != null) + { + Dispatcher.Invoke(finishedHandler, this, new ToolRunnerEventArgs(exitCode, output, error)); + } + else + { + finishedHandler(this, new ToolRunnerEventArgs(exitCode, output, error)); + } + } + } + private void PrepareExecution() { _isProcessing = true; @@ -191,11 +213,7 @@ private void CompleteExecution() ConsumeResults(outputText, errorText); // notify other listeners, in case they want to get something extra: - var finishedHandler = Finished; - if (finishedHandler != null) - { - finishedHandler(this, new ToolRunnerEventArgs(exitCode, outputText, errorText)); - } + NotifyFinished(exitCode, outputText, errorText); _isProcessing = false; } diff --git a/src_vs2012/VSNDK.Package/VSNDK.Package.csproj b/src_vs2012/VSNDK.Package/VSNDK.Package.csproj index 67b2b8f8..4c425b78 100644 --- a/src_vs2012/VSNDK.Package/VSNDK.Package.csproj +++ b/src_vs2012/VSNDK.Package/VSNDK.Package.csproj @@ -331,6 +331,7 @@ Component + From ca153645ed7265bcc765d3560bd63cea687dd222 Mon Sep 17 00:00:00 2001 From: Pawel Hofman Date: Wed, 14 May 2014 16:06:39 +0200 Subject: [PATCH 057/851] Added Tag property to ToolRunner --- src_vs2012/VSNDK.Package/Tools/ToolRunner.cs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src_vs2012/VSNDK.Package/Tools/ToolRunner.cs b/src_vs2012/VSNDK.Package/Tools/ToolRunner.cs index c00d2de5..4fe2357b 100644 --- a/src_vs2012/VSNDK.Package/Tools/ToolRunner.cs +++ b/src_vs2012/VSNDK.Package/Tools/ToolRunner.cs @@ -88,6 +88,12 @@ public string LastError protected set; } + public object Tag + { + get; + set; + } + #endregion private void OutputDataReceived(object sender, DataReceivedEventArgs e) @@ -110,6 +116,8 @@ public bool Execute() { if (_isProcessing) throw new InvalidOperationException("The process is already running"); + if (string.IsNullOrEmpty(FileName)) + throw new InvalidOperationException("No executable to start"); PrepareExecution(); From 823feda17b0a7caa7b1975b46c5e268df35b998a Mon Sep 17 00:00:00 2001 From: Pawel Hofman Date: Wed, 14 May 2014 16:07:02 +0200 Subject: [PATCH 058/851] Improved response error parsing in AppRemoveRunner --- .../VSNDK.Package/Tools/ApplicationRemoveRunner.cs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src_vs2012/VSNDK.Package/Tools/ApplicationRemoveRunner.cs b/src_vs2012/VSNDK.Package/Tools/ApplicationRemoveRunner.cs index 0faca403..dec83a3e 100644 --- a/src_vs2012/VSNDK.Package/Tools/ApplicationRemoveRunner.cs +++ b/src_vs2012/VSNDK.Package/Tools/ApplicationRemoveRunner.cs @@ -111,9 +111,9 @@ protected override void ConsumeResults(string output, string error) // check, if there is any runtime error message: foreach (var line in lines) { - if (line.StartsWith("error:", StringComparison.InvariantCultureIgnoreCase)) + if (line.StartsWith("error: ", StringComparison.InvariantCultureIgnoreCase)) { - LastError = line.Substring(6).Trim();; + LastError = line.Substring(7).Trim(); break; } if (string.Compare("result::success", line, StringComparison.InvariantCultureIgnoreCase) == 0) @@ -121,6 +121,12 @@ protected override void ConsumeResults(string output, string error) RemovedSuccessfully = true; break; } + if (line.StartsWith("result::failure", StringComparison.InvariantCultureIgnoreCase)) + { + RemovedSuccessfully = false; + LastError = line.Substring(15).Trim(); + break; + } } } } From a47562c15d0eb622577be7b0f437bb22cdefde93 Mon Sep 17 00:00:00 2001 From: Pawel Hofman Date: Wed, 14 May 2014 16:09:52 +0200 Subject: [PATCH 059/851] Added debug-token upload feature --- .../VSNDK.Package/Model/DebugTokenInfo.cs | 84 +++ .../Model/DeviceDebugTokenInfo.cs | 21 + src_vs2012/VSNDK.Package/Model/DeviceInfo.cs | 4 + .../VSNDK.Package/Options/DialogHelper.cs | 17 + .../Options/Dialogs/ComboBoxItem.cs | 38 ++ .../Dialogs/DebugTokenForm.Designer.cs | 288 ++++++++++ .../Options/Dialogs/DebugTokenForm.cs | 501 ++++++++++++++++++ .../Options/Dialogs/DebugTokenForm.resx | 120 +++++ .../Options/Dialogs/DeviceForm.cs | 2 +- .../Options/TargetsOptionControl.Designer.cs | 15 +- .../Options/TargetsOptionControl.cs | 29 +- src_vs2012/VSNDK.Package/VSNDK.Package.csproj | 10 + .../ViewModels/DeviceDefinition.cs | 8 + .../ViewModels/TargetsOptionViewModel.cs | 66 +++ 14 files changed, 1191 insertions(+), 12 deletions(-) create mode 100644 src_vs2012/VSNDK.Package/Options/Dialogs/ComboBoxItem.cs create mode 100644 src_vs2012/VSNDK.Package/Options/Dialogs/DebugTokenForm.Designer.cs create mode 100644 src_vs2012/VSNDK.Package/Options/Dialogs/DebugTokenForm.cs create mode 100644 src_vs2012/VSNDK.Package/Options/Dialogs/DebugTokenForm.resx diff --git a/src_vs2012/VSNDK.Package/Model/DebugTokenInfo.cs b/src_vs2012/VSNDK.Package/Model/DebugTokenInfo.cs index b9781bb6..7a3c4148 100644 --- a/src_vs2012/VSNDK.Package/Model/DebugTokenInfo.cs +++ b/src_vs2012/VSNDK.Package/Model/DebugTokenInfo.cs @@ -86,6 +86,26 @@ public DateTime ExpiryDate #endregion + /// + /// Checks, whether this debug token is build agains specified device. + /// + public bool Contains(ulong device) + { + if (device == 0) + return false; + if (Devices == null || Devices.Length == 0) + return false; + + for (int i = 0; i < Devices.Length; i++) + { + if (device == Devices[i]) + return true; + } + + return false; + } + + public override string ToString() { if (_description == null) @@ -94,6 +114,70 @@ public override string ToString() return _description; } + /// + /// Gets the long description summary of the debug token. + /// + public string ToLongDescription(bool mostImportantOnly) + { + var result = new StringBuilder(); + + if (!mostImportantOnly) + { + result.Append("Name: ").Append(Name).Append(" (").Append(ID).AppendLine(")"); + result.Append("Author: ").AppendLine(Author); + } + + // print dates: + if (ExpiryDate != DateTime.MinValue) + result.Append("Expiry Date: ").AppendLine(ExpiryDate.ToLocalTime().ToString("yyyy-MM-dd HH:mm:ss")); + if (!mostImportantOnly) + { + if (IssueDate != DateTime.MinValue) + result.Append("Issue Date: ").AppendLine(IssueDate.ToLocalTime().ToString("yyyy-MM-dd HH:mm:ss")); + result.Append("Version: ").Append(Version).Append(" (ID: ").Append(VersionID).AppendLine(")"); + } + + // print affected devices: + if (mostImportantOnly && Devices.Length > 0) + { + result.Append("Devices: "); + int i = 0; + foreach (var device in Devices) + { + if (i > 0) + result.Append(", "); + result.Append(device.ToString("X")); + i++; + } + result.AppendLine(); + } + + if (mostImportantOnly) + { + result.Append("Author: ").AppendLine(Author); + result.Append("Author ID: ").AppendLine(AuthorID); + } + + // print system actions allowed: + if (mostImportantOnly && SystemActions.Length > 0) + { + result.AppendLine(); + result.Append("Actions: "); + + int i = 0; + foreach (var action in SystemActions) + { + if (i > 0) + result.Append(", "); + result.Append(action); + i++; + } + result.AppendLine(); + } + + return result.ToString(); + } + private string GetDescription() { var result = new StringBuilder(); diff --git a/src_vs2012/VSNDK.Package/Model/DeviceDebugTokenInfo.cs b/src_vs2012/VSNDK.Package/Model/DeviceDebugTokenInfo.cs index 684045f3..236551db 100644 --- a/src_vs2012/VSNDK.Package/Model/DeviceDebugTokenInfo.cs +++ b/src_vs2012/VSNDK.Package/Model/DeviceDebugTokenInfo.cs @@ -72,6 +72,27 @@ public override string ToString() return _description; } + /// + /// Gets full info about this object. + /// + public string ToLongDescription() + { + var result = new StringBuilder(); + + if (!string.IsNullOrEmpty(Author)) + result.Append("Author: ").AppendLine(Author); + if (ExpiryDate != DateTime.MinValue) + result.Append("Expiry Date: ").AppendLine(ExpiryDate.ToLocalTime().ToString("yyyy-MM-dd HH:mm:ss")); + + if (ValidationErrorCode != 0) + { + result.Append("Error Code: ").AppendLine(ValidationErrorCode.ToString()); + result.Append("Error Message: ").AppendLine(ValidationErrorMessage); + } + + return result.ToString(); + } + private string GetDescription() { var result = new StringBuilder(); diff --git a/src_vs2012/VSNDK.Package/Model/DeviceInfo.cs b/src_vs2012/VSNDK.Package/Model/DeviceInfo.cs index 78ccbc32..c00eaaf5 100644 --- a/src_vs2012/VSNDK.Package/Model/DeviceInfo.cs +++ b/src_vs2012/VSNDK.Package/Model/DeviceInfo.cs @@ -342,6 +342,10 @@ private static bool GetBool(string text) if (string.CompareOrdinal(text, "0") == 0) return false; + // PH: no reason, but sometimes boolean field is presented as JSON (especially debug-token-valid field)... + if (string.CompareOrdinal(text, "{}") == 0) + return false; + throw new FormatException("Invalid boolean value"); } diff --git a/src_vs2012/VSNDK.Package/Options/DialogHelper.cs b/src_vs2012/VSNDK.Package/Options/DialogHelper.cs index 21feb57f..2f1aa145 100644 --- a/src_vs2012/VSNDK.Package/Options/DialogHelper.cs +++ b/src_vs2012/VSNDK.Package/Options/DialogHelper.cs @@ -19,5 +19,22 @@ public static string BrowseForFolder(string startupPath, string description) return startupPath; } + + /// + /// Returns preconfigured window for opening BAR files. + /// + public static OpenFileDialog OpenBarFile(string title, string startupPath) + { + var openFile = new OpenFileDialog(); + openFile.Title = title; + openFile.InitialDirectory = startupPath; + openFile.DefaultExt = ".bar"; + openFile.Filter = "Bar files|*.bar|All files|*.*"; + openFile.FilterIndex = 0; + openFile.CheckFileExists = true; + openFile.CheckPathExists = true; + + return openFile; + } } } diff --git a/src_vs2012/VSNDK.Package/Options/Dialogs/ComboBoxItem.cs b/src_vs2012/VSNDK.Package/Options/Dialogs/ComboBoxItem.cs new file mode 100644 index 00000000..ee814323 --- /dev/null +++ b/src_vs2012/VSNDK.Package/Options/Dialogs/ComboBoxItem.cs @@ -0,0 +1,38 @@ +namespace RIM.VSNDK_Package.Options.Dialogs +{ + /// + /// Item class to feed Windows Forms ComboBox. + /// + public sealed class ComboBoxItem + { + public ComboBoxItem() + { + } + + public ComboBoxItem(string text) + { + Text = text; + } + + #region Properties + + public string Text + { + get; + set; + } + + public object Tag + { + get; + set; + } + + #endregion + + public override string ToString() + { + return Text ?? string.Empty; + } + } +} diff --git a/src_vs2012/VSNDK.Package/Options/Dialogs/DebugTokenForm.Designer.cs b/src_vs2012/VSNDK.Package/Options/Dialogs/DebugTokenForm.Designer.cs new file mode 100644 index 00000000..d16077ec --- /dev/null +++ b/src_vs2012/VSNDK.Package/Options/Dialogs/DebugTokenForm.Designer.cs @@ -0,0 +1,288 @@ +namespace RIM.VSNDK_Package.Options.Dialogs +{ + internal partial class DebugTokenForm + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.groupBox1 = new System.Windows.Forms.GroupBox(); + this.bttTokenRenew = new System.Windows.Forms.Button(); + this.bttTokenCreate = new System.Windows.Forms.Button(); + this.txtDebugTokenLog = new System.Windows.Forms.TextBox(); + this.bttTokenBrowse = new System.Windows.Forms.Button(); + this.txtDebugTokenPath = new System.Windows.Forms.TextBox(); + this.label1 = new System.Windows.Forms.Label(); + this.bttOK = new System.Windows.Forms.Button(); + this.groupBox2 = new System.Windows.Forms.GroupBox(); + this.bttRemove = new System.Windows.Forms.Button(); + this.bttUpload = new System.Windows.Forms.Button(); + this.txtDeviceLog = new System.Windows.Forms.TextBox(); + this.cmbDevices = new System.Windows.Forms.ComboBox(); + this.bttDeviceLoad = new System.Windows.Forms.Button(); + this.label2 = new System.Windows.Forms.Label(); + this.lblError = new System.Windows.Forms.Label(); + this.groupBox1.SuspendLayout(); + this.groupBox2.SuspendLayout(); + this.SuspendLayout(); + // + // groupBox1 + // + this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.groupBox1.Controls.Add(this.bttTokenRenew); + this.groupBox1.Controls.Add(this.bttTokenCreate); + this.groupBox1.Controls.Add(this.txtDebugTokenLog); + this.groupBox1.Controls.Add(this.bttTokenBrowse); + this.groupBox1.Controls.Add(this.txtDebugTokenPath); + this.groupBox1.Controls.Add(this.label1); + this.groupBox1.Location = new System.Drawing.Point(12, 12); + this.groupBox1.Name = "groupBox1"; + this.groupBox1.Size = new System.Drawing.Size(523, 145); + this.groupBox1.TabIndex = 0; + this.groupBox1.TabStop = false; + this.groupBox1.Text = "Debug Token"; + // + // bttTokenRenew + // + this.bttTokenRenew.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.bttTokenRenew.Enabled = false; + this.bttTokenRenew.Location = new System.Drawing.Point(442, 80); + this.bttTokenRenew.Name = "bttTokenRenew"; + this.bttTokenRenew.Size = new System.Drawing.Size(75, 23); + this.bttTokenRenew.TabIndex = 5; + this.bttTokenRenew.Text = "&Renew..."; + this.bttTokenRenew.UseVisualStyleBackColor = true; + // + // bttTokenCreate + // + this.bttTokenCreate.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.bttTokenCreate.Enabled = false; + this.bttTokenCreate.Location = new System.Drawing.Point(442, 51); + this.bttTokenCreate.Name = "bttTokenCreate"; + this.bttTokenCreate.Size = new System.Drawing.Size(75, 23); + this.bttTokenCreate.TabIndex = 4; + this.bttTokenCreate.Text = "Cr&eate..."; + this.bttTokenCreate.UseVisualStyleBackColor = true; + // + // txtDebugTokenLog + // + this.txtDebugTokenLog.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.txtDebugTokenLog.Location = new System.Drawing.Point(20, 51); + this.txtDebugTokenLog.Multiline = true; + this.txtDebugTokenLog.Name = "txtDebugTokenLog"; + this.txtDebugTokenLog.ReadOnly = true; + this.txtDebugTokenLog.ScrollBars = System.Windows.Forms.ScrollBars.Vertical; + this.txtDebugTokenLog.Size = new System.Drawing.Size(416, 88); + this.txtDebugTokenLog.TabIndex = 3; + // + // bttTokenBrowse + // + this.bttTokenBrowse.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.bttTokenBrowse.Location = new System.Drawing.Point(442, 22); + this.bttTokenBrowse.Name = "bttTokenBrowse"; + this.bttTokenBrowse.Size = new System.Drawing.Size(75, 23); + this.bttTokenBrowse.TabIndex = 2; + this.bttTokenBrowse.Text = "&Browse..."; + this.bttTokenBrowse.UseVisualStyleBackColor = true; + this.bttTokenBrowse.Click += new System.EventHandler(this.bttTokenBrowse_Click); + // + // txtDebugTokenPath + // + this.txtDebugTokenPath.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.txtDebugTokenPath.Location = new System.Drawing.Point(75, 22); + this.txtDebugTokenPath.Name = "txtDebugTokenPath"; + this.txtDebugTokenPath.ReadOnly = true; + this.txtDebugTokenPath.Size = new System.Drawing.Size(361, 20); + this.txtDebugTokenPath.TabIndex = 1; + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Location = new System.Drawing.Point(17, 25); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(32, 13); + this.label1.TabIndex = 0; + this.label1.Text = "Path:"; + // + // bttOK + // + this.bttOK.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.bttOK.DialogResult = System.Windows.Forms.DialogResult.Cancel; + this.bttOK.Location = new System.Drawing.Point(460, 381); + this.bttOK.Name = "bttOK"; + this.bttOK.Size = new System.Drawing.Size(75, 23); + this.bttOK.TabIndex = 1; + this.bttOK.Text = "&Close"; + this.bttOK.UseVisualStyleBackColor = true; + // + // groupBox2 + // + this.groupBox2.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.groupBox2.Controls.Add(this.bttRemove); + this.groupBox2.Controls.Add(this.bttUpload); + this.groupBox2.Controls.Add(this.txtDeviceLog); + this.groupBox2.Controls.Add(this.cmbDevices); + this.groupBox2.Controls.Add(this.bttDeviceLoad); + this.groupBox2.Controls.Add(this.label2); + this.groupBox2.Location = new System.Drawing.Point(12, 163); + this.groupBox2.Name = "groupBox2"; + this.groupBox2.Size = new System.Drawing.Size(523, 212); + this.groupBox2.TabIndex = 2; + this.groupBox2.TabStop = false; + this.groupBox2.Text = "Devices"; + // + // bttRemove + // + this.bttRemove.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.bttRemove.Enabled = false; + this.bttRemove.Location = new System.Drawing.Point(442, 129); + this.bttRemove.Name = "bttRemove"; + this.bttRemove.Size = new System.Drawing.Size(75, 23); + this.bttRemove.TabIndex = 5; + this.bttRemove.Text = "Re&move"; + this.bttRemove.UseVisualStyleBackColor = true; + this.bttRemove.Click += new System.EventHandler(this.bttRemove_Click); + // + // bttUpload + // + this.bttUpload.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.bttUpload.Enabled = false; + this.bttUpload.Location = new System.Drawing.Point(442, 46); + this.bttUpload.Name = "bttUpload"; + this.bttUpload.Size = new System.Drawing.Size(75, 23); + this.bttUpload.TabIndex = 4; + this.bttUpload.Text = "&Upload"; + this.bttUpload.UseVisualStyleBackColor = true; + this.bttUpload.Click += new System.EventHandler(this.bttUpload_Click); + // + // txtDeviceLog + // + this.txtDeviceLog.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.txtDeviceLog.Location = new System.Drawing.Point(20, 46); + this.txtDeviceLog.Multiline = true; + this.txtDeviceLog.Name = "txtDeviceLog"; + this.txtDeviceLog.ReadOnly = true; + this.txtDeviceLog.ScrollBars = System.Windows.Forms.ScrollBars.Vertical; + this.txtDeviceLog.Size = new System.Drawing.Size(416, 160); + this.txtDeviceLog.TabIndex = 3; + // + // cmbDevices + // + this.cmbDevices.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.cmbDevices.Enabled = false; + this.cmbDevices.FormattingEnabled = true; + this.cmbDevices.Location = new System.Drawing.Point(75, 19); + this.cmbDevices.MaxDropDownItems = 25; + this.cmbDevices.Name = "cmbDevices"; + this.cmbDevices.Size = new System.Drawing.Size(189, 21); + this.cmbDevices.TabIndex = 0; + this.cmbDevices.SelectedIndexChanged += new System.EventHandler(this.cmbDevices_SelectedIndexChanged); + // + // bttDeviceLoad + // + this.bttDeviceLoad.Enabled = false; + this.bttDeviceLoad.Location = new System.Drawing.Point(442, 75); + this.bttDeviceLoad.Name = "bttDeviceLoad"; + this.bttDeviceLoad.Size = new System.Drawing.Size(75, 23); + this.bttDeviceLoad.TabIndex = 2; + this.bttDeviceLoad.Text = "Re&load info"; + this.bttDeviceLoad.UseVisualStyleBackColor = true; + this.bttDeviceLoad.Click += new System.EventHandler(this.bttDeviceLoad_Click); + // + // label2 + // + this.label2.AutoSize = true; + this.label2.Location = new System.Drawing.Point(17, 22); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(41, 13); + this.label2.TabIndex = 1; + this.label2.Text = "Target:"; + // + // lblError + // + this.lblError.ForeColor = System.Drawing.Color.Red; + this.lblError.Location = new System.Drawing.Point(30, 378); + this.lblError.Name = "lblError"; + this.lblError.Size = new System.Drawing.Size(418, 35); + this.lblError.TabIndex = 6; + this.lblError.Text = "- error -"; + this.lblError.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + this.lblError.Visible = false; + // + // DebugTokenForm + // + this.AcceptButton = this.bttOK; + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.CancelButton = this.bttOK; + this.ClientSize = new System.Drawing.Size(547, 411); + this.Controls.Add(this.lblError); + this.Controls.Add(this.groupBox2); + this.Controls.Add(this.bttOK); + this.Controls.Add(this.groupBox1); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; + this.MaximizeBox = false; + this.MinimizeBox = false; + this.Name = "DebugTokenForm"; + this.ShowIcon = false; + this.ShowInTaskbar = false; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; + this.Text = "Debug Token Deployment"; + this.groupBox1.ResumeLayout(false); + this.groupBox1.PerformLayout(); + this.groupBox2.ResumeLayout(false); + this.groupBox2.PerformLayout(); + this.ResumeLayout(false); + + } + + #endregion + + private System.Windows.Forms.GroupBox groupBox1; + private System.Windows.Forms.Button bttTokenCreate; + private System.Windows.Forms.TextBox txtDebugTokenLog; + private System.Windows.Forms.Button bttTokenBrowse; + private System.Windows.Forms.TextBox txtDebugTokenPath; + private System.Windows.Forms.Label label1; + private System.Windows.Forms.Button bttOK; + private System.Windows.Forms.GroupBox groupBox2; + private System.Windows.Forms.Button bttDeviceLoad; + private System.Windows.Forms.Label label2; + private System.Windows.Forms.ComboBox cmbDevices; + private System.Windows.Forms.TextBox txtDeviceLog; + private System.Windows.Forms.Button bttTokenRenew; + private System.Windows.Forms.Button bttUpload; + private System.Windows.Forms.Button bttRemove; + private System.Windows.Forms.Label lblError; + } +} \ No newline at end of file diff --git a/src_vs2012/VSNDK.Package/Options/Dialogs/DebugTokenForm.cs b/src_vs2012/VSNDK.Package/Options/Dialogs/DebugTokenForm.cs new file mode 100644 index 00000000..ff0b6acb --- /dev/null +++ b/src_vs2012/VSNDK.Package/Options/Dialogs/DebugTokenForm.cs @@ -0,0 +1,501 @@ +using System; +using System.Windows.Forms; +using RIM.VSNDK_Package.Diagnostics; +using RIM.VSNDK_Package.Model; +using RIM.VSNDK_Package.Tools; +using RIM.VSNDK_Package.ViewModels; + +namespace RIM.VSNDK_Package.Options.Dialogs +{ + internal partial class DebugTokenForm : Form + { + private TargetsOptionViewModel _vm; + private DeviceDefinition _device; + private DebugTokenInfoRunner _tokenInfoRunner; + private DeviceInfoRunner _deviceInfoRunner; + private DebugTokenUploadRunner _tokenUploadRunner; + private ApplicationRemoveRunner _tokenRemoveRunner; + private DebugTokenInfo _tokenInfo; + private bool _startup; + + public DebugTokenForm() + { + InitializeComponent(); + + ErrorText = string.Empty; + _startup = true; + } + + protected override void OnShown(EventArgs e) + { + base.OnShown(e); + + if (_startup) + { + _startup = false; + + // if there is no path do debug-token, ask for it: + if (string.IsNullOrEmpty(DebugTokenPath)) + { + bttTokenBrowse_Click(null, EventArgs.Empty); + } + + LoadDeviceInfo(_device, false); + } + } + + #region Properties + + public bool IsLoadingTokenInfo + { + get { return _tokenInfoRunner != null; } + } + + public bool IsUploadingToken + { + get { return _tokenUploadRunner != null; } + } + + public bool IsRemovingToken + { + get { return _tokenRemoveRunner != null; } + } + + public bool IsLoadingDeviceInfo + { + get { return _deviceInfoRunner != null; } + } + + public string DebugTokenPath + { + get { return txtDebugTokenPath.Text; } + set { txtDebugTokenPath.Text = value; } + } + + public string ErrorText + { + get { return lblError.Text; } + set + { + lblError.Text = value; + lblError.Visible = !string.IsNullOrEmpty(value); + } + } + + public bool ErrorVisible + { + get { return lblError.Visible; } + set { lblError.Visible = value; } + } + + #endregion + + /// + /// Provides the view-model for populating data. + /// + internal void SetVM(TargetsOptionViewModel vm, DeviceDefinition device) + { + if (vm == null) + throw new ArgumentNullException("vm"); + if (device == null) + throw new ArgumentNullException("device"); + _vm = vm; + _device = device; + + PopulateDevices(device); + } + + private void PopulateDevices(DeviceDefinition select) + { + cmbDevices.Items.Clear(); + + ComboBoxItem selectedItem = null; + foreach (var device in _vm.Devices) + { + var item = new ComboBoxItem(device.ShortName); + item.Tag = device; + + if (device == select) + selectedItem = item; + + cmbDevices.Items.Add(item); + } + + cmbDevices.SelectedItem = selectedItem; + } + + #region Logs Support Methods + + private void ClearTokenLogs() + { + txtDebugTokenLog.Text = string.Empty; + } + + private void AppendTokenLog(string message) + { + if (InvokeRequired) + Invoke(new Action(AppendTokenLog), message); + else + txtDebugTokenLog.Text += message + Environment.NewLine; + } + + private void ClearDeviceLogs() + { + txtDeviceLog.Text = string.Empty; + } + + private void AppendDeviceLog(string message) + { + if (InvokeRequired) + Invoke(new Action(AppendDeviceLog), message); + else + txtDeviceLog.Text += message + Environment.NewLine; + } + + #endregion + + #region Token Info Runner + + private void LoadTokenInfo(string fileName) + { + if (IsLoadingTokenInfo) + return; + + ClearTokenLogs(); + AppendTokenLog("Loading debug token info..."); + _tokenInfo = null; + DebugTokenPath = fileName; + UpdateTokenStatusUI(false); + + // and load token info asynchronously: + _tokenInfoRunner = new DebugTokenInfoRunner(RunnerDefaults.ToolsDirectory, fileName); + _tokenInfoRunner.Dispatcher = EventDispatcher.From(this); + _tokenInfoRunner.Finished += TokenInfoRunnerOnFinished; + _tokenInfoRunner.ExecuteAsync(); + } + + private void TokenInfoRunnerOnFinished(object sender, ToolRunnerEventArgs e) + { + bool success = string.IsNullOrEmpty(_tokenInfoRunner.LastError) && _tokenInfoRunner.DebugToken != null; + AppendTokenLog("--- DONE with " + (success ? "success" : "failure") + Environment.NewLine); + + if (success) + { + _tokenInfo = _tokenInfoRunner.DebugToken; + + TraceLog.WriteLine("Loaded debug token: {0}", _tokenInfoRunner.DebugToken); + AppendTokenLog("Debug token found:" + Environment.NewLine + _tokenInfoRunner.DebugToken.ToLongDescription(true)); + } + else + { + TraceLog.WriteLine("Failed to load info about debug token: \"{0}\"", _tokenInfoRunner.DebugTokenLocation); + TraceLog.WarnLine(_tokenInfoRunner.LastOutput); + AppendTokenLog(_tokenInfoRunner.LastError); + } + + _tokenInfoRunner.Finished -= TokenInfoRunnerOnFinished; + _tokenInfoRunner = null; + + UpdateTokenStatusUI(true); + UpdateDeviceStatusUI(!IsLoadingDeviceInfo); + } + + private void UpdateTokenStatusUI(bool completed) + { + bttTokenBrowse.Enabled = completed; + bttTokenCreate.Enabled = completed; + bttTokenRenew.Enabled = completed; + + if (!completed) + { + ErrorText = string.Empty; + } + else + { + UpdateErrorUI(); + } + } + + private void UpdateErrorUI() + { + if (_tokenInfo == null) + { + ErrorText = "Missing debug token to upload"; + return; + } + + if (_tokenInfo.ExpiryDate < DateTime.UtcNow) + { + ErrorText = "Debug token already expired"; + return; + } + + var deviceInfo = _vm.GetDetails(_device); + if (deviceInfo == null) + { + ErrorText = "Missing connected device"; + return; + } + + if (deviceInfo.PIN == 0) + { + ErrorText = "Invalid device PIN"; + return; + } + + if (!_tokenInfo.Contains(deviceInfo.PIN)) + { + ErrorText = "Debug token is not created against this device, recreate it adding connected device's PIN to list of target devices"; + return; + } + } + + #endregion + + #region Device Info Runner + + private void LoadDeviceInfo(DeviceDefinition device, bool forceReload) + { + if (IsLoadingDeviceInfo) + return; + + ClearDeviceLogs(); + _device = device; + if (_device == null) + { + AppendDeviceLog("Invalid device to load info"); + return; + } + + // load device info or get it from cache: + var deviceInfo = _vm.GetDetails(_device); + if (deviceInfo == null || forceReload) + { + AppendDeviceLog("Loading device info..."); + _vm.SetDetails(_device, null); + UpdateDeviceStatusUI(false); + + // load info asynchronously: + _deviceInfoRunner = new DeviceInfoRunner(RunnerDefaults.ToolsDirectory, _device.IP, _device.Password); + _deviceInfoRunner.Dispatcher = EventDispatcher.From(this); + _deviceInfoRunner.Finished += DeviceInfoRunnerOnFinished; + _deviceInfoRunner.ExecuteAsync(); + } + else + { + PrintDeviceInfo(deviceInfo); + UpdateDeviceStatusUI(true); + } + } + + private void DeviceInfoRunnerOnFinished(object sender, ToolRunnerEventArgs toolRunnerEventArgs) + { + bool success = string.IsNullOrEmpty(_deviceInfoRunner.LastError) && _deviceInfoRunner.DeviceInfo != null; + AppendDeviceLog("--- DONE with " + (success ? "success" : "failure") + Environment.NewLine); + + if (success) + { + TraceLog.WriteLine("Loaded info about device: {0}", _deviceInfoRunner.DeviceInfo); + + // update cache: + var deviceInfo = _deviceInfoRunner.DeviceInfo; + _vm.SetDetails(_device, deviceInfo); + + PrintDeviceInfo(deviceInfo); + } + else + { + TraceLog.WriteLine("Failed to load info about device: {0}", _device); + TraceLog.WarnLine(_deviceInfoRunner.LastOutput); + AppendDeviceLog(_deviceInfoRunner.LastError); + } + + _deviceInfoRunner.Finished -= DeviceInfoRunnerOnFinished; + _deviceInfoRunner = null; + + UpdateDeviceStatusUI(true); + } + + private void PrintDeviceInfo(DeviceInfo deviceInfo) + { + if (deviceInfo == null) + return; + + string debugTokenDescription = deviceInfo.DebugToken != null ? deviceInfo.DebugToken.ToLongDescription() : "Error: not found"; + + AppendDeviceLog("Debug token found: " + Environment.NewLine + debugTokenDescription); + AppendDeviceLog("Device found:" + Environment.NewLine + deviceInfo.ToLongDescription()); + } + + private void UpdateDeviceStatusUI(bool completed) + { + var details = _vm.GetDetails(_device); + + cmbDevices.Enabled = completed; + bttDeviceLoad.Enabled = completed && !IsLoadingDeviceInfo; + bttUpload.Enabled = completed && details != null && _tokenInfo != null /*&& _tokenInfo.ExpiryDate > DateTime.UtcNow && _tokenInfo.Contains(details.PIN) */; + bttRemove.Enabled = completed && details != null && details.DebugToken != null && _tokenInfo != null && !string.IsNullOrEmpty(_tokenInfo.ID); + + if (!completed) + { + ErrorText = string.Empty; + } + else + { + UpdateErrorUI(); + } + } + + #endregion + + #region Debug Token Upload Runner + + private void UploadDebugToken(string fileName) + { + if (IsUploadingToken) + return; + + ClearDeviceLogs(); + if (_device == null) + { + AppendDeviceLog("Invalid device to upload debug token"); + return; + } + + AppendDeviceLog("Uploading debug token to " + _device + "..."); + UpdateDeviceStatusUI(false); + + // upload token asynchronously: + _tokenUploadRunner = new DebugTokenUploadRunner(RunnerDefaults.ToolsDirectory, fileName, _device.IP, _device.Password); + _tokenUploadRunner.Dispatcher = EventDispatcher.From(this); + _tokenUploadRunner.Finished += DebugTokenUploadRunnerOnFinished; + _tokenUploadRunner.ExecuteAsync(); + } + + private void DebugTokenUploadRunnerOnFinished(object sender, ToolRunnerEventArgs e) + { + bool success = string.IsNullOrEmpty(_tokenUploadRunner.LastError) && _tokenUploadRunner.UploadedSuccessfully; + AppendDeviceLog("--- DONE with " + (success ? "success" : "failure") + Environment.NewLine); + + if (success) + { + TraceLog.WriteLine("Uploaded debug token to device: {0}", _device); + + // reload device info: + LoadDeviceInfo(_device, true); + } + else + { + TraceLog.WriteLine("Failed to upload debug token to device: {0}", _device); + TraceLog.WarnLine(_tokenUploadRunner.LastError); + AppendDeviceLog(_tokenUploadRunner.LastError); + } + + _tokenUploadRunner.Finished -= DeviceInfoRunnerOnFinished; + _tokenUploadRunner = null; + + UpdateDeviceStatusUI(true); + } + + #endregion + + #region Debug Token Removal Runner + + private void RemoveDebugToken() + { + if (IsRemovingToken) + return; + + ClearDeviceLogs(); + if (_device == null) + { + AppendDeviceLog("Invalid device to remove debug token"); + return; + } + if (_tokenInfo == null || string.IsNullOrEmpty(_tokenInfo.ID)) + { + AppendDeviceLog("Invalid debug token info, to remove it from device"); + return; + } + + AppendDeviceLog("Removing debug token from " + _device + "..."); + UpdateDeviceStatusUI(false); + + // remove token asynchronously: + _tokenRemoveRunner = new ApplicationRemoveRunner(RunnerDefaults.ToolsDirectory, _tokenInfo.ID, _device.IP, _device.Password); + _tokenRemoveRunner.Dispatcher = EventDispatcher.From(this); + _tokenRemoveRunner.Finished += DebugTokenRemoveRunnerOnFinished; + _tokenRemoveRunner.ExecuteAsync(); + } + + private void DebugTokenRemoveRunnerOnFinished(object sender, ToolRunnerEventArgs e) + { + bool success = string.IsNullOrEmpty(_tokenRemoveRunner.LastError) && _tokenRemoveRunner.RemovedSuccessfully; + AppendDeviceLog("--- DONE with " + (success ? "success" : "failure") + Environment.NewLine); + + if (success) + { + TraceLog.WriteLine("Removed debug token a device: {0}", _device); + + // reload device info: + LoadDeviceInfo(_device, true); + } + else + { + TraceLog.WriteLine("Failed to remove debug token to device: {0}", _device); + TraceLog.WarnLine(_tokenRemoveRunner.LastOutput); + TraceLog.WarnLine(_tokenRemoveRunner.LastError); + AppendDeviceLog(_tokenRemoveRunner.LastError); + } + + _tokenRemoveRunner.Finished -= DebugTokenRemoveRunnerOnFinished; + _tokenRemoveRunner = null; + + UpdateDeviceStatusUI(true); + } + + #endregion + + private void bttTokenBrowse_Click(object sender, EventArgs e) + { + if (IsLoadingTokenInfo) + return; + + var openFile = DialogHelper.OpenBarFile("Load Debug Token", + string.IsNullOrEmpty(DebugTokenPath) ? RunnerDefaults.DataDirectory : DebugTokenPath); + + if (openFile.ShowDialog() == DialogResult.OK) + { + LoadTokenInfo(openFile.FileName); + } + } + + private void cmbDevices_SelectedIndexChanged(object sender, EventArgs e) + { + var item = cmbDevices.SelectedItem as ComboBoxItem; + var device = item != null ? item.Tag as DeviceDefinition : null; + + // load and display detailed info about newly selected device: + if (device != null) + { + LoadDeviceInfo(device, false); + } + } + + private void bttDeviceLoad_Click(object sender, EventArgs e) + { + // force data reload: + LoadDeviceInfo(_device, true); + } + + private void bttUpload_Click(object sender, EventArgs e) + { + UploadDebugToken(DebugTokenPath); + } + + private void bttRemove_Click(object sender, EventArgs e) + { + RemoveDebugToken(); + } + } +} diff --git a/src_vs2012/VSNDK.Package/Options/Dialogs/DebugTokenForm.resx b/src_vs2012/VSNDK.Package/Options/Dialogs/DebugTokenForm.resx new file mode 100644 index 00000000..29dcb1b3 --- /dev/null +++ b/src_vs2012/VSNDK.Package/Options/Dialogs/DebugTokenForm.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/src_vs2012/VSNDK.Package/Options/Dialogs/DeviceForm.cs b/src_vs2012/VSNDK.Package/Options/Dialogs/DeviceForm.cs index 9655fd9a..f327613b 100644 --- a/src_vs2012/VSNDK.Package/Options/Dialogs/DeviceForm.cs +++ b/src_vs2012/VSNDK.Package/Options/Dialogs/DeviceForm.cs @@ -69,7 +69,7 @@ public string LoadedDeviceName else { _loadedDeviceName = value; - bttSetName.Text = "<< " + value.Substring(0, value.Length > 14 ? 14 : value.Length) + "..."; // up to 15chars + bttSetName.Text = "<< " + (value.Length > 14 ? value.Substring(0, 14) + "..." : value); // up to 15chars bttSetName.Visible = true; } } diff --git a/src_vs2012/VSNDK.Package/Options/TargetsOptionControl.Designer.cs b/src_vs2012/VSNDK.Package/Options/TargetsOptionControl.Designer.cs index dbc2a317..4b19ccda 100644 --- a/src_vs2012/VSNDK.Package/Options/TargetsOptionControl.Designer.cs +++ b/src_vs2012/VSNDK.Package/Options/TargetsOptionControl.Designer.cs @@ -31,6 +31,7 @@ private void InitializeComponent() this.groupBox1 = new System.Windows.Forms.GroupBox(); this.listTargets = new System.Windows.Forms.ListView(); this.columnActive = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); + this.columnType = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.columnName = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.columnIP = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.label1 = new System.Windows.Forms.Label(); @@ -40,7 +41,6 @@ private void InitializeComponent() this.lnkMoreInfo = new System.Windows.Forms.LinkLabel(); this.bttDebugToken = new System.Windows.Forms.Button(); this.bttActivate = new System.Windows.Forms.Button(); - this.columnType = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.groupBox1.SuspendLayout(); this.SuspendLayout(); // @@ -86,6 +86,12 @@ private void InitializeComponent() this.columnActive.Text = "A"; this.columnActive.Width = 20; // + // columnType + // + this.columnType.Text = "T"; + this.columnType.TextAlign = System.Windows.Forms.HorizontalAlignment.Center; + this.columnType.Width = 20; + // // columnName // this.columnName.Text = "Name"; @@ -163,6 +169,7 @@ private void InitializeComponent() this.bttDebugToken.TabIndex = 2; this.bttDebugToken.Text = "&Upload debug token..."; this.bttDebugToken.UseVisualStyleBackColor = true; + this.bttDebugToken.Click += new System.EventHandler(this.bttDebugToken_Click); // // bttActivate // @@ -176,12 +183,6 @@ private void InitializeComponent() this.bttActivate.UseVisualStyleBackColor = true; this.bttActivate.Click += new System.EventHandler(this.bttActivate_Click); // - // columnType - // - this.columnType.Text = "T"; - this.columnType.TextAlign = System.Windows.Forms.HorizontalAlignment.Center; - this.columnType.Width = 20; - // // TargetsOptionControl // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); diff --git a/src_vs2012/VSNDK.Package/Options/TargetsOptionControl.cs b/src_vs2012/VSNDK.Package/Options/TargetsOptionControl.cs index f8b42247..99f74780 100644 --- a/src_vs2012/VSNDK.Package/Options/TargetsOptionControl.cs +++ b/src_vs2012/VSNDK.Package/Options/TargetsOptionControl.cs @@ -37,7 +37,7 @@ private void PopulateDevices() foreach (var device in _vm.Devices) { - ListViewItem item = new ListViewItem(); + var item = new ListViewItem(); item.Tag = device; item.Text = _vm.IsActive(device) ? "x" : string.Empty; item.SubItems.Add(device.Type == DeviceDefinitionType.Simulator ? "S" : string.Empty); @@ -47,7 +47,7 @@ private void PopulateDevices() listTargets.Items.Add(item); } - bttDebugToken.Enabled = _vm.ActiveDevice != null; + bttDebugToken.Enabled = _vm.RealDevicesCount > 0; } private void lnkMoreInfo_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) @@ -59,8 +59,13 @@ private void listTargets_SelectedIndexChanged(object sender, System.EventArgs e) { var device = SelectedDevice; - bttEdit.Enabled = bttRemove.Enabled = device != null; - bttActivate.Enabled = device != null && _vm.IsActive(device); + bttEdit.Enabled = bttRemove.Enabled = bttActivate.Enabled = device != null; + + // update the button with 'debug-token' deployment, to limit it only to valid devices: + device = SelectedDevice ?? _vm.ActiveDevice; + if (device != null && device.Type != DeviceDefinitionType.Device) + device = null; + bttDebugToken.Enabled = _vm.RealDevicesCount > 0 && device != null; } private void listTargets_DoubleClick(object sender, System.EventArgs e) @@ -113,6 +118,22 @@ private void bttRemove_Click(object sender, System.EventArgs e) } } + private void bttDebugToken_Click(object sender, System.EventArgs e) + { + var device = SelectedDevice ?? _vm.ActiveDevice; + + if (device != null && device.Type != DeviceDefinitionType.Device) + device = null; + + var form = new DebugTokenForm(); + form.SetVM(_vm, device); + + if (form.ShowDialog() == DialogResult.OK) + { + + } + } + public void OnApply() { _vm.Apply(); diff --git a/src_vs2012/VSNDK.Package/VSNDK.Package.csproj b/src_vs2012/VSNDK.Package/VSNDK.Package.csproj index 4c425b78..5f57228d 100644 --- a/src_vs2012/VSNDK.Package/VSNDK.Package.csproj +++ b/src_vs2012/VSNDK.Package/VSNDK.Package.csproj @@ -282,6 +282,13 @@ AddLocalNdkForm.cs + + + Form + + + DebugTokenForm.cs + Form @@ -495,6 +502,9 @@ AddLocalNdkForm.cs + + DebugTokenForm.cs + DeviceForm.cs diff --git a/src_vs2012/VSNDK.Package/ViewModels/DeviceDefinition.cs b/src_vs2012/VSNDK.Package/ViewModels/DeviceDefinition.cs index bba6c95e..56001cc0 100644 --- a/src_vs2012/VSNDK.Package/ViewModels/DeviceDefinition.cs +++ b/src_vs2012/VSNDK.Package/ViewModels/DeviceDefinition.cs @@ -61,6 +61,14 @@ public DeviceDefinitionType Type private set; } + /// + /// Gets non-null short name of this device. + /// + public string ShortName + { + get { return string.IsNullOrEmpty(Name) ? IP : Name; } + } + #endregion /// diff --git a/src_vs2012/VSNDK.Package/ViewModels/TargetsOptionViewModel.cs b/src_vs2012/VSNDK.Package/ViewModels/TargetsOptionViewModel.cs index bfc021f2..01e68390 100644 --- a/src_vs2012/VSNDK.Package/ViewModels/TargetsOptionViewModel.cs +++ b/src_vs2012/VSNDK.Package/ViewModels/TargetsOptionViewModel.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using RIM.VSNDK_Package.Model; namespace RIM.VSNDK_Package.ViewModels { @@ -11,6 +12,7 @@ internal sealed class TargetsOptionViewModel private List _devices; private DeviceDefinition _activeDevice; private DeviceDefinition _activeSimulator; + private Dictionary _details; /// /// Gets the list of target devices. @@ -25,6 +27,7 @@ public ICollection Devices _devices = new List(PackageViewModel.Instance.TargetDevices); _activeDevice = PackageViewModel.Instance.ActiveDevice; _activeSimulator = PackageViewModel.Instance.ActiveSimulator; + UpdateRealDevicesCount(); } return _devices; @@ -36,6 +39,28 @@ public DeviceDefinition ActiveDevice get { return _activeDevice; } } + public int RealDevicesCount + { + get; + private set; + } + + private void UpdateRealDevicesCount() + { + int count = 0; + + if (_devices != null) + { + foreach (var d in _devices) + { + if (d.Type == DeviceDefinitionType.Device) + count++; + } + } + + RealDevicesCount = count; + } + public bool IsActive(DeviceDefinition device) { if (device == null) @@ -51,6 +76,7 @@ public void Add(DeviceDefinition device) _devices.Add(device); _devices.Sort(); + UpdateRealDevicesCount(); // and set as activate automatically: if (_activeDevice == null && device.Type == DeviceDefinitionType.Device) @@ -113,6 +139,7 @@ public void Update(DeviceDefinition oldDevice, DeviceDefinition newDevice) _devices[index] = newDevice; _devices.Sort(); + UpdateRealDevicesCount(); if (_activeDevice == oldDevice) { @@ -133,6 +160,8 @@ public void Remove(DeviceDefinition device) return; _devices.Remove(device); + UpdateRealDevicesCount(); + if (_activeDevice == device) { _activeDevice = null; @@ -146,6 +175,43 @@ public void Remove(DeviceDefinition device) } } + /// + /// Gets detailed physical device description if available. + /// + public DeviceInfo GetDetails(DeviceDefinition device) + { + if (device == null) + return null; + if (_details == null) + return null; + + DeviceInfo details; + return _details.TryGetValue(device, out details) ? details : null; + } + + /// + /// Sets or updates detailed info about particular device. + /// + public void SetDetails(DeviceDefinition device, DeviceInfo details) + { + if (device == null) + throw new ArgumentNullException("device"); + + if (details == null) + { + if (_details != null) + _details.Remove(device); + } + else + { + if (_details == null) + _details = new Dictionary(); + + // add or update info: + _details[device] = details; + } + } + /// /// OK. Save it. /// From ecd6750519468fb2c1f51a17f0d3cf67ea2d99aa Mon Sep 17 00:00:00 2001 From: Pawel Hofman Date: Wed, 14 May 2014 18:03:32 +0200 Subject: [PATCH 060/851] Fixed passing list of devices, when creating debug-token --- src_vs2012/VSNDK.Package/Tools/DebugTokenCreateRunner.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src_vs2012/VSNDK.Package/Tools/DebugTokenCreateRunner.cs b/src_vs2012/VSNDK.Package/Tools/DebugTokenCreateRunner.cs index 1b0db3e1..3194bee0 100644 --- a/src_vs2012/VSNDK.Package/Tools/DebugTokenCreateRunner.cs +++ b/src_vs2012/VSNDK.Package/Tools/DebugTokenCreateRunner.cs @@ -108,7 +108,7 @@ private void UpdateArguments() // list of devices: foreach (var device in Devices) { - args.Append(" -deviceid \"0x").Append(device.ToString("X")).Append('"'); + args.Append(" -devicepin \"").Append(device.ToString("X")).Append('"'); } // path to the output .bar file: From c2b5081fcf1341d1777370597299d9aaef134d76 Mon Sep 17 00:00:00 2001 From: Pawel Hofman Date: Wed, 14 May 2014 18:04:42 +0200 Subject: [PATCH 061/851] Added debug-token renew feature --- .../VSNDK.Package/Options/DialogHelper.cs | 18 ++ .../Dialogs/DebugTokenForm.Designer.cs | 25 +-- .../Options/Dialogs/DebugTokenForm.cs | 132 +++++++++++- .../Options/Dialogs/DeviceForm.cs | 2 +- .../Options/Dialogs/PasswordForm.Designer.cs | 153 ++++++++++++++ .../Options/Dialogs/PasswordForm.cs | 42 ++++ .../Options/Dialogs/PasswordForm.resx | 120 +++++++++++ src_vs2012/VSNDK.Package/VSNDK.Package.csproj | 10 + .../ViewModels/DeveloperDefinition.cs | 193 ++++++++++++++++++ .../ViewModels/PackageViewModel.cs | 16 +- .../ViewModels/TargetsOptionViewModel.cs | 8 + 11 files changed, 698 insertions(+), 21 deletions(-) create mode 100644 src_vs2012/VSNDK.Package/Options/Dialogs/PasswordForm.Designer.cs create mode 100644 src_vs2012/VSNDK.Package/Options/Dialogs/PasswordForm.cs create mode 100644 src_vs2012/VSNDK.Package/Options/Dialogs/PasswordForm.resx create mode 100644 src_vs2012/VSNDK.Package/ViewModels/DeveloperDefinition.cs diff --git a/src_vs2012/VSNDK.Package/Options/DialogHelper.cs b/src_vs2012/VSNDK.Package/Options/DialogHelper.cs index 2f1aa145..ebc0e150 100644 --- a/src_vs2012/VSNDK.Package/Options/DialogHelper.cs +++ b/src_vs2012/VSNDK.Package/Options/DialogHelper.cs @@ -36,5 +36,23 @@ public static OpenFileDialog OpenBarFile(string title, string startupPath) return openFile; } + + /// + /// Returns preconfigured window for saving BAR file. + /// + public static SaveFileDialog SaveBarFile(string title, string startupPath, string fileName) + { + var saveFile = new SaveFileDialog(); + saveFile.Title = title; + saveFile.InitialDirectory = startupPath; + saveFile.FileName = fileName; + saveFile.DefaultExt = ".bar"; + saveFile.Filter = "Bar files|*.bar|All files|*.*"; + saveFile.FilterIndex = 0; + saveFile.CreatePrompt = false; + saveFile.OverwritePrompt = true; + + return saveFile; + } } } diff --git a/src_vs2012/VSNDK.Package/Options/Dialogs/DebugTokenForm.Designer.cs b/src_vs2012/VSNDK.Package/Options/Dialogs/DebugTokenForm.Designer.cs index d16077ec..3263938a 100644 --- a/src_vs2012/VSNDK.Package/Options/Dialogs/DebugTokenForm.Designer.cs +++ b/src_vs2012/VSNDK.Package/Options/Dialogs/DebugTokenForm.Designer.cs @@ -72,9 +72,10 @@ private void InitializeComponent() this.bttTokenRenew.Location = new System.Drawing.Point(442, 80); this.bttTokenRenew.Name = "bttTokenRenew"; this.bttTokenRenew.Size = new System.Drawing.Size(75, 23); - this.bttTokenRenew.TabIndex = 5; + this.bttTokenRenew.TabIndex = 4; this.bttTokenRenew.Text = "&Renew..."; this.bttTokenRenew.UseVisualStyleBackColor = true; + this.bttTokenRenew.Click += new System.EventHandler(this.bttTokenRenew_Click); // // bttTokenCreate // @@ -83,7 +84,7 @@ private void InitializeComponent() this.bttTokenCreate.Location = new System.Drawing.Point(442, 51); this.bttTokenCreate.Name = "bttTokenCreate"; this.bttTokenCreate.Size = new System.Drawing.Size(75, 23); - this.bttTokenCreate.TabIndex = 4; + this.bttTokenCreate.TabIndex = 3; this.bttTokenCreate.Text = "Cr&eate..."; this.bttTokenCreate.UseVisualStyleBackColor = true; // @@ -98,7 +99,7 @@ private void InitializeComponent() this.txtDebugTokenLog.ReadOnly = true; this.txtDebugTokenLog.ScrollBars = System.Windows.Forms.ScrollBars.Vertical; this.txtDebugTokenLog.Size = new System.Drawing.Size(416, 88); - this.txtDebugTokenLog.TabIndex = 3; + this.txtDebugTokenLog.TabIndex = 5; // // bttTokenBrowse // @@ -137,7 +138,7 @@ private void InitializeComponent() this.bttOK.Location = new System.Drawing.Point(460, 381); this.bttOK.Name = "bttOK"; this.bttOK.Size = new System.Drawing.Size(75, 23); - this.bttOK.TabIndex = 1; + this.bttOK.TabIndex = 3; this.bttOK.Text = "&Close"; this.bttOK.UseVisualStyleBackColor = true; // @@ -155,7 +156,7 @@ private void InitializeComponent() this.groupBox2.Location = new System.Drawing.Point(12, 163); this.groupBox2.Name = "groupBox2"; this.groupBox2.Size = new System.Drawing.Size(523, 212); - this.groupBox2.TabIndex = 2; + this.groupBox2.TabIndex = 1; this.groupBox2.TabStop = false; this.groupBox2.Text = "Devices"; // @@ -166,7 +167,7 @@ private void InitializeComponent() this.bttRemove.Location = new System.Drawing.Point(442, 129); this.bttRemove.Name = "bttRemove"; this.bttRemove.Size = new System.Drawing.Size(75, 23); - this.bttRemove.TabIndex = 5; + this.bttRemove.TabIndex = 4; this.bttRemove.Text = "Re&move"; this.bttRemove.UseVisualStyleBackColor = true; this.bttRemove.Click += new System.EventHandler(this.bttRemove_Click); @@ -178,7 +179,7 @@ private void InitializeComponent() this.bttUpload.Location = new System.Drawing.Point(442, 46); this.bttUpload.Name = "bttUpload"; this.bttUpload.Size = new System.Drawing.Size(75, 23); - this.bttUpload.TabIndex = 4; + this.bttUpload.TabIndex = 2; this.bttUpload.Text = "&Upload"; this.bttUpload.UseVisualStyleBackColor = true; this.bttUpload.Click += new System.EventHandler(this.bttUpload_Click); @@ -194,7 +195,7 @@ private void InitializeComponent() this.txtDeviceLog.ReadOnly = true; this.txtDeviceLog.ScrollBars = System.Windows.Forms.ScrollBars.Vertical; this.txtDeviceLog.Size = new System.Drawing.Size(416, 160); - this.txtDeviceLog.TabIndex = 3; + this.txtDeviceLog.TabIndex = 5; // // cmbDevices // @@ -205,7 +206,7 @@ private void InitializeComponent() this.cmbDevices.MaxDropDownItems = 25; this.cmbDevices.Name = "cmbDevices"; this.cmbDevices.Size = new System.Drawing.Size(189, 21); - this.cmbDevices.TabIndex = 0; + this.cmbDevices.TabIndex = 1; this.cmbDevices.SelectedIndexChanged += new System.EventHandler(this.cmbDevices_SelectedIndexChanged); // // bttDeviceLoad @@ -214,7 +215,7 @@ private void InitializeComponent() this.bttDeviceLoad.Location = new System.Drawing.Point(442, 75); this.bttDeviceLoad.Name = "bttDeviceLoad"; this.bttDeviceLoad.Size = new System.Drawing.Size(75, 23); - this.bttDeviceLoad.TabIndex = 2; + this.bttDeviceLoad.TabIndex = 3; this.bttDeviceLoad.Text = "Re&load info"; this.bttDeviceLoad.UseVisualStyleBackColor = true; this.bttDeviceLoad.Click += new System.EventHandler(this.bttDeviceLoad_Click); @@ -225,7 +226,7 @@ private void InitializeComponent() this.label2.Location = new System.Drawing.Point(17, 22); this.label2.Name = "label2"; this.label2.Size = new System.Drawing.Size(41, 13); - this.label2.TabIndex = 1; + this.label2.TabIndex = 0; this.label2.Text = "Target:"; // // lblError @@ -234,7 +235,7 @@ private void InitializeComponent() this.lblError.Location = new System.Drawing.Point(30, 378); this.lblError.Name = "lblError"; this.lblError.Size = new System.Drawing.Size(418, 35); - this.lblError.TabIndex = 6; + this.lblError.TabIndex = 2; this.lblError.Text = "- error -"; this.lblError.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; this.lblError.Visible = false; diff --git a/src_vs2012/VSNDK.Package/Options/Dialogs/DebugTokenForm.cs b/src_vs2012/VSNDK.Package/Options/Dialogs/DebugTokenForm.cs index ff0b6acb..bc07b237 100644 --- a/src_vs2012/VSNDK.Package/Options/Dialogs/DebugTokenForm.cs +++ b/src_vs2012/VSNDK.Package/Options/Dialogs/DebugTokenForm.cs @@ -1,4 +1,5 @@ using System; +using System.IO; using System.Windows.Forms; using RIM.VSNDK_Package.Diagnostics; using RIM.VSNDK_Package.Model; @@ -15,6 +16,7 @@ internal partial class DebugTokenForm : Form private DeviceInfoRunner _deviceInfoRunner; private DebugTokenUploadRunner _tokenUploadRunner; private ApplicationRemoveRunner _tokenRemoveRunner; + private DebugTokenCreateRunner _tokenCreateRunner; private DebugTokenInfo _tokenInfo; private bool _startup; @@ -61,6 +63,11 @@ public bool IsRemovingToken get { return _tokenRemoveRunner != null; } } + public bool IsCreatingToken + { + get { return _tokenCreateRunner != null; } + } + public bool IsLoadingDeviceInfo { get { return _deviceInfoRunner != null; } @@ -189,7 +196,6 @@ private void TokenInfoRunnerOnFinished(object sender, ToolRunnerEventArgs e) else { TraceLog.WriteLine("Failed to load info about debug token: \"{0}\"", _tokenInfoRunner.DebugTokenLocation); - TraceLog.WarnLine(_tokenInfoRunner.LastOutput); AppendTokenLog(_tokenInfoRunner.LastError); } @@ -380,9 +386,6 @@ private void DebugTokenUploadRunnerOnFinished(object sender, ToolRunnerEventArgs if (success) { TraceLog.WriteLine("Uploaded debug token to device: {0}", _device); - - // reload device info: - LoadDeviceInfo(_device, true); } else { @@ -395,6 +398,12 @@ private void DebugTokenUploadRunnerOnFinished(object sender, ToolRunnerEventArgs _tokenUploadRunner = null; UpdateDeviceStatusUI(true); + + if (success) + { + // reload device info: + LoadDeviceInfo(_device, true); + } } #endregion @@ -436,9 +445,6 @@ private void DebugTokenRemoveRunnerOnFinished(object sender, ToolRunnerEventArgs if (success) { TraceLog.WriteLine("Removed debug token a device: {0}", _device); - - // reload device info: - LoadDeviceInfo(_device, true); } else { @@ -452,6 +458,85 @@ private void DebugTokenRemoveRunnerOnFinished(object sender, ToolRunnerEventArgs _tokenRemoveRunner = null; UpdateDeviceStatusUI(true); + + if (success) + { + // reload device info: + LoadDeviceInfo(_device, true); + } + } + + #endregion + + #region Debug Token Create Runner + + private void CreateDebugToken(string fileName, ulong pin) + { + if (IsCreatingToken) + return; + + var devices = MergeDevices(_tokenInfo, pin); + + ClearTokenLogs(); + AppendTokenLog("Creating new debug token..."); + _tokenInfo = null; + DebugTokenPath = fileName; + UpdateTokenStatusUI(false); + + // and create token asynchronously: + _tokenCreateRunner = new DebugTokenCreateRunner(RunnerDefaults.ToolsDirectory, fileName, _vm.Developer.CskPassword, devices); + _tokenCreateRunner.Dispatcher = EventDispatcher.From(this); + _tokenCreateRunner.Finished += TokenCreateRunnerOnFinished; + _tokenCreateRunner.ExecuteAsync(); + } + + private static ulong[] MergeDevices(DebugTokenInfo existingToken, ulong pin) + { + // will be only for current device: + if (existingToken == null || existingToken.Devices == null || existingToken.Devices.Length == 0) + return new[] { pin }; + + // already contains: + if (existingToken.Contains(pin)) + return existingToken.Devices; + + var result = new ulong[existingToken.Devices.Length + 1]; + result[0] = pin; + + for (int i = 0; i < existingToken.Devices.Length; i++) + result[i + 1] = existingToken.Devices[i]; + return result; + } + + private void TokenCreateRunnerOnFinished(object sender, ToolRunnerEventArgs e) + { + bool success = string.IsNullOrEmpty(_tokenCreateRunner.LastError) && _tokenCreateRunner.CreatedSuccessfully; + AppendTokenLog("--- DONE with " + (success ? "success" : "failure") + Environment.NewLine); + + string path = success ? _tokenCreateRunner.DebugTokenLocation : null; + + if (success) + { + TraceLog.WriteLine("Created new debug token at: \"{0}\"", path); + AppendTokenLog("Debug token created at:" + Environment.NewLine + path); + } + else + { + TraceLog.WriteLine("Failed to create debug token at: \"{0}\"", path); + AppendTokenLog(_tokenCreateRunner.LastError); + } + + _tokenCreateRunner.Finished -= TokenCreateRunnerOnFinished; + _tokenCreateRunner = null; + + UpdateTokenStatusUI(true); + UpdateDeviceStatusUI(!IsLoadingDeviceInfo); + + if (success) + { + // reload token info: + LoadTokenInfo(path); + } } #endregion @@ -497,5 +582,38 @@ private void bttRemove_Click(object sender, EventArgs e) { RemoveDebugToken(); } + + private void bttTokenRenew_Click(object sender, EventArgs e) + { + var details = _vm.GetDetails(_device); + if (details == null || details.PIN == 0) + { + MessageBoxHelper.Show("Please connect first the device and load its properties", "Missing device PIN", MessageBoxButtons.OK, MessageBoxIcon.Error); + return; + } + + if (string.IsNullOrEmpty(_vm.Developer.CskPassword)) + { + var form = new PasswordForm(); + + if (form.ShowDialog() != DialogResult.OK) + { + TraceLog.WarnLine("Update of BBID Token CSK password rejected"); + return; + } + + // save password (for current session only for persistantly): + _vm.Developer.UpdatePassword(form.Password, form.ShouldRemember); + } + + // ask where to store the debug-token: + var startupPath = string.IsNullOrEmpty(DebugTokenPath) ? RunnerDefaults.DataDirectory : Path.GetDirectoryName(DebugTokenPath); + var saveFile = DialogHelper.SaveBarFile("Renewed debug token location", startupPath, "debugtoken-" + DateTime.Now.ToString("yyyy-MM-hh") + ".bar"); + + if (saveFile.ShowDialog() == DialogResult.OK) + { + CreateDebugToken(saveFile.FileName, details.PIN); + } + } } } diff --git a/src_vs2012/VSNDK.Package/Options/Dialogs/DeviceForm.cs b/src_vs2012/VSNDK.Package/Options/Dialogs/DeviceForm.cs index f327613b..062dd75c 100644 --- a/src_vs2012/VSNDK.Package/Options/Dialogs/DeviceForm.cs +++ b/src_vs2012/VSNDK.Package/Options/Dialogs/DeviceForm.cs @@ -185,7 +185,7 @@ private void RunnerOnFinished(object sender, ToolRunnerEventArgs e) private void cmbType_SelectedIndexChanged(object sender, EventArgs e) { - txtIP.Enabled = DeviceClass != DialogDeviceClass.UsbDevice; + txtIP.ReadOnly = DeviceClass != DialogDeviceClass.UsbDevice; if (DeviceClass == DialogDeviceClass.UsbDevice) { diff --git a/src_vs2012/VSNDK.Package/Options/Dialogs/PasswordForm.Designer.cs b/src_vs2012/VSNDK.Package/Options/Dialogs/PasswordForm.Designer.cs new file mode 100644 index 00000000..fd1fafe1 --- /dev/null +++ b/src_vs2012/VSNDK.Package/Options/Dialogs/PasswordForm.Designer.cs @@ -0,0 +1,153 @@ +namespace RIM.VSNDK_Package.Options.Dialogs +{ + partial class PasswordForm + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.label1 = new System.Windows.Forms.Label(); + this.groupBox1 = new System.Windows.Forms.GroupBox(); + this.label2 = new System.Windows.Forms.Label(); + this.txtPassword = new System.Windows.Forms.TextBox(); + this.bttCancel = new System.Windows.Forms.Button(); + this.bttOK = new System.Windows.Forms.Button(); + this.chkRemember = new System.Windows.Forms.CheckBox(); + this.groupBox1.SuspendLayout(); + this.SuspendLayout(); + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Location = new System.Drawing.Point(20, 25); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(56, 13); + this.label1.TabIndex = 0; + this.label1.Text = "Password:"; + // + // groupBox1 + // + this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.groupBox1.Controls.Add(this.label2); + this.groupBox1.Controls.Add(this.txtPassword); + this.groupBox1.Controls.Add(this.label1); + this.groupBox1.Location = new System.Drawing.Point(12, 12); + this.groupBox1.Name = "groupBox1"; + this.groupBox1.Size = new System.Drawing.Size(342, 79); + this.groupBox1.TabIndex = 0; + this.groupBox1.TabStop = false; + this.groupBox1.Text = "Input"; + // + // label2 + // + this.label2.AutoSize = true; + this.label2.Location = new System.Drawing.Point(20, 50); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(307, 13); + this.label2.TabIndex = 2; + this.label2.Text = "(password set when downloading the BlackBerry ID CSK token)"; + // + // txtPassword + // + this.txtPassword.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.txtPassword.Location = new System.Drawing.Point(101, 22); + this.txtPassword.Name = "txtPassword"; + this.txtPassword.PasswordChar = '*'; + this.txtPassword.Size = new System.Drawing.Size(171, 20); + this.txtPassword.TabIndex = 1; + // + // bttCancel + // + this.bttCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.bttCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel; + this.bttCancel.Location = new System.Drawing.Point(279, 97); + this.bttCancel.Name = "bttCancel"; + this.bttCancel.Size = new System.Drawing.Size(75, 23); + this.bttCancel.TabIndex = 3; + this.bttCancel.Text = "&Cancel"; + this.bttCancel.UseVisualStyleBackColor = true; + // + // bttOK + // + this.bttOK.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.bttOK.Location = new System.Drawing.Point(198, 97); + this.bttOK.Name = "bttOK"; + this.bttOK.Size = new System.Drawing.Size(75, 23); + this.bttOK.TabIndex = 2; + this.bttOK.Text = "&OK"; + this.bttOK.UseVisualStyleBackColor = true; + this.bttOK.Click += new System.EventHandler(this.bttOK_Click); + // + // chkRemember + // + this.chkRemember.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this.chkRemember.AutoSize = true; + this.chkRemember.Location = new System.Drawing.Point(12, 101); + this.chkRemember.Name = "chkRemember"; + this.chkRemember.Size = new System.Drawing.Size(77, 17); + this.chkRemember.TabIndex = 1; + this.chkRemember.Text = "Remember"; + this.chkRemember.UseVisualStyleBackColor = true; + // + // PasswordForm + // + this.AcceptButton = this.bttOK; + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.CancelButton = this.bttCancel; + this.ClientSize = new System.Drawing.Size(366, 132); + this.Controls.Add(this.chkRemember); + this.Controls.Add(this.bttOK); + this.Controls.Add(this.bttCancel); + this.Controls.Add(this.groupBox1); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; + this.MaximizeBox = false; + this.MinimizeBox = false; + this.Name = "PasswordForm"; + this.ShowIcon = false; + this.ShowInTaskbar = false; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; + this.Text = "CSK Password Request"; + this.groupBox1.ResumeLayout(false); + this.groupBox1.PerformLayout(); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.Label label1; + private System.Windows.Forms.GroupBox groupBox1; + private System.Windows.Forms.Button bttCancel; + private System.Windows.Forms.Button bttOK; + private System.Windows.Forms.TextBox txtPassword; + private System.Windows.Forms.CheckBox chkRemember; + private System.Windows.Forms.Label label2; + } +} \ No newline at end of file diff --git a/src_vs2012/VSNDK.Package/Options/Dialogs/PasswordForm.cs b/src_vs2012/VSNDK.Package/Options/Dialogs/PasswordForm.cs new file mode 100644 index 00000000..dda554cd --- /dev/null +++ b/src_vs2012/VSNDK.Package/Options/Dialogs/PasswordForm.cs @@ -0,0 +1,42 @@ +using System; +using System.Windows.Forms; + +namespace RIM.VSNDK_Package.Options.Dialogs +{ + public partial class PasswordForm : Form + { + public PasswordForm() + { + InitializeComponent(); + } + + #region Properties + + public string Password + { + get { return txtPassword.Text; } + set { txtPassword.Text = value; } + } + + public bool ShouldRemember + { + get { return chkRemember.Checked; } + set { chkRemember.Checked = value; } + } + + #endregion + + private void bttOK_Click(object sender, EventArgs e) + { + if (string.IsNullOrEmpty(Password)) + { + MessageBoxHelper.Show("You must specify value for password", "Password error", MessageBoxButtons.OK, MessageBoxIcon.Error); + ActiveControl = txtPassword; + return; + } + + DialogResult = DialogResult.OK; + Close(); + } + } +} diff --git a/src_vs2012/VSNDK.Package/Options/Dialogs/PasswordForm.resx b/src_vs2012/VSNDK.Package/Options/Dialogs/PasswordForm.resx new file mode 100644 index 00000000..29dcb1b3 --- /dev/null +++ b/src_vs2012/VSNDK.Package/Options/Dialogs/PasswordForm.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/src_vs2012/VSNDK.Package/VSNDK.Package.csproj b/src_vs2012/VSNDK.Package/VSNDK.Package.csproj index 5f57228d..23f05909 100644 --- a/src_vs2012/VSNDK.Package/VSNDK.Package.csproj +++ b/src_vs2012/VSNDK.Package/VSNDK.Package.csproj @@ -302,6 +302,12 @@ InstallNdkForm.cs + + Form + + + PasswordForm.cs + UserControl @@ -340,6 +346,7 @@ + @@ -511,6 +518,9 @@ InstallNdkForm.cs + + PasswordForm.cs + GeneralOptionControl.cs diff --git a/src_vs2012/VSNDK.Package/ViewModels/DeveloperDefinition.cs b/src_vs2012/VSNDK.Package/ViewModels/DeveloperDefinition.cs new file mode 100644 index 00000000..0b357985 --- /dev/null +++ b/src_vs2012/VSNDK.Package/ViewModels/DeveloperDefinition.cs @@ -0,0 +1,193 @@ +using System; +using System.IO; +using Microsoft.Win32; +using RIM.VSNDK_Package.Tools; + +namespace RIM.VSNDK_Package.ViewModels +{ + /// + /// Short settings about developer doing the development. + /// + internal sealed class DeveloperDefinition + { + private const string DefaultCertificateName = "author.p12"; + private const string FieldCertificateFileName = "certificate"; + private const string FieldCskPassword = "CSKPass"; + + public DeveloperDefinition(string certificatePath, string cskPassword) + { + if (string.IsNullOrEmpty(certificatePath)) + throw new ArgumentNullException("certificatePath"); + + CertificateFileName = certificatePath; + CskPassword = cskPassword; + } + + #region Properties + + /// + /// Gets the path to the author.p12 file. + /// + public string CertificateFileName + { + get; + private set; + } + + /// + /// Password set by developer to the certificate. + /// + public string CskPassword + { + get; + private set; + } + + #endregion + + /// + /// Updates stored CSK password to a new value. + /// + public void UpdatePassword(string password, bool remember) + { + CskPassword = password; + if (remember) + SavePassword(); + } + + /// + /// Stores password into registry. + /// + public void SavePassword() + { + RegistryKey registry = Registry.CurrentUser; + RegistryKey settings = null; + + try + { + settings = registry.CreateSubKey(RunnerDefaults.RegistryPath); + if (settings == null) + return; + + if (CskPassword == null) + CskPassword = string.Empty; + + settings.SetValue(FieldCskPassword, GlobalFunctions.Encrypt(CskPassword)); + } + finally + { + if (settings != null) + settings.Close(); + registry.Close(); + } + } + + /// + /// Checks, if the CSK password is stored in registry. + /// + public bool CheckIsPasswordSaved() + { + RegistryKey registry = Registry.CurrentUser; + RegistryKey settings = null; + + try + { + settings = registry.OpenSubKey(RunnerDefaults.RegistryPath); + if (settings == null) + return false; + + if (CskPassword == null) + CskPassword = string.Empty; + + return settings.GetValue(FieldCskPassword, null) != null; + } + finally + { + if (settings != null) + settings.Close(); + registry.Close(); + } + } + + /// + /// Removes password stored inside registry. + /// + public static void DeletePassword() + { + RegistryKey registry = Registry.CurrentUser; + RegistryKey settings = null; + + try + { + settings = registry.OpenSubKey(RunnerDefaults.RegistryPath); + if (settings == null) + return; + + settings.DeleteSubKey(FieldCskPassword); + } + finally + { + if (settings != null) + settings.Close(); + registry.Close(); + } + } + + /// + /// Creates new developer-definition object based on info read from registry and around. + /// + public static DeveloperDefinition Load(string dataPath) + { + if (string.IsNullOrEmpty(dataPath)) + throw new ArgumentNullException("dataPath"); + + RegistryKey registry = Registry.CurrentUser; + RegistryKey settings; + + string certificateFileName = null; + string cskPassword = null; + + try + { + settings = registry.OpenSubKey(RunnerDefaults.RegistryPath); + } + catch + { + // no device definition + return null; + } + if (settings == null) + return null; + + // CERTIFICATE + try + { + object xCertificate = settings.GetValue(FieldCertificateFileName); + if (xCertificate != null) + certificateFileName = xCertificate.ToString(); + } + catch + { + } + // set default, if loading failed: + if (string.IsNullOrEmpty(certificateFileName)) + certificateFileName = Path.Combine(dataPath, DefaultCertificateName); + + // IP + try + { + object xPassword = settings.GetValue(FieldCskPassword); + if (xPassword != null) + cskPassword = GlobalFunctions.Decrypt(xPassword.ToString()); + } + catch + { + } + + settings.Close(); + registry.Close(); + + return new DeveloperDefinition(certificateFileName, cskPassword); + } + } +} diff --git a/src_vs2012/VSNDK.Package/ViewModels/PackageViewModel.cs b/src_vs2012/VSNDK.Package/ViewModels/PackageViewModel.cs index c951fc5b..4541c627 100644 --- a/src_vs2012/VSNDK.Package/ViewModels/PackageViewModel.cs +++ b/src_vs2012/VSNDK.Package/ViewModels/PackageViewModel.cs @@ -1,5 +1,4 @@ using System; -using System.Collections.Generic; using RIM.VSNDK_Package.Diagnostics; using RIM.VSNDK_Package.Model; using RIM.VSNDK_Package.Tools; @@ -30,6 +29,7 @@ public static PackageViewModel Instance #endregion + private DeveloperDefinition _developer; private NdkInfo[] _installedNDKs; private NdkInfo _activeNDK; private DeviceDefinition[] _targetDevices; @@ -42,6 +42,20 @@ public PackageViewModel() #region Properties + public DeveloperDefinition Developer + { + get + { + if (_developer == null) + { + // load info about current developer: + _developer = DeveloperDefinition.Load(RunnerDefaults.DataDirectory); + } + + return _developer; + } + } + public NdkInfo[] InstalledNDKs { get diff --git a/src_vs2012/VSNDK.Package/ViewModels/TargetsOptionViewModel.cs b/src_vs2012/VSNDK.Package/ViewModels/TargetsOptionViewModel.cs index 01e68390..a85cb427 100644 --- a/src_vs2012/VSNDK.Package/ViewModels/TargetsOptionViewModel.cs +++ b/src_vs2012/VSNDK.Package/ViewModels/TargetsOptionViewModel.cs @@ -14,6 +14,14 @@ internal sealed class TargetsOptionViewModel private DeviceDefinition _activeSimulator; private Dictionary _details; + /// + /// Gets the reference to current developer. + /// + public DeveloperDefinition Developer + { + get { return PackageViewModel.Instance.Developer; } + } + /// /// Gets the list of target devices. /// From aaa1d8b6e962fe3f1d93bcd0a06ce92f6edd20bc Mon Sep 17 00:00:00 2001 From: Pawel Hofman Date: Wed, 14 May 2014 21:22:58 +0200 Subject: [PATCH 062/851] Renamed DebugTokenForm dialog --- ...TokenForm.Designer.cs => DebugTokenDeploymentForm.Designer.cs} | 0 .../Dialogs/{DebugTokenForm.cs => DebugTokenDeploymentForm.cs} | 0 .../{DebugTokenForm.resx => DebugTokenDeploymentForm.resx} | 0 3 files changed, 0 insertions(+), 0 deletions(-) rename src_vs2012/VSNDK.Package/Options/Dialogs/{DebugTokenForm.Designer.cs => DebugTokenDeploymentForm.Designer.cs} (100%) rename src_vs2012/VSNDK.Package/Options/Dialogs/{DebugTokenForm.cs => DebugTokenDeploymentForm.cs} (100%) rename src_vs2012/VSNDK.Package/Options/Dialogs/{DebugTokenForm.resx => DebugTokenDeploymentForm.resx} (100%) diff --git a/src_vs2012/VSNDK.Package/Options/Dialogs/DebugTokenForm.Designer.cs b/src_vs2012/VSNDK.Package/Options/Dialogs/DebugTokenDeploymentForm.Designer.cs similarity index 100% rename from src_vs2012/VSNDK.Package/Options/Dialogs/DebugTokenForm.Designer.cs rename to src_vs2012/VSNDK.Package/Options/Dialogs/DebugTokenDeploymentForm.Designer.cs diff --git a/src_vs2012/VSNDK.Package/Options/Dialogs/DebugTokenForm.cs b/src_vs2012/VSNDK.Package/Options/Dialogs/DebugTokenDeploymentForm.cs similarity index 100% rename from src_vs2012/VSNDK.Package/Options/Dialogs/DebugTokenForm.cs rename to src_vs2012/VSNDK.Package/Options/Dialogs/DebugTokenDeploymentForm.cs diff --git a/src_vs2012/VSNDK.Package/Options/Dialogs/DebugTokenForm.resx b/src_vs2012/VSNDK.Package/Options/Dialogs/DebugTokenDeploymentForm.resx similarity index 100% rename from src_vs2012/VSNDK.Package/Options/Dialogs/DebugTokenForm.resx rename to src_vs2012/VSNDK.Package/Options/Dialogs/DebugTokenDeploymentForm.resx From 515ab0582ff5d68f58c563caf29bab97ec93667e Mon Sep 17 00:00:00 2001 From: Pawel Hofman Date: Wed, 14 May 2014 21:25:26 +0200 Subject: [PATCH 063/851] Fixed invalid field blocking --- src_vs2012/VSNDK.Package/Options/Dialogs/DeviceForm.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src_vs2012/VSNDK.Package/Options/Dialogs/DeviceForm.cs b/src_vs2012/VSNDK.Package/Options/Dialogs/DeviceForm.cs index 062dd75c..4294947f 100644 --- a/src_vs2012/VSNDK.Package/Options/Dialogs/DeviceForm.cs +++ b/src_vs2012/VSNDK.Package/Options/Dialogs/DeviceForm.cs @@ -113,6 +113,8 @@ private DialogDeviceClass GetDeviceClass(DeviceDefinitionType type, string ip) private void ClearLog() { txtLogs.Text = string.Empty; + txtLogs.SelectionLength = 0; + txtLogs.SelectionStart = 0; } private void AppendLog(string text) @@ -185,7 +187,7 @@ private void RunnerOnFinished(object sender, ToolRunnerEventArgs e) private void cmbType_SelectedIndexChanged(object sender, EventArgs e) { - txtIP.ReadOnly = DeviceClass != DialogDeviceClass.UsbDevice; + txtIP.ReadOnly = DeviceClass == DialogDeviceClass.UsbDevice; if (DeviceClass == DialogDeviceClass.UsbDevice) { From bcf06da0b896343177d00beecdf05b68d2d00ebc Mon Sep 17 00:00:00 2001 From: Pawel Hofman Date: Wed, 14 May 2014 21:26:18 +0200 Subject: [PATCH 064/851] Renamed DebugTokenForm to follow new file name --- .../Dialogs/DebugTokenDeploymentForm.Designer.cs | 4 ++-- .../Options/Dialogs/DebugTokenDeploymentForm.cs | 8 ++++++-- .../VSNDK.Package/Options/TargetsOptionControl.cs | 2 +- src_vs2012/VSNDK.Package/VSNDK.Package.csproj | 10 +++++----- 4 files changed, 14 insertions(+), 10 deletions(-) diff --git a/src_vs2012/VSNDK.Package/Options/Dialogs/DebugTokenDeploymentForm.Designer.cs b/src_vs2012/VSNDK.Package/Options/Dialogs/DebugTokenDeploymentForm.Designer.cs index 3263938a..9fb747bb 100644 --- a/src_vs2012/VSNDK.Package/Options/Dialogs/DebugTokenDeploymentForm.Designer.cs +++ b/src_vs2012/VSNDK.Package/Options/Dialogs/DebugTokenDeploymentForm.Designer.cs @@ -1,6 +1,6 @@ namespace RIM.VSNDK_Package.Options.Dialogs { - internal partial class DebugTokenForm + internal partial class DebugTokenDeploymentForm { /// /// Required designer variable. @@ -254,7 +254,7 @@ private void InitializeComponent() this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; this.MaximizeBox = false; this.MinimizeBox = false; - this.Name = "DebugTokenForm"; + this.Name = "DebugTokenDeploymentForm"; this.ShowIcon = false; this.ShowInTaskbar = false; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; diff --git a/src_vs2012/VSNDK.Package/Options/Dialogs/DebugTokenDeploymentForm.cs b/src_vs2012/VSNDK.Package/Options/Dialogs/DebugTokenDeploymentForm.cs index bc07b237..0687961f 100644 --- a/src_vs2012/VSNDK.Package/Options/Dialogs/DebugTokenDeploymentForm.cs +++ b/src_vs2012/VSNDK.Package/Options/Dialogs/DebugTokenDeploymentForm.cs @@ -8,7 +8,7 @@ namespace RIM.VSNDK_Package.Options.Dialogs { - internal partial class DebugTokenForm : Form + internal partial class DebugTokenDeploymentForm : Form { private TargetsOptionViewModel _vm; private DeviceDefinition _device; @@ -20,7 +20,7 @@ internal partial class DebugTokenForm : Form private DebugTokenInfo _tokenInfo; private bool _startup; - public DebugTokenForm() + public DebugTokenDeploymentForm() { InitializeComponent(); @@ -136,6 +136,8 @@ private void PopulateDevices(DeviceDefinition select) private void ClearTokenLogs() { txtDebugTokenLog.Text = string.Empty; + txtDebugTokenLog.SelectionLength = 0; + txtDebugTokenLog.SelectionStart = 0; } private void AppendTokenLog(string message) @@ -149,6 +151,8 @@ private void AppendTokenLog(string message) private void ClearDeviceLogs() { txtDeviceLog.Text = string.Empty; + txtDeviceLog.SelectionLength = 0; + txtDeviceLog.SelectionStart = 0; } private void AppendDeviceLog(string message) diff --git a/src_vs2012/VSNDK.Package/Options/TargetsOptionControl.cs b/src_vs2012/VSNDK.Package/Options/TargetsOptionControl.cs index 99f74780..51a5b039 100644 --- a/src_vs2012/VSNDK.Package/Options/TargetsOptionControl.cs +++ b/src_vs2012/VSNDK.Package/Options/TargetsOptionControl.cs @@ -125,7 +125,7 @@ private void bttDebugToken_Click(object sender, System.EventArgs e) if (device != null && device.Type != DeviceDefinitionType.Device) device = null; - var form = new DebugTokenForm(); + var form = new DebugTokenDeploymentForm(); form.SetVM(_vm, device); if (form.ShowDialog() == DialogResult.OK) diff --git a/src_vs2012/VSNDK.Package/VSNDK.Package.csproj b/src_vs2012/VSNDK.Package/VSNDK.Package.csproj index 23f05909..ea2d93ae 100644 --- a/src_vs2012/VSNDK.Package/VSNDK.Package.csproj +++ b/src_vs2012/VSNDK.Package/VSNDK.Package.csproj @@ -283,11 +283,11 @@ AddLocalNdkForm.cs - + Form - - DebugTokenForm.cs + + DebugTokenDeploymentForm.cs Form @@ -509,8 +509,8 @@ AddLocalNdkForm.cs - - DebugTokenForm.cs + + DebugTokenDeploymentForm.cs DeviceForm.cs From 3eca2539f14f933e313fc6ddd824f07be59fbc9c Mon Sep 17 00:00:00 2001 From: Pawel Hofman Date: Wed, 14 May 2014 22:41:19 +0200 Subject: [PATCH 065/851] Fixed missing title on DeviceForm --- src_vs2012/VSNDK.Package/Options/Dialogs/DeviceForm.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src_vs2012/VSNDK.Package/Options/Dialogs/DeviceForm.cs b/src_vs2012/VSNDK.Package/Options/Dialogs/DeviceForm.cs index 4294947f..eb7650ad 100644 --- a/src_vs2012/VSNDK.Package/Options/Dialogs/DeviceForm.cs +++ b/src_vs2012/VSNDK.Package/Options/Dialogs/DeviceForm.cs @@ -18,7 +18,7 @@ public DeviceForm(string title) { InitializeComponent(); - Name = title; + Text = title; cmbType.SelectedIndex = 0; IsConnected = false; } From 4fbd37dc7eb8076524463a9e8840a218b58f9144 Mon Sep 17 00:00:00 2001 From: Pawel Hofman Date: Thu, 15 May 2014 01:17:10 +0200 Subject: [PATCH 066/851] Final optimizations around PIN/Targets/DebugTokens --- .../Options/Dialogs/ComboBoxItem.cs | 6 + .../DebugTokenDeploymentForm.Designer.cs | 34 ++- .../Dialogs/DebugTokenDeploymentForm.cs | 60 +++-- .../Options/Dialogs/DeviceForm.Designer.cs | 103 ++++++-- .../Options/Dialogs/DeviceForm.cs | 72 +++++- .../Options/Dialogs/PinListForm.Designer.cs | 224 ++++++++++++++++++ .../Options/Dialogs/PinListForm.cs | 175 ++++++++++++++ .../Options/Dialogs/PinListForm.resx | 120 ++++++++++ .../Options/TargetsOptionControl.cs | 6 +- src_vs2012/VSNDK.Package/VSNDK.Package.csproj | 9 + 10 files changed, 738 insertions(+), 71 deletions(-) create mode 100644 src_vs2012/VSNDK.Package/Options/Dialogs/PinListForm.Designer.cs create mode 100644 src_vs2012/VSNDK.Package/Options/Dialogs/PinListForm.cs create mode 100644 src_vs2012/VSNDK.Package/Options/Dialogs/PinListForm.resx diff --git a/src_vs2012/VSNDK.Package/Options/Dialogs/ComboBoxItem.cs b/src_vs2012/VSNDK.Package/Options/Dialogs/ComboBoxItem.cs index ee814323..9d6a7c07 100644 --- a/src_vs2012/VSNDK.Package/Options/Dialogs/ComboBoxItem.cs +++ b/src_vs2012/VSNDK.Package/Options/Dialogs/ComboBoxItem.cs @@ -14,6 +14,12 @@ public ComboBoxItem(string text) Text = text; } + public ComboBoxItem(string text, object tag) + { + Text = text; + Tag = tag; + } + #region Properties public string Text diff --git a/src_vs2012/VSNDK.Package/Options/Dialogs/DebugTokenDeploymentForm.Designer.cs b/src_vs2012/VSNDK.Package/Options/Dialogs/DebugTokenDeploymentForm.Designer.cs index 9fb747bb..ce12cb0e 100644 --- a/src_vs2012/VSNDK.Package/Options/Dialogs/DebugTokenDeploymentForm.Designer.cs +++ b/src_vs2012/VSNDK.Package/Options/Dialogs/DebugTokenDeploymentForm.Designer.cs @@ -29,7 +29,6 @@ protected override void Dispose(bool disposing) private void InitializeComponent() { this.groupBox1 = new System.Windows.Forms.GroupBox(); - this.bttTokenRenew = new System.Windows.Forms.Button(); this.bttTokenCreate = new System.Windows.Forms.Button(); this.txtDebugTokenLog = new System.Windows.Forms.TextBox(); this.bttTokenBrowse = new System.Windows.Forms.Button(); @@ -37,6 +36,7 @@ private void InitializeComponent() this.label1 = new System.Windows.Forms.Label(); this.bttOK = new System.Windows.Forms.Button(); this.groupBox2 = new System.Windows.Forms.GroupBox(); + this.bttAdd = new System.Windows.Forms.Button(); this.bttRemove = new System.Windows.Forms.Button(); this.bttUpload = new System.Windows.Forms.Button(); this.txtDeviceLog = new System.Windows.Forms.TextBox(); @@ -52,7 +52,6 @@ private void InitializeComponent() // this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); - this.groupBox1.Controls.Add(this.bttTokenRenew); this.groupBox1.Controls.Add(this.bttTokenCreate); this.groupBox1.Controls.Add(this.txtDebugTokenLog); this.groupBox1.Controls.Add(this.bttTokenBrowse); @@ -65,28 +64,16 @@ private void InitializeComponent() this.groupBox1.TabStop = false; this.groupBox1.Text = "Debug Token"; // - // bttTokenRenew - // - this.bttTokenRenew.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this.bttTokenRenew.Enabled = false; - this.bttTokenRenew.Location = new System.Drawing.Point(442, 80); - this.bttTokenRenew.Name = "bttTokenRenew"; - this.bttTokenRenew.Size = new System.Drawing.Size(75, 23); - this.bttTokenRenew.TabIndex = 4; - this.bttTokenRenew.Text = "&Renew..."; - this.bttTokenRenew.UseVisualStyleBackColor = true; - this.bttTokenRenew.Click += new System.EventHandler(this.bttTokenRenew_Click); - // // bttTokenCreate // this.bttTokenCreate.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this.bttTokenCreate.Enabled = false; this.bttTokenCreate.Location = new System.Drawing.Point(442, 51); this.bttTokenCreate.Name = "bttTokenCreate"; this.bttTokenCreate.Size = new System.Drawing.Size(75, 23); this.bttTokenCreate.TabIndex = 3; this.bttTokenCreate.Text = "Cr&eate..."; this.bttTokenCreate.UseVisualStyleBackColor = true; + this.bttTokenCreate.Click += new System.EventHandler(this.bttTokenCreate_Click); // // txtDebugTokenLog // @@ -147,6 +134,7 @@ private void InitializeComponent() this.groupBox2.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); + this.groupBox2.Controls.Add(this.bttAdd); this.groupBox2.Controls.Add(this.bttRemove); this.groupBox2.Controls.Add(this.bttUpload); this.groupBox2.Controls.Add(this.txtDeviceLog); @@ -158,7 +146,17 @@ private void InitializeComponent() this.groupBox2.Size = new System.Drawing.Size(523, 212); this.groupBox2.TabIndex = 1; this.groupBox2.TabStop = false; - this.groupBox2.Text = "Devices"; + this.groupBox2.Text = "Onto Device"; + // + // bttAdd + // + this.bttAdd.Location = new System.Drawing.Point(270, 19); + this.bttAdd.Name = "bttAdd"; + this.bttAdd.Size = new System.Drawing.Size(30, 23); + this.bttAdd.TabIndex = 6; + this.bttAdd.Text = "+"; + this.bttAdd.UseVisualStyleBackColor = true; + this.bttAdd.Click += new System.EventHandler(this.bttAdd_Click); // // bttRemove // @@ -240,7 +238,7 @@ private void InitializeComponent() this.lblError.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; this.lblError.Visible = false; // - // DebugTokenForm + // DebugTokenDeploymentForm // this.AcceptButton = this.bttOK; this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); @@ -281,9 +279,9 @@ private void InitializeComponent() private System.Windows.Forms.Label label2; private System.Windows.Forms.ComboBox cmbDevices; private System.Windows.Forms.TextBox txtDeviceLog; - private System.Windows.Forms.Button bttTokenRenew; private System.Windows.Forms.Button bttUpload; private System.Windows.Forms.Button bttRemove; private System.Windows.Forms.Label lblError; + private System.Windows.Forms.Button bttAdd; } } \ No newline at end of file diff --git a/src_vs2012/VSNDK.Package/Options/Dialogs/DebugTokenDeploymentForm.cs b/src_vs2012/VSNDK.Package/Options/Dialogs/DebugTokenDeploymentForm.cs index 0687961f..c213d5d8 100644 --- a/src_vs2012/VSNDK.Package/Options/Dialogs/DebugTokenDeploymentForm.cs +++ b/src_vs2012/VSNDK.Package/Options/Dialogs/DebugTokenDeploymentForm.cs @@ -48,6 +48,12 @@ protected override void OnShown(EventArgs e) #region Properties + public bool AskOnStartup + { + get { return _startup; } + set { _startup = value; } + } + public bool IsLoadingTokenInfo { get { return _tokenInfoRunner != null; } @@ -214,7 +220,6 @@ private void UpdateTokenStatusUI(bool completed) { bttTokenBrowse.Enabled = completed; bttTokenCreate.Enabled = completed; - bttTokenRenew.Enabled = completed; if (!completed) { @@ -474,13 +479,11 @@ private void DebugTokenRemoveRunnerOnFinished(object sender, ToolRunnerEventArgs #region Debug Token Create Runner - private void CreateDebugToken(string fileName, ulong pin) + private void CreateDebugToken(string fileName, ulong[] devicePins) { if (IsCreatingToken) return; - var devices = MergeDevices(_tokenInfo, pin); - ClearTokenLogs(); AppendTokenLog("Creating new debug token..."); _tokenInfo = null; @@ -488,30 +491,12 @@ private void CreateDebugToken(string fileName, ulong pin) UpdateTokenStatusUI(false); // and create token asynchronously: - _tokenCreateRunner = new DebugTokenCreateRunner(RunnerDefaults.ToolsDirectory, fileName, _vm.Developer.CskPassword, devices); + _tokenCreateRunner = new DebugTokenCreateRunner(RunnerDefaults.ToolsDirectory, fileName, _vm.Developer.CskPassword, devicePins); _tokenCreateRunner.Dispatcher = EventDispatcher.From(this); _tokenCreateRunner.Finished += TokenCreateRunnerOnFinished; _tokenCreateRunner.ExecuteAsync(); } - private static ulong[] MergeDevices(DebugTokenInfo existingToken, ulong pin) - { - // will be only for current device: - if (existingToken == null || existingToken.Devices == null || existingToken.Devices.Length == 0) - return new[] { pin }; - - // already contains: - if (existingToken.Contains(pin)) - return existingToken.Devices; - - var result = new ulong[existingToken.Devices.Length + 1]; - result[0] = pin; - - for (int i = 0; i < existingToken.Devices.Length; i++) - result[i + 1] = existingToken.Devices[i]; - return result; - } - private void TokenCreateRunnerOnFinished(object sender, ToolRunnerEventArgs e) { bool success = string.IsNullOrEmpty(_tokenCreateRunner.LastError) && _tokenCreateRunner.CreatedSuccessfully; @@ -587,7 +572,7 @@ private void bttRemove_Click(object sender, EventArgs e) RemoveDebugToken(); } - private void bttTokenRenew_Click(object sender, EventArgs e) + private void bttTokenCreate_Click(object sender, EventArgs e) { var details = _vm.GetDetails(_device); if (details == null || details.PIN == 0) @@ -616,7 +601,32 @@ private void bttTokenRenew_Click(object sender, EventArgs e) if (saveFile.ShowDialog() == DialogResult.OK) { - CreateDebugToken(saveFile.FileName, details.PIN); + // show PINs editor: + var form = new PinListForm(); + form.OptionalDevices = _vm.Devices; + form.Add(_tokenInfo != null ? _tokenInfo.Devices : null); + form.Add(details.PIN); + + if (form.ShowDialog() == DialogResult.OK) + { + var devicePINs = form.PINs; + if (devicePINs == null || devicePINs.Length == 0) + devicePINs = new[] { details.PIN }; + + CreateDebugToken(saveFile.FileName, devicePINs); + } + } + } + + private void bttAdd_Click(object sender, EventArgs e) + { + var form = new DeviceForm("Add new Target Device"); + + if (form.ShowDialog() == DialogResult.OK) + { + var device = form.ToDevice(); + _vm.Add(device); + PopulateDevices(device); } } } diff --git a/src_vs2012/VSNDK.Package/Options/Dialogs/DeviceForm.Designer.cs b/src_vs2012/VSNDK.Package/Options/Dialogs/DeviceForm.Designer.cs index 2cf47e41..aec64c9e 100644 --- a/src_vs2012/VSNDK.Package/Options/Dialogs/DeviceForm.Designer.cs +++ b/src_vs2012/VSNDK.Package/Options/Dialogs/DeviceForm.Designer.cs @@ -36,12 +36,16 @@ private void InitializeComponent() this.label3 = new System.Windows.Forms.Label(); this.txtName = new System.Windows.Forms.TextBox(); this.label2 = new System.Windows.Forms.Label(); - this.label1 = new System.Windows.Forms.Label(); + this.lblType = new System.Windows.Forms.Label(); this.cmbType = new System.Windows.Forms.ComboBox(); + this.cmbNames = new System.Windows.Forms.ComboBox(); this.txtLogs = new System.Windows.Forms.TextBox(); this.bttTest = new System.Windows.Forms.Button(); this.bttOK = new System.Windows.Forms.Button(); this.bttCancel = new System.Windows.Forms.Button(); + this.bttDiscover = new System.Windows.Forms.Button(); + this.txtPIN = new System.Windows.Forms.TextBox(); + this.lblPIN = new System.Windows.Forms.Label(); this.groupBox1.SuspendLayout(); this.SuspendLayout(); // @@ -56,8 +60,11 @@ private void InitializeComponent() this.groupBox1.Controls.Add(this.label3); this.groupBox1.Controls.Add(this.txtName); this.groupBox1.Controls.Add(this.label2); - this.groupBox1.Controls.Add(this.label1); + this.groupBox1.Controls.Add(this.lblType); this.groupBox1.Controls.Add(this.cmbType); + this.groupBox1.Controls.Add(this.cmbNames); + this.groupBox1.Controls.Add(this.txtPIN); + this.groupBox1.Controls.Add(this.lblPIN); this.groupBox1.Location = new System.Drawing.Point(12, 12); this.groupBox1.Name = "groupBox1"; this.groupBox1.Size = new System.Drawing.Size(404, 141); @@ -70,7 +77,7 @@ private void InitializeComponent() this.bttSetName.Location = new System.Drawing.Point(260, 50); this.bttSetName.Name = "bttSetName"; this.bttSetName.Size = new System.Drawing.Size(138, 23); - this.bttSetName.TabIndex = 8; + this.bttSetName.TabIndex = 7; this.bttSetName.Text = "Set "; this.bttSetName.UseVisualStyleBackColor = true; this.bttSetName.Visible = false; @@ -82,7 +89,7 @@ private void InitializeComponent() this.txtPassword.Name = "txtPassword"; this.txtPassword.PasswordChar = '*'; this.txtPassword.Size = new System.Drawing.Size(156, 20); - this.txtPassword.TabIndex = 7; + this.txtPassword.TabIndex = 11; // // label4 // @@ -90,7 +97,7 @@ private void InitializeComponent() this.label4.Location = new System.Drawing.Point(17, 106); this.label4.Name = "label4"; this.label4.Size = new System.Drawing.Size(56, 13); - this.label4.TabIndex = 6; + this.label4.TabIndex = 10; this.label4.Text = "Password:"; // // txtIP @@ -98,7 +105,7 @@ private void InitializeComponent() this.txtIP.Location = new System.Drawing.Point(89, 76); this.txtIP.Name = "txtIP"; this.txtIP.Size = new System.Drawing.Size(126, 20); - this.txtIP.TabIndex = 5; + this.txtIP.TabIndex = 9; // // label3 // @@ -106,7 +113,7 @@ private void InitializeComponent() this.label3.Location = new System.Drawing.Point(17, 79); this.label3.Name = "label3"; this.label3.Size = new System.Drawing.Size(20, 13); - this.label3.TabIndex = 4; + this.label3.TabIndex = 8; this.label3.Text = "IP:"; // // txtName @@ -114,7 +121,7 @@ private void InitializeComponent() this.txtName.Location = new System.Drawing.Point(89, 50); this.txtName.Name = "txtName"; this.txtName.Size = new System.Drawing.Size(156, 20); - this.txtName.TabIndex = 3; + this.txtName.TabIndex = 6; // // label2 // @@ -122,17 +129,17 @@ private void InitializeComponent() this.label2.Location = new System.Drawing.Point(17, 53); this.label2.Name = "label2"; this.label2.Size = new System.Drawing.Size(38, 13); - this.label2.TabIndex = 2; + this.label2.TabIndex = 4; this.label2.Text = "Name:"; // - // label1 + // lblType // - this.label1.AutoSize = true; - this.label1.Location = new System.Drawing.Point(17, 26); - this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(34, 13); - this.label1.TabIndex = 1; - this.label1.Text = "Type:"; + this.lblType.AutoSize = true; + this.lblType.Location = new System.Drawing.Point(17, 26); + this.lblType.Name = "lblType"; + this.lblType.Size = new System.Drawing.Size(34, 13); + this.lblType.TabIndex = 0; + this.lblType.Text = "Type:"; // // cmbType // @@ -145,9 +152,23 @@ private void InitializeComponent() this.cmbType.Location = new System.Drawing.Point(89, 23); this.cmbType.Name = "cmbType"; this.cmbType.Size = new System.Drawing.Size(126, 21); - this.cmbType.TabIndex = 0; + this.cmbType.TabIndex = 2; this.cmbType.SelectedIndexChanged += new System.EventHandler(this.cmbType_SelectedIndexChanged); // + // cmbNames + // + this.cmbNames.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.cmbNames.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.cmbNames.FormattingEnabled = true; + this.cmbNames.Location = new System.Drawing.Point(89, 50); + this.cmbNames.MaxDropDownItems = 25; + this.cmbNames.Name = "cmbNames"; + this.cmbNames.Size = new System.Drawing.Size(156, 21); + this.cmbNames.TabIndex = 5; + this.cmbNames.Visible = false; + this.cmbNames.SelectedIndexChanged += new System.EventHandler(this.cmbNames_SelectedIndexChanged); + // // txtLogs // this.txtLogs.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) @@ -158,15 +179,15 @@ private void InitializeComponent() this.txtLogs.ReadOnly = true; this.txtLogs.ScrollBars = System.Windows.Forms.ScrollBars.Vertical; this.txtLogs.Size = new System.Drawing.Size(404, 85); - this.txtLogs.TabIndex = 8; + this.txtLogs.TabIndex = 1; // // bttTest // this.bttTest.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); - this.bttTest.Location = new System.Drawing.Point(10, 250); + this.bttTest.Location = new System.Drawing.Point(12, 250); this.bttTest.Name = "bttTest"; this.bttTest.Size = new System.Drawing.Size(75, 23); - this.bttTest.TabIndex = 9; + this.bttTest.TabIndex = 3; this.bttTest.Text = "&Test"; this.bttTest.UseVisualStyleBackColor = true; this.bttTest.Click += new System.EventHandler(this.bttTest_Click); @@ -177,7 +198,7 @@ private void InitializeComponent() this.bttOK.Location = new System.Drawing.Point(260, 250); this.bttOK.Name = "bttOK"; this.bttOK.Size = new System.Drawing.Size(75, 23); - this.bttOK.TabIndex = 10; + this.bttOK.TabIndex = 4; this.bttOK.Text = "&OK"; this.bttOK.UseVisualStyleBackColor = true; this.bttOK.Click += new System.EventHandler(this.bttOK_Click); @@ -189,10 +210,41 @@ private void InitializeComponent() this.bttCancel.Location = new System.Drawing.Point(341, 250); this.bttCancel.Name = "bttCancel"; this.bttCancel.Size = new System.Drawing.Size(75, 23); - this.bttCancel.TabIndex = 11; + this.bttCancel.TabIndex = 5; this.bttCancel.Text = "&Cancel"; this.bttCancel.UseVisualStyleBackColor = true; // + // bttDiscover + // + this.bttDiscover.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this.bttDiscover.Location = new System.Drawing.Point(10, 250); + this.bttDiscover.Name = "bttDiscover"; + this.bttDiscover.Size = new System.Drawing.Size(75, 23); + this.bttDiscover.TabIndex = 2; + this.bttDiscover.Text = "&Discover"; + this.bttDiscover.UseVisualStyleBackColor = true; + this.bttDiscover.Visible = false; + this.bttDiscover.Click += new System.EventHandler(this.bttTest_Click); + // + // txtPIN + // + this.txtPIN.Location = new System.Drawing.Point(89, 23); + this.txtPIN.Name = "txtPIN"; + this.txtPIN.ReadOnly = true; + this.txtPIN.Size = new System.Drawing.Size(126, 20); + this.txtPIN.TabIndex = 3; + this.txtPIN.Visible = false; + // + // lblPIN + // + this.lblPIN.AutoSize = true; + this.lblPIN.Location = new System.Drawing.Point(17, 26); + this.lblPIN.Name = "lblPIN"; + this.lblPIN.Size = new System.Drawing.Size(28, 13); + this.lblPIN.TabIndex = 1; + this.lblPIN.Text = "PIN:"; + this.lblPIN.Visible = false; + // // DeviceForm // this.AcceptButton = this.bttOK; @@ -205,6 +257,7 @@ private void InitializeComponent() this.Controls.Add(this.bttTest); this.Controls.Add(this.txtLogs); this.Controls.Add(this.groupBox1); + this.Controls.Add(this.bttDiscover); this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; this.MaximizeBox = false; this.MinimizeBox = false; @@ -229,12 +282,16 @@ private void InitializeComponent() private System.Windows.Forms.Label label3; private System.Windows.Forms.TextBox txtName; private System.Windows.Forms.Label label2; - private System.Windows.Forms.Label label1; + private System.Windows.Forms.Label lblType; private System.Windows.Forms.ComboBox cmbType; private System.Windows.Forms.TextBox txtLogs; private System.Windows.Forms.Button bttTest; private System.Windows.Forms.Button bttOK; private System.Windows.Forms.Button bttCancel; private System.Windows.Forms.Button bttSetName; + private System.Windows.Forms.ComboBox cmbNames; + private System.Windows.Forms.Button bttDiscover; + private System.Windows.Forms.Label lblPIN; + private System.Windows.Forms.TextBox txtPIN; } } \ No newline at end of file diff --git a/src_vs2012/VSNDK.Package/Options/Dialogs/DeviceForm.cs b/src_vs2012/VSNDK.Package/Options/Dialogs/DeviceForm.cs index eb7650ad..d70fb8ad 100644 --- a/src_vs2012/VSNDK.Package/Options/Dialogs/DeviceForm.cs +++ b/src_vs2012/VSNDK.Package/Options/Dialogs/DeviceForm.cs @@ -1,4 +1,5 @@ using System; +using System.Collections.Generic; using System.Windows.Forms; using RIM.VSNDK_Package.Diagnostics; using RIM.VSNDK_Package.Tools; @@ -12,6 +13,7 @@ namespace RIM.VSNDK_Package.Options.Dialogs internal partial class DeviceForm : Form { private DeviceInfoRunner _runner; + private ulong _pin; private string _loadedDeviceName; public DeviceForm(string title) @@ -55,6 +57,11 @@ public bool IsConnected private set; } + public bool IsDiscoverMode + { + get { return cmbNames.Visible; } + } + public string LoadedDeviceName { get { return _loadedDeviceName; } @@ -70,11 +77,21 @@ public string LoadedDeviceName { _loadedDeviceName = value; bttSetName.Text = "<< " + (value.Length > 14 ? value.Substring(0, 14) + "..." : value); // up to 15chars - bttSetName.Visible = true; + bttSetName.Visible = txtName.Visible; } } } + public ulong PIN + { + get { return _pin; } + private set + { + _pin = value; + txtPIN.Text = value == 0 ? string.Empty : value.ToString("X"); + } + } + #endregion public DeviceDefinition ToDevice() @@ -102,6 +119,31 @@ public void FromDevice(DeviceDefinition device) DevicePassword = device.Password; } + public void SetDiscoverMode(IEnumerable devices) + { + cmbType.Enabled = false; + txtName.Visible = false; + cmbNames.Visible = true; + bttTest.Visible = false; + bttDiscover.Visible = true; + bttOK.Enabled = false; + lblType.Visible = false; + lblPIN.Visible = true; + cmbType.Visible = false; + txtPIN.Visible = true; + + cmbNames.Items.Clear(); + cmbNames.Items.Add(new ComboBoxItem(string.Empty)); + if (devices != null) + { + foreach (var device in devices) + { + cmbNames.Items.Add(new ComboBoxItem(device.ShortName, device)); + } + } + cmbNames.SelectedIndex = 0; + } + private DialogDeviceClass GetDeviceClass(DeviceDefinitionType type, string ip) { if (type == DeviceDefinitionType.Simulator) @@ -154,6 +196,7 @@ private void bttTest_Click(object sender, EventArgs e) IsConnected = false; LoadedDeviceName = null; + PIN = 0; _runner = new DeviceInfoRunner(RunnerDefaults.ToolsDirectory, DeviceIP, DevicePassword); _runner.Dispatcher = EventDispatcher.From(this); _runner.Finished += RunnerOnFinished; @@ -172,6 +215,7 @@ private void RunnerOnFinished(object sender, ToolRunnerEventArgs e) TraceLog.WriteLine("Found device: {0} with IP: {1}", _runner.DeviceInfo.ToString(), DeviceIP); AppendLog("Device found:" + Environment.NewLine + _runner.DeviceInfo.ToLongDescription()); LoadedDeviceName = _runner.DeviceInfo != null ? _runner.DeviceInfo.Name : null; + PIN = _runner.DeviceInfo != null ? _runner.DeviceInfo.PIN : 0; IsConnected = true; } else @@ -183,6 +227,8 @@ private void RunnerOnFinished(object sender, ToolRunnerEventArgs e) _runner.Finished -= RunnerOnFinished; _runner = null; + + bttOK.Enabled = PIN > 0; } private void cmbType_SelectedIndexChanged(object sender, EventArgs e) @@ -211,6 +257,13 @@ private void bttOK_Click(object sender, EventArgs e) return; } + if (IsDiscoverMode && PIN == 0) + { + MessageBoxHelper.Show("Sorry, no PIN found yet", "Target Device", MessageBoxIcon.Error); + ActiveControl = bttDiscover; + return; + } + DialogResult = DialogResult.OK; Close(); } @@ -219,5 +272,22 @@ private void bttSetName_Click(object sender, EventArgs e) { txtName.Text = LoadedDeviceName; } + + private void cmbNames_SelectedIndexChanged(object sender, EventArgs e) + { + var item = cmbNames.SelectedItem as ComboBoxItem; + var info = item != null ? item.Tag as DeviceDefinition : null; + + if (info != null) + { + DeviceIP = info.IP; + DevicePassword = info.Password; + } + else + { + DeviceIP = string.Empty; + DevicePassword = string.Empty; + } + } } } diff --git a/src_vs2012/VSNDK.Package/Options/Dialogs/PinListForm.Designer.cs b/src_vs2012/VSNDK.Package/Options/Dialogs/PinListForm.Designer.cs new file mode 100644 index 00000000..013b97dc --- /dev/null +++ b/src_vs2012/VSNDK.Package/Options/Dialogs/PinListForm.Designer.cs @@ -0,0 +1,224 @@ +namespace RIM.VSNDK_Package.Options.Dialogs +{ + partial class PinListForm + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.bttCancel = new System.Windows.Forms.Button(); + this.bttOK = new System.Windows.Forms.Button(); + this.label1 = new System.Windows.Forms.Label(); + this.txtPIN = new System.Windows.Forms.TextBox(); + this.bttDiscover = new System.Windows.Forms.Button(); + this.groupBox1 = new System.Windows.Forms.GroupBox(); + this.bttAdd = new System.Windows.Forms.Button(); + this.listPINs = new System.Windows.Forms.ListView(); + this.label2 = new System.Windows.Forms.Label(); + this.columnPIN = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); + this.bttClear = new System.Windows.Forms.Button(); + this.bttRemove = new System.Windows.Forms.Button(); + this.groupBox1.SuspendLayout(); + this.SuspendLayout(); + // + // bttCancel + // + this.bttCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.bttCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel; + this.bttCancel.Location = new System.Drawing.Point(312, 275); + this.bttCancel.Name = "bttCancel"; + this.bttCancel.Size = new System.Drawing.Size(75, 23); + this.bttCancel.TabIndex = 2; + this.bttCancel.Text = "&Cancel"; + this.bttCancel.UseVisualStyleBackColor = true; + // + // bttOK + // + this.bttOK.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.bttOK.DialogResult = System.Windows.Forms.DialogResult.OK; + this.bttOK.Location = new System.Drawing.Point(231, 275); + this.bttOK.Name = "bttOK"; + this.bttOK.Size = new System.Drawing.Size(75, 23); + this.bttOK.TabIndex = 1; + this.bttOK.Text = "&OK"; + this.bttOK.UseVisualStyleBackColor = true; + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Location = new System.Drawing.Point(15, 22); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(28, 13); + this.label1.TabIndex = 0; + this.label1.Text = "PIN:"; + // + // txtPIN + // + this.txtPIN.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.txtPIN.Location = new System.Drawing.Point(72, 19); + this.txtPIN.Name = "txtPIN"; + this.txtPIN.Size = new System.Drawing.Size(216, 20); + this.txtPIN.TabIndex = 1; + // + // bttDiscover + // + this.bttDiscover.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.bttDiscover.Location = new System.Drawing.Point(294, 48); + this.bttDiscover.Name = "bttDiscover"; + this.bttDiscover.Size = new System.Drawing.Size(75, 23); + this.bttDiscover.TabIndex = 3; + this.bttDiscover.Text = "&Discover..."; + this.bttDiscover.UseVisualStyleBackColor = true; + this.bttDiscover.Click += new System.EventHandler(this.bttDiscover_Click); + // + // groupBox1 + // + this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.groupBox1.Controls.Add(this.bttRemove); + this.groupBox1.Controls.Add(this.bttClear); + this.groupBox1.Controls.Add(this.label2); + this.groupBox1.Controls.Add(this.listPINs); + this.groupBox1.Controls.Add(this.bttAdd); + this.groupBox1.Controls.Add(this.label1); + this.groupBox1.Controls.Add(this.bttDiscover); + this.groupBox1.Controls.Add(this.txtPIN); + this.groupBox1.Location = new System.Drawing.Point(12, 12); + this.groupBox1.Name = "groupBox1"; + this.groupBox1.Size = new System.Drawing.Size(375, 257); + this.groupBox1.TabIndex = 0; + this.groupBox1.TabStop = false; + this.groupBox1.Text = "New"; + // + // bttAdd + // + this.bttAdd.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.bttAdd.Location = new System.Drawing.Point(294, 19); + this.bttAdd.Name = "bttAdd"; + this.bttAdd.Size = new System.Drawing.Size(75, 23); + this.bttAdd.TabIndex = 2; + this.bttAdd.Text = "&Add"; + this.bttAdd.UseVisualStyleBackColor = true; + this.bttAdd.Click += new System.EventHandler(this.bttAdd_Click); + // + // listPINs + // + this.listPINs.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.listPINs.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { + this.columnPIN}); + this.listPINs.FullRowSelect = true; + this.listPINs.GridLines = true; + this.listPINs.HideSelection = false; + this.listPINs.Location = new System.Drawing.Point(72, 84); + this.listPINs.MultiSelect = false; + this.listPINs.Name = "listPINs"; + this.listPINs.Size = new System.Drawing.Size(216, 158); + this.listPINs.TabIndex = 5; + this.listPINs.UseCompatibleStateImageBehavior = false; + this.listPINs.View = System.Windows.Forms.View.Details; + this.listPINs.SelectedIndexChanged += new System.EventHandler(this.listPINs_SelectedIndexChanged); + // + // label2 + // + this.label2.AutoSize = true; + this.label2.Location = new System.Drawing.Point(17, 84); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(26, 13); + this.label2.TabIndex = 4; + this.label2.Text = "List:"; + // + // columnPIN + // + this.columnPIN.Text = "PINs"; + this.columnPIN.Width = 180; + // + // bttClear + // + this.bttClear.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.bttClear.Enabled = false; + this.bttClear.Location = new System.Drawing.Point(294, 113); + this.bttClear.Name = "bttClear"; + this.bttClear.Size = new System.Drawing.Size(75, 23); + this.bttClear.TabIndex = 7; + this.bttClear.Text = "&Clear"; + this.bttClear.UseVisualStyleBackColor = true; + this.bttClear.Click += new System.EventHandler(this.bttClear_Click); + // + // bttRemove + // + this.bttRemove.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.bttRemove.Enabled = false; + this.bttRemove.Location = new System.Drawing.Point(294, 84); + this.bttRemove.Name = "bttRemove"; + this.bttRemove.Size = new System.Drawing.Size(75, 23); + this.bttRemove.TabIndex = 6; + this.bttRemove.Text = "&Remove"; + this.bttRemove.UseVisualStyleBackColor = true; + this.bttRemove.Click += new System.EventHandler(this.bttRemove_Click); + // + // PinListForm + // + this.AcceptButton = this.bttOK; + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.CancelButton = this.bttCancel; + this.ClientSize = new System.Drawing.Size(399, 310); + this.Controls.Add(this.groupBox1); + this.Controls.Add(this.bttOK); + this.Controls.Add(this.bttCancel); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; + this.MaximizeBox = false; + this.MinimizeBox = false; + this.Name = "PinListForm"; + this.ShowIcon = false; + this.ShowInTaskbar = false; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; + this.Text = "PIN Editor"; + this.groupBox1.ResumeLayout(false); + this.groupBox1.PerformLayout(); + this.ResumeLayout(false); + + } + + #endregion + + private System.Windows.Forms.Button bttCancel; + private System.Windows.Forms.Button bttOK; + private System.Windows.Forms.Label label1; + private System.Windows.Forms.TextBox txtPIN; + private System.Windows.Forms.Button bttDiscover; + private System.Windows.Forms.GroupBox groupBox1; + private System.Windows.Forms.Button bttAdd; + private System.Windows.Forms.Label label2; + private System.Windows.Forms.ListView listPINs; + private System.Windows.Forms.ColumnHeader columnPIN; + private System.Windows.Forms.Button bttRemove; + private System.Windows.Forms.Button bttClear; + } +} \ No newline at end of file diff --git a/src_vs2012/VSNDK.Package/Options/Dialogs/PinListForm.cs b/src_vs2012/VSNDK.Package/Options/Dialogs/PinListForm.cs new file mode 100644 index 00000000..1b13f8e0 --- /dev/null +++ b/src_vs2012/VSNDK.Package/Options/Dialogs/PinListForm.cs @@ -0,0 +1,175 @@ +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Windows.Forms; +using RIM.VSNDK_Package.ViewModels; + +namespace RIM.VSNDK_Package.Options.Dialogs +{ + /// + /// Dialog for creating list of device PINs. + /// + public partial class PinListForm : Form + { + private List _pins; + + public PinListForm() + { + InitializeComponent(); + + _pins = new List(); + } + + #region Properties + + public string NewPIN + { + get { return txtPIN.Text; } + set { txtPIN.Text = value; } + } + + public ulong[] PINs + { + get { return _pins.ToArray(); } + set + { + if (value == null) + _pins = new List(); + else + _pins = new List(value); + + PopulateList(); + } + } + + internal IEnumerable OptionalDevices + { + get; + set; + } + + #endregion + + private void PopulateList() + { + listPINs.Items.Clear(); + + for (int i = 0; i < _pins.Count; i++) + listPINs.Items.Add(_pins[i].ToString("X")); + + bttClear.Enabled = _pins.Count > 0; + } + + /// + /// Adds new PIN to the collection. + /// + public int Add(ulong pin) + { + if (_pins.IndexOf(pin) < 0) + { + _pins.Insert(0, pin); + + PopulateList(); + return 1; + } + + return 0; + } + + /// + /// Adds a list of PINs to the collection. + /// + public int Add(IEnumerable pins) + { + if (pins == null) + return 0; + + int count = 0; + foreach (var p in pins) + { + if (_pins.IndexOf(p) < 0) + { + _pins.Insert(count, p); + count++; + } + } + + PopulateList(); + return count; + } + + /// + /// Adds new PINs read from specified string (can be a comma-separated list of values). + /// + public int Add(string pin) + { + if (string.IsNullOrEmpty(pin)) + return 0; + + var items = pin.Split(new[] { ' ', ',', ';', '|', '#', '*', '/', '\\' }, StringSplitOptions.RemoveEmptyEntries); + var pins = new ulong[items.Length]; + + for(int i = 0; i < items.Length; i++) + { + ulong value; + + // try to parse all or NONE! + if (!ulong.TryParse(items[i], NumberStyles.HexNumber, null, out value)) + return -1; + + pins[i] = value; + } + + // add all to the existing list: + _pins.AddRange(pins); + PopulateList(); + return pins.Length; + } + + private void bttAdd_Click(object sender, EventArgs e) + { + if (Add(NewPIN) < 0) + { + MessageBoxHelper.Show("PIN number contains errors. Please correct them and try again", "Invalid PIN value", MessageBoxButtons.OK, MessageBoxIcon.Error); + return; + } + NewPIN = string.Empty; + } + + private void bttClear_Click(object sender, EventArgs e) + { + if (MessageBoxHelper.Show("Clear the list?", "PIN List", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) + { + _pins.Clear(); + PopulateList(); + } + } + + private void listPINs_SelectedIndexChanged(object sender, EventArgs e) + { + bttRemove.Enabled = listPINs.SelectedItems.Count > 0; + } + + private void bttRemove_Click(object sender, EventArgs e) + { + if (MessageBoxHelper.Show("Remove this item?", _pins[listPINs.SelectedIndices[0]].ToString("X"), MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) + { + _pins.RemoveAt(listPINs.SelectedIndices[0]); + PopulateList(); + } + } + + private void bttDiscover_Click(object sender, EventArgs e) + { + var form = new DeviceForm("Discover Device PIN"); + form.SetDiscoverMode(OptionalDevices); + + if (form.ShowDialog() == DialogResult.OK && form.PIN != 0) + { + Add(form.PIN); + } + + ActiveControl = txtPIN; + } + } +} diff --git a/src_vs2012/VSNDK.Package/Options/Dialogs/PinListForm.resx b/src_vs2012/VSNDK.Package/Options/Dialogs/PinListForm.resx new file mode 100644 index 00000000..29dcb1b3 --- /dev/null +++ b/src_vs2012/VSNDK.Package/Options/Dialogs/PinListForm.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/src_vs2012/VSNDK.Package/Options/TargetsOptionControl.cs b/src_vs2012/VSNDK.Package/Options/TargetsOptionControl.cs index 51a5b039..b88c97a2 100644 --- a/src_vs2012/VSNDK.Package/Options/TargetsOptionControl.cs +++ b/src_vs2012/VSNDK.Package/Options/TargetsOptionControl.cs @@ -127,11 +127,9 @@ private void bttDebugToken_Click(object sender, System.EventArgs e) var form = new DebugTokenDeploymentForm(); form.SetVM(_vm, device); + form.AskOnStartup = false; - if (form.ShowDialog() == DialogResult.OK) - { - - } + form.ShowDialog(); } public void OnApply() diff --git a/src_vs2012/VSNDK.Package/VSNDK.Package.csproj b/src_vs2012/VSNDK.Package/VSNDK.Package.csproj index ea2d93ae..e6883ed5 100644 --- a/src_vs2012/VSNDK.Package/VSNDK.Package.csproj +++ b/src_vs2012/VSNDK.Package/VSNDK.Package.csproj @@ -308,6 +308,12 @@ PasswordForm.cs + + Form + + + PinListForm.cs + UserControl @@ -521,6 +527,9 @@ PasswordForm.cs + + PinListForm.cs + GeneralOptionControl.cs From 08b3ea17b2b33a95719420ede12962513cfbe4eb Mon Sep 17 00:00:00 2001 From: Pawel Hofman Date: Thu, 15 May 2014 01:52:30 +0200 Subject: [PATCH 067/851] Added confirmation question, before removing token --- .../Options/Dialogs/DebugTokenDeploymentForm.Designer.cs | 2 +- .../VSNDK.Package/Options/Dialogs/DebugTokenDeploymentForm.cs | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src_vs2012/VSNDK.Package/Options/Dialogs/DebugTokenDeploymentForm.Designer.cs b/src_vs2012/VSNDK.Package/Options/Dialogs/DebugTokenDeploymentForm.Designer.cs index ce12cb0e..042b26d3 100644 --- a/src_vs2012/VSNDK.Package/Options/Dialogs/DebugTokenDeploymentForm.Designer.cs +++ b/src_vs2012/VSNDK.Package/Options/Dialogs/DebugTokenDeploymentForm.Designer.cs @@ -95,7 +95,7 @@ private void InitializeComponent() this.bttTokenBrowse.Name = "bttTokenBrowse"; this.bttTokenBrowse.Size = new System.Drawing.Size(75, 23); this.bttTokenBrowse.TabIndex = 2; - this.bttTokenBrowse.Text = "&Browse..."; + this.bttTokenBrowse.Text = "&Open..."; this.bttTokenBrowse.UseVisualStyleBackColor = true; this.bttTokenBrowse.Click += new System.EventHandler(this.bttTokenBrowse_Click); // diff --git a/src_vs2012/VSNDK.Package/Options/Dialogs/DebugTokenDeploymentForm.cs b/src_vs2012/VSNDK.Package/Options/Dialogs/DebugTokenDeploymentForm.cs index c213d5d8..4dbfa20d 100644 --- a/src_vs2012/VSNDK.Package/Options/Dialogs/DebugTokenDeploymentForm.cs +++ b/src_vs2012/VSNDK.Package/Options/Dialogs/DebugTokenDeploymentForm.cs @@ -424,6 +424,9 @@ private void RemoveDebugToken() if (IsRemovingToken) return; + if (MessageBoxHelper.Show("Remove debug-token from that device?", _device.ShortName, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No) + return; + ClearDeviceLogs(); if (_device == null) { From 370d9412f1a70f979af6e764ab916d88f2ce1787 Mon Sep 17 00:00:00 2001 From: Pawel Hofman Date: Thu, 15 May 2014 01:52:56 +0200 Subject: [PATCH 068/851] Added support to settings reset --- .../Options/ApiLevelOptionControl.cs | 8 +++++++- .../VSNDK.Package/Options/ApiLevelOptionPage.cs | 9 ++++++++- .../VSNDK.Package/Options/TargetsOptionControl.cs | 15 ++++++++++++--- .../VSNDK.Package/Options/TargetsOptionPage.cs | 9 ++++++++- 4 files changed, 35 insertions(+), 6 deletions(-) diff --git a/src_vs2012/VSNDK.Package/Options/ApiLevelOptionControl.cs b/src_vs2012/VSNDK.Package/Options/ApiLevelOptionControl.cs index 9cf08129..b69b91b8 100644 --- a/src_vs2012/VSNDK.Package/Options/ApiLevelOptionControl.cs +++ b/src_vs2012/VSNDK.Package/Options/ApiLevelOptionControl.cs @@ -9,7 +9,7 @@ namespace RIM.VSNDK_Package.Options { public partial class ApiLevelOptionControl : UserControl { - private readonly ApiLevelOptionViewModel _vm = new ApiLevelOptionViewModel(); + private ApiLevelOptionViewModel _vm = new ApiLevelOptionViewModel(); public ApiLevelOptionControl() { @@ -49,6 +49,12 @@ internal void OnApply() _vm.ActiveNDK = cmbNDKs.SelectedItem as NdkInfo; } + public void OnClosed() + { + _vm = new ApiLevelOptionViewModel(); + PopulateNDKs(); + } + private void bttAddLocal_Click(object sender, EventArgs e) { var form = new AddLocalNdkForm(); diff --git a/src_vs2012/VSNDK.Package/Options/ApiLevelOptionPage.cs b/src_vs2012/VSNDK.Package/Options/ApiLevelOptionPage.cs index 2f5ab78f..82f07935 100644 --- a/src_vs2012/VSNDK.Package/Options/ApiLevelOptionPage.cs +++ b/src_vs2012/VSNDK.Package/Options/ApiLevelOptionPage.cs @@ -1,4 +1,5 @@ -using System.ComponentModel; +using System; +using System.ComponentModel; using System.Drawing; using System.Windows.Forms; using System.Runtime.InteropServices; @@ -56,5 +57,11 @@ protected override void OnApply(PageApplyEventArgs e) } } } + + protected override void OnClosed(EventArgs e) + { + base.OnClosed(e); + Control.OnClosed(); + } } } diff --git a/src_vs2012/VSNDK.Package/Options/TargetsOptionControl.cs b/src_vs2012/VSNDK.Package/Options/TargetsOptionControl.cs index b88c97a2..aa2b5181 100644 --- a/src_vs2012/VSNDK.Package/Options/TargetsOptionControl.cs +++ b/src_vs2012/VSNDK.Package/Options/TargetsOptionControl.cs @@ -1,4 +1,5 @@ -using System.Diagnostics; +using System; +using System.Diagnostics; using System.Windows.Forms; using RIM.VSNDK_Package.Options.Dialogs; using RIM.VSNDK_Package.ViewModels; @@ -7,7 +8,7 @@ namespace RIM.VSNDK_Package.Options { public partial class TargetsOptionControl : UserControl { - private readonly TargetsOptionViewModel _vm = new TargetsOptionViewModel(); + private TargetsOptionViewModel _vm = new TargetsOptionViewModel(); public TargetsOptionControl() { @@ -110,11 +111,13 @@ private void bttRemove_Click(object sender, System.EventArgs e) { var device = SelectedDevice; - if (MessageBoxHelper.Show(device.Type == DeviceDefinitionType.Device ? "Remove the device?" : "Remove the simulator?", + if (device != null + && MessageBoxHelper.Show(device.Type == DeviceDefinitionType.Device ? "Remove the device?" : "Remove the simulator?", device.ToString(), MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { _vm.Remove(device); PopulateDevices(); + listTargets_SelectedIndexChanged(null, EventArgs.Empty); } } @@ -136,5 +139,11 @@ public void OnApply() { _vm.Apply(); } + + public void OnReset() + { + _vm = new TargetsOptionViewModel(); + PopulateDevices(); + } } } diff --git a/src_vs2012/VSNDK.Package/Options/TargetsOptionPage.cs b/src_vs2012/VSNDK.Package/Options/TargetsOptionPage.cs index c38fcb3a..1459ee23 100644 --- a/src_vs2012/VSNDK.Package/Options/TargetsOptionPage.cs +++ b/src_vs2012/VSNDK.Package/Options/TargetsOptionPage.cs @@ -1,4 +1,5 @@ -using System.ComponentModel; +using System; +using System.ComponentModel; using System.Drawing; using System.Windows.Forms; using System.Runtime.InteropServices; @@ -45,5 +46,11 @@ protected override void OnApply(PageApplyEventArgs e) { Control.OnApply(); } + + protected override void OnClosed(EventArgs e) + { + base.OnClosed(e); + Control.OnReset(); + } } } From 2d4ac2224a9de715f5e3e877e6ded2ccc6e21ef3 Mon Sep 17 00:00:00 2001 From: Pawel Hofman Date: Thu, 15 May 2014 14:46:30 +0200 Subject: [PATCH 069/851] Fixed invalid settings deletion from registry --- .../VSNDK.Package/ViewModels/DeveloperDefinition.cs | 4 ++-- .../VSNDK.Package/ViewModels/DeviceDefinition.cs | 11 ++++------- src_vs2012/VSNDK.Package/ViewModels/NdkDefinition.cs | 6 +++--- 3 files changed, 9 insertions(+), 12 deletions(-) diff --git a/src_vs2012/VSNDK.Package/ViewModels/DeveloperDefinition.cs b/src_vs2012/VSNDK.Package/ViewModels/DeveloperDefinition.cs index 0b357985..b61509d5 100644 --- a/src_vs2012/VSNDK.Package/ViewModels/DeveloperDefinition.cs +++ b/src_vs2012/VSNDK.Package/ViewModels/DeveloperDefinition.cs @@ -119,11 +119,11 @@ public static void DeletePassword() try { - settings = registry.OpenSubKey(RunnerDefaults.RegistryPath); + settings = registry.CreateSubKey(RunnerDefaults.RegistryPath); if (settings == null) return; - settings.DeleteSubKey(FieldCskPassword); + settings.DeleteValue(FieldCskPassword, false); } finally { diff --git a/src_vs2012/VSNDK.Package/ViewModels/DeviceDefinition.cs b/src_vs2012/VSNDK.Package/ViewModels/DeviceDefinition.cs index 56001cc0..d4435b4b 100644 --- a/src_vs2012/VSNDK.Package/ViewModels/DeviceDefinition.cs +++ b/src_vs2012/VSNDK.Package/ViewModels/DeviceDefinition.cs @@ -235,16 +235,13 @@ public static void Delete(DeviceDefinitionType type) try { - settings = registry.OpenSubKey(RunnerDefaults.RegistryPath); + settings = registry.CreateSubKey(RunnerDefaults.RegistryPath); if (settings == null) return; - settings.DeleteSubKey(type == DeviceDefinitionType.Device ? FieldDeviceName : FieldSimulatorName); - settings.DeleteSubKey(type == DeviceDefinitionType.Device ? FieldDeviceIP : FieldSimulatorIP); - settings.DeleteSubKey(type == DeviceDefinitionType.Device ? FieldDevicePassword : FieldSimulatorPassword); - } - catch (UnauthorizedAccessException) - { + settings.DeleteValue(type == DeviceDefinitionType.Device ? FieldDeviceName : FieldSimulatorName, false); + settings.DeleteValue(type == DeviceDefinitionType.Device ? FieldDeviceIP : FieldSimulatorIP, false); + settings.DeleteValue(type == DeviceDefinitionType.Device ? FieldDevicePassword : FieldSimulatorPassword, false); } finally { diff --git a/src_vs2012/VSNDK.Package/ViewModels/NdkDefinition.cs b/src_vs2012/VSNDK.Package/ViewModels/NdkDefinition.cs index dc724d68..4f843891 100644 --- a/src_vs2012/VSNDK.Package/ViewModels/NdkDefinition.cs +++ b/src_vs2012/VSNDK.Package/ViewModels/NdkDefinition.cs @@ -103,12 +103,12 @@ public static void Delete() try { - settings = registry.OpenSubKey(RunnerDefaults.RegistryPath); + settings = registry.CreateSubKey(RunnerDefaults.RegistryPath); if (settings == null) return; - settings.DeleteSubKey(FieldHostPath); - settings.DeleteSubKey(FieldTargetPath); + settings.DeleteValue(FieldHostPath, false); + settings.DeleteValue(FieldTargetPath, false); } finally { From c343bc29b0ca5f3828d1f96ccb7e74fc53528492 Mon Sep 17 00:00:00 2001 From: Pawel Hofman Date: Thu, 15 May 2014 14:50:21 +0200 Subject: [PATCH 070/851] Some UI cleanup To have the ViewModels recreated less frequently and proper controls set as active, when particular error happens. Also updated the Visual Studio menu adding underline for some letters. --- .../Options/ApiLevelOptionControl.cs | 3 +- .../VSNDK.Package/Options/DialogHelper.cs | 36 ++++++++++++++++++- .../Options/Dialogs/DeviceForm.cs | 19 ++++++++++ .../Options/Dialogs/PasswordForm.cs | 9 +++++ .../Options/GeneralOptionControl.cs | 8 ++++- .../Options/TargetsOptionControl.cs | 9 +++-- src_vs2012/VSNDK.Package/VSNDK.Package.vsct | 9 +++-- .../ViewModels/TargetsOptionViewModel.cs | 11 ++++++ 8 files changed, 92 insertions(+), 12 deletions(-) diff --git a/src_vs2012/VSNDK.Package/Options/ApiLevelOptionControl.cs b/src_vs2012/VSNDK.Package/Options/ApiLevelOptionControl.cs index b69b91b8..fc91a4d0 100644 --- a/src_vs2012/VSNDK.Package/Options/ApiLevelOptionControl.cs +++ b/src_vs2012/VSNDK.Package/Options/ApiLevelOptionControl.cs @@ -9,7 +9,7 @@ namespace RIM.VSNDK_Package.Options { public partial class ApiLevelOptionControl : UserControl { - private ApiLevelOptionViewModel _vm = new ApiLevelOptionViewModel(); + private readonly ApiLevelOptionViewModel _vm = new ApiLevelOptionViewModel(); public ApiLevelOptionControl() { @@ -51,7 +51,6 @@ internal void OnApply() public void OnClosed() { - _vm = new ApiLevelOptionViewModel(); PopulateNDKs(); } diff --git a/src_vs2012/VSNDK.Package/Options/DialogHelper.cs b/src_vs2012/VSNDK.Package/Options/DialogHelper.cs index ebc0e150..58b6142c 100644 --- a/src_vs2012/VSNDK.Package/Options/DialogHelper.cs +++ b/src_vs2012/VSNDK.Package/Options/DialogHelper.cs @@ -1,4 +1,5 @@ -using System.Windows.Forms; +using System.Diagnostics; +using System.Windows.Forms; namespace RIM.VSNDK_Package.Options { @@ -54,5 +55,38 @@ public static SaveFileDialog SaveBarFile(string title, string startupPath, strin return saveFile; } + + /// + /// Opens Windows Explorer window with specified path. + /// + public static void StartExplorer(string path) + { + if (string.IsNullOrEmpty(path)) + return; + + Process.Start("Explorer.exe", "/e,\"" + path + "\""); + } + + /// + /// Opens Windows Explorer window with specified file selected. + /// + public static void StartExplorerForFile(string path) + { + if (string.IsNullOrEmpty(path)) + return; + + Process.Start("Explorer.exe", "/select,\"" + path + "\""); + } + + /// + /// Opens a default web-browser with specified URL. + /// + public static void StartURL(string url) + { + if (string.IsNullOrEmpty(url) || !(url.StartsWith("http://") || url.StartsWith("https://"))) + return; + + Process.Start(url); + } } } diff --git a/src_vs2012/VSNDK.Package/Options/Dialogs/DeviceForm.cs b/src_vs2012/VSNDK.Package/Options/Dialogs/DeviceForm.cs index d70fb8ad..1a909790 100644 --- a/src_vs2012/VSNDK.Package/Options/Dialogs/DeviceForm.cs +++ b/src_vs2012/VSNDK.Package/Options/Dialogs/DeviceForm.cs @@ -82,6 +82,22 @@ public string LoadedDeviceName } } + private DeviceDefinition SelectedDevice + { + get + { + if (cmbNames.Enabled && cmbNames.Visible) + { + var item = cmbNames.SelectedItem as ComboBoxItem; + var device = item != null ? item.Tag as DeviceDefinition : null; + + return device; + } + + return null; + } + } + public ulong PIN { get { return _pin; } @@ -142,6 +158,9 @@ public void SetDiscoverMode(IEnumerable devices) } } cmbNames.SelectedIndex = 0; + cmbNames.Enabled = cmbNames.Items.Count > 1; + + ActiveControl = txtIP; } private DialogDeviceClass GetDeviceClass(DeviceDefinitionType type, string ip) diff --git a/src_vs2012/VSNDK.Package/Options/Dialogs/PasswordForm.cs b/src_vs2012/VSNDK.Package/Options/Dialogs/PasswordForm.cs index dda554cd..26fa05f8 100644 --- a/src_vs2012/VSNDK.Package/Options/Dialogs/PasswordForm.cs +++ b/src_vs2012/VSNDK.Package/Options/Dialogs/PasswordForm.cs @@ -24,6 +24,15 @@ public bool ShouldRemember set { chkRemember.Checked = value; } } + /// + /// Shows the option to indicate, if password should be remembered or not. + /// + public bool ShowRemember + { + get { return chkRemember.Visible; } + set { chkRemember.Visible = value; } + } + #endregion private void bttOK_Click(object sender, EventArgs e) diff --git a/src_vs2012/VSNDK.Package/Options/GeneralOptionControl.cs b/src_vs2012/VSNDK.Package/Options/GeneralOptionControl.cs index 52d31ca4..c86fcd65 100644 --- a/src_vs2012/VSNDK.Package/Options/GeneralOptionControl.cs +++ b/src_vs2012/VSNDK.Package/Options/GeneralOptionControl.cs @@ -29,6 +29,12 @@ public string ToolsPath set { txtToolsPath.Text = value; } } + public string ProfilePath + { + get { return txtProfilePath.Text; } + set { txtProfilePath.Text = value; } + } + #endregion private void bttNdkBrowse_Click(object sender, System.EventArgs e) @@ -43,7 +49,7 @@ private void bttToolsBrowse_Click(object sender, System.EventArgs e) private void bttOpenProfile_Click(object sender, System.EventArgs e) { - Process.Start("Explorer.exe", "/e,\"" + txtProfilePath.Text + "\""); + DialogHelper.StartExplorer(ProfilePath); } } } diff --git a/src_vs2012/VSNDK.Package/Options/TargetsOptionControl.cs b/src_vs2012/VSNDK.Package/Options/TargetsOptionControl.cs index aa2b5181..f8eb88fe 100644 --- a/src_vs2012/VSNDK.Package/Options/TargetsOptionControl.cs +++ b/src_vs2012/VSNDK.Package/Options/TargetsOptionControl.cs @@ -8,7 +8,7 @@ namespace RIM.VSNDK_Package.Options { public partial class TargetsOptionControl : UserControl { - private TargetsOptionViewModel _vm = new TargetsOptionViewModel(); + private readonly TargetsOptionViewModel _vm = new TargetsOptionViewModel(); public TargetsOptionControl() { @@ -53,7 +53,7 @@ private void PopulateDevices() private void lnkMoreInfo_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { - Process.Start("http://developer.blackberry.com/native/documentation/cascades/getting_started/setting_up.html"); + DialogHelper.StartURL("http://developer.blackberry.com/native/documentation/cascades/getting_started/setting_up.html"); } private void listTargets_SelectedIndexChanged(object sender, System.EventArgs e) @@ -133,6 +133,9 @@ private void bttDebugToken_Click(object sender, System.EventArgs e) form.AskOnStartup = false; form.ShowDialog(); + + // refresh the list, as it's possible to add new device from debug-token deployment form: + PopulateDevices(); } public void OnApply() @@ -142,7 +145,7 @@ public void OnApply() public void OnReset() { - _vm = new TargetsOptionViewModel(); + _vm.Reset(); PopulateDevices(); } } diff --git a/src_vs2012/VSNDK.Package/VSNDK.Package.vsct b/src_vs2012/VSNDK.Package/VSNDK.Package.vsct index a686d588..3ab15ba6 100644 --- a/src_vs2012/VSNDK.Package/VSNDK.Package.vsct +++ b/src_vs2012/VSNDK.Package/VSNDK.Package.vsct @@ -48,8 +48,7 @@ - BlackBerry - BlackBerry + &BlackBerry @@ -57,7 +56,7 @@ - Targets + &Targets @@ -126,7 +125,7 @@ @@ -159,7 +158,7 @@ diff --git a/src_vs2012/VSNDK.Package/ViewModels/TargetsOptionViewModel.cs b/src_vs2012/VSNDK.Package/ViewModels/TargetsOptionViewModel.cs index a85cb427..4844a72c 100644 --- a/src_vs2012/VSNDK.Package/ViewModels/TargetsOptionViewModel.cs +++ b/src_vs2012/VSNDK.Package/ViewModels/TargetsOptionViewModel.cs @@ -229,5 +229,16 @@ public void Apply() PackageViewModel.Instance.ActiveDevice = _activeDevice; PackageViewModel.Instance.ActiveSimulator = _activeSimulator; } + + /// + /// User cancelled settings. + /// + public void Reset() + { + _devices = null; + _activeDevice = null; + _activeSimulator = null; + _details = null; + } } } From a1ec5b13edc771252845884f9f20939892703091 Mon Sep 17 00:00:00 2001 From: Pawel Hofman Date: Thu, 15 May 2014 14:53:07 +0200 Subject: [PATCH 071/851] Added first draft of Signing options dialog --- .../Options/SigningOptionControl.Designer.cs | 220 +++++++++++++++++- .../Options/SigningOptionControl.cs | 103 +++++++- .../Options/SigningOptionControl.resx | 3 + .../Options/SigningOptionPage.cs | 5 + src_vs2012/VSNDK.Package/VSNDK.Package.csproj | 1 + .../ViewModels/DeveloperDefinition.cs | 106 +++++++-- .../ViewModels/SigningOptionViewModel.cs | 19 ++ 7 files changed, 432 insertions(+), 25 deletions(-) create mode 100644 src_vs2012/VSNDK.Package/ViewModels/SigningOptionViewModel.cs diff --git a/src_vs2012/VSNDK.Package/Options/SigningOptionControl.Designer.cs b/src_vs2012/VSNDK.Package/Options/SigningOptionControl.Designer.cs index 425de4c5..89d10848 100644 --- a/src_vs2012/VSNDK.Package/Options/SigningOptionControl.Designer.cs +++ b/src_vs2012/VSNDK.Package/Options/SigningOptionControl.Designer.cs @@ -28,18 +28,236 @@ protected override void Dispose(bool disposing) /// private void InitializeComponent() { + System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(SigningOptionControl)); + this.groupBox1 = new System.Windows.Forms.GroupBox(); + this.bttUnregister = new System.Windows.Forms.Button(); + this.bttRegister = new System.Windows.Forms.Button(); + this.bttDeletePassword = new System.Windows.Forms.Button(); + this.lblMore = new System.Windows.Forms.LinkLabel(); + this.label1 = new System.Windows.Forms.Label(); + this.label2 = new System.Windows.Forms.Label(); + this.label3 = new System.Windows.Forms.Label(); + this.txtCertPath = new System.Windows.Forms.TextBox(); + this.txtAuthor = new System.Windows.Forms.TextBox(); + this.groupBox2 = new System.Windows.Forms.GroupBox(); + this.bttBackup = new System.Windows.Forms.Button(); + this.bttRestore = new System.Windows.Forms.Button(); + this.bttNavigate = new System.Windows.Forms.Button(); + this.label4 = new System.Windows.Forms.Label(); + this.bttRefresh = new System.Windows.Forms.Button(); + this.groupBox1.SuspendLayout(); + this.groupBox2.SuspendLayout(); this.SuspendLayout(); // + // groupBox1 + // + this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.groupBox1.Controls.Add(this.bttUnregister); + this.groupBox1.Controls.Add(this.bttRegister); + this.groupBox1.Controls.Add(this.bttDeletePassword); + this.groupBox1.Controls.Add(this.lblMore); + this.groupBox1.Controls.Add(this.label1); + this.groupBox1.Location = new System.Drawing.Point(3, 3); + this.groupBox1.Name = "groupBox1"; + this.groupBox1.Size = new System.Drawing.Size(396, 103); + this.groupBox1.TabIndex = 0; + this.groupBox1.TabStop = false; + this.groupBox1.Text = "BlackBerry Signing Authority"; + // + // bttUnregister + // + this.bttUnregister.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this.bttUnregister.Location = new System.Drawing.Point(90, 70); + this.bttUnregister.Name = "bttUnregister"; + this.bttUnregister.Size = new System.Drawing.Size(75, 23); + this.bttUnregister.TabIndex = 3; + this.bttUnregister.Text = "&Unregister"; + this.bttUnregister.UseVisualStyleBackColor = true; + // + // bttRegister + // + this.bttRegister.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this.bttRegister.Location = new System.Drawing.Point(9, 70); + this.bttRegister.Name = "bttRegister"; + this.bttRegister.Size = new System.Drawing.Size(75, 23); + this.bttRegister.TabIndex = 2; + this.bttRegister.Text = "&Register"; + this.bttRegister.UseVisualStyleBackColor = true; + // + // bttDeletePassword + // + this.bttDeletePassword.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.bttDeletePassword.Location = new System.Drawing.Point(264, 70); + this.bttDeletePassword.Name = "bttDeletePassword"; + this.bttDeletePassword.Size = new System.Drawing.Size(126, 23); + this.bttDeletePassword.TabIndex = 4; + this.bttDeletePassword.Text = "Delete password"; + this.bttDeletePassword.UseVisualStyleBackColor = true; + this.bttDeletePassword.Click += new System.EventHandler(this.bttDeletePassword_Click); + // + // lblMore + // + this.lblMore.AutoSize = true; + this.lblMore.Location = new System.Drawing.Point(6, 48); + this.lblMore.Name = "lblMore"; + this.lblMore.Size = new System.Drawing.Size(60, 13); + this.lblMore.TabIndex = 1; + this.lblMore.TabStop = true; + this.lblMore.Text = "More info..."; + this.lblMore.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.lblMore_LinkClicked); + // + // label1 + // + this.label1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.label1.Location = new System.Drawing.Point(6, 20); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(384, 32); + this.label1.TabIndex = 0; + this.label1.Text = "You must register with BlackBerry in order to sign applications and create debug " + + "tokens for your device."; + // + // label2 + // + this.label2.AutoSize = true; + this.label2.Location = new System.Drawing.Point(6, 22); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(32, 13); + this.label2.TabIndex = 0; + this.label2.Text = "Path:"; + // + // label3 + // + this.label3.AutoSize = true; + this.label3.Location = new System.Drawing.Point(6, 48); + this.label3.Name = "label3"; + this.label3.Size = new System.Drawing.Size(41, 13); + this.label3.TabIndex = 3; + this.label3.Text = "Author:"; + // + // txtCertPath + // + this.txtCertPath.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.txtCertPath.Location = new System.Drawing.Point(90, 19); + this.txtCertPath.Name = "txtCertPath"; + this.txtCertPath.ReadOnly = true; + this.txtCertPath.Size = new System.Drawing.Size(219, 20); + this.txtCertPath.TabIndex = 1; + // + // txtAuthor + // + this.txtAuthor.Location = new System.Drawing.Point(90, 45); + this.txtAuthor.Name = "txtAuthor"; + this.txtAuthor.ReadOnly = true; + this.txtAuthor.Size = new System.Drawing.Size(171, 20); + this.txtAuthor.TabIndex = 4; + // + // groupBox2 + // + this.groupBox2.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.groupBox2.Controls.Add(this.bttRefresh); + this.groupBox2.Controls.Add(this.bttBackup); + this.groupBox2.Controls.Add(this.bttRestore); + this.groupBox2.Controls.Add(this.bttNavigate); + this.groupBox2.Controls.Add(this.txtAuthor); + this.groupBox2.Controls.Add(this.txtCertPath); + this.groupBox2.Controls.Add(this.label2); + this.groupBox2.Controls.Add(this.label3); + this.groupBox2.Controls.Add(this.label4); + this.groupBox2.Location = new System.Drawing.Point(3, 112); + this.groupBox2.Name = "groupBox2"; + this.groupBox2.Size = new System.Drawing.Size(396, 183); + this.groupBox2.TabIndex = 1; + this.groupBox2.TabStop = false; + this.groupBox2.Text = "Developer Certificate:"; + // + // bttBackup + // + this.bttBackup.Location = new System.Drawing.Point(9, 144); + this.bttBackup.Name = "bttBackup"; + this.bttBackup.Size = new System.Drawing.Size(75, 23); + this.bttBackup.TabIndex = 6; + this.bttBackup.Text = "&Backup..."; + this.bttBackup.UseVisualStyleBackColor = true; + // + // bttRestore + // + this.bttRestore.Location = new System.Drawing.Point(90, 144); + this.bttRestore.Name = "bttRestore"; + this.bttRestore.Size = new System.Drawing.Size(75, 23); + this.bttRestore.TabIndex = 7; + this.bttRestore.Text = "R&estore..."; + this.bttRestore.UseVisualStyleBackColor = true; + // + // bttNavigate + // + this.bttNavigate.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.bttNavigate.Location = new System.Drawing.Point(315, 19); + this.bttNavigate.Name = "bttNavigate"; + this.bttNavigate.Size = new System.Drawing.Size(75, 23); + this.bttNavigate.TabIndex = 2; + this.bttNavigate.Text = "&Navigate..."; + this.bttNavigate.UseVisualStyleBackColor = true; + this.bttNavigate.Click += new System.EventHandler(this.bttNavigate_Click); + // + // label4 + // + this.label4.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.label4.Location = new System.Drawing.Point(6, 72); + this.label4.Name = "label4"; + this.label4.Size = new System.Drawing.Size(384, 73); + this.label4.TabIndex = 5; + this.label4.Text = resources.GetString("label4.Text"); + // + // bttRefresh + // + this.bttRefresh.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.bttRefresh.Location = new System.Drawing.Point(315, 46); + this.bttRefresh.Name = "bttRefresh"; + this.bttRefresh.Size = new System.Drawing.Size(75, 23); + this.bttRefresh.TabIndex = 8; + this.bttRefresh.Text = "&Refresh..."; + this.bttRefresh.UseVisualStyleBackColor = true; + this.bttRefresh.Click += new System.EventHandler(this.bttRefresh_Click); + // // SigningOptionControl // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.Controls.Add(this.groupBox2); + this.Controls.Add(this.groupBox1); this.Name = "SigningOptionControl"; - this.Size = new System.Drawing.Size(287, 185); + this.Size = new System.Drawing.Size(402, 298); + this.groupBox1.ResumeLayout(false); + this.groupBox1.PerformLayout(); + this.groupBox2.ResumeLayout(false); + this.groupBox2.PerformLayout(); this.ResumeLayout(false); } #endregion + + private System.Windows.Forms.GroupBox groupBox1; + private System.Windows.Forms.LinkLabel lblMore; + private System.Windows.Forms.Label label1; + private System.Windows.Forms.TextBox txtAuthor; + private System.Windows.Forms.TextBox txtCertPath; + private System.Windows.Forms.Label label3; + private System.Windows.Forms.Label label2; + private System.Windows.Forms.Button bttUnregister; + private System.Windows.Forms.Button bttRegister; + private System.Windows.Forms.GroupBox groupBox2; + private System.Windows.Forms.Button bttDeletePassword; + private System.Windows.Forms.Button bttNavigate; + private System.Windows.Forms.Label label4; + private System.Windows.Forms.Button bttBackup; + private System.Windows.Forms.Button bttRestore; + private System.Windows.Forms.Button bttRefresh; } } diff --git a/src_vs2012/VSNDK.Package/Options/SigningOptionControl.cs b/src_vs2012/VSNDK.Package/Options/SigningOptionControl.cs index 07b46dbf..f688f2c0 100644 --- a/src_vs2012/VSNDK.Package/Options/SigningOptionControl.cs +++ b/src_vs2012/VSNDK.Package/Options/SigningOptionControl.cs @@ -1,20 +1,109 @@ using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Drawing; -using System.Data; -using System.Linq; -using System.Text; -using System.Threading.Tasks; +using System.Diagnostics; +using System.IO; using System.Windows.Forms; +using RIM.VSNDK_Package.Options.Dialogs; +using RIM.VSNDK_Package.ViewModels; namespace RIM.VSNDK_Package.Options { public partial class SigningOptionControl : UserControl { + private readonly SigningOptionViewModel _vm = new SigningOptionViewModel(); + public SigningOptionControl() { InitializeComponent(); + UpdateUI(); + } + + #region Properties + + public string CertificatePath + { + get { return txtCertPath.Text; } + set { txtCertPath.Text = value; } + } + + public string Author + { + get { return txtAuthor.Text; } + set { txtAuthor.Text = value; } + } + + #endregion + + private void UpdateUI() + { + CertificatePath = _vm.Developer.CertificateFileName; + Author = _vm.Developer.Name; + + bttRegister.Enabled = !_vm.Developer.IsRegistered; + bttUnregister.Enabled = !bttRegister.Enabled; + bttBackup.Enabled = bttUnregister.Enabled; + + bttNavigate.Enabled = !string.IsNullOrEmpty(CertificatePath); + bttDeletePassword.Enabled = _vm.Developer.IsPasswordSaved; + bttRefresh.Enabled = bttNavigate.Enabled; + } + + /// + /// Control has become visible again, when user navigated over Settings. + /// + public void OnActivate() + { + UpdateUI(); + } + + private void lblMore_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) + { + DialogHelper.StartURL("http://www.blackberry.com/go/codesigning/"); + } + + private void bttNavigate_Click(object sender, EventArgs e) + { + if (string.IsNullOrEmpty(CertificatePath)) + return; + + DialogHelper.StartExplorerForFile(CertificatePath); + } + + private void bttDeletePassword_Click(object sender, EventArgs e) + { + if (MessageBoxHelper.Show("Delete stored password?", "BBID Token CSK Password", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No) + return; + + _vm.Developer.DeleteCskPassword(); + UpdateUI(); + } + + private void bttRefresh_Click(object sender, EventArgs e) + { + // try to reload info with cached password: + if (_vm.Developer.HasPassword) + { + Author = _vm.Developer.UpdateName(null); + UpdateUI(); + + if (!string.IsNullOrEmpty(Author)) + return; + } + + // if it failed, ask for new password: + var form = new PasswordForm(); + if (form.ShowDialog() == DialogResult.Cancel) + return; + + _vm.Developer.UpdatePassword(form.Password, form.ShouldRemember); + + // try again to reload data from certificate: + Author = _vm.Developer.UpdateName(null); + UpdateUI(); + + if (string.IsNullOrEmpty(Author)) + { + MessageBoxHelper.Show("Unable to load info about author", "Invalid password or certificate file", MessageBoxButtons.OK, MessageBoxIcon.Warning); + } } } } diff --git a/src_vs2012/VSNDK.Package/Options/SigningOptionControl.resx b/src_vs2012/VSNDK.Package/Options/SigningOptionControl.resx index 29dcb1b3..5104a117 100644 --- a/src_vs2012/VSNDK.Package/Options/SigningOptionControl.resx +++ b/src_vs2012/VSNDK.Package/Options/SigningOptionControl.resx @@ -117,4 +117,7 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + If you lose your signing keys, or forget your password, you will be required to re-register with BlackBerry. After re-registration, new versions of your applications will appear as new applications, and will not have access to shared data from previous versions. Exporting your signing keys will also allow you to import them on multiple computers and sign from any of them. + \ No newline at end of file diff --git a/src_vs2012/VSNDK.Package/Options/SigningOptionPage.cs b/src_vs2012/VSNDK.Package/Options/SigningOptionPage.cs index c32973b9..e113dde3 100644 --- a/src_vs2012/VSNDK.Package/Options/SigningOptionPage.cs +++ b/src_vs2012/VSNDK.Package/Options/SigningOptionPage.cs @@ -41,5 +41,10 @@ protected override IWin32Window Window #endregion + protected override void OnActivate(CancelEventArgs e) + { + base.OnActivate(e); + Control.OnActivate(); + } } } diff --git a/src_vs2012/VSNDK.Package/VSNDK.Package.csproj b/src_vs2012/VSNDK.Package/VSNDK.Package.csproj index e6883ed5..cb3ef41d 100644 --- a/src_vs2012/VSNDK.Package/VSNDK.Package.csproj +++ b/src_vs2012/VSNDK.Package/VSNDK.Package.csproj @@ -366,6 +366,7 @@ + Templates\VCWizards\BlackBerry\BarDescriptor\Templates\1033\bar-descriptor.cs diff --git a/src_vs2012/VSNDK.Package/ViewModels/DeveloperDefinition.cs b/src_vs2012/VSNDK.Package/ViewModels/DeveloperDefinition.cs index b61509d5..f83096cc 100644 --- a/src_vs2012/VSNDK.Package/ViewModels/DeveloperDefinition.cs +++ b/src_vs2012/VSNDK.Package/ViewModels/DeveloperDefinition.cs @@ -1,6 +1,8 @@ using System; using System.IO; +using System.Security.Cryptography.X509Certificates; using Microsoft.Win32; +using RIM.VSNDK_Package.Diagnostics; using RIM.VSNDK_Package.Tools; namespace RIM.VSNDK_Package.ViewModels @@ -21,10 +23,19 @@ public DeveloperDefinition(string certificatePath, string cskPassword) CertificateFileName = certificatePath; CskPassword = cskPassword; + + // get the author directly from certificate: + Name = LoadIssuer(CertificateFileName, CskPassword); } #region Properties + public string Name + { + get; + private set; + } + /// /// Gets the path to the author.p12 file. /// @@ -43,6 +54,22 @@ public string CskPassword private set; } + /// + /// Checks, if CskPassword is setup. + /// + public bool HasPassword + { + get { return !string.IsNullOrEmpty(CskPassword); } + } + + /// + /// Checks if developer completed registration. + /// + public bool IsRegistered + { + get { return !string.IsNullOrEmpty(CertificateFileName) && File.Exists(CertificateFileName); } + } + #endregion /// @@ -55,6 +82,14 @@ public void UpdatePassword(string password, bool remember) SavePassword(); } + /// + /// Tries to reload issuer from the certificate. + /// + public string UpdateName(string password) + { + return Name = LoadIssuer(CertificateFileName, string.IsNullOrEmpty(password) ? CskPassword : password); + } + /// /// Stores password into registry. /// @@ -85,30 +120,42 @@ public void SavePassword() /// /// Checks, if the CSK password is stored in registry. /// - public bool CheckIsPasswordSaved() + public bool IsPasswordSaved { - RegistryKey registry = Registry.CurrentUser; - RegistryKey settings = null; - - try + get { - settings = registry.OpenSubKey(RunnerDefaults.RegistryPath); - if (settings == null) - return false; + RegistryKey registry = Registry.CurrentUser; + RegistryKey settings = null; - if (CskPassword == null) - CskPassword = string.Empty; + try + { + settings = registry.OpenSubKey(RunnerDefaults.RegistryPath); + if (settings == null) + return false; - return settings.GetValue(FieldCskPassword, null) != null; - } - finally - { - if (settings != null) - settings.Close(); - registry.Close(); + if (CskPassword == null) + CskPassword = string.Empty; + + return settings.GetValue(FieldCskPassword, null) != null; + } + finally + { + if (settings != null) + settings.Close(); + registry.Close(); + } } } + /// + /// Removes password stored inside registry and cached in this class. + /// + public void DeleteCskPassword() + { + DeletePassword(); + CskPassword = null; + } + /// /// Removes password stored inside registry. /// @@ -189,5 +236,30 @@ public static DeveloperDefinition Load(string dataPath) return new DeveloperDefinition(certificateFileName, cskPassword); } + + /// + /// Loads 'issuer' field from the X.509 certificate. + /// + public static string LoadIssuer(string certificateFileName, string password) + { + try + { + if (!File.Exists(certificateFileName) || string.IsNullOrEmpty(password)) + return null; + + var cert = new X509Certificate(certificateFileName, password); + var issuer = cert.Issuer; + + if (issuer != null && issuer.StartsWith("CN=", StringComparison.InvariantCultureIgnoreCase)) + issuer = issuer.Substring(3).Trim(); + + return issuer; + } + catch (Exception ex) + { + TraceLog.WriteException(ex, "Unable to read data from certificate: \"{0}\"", certificateFileName); + return null; + } + } } } diff --git a/src_vs2012/VSNDK.Package/ViewModels/SigningOptionViewModel.cs b/src_vs2012/VSNDK.Package/ViewModels/SigningOptionViewModel.cs new file mode 100644 index 00000000..e7d63833 --- /dev/null +++ b/src_vs2012/VSNDK.Package/ViewModels/SigningOptionViewModel.cs @@ -0,0 +1,19 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace RIM.VSNDK_Package.ViewModels +{ + internal sealed class SigningOptionViewModel + { + /// + /// Gets info about the developer. + /// + public DeveloperDefinition Developer + { + get { return PackageViewModel.Instance.Developer; } + } + } +} From 0032e653b19536d71e936adb93b3222da4c1c865 Mon Sep 17 00:00:00 2001 From: Pawel Hofman Date: Thu, 15 May 2014 17:48:16 +0200 Subject: [PATCH 072/851] Added more data about debug-token on details print --- src_vs2012/VSNDK.Package/Model/DebugTokenInfo.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src_vs2012/VSNDK.Package/Model/DebugTokenInfo.cs b/src_vs2012/VSNDK.Package/Model/DebugTokenInfo.cs index 7a3c4148..f84161c7 100644 --- a/src_vs2012/VSNDK.Package/Model/DebugTokenInfo.cs +++ b/src_vs2012/VSNDK.Package/Model/DebugTokenInfo.cs @@ -156,6 +156,11 @@ public string ToLongDescription(bool mostImportantOnly) { result.Append("Author: ").AppendLine(Author); result.Append("Author ID: ").AppendLine(AuthorID); + + result.AppendLine(); + result.Append("App ID: ").AppendLine(ID); + result.Append("App Name: ").AppendLine(Name); + result.Append("App Version: ").Append(Version).Append(" (").Append(VersionID).AppendLine(")"); } // print system actions allowed: From edd88bc43594897ea56c614ae001f5b4d6622ab5 Mon Sep 17 00:00:00 2001 From: Pawel Hofman Date: Thu, 15 May 2014 17:50:50 +0200 Subject: [PATCH 073/851] Almost complete Signing dialogs and user flow --- .../VSNDK.Package/Options/DialogHelper.cs | 34 ++ .../Dialogs/DebugTokenDeploymentForm.cs | 2 +- .../Options/Dialogs/LoginForm.Designer.cs | 64 ++++ .../Options/Dialogs/LoginForm.cs | 96 ++++++ .../Options/Dialogs/LoginForm.resx | 120 +++++++ .../Options/Dialogs/PasswordForm.Designer.cs | 6 +- .../Options/SigningOptionControl.Designer.cs | 34 +- .../Options/SigningOptionControl.cs | 110 +++++-- .../Options/SigningOptionControl.resx | 2 +- src_vs2012/VSNDK.Package/VSNDK.Package.csproj | 14 +- .../ViewModels/DeveloperDefinition.cs | 295 +++++++++++++++++- 11 files changed, 725 insertions(+), 52 deletions(-) create mode 100644 src_vs2012/VSNDK.Package/Options/Dialogs/LoginForm.Designer.cs create mode 100644 src_vs2012/VSNDK.Package/Options/Dialogs/LoginForm.cs create mode 100644 src_vs2012/VSNDK.Package/Options/Dialogs/LoginForm.resx diff --git a/src_vs2012/VSNDK.Package/Options/DialogHelper.cs b/src_vs2012/VSNDK.Package/Options/DialogHelper.cs index 58b6142c..cdd0c5d9 100644 --- a/src_vs2012/VSNDK.Package/Options/DialogHelper.cs +++ b/src_vs2012/VSNDK.Package/Options/DialogHelper.cs @@ -56,6 +56,40 @@ public static SaveFileDialog SaveBarFile(string title, string startupPath, strin return saveFile; } + /// + /// Returns preconfigured window for opening ZIP files. + /// + public static OpenFileDialog OpenZipFile(string title) + { + var openFile = new OpenFileDialog(); + openFile.Title = title; + openFile.DefaultExt = ".bar"; + openFile.Filter = "Zip files|*.zip|All files|*.*"; + openFile.FilterIndex = 0; + openFile.CheckFileExists = true; + openFile.CheckPathExists = true; + + return openFile; + } + + /// + /// Returns preconfigured window for saving ZIP file. + /// + public static SaveFileDialog SaveZipFile(string title, string fileName) + { + var saveFile = new SaveFileDialog(); + saveFile.Title = title; + saveFile.FileName = fileName; + saveFile.DefaultExt = ".zip"; + saveFile.Filter = "Zip files|*.zip|All files|*.*"; + saveFile.FilterIndex = 0; + saveFile.CreatePrompt = false; + saveFile.OverwritePrompt = true; + + return saveFile; + } + + /// /// Opens Windows Explorer window with specified path. /// diff --git a/src_vs2012/VSNDK.Package/Options/Dialogs/DebugTokenDeploymentForm.cs b/src_vs2012/VSNDK.Package/Options/Dialogs/DebugTokenDeploymentForm.cs index 4dbfa20d..e6710d75 100644 --- a/src_vs2012/VSNDK.Package/Options/Dialogs/DebugTokenDeploymentForm.cs +++ b/src_vs2012/VSNDK.Package/Options/Dialogs/DebugTokenDeploymentForm.cs @@ -424,7 +424,7 @@ private void RemoveDebugToken() if (IsRemovingToken) return; - if (MessageBoxHelper.Show("Remove debug-token from that device?", _device.ShortName, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No) + if (MessageBoxHelper.Show("Remove debug-token from that device?", _device.ShortName, MessageBoxButtons.YesNo, MessageBoxIcon.Question) != DialogResult.Yes) return; ClearDeviceLogs(); diff --git a/src_vs2012/VSNDK.Package/Options/Dialogs/LoginForm.Designer.cs b/src_vs2012/VSNDK.Package/Options/Dialogs/LoginForm.Designer.cs new file mode 100644 index 00000000..ee635aa2 --- /dev/null +++ b/src_vs2012/VSNDK.Package/Options/Dialogs/LoginForm.Designer.cs @@ -0,0 +1,64 @@ +namespace RIM.VSNDK_Package.Options.Dialogs +{ + partial class LoginForm + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.webBrowser = new System.Windows.Forms.WebBrowser(); + this.SuspendLayout(); + // + // webBrowser + // + this.webBrowser.Dock = System.Windows.Forms.DockStyle.Fill; + this.webBrowser.Location = new System.Drawing.Point(0, 0); + this.webBrowser.MinimumSize = new System.Drawing.Size(20, 20); + this.webBrowser.Name = "webBrowser"; + this.webBrowser.Size = new System.Drawing.Size(739, 424); + this.webBrowser.TabIndex = 0; + // + // LoginForm + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(739, 424); + this.Controls.Add(this.webBrowser); + this.MaximizeBox = false; + this.MinimizeBox = false; + this.Name = "LoginForm"; + this.ShowIcon = false; + this.ShowInTaskbar = false; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; + this.Text = "Sign-in to create and download BlackBerry ID token"; + this.ResumeLayout(false); + + } + + #endregion + + private System.Windows.Forms.WebBrowser webBrowser; + } +} \ No newline at end of file diff --git a/src_vs2012/VSNDK.Package/Options/Dialogs/LoginForm.cs b/src_vs2012/VSNDK.Package/Options/Dialogs/LoginForm.cs new file mode 100644 index 00000000..68fdeb28 --- /dev/null +++ b/src_vs2012/VSNDK.Package/Options/Dialogs/LoginForm.cs @@ -0,0 +1,96 @@ +using System; +using System.IO; +using System.Net; +using System.Net.Security; +using System.Security.Cryptography.X509Certificates; +using System.Text; +using System.Windows.Forms; +using RIM.VSNDK_Package.Diagnostics; +using RIM.VSNDK_Package.ViewModels; + +namespace RIM.VSNDK_Package.Options.Dialogs +{ + internal partial class LoginForm : Form + { + private DeveloperDefinition _developer; + + public LoginForm(string title, DeveloperDefinition developer) + { + if (developer == null) + throw new ArgumentNullException("developer"); + _developer = developer; + + // validate certificate by calling a function + ServicePointManager.ServerCertificateValidationCallback += ValidateRemoteCertificate; + InitializeComponent(); + + if (title != null) + Text = title; + + // navigate: + webBrowser.Navigating += OnBrowserNavigating; + webBrowser.Navigate(new Uri("https://developer.blackberry.com/codesigning/", UriKind.Absolute)); + } + + /// + /// Method that handles the Navigating event. + /// + public void OnBrowserNavigating(object sender, WebBrowserNavigatingEventArgs e) + { + if (e.Url.Segments[e.Url.Segments.Length - 1].EndsWith("csk.pg")) + { + HttpWebRequest request = (HttpWebRequest)WebRequest.Create(e.Url); + request.Referer = ((WebBrowser)sender).Url.ToString(); + request.CookieContainer = new CookieContainer(); + string cookie_txt = webBrowser != null && webBrowser.Document != null ? webBrowser.Document.Cookie : string.Empty; + string[] cookies = cookie_txt.Split(';'); + + try + { + // Copying cookies from WebBrowser to the HttpWebRequest. + foreach (string cookie in cookies) + { + string[] details = cookie.Split('='); + if (details.Length == 2) + { + details[1] = details[1].Replace(",", "%2C"); + request.CookieContainer.Add(e.Url, new Cookie(details[0].Trim(), details[1].Trim())); + } + } + + request.KeepAlive = true; + + // Getting the response + HttpWebResponse response = (HttpWebResponse)request.GetResponse(); + + // Creating a StreamReader + using (Stream stream = response.GetResponseStream()) + { + using (var reader = new StreamReader(stream, Encoding.UTF8)) + { + // Save the CSK file.. + _developer.SaveBlackBerryToken(reader.ReadToEnd()); + } + } + } + catch (Exception ex) + { + TraceLog.WriteException(ex, "Error while downloading BlackBerry ID token"); + MessageBoxHelper.Show(ex.Message, "An error occurred while downloading your signing key.", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + + Close(); + } + } + + /// + /// Callback used to validate the certificate in an SSL conversation + /// + private static bool ValidateRemoteCertificate(object sender, X509Certificate cert, X509Chain chain, SslPolicyErrors policyErrors) + { + // accept all 'BlackBerry' domains: + return cert.Subject.Contains(".blackberry.com"); + } + + } +} diff --git a/src_vs2012/VSNDK.Package/Options/Dialogs/LoginForm.resx b/src_vs2012/VSNDK.Package/Options/Dialogs/LoginForm.resx new file mode 100644 index 00000000..29dcb1b3 --- /dev/null +++ b/src_vs2012/VSNDK.Package/Options/Dialogs/LoginForm.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/src_vs2012/VSNDK.Package/Options/Dialogs/PasswordForm.Designer.cs b/src_vs2012/VSNDK.Package/Options/Dialogs/PasswordForm.Designer.cs index fd1fafe1..d3f0c740 100644 --- a/src_vs2012/VSNDK.Package/Options/Dialogs/PasswordForm.Designer.cs +++ b/src_vs2012/VSNDK.Package/Options/Dialogs/PasswordForm.Designer.cs @@ -67,9 +67,9 @@ private void InitializeComponent() this.label2.AutoSize = true; this.label2.Location = new System.Drawing.Point(20, 50); this.label2.Name = "label2"; - this.label2.Size = new System.Drawing.Size(307, 13); + this.label2.Size = new System.Drawing.Size(311, 13); this.label2.TabIndex = 2; - this.label2.Text = "(password set when downloading the BlackBerry ID CSK token)"; + this.label2.Text = "(password set when created the BlackBerry ID token or CSK file)"; // // txtPassword // @@ -132,7 +132,7 @@ private void InitializeComponent() this.ShowIcon = false; this.ShowInTaskbar = false; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; - this.Text = "CSK Password Request"; + this.Text = "Password Request"; this.groupBox1.ResumeLayout(false); this.groupBox1.PerformLayout(); this.ResumeLayout(false); diff --git a/src_vs2012/VSNDK.Package/Options/SigningOptionControl.Designer.cs b/src_vs2012/VSNDK.Package/Options/SigningOptionControl.Designer.cs index 89d10848..b78d64f4 100644 --- a/src_vs2012/VSNDK.Package/Options/SigningOptionControl.Designer.cs +++ b/src_vs2012/VSNDK.Package/Options/SigningOptionControl.Designer.cs @@ -40,11 +40,11 @@ private void InitializeComponent() this.txtCertPath = new System.Windows.Forms.TextBox(); this.txtAuthor = new System.Windows.Forms.TextBox(); this.groupBox2 = new System.Windows.Forms.GroupBox(); + this.bttRefresh = new System.Windows.Forms.Button(); this.bttBackup = new System.Windows.Forms.Button(); this.bttRestore = new System.Windows.Forms.Button(); this.bttNavigate = new System.Windows.Forms.Button(); this.label4 = new System.Windows.Forms.Label(); - this.bttRefresh = new System.Windows.Forms.Button(); this.groupBox1.SuspendLayout(); this.groupBox2.SuspendLayout(); this.SuspendLayout(); @@ -74,6 +74,7 @@ private void InitializeComponent() this.bttUnregister.TabIndex = 3; this.bttUnregister.Text = "&Unregister"; this.bttUnregister.UseVisualStyleBackColor = true; + this.bttUnregister.Click += new System.EventHandler(this.bttUnregister_Click); // // bttRegister // @@ -84,6 +85,7 @@ private void InitializeComponent() this.bttRegister.TabIndex = 2; this.bttRegister.Text = "&Register"; this.bttRegister.UseVisualStyleBackColor = true; + this.bttRegister.Click += new System.EventHandler(this.bttRegister_Click); // // bttDeletePassword // @@ -92,7 +94,7 @@ private void InitializeComponent() this.bttDeletePassword.Name = "bttDeletePassword"; this.bttDeletePassword.Size = new System.Drawing.Size(126, 23); this.bttDeletePassword.TabIndex = 4; - this.bttDeletePassword.Text = "Delete password"; + this.bttDeletePassword.Text = "Forget password"; this.bttDeletePassword.UseVisualStyleBackColor = true; this.bttDeletePassword.Click += new System.EventHandler(this.bttDeletePassword_Click); // @@ -123,9 +125,9 @@ private void InitializeComponent() this.label2.AutoSize = true; this.label2.Location = new System.Drawing.Point(6, 22); this.label2.Name = "label2"; - this.label2.Size = new System.Drawing.Size(32, 13); + this.label2.Size = new System.Drawing.Size(55, 13); this.label2.TabIndex = 0; - this.label2.Text = "Path:"; + this.label2.Text = "File name:"; // // label3 // @@ -175,6 +177,17 @@ private void InitializeComponent() this.groupBox2.TabStop = false; this.groupBox2.Text = "Developer Certificate:"; // + // bttRefresh + // + this.bttRefresh.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.bttRefresh.Location = new System.Drawing.Point(315, 46); + this.bttRefresh.Name = "bttRefresh"; + this.bttRefresh.Size = new System.Drawing.Size(75, 23); + this.bttRefresh.TabIndex = 8; + this.bttRefresh.Text = "&Refresh..."; + this.bttRefresh.UseVisualStyleBackColor = true; + this.bttRefresh.Click += new System.EventHandler(this.bttRefresh_Click); + // // bttBackup // this.bttBackup.Location = new System.Drawing.Point(9, 144); @@ -183,6 +196,7 @@ private void InitializeComponent() this.bttBackup.TabIndex = 6; this.bttBackup.Text = "&Backup..."; this.bttBackup.UseVisualStyleBackColor = true; + this.bttBackup.Click += new System.EventHandler(this.bttBackup_Click); // // bttRestore // @@ -192,6 +206,7 @@ private void InitializeComponent() this.bttRestore.TabIndex = 7; this.bttRestore.Text = "R&estore..."; this.bttRestore.UseVisualStyleBackColor = true; + this.bttRestore.Click += new System.EventHandler(this.bttRestore_Click); // // bttNavigate // @@ -214,17 +229,6 @@ private void InitializeComponent() this.label4.TabIndex = 5; this.label4.Text = resources.GetString("label4.Text"); // - // bttRefresh - // - this.bttRefresh.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this.bttRefresh.Location = new System.Drawing.Point(315, 46); - this.bttRefresh.Name = "bttRefresh"; - this.bttRefresh.Size = new System.Drawing.Size(75, 23); - this.bttRefresh.TabIndex = 8; - this.bttRefresh.Text = "&Refresh..."; - this.bttRefresh.UseVisualStyleBackColor = true; - this.bttRefresh.Click += new System.EventHandler(this.bttRefresh_Click); - // // SigningOptionControl // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); diff --git a/src_vs2012/VSNDK.Package/Options/SigningOptionControl.cs b/src_vs2012/VSNDK.Package/Options/SigningOptionControl.cs index f688f2c0..a0434c14 100644 --- a/src_vs2012/VSNDK.Package/Options/SigningOptionControl.cs +++ b/src_vs2012/VSNDK.Package/Options/SigningOptionControl.cs @@ -1,6 +1,4 @@ using System; -using System.Diagnostics; -using System.IO; using System.Windows.Forms; using RIM.VSNDK_Package.Options.Dialogs; using RIM.VSNDK_Package.ViewModels; @@ -55,6 +53,35 @@ public void OnActivate() UpdateUI(); } + private void ReloadAuthor() + { + // try to reload info with cached password: + if (_vm.Developer.HasPassword) + { + Author = _vm.Developer.UpdateName(null); + UpdateUI(); + + if (!string.IsNullOrEmpty(Author)) + return; + } + + // if it failed, ask for new password: + var form = new PasswordForm(); + if (form.ShowDialog() != DialogResult.OK) + return; + + _vm.Developer.UpdatePassword(form.Password, form.ShouldRemember); + + // try again to reload data from certificate: + Author = _vm.Developer.UpdateName(null); + UpdateUI(); + + if (string.IsNullOrEmpty(Author)) + { + MessageBoxHelper.Show("Unable to load info about author", "Invalid password or certificate file", MessageBoxButtons.OK, MessageBoxIcon.Warning); + } + } + private void lblMore_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { DialogHelper.StartURL("http://www.blackberry.com/go/codesigning/"); @@ -62,15 +89,16 @@ private void lblMore_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) private void bttNavigate_Click(object sender, EventArgs e) { - if (string.IsNullOrEmpty(CertificatePath)) + var path = _vm.Developer.CertificateFullPath; + if (string.IsNullOrEmpty(path)) return; - DialogHelper.StartExplorerForFile(CertificatePath); + DialogHelper.StartExplorerForFile(path); } private void bttDeletePassword_Click(object sender, EventArgs e) { - if (MessageBoxHelper.Show("Delete stored password?", "BBID Token CSK Password", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No) + if (MessageBoxHelper.Show("Delete stored password?", "BBID Token CSK Password", MessageBoxButtons.YesNo, MessageBoxIcon.Question) != DialogResult.Yes) return; _vm.Developer.DeleteCskPassword(); @@ -79,31 +107,69 @@ private void bttDeletePassword_Click(object sender, EventArgs e) private void bttRefresh_Click(object sender, EventArgs e) { - // try to reload info with cached password: - if (_vm.Developer.HasPassword) + ReloadAuthor(); + } + + private void bttBackup_Click(object sender, EventArgs e) + { + var form = DialogHelper.SaveZipFile("Exporting Developer Profile", "profile_backup_" + DateTime.Now.ToString("yyyy-MM-dd") + ".zip"); + + if (form.ShowDialog() == DialogResult.OK) { - Author = _vm.Developer.UpdateName(null); - UpdateUI(); + if (_vm.Developer.BackupProfile(form.FileName)) + { + MessageBoxHelper.Show("Developer profile exported", null, MessageBoxButtons.OK, MessageBoxIcon.Information); + } + else + { + MessageBoxHelper.Show("Error while exporting developer profile", null, MessageBoxButtons.OK, MessageBoxIcon.Error); + } - if (!string.IsNullOrEmpty(Author)) - return; + UpdateUI(); } + } - // if it failed, ask for new password: - var form = new PasswordForm(); - if (form.ShowDialog() == DialogResult.Cancel) - return; - - _vm.Developer.UpdatePassword(form.Password, form.ShouldRemember); + private void bttRestore_Click(object sender, EventArgs e) + { + var form = DialogHelper.OpenZipFile("Restoring Developer Profile"); - // try again to reload data from certificate: - Author = _vm.Developer.UpdateName(null); - UpdateUI(); + if (form.ShowDialog() == DialogResult.OK) + { + if (_vm.Developer.RestoreProfile(form.FileName)) + { + MessageBoxHelper.Show("Developer profile restored", null, MessageBoxButtons.OK, MessageBoxIcon.Information); + } + else + { + MessageBoxHelper.Show("Error while importing developer profile", null, MessageBoxButtons.OK, MessageBoxIcon.Error); + } + + ReloadAuthor(); + } + } - if (string.IsNullOrEmpty(Author)) + private void bttUnregister_Click(object sender, EventArgs e) + { + if (MessageBoxHelper.Show("Do you want to unregister and remove the BlackBerry ID Token file?\r\nThis operation can not be reverted. Make sure you have created a backup.", "UNREGISTRATION!!", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { - MessageBoxHelper.Show("Unable to load info about author", "Invalid password or certificate file", MessageBoxButtons.OK, MessageBoxIcon.Warning); + // unregister, this is the only place, where doing it synchronously is OK: + + // and delete all profile-related files: + _vm.Developer.DeleteProfile(); + UpdateUI(); } } + + private void bttRegister_Click(object sender, EventArgs e) + { + var form = new LoginForm(null, _vm.Developer); + form.ShowDialog(); + + // call the registration tool: + + // clean-up files, in case something went wrong: + _vm.Developer.CleanupProfile(); + UpdateUI(); + } } } diff --git a/src_vs2012/VSNDK.Package/Options/SigningOptionControl.resx b/src_vs2012/VSNDK.Package/Options/SigningOptionControl.resx index 5104a117..b7da4152 100644 --- a/src_vs2012/VSNDK.Package/Options/SigningOptionControl.resx +++ b/src_vs2012/VSNDK.Package/Options/SigningOptionControl.resx @@ -118,6 +118,6 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - If you lose your signing keys, or forget your password, you will be required to re-register with BlackBerry. After re-registration, new versions of your applications will appear as new applications, and will not have access to shared data from previous versions. Exporting your signing keys will also allow you to import them on multiple computers and sign from any of them. + If you lose your signing keys, or forget your password, you will be required to re-register with BlackBerry. After re-registration, new versions of your applications will appear as new applications, and will not have access to shared data from previous releases. Exporting your signing keys will also allow you to import them on multiple computers and sign from any of them. \ No newline at end of file diff --git a/src_vs2012/VSNDK.Package/VSNDK.Package.csproj b/src_vs2012/VSNDK.Package/VSNDK.Package.csproj index cb3ef41d..73275715 100644 --- a/src_vs2012/VSNDK.Package/VSNDK.Package.csproj +++ b/src_vs2012/VSNDK.Package/VSNDK.Package.csproj @@ -243,7 +243,7 @@ DeRegisterWindow.xaml - Signing\Models\SigningData.cs + Signing\SigningData.cs Signing\RegistrationWindow.xaml.cs @@ -302,6 +302,12 @@ InstallNdkForm.cs + + Form + + + LoginForm.cs + Form @@ -525,6 +531,9 @@ InstallNdkForm.cs + + LoginForm.cs + PasswordForm.cs @@ -669,6 +678,9 @@ Always + + + true diff --git a/src_vs2012/VSNDK.Package/ViewModels/DeveloperDefinition.cs b/src_vs2012/VSNDK.Package/ViewModels/DeveloperDefinition.cs index f83096cc..b075d835 100644 --- a/src_vs2012/VSNDK.Package/ViewModels/DeveloperDefinition.cs +++ b/src_vs2012/VSNDK.Package/ViewModels/DeveloperDefinition.cs @@ -1,5 +1,6 @@ using System; using System.IO; +using System.IO.Packaging; using System.Security.Cryptography.X509Certificates; using Microsoft.Win32; using RIM.VSNDK_Package.Diagnostics; @@ -13,23 +14,28 @@ namespace RIM.VSNDK_Package.ViewModels internal sealed class DeveloperDefinition { private const string DefaultCertificateName = "author.p12"; + private const string DefaultCskName = "bbidtoken.csk"; private const string FieldCertificateFileName = "certificate"; private const string FieldCskPassword = "CSKPass"; - public DeveloperDefinition(string certificatePath, string cskPassword) + public DeveloperDefinition(string dataPath, string certificatePath, string cskPassword) { - if (string.IsNullOrEmpty(certificatePath)) - throw new ArgumentNullException("certificatePath"); + if (string.IsNullOrEmpty(dataPath)) + throw new ArgumentNullException("dataPath"); + DataPath = dataPath; CertificateFileName = certificatePath; CskPassword = cskPassword; // get the author directly from certificate: - Name = LoadIssuer(CertificateFileName, CskPassword); + Name = LoadIssuer(CertificateFullPath, CskPassword); } #region Properties + /// + /// Gets the name of the developer (publisher). + /// public string Name { get; @@ -37,7 +43,16 @@ public string Name } /// - /// Gets the path to the author.p12 file. + /// Gets the location, where all developer configuration files are stored. + /// + public string DataPath + { + get; + private set; + } + + /// + /// Gets the name of certificate file (author.p12). /// public string CertificateFileName { @@ -45,6 +60,14 @@ public string CertificateFileName private set; } + /// + /// Gets the full path to the developers certificate. + /// + public string CertificateFullPath + { + get { return string.IsNullOrEmpty(CertificateFileName) ? null : Path.Combine(DataPath, CertificateFileName); } + } + /// /// Password set by developer to the certificate. /// @@ -67,7 +90,7 @@ public bool HasPassword /// public bool IsRegistered { - get { return !string.IsNullOrEmpty(CertificateFileName) && File.Exists(CertificateFileName); } + get { return !string.IsNullOrEmpty(CertificateFileName) && File.Exists(CertificateFullPath); } } #endregion @@ -87,7 +110,7 @@ public void UpdatePassword(string password, bool remember) /// public string UpdateName(string password) { - return Name = LoadIssuer(CertificateFileName, string.IsNullOrEmpty(password) ? CskPassword : password); + return Name = LoadIssuer(CertificateFullPath, string.IsNullOrEmpty(password) ? CskPassword : password); } /// @@ -180,6 +203,57 @@ public static void DeletePassword() } } + /// + /// Updates path to the certificate inside the registry. + /// + private void SaveCertificatePath() + { + RegistryKey registry = Registry.CurrentUser; + RegistryKey settings = null; + + try + { + settings = registry.CreateSubKey(RunnerDefaults.RegistryPath); + if (settings == null) + return; + + if (string.Compare(DefaultCertificateName, CertificateFileName, StringComparison.InvariantCultureIgnoreCase) == 0) + settings.DeleteValue(FieldCertificateFileName, false); + else + settings.SetValue(FieldCertificateFileName, CertificateFileName); + } + finally + { + if (settings != null) + settings.Close(); + registry.Close(); + } + } + + /// + /// Removes certificate path from registry. + /// + private void DeleteCertificatePath() + { + RegistryKey registry = Registry.CurrentUser; + RegistryKey settings = null; + + try + { + settings = registry.CreateSubKey(RunnerDefaults.RegistryPath); + if (settings == null) + return; + + settings.DeleteValue(FieldCertificateFileName, false); + } + finally + { + if (settings != null) + settings.Close(); + registry.Close(); + } + } + /// /// Creates new developer-definition object based on info read from registry and around. /// @@ -218,7 +292,7 @@ public static DeveloperDefinition Load(string dataPath) } // set default, if loading failed: if (string.IsNullOrEmpty(certificateFileName)) - certificateFileName = Path.Combine(dataPath, DefaultCertificateName); + certificateFileName = DefaultCertificateName; // IP try @@ -234,7 +308,7 @@ public static DeveloperDefinition Load(string dataPath) settings.Close(); registry.Close(); - return new DeveloperDefinition(certificateFileName, cskPassword); + return new DeveloperDefinition(dataPath, certificateFileName, cskPassword); } /// @@ -261,5 +335,208 @@ public static string LoadIssuer(string certificateFileName, string password) return null; } } + + /// + /// Gets the list of files, that are assumed to be a developer profile for signing applications. + /// + private string[] GetProfileFiles() + { + return new[] { CertificateFileName, "bbidtoken.csk", "barsigner.db", + "bbsigner.csk", "bb_id_rsa", "bb_id_rsa.pub", + + // PH: TODO: but I have also files: + "barsigner.csk", "bbt_id_rsa", "bbt_id_rsa.pub"}; + } + + /// + /// Saves all developer profile info into specified file. + /// + public bool BackupProfile(string outputFile) + { + if (string.IsNullOrEmpty(outputFile)) + return false; + + var fileNames = GetProfileFiles(); + + try + { + using (var package = Package.Open(outputFile, FileMode.Create)) + { + foreach (var name in fileNames) + { + Append(package, name, Path.Combine(DataPath, name)); + } + } + + return true; + } + catch (Exception ex) + { + TraceLog.WriteException(ex, "Unable to export profile to file: \"{0}\"", outputFile); + return false; + } + } + + /// + /// Appends file to the ZIP package. + /// + private static void Append(Package package, string name, string fullPathName) + { + if (File.Exists(fullPathName)) + { + Uri uri = PackUriHelper.CreatePartUri(new Uri(name, UriKind.Relative)); + PackagePart part = package.CreatePart(uri, string.Empty); + + using (var fileStream = new FileStream(fullPathName, FileMode.Open, FileAccess.Read)) + { + CopyStream(fileStream, part.GetStream()); + } + } + } + + /// + /// Copy a stream from one stream to another. + /// + private static void CopyStream(Stream source, Stream target) + { + if (source == null) + throw new ArgumentNullException("source"); + if (target == null) + throw new ArgumentNullException("target"); + + var buffer = new byte[0x1000]; + int bytesRead; + + while ((bytesRead = source.Read(buffer, 0, buffer.Length)) > 0) + { + target.Write(buffer, 0, bytesRead); + } + } + + /// + /// Extracts the developer profile. + /// + public bool RestoreProfile(string inputFile) + { + if (string.IsNullOrEmpty(inputFile)) + return false; + + if (File.Exists(inputFile)) + { + string p12FileName = null; + + try + { + // make the password invalid: + DeletePassword(); + + // extract all files that are within the backup package: + using (var package = Package.Open(inputFile, FileMode.Open, FileAccess.ReadWrite)) + { + foreach (var part in package.GetParts()) + { + var name = ExtractFile(part, DataPath); + if (name != null && name.EndsWith(".p12")) + { + p12FileName = Path.GetFileName(name); + } + } + } + + // no certificate found inside? + if (string.IsNullOrEmpty(p12FileName)) + return false; + + // update save it for future reference: + CertificateFileName = p12FileName; + SaveCertificatePath(); + return true; + } + catch (Exception ex) + { + TraceLog.WriteException(ex, "Impossible to restore profile: \"{0}\"", inputFile); + return false; + } + } + + return false; + } + + /// + /// Extract file under specified directory. + /// + public static string ExtractFile(PackagePart part, string folder) + { + // initially create file under the folder specified + string filePath = part.Uri.OriginalString.Replace('/', Path.DirectorySeparatorChar); + + // remove trailing directory separator: + if (!string.IsNullOrEmpty(filePath) && filePath[0] == Path.DirectorySeparatorChar) + { + filePath = filePath.TrimStart(Path.DirectorySeparatorChar); + } + + filePath = Path.Combine(folder, filePath); + var dirName = Path.GetDirectoryName(filePath); + if (!string.IsNullOrEmpty(dirName)) + { + Directory.CreateDirectory(dirName); + } + + // extract file: + using (var output = File.Create(filePath)) + { + CopyStream(part.GetStream(), output); + } + + return filePath; + } + + /// + /// Writes a BlackBerry ID token file. + /// + public void SaveBlackBerryToken(string content) + { + var fileName = Path.Combine(DataPath, DefaultCskName); + + if (File.Exists(fileName)) + File.Delete(fileName); + + if (!string.IsNullOrEmpty(content)) + { + File.WriteAllText(fileName, content); + } + } + + /// + /// Delete all files that belong to the developer profile. + /// Removes its password etc. + /// + public void DeleteProfile() + { + var files = GetProfileFiles(); + + foreach (var fileName in files) + { + var fullName = Path.Combine(DataPath, fileName); + if (File.Exists(fullName)) + File.Delete(fullName); + } + + DeleteCskPassword(); + CertificateFileName = null; + Name = null; + } + + /// + /// Removes some profile temporary files, that are not needed anymore, when registration process completed. + /// + public void CleanupProfile() + { + if (!IsRegistered) + { + DeleteProfile(); + } + } } } From 6a0645d24e94e3c422f134be37c41a525bd8b74d Mon Sep 17 00:00:00 2001 From: Pawel Hofman Date: Fri, 16 May 2014 00:08:24 +0200 Subject: [PATCH 074/851] Added 'Help' into menu with web-page URLs --- src/VSNDK.Package/PkgCmdID.cs | 28 +++-- src/VSNDK.Package/VSNDK.PackagePackage.cs | 52 ++++++++- src_vs2012/VSNDK.Package/VSNDK.Package.vsct | 112 +++++++++++++++++--- 3 files changed, 167 insertions(+), 25 deletions(-) diff --git a/src/VSNDK.Package/PkgCmdID.cs b/src/VSNDK.Package/PkgCmdID.cs index 607d01ca..c5a4dbcf 100644 --- a/src/VSNDK.Package/PkgCmdID.cs +++ b/src/VSNDK.Package/PkgCmdID.cs @@ -16,15 +16,25 @@ namespace RIM.VSNDK_Package { internal static class PkgCmdIDList { - public const int cmdidBlackBerryTools = 0x0201; - public const int cmdidBlackBerrySettings = 0x0202; - public const int cmdidBlackBerryDebugToken = 0x0203; - public const int cmdidBlackBerryOptions = 0x0301; - public const int cmdidBlackBerryTargetsDevicesPlaceholder = 0x0401; - public const int cmdidBlackBerryTargetsApiLevelsPlaceholder = 0x0501; - public const int cmdidBlackBerryTargetsConfigure = 0x0601; + public const int cmdidBlackBerryTools = 0x201; + public const int cmdidBlackBerrySettings = 0x202; + public const int cmdidBlackBerryDebugToken = 0x203; + public const int cmdidBlackBerryOptions = 0x301; + public const int cmdidBlackBerryTargetsDevicesPlaceholder = 0x501; + public const int cmdidBlackBerryTargetsApiLevelsPlaceholder = 0x601; + public const int cmdidBlackBerryTargetsConfigure = 0x701; + + public const int cmdidBlackBerryHelpDocNative = 0x901; + public const int cmdidBlackBerryHelpDocCascades = 0x902; + public const int cmdidBlackBerryHelpDocPlayBook = 0x903; + public const int cmdidBlackBerryHelpSamplesNative = 0x1001; + public const int cmdidBlackBerryHelpSamplesCascades = 0x1002; + public const int cmdidBlackBerryHelpSamplesPlayBook = 0x1003; + public const int cmdidBlackBerryHelpSamplesOpenSource = 0x1004; + public const int cmdidBlackBerryHelpAbout = 0x1101; + public const int cmdidBlackBerryProjectImport = 0x0104; public const int cmdidfooLocalBox = 0x0105; - }; -} \ No newline at end of file + } +} diff --git a/src/VSNDK.Package/VSNDK.PackagePackage.cs b/src/VSNDK.Package/VSNDK.PackagePackage.cs index 30eb4544..676d695a 100644 --- a/src/VSNDK.Package/VSNDK.PackagePackage.cs +++ b/src/VSNDK.Package/VSNDK.PackagePackage.cs @@ -1012,7 +1012,7 @@ protected override void Initialize() // Create the command for the tool window CommandID toolwndCommandID = new CommandID(GuidList.guidVSNDK_PackageCmdSet, PkgCmdIDList.cmdidBlackBerryTools); MenuCommand menuToolWin = new MenuCommand(ShowToolWindow, toolwndCommandID); - mcs.AddCommand( menuToolWin ); + mcs.AddCommand(menuToolWin); // Create the command for the settings window CommandID wndSettingsCommandID = new CommandID(GuidList.guidVSNDK_PackageCmdSet, PkgCmdIDList.cmdidBlackBerrySettings); @@ -1062,6 +1062,19 @@ protected override void Initialize() apiLevelCommandID); mcs.AddCommand(apiLevelMenu); + // Create command for 'Help' menus + var helpCmdIDs = new[] { + PkgCmdIDList.cmdidBlackBerryHelpDocNative, PkgCmdIDList.cmdidBlackBerryHelpDocCascades, PkgCmdIDList.cmdidBlackBerryHelpDocPlayBook, + PkgCmdIDList.cmdidBlackBerryHelpSamplesNative, PkgCmdIDList.cmdidBlackBerryHelpSamplesCascades, PkgCmdIDList.cmdidBlackBerryHelpSamplesPlayBook, PkgCmdIDList.cmdidBlackBerryHelpSamplesOpenSource, + PkgCmdIDList.cmdidBlackBerryHelpAbout + }; + foreach (var cmdID in helpCmdIDs) + { + CommandID helpCommandID = new CommandID(GuidList.guidVSNDK_PackageCmdSet, cmdID); + MenuCommand helpMenu = new MenuCommand(OpenHelpWebPage, helpCommandID); + mcs.AddCommand(helpMenu); + } + // Create command for 'Configure...' [targets] menu CommandID configureCommandID = new CommandID(GuidList.guidVSNDK_PackageCmdSet, PkgCmdIDList.cmdidBlackBerryTargetsConfigure); MenuCommand configureMenu = new MenuCommand((s, e) => ShowOptionPage(typeof(TargetsOptionPage)), configureCommandID); @@ -1077,6 +1090,41 @@ protected override void Initialize() TraceLog.WriteLine("-------------------- DONE"); } + + private void OpenHelpWebPage(object sender, EventArgs e) + { + var menuCommand = sender as MenuCommand; + int cmdID = menuCommand != null ? menuCommand.CommandID.ID : 0; + + switch (cmdID) + { + case PkgCmdIDList.cmdidBlackBerryHelpDocNative: + DialogHelper.StartURL("http://developer.blackberry.com/native/documentation/core/framework.html"); + break; + case PkgCmdIDList.cmdidBlackBerryHelpDocCascades: + DialogHelper.StartURL("http://developer.blackberry.com/native/documentation/cascades/dev/index.html"); + break; + case PkgCmdIDList.cmdidBlackBerryHelpDocPlayBook: + DialogHelper.StartURL("http://developer.blackberry.com/playbook/native/documentation/"); + break; + case PkgCmdIDList.cmdidBlackBerryHelpSamplesNative: + DialogHelper.StartURL("http://developer.blackberry.com/native/sampleapps/"); + break; + case PkgCmdIDList.cmdidBlackBerryHelpSamplesCascades: + DialogHelper.StartURL("http://developer.blackberry.com/native/sampleapps/"); + break; + case PkgCmdIDList.cmdidBlackBerryHelpSamplesPlayBook: + DialogHelper.StartURL("http://developer.blackberry.com/playbook/native/sampleapps/"); + break; + case PkgCmdIDList.cmdidBlackBerryHelpSamplesOpenSource: + DialogHelper.StartURL("https://github.com/blackberry"); + break; + default: + TraceLog.WarnLine("Unknown Help item requested"); + break; + } + } + #endregion #region private methods @@ -1558,7 +1606,6 @@ private bool checkDebugConfiguration() #endregion - #region Event Handlers /// @@ -1817,6 +1864,5 @@ private void MenuItemCallback(object sender, EventArgs e) } #endregion - } } diff --git a/src_vs2012/VSNDK.Package/VSNDK.Package.vsct b/src_vs2012/VSNDK.Package/VSNDK.Package.vsct index 3ab15ba6..3d3b795c 100644 --- a/src_vs2012/VSNDK.Package/VSNDK.Package.vsct +++ b/src_vs2012/VSNDK.Package/VSNDK.Package.vsct @@ -52,7 +52,7 @@ - + @@ -60,6 +60,13 @@ + + + + + &Help + + @@ -86,7 +93,17 @@ - + + + + + + + + + + + @@ -161,8 +178,62 @@ &Configure... + + + + + + + + + + + - + + + + + - - - - - - - - - - - - - - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + with the available font names and font sizes respectively + --> + + + + + + + + + + + + + + + + + diff --git a/src_vs2012/VSNDK.Package/VSNDK.Package.Menu.vsct b/src_vs2012/VSNDK.Package/VSNDK.Package.Menu.vsct new file mode 100644 index 00000000..ce8067c8 --- /dev/null +++ b/src_vs2012/VSNDK.Package/VSNDK.Package.Menu.vsct @@ -0,0 +1,296 @@ + + + + + + + + + + + + + + + + + + &Targets + + + + + + + + &Help + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src_vs2012/VSNDK.Package/VSNDK.Package.csproj b/src_vs2012/VSNDK.Package/VSNDK.Package.csproj index 52f9d1b0..6935e94a 100644 --- a/src_vs2012/VSNDK.Package/VSNDK.Package.csproj +++ b/src_vs2012/VSNDK.Package/VSNDK.Package.csproj @@ -411,6 +411,7 @@ UpdateManager\UpdateManagerDialog.xaml.cs UpdateManagerDialog.xaml + diff --git a/src_vs2012/VSNDK.Package/VSNDK.Package.vsct b/src_vs2012/VSNDK.Package/VSNDK.Package.vsct index 3d3b795c..d956aacb 100644 --- a/src_vs2012/VSNDK.Package/VSNDK.Package.vsct +++ b/src_vs2012/VSNDK.Package/VSNDK.Package.vsct @@ -29,6 +29,7 @@ + - - - - &Targets - - - - - - - - &Help - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -286,53 +96,4 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src_vs2013/VSNDK.Package/VSNDK.Package.csproj b/src_vs2013/VSNDK.Package/VSNDK.Package.csproj index 5fd7e614..9db4fc0b 100644 --- a/src_vs2013/VSNDK.Package/VSNDK.Package.csproj +++ b/src_vs2013/VSNDK.Package/VSNDK.Package.csproj @@ -250,6 +250,243 @@ Signing\SigningDialog.xaml.cs SigningDialog.xaml + + Diagnostics\BlackBerryPaneTraceListener.cs + + + Diagnostics\BlackBerryTraceListener.cs + + + Diagnostics\TimeTracker.cs + + + Diagnostics\TraceLog.cs + + + MessageBoxHelper.cs + + + Model\ApiInfo.cs + + + Model\ApiLevelListTypes.cs + + + Model\DebugTokenInfo.cs + + + Model\DeviceDebugTokenInfo.cs + + + Model\DeviceInfo.cs + + + Model\DeviceTheme.cs + + + Model\Integration\ComboBoxItem.cs + + + Model\Integration\DynamicMenuCommand.cs + + + Model\NdkInfo.cs + + + Options\ApiLevelOptionControl.cs + UserControl + + + Options\ApiLevelOptionControl.designer.cs + ApiLevelOptionControl.cs + + + Options\ApiLevelOptionPage.cs + Component + + + Options\DialogHelper.cs + + + Options\Dialogs\AboutForm.cs + Form + + + Options\Dialogs\AboutForm.designer.cs + AboutForm.cs + + + Options\Dialogs\AddLocalNdkForm.cs + Form + + + Options\Dialogs\AddLocalNdkForm.designer.cs + AddLocalNdkForm.cs + + + Options\Dialogs\DebugTokenDeploymentForm.cs + Form + + + Options\Dialogs\DebugTokenDeploymentForm.designer.cs + DebugTokenDeploymentForm.cs + + + Options\Dialogs\DeviceForm.cs + Form + + + Options\Dialogs\DeviceForm.designer.cs + DeviceForm.cs + + + Options\Dialogs\InstallNdkForm.cs + Form + + + Options\Dialogs\InstallNdkForm.designer.cs + InstallNdkForm.cs + + + Options\Dialogs\LoginForm.cs + Form + + + Options\Dialogs\LoginForm.designer.cs + LoginForm.cs + + + Options\Dialogs\PasswordForm.cs + Form + + + Options\Dialogs\PasswordForm.designer.cs + PasswordForm.cs + + + Options\Dialogs\PinListForm.cs + Form + + + Options\Dialogs\PinListForm.designer.cs + PinListForm.cs + + + Options\Dialogs\RegistrationForm.cs + Form + + + Options\Dialogs\RegistrationForm.designer.cs + RegistrationForm.cs + + + Options\GeneralOptionControl.cs + UserControl + + + Options\GeneralOptionControl.designer.cs + GeneralOptionControl.cs + + + Options\GeneralOptionPage.cs + Component + + + Options\LogsOptionControl.cs + UserControl + + + Options\LogsOptionControl.designer.cs + LogsOptionControl.cs + + + Options\LogsOptionPage.cs + Component + + + Options\SigningOptionControl.cs + UserControl + + + Options\SigningOptionControl.designer.cs + SigningOptionControl.cs + + + Options\SigningOptionPage.cs + Component + + + Options\TargetsOptionControl.cs + UserControl + + + Options\TargetsOptionControl.designer.cs + TargetsOptionControl.cs + + + Options\TargetsOptionPage.cs + Component + + + Tools\ApiLevelListLoadRunner.cs + + + Tools\ApplicationRemoveRunner.cs + + + Tools\DebugTokenCreateRunner.cs + + + Tools\DebugTokenInfoRunner.cs + + + Tools\DebugTokenUploadRunner.cs + + + Tools\DeviceInfoRunner.cs + + + Tools\EventDispatcher.cs + + + Tools\KeyToolGenRunner.cs + + + Tools\KeyToolRemoveRunner.cs + + + Tools\RunnerDefaults.cs + + + Tools\ToolRunner.cs + + + Tools\ToolRunnerEventArgs.cs + + + ViewModels\ApiLevelOptionViewModel.cs + + + ViewModels\DeveloperDefinition.cs + + + ViewModels\DeviceDefinition.cs + + + ViewModels\DeviceDefinitionType.cs + + + ViewModels\NdkDefinition.cs + + + ViewModels\PackageViewModel.cs + + + ViewModels\SigningOptionViewModel.cs + + + ViewModels\TargetsOptionViewModel.cs + Templates\VCWizards\BlackBerry\BarDescriptor\Templates\1033\bar-descriptor.cs bar-descriptor.xsd @@ -286,6 +523,71 @@ Templates\VCWizards\BlackBerry\BarDescriptor\Templates\1033\templates.inf Always + + VSNDK.Package.Menu.vsct + + + VSNDK.Package.Bitmaps.vsct + + + Options\ApiLevelOptionControl.resx + ApiLevelOptionControl.cs + + + Options\Dialogs\AboutForm.resx + AboutForm.cs + + + Options\Dialogs\AddLocalNdkForm.resx + AddLocalNdkForm.cs + + + Options\Dialogs\DebugTokenDeploymentForm.resx + DebugTokenDeploymentForm.cs + + + Options\Dialogs\DeviceForm.resx + DeviceForm.cs + + + Options\Dialogs\InstallNdkForm.resx + InstallNdkForm.cs + + + Options\Dialogs\LoginForm.resx + LoginForm.cs + + + Options\Dialogs\PasswordForm.resx + PasswordForm.cs + + + Options\Dialogs\PinListForm.resx + PinListForm.cs + + + Options\Dialogs\RegistrationForm.resx + RegistrationForm.cs + + + Options\GeneralOptionControl.resx + GeneralOptionControl.cs + + + Options\LogsOptionControl.resx + LogsOptionControl.cs + + + Options\SigningOptionControl.resx + SigningOptionControl.cs + + + Options\TargetsOptionControl.resx + TargetsOptionControl.cs + + + Resources\Logo.png + Resources\BlackBerryMessager.bmp diff --git a/src_vs2013/VSNDK.Package/VSNDK.Package.vsct b/src_vs2013/VSNDK.Package/VSNDK.Package.vsct index 8231eb32..a970c778 100644 --- a/src_vs2013/VSNDK.Package/VSNDK.Package.vsct +++ b/src_vs2013/VSNDK.Package/VSNDK.Package.vsct @@ -1,39 +1,32 @@  - - - - + + - - + + - - + + - - - - - - - - - - - - - - - - - - BlackBerry - BlackBerry - - - - - - - - - - - - - - - - - - - - - - + + + + + + + &BlackBerry + + - + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + From 089c70c79dc87c4e588251e8f88993a34bbbc230 Mon Sep 17 00:00:00 2001 From: Pawel Hofman Date: Sun, 18 May 2014 15:01:54 +0200 Subject: [PATCH 085/851] Added more error messages during signing-process --- .../VSNDK.Package/Options/SigningOptionControl.cs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src_vs2012/VSNDK.Package/Options/SigningOptionControl.cs b/src_vs2012/VSNDK.Package/Options/SigningOptionControl.cs index ade360a9..08e39b44 100644 --- a/src_vs2012/VSNDK.Package/Options/SigningOptionControl.cs +++ b/src_vs2012/VSNDK.Package/Options/SigningOptionControl.cs @@ -183,6 +183,13 @@ private void bttUnregister_Click(object sender, EventArgs e) private void bttRegister_Click(object sender, EventArgs e) { + if (_vm.Developer.IsRegistered) + { + MessageBoxHelper.Show("You are already registered, please unregister first, if you want to create new BlackBerry ID token!", "Registration", + MessageBoxButtons.OK, MessageBoxIcon.Information); + return; + } + var form = new LoginForm(null, _vm.Developer); form.ShowDialog(); // this should generate BlackBerry token file @@ -218,6 +225,10 @@ private void bttRegister_Click(object sender, EventArgs e) } } } + else + { + MessageBoxHelper.Show("Creation of BlackBerry ID token failed. Please try again.", "Registration", MessageBoxButtons.OK, MessageBoxIcon.Error); + } UpdateUI(); } From b39635c2c805b3e27e3d5ab87662ad906314c925 Mon Sep 17 00:00:00 2001 From: Pawel Hofman Date: Tue, 20 May 2014 17:59:49 +0200 Subject: [PATCH 086/851] Started tweaking the build environment --- VSNDKPluginBuild.bat | 45 ++++++++++++++++++++++++++------------------ 1 file changed, 27 insertions(+), 18 deletions(-) diff --git a/VSNDKPluginBuild.bat b/VSNDKPluginBuild.bat index 0c26eee5..25bf9224 100644 --- a/VSNDKPluginBuild.bat +++ b/VSNDKPluginBuild.bat @@ -1,12 +1,14 @@ -echo off +@echo off +setlocal REM ******************************************************************************************** REM Declare Constants REM ******************************************************************************************** set thisDir=%~dp0 -set buildresults="%thisDir%\..\buildresults" -set dotNetFrameworkPath="C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\MsBuild.exe" -set dotNetFrameworkPath2013="C:\Program Files (x86)\MSBuild\12.0\Bin\MsBuild.exe" +set buildresults="%thisDir%..\buildresults" +set msbuild="C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\MsBuild.exe" +set msbuild2013="C:\Program Files (x86)\MSBuild\12.0\Bin\MsBuild.exe" + set solutionPath2010="%thisDir%\src\VSNDK.sln" set AddIn2012="%thisDir%\src_vs2012\VSNDK.AddIn\VSNDK.AddIn.csproj" set DebugEngine2012="%thisDir%\src_vs2012\VSNDK.DebugEngine\VSNDK.DebugEngine.csproj" @@ -19,6 +21,9 @@ set GDWrapper2013="%thisDir%\src_vs2013\GDBWrapper\GDBWrapper.vcxproj" set VSPackage2013="%thisDir%\src_vs2013\VSNDK.Package\VSNDK.Package.csproj" set VSTasks2013="%thisDir%\src_vs2013\VSNDK.Tasks\VSNDK.Tasks.csproj" +echo Starting... +echo Output folder: %buildresults% + REM ******************************************************************************************** REM Clean up old bin folder REM ******************************************************************************************** @@ -33,28 +38,32 @@ REM **************************************************************************** REM Build VS2010 REM ******************************************************************************************** REM echo Building Solution for VS2010 -REM %dotNetFrameworkPath% %solutionPath2010% /property:Configuration=Release /target:Clean;Build /p:OutputPath="%buildresults%\VS2010" > %buildresult%\VS2010_buildlog.txt -REM echo Build Success +REM %msbuild% %solutionPath2010% /property:Configuration=Release /target:Clean;Build /p:OutputPath="%buildresults%\VS2010" > %buildresults%\VS2010_buildlog.txt +REM echo Build Done REM ******************************************************************************************** REM Build VS2012 REM ******************************************************************************************** echo Building Solution for VS2012 -%dotNetFrameworkPath% %AddIn2012% /property:Configuration=Release /target:Clean;Build /p:VisualStudioVersion=11.0 /p:OutputPath="%buildresults%\VS2012" > %buildresult%\VS2012_buildlog_AddIn.txt -%dotNetFrameworkPath% %DebugEngine2012% /property:Configuration=Release /target:Clean;Build /p:VisualStudioVersion=11.0 /p:OutputPath="%buildresults%\VS2012" > %buildresult%\VS2012_buildlog_DBEngine.txt -%dotNetFrameworkPath% %GDWrapper2012% /property:Configuration=Release /target:Clean;Build /p:VisualStudioVersion=11.0 /p:OutputPath="%buildresults%\VS2012" > %buildresult%\VS2012_buildlog_GDBWrapper.txt -%dotNetFrameworkPath% %VSPackage2012% /property:Configuration=Release /target:Clean;Build /p:VisualStudioVersion=11.0 /p:OutputPath="%buildresults%\VS2012" > %buildresult%\VS2012_buildlog_Package.txt -%dotNetFrameworkPath% %VSTasks2012% /property:Configuration=Release /target:Clean;Build /p:VisualStudioVersion=11.0 /p:OutputPath="%buildresults%\VS2012" > %buildresult%\VS2012_buildlog_Tasks.txt -echo Build Success +%msbuild% %AddIn2012% /property:Configuration=Release /target:Clean;Build /p:VisualStudioVersion=11.0 /p:OutputPath="%buildresults%\VS2012" > %buildresults%\VS2012_buildlog_AddIn.txt +%msbuild% %DebugEngine2012% /property:Configuration=Release /target:Clean;Build /p:VisualStudioVersion=11.0 /p:OutputPath="%buildresults%\VS2012" > %buildresults%\VS2012_buildlog_DBEngine.txt +%msbuild% %GDWrapper2012% /property:Configuration=Release /target:Clean;Build /p:VisualStudioVersion=11.0 /p:OutputPath="%buildresults%\VS2012" > %buildresults%\VS2012_buildlog_GDBWrapper.txt +%msbuild% %VSPackage2012% /property:Configuration=Release /target:Clean;Build /p:VisualStudioVersion=11.0 /p:OutputPath="%buildresults%\VS2012" > %buildresults%\VS2012_buildlog_Package.txt +%msbuild% %VSTasks2012% /property:Configuration=Release /target:Clean;Build /p:VisualStudioVersion=11.0 /p:OutputPath="%buildresults%\VS2012" > %buildresults%\VS2012_buildlog_Tasks.txt +echo Build Done REM ******************************************************************************************** REM Build VS2013 REM ******************************************************************************************** echo Building Solution for VS2013 -%dotNetFrameworkPath2013% %AddIn2013% /property:Configuration=Release /target:Clean;Build /p:VisualStudioVersion=12.0 /p:OutputPath="%buildresults%\VS2013" > %buildresults%\VS2013_buildlog_AddIn.txt -%dotNetFrameworkPath2013% %DebugEngine2013% /property:Configuration=Release /target:Clean;Build /p:VisualStudioVersion=12.0 /p:OutputPath="%buildresults%\VS2013" > %buildresults%\VS2013_buildlog_DBEngine.txt -%dotNetFrameworkPath2013% %GDWrapper2013% /property:Configuration=Release /target:Clean;Build /p:VisualStudioVersion=12.0 /p:OutputPath="%buildresults%\VS2013" > %buildresults%\VS2013_buildlog_GDBWrapper.txt -%dotNetFrameworkPath2013% %VSPackage2013% /property:Configuration=Release /target:Clean;Build /p:VisualStudioVersion=12.0 /p:OutputPath="%buildresults%\VS2013" > %buildresults%\VS2013_buildlog_Package.txt -%dotNetFrameworkPath2013% %VSTasks2013% /property:Configuration=Release /target:Clean;Build /p:VisualStudioVersion=12.0 /p:OutputPath="%buildresults%\VS2013" > %buildresults%\VS2013_buildlog_Tasks.txt -echo Build Success +%msbuild2013% %AddIn2013% /property:Configuration=Release /target:Clean;Build /p:VisualStudioVersion=12.0 /p:OutputPath="%buildresults%\VS2013" > %buildresults%\VS2013_buildlog_AddIn.txt +%msbuild2013% %DebugEngine2013% /property:Configuration=Release /target:Clean;Build /p:VisualStudioVersion=12.0 /p:OutputPath="%buildresults%\VS2013" > %buildresults%\VS2013_buildlog_DBEngine.txt +%msbuild2013% %GDWrapper2013% /property:Configuration=Release /target:Clean;Build /p:VisualStudioVersion=12.0 /p:OutputPath="%buildresults%\VS2013" > %buildresults%\VS2013_buildlog_GDBWrapper.txt +%msbuild2013% %VSPackage2013% /property:Configuration=Release /target:Clean;Build /p:VisualStudioVersion=12.0 /p:OutputPath="%buildresults%\VS2013" > %buildresults%\VS2013_buildlog_Package.txt +%msbuild2013% %VSTasks2013% /property:Configuration=Release /target:Clean;Build /p:VisualStudioVersion=12.0 /p:OutputPath="%buildresults%\VS2013" > %buildresults%\VS2013_buildlog_Tasks.txt +echo Build Done + +:EOF +endlocal +echo [DONE] From 5991e944e1904efb1493080eb8380837900fef74 Mon Sep 17 00:00:00 2001 From: Pawel Hofman Date: Wed, 21 May 2014 01:24:45 +0200 Subject: [PATCH 087/851] Removed some compilation warnings in AddIn --- src/VSNDK.AddIn/NativeMethods.cs | 4 ++-- src/VSNDK.AddIn/VSNDKConstants.cs | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/VSNDK.AddIn/NativeMethods.cs b/src/VSNDK.AddIn/NativeMethods.cs index 4c2c5035..9f3715b7 100644 --- a/src/VSNDK.AddIn/NativeMethods.cs +++ b/src/VSNDK.AddIn/NativeMethods.cs @@ -20,8 +20,8 @@ IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR using Microsoft.VisualStudio.OLE.Interop; namespace Microsoft.VisualStudio.Project -{ - public static class NativeMethods +{ + internal static class NativeMethods { // IIDS public static readonly Guid IID_IUnknown = new Guid("{00000000-0000-0000-C000-000000000046}"); diff --git a/src/VSNDK.AddIn/VSNDKConstants.cs b/src/VSNDK.AddIn/VSNDKConstants.cs index c27674dd..eac94037 100644 --- a/src/VSNDK.AddIn/VSNDKConstants.cs +++ b/src/VSNDK.AddIn/VSNDKConstants.cs @@ -21,8 +21,8 @@ namespace VSNDK.AddIn { /// /// Command IDs exposed by VisualStudio. - /// - public static class CommandConstants + /// + internal static class CommandConstants { public const int cmdidAddSolutionSCC = 21016; public const int cmdidUndoCheckoutSCC = 21009; From 93998c481b203ada1982a22eb6dc84783df15b90 Mon Sep 17 00:00:00 2001 From: Pawel Hofman Date: Wed, 21 May 2014 01:25:26 +0200 Subject: [PATCH 088/851] Made the Package tests compile in Release mode --- src_vs2012/VSNDK.Package.Test/DiagnosticTests.cs | 7 ++++++- src_vs2012/VSNDK.Package.Test/ParserTests.cs | 6 +++++- src_vs2012/VSNDK.Package.Test/ToolRunnerTests.cs | 6 +++++- 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/src_vs2012/VSNDK.Package.Test/DiagnosticTests.cs b/src_vs2012/VSNDK.Package.Test/DiagnosticTests.cs index 912cc39f..4fa77c0f 100644 --- a/src_vs2012/VSNDK.Package.Test/DiagnosticTests.cs +++ b/src_vs2012/VSNDK.Package.Test/DiagnosticTests.cs @@ -1,4 +1,6 @@ -using System.IO; +#if DEBUG + +using System.IO; using System.Text; using NUnit.Framework; using RIM.VSNDK_Package.Diagnostics; @@ -31,3 +33,6 @@ public void PrintSomeMixedMessages() } } } + +#endif + diff --git a/src_vs2012/VSNDK.Package.Test/ParserTests.cs b/src_vs2012/VSNDK.Package.Test/ParserTests.cs index 3ecd1bac..c26c78c4 100644 --- a/src_vs2012/VSNDK.Package.Test/ParserTests.cs +++ b/src_vs2012/VSNDK.Package.Test/ParserTests.cs @@ -1,4 +1,6 @@ -using System; +#if DEBUG + +using System; using System.Windows; using NUnit.Framework; using RIM.VSNDK_Package.Model; @@ -383,3 +385,5 @@ public void ParseDeviceId() } } } + +#endif diff --git a/src_vs2012/VSNDK.Package.Test/ToolRunnerTests.cs b/src_vs2012/VSNDK.Package.Test/ToolRunnerTests.cs index 7d7735a6..29ad41b1 100644 --- a/src_vs2012/VSNDK.Package.Test/ToolRunnerTests.cs +++ b/src_vs2012/VSNDK.Package.Test/ToolRunnerTests.cs @@ -1,4 +1,6 @@ -using System; +#if DEBUG + +using System; using System.Threading; using NUnit.Framework; using RIM.VSNDK_Package.Model; @@ -174,3 +176,5 @@ public void LoadInstalledNdkInfo() } } } + +#endif From 5e942ae0279f812fbaafee7b17aca8b27dc656dc Mon Sep 17 00:00:00 2001 From: Pawel Hofman Date: Wed, 21 May 2014 01:26:12 +0200 Subject: [PATCH 089/851] Implemented IDisposable in ToolRunner As suggested by Automatic Code Analysis --- src_vs2012/VSNDK.Package/Tools/ToolRunner.cs | 35 ++++++++++++++++++-- 1 file changed, 33 insertions(+), 2 deletions(-) diff --git a/src_vs2012/VSNDK.Package/Tools/ToolRunner.cs b/src_vs2012/VSNDK.Package/Tools/ToolRunner.cs index c369e9fc..83cc3f9e 100644 --- a/src_vs2012/VSNDK.Package/Tools/ToolRunner.cs +++ b/src_vs2012/VSNDK.Package/Tools/ToolRunner.cs @@ -8,9 +8,9 @@ namespace RIM.VSNDK_Package.Tools /// /// Class that runs specified executable, captures its output and error messages, then provides to parsers. /// - internal class ToolRunner + internal class ToolRunner : IDisposable { - private readonly Process _process; + private Process _process; private StringBuilder _output; private StringBuilder _error; private bool _isProcessing; @@ -33,6 +33,11 @@ public ToolRunner() _process.ErrorDataReceived += ErrorDataReceived; } + ~ToolRunner() + { + Dispose(false); + } + /// /// Init constructor. Setups the executable and its working directory. /// @@ -116,6 +121,8 @@ public bool Execute() { if (_isProcessing) throw new InvalidOperationException("The process is already running"); + if (_process == null) + throw new ObjectDisposedException("ToolRunner"); if (string.IsNullOrEmpty(FileName)) throw new InvalidOperationException("No executable to start"); @@ -148,6 +155,8 @@ public void ExecuteAsync() { if (_isProcessing) throw new InvalidOperationException("The process is already running"); + if (_process == null) + throw new ObjectDisposedException("ToolRunner"); PrepareExecution(); @@ -258,5 +267,27 @@ protected static string ExtractErrorMessages(string error) return result.ToString(); } + + #region IDisposable Implementation + + public void Dispose() + { + Dispose(true); + GC.SuppressFinalize(this); + } + + protected virtual void Dispose(bool disposing) + { + if (disposing) + { + if (_process != null) + { + _process.Dispose(); + _process = null; + } + } + } + + #endregion } } From 9a524d312cdaf9e3db3107b168a1b7cb78a182f7 Mon Sep 17 00:00:00 2001 From: Pawel Hofman Date: Wed, 21 May 2014 01:27:03 +0200 Subject: [PATCH 090/851] Made all projects to compile in Release mode --- .gitignore | 11 ++++ VSNDKPluginBuild.bat | 75 +++++++++++++------------- src/GDBParser/GDBParser.vcxproj | 2 +- src_vs2012/GDBParser/GDBParser.vcxproj | 8 +-- src_vs2013/GDBParser/GDBParser.vcxproj | 13 +++-- 5 files changed, 62 insertions(+), 47 deletions(-) diff --git a/.gitignore b/.gitignore index 498777f1..f861475e 100644 --- a/.gitignore +++ b/.gitignore @@ -47,11 +47,16 @@ src_vs2013/VSNDK.AddIn/VSNDK.AddIn.csproj.user src_vs2013/VSNDK.Package/VSNDK.Package.csproj.user # build temp outputs +_BuildResults/ +BuildResults/ src/Debug/ +src/Release/ src/GDBParser.UnitTests/bin/ src/GDBParser.UnitTests/obj/ src/GDBParser/Debug/ +src/GDBParser/Release/ src/GDBWrapper/Debug/ +src/GDBWrapper/Release/ src/ipch/ src/VSNDK.AddIn/bin/ src/VSNDK.AddIn/obj/ @@ -67,10 +72,13 @@ src/VSNDK.Tasks/bin/ src/VSNDK.Tasks/obj/ src_vs2012/Debug/ +src_vs2012/Release/ src_vs2012/GDBParser/Debug/ +src_vs2012/GDBParser/Release/ src_vs2012/GDBParser.UnitTests/bin/ src_vs2012/GDBParser.UnitTests/obj/ src_vs2012/GDBWrapper/Debug/ +src_vs2012/GDBWrapper/Release/ src_vs2012/ipch/ src_vs2012/VSNDK.AddIn/bin/ src_vs2012/VSNDK.AddIn/obj/ @@ -86,10 +94,13 @@ src_vs2012/VSNDK.Tasks/bin/ src_vs2012/VSNDK.Tasks/obj/ src_vs2013/Debug/ +src_vs2013/Release/ src_vs2013/GDBParser.UnitTests/bin/ src_vs2013/GDBParser.UnitTests/obj/ src_vs2013/GDBParser/Debug/ +src_vs2013/GDBParser/Release/ src_vs2013/GDBWrapper/Debug/ +src_vs2013/GDBWrapper/Release/ src_vs2013/ipch/ src_vs2013/VSNDK.AddIn/bin/ src_vs2013/VSNDK.AddIn/obj/ diff --git a/VSNDKPluginBuild.bat b/VSNDKPluginBuild.bat index 25bf9224..b399d011 100644 --- a/VSNDKPluginBuild.bat +++ b/VSNDKPluginBuild.bat @@ -5,21 +5,16 @@ REM **************************************************************************** REM Declare Constants REM ******************************************************************************************** set thisDir=%~dp0 -set buildresults="%thisDir%..\buildresults" -set msbuild="C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\MsBuild.exe" -set msbuild2013="C:\Program Files (x86)\MSBuild\12.0\Bin\MsBuild.exe" +set BuildResults="%thisDir%_BuildResults" -set solutionPath2010="%thisDir%\src\VSNDK.sln" -set AddIn2012="%thisDir%\src_vs2012\VSNDK.AddIn\VSNDK.AddIn.csproj" -set DebugEngine2012="%thisDir%\src_vs2012\VSNDK.DebugEngine\VSNDK.DebugEngine.csproj" -set GDWrapper2012="%thisDir%\src_vs2012\GDBWrapper\GDBWrapper.vcxproj" -set VSPackage2012="%thisDir%\src_vs2012\VSNDK.Package\VSNDK.Package.csproj" -set VSTasks2012="%thisDir%\src_vs2012\VSNDK.Tasks\VSNDK.Tasks.csproj" -set AddIn2013="%thisDir%\src_vs2013\VSNDK.AddIn\VSNDK.AddIn.csproj" -set DebugEngine2013="%thisDir%\src_vs2013\VSNDK.DebugEngine\VSNDK.DebugEngine.csproj" -set GDWrapper2013="%thisDir%\src_vs2013\GDBWrapper\GDBWrapper.vcxproj" -set VSPackage2013="%thisDir%\src_vs2013\VSNDK.Package\VSNDK.Package.csproj" -set VSTasks2013="%thisDir%\src_vs2013\VSNDK.Tasks\VSNDK.Tasks.csproj" +set MsBuild="C:\Windows\Microsoft.NET\Framework\v4.0.30319\MsBuild.exe" +set MsBuild2013="C:\Program Files (x86)\MSBuild\12.0\Bin\MsBuild.exe" +set MsBuildCmd=%MsBuild% /property:Configuration=Release /target:Clean;Build +set MsBuild2013Cmd=%MsBuild2013% /property:Configuration=Release /target:Clean;Build + +set SolutionPath2010="%thisDir%\src\VSNDK.sln" +set SolutionPath2012="%thisDir%\src_vs2012\VSNDK.sln" +set SolutionPath2013="%thisDir%\src_vs2013\VSNDK.sln" echo Starting... echo Output folder: %buildresults% @@ -27,43 +22,45 @@ echo Output folder: %buildresults% REM ******************************************************************************************** REM Clean up old bin folder REM ******************************************************************************************** -echo Removing previous code -if not exist "%buildresults%" goto build - echo Remove Build Results - RMDIR /Q "%buildresults%" /S - MKDIR "%buildresults%" -:build +echo 1) Removing previous code... +if not exist "%BuildResults%" goto :create + rmdir /Q "%BuildResults%" /S + if errorlevel 1 ( exit /b %errorlevel% ) + + mkdir "%BuildResults%" + if errorlevel 1 ( exit /b %errorlevel% ) + + echo 1) Cleanup - DONE + goto :removed +:create + mkdir "%BuildResults%" + echo 1) Created empty folder - DONE +:removed REM ******************************************************************************************** REM Build VS2010 REM ******************************************************************************************** -REM echo Building Solution for VS2010 -REM %msbuild% %solutionPath2010% /property:Configuration=Release /target:Clean;Build /p:OutputPath="%buildresults%\VS2010" > %buildresults%\VS2010_buildlog.txt -REM echo Build Done +echo 2) Building Solution for Visual Studio 2010 +%MsBuildCmd% %SolutionPath2010% /p:OutputPath="%buildresults%\VS2010" > %buildresults%\VS2010_buildlog.txt +if errorlevel 1 ( exit /b %errorlevel% ) +echo 2) Build - DONE REM ******************************************************************************************** REM Build VS2012 REM ******************************************************************************************** -echo Building Solution for VS2012 -%msbuild% %AddIn2012% /property:Configuration=Release /target:Clean;Build /p:VisualStudioVersion=11.0 /p:OutputPath="%buildresults%\VS2012" > %buildresults%\VS2012_buildlog_AddIn.txt -%msbuild% %DebugEngine2012% /property:Configuration=Release /target:Clean;Build /p:VisualStudioVersion=11.0 /p:OutputPath="%buildresults%\VS2012" > %buildresults%\VS2012_buildlog_DBEngine.txt -%msbuild% %GDWrapper2012% /property:Configuration=Release /target:Clean;Build /p:VisualStudioVersion=11.0 /p:OutputPath="%buildresults%\VS2012" > %buildresults%\VS2012_buildlog_GDBWrapper.txt -%msbuild% %VSPackage2012% /property:Configuration=Release /target:Clean;Build /p:VisualStudioVersion=11.0 /p:OutputPath="%buildresults%\VS2012" > %buildresults%\VS2012_buildlog_Package.txt -%msbuild% %VSTasks2012% /property:Configuration=Release /target:Clean;Build /p:VisualStudioVersion=11.0 /p:OutputPath="%buildresults%\VS2012" > %buildresults%\VS2012_buildlog_Tasks.txt -echo Build Done +echo 3) Building Solution for Visual Studio 2012 +%MsBuildCmd% %SolutionPath2012% /p:OutputPath="%buildresults%\VS2012" /p:VisualStudioVersion=11.0 > %buildresults%\VS2012_buildlog.txt +if errorlevel 1 ( exit /b %errorlevel% ) +echo 3) Build - DONE REM ******************************************************************************************** REM Build VS2013 REM ******************************************************************************************** -echo Building Solution for VS2013 -%msbuild2013% %AddIn2013% /property:Configuration=Release /target:Clean;Build /p:VisualStudioVersion=12.0 /p:OutputPath="%buildresults%\VS2013" > %buildresults%\VS2013_buildlog_AddIn.txt -%msbuild2013% %DebugEngine2013% /property:Configuration=Release /target:Clean;Build /p:VisualStudioVersion=12.0 /p:OutputPath="%buildresults%\VS2013" > %buildresults%\VS2013_buildlog_DBEngine.txt -%msbuild2013% %GDWrapper2013% /property:Configuration=Release /target:Clean;Build /p:VisualStudioVersion=12.0 /p:OutputPath="%buildresults%\VS2013" > %buildresults%\VS2013_buildlog_GDBWrapper.txt -%msbuild2013% %VSPackage2013% /property:Configuration=Release /target:Clean;Build /p:VisualStudioVersion=12.0 /p:OutputPath="%buildresults%\VS2013" > %buildresults%\VS2013_buildlog_Package.txt -%msbuild2013% %VSTasks2013% /property:Configuration=Release /target:Clean;Build /p:VisualStudioVersion=12.0 /p:OutputPath="%buildresults%\VS2013" > %buildresults%\VS2013_buildlog_Tasks.txt -echo Build Done - +echo 4) Building Solution for Visual Studio 2013 +%MsBuildCmd% %SolutionPath2013% /p:OutputPath="%buildresults%\VS2013" /p:VisualStudioVersion=12.0 > %buildresults%\VS2013_buildlog.txt +if errorlevel 1 ( exit /b %errorlevel% ) +echo 4) Build - DONE :EOF endlocal -echo [DONE] +echo [ALL DONE] diff --git a/src/GDBParser/GDBParser.vcxproj b/src/GDBParser/GDBParser.vcxproj index 87884437..ba376cd2 100644 --- a/src/GDBParser/GDBParser.vcxproj +++ b/src/GDBParser/GDBParser.vcxproj @@ -100,7 +100,7 @@ ProgramDatabase - true + false psapi.lib;$(VSInstallDir)\DIA SDK\lib\diaguids.lib;%(AdditionalDependencies) GDBParser.def true diff --git a/src_vs2012/GDBParser/GDBParser.vcxproj b/src_vs2012/GDBParser/GDBParser.vcxproj index c12f8528..86ec17af 100644 --- a/src_vs2012/GDBParser/GDBParser.vcxproj +++ b/src_vs2012/GDBParser/GDBParser.vcxproj @@ -103,7 +103,7 @@ ProgramDatabase - true + false psapi.lib;$(VSInstallDir)\DIA SDK\lib\diaguids.lib;%(AdditionalDependencies) GDBParser.def true @@ -116,7 +116,7 @@ MachineX86 - xcopy "$(ProjectDir)Instructions.txt" "$(OutputPath)" /d /y + xcopy "$(ProjectDir)..\..\src\GDBParser\Instructions.txt" "$(OutputPath)" /d /y Copying Instructions.txt to output directory. @@ -146,7 +146,9 @@ - + + false + diff --git a/src_vs2013/GDBParser/GDBParser.vcxproj b/src_vs2013/GDBParser/GDBParser.vcxproj index 7c23710b..f47e74d2 100644 --- a/src_vs2013/GDBParser/GDBParser.vcxproj +++ b/src_vs2013/GDBParser/GDBParser.vcxproj @@ -59,6 +59,9 @@ $(ReferencePath) $(ProgramFiles)\Microsoft Visual Studio 12.0\DIA SDK\lib\;$(ProgramFiles)\Microsoft Visual Studio 11.0\DIA SDK\lib\;$(LibraryPath) + + $(ProgramFiles)\Microsoft Visual Studio 12.0\DIA SDK\lib\;$(ProgramFiles)\Microsoft Visual Studio 11.0\DIA SDK\lib\;$(LibraryPath) + Disabled @@ -102,8 +105,8 @@ ProgramDatabase - true - psapi.lib;$(VSInstallDir_120)DIA SDK\lib\diaguids.lib;%(AdditionalDependencies) + false + psapi.lib;diaguids.lib;%(AdditionalDependencies) GDBParser.def true Windows @@ -115,7 +118,7 @@ MachineX86 - xcopy "$(ProjectDir)Instructions.txt" "$(OutputPath)" /d /y + xcopy "$(ProjectDir)..\..\src\GDBParser\Instructions.txt" "$(OutputPath)" /d /y Copying Instructions.txt to output directory. @@ -145,7 +148,9 @@ - + + false + From ce5b19aa3f2374aff1ea609222623ae74bfca197 Mon Sep 17 00:00:00 2001 From: Pawel Hofman Date: Wed, 21 May 2014 02:53:09 +0200 Subject: [PATCH 091/851] Added detection of PlayBook SDK and profile on Windows XP --- .../VSNDK.Package/Tools/RunnerDefaults.cs | 37 ++++++++++++++++++- .../ViewModels/PackageViewModel.cs | 4 +- 2 files changed, 39 insertions(+), 2 deletions(-) diff --git a/src_vs2012/VSNDK.Package/Tools/RunnerDefaults.cs b/src_vs2012/VSNDK.Package/Tools/RunnerDefaults.cs index f0d75637..f97e745b 100644 --- a/src_vs2012/VSNDK.Package/Tools/RunnerDefaults.cs +++ b/src_vs2012/VSNDK.Package/Tools/RunnerDefaults.cs @@ -13,15 +13,26 @@ internal static class RunnerDefaults public static readonly string DataDirectory; public static readonly string InstallationConfigDirectory; public static readonly string SupplementaryInstallationConfigDirectory; + public static readonly string SupplementaryPlayBookInstallationConfigDirectory; public static readonly string RegistryPath; static RunnerDefaults() { ToolsDirectory = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86), "BlackBerry", "VSPlugin-NDK", "qnxtools", "bin"); NdkDirectory = Path.Combine(Path.GetPathRoot(Environment.GetFolderPath(Environment.SpecialFolder.System)), "bbndk_vs"); - DataDirectory = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "Research In Motion"); + // the base data folder is different for each platform... + if (IsWindowsXP) + { + DataDirectory = Path.Combine(Environment.ExpandEnvironmentVariables("%HomeDrive%"), Environment.ExpandEnvironmentVariables("%HomePath%"), "Local Settings", "Application Data", "Research In Motion"); + } + else + { + DataDirectory = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "Research In Motion"); + } + InstallationConfigDirectory = Path.Combine(DataDirectory, "BlackBerry Native SDK", "qconfig"); SupplementaryInstallationConfigDirectory = Path.Combine(Path.GetPathRoot(Environment.GetFolderPath(Environment.SpecialFolder.System)), "bbndk_vs", "..", "qconfig"); + SupplementaryPlayBookInstallationConfigDirectory = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles), "QNX Software Systems", "qconfig"); RegistryPath = @"Software\BlackBerry\BlackBerryVSPlugin"; #if DEBUG @@ -42,5 +53,29 @@ public static string DataFileName(string fileName) return Path.Combine(DataDirectory, fileName); } + + /// + /// Gets an indication, if currently running on Windows XP. + /// + public static bool IsWindowsXP + { + get + { + var os = Environment.OSVersion; + return os.Platform == PlatformID.Win32NT && os.Version.Major == 5 && os.Version.Minor == 1; + } + } + + /// + /// Gets an indication, if currently running on Windows XP, Vista, 7, 8 or newer system. + /// + public static bool IsWindowsXPorNewer + { + get + { + var os = Environment.OSVersion; + return os.Platform == PlatformID.Win32NT && (os.Version.Major > 5 || (os.Version.Major == 5 && os.Version.Minor == 1)); + } + } } } diff --git a/src_vs2012/VSNDK.Package/ViewModels/PackageViewModel.cs b/src_vs2012/VSNDK.Package/ViewModels/PackageViewModel.cs index 4541c627..3e201627 100644 --- a/src_vs2012/VSNDK.Package/ViewModels/PackageViewModel.cs +++ b/src_vs2012/VSNDK.Package/ViewModels/PackageViewModel.cs @@ -63,7 +63,9 @@ public NdkInfo[] InstalledNDKs if (_installedNDKs == null) { // load info about NDKs from specified locations: - _installedNDKs = NdkInfo.Load(RunnerDefaults.InstallationConfigDirectory, RunnerDefaults.SupplementaryInstallationConfigDirectory); + _installedNDKs = NdkInfo.Load(RunnerDefaults.InstallationConfigDirectory, + RunnerDefaults.SupplementaryInstallationConfigDirectory, + RunnerDefaults.SupplementaryPlayBookInstallationConfigDirectory); } return _installedNDKs; From 1691b823d834ca152388833244edd48754389c0b Mon Sep 17 00:00:00 2001 From: Pawel Hofman Date: Wed, 21 May 2014 11:56:14 +0200 Subject: [PATCH 092/851] Updated script to allow selective solution build --- VSNDKPluginBuild.bat | 92 +++++++++++++++++++++++++++++++++----------- 1 file changed, 70 insertions(+), 22 deletions(-) diff --git a/VSNDKPluginBuild.bat b/VSNDKPluginBuild.bat index b399d011..d918433f 100644 --- a/VSNDKPluginBuild.bat +++ b/VSNDKPluginBuild.bat @@ -1,65 +1,113 @@ @echo off -setlocal +setlocal enableextensions + +REM ******************************************************************************************** +REM Allow selective build +REM ******************************************************************************************** + +:: Process parameters, to limit the solutions to build +if "%~1" == "" ( + set ActionClean=1 + set ActionBuildVS2010=1 + set ActionBuildVS2012=1 + set ActionBuildVS2013=1 +) else ( + set ActionClean=1 + set ActionBuildVS2010=0 + set ActionBuildVS2012=0 + set ActionBuildVS2013=0 + for %%a in (%*) do ( + if /i "%%a" == "/ActionNoClean" set ActionClean=0 + if /i "%%a" == "/no-clean" set ActionClean=0 + if /i "%%a" == "vs2010" set ActionBuildVS2010=1 + if /i "%%a" == "vs2012" set ActionBuildVS2012=1 + if /i "%%a" == "vs2013" set ActionBuildVS2013=1 + ) +) REM ******************************************************************************************** REM Declare Constants REM ******************************************************************************************** +set /A actionNo=1 set thisDir=%~dp0 set BuildResults="%thisDir%_BuildResults" set MsBuild="C:\Windows\Microsoft.NET\Framework\v4.0.30319\MsBuild.exe" set MsBuild2013="C:\Program Files (x86)\MSBuild\12.0\Bin\MsBuild.exe" -set MsBuildCmd=%MsBuild% /property:Configuration=Release /target:Clean;Build -set MsBuild2013Cmd=%MsBuild2013% /property:Configuration=Release /target:Clean;Build +set MsBuildCmd=%MsBuild% /property:Configuration=Release /target:Rebuild +set MsBuild2013Cmd=%MsBuild2013% /property:Configuration=Release /target:Rebuild set SolutionPath2010="%thisDir%\src\VSNDK.sln" set SolutionPath2012="%thisDir%\src_vs2012\VSNDK.sln" set SolutionPath2013="%thisDir%\src_vs2013\VSNDK.sln" echo Starting... -echo Output folder: %buildresults% +echo Output folder: %BuildResults% REM ******************************************************************************************** REM Clean up old bin folder REM ******************************************************************************************** -echo 1) Removing previous code... -if not exist "%BuildResults%" goto :create +if %ActionClean% equ 0 (goto skip_clean) + +echo %actionNo%: Removing previous code... +if not exist "%BuildResults%" ( + mkdir "%BuildResults%" + echo %actionNo%: Created empty folder - DONE + +) else ( rmdir /Q "%BuildResults%" /S if errorlevel 1 ( exit /b %errorlevel% ) mkdir "%BuildResults%" if errorlevel 1 ( exit /b %errorlevel% ) - - echo 1) Cleanup - DONE - goto :removed -:create - mkdir "%BuildResults%" - echo 1) Created empty folder - DONE -:removed + echo %actionNo%: Cleanup - DONE +) +set /a actionNo += 1 +:skip_clean + REM ******************************************************************************************** REM Build VS2010 REM ******************************************************************************************** -echo 2) Building Solution for Visual Studio 2010 -%MsBuildCmd% %SolutionPath2010% /p:OutputPath="%buildresults%\VS2010" > %buildresults%\VS2010_buildlog.txt +if %ActionBuildVS2010% equ 0 (goto skip_vs2010) + +echo %actionNo%: Building Solution for Visual Studio 2010 +%MsBuildCmd% %SolutionPath2010% /p:OutputPath="%BuildResults%\VS2010" > %BuildResults%\VS2010_buildlog.txt if errorlevel 1 ( exit /b %errorlevel% ) -echo 2) Build - DONE +echo %actionNo%: Build - DONE +set /a actionNo += 1 + +:skip_vs2010 REM ******************************************************************************************** REM Build VS2012 REM ******************************************************************************************** -echo 3) Building Solution for Visual Studio 2012 -%MsBuildCmd% %SolutionPath2012% /p:OutputPath="%buildresults%\VS2012" /p:VisualStudioVersion=11.0 > %buildresults%\VS2012_buildlog.txt +if %ActionBuildVS2012% equ 0 (goto skip_vs2012) + +echo %actionNo%: Building Solution for Visual Studio 2012 +%MsBuildCmd% %SolutionPath2012% /p:OutputPath="%BuildResults%\VS2012" /p:VisualStudioVersion=11.0 > %BuildResults%\VS2012_buildlog.txt if errorlevel 1 ( exit /b %errorlevel% ) -echo 3) Build - DONE +echo %actionNo%: Build - DONE +set /a actionNo += 1 + +:skip_vs2012 REM ******************************************************************************************** REM Build VS2013 REM ******************************************************************************************** -echo 4) Building Solution for Visual Studio 2013 -%MsBuildCmd% %SolutionPath2013% /p:OutputPath="%buildresults%\VS2013" /p:VisualStudioVersion=12.0 > %buildresults%\VS2013_buildlog.txt +if %ActionBuildVS2013% equ 0 (goto skip_vs2013) + +echo %actionNo%: Building Solution for Visual Studio 2013 +%MsBuild2013Cmd% %SolutionPath2013% /p:OutputPath="%BuildResults%\VS2013" /p:VisualStudioVersion=12.0 > %BuildResults%\VS2013_buildlog.txt if errorlevel 1 ( exit /b %errorlevel% ) -echo 4) Build - DONE +echo %actionNo%: Build - DONE +set /a actionNo += 1 + +:skip_vs2013 + +REM ******************************************************************************************** +REM DONE +REM ******************************************************************************************** :EOF endlocal From ba2f9bc95a11443882492164615383cde4514d41 Mon Sep 17 00:00:00 2001 From: Pawel Hofman Date: Wed, 21 May 2014 11:57:08 +0200 Subject: [PATCH 093/851] Renamed build script --- VSNDKPluginBuild.bat => build.bat | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename VSNDKPluginBuild.bat => build.bat (100%) diff --git a/VSNDKPluginBuild.bat b/build.bat similarity index 100% rename from VSNDKPluginBuild.bat rename to build.bat From 95442d89317ec3250734d951ccd8861f7d1db421 Mon Sep 17 00:00:00 2001 From: Pawel Hofman Date: Wed, 21 May 2014 11:57:41 +0200 Subject: [PATCH 094/851] Renamed clean temporary file script Although I would rather recommend to use, to remove unnecessary files: git clean -f -x -d --- CleanFiles.bat => clean.bat | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename CleanFiles.bat => clean.bat (100%) diff --git a/CleanFiles.bat b/clean.bat similarity index 100% rename from CleanFiles.bat rename to clean.bat From 01f3d589e26a1ca4a95d5803e7f5a59ed1b79f06 Mon Sep 17 00:00:00 2001 From: Pawel Hofman Date: Wed, 21 May 2014 15:50:12 +0200 Subject: [PATCH 095/851] Improved ProgramFiles detection in build script --- build.bat | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/build.bat b/build.bat index d918433f..35737364 100644 --- a/build.bat +++ b/build.bat @@ -32,8 +32,11 @@ set /A actionNo=1 set thisDir=%~dp0 set BuildResults="%thisDir%_BuildResults" +set ProgFilesRoot=%ProgramFiles(x86)% +if "%ProgFilesRoot%" == "" set ProgFilesRoot=%ProgramFiles% + set MsBuild="C:\Windows\Microsoft.NET\Framework\v4.0.30319\MsBuild.exe" -set MsBuild2013="C:\Program Files (x86)\MSBuild\12.0\Bin\MsBuild.exe" +set MsBuild2013="%ProgFilesRoot%\MSBuild\12.0\Bin\MsBuild.exe" set MsBuildCmd=%MsBuild% /property:Configuration=Release /target:Rebuild set MsBuild2013Cmd=%MsBuild2013% /property:Configuration=Release /target:Rebuild From 75ed4055b624603510942fc366af0c13c10a57db Mon Sep 17 00:00:00 2001 From: Pawel Hofman Date: Wed, 21 May 2014 16:06:05 +0200 Subject: [PATCH 096/851] Build script generates (un-)installation scripts --- build.bat | 111 +++++++++++++++++++++++++++++++++++++-- setup_install.template | 103 ++++++++++++++++++++++++++++++++++++ setup_uninstall.template | 27 ++++++++++ 3 files changed, 236 insertions(+), 5 deletions(-) create mode 100644 setup_install.template create mode 100644 setup_uninstall.template diff --git a/build.bat b/build.bat index 35737364..596c1eb7 100644 --- a/build.bat +++ b/build.bat @@ -8,20 +8,25 @@ REM **************************************************************************** :: Process parameters, to limit the solutions to build if "%~1" == "" ( set ActionClean=1 + set ActionGenScripts=1 set ActionBuildVS2010=1 set ActionBuildVS2012=1 set ActionBuildVS2013=1 ) else ( set ActionClean=1 + set ActionGenScripts=0 set ActionBuildVS2010=0 set ActionBuildVS2012=0 set ActionBuildVS2013=0 for %%a in (%*) do ( - if /i "%%a" == "/ActionNoClean" set ActionClean=0 - if /i "%%a" == "/no-clean" set ActionClean=0 - if /i "%%a" == "vs2010" set ActionBuildVS2010=1 - if /i "%%a" == "vs2012" set ActionBuildVS2012=1 - if /i "%%a" == "vs2013" set ActionBuildVS2013=1 + if /i "%%a" == "/noclean" set ActionClean=0 + if /i "%%a" == "/no-clean" set ActionClean=0 + if /i "%%a" == "/scripts" set ActionGenScripts=1 + if /i "%%a" == "/noscripts" set ActionGenScripts=0 + if /i "%%a" == "/no-scripts" set ActionGenScripts=0 + if /i "%%a" == "vs2010" set ActionBuildVS2010=1 && set ActionGenScripts=1 + if /i "%%a" == "vs2012" set ActionBuildVS2012=1 && set ActionGenScripts=1 + if /i "%%a" == "vs2013" set ActionBuildVS2013=1 && set ActionGenScripts=1 ) ) @@ -108,6 +113,102 @@ set /a actionNo += 1 :skip_vs2013 +REM ******************************************************************************************** +REM Create Installation/Uninstallation Registry Scripts +REM ******************************************************************************************** +if %ActionGenScripts% equ 0 (goto skip_scripts) + +echo %actionNo%: Creating installation scripts +call :processTemplates 2010 10.0 +call :processTemplates 2012 11.0 +call :processTemplates 2013 12.0 + +echo %actionNo%: Writing - DONE +set /a actionNo += 1 + +:skip_scripts + +REM ******************************************************************************************** +REM Helper functions +REM ******************************************************************************************** +goto EOF + +REM ******************************************************************************************** +REM Generates a set of templates for specified Visual Studio version +REM $1 - Visual Studio number (2010) +REM $2 - Visual Studio version (10.0) +:processTemplates +setlocal EnableDelayedExpansion + +set InstallTemplate="%thisDir%setup_install.template" +set UninstallTemplate="%thisDir%setup_uninstall.template" + +set VSYear=%~1 +set VSVersion=%~2 +set PluginRegistryNodeName=BlackBerryVSPlugin +set PluginPathX86="C:\Program Files\BlackBerry\VSPlugin-NDK" +set PluginPathX64="C:\Program Files (x86)\BlackBerry\VSPlugin-NDK" + +set InstallOutputFileX86="%BuildResults%\setup_VS%VSYear%_install_x86.reg" +set InstallOutputFileX64="%BuildResults%\setup_VS%VSYear%_install_x64.reg" +set UninstallOutputFile="%BuildResults%\setup_VS%VSYear%_uninstall.reg" + +call :processTemplate %InstallTemplate% %InstallOutputFileX86% %VSYear% %VSVersion% %PluginRegistryNodeName% %PluginPathX86% +call :processTemplate %InstallTemplate% %InstallOutputFileX64% %VSYear% %VSVersion% %PluginRegistryNodeName% %PluginPathX64% + +call :processTemplate %UninstallTemplate% %UninstallOutputFile% %VSYear% %VSVersion% %PluginRegistryNodeName% "" + +endlocal +exit /b + +REM ******************************************************************************************** +REM Generates single file from specified template +REM $1 - input template path +REM $2 - output name +REM $3 - Visual Studio number (2010) +REM $4 - Visual Studio version (10.0) +REM $5 - registry node name of the plugin (BlackBerryVSPlugin) +REM $6 - plugin installation directory (C:\Program Files (x86)\BlackBerry\VSPlugin-NDK) +:processTemplate +setlocal EnableDelayedExpansion + +set InputFile=%~1 +set OutputFile=%~2 +set OutputShortFileName=%~n2%~x2 +set VSYear=%~3 +set VSVersion=%~4 +set PluginRegistryNodeName=%~5 +set PluginPath=%~6 + +REM Tweak a bit the path, to be better consumed by delayed evaluation +REM and printed correctly into output (preserve parenthesis and double path-chars) +set PluginPath=!PluginPath:\=\\! +set PluginPath=!PluginPath:(=^^(! +set PluginPath=!PluginPath:)=^^)! + +REM Create empty file +type nul > %OutputFile% + +for /f "tokens=* delims=" %%l in (%InputFile%) do ( + set line=%%l + + REM Inject empty line, so the sections are easier visible + set first=!line:~0,1! + if "!first!" == "[" echo.>> %OutputFile% + + REM Replace markers within the template + set line=!line:#VSVersion#=%VSVersion%! + set line=!line:#VSYear#=%VSYear%! + set line=!line:#PluginRegistryNodeName#=%PluginRegistryNodeName%! + set line=!line:#PluginPath#=%PluginPath%! + echo.!line! >> %OutputFile% +) +echo.>> %OutputFile% +echo Completed template "%OutputShortFileName%" + +endlocal +exit /b + REM ******************************************************************************************** REM DONE REM ******************************************************************************************** diff --git a/setup_install.template b/setup_install.template new file mode 100644 index 00000000..9ae62bce --- /dev/null +++ b/setup_install.template @@ -0,0 +1,103 @@ +REGEDIT4 + +[HKEY_CURRENT_USER\SOFTWARE\BlackBerry\#PluginRegistryNodeName#] +"device_password"="" +"device_IP"="169.254.0.1" +"simulator_password"="" +"simulator_IP"="" +"NDKHostPath"="" +"NDKTargetPath"="" +"NDKRemotePath"="" + +[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\AD7Metrics\Engine\{E5A37609-2F43-4830-AA85-D94CFA035DD2}] +"AddressBP"=dword:00000000 +"AutoSelectPriority"=dword:00000004 +"CallstackBP"=dword:00000001 +"ProgramProvider"="{AD06FD46-C790-4D5C-A274-8815DF9511B8}" +"Attach"=dword:00000001 +"CLSID"="{904AA6E0-942C-4D11-9094-7BAAEB3EE4B9}" +"AlwaysLoadLocal"="1" +"PortSupplier"="{92A2B753-00BD-40FF-9964-6AB64A1D6C9F}" +"Name"="VSNDK Debug Engine" +@="guidDebuggingSampleEngine" + +[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\AD7Metrics\Engine\{E5A37609-2F43-4830-AA85-D94CFA035DD2}\IncompatibleList] +"guidScriptEng"="{F200A7E7-DEA5-11D0-B854-00A0244A1DE2}" +"guidNativeOnlyEng"="{449EC4CC-30D2-4032-9256-EE18EB41B62B}" +"guidCOMPlusOnlyEng"="{449EC4CC-30D2-4032-9256-EE18EB41B62B}" +"guidCOMPlusNativeEng"="{92EF0900-2251-11D2-B72E-0000F87572EF}" + +[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\#VSVersion#\CLSID\{AD06FD46-C790-4D5C-A274-8815DF9511B8}] +"CodeBase"="#PluginPath#\\VSNDK.DebugEngine.dll" +"InprocServer32"="C:\\Windows\\System32\\mscoree.dll" +"Class"="VSNDK.DebugEngine.AD7ProgramProvider" +"Assembly"="VSNDK.DebugEngine" + +[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\#VSVersion#\CLSID\{904AA6E0-942C-4D11-9094-7BAAEB3EE4B9}] +"CodeBase"="#PluginPath#\\VSNDK.DebugEngine.dll" +"InprocServer32"="C:\\Windows\\System32\\mscoree.dll" +"Class"="VSNDK.DebugEngine.AD7Engine" +"Assembly"="VSNDK.DebugEngine" + +[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\#VSVersion#\CLSID\{BDC2218C-D50C-4A5A-A2F6-66BDC94FF8D6}] +@="BlackBerrySupplier" +"Assembly"="VSNDK.DebugEngine" +"Class"="VSNDK.DebugEngine.AD7PortSupplier" +"InprocServer32"="C:\\Windows\\System32\\mscoree.dll" +"CodeBase"="#PluginPath#\\VSNDK.DebugEngine.dll" +"ThreadingModel"="Free" + +[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\#VSVersion#\AD7Metrics\PortSupplier\{92A2B753-00BD-40FF-9964-6AB64A1D6C9F}] +"Name"="BlackBerry" +"DisallowUserEnteredPorts"=dword:00000000 +"CLSID"="{BDC2218C-D50C-4A5A-A2F6-66BDC94FF8D6}" +@="Visual Studio Plug-in for BlackBerry" +"PortPickerCLSID"="{3FAA02D6-72D8-4F69-A1E6-BB05ECB4E37A}" + +[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\#VSVersion#\AD7Metrics\Engine\{E5A37609-2F43-4830-AA85-D94CFA035DD2}] +"AlwaysLoadLocal"="1" +"PortSupplier"="{BDC2218C-D50C-4A5A-A2F6-66BDC94FF8D6}" +"Name"="VSNDK Debug Engine" +"CallstackBP"=dword:00000001 +"AutoSelectPriority"=dword:00000004 +"AddressBP"=dword:00000000 +"Attach"=dword:00000001 +"ProgramProvider"="{AD06FD46-C790-4D5C-A274-8815DF9511B8}" +"CLSID"="{904AA6E0-942C-4D11-9094-7BAAEB3EE4B9}" +@="guidDebuggingSampleEngine" + +[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\#VSVersion#\AD7Metrics\Engine\{E5A37609-2F43-4830-AA85-D94CFA035DD2}\IncompatibleList] +"guidScriptEng"="{F200A7E7-DEA5-11D0-B854-00A0244A1DE2}" +"guidNativeOnlyEng"="{449EC4CC-30D2-4032-9256-EE18EB41B62B}" +"guidCOMPlusOnlyEng"="{449EC4CC-30D2-4032-9256-EE18EB41B62B}" +"guidCOMPlusNativeEng"="{92EF0900-2251-11D2-B72E-0000F87572EF}" + +[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\#VSVersion#\CLSID\{AD06FD46-C790-4D5C-A274-8815DF9511B8}] +"CodeBase"="#PluginPath#\\VSNDK.DebugEngine.dll" +"InprocServer32"="C:\\Windows\\System32\\mscoree.dll" +"Class"="VSNDK.DebugEngine.AD7ProgramProvider" +"Assembly"="VSNDK.DebugEngine" + +[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\#VSVersion#\CLSID\{904AA6E0-942C-4D11-9094-7BAAEB3EE4B9}] +"CodeBase"="#PluginPath#\\VSNDK.DebugEngine.dll" +"Assembly"="VSNDK.DebugEngine" +"Class"="VSNDK.DebugEngine.AD7Engine" +"InprocServer32"="C:\\Windows\\System32\\mscoree.dll" + +[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\#VSVersion#\AD7Metrics\Engine\{E5A37609-2F43-4830-AA85-D94CFA035DD2}] +"Attach"=dword:00000001 +"ProgramProvider"="{AD06FD46-C790-4D5C-A274-8815DF9511B8}" +"CLSID"="{904AA6E0-942C-4D11-9094-7BAAEB3EE4B9}" +@="guidDebuggingSampleEngine" +"AlwaysLoadLocal"="1" +"AutoSelectPriority"=dword:00000004 +"PortSupplier"="{92A2B753-00BD-40FF-9964-6AB64A1D6C9F}" +"Name"="VSNDK Debug Engine" +"CallstackBP"=dword:00000001 +"AddressBP"=dword:00000000 + +[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\#VSVersion#\AD7Metrics\Engine\{E5A37609-2F43-4830-AA85-D94CFA035DD2}\IncompatibleList] +"guidNativeOnlyEng"="{449EC4CC-30D2-4032-9256-EE18EB41B62B}" +"guidCOMPlusOnlyEng"="{449EC4CC-30D2-4032-9256-EE18EB41B62B}" +"guidScriptEng"="{F200A7E7-DEA5-11D0-B854-00A0244A1DE2}" +"guidCOMPlusNativeEng"="{92EF0900-2251-11D2-B72E-0000F87572EF}" \ No newline at end of file diff --git a/setup_uninstall.template b/setup_uninstall.template new file mode 100644 index 00000000..8865531f --- /dev/null +++ b/setup_uninstall.template @@ -0,0 +1,27 @@ +REGEDIT4 + +[-HKEY_CURRENT_USER\SOFTWARE\BlackBerry\#PluginRegistryNodeName#] + +[-HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\AD7Metrics\Engine\{E5A37609-2F43-4830-AA85-D94CFA035DD2}\IncompatibleList] + +[-HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\AD7Metrics\Engine\{E5A37609-2F43-4830-AA85-D94CFA035DD2}] + +[-HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\#VSVersion#\CLSID\{AD06FD46-C790-4D5C-A274-8815DF9511B8}] + +[-HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\#VSVersion#\CLSID\{904AA6E0-942C-4D11-9094-7BAAEB3EE4B9}] + +[-HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\#VSVersion#\CLSID\{BDC2218C-D50C-4A5A-A2F6-66BDC94FF8D6}] + +[-HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\#VSVersion#\AD7Metrics\PortSupplier\{92A2B753-00BD-40FF-9964-6AB64A1D6C9F}] + +[-HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\#VSVersion#\AD7Metrics\Engine\{E5A37609-2F43-4830-AA85-D94CFA035DD2}\IncompatibleList] + +[-HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\#VSVersion#\AD7Metrics\Engine\{E5A37609-2F43-4830-AA85-D94CFA035DD2}] + +[-HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\#VSVersion#\CLSID\{AD06FD46-C790-4D5C-A274-8815DF9511B8}] + +[-HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\#VSVersion#\CLSID\{904AA6E0-942C-4D11-9094-7BAAEB3EE4B9}] + +[-HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\#VSVersion#\AD7Metrics\Engine\{E5A37609-2F43-4830-AA85-D94CFA035DD2}\IncompatibleList] + +[-HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\#VSVersion#\AD7Metrics\Engine\{E5A37609-2F43-4830-AA85-D94CFA035DD2}] \ No newline at end of file From 77c6df648f5e15fc6b7dbff407d4339151cfaecf Mon Sep 17 00:00:00 2001 From: Pawel Hofman Date: Wed, 21 May 2014 17:43:46 +0200 Subject: [PATCH 097/851] Updated setup script to do instal and remove Single script to install and completelly remove the plugin. It requires the build.bat to be called first, to prepare the binaries. It also allowes a selective call to work for single Visual Studio edition. --- VSNDKPluginSetup.bat | 408 +++++++++++++++++++++++++++++++------------ 1 file changed, 295 insertions(+), 113 deletions(-) diff --git a/VSNDKPluginSetup.bat b/VSNDKPluginSetup.bat index dcf95c0e..ef42693d 100644 --- a/VSNDKPluginSetup.bat +++ b/VSNDKPluginSetup.bat @@ -1,118 +1,300 @@ -echo off - -REM //******************************************************************************************** -REM // Batch Constants -REM // thisDir = working directory of current batch file. -REM // buildresults = Directory containing the build results. -REM ********************************************************************************************** +@echo off +setlocal EnableExtensions + +REM ******************************************************************************************** +REM Allow selective installation/uninstallation +REM ******************************************************************************************** + +:: Process parameters, to limit processing +if "%~1" == "" ( + set ActionVS2010=1 + set ActionVS2012=1 + set ActionVS2013=1 + set ActionUninstall=0 +) else ( + set ActionVS2010=0 + set ActionVS2012=0 + set ActionVS2013=0 + set ActionUninstall=0 + for %%a in (%*) do ( + if /i "%%a" == "/all" set ActionVS2010=1 && set ActionVS2012=1 && set ActionVS2013=1 + if /i "%%a" == "/uninstall" set ActionUninstall=1 + if /i "%%a" == "/u" set ActionUninstall=1 + if /i "%%a" == "/delete" set ActionUninstall=1 + if /i "%%a" == "/del" set ActionUninstall=1 + if /i "%%a" == "vs2010" set ActionVS2010=1 + if /i "%%a" == "vs2012" set ActionVS2012=1 + if /i "%%a" == "vs2013" set ActionVS2013=1 + ) +) + +REM ******************************************************************************************** +REM Declare Constants +REM ******************************************************************************************** +set /A actionNo=1 set thisDir=%~dp0 -set buildresults=%thisDir%..\buildresults\VS2010 -set ProgRoot=%ProgramFiles(x86)% -set AllUsers=%ALLUSERSPROFILE% -set AppData=%APPDATA% -set drive=%cd:~0,3% - -if "%ProgramFiles(x86)%XXX"=="XXX" ( -echo 32-bit -set ProgRoot=%ProgramFiles% -) -echo %ProgRoot% - -REM //******************************************************************************************** -REM // Copy AddIn Files -REM ********************************************************************************************** -echo Copy "%buildresults%\VSNDK.AddIn.AddIn" to "%AllUsers%\Microsoft\MSEnvShared\Addins\VSNDK.AddIn.AddIn" -copy "%buildresults%\VSNDK.AddIn.AddIn" "%AllUsers%\Microsoft\MSEnvShared\Addins\VSNDK.AddIn.AddIn" -echo Copy "%buildresults%\VSNDK.AddIn.dll" to "%AllUsers%\Microsoft\MSEnvShared\Addins\VSNDK.AddIn.dll" -copy "%buildresults%\VSNDK.AddIn.dll" "%AllUsers%\Microsoft\MSEnvShared\Addins\VSNDK.AddIn.dll" - -REM //******************************************************************************************** -REM // Copy GDBParser and DebugEngine Files -REM ********************************************************************************************** -echo Make Directory "%ProgRoot%\BlackBerry\VSPlugin-NDK" -md "%ProgRoot%\BlackBerry\VSPlugin-NDK" -echo Copy "%buildresults%\GDBParser.dll" to "%ProgRoot%\BlackBerry\VSPlugin-NDK\GDBParser.dll" -copy "%buildresults%\GDBParser.dll" "%ProgRoot%\BlackBerry\VSPlugin-NDK\GDBParser.dll" -echo Copy "%buildresults%\GDBWrapper.exe" to "%ProgRoot%\BlackBerry\VSPlugin-NDK\GDBWrapper.exe" -copy "%buildresults%\GDBWrapper.exe" "%ProgRoot%\BlackBerry\VSPlugin-NDK\GDBWrapper.exe" -echo Copy "%buildresults%\Instructions.txt" to "%ProgRoot%\BlackBerry\VSPlugin-NDK\Instructions.txt" -copy "%buildresults%\Instructions.txt" "%ProgRoot%\BlackBerry\VSPlugin-NDK\Instructions.txt" -echo Copy "%buildresults%\VSNDK.DebugEngine.dll" to "%ProgRoot%\BlackBerry\VSPlugin-NDK\VSNDK.DebugEngine.dll" -copy "%buildresults%\VSNDK.DebugEngine.dll" "%ProgRoot%\BlackBerry\VSPlugin-NDK\VSNDK.DebugEngine.dll" - -REM //******************************************************************************************** -REM // Copy Package Files -REM ********************************************************************************************** -echo Make Directory "%ProgRoot%\Microsoft Visual Studio 10.0\Common7\IDE\Extensions\NDK Plugin" -md "%ProgRoot%\Microsoft Visual Studio 10.0\Common7\IDE\Extensions\NDK Plugin" -echo "%buildresults%\extension.vsixmanifest" to "%ProgRoot%\Microsoft Visual Studio 10.0\Common7\IDE\Extensions\NDK Plugin\extension.vsixmanifest" -copy "%buildresults%\extension.vsixmanifest" "%ProgRoot%\Microsoft Visual Studio 10.0\Common7\IDE\Extensions\NDK Plugin\extension.vsixmanifest" -echo "%buildresults%\VSNDK.Package.dll" to "%ProgRoot%\Microsoft Visual Studio 10.0\Common7\IDE\Extensions\NDK Plugin\VSNDK.Package.dll" -copy "%buildresults%\VSNDK.Package.dll" "%ProgRoot%\Microsoft Visual Studio 10.0\Common7\IDE\Extensions\NDK Plugin\VSNDK.Package.dll" -echo "%buildresults%\VSNDK.Package.pkgdef" to "%ProgRoot%\Microsoft Visual Studio 10.0\Common7\IDE\Extensions\NDK Plugin\VSNDK.Package.pkgdef" -copy "%buildresults%\VSNDK.Package.pkgdef" "%ProgRoot%\Microsoft Visual Studio 10.0\Common7\IDE\Extensions\NDK Plugin\VSNDK.Package.pkgdef" - -REM //******************************************************************************************** -REM // Copy MSBuild Files -REM ********************************************************************************************** +set BuildResults=%thisDir%_BuildResults + +set ProgFilesRoot=%ProgramFiles(x86)% +set SystemArch=x64 +if "%ProgFilesRoot%" == "" set ProgFilesRoot=%ProgramFiles% && set SystemArch=x86 + +set AllUsersRoot=%ALLUSERSPROFILE% +set PluginRoot=%ProgRoot%\BlackBerry\VSPlugin-NDK + +if %ActionUninstall% neq 0 (echo Performing REMOVAL action...) else (echo Performing INSTALLATION action...) + +REM ******************************************************************************************** +REM Visual Studio 2010 +REM ******************************************************************************************** +if %ActionVS2010% equ 0 (goto skip_vs2010) + +echo %actionNo%: Processing Setup for Visual Studio 2010 +call :processSetup 2010 10.0 +if errorlevel 1 ( exit /b %errorlevel% ) +if %ActionUninstall% neq 0 (echo %actionNo%: Removal - DONE) else (echo %actionNo%: Installation - DONE) +set /a actionNo += 1 + +:skip_vs2010 + +REM ******************************************************************************************** +REM Visual Studio 2012 +REM ******************************************************************************************** +if %ActionVS2012% equ 0 (goto skip_vs2012) + +echo %actionNo%: Processing Setup for Visual Studio 2012 +call :processSetup 2012 11.0 +if errorlevel 1 ( exit /b %errorlevel% ) +if %ActionUninstall% neq 0 (echo %actionNo%: Removal - DONE) else (echo %actionNo%: Installation - DONE) +set /a actionNo += 1 + +:skip_vs2012 + +REM ******************************************************************************************** +REM Visual Studio 2013 +REM ******************************************************************************************** +if %ActionVS2013% equ 0 (goto skip_vs2013) + +echo %actionNo%: Processing Setup for Visual Studio 2013 +call :processSetup 2013 12.0 +if errorlevel 1 ( exit /b %errorlevel% ) +if %ActionUninstall% neq 0 (echo %actionNo%: Removal - DONE) else (echo %actionNo%: Installation - DONE) +set /a actionNo += 1 + +:skip_vs2013 + +REM ******************************************************************************************** +REM Helper functions +REM ******************************************************************************************** +goto EOF + +REM ******************************************************************************************** +REM Aggregate function to perform all actions needed to correctly deploy plugin +REM $1 - Visual Studio number (2012) +REM $2 - Visual Studio version (12.0) +REM $3 - Visual Studio selector (V120) # optional +:processSetup +setlocal EnableDelayedExpansion + +set VSYear=%1 +set VSVersion=%~2 +set VSSelector=%~3 +set BuildPath=%BuildResults%\VS%VSYear% +set VSPluginPath=%ProgFilesRoot%\Microsoft Visual Studio %VSVersion%\Common7\IDE\Extensions\NDK Plugin +set VSWizardsPath=%ProgFilesRoot%\Microsoft Visual Studio %VSVersion%\VC\VCWizards\CodeWiz + +if "%VSSelector%" == "" set MSBuildTargetPath=%ProgFilesRoot%\MSBuild\Microsoft.Cpp\v4.0\Platforms +else set MSBuildTargetPath=%ProgFilesRoot%\MSBuild\Microsoft.Cpp\v4.0\%VSSelector%\Platforms + +call :processAddIn "%BuildPath%" "%AllUsersRoot%\Microsoft\MSEnvShared\Addins" +call :processPlugin "%BuildPath%" "%PluginRoot%" "%VSPluginPath%" "%MSBuildTargetPath%" "%VSWizardsPath%" +call :processTools "%thisDir%" "%PluginRoot%" "%SystemDrive%" + +if %ActionUninstall% neq 0 (goto uninstall_reg) + +REM Registering debug-ending and other support classes +echo %actionNo%: Registering debug-engine [%BuildResults%\setup_VS%VSYear%_install_%SystemArch%.reg] +REGEDIT.EXE /S "%BuildResults%\setup_VS%VSYear%_install_%SystemArch%.reg" +goto processSetup_End + +:uninstall_reg +echo %actionNo%: Unregistering debug-engine [%BuildResults%\setup_VS%VSYear%_uninstall.reg] +REGEDIT.EXE /S "%BuildResults%\setup_VS%VSYear%_uninstall.reg" + +:processSetup_End +endlocal +exit /b + +REM ******************************************************************************************** +REM Setup AddIn Files +REM ******************************************************************************************** +REM $1 - from +REM $2 - to +:processAddIn +setlocal EnableDelayedExpansion + +set InputPath=%~1 +set OutputPath=%~2 + +if %ActionUninstall% neq 0 (goto uninstall_AddIn) + +REM Install add-in +echo Copy "%InputPath%\VSNDK.AddIn.AddIn" to "%OutputPath%\VSNDK.AddIn.AddIn" +copy "%InputPath%\VSNDK.AddIn.AddIn" "%OutputPath%\VSNDK.AddIn.AddIn" +echo Copy "%InputPath%\VSNDK.AddIn.dll" to "%OutputPath%\VSNDK.AddIn.dll" +copy "%InputPath%\VSNDK.AddIn.dll" "%OutputPath%\VSNDK.AddIn.dll" +goto processAddIn_End + +:uninstall_AddIn +REM Remove add-in +echo Deleting "%OutputPath%\VSNDK.AddIn.AddIn" +del "%OutputPath%\VSNDK.AddIn.AddIn" +echo Deleting "%OutputPath%\VSNDK.AddIn.dll" +del "%OutputPath%\VSNDK.AddIn.dll" + +:processAddIn_End +endlocal +exit /b + + +REM ******************************************************************************************** +REM Copy GDBParser and DebugEngine Files +REM ******************************************************************************************** +REM $1 - from +REM $2 - to (plugin path) +REM $3 - to (Visual Studio path) +REM $4 - MSBuild Targets path +REM $5 - Wizards path +:processPlugin +setlocal EnableDelayedExpansion + +set InputPath=%~1 +set OutputPluginPath=%~2 +set OutputVsPath=%~3 +set OutputMsBuildTargetsPath=%~4 +set OutputWizardsPath=%~5 + +if %ActionUninstall% neq 0 (goto uninstall_Plugin) + +REM Create folders +echo Make Directory "%OutputPluginPath%" +md "%OutputPluginPath%" +echo Make Directory "%OutputVsPath%" +md "%OutputVsPath%" + +REM Install +echo Copy "%InputPath%\GDBParser.dll" to "%OutputVsPath%\GDBParser.dll" +copy "%InputPath%\GDBParser.dll" "%OutputVsPath%\GDBParser.dll" +echo Copy "%InputPath%\GDBWrapper.exe" to "%OutputPluginPath%\GDBWrapper.exe" +copy "%InputPath%\GDBWrapper.exe" "%OutputPluginPath%\GDBWrapper.exe" +echo Copy "%InputPath%\Instructions.txt" to "%OutputPluginPath%\Instructions.txt" +copy "%InputPath%\Instructions.txt" "%OutputPluginPath%\Instructions.txt" +echo Copy "%InputPath%\VSNDK.DebugEngine.dll" to "%OutputPluginPath%\VSNDK.DebugEngine.dll" +copy "%InputPath%\VSNDK.DebugEngine.dll" "%OutputPluginPath%\VSNDK.DebugEngine.dll" + +REM Install Package Files +echo "%InputPath%\extension.vsixmanifest" to "%OutputVsPath%\extension.vsixmanifest" +copy "%InputPath%\extension.vsixmanifest" "%OutputVsPath%\extension.vsixmanifest" +echo "%InputPath%\VSNDK.Package.dll" to "%OutputVsPath%\VSNDK.Package.dll" +copy "%InputPath%\VSNDK.Package.dll" "%OutputVsPath%\VSNDK.Package.dll" +echo "%InputPath%\VSNDK.Package.pkgdef" to "%OutputVsPath%\VSNDK.Package.pkgdef" +copy "%InputPath%\VSNDK.Package.pkgdef" "%OutputVsPath%\VSNDK.Package.pkgdef" + +REM MSBuild Files echo Copy BlackBerry MSBuild directory -xcopy "%buildresults%\BlackBerry" "%ProgRoot%\MSBuild\Microsoft.Cpp\v4.0\Platforms\BlackBerry" /e /i /y -copy "%buildresults%\VSNDK.Tasks.dll" "%ProgRoot%\MSBuild\Microsoft.Cpp\v4.0\Platforms\BlackBerry\VSNDK.Tasks.dll" -echo Copy GDBWrapper.exe +xcopy "%InputPath%\BlackBerry" "%OutputMsBuildTargetsPath%\BlackBerry" /e /i /y +copy "%InputPath%\VSNDK.Tasks.dll" "%OutputMsBuildTargetsPath%\BlackBerry\VSNDK.Tasks.dll" echo Copy BlackBerrySimulator MSBuild directory -xcopy "%buildresults%\BlackBerrySimulator" "%ProgRoot%\MSBuild\Microsoft.Cpp\v4.0\Platforms\BlackBerrySimulator" /e /i /y -copy "%buildresults%\VSNDK.Tasks.dll" "%ProgRoot%\MSBuild\Microsoft.Cpp\v4.0\Platforms\BlackBerrySimulator\VSNDK.Tasks.dll" +xcopy "%InputPath%\BlackBerrySimulator" "%OutputMsBuildTargetsPath%\BlackBerrySimulator" /e /i /y +copy "%InputPath%\VSNDK.Tasks.dll" "%OutputMsBuildTargetsPath%\BlackBerrySimulator\VSNDK.Tasks.dll" -REM //******************************************************************************************** -REM // Copy Template Files -REM ********************************************************************************************** +REM Templates echo Copy BlackBerry VCWizards directory -xcopy "%buildresults%\Templates\VCWizards" "%ProgRoot%\Microsoft Visual Studio 10.0\VC\VCWizards\CodeWiz" /e /i /y - -REM //******************************************************************************************** -REM // Copy SDK Command Line Tool Files -REM ********************************************************************************************** -echo xcopy "%thisDir%bbndk_vs" "%drive%bbndk_vs" /e /i /y -md "%drive%bbndk_vs" -xcopy "%thisDir%bbndk_vs" "%drive%bbndk_vs" /e /i /y - -REM //******************************************************************************************** -REM // Copy QNX Tools -REM ********************************************************************************************** -echo xcopy "%thisDir%qnxtools" "%ProgRoot%\BlackBerry\VSPlugin-NDK\qnxtools" /e /i /y -md "%ProgRoot%\BlackBerry\VSPlugin-NDK\qnxtools" -xcopy "%thisDir%qnxtools" "%ProgRoot%\BlackBerry\VSPlugin-NDK\qnxtools" /e /i /y - -REM //******************************************************************************************** -REM // Register clases -REM ********************************************************************************************** -echo registering setup -REGEDIT.EXE /S "thisDir"VSNDKPluginSetup.reg - - - - - - - - - - - - - - - - - - - - - - - - - - - - +xcopy "%InputPath%\Templates\VCWizards" "%OutputWizardsPath%" /e /i /y + + +goto processPlugin_End + +:uninstall_Plugin + +REM Uninstall +echo Deleting "%OutputVsPath%\GDBParser.dll" +del "%OutputVsPath%\GDBParser.dll" +echo Deleting "%OutputPluginPath%\GDBWrapper.exe" +del "%OutputPluginPath%\GDBWrapper.exe" +echo Deleting "%OutputPluginPath%\Instructions.txt" +del "%OutputPluginPath%\Instructions.txt" +echo Deleting "%OutputPluginPath%\VSNDK.DebugEngine.dll" +del "%OutputPluginPath%\VSNDK.DebugEngine.dll" + +REM Uninstall Package Files +echo Deleting "%OutputVsPath%\extension.vsixmanifest" +del "%OutputVsPath%\extension.manifest" +echo Deleting "%OutputVsPath%\VSNDK.Package.dll" +del "%OutputVsPath%\VSNDK.Package.dll" +echo Deleting "%OutputVsPath%\VSNDK.Package.pkgdef" +del "%OutputVsPath%\VSNDK.Package.pkgdef" + +REM Remove folders +echo Remove Directory "%OutputPluginPath%" +rd "%OutputPluginPath%" +echo Remove Directory "%OutputVsPath%" +rd "%OutputVsPath%" + +REM Remove MSBuild Files +echo Delete BlackBerry MSBuild directory +rd "%OutputMsBuildTargetsPath%\BlackBerry" /s /q +echo Delete BlackBerrySimulator MSBuild directory +rd "%OutputMsBuildTargetsPath%\BlackBerrySimulator" /s /q + +REM Remove Templates +echo Delete BlackBerry VCWizards directory +rd "%OutputWizardsPath%\BlackBerry" /s /q + +:processPlugin_End +endlocal +exit /b + +REM ******************************************************************************************** +REM NDK & QNX toolset +REM ******************************************************************************************** +REM $1 - from +REM $2 - to (plugin path) +REM $3 - NDK path +:processTools +setlocal EnableDelayedExpansion + +set InputPath=%~1 +set OutputPath=%~2 +set OutputNdkPath=%~2 + +if %ActionUninstall% neq 0 (goto uninstall_Tools) + +REM Install +echo xcopy "%InputPath%\bbndk_vs" "%OutputNdkPath%\bbndk_vs" /e /i /y +md "%OutputNdkPath%\bbndk_vs" +xcopy "%InputPath%bbndk_vs" "%OutputNdkPath%\bbndk_vs" /e /i /y + +echo xcopy "%InputPath%\qnxtools" "%OutputPath%\qnxtools" /e /i /y +md "%OutputPath%\qnxtools" +xcopy "%InputPath%\qnxtools" "%OutputPath%\qnxtools" /e /i /y + +:uninstall_Tools + +REM Remove +echo Delete "%OutputNdkPath%\bbndk_vs" directory +rd "%OutputNdkPath%\bbndk_vs" /s /q +echo Delete "%OutputPath%\qnxtools" directory +rd "%OutputPath%\qnxtools" /s /q + +:processTools_End +endlocal +exit /b + +REM ******************************************************************************************** +REM END +REM ******************************************************************************************** + +:EOF +endlocal +echo [ALL DONE] From 04113bf5ff702f4eebab2b5273278c57963cd6fb Mon Sep 17 00:00:00 2001 From: Pawel Hofman Date: Wed, 21 May 2014 17:48:22 +0200 Subject: [PATCH 098/851] Renamed setup script and removed old ones --- VSNDKPluginSetup.reg | 102 -------------------------- VSNDKPluginSetupVS2012.bat | 118 ------------------------------ VSNDKPluginSetupVS2012.reg | 103 -------------------------- VSNDKPluginSetupVS2013.bat | 118 ------------------------------ VSNDKPluginSetupVS2013.reg | 103 -------------------------- VSNDKPluginUninstall.bat | 105 -------------------------- VSNDKPluginUninstall.reg | 27 ------- VSNDKPluginSetup.bat => setup.bat | 0 8 files changed, 676 deletions(-) delete mode 100644 VSNDKPluginSetup.reg delete mode 100644 VSNDKPluginSetupVS2012.bat delete mode 100644 VSNDKPluginSetupVS2012.reg delete mode 100644 VSNDKPluginSetupVS2013.bat delete mode 100644 VSNDKPluginSetupVS2013.reg delete mode 100644 VSNDKPluginUninstall.bat delete mode 100644 VSNDKPluginUninstall.reg rename VSNDKPluginSetup.bat => setup.bat (100%) diff --git a/VSNDKPluginSetup.reg b/VSNDKPluginSetup.reg deleted file mode 100644 index 3f826dd5..00000000 --- a/VSNDKPluginSetup.reg +++ /dev/null @@ -1,102 +0,0 @@ -REGEDIT4 - -[HKEY_CURRENT_USER\SOFTWARE\BlackBerry\BlackBerryVSPlugin] -"device_password"="AQAAANCMnd8BFdERjHoAwE/Cl+sBAAAA7fSRRS7m1Em+yoK0ioAYhwQAAAACAAAAAAADZgAAwAAAABAAAAAb9QNNQPNG1qB5uDOFabBjAAAAAASAAACgAAAAEAAAAOu49T6nbn0mHnBMoGvre5cIAAAA2NG7RxOCGYgUAAAAi84MGQ9ELFYdXZ5pOhVSayDK2V4=" -"device_IP"="169.254.0.1" -"simulator_password"="AQAAANCMnd8BFdERjHoAwE/Cl+sBAAAA7fSRRS7m1Em+yoK0ioAYhwQAAAACAAAAAAADZgAAwAAAABAAAAAb9QNNQPNG1qB5uDOFabBjAAAAAASAAACgAAAAEAAAAOu49T6nbn0mHnBMoGvre5cIAAAA2NG7RxOCGYgUAAAAi84MGQ9ELFYdXZ5pOhVSayDK2V4=" -"simulator_IP"="" -"NDKHostPath"="" -"NDKTargetPath"="" - -[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\AD7Metrics\Engine\{E5A37609-2F43-4830-AA85-D94CFA035DD2}] -"AddressBP"=dword:00000000 -"AutoSelectPriority"=dword:00000004 -"CallstackBP"=dword:00000001 -"ProgramProvider"="{AD06FD46-C790-4D5C-A274-8815DF9511B8}" -"Attach"=dword:00000001 -"CLSID"="{904AA6E0-942C-4D11-9094-7BAAEB3EE4B9}" -"AlwaysLoadLocal"="1" -"PortSupplier"="{92A2B753-00BD-40FF-9964-6AB64A1D6C9F}" -"Name"="VSNDK Debug Engine" -@="guidDebuggingSampleEngine" - -[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\AD7Metrics\Engine\{E5A37609-2F43-4830-AA85-D94CFA035DD2}\IncompatibleList] -"guidScriptEng"="{F200A7E7-DEA5-11D0-B854-00A0244A1DE2}" -"guidNativeOnlyEng"="{449EC4CC-30D2-4032-9256-EE18EB41B62B}" -"guidCOMPlusOnlyEng"="{449EC4CC-30D2-4032-9256-EE18EB41B62B}" -"guidCOMPlusNativeEng"="{92EF0900-2251-11D2-B72E-0000F87572EF}" - -[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\10.0\CLSID\{AD06FD46-C790-4D5C-A274-8815DF9511B8}] -"CodeBase"="C:\\Program Files (x86)\\BlackBerry\\VSPlugin-NDK\\VSNDK.DebugEngine.dll" -"InprocServer32"="c:\\windows\\system32\\mscoree.dll" -"Class"="VSNDK.DebugEngine.AD7ProgramProvider" -"Assembly"="VSNDK.DebugEngine" - -[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\10.0\CLSID\{904AA6E0-942C-4D11-9094-7BAAEB3EE4B9}] -"CodeBase"="C:\\Program Files (x86)\\BlackBerry\\VSPlugin-NDK\\VSNDK.DebugEngine.dll" -"InprocServer32"="c:\\windows\\system32\\mscoree.dll" -"Class"="VSNDK.DebugEngine.AD7Engine" -"Assembly"="VSNDK.DebugEngine" - -[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\10.0\CLSID\{BDC2218C-D50C-4A5A-A2F6-66BDC94FF8D6}] -@="BlackBerrySupplier" -"Assembly"="VSNDK.DebugEngine" -"Class"="VSNDK.DebugEngine.AD7PortSupplier" -"InprocServer32"="c:\\windows\\system32\\mscoree.dll" -"CodeBase"="C:\\Program Files (x86)\\BlackBerry\\VSPlugin-NDK\\VSNDK.DebugEngine.dll" -"ThreadingModel"="Free" - -[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\10.0\AD7Metrics\PortSupplier\{92A2B753-00BD-40FF-9964-6AB64A1D6C9F}] -"Name"="BlackBerry" -"DisallowUserEnteredPorts"=dword:00000000 -"CLSID"="{BDC2218C-D50C-4A5A-A2F6-66BDC94FF8D6}" -@="Visual Studio Plug-in for BlackBerry" -"PortPickerCLSID"="{3FAA02D6-72D8-4F69-A1E6-BB05ECB4E37A}" - -[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\10.0\AD7Metrics\Engine\{E5A37609-2F43-4830-AA85-D94CFA035DD2}] -"AlwaysLoadLocal"="1" -"PortSupplier"="{BDC2218C-D50C-4A5A-A2F6-66BDC94FF8D6}" -"Name"="VSNDK Debug Engine" -"CallstackBP"=dword:00000001 -"AutoSelectPriority"=dword:00000004 -"AddressBP"=dword:00000000 -"Attach"=dword:00000001 -"ProgramProvider"="{AD06FD46-C790-4D5C-A274-8815DF9511B8}" -"CLSID"="{904AA6E0-942C-4D11-9094-7BAAEB3EE4B9}" -@="guidDebuggingSampleEngine" - -[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\10.0\AD7Metrics\Engine\{E5A37609-2F43-4830-AA85-D94CFA035DD2}\IncompatibleList] -"guidScriptEng"="{F200A7E7-DEA5-11D0-B854-00A0244A1DE2}" -"guidNativeOnlyEng"="{449EC4CC-30D2-4032-9256-EE18EB41B62B}" -"guidCOMPlusOnlyEng"="{449EC4CC-30D2-4032-9256-EE18EB41B62B}" -"guidCOMPlusNativeEng"="{92EF0900-2251-11D2-B72E-0000F87572EF}" - -[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\10.0\CLSID\{AD06FD46-C790-4D5C-A274-8815DF9511B8}] -"CodeBase"="C:\\Program Files (x86)\\BlackBerry\\VSPlugin-NDK\\VSNDK.DebugEngine.dll" -"InprocServer32"="c:\\windows\\system32\\mscoree.dll" -"Class"="VSNDK.DebugEngine.AD7ProgramProvider" -"Assembly"="VSNDK.DebugEngine" - -[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\10.0\CLSID\{904AA6E0-942C-4D11-9094-7BAAEB3EE4B9}] -"CodeBase"="C:\\Program Files (x86)\\BlackBerry\\VSPlugin-NDK\\VSNDK.DebugEngine.dll" -"Assembly"="VSNDK.DebugEngine" -"Class"="VSNDK.DebugEngine.AD7Engine" -"InprocServer32"="c:\\windows\\system32\\mscoree.dll" - -[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\10.0\AD7Metrics\Engine\{E5A37609-2F43-4830-AA85-D94CFA035DD2}] -"Attach"=dword:00000001 -"ProgramProvider"="{AD06FD46-C790-4D5C-A274-8815DF9511B8}" -"CLSID"="{904AA6E0-942C-4D11-9094-7BAAEB3EE4B9}" -@="guidDebuggingSampleEngine" -"AlwaysLoadLocal"="1" -"AutoSelectPriority"=dword:00000004 -"PortSupplier"="{92A2B753-00BD-40FF-9964-6AB64A1D6C9F}" -"Name"="VSNDK Debug Engine" -"CallstackBP"=dword:00000001 -"AddressBP"=dword:00000000 - -[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\10.0\AD7Metrics\Engine\{E5A37609-2F43-4830-AA85-D94CFA035DD2}\IncompatibleList] -"guidNativeOnlyEng"="{449EC4CC-30D2-4032-9256-EE18EB41B62B}" -"guidCOMPlusOnlyEng"="{449EC4CC-30D2-4032-9256-EE18EB41B62B}" -"guidScriptEng"="{F200A7E7-DEA5-11D0-B854-00A0244A1DE2}" -"guidCOMPlusNativeEng"="{92EF0900-2251-11D2-B72E-0000F87572EF}" \ No newline at end of file diff --git a/VSNDKPluginSetupVS2012.bat b/VSNDKPluginSetupVS2012.bat deleted file mode 100644 index 579ee868..00000000 --- a/VSNDKPluginSetupVS2012.bat +++ /dev/null @@ -1,118 +0,0 @@ -echo off - -REM //******************************************************************************************** -REM // Batch Constants -REM // thisDir = working directory of current batch file. -REM // buildresults = Directory containing the build results. -REM ********************************************************************************************** -set thisDir=%~dp0 -set buildresults=%thisDir%..\buildresults\VS2012 -set ProgRoot=%ProgramFiles(x86)% -set AllUsers=%ALLUSERSPROFILE% -set AppData=%APPDATA% -set drive=%cd:~0,3% - -if "%ProgramFiles(x86)%XXX"=="XXX" ( -echo 32-bit -set ProgRoot=%ProgramFiles% -) -echo %ProgRoot% - -REM //******************************************************************************************** -REM // Copy AddIn Files -REM ********************************************************************************************** -echo Copy "%buildresults%\VSNDK.AddIn.AddIn" to "%AllUsers%\Microsoft\MSEnvShared\Addins\VSNDK.AddIn.AddIn" -copy "%buildresults%\VSNDK.AddIn.AddIn" "%AllUsers%\Microsoft\MSEnvShared\Addins\VSNDK.AddIn.AddIn" -echo Copy "%buildresults%\VSNDK.AddIn.dll" to "%AllUsers%\Microsoft\MSEnvShared\Addins\VSNDK.AddIn.dll" -copy "%buildresults%\VSNDK.AddIn.dll" "%AllUsers%\Microsoft\MSEnvShared\Addins\VSNDK.AddIn.dll" - -REM //******************************************************************************************** -REM // Copy GDBParser and DebugEngine Files -REM ********************************************************************************************** -echo Make Directory "%ProgRoot%\BlackBerry\VSPlugin-NDK" -md "%ProgRoot%\BlackBerry\VSPlugin-NDK" -echo "%buildresults%\GDBParser.dll" to "%ProgRoot%\Microsoft Visual Studio 11.0\Common7\IDE\Extensions\NDK Plugin\GDBParser.dll" -copy "%buildresults%\GDBParser.dll" "%ProgRoot%\Microsoft Visual Studio 11.0\Common7\IDE\Extensions\NDK Plugin\GDBParser.dll" -echo Copy "%buildresults%\GDBWrapper.exe" to "%ProgRoot%\BlackBerry\VSPlugin-NDK\GDBWrapper.exe" -copy "%buildresults%\GDBWrapper.exe" "%ProgRoot%\BlackBerry\VSPlugin-NDK\GDBWrapper.exe" -echo Copy "%buildresults%\Instructions.txt" to "%ProgRoot%\BlackBerry\VSPlugin-NDK\Instructions.txt" -copy "%buildresults%\Instructions.txt" "%ProgRoot%\BlackBerry\VSPlugin-NDK\Instructions.txt" -echo Copy "%buildresults%\VSNDK.DebugEngine.dll" to "%ProgRoot%\BlackBerry\VSPlugin-NDK\VSNDK.DebugEngine.dll" -copy "%buildresults%\VSNDK.DebugEngine.dll" "%ProgRoot%\BlackBerry\VSPlugin-NDK\VSNDK.DebugEngine.dll" - -REM //******************************************************************************************** -REM // Copy Package Files -REM ********************************************************************************************** -echo Make Directory "%ProgRoot%\Microsoft Visual Studio 11.0\Common7\IDE\Extensions\NDK Plugin" -md "%ProgRoot%\Microsoft Visual Studio 11.0\Common7\IDE\Extensions\NDK Plugin" -echo "%buildresults%\extension.vsixmanifest" to "%ProgRoot%\Microsoft Visual Studio 11.0\Common7\IDE\Extensions\NDK Plugin\extension.vsixmanifest" -copy "%buildresults%\extension.vsixmanifest" "%ProgRoot%\Microsoft Visual Studio 11.0\Common7\IDE\Extensions\NDK Plugin\extension.vsixmanifest" -echo "%buildresults%\VSNDK.Package.dll" to "%ProgRoot%\Microsoft Visual Studio 11.0\Common7\IDE\Extensions\NDK Plugin\VSNDK.Package.dll" -copy "%buildresults%\VSNDK.Package.dll" "%ProgRoot%\Microsoft Visual Studio 11.0\Common7\IDE\Extensions\NDK Plugin\VSNDK.Package.dll" -echo "%buildresults%\VSNDK.Package.pkgdef" to "%ProgRoot%\Microsoft Visual Studio 11.0\Common7\IDE\Extensions\NDK Plugin\VSNDK.Package.pkgdef" -copy "%buildresults%\VSNDK.Package.pkgdef" "%ProgRoot%\Microsoft Visual Studio 11.0\Common7\IDE\Extensions\NDK Plugin\VSNDK.Package.pkgdef" - -REM //******************************************************************************************** -REM // Copy MSBuild Files -REM ********************************************************************************************** -echo Copy BlackBerry MSBuild directory -xcopy "%buildresults%\BlackBerry" "%ProgRoot%\MSBuild\Microsoft.Cpp\v4.0\Platforms\BlackBerry" /e /i /y -copy "%buildresults%\VSNDK.Tasks.dll" "%ProgRoot%\MSBuild\Microsoft.Cpp\v4.0\Platforms\BlackBerry\VSNDK.Tasks.dll" -echo Copy GDBWrapper.exe -echo Copy BlackBerrySimulator MSBuild directory -xcopy "%buildresults%\BlackBerrySimulator" "%ProgRoot%\MSBuild\Microsoft.Cpp\v4.0\Platforms\BlackBerrySimulator" /e /i /y -copy "%buildresults%\VSNDK.Tasks.dll" "%ProgRoot%\MSBuild\Microsoft.Cpp\v4.0\Platforms\BlackBerrySimulator\VSNDK.Tasks.dll" - -REM //******************************************************************************************** -REM // Copy Template Files -REM ********************************************************************************************** -echo Copy BlackBerry VCWizards directory -xcopy "%buildresults%\Templates\VCWizards" "%ProgRoot%\Microsoft Visual Studio 11.0\VC\VCWizards\CodeWiz" /e /i /y - -REM //******************************************************************************************** -REM // Copy SDK Command Line Tool Files -REM ********************************************************************************************** -echo xcopy "%thisDir%bbndk_vs" "%drive%bbndk_vs" /e /i /y -md "%drive%bbndk_vs" -xcopy "%thisDir%bbndk_vs" "%drive%bbndk_vs" /e /i /y - -REM //******************************************************************************************** -REM // Copy QNX Tools -REM ********************************************************************************************** -echo xcopy "%thisDir%qnxtools" "%ProgRoot%\BlackBerry\VSPlugin-NDK\qnxtools" /e /i /y -md "%ProgRoot%\BlackBerry\VSPlugin-NDK\qnxtools" -xcopy "%thisDir%qnxtools" "%ProgRoot%\BlackBerry\VSPlugin-NDK\qnxtools" /e /i /y - -REM //******************************************************************************************** -REM // Register clases -REM ********************************************************************************************** -echo registering setup -REGEDIT.EXE /S "thisDir"VSNDKPluginSetup2012.reg - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/VSNDKPluginSetupVS2012.reg b/VSNDKPluginSetupVS2012.reg deleted file mode 100644 index 5245ef89..00000000 --- a/VSNDKPluginSetupVS2012.reg +++ /dev/null @@ -1,103 +0,0 @@ -REGEDIT4 - -[HKEY_CURRENT_USER\SOFTWARE\BlackBerry\BlackBerryVSPlugin] -"device_password"="AQAAANCMnd8BFdERjHoAwE/Cl+sBAAAA7fSRRS7m1Em+yoK0ioAYhwQAAAACAAAAAAADZgAAwAAAABAAAAAb9QNNQPNG1qB5uDOFabBjAAAAAASAAACgAAAAEAAAAOu49T6nbn0mHnBMoGvre5cIAAAA2NG7RxOCGYgUAAAAi84MGQ9ELFYdXZ5pOhVSayDK2V4=" -"device_IP"="169.254.0.1" -"simulator_password"="AQAAANCMnd8BFdERjHoAwE/Cl+sBAAAA7fSRRS7m1Em+yoK0ioAYhwQAAAACAAAAAAADZgAAwAAAABAAAAAb9QNNQPNG1qB5uDOFabBjAAAAAASAAACgAAAAEAAAAOu49T6nbn0mHnBMoGvre5cIAAAA2NG7RxOCGYgUAAAAi84MGQ9ELFYdXZ5pOhVSayDK2V4=" -"simulator_IP"="" -"NDKHostPath"="" -"NDKTargetPath"="" -"NDKRemotePath"="" - -[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\AD7Metrics\Engine\{E5A37609-2F43-4830-AA85-D94CFA035DD2}] -"AddressBP"=dword:00000000 -"AutoSelectPriority"=dword:00000004 -"CallstackBP"=dword:00000001 -"ProgramProvider"="{AD06FD46-C790-4D5C-A274-8815DF9511B8}" -"Attach"=dword:00000001 -"CLSID"="{904AA6E0-942C-4D11-9094-7BAAEB3EE4B9}" -"AlwaysLoadLocal"="1" -"PortSupplier"="{92A2B753-00BD-40FF-9964-6AB64A1D6C9F}" -"Name"="VSNDK Debug Engine" -@="guidDebuggingSampleEngine" - -[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\AD7Metrics\Engine\{E5A37609-2F43-4830-AA85-D94CFA035DD2}\IncompatibleList] -"guidScriptEng"="{F200A7E7-DEA5-11D0-B854-00A0244A1DE2}" -"guidNativeOnlyEng"="{449EC4CC-30D2-4032-9256-EE18EB41B62B}" -"guidCOMPlusOnlyEng"="{449EC4CC-30D2-4032-9256-EE18EB41B62B}" -"guidCOMPlusNativeEng"="{92EF0900-2251-11D2-B72E-0000F87572EF}" - -[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\11.0\CLSID\{AD06FD46-C790-4D5C-A274-8815DF9511B8}] -"CodeBase"="C:\\Program Files (x86)\\BlackBerry\\VSPlugin-NDK\\VSNDK.DebugEngine.dll" -"InprocServer32"="c:\\windows\\system32\\mscoree.dll" -"Class"="VSNDK.DebugEngine.AD7ProgramProvider" -"Assembly"="VSNDK.DebugEngine" - -[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\11.0\CLSID\{904AA6E0-942C-4D11-9094-7BAAEB3EE4B9}] -"CodeBase"="C:\\Program Files (x86)\\BlackBerry\\VSPlugin-NDK\\VSNDK.DebugEngine.dll" -"InprocServer32"="c:\\windows\\system32\\mscoree.dll" -"Class"="VSNDK.DebugEngine.AD7Engine" -"Assembly"="VSNDK.DebugEngine" - -[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\11.0\CLSID\{BDC2218C-D50C-4A5A-A2F6-66BDC94FF8D6}] -@="BlackBerrySupplier" -"Assembly"="VSNDK.DebugEngine" -"Class"="VSNDK.DebugEngine.AD7PortSupplier" -"InprocServer32"="c:\\windows\\system32\\mscoree.dll" -"CodeBase"="C:\\Program Files (x86)\\BlackBerry\\VSPlugin-NDK\\VSNDK.DebugEngine.dll" -"ThreadingModel"="Free" - -[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\11.0\AD7Metrics\PortSupplier\{92A2B753-00BD-40FF-9964-6AB64A1D6C9F}] -"Name"="BlackBerry" -"DisallowUserEnteredPorts"=dword:00000000 -"CLSID"="{BDC2218C-D50C-4A5A-A2F6-66BDC94FF8D6}" -@="Visual Studio Plug-in for BlackBerry" -"PortPickerCLSID"="{3FAA02D6-72D8-4F69-A1E6-BB05ECB4E37A}" - -[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\11.0\AD7Metrics\Engine\{E5A37609-2F43-4830-AA85-D94CFA035DD2}] -"AlwaysLoadLocal"="1" -"PortSupplier"="{BDC2218C-D50C-4A5A-A2F6-66BDC94FF8D6}" -"Name"="VSNDK Debug Engine" -"CallstackBP"=dword:00000001 -"AutoSelectPriority"=dword:00000004 -"AddressBP"=dword:00000000 -"Attach"=dword:00000001 -"ProgramProvider"="{AD06FD46-C790-4D5C-A274-8815DF9511B8}" -"CLSID"="{904AA6E0-942C-4D11-9094-7BAAEB3EE4B9}" -@="guidDebuggingSampleEngine" - -[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\11.0\AD7Metrics\Engine\{E5A37609-2F43-4830-AA85-D94CFA035DD2}\IncompatibleList] -"guidScriptEng"="{F200A7E7-DEA5-11D0-B854-00A0244A1DE2}" -"guidNativeOnlyEng"="{449EC4CC-30D2-4032-9256-EE18EB41B62B}" -"guidCOMPlusOnlyEng"="{449EC4CC-30D2-4032-9256-EE18EB41B62B}" -"guidCOMPlusNativeEng"="{92EF0900-2251-11D2-B72E-0000F87572EF}" - -[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\11.0\CLSID\{AD06FD46-C790-4D5C-A274-8815DF9511B8}] -"CodeBase"="C:\\Program Files (x86)\\BlackBerry\\VSPlugin-NDK\\VSNDK.DebugEngine.dll" -"InprocServer32"="c:\\windows\\system32\\mscoree.dll" -"Class"="VSNDK.DebugEngine.AD7ProgramProvider" -"Assembly"="VSNDK.DebugEngine" - -[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\11.0\CLSID\{904AA6E0-942C-4D11-9094-7BAAEB3EE4B9}] -"CodeBase"="C:\\Program Files (x86)\\BlackBerry\\VSPlugin-NDK\\VSNDK.DebugEngine.dll" -"Assembly"="VSNDK.DebugEngine" -"Class"="VSNDK.DebugEngine.AD7Engine" -"InprocServer32"="c:\\windows\\system32\\mscoree.dll" - -[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\11.0\AD7Metrics\Engine\{E5A37609-2F43-4830-AA85-D94CFA035DD2}] -"Attach"=dword:00000001 -"ProgramProvider"="{AD06FD46-C790-4D5C-A274-8815DF9511B8}" -"CLSID"="{904AA6E0-942C-4D11-9094-7BAAEB3EE4B9}" -@="guidDebuggingSampleEngine" -"AlwaysLoadLocal"="1" -"AutoSelectPriority"=dword:00000004 -"PortSupplier"="{92A2B753-00BD-40FF-9964-6AB64A1D6C9F}" -"Name"="VSNDK Debug Engine" -"CallstackBP"=dword:00000001 -"AddressBP"=dword:00000000 - -[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\11.0\AD7Metrics\Engine\{E5A37609-2F43-4830-AA85-D94CFA035DD2}\IncompatibleList] -"guidNativeOnlyEng"="{449EC4CC-30D2-4032-9256-EE18EB41B62B}" -"guidCOMPlusOnlyEng"="{449EC4CC-30D2-4032-9256-EE18EB41B62B}" -"guidScriptEng"="{F200A7E7-DEA5-11D0-B854-00A0244A1DE2}" -"guidCOMPlusNativeEng"="{92EF0900-2251-11D2-B72E-0000F87572EF}" \ No newline at end of file diff --git a/VSNDKPluginSetupVS2013.bat b/VSNDKPluginSetupVS2013.bat deleted file mode 100644 index af05df1f..00000000 --- a/VSNDKPluginSetupVS2013.bat +++ /dev/null @@ -1,118 +0,0 @@ -echo off - -REM //******************************************************************************************** -REM // Batch Constants -REM // thisDir = working directory of current batch file. -REM // buildresults = Directory containing the build results. -REM ********************************************************************************************** -set thisDir=%~dp0 -set buildresults=%thisDir%..\buildresults\VS2013 -set ProgRoot=%ProgramFiles(x86)% -set AllUsers=%ALLUSERSPROFILE% -set AppData=%APPDATA% -set drive=%cd:~0,3% - -if "%ProgramFiles(x86)%XXX"=="XXX" ( -echo 32-bit -set ProgRoot=%ProgramFiles% -) -echo %ProgRoot% - -REM //******************************************************************************************** -REM // Copy AddIn Files -REM ********************************************************************************************** -echo Copy "%buildresults%\VSNDK.AddIn.AddIn" to "%AllUsers%\Microsoft\MSEnvShared\Addins\VSNDK.AddIn.AddIn" -copy "%buildresults%\VSNDK.AddIn.AddIn" "%AllUsers%\Microsoft\MSEnvShared\Addins\VSNDK.AddIn.AddIn" -echo Copy "%buildresults%\VSNDK.AddIn.dll" to "%AllUsers%\Microsoft\MSEnvShared\Addins\VSNDK.AddIn.dll" -copy "%buildresults%\VSNDK.AddIn.dll" "%AllUsers%\Microsoft\MSEnvShared\Addins\VSNDK.AddIn.dll" - -REM //******************************************************************************************** -REM // Copy GDBParser and DebugEngine Files -REM ********************************************************************************************** -echo Make Directory "%ProgRoot%\BlackBerry\VSPlugin-NDK" -md "%ProgRoot%\BlackBerry\VSPlugin-NDK" -echo "%buildresults%\GDBParser.dll" to "%ProgRoot%\Microsoft Visual Studio 12.0\Common7\IDE\Extensions\NDK Plugin\GDBParser.dll" -copy "%buildresults%\GDBParser.dll" "%ProgRoot%\Microsoft Visual Studio 12.0\Common7\IDE\Extensions\NDK Plugin\GDBParser.dll" -echo Copy "%buildresults%\GDBWrapper.exe" to "%ProgRoot%\BlackBerry\VSPlugin-NDK\GDBWrapper.exe" -copy "%buildresults%\GDBWrapper.exe" "%ProgRoot%\BlackBerry\VSPlugin-NDK\GDBWrapper.exe" -echo Copy "%buildresults%\Instructions.txt" to "%ProgRoot%\BlackBerry\VSPlugin-NDK\Instructions.txt" -copy "%buildresults%\Instructions.txt" "%ProgRoot%\BlackBerry\VSPlugin-NDK\Instructions.txt" -echo Copy "%buildresults%\VSNDK.DebugEngine.dll" to "%ProgRoot%\BlackBerry\VSPlugin-NDK\VSNDK.DebugEngine.dll" -copy "%buildresults%\VSNDK.DebugEngine.dll" "%ProgRoot%\BlackBerry\VSPlugin-NDK\VSNDK.DebugEngine.dll" - -REM //******************************************************************************************** -REM // Copy Package Files -REM ********************************************************************************************** -echo Make Directory "%ProgRoot%\Microsoft Visual Studio 12.0\Common7\IDE\Extensions\NDK Plugin" -md "%ProgRoot%\Microsoft Visual Studio 12.0\Common7\IDE\Extensions\NDK Plugin" -echo "%buildresults%\extension.vsixmanifest" to "%ProgRoot%\Microsoft Visual Studio 12.0\Common7\IDE\Extensions\NDK Plugin\extension.vsixmanifest" -copy "%buildresults%\extension.vsixmanifest" "%ProgRoot%\Microsoft Visual Studio 12.0\Common7\IDE\Extensions\NDK Plugin\extension.vsixmanifest" -echo "%buildresults%\VSNDK.Package.dll" to "%ProgRoot%\Microsoft Visual Studio 12.0\Common7\IDE\Extensions\NDK Plugin\VSNDK.Package.dll" -copy "%buildresults%\VSNDK.Package.dll" "%ProgRoot%\Microsoft Visual Studio 12.0\Common7\IDE\Extensions\NDK Plugin\VSNDK.Package.dll" -echo "%buildresults%\VSNDK.Package.pkgdef" to "%ProgRoot%\Microsoft Visual Studio 12.0\Common7\IDE\Extensions\NDK Plugin\VSNDK.Package.pkgdef" -copy "%buildresults%\VSNDK.Package.pkgdef" "%ProgRoot%\Microsoft Visual Studio 12.0\Common7\IDE\Extensions\NDK Plugin\VSNDK.Package.pkgdef" - -REM //******************************************************************************************** -REM // Copy MSBuild Files -REM ********************************************************************************************** -echo Copy BlackBerry MSBuild directory -xcopy "%buildresults%\BlackBerry" "%ProgRoot%\MSBuild\Microsoft.Cpp\v4.0\V120\Platforms\BlackBerry" /e /i /y -copy "%buildresults%\VSNDK.Tasks.dll" "%ProgRoot%\MSBuild\Microsoft.Cpp\v4.0\V120\Platforms\BlackBerry\VSNDK.Tasks.dll" -echo Copy GDBWrapper.exe -echo Copy BlackBerrySimulator MSBuild directory -xcopy "%buildresults%\BlackBerrySimulator" "%ProgRoot%\MSBuild\Microsoft.Cpp\v4.0\V120\Platforms\BlackBerrySimulator" /e /i /y -copy "%buildresults%\VSNDK.Tasks.dll" "%ProgRoot%\MSBuild\Microsoft.Cpp\v4.0\V120\Platforms\BlackBerrySimulator\VSNDK.Tasks.dll" - -REM //******************************************************************************************** -REM // Copy Template Files -REM ********************************************************************************************** -echo Copy BlackBerry VCWizards directory -xcopy "%buildresults%\Templates\VCWizards" "%ProgRoot%\Microsoft Visual Studio 12.0\VC\VCWizards\CodeWiz" /e /i /y - -REM //******************************************************************************************** -REM // Copy SDK Command Line Tool Files -REM ********************************************************************************************** -echo xcopy "%thisDir%bbndk_vs" "%drive%bbndk_vs" /e /i /y -md "%drive%bbndk_vs" -xcopy "%thisDir%bbndk_vs" "%drive%bbndk_vs" /e /i /y - -REM //******************************************************************************************** -REM // Copy QNX Tools -REM ********************************************************************************************** -echo xcopy "%thisDir%qnxtools" "%ProgRoot%\BlackBerry\VSPlugin-NDK\qnxtools" /e /i /y -md "%ProgRoot%\BlackBerry\VSPlugin-NDK\qnxtools" -xcopy "%thisDir%qnxtools" "%ProgRoot%\BlackBerry\VSPlugin-NDK\qnxtools" /e /i /y - -REM //******************************************************************************************** -REM // Register clases -REM ********************************************************************************************** -echo registering setup -REGEDIT.EXE /S "thisDir"VSNDKPluginSetup2013.reg - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/VSNDKPluginSetupVS2013.reg b/VSNDKPluginSetupVS2013.reg deleted file mode 100644 index 3061b5ed..00000000 --- a/VSNDKPluginSetupVS2013.reg +++ /dev/null @@ -1,103 +0,0 @@ -REGEDIT4 - -[HKEY_CURRENT_USER\SOFTWARE\BlackBerry\BlackBerryVSPlugin] -"device_password"="AQAAANCMnd8BFdERjHoAwE/Cl+sBAAAA7fSRRS7m1Em+yoK0ioAYhwQAAAACAAAAAAADZgAAwAAAABAAAAAb9QNNQPNG1qB5uDOFabBjAAAAAASAAACgAAAAEAAAAOu49T6nbn0mHnBMoGvre5cIAAAA2NG7RxOCGYgUAAAAi84MGQ9ELFYdXZ5pOhVSayDK2V4=" -"device_IP"="169.254.0.1" -"simulator_password"="AQAAANCMnd8BFdERjHoAwE/Cl+sBAAAA7fSRRS7m1Em+yoK0ioAYhwQAAAACAAAAAAADZgAAwAAAABAAAAAb9QNNQPNG1qB5uDOFabBjAAAAAASAAACgAAAAEAAAAOu49T6nbn0mHnBMoGvre5cIAAAA2NG7RxOCGYgUAAAAi84MGQ9ELFYdXZ5pOhVSayDK2V4=" -"simulator_IP"="" -"NDKHostPath"="" -"NDKTargetPath"="" -"NDKRemotePath"="" - -[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\AD7Metrics\Engine\{E5A37609-2F43-4830-AA85-D94CFA035DD2}] -"AddressBP"=dword:00000000 -"AutoSelectPriority"=dword:00000004 -"CallstackBP"=dword:00000001 -"ProgramProvider"="{AD06FD46-C790-4D5C-A274-8815DF9511B8}" -"Attach"=dword:00000001 -"CLSID"="{904AA6E0-942C-4D11-9094-7BAAEB3EE4B9}" -"AlwaysLoadLocal"="1" -"PortSupplier"="{92A2B753-00BD-40FF-9964-6AB64A1D6C9F}" -"Name"="VSNDK Debug Engine" -@="guidDebuggingSampleEngine" - -[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\AD7Metrics\Engine\{E5A37609-2F43-4830-AA85-D94CFA035DD2}\IncompatibleList] -"guidScriptEng"="{F200A7E7-DEA5-11D0-B854-00A0244A1DE2}" -"guidNativeOnlyEng"="{449EC4CC-30D2-4032-9256-EE18EB41B62B}" -"guidCOMPlusOnlyEng"="{449EC4CC-30D2-4032-9256-EE18EB41B62B}" -"guidCOMPlusNativeEng"="{92EF0900-2251-11D2-B72E-0000F87572EF}" - -[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\12.0\CLSID\{AD06FD46-C790-4D5C-A274-8815DF9511B8}] -"CodeBase"="C:\\Program Files (x86)\\BlackBerry\\VSPlugin-NDK\\VSNDK.DebugEngine.dll" -"InprocServer32"="c:\\windows\\system32\\mscoree.dll" -"Class"="VSNDK.DebugEngine.AD7ProgramProvider" -"Assembly"="VSNDK.DebugEngine" - -[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\12.0\CLSID\{904AA6E0-942C-4D11-9094-7BAAEB3EE4B9}] -"CodeBase"="C:\\Program Files (x86)\\BlackBerry\\VSPlugin-NDK\\VSNDK.DebugEngine.dll" -"InprocServer32"="c:\\windows\\system32\\mscoree.dll" -"Class"="VSNDK.DebugEngine.AD7Engine" -"Assembly"="VSNDK.DebugEngine" - -[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\12.0\CLSID\{BDC2218C-D50C-4A5A-A2F6-66BDC94FF8D6}] -@="BlackBerrySupplier" -"Assembly"="VSNDK.DebugEngine" -"Class"="VSNDK.DebugEngine.AD7PortSupplier" -"InprocServer32"="c:\\windows\\system32\\mscoree.dll" -"CodeBase"="C:\\Program Files (x86)\\BlackBerry\\VSPlugin-NDK\\VSNDK.DebugEngine.dll" -"ThreadingModel"="Free" - -[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\12.0\AD7Metrics\PortSupplier\{92A2B753-00BD-40FF-9964-6AB64A1D6C9F}] -"Name"="BlackBerry" -"DisallowUserEnteredPorts"=dword:00000000 -"CLSID"="{BDC2218C-D50C-4A5A-A2F6-66BDC94FF8D6}" -@="Visual Studio Plug-in for BlackBerry" -"PortPickerCLSID"="{3FAA02D6-72D8-4F69-A1E6-BB05ECB4E37A}" - -[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\12.0\AD7Metrics\Engine\{E5A37609-2F43-4830-AA85-D94CFA035DD2}] -"AlwaysLoadLocal"="1" -"PortSupplier"="{BDC2218C-D50C-4A5A-A2F6-66BDC94FF8D6}" -"Name"="VSNDK Debug Engine" -"CallstackBP"=dword:00000001 -"AutoSelectPriority"=dword:00000004 -"AddressBP"=dword:00000000 -"Attach"=dword:00000001 -"ProgramProvider"="{AD06FD46-C790-4D5C-A274-8815DF9511B8}" -"CLSID"="{904AA6E0-942C-4D11-9094-7BAAEB3EE4B9}" -@="guidDebuggingSampleEngine" - -[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\12.0\AD7Metrics\Engine\{E5A37609-2F43-4830-AA85-D94CFA035DD2}\IncompatibleList] -"guidScriptEng"="{F200A7E7-DEA5-11D0-B854-00A0244A1DE2}" -"guidNativeOnlyEng"="{449EC4CC-30D2-4032-9256-EE18EB41B62B}" -"guidCOMPlusOnlyEng"="{449EC4CC-30D2-4032-9256-EE18EB41B62B}" -"guidCOMPlusNativeEng"="{92EF0900-2251-11D2-B72E-0000F87572EF}" - -[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\12.0\CLSID\{AD06FD46-C790-4D5C-A274-8815DF9511B8}] -"CodeBase"="C:\\Program Files (x86)\\BlackBerry\\VSPlugin-NDK\\VSNDK.DebugEngine.dll" -"InprocServer32"="c:\\windows\\system32\\mscoree.dll" -"Class"="VSNDK.DebugEngine.AD7ProgramProvider" -"Assembly"="VSNDK.DebugEngine" - -[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\12.0\CLSID\{904AA6E0-942C-4D11-9094-7BAAEB3EE4B9}] -"CodeBase"="C:\\Program Files (x86)\\BlackBerry\\VSPlugin-NDK\\VSNDK.DebugEngine.dll" -"Assembly"="VSNDK.DebugEngine" -"Class"="VSNDK.DebugEngine.AD7Engine" -"InprocServer32"="c:\\windows\\system32\\mscoree.dll" - -[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\12.0\AD7Metrics\Engine\{E5A37609-2F43-4830-AA85-D94CFA035DD2}] -"Attach"=dword:00000001 -"ProgramProvider"="{AD06FD46-C790-4D5C-A274-8815DF9511B8}" -"CLSID"="{904AA6E0-942C-4D11-9094-7BAAEB3EE4B9}" -@="guidDebuggingSampleEngine" -"AlwaysLoadLocal"="1" -"AutoSelectPriority"=dword:00000004 -"PortSupplier"="{92A2B753-00BD-40FF-9964-6AB64A1D6C9F}" -"Name"="VSNDK Debug Engine" -"CallstackBP"=dword:00000001 -"AddressBP"=dword:00000000 - -[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\12.0\AD7Metrics\Engine\{E5A37609-2F43-4830-AA85-D94CFA035DD2}\IncompatibleList] -"guidNativeOnlyEng"="{449EC4CC-30D2-4032-9256-EE18EB41B62B}" -"guidCOMPlusOnlyEng"="{449EC4CC-30D2-4032-9256-EE18EB41B62B}" -"guidScriptEng"="{F200A7E7-DEA5-11D0-B854-00A0244A1DE2}" -"guidCOMPlusNativeEng"="{92EF0900-2251-11D2-B72E-0000F87572EF}" \ No newline at end of file diff --git a/VSNDKPluginUninstall.bat b/VSNDKPluginUninstall.bat deleted file mode 100644 index 7f03daf6..00000000 --- a/VSNDKPluginUninstall.bat +++ /dev/null @@ -1,105 +0,0 @@ -echo off - -REM //******************************************************************************************** -REM // Batch Constants -REM // thisDir = working directory of current batch file. -REM // buildresults = Directory containing the build results. -REM ********************************************************************************************** -set thisDir=%~dp0 -set buildresults=%thisDir%..\buildresults -set ProgRoot=%ProgramFiles(x86)% -set AllUsers=%ALLUSERSPROFILE% -set AppData=%APPDATA% -set drive=%cd:~0,3% - -if "%ProgramFiles(x86)%XXX"=="XXX" ( -echo 32-bit -set ProgRoot=%ProgramFiles% -) -echo %ProgRoot% - -REM //******************************************************************************************** -REM // Remove AddIn Files -REM ********************************************************************************************** -echo Deleting "%AllUsers%\Microsoft\MSEnvShared\Addins\VSNDK.AddIn.AddIn" -del "%AllUsers%\Microsoft\MSEnvShared\Addins\VSNDK.AddIn.AddIn" -echo Deleting "%AllUsers%\Microsoft\MSEnvShared\Addins\VSNDK.AddIn.dll" -del "%AllUsers%\Microsoft\MSEnvShared\Addins\VSNDK.AddIn.dll" - -REM //******************************************************************************************** -REM // Remove GDBParser and DebugEngine Files -REM ********************************************************************************************** -echo Deleting "%ProgRoot%\BlackBerry\VSPlugin-NDK\GDBParser.dll" -del "%ProgRoot%\BlackBerry\VSPlugin-NDK\GDBParser.dll" -echo Deleting "%ProgRoot%\BlackBerry\VSPlugin-NDK\GDBWrapper.exe" -del "%ProgRoot%\BlackBerry\VSPlugin-NDK\GDBWrapper.exe" -echo Deleting "%ProgRoot%\BlackBerry\VSPlugin-NDK\Instructions.txt" -del "%ProgRoot%\BlackBerry\VSPlugin-NDK\Instructions.txt" -echo Deleting "%ProgRoot%\BlackBerry\VSPlugin-NDK\VSNDK.DebugEngine.dll" -del "%ProgRoot%\BlackBerry\VSPlugin-NDK\VSNDK.DebugEngine.dll" -echo Remove Directory "%ProgRoot%\BlackBerry\VSPlugin-NDK" -rd "%ProgRoot%\BlackBerry\VSPlugin-NDK" - -REM //******************************************************************************************** -REM // Remove Package Files -REM ********************************************************************************************** -echo Deleting "%ProgRoot%\Microsoft Visual Studio 10.0\Common7\IDE\Extensions\NDK Plugin\extension.vsixmanifest" -del "%ProgRoot%\Microsoft Visual Studio 10.0\Common7\IDE\Extensions\NDK Plugin\extension.manifest" -echo Deleting "%ProgRoot%\Microsoft Visual Studio 10.0\Common7\IDE\Extensions\NDK Plugin\VSNDK.Package.dll" -del "%ProgRoot%\Microsoft Visual Studio 10.0\Common7\IDE\Extensions\NDK Plugin\VSNDK.Package.dll" -echo Deleting "%ProgRoot%\Microsoft Visual Studio 10.0\Common7\IDE\Extensions\NDK Plugin\VSNDK.Package.pkgdef" -del "%ProgRoot%\Microsoft Visual Studio 10.0\Common7\IDE\Extensions\NDK Plugin\VSNDK.Package.pkgdef" -echo Remove Directory "%ProgRoot%\Microsoft Visual Studio 10.0\Common7\IDE\Extensions\NDK Plugin" -rd "%ProgRoot%\Microsoft Visual Studio 10.0\Common7\IDE\Extensions\NDK Plugin" - - -REM //******************************************************************************************** -REM // Remove MSBuild Files -REM ********************************************************************************************** -echo Delete BlackBerry MSBuild directory -rd "%ProgRoot%\MSBuild\Microsoft.Cpp\v4.0\Platforms\BlackBerry" /s /q -echo Delete BlackBerrySimulator MSBuild directory -rd "%buildresults%\BlackBerrySimulator" "%ProgRoot%\MSBuild\Microsoft.Cpp\v4.0\Platforms\BlackBerrySimulator" /s /q - -REM //******************************************************************************************** -REM // Remove Template Files -REM ********************************************************************************************** -echo Delete BlackBerry VCWizards directory -rd "%ProgRoot%\Microsoft Visual Studio 10.0\VC\VCWizards\CodeWiz\BlackBerry" /s /q - -REM //******************************************************************************************** -REM // Remove command line tools -REM ********************************************************************************************** -echo Delete %drive%bbndk_vs directory -rd "%drive%bbndk_vs" /s /q - -REM //******************************************************************************************** -REM // Remove qnx tools -REM ********************************************************************************************** -echo Delete "%ProgRoot%\BlackBerry\VSPlugin-NDK\qnxtools" directory -rd "%ProgRoot%\BlackBerry\VSPlugin-NDK\qnxtools" /s /q - -REM //******************************************************************************************** -REM // Register clases -REM ********************************************************************************************** -echo Unregistering - %thisDir%VSNDKPluginUninstall.reg -REGEDIT.EXE -S %thisDir%VSNDKPluginUninstall.reg - - - - - - - - - - - - - - - - - - - diff --git a/VSNDKPluginUninstall.reg b/VSNDKPluginUninstall.reg deleted file mode 100644 index 634e9486..00000000 --- a/VSNDKPluginUninstall.reg +++ /dev/null @@ -1,27 +0,0 @@ -REGEDIT4 - -[-HKEY_CURRENT_USER\SOFTWARE\BlackBerry\BlackBerryVSPlugin] - -[-HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\AD7Metrics\Engine\{E5A37609-2F43-4830-AA85-D94CFA035DD2}\IncompatibleList] - -[-HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\AD7Metrics\Engine\{E5A37609-2F43-4830-AA85-D94CFA035DD2}] - -[-HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\10.0\CLSID\{AD06FD46-C790-4D5C-A274-8815DF9511B8}] - -[-HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\10.0\CLSID\{904AA6E0-942C-4D11-9094-7BAAEB3EE4B9}] - -[-HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\10.0\CLSID\{BDC2218C-D50C-4A5A-A2F6-66BDC94FF8D6}] - -[-HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\10.0\AD7Metrics\PortSupplier\{92A2B753-00BD-40FF-9964-6AB64A1D6C9F}] - -[-HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\10.0\AD7Metrics\Engine\{E5A37609-2F43-4830-AA85-D94CFA035DD2}\IncompatibleList] - -[-HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\10.0\AD7Metrics\Engine\{E5A37609-2F43-4830-AA85-D94CFA035DD2}] - -[-HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\10.0\CLSID\{AD06FD46-C790-4D5C-A274-8815DF9511B8}] - -[-HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\10.0\CLSID\{904AA6E0-942C-4D11-9094-7BAAEB3EE4B9}] - -[-HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\10.0\AD7Metrics\Engine\{E5A37609-2F43-4830-AA85-D94CFA035DD2}\IncompatibleList] - -[-HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\10.0\AD7Metrics\Engine\{E5A37609-2F43-4830-AA85-D94CFA035DD2}] \ No newline at end of file diff --git a/VSNDKPluginSetup.bat b/setup.bat similarity index 100% rename from VSNDKPluginSetup.bat rename to setup.bat From ddc10721a59e7fce66adffa1e9f460b222e762b2 Mon Sep 17 00:00:00 2001 From: Pawel Hofman Date: Wed, 21 May 2014 17:53:22 +0200 Subject: [PATCH 099/851] Updated README with renamed build and setup scripts --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 071bcea0..db18953a 100644 --- a/README.md +++ b/README.md @@ -17,8 +17,8 @@ If Visual Studio 2013 is installed on a machine, where Visual Studio 2012 did al More info [here] (http://connect.microsoft.com/VisualStudio/feedback/details/814147/dia-sdk-installed-into-wrong-directory). ##Build commands -1. VSNDKPluginBuild.bat – A batch file that builds the various components of the BlackBerry Native Plug-in to the ..\buildresults folder. -2. VSNDKPluginSetup.bat – A batch file that installs the newly built components of the BlackBerry Native Plug-in to the correct locations on your computer. +1. build.bat – A batch file that builds the various components of the BlackBerry Native Plug-in to the ..\_BuildResults folder. +2. setup.bat – A batch file that installs the newly built components of the BlackBerry Native Plug-in to the correct locations on your computer. ##Contributing The BlackBerry Native Plug-in for Microsoft Visual Studio project currently contains the following code branches: From f768991f357574e942a34bb6f68acbfd147a511f Mon Sep 17 00:00:00 2001 From: Pawel Hofman Date: Wed, 21 May 2014 17:55:10 +0200 Subject: [PATCH 100/851] Added missing toolset selectors --- setup.bat | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/setup.bat b/setup.bat index ef42693d..36039b2c 100644 --- a/setup.bat +++ b/setup.bat @@ -63,7 +63,7 @@ REM **************************************************************************** if %ActionVS2012% equ 0 (goto skip_vs2012) echo %actionNo%: Processing Setup for Visual Studio 2012 -call :processSetup 2012 11.0 +call :processSetup 2012 11.0 V110 if errorlevel 1 ( exit /b %errorlevel% ) if %ActionUninstall% neq 0 (echo %actionNo%: Removal - DONE) else (echo %actionNo%: Installation - DONE) set /a actionNo += 1 @@ -76,7 +76,7 @@ REM **************************************************************************** if %ActionVS2013% equ 0 (goto skip_vs2013) echo %actionNo%: Processing Setup for Visual Studio 2013 -call :processSetup 2013 12.0 +call :processSetup 2013 12.0 V120 if errorlevel 1 ( exit /b %errorlevel% ) if %ActionUninstall% neq 0 (echo %actionNo%: Removal - DONE) else (echo %actionNo%: Installation - DONE) set /a actionNo += 1 From f863c139fdf727b654023d54b09bfa379442c7a5 Mon Sep 17 00:00:00 2001 From: Pawel Hofman Date: Thu, 22 May 2014 00:53:32 +0200 Subject: [PATCH 101/851] Fixed typos etc in setup script Added also option to skip installation/removal of toolset and their generation by the build script, if limited build to single Visual Studio version. --- build.bat | 9 +++++++++ setup.bat | 52 +++++++++++++++++++++++++++++++++++----------------- 2 files changed, 44 insertions(+), 17 deletions(-) diff --git a/build.bat b/build.bat index 596c1eb7..f95c98c9 100644 --- a/build.bat +++ b/build.bat @@ -119,9 +119,18 @@ REM **************************************************************************** if %ActionGenScripts% equ 0 (goto skip_scripts) echo %actionNo%: Creating installation scripts + +if %ActionBuildVS2010% equ 0 (goto skip_vs2010_scripts) call :processTemplates 2010 10.0 +:skip_vs2010_scripts + +if %ActionBuildVS2012% equ 0 (goto skip_vs2012_scripts) call :processTemplates 2012 11.0 +:skip_vs2012_scripts + +if %ActionBuildVS2013% equ 0 (goto skip_vs2013_scripts) call :processTemplates 2013 12.0 +:skip_vs2013_scripts echo %actionNo%: Writing - DONE set /a actionNo += 1 diff --git a/setup.bat b/setup.bat index 36039b2c..fc3d21bb 100644 --- a/setup.bat +++ b/setup.bat @@ -11,20 +11,25 @@ if "%~1" == "" ( set ActionVS2012=1 set ActionVS2013=1 set ActionUninstall=0 + set ActionSkipTools=0 ) else ( set ActionVS2010=0 set ActionVS2012=0 set ActionVS2013=0 set ActionUninstall=0 + set ActionSkipTools=0 for %%a in (%*) do ( - if /i "%%a" == "/all" set ActionVS2010=1 && set ActionVS2012=1 && set ActionVS2013=1 - if /i "%%a" == "/uninstall" set ActionUninstall=1 - if /i "%%a" == "/u" set ActionUninstall=1 - if /i "%%a" == "/delete" set ActionUninstall=1 - if /i "%%a" == "/del" set ActionUninstall=1 - if /i "%%a" == "vs2010" set ActionVS2010=1 - if /i "%%a" == "vs2012" set ActionVS2012=1 - if /i "%%a" == "vs2013" set ActionVS2013=1 + if /i "%%a" == "/all" set ActionVS2010=1 && set ActionVS2012=1 && set ActionVS2013=1 + if /i "%%a" == "/uninstall" set ActionUninstall=1 + if /i "%%a" == "/u" set ActionUninstall=1 + if /i "%%a" == "/delete" set ActionUninstall=1 + if /i "%%a" == "/del" set ActionUninstall=1 + if /i "%%a" == "/skip-tools" set ActionSkipTools=1 + if /i "%%a" == "/no-tools" set ActionSkipTools=1 + if /i "%%a" == "/notools" set ActionSkipTools=1 + if /i "%%a" == "vs2010" set ActionVS2010=1 + if /i "%%a" == "vs2012" set ActionVS2012=1 + if /i "%%a" == "vs2013" set ActionVS2013=1 ) ) @@ -33,14 +38,15 @@ REM Declare Constants REM ******************************************************************************************** set /A actionNo=1 set thisDir=%~dp0 -set BuildResults=%thisDir%_BuildResults +set thisDir=%thisDir:~0,-1% +set BuildResults=%thisDir%\_BuildResults set ProgFilesRoot=%ProgramFiles(x86)% set SystemArch=x64 -if "%ProgFilesRoot%" == "" set ProgFilesRoot=%ProgramFiles% && set SystemArch=x86 +if "%ProgFilesRoot%" == "" set "ProgFilesRoot=%ProgramFiles%" && set SystemArch=x86 set AllUsersRoot=%ALLUSERSPROFILE% -set PluginRoot=%ProgRoot%\BlackBerry\VSPlugin-NDK +set PluginRoot=%ProgFilesRoot%\BlackBerry\VSPlugin-NDK if %ActionUninstall% neq 0 (echo Performing REMOVAL action...) else (echo Performing INSTALLATION action...) @@ -103,12 +109,16 @@ set BuildPath=%BuildResults%\VS%VSYear% set VSPluginPath=%ProgFilesRoot%\Microsoft Visual Studio %VSVersion%\Common7\IDE\Extensions\NDK Plugin set VSWizardsPath=%ProgFilesRoot%\Microsoft Visual Studio %VSVersion%\VC\VCWizards\CodeWiz -if "%VSSelector%" == "" set MSBuildTargetPath=%ProgFilesRoot%\MSBuild\Microsoft.Cpp\v4.0\Platforms -else set MSBuildTargetPath=%ProgFilesRoot%\MSBuild\Microsoft.Cpp\v4.0\%VSSelector%\Platforms +set MSBuildTargetPath=%ProgFilesRoot%\MSBuild\Microsoft.Cpp\v4.0\Platforms +if not "%VSSelector%" == "" set MSBuildTargetPath=%ProgFilesRoot%\MSBuild\Microsoft.Cpp\v4.0\%VSSelector%\Platforms + +REM Skip installation of custom tools (in case upgrading only plugin during development) +if %ActionSkipTools% neq 0 goto skip_tools +call :processTools "%thisDir%" "%PluginRoot%" "%SystemDrive%" +:skip_tools call :processAddIn "%BuildPath%" "%AllUsersRoot%\Microsoft\MSEnvShared\Addins" call :processPlugin "%BuildPath%" "%PluginRoot%" "%VSPluginPath%" "%MSBuildTargetPath%" "%VSWizardsPath%" -call :processTools "%thisDir%" "%PluginRoot%" "%SystemDrive%" if %ActionUninstall% neq 0 (goto uninstall_reg) @@ -139,6 +149,8 @@ set OutputPath=%~2 if %ActionUninstall% neq 0 (goto uninstall_AddIn) REM Install add-in +echo %actionNo%: Installing Add-in +mkdir "%OutputPath% echo Copy "%InputPath%\VSNDK.AddIn.AddIn" to "%OutputPath%\VSNDK.AddIn.AddIn" copy "%InputPath%\VSNDK.AddIn.AddIn" "%OutputPath%\VSNDK.AddIn.AddIn" echo Copy "%InputPath%\VSNDK.AddIn.dll" to "%OutputPath%\VSNDK.AddIn.dll" @@ -147,6 +159,7 @@ goto processAddIn_End :uninstall_AddIn REM Remove add-in +echo %actionNo%: Removing Add-in echo Deleting "%OutputPath%\VSNDK.AddIn.AddIn" del "%OutputPath%\VSNDK.AddIn.AddIn" echo Deleting "%OutputPath%\VSNDK.AddIn.dll" @@ -177,6 +190,7 @@ set OutputWizardsPath=%~5 if %ActionUninstall% neq 0 (goto uninstall_Plugin) REM Create folders +echo %actionNo%: Installing plugin binaries echo Make Directory "%OutputPluginPath%" md "%OutputPluginPath%" echo Make Directory "%OutputVsPath%" @@ -218,6 +232,7 @@ goto processPlugin_End :uninstall_Plugin REM Uninstall +echo %actionNo%: Removing plugin binaries echo Deleting "%OutputVsPath%\GDBParser.dll" del "%OutputVsPath%\GDBParser.dll" echo Deleting "%OutputPluginPath%\GDBWrapper.exe" @@ -229,7 +244,7 @@ del "%OutputPluginPath%\VSNDK.DebugEngine.dll" REM Uninstall Package Files echo Deleting "%OutputVsPath%\extension.vsixmanifest" -del "%OutputVsPath%\extension.manifest" +del "%OutputVsPath%\extension.vsixmanifest" echo Deleting "%OutputVsPath%\VSNDK.Package.dll" del "%OutputVsPath%\VSNDK.Package.dll" echo Deleting "%OutputVsPath%\VSNDK.Package.pkgdef" @@ -266,22 +281,25 @@ setlocal EnableDelayedExpansion set InputPath=%~1 set OutputPath=%~2 -set OutputNdkPath=%~2 +set OutputNdkPath=%~3 if %ActionUninstall% neq 0 (goto uninstall_Tools) REM Install +echo %actionNo%: Installing toolset echo xcopy "%InputPath%\bbndk_vs" "%OutputNdkPath%\bbndk_vs" /e /i /y md "%OutputNdkPath%\bbndk_vs" -xcopy "%InputPath%bbndk_vs" "%OutputNdkPath%\bbndk_vs" /e /i /y +xcopy "%InputPath%\bbndk_vs" "%OutputNdkPath%\bbndk_vs" /e /i /y echo xcopy "%InputPath%\qnxtools" "%OutputPath%\qnxtools" /e /i /y md "%OutputPath%\qnxtools" xcopy "%InputPath%\qnxtools" "%OutputPath%\qnxtools" /e /i /y +goto processTools_End :uninstall_Tools REM Remove +echo %actionNo%: Removing toolset echo Delete "%OutputNdkPath%\bbndk_vs" directory rd "%OutputNdkPath%\bbndk_vs" /s /q echo Delete "%OutputPath%\qnxtools" directory From 780a6c37bc40fa5d2a2ec930b67b3f2a8b16e41b Mon Sep 17 00:00:00 2001 From: Pawel Hofman Date: Thu, 22 May 2014 01:27:30 +0200 Subject: [PATCH 102/851] Improved detection of PlayBook NDKs --- src_vs2012/VSNDK.Package/Model/NdkInfo.cs | 73 ++++++++++++++++++++--- 1 file changed, 66 insertions(+), 7 deletions(-) diff --git a/src_vs2012/VSNDK.Package/Model/NdkInfo.cs b/src_vs2012/VSNDK.Package/Model/NdkInfo.cs index 14ea5436..a115b1da 100644 --- a/src_vs2012/VSNDK.Package/Model/NdkInfo.cs +++ b/src_vs2012/VSNDK.Package/Model/NdkInfo.cs @@ -212,6 +212,12 @@ public static NdkInfo Load(XmlReader reader) { if (!string.IsNullOrEmpty(targetPath) && !string.IsNullOrEmpty(hostPath)) { + // is it a PlayBook NDK, which has no 'version' field? + if (version == null && !string.IsNullOrEmpty(name)) + { + version = GetVersionFromFolderName(name); + } + // try to define info about the installation: return new NdkInfo(name, version, hostPath, targetPath); } @@ -374,9 +380,13 @@ public static NdkInfo Scan(string folder) var targetDirs = Directory.GetDirectories(folder, "target*"); if (targetDirs.Length != 0) { - info = ScanByTargetFolder(targetDirs[0]); - if (info != null) - return info; + // get the first folder with a descriptor: + foreach (var target in targetDirs) + { + info = ScanByTargetFolder(target); + if (info != null) + return info; + } } // is it a host folder? @@ -388,7 +398,15 @@ public static NdkInfo Scan(string folder) if (targetDirs.Length == 0) return null; - return ScanByTargetFolder(targetDirs[0]); + // get first folder with a descriptor: + foreach (var target in targetDirs) + { + info = ScanByTargetFolder(targetDirs[0]); + if (info != null) + return info; + } + + return null; } private static NdkInfo ScanByTargetFolder(string folder) @@ -408,7 +426,24 @@ private static NdkInfo ScanByTargetFolder(string folder) // extract version out of the current folder name var version = GetVersionFromFolderName(Path.GetFileName(folder)); if (version == null) - version = new Version(10, 0, 1); + { + // is there an installation folder with version (used by PlayBook NDKs)? + var installInfoPath = Path.Combine(folder, "..", "install", "info.txt"); + if (File.Exists(installInfoPath)) + { + try + { + version = GetVersionFromInstallationInfo(File.ReadAllLines(installInfoPath)); + } + catch (Exception ex) + { + TraceLog.WriteException(ex, "Unable to read installation info from file: \"{0}\"", installInfoPath); + } + } + + if (version == null) + version = new Version(10, 0, 1); + } return new NdkInfo(string.Concat("BlackBerry Local SDK ", version, " /", DateTime.Now.ToString("yyyy-MM-dd"), "/"), version, Path.Combine(hostDirs[0], "win32", "x86"), Path.Combine(folder, "qnx6")); @@ -417,6 +452,30 @@ private static NdkInfo ScanByTargetFolder(string folder) return null; } + private static Version GetVersionFromInstallationInfo(string[] lines) + { + if (lines == null || lines.Length == 0) + return null; + + // find the line, that describes the target version: + foreach (var line in lines) + { + if (line.StartsWith("target", StringComparison.OrdinalIgnoreCase)) + { + var index = line.IndexOf('='); + string versionString; + if (index < 0) + versionString = line.Substring(7).Trim(); // one char after 'target' assumed to be separator + else + versionString = line.Substring(index + 1).Trim(); + + return string.IsNullOrEmpty(versionString) ? null : new Version(versionString); + } + } + + return null; + } + private static Version GetVersionFromFolderName(string directoryName) { if (string.IsNullOrEmpty(directoryName)) @@ -425,11 +484,11 @@ private static Version GetVersionFromFolderName(string directoryName) int i = directoryName.Length; // find the version substring at the end of the name: - while (i > 0 && directoryName[i - 1] == '_' || char.IsDigit(directoryName[i - 1])) + while (i > 0 && directoryName[i - 1] == '_' || directoryName[i - 1] == '.' || char.IsDigit(directoryName[i - 1])) i--; // we might read one char too much: - if (i < directoryName.Length && directoryName[i] == '_') + if (i < directoryName.Length && !char.IsDigit(directoryName[i])) i++; // parse: From ca683466012b0f648b2e177b07c62ac6377790a4 Mon Sep 17 00:00:00 2001 From: Pawel Hofman Date: Thu, 22 May 2014 01:49:33 +0200 Subject: [PATCH 103/851] Fixed a crash, when adding first NDK as 'custom' Since it could happen no directories for NDK info caches created yet, data was not saved correctly and an exception thrown later, at a time of selection not-known NDK. --- src_vs2012/VSNDK.Package/Model/NdkInfo.cs | 14 +++++++++++++- .../Options/ApiLevelOptionControl.cs | 15 ++++++++++----- .../VSNDK.Package/ViewModels/PackageViewModel.cs | 2 +- 3 files changed, 24 insertions(+), 7 deletions(-) diff --git a/src_vs2012/VSNDK.Package/Model/NdkInfo.cs b/src_vs2012/VSNDK.Package/Model/NdkInfo.cs index a115b1da..66d14eff 100644 --- a/src_vs2012/VSNDK.Package/Model/NdkInfo.cs +++ b/src_vs2012/VSNDK.Package/Model/NdkInfo.cs @@ -499,11 +499,22 @@ private static Version GetVersionFromFolderName(string directoryName) return new Version(versionString); } - public void Save(string outputDirectory) + public bool Save(string outputDirectory) { if (string.IsNullOrEmpty(outputDirectory)) throw new ArgumentNullException("outputDirectory"); + // make sure, the output directory exists: + try + { + Directory.CreateDirectory(outputDirectory); + } + catch (Exception ex) + { + TraceLog.WriteException(ex, "Unable to create directory for NDK info cache"); + return false; + } + // normalize file name: var fileName = new StringBuilder(string.IsNullOrEmpty(Name) ? "vsplugin_target_" + Version + DateTime.Now.ToString("yyyy-MM-dd_HH_mm_ss") + ".xml" : Name + ".xml"); @@ -553,6 +564,7 @@ public void Save(string outputDirectory) // store it: doc.Save(Path.Combine(outputDirectory, fileName.ToString())); + return true; } } } diff --git a/src_vs2012/VSNDK.Package/Options/ApiLevelOptionControl.cs b/src_vs2012/VSNDK.Package/Options/ApiLevelOptionControl.cs index fc91a4d0..e440e3bf 100644 --- a/src_vs2012/VSNDK.Package/Options/ApiLevelOptionControl.cs +++ b/src_vs2012/VSNDK.Package/Options/ApiLevelOptionControl.cs @@ -64,11 +64,16 @@ private void bttAddLocal_Click(object sender, EventArgs e) if (ndk != null) { // save inside 'installation config' directory: - ndk.Save(RunnerDefaults.InstallationConfigDirectory); - - // reload NDKs - _vm.ReloadAndActivate(ndk); - PopulateNDKs(); + if (ndk.Save(RunnerDefaults.InstallationConfigDirectory)) + { + // reload NDKs + _vm.ReloadAndActivate(ndk); + PopulateNDKs(); + } + else + { + MessageBoxHelper.Show("Unable to save NDK information", "API Level Updater", MessageBoxButtons.OK, MessageBoxIcon.Error); + } } } } diff --git a/src_vs2012/VSNDK.Package/ViewModels/PackageViewModel.cs b/src_vs2012/VSNDK.Package/ViewModels/PackageViewModel.cs index 3e201627..5d801ab1 100644 --- a/src_vs2012/VSNDK.Package/ViewModels/PackageViewModel.cs +++ b/src_vs2012/VSNDK.Package/ViewModels/PackageViewModel.cs @@ -102,7 +102,7 @@ public NdkInfo ActiveNDK } set { - if (value != null && !value.Matches(_activeNDK)) + if (value != null && !value.Matches(_activeNDK) && InstalledNDKs.Length > 0) { var index = IndexOfInstalled(value); if (index < 0) From 8e29d4d91f2b58f95fd49f396ba473f833a08c7d Mon Sep 17 00:00:00 2001 From: Pawel Hofman Date: Thu, 22 May 2014 02:23:33 +0200 Subject: [PATCH 104/851] Added parameter to force build all --- build.bat | 1 + setup.bat | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/build.bat b/build.bat index f95c98c9..603b84f1 100644 --- a/build.bat +++ b/build.bat @@ -19,6 +19,7 @@ if "%~1" == "" ( set ActionBuildVS2012=0 set ActionBuildVS2013=0 for %%a in (%*) do ( + if /i "%%a" == "/all" set ActionBuildVS2010=1 && set ActionBuildVS2012=1 && set ActionBuildVS2013=1 if /i "%%a" == "/noclean" set ActionClean=0 if /i "%%a" == "/no-clean" set ActionClean=0 if /i "%%a" == "/scripts" set ActionGenScripts=1 diff --git a/setup.bat b/setup.bat index fc3d21bb..5dee9831 100644 --- a/setup.bat +++ b/setup.bat @@ -5,7 +5,7 @@ REM **************************************************************************** REM Allow selective installation/uninstallation REM ******************************************************************************************** -:: Process parameters, to limit processing +:: Process parameters, to limit setup activities or directions if "%~1" == "" ( set ActionVS2010=1 set ActionVS2012=1 From 1700f100719a82dc5f49d66832da88dbab70d5a7 Mon Sep 17 00:00:00 2001 From: Pawel Hofman Date: Thu, 22 May 2014 12:50:20 +0200 Subject: [PATCH 105/851] Added option to override build output folder --- build.bat | 75 ++++++++++++++++++++++++++++++++++--------------------- 1 file changed, 46 insertions(+), 29 deletions(-) diff --git a/build.bat b/build.bat index 603b84f1..c6b1d51b 100644 --- a/build.bat +++ b/build.bat @@ -1,5 +1,6 @@ @echo off -setlocal enableextensions +echo Starting... +setlocal EnableExtensions REM ******************************************************************************************** REM Allow selective build @@ -18,25 +19,41 @@ if "%~1" == "" ( set ActionBuildVS2010=0 set ActionBuildVS2012=0 set ActionBuildVS2013=0 - for %%a in (%*) do ( - if /i "%%a" == "/all" set ActionBuildVS2010=1 && set ActionBuildVS2012=1 && set ActionBuildVS2013=1 - if /i "%%a" == "/noclean" set ActionClean=0 - if /i "%%a" == "/no-clean" set ActionClean=0 - if /i "%%a" == "/scripts" set ActionGenScripts=1 - if /i "%%a" == "/noscripts" set ActionGenScripts=0 - if /i "%%a" == "/no-scripts" set ActionGenScripts=0 - if /i "%%a" == "vs2010" set ActionBuildVS2010=1 && set ActionGenScripts=1 - if /i "%%a" == "vs2012" set ActionBuildVS2012=1 && set ActionGenScripts=1 - if /i "%%a" == "vs2013" set ActionBuildVS2013=1 && set ActionGenScripts=1 - ) ) +:args_parsing +set arg=%~1 +if "%arg%" == "" (goto args_parsing_done) +if /i "%arg%" == "/all" set ActionBuildVS2010=1 && set ActionBuildVS2012=1 && set ActionBuildVS2013=1 +if /i "%arg%" == "/noclean" set ActionClean=0 +if /i "%arg%" == "/no-clean" set ActionClean=0 +if /i "%arg%" == "/scripts" set ActionGenScripts=2 +if /i "%arg%" == "/noscripts" set ActionGenScripts=0 +if /i "%arg%" == "/no-scripts" set ActionGenScripts=0 +if /i "%arg%" == "vs2010" set ActionBuildVS2010=1 && set ActionGenScripts=1 +if /i "%arg%" == "vs2012" set ActionBuildVS2012=1 && set ActionGenScripts=1 +if /i "%arg%" == "vs2013" set ActionBuildVS2013=1 && set ActionGenScripts=1 +if /i "%arg:~0,5%" == "/out:" set CustomOutputDir=%arg:~5% + +shift /1 +goto args_parsing + +:args_parsing_done +set arg= + REM ******************************************************************************************** REM Declare Constants REM ******************************************************************************************** set /A actionNo=1 set thisDir=%~dp0 -set BuildResults="%thisDir%_BuildResults" +set thisDir=%thisDir:~0,-1% + +REM Allow to override the BuildReults path, in case someone dislikes the default one +set BuildResults=%thisDir%\_BuildResults +if "%CustomOutputDir%" == "" goto skip_buildoutput_override + set BuildResults=%CustomOutputDir% + if "%BuildResults:~-1%" == "\" set BuildResults=%BuildResults:~0,-1% +:skip_buildoutput_override set ProgFilesRoot=%ProgramFiles(x86)% if "%ProgFilesRoot%" == "" set ProgFilesRoot=%ProgramFiles% @@ -50,8 +67,8 @@ set SolutionPath2010="%thisDir%\src\VSNDK.sln" set SolutionPath2012="%thisDir%\src_vs2012\VSNDK.sln" set SolutionPath2013="%thisDir%\src_vs2013\VSNDK.sln" -echo Starting... -echo Output folder: %BuildResults% +echo Current folder: "%thisDir%" +echo Output folder: "%BuildResults%" REM ******************************************************************************************** REM Clean up old bin folder @@ -81,7 +98,7 @@ REM **************************************************************************** if %ActionBuildVS2010% equ 0 (goto skip_vs2010) echo %actionNo%: Building Solution for Visual Studio 2010 -%MsBuildCmd% %SolutionPath2010% /p:OutputPath="%BuildResults%\VS2010" > %BuildResults%\VS2010_buildlog.txt +%MsBuildCmd% %SolutionPath2010% /p:OutputPath="%BuildResults%\VS2010" > "%BuildResults%\VS2010_buildlog.txt" if errorlevel 1 ( exit /b %errorlevel% ) echo %actionNo%: Build - DONE set /a actionNo += 1 @@ -94,7 +111,7 @@ REM **************************************************************************** if %ActionBuildVS2012% equ 0 (goto skip_vs2012) echo %actionNo%: Building Solution for Visual Studio 2012 -%MsBuildCmd% %SolutionPath2012% /p:OutputPath="%BuildResults%\VS2012" /p:VisualStudioVersion=11.0 > %BuildResults%\VS2012_buildlog.txt +%MsBuildCmd% %SolutionPath2012% /p:OutputPath="%BuildResults%\VS2012" /p:VisualStudioVersion=11.0 > "%BuildResults%\VS2012_buildlog.txt" if errorlevel 1 ( exit /b %errorlevel% ) echo %actionNo%: Build - DONE set /a actionNo += 1 @@ -107,7 +124,7 @@ REM **************************************************************************** if %ActionBuildVS2013% equ 0 (goto skip_vs2013) echo %actionNo%: Building Solution for Visual Studio 2013 -%MsBuild2013Cmd% %SolutionPath2013% /p:OutputPath="%BuildResults%\VS2013" /p:VisualStudioVersion=12.0 > %BuildResults%\VS2013_buildlog.txt +%MsBuild2013Cmd% %SolutionPath2013% /p:OutputPath="%BuildResults%\VS2013" /p:VisualStudioVersion=12.0 > "%BuildResults%\VS2013_buildlog.txt" if errorlevel 1 ( exit /b %errorlevel% ) echo %actionNo%: Build - DONE set /a actionNo += 1 @@ -121,15 +138,15 @@ if %ActionGenScripts% equ 0 (goto skip_scripts) echo %actionNo%: Creating installation scripts -if %ActionBuildVS2010% equ 0 (goto skip_vs2010_scripts) +if %ActionBuildVS2010% equ 0 (if %ActionGenScripts% neq 2 (goto skip_vs2010_scripts)) call :processTemplates 2010 10.0 :skip_vs2010_scripts -if %ActionBuildVS2012% equ 0 (goto skip_vs2012_scripts) +if %ActionBuildVS2012% equ 0 (if %ActionGenScripts% neq 2 (goto skip_vs2012_scripts)) call :processTemplates 2012 11.0 :skip_vs2012_scripts -if %ActionBuildVS2013% equ 0 (goto skip_vs2013_scripts) +if %ActionBuildVS2013% equ 0 (if %ActionGenScripts% neq 2 (goto skip_vs2013_scripts)) call :processTemplates 2013 12.0 :skip_vs2013_scripts @@ -150,8 +167,8 @@ REM $2 - Visual Studio version (10.0) :processTemplates setlocal EnableDelayedExpansion -set InstallTemplate="%thisDir%setup_install.template" -set UninstallTemplate="%thisDir%setup_uninstall.template" +set InstallTemplate="%thisDir%\setup_install.template" +set UninstallTemplate="%thisDir%\setup_uninstall.template" set VSYear=%~1 set VSVersion=%~2 @@ -197,24 +214,24 @@ set PluginPath=!PluginPath:(=^^(! set PluginPath=!PluginPath:)=^^)! REM Create empty file -type nul > %OutputFile% +type nul > "%OutputFile%" -for /f "tokens=* delims=" %%l in (%InputFile%) do ( +for /f "tokens=* delims=" %%l in ("%InputFile%") do ( set line=%%l REM Inject empty line, so the sections are easier visible set first=!line:~0,1! - if "!first!" == "[" echo.>> %OutputFile% + if "!first!" == "[" echo.>> "%OutputFile%" REM Replace markers within the template set line=!line:#VSVersion#=%VSVersion%! set line=!line:#VSYear#=%VSYear%! set line=!line:#PluginRegistryNodeName#=%PluginRegistryNodeName%! set line=!line:#PluginPath#=%PluginPath%! - echo.!line! >> %OutputFile% + echo.!line! >> "%OutputFile%" ) -echo.>> %OutputFile% -echo Completed template "%OutputShortFileName%" +echo.>> "%OutputFile%" +echo %actionNo%: Completed template "%OutputShortFileName%" endlocal exit /b From b168711b5feec49710a67c926d9f8f663051ea37 Mon Sep 17 00:00:00 2001 From: Pawel Hofman Date: Fri, 23 May 2014 16:20:26 +0200 Subject: [PATCH 106/851] Added plugin-owned installed NDKs cache dir Not to mess with the installed Momentics, if we start adding really custom NDKs, those might not be valid for it. --- src_vs2012/VSNDK.Package/Options/ApiLevelOptionControl.cs | 2 +- src_vs2012/VSNDK.Package/Tools/RunnerDefaults.cs | 5 +++++ src_vs2012/VSNDK.Package/ViewModels/PackageViewModel.cs | 3 ++- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src_vs2012/VSNDK.Package/Options/ApiLevelOptionControl.cs b/src_vs2012/VSNDK.Package/Options/ApiLevelOptionControl.cs index e440e3bf..54a9898d 100644 --- a/src_vs2012/VSNDK.Package/Options/ApiLevelOptionControl.cs +++ b/src_vs2012/VSNDK.Package/Options/ApiLevelOptionControl.cs @@ -64,7 +64,7 @@ private void bttAddLocal_Click(object sender, EventArgs e) if (ndk != null) { // save inside 'installation config' directory: - if (ndk.Save(RunnerDefaults.InstallationConfigDirectory)) + if (ndk.Save(RunnerDefaults.PluginInstallationConfigDirectory)) { // reload NDKs _vm.ReloadAndActivate(ndk); diff --git a/src_vs2012/VSNDK.Package/Tools/RunnerDefaults.cs b/src_vs2012/VSNDK.Package/Tools/RunnerDefaults.cs index f97e745b..0f7ce21a 100644 --- a/src_vs2012/VSNDK.Package/Tools/RunnerDefaults.cs +++ b/src_vs2012/VSNDK.Package/Tools/RunnerDefaults.cs @@ -14,6 +14,10 @@ internal static class RunnerDefaults public static readonly string InstallationConfigDirectory; public static readonly string SupplementaryInstallationConfigDirectory; public static readonly string SupplementaryPlayBookInstallationConfigDirectory; + /// + /// Plugin-owned installation cache config directory. + /// + public static readonly string PluginInstallationConfigDirectory; public static readonly string RegistryPath; static RunnerDefaults() @@ -33,6 +37,7 @@ static RunnerDefaults() InstallationConfigDirectory = Path.Combine(DataDirectory, "BlackBerry Native SDK", "qconfig"); SupplementaryInstallationConfigDirectory = Path.Combine(Path.GetPathRoot(Environment.GetFolderPath(Environment.SpecialFolder.System)), "bbndk_vs", "..", "qconfig"); SupplementaryPlayBookInstallationConfigDirectory = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles), "QNX Software Systems", "qconfig"); + PluginInstallationConfigDirectory = Path.Combine(DataDirectory, "VSPlugin", "qconfig"); RegistryPath = @"Software\BlackBerry\BlackBerryVSPlugin"; #if DEBUG diff --git a/src_vs2012/VSNDK.Package/ViewModels/PackageViewModel.cs b/src_vs2012/VSNDK.Package/ViewModels/PackageViewModel.cs index 5d801ab1..70b979d7 100644 --- a/src_vs2012/VSNDK.Package/ViewModels/PackageViewModel.cs +++ b/src_vs2012/VSNDK.Package/ViewModels/PackageViewModel.cs @@ -63,7 +63,8 @@ public NdkInfo[] InstalledNDKs if (_installedNDKs == null) { // load info about NDKs from specified locations: - _installedNDKs = NdkInfo.Load(RunnerDefaults.InstallationConfigDirectory, + _installedNDKs = NdkInfo.Load(RunnerDefaults.PluginInstallationConfigDirectory, + RunnerDefaults.InstallationConfigDirectory, RunnerDefaults.SupplementaryInstallationConfigDirectory, RunnerDefaults.SupplementaryPlayBookInstallationConfigDirectory); } From dc17c927628caa5817b223d74f179c18f7f35802 Mon Sep 17 00:00:00 2001 From: Pawel Hofman Date: Fri, 23 May 2014 17:27:47 +0200 Subject: [PATCH 107/851] Redesigned signing window --- .../Options/SigningOptionControl.Designer.cs | 52 ++++++++++++------- .../Options/SigningOptionControl.cs | 2 +- 2 files changed, 35 insertions(+), 19 deletions(-) diff --git a/src_vs2012/VSNDK.Package/Options/SigningOptionControl.Designer.cs b/src_vs2012/VSNDK.Package/Options/SigningOptionControl.Designer.cs index b78d64f4..724d0cc4 100644 --- a/src_vs2012/VSNDK.Package/Options/SigningOptionControl.Designer.cs +++ b/src_vs2012/VSNDK.Package/Options/SigningOptionControl.Designer.cs @@ -45,6 +45,7 @@ private void InitializeComponent() this.bttRestore = new System.Windows.Forms.Button(); this.bttNavigate = new System.Windows.Forms.Button(); this.label4 = new System.Windows.Forms.Label(); + this.button1 = new System.Windows.Forms.Button(); this.groupBox1.SuspendLayout(); this.groupBox2.SuspendLayout(); this.SuspendLayout(); @@ -55,7 +56,6 @@ private void InitializeComponent() | System.Windows.Forms.AnchorStyles.Right))); this.groupBox1.Controls.Add(this.bttUnregister); this.groupBox1.Controls.Add(this.bttRegister); - this.groupBox1.Controls.Add(this.bttDeletePassword); this.groupBox1.Controls.Add(this.lblMore); this.groupBox1.Controls.Add(this.label1); this.groupBox1.Location = new System.Drawing.Point(3, 3); @@ -89,12 +89,12 @@ private void InitializeComponent() // // bttDeletePassword // - this.bttDeletePassword.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this.bttDeletePassword.Location = new System.Drawing.Point(264, 70); + this.bttDeletePassword.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.bttDeletePassword.Location = new System.Drawing.Point(315, 43); this.bttDeletePassword.Name = "bttDeletePassword"; - this.bttDeletePassword.Size = new System.Drawing.Size(126, 23); - this.bttDeletePassword.TabIndex = 4; - this.bttDeletePassword.Text = "Forget password"; + this.bttDeletePassword.Size = new System.Drawing.Size(75, 23); + this.bttDeletePassword.TabIndex = 7; + this.bttDeletePassword.Text = "Detach"; this.bttDeletePassword.UseVisualStyleBackColor = true; this.bttDeletePassword.Click += new System.EventHandler(this.bttDeletePassword_Click); // @@ -135,7 +135,7 @@ private void InitializeComponent() this.label3.Location = new System.Drawing.Point(6, 48); this.label3.Name = "label3"; this.label3.Size = new System.Drawing.Size(41, 13); - this.label3.TabIndex = 3; + this.label3.TabIndex = 4; this.label3.Text = "Author:"; // // txtCertPath @@ -145,16 +145,18 @@ private void InitializeComponent() this.txtCertPath.Location = new System.Drawing.Point(90, 19); this.txtCertPath.Name = "txtCertPath"; this.txtCertPath.ReadOnly = true; - this.txtCertPath.Size = new System.Drawing.Size(219, 20); + this.txtCertPath.Size = new System.Drawing.Size(138, 20); this.txtCertPath.TabIndex = 1; // // txtAuthor // + this.txtAuthor.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); this.txtAuthor.Location = new System.Drawing.Point(90, 45); this.txtAuthor.Name = "txtAuthor"; this.txtAuthor.ReadOnly = true; - this.txtAuthor.Size = new System.Drawing.Size(171, 20); - this.txtAuthor.TabIndex = 4; + this.txtAuthor.Size = new System.Drawing.Size(138, 20); + this.txtAuthor.TabIndex = 5; // // groupBox2 // @@ -163,7 +165,9 @@ private void InitializeComponent() | System.Windows.Forms.AnchorStyles.Right))); this.groupBox2.Controls.Add(this.bttRefresh); this.groupBox2.Controls.Add(this.bttBackup); + this.groupBox2.Controls.Add(this.bttDeletePassword); this.groupBox2.Controls.Add(this.bttRestore); + this.groupBox2.Controls.Add(this.button1); this.groupBox2.Controls.Add(this.bttNavigate); this.groupBox2.Controls.Add(this.txtAuthor); this.groupBox2.Controls.Add(this.txtCertPath); @@ -180,10 +184,10 @@ private void InitializeComponent() // bttRefresh // this.bttRefresh.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this.bttRefresh.Location = new System.Drawing.Point(315, 46); + this.bttRefresh.Location = new System.Drawing.Point(234, 43); this.bttRefresh.Name = "bttRefresh"; this.bttRefresh.Size = new System.Drawing.Size(75, 23); - this.bttRefresh.TabIndex = 8; + this.bttRefresh.TabIndex = 6; this.bttRefresh.Text = "&Refresh..."; this.bttRefresh.UseVisualStyleBackColor = true; this.bttRefresh.Click += new System.EventHandler(this.bttRefresh_Click); @@ -193,7 +197,7 @@ private void InitializeComponent() this.bttBackup.Location = new System.Drawing.Point(9, 144); this.bttBackup.Name = "bttBackup"; this.bttBackup.Size = new System.Drawing.Size(75, 23); - this.bttBackup.TabIndex = 6; + this.bttBackup.TabIndex = 9; this.bttBackup.Text = "&Backup..."; this.bttBackup.UseVisualStyleBackColor = true; this.bttBackup.Click += new System.EventHandler(this.bttBackup_Click); @@ -203,7 +207,7 @@ private void InitializeComponent() this.bttRestore.Location = new System.Drawing.Point(90, 144); this.bttRestore.Name = "bttRestore"; this.bttRestore.Size = new System.Drawing.Size(75, 23); - this.bttRestore.TabIndex = 7; + this.bttRestore.TabIndex = 10; this.bttRestore.Text = "R&estore..."; this.bttRestore.UseVisualStyleBackColor = true; this.bttRestore.Click += new System.EventHandler(this.bttRestore_Click); @@ -211,11 +215,11 @@ private void InitializeComponent() // bttNavigate // this.bttNavigate.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this.bttNavigate.Location = new System.Drawing.Point(315, 19); + this.bttNavigate.Location = new System.Drawing.Point(315, 16); this.bttNavigate.Name = "bttNavigate"; this.bttNavigate.Size = new System.Drawing.Size(75, 23); - this.bttNavigate.TabIndex = 2; - this.bttNavigate.Text = "&Navigate..."; + this.bttNavigate.TabIndex = 3; + this.bttNavigate.Text = "&Open..."; this.bttNavigate.UseVisualStyleBackColor = true; this.bttNavigate.Click += new System.EventHandler(this.bttNavigate_Click); // @@ -226,9 +230,20 @@ private void InitializeComponent() this.label4.Location = new System.Drawing.Point(6, 72); this.label4.Name = "label4"; this.label4.Size = new System.Drawing.Size(384, 73); - this.label4.TabIndex = 5; + this.label4.TabIndex = 8; this.label4.Text = resources.GetString("label4.Text"); // + // button1 + // + this.button1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.button1.Location = new System.Drawing.Point(234, 16); + this.button1.Name = "button1"; + this.button1.Size = new System.Drawing.Size(75, 23); + this.button1.TabIndex = 2; + this.button1.Text = "&Change..."; + this.button1.UseVisualStyleBackColor = true; + this.button1.Click += new System.EventHandler(this.bttNavigate_Click); + // // SigningOptionControl // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); @@ -263,5 +278,6 @@ private void InitializeComponent() private System.Windows.Forms.Button bttBackup; private System.Windows.Forms.Button bttRestore; private System.Windows.Forms.Button bttRefresh; + private System.Windows.Forms.Button button1; } } diff --git a/src_vs2012/VSNDK.Package/Options/SigningOptionControl.cs b/src_vs2012/VSNDK.Package/Options/SigningOptionControl.cs index 08e39b44..2d26e1af 100644 --- a/src_vs2012/VSNDK.Package/Options/SigningOptionControl.cs +++ b/src_vs2012/VSNDK.Package/Options/SigningOptionControl.cs @@ -99,7 +99,7 @@ private void bttNavigate_Click(object sender, EventArgs e) private void bttDeletePassword_Click(object sender, EventArgs e) { - if (MessageBoxHelper.Show("Delete stored password?", "BBID Token CSK Password", MessageBoxButtons.YesNo, MessageBoxIcon.Question) != DialogResult.Yes) + if (MessageBoxHelper.Show("Are you sure to delete stored certificate password?", null, MessageBoxButtons.YesNo, MessageBoxIcon.Question) != DialogResult.Yes) return; _vm.Developer.DeleteCskPassword(); From 6b81cc57804e842a071cac343ccdf1f1534a6ccf Mon Sep 17 00:00:00 2001 From: Pawel Hofman Date: Sat, 24 May 2014 00:02:28 +0200 Subject: [PATCH 108/851] Fixed displayed device menu item '-' When nothing defined. --- src/VSNDK.Package/VSNDK.PackagePackage.cs | 6 ++++-- .../VSNDK.Package/Model/Integration/DynamicMenuCommand.cs | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/VSNDK.Package/VSNDK.PackagePackage.cs b/src/VSNDK.Package/VSNDK.PackagePackage.cs index 1cc80b99..0249fac7 100644 --- a/src/VSNDK.Package/VSNDK.PackagePackage.cs +++ b/src/VSNDK.Package/VSNDK.PackagePackage.cs @@ -1041,7 +1041,8 @@ protected override void Initialize() (cmd, collection, index) => { var item = index >= 0 && index < collection.Count ? ((DeviceDefinition[])collection)[index] : null; - cmd.Checked = item == PackageViewModel.Instance.ActiveDevice || item == PackageViewModel.Instance.ActiveSimulator; + cmd.Checked = item != null && (item == PackageViewModel.Instance.ActiveDevice || item == PackageViewModel.Instance.ActiveSimulator); + cmd.Visible = item != null; cmd.Text = item != null ? item.ToString() : "-"; }, devicesCommandID); @@ -1057,7 +1058,8 @@ protected override void Initialize() (cmd, collection, index) => { var item = index >= 0 && index < collection.Count ? ((NdkInfo[]) collection)[index] : null; - cmd.Checked = item == PackageViewModel.Instance.ActiveNDK; + cmd.Checked = item != null && item == PackageViewModel.Instance.ActiveNDK; + cmd.Visible = item != null; cmd.Text = item != null ? item.ToString() : "-"; }, apiLevelCommandID); diff --git a/src_vs2012/VSNDK.Package/Model/Integration/DynamicMenuCommand.cs b/src_vs2012/VSNDK.Package/Model/Integration/DynamicMenuCommand.cs index 6ce5ab45..2f6d5aaa 100644 --- a/src_vs2012/VSNDK.Package/Model/Integration/DynamicMenuCommand.cs +++ b/src_vs2012/VSNDK.Package/Model/Integration/DynamicMenuCommand.cs @@ -84,7 +84,7 @@ private bool InternalCollectionPredicate(int cmdId) { var collection = Collection; - if (collection == null) + if (collection == null || collection.Count == 0) return false; return cmdId >= CommandID.ID && (cmdId - CommandID.ID) < collection.Count; From cc6c1e7864fbbe1089ce8f632b00150c01037293 Mon Sep 17 00:00:00 2001 From: Pawel Hofman Date: Sat, 24 May 2014 00:05:55 +0200 Subject: [PATCH 109/851] Added option to open URLs as tab in Visual Studio --- .../Options/GeneralOptionControl.Designer.cs | 76 +++++++++++-------- .../Options/GeneralOptionControl.cs | 12 ++- .../Options/GeneralOptionPage.cs | 10 ++- 3 files changed, 61 insertions(+), 37 deletions(-) diff --git a/src_vs2012/VSNDK.Package/Options/GeneralOptionControl.Designer.cs b/src_vs2012/VSNDK.Package/Options/GeneralOptionControl.Designer.cs index 0e34d005..4fa8bf03 100644 --- a/src_vs2012/VSNDK.Package/Options/GeneralOptionControl.Designer.cs +++ b/src_vs2012/VSNDK.Package/Options/GeneralOptionControl.Designer.cs @@ -30,15 +30,16 @@ private void InitializeComponent() { this.txtNdkPath = new System.Windows.Forms.TextBox(); this.groupBox1 = new System.Windows.Forms.GroupBox(); + this.bttOpenProfile = new System.Windows.Forms.Button(); + this.txtProfilePath = new System.Windows.Forms.TextBox(); + this.label4 = new System.Windows.Forms.Label(); this.label3 = new System.Windows.Forms.Label(); this.bttToolsBrowse = new System.Windows.Forms.Button(); this.bttNdkBrowse = new System.Windows.Forms.Button(); this.txtToolsPath = new System.Windows.Forms.TextBox(); this.label2 = new System.Windows.Forms.Label(); this.label1 = new System.Windows.Forms.Label(); - this.label4 = new System.Windows.Forms.Label(); - this.txtProfilePath = new System.Windows.Forms.TextBox(); - this.bttOpenProfile = new System.Windows.Forms.Button(); + this.chkOpenInExternal = new System.Windows.Forms.CheckBox(); this.groupBox1.SuspendLayout(); this.SuspendLayout(); // @@ -72,6 +73,36 @@ private void InitializeComponent() this.groupBox1.TabStop = false; this.groupBox1.Text = "Locations"; // + // bttOpenProfile + // + this.bttOpenProfile.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.bttOpenProfile.Location = new System.Drawing.Point(526, 115); + this.bttOpenProfile.Name = "bttOpenProfile"; + this.bttOpenProfile.Size = new System.Drawing.Size(75, 23); + this.bttOpenProfile.TabIndex = 9; + this.bttOpenProfile.Text = "Open..."; + this.bttOpenProfile.UseVisualStyleBackColor = true; + this.bttOpenProfile.Click += new System.EventHandler(this.bttOpenProfile_Click); + // + // txtProfilePath + // + this.txtProfilePath.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.txtProfilePath.Location = new System.Drawing.Point(91, 115); + this.txtProfilePath.Name = "txtProfilePath"; + this.txtProfilePath.ReadOnly = true; + this.txtProfilePath.Size = new System.Drawing.Size(429, 20); + this.txtProfilePath.TabIndex = 8; + // + // label4 + // + this.label4.AutoSize = true; + this.label4.Location = new System.Drawing.Point(15, 118); + this.label4.Name = "label4"; + this.label4.Size = new System.Drawing.Size(64, 13); + this.label4.TabIndex = 7; + this.label4.Text = "Profile Path:"; + // // label3 // this.label3.AutoSize = true; @@ -130,46 +161,28 @@ private void InitializeComponent() this.label1.TabIndex = 0; this.label1.Text = "NDK Path:"; // - // label4 - // - this.label4.AutoSize = true; - this.label4.Location = new System.Drawing.Point(15, 118); - this.label4.Name = "label4"; - this.label4.Size = new System.Drawing.Size(64, 13); - this.label4.TabIndex = 7; - this.label4.Text = "Profile Path:"; - // - // txtProfilePath - // - this.txtProfilePath.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.txtProfilePath.Location = new System.Drawing.Point(91, 115); - this.txtProfilePath.Name = "txtProfilePath"; - this.txtProfilePath.ReadOnly = true; - this.txtProfilePath.Size = new System.Drawing.Size(429, 20); - this.txtProfilePath.TabIndex = 8; - // - // bttOpenProfile + // chkOpenInExternal // - this.bttOpenProfile.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this.bttOpenProfile.Location = new System.Drawing.Point(526, 115); - this.bttOpenProfile.Name = "bttOpenProfile"; - this.bttOpenProfile.Size = new System.Drawing.Size(75, 23); - this.bttOpenProfile.TabIndex = 9; - this.bttOpenProfile.Text = "Open..."; - this.bttOpenProfile.UseVisualStyleBackColor = true; - this.bttOpenProfile.Click += new System.EventHandler(this.bttOpenProfile_Click); + this.chkOpenInExternal.AutoSize = true; + this.chkOpenInExternal.Location = new System.Drawing.Point(18, 175); + this.chkOpenInExternal.Name = "chkOpenInExternal"; + this.chkOpenInExternal.Size = new System.Drawing.Size(167, 17); + this.chkOpenInExternal.TabIndex = 1; + this.chkOpenInExternal.Text = "Open links in external browser"; + this.chkOpenInExternal.UseVisualStyleBackColor = true; // // GeneralOptionControl // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.Controls.Add(this.chkOpenInExternal); this.Controls.Add(this.groupBox1); this.Name = "GeneralOptionControl"; this.Size = new System.Drawing.Size(619, 217); this.groupBox1.ResumeLayout(false); this.groupBox1.PerformLayout(); this.ResumeLayout(false); + this.PerformLayout(); } @@ -186,5 +199,6 @@ private void InitializeComponent() private System.Windows.Forms.TextBox txtProfilePath; private System.Windows.Forms.Label label4; private System.Windows.Forms.Button bttOpenProfile; + private System.Windows.Forms.CheckBox chkOpenInExternal; } } diff --git a/src_vs2012/VSNDK.Package/Options/GeneralOptionControl.cs b/src_vs2012/VSNDK.Package/Options/GeneralOptionControl.cs index c86fcd65..64ea12cb 100644 --- a/src_vs2012/VSNDK.Package/Options/GeneralOptionControl.cs +++ b/src_vs2012/VSNDK.Package/Options/GeneralOptionControl.cs @@ -1,5 +1,4 @@ -using System.Diagnostics; -using System.Windows.Forms; +using System.Windows.Forms; using RIM.VSNDK_Package.Tools; namespace RIM.VSNDK_Package.Options @@ -35,6 +34,15 @@ public string ProfilePath set { txtProfilePath.Text = value; } } + /// + /// Checks if open URL links in internal or external browser. + /// + public bool IsOpeningExternal + { + get { return chkOpenInExternal.Checked; } + set { chkOpenInExternal.Checked = value; } + } + #endregion private void bttNdkBrowse_Click(object sender, System.EventArgs e) diff --git a/src_vs2012/VSNDK.Package/Options/GeneralOptionPage.cs b/src_vs2012/VSNDK.Package/Options/GeneralOptionPage.cs index 629a117e..b9960437 100644 --- a/src_vs2012/VSNDK.Package/Options/GeneralOptionPage.cs +++ b/src_vs2012/VSNDK.Package/Options/GeneralOptionPage.cs @@ -55,11 +55,13 @@ public string ToolsPath set { Control.ToolsPath = value; } } - #endregion - - protected override void OnApply(PageApplyEventArgs e) + public bool IsOpeningExternal { - base.OnApply(e); + get { return Control.IsOpeningExternal; } + set { Control.IsOpeningExternal = value; } } + + + #endregion } } From 5c694656041f58ca73352cdadc137a93bc46b58e Mon Sep 17 00:00:00 2001 From: Pawel Hofman Date: Sat, 24 May 2014 00:06:57 +0200 Subject: [PATCH 110/851] Added more 'Help' web pages to open Also utilized new option to display web content in external application or start Visual Studio dedicated tab. --- src/VSNDK.Package/PkgCmdID.cs | 18 +++---- src/VSNDK.Package/VSNDK.PackagePackage.cs | 46 ++++++++++++++---- .../VSNDK.Package/VSNDK.Package.Menu.vsct | 48 +++++++++++++------ 3 files changed, 80 insertions(+), 32 deletions(-) diff --git a/src/VSNDK.Package/PkgCmdID.cs b/src/VSNDK.Package/PkgCmdID.cs index c5a4dbcf..14e60975 100644 --- a/src/VSNDK.Package/PkgCmdID.cs +++ b/src/VSNDK.Package/PkgCmdID.cs @@ -24,14 +24,16 @@ internal static class PkgCmdIDList public const int cmdidBlackBerryTargetsApiLevelsPlaceholder = 0x601; public const int cmdidBlackBerryTargetsConfigure = 0x701; - public const int cmdidBlackBerryHelpDocNative = 0x901; - public const int cmdidBlackBerryHelpDocCascades = 0x902; - public const int cmdidBlackBerryHelpDocPlayBook = 0x903; - public const int cmdidBlackBerryHelpSamplesNative = 0x1001; - public const int cmdidBlackBerryHelpSamplesCascades = 0x1002; - public const int cmdidBlackBerryHelpSamplesPlayBook = 0x1003; - public const int cmdidBlackBerryHelpSamplesOpenSource = 0x1004; - public const int cmdidBlackBerryHelpAbout = 0x1101; + public const int cmdidBlackBerryHelpWelcomePage = 0x901; + public const int cmdidBlackBerryHelpSupportForum = 0x902; + public const int cmdidBlackBerryHelpDocNative = 0x1001; + public const int cmdidBlackBerryHelpDocCascades = 0x1002; + public const int cmdidBlackBerryHelpDocPlayBook = 0x1003; + public const int cmdidBlackBerryHelpSamplesNative = 0x1101; + public const int cmdidBlackBerryHelpSamplesCascades = 0x1102; + public const int cmdidBlackBerryHelpSamplesPlayBook = 0x1103; + public const int cmdidBlackBerryHelpSamplesOpenSource = 0x1104; + public const int cmdidBlackBerryHelpAbout = 0x1201; public const int cmdidBlackBerryProjectImport = 0x0104; diff --git a/src/VSNDK.Package/VSNDK.PackagePackage.cs b/src/VSNDK.Package/VSNDK.PackagePackage.cs index 0249fac7..6bc54b1f 100644 --- a/src/VSNDK.Package/VSNDK.PackagePackage.cs +++ b/src/VSNDK.Package/VSNDK.PackagePackage.cs @@ -926,7 +926,7 @@ public sealed class VSNDK_PackagePackage : Package #region private member variables private BlackBerryPaneTraceListener _traceWindow; - private DTE _dte; + private DTE2 _dte; private VSNDKCommandEvents _commandEvents; private bool _isSimulator; private BuildEvents _buildEvents; @@ -985,7 +985,7 @@ protected override void Initialize() TraceLog.WriteLine(" * registered editors"); - _dte = (DTE)GetService(typeof(DTE)); + _dte = (DTE2)GetService(typeof(SDTE)); if ((IsBlackBerrySolution(_dte)) && (apiList._installedAPIList.Count == 0)) { @@ -1067,6 +1067,7 @@ protected override void Initialize() // Create command for 'Help' menus var helpCmdIDs = new[] { + PkgCmdIDList.cmdidBlackBerryHelpWelcomePage, PkgCmdIDList.cmdidBlackBerryHelpSupportForum, PkgCmdIDList.cmdidBlackBerryHelpDocNative, PkgCmdIDList.cmdidBlackBerryHelpDocCascades, PkgCmdIDList.cmdidBlackBerryHelpDocPlayBook, PkgCmdIDList.cmdidBlackBerryHelpSamplesNative, PkgCmdIDList.cmdidBlackBerryHelpSamplesCascades, PkgCmdIDList.cmdidBlackBerryHelpSamplesPlayBook, PkgCmdIDList.cmdidBlackBerryHelpSamplesOpenSource, PkgCmdIDList.cmdidBlackBerryHelpAbout @@ -1094,6 +1095,25 @@ protected override void Initialize() TraceLog.WriteLine("-------------------- DONE"); } + public Window2 OpenWebPageTab(string url) + { + return (Window2)_dte.ItemOperations.Navigate(url, vsNavigateOptions.vsNavigateOptionsNewWindow); + } + + private void OpenUrl(string url) + { + var options = (GeneralOptionPage)GetDialogPage(typeof(GeneralOptionPage)); + + if (options.IsOpeningExternal) + { + DialogHelper.StartURL(url); + } + else + { + OpenWebPageTab(url); + } + } + private void OpenHelpWebPage(object sender, EventArgs e) { var menuCommand = sender as MenuCommand; @@ -1101,26 +1121,32 @@ private void OpenHelpWebPage(object sender, EventArgs e) switch (cmdID) { + case PkgCmdIDList.cmdidBlackBerryHelpWelcomePage: + OpenUrl("http://developer.blackberry.com/cascades/momentics/"); + break; + case PkgCmdIDList.cmdidBlackBerryHelpSupportForum: + OpenUrl("http://supportforums.blackberry.com/t5/Developer-Support-Forums/ct-p/blackberrydev"); + break; case PkgCmdIDList.cmdidBlackBerryHelpDocNative: - DialogHelper.StartURL("http://developer.blackberry.com/native/documentation/core/framework.html"); + OpenUrl("http://developer.blackberry.com/native/documentation/core/framework.html"); break; case PkgCmdIDList.cmdidBlackBerryHelpDocCascades: - DialogHelper.StartURL("http://developer.blackberry.com/native/documentation/cascades/dev/index.html"); + OpenUrl("http://developer.blackberry.com/native/documentation/cascades/dev/index.html"); break; case PkgCmdIDList.cmdidBlackBerryHelpDocPlayBook: - DialogHelper.StartURL("http://developer.blackberry.com/playbook/native/documentation/"); + OpenUrl("http://developer.blackberry.com/playbook/native/documentation/"); break; case PkgCmdIDList.cmdidBlackBerryHelpSamplesNative: - DialogHelper.StartURL("http://developer.blackberry.com/native/sampleapps/"); + OpenUrl("http://developer.blackberry.com/native/sampleapps/"); break; case PkgCmdIDList.cmdidBlackBerryHelpSamplesCascades: - DialogHelper.StartURL("http://developer.blackberry.com/native/sampleapps/"); + OpenUrl("http://developer.blackberry.com/native/sampleapps/"); break; case PkgCmdIDList.cmdidBlackBerryHelpSamplesPlayBook: - DialogHelper.StartURL("http://developer.blackberry.com/playbook/native/sampleapps/"); + OpenUrl("http://developer.blackberry.com/playbook/native/sampleapps/"); break; case PkgCmdIDList.cmdidBlackBerryHelpSamplesOpenSource: - DialogHelper.StartURL("https://github.com/blackberry"); + OpenUrl("https://github.com/blackberry"); break; case PkgCmdIDList.cmdidBlackBerryHelpAbout: { @@ -1143,7 +1169,7 @@ private void OpenHelpWebPage(object sender, EventArgs e) /// /// /// - private bool IsBlackBerrySolution(EnvDTE.DTE dte) + private bool IsBlackBerrySolution(DTE2 dte) { bool res = false; diff --git a/src_vs2012/VSNDK.Package/VSNDK.Package.Menu.vsct b/src_vs2012/VSNDK.Package/VSNDK.Package.Menu.vsct index ce8067c8..094753c0 100644 --- a/src_vs2012/VSNDK.Package/VSNDK.Package.Menu.vsct +++ b/src_vs2012/VSNDK.Package/VSNDK.Package.Menu.vsct @@ -53,13 +53,16 @@ - + - + - + + + + @@ -138,6 +141,20 @@ + + + + internal class ApiInfo { + private readonly string _description; + public ApiInfo(string name, Version version) { if (string.IsNullOrEmpty(name)) @@ -17,6 +19,9 @@ public ApiInfo(string name, Version version) Name = name; Version = version; Level = new Version(version.Major, version.Minor); + + var versionString = Version.ToString(); + _description = Name.IndexOf(versionString, StringComparison.Ordinal) >= 0 ? Name : string.Concat(Name, " (", versionString, ")"); } #region Properties @@ -43,7 +48,7 @@ public Version Level public override string ToString() { - return string.Concat(Name, " (", Version, ")"); + return _description; } } } From 5a3cce4a9a2aa4bbf3810084e85894e3bd047879 Mon Sep 17 00:00:00 2001 From: Pawel Hofman Date: Sat, 24 May 2014 00:46:45 +0200 Subject: [PATCH 112/851] Fixed empty paths on Windows XP --- src_vs2012/VSNDK.Package/Tools/RunnerDefaults.cs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src_vs2012/VSNDK.Package/Tools/RunnerDefaults.cs b/src_vs2012/VSNDK.Package/Tools/RunnerDefaults.cs index 0f7ce21a..029776c5 100644 --- a/src_vs2012/VSNDK.Package/Tools/RunnerDefaults.cs +++ b/src_vs2012/VSNDK.Package/Tools/RunnerDefaults.cs @@ -22,12 +22,16 @@ internal static class RunnerDefaults static RunnerDefaults() { - ToolsDirectory = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86), "BlackBerry", "VSPlugin-NDK", "qnxtools", "bin"); + var programFilesX86 = Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86); + if (string.IsNullOrEmpty(programFilesX86)) + programFilesX86 = Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles); + + ToolsDirectory = Path.Combine(programFilesX86, "BlackBerry", "VSPlugin-NDK", "qnxtools", "bin"); NdkDirectory = Path.Combine(Path.GetPathRoot(Environment.GetFolderPath(Environment.SpecialFolder.System)), "bbndk_vs"); // the base data folder is different for each platform... if (IsWindowsXP) { - DataDirectory = Path.Combine(Environment.ExpandEnvironmentVariables("%HomeDrive%"), Environment.ExpandEnvironmentVariables("%HomePath%"), "Local Settings", "Application Data", "Research In Motion"); + DataDirectory = Path.Combine(Environment.ExpandEnvironmentVariables("%HomeDrive%%HomePath%"), "Local Settings", "Application Data", "Research In Motion"); } else { From 6b656dc2a58f6f3ed1000764c0f3ac8fa8cc26df Mon Sep 17 00:00:00 2001 From: Pawel Hofman Date: Sat, 24 May 2014 00:46:58 +0200 Subject: [PATCH 113/851] Disabled storing paths from general-settings --- .../Options/GeneralOptionControl.cs | 18 +++++++++++++----- .../VSNDK.Package/Options/GeneralOptionPage.cs | 7 ++++++- 2 files changed, 19 insertions(+), 6 deletions(-) diff --git a/src_vs2012/VSNDK.Package/Options/GeneralOptionControl.cs b/src_vs2012/VSNDK.Package/Options/GeneralOptionControl.cs index 64ea12cb..866d3e8d 100644 --- a/src_vs2012/VSNDK.Package/Options/GeneralOptionControl.cs +++ b/src_vs2012/VSNDK.Package/Options/GeneralOptionControl.cs @@ -1,4 +1,5 @@ -using System.Windows.Forms; +using System.ComponentModel; +using System.Windows.Forms; using RIM.VSNDK_Package.Tools; namespace RIM.VSNDK_Package.Options @@ -8,26 +9,26 @@ public partial class GeneralOptionControl : UserControl public GeneralOptionControl() { InitializeComponent(); - - txtNdkPath.Text = RunnerDefaults.NdkDirectory; - txtToolsPath.Text = RunnerDefaults.ToolsDirectory; - txtProfilePath.Text = RunnerDefaults.DataDirectory; + OnReset(); } #region Properties + [Browsable(false)] public string NdkPath { get { return txtNdkPath.Text; } set { txtNdkPath.Text = value; } } + [Browsable(false)] public string ToolsPath { get { return txtToolsPath.Text; } set { txtToolsPath.Text = value; } } + [Browsable(false)] public string ProfilePath { get { return txtProfilePath.Text; } @@ -59,5 +60,12 @@ private void bttOpenProfile_Click(object sender, System.EventArgs e) { DialogHelper.StartExplorer(ProfilePath); } + + public void OnReset() + { + txtNdkPath.Text = RunnerDefaults.NdkDirectory; + txtToolsPath.Text = RunnerDefaults.ToolsDirectory; + txtProfilePath.Text = RunnerDefaults.DataDirectory; + } } } diff --git a/src_vs2012/VSNDK.Package/Options/GeneralOptionPage.cs b/src_vs2012/VSNDK.Package/Options/GeneralOptionPage.cs index b9960437..17b0ff4a 100644 --- a/src_vs2012/VSNDK.Package/Options/GeneralOptionPage.cs +++ b/src_vs2012/VSNDK.Package/Options/GeneralOptionPage.cs @@ -61,7 +61,12 @@ public bool IsOpeningExternal set { Control.IsOpeningExternal = value; } } - #endregion + + protected override void OnClosed(System.EventArgs e) + { + base.OnClosed(e); + Control.OnReset(); + } } } From ba4f239bc63b5784b85e474045ffe7aa990ad912 Mon Sep 17 00:00:00 2001 From: Pawel Hofman Date: Sun, 25 May 2014 02:06:00 +0200 Subject: [PATCH 114/851] Implemented extended WebBrowser To follow the same single sign-in BBID token request. It will let grab data received as POST-data and add error handling. --- .../Model/Integration/WebBrowserTurbo.cs | 221 ++++++++++++++++++ 1 file changed, 221 insertions(+) create mode 100644 src_vs2012/VSNDK.Package/Model/Integration/WebBrowserTurbo.cs diff --git a/src_vs2012/VSNDK.Package/Model/Integration/WebBrowserTurbo.cs b/src_vs2012/VSNDK.Package/Model/Integration/WebBrowserTurbo.cs new file mode 100644 index 00000000..56e81116 --- /dev/null +++ b/src_vs2012/VSNDK.Package/Model/Integration/WebBrowserTurbo.cs @@ -0,0 +1,221 @@ +using System; +using System.Runtime.InteropServices; +using System.Windows.Forms; + +namespace RIM.VSNDK_Package.Model.Integration +{ + /// + /// Extended version of WebBrowser to return more data, when navigating over URLs and notify about errors. + /// Based on sample implementation from: + /// http://msdn.microsoft.com/en-us/library/system.windows.forms.webbrowser.createsink%28VS.80%29.aspx + /// + public sealed class WebBrowserTurbo : WebBrowser + { + public event WebBrowserNavigateErrorEventHandler NavigateError; + public event WebBrowserBeforeNavigatingEventHandler BeforeNavigating; + + private AxHost.ConnectionPointCookie _cookie; + private EventSink _sink; + + #region COM Interfaces + + // Imports the NavigateError method from the OLE DWebBrowserEvents2 + // interface. + [ComImport, Guid("34A715A0-6587-11D0-924A-0020AFC7AC4D"), InterfaceType(ComInterfaceType.InterfaceIsIDispatch), TypeLibType(TypeLibTypeFlags.FHidden)] + public interface DWebBrowserEvents2 + { + [DispId(250)] + void BeforeNavigate2( + [MarshalAs(UnmanagedType.IDispatch)] object pDisp, + [In] ref object url, + [In] ref object flags, + [In] ref object targetFrameName, + [In] ref object postData, + [In] ref object headers, + [In, Out, MarshalAs(UnmanagedType.VariantBool)] ref bool cancel); + + [DispId(271)] + void NavigateError( + [In, MarshalAs(UnmanagedType.IDispatch)] object pDisp, + [In] ref object url, + [In] ref object targetFrame, + [In] ref object statusCode, + [In, Out] ref bool cancel); + } + + /// + /// Helper class that will forward COM events received from the COM-object-browser to the control. + /// + private sealed class EventSink : StandardOleMarshalObject, DWebBrowserEvents2 + { + private WebBrowserTurbo _browser; + + public EventSink(WebBrowserTurbo browser) + { + if (browser == null) + throw new ArgumentNullException("browser"); + + _browser = browser; + } + + public void BeforeNavigate2(object pDisp, ref object url, ref object flags, ref object targetFrameName, ref object postData, ref object headers, ref bool cancel) + { + var e = new WebBrowserBeforeNavigatingEventArgs((string) url, (string) targetFrameName, (byte[]) postData, (string) headers, cancel); + + // notify: + _browser.OnBeforeNavigating(e); + + // update out params: + cancel = e.Cancel; + } + + public void NavigateError(object pDisp, ref object url, ref object targetFrame, ref object statusCode, ref bool cancel) + { + var e = new WebBrowserNavigateErrorEventArgs((string) url, (string) targetFrame, (int) statusCode, cancel); + + // notify + _browser.OnNavigateError(e); + + // update out params: + cancel = e.Cancel; + } + } + + #endregion + + #region Notifications + + private void OnNavigateError(WebBrowserNavigateErrorEventArgs e) + { + if (NavigateError != null) + { + NavigateError(this, e); + } + } + + private void OnBeforeNavigating(WebBrowserBeforeNavigatingEventArgs e) + { + if (BeforeNavigating != null) + { + BeforeNavigating(this, e); + } + } + + #endregion + + protected override void CreateSink() + { + base.CreateSink(); + + // initialize object, that will forward events from associated ActiveX control: + _sink = new EventSink(this); + _cookie = new AxHost.ConnectionPointCookie(ActiveXInstance, _sink, typeof(DWebBrowserEvents2)); + } + + protected override void DetachSink() + { + // remove even forwarder: + if (_cookie != null) + { + _cookie.Disconnect(); + _cookie = null; + } + base.DetachSink(); + } + } + + public delegate void WebBrowserNavigateErrorEventHandler(object sender, WebBrowserNavigateErrorEventArgs e); + + public delegate void WebBrowserBeforeNavigatingEventHandler(object sender, WebBrowserBeforeNavigatingEventArgs e); + + /// + /// Arguments passed along with browser navigation error events. + /// + public sealed class WebBrowserNavigateErrorEventArgs : EventArgs + { + public WebBrowserNavigateErrorEventArgs(string url, string targetFrame, int statusCode, bool cancel) + { + Url = url; + TargetFrame = targetFrame; + StatusCode = statusCode; + Cancel = cancel; + } + + #region Properties + + public string Url + { + get; + private set; + } + + public string TargetFrame + { + get; + private set; + } + + public int StatusCode + { + get; + private set; + } + + public bool Cancel + { + get; + set; + } + + #endregion + } + + /// + /// Arguments passed along with browser navigation events. + /// + public sealed class WebBrowserBeforeNavigatingEventArgs : EventArgs + { + public WebBrowserBeforeNavigatingEventArgs(string url, string targetFrame, byte[] postData, string headers, bool cancel) + { + Url = url; + TargetFrame = targetFrame; + PostData = postData; + Headers = headers; + Cancel = cancel; + } + + #region Properties + + public string Url + { + get; + private set; + } + + public string TargetFrame + { + get; + private set; + } + + public byte[] PostData + { + get; + private set; + } + + public string Headers + { + get; + private set; + } + + public bool Cancel + { + get; + set; + } + + #endregion + } +} From 77f10784de2ddd2b40077d04539b0799c8f9f1e9 Mon Sep 17 00:00:00 2001 From: Pawel Hofman Date: Mon, 26 May 2014 13:51:26 +0200 Subject: [PATCH 115/851] Renamed LoginForm to better reflect its purpose --- .../Dialogs/{LoginForm.Designer.cs => CskRequestForm.Designer.cs} | 0 .../Options/Dialogs/{LoginForm.cs => CskRequestForm.cs} | 0 .../Options/Dialogs/{LoginForm.resx => CskRequestForm.resx} | 0 3 files changed, 0 insertions(+), 0 deletions(-) rename src_vs2012/VSNDK.Package/Options/Dialogs/{LoginForm.Designer.cs => CskRequestForm.Designer.cs} (100%) rename src_vs2012/VSNDK.Package/Options/Dialogs/{LoginForm.cs => CskRequestForm.cs} (100%) rename src_vs2012/VSNDK.Package/Options/Dialogs/{LoginForm.resx => CskRequestForm.resx} (100%) diff --git a/src_vs2012/VSNDK.Package/Options/Dialogs/LoginForm.Designer.cs b/src_vs2012/VSNDK.Package/Options/Dialogs/CskRequestForm.Designer.cs similarity index 100% rename from src_vs2012/VSNDK.Package/Options/Dialogs/LoginForm.Designer.cs rename to src_vs2012/VSNDK.Package/Options/Dialogs/CskRequestForm.Designer.cs diff --git a/src_vs2012/VSNDK.Package/Options/Dialogs/LoginForm.cs b/src_vs2012/VSNDK.Package/Options/Dialogs/CskRequestForm.cs similarity index 100% rename from src_vs2012/VSNDK.Package/Options/Dialogs/LoginForm.cs rename to src_vs2012/VSNDK.Package/Options/Dialogs/CskRequestForm.cs diff --git a/src_vs2012/VSNDK.Package/Options/Dialogs/LoginForm.resx b/src_vs2012/VSNDK.Package/Options/Dialogs/CskRequestForm.resx similarity index 100% rename from src_vs2012/VSNDK.Package/Options/Dialogs/LoginForm.resx rename to src_vs2012/VSNDK.Package/Options/Dialogs/CskRequestForm.resx From 6095c8a021705c2b61c3cffb7239bb324c503340 Mon Sep 17 00:00:00 2001 From: Pawel Hofman Date: Mon, 26 May 2014 17:08:15 +0200 Subject: [PATCH 116/851] Fixed opening Explorer for non existing files In that case the parent folder will popup, instead of just error message and nothing done. --- .../VSNDK.Package/Options/DialogHelper.cs | 40 ++++++++++++++++++- 1 file changed, 39 insertions(+), 1 deletion(-) diff --git a/src_vs2012/VSNDK.Package/Options/DialogHelper.cs b/src_vs2012/VSNDK.Package/Options/DialogHelper.cs index cdd0c5d9..aa941e1c 100644 --- a/src_vs2012/VSNDK.Package/Options/DialogHelper.cs +++ b/src_vs2012/VSNDK.Package/Options/DialogHelper.cs @@ -1,4 +1,6 @@ -using System.Diagnostics; +using System; +using System.Diagnostics; +using System.IO; using System.Windows.Forms; namespace RIM.VSNDK_Package.Options @@ -38,6 +40,23 @@ public static OpenFileDialog OpenBarFile(string title, string startupPath) return openFile; } + /// + /// Returns preconfigured window for opening certificate files. + /// + public static OpenFileDialog OpenCertFile(string startupPath) + { + var openFile = new OpenFileDialog(); + openFile.Title = "Opening certificate file"; + openFile.InitialDirectory = startupPath; + openFile.DefaultExt = ".p12"; + openFile.Filter = "Certificate files|*.p12|All files|*.*"; + openFile.FilterIndex = 0; + openFile.CheckFileExists = true; + openFile.CheckPathExists = true; + + return openFile; + } + /// /// Returns preconfigured window for saving BAR file. /// @@ -98,6 +117,17 @@ public static void StartExplorer(string path) if (string.IsNullOrEmpty(path)) return; + // if specified directory doesn't exist, create it: + try + { + if (!Directory.Exists(path)) + Directory.CreateDirectory(path); + } + catch + { + } + + // open Explorer window with this folder: Process.Start("Explorer.exe", "/e,\"" + path + "\""); } @@ -109,6 +139,14 @@ public static void StartExplorerForFile(string path) if (string.IsNullOrEmpty(path)) return; + // if file doesn't exits, try to open its parent folder: + if (!File.Exists(path)) + { + StartExplorer(Path.GetDirectoryName(path)); + return; + } + + // open Explorer window with specified file selected: Process.Start("Explorer.exe", "/select,\"" + path + "\""); } From 0847346166f7729509eed4ac48ad9f52d25da598 Mon Sep 17 00:00:00 2001 From: Pawel Hofman Date: Mon, 26 May 2014 17:11:09 +0200 Subject: [PATCH 117/851] Added option to change .p12 certificate via UI --- src/VSNDK.Package/VSNDK.Package.csproj | 33 ++-- .../Dialogs/CskRequestForm.Designer.cs | 12 +- .../Options/Dialogs/CskRequestForm.cs | 144 ++++++++++-------- .../Options/Dialogs/PasswordForm.Designer.cs | 14 +- .../Options/SigningOptionControl.Designer.cs | 52 +++---- .../Options/SigningOptionControl.cs | 106 ++++++++++++- .../Options/TargetsOptionControl.Designer.cs | 2 +- src_vs2012/VSNDK.Package/VSNDK.Package.csproj | 22 +-- .../ViewModels/DeveloperDefinition.cs | 42 ++++- src_vs2013/VSNDK.Package/VSNDK.Package.csproj | 29 ++-- 10 files changed, 312 insertions(+), 144 deletions(-) diff --git a/src/VSNDK.Package/VSNDK.Package.csproj b/src/VSNDK.Package/VSNDK.Package.csproj index 353ead62..4addb9eb 100644 --- a/src/VSNDK.Package/VSNDK.Package.csproj +++ b/src/VSNDK.Package/VSNDK.Package.csproj @@ -78,6 +78,7 @@ + @@ -182,6 +183,10 @@ Model\Integration\DynamicMenuCommand.cs + + Model\Integration\WebBrowserTurbo.cs + Component + Model\NdkInfo.cs @@ -216,6 +221,14 @@ Options\Dialogs\AddLocalNdkForm.designer.cs AddLocalNdkForm.cs + + Options\Dialogs\CskRequestForm.cs + Form + + + Options\Dialogs\CskRequestForm.designer.cs + CskRequestForm.cs + Options\Dialogs\DebugTokenDeploymentForm.cs Form @@ -240,14 +253,6 @@ Options\Dialogs\InstallNdkForm.designer.cs InstallNdkForm.cs - - Options\Dialogs\LoginForm.cs - Form - - - Options\Dialogs\LoginForm.designer.cs - LoginForm.cs - Options\Dialogs\PasswordForm.cs Form @@ -436,8 +441,8 @@ - Menus.ctmenu - Designer + Menus.ctmenu + Designer @@ -473,6 +478,10 @@ Options\Dialogs\AddLocalNdkForm.resx AddLocalNdkForm.cs + + Options\Dialogs\CskRequestForm.resx + CskRequestForm.cs + Options\Dialogs\DebugTokenDeploymentForm.resx DebugTokenDeploymentForm.cs @@ -485,10 +494,6 @@ Options\Dialogs\InstallNdkForm.resx InstallNdkForm.cs - - Options\Dialogs\LoginForm.resx - LoginForm.cs - Options\Dialogs\PasswordForm.resx PasswordForm.cs diff --git a/src_vs2012/VSNDK.Package/Options/Dialogs/CskRequestForm.Designer.cs b/src_vs2012/VSNDK.Package/Options/Dialogs/CskRequestForm.Designer.cs index 8594d987..75789688 100644 --- a/src_vs2012/VSNDK.Package/Options/Dialogs/CskRequestForm.Designer.cs +++ b/src_vs2012/VSNDK.Package/Options/Dialogs/CskRequestForm.Designer.cs @@ -1,6 +1,8 @@ -namespace RIM.VSNDK_Package.Options.Dialogs +using RIM.VSNDK_Package.Model.Integration; + +namespace RIM.VSNDK_Package.Options.Dialogs { - partial class LoginForm + partial class CskRequestForm { /// /// Required designer variable. @@ -28,7 +30,7 @@ protected override void Dispose(bool disposing) /// private void InitializeComponent() { - this.webBrowser = new System.Windows.Forms.WebBrowser(); + this.webBrowser = new WebBrowserTurbo(); this.SuspendLayout(); // // webBrowser @@ -47,7 +49,7 @@ private void InitializeComponent() this.ClientSize = new System.Drawing.Size(739, 424); this.Controls.Add(this.webBrowser); this.MinimizeBox = false; - this.Name = "LoginForm"; + this.Name = "CskRequestForm"; this.ShowIcon = false; this.ShowInTaskbar = false; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; @@ -58,6 +60,6 @@ private void InitializeComponent() #endregion - private System.Windows.Forms.WebBrowser webBrowser; + private WebBrowserTurbo webBrowser; } } \ No newline at end of file diff --git a/src_vs2012/VSNDK.Package/Options/Dialogs/CskRequestForm.cs b/src_vs2012/VSNDK.Package/Options/Dialogs/CskRequestForm.cs index 68fdeb28..0f27ac28 100644 --- a/src_vs2012/VSNDK.Package/Options/Dialogs/CskRequestForm.cs +++ b/src_vs2012/VSNDK.Package/Options/Dialogs/CskRequestForm.cs @@ -1,96 +1,118 @@ using System; -using System.IO; -using System.Net; -using System.Net.Security; -using System.Security.Cryptography.X509Certificates; +using System.Collections.Generic; using System.Text; +using System.Web; using System.Windows.Forms; -using RIM.VSNDK_Package.Diagnostics; -using RIM.VSNDK_Package.ViewModels; +using RIM.VSNDK_Package.Model.Integration; namespace RIM.VSNDK_Package.Options.Dialogs { - internal partial class LoginForm : Form + internal partial class CskRequestForm : Form { - private DeveloperDefinition _developer; + private const string CallbackURL = "http://127.0.0.1:12345/vs-plugin"; - public LoginForm(string title, DeveloperDefinition developer) + public CskRequestForm(string title) { - if (developer == null) - throw new ArgumentNullException("developer"); - _developer = developer; - // validate certificate by calling a function - ServicePointManager.ServerCertificateValidationCallback += ValidateRemoteCertificate; InitializeComponent(); if (title != null) Text = title; // navigate: - webBrowser.Navigating += OnBrowserNavigating; - webBrowser.Navigate(new Uri("https://developer.blackberry.com/codesigning/", UriKind.Absolute)); + webBrowser.BeforeNavigating += OnBeforeNavigating; + webBrowser.NavigateError += OnNavigatingError; + } + + #region Properties + + public int StatusCode + { + get; + private set; + } + + public string CskData + { + get; + private set; + } + + #endregion + + public void StartRequest(string password) + { + string headers = "Content-Type: application/x-www-form-urlencoded"; + string data = "callbackURL=" + HttpUtility.UrlEncode(CallbackURL) + "&cskPassword=" + HttpUtility.UrlEncode(password); + + webBrowser.Navigate(new Uri("https://developer.blackberry.com/bdsc/ndk.pg", UriKind.Absolute), null, Encoding.UTF8.GetBytes(data), headers); } /// - /// Method that handles the Navigating event. + /// Method that handles all errors during spot on web-pages. /// - public void OnBrowserNavigating(object sender, WebBrowserNavigatingEventArgs e) + private void OnNavigatingError(object sender, WebBrowserNavigateErrorEventArgs e) { - if (e.Url.Segments[e.Url.Segments.Length - 1].EndsWith("csk.pg")) - { - HttpWebRequest request = (HttpWebRequest)WebRequest.Create(e.Url); - request.Referer = ((WebBrowser)sender).Url.ToString(); - request.CookieContainer = new CookieContainer(); - string cookie_txt = webBrowser != null && webBrowser.Document != null ? webBrowser.Document.Cookie : string.Empty; - string[] cookies = cookie_txt.Split(';'); + StatusCode = e.StatusCode; + e.Cancel = true; - try - { - // Copying cookies from WebBrowser to the HttpWebRequest. - foreach (string cookie in cookies) - { - string[] details = cookie.Split('='); - if (details.Length == 2) - { - details[1] = details[1].Replace(",", "%2C"); - request.CookieContainer.Add(e.Url, new Cookie(details[0].Trim(), details[1].Trim())); - } - } + Invoke(new Action(RequestFailed)); + } - request.KeepAlive = true; + /// + /// Method that handles the BeforeNavigating event of the browser. + /// + private void OnBeforeNavigating(object sender, WebBrowserBeforeNavigatingEventArgs e) + { + if (e.Url == CallbackURL) + { + string postData = Encoding.UTF8.GetString(e.PostData); + string[] data = postData.Split('&'); - // Getting the response - HttpWebResponse response = (HttpWebResponse)request.GetResponse(); + for (int i = 0; i < data.Length; i++) + data[i] = HttpUtility.UrlDecode(data[i]); - // Creating a StreamReader - using (Stream stream = response.GetResponseStream()) - { - using (var reader = new StreamReader(stream, Encoding.UTF8)) - { - // Save the CSK file.. - _developer.SaveBlackBerryToken(reader.ReadToEnd()); - } - } - } - catch (Exception ex) - { - TraceLog.WriteException(ex, "Error while downloading BlackBerry ID token"); - MessageBoxHelper.Show(ex.Message, "An error occurred while downloading your signing key.", MessageBoxButtons.OK, MessageBoxIcon.Error); - } + StatusCode = 200; + CskData = FindContentFor(data, "cskData="); + e.Cancel = true; - Close(); + // And close the form + Invoke(new Action(RequestCompleted)); } } + private void RequestFailed() + { + DialogResult = DialogResult.Cancel; + Close(); + } + + private void RequestCompleted() + { + DialogResult = DialogResult.OK; + Close(); + } + /// - /// Callback used to validate the certificate in an SSL conversation + /// Get the rest of the line from specified collection that starts with specified string key. /// - private static bool ValidateRemoteCertificate(object sender, X509Certificate cert, X509Chain chain, SslPolicyErrors policyErrors) + private static string FindContentFor(IEnumerable collection, string key) { - // accept all 'BlackBerry' domains: - return cert.Subject.Contains(".blackberry.com"); - } + if (string.IsNullOrEmpty(key)) + throw new ArgumentNullException("key"); + + if (collection != null) + { + foreach (var item in collection) + { + if (item != null && item.StartsWith(key, StringComparison.OrdinalIgnoreCase)) + { + return item.Substring(key.Length); + } + } + } + return null; + } } } diff --git a/src_vs2012/VSNDK.Package/Options/Dialogs/PasswordForm.Designer.cs b/src_vs2012/VSNDK.Package/Options/Dialogs/PasswordForm.Designer.cs index d3f0c740..ebb17eda 100644 --- a/src_vs2012/VSNDK.Package/Options/Dialogs/PasswordForm.Designer.cs +++ b/src_vs2012/VSNDK.Package/Options/Dialogs/PasswordForm.Designer.cs @@ -57,7 +57,7 @@ private void InitializeComponent() this.groupBox1.Controls.Add(this.label1); this.groupBox1.Location = new System.Drawing.Point(12, 12); this.groupBox1.Name = "groupBox1"; - this.groupBox1.Size = new System.Drawing.Size(342, 79); + this.groupBox1.Size = new System.Drawing.Size(310, 79); this.groupBox1.TabIndex = 0; this.groupBox1.TabStop = false; this.groupBox1.Text = "Input"; @@ -67,9 +67,9 @@ private void InitializeComponent() this.label2.AutoSize = true; this.label2.Location = new System.Drawing.Point(20, 50); this.label2.Name = "label2"; - this.label2.Size = new System.Drawing.Size(311, 13); + this.label2.Size = new System.Drawing.Size(281, 13); this.label2.TabIndex = 2; - this.label2.Text = "(password set when created the BlackBerry ID token or CSK file)"; + this.label2.Text = "(password set when the BlackBerry ID token was created)"; // // txtPassword // @@ -78,14 +78,14 @@ private void InitializeComponent() this.txtPassword.Location = new System.Drawing.Point(101, 22); this.txtPassword.Name = "txtPassword"; this.txtPassword.PasswordChar = '*'; - this.txtPassword.Size = new System.Drawing.Size(171, 20); + this.txtPassword.Size = new System.Drawing.Size(200, 20); this.txtPassword.TabIndex = 1; // // bttCancel // this.bttCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.bttCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel; - this.bttCancel.Location = new System.Drawing.Point(279, 97); + this.bttCancel.Location = new System.Drawing.Point(247, 97); this.bttCancel.Name = "bttCancel"; this.bttCancel.Size = new System.Drawing.Size(75, 23); this.bttCancel.TabIndex = 3; @@ -95,7 +95,7 @@ private void InitializeComponent() // bttOK // this.bttOK.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this.bttOK.Location = new System.Drawing.Point(198, 97); + this.bttOK.Location = new System.Drawing.Point(166, 97); this.bttOK.Name = "bttOK"; this.bttOK.Size = new System.Drawing.Size(75, 23); this.bttOK.TabIndex = 2; @@ -120,7 +120,7 @@ private void InitializeComponent() this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.CancelButton = this.bttCancel; - this.ClientSize = new System.Drawing.Size(366, 132); + this.ClientSize = new System.Drawing.Size(334, 132); this.Controls.Add(this.chkRemember); this.Controls.Add(this.bttOK); this.Controls.Add(this.bttCancel); diff --git a/src_vs2012/VSNDK.Package/Options/SigningOptionControl.Designer.cs b/src_vs2012/VSNDK.Package/Options/SigningOptionControl.Designer.cs index 724d0cc4..83a80434 100644 --- a/src_vs2012/VSNDK.Package/Options/SigningOptionControl.Designer.cs +++ b/src_vs2012/VSNDK.Package/Options/SigningOptionControl.Designer.cs @@ -32,9 +32,9 @@ private void InitializeComponent() this.groupBox1 = new System.Windows.Forms.GroupBox(); this.bttUnregister = new System.Windows.Forms.Button(); this.bttRegister = new System.Windows.Forms.Button(); - this.bttDeletePassword = new System.Windows.Forms.Button(); this.lblMore = new System.Windows.Forms.LinkLabel(); this.label1 = new System.Windows.Forms.Label(); + this.bttDeletePassword = new System.Windows.Forms.Button(); this.label2 = new System.Windows.Forms.Label(); this.label3 = new System.Windows.Forms.Label(); this.txtCertPath = new System.Windows.Forms.TextBox(); @@ -43,9 +43,9 @@ private void InitializeComponent() this.bttRefresh = new System.Windows.Forms.Button(); this.bttBackup = new System.Windows.Forms.Button(); this.bttRestore = new System.Windows.Forms.Button(); + this.bttChangeCert = new System.Windows.Forms.Button(); this.bttNavigate = new System.Windows.Forms.Button(); this.label4 = new System.Windows.Forms.Label(); - this.button1 = new System.Windows.Forms.Button(); this.groupBox1.SuspendLayout(); this.groupBox2.SuspendLayout(); this.SuspendLayout(); @@ -87,17 +87,6 @@ private void InitializeComponent() this.bttRegister.UseVisualStyleBackColor = true; this.bttRegister.Click += new System.EventHandler(this.bttRegister_Click); // - // bttDeletePassword - // - this.bttDeletePassword.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this.bttDeletePassword.Location = new System.Drawing.Point(315, 43); - this.bttDeletePassword.Name = "bttDeletePassword"; - this.bttDeletePassword.Size = new System.Drawing.Size(75, 23); - this.bttDeletePassword.TabIndex = 7; - this.bttDeletePassword.Text = "Detach"; - this.bttDeletePassword.UseVisualStyleBackColor = true; - this.bttDeletePassword.Click += new System.EventHandler(this.bttDeletePassword_Click); - // // lblMore // this.lblMore.AutoSize = true; @@ -119,6 +108,17 @@ private void InitializeComponent() this.label1.TabIndex = 0; this.label1.Text = "You must register with BlackBerry in order to sign applications and create debug " + "tokens for your device."; + // + // bttDeletePassword + // + this.bttDeletePassword.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.bttDeletePassword.Location = new System.Drawing.Point(315, 43); + this.bttDeletePassword.Name = "bttDeletePassword"; + this.bttDeletePassword.Size = new System.Drawing.Size(75, 23); + this.bttDeletePassword.TabIndex = 7; + this.bttDeletePassword.Text = "Detach"; + this.bttDeletePassword.UseVisualStyleBackColor = true; + this.bttDeletePassword.Click += new System.EventHandler(this.bttDeletePassword_Click); // // label2 // @@ -167,7 +167,7 @@ private void InitializeComponent() this.groupBox2.Controls.Add(this.bttBackup); this.groupBox2.Controls.Add(this.bttDeletePassword); this.groupBox2.Controls.Add(this.bttRestore); - this.groupBox2.Controls.Add(this.button1); + this.groupBox2.Controls.Add(this.bttChangeCert); this.groupBox2.Controls.Add(this.bttNavigate); this.groupBox2.Controls.Add(this.txtAuthor); this.groupBox2.Controls.Add(this.txtCertPath); @@ -212,6 +212,17 @@ private void InitializeComponent() this.bttRestore.UseVisualStyleBackColor = true; this.bttRestore.Click += new System.EventHandler(this.bttRestore_Click); // + // bttChangeCert + // + this.bttChangeCert.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.bttChangeCert.Location = new System.Drawing.Point(234, 16); + this.bttChangeCert.Name = "bttChangeCert"; + this.bttChangeCert.Size = new System.Drawing.Size(75, 23); + this.bttChangeCert.TabIndex = 2; + this.bttChangeCert.Text = "&Change..."; + this.bttChangeCert.UseVisualStyleBackColor = true; + this.bttChangeCert.Click += new System.EventHandler(this.bttChangeCert_Click); + // // bttNavigate // this.bttNavigate.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); @@ -233,17 +244,6 @@ private void InitializeComponent() this.label4.TabIndex = 8; this.label4.Text = resources.GetString("label4.Text"); // - // button1 - // - this.button1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this.button1.Location = new System.Drawing.Point(234, 16); - this.button1.Name = "button1"; - this.button1.Size = new System.Drawing.Size(75, 23); - this.button1.TabIndex = 2; - this.button1.Text = "&Change..."; - this.button1.UseVisualStyleBackColor = true; - this.button1.Click += new System.EventHandler(this.bttNavigate_Click); - // // SigningOptionControl // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); @@ -278,6 +278,6 @@ private void InitializeComponent() private System.Windows.Forms.Button bttBackup; private System.Windows.Forms.Button bttRestore; private System.Windows.Forms.Button bttRefresh; - private System.Windows.Forms.Button button1; + private System.Windows.Forms.Button bttChangeCert; } } diff --git a/src_vs2012/VSNDK.Package/Options/SigningOptionControl.cs b/src_vs2012/VSNDK.Package/Options/SigningOptionControl.cs index 2d26e1af..2e353739 100644 --- a/src_vs2012/VSNDK.Package/Options/SigningOptionControl.cs +++ b/src_vs2012/VSNDK.Package/Options/SigningOptionControl.cs @@ -1,5 +1,7 @@ using System; +using System.IO; using System.Windows.Forms; +using RIM.VSNDK_Package.Diagnostics; using RIM.VSNDK_Package.Options.Dialogs; using RIM.VSNDK_Package.Tools; using RIM.VSNDK_Package.ViewModels; @@ -76,16 +78,107 @@ private void ReloadAuthor() // try again to reload data from certificate: Author = _vm.Developer.UpdateName(null); UpdateUI(); + VerifyAuthor(Author); + } + + private void lblMore_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) + { + DialogHelper.StartURL("http://www.blackberry.com/go/codesigning/"); + } - if (string.IsNullOrEmpty(Author)) + private static void VerifyAuthor(string author) + { + if (string.IsNullOrEmpty(author)) { MessageBoxHelper.Show("Unable to load info about author", "Invalid password or certificate file", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } - private void lblMore_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) + internal static void CopyExistingCert(DeveloperDefinition developer) { - DialogHelper.StartURL("http://www.blackberry.com/go/codesigning/"); + if (developer == null) + throw new ArgumentNullException("developer"); + if (string.IsNullOrEmpty(developer.DataPath)) + throw new ArgumentOutOfRangeException("developer"); + + // navigate for new certificate: + var form = DialogHelper.OpenCertFile(developer.DataPath); + + if (form.ShowDialog() == DialogResult.OK && File.Exists(form.FileName)) + { + // will need to move the file? - ask for confirmation, if one with the same name exists: + var srcPath = form.FileName; + var fileName = Path.GetFileName(srcPath); + var folderName = Path.GetDirectoryName(srcPath); + + if (string.IsNullOrEmpty(fileName) || string.IsNullOrEmpty(folderName)) + return; + + // copy the file: + if (string.Compare(developer.DataPath, folderName, StringComparison.InvariantCultureIgnoreCase) != 0) + { + var destPath = Path.Combine(developer.DataPath, fileName); + if (File.Exists(destPath)) + { + var result = MessageBoxHelper.Show("File \"" + fileName + "\" already exists in certificate storage folder.\r\nDo you want to overwrite it?", + null, MessageBoxButtons.YesNoCancel, MessageBoxIcon.Exclamation); + + if (result == DialogResult.Cancel) + return; + if (result == DialogResult.No) + { + // generate new name: + fileName = "author-" + DateTime.Now.ToString("yyyy-MM-dd") + ".p12"; + destPath = Path.Combine(developer.DataPath, fileName); + } + } + + try + { + File.Copy(srcPath, destPath, true); + } + catch (Exception ex) + { + TraceLog.WriteException(ex, "Unable to copy certificate file \"{0}\"", srcPath); + MessageBoxHelper.Show(ex.Message, "Certificate file error", MessageBoxButtons.OK, MessageBoxIcon.Error); + return; + } + } + + developer.UpdateCertificate(fileName); + + // ask for password several times: + while (true) + { + var passForm = new PasswordForm(); + + if (passForm.ShowDialog() == DialogResult.OK) + { + // load info from new certificate: + developer.UpdateName(passForm.Password); + + // succeeded - yes? + if (developer.HasName) + { + developer.UpdatePassword(passForm.Password, passForm.ShouldRemember); + break; + } + + // no - display error and ask again: + VerifyAuthor(developer.Name); + } + else + { + break; + } + } + } + } + + private void bttChangeCert_Click(object sender, EventArgs e) + { + CopyExistingCert(_vm.Developer); + UpdateUI(); } private void bttNavigate_Click(object sender, EventArgs e) @@ -99,10 +192,11 @@ private void bttNavigate_Click(object sender, EventArgs e) private void bttDeletePassword_Click(object sender, EventArgs e) { - if (MessageBoxHelper.Show("Are you sure to delete stored certificate password?", null, MessageBoxButtons.YesNo, MessageBoxIcon.Question) != DialogResult.Yes) + if (MessageBoxHelper.Show("Are you sure to delete stored certificate password?\r\n\r\nYou will need to type it in, whenever required.", + null, MessageBoxButtons.YesNo, MessageBoxIcon.Question) != DialogResult.Yes) return; - _vm.Developer.DeleteCskPassword(); + _vm.Developer.ClearPassword(); UpdateUI(); } @@ -190,7 +284,7 @@ private void bttRegister_Click(object sender, EventArgs e) return; } - var form = new LoginForm(null, _vm.Developer); + var form = new CskRequestForm(null); form.ShowDialog(); // this should generate BlackBerry token file /////////////////////////////// diff --git a/src_vs2012/VSNDK.Package/Options/TargetsOptionControl.Designer.cs b/src_vs2012/VSNDK.Package/Options/TargetsOptionControl.Designer.cs index 91f51e91..2bc9a729 100644 --- a/src_vs2012/VSNDK.Package/Options/TargetsOptionControl.Designer.cs +++ b/src_vs2012/VSNDK.Package/Options/TargetsOptionControl.Designer.cs @@ -95,7 +95,7 @@ private void InitializeComponent() // columnName // this.columnName.Text = "Name"; - this.columnName.Width = 150; + this.columnName.Width = 140; // // columnIP // diff --git a/src_vs2012/VSNDK.Package/VSNDK.Package.csproj b/src_vs2012/VSNDK.Package/VSNDK.Package.csproj index 6935e94a..5c60a7a9 100644 --- a/src_vs2012/VSNDK.Package/VSNDK.Package.csproj +++ b/src_vs2012/VSNDK.Package/VSNDK.Package.csproj @@ -96,6 +96,7 @@ + @@ -266,6 +267,9 @@ + + Component + UserControl @@ -289,6 +293,12 @@ AddLocalNdkForm.cs + + Form + + + CskRequestForm.cs + Form @@ -307,12 +317,6 @@ InstallNdkForm.cs - - Form - - - LoginForm.cs - Form @@ -412,6 +416,9 @@ UpdateManagerDialog.xaml + + CskRequestForm.cs + @@ -549,9 +556,6 @@ InstallNdkForm.cs - - LoginForm.cs - PasswordForm.cs diff --git a/src_vs2012/VSNDK.Package/ViewModels/DeveloperDefinition.cs b/src_vs2012/VSNDK.Package/ViewModels/DeveloperDefinition.cs index 0a27d402..5f68fe16 100644 --- a/src_vs2012/VSNDK.Package/ViewModels/DeveloperDefinition.cs +++ b/src_vs2012/VSNDK.Package/ViewModels/DeveloperDefinition.cs @@ -42,6 +42,14 @@ public string Name private set; } + /// + /// Gets the indication, if a name was loaded for this developer (publisher) from a certificate. + /// + public bool HasName + { + get { return !string.IsNullOrEmpty(Name); } + } + /// /// Gets the location, where all developer configuration files are stored. /// @@ -189,7 +197,7 @@ public bool IsPasswordSaved /// /// Removes password stored inside registry and cached in this class. /// - public void DeleteCskPassword() + public void ClearPassword() { DeletePassword(); CskPassword = null; @@ -270,6 +278,32 @@ private void DeleteCertificatePath() } } + /// + /// Updates the certificate file name and save it into the registry. + /// + public void UpdateCertificate(string fileName) + { + var folder = Path.GetDirectoryName(fileName); + + if (!string.IsNullOrEmpty(folder)) + throw new ArgumentOutOfRangeException("fileName", "Invalid name, folder is not expected inside, only file name"); + if (File.Exists(Path.Combine(DataPath, folder))) + throw new ArgumentOutOfRangeException("fileName", "File doesn't existing in designated certificate storage"); + + ClearPassword(); + CertificateFileName = fileName; + Name = null; + + if (string.Compare(fileName, DefaultCertificateName, StringComparison.InvariantCultureIgnoreCase) == 0) + { + DeleteCertificatePath(); + } + else + { + SaveCertificatePath(); + } + } + /// /// Creates new developer-definition object based on info read from registry and around. /// @@ -342,6 +376,8 @@ public static string LoadIssuer(string certificateFileName, string password) if (issuer != null && issuer.StartsWith("CN=", StringComparison.InvariantCultureIgnoreCase)) issuer = issuer.Substring(3).Trim(); + if (issuer != null && issuer.StartsWith("CommonName=", StringComparison.InvariantCultureIgnoreCase)) + issuer = issuer.Substring(11).Trim(); return issuer; } @@ -360,7 +396,7 @@ private string[] GetProfileFiles() return new[] { CertificateFileName, "bbidtoken.csk", "barsigner.db", "bbsigner.csk", "bb_id_rsa", "bb_id_rsa.pub", - // PH: TODO: but I have also files: + // PH: TODO: but I have also files: for tablets? "barsigner.csk", "bbt_id_rsa", "bbt_id_rsa.pub"}; } @@ -540,7 +576,7 @@ public void DeleteProfile() } DeleteCertificatePath(); - DeleteCskPassword(); + ClearPassword(); CertificateFileName = null; Name = null; } diff --git a/src_vs2013/VSNDK.Package/VSNDK.Package.csproj b/src_vs2013/VSNDK.Package/VSNDK.Package.csproj index 9db4fc0b..c8f0915e 100644 --- a/src_vs2013/VSNDK.Package/VSNDK.Package.csproj +++ b/src_vs2013/VSNDK.Package/VSNDK.Package.csproj @@ -93,6 +93,7 @@ + @@ -289,6 +290,10 @@ Model\Integration\DynamicMenuCommand.cs + + Model\Integration\WebBrowserTurbo.cs + Component + Model\NdkInfo.cs @@ -323,6 +328,14 @@ Options\Dialogs\AddLocalNdkForm.designer.cs AddLocalNdkForm.cs + + Options\Dialogs\CskRequestForm.cs + Form + + + Options\Dialogs\CskRequestForm.designer.cs + CskRequestForm.cs + Options\Dialogs\DebugTokenDeploymentForm.cs Form @@ -347,14 +360,6 @@ Options\Dialogs\InstallNdkForm.designer.cs InstallNdkForm.cs - - Options\Dialogs\LoginForm.cs - Form - - - Options\Dialogs\LoginForm.designer.cs - LoginForm.cs - Options\Dialogs\PasswordForm.cs Form @@ -541,6 +546,10 @@ Options\Dialogs\AddLocalNdkForm.resx AddLocalNdkForm.cs + + Options\Dialogs\CskRequestForm.resx + CskRequestForm.cs + Options\Dialogs\DebugTokenDeploymentForm.resx DebugTokenDeploymentForm.cs @@ -553,10 +562,6 @@ Options\Dialogs\InstallNdkForm.resx InstallNdkForm.cs - - Options\Dialogs\LoginForm.resx - LoginForm.cs - Options\Dialogs\PasswordForm.resx PasswordForm.cs From 7ef35ea1994000ce45e9bfecad733f31253c8a43 Mon Sep 17 00:00:00 2001 From: Pawel Hofman Date: Mon, 26 May 2014 17:17:29 +0200 Subject: [PATCH 118/851] Fixed misplaced name/password in cert generator --- .../Options/SigningOptionControl.cs | 2 +- .../VSNDK.Package/Tools/KeyToolGenRunner.cs | 22 +++++++++++++++++-- 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/src_vs2012/VSNDK.Package/Options/SigningOptionControl.cs b/src_vs2012/VSNDK.Package/Options/SigningOptionControl.cs index 2e353739..c3046821 100644 --- a/src_vs2012/VSNDK.Package/Options/SigningOptionControl.cs +++ b/src_vs2012/VSNDK.Package/Options/SigningOptionControl.cs @@ -296,7 +296,7 @@ private void bttRegister_Click(object sender, EventArgs e) if (registrationForm.ShowDialog() == DialogResult.OK) { - var runner = new KeyToolGenRunner(RunnerDefaults.ToolsDirectory, registrationForm.AuthorName, registrationForm.AuthorPassword); + var runner = new KeyToolGenRunner(RunnerDefaults.ToolsDirectory, registrationForm.AuthorName, registrationForm.AuthorPassword, null); var success = runner.Execute(); // finally, show result message: diff --git a/src_vs2012/VSNDK.Package/Tools/KeyToolGenRunner.cs b/src_vs2012/VSNDK.Package/Tools/KeyToolGenRunner.cs index b1704452..6c83c4c5 100644 --- a/src_vs2012/VSNDK.Package/Tools/KeyToolGenRunner.cs +++ b/src_vs2012/VSNDK.Package/Tools/KeyToolGenRunner.cs @@ -9,6 +9,7 @@ internal sealed class KeyToolGenRunner : ToolRunner { private string _name; private string _password; + private string _fileName; /// /// Init constructor. @@ -16,7 +17,8 @@ internal sealed class KeyToolGenRunner : ToolRunner /// Tools directory /// Name of the developer /// Password protection, required later to use the keys - public KeyToolGenRunner(string workingDirectory, string name, string password) + /// Name of the certificate, where to store specified data; if null, 'author.p12' is used + public KeyToolGenRunner(string workingDirectory, string name, string password, string fileName) : base("cmd.exe", workingDirectory) { if (string.IsNullOrEmpty(name)) @@ -26,6 +28,7 @@ public KeyToolGenRunner(string workingDirectory, string name, string password) _name = name; _password = password; + _fileName = fileName; UpdateArguments(); } @@ -63,11 +66,26 @@ public string Password } } + /// + /// Gets or sets the name of the certificate file, where to store the data. + /// + public string FileName + { + get { return _fileName; } + set + { + _fileName = value; + UpdateArguments(); + } + } + #endregion private void UpdateArguments() { - Arguments = string.Format(@"/C blackberry-keytool -genkeypair -author ""{1}"" -storepass ""{0}""", Name, Password); + Arguments = string.Format(@"/C blackberry-keytool -genkeypair{0} -author ""{1}"" -storepass ""{2}""", + string.IsNullOrEmpty(FileName) ? string.Empty : string.Concat(" -keystore \"", FileName, "\""), + Name, Password); } protected override void ConsumeResults(string output, string error) From bd38728ea7f56de5c055a5df3de7f1b2696bf2b2 Mon Sep 17 00:00:00 2001 From: Pawel Hofman Date: Mon, 26 May 2014 18:15:19 +0200 Subject: [PATCH 119/851] Fixed exception, when missing executable to run --- src_vs2012/VSNDK.Package/Tools/ToolRunner.cs | 22 +++++++++++++------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/src_vs2012/VSNDK.Package/Tools/ToolRunner.cs b/src_vs2012/VSNDK.Package/Tools/ToolRunner.cs index 83cc3f9e..4b9f9347 100644 --- a/src_vs2012/VSNDK.Package/Tools/ToolRunner.cs +++ b/src_vs2012/VSNDK.Package/Tools/ToolRunner.cs @@ -127,6 +127,7 @@ public bool Execute() throw new InvalidOperationException("No executable to start"); PrepareExecution(); + int exitCode = int.MinValue; try { @@ -136,8 +137,9 @@ public bool Execute() _process.BeginErrorReadLine(); _process.BeginOutputReadLine(); _process.WaitForExit(); + exitCode = _process.ExitCode; - return _process.ExitCode == 0; + return exitCode == 0; } catch (Exception e) { @@ -147,7 +149,10 @@ public bool Execute() } finally { - CompleteExecution(); + // release process resources: + _process.Close(); + + CompleteExecution(exitCode); } } @@ -181,8 +186,13 @@ public void ExecuteAsync() private void AsyncProcessExited(object sender, EventArgs e) { + int exitCode = _process.ExitCode; _process.Exited -= AsyncProcessExited; - CompleteExecution(); + + // release process resources: + _process.Close(); + + CompleteExecution(exitCode); } private void NotifyFinished(int exitCode, string output, string error) @@ -212,20 +222,16 @@ private void PrepareExecution() _error = new StringBuilder(); } - private void CompleteExecution() + private void CompleteExecution(int exitCode) { var outputText = _output.Length > 0 ? _output.ToString() : null; var errorText = _error.Length > 0 ? _error.ToString() : null; - var exitCode = _process.ExitCode; _output = null; _error = null; LastOutput = outputText; LastError = errorText; - // release process resources: - _process.Close(); - #if DEBUG // print received data: if (!string.IsNullOrEmpty(outputText)) From a3fee617b8e8cd0bd624ab371c2151e093376076 Mon Sep 17 00:00:00 2001 From: Pawel Hofman Date: Mon, 26 May 2014 18:18:52 +0200 Subject: [PATCH 120/851] Switched to internal tool tp load info about cert C# X509Certificate couldn't handle it on all expected platforms. That's why used blackberry-keytool to perform printouts --- src/VSNDK.Package/VSNDK.Package.csproj | 3 + .../VSNDK.Package.Test/ToolRunnerTests.cs | 14 ++ .../VSNDK.Package/Tools/KeyToolGenRunner.cs | 16 +- .../VSNDK.Package/Tools/KeyToolInfoRunner.cs | 187 ++++++++++++++++++ src_vs2012/VSNDK.Package/VSNDK.Package.csproj | 1 + .../ViewModels/DeveloperDefinition.cs | 17 +- src_vs2013/VSNDK.Package/VSNDK.Package.csproj | 3 + 7 files changed, 232 insertions(+), 9 deletions(-) create mode 100644 src_vs2012/VSNDK.Package/Tools/KeyToolInfoRunner.cs diff --git a/src/VSNDK.Package/VSNDK.Package.csproj b/src/VSNDK.Package/VSNDK.Package.csproj index 4addb9eb..a1bf9ffa 100644 --- a/src/VSNDK.Package/VSNDK.Package.csproj +++ b/src/VSNDK.Package/VSNDK.Package.csproj @@ -349,6 +349,9 @@ Tools\KeyToolGenRunner.cs + + Tools\KeyToolInfoRunner.cs + Tools\KeyToolRemoveRunner.cs diff --git a/src_vs2012/VSNDK.Package.Test/ToolRunnerTests.cs b/src_vs2012/VSNDK.Package.Test/ToolRunnerTests.cs index 29ad41b1..9dc46922 100644 --- a/src_vs2012/VSNDK.Package.Test/ToolRunnerTests.cs +++ b/src_vs2012/VSNDK.Package.Test/ToolRunnerTests.cs @@ -1,10 +1,12 @@ #if DEBUG using System; +using System.IO; using System.Threading; using NUnit.Framework; using RIM.VSNDK_Package.Model; using RIM.VSNDK_Package.Tools; +using RIM.VSNDK_Package.ViewModels; namespace VSNDK.Package.Test { @@ -174,6 +176,18 @@ public void LoadInstalledNdkInfo() Assert.IsNotNull(info); Assert.IsTrue(info.Length > 0); } + + [Test] + public void LoadInfoAboutCertificate() + { + var runner = new KeyToolInfoRunner(RunnerDefaults.TestToolsDirectory, Path.Combine(RunnerDefaults.DataDirectory, DeveloperDefinition.DefaultCertificateName), "abcdef"); + var result = runner.Execute(); + + Assert.IsTrue(result, "Unable to start the tool"); + Assert.IsNotNull(runner.LastOutput); + Assert.IsNull(runner.LastError); + Assert.IsNotNull(runner.Issuer); + } } } diff --git a/src_vs2012/VSNDK.Package/Tools/KeyToolGenRunner.cs b/src_vs2012/VSNDK.Package/Tools/KeyToolGenRunner.cs index 6c83c4c5..a9161c89 100644 --- a/src_vs2012/VSNDK.Package/Tools/KeyToolGenRunner.cs +++ b/src_vs2012/VSNDK.Package/Tools/KeyToolGenRunner.cs @@ -9,7 +9,7 @@ internal sealed class KeyToolGenRunner : ToolRunner { private string _name; private string _password; - private string _fileName; + private string _storeFileName; /// /// Init constructor. @@ -17,8 +17,8 @@ internal sealed class KeyToolGenRunner : ToolRunner /// Tools directory /// Name of the developer /// Password protection, required later to use the keys - /// Name of the certificate, where to store specified data; if null, 'author.p12' is used - public KeyToolGenRunner(string workingDirectory, string name, string password, string fileName) + /// Name of the certificate, where to store specified data; if null, 'author.p12' is used + public KeyToolGenRunner(string workingDirectory, string name, string password, string storeFileName) : base("cmd.exe", workingDirectory) { if (string.IsNullOrEmpty(name)) @@ -28,7 +28,7 @@ public KeyToolGenRunner(string workingDirectory, string name, string password, s _name = name; _password = password; - _fileName = fileName; + _storeFileName = storeFileName; UpdateArguments(); } @@ -69,12 +69,12 @@ public string Password /// /// Gets or sets the name of the certificate file, where to store the data. /// - public string FileName + public string StoreFileName { - get { return _fileName; } + get { return _storeFileName; } set { - _fileName = value; + _storeFileName = value; UpdateArguments(); } } @@ -84,7 +84,7 @@ public string FileName private void UpdateArguments() { Arguments = string.Format(@"/C blackberry-keytool -genkeypair{0} -author ""{1}"" -storepass ""{2}""", - string.IsNullOrEmpty(FileName) ? string.Empty : string.Concat(" -keystore \"", FileName, "\""), + string.IsNullOrEmpty(StoreFileName) ? string.Empty : string.Concat(" -keystore \"", StoreFileName, "\""), Name, Password); } diff --git a/src_vs2012/VSNDK.Package/Tools/KeyToolInfoRunner.cs b/src_vs2012/VSNDK.Package/Tools/KeyToolInfoRunner.cs new file mode 100644 index 00000000..9a74c1aa --- /dev/null +++ b/src_vs2012/VSNDK.Package/Tools/KeyToolInfoRunner.cs @@ -0,0 +1,187 @@ +using System; +using RIM.VSNDK_Package.Diagnostics; + +namespace RIM.VSNDK_Package.Tools +{ + /// + /// Runner, that calls specific tool to load info about developer's signing keys. + /// + internal sealed class KeyToolInfoRunner : ToolRunner + { + private string _password; + private string _storeFileName; + + /// + /// Init constructor. + /// + /// Tools directory + /// Name of the certificate file + /// Required password to decrypt info inside the certificate file + public KeyToolInfoRunner(string workingDirectory, string storeFileName, string password) + : base("cmd.exe", workingDirectory) + { + if (string.IsNullOrEmpty(storeFileName)) + throw new ArgumentNullException("storeFileName"); + if (string.IsNullOrEmpty(password)) + throw new ArgumentNullException("password"); + + _storeFileName = storeFileName; + _password = password; + UpdateArguments(); + } + + #region Properties + + /// + /// Gets or set access password, used when generating certificate. + /// + public string Password + { + get { return _password; } + set + { + if (!string.IsNullOrEmpty(value)) + { + _password = value; + UpdateArguments(); + } + } + } + + /// + /// Gets or sets the name of the certificate file, where to load info from. + /// + public string StoreFileName + { + get { return _storeFileName; } + set + { + _storeFileName = value; + UpdateArguments(); + } + } + + public string Alias + { + get; + private set; + } + + public string SubjectName + { + get; + private set; + } + + public string Issuer + { + get; + private set; + } + + public string Algorithm + { + get; + private set; + } + + public string FingerprintSHA1 + { + get; + private set; + } + + public string FingerprintMD5 + { + get; + private set; + } + + #endregion + + private void UpdateArguments() + { + Arguments = string.Format(@"/C blackberry-keytool -list -keystore ""{0}"" -storepass ""{1}"" -verbose", StoreFileName, Password); + } + + protected override void ConsumeResults(string output, string error) + { + /* +Found 1 private key +Found 1 certificate: + Alias: + author + Serial Number: + aa:bb:cc:dd + Subject Name: + CommonName=XyXyXyXyXyXy + Issuer Name: + CommonName=XyXyXyXyXyXy + Valid From: + Thu Oct 18 22:25:41 CEST 2012 + Valid To: + Wed Oct 13 22:25:41 CEST 2032 + Public Key: + ECC-SECP521R1 + Signature Algorithm: + SHA512withECDSA + SHA1 Fingerprint: + aa:bb:cc:dd:ee:ff:gg:hh:ii:jj:kk:ll:00:11:22:33:44:55:66:77 + MD5 Fingerprint: + 00:11:22:33:44:55:66:77:88:99:00:11:22:33:44:55 + */ + + if (string.IsNullOrEmpty(error) && !string.IsNullOrEmpty(output)) + { + var lines = output.Split(new[] { '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries); + + // remove white chars... + for (int i = 0; i < lines.Length; i++) + { + lines[i] = lines[i].Trim(); + } + + // do the parsing: + // - assuming that n-line has header and n+1 - data + for (int i = 0; i < lines.Length - 1; i++) + { + if (string.Compare("alias:", lines[i], StringComparison.InvariantCultureIgnoreCase) == 0) + { + Alias = lines[++i]; + continue; + } + if (string.Compare("subject name:", lines[i], StringComparison.InvariantCultureIgnoreCase) == 0) + { + SubjectName = lines[++i]; + continue; + } + if (string.Compare("issuer name:", lines[i], StringComparison.InvariantCultureIgnoreCase) == 0) + { + Issuer = lines[++i]; + continue; + } + if (string.Compare("signature algorithm:", lines[i], StringComparison.InvariantCultureIgnoreCase) == 0) + { + Algorithm = lines[++i]; + continue; + } + + if (string.Compare("md5 fingerprint:", lines[i], StringComparison.InvariantCultureIgnoreCase) == 0) + { + FingerprintMD5 = lines[++i]; + continue; + } + if (string.Compare("sha1 fingerprint:", lines[i], StringComparison.InvariantCultureIgnoreCase) == 0) + { + FingerprintSHA1 = lines[++i]; + continue; + } + } + } + + TraceLog.WriteLine("For certificate: {0}", StoreFileName); + TraceLog.WriteLine(" * issuer: {0}", Issuer ?? "- none -"); + TraceLog.WriteLine(" * algorithm: {0}", Algorithm ?? "- none -"); + } + } +} diff --git a/src_vs2012/VSNDK.Package/VSNDK.Package.csproj b/src_vs2012/VSNDK.Package/VSNDK.Package.csproj index 5c60a7a9..34378bde 100644 --- a/src_vs2012/VSNDK.Package/VSNDK.Package.csproj +++ b/src_vs2012/VSNDK.Package/VSNDK.Package.csproj @@ -373,6 +373,7 @@ + diff --git a/src_vs2012/VSNDK.Package/ViewModels/DeveloperDefinition.cs b/src_vs2012/VSNDK.Package/ViewModels/DeveloperDefinition.cs index 5f68fe16..0eae14e0 100644 --- a/src_vs2012/VSNDK.Package/ViewModels/DeveloperDefinition.cs +++ b/src_vs2012/VSNDK.Package/ViewModels/DeveloperDefinition.cs @@ -13,7 +13,10 @@ namespace RIM.VSNDK_Package.ViewModels /// internal sealed class DeveloperDefinition { - private const string DefaultCertificateName = "author.p12"; + /// + /// Default name of the certificate file. + /// + internal const string DefaultCertificateName = "author.p12"; private const string DefaultCskName = "bbidtoken.csk"; private const string FieldCertificateFileName = "certificate"; private const string FieldCskPassword = "CSKPass"; @@ -371,8 +374,20 @@ public static string LoadIssuer(string certificateFileName, string password) if (!File.Exists(certificateFileName) || string.IsNullOrEmpty(password)) return null; + /* PH: OK - this did work, but not for WinXP, as this one doesn't support SHA512withECDSA algorithm... var cert = new X509Certificate(certificateFileName, password); var issuer = cert.Issuer; + */ + string issuer; + using (var runner = new KeyToolInfoRunner(RunnerDefaults.ToolsDirectory, certificateFileName, password)) + { + // invoke + if (!runner.Execute()) + return null; + + // grab results: + issuer = runner.Issuer; + } if (issuer != null && issuer.StartsWith("CN=", StringComparison.InvariantCultureIgnoreCase)) issuer = issuer.Substring(3).Trim(); diff --git a/src_vs2013/VSNDK.Package/VSNDK.Package.csproj b/src_vs2013/VSNDK.Package/VSNDK.Package.csproj index c8f0915e..b376f833 100644 --- a/src_vs2013/VSNDK.Package/VSNDK.Package.csproj +++ b/src_vs2013/VSNDK.Package/VSNDK.Package.csproj @@ -456,6 +456,9 @@ Tools\KeyToolGenRunner.cs + + Tools\KeyToolInfoRunner.cs + Tools\KeyToolRemoveRunner.cs From 3020ad2208f0df9e46e69f6be304a60ded47cb38 Mon Sep 17 00:00:00 2001 From: Pawel Hofman Date: Mon, 26 May 2014 22:48:50 +0200 Subject: [PATCH 121/851] Fixed broken PATH That's a candidate for a Bug of the Project award --- src/VSNDK.Package/VSNDK.PackagePackage.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/VSNDK.Package/VSNDK.PackagePackage.cs b/src/VSNDK.Package/VSNDK.PackagePackage.cs index 6bc54b1f..9b80bb6f 100644 --- a/src/VSNDK.Package/VSNDK.PackagePackage.cs +++ b/src/VSNDK.Package/VSNDK.PackagePackage.cs @@ -1234,7 +1234,7 @@ private void SetNDKPath() System.Environment.SetEnvironmentVariable("QNX_TARGET", qnx_target); System.Environment.SetEnvironmentVariable("QNX_HOST", qnx_host); - string ndkpath = string.Format(@"{0}/usr/bin;{1}", qnx_host, qnx_config) + + string ndkpath = string.Format(@"{0}/usr/bin;{1};", qnx_host, qnx_config) + System.Environment.GetEnvironmentVariable("PATH"); System.Environment.SetEnvironmentVariable("PATH", ndkpath); From 98381ac691e56a5de123fd858ceb284f954ab15f Mon Sep 17 00:00:00 2001 From: Pawel Hofman Date: Tue, 27 May 2014 00:17:02 +0200 Subject: [PATCH 122/851] Added a way to 'setup' runned tools Required to pass to them custom PATH and other QNX-required variables. Also fixed some other smaller issues. --- src/VSNDK.Package/VSNDK.Package.csproj | 3 ++ src/VSNDK.Package/VSNDK.PackagePackage.cs | 26 +++++++-- .../Tools/DebugTokenCreateRunner.cs | 2 +- .../Tools/DebugTokenInfoRunner.cs | 2 +- .../Tools/DebugTokenUploadRunner.cs | 2 +- .../VSNDK.Package/Tools/KeyToolGenRunner.cs | 2 +- .../VSNDK.Package/Tools/KeyToolInfoRunner.cs | 2 +- .../VSNDK.Package/Tools/RunnerDefaults.cs | 5 ++ src_vs2012/VSNDK.Package/Tools/ToolRunner.cs | 32 +++++++++-- .../Tools/ToolRunnerStartupEventArgs.cs | 54 +++++++++++++++++++ src_vs2012/VSNDK.Package/VSNDK.Package.csproj | 1 + .../ViewModels/DeveloperDefinition.cs | 24 ++++++--- src_vs2013/VSNDK.Package/VSNDK.Package.csproj | 3 ++ 13 files changed, 138 insertions(+), 20 deletions(-) create mode 100644 src_vs2012/VSNDK.Package/Tools/ToolRunnerStartupEventArgs.cs diff --git a/src/VSNDK.Package/VSNDK.Package.csproj b/src/VSNDK.Package/VSNDK.Package.csproj index a1bf9ffa..27745162 100644 --- a/src/VSNDK.Package/VSNDK.Package.csproj +++ b/src/VSNDK.Package/VSNDK.Package.csproj @@ -364,6 +364,9 @@ Tools\ToolRunnerEventArgs.cs + + Tools\ToolRunnerStartupEventArgs.cs + ViewModels\ApiLevelOptionViewModel.cs diff --git a/src/VSNDK.Package/VSNDK.PackagePackage.cs b/src/VSNDK.Package/VSNDK.PackagePackage.cs index 9b80bb6f..057ec0cb 100644 --- a/src/VSNDK.Package/VSNDK.PackagePackage.cs +++ b/src/VSNDK.Package/VSNDK.PackagePackage.cs @@ -37,6 +37,7 @@ using RIM.VSNDK_Package.Model.Integration; using RIM.VSNDK_Package.Options; using RIM.VSNDK_Package.Options.Dialogs; +using RIM.VSNDK_Package.Tools; using RIM.VSNDK_Package.UpdateManager.Model; using RIM.VSNDK_Package.ViewModels; using VSNDK.Parser; @@ -973,13 +974,27 @@ protected override void Initialize() TraceLog.Add(_traceWindow); TraceLog.WriteLine("BlackBerry plugin started"); - - var options = GetDialogPage(typeof(GeneralOptionPage)) as GeneralOptionPage; - var path = options.NdkPath; - InstalledAPIListSingleton apiList = InstalledAPIListSingleton.Instance; TraceLog.WriteLine(" * loaded NDK descriptions"); + // setup called before running any 'tool': + ToolRunner.Startup += (s, e) => + { + var ndk = PackageViewModel.Instance.ActiveNDK; + + if (ndk != null) + { + e["QNX_TARGET"] = ndk.TargetPath; + e["QNX_HOST"] = ndk.HostPath; + e["PATH"] = string.Concat(Path.Combine(ndk.HostPath, "usr", "bin"), ";", + Path.Combine(RunnerDefaults.JavaHome, "bin"), ";", e["PATH"]); + } + else + { + e["PATH"] = string.Concat(Path.Combine(RunnerDefaults.JavaHome, "bin"), ";", e["PATH"]); + } + }; + //Create Editor Factory. Note that the base Package class will call Dispose on it. RegisterEditorFactory(new EditorFactory(this)); TraceLog.WriteLine(" * registered editors"); @@ -1229,6 +1244,7 @@ private void SetNDKPath() } } + /* PH: TODO: remove following code as it affects Visual Studio and all tools running by it */ string qnx_config = GlobalFunctions.bbndkPathConst + @"\features\com.qnx.tools.jre.win32_1.6.0.43\jre\bin"; System.Environment.SetEnvironmentVariable("QNX_TARGET", qnx_target); @@ -1237,7 +1253,7 @@ private void SetNDKPath() string ndkpath = string.Format(@"{0}/usr/bin;{1};", qnx_host, qnx_config) + System.Environment.GetEnvironmentVariable("PATH"); System.Environment.SetEnvironmentVariable("PATH", ndkpath); - + /* */ } catch (Exception ex) diff --git a/src_vs2012/VSNDK.Package/Tools/DebugTokenCreateRunner.cs b/src_vs2012/VSNDK.Package/Tools/DebugTokenCreateRunner.cs index 27cc23d5..1b9a25ce 100644 --- a/src_vs2012/VSNDK.Package/Tools/DebugTokenCreateRunner.cs +++ b/src_vs2012/VSNDK.Package/Tools/DebugTokenCreateRunner.cs @@ -112,7 +112,7 @@ private void UpdateArguments() } // path to the output .bar file: - args.Append(" \"").Append(Environment.ExpandEnvironmentVariables(DebugTokenLocation)).Append("\""); + args.Append(" \"").Append(System.Environment.ExpandEnvironmentVariables(DebugTokenLocation)).Append("\""); Arguments = args.ToString(); } diff --git a/src_vs2012/VSNDK.Package/Tools/DebugTokenInfoRunner.cs b/src_vs2012/VSNDK.Package/Tools/DebugTokenInfoRunner.cs index 5bc1a227..d09ea6c1 100644 --- a/src_vs2012/VSNDK.Package/Tools/DebugTokenInfoRunner.cs +++ b/src_vs2012/VSNDK.Package/Tools/DebugTokenInfoRunner.cs @@ -46,7 +46,7 @@ public string DebugTokenLocation if (!string.IsNullOrEmpty(value)) { _location = value; - Arguments = string.Format(@"/C blackberry-airpackager.bat -listManifest ""{0}""", Environment.ExpandEnvironmentVariables(value)); + Arguments = string.Format(@"/C blackberry-airpackager.bat -listManifest ""{0}""", System.Environment.ExpandEnvironmentVariables(value)); } } } diff --git a/src_vs2012/VSNDK.Package/Tools/DebugTokenUploadRunner.cs b/src_vs2012/VSNDK.Package/Tools/DebugTokenUploadRunner.cs index 57b8147a..1541a6e1 100644 --- a/src_vs2012/VSNDK.Package/Tools/DebugTokenUploadRunner.cs +++ b/src_vs2012/VSNDK.Package/Tools/DebugTokenUploadRunner.cs @@ -98,7 +98,7 @@ public bool UploadedSuccessfully private void UpdateArguments() { Arguments = string.Format(@"/C blackberry-deploy.bat -installDebugToken ""{0}"" -device ""{1}"" -password ""{2}""", - Environment.ExpandEnvironmentVariables(DebugTokenLocation), IP, Password); + System.Environment.ExpandEnvironmentVariables(DebugTokenLocation), IP, Password); } protected override void ConsumeResults(string output, string error) diff --git a/src_vs2012/VSNDK.Package/Tools/KeyToolGenRunner.cs b/src_vs2012/VSNDK.Package/Tools/KeyToolGenRunner.cs index a9161c89..eed35ce1 100644 --- a/src_vs2012/VSNDK.Package/Tools/KeyToolGenRunner.cs +++ b/src_vs2012/VSNDK.Package/Tools/KeyToolGenRunner.cs @@ -84,7 +84,7 @@ public string StoreFileName private void UpdateArguments() { Arguments = string.Format(@"/C blackberry-keytool -genkeypair{0} -author ""{1}"" -storepass ""{2}""", - string.IsNullOrEmpty(StoreFileName) ? string.Empty : string.Concat(" -keystore \"", StoreFileName, "\""), + string.IsNullOrEmpty(StoreFileName) ? string.Empty : string.Concat(" -keystore \"", System.Environment.ExpandEnvironmentVariables(StoreFileName), "\""), Name, Password); } diff --git a/src_vs2012/VSNDK.Package/Tools/KeyToolInfoRunner.cs b/src_vs2012/VSNDK.Package/Tools/KeyToolInfoRunner.cs index 9a74c1aa..2cbd9bff 100644 --- a/src_vs2012/VSNDK.Package/Tools/KeyToolInfoRunner.cs +++ b/src_vs2012/VSNDK.Package/Tools/KeyToolInfoRunner.cs @@ -101,7 +101,7 @@ public string FingerprintMD5 private void UpdateArguments() { - Arguments = string.Format(@"/C blackberry-keytool -list -keystore ""{0}"" -storepass ""{1}"" -verbose", StoreFileName, Password); + Arguments = string.Format(@"/C blackberry-keytool -list -keystore ""{0}"" -storepass ""{1}"" -verbose", System.Environment.ExpandEnvironmentVariables(StoreFileName), Password); } protected override void ConsumeResults(string output, string error) diff --git a/src_vs2012/VSNDK.Package/Tools/RunnerDefaults.cs b/src_vs2012/VSNDK.Package/Tools/RunnerDefaults.cs index 029776c5..9e9d949e 100644 --- a/src_vs2012/VSNDK.Package/Tools/RunnerDefaults.cs +++ b/src_vs2012/VSNDK.Package/Tools/RunnerDefaults.cs @@ -14,6 +14,9 @@ internal static class RunnerDefaults public static readonly string InstallationConfigDirectory; public static readonly string SupplementaryInstallationConfigDirectory; public static readonly string SupplementaryPlayBookInstallationConfigDirectory; + + public static readonly string JavaHome; + /// /// Plugin-owned installation cache config directory. /// @@ -28,6 +31,8 @@ static RunnerDefaults() ToolsDirectory = Path.Combine(programFilesX86, "BlackBerry", "VSPlugin-NDK", "qnxtools", "bin"); NdkDirectory = Path.Combine(Path.GetPathRoot(Environment.GetFolderPath(Environment.SpecialFolder.System)), "bbndk_vs"); + JavaHome = Path.Combine(NdkDirectory, "features", "com.qnx.tools.jre.win32_1.6.0.43", "jre"); + // the base data folder is different for each platform... if (IsWindowsXP) { diff --git a/src_vs2012/VSNDK.Package/Tools/ToolRunner.cs b/src_vs2012/VSNDK.Package/Tools/ToolRunner.cs index 4b9f9347..d8b62531 100644 --- a/src_vs2012/VSNDK.Package/Tools/ToolRunner.cs +++ b/src_vs2012/VSNDK.Package/Tools/ToolRunner.cs @@ -1,4 +1,5 @@ using System; +using System.Collections.Specialized; using System.Diagnostics; using System.Text; using RIM.VSNDK_Package.Diagnostics; @@ -15,6 +16,7 @@ internal class ToolRunner : IDisposable private StringBuilder _error; private bool _isProcessing; + public static event EventHandler Startup; public event EventHandler Finished; /// @@ -70,6 +72,11 @@ public string WorkingDirectory set { _process.StartInfo.WorkingDirectory = value; } } + public StringDictionary Environment + { + get { return _process.StartInfo.EnvironmentVariables; } + } + public string Arguments { get { return _process.StartInfo.Arguments; } @@ -141,10 +148,9 @@ public bool Execute() return exitCode == 0; } - catch (Exception e) + catch (Exception ex) { - Debug.WriteLine(_process.StartInfo.Arguments); - Debug.WriteLine(e.Message); + TraceLog.WriteException(ex, "Unable to start {0}", GetType().Name); return false; } finally @@ -220,6 +226,9 @@ private void PrepareExecution() LastError = null; _output = new StringBuilder(); _error = new StringBuilder(); + + // allow setup customization by sub-classes: + PrepareStartup(); } private void CompleteExecution(int exitCode) @@ -233,12 +242,18 @@ private void CompleteExecution(int exitCode) LastError = errorText; #if DEBUG + TraceLog.WriteLine("{0} {1}", _process.StartInfo.FileName, _process.StartInfo.Arguments); + TraceLog.WriteLine(" * PATH: {0}", _process.StartInfo.EnvironmentVariables["PATH"]); + TraceLog.WriteLine(" * QNX_TARGET: {0}", _process.StartInfo.EnvironmentVariables["QNX_TARGET"]); + TraceLog.WriteLine(" * QNX_HOST: {0}", _process.StartInfo.EnvironmentVariables["QNX_HOST"]); + // print received data: if (!string.IsNullOrEmpty(outputText)) TraceLog.WriteLine(outputText.Trim()); if (!string.IsNullOrEmpty(errorText)) TraceLog.WarnLine(errorText.Trim()); #endif + // consume received data: ConsumeResults(outputText, errorText); @@ -248,6 +263,17 @@ private void CompleteExecution(int exitCode) _isProcessing = false; } + /// + /// Method executed before starting the tool, to setup the state of the current runner. + /// + protected virtual void PrepareStartup() + { + // this is the place to override and DISABLE running GLOBAL setup: + var handler = Startup; + if (handler != null) + handler(this, new ToolRunnerStartupEventArgs(this)); + } + protected virtual void ConsumeResults(string output, string error) { // do nothing, subclasses should handle parsing output diff --git a/src_vs2012/VSNDK.Package/Tools/ToolRunnerStartupEventArgs.cs b/src_vs2012/VSNDK.Package/Tools/ToolRunnerStartupEventArgs.cs new file mode 100644 index 00000000..3420452f --- /dev/null +++ b/src_vs2012/VSNDK.Package/Tools/ToolRunnerStartupEventArgs.cs @@ -0,0 +1,54 @@ +using System; +using System.Collections.Specialized; + +namespace RIM.VSNDK_Package.Tools +{ + /// + /// Arguments passed along with Startup event of the ToolRunner class. + /// + internal sealed class ToolRunnerStartupEventArgs : EventArgs + { + private readonly ToolRunner _runner; + + /// + /// Init constructor. + /// + public ToolRunnerStartupEventArgs(ToolRunner runner) + { + if (runner == null) + throw new ArgumentNullException("runner"); + + _runner = runner; + } + + #region Properties + + /// + /// Gets or set the working directory of the runner. + /// + public string WorkingDirectory + { + get { return _runner.WorkingDirectory; } + set { _runner.WorkingDirectory = value; } + } + + /// + /// Gets the reference to environment variables. + /// + public StringDictionary Environment + { + get { return _runner.Environment; } + } + + #endregion + + /// + /// Indexer to access and update environment variables. + /// + public string this[string key] + { + get { return _runner.Environment[key]; } + set { _runner.Environment[key] = value; } + } + } +} diff --git a/src_vs2012/VSNDK.Package/VSNDK.Package.csproj b/src_vs2012/VSNDK.Package/VSNDK.Package.csproj index 34378bde..ee211619 100644 --- a/src_vs2012/VSNDK.Package/VSNDK.Package.csproj +++ b/src_vs2012/VSNDK.Package/VSNDK.Package.csproj @@ -375,6 +375,7 @@ + diff --git a/src_vs2012/VSNDK.Package/ViewModels/DeveloperDefinition.cs b/src_vs2012/VSNDK.Package/ViewModels/DeveloperDefinition.cs index 0eae14e0..7f0902cc 100644 --- a/src_vs2012/VSNDK.Package/ViewModels/DeveloperDefinition.cs +++ b/src_vs2012/VSNDK.Package/ViewModels/DeveloperDefinition.cs @@ -1,7 +1,6 @@ using System; using System.IO; using System.IO.Packaging; -using System.Security.Cryptography.X509Certificates; using Microsoft.Win32; using RIM.VSNDK_Package.Diagnostics; using RIM.VSNDK_Package.Tools; @@ -21,6 +20,8 @@ internal sealed class DeveloperDefinition private const string FieldCertificateFileName = "certificate"; private const string FieldCskPassword = "CSKPass"; + private string _name; + public DeveloperDefinition(string dataPath, string certificatePath, string cskPassword) { if (string.IsNullOrEmpty(dataPath)) @@ -29,9 +30,6 @@ public DeveloperDefinition(string dataPath, string certificatePath, string cskPa DataPath = dataPath; CertificateFileName = certificatePath; CskPassword = cskPassword; - - // get the author directly from certificate: - Name = LoadIssuer(CertificateFullPath, CskPassword); } #region Properties @@ -41,8 +39,17 @@ public DeveloperDefinition(string dataPath, string certificatePath, string cskPa /// public string Name { - get; - private set; + get + { + if (string.IsNullOrEmpty(_name) && HasPassword) + { + // get the author from certificate: + _name = LoadIssuer(CertificateFullPath, CskPassword); + } + + return _name; + } + private set { _name = value; } } /// @@ -290,7 +297,7 @@ public void UpdateCertificate(string fileName) if (!string.IsNullOrEmpty(folder)) throw new ArgumentOutOfRangeException("fileName", "Invalid name, folder is not expected inside, only file name"); - if (File.Exists(Path.Combine(DataPath, folder))) + if (File.Exists(Path.Combine(DataPath, fileName))) throw new ArgumentOutOfRangeException("fileName", "File doesn't existing in designated certificate storage"); ClearPassword(); @@ -564,6 +571,9 @@ public static string ExtractFile(PackagePart part, string folder) /// public void SaveBlackBerryToken(string content) { + if (string.IsNullOrEmpty(content)) + throw new ArgumentNullException("content"); + var fileName = BlackBerryTokenFullPath; if (File.Exists(fileName)) diff --git a/src_vs2013/VSNDK.Package/VSNDK.Package.csproj b/src_vs2013/VSNDK.Package/VSNDK.Package.csproj index b376f833..bb2bd66b 100644 --- a/src_vs2013/VSNDK.Package/VSNDK.Package.csproj +++ b/src_vs2013/VSNDK.Package/VSNDK.Package.csproj @@ -471,6 +471,9 @@ Tools\ToolRunnerEventArgs.cs + + Tools\ToolRunnerStartupEventArgs.cs + ViewModels\ApiLevelOptionViewModel.cs From 8f9f813ef64964fd0cd82f4cedced4f504628635 Mon Sep 17 00:00:00 2001 From: Pawel Hofman Date: Tue, 27 May 2014 01:56:42 +0200 Subject: [PATCH 123/851] Improved cleaning when disposed ToolRunner --- src_vs2012/VSNDK.Package/Tools/ToolRunner.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src_vs2012/VSNDK.Package/Tools/ToolRunner.cs b/src_vs2012/VSNDK.Package/Tools/ToolRunner.cs index d8b62531..30077ce8 100644 --- a/src_vs2012/VSNDK.Package/Tools/ToolRunner.cs +++ b/src_vs2012/VSNDK.Package/Tools/ToolRunner.cs @@ -314,9 +314,14 @@ protected virtual void Dispose(bool disposing) { if (_process != null) { + _process.OutputDataReceived -= OutputDataReceived; + _process.ErrorDataReceived -= ErrorDataReceived; + _process.Dispose(); _process = null; } + + Finished = null; } } From 3b9674819eb0af936cab887b2841a4653ebadf32 Mon Sep 17 00:00:00 2001 From: Pawel Hofman Date: Tue, 27 May 2014 01:57:18 +0200 Subject: [PATCH 124/851] Changed detection, when developer did registered --- src_vs2012/VSNDK.Package/ViewModels/DeveloperDefinition.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src_vs2012/VSNDK.Package/ViewModels/DeveloperDefinition.cs b/src_vs2012/VSNDK.Package/ViewModels/DeveloperDefinition.cs index 7f0902cc..971ff8f9 100644 --- a/src_vs2012/VSNDK.Package/ViewModels/DeveloperDefinition.cs +++ b/src_vs2012/VSNDK.Package/ViewModels/DeveloperDefinition.cs @@ -116,7 +116,7 @@ public bool HasPassword /// public bool IsRegistered { - get { return !string.IsNullOrEmpty(CertificateFileName) && File.Exists(CertificateFullPath); } + get { return !string.IsNullOrEmpty(CertificateFileName) && File.Exists(CertificateFullPath) && File.Exists(BlackBerryTokenFullPath); } } /// From 28708167aca2d1dcfe1c4349ba8e8eada618602b Mon Sep 17 00:00:00 2001 From: Pawel Hofman Date: Tue, 27 May 2014 01:58:02 +0200 Subject: [PATCH 125/851] Added keystore-path param to debug-token creation tool-runner --- .../VSNDK.Package.Test/ToolRunnerTests.cs | 2 +- .../Dialogs/DebugTokenDeploymentForm.cs | 2 +- .../Tools/DebugTokenCreateRunner.cs | 27 ++++++++++++++++--- 3 files changed, 26 insertions(+), 5 deletions(-) diff --git a/src_vs2012/VSNDK.Package.Test/ToolRunnerTests.cs b/src_vs2012/VSNDK.Package.Test/ToolRunnerTests.cs index 9dc46922..3516b434 100644 --- a/src_vs2012/VSNDK.Package.Test/ToolRunnerTests.cs +++ b/src_vs2012/VSNDK.Package.Test/ToolRunnerTests.cs @@ -112,7 +112,7 @@ public void RemoveDebugTokenInfo() public void CreateDebugTokenInfo() { string debugToken = RunnerDefaults.DataFileName("debugtoken-new.bar"); - var runner = new DebugTokenCreateRunner(RunnerDefaults.TestToolsDirectory, debugToken, "test", new[] { 0x1ul, 0x2ul }); + var runner = new DebugTokenCreateRunner(RunnerDefaults.TestToolsDirectory, debugToken, "test", new[] { 0x1ul, 0x2ul }, null); var result = runner.Execute(); Assert.IsTrue(result, "Unable to start the tool"); diff --git a/src_vs2012/VSNDK.Package/Options/Dialogs/DebugTokenDeploymentForm.cs b/src_vs2012/VSNDK.Package/Options/Dialogs/DebugTokenDeploymentForm.cs index f59078cd..6bdaf3a0 100644 --- a/src_vs2012/VSNDK.Package/Options/Dialogs/DebugTokenDeploymentForm.cs +++ b/src_vs2012/VSNDK.Package/Options/Dialogs/DebugTokenDeploymentForm.cs @@ -496,7 +496,7 @@ private void CreateDebugToken(string fileName, ulong[] devicePins) UpdateTokenStatusUI(false); // and create token asynchronously: - _tokenCreateRunner = new DebugTokenCreateRunner(RunnerDefaults.ToolsDirectory, fileName, _vm.Developer.CskPassword, devicePins); + _tokenCreateRunner = new DebugTokenCreateRunner(RunnerDefaults.ToolsDirectory, fileName, _vm.Developer.CskPassword, devicePins, _vm.Developer.CertificateFullPath); _tokenCreateRunner.Dispatcher = EventDispatcher.From(this); _tokenCreateRunner.Finished += TokenCreateRunnerOnFinished; _tokenCreateRunner.ExecuteAsync(); diff --git a/src_vs2012/VSNDK.Package/Tools/DebugTokenCreateRunner.cs b/src_vs2012/VSNDK.Package/Tools/DebugTokenCreateRunner.cs index 1b9a25ce..45e5f48a 100644 --- a/src_vs2012/VSNDK.Package/Tools/DebugTokenCreateRunner.cs +++ b/src_vs2012/VSNDK.Package/Tools/DebugTokenCreateRunner.cs @@ -12,6 +12,7 @@ internal sealed class DebugTokenCreateRunner : ToolRunner private string _location; private string _password; private ulong[] _devices; + private string _storeFileName; /// /// Init constructor. @@ -20,7 +21,8 @@ internal sealed class DebugTokenCreateRunner : ToolRunner /// File name and directory of the debug-token bar file /// Password to the local certificate, specified when registering with the BlackBerry Signing Authority /// List of device PINs - public DebugTokenCreateRunner(string workingDirectory, string debugTokenLocation, string password, ulong[] devices) + /// Name of the certificate, where to developer data is stored; if null, 'author.p12' is used + public DebugTokenCreateRunner(string workingDirectory, string debugTokenLocation, string password, ulong[] devices, string storeFileName) : base("cmd.exe", workingDirectory) { if (string.IsNullOrEmpty(debugTokenLocation)) @@ -33,6 +35,7 @@ public DebugTokenCreateRunner(string workingDirectory, string debugTokenLocation _location = debugTokenLocation; _password = password; _devices = devices; + _storeFileName = storeFileName; UpdateArguments(); } @@ -87,6 +90,19 @@ public string Password } } + /// + /// Gets or sets the name of the certificate file, where developer (publisher) data is stored. + /// + public string StoreFileName + { + get { return _storeFileName; } + set + { + _storeFileName = value; + UpdateArguments(); + } + } + /// /// Gets and indication, if the debug-token was created successfully. /// @@ -105,14 +121,19 @@ private void UpdateArguments() // password: args.Append("-storepass \"").Append(Password).Append("\" "); + // keystore: + if (!string.IsNullOrEmpty(StoreFileName)) + args.Append("-keystore \"").Append(System.Environment.ExpandEnvironmentVariables(StoreFileName)).Append("\" "); + + // list of devices: foreach (var device in Devices) { - args.Append(" -devicepin \"").Append(device.ToString("X")).Append('"'); + args.Append("-devicepin \"").Append(device.ToString("X")).Append("\" "); } // path to the output .bar file: - args.Append(" \"").Append(System.Environment.ExpandEnvironmentVariables(DebugTokenLocation)).Append("\""); + args.Append('"').Append(System.Environment.ExpandEnvironmentVariables(DebugTokenLocation)).Append('"'); Arguments = args.ToString(); } From 2b07c66230bc461533289057829f0cb2e35b047c Mon Sep 17 00:00:00 2001 From: Pawel Hofman Date: Tue, 27 May 2014 02:45:53 +0200 Subject: [PATCH 126/851] Draft version of new 'registration' UI --- .../Dialogs/RegistrationForm.Designer.cs | 275 ++++++++++++++---- .../Options/Dialogs/RegistrationForm.resx | 3 + .../Options/SigningOptionControl.Designer.cs | 8 +- .../Options/SigningOptionControl.cs | 46 ++- 4 files changed, 242 insertions(+), 90 deletions(-) diff --git a/src_vs2012/VSNDK.Package/Options/Dialogs/RegistrationForm.Designer.cs b/src_vs2012/VSNDK.Package/Options/Dialogs/RegistrationForm.Designer.cs index 58d31f5c..eb84eb6f 100644 --- a/src_vs2012/VSNDK.Package/Options/Dialogs/RegistrationForm.Designer.cs +++ b/src_vs2012/VSNDK.Package/Options/Dialogs/RegistrationForm.Designer.cs @@ -28,99 +28,240 @@ protected override void Dispose(bool disposing) /// private void InitializeComponent() { + System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(RegistrationForm)); this.groupBox1 = new System.Windows.Forms.GroupBox(); - this.bttCancel = new System.Windows.Forms.Button(); + this.txtPassword = new System.Windows.Forms.TextBox(); + this.label3 = new System.Windows.Forms.Label(); + this.txtName = new System.Windows.Forms.TextBox(); + this.label2 = new System.Windows.Forms.Label(); this.bttOK = new System.Windows.Forms.Button(); + this.label4 = new System.Windows.Forms.Label(); this.label1 = new System.Windows.Forms.Label(); - this.label2 = new System.Windows.Forms.Label(); - this.txtName = new System.Windows.Forms.TextBox(); - this.label3 = new System.Windows.Forms.Label(); - this.txtPassword = new System.Windows.Forms.TextBox(); + this.txtConfirmPassword = new System.Windows.Forms.TextBox(); + this.label5 = new System.Windows.Forms.Label(); + this.bttCreateToken = new System.Windows.Forms.Button(); + this.bttCreateCertificate = new System.Windows.Forms.Button(); + this.groupBox2 = new System.Windows.Forms.GroupBox(); + this.txtLog = new System.Windows.Forms.TextBox(); + this.label6 = new System.Windows.Forms.Label(); + this.cmbCertificate = new System.Windows.Forms.ComboBox(); + this.txtCertName = new System.Windows.Forms.TextBox(); + this.bttSelectCert = new System.Windows.Forms.Button(); + this.bttRefreshCert = new System.Windows.Forms.Button(); + this.bttCancel = new System.Windows.Forms.Button(); this.groupBox1.SuspendLayout(); + this.groupBox2.SuspendLayout(); this.SuspendLayout(); // // groupBox1 // - this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left) + this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); - this.groupBox1.Controls.Add(this.txtPassword); - this.groupBox1.Controls.Add(this.label3); - this.groupBox1.Controls.Add(this.txtName); - this.groupBox1.Controls.Add(this.label2); this.groupBox1.Controls.Add(this.label1); + this.groupBox1.Controls.Add(this.label4); this.groupBox1.Location = new System.Drawing.Point(12, 12); this.groupBox1.Name = "groupBox1"; - this.groupBox1.Size = new System.Drawing.Size(324, 121); + this.groupBox1.Size = new System.Drawing.Size(537, 121); this.groupBox1.TabIndex = 0; this.groupBox1.TabStop = false; this.groupBox1.Text = "Info"; // - // bttCancel + // txtPassword // - this.bttCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this.bttCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel; - this.bttCancel.Location = new System.Drawing.Point(261, 139); - this.bttCancel.Name = "bttCancel"; - this.bttCancel.Size = new System.Drawing.Size(75, 23); - this.bttCancel.TabIndex = 2; - this.bttCancel.Text = "&Cancel"; - this.bttCancel.UseVisualStyleBackColor = true; + this.txtPassword.Location = new System.Drawing.Point(122, 50); + this.txtPassword.Name = "txtPassword"; + this.txtPassword.PasswordChar = '*'; + this.txtPassword.Size = new System.Drawing.Size(113, 20); + this.txtPassword.TabIndex = 3; + // + // label3 + // + this.label3.AutoSize = true; + this.label3.Location = new System.Drawing.Point(12, 53); + this.label3.Name = "label3"; + this.label3.Size = new System.Drawing.Size(56, 13); + this.label3.TabIndex = 2; + this.label3.Text = "Password:"; + // + // txtName + // + this.txtName.Location = new System.Drawing.Point(122, 24); + this.txtName.Name = "txtName"; + this.txtName.Size = new System.Drawing.Size(184, 20); + this.txtName.TabIndex = 1; + // + // label2 + // + this.label2.AutoSize = true; + this.label2.Location = new System.Drawing.Point(12, 27); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(70, 13); + this.label2.TabIndex = 0; + this.label2.Text = "Author name:"; // // bttOK // this.bttOK.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this.bttOK.Location = new System.Drawing.Point(180, 139); + this.bttOK.Location = new System.Drawing.Point(393, 458); this.bttOK.Name = "bttOK"; this.bttOK.Size = new System.Drawing.Size(75, 23); - this.bttOK.TabIndex = 1; + this.bttOK.TabIndex = 3; this.bttOK.Text = "&OK"; this.bttOK.UseVisualStyleBackColor = true; this.bttOK.Click += new System.EventHandler(this.bttOK_Click); // + // label4 + // + this.label4.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.label4.Location = new System.Drawing.Point(12, 25); + this.label4.Name = "label4"; + this.label4.Size = new System.Drawing.Size(519, 47); + this.label4.TabIndex = 0; + this.label4.Text = resources.GetString("label4.Text"); + // // label1 // this.label1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); - this.label1.Location = new System.Drawing.Point(6, 26); + this.label1.Location = new System.Drawing.Point(12, 82); this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(312, 38); - this.label1.TabIndex = 0; - this.label1.Text = "Please, enter the Author Name and Password that you specified when requested the " + - "BlackBerry ID token."; + this.label1.Size = new System.Drawing.Size(519, 23); + this.label1.TabIndex = 1; + this.label1.Text = "To complete the registration both - BlackBerry ID token and developer certificate" + + " - are required."; // - // label2 + // txtConfirmPassword // - this.label2.AutoSize = true; - this.label2.Location = new System.Drawing.Point(9, 64); - this.label2.Name = "label2"; - this.label2.Size = new System.Drawing.Size(70, 13); - this.label2.TabIndex = 1; - this.label2.Text = "Author name:"; + this.txtConfirmPassword.Location = new System.Drawing.Point(122, 76); + this.txtConfirmPassword.Name = "txtConfirmPassword"; + this.txtConfirmPassword.PasswordChar = '*'; + this.txtConfirmPassword.Size = new System.Drawing.Size(113, 20); + this.txtConfirmPassword.TabIndex = 5; // - // txtName + // label5 // - this.txtName.Location = new System.Drawing.Point(85, 61); - this.txtName.Name = "txtName"; - this.txtName.Size = new System.Drawing.Size(184, 20); - this.txtName.TabIndex = 2; + this.label5.AutoSize = true; + this.label5.Location = new System.Drawing.Point(12, 79); + this.label5.Name = "label5"; + this.label5.Size = new System.Drawing.Size(93, 13); + this.label5.TabIndex = 4; + this.label5.Text = "Confirm password:"; // - // label3 + // bttCreateToken // - this.label3.AutoSize = true; - this.label3.Location = new System.Drawing.Point(9, 90); - this.label3.Name = "label3"; - this.label3.Size = new System.Drawing.Size(56, 13); - this.label3.TabIndex = 3; - this.label3.Text = "Password:"; + this.bttCreateToken.Location = new System.Drawing.Point(418, 22); + this.bttCreateToken.Name = "bttCreateToken"; + this.bttCreateToken.Size = new System.Drawing.Size(113, 23); + this.bttCreateToken.TabIndex = 11; + this.bttCreateToken.Text = "Create &Token..."; + this.bttCreateToken.UseVisualStyleBackColor = true; // - // txtPassword + // bttCreateCertificate // - this.txtPassword.Location = new System.Drawing.Point(85, 87); - this.txtPassword.Name = "txtPassword"; - this.txtPassword.PasswordChar = '*'; - this.txtPassword.Size = new System.Drawing.Size(113, 20); - this.txtPassword.TabIndex = 4; + this.bttCreateCertificate.Location = new System.Drawing.Point(418, 53); + this.bttCreateCertificate.Name = "bttCreateCertificate"; + this.bttCreateCertificate.Size = new System.Drawing.Size(113, 23); + this.bttCreateCertificate.TabIndex = 12; + this.bttCreateCertificate.Text = "Create Ce&rtificate..."; + this.bttCreateCertificate.UseVisualStyleBackColor = true; + // + // groupBox2 + // + this.groupBox2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.groupBox2.Controls.Add(this.bttRefreshCert); + this.groupBox2.Controls.Add(this.bttSelectCert); + this.groupBox2.Controls.Add(this.txtCertName); + this.groupBox2.Controls.Add(this.cmbCertificate); + this.groupBox2.Controls.Add(this.label6); + this.groupBox2.Controls.Add(this.bttCreateCertificate); + this.groupBox2.Controls.Add(this.label2); + this.groupBox2.Controls.Add(this.bttCreateToken); + this.groupBox2.Controls.Add(this.txtName); + this.groupBox2.Controls.Add(this.label3); + this.groupBox2.Controls.Add(this.label5); + this.groupBox2.Controls.Add(this.txtConfirmPassword); + this.groupBox2.Controls.Add(this.txtPassword); + this.groupBox2.Location = new System.Drawing.Point(12, 139); + this.groupBox2.Name = "groupBox2"; + this.groupBox2.Size = new System.Drawing.Size(537, 171); + this.groupBox2.TabIndex = 1; + this.groupBox2.TabStop = false; + this.groupBox2.Text = "Action"; + // + // txtLog + // + this.txtLog.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.txtLog.Location = new System.Drawing.Point(12, 316); + this.txtLog.Multiline = true; + this.txtLog.Name = "txtLog"; + this.txtLog.ReadOnly = true; + this.txtLog.ScrollBars = System.Windows.Forms.ScrollBars.Vertical; + this.txtLog.Size = new System.Drawing.Size(537, 136); + this.txtLog.TabIndex = 2; + // + // label6 + // + this.label6.AutoSize = true; + this.label6.Location = new System.Drawing.Point(12, 108); + this.label6.Name = "label6"; + this.label6.Size = new System.Drawing.Size(57, 13); + this.label6.TabIndex = 6; + this.label6.Text = "Certificate:"; + // + // cmbCertificate + // + this.cmbCertificate.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.cmbCertificate.FormattingEnabled = true; + this.cmbCertificate.Items.AddRange(new object[] { + "Use current", + "Create new", + "Select existing"}); + this.cmbCertificate.Location = new System.Drawing.Point(122, 102); + this.cmbCertificate.MaxDropDownItems = 20; + this.cmbCertificate.Name = "cmbCertificate"; + this.cmbCertificate.Size = new System.Drawing.Size(184, 21); + this.cmbCertificate.TabIndex = 7; + // + // txtCertName + // + this.txtCertName.Location = new System.Drawing.Point(122, 129); + this.txtCertName.Name = "txtCertName"; + this.txtCertName.Size = new System.Drawing.Size(184, 20); + this.txtCertName.TabIndex = 8; + // + // bttSelectCert + // + this.bttSelectCert.Location = new System.Drawing.Point(312, 129); + this.bttSelectCert.Name = "bttSelectCert"; + this.bttSelectCert.Size = new System.Drawing.Size(32, 23); + this.bttSelectCert.TabIndex = 9; + this.bttSelectCert.Text = "..."; + this.bttSelectCert.UseVisualStyleBackColor = true; + // + // bttRefreshCert + // + this.bttRefreshCert.Location = new System.Drawing.Point(312, 127); + this.bttRefreshCert.Name = "bttRefreshCert"; + this.bttRefreshCert.Size = new System.Drawing.Size(75, 23); + this.bttRefreshCert.TabIndex = 10; + this.bttRefreshCert.Text = "&Refresh"; + this.bttRefreshCert.UseVisualStyleBackColor = true; + // + // bttCancel + // + this.bttCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.bttCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel; + this.bttCancel.Location = new System.Drawing.Point(474, 458); + this.bttCancel.Name = "bttCancel"; + this.bttCancel.Size = new System.Drawing.Size(75, 23); + this.bttCancel.TabIndex = 4; + this.bttCancel.Text = "Ca&ncel"; + this.bttCancel.UseVisualStyleBackColor = true; + this.bttCancel.Click += new System.EventHandler(this.bttOK_Click); // // RegistrationForm // @@ -128,9 +269,11 @@ private void InitializeComponent() this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.CancelButton = this.bttCancel; - this.ClientSize = new System.Drawing.Size(348, 174); - this.Controls.Add(this.bttOK); + this.ClientSize = new System.Drawing.Size(561, 493); + this.Controls.Add(this.txtLog); + this.Controls.Add(this.groupBox2); this.Controls.Add(this.bttCancel); + this.Controls.Add(this.bttOK); this.Controls.Add(this.groupBox1); this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; this.MaximizeBox = false; @@ -139,22 +282,36 @@ private void InitializeComponent() this.ShowIcon = false; this.ShowInTaskbar = false; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; - this.Text = "Key Generator Properties"; + this.Text = "Registration Form"; this.groupBox1.ResumeLayout(false); - this.groupBox1.PerformLayout(); + this.groupBox2.ResumeLayout(false); + this.groupBox2.PerformLayout(); this.ResumeLayout(false); + this.PerformLayout(); } #endregion private System.Windows.Forms.GroupBox groupBox1; - private System.Windows.Forms.Button bttCancel; private System.Windows.Forms.Button bttOK; - private System.Windows.Forms.Label label1; private System.Windows.Forms.TextBox txtPassword; private System.Windows.Forms.Label label3; private System.Windows.Forms.TextBox txtName; private System.Windows.Forms.Label label2; + private System.Windows.Forms.Label label4; + private System.Windows.Forms.Button bttCreateCertificate; + private System.Windows.Forms.Button bttCreateToken; + private System.Windows.Forms.Label label1; + private System.Windows.Forms.TextBox txtConfirmPassword; + private System.Windows.Forms.Label label5; + private System.Windows.Forms.GroupBox groupBox2; + private System.Windows.Forms.TextBox txtLog; + private System.Windows.Forms.Button bttRefreshCert; + private System.Windows.Forms.Button bttSelectCert; + private System.Windows.Forms.TextBox txtCertName; + private System.Windows.Forms.ComboBox cmbCertificate; + private System.Windows.Forms.Label label6; + private System.Windows.Forms.Button bttCancel; } } \ No newline at end of file diff --git a/src_vs2012/VSNDK.Package/Options/Dialogs/RegistrationForm.resx b/src_vs2012/VSNDK.Package/Options/Dialogs/RegistrationForm.resx index 29dcb1b3..59f68477 100644 --- a/src_vs2012/VSNDK.Package/Options/Dialogs/RegistrationForm.resx +++ b/src_vs2012/VSNDK.Package/Options/Dialogs/RegistrationForm.resx @@ -117,4 +117,7 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + Type the password to use with the BlackBerry token. The browser will open and you will be asked to create or login to your BlackBerry ID. Token can be used to sign applications and publish in BlackBerry AppWorld or to create debug-tokens, required for debugging purposes on real devices. + \ No newline at end of file diff --git a/src_vs2012/VSNDK.Package/Options/SigningOptionControl.Designer.cs b/src_vs2012/VSNDK.Package/Options/SigningOptionControl.Designer.cs index 83a80434..8cb353c6 100644 --- a/src_vs2012/VSNDK.Package/Options/SigningOptionControl.Designer.cs +++ b/src_vs2012/VSNDK.Package/Options/SigningOptionControl.Designer.cs @@ -116,7 +116,7 @@ private void InitializeComponent() this.bttDeletePassword.Name = "bttDeletePassword"; this.bttDeletePassword.Size = new System.Drawing.Size(75, 23); this.bttDeletePassword.TabIndex = 7; - this.bttDeletePassword.Text = "Detach"; + this.bttDeletePassword.Text = "&Detach"; this.bttDeletePassword.UseVisualStyleBackColor = true; this.bttDeletePassword.Click += new System.EventHandler(this.bttDeletePassword_Click); // @@ -188,7 +188,7 @@ private void InitializeComponent() this.bttRefresh.Name = "bttRefresh"; this.bttRefresh.Size = new System.Drawing.Size(75, 23); this.bttRefresh.TabIndex = 6; - this.bttRefresh.Text = "&Refresh..."; + this.bttRefresh.Text = "Re&fresh..."; this.bttRefresh.UseVisualStyleBackColor = true; this.bttRefresh.Click += new System.EventHandler(this.bttRefresh_Click); // @@ -219,7 +219,7 @@ private void InitializeComponent() this.bttChangeCert.Name = "bttChangeCert"; this.bttChangeCert.Size = new System.Drawing.Size(75, 23); this.bttChangeCert.TabIndex = 2; - this.bttChangeCert.Text = "&Change..."; + this.bttChangeCert.Text = "&Select..."; this.bttChangeCert.UseVisualStyleBackColor = true; this.bttChangeCert.Click += new System.EventHandler(this.bttChangeCert_Click); // @@ -230,7 +230,7 @@ private void InitializeComponent() this.bttNavigate.Name = "bttNavigate"; this.bttNavigate.Size = new System.Drawing.Size(75, 23); this.bttNavigate.TabIndex = 3; - this.bttNavigate.Text = "&Open..."; + this.bttNavigate.Text = "S&how..."; this.bttNavigate.UseVisualStyleBackColor = true; this.bttNavigate.Click += new System.EventHandler(this.bttNavigate_Click); // diff --git a/src_vs2012/VSNDK.Package/Options/SigningOptionControl.cs b/src_vs2012/VSNDK.Package/Options/SigningOptionControl.cs index c3046821..ef77c09a 100644 --- a/src_vs2012/VSNDK.Package/Options/SigningOptionControl.cs +++ b/src_vs2012/VSNDK.Package/Options/SigningOptionControl.cs @@ -284,44 +284,36 @@ private void bttRegister_Click(object sender, EventArgs e) return; } - var form = new CskRequestForm(null); - form.ShowDialog(); // this should generate BlackBerry token file - /////////////////////////////// // REGISTER - if (!_vm.Developer.IsRegistered && _vm.Developer.HasBlackBerryTokenFile) + var registrationForm = new RegistrationForm(); + + if (registrationForm.ShowDialog() == DialogResult.OK) { - var registrationForm = new RegistrationForm(); + /* + var runner = new KeyToolGenRunner(RunnerDefaults.ToolsDirectory, registrationForm.AuthorName, registrationForm.AuthorPassword, null); + var success = runner.Execute(); - if (registrationForm.ShowDialog() == DialogResult.OK) + // finally, show result message: + if (success && string.IsNullOrEmpty(runner.LastError)) { - var runner = new KeyToolGenRunner(RunnerDefaults.ToolsDirectory, registrationForm.AuthorName, registrationForm.AuthorPassword, null); - var success = runner.Execute(); - - // finally, show result message: - if (success && string.IsNullOrEmpty(runner.LastError)) + if (!string.IsNullOrEmpty(runner.LastOutput)) { - if (!string.IsNullOrEmpty(runner.LastOutput)) - { - MessageBoxHelper.Show(runner.LastOutput.Replace("CSK", "BB ID Token"), "Registered developer profile", MessageBoxButtons.OK, MessageBoxIcon.Information); - } + MessageBoxHelper.Show(runner.LastOutput.Replace("CSK", "BB ID Token"), "Registered developer profile", MessageBoxButtons.OK, MessageBoxIcon.Information); } - else - { - // clean-up files, in case something went wrong: - _vm.Developer.CleanupProfile(); + } + else + { + // clean-up files, in case something went wrong: + _vm.Developer.CleanupProfile(); - if (!string.IsNullOrEmpty(runner.LastError)) - { - MessageBoxHelper.Show(runner.LastError, "Failed to create developer profile", MessageBoxButtons.OK, MessageBoxIcon.Error); - } + if (!string.IsNullOrEmpty(runner.LastError)) + { + MessageBoxHelper.Show(runner.LastError, "Failed to create developer profile", MessageBoxButtons.OK, MessageBoxIcon.Error); } } - } - else - { - MessageBoxHelper.Show("Creation of BlackBerry ID token failed. Please try again.", "Registration", MessageBoxButtons.OK, MessageBoxIcon.Error); + */ } UpdateUI(); From 1be45dfa9aa54725bf3898e6eee4b334ac53d1a8 Mon Sep 17 00:00:00 2001 From: Pawel Hofman Date: Tue, 27 May 2014 19:30:51 +0200 Subject: [PATCH 127/851] Reverted wrong input param-check condition --- src_vs2012/VSNDK.Package/ViewModels/DeveloperDefinition.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src_vs2012/VSNDK.Package/ViewModels/DeveloperDefinition.cs b/src_vs2012/VSNDK.Package/ViewModels/DeveloperDefinition.cs index 971ff8f9..8bd897d0 100644 --- a/src_vs2012/VSNDK.Package/ViewModels/DeveloperDefinition.cs +++ b/src_vs2012/VSNDK.Package/ViewModels/DeveloperDefinition.cs @@ -297,7 +297,7 @@ public void UpdateCertificate(string fileName) if (!string.IsNullOrEmpty(folder)) throw new ArgumentOutOfRangeException("fileName", "Invalid name, folder is not expected inside, only file name"); - if (File.Exists(Path.Combine(DataPath, fileName))) + if (!File.Exists(Path.Combine(DataPath, fileName))) throw new ArgumentOutOfRangeException("fileName", "File doesn't existing in designated certificate storage"); ClearPassword(); From d46ac7a31a048c89eaa524ee03002dc047e2423e Mon Sep 17 00:00:00 2001 From: Pawel Hofman Date: Wed, 28 May 2014 02:09:26 +0200 Subject: [PATCH 128/851] Moved certificate info into separate class Now parsing data from keygen tool is more clear and new fields can be added easier. --- src/VSNDK.Package/VSNDK.Package.csproj | 3 + .../VSNDK.Package.Test/ToolRunnerTests.cs | 7 +- .../VSNDK.Package/Model/CertificateInfo.cs | 223 ++++++++++++++++++ .../VSNDK.Package/Tools/KeyToolInfoRunner.cs | 86 +------ src_vs2012/VSNDK.Package/VSNDK.Package.csproj | 1 + .../ViewModels/DeveloperDefinition.cs | 4 +- src_vs2013/VSNDK.Package/VSNDK.Package.csproj | 3 + 7 files changed, 247 insertions(+), 80 deletions(-) create mode 100644 src_vs2012/VSNDK.Package/Model/CertificateInfo.cs diff --git a/src/VSNDK.Package/VSNDK.Package.csproj b/src/VSNDK.Package/VSNDK.Package.csproj index 27745162..e8d7b6bb 100644 --- a/src/VSNDK.Package/VSNDK.Package.csproj +++ b/src/VSNDK.Package/VSNDK.Package.csproj @@ -165,6 +165,9 @@ Model\ApiLevelListTypes.cs + + Model\CertificateInfo.cs + Model\DebugTokenInfo.cs diff --git a/src_vs2012/VSNDK.Package.Test/ToolRunnerTests.cs b/src_vs2012/VSNDK.Package.Test/ToolRunnerTests.cs index 3516b434..2c1f57af 100644 --- a/src_vs2012/VSNDK.Package.Test/ToolRunnerTests.cs +++ b/src_vs2012/VSNDK.Package.Test/ToolRunnerTests.cs @@ -180,13 +180,16 @@ public void LoadInstalledNdkInfo() [Test] public void LoadInfoAboutCertificate() { - var runner = new KeyToolInfoRunner(RunnerDefaults.TestToolsDirectory, Path.Combine(RunnerDefaults.DataDirectory, DeveloperDefinition.DefaultCertificateName), "abcdef"); + var fileName = Path.Combine(RunnerDefaults.DataDirectory, DeveloperDefinition.DefaultCertificateName); + var password = "abcdef"; + var runner = new KeyToolInfoRunner(RunnerDefaults.TestToolsDirectory, fileName, password); var result = runner.Execute(); Assert.IsTrue(result, "Unable to start the tool"); Assert.IsNotNull(runner.LastOutput); Assert.IsNull(runner.LastError); - Assert.IsNotNull(runner.Issuer); + Assert.IsNotNull(runner.Info); + Assert.IsNotNull(runner.Info.Issuer); } } } diff --git a/src_vs2012/VSNDK.Package/Model/CertificateInfo.cs b/src_vs2012/VSNDK.Package/Model/CertificateInfo.cs new file mode 100644 index 00000000..80f65ef7 --- /dev/null +++ b/src_vs2012/VSNDK.Package/Model/CertificateInfo.cs @@ -0,0 +1,223 @@ +using System; +using System.Globalization; + +namespace RIM.VSNDK_Package.Model +{ + /// + /// Class describing developer's certificate. + /// + internal sealed class CertificateInfo + { + private CertificateInfo() + { + } + + public CertificateInfo(string alias, string subjectName, string issuer, string algorithm, string fingerprintSHA1, string fingerprintMD5) + { + Alias = alias; + SubjectName = subjectName; + Issuer = issuer; + Algorithm = algorithm; + FingerprintSHA1 = fingerprintSHA1; + FingerprintMD5 = fingerprintMD5; + } + + #region Properties + + public string Alias + { + get; + private set; + } + + public string SerialNumber + { + get; + private set; + } + + public string SubjectName + { + get; + private set; + } + + public string Issuer + { + get; + private set; + } + + public DateTime ValidFrom + { + get; + private set; + } + + public DateTime ValidTo + { + get; + private set; + } + + public string Algorithm + { + get; + private set; + } + + public string PublicKey + { + get; + private set; + } + + public string FingerprintSHA1 + { + get; + private set; + } + + public string FingerprintMD5 + { + get; + private set; + } + + #endregion + + /// + /// Extracts certificate info out of given text. + /// + public static CertificateInfo Parse(string text) + { + if (string.IsNullOrEmpty(text)) + return null; + + /* +Found 1 private key +Found 1 certificate: + Alias: + author + Serial Number: + aa:bb:cc:dd + Subject Name: + CommonName=XyXyXyXyXyXy + Issuer Name: + CommonName=XyXyXyXyXyXy + Valid From: + Thu Oct 18 22:25:41 CEST 2012 + Valid To: + Wed Oct 13 22:25:41 CEST 2032 + Public Key: + ECC-SECP521R1 + Signature Algorithm: + SHA512withECDSA + SHA1 Fingerprint: + aa:bb:cc:dd:ee:ff:gg:hh:ii:jj:kk:ll:00:11:22:33:44:55:66:77 + MD5 Fingerprint: + 00:11:22:33:44:55:66:77:88:99:00:11:22:33:44:55 + */ + + var lines = text.Split(new[] { '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries); + + // remove white chars... + for (int i = 0; i < lines.Length; i++) + { + lines[i] = lines[i].Trim(); + } + + var result = new CertificateInfo(); + + // do the parsing: + // - assuming that n-line has header and n+1 - data + for (int i = 0; i < lines.Length - 1; i++) + { + if (string.Compare("alias:", lines[i], StringComparison.InvariantCultureIgnoreCase) == 0) + { + result.Alias = lines[++i]; + continue; + } + if (string.Compare("serial number:", lines[i], StringComparison.InvariantCultureIgnoreCase) == 0) + { + result.SerialNumber = lines[++i]; + continue; + } + if (string.Compare("subject name:", lines[i], StringComparison.InvariantCultureIgnoreCase) == 0) + { + result.SubjectName = lines[++i]; + continue; + } + if (string.Compare("issuer name:", lines[i], StringComparison.InvariantCultureIgnoreCase) == 0) + { + result.Issuer = lines[++i]; + continue; + } + if (string.Compare("valid from:", lines[i], StringComparison.InvariantCultureIgnoreCase) == 0) + { + result.ValidFrom = ParseDate(lines[++i]); + continue; + } + if (string.Compare("valid to:", lines[i], StringComparison.InvariantCultureIgnoreCase) == 0) + { + result.ValidTo = ParseDate(lines[++i]); + continue; + } + if (string.Compare("signature algorithm:", lines[i], StringComparison.InvariantCultureIgnoreCase) == 0) + { + result.Algorithm = lines[++i]; + continue; + } + if (string.Compare("public key:", lines[i], StringComparison.InvariantCultureIgnoreCase) == 0) + { + result.PublicKey = lines[++i]; + continue; + } + if (string.Compare("md5 fingerprint:", lines[i], StringComparison.InvariantCultureIgnoreCase) == 0) + { + result.FingerprintMD5 = lines[++i]; + continue; + } + if (string.Compare("sha1 fingerprint:", lines[i], StringComparison.InvariantCultureIgnoreCase) == 0) + { + result.FingerprintSHA1 = lines[++i]; + continue; + } + } + + // verify if at least some basic fields are set, + // then return the result, else treat everything as parsing failure: + return string.IsNullOrEmpty(result.Issuer) ? null : result; + } + + private static DateTime ParseDate(string text) + { + text = RemoveTimeZone(text); + if (string.IsNullOrEmpty(text)) + return DateTime.MinValue.ToUniversalTime(); + + var culture = CultureInfo.GetCultureInfo("en-US"); + + // Thu Oct 18 22:25:41 2012 + return DateTime.ParseExact(text, + new[] { "ddd MMM d HH:mm:ss yyyy", "ddd MMM dd HH:mm:ss yyyy" }, + culture, DateTimeStyles.AssumeLocal).ToUniversalTime(); + } + + private static string RemoveTimeZone(string text) + { + if (string.IsNullOrEmpty(text)) + return null; + + // find text between last two spaces: + int endIndex = text.LastIndexOf(' '); + if (endIndex <= 0) + return text; + int startIndex = text.LastIndexOf(' ', endIndex - 1); + if (startIndex < 0) + return text; + + return string.Concat(text.Substring(0, startIndex), text.Substring(endIndex)); + } + } +} diff --git a/src_vs2012/VSNDK.Package/Tools/KeyToolInfoRunner.cs b/src_vs2012/VSNDK.Package/Tools/KeyToolInfoRunner.cs index 2cbd9bff..54b3d50a 100644 --- a/src_vs2012/VSNDK.Package/Tools/KeyToolInfoRunner.cs +++ b/src_vs2012/VSNDK.Package/Tools/KeyToolInfoRunner.cs @@ -1,5 +1,6 @@ using System; using RIM.VSNDK_Package.Diagnostics; +using RIM.VSNDK_Package.Model; namespace RIM.VSNDK_Package.Tools { @@ -61,37 +62,10 @@ public string StoreFileName } } - public string Alias - { - get; - private set; - } - - public string SubjectName - { - get; - private set; - } - - public string Issuer - { - get; - private set; - } - - public string Algorithm - { - get; - private set; - } - - public string FingerprintSHA1 - { - get; - private set; - } - - public string FingerprintMD5 + /// + /// Gets the certificate info returned by the keytool. + /// + public CertificateInfo Info { get; private set; @@ -131,57 +105,15 @@ Found 1 private key 00:11:22:33:44:55:66:77:88:99:00:11:22:33:44:55 */ + Info = null; if (string.IsNullOrEmpty(error) && !string.IsNullOrEmpty(output)) { - var lines = output.Split(new[] { '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries); - - // remove white chars... - for (int i = 0; i < lines.Length; i++) - { - lines[i] = lines[i].Trim(); - } - - // do the parsing: - // - assuming that n-line has header and n+1 - data - for (int i = 0; i < lines.Length - 1; i++) - { - if (string.Compare("alias:", lines[i], StringComparison.InvariantCultureIgnoreCase) == 0) - { - Alias = lines[++i]; - continue; - } - if (string.Compare("subject name:", lines[i], StringComparison.InvariantCultureIgnoreCase) == 0) - { - SubjectName = lines[++i]; - continue; - } - if (string.Compare("issuer name:", lines[i], StringComparison.InvariantCultureIgnoreCase) == 0) - { - Issuer = lines[++i]; - continue; - } - if (string.Compare("signature algorithm:", lines[i], StringComparison.InvariantCultureIgnoreCase) == 0) - { - Algorithm = lines[++i]; - continue; - } - - if (string.Compare("md5 fingerprint:", lines[i], StringComparison.InvariantCultureIgnoreCase) == 0) - { - FingerprintMD5 = lines[++i]; - continue; - } - if (string.Compare("sha1 fingerprint:", lines[i], StringComparison.InvariantCultureIgnoreCase) == 0) - { - FingerprintSHA1 = lines[++i]; - continue; - } - } + Info = CertificateInfo.Parse(output); } TraceLog.WriteLine("For certificate: {0}", StoreFileName); - TraceLog.WriteLine(" * issuer: {0}", Issuer ?? "- none -"); - TraceLog.WriteLine(" * algorithm: {0}", Algorithm ?? "- none -"); + TraceLog.WriteLine(" * issuer: {0}", Info != null ? Info.Issuer : "- none -"); + TraceLog.WriteLine(" * algorithm: {0}", Info != null ? Info.Algorithm : "- none -"); } } } diff --git a/src_vs2012/VSNDK.Package/VSNDK.Package.csproj b/src_vs2012/VSNDK.Package/VSNDK.Package.csproj index ee211619..f4fe5524 100644 --- a/src_vs2012/VSNDK.Package/VSNDK.Package.csproj +++ b/src_vs2012/VSNDK.Package/VSNDK.Package.csproj @@ -261,6 +261,7 @@ + diff --git a/src_vs2012/VSNDK.Package/ViewModels/DeveloperDefinition.cs b/src_vs2012/VSNDK.Package/ViewModels/DeveloperDefinition.cs index 8bd897d0..2605a144 100644 --- a/src_vs2012/VSNDK.Package/ViewModels/DeveloperDefinition.cs +++ b/src_vs2012/VSNDK.Package/ViewModels/DeveloperDefinition.cs @@ -391,9 +391,11 @@ public static string LoadIssuer(string certificateFileName, string password) // invoke if (!runner.Execute()) return null; + if (runner.Info == null) + return null; // grab results: - issuer = runner.Issuer; + issuer = runner.Info.Issuer; } if (issuer != null && issuer.StartsWith("CN=", StringComparison.InvariantCultureIgnoreCase)) diff --git a/src_vs2013/VSNDK.Package/VSNDK.Package.csproj b/src_vs2013/VSNDK.Package/VSNDK.Package.csproj index bb2bd66b..1387185e 100644 --- a/src_vs2013/VSNDK.Package/VSNDK.Package.csproj +++ b/src_vs2013/VSNDK.Package/VSNDK.Package.csproj @@ -272,6 +272,9 @@ Model\ApiLevelListTypes.cs + + Model\CertificateInfo.cs + Model\DebugTokenInfo.cs From 2eb83c3e242b4fcc8ebf4831187f9c087d027b33 Mon Sep 17 00:00:00 2001 From: Pawel Hofman Date: Wed, 28 May 2014 03:47:13 +0200 Subject: [PATCH 129/851] Added BlackBerry ID token info class and parser --- src/VSNDK.Package/VSNDK.Package.csproj | 3 + src_vs2012/VSNDK.Package.Test/ParserTests.cs | 18 +++ .../VSNDK.Package/Model/CertificateInfo.cs | 46 +++++- .../VSNDK.Package/Model/CskTokenInfo.cs | 132 ++++++++++++++++++ src_vs2012/VSNDK.Package/VSNDK.Package.csproj | 1 + src_vs2013/VSNDK.Package/VSNDK.Package.csproj | 3 + 6 files changed, 197 insertions(+), 6 deletions(-) create mode 100644 src_vs2012/VSNDK.Package/Model/CskTokenInfo.cs diff --git a/src/VSNDK.Package/VSNDK.Package.csproj b/src/VSNDK.Package/VSNDK.Package.csproj index e8d7b6bb..d4e14317 100644 --- a/src/VSNDK.Package/VSNDK.Package.csproj +++ b/src/VSNDK.Package/VSNDK.Package.csproj @@ -168,6 +168,9 @@ Model\CertificateInfo.cs + + Model\CskTokenInfo.cs + Model\DebugTokenInfo.cs diff --git a/src_vs2012/VSNDK.Package.Test/ParserTests.cs b/src_vs2012/VSNDK.Package.Test/ParserTests.cs index c26c78c4..1a27db20 100644 --- a/src_vs2012/VSNDK.Package.Test/ParserTests.cs +++ b/src_vs2012/VSNDK.Package.Test/ParserTests.cs @@ -383,6 +383,24 @@ public void ParseDeviceId() Assert.AreEqual(0x1122, DeviceInfo.ParseDeviceId("0X1122")); Assert.AreEqual(1122, DeviceInfo.ParseDeviceId("1122")); } + + [Test] + public void ParseCskToken() + { + const string cskTokenData = @"#Do not edit manually. Generated automatically by BlackBerry tools. +#Mon Sep 02 08:43:07 EDT 2013 +HMAC=111111111111111111111111111\= +Salt=22222222222\= +IV=33333333333\= +Version=3 +Token=44444444444444444444444444\=\="; + + var result = CskTokenInfo.Parse(cskTokenData); + + Assert.IsNotNull(result); + Assert.AreEqual(new DateTime(2013, 9, 2, 6, 43, 07, DateTimeKind.Utc), result.CreatedAt); + Assert.AreEqual("3", result.Version); + } } } diff --git a/src_vs2012/VSNDK.Package/Model/CertificateInfo.cs b/src_vs2012/VSNDK.Package/Model/CertificateInfo.cs index 80f65ef7..bdc1bfd1 100644 --- a/src_vs2012/VSNDK.Package/Model/CertificateInfo.cs +++ b/src_vs2012/VSNDK.Package/Model/CertificateInfo.cs @@ -190,22 +190,55 @@ Found 1 private key return string.IsNullOrEmpty(result.Issuer) ? null : result; } - private static DateTime ParseDate(string text) + /// + /// Parses the date out of given text. + /// + internal static DateTime ParseDate(string text) + { + DateTime date; + + return TryParseDate(text, out date) ? date : date; + } + + /// + /// Tries to parse the date from specified string. + /// + internal static bool TryParseDate(string text, out DateTime result) { - text = RemoveTimeZone(text); + string timeZoneName; + + text = RemoveTimeZone(text, out timeZoneName); if (string.IsNullOrEmpty(text)) - return DateTime.MinValue.ToUniversalTime(); + { + result = DateTime.MinValue.ToUniversalTime(); + return false; + } var culture = CultureInfo.GetCultureInfo("en-US"); + var timeZoneShift = GetTimeZoneShift(timeZoneName); // Thu Oct 18 22:25:41 2012 - return DateTime.ParseExact(text, + if (!DateTime.TryParseExact(text, new[] { "ddd MMM d HH:mm:ss yyyy", "ddd MMM dd HH:mm:ss yyyy" }, - culture, DateTimeStyles.AssumeLocal).ToUniversalTime(); + culture, DateTimeStyles.AssumeLocal, + out result)) + return false; + + result = result.Subtract(timeZoneShift).ToUniversalTime(); + return true; + } + + private static TimeSpan GetTimeZoneShift(string timeZoneName) + { + // PH: TODO: implement proper time-zone shift detection + // like for CEST -> +2:00 + // and change the parsing code to use AssumeUniversal instead of AssumeLocal + return new TimeSpan(0, 0, 0); } - private static string RemoveTimeZone(string text) + private static string RemoveTimeZone(string text, out string timeZoneName) { + timeZoneName = null; if (string.IsNullOrEmpty(text)) return null; @@ -217,6 +250,7 @@ private static string RemoveTimeZone(string text) if (startIndex < 0) return text; + timeZoneName = text.Substring(startIndex + 1, endIndex - startIndex - 1); return string.Concat(text.Substring(0, startIndex), text.Substring(endIndex)); } } diff --git a/src_vs2012/VSNDK.Package/Model/CskTokenInfo.cs b/src_vs2012/VSNDK.Package/Model/CskTokenInfo.cs new file mode 100644 index 00000000..0c1f9736 --- /dev/null +++ b/src_vs2012/VSNDK.Package/Model/CskTokenInfo.cs @@ -0,0 +1,132 @@ +using System; +using System.IO; +using RIM.VSNDK_Package.Diagnostics; + +namespace RIM.VSNDK_Package.Model +{ + /// + /// Class describing BlackBerry ID token. + /// + internal sealed class CskTokenInfo + { + private CskTokenInfo() + { + } + + /// + /// Init constructor. + /// + public CskTokenInfo(string content) + { + Content = content; + Parse(content, this); + } + + #region Properties + + /// + /// Gets the whole content of the token data. + /// + public string Content + { + get; + private set; + } + + public DateTime CreatedAt + { + get; + private set; + } + + public string HMAC + { + get; + private set; + } + + public string Version + { + get; + private set; + } + + public string Token + { + get; + private set; + } + + #endregion + + /// + /// Loads token info from specified file. + /// + public static CskTokenInfo Load(string fileName) + { + if (string.IsNullOrEmpty(fileName)) + return null; + + try + { + return Parse(File.ReadAllText(fileName)); + } + catch (Exception ex) + { + TraceLog.WriteException(ex, "Unable to load file: \"{0}\"", fileName); + return null; + } + } + + /// + /// Extracts token info from a text content. + /// + public static CskTokenInfo Parse(string text) + { + return Parse(text, new CskTokenInfo()); + } + + /// + /// Updates token info from a text content inside given result. + /// + private static CskTokenInfo Parse(string text, CskTokenInfo result) + { + if (string.IsNullOrEmpty(text)) + return null; + + var lines = text.Split(new[] { '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries); + foreach (var line in lines) + { + // date from comment: + if (line.Length > 0 && line[0] == '#') + { + DateTime date; + if (CertificateInfo.TryParseDate(line.Substring(1), out date)) + { + result.CreatedAt = date; + } + } + + // HMAC: + if (line.StartsWith("hmac=", StringComparison.InvariantCultureIgnoreCase)) + { + result.HMAC = line.Substring(5).Trim(); + } + + // version: + if (line.StartsWith("version=", StringComparison.InvariantCultureIgnoreCase)) + { + result.Version = line.Substring(8).Trim(); + } + + // token: + if (line.StartsWith("token=", StringComparison.InvariantCultureIgnoreCase)) + { + result.Token = line.Substring(6).Trim(); + } + } + + return result; + } + } +} diff --git a/src_vs2012/VSNDK.Package/VSNDK.Package.csproj b/src_vs2012/VSNDK.Package/VSNDK.Package.csproj index f4fe5524..a4e16d09 100644 --- a/src_vs2012/VSNDK.Package/VSNDK.Package.csproj +++ b/src_vs2012/VSNDK.Package/VSNDK.Package.csproj @@ -262,6 +262,7 @@ + diff --git a/src_vs2013/VSNDK.Package/VSNDK.Package.csproj b/src_vs2013/VSNDK.Package/VSNDK.Package.csproj index 1387185e..73b4878b 100644 --- a/src_vs2013/VSNDK.Package/VSNDK.Package.csproj +++ b/src_vs2013/VSNDK.Package/VSNDK.Package.csproj @@ -275,6 +275,9 @@ Model\CertificateInfo.cs + + Model\CskTokenInfo.cs + Model\DebugTokenInfo.cs From 9f64cef0d600cac17758ddafb891ea5a2844a8a1 Mon Sep 17 00:00:00 2001 From: Pawel Hofman Date: Wed, 28 May 2014 03:49:16 +0200 Subject: [PATCH 130/851] Another round of UI design for registration form --- .../Dialogs/RegistrationForm.Designer.cs | 197 +++++++++--------- 1 file changed, 97 insertions(+), 100 deletions(-) diff --git a/src_vs2012/VSNDK.Package/Options/Dialogs/RegistrationForm.Designer.cs b/src_vs2012/VSNDK.Package/Options/Dialogs/RegistrationForm.Designer.cs index eb84eb6f..e1368558 100644 --- a/src_vs2012/VSNDK.Package/Options/Dialogs/RegistrationForm.Designer.cs +++ b/src_vs2012/VSNDK.Package/Options/Dialogs/RegistrationForm.Designer.cs @@ -29,46 +29,53 @@ protected override void Dispose(bool disposing) private void InitializeComponent() { System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(RegistrationForm)); - this.groupBox1 = new System.Windows.Forms.GroupBox(); + this.label1 = new System.Windows.Forms.Label(); + this.label4 = new System.Windows.Forms.Label(); this.txtPassword = new System.Windows.Forms.TextBox(); this.label3 = new System.Windows.Forms.Label(); this.txtName = new System.Windows.Forms.TextBox(); this.label2 = new System.Windows.Forms.Label(); this.bttOK = new System.Windows.Forms.Button(); - this.label4 = new System.Windows.Forms.Label(); - this.label1 = new System.Windows.Forms.Label(); this.txtConfirmPassword = new System.Windows.Forms.TextBox(); this.label5 = new System.Windows.Forms.Label(); this.bttCreateToken = new System.Windows.Forms.Button(); this.bttCreateCertificate = new System.Windows.Forms.Button(); this.groupBox2 = new System.Windows.Forms.GroupBox(); - this.txtLog = new System.Windows.Forms.TextBox(); - this.label6 = new System.Windows.Forms.Label(); - this.cmbCertificate = new System.Windows.Forms.ComboBox(); - this.txtCertName = new System.Windows.Forms.TextBox(); - this.bttSelectCert = new System.Windows.Forms.Button(); this.bttRefreshCert = new System.Windows.Forms.Button(); + this.bttSelectCert = new System.Windows.Forms.Button(); + this.txtCertName = new System.Windows.Forms.TextBox(); + this.cmbCertificate = new System.Windows.Forms.ComboBox(); + this.label6 = new System.Windows.Forms.Label(); + this.txtLog = new System.Windows.Forms.TextBox(); this.bttCancel = new System.Windows.Forms.Button(); - this.groupBox1.SuspendLayout(); + this.groupBox3 = new System.Windows.Forms.GroupBox(); this.groupBox2.SuspendLayout(); this.SuspendLayout(); // - // groupBox1 + // label1 + // + this.label1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.label1.Location = new System.Drawing.Point(12, 73); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(519, 23); + this.label1.TabIndex = 1; + this.label1.Text = "To complete the registration both - BlackBerry ID token and developer certificate" + + " - are required."; // - this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + // label4 + // + this.label4.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); - this.groupBox1.Controls.Add(this.label1); - this.groupBox1.Controls.Add(this.label4); - this.groupBox1.Location = new System.Drawing.Point(12, 12); - this.groupBox1.Name = "groupBox1"; - this.groupBox1.Size = new System.Drawing.Size(537, 121); - this.groupBox1.TabIndex = 0; - this.groupBox1.TabStop = false; - this.groupBox1.Text = "Info"; + this.label4.Location = new System.Drawing.Point(12, 26); + this.label4.Name = "label4"; + this.label4.Size = new System.Drawing.Size(519, 47); + this.label4.TabIndex = 0; + this.label4.Text = resources.GetString("label4.Text"); // // txtPassword // - this.txtPassword.Location = new System.Drawing.Point(122, 50); + this.txtPassword.Location = new System.Drawing.Point(131, 129); this.txtPassword.Name = "txtPassword"; this.txtPassword.PasswordChar = '*'; this.txtPassword.Size = new System.Drawing.Size(113, 20); @@ -77,7 +84,7 @@ private void InitializeComponent() // label3 // this.label3.AutoSize = true; - this.label3.Location = new System.Drawing.Point(12, 53); + this.label3.Location = new System.Drawing.Point(12, 132); this.label3.Name = "label3"; this.label3.Size = new System.Drawing.Size(56, 13); this.label3.TabIndex = 2; @@ -85,7 +92,7 @@ private void InitializeComponent() // // txtName // - this.txtName.Location = new System.Drawing.Point(122, 24); + this.txtName.Location = new System.Drawing.Point(131, 103); this.txtName.Name = "txtName"; this.txtName.Size = new System.Drawing.Size(184, 20); this.txtName.TabIndex = 1; @@ -93,7 +100,7 @@ private void InitializeComponent() // label2 // this.label2.AutoSize = true; - this.label2.Location = new System.Drawing.Point(12, 27); + this.label2.Location = new System.Drawing.Point(12, 106); this.label2.Name = "label2"; this.label2.Size = new System.Drawing.Size(70, 13); this.label2.TabIndex = 0; @@ -102,38 +109,17 @@ private void InitializeComponent() // bttOK // this.bttOK.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this.bttOK.Location = new System.Drawing.Point(393, 458); + this.bttOK.Location = new System.Drawing.Point(393, 496); this.bttOK.Name = "bttOK"; this.bttOK.Size = new System.Drawing.Size(75, 23); this.bttOK.TabIndex = 3; this.bttOK.Text = "&OK"; this.bttOK.UseVisualStyleBackColor = true; this.bttOK.Click += new System.EventHandler(this.bttOK_Click); - // - // label4 - // - this.label4.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.label4.Location = new System.Drawing.Point(12, 25); - this.label4.Name = "label4"; - this.label4.Size = new System.Drawing.Size(519, 47); - this.label4.TabIndex = 0; - this.label4.Text = resources.GetString("label4.Text"); - // - // label1 - // - this.label1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.label1.Location = new System.Drawing.Point(12, 82); - this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(519, 23); - this.label1.TabIndex = 1; - this.label1.Text = "To complete the registration both - BlackBerry ID token and developer certificate" + - " - are required."; // // txtConfirmPassword // - this.txtConfirmPassword.Location = new System.Drawing.Point(122, 76); + this.txtConfirmPassword.Location = new System.Drawing.Point(131, 155); this.txtConfirmPassword.Name = "txtConfirmPassword"; this.txtConfirmPassword.PasswordChar = '*'; this.txtConfirmPassword.Size = new System.Drawing.Size(113, 20); @@ -142,7 +128,7 @@ private void InitializeComponent() // label5 // this.label5.AutoSize = true; - this.label5.Location = new System.Drawing.Point(12, 79); + this.label5.Location = new System.Drawing.Point(12, 158); this.label5.Name = "label5"; this.label5.Size = new System.Drawing.Size(93, 13); this.label5.TabIndex = 4; @@ -150,18 +136,18 @@ private void InitializeComponent() // // bttCreateToken // - this.bttCreateToken.Location = new System.Drawing.Point(418, 22); + this.bttCreateToken.Location = new System.Drawing.Point(15, 244); this.bttCreateToken.Name = "bttCreateToken"; - this.bttCreateToken.Size = new System.Drawing.Size(113, 23); + this.bttCreateToken.Size = new System.Drawing.Size(110, 23); this.bttCreateToken.TabIndex = 11; this.bttCreateToken.Text = "Create &Token..."; this.bttCreateToken.UseVisualStyleBackColor = true; // // bttCreateCertificate // - this.bttCreateCertificate.Location = new System.Drawing.Point(418, 53); + this.bttCreateCertificate.Location = new System.Drawing.Point(131, 244); this.bttCreateCertificate.Name = "bttCreateCertificate"; - this.bttCreateCertificate.Size = new System.Drawing.Size(113, 23); + this.bttCreateCertificate.Size = new System.Drawing.Size(110, 23); this.bttCreateCertificate.TabIndex = 12; this.bttCreateCertificate.Text = "Create Ce&rtificate..."; this.bttCreateCertificate.UseVisualStyleBackColor = true; @@ -170,7 +156,9 @@ private void InitializeComponent() // this.groupBox2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); + this.groupBox2.Controls.Add(this.label1); this.groupBox2.Controls.Add(this.bttRefreshCert); + this.groupBox2.Controls.Add(this.label4); this.groupBox2.Controls.Add(this.bttSelectCert); this.groupBox2.Controls.Add(this.txtCertName); this.groupBox2.Controls.Add(this.cmbCertificate); @@ -183,34 +171,37 @@ private void InitializeComponent() this.groupBox2.Controls.Add(this.label5); this.groupBox2.Controls.Add(this.txtConfirmPassword); this.groupBox2.Controls.Add(this.txtPassword); - this.groupBox2.Location = new System.Drawing.Point(12, 139); + this.groupBox2.Location = new System.Drawing.Point(12, 12); this.groupBox2.Name = "groupBox2"; - this.groupBox2.Size = new System.Drawing.Size(537, 171); + this.groupBox2.Size = new System.Drawing.Size(537, 279); this.groupBox2.TabIndex = 1; this.groupBox2.TabStop = false; - this.groupBox2.Text = "Action"; + this.groupBox2.Text = "BlackBerry 10 Devices"; // - // txtLog + // bttRefreshCert // - this.txtLog.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.txtLog.Location = new System.Drawing.Point(12, 316); - this.txtLog.Multiline = true; - this.txtLog.Name = "txtLog"; - this.txtLog.ReadOnly = true; - this.txtLog.ScrollBars = System.Windows.Forms.ScrollBars.Vertical; - this.txtLog.Size = new System.Drawing.Size(537, 136); - this.txtLog.TabIndex = 2; + this.bttRefreshCert.Location = new System.Drawing.Point(321, 208); + this.bttRefreshCert.Name = "bttRefreshCert"; + this.bttRefreshCert.Size = new System.Drawing.Size(75, 23); + this.bttRefreshCert.TabIndex = 10; + this.bttRefreshCert.Text = "&Refresh"; + this.bttRefreshCert.UseVisualStyleBackColor = true; // - // label6 + // bttSelectCert // - this.label6.AutoSize = true; - this.label6.Location = new System.Drawing.Point(12, 108); - this.label6.Name = "label6"; - this.label6.Size = new System.Drawing.Size(57, 13); - this.label6.TabIndex = 6; - this.label6.Text = "Certificate:"; + this.bttSelectCert.Location = new System.Drawing.Point(321, 208); + this.bttSelectCert.Name = "bttSelectCert"; + this.bttSelectCert.Size = new System.Drawing.Size(32, 23); + this.bttSelectCert.TabIndex = 9; + this.bttSelectCert.Text = "..."; + this.bttSelectCert.UseVisualStyleBackColor = true; + // + // txtCertName + // + this.txtCertName.Location = new System.Drawing.Point(131, 208); + this.txtCertName.Name = "txtCertName"; + this.txtCertName.Size = new System.Drawing.Size(184, 20); + this.txtCertName.TabIndex = 8; // // cmbCertificate // @@ -220,48 +211,55 @@ private void InitializeComponent() "Use current", "Create new", "Select existing"}); - this.cmbCertificate.Location = new System.Drawing.Point(122, 102); + this.cmbCertificate.Location = new System.Drawing.Point(131, 181); this.cmbCertificate.MaxDropDownItems = 20; this.cmbCertificate.Name = "cmbCertificate"; this.cmbCertificate.Size = new System.Drawing.Size(184, 21); this.cmbCertificate.TabIndex = 7; // - // txtCertName - // - this.txtCertName.Location = new System.Drawing.Point(122, 129); - this.txtCertName.Name = "txtCertName"; - this.txtCertName.Size = new System.Drawing.Size(184, 20); - this.txtCertName.TabIndex = 8; - // - // bttSelectCert + // label6 // - this.bttSelectCert.Location = new System.Drawing.Point(312, 129); - this.bttSelectCert.Name = "bttSelectCert"; - this.bttSelectCert.Size = new System.Drawing.Size(32, 23); - this.bttSelectCert.TabIndex = 9; - this.bttSelectCert.Text = "..."; - this.bttSelectCert.UseVisualStyleBackColor = true; + this.label6.AutoSize = true; + this.label6.Location = new System.Drawing.Point(12, 184); + this.label6.Name = "label6"; + this.label6.Size = new System.Drawing.Size(57, 13); + this.label6.TabIndex = 6; + this.label6.Text = "Certificate:"; // - // bttRefreshCert + // txtLog // - this.bttRefreshCert.Location = new System.Drawing.Point(312, 127); - this.bttRefreshCert.Name = "bttRefreshCert"; - this.bttRefreshCert.Size = new System.Drawing.Size(75, 23); - this.bttRefreshCert.TabIndex = 10; - this.bttRefreshCert.Text = "&Refresh"; - this.bttRefreshCert.UseVisualStyleBackColor = true; + this.txtLog.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.txtLog.Location = new System.Drawing.Point(12, 390); + this.txtLog.Multiline = true; + this.txtLog.Name = "txtLog"; + this.txtLog.ReadOnly = true; + this.txtLog.ScrollBars = System.Windows.Forms.ScrollBars.Vertical; + this.txtLog.Size = new System.Drawing.Size(537, 100); + this.txtLog.TabIndex = 2; // // bttCancel // this.bttCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.bttCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel; - this.bttCancel.Location = new System.Drawing.Point(474, 458); + this.bttCancel.Location = new System.Drawing.Point(474, 496); this.bttCancel.Name = "bttCancel"; this.bttCancel.Size = new System.Drawing.Size(75, 23); this.bttCancel.TabIndex = 4; this.bttCancel.Text = "Ca&ncel"; this.bttCancel.UseVisualStyleBackColor = true; - this.bttCancel.Click += new System.EventHandler(this.bttOK_Click); + // + // groupBox3 + // + this.groupBox3.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.groupBox3.Location = new System.Drawing.Point(12, 297); + this.groupBox3.Name = "groupBox3"; + this.groupBox3.Size = new System.Drawing.Size(537, 87); + this.groupBox3.TabIndex = 5; + this.groupBox3.TabStop = false; + this.groupBox3.Text = "BlackBerry PlayBook"; // // RegistrationForm // @@ -269,12 +267,12 @@ private void InitializeComponent() this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.CancelButton = this.bttCancel; - this.ClientSize = new System.Drawing.Size(561, 493); + this.ClientSize = new System.Drawing.Size(561, 531); + this.Controls.Add(this.groupBox3); this.Controls.Add(this.txtLog); this.Controls.Add(this.groupBox2); this.Controls.Add(this.bttCancel); this.Controls.Add(this.bttOK); - this.Controls.Add(this.groupBox1); this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; this.MaximizeBox = false; this.MinimizeBox = false; @@ -283,7 +281,6 @@ private void InitializeComponent() this.ShowInTaskbar = false; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; this.Text = "Registration Form"; - this.groupBox1.ResumeLayout(false); this.groupBox2.ResumeLayout(false); this.groupBox2.PerformLayout(); this.ResumeLayout(false); @@ -293,7 +290,6 @@ private void InitializeComponent() #endregion - private System.Windows.Forms.GroupBox groupBox1; private System.Windows.Forms.Button bttOK; private System.Windows.Forms.TextBox txtPassword; private System.Windows.Forms.Label label3; @@ -313,5 +309,6 @@ private void InitializeComponent() private System.Windows.Forms.ComboBox cmbCertificate; private System.Windows.Forms.Label label6; private System.Windows.Forms.Button bttCancel; + private System.Windows.Forms.GroupBox groupBox3; } } \ No newline at end of file From 2fe4227186ecf9b82ba5558e950299e1df544c68 Mon Sep 17 00:00:00 2001 From: Pawel Hofman Date: Thu, 29 May 2014 04:34:25 +0200 Subject: [PATCH 131/851] Improving signing/registration UI and flow --- .../VSNDK.Package/Model/CskTokenInfo.cs | 45 +++ .../VSNDK.Package/Options/DialogHelper.cs | 17 + .../Dialogs/CskRequestForm.Designer.cs | 6 +- .../Options/Dialogs/CskRequestForm.cs | 8 +- .../Dialogs/RegistrationForm.Designer.cs | 297 +++++++++++++++--- .../Options/Dialogs/RegistrationForm.cs | 221 ++++++++++++- .../Options/Dialogs/RegistrationForm.resx | 3 + .../Options/SigningOptionControl.Designer.cs | 13 + .../Options/SigningOptionControl.cs | 39 +-- .../ViewModels/DeveloperDefinition.cs | 163 ++++++++-- 10 files changed, 695 insertions(+), 117 deletions(-) diff --git a/src_vs2012/VSNDK.Package/Model/CskTokenInfo.cs b/src_vs2012/VSNDK.Package/Model/CskTokenInfo.cs index 0c1f9736..d0fe934d 100644 --- a/src_vs2012/VSNDK.Package/Model/CskTokenInfo.cs +++ b/src_vs2012/VSNDK.Package/Model/CskTokenInfo.cs @@ -33,12 +33,56 @@ public string Content private set; } + public bool HasContent + { + get { return !string.IsNullOrEmpty(Content); } + } + public DateTime CreatedAt { get; private set; } + public DateTime ValidTo + { + get; + private set; + } + + /// + /// Gets an indication, if the token is still valid. + /// + public bool IsValid + { + get { return DateTime.UtcNow < ValidTo; } + } + + /// + /// Gets the string representation of the validation date. + /// + public string ValidDateString + { + get { return ValidTo.ToString("dd-MM-yyyy"); } + } + + /// + /// Gets the number of days passed after the token validation date. + /// + public int ExpirationDays + { + get + { + if (IsValid) + return 0; + if (ValidTo == DateTime.MinValue) + return 365; + + var diff = DateTime.UtcNow - ValidTo; + return (int) diff.TotalDays; + } + } + public string HMAC { get; @@ -104,6 +148,7 @@ private static CskTokenInfo Parse(string text, CskTokenInfo result) if (CertificateInfo.TryParseDate(line.Substring(1), out date)) { result.CreatedAt = date; + result.ValidTo = date.Date.AddYears(1); // BBID token is valid only for one year! } } diff --git a/src_vs2012/VSNDK.Package/Options/DialogHelper.cs b/src_vs2012/VSNDK.Package/Options/DialogHelper.cs index aa941e1c..6e4f4b54 100644 --- a/src_vs2012/VSNDK.Package/Options/DialogHelper.cs +++ b/src_vs2012/VSNDK.Package/Options/DialogHelper.cs @@ -57,6 +57,23 @@ public static OpenFileDialog OpenCertFile(string startupPath) return openFile; } + /// + /// Returns preconfigured window for opening CSJ files. + /// + public static OpenFileDialog OpenCsjFile(string startupPath, string title) + { + var openFile = new OpenFileDialog(); + openFile.Title = title ?? "Opening CSJ file"; + openFile.InitialDirectory = startupPath; + openFile.DefaultExt = ".csj"; + openFile.Filter = "Code Signing files|*.csj;*.csk|Certificate files|*.p12|All files|*.*"; + openFile.FilterIndex = 0; + openFile.CheckFileExists = true; + openFile.CheckPathExists = true; + + return openFile; + } + /// /// Returns preconfigured window for saving BAR file. /// diff --git a/src_vs2012/VSNDK.Package/Options/Dialogs/CskRequestForm.Designer.cs b/src_vs2012/VSNDK.Package/Options/Dialogs/CskRequestForm.Designer.cs index 75789688..db29e3bd 100644 --- a/src_vs2012/VSNDK.Package/Options/Dialogs/CskRequestForm.Designer.cs +++ b/src_vs2012/VSNDK.Package/Options/Dialogs/CskRequestForm.Designer.cs @@ -30,7 +30,7 @@ protected override void Dispose(bool disposing) /// private void InitializeComponent() { - this.webBrowser = new WebBrowserTurbo(); + this.webBrowser = new RIM.VSNDK_Package.Model.Integration.WebBrowserTurbo(); this.SuspendLayout(); // // webBrowser @@ -42,7 +42,7 @@ private void InitializeComponent() this.webBrowser.Size = new System.Drawing.Size(739, 424); this.webBrowser.TabIndex = 0; // - // LoginForm + // CskRequestForm // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; @@ -53,7 +53,7 @@ private void InitializeComponent() this.ShowIcon = false; this.ShowInTaskbar = false; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; - this.Text = "Sign-in to create and download BlackBerry ID token"; + this.Text = "Request BlackBerry ID token"; this.ResumeLayout(false); } diff --git a/src_vs2012/VSNDK.Package/Options/Dialogs/CskRequestForm.cs b/src_vs2012/VSNDK.Package/Options/Dialogs/CskRequestForm.cs index 0f27ac28..91bba109 100644 --- a/src_vs2012/VSNDK.Package/Options/Dialogs/CskRequestForm.cs +++ b/src_vs2012/VSNDK.Package/Options/Dialogs/CskRequestForm.cs @@ -3,6 +3,8 @@ using System.Text; using System.Web; using System.Windows.Forms; +using RIM.VSNDK_Package.Diagnostics; +using RIM.VSNDK_Package.Model; using RIM.VSNDK_Package.Model.Integration; namespace RIM.VSNDK_Package.Options.Dialogs @@ -32,7 +34,7 @@ public int StatusCode private set; } - public string CskData + public CskTokenInfo Token { get; private set; @@ -57,6 +59,8 @@ private void OnNavigatingError(object sender, WebBrowserNavigateErrorEventArgs e e.Cancel = true; Invoke(new Action(RequestFailed)); + + TraceLog.WarnLine("Error {0}, while loading URL: \"{1}\"", e.StatusCode, e.Url); } /// @@ -73,7 +77,7 @@ private void OnBeforeNavigating(object sender, WebBrowserBeforeNavigatingEventAr data[i] = HttpUtility.UrlDecode(data[i]); StatusCode = 200; - CskData = FindContentFor(data, "cskData="); + Token = new CskTokenInfo(FindContentFor(data, "cskData=")); e.Cancel = true; // And close the form diff --git a/src_vs2012/VSNDK.Package/Options/Dialogs/RegistrationForm.Designer.cs b/src_vs2012/VSNDK.Package/Options/Dialogs/RegistrationForm.Designer.cs index e1368558..ea25b379 100644 --- a/src_vs2012/VSNDK.Package/Options/Dialogs/RegistrationForm.Designer.cs +++ b/src_vs2012/VSNDK.Package/Options/Dialogs/RegistrationForm.Designer.cs @@ -47,9 +47,26 @@ private void InitializeComponent() this.cmbCertificate = new System.Windows.Forms.ComboBox(); this.label6 = new System.Windows.Forms.Label(); this.txtLog = new System.Windows.Forms.TextBox(); - this.bttCancel = new System.Windows.Forms.Button(); this.groupBox3 = new System.Windows.Forms.GroupBox(); + this.lblTabletRegistration = new System.Windows.Forms.Label(); + this.label13 = new System.Windows.Forms.Label(); + this.lnkMoreInfo = new System.Windows.Forms.LinkLabel(); + this.txtCskConfirmPassword = new System.Windows.Forms.TextBox(); + this.txtCskPassword = new System.Windows.Forms.TextBox(); + this.label11 = new System.Windows.Forms.Label(); + this.txtCsjPin = new System.Windows.Forms.TextBox(); + this.label10 = new System.Windows.Forms.Label(); + this.txtPbdtPath = new System.Windows.Forms.TextBox(); + this.label9 = new System.Windows.Forms.Label(); + this.bttPbdtNavigate = new System.Windows.Forms.Button(); + this.bttRdkNavigate = new System.Windows.Forms.Button(); + this.bttCreateSigner = new System.Windows.Forms.Button(); + this.txtRdkPath = new System.Windows.Forms.TextBox(); + this.label8 = new System.Windows.Forms.Label(); + this.label7 = new System.Windows.Forms.Label(); + this.label12 = new System.Windows.Forms.Label(); this.groupBox2.SuspendLayout(); + this.groupBox3.SuspendLayout(); this.SuspendLayout(); // // label1 @@ -58,10 +75,9 @@ private void InitializeComponent() | System.Windows.Forms.AnchorStyles.Right))); this.label1.Location = new System.Drawing.Point(12, 73); this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(519, 23); + this.label1.Size = new System.Drawing.Size(519, 33); this.label1.TabIndex = 1; - this.label1.Text = "To complete the registration both - BlackBerry ID token and developer certificate" + - " - are required."; + this.label1.Text = resources.GetString("label1.Text"); // // label4 // @@ -75,16 +91,17 @@ private void InitializeComponent() // // txtPassword // - this.txtPassword.Location = new System.Drawing.Point(131, 129); + this.txtPassword.Location = new System.Drawing.Point(131, 144); this.txtPassword.Name = "txtPassword"; this.txtPassword.PasswordChar = '*'; this.txtPassword.Size = new System.Drawing.Size(113, 20); this.txtPassword.TabIndex = 3; + this.txtPassword.TextChanged += new System.EventHandler(this.txtPassword_TextChanged); // // label3 // this.label3.AutoSize = true; - this.label3.Location = new System.Drawing.Point(12, 132); + this.label3.Location = new System.Drawing.Point(12, 147); this.label3.Name = "label3"; this.label3.Size = new System.Drawing.Size(56, 13); this.label3.TabIndex = 2; @@ -92,7 +109,7 @@ private void InitializeComponent() // // txtName // - this.txtName.Location = new System.Drawing.Point(131, 103); + this.txtName.Location = new System.Drawing.Point(131, 118); this.txtName.Name = "txtName"; this.txtName.Size = new System.Drawing.Size(184, 20); this.txtName.TabIndex = 1; @@ -100,26 +117,26 @@ private void InitializeComponent() // label2 // this.label2.AutoSize = true; - this.label2.Location = new System.Drawing.Point(12, 106); + this.label2.Location = new System.Drawing.Point(12, 121); this.label2.Name = "label2"; - this.label2.Size = new System.Drawing.Size(70, 13); + this.label2.Size = new System.Drawing.Size(72, 13); this.label2.TabIndex = 0; - this.label2.Text = "Author name:"; + this.label2.Text = "Author Name:"; // // bttOK // this.bttOK.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this.bttOK.Location = new System.Drawing.Point(393, 496); + this.bttOK.DialogResult = System.Windows.Forms.DialogResult.OK; + this.bttOK.Location = new System.Drawing.Point(1017, 398); this.bttOK.Name = "bttOK"; this.bttOK.Size = new System.Drawing.Size(75, 23); this.bttOK.TabIndex = 3; this.bttOK.Text = "&OK"; this.bttOK.UseVisualStyleBackColor = true; - this.bttOK.Click += new System.EventHandler(this.bttOK_Click); // // txtConfirmPassword // - this.txtConfirmPassword.Location = new System.Drawing.Point(131, 155); + this.txtConfirmPassword.Location = new System.Drawing.Point(131, 170); this.txtConfirmPassword.Name = "txtConfirmPassword"; this.txtConfirmPassword.PasswordChar = '*'; this.txtConfirmPassword.Size = new System.Drawing.Size(113, 20); @@ -128,24 +145,25 @@ private void InitializeComponent() // label5 // this.label5.AutoSize = true; - this.label5.Location = new System.Drawing.Point(12, 158); + this.label5.Location = new System.Drawing.Point(12, 173); this.label5.Name = "label5"; - this.label5.Size = new System.Drawing.Size(93, 13); + this.label5.Size = new System.Drawing.Size(94, 13); this.label5.TabIndex = 4; - this.label5.Text = "Confirm password:"; + this.label5.Text = "Confirm Password:"; // // bttCreateToken // - this.bttCreateToken.Location = new System.Drawing.Point(15, 244); + this.bttCreateToken.Location = new System.Drawing.Point(15, 259); this.bttCreateToken.Name = "bttCreateToken"; this.bttCreateToken.Size = new System.Drawing.Size(110, 23); this.bttCreateToken.TabIndex = 11; this.bttCreateToken.Text = "Create &Token..."; this.bttCreateToken.UseVisualStyleBackColor = true; + this.bttCreateToken.Click += new System.EventHandler(this.bttCreateToken_Click); // // bttCreateCertificate // - this.bttCreateCertificate.Location = new System.Drawing.Point(131, 244); + this.bttCreateCertificate.Location = new System.Drawing.Point(131, 259); this.bttCreateCertificate.Name = "bttCreateCertificate"; this.bttCreateCertificate.Size = new System.Drawing.Size(110, 23); this.bttCreateCertificate.TabIndex = 12; @@ -154,9 +172,6 @@ private void InitializeComponent() // // groupBox2 // - this.groupBox2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.groupBox2.Controls.Add(this.label1); this.groupBox2.Controls.Add(this.bttRefreshCert); this.groupBox2.Controls.Add(this.label4); this.groupBox2.Controls.Add(this.bttSelectCert); @@ -171,16 +186,17 @@ private void InitializeComponent() this.groupBox2.Controls.Add(this.label5); this.groupBox2.Controls.Add(this.txtConfirmPassword); this.groupBox2.Controls.Add(this.txtPassword); + this.groupBox2.Controls.Add(this.label1); this.groupBox2.Location = new System.Drawing.Point(12, 12); this.groupBox2.Name = "groupBox2"; - this.groupBox2.Size = new System.Drawing.Size(537, 279); + this.groupBox2.Size = new System.Drawing.Size(537, 288); this.groupBox2.TabIndex = 1; this.groupBox2.TabStop = false; this.groupBox2.Text = "BlackBerry 10 Devices"; // // bttRefreshCert // - this.bttRefreshCert.Location = new System.Drawing.Point(321, 208); + this.bttRefreshCert.Location = new System.Drawing.Point(321, 223); this.bttRefreshCert.Name = "bttRefreshCert"; this.bttRefreshCert.Size = new System.Drawing.Size(75, 23); this.bttRefreshCert.TabIndex = 10; @@ -189,7 +205,7 @@ private void InitializeComponent() // // bttSelectCert // - this.bttSelectCert.Location = new System.Drawing.Point(321, 208); + this.bttSelectCert.Location = new System.Drawing.Point(321, 223); this.bttSelectCert.Name = "bttSelectCert"; this.bttSelectCert.Size = new System.Drawing.Size(32, 23); this.bttSelectCert.TabIndex = 9; @@ -198,7 +214,7 @@ private void InitializeComponent() // // txtCertName // - this.txtCertName.Location = new System.Drawing.Point(131, 208); + this.txtCertName.Location = new System.Drawing.Point(131, 223); this.txtCertName.Name = "txtCertName"; this.txtCertName.Size = new System.Drawing.Size(184, 20); this.txtCertName.TabIndex = 8; @@ -211,7 +227,7 @@ private void InitializeComponent() "Use current", "Create new", "Select existing"}); - this.cmbCertificate.Location = new System.Drawing.Point(131, 181); + this.cmbCertificate.Location = new System.Drawing.Point(131, 196); this.cmbCertificate.MaxDropDownItems = 20; this.cmbCertificate.Name = "cmbCertificate"; this.cmbCertificate.Size = new System.Drawing.Size(184, 21); @@ -220,7 +236,7 @@ private void InitializeComponent() // label6 // this.label6.AutoSize = true; - this.label6.Location = new System.Drawing.Point(12, 184); + this.label6.Location = new System.Drawing.Point(12, 199); this.label6.Name = "label6"; this.label6.Size = new System.Drawing.Size(57, 13); this.label6.TabIndex = 6; @@ -231,47 +247,210 @@ private void InitializeComponent() this.txtLog.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); - this.txtLog.Location = new System.Drawing.Point(12, 390); + this.txtLog.Location = new System.Drawing.Point(12, 306); this.txtLog.Multiline = true; this.txtLog.Name = "txtLog"; this.txtLog.ReadOnly = true; this.txtLog.ScrollBars = System.Windows.Forms.ScrollBars.Vertical; - this.txtLog.Size = new System.Drawing.Size(537, 100); + this.txtLog.Size = new System.Drawing.Size(1080, 86); this.txtLog.TabIndex = 2; // - // bttCancel - // - this.bttCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this.bttCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel; - this.bttCancel.Location = new System.Drawing.Point(474, 496); - this.bttCancel.Name = "bttCancel"; - this.bttCancel.Size = new System.Drawing.Size(75, 23); - this.bttCancel.TabIndex = 4; - this.bttCancel.Text = "Ca&ncel"; - this.bttCancel.UseVisualStyleBackColor = true; - // // groupBox3 // - this.groupBox3.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.groupBox3.Location = new System.Drawing.Point(12, 297); + this.groupBox3.Controls.Add(this.lblTabletRegistration); + this.groupBox3.Controls.Add(this.label13); + this.groupBox3.Controls.Add(this.lnkMoreInfo); + this.groupBox3.Controls.Add(this.txtCskConfirmPassword); + this.groupBox3.Controls.Add(this.txtCskPassword); + this.groupBox3.Controls.Add(this.label11); + this.groupBox3.Controls.Add(this.txtCsjPin); + this.groupBox3.Controls.Add(this.label10); + this.groupBox3.Controls.Add(this.txtPbdtPath); + this.groupBox3.Controls.Add(this.label9); + this.groupBox3.Controls.Add(this.bttPbdtNavigate); + this.groupBox3.Controls.Add(this.bttRdkNavigate); + this.groupBox3.Controls.Add(this.bttCreateSigner); + this.groupBox3.Controls.Add(this.txtRdkPath); + this.groupBox3.Controls.Add(this.label8); + this.groupBox3.Controls.Add(this.label7); + this.groupBox3.Controls.Add(this.label12); + this.groupBox3.Location = new System.Drawing.Point(555, 12); this.groupBox3.Name = "groupBox3"; - this.groupBox3.Size = new System.Drawing.Size(537, 87); + this.groupBox3.Size = new System.Drawing.Size(537, 288); this.groupBox3.TabIndex = 5; this.groupBox3.TabStop = false; - this.groupBox3.Text = "BlackBerry PlayBook"; + this.groupBox3.Text = "BlackBerry Tablet"; + // + // lblTabletRegistration + // + this.lblTabletRegistration.AutoSize = true; + this.lblTabletRegistration.Location = new System.Drawing.Point(134, 264); + this.lblTabletRegistration.Name = "lblTabletRegistration"; + this.lblTabletRegistration.Size = new System.Drawing.Size(165, 13); + this.lblTabletRegistration.TabIndex = 13; + this.lblTabletRegistration.Text = "Registration has been completed."; + // + // label13 + // + this.label13.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.label13.Location = new System.Drawing.Point(15, 73); + this.label13.Name = "label13"; + this.label13.Size = new System.Drawing.Size(519, 36); + this.label13.TabIndex = 1; + this.label13.Text = "To complete the registration both - BlackBerry Signer and developer certificate -" + + " are required. Certificate will be created automatically here or at BlackBerry 1" + + "0 devices section on left."; + // + // lnkMoreInfo + // + this.lnkMoreInfo.AutoSize = true; + this.lnkMoreInfo.Location = new System.Drawing.Point(15, 54); + this.lnkMoreInfo.Name = "lnkMoreInfo"; + this.lnkMoreInfo.Size = new System.Drawing.Size(60, 13); + this.lnkMoreInfo.TabIndex = 12; + this.lnkMoreInfo.TabStop = true; + this.lnkMoreInfo.Text = "More info..."; + this.lnkMoreInfo.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.lnkMoreInfo_LinkClicked); + // + // txtCskConfirmPassword + // + this.txtCskConfirmPassword.Location = new System.Drawing.Point(134, 231); + this.txtCskConfirmPassword.Name = "txtCskConfirmPassword"; + this.txtCskConfirmPassword.PasswordChar = '*'; + this.txtCskConfirmPassword.Size = new System.Drawing.Size(113, 20); + this.txtCskConfirmPassword.TabIndex = 9; + // + // txtCskPassword + // + this.txtCskPassword.Location = new System.Drawing.Point(134, 205); + this.txtCskPassword.Name = "txtCskPassword"; + this.txtCskPassword.PasswordChar = '*'; + this.txtCskPassword.Size = new System.Drawing.Size(113, 20); + this.txtCskPassword.TabIndex = 9; + this.txtCskPassword.TextChanged += new System.EventHandler(this.txtCskPassword_TextChanged); + // + // label11 + // + this.label11.AutoSize = true; + this.label11.Location = new System.Drawing.Point(18, 208); + this.label11.Name = "label11"; + this.label11.Size = new System.Drawing.Size(80, 13); + this.label11.TabIndex = 8; + this.label11.Text = "CSK Password:"; + // + // txtCsjPin + // + this.txtCsjPin.Location = new System.Drawing.Point(134, 179); + this.txtCsjPin.Name = "txtCsjPin"; + this.txtCsjPin.PasswordChar = '*'; + this.txtCsjPin.Size = new System.Drawing.Size(113, 20); + this.txtCsjPin.TabIndex = 7; + // + // label10 + // + this.label10.AutoSize = true; + this.label10.Location = new System.Drawing.Point(18, 182); + this.label10.Name = "label10"; + this.label10.Size = new System.Drawing.Size(50, 13); + this.label10.TabIndex = 6; + this.label10.Text = "CSJ PIN:"; + // + // txtPbdtPath + // + this.txtPbdtPath.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.txtPbdtPath.Location = new System.Drawing.Point(134, 153); + this.txtPbdtPath.Name = "txtPbdtPath"; + this.txtPbdtPath.Size = new System.Drawing.Size(344, 20); + this.txtPbdtPath.TabIndex = 5; + // + // label9 + // + this.label9.AutoSize = true; + this.label9.Location = new System.Drawing.Point(18, 156); + this.label9.Name = "label9"; + this.label9.Size = new System.Drawing.Size(86, 13); + this.label9.TabIndex = 4; + this.label9.Text = "PBDT CSJ Path:"; + // + // bttPbdtNavigate + // + this.bttPbdtNavigate.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.bttPbdtNavigate.Location = new System.Drawing.Point(484, 153); + this.bttPbdtNavigate.Name = "bttPbdtNavigate"; + this.bttPbdtNavigate.Size = new System.Drawing.Size(38, 23); + this.bttPbdtNavigate.TabIndex = 3; + this.bttPbdtNavigate.Text = "..."; + this.bttPbdtNavigate.UseVisualStyleBackColor = true; + this.bttPbdtNavigate.Click += new System.EventHandler(this.bttPbdtNavigate_Click); + // + // bttRdkNavigate + // + this.bttRdkNavigate.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.bttRdkNavigate.Location = new System.Drawing.Point(484, 127); + this.bttRdkNavigate.Name = "bttRdkNavigate"; + this.bttRdkNavigate.Size = new System.Drawing.Size(38, 23); + this.bttRdkNavigate.TabIndex = 3; + this.bttRdkNavigate.Text = "..."; + this.bttRdkNavigate.UseVisualStyleBackColor = true; + this.bttRdkNavigate.Click += new System.EventHandler(this.bttRdkNavigate_Click); + // + // bttCreateSigner + // + this.bttCreateSigner.Location = new System.Drawing.Point(18, 259); + this.bttCreateSigner.Name = "bttCreateSigner"; + this.bttCreateSigner.Size = new System.Drawing.Size(110, 23); + this.bttCreateSigner.TabIndex = 11; + this.bttCreateSigner.Text = "&Create signer..."; + this.bttCreateSigner.UseVisualStyleBackColor = true; + this.bttCreateSigner.Click += new System.EventHandler(this.bttCreateSigner_Click); + // + // txtRdkPath + // + this.txtRdkPath.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.txtRdkPath.Location = new System.Drawing.Point(134, 127); + this.txtRdkPath.Name = "txtRdkPath"; + this.txtRdkPath.Size = new System.Drawing.Size(344, 20); + this.txtRdkPath.TabIndex = 2; + // + // label8 + // + this.label8.AutoSize = true; + this.label8.Location = new System.Drawing.Point(18, 130); + this.label8.Name = "label8"; + this.label8.Size = new System.Drawing.Size(80, 13); + this.label8.TabIndex = 1; + this.label8.Text = "RDK CSJ Path:"; + // + // label7 + // + this.label7.Location = new System.Drawing.Point(15, 20); + this.label7.Name = "label7"; + this.label7.Size = new System.Drawing.Size(516, 40); + this.label7.TabIndex = 0; + this.label7.Text = "Specify signing properties, that were submitted at BlackBerry CodeSigning page. Y" + + "ou should receive required RDK and PBDT files via email before."; + // + // label12 + // + this.label12.AutoSize = true; + this.label12.Location = new System.Drawing.Point(18, 234); + this.label12.Name = "label12"; + this.label12.Size = new System.Drawing.Size(94, 13); + this.label12.TabIndex = 4; + this.label12.Text = "Confirm Password:"; // // RegistrationForm // this.AcceptButton = this.bttOK; this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.CancelButton = this.bttCancel; - this.ClientSize = new System.Drawing.Size(561, 531); + this.ClientSize = new System.Drawing.Size(1104, 433); this.Controls.Add(this.groupBox3); this.Controls.Add(this.txtLog); this.Controls.Add(this.groupBox2); - this.Controls.Add(this.bttCancel); this.Controls.Add(this.bttOK); this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; this.MaximizeBox = false; @@ -280,9 +459,11 @@ private void InitializeComponent() this.ShowIcon = false; this.ShowInTaskbar = false; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; - this.Text = "Registration Form"; + this.Text = "Developer Registration Form"; this.groupBox2.ResumeLayout(false); this.groupBox2.PerformLayout(); + this.groupBox3.ResumeLayout(false); + this.groupBox3.PerformLayout(); this.ResumeLayout(false); this.PerformLayout(); @@ -308,7 +489,23 @@ private void InitializeComponent() private System.Windows.Forms.TextBox txtCertName; private System.Windows.Forms.ComboBox cmbCertificate; private System.Windows.Forms.Label label6; - private System.Windows.Forms.Button bttCancel; private System.Windows.Forms.GroupBox groupBox3; + private System.Windows.Forms.LinkLabel lnkMoreInfo; + private System.Windows.Forms.TextBox txtCskConfirmPassword; + private System.Windows.Forms.TextBox txtCskPassword; + private System.Windows.Forms.Label label11; + private System.Windows.Forms.TextBox txtCsjPin; + private System.Windows.Forms.Label label10; + private System.Windows.Forms.TextBox txtPbdtPath; + private System.Windows.Forms.Label label9; + private System.Windows.Forms.Button bttPbdtNavigate; + private System.Windows.Forms.Button bttRdkNavigate; + private System.Windows.Forms.Button bttCreateSigner; + private System.Windows.Forms.TextBox txtRdkPath; + private System.Windows.Forms.Label label8; + private System.Windows.Forms.Label label7; + private System.Windows.Forms.Label label12; + private System.Windows.Forms.Label label13; + private System.Windows.Forms.Label lblTabletRegistration; } } \ No newline at end of file diff --git a/src_vs2012/VSNDK.Package/Options/Dialogs/RegistrationForm.cs b/src_vs2012/VSNDK.Package/Options/Dialogs/RegistrationForm.cs index 246f0282..11c6ca62 100644 --- a/src_vs2012/VSNDK.Package/Options/Dialogs/RegistrationForm.cs +++ b/src_vs2012/VSNDK.Package/Options/Dialogs/RegistrationForm.cs @@ -1,13 +1,27 @@ using System; +using System.IO; using System.Windows.Forms; +using RIM.VSNDK_Package.ViewModels; namespace RIM.VSNDK_Package.Options.Dialogs { public partial class RegistrationForm : Form { - public RegistrationForm() + private const string ValidationCaption = "Validation"; + private readonly DeveloperDefinition _developer; + + internal RegistrationForm(DeveloperDefinition developer) { + if (developer == null) + throw new ArgumentNullException("developer"); + _developer = developer; + InitializeComponent(); + + Password = _developer.CskPassword; + AuthorName = _developer.Name; + + UpdateUI(); } #region Properties @@ -18,36 +32,217 @@ public string AuthorName set { txtName.Text = value; } } - public string AuthorPassword + public string Password { get { return txtPassword.Text; } - set { txtPassword.Text = value; } + set + { + txtPassword.Text = value; + txtConfirmPassword.Text = value; + txtCskPassword.Text = value; + txtCskConfirmPassword.Text = value; + } } #endregion - private void bttOK_Click(object sender, EventArgs e) + #region Logging + + private void ClearLogs() + { + txtLog.Text = string.Empty; + } + + private void Log(string text) { - if (string.IsNullOrEmpty(AuthorName)) + if (InvokeRequired) { - MessageBoxHelper.Show("Name can't be empty. Please enter a meaningful text.", "Invalid name", MessageBoxButtons.OK, MessageBoxIcon.Error); + Invoke(new Action(Log), text); return; } - if (AuthorName.Trim().ToUpper().Contains("BLACKBERRY")) + txtLog.Text += text + Environment.NewLine; + } + + #endregion + + #region Input Checks + + /// + /// Checks for input password errors. Returns 'true', when all is OK. + /// + private bool CheckPassword(TextBox password, TextBox confirmation, string name) + { + if (string.IsNullOrEmpty(name)) + name = "Password"; + + if (password != null && string.IsNullOrEmpty(password.Text)) { - MessageBoxHelper.Show("\"BlackBerry\" is a reserved word and cannot be used as \"Author Name\"", "Invalid name", MessageBoxButtons.OK, MessageBoxIcon.Error); - return; + MessageBoxHelper.Show(name + " can not be empty", ValidationCaption, MessageBoxButtons.OK, MessageBoxIcon.Error); + ActiveControl = password; + return false; } - if (string.IsNullOrEmpty(AuthorPassword)) + if (password != null && confirmation != null + && string.Compare(password.Text, confirmation.Text, StringComparison.CurrentCulture) != 0) { - MessageBoxHelper.Show("Password can't be empty. Please enter any text.", "Invalid password", MessageBoxButtons.OK, MessageBoxIcon.Error); + MessageBoxHelper.Show(name + "s are not matching.", ValidationCaption, MessageBoxButtons.OK, MessageBoxIcon.Error); + ActiveControl = confirmation; + return false; + } + + return true; + } + + /// + /// Checks for input file name errors. Returns 'true', when all is OK. + /// + private bool CheckPath(TextBox path, string name) + { + if (string.IsNullOrEmpty(name)) + name = "file name"; + + if (path != null && string.IsNullOrEmpty(path.Text)) + { + MessageBoxHelper.Show("Specified " + name + " can not be empty", ValidationCaption, MessageBoxButtons.OK, MessageBoxIcon.Error); + ActiveControl = path; + return false; + } + + if (path != null && !File.Exists(path.Text)) + { + MessageBoxHelper.Show("Specified " + name + " does not exist. Ensure it points to the right file", ValidationCaption, MessageBoxButtons.OK, MessageBoxIcon.Error); + ActiveControl = path; + return false; + } + + return true; + } + + /// + /// Checks for author name's errors. Returns 'true', when all is OK. + /// + private bool CheckName(TextBox author) + { + if (string.IsNullOrEmpty(author.Text)) + { + MessageBoxHelper.Show("Author Name can not be empty. Please enter a meaningful text.", ValidationCaption, MessageBoxButtons.OK, MessageBoxIcon.Error); + ActiveControl = author; + return false; + } + + if (author.Text.Trim().ToUpper().Contains("BLACKBERRY")) + { + MessageBoxHelper.Show("\"BlackBerry\" is a reserved word and cannot be used as \"Author Name\"", ValidationCaption, MessageBoxButtons.OK, MessageBoxIcon.Error); + ActiveControl = author; + return false; + } + + return true; + } + + #endregion + + private void UpdateUI() + { + // tablet section: + bool tabletRegistered = _developer.IsTabletRegistered; + + lblTabletRegistration.Visible = tabletRegistered; + + bttCreateSigner.Enabled = !tabletRegistered; + txtRdkPath.Enabled = bttRdkNavigate.Enabled = !tabletRegistered; + txtPbdtPath.Enabled = bttPbdtNavigate.Enabled = !tabletRegistered; + txtCsjPin.Enabled = txtCskPassword.Enabled = txtCskConfirmPassword.Enabled = !tabletRegistered; + + // BB10 devices section: + + } + + private void txtPassword_TextChanged(object sender, EventArgs e) + { + txtConfirmPassword.Text = string.Empty; + txtCskPassword.Text = txtPassword.Text; + } + + private void txtCskPassword_TextChanged(object sender, EventArgs e) + { + txtCskConfirmPassword.Text = string.Empty; + txtPassword.Text = txtCskPassword.Text; + } + + private void bttCreateToken_Click(object sender, EventArgs e) + { + if (!CheckPassword(txtPassword, txtConfirmPassword, null)) return; + + if (File.Exists(_developer.CskTokenFullPath)) + { + // confirm overwrite operation: + if (MessageBoxHelper.Show("Overwrite existing BlackBerry ID token?", null, MessageBoxButtons.YesNo, MessageBoxIcon.Question) != DialogResult.Yes) + return; + } + + // show token request form: + var form = new CskRequestForm(null); + form.StartRequest(txtPassword.Text); + + if (form.ShowDialog() == DialogResult.OK) + { + // got the token, so save it in respective location: + _developer.SaveCskToken(form.Token); + + // log it: + Log("Created BlackBerry ID token - valid until " + form.Token.ValidDateString); + } + else + { + if (form.StatusCode != 0) + { + MessageBoxHelper.Show("Failed to obtain the BlackBerry ID token from Security Authority.\r\nPlease check your Internet connection", null, MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + + UpdateUI(); + } + + private void lnkMoreInfo_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) + { + DialogHelper.StartURL("http://www.blackberry.com/go/codesigning/"); + } + + private void bttRdkNavigate_Click(object sender, EventArgs e) + { + var form = DialogHelper.OpenCsjFile(_developer.DataPath, "Opening RDK file"); + + if (form.ShowDialog() == DialogResult.OK) + { + txtRdkPath.Text = form.FileName; + } + } + + private void bttPbdtNavigate_Click(object sender, EventArgs e) + { + var form = DialogHelper.OpenCsjFile(_developer.DataPath, "Opening PBDT file"); + + if (form.ShowDialog() == DialogResult.OK) + { + txtPbdtPath.Text = form.FileName; } + } - DialogResult = DialogResult.OK; - Close(); + private void bttCreateSigner_Click(object sender, EventArgs e) + { + if (!CheckPassword(txtCskPassword, txtCskConfirmPassword, null)) + return; + if (!CheckPassword(txtCsjPin, null, "PIN")) + return; + + // check paths: + if (!CheckPath(txtRdkPath, "RDK path")) + return; + if (!CheckPath(txtPbdtPath, "PBDT path")) + return; } } } diff --git a/src_vs2012/VSNDK.Package/Options/Dialogs/RegistrationForm.resx b/src_vs2012/VSNDK.Package/Options/Dialogs/RegistrationForm.resx index 59f68477..bca630d6 100644 --- a/src_vs2012/VSNDK.Package/Options/Dialogs/RegistrationForm.resx +++ b/src_vs2012/VSNDK.Package/Options/Dialogs/RegistrationForm.resx @@ -117,6 +117,9 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + To complete the registration both - BlackBerry ID token and developer certificate - are required. However if you created BlackBerry Signer at tablet's section, it can be also used to deploy and debug here. + Type the password to use with the BlackBerry token. The browser will open and you will be asked to create or login to your BlackBerry ID. Token can be used to sign applications and publish in BlackBerry AppWorld or to create debug-tokens, required for debugging purposes on real devices. diff --git a/src_vs2012/VSNDK.Package/Options/SigningOptionControl.Designer.cs b/src_vs2012/VSNDK.Package/Options/SigningOptionControl.Designer.cs index 8cb353c6..f2cd6d18 100644 --- a/src_vs2012/VSNDK.Package/Options/SigningOptionControl.Designer.cs +++ b/src_vs2012/VSNDK.Package/Options/SigningOptionControl.Designer.cs @@ -46,6 +46,7 @@ private void InitializeComponent() this.bttChangeCert = new System.Windows.Forms.Button(); this.bttNavigate = new System.Windows.Forms.Button(); this.label4 = new System.Windows.Forms.Label(); + this.lblStatus = new System.Windows.Forms.Label(); this.groupBox1.SuspendLayout(); this.groupBox2.SuspendLayout(); this.SuspendLayout(); @@ -54,6 +55,7 @@ private void InitializeComponent() // this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); + this.groupBox1.Controls.Add(this.lblStatus); this.groupBox1.Controls.Add(this.bttUnregister); this.groupBox1.Controls.Add(this.bttRegister); this.groupBox1.Controls.Add(this.lblMore); @@ -244,6 +246,16 @@ private void InitializeComponent() this.label4.TabIndex = 8; this.label4.Text = resources.GetString("label4.Text"); // + // lblStatus + // + this.lblStatus.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Right))); + this.lblStatus.Location = new System.Drawing.Point(234, 48); + this.lblStatus.Name = "lblStatus"; + this.lblStatus.Size = new System.Drawing.Size(156, 45); + this.lblStatus.TabIndex = 4; + this.lblStatus.TextAlign = System.Drawing.ContentAlignment.BottomLeft; + // // SigningOptionControl // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); @@ -279,5 +291,6 @@ private void InitializeComponent() private System.Windows.Forms.Button bttRestore; private System.Windows.Forms.Button bttRefresh; private System.Windows.Forms.Button bttChangeCert; + private System.Windows.Forms.Label lblStatus; } } diff --git a/src_vs2012/VSNDK.Package/Options/SigningOptionControl.cs b/src_vs2012/VSNDK.Package/Options/SigningOptionControl.cs index ef77c09a..f272adae 100644 --- a/src_vs2012/VSNDK.Package/Options/SigningOptionControl.cs +++ b/src_vs2012/VSNDK.Package/Options/SigningOptionControl.cs @@ -39,9 +39,10 @@ private void UpdateUI() CertificatePath = _vm.Developer.CertificateFileName; Author = _vm.Developer.Name; - bttRegister.Enabled = !_vm.Developer.IsRegistered; - bttUnregister.Enabled = !bttRegister.Enabled; - bttBackup.Enabled = bttUnregister.Enabled; + //bttRegister.Enabled = !_vm.Developer.IsRegistered; + //bttUnregister.Enabled = !bttRegister.Enabled; + //bttBackup.Enabled = bttUnregister.Enabled; + lblStatus.Text = _vm.Developer.ToShortStatusDescription(); bttNavigate.Enabled = !string.IsNullOrEmpty(CertificatePath); bttDeletePassword.Enabled = _vm.Developer.IsPasswordSaved; @@ -277,44 +278,20 @@ private void bttUnregister_Click(object sender, EventArgs e) private void bttRegister_Click(object sender, EventArgs e) { + /* if (_vm.Developer.IsRegistered) { MessageBoxHelper.Show("You are already registered, please unregister first, if you want to create new BlackBerry ID token!", "Registration", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } + */ /////////////////////////////// // REGISTER - var registrationForm = new RegistrationForm(); - - if (registrationForm.ShowDialog() == DialogResult.OK) - { - /* - var runner = new KeyToolGenRunner(RunnerDefaults.ToolsDirectory, registrationForm.AuthorName, registrationForm.AuthorPassword, null); - var success = runner.Execute(); - - // finally, show result message: - if (success && string.IsNullOrEmpty(runner.LastError)) - { - if (!string.IsNullOrEmpty(runner.LastOutput)) - { - MessageBoxHelper.Show(runner.LastOutput.Replace("CSK", "BB ID Token"), "Registered developer profile", MessageBoxButtons.OK, MessageBoxIcon.Information); - } - } - else - { - // clean-up files, in case something went wrong: - _vm.Developer.CleanupProfile(); - - if (!string.IsNullOrEmpty(runner.LastError)) - { - MessageBoxHelper.Show(runner.LastError, "Failed to create developer profile", MessageBoxButtons.OK, MessageBoxIcon.Error); - } - } - */ - } + var registrationForm = new RegistrationForm(_vm.Developer); + registrationForm.ShowDialog(); UpdateUI(); } diff --git a/src_vs2012/VSNDK.Package/ViewModels/DeveloperDefinition.cs b/src_vs2012/VSNDK.Package/ViewModels/DeveloperDefinition.cs index 2605a144..2baeacef 100644 --- a/src_vs2012/VSNDK.Package/ViewModels/DeveloperDefinition.cs +++ b/src_vs2012/VSNDK.Package/ViewModels/DeveloperDefinition.cs @@ -1,8 +1,10 @@ using System; using System.IO; using System.IO.Packaging; +using System.Text; using Microsoft.Win32; using RIM.VSNDK_Package.Diagnostics; +using RIM.VSNDK_Package.Model; using RIM.VSNDK_Package.Tools; namespace RIM.VSNDK_Package.ViewModels @@ -16,11 +18,15 @@ internal sealed class DeveloperDefinition /// Default name of the certificate file. /// internal const string DefaultCertificateName = "author.p12"; - private const string DefaultCskName = "bbidtoken.csk"; + private const string DefaultCskTokenName = "bbidtoken.csk"; + private const string DefaultTabletSignerName = "barsigner.db"; + private const string DefaultTabletCskTokenName = "barsigner.csk"; private const string FieldCertificateFileName = "certificate"; private const string FieldCskPassword = "CSKPass"; private string _name; + private CskTokenInfo _cskToken; + private CskTokenInfo _cskTabletToken; public DeveloperDefinition(string dataPath, string certificatePath, string cskPassword) { @@ -89,9 +95,71 @@ public string CertificateFullPath /// /// Gets full path to the BlackBerry ID token file (bbidtoken.csk). /// - public string BlackBerryTokenFullPath + public string CskTokenFullPath { - get { return Path.Combine(DataPath, DefaultCskName); } + get { return Path.Combine(DataPath, DefaultCskTokenName); } + } + + /// + /// Gets full path do the BlackBerry Tablet Signer Authority file (barsigner.db). + /// + public string TabletSignerFullPath + { + get { return Path.Combine(DataPath, DefaultTabletSignerName); } + } + + /// + /// Gets full path to the BlackBerry Tablet CSK token file (barsigner.csk). + /// + public string TabletCskTokenFullPath + { + get { return Path.Combine(DataPath, DefaultTabletCskTokenName); } + } + + /// + /// Gets the BlackBerry ID token information. + /// + public CskTokenInfo Token + { + get + { + if (_cskToken == null) + _cskToken = CskTokenInfo.Load(CskTokenFullPath); + + return _cskToken; + } + private set { _cskToken = value; } + } + + /// + /// Gets the BlackBerry Tablet token information. + /// + public CskTokenInfo TabletToken + { + get + { + if (_cskTabletToken == null) + _cskTabletToken = CskTokenInfo.Load(TabletCskTokenFullPath); + + return _cskTabletToken; + } + private set { _cskTabletToken = value; } + } + + /// + /// Gets an indication, if BlackBerry ID token exists. + /// + public bool HasToken + { + get { return File.Exists(CskTokenFullPath) && Token != null; } + } + + /// + /// Gets an indication, if BlackBerry Tablet token exists. + /// + public bool HasTabletToken + { + get { return File.Exists(TabletCskTokenFullPath) && TabletToken != null; } } /// @@ -116,19 +184,28 @@ public bool HasPassword /// public bool IsRegistered { - get { return !string.IsNullOrEmpty(CertificateFileName) && File.Exists(CertificateFullPath) && File.Exists(BlackBerryTokenFullPath); } + get { return !string.IsNullOrEmpty(CertificateFileName) && File.Exists(CertificateFullPath) && File.Exists(CskTokenFullPath); } } /// - /// Checks if developer started registration and downloaded token file. + /// Checks if developer completed tablet registration. /// - public bool HasBlackBerryTokenFile + public bool IsTabletRegistered { - get { return File.Exists(BlackBerryTokenFullPath); } + get { return !string.IsNullOrEmpty(CertificateFileName) && File.Exists(CertificateFullPath) && File.Exists(TabletSignerFullPath) && File.Exists(TabletCskTokenFullPath); } } #endregion + /// + /// Invalidates loaded CSK tokens to force them load from disk again. + /// + public void InvalidateTokens() + { + Token = null; + TabletToken = null; + } + /// /// Updates stored CSK password to a new value. /// @@ -417,11 +494,12 @@ public static string LoadIssuer(string certificateFileName, string password) /// private string[] GetProfileFiles() { - return new[] { CertificateFileName, "bbidtoken.csk", "barsigner.db", - "bbsigner.csk", "bb_id_rsa", "bb_id_rsa.pub", + return new[] { CertificateFileName, DefaultCskTokenName, "bbsigner.csk", + "bb_id_rsa", "bb_id_rsa.pub", - // PH: TODO: but I have also files: for tablets? - "barsigner.csk", "bbt_id_rsa", "bbt_id_rsa.pub"}; + // and files for PlayBook tablet: + DefaultTabletCskTokenName, DefaultTabletSignerName, + "bbt_id_rsa", "bbt_id_rsa.pub"}; } /// @@ -505,6 +583,7 @@ public bool RestoreProfile(string inputFile) { // make the password invalid: DeletePassword(); + Token = null; // extract all files that are within the backup package: using (var package = Package.Open(inputFile, FileMode.Open, FileAccess.ReadWrite)) @@ -571,19 +650,20 @@ public static string ExtractFile(PackagePart part, string folder) /// /// Writes a BlackBerry ID token file. /// - public void SaveBlackBerryToken(string content) + public void SaveCskToken(CskTokenInfo token) { - if (string.IsNullOrEmpty(content)) - throw new ArgumentNullException("content"); + // update stored token in memory: + Token = token; - var fileName = BlackBerryTokenFullPath; + // and on disk: + var fileName = CskTokenFullPath; if (File.Exists(fileName)) File.Delete(fileName); - if (!string.IsNullOrEmpty(content)) + if (token.HasContent) { - File.WriteAllText(fileName, content); + File.WriteAllText(fileName, token.Content); } } @@ -606,6 +686,7 @@ public void DeleteProfile() ClearPassword(); CertificateFileName = null; Name = null; + Token = null; } /// @@ -613,10 +694,56 @@ public void DeleteProfile() /// public void CleanupProfile() { - if (!IsRegistered) + // if there is no certificate file, means all generators failed, + // so remove all other remaining files... + if (!File.Exists(CertificateFullPath)) { DeleteProfile(); } } + + /// + /// Gets long description in human readable format. + /// + public string ToLongStatusDescription() + { + var result = new StringBuilder(); + + result.AppendLine("Status:"); + result.Append(" * BlackBerry 10 - ").AppendLine(IsRegistered ? "registered" : (IsTabletRegistered ? "using tablet certificates" : "not registered")); + if (HasToken) + { + if (Token.IsValid) + result.Append(" > token expires at ").AppendLine(Token.ValidDateString); + else + result.Append(" > token expired ").Append(Token.ExpirationDays).AppendLine(" days ago"); + } + result.Append(" * PlayBook - ").AppendLine(IsTabletRegistered ? "registered" : "not registered"); + + if (IsPasswordSaved) + result.AppendLine(" * password is stored"); + + return result.ToString(); + } + + /// + /// Gets short description in human readable format. + /// + public string ToShortStatusDescription() + { + var result = new StringBuilder(); + + result.Append("BB10: ").AppendLine(IsRegistered ? "registered" : (IsTabletRegistered ? "using tablet certificates" : "not registered")); + if (HasToken) + { + if (Token.IsValid) + result.Append(" (token expires at ").Append(Token.ValidDateString).AppendLine(")"); + else + result.Append(" (token expired ").Append(Token.ExpirationDays).AppendLine(" days ago)"); + } + result.Append("PlayBook: ").Append(IsTabletRegistered ? "registered" : "not registered"); + + return result.ToString(); + } } } From 42e348c63a414ac3e22117ae8099b79764a9652e Mon Sep 17 00:00:00 2001 From: Pawel Hofman Date: Thu, 29 May 2014 11:32:19 +0200 Subject: [PATCH 132/851] Added error message, when trying to deploy debug-token for missing device --- .../Dialogs/DebugTokenDeploymentForm.cs | 4 +- .../Options/TargetsOptionControl.cs | 40 +++++++++++-------- 2 files changed, 27 insertions(+), 17 deletions(-) diff --git a/src_vs2012/VSNDK.Package/Options/Dialogs/DebugTokenDeploymentForm.cs b/src_vs2012/VSNDK.Package/Options/Dialogs/DebugTokenDeploymentForm.cs index 6bdaf3a0..b29fe944 100644 --- a/src_vs2012/VSNDK.Package/Options/Dialogs/DebugTokenDeploymentForm.cs +++ b/src_vs2012/VSNDK.Package/Options/Dialogs/DebugTokenDeploymentForm.cs @@ -21,12 +21,14 @@ internal partial class DebugTokenDeploymentForm : Form private DebugTokenInfo _tokenInfo; private bool _startup; - public DebugTokenDeploymentForm() + public DebugTokenDeploymentForm(TargetsOptionViewModel vm, DeviceDefinition device) { InitializeComponent(); ErrorText = string.Empty; _startup = true; + + SetVM(vm, device); } protected override void OnShown(EventArgs e) diff --git a/src_vs2012/VSNDK.Package/Options/TargetsOptionControl.cs b/src_vs2012/VSNDK.Package/Options/TargetsOptionControl.cs index f8eb88fe..38e24823 100644 --- a/src_vs2012/VSNDK.Package/Options/TargetsOptionControl.cs +++ b/src_vs2012/VSNDK.Package/Options/TargetsOptionControl.cs @@ -1,5 +1,4 @@ using System; -using System.Diagnostics; using System.Windows.Forms; using RIM.VSNDK_Package.Options.Dialogs; using RIM.VSNDK_Package.ViewModels; @@ -35,7 +34,7 @@ private DeviceDefinition SelectedDevice private void PopulateDevices() { listTargets.Items.Clear(); - + foreach (var device in _vm.Devices) { var item = new ListViewItem(); @@ -49,6 +48,10 @@ private void PopulateDevices() } bttDebugToken.Enabled = _vm.RealDevicesCount > 0; + + // select first item: + if (listTargets.Items.Count > 0) + listTargets.Items[0].Selected = true; } private void lnkMoreInfo_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) @@ -56,7 +59,7 @@ private void lnkMoreInfo_LinkClicked(object sender, LinkLabelLinkClickedEventArg DialogHelper.StartURL("http://developer.blackberry.com/native/documentation/cascades/getting_started/setting_up.html"); } - private void listTargets_SelectedIndexChanged(object sender, System.EventArgs e) + private void listTargets_SelectedIndexChanged(object sender, EventArgs e) { var device = SelectedDevice; @@ -69,7 +72,7 @@ private void listTargets_SelectedIndexChanged(object sender, System.EventArgs e) bttDebugToken.Enabled = _vm.RealDevicesCount > 0 && device != null; } - private void listTargets_DoubleClick(object sender, System.EventArgs e) + private void listTargets_DoubleClick(object sender, EventArgs e) { if (SelectedDevice != null) { @@ -77,7 +80,7 @@ private void listTargets_DoubleClick(object sender, System.EventArgs e) } } - private void bttAdd_Click(object sender, System.EventArgs e) + private void bttAdd_Click(object sender, EventArgs e) { var form = new DeviceForm("Add new Target Device"); @@ -88,7 +91,7 @@ private void bttAdd_Click(object sender, System.EventArgs e) } } - private void bttEdit_Click(object sender, System.EventArgs e) + private void bttEdit_Click(object sender, EventArgs e) { var form = new DeviceForm("Edit Target Device"); var device = SelectedDevice; @@ -101,13 +104,13 @@ private void bttEdit_Click(object sender, System.EventArgs e) } } - private void bttActivate_Click(object sender, System.EventArgs e) + private void bttActivate_Click(object sender, EventArgs e) { _vm.SetActive(SelectedDevice); PopulateDevices(); } - private void bttRemove_Click(object sender, System.EventArgs e) + private void bttRemove_Click(object sender, EventArgs e) { var device = SelectedDevice; @@ -121,21 +124,26 @@ private void bttRemove_Click(object sender, System.EventArgs e) } } - private void bttDebugToken_Click(object sender, System.EventArgs e) + private void bttDebugToken_Click(object sender, EventArgs e) { var device = SelectedDevice ?? _vm.ActiveDevice; if (device != null && device.Type != DeviceDefinitionType.Device) device = null; - var form = new DebugTokenDeploymentForm(); - form.SetVM(_vm, device); - form.AskOnStartup = false; - - form.ShowDialog(); + if (device != null) + { + var form = new DebugTokenDeploymentForm(_vm, device); + form.AskOnStartup = false; + form.ShowDialog(); - // refresh the list, as it's possible to add new device from debug-token deployment form: - PopulateDevices(); + // refresh the list, as it's possible to add new device from debug-token deployment form: + PopulateDevices(); + } + else + { + MessageBoxHelper.Show("Please select a device first", null, MessageBoxButtons.OK, MessageBoxIcon.Information); + } } public void OnApply() From 81f892682753d22657347ff31d12cbf043786153 Mon Sep 17 00:00:00 2001 From: Pawel Hofman Date: Thu, 29 May 2014 11:36:46 +0200 Subject: [PATCH 133/851] Made dialogs internal --- .../Options/Dialogs/AddLocalNdkForm.Designer.cs | 2 +- .../VSNDK.Package/Options/Dialogs/AddLocalNdkForm.cs | 2 +- .../Options/Dialogs/InstallNdkForm.Designer.cs | 2 +- .../VSNDK.Package/Options/Dialogs/InstallNdkForm.cs | 12 ++---------- .../Options/Dialogs/PasswordForm.Designer.cs | 2 +- .../VSNDK.Package/Options/Dialogs/PasswordForm.cs | 2 +- .../Options/Dialogs/PinListForm.Designer.cs | 2 +- .../VSNDK.Package/Options/Dialogs/PinListForm.cs | 2 +- 8 files changed, 9 insertions(+), 17 deletions(-) diff --git a/src_vs2012/VSNDK.Package/Options/Dialogs/AddLocalNdkForm.Designer.cs b/src_vs2012/VSNDK.Package/Options/Dialogs/AddLocalNdkForm.Designer.cs index 21f1af7f..205bc84f 100644 --- a/src_vs2012/VSNDK.Package/Options/Dialogs/AddLocalNdkForm.Designer.cs +++ b/src_vs2012/VSNDK.Package/Options/Dialogs/AddLocalNdkForm.Designer.cs @@ -1,6 +1,6 @@ namespace RIM.VSNDK_Package.Options.Dialogs { - partial class AddLocalNdkForm + internal partial class AddLocalNdkForm { /// /// Required designer variable. diff --git a/src_vs2012/VSNDK.Package/Options/Dialogs/AddLocalNdkForm.cs b/src_vs2012/VSNDK.Package/Options/Dialogs/AddLocalNdkForm.cs index 15738e0b..db777e04 100644 --- a/src_vs2012/VSNDK.Package/Options/Dialogs/AddLocalNdkForm.cs +++ b/src_vs2012/VSNDK.Package/Options/Dialogs/AddLocalNdkForm.cs @@ -6,7 +6,7 @@ namespace RIM.VSNDK_Package.Options.Dialogs { - public partial class AddLocalNdkForm : Form + internal partial class AddLocalNdkForm : Form { public AddLocalNdkForm() { diff --git a/src_vs2012/VSNDK.Package/Options/Dialogs/InstallNdkForm.Designer.cs b/src_vs2012/VSNDK.Package/Options/Dialogs/InstallNdkForm.Designer.cs index ef2f816e..da5242a9 100644 --- a/src_vs2012/VSNDK.Package/Options/Dialogs/InstallNdkForm.Designer.cs +++ b/src_vs2012/VSNDK.Package/Options/Dialogs/InstallNdkForm.Designer.cs @@ -1,6 +1,6 @@ namespace RIM.VSNDK_Package.Options.Dialogs { - partial class InstallNdkForm + internal partial class InstallNdkForm { /// /// Required designer variable. diff --git a/src_vs2012/VSNDK.Package/Options/Dialogs/InstallNdkForm.cs b/src_vs2012/VSNDK.Package/Options/Dialogs/InstallNdkForm.cs index febeaf1a..b716a05c 100644 --- a/src_vs2012/VSNDK.Package/Options/Dialogs/InstallNdkForm.cs +++ b/src_vs2012/VSNDK.Package/Options/Dialogs/InstallNdkForm.cs @@ -1,16 +1,8 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Data; -using System.Drawing; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows.Forms; +using System.Windows.Forms; namespace RIM.VSNDK_Package.Options.Dialogs { - public partial class InstallNdkForm : Form + internal partial class InstallNdkForm : Form { public InstallNdkForm() { diff --git a/src_vs2012/VSNDK.Package/Options/Dialogs/PasswordForm.Designer.cs b/src_vs2012/VSNDK.Package/Options/Dialogs/PasswordForm.Designer.cs index ebb17eda..1261a599 100644 --- a/src_vs2012/VSNDK.Package/Options/Dialogs/PasswordForm.Designer.cs +++ b/src_vs2012/VSNDK.Package/Options/Dialogs/PasswordForm.Designer.cs @@ -1,6 +1,6 @@ namespace RIM.VSNDK_Package.Options.Dialogs { - partial class PasswordForm + internal partial class PasswordForm { /// /// Required designer variable. diff --git a/src_vs2012/VSNDK.Package/Options/Dialogs/PasswordForm.cs b/src_vs2012/VSNDK.Package/Options/Dialogs/PasswordForm.cs index 26fa05f8..3862e973 100644 --- a/src_vs2012/VSNDK.Package/Options/Dialogs/PasswordForm.cs +++ b/src_vs2012/VSNDK.Package/Options/Dialogs/PasswordForm.cs @@ -3,7 +3,7 @@ namespace RIM.VSNDK_Package.Options.Dialogs { - public partial class PasswordForm : Form + internal partial class PasswordForm : Form { public PasswordForm() { diff --git a/src_vs2012/VSNDK.Package/Options/Dialogs/PinListForm.Designer.cs b/src_vs2012/VSNDK.Package/Options/Dialogs/PinListForm.Designer.cs index 013b97dc..77b14824 100644 --- a/src_vs2012/VSNDK.Package/Options/Dialogs/PinListForm.Designer.cs +++ b/src_vs2012/VSNDK.Package/Options/Dialogs/PinListForm.Designer.cs @@ -1,6 +1,6 @@ namespace RIM.VSNDK_Package.Options.Dialogs { - partial class PinListForm + internal partial class PinListForm { /// /// Required designer variable. diff --git a/src_vs2012/VSNDK.Package/Options/Dialogs/PinListForm.cs b/src_vs2012/VSNDK.Package/Options/Dialogs/PinListForm.cs index 1b13f8e0..7ce4e046 100644 --- a/src_vs2012/VSNDK.Package/Options/Dialogs/PinListForm.cs +++ b/src_vs2012/VSNDK.Package/Options/Dialogs/PinListForm.cs @@ -9,7 +9,7 @@ namespace RIM.VSNDK_Package.Options.Dialogs /// /// Dialog for creating list of device PINs. /// - public partial class PinListForm : Form + internal partial class PinListForm : Form { private List _pins; From d04cb0eced809e3bb6e82b69f0ea3b1576fa419b Mon Sep 17 00:00:00 2001 From: Pawel Hofman Date: Thu, 29 May 2014 15:51:31 +0200 Subject: [PATCH 134/851] Completed registration UI and user flow --- src/VSNDK.Package/VSNDK.Package.csproj | 18 + .../VSNDK.Package/Model/CskTokenInfo.cs | 27 +- .../VSNDK.Package/Options/CertHelper.cs | 147 ++++++++ .../CertificateDetailsForm.Designer.cs | 333 ++++++++++++++++++ .../Options/Dialogs/CertificateDetailsForm.cs | 109 ++++++ .../Dialogs/CertificateDetailsForm.resx | 120 +++++++ .../Options/Dialogs/CskRequestForm.cs | 23 +- .../Dialogs/DebugTokenDeploymentForm.cs | 2 +- .../Dialogs/RegistrationForm.Designer.cs | 191 +++++----- .../Options/Dialogs/RegistrationForm.cs | 137 ++++++- .../Options/Dialogs/RegistrationForm.resx | 2 +- .../Options/SigningOptionControl.Designer.cs | 26 +- .../Options/SigningOptionControl.cs | 119 +------ .../VSNDK.Package/Tools/KeyToolGenRunner.cs | 44 ++- .../Tools/KeyToolRegisterRunner.cs | 129 +++++++ .../Tools/KeyToolRemoveRunner.cs | 12 +- src_vs2012/VSNDK.Package/VSNDK.Package.csproj | 11 + .../ViewModels/DeveloperDefinition.cs | 42 ++- src_vs2013/VSNDK.Package/VSNDK.Package.csproj | 18 + 19 files changed, 1259 insertions(+), 251 deletions(-) create mode 100644 src_vs2012/VSNDK.Package/Options/CertHelper.cs create mode 100644 src_vs2012/VSNDK.Package/Options/Dialogs/CertificateDetailsForm.Designer.cs create mode 100644 src_vs2012/VSNDK.Package/Options/Dialogs/CertificateDetailsForm.cs create mode 100644 src_vs2012/VSNDK.Package/Options/Dialogs/CertificateDetailsForm.resx create mode 100644 src_vs2012/VSNDK.Package/Tools/KeyToolRegisterRunner.cs diff --git a/src/VSNDK.Package/VSNDK.Package.csproj b/src/VSNDK.Package/VSNDK.Package.csproj index d4e14317..39cfb518 100644 --- a/src/VSNDK.Package/VSNDK.Package.csproj +++ b/src/VSNDK.Package/VSNDK.Package.csproj @@ -208,6 +208,9 @@ Options\ApiLevelOptionPage.cs Component + + Options\CertHelper.cs + Options\DialogHelper.cs @@ -227,6 +230,14 @@ Options\Dialogs\AddLocalNdkForm.designer.cs AddLocalNdkForm.cs + + Options\Dialogs\CertificateDetailsForm.cs + Form + + + Options\Dialogs\CertificateDetailsForm.designer.cs + CertificateDetailsForm.cs + Options\Dialogs\CskRequestForm.cs Form @@ -358,6 +369,9 @@ Tools\KeyToolInfoRunner.cs + + Tools\KeyToolRegisterRunner.cs + Tools\KeyToolRemoveRunner.cs @@ -490,6 +504,10 @@ Options\Dialogs\AddLocalNdkForm.resx AddLocalNdkForm.cs + + Options\Dialogs\CertificateDetailsForm.resx + CertificateDetailsForm.cs + Options\Dialogs\CskRequestForm.resx CskRequestForm.cs diff --git a/src_vs2012/VSNDK.Package/Model/CskTokenInfo.cs b/src_vs2012/VSNDK.Package/Model/CskTokenInfo.cs index d0fe934d..ff6b3dfd 100644 --- a/src_vs2012/VSNDK.Package/Model/CskTokenInfo.cs +++ b/src_vs2012/VSNDK.Package/Model/CskTokenInfo.cs @@ -58,12 +58,20 @@ public bool IsValid get { return DateTime.UtcNow < ValidTo; } } + /// + /// Gets the string representation of the creation date. + /// + public string CreatedAtString + { + get { return CreatedAt.ToString("yyyy-MM-dd HH:mm:ss"); } + } + /// /// Gets the string representation of the validation date. /// public string ValidDateString { - get { return ValidTo.ToString("dd-MM-yyyy"); } + get { return ValidTo.ToString("yyyy-MM-dd"); } } /// @@ -101,6 +109,12 @@ public string Token private set; } + public string Company + { + get; + private set; + } + #endregion /// @@ -149,6 +163,7 @@ private static CskTokenInfo Parse(string text, CskTokenInfo result) { result.CreatedAt = date; result.ValidTo = date.Date.AddYears(1); // BBID token is valid only for one year! + continue; } } @@ -156,18 +171,28 @@ private static CskTokenInfo Parse(string text, CskTokenInfo result) if (line.StartsWith("hmac=", StringComparison.InvariantCultureIgnoreCase)) { result.HMAC = line.Substring(5).Trim(); + continue; } // version: if (line.StartsWith("version=", StringComparison.InvariantCultureIgnoreCase)) { result.Version = line.Substring(8).Trim(); + continue; } // token: if (line.StartsWith("token=", StringComparison.InvariantCultureIgnoreCase)) { result.Token = line.Substring(6).Trim(); + continue; + } + + // company: + if (line.StartsWith("company=", StringComparison.InvariantCultureIgnoreCase)) + { + result.Company = line.Substring(8).Trim(); + continue; } } diff --git a/src_vs2012/VSNDK.Package/Options/CertHelper.cs b/src_vs2012/VSNDK.Package/Options/CertHelper.cs new file mode 100644 index 00000000..697a07e7 --- /dev/null +++ b/src_vs2012/VSNDK.Package/Options/CertHelper.cs @@ -0,0 +1,147 @@ +using System; +using System.IO; +using System.Windows.Forms; +using RIM.VSNDK_Package.Diagnostics; +using RIM.VSNDK_Package.Options.Dialogs; +using RIM.VSNDK_Package.ViewModels; + +namespace RIM.VSNDK_Package.Options +{ + internal static class CertHelper + { + /// + /// Helper method to let reload author. Returns 'true', when new data has been loaded and UI needs to be updated. + /// + public static bool ReloadAuthor(DeveloperDefinition developer) + { + if (developer == null) + throw new ArgumentNullException("developer"); + + string author; + + // verify if at least tried to register: + if (!developer.HasCertificate) + { + MessageBoxHelper.Show("Sorry, but certificate does not exist. Please try to register first", null, MessageBoxButtons.OK, MessageBoxIcon.Error); + return false; + } + + // try to reload info with cached password: + if (developer.HasPassword) + { + author = developer.UpdateName(null); + + if (!string.IsNullOrEmpty(author)) + return true; + } + + // if it failed, ask for new password: + var form = new PasswordForm(); + if (form.ShowDialog() != DialogResult.OK) + return false; + + developer.UpdatePassword(form.Password, form.ShouldRemember); + + // try again to reload data from certificate: + author = developer.UpdateName(null); + VerifyAuthor(author); + + return !string.IsNullOrEmpty(author); + } + + /// + /// Helper class to import certificate into the DataPath location. + /// It also triggers asking for password. Returns 'true', when all was done correctly and UI needs to be updated. + /// + public static bool Import(DeveloperDefinition developer) + { + if (developer == null) + throw new ArgumentNullException("developer"); + if (string.IsNullOrEmpty(developer.DataPath)) + throw new ArgumentOutOfRangeException("developer"); + + // navigate for new certificate: + var form = DialogHelper.OpenCertFile(developer.DataPath); + + if (form.ShowDialog() == DialogResult.OK && File.Exists(form.FileName)) + { + // will need to move the file? - ask for confirmation, if one with the same name exists: + var srcPath = form.FileName; + var fileName = Path.GetFileName(srcPath); + var folderName = Path.GetDirectoryName(srcPath); + + if (string.IsNullOrEmpty(fileName) || string.IsNullOrEmpty(folderName)) + return false; + + // copy the file: + if (string.Compare(developer.DataPath, folderName, StringComparison.InvariantCultureIgnoreCase) != 0) + { + var destPath = Path.Combine(developer.DataPath, fileName); + if (File.Exists(destPath)) + { + var result = MessageBoxHelper.Show("File \"" + fileName + "\" already exists in certificate storage folder.\r\nDo you want to overwrite it?", + null, MessageBoxButtons.YesNoCancel, MessageBoxIcon.Exclamation); + + if (result == DialogResult.Cancel) + return false; + if (result == DialogResult.No) + { + // generate new name: + fileName = "author-" + DateTime.Now.ToString("yyyy-MM-dd") + ".p12"; + destPath = Path.Combine(developer.DataPath, fileName); + } + } + + try + { + File.Copy(srcPath, destPath, true); + } + catch (Exception ex) + { + TraceLog.WriteException(ex, "Unable to copy certificate file \"{0}\"", srcPath); + MessageBoxHelper.Show(ex.Message, "Certificate file error", MessageBoxButtons.OK, MessageBoxIcon.Error); + return false; + } + } + + developer.UpdateCertificate(fileName); + + // ask for password several times: + while (true) + { + var passForm = new PasswordForm(); + + if (passForm.ShowDialog() == DialogResult.OK) + { + // load info from new certificate: + developer.UpdateName(passForm.Password); + + // succeeded - yes? + if (developer.HasName) + { + developer.UpdatePassword(passForm.Password, passForm.ShouldRemember); + return true; + } + + // no - display error and ask again: + VerifyAuthor(developer.Name); + } + else + { + break; + } + } + } + + return false; + } + + private static void VerifyAuthor(string author) + { + if (string.IsNullOrEmpty(author)) + { + MessageBoxHelper.Show("Unable to load info about author", "Invalid password or certificate file", MessageBoxButtons.OK, MessageBoxIcon.Warning); + } + } + } +} diff --git a/src_vs2012/VSNDK.Package/Options/Dialogs/CertificateDetailsForm.Designer.cs b/src_vs2012/VSNDK.Package/Options/Dialogs/CertificateDetailsForm.Designer.cs new file mode 100644 index 00000000..cb85b5c1 --- /dev/null +++ b/src_vs2012/VSNDK.Package/Options/Dialogs/CertificateDetailsForm.Designer.cs @@ -0,0 +1,333 @@ +namespace RIM.VSNDK_Package.Options.Dialogs +{ + internal partial class CertificateDetailsForm + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.groupBox1 = new System.Windows.Forms.GroupBox(); + this.txtPath = new System.Windows.Forms.TextBox(); + this.label2 = new System.Windows.Forms.Label(); + this.bttShow = new System.Windows.Forms.Button(); + this.txtName = new System.Windows.Forms.TextBox(); + this.label1 = new System.Windows.Forms.Label(); + this.bttClose = new System.Windows.Forms.Button(); + this.groupBox2 = new System.Windows.Forms.GroupBox(); + this.label9 = new System.Windows.Forms.Label(); + this.label8 = new System.Windows.Forms.Label(); + this.label7 = new System.Windows.Forms.Label(); + this.txtMD5 = new System.Windows.Forms.TextBox(); + this.txtSHA1 = new System.Windows.Forms.TextBox(); + this.txtSerialNumber = new System.Windows.Forms.TextBox(); + this.label6 = new System.Windows.Forms.Label(); + this.txtValidTo = new System.Windows.Forms.TextBox(); + this.txtValidFrom = new System.Windows.Forms.TextBox(); + this.label5 = new System.Windows.Forms.Label(); + this.txtIssuer = new System.Windows.Forms.TextBox(); + this.label4 = new System.Windows.Forms.Label(); + this.txtAlias = new System.Windows.Forms.TextBox(); + this.label3 = new System.Windows.Forms.Label(); + this.groupBox1.SuspendLayout(); + this.groupBox2.SuspendLayout(); + this.SuspendLayout(); + // + // groupBox1 + // + this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.groupBox1.Controls.Add(this.txtPath); + this.groupBox1.Controls.Add(this.label2); + this.groupBox1.Controls.Add(this.bttShow); + this.groupBox1.Controls.Add(this.txtName); + this.groupBox1.Controls.Add(this.label1); + this.groupBox1.Location = new System.Drawing.Point(12, 12); + this.groupBox1.Name = "groupBox1"; + this.groupBox1.Size = new System.Drawing.Size(528, 98); + this.groupBox1.TabIndex = 0; + this.groupBox1.TabStop = false; + this.groupBox1.Text = "File Details"; + // + // txtPath + // + this.txtPath.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.txtPath.Location = new System.Drawing.Point(95, 55); + this.txtPath.Name = "txtPath"; + this.txtPath.ReadOnly = true; + this.txtPath.Size = new System.Drawing.Size(330, 20); + this.txtPath.TabIndex = 3; + // + // label2 + // + this.label2.AutoSize = true; + this.label2.Location = new System.Drawing.Point(16, 60); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(32, 13); + this.label2.TabIndex = 2; + this.label2.Text = "Path:"; + // + // bttShow + // + this.bttShow.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.bttShow.Location = new System.Drawing.Point(431, 55); + this.bttShow.Name = "bttShow"; + this.bttShow.Size = new System.Drawing.Size(75, 23); + this.bttShow.TabIndex = 1; + this.bttShow.Text = "&Show..."; + this.bttShow.UseVisualStyleBackColor = true; + this.bttShow.Click += new System.EventHandler(this.bttShow_Click); + // + // txtName + // + this.txtName.Location = new System.Drawing.Point(95, 29); + this.txtName.Name = "txtName"; + this.txtName.ReadOnly = true; + this.txtName.Size = new System.Drawing.Size(135, 20); + this.txtName.TabIndex = 1; + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Location = new System.Drawing.Point(16, 32); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(38, 13); + this.label1.TabIndex = 0; + this.label1.Text = "Name:"; + // + // bttClose + // + this.bttClose.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.bttClose.DialogResult = System.Windows.Forms.DialogResult.OK; + this.bttClose.Location = new System.Drawing.Point(465, 341); + this.bttClose.Name = "bttClose"; + this.bttClose.Size = new System.Drawing.Size(75, 23); + this.bttClose.TabIndex = 2; + this.bttClose.Text = "&Close"; + this.bttClose.UseVisualStyleBackColor = true; + // + // groupBox2 + // + this.groupBox2.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.groupBox2.Controls.Add(this.label9); + this.groupBox2.Controls.Add(this.label8); + this.groupBox2.Controls.Add(this.label7); + this.groupBox2.Controls.Add(this.txtMD5); + this.groupBox2.Controls.Add(this.txtSHA1); + this.groupBox2.Controls.Add(this.txtSerialNumber); + this.groupBox2.Controls.Add(this.label6); + this.groupBox2.Controls.Add(this.txtValidTo); + this.groupBox2.Controls.Add(this.txtValidFrom); + this.groupBox2.Controls.Add(this.label5); + this.groupBox2.Controls.Add(this.txtIssuer); + this.groupBox2.Controls.Add(this.label4); + this.groupBox2.Controls.Add(this.txtAlias); + this.groupBox2.Controls.Add(this.label3); + this.groupBox2.Location = new System.Drawing.Point(12, 116); + this.groupBox2.Name = "groupBox2"; + this.groupBox2.Size = new System.Drawing.Size(528, 219); + this.groupBox2.TabIndex = 3; + this.groupBox2.TabStop = false; + this.groupBox2.Text = "Attributes"; + // + // label9 + // + this.label9.AutoSize = true; + this.label9.Location = new System.Drawing.Point(16, 183); + this.label9.Name = "label9"; + this.label9.Size = new System.Drawing.Size(33, 13); + this.label9.TabIndex = 13; + this.label9.Text = "MD5:"; + // + // label8 + // + this.label8.AutoSize = true; + this.label8.Location = new System.Drawing.Point(16, 157); + this.label8.Name = "label8"; + this.label8.Size = new System.Drawing.Size(38, 13); + this.label8.TabIndex = 12; + this.label8.Text = "SHA1:"; + // + // label7 + // + this.label7.AutoSize = true; + this.label7.Location = new System.Drawing.Point(16, 131); + this.label7.Name = "label7"; + this.label7.Size = new System.Drawing.Size(74, 13); + this.label7.TabIndex = 11; + this.label7.Text = "Serial number:"; + // + // txtMD5 + // + this.txtMD5.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.txtMD5.Location = new System.Drawing.Point(95, 180); + this.txtMD5.Name = "txtMD5"; + this.txtMD5.ReadOnly = true; + this.txtMD5.Size = new System.Drawing.Size(411, 20); + this.txtMD5.TabIndex = 10; + // + // txtSHA1 + // + this.txtSHA1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.txtSHA1.Location = new System.Drawing.Point(95, 154); + this.txtSHA1.Name = "txtSHA1"; + this.txtSHA1.ReadOnly = true; + this.txtSHA1.Size = new System.Drawing.Size(411, 20); + this.txtSHA1.TabIndex = 9; + // + // txtSerialNumber + // + this.txtSerialNumber.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.txtSerialNumber.Location = new System.Drawing.Point(95, 128); + this.txtSerialNumber.Name = "txtSerialNumber"; + this.txtSerialNumber.ReadOnly = true; + this.txtSerialNumber.Size = new System.Drawing.Size(411, 20); + this.txtSerialNumber.TabIndex = 8; + // + // label6 + // + this.label6.AutoSize = true; + this.label6.Location = new System.Drawing.Point(16, 105); + this.label6.Name = "label6"; + this.label6.Size = new System.Drawing.Size(45, 13); + this.label6.TabIndex = 7; + this.label6.Text = "Valid to:"; + // + // txtValidTo + // + this.txtValidTo.Location = new System.Drawing.Point(95, 102); + this.txtValidTo.Name = "txtValidTo"; + this.txtValidTo.ReadOnly = true; + this.txtValidTo.Size = new System.Drawing.Size(200, 20); + this.txtValidTo.TabIndex = 6; + // + // txtValidFrom + // + this.txtValidFrom.Location = new System.Drawing.Point(95, 76); + this.txtValidFrom.Name = "txtValidFrom"; + this.txtValidFrom.ReadOnly = true; + this.txtValidFrom.Size = new System.Drawing.Size(200, 20); + this.txtValidFrom.TabIndex = 5; + // + // label5 + // + this.label5.AutoSize = true; + this.label5.Location = new System.Drawing.Point(16, 79); + this.label5.Name = "label5"; + this.label5.Size = new System.Drawing.Size(56, 13); + this.label5.TabIndex = 4; + this.label5.Text = "Valid from:"; + // + // txtIssuer + // + this.txtIssuer.Location = new System.Drawing.Point(95, 50); + this.txtIssuer.Name = "txtIssuer"; + this.txtIssuer.ReadOnly = true; + this.txtIssuer.Size = new System.Drawing.Size(200, 20); + this.txtIssuer.TabIndex = 3; + // + // label4 + // + this.label4.AutoSize = true; + this.label4.Location = new System.Drawing.Point(16, 53); + this.label4.Name = "label4"; + this.label4.Size = new System.Drawing.Size(38, 13); + this.label4.TabIndex = 2; + this.label4.Text = "Issuer:"; + // + // txtAlias + // + this.txtAlias.Location = new System.Drawing.Point(95, 24); + this.txtAlias.Name = "txtAlias"; + this.txtAlias.ReadOnly = true; + this.txtAlias.Size = new System.Drawing.Size(135, 20); + this.txtAlias.TabIndex = 1; + // + // label3 + // + this.label3.AutoSize = true; + this.label3.Location = new System.Drawing.Point(16, 27); + this.label3.Name = "label3"; + this.label3.Size = new System.Drawing.Size(32, 13); + this.label3.TabIndex = 0; + this.label3.Text = "Alias:"; + // + // CertificateDetailsForm + // + this.AcceptButton = this.bttClose; + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.CancelButton = this.bttClose; + this.ClientSize = new System.Drawing.Size(552, 376); + this.Controls.Add(this.groupBox2); + this.Controls.Add(this.bttClose); + this.Controls.Add(this.groupBox1); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; + this.MaximizeBox = false; + this.MinimizeBox = false; + this.Name = "CertificateDetailsForm"; + this.ShowIcon = false; + this.ShowInTaskbar = false; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; + this.Text = "Certificate Details"; + this.groupBox1.ResumeLayout(false); + this.groupBox1.PerformLayout(); + this.groupBox2.ResumeLayout(false); + this.groupBox2.PerformLayout(); + this.ResumeLayout(false); + + } + + #endregion + + private System.Windows.Forms.GroupBox groupBox1; + private System.Windows.Forms.Button bttShow; + private System.Windows.Forms.Button bttClose; + private System.Windows.Forms.TextBox txtPath; + private System.Windows.Forms.Label label2; + private System.Windows.Forms.TextBox txtName; + private System.Windows.Forms.Label label1; + private System.Windows.Forms.GroupBox groupBox2; + private System.Windows.Forms.Label label6; + private System.Windows.Forms.TextBox txtValidTo; + private System.Windows.Forms.TextBox txtValidFrom; + private System.Windows.Forms.Label label5; + private System.Windows.Forms.TextBox txtIssuer; + private System.Windows.Forms.Label label4; + private System.Windows.Forms.TextBox txtAlias; + private System.Windows.Forms.Label label3; + private System.Windows.Forms.Label label9; + private System.Windows.Forms.Label label8; + private System.Windows.Forms.Label label7; + private System.Windows.Forms.TextBox txtMD5; + private System.Windows.Forms.TextBox txtSHA1; + private System.Windows.Forms.TextBox txtSerialNumber; + } +} \ No newline at end of file diff --git a/src_vs2012/VSNDK.Package/Options/Dialogs/CertificateDetailsForm.cs b/src_vs2012/VSNDK.Package/Options/Dialogs/CertificateDetailsForm.cs new file mode 100644 index 00000000..f632e70b --- /dev/null +++ b/src_vs2012/VSNDK.Package/Options/Dialogs/CertificateDetailsForm.cs @@ -0,0 +1,109 @@ +using System; +using System.IO; +using System.Windows.Forms; +using RIM.VSNDK_Package.Tools; +using RIM.VSNDK_Package.ViewModels; + +namespace RIM.VSNDK_Package.Options.Dialogs +{ + internal partial class CertificateDetailsForm : Form + { + private readonly DeveloperDefinition _developer; + private KeyToolInfoRunner _runner; + private bool _shouldLoad; + + public CertificateDetailsForm(DeveloperDefinition developer) + { + if (developer == null) + throw new ArgumentNullException("developer"); + _developer = developer; + + InitializeComponent(); + _shouldLoad = true; + Path = _developer.CertificateFullPath; + } + + protected override void OnShown(EventArgs e) + { + base.OnShown(e); + + // load info about the certificate: + if (_shouldLoad && !string.IsNullOrEmpty(Path) && File.Exists(Path)) + { + txtAlias.Text = "Loading..."; + + // ask for password, if needed: + if (!_developer.HasPassword) + { + var form = new PasswordForm(); + + if (form.ShowDialog() != DialogResult.OK) + { + txtAlias.Text = string.Empty; + return; + } + + // store given password: + _developer.UpdatePassword(form.Password, form.ShouldRemember); + } + + _runner = new KeyToolInfoRunner(RunnerDefaults.ToolsDirectory, Path, _developer.CskPassword); + _runner.Dispatcher = EventDispatcher.From(this); + _runner.Finished += OnInfoLoaded; + _runner.ExecuteAsync(); + } + } + + #region Properties + + public string Path + { + get { return txtPath.Text; } + set + { + if (string.IsNullOrEmpty(value)) + { + txtName.Text = string.Empty; + txtPath.Text = "Certificate is missing"; + bttShow.Enabled = false; + } + else + { + txtName.Text = System.IO.Path.GetFileName(value); + txtPath.Text = value; + bttShow.Enabled = true; + } + } + } + + #endregion + + private void OnInfoLoaded(object sender, ToolRunnerEventArgs e) + { + if (e.IsSuccessfull && _runner.Info != null) + { + var info = _runner.Info; + + txtAlias.Text = info.Alias; + txtIssuer.Text = info.Issuer; + txtValidFrom.Text = info.ValidFrom.ToLocalTime().ToString("yyyy-MM-dd HH:mm:ss"); + txtValidTo.Text = info.ValidTo.ToLocalTime().ToString("yyyy-MM-dd HH:mm:ss"); + txtSerialNumber.Text = info.SerialNumber; + txtSHA1.Text = info.FingerprintSHA1; + txtMD5.Text = info.FingerprintMD5; + } + else + { + txtAlias.Text = "Unable to load info"; + } + } + + private void bttShow_Click(object sender, EventArgs e) + { + if (string.IsNullOrEmpty(Path)) + return; + + DialogHelper.StartExplorerForFile(Path); + } + } +} diff --git a/src_vs2012/VSNDK.Package/Options/Dialogs/CertificateDetailsForm.resx b/src_vs2012/VSNDK.Package/Options/Dialogs/CertificateDetailsForm.resx new file mode 100644 index 00000000..29dcb1b3 --- /dev/null +++ b/src_vs2012/VSNDK.Package/Options/Dialogs/CertificateDetailsForm.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/src_vs2012/VSNDK.Package/Options/Dialogs/CskRequestForm.cs b/src_vs2012/VSNDK.Package/Options/Dialogs/CskRequestForm.cs index 91bba109..9aa1ffc0 100644 --- a/src_vs2012/VSNDK.Package/Options/Dialogs/CskRequestForm.cs +++ b/src_vs2012/VSNDK.Package/Options/Dialogs/CskRequestForm.cs @@ -70,16 +70,25 @@ private void OnBeforeNavigating(object sender, WebBrowserBeforeNavigatingEventAr { if (e.Url == CallbackURL) { - string postData = Encoding.UTF8.GetString(e.PostData); - string[] data = postData.Split('&'); + if (e.PostData == null || e.PostData.Length == 0) + { + StatusCode = 404; + Token = new CskTokenInfo(null); + } + else + { + // this seems to be NUL-terminated string... + string postData = Encoding.UTF8.GetString(e.PostData, 0, e.PostData[e.PostData.Length - 1] == 0 ? e.PostData.Length - 1 : e.PostData.Length); + string[] data = postData.Split('&'); - for (int i = 0; i < data.Length; i++) - data[i] = HttpUtility.UrlDecode(data[i]); + for (int i = 0; i < data.Length; i++) + data[i] = HttpUtility.UrlDecode(data[i]); - StatusCode = 200; - Token = new CskTokenInfo(FindContentFor(data, "cskData=")); - e.Cancel = true; + StatusCode = 200; + Token = new CskTokenInfo(FindContentFor(data, "cskData=")); + } + e.Cancel = true; // And close the form Invoke(new Action(RequestCompleted)); } diff --git a/src_vs2012/VSNDK.Package/Options/Dialogs/DebugTokenDeploymentForm.cs b/src_vs2012/VSNDK.Package/Options/Dialogs/DebugTokenDeploymentForm.cs index b29fe944..4fbaebab 100644 --- a/src_vs2012/VSNDK.Package/Options/Dialogs/DebugTokenDeploymentForm.cs +++ b/src_vs2012/VSNDK.Package/Options/Dialogs/DebugTokenDeploymentForm.cs @@ -604,7 +604,7 @@ private void bttTokenCreate_Click(object sender, EventArgs e) // ask where to store the debug-token: var startupPath = string.IsNullOrEmpty(DebugTokenPath) ? RunnerDefaults.DataDirectory : Path.GetDirectoryName(DebugTokenPath); - var saveFile = DialogHelper.SaveBarFile("Renewed debug token location", startupPath, "debugtoken-" + DateTime.Now.ToString("yyyy-MM-hh") + ".bar"); + var saveFile = DialogHelper.SaveBarFile("Renewed debug token location", startupPath, "debugtoken-" + DateTime.Now.ToString("yyyy-MM-dd") + ".bar"); if (saveFile.ShowDialog() == DialogResult.OK) { diff --git a/src_vs2012/VSNDK.Package/Options/Dialogs/RegistrationForm.Designer.cs b/src_vs2012/VSNDK.Package/Options/Dialogs/RegistrationForm.Designer.cs index ea25b379..8aa19211 100644 --- a/src_vs2012/VSNDK.Package/Options/Dialogs/RegistrationForm.Designer.cs +++ b/src_vs2012/VSNDK.Package/Options/Dialogs/RegistrationForm.Designer.cs @@ -1,6 +1,6 @@ namespace RIM.VSNDK_Package.Options.Dialogs { - partial class RegistrationForm + internal partial class RegistrationForm { /// /// Required designer variable. @@ -41,11 +41,12 @@ private void InitializeComponent() this.bttCreateToken = new System.Windows.Forms.Button(); this.bttCreateCertificate = new System.Windows.Forms.Button(); this.groupBox2 = new System.Windows.Forms.GroupBox(); - this.bttRefreshCert = new System.Windows.Forms.Button(); - this.bttSelectCert = new System.Windows.Forms.Button(); + this.lblTokenExpiration = new System.Windows.Forms.Label(); + this.lblRegistration = new System.Windows.Forms.Label(); + this.bttRefresh = new System.Windows.Forms.Button(); this.txtCertName = new System.Windows.Forms.TextBox(); - this.cmbCertificate = new System.Windows.Forms.ComboBox(); this.label6 = new System.Windows.Forms.Label(); + this.bttImportCertificate = new System.Windows.Forms.Button(); this.txtLog = new System.Windows.Forms.TextBox(); this.groupBox3 = new System.Windows.Forms.GroupBox(); this.lblTabletRegistration = new System.Windows.Forms.Label(); @@ -65,6 +66,7 @@ private void InitializeComponent() this.label8 = new System.Windows.Forms.Label(); this.label7 = new System.Windows.Forms.Label(); this.label12 = new System.Windows.Forms.Label(); + this.bttNavigate = new System.Windows.Forms.Button(); this.groupBox2.SuspendLayout(); this.groupBox3.SuspendLayout(); this.SuspendLayout(); @@ -95,7 +97,7 @@ private void InitializeComponent() this.txtPassword.Name = "txtPassword"; this.txtPassword.PasswordChar = '*'; this.txtPassword.Size = new System.Drawing.Size(113, 20); - this.txtPassword.TabIndex = 3; + this.txtPassword.TabIndex = 5; this.txtPassword.TextChanged += new System.EventHandler(this.txtPassword_TextChanged); // // label3 @@ -104,7 +106,7 @@ private void InitializeComponent() this.label3.Location = new System.Drawing.Point(12, 147); this.label3.Name = "label3"; this.label3.Size = new System.Drawing.Size(56, 13); - this.label3.TabIndex = 2; + this.label3.TabIndex = 4; this.label3.Text = "Password:"; // // txtName @@ -112,7 +114,7 @@ private void InitializeComponent() this.txtName.Location = new System.Drawing.Point(131, 118); this.txtName.Name = "txtName"; this.txtName.Size = new System.Drawing.Size(184, 20); - this.txtName.TabIndex = 1; + this.txtName.TabIndex = 3; // // label2 // @@ -120,7 +122,7 @@ private void InitializeComponent() this.label2.Location = new System.Drawing.Point(12, 121); this.label2.Name = "label2"; this.label2.Size = new System.Drawing.Size(72, 13); - this.label2.TabIndex = 0; + this.label2.TabIndex = 2; this.label2.Text = "Author Name:"; // // bttOK @@ -131,7 +133,7 @@ private void InitializeComponent() this.bttOK.Name = "bttOK"; this.bttOK.Size = new System.Drawing.Size(75, 23); this.bttOK.TabIndex = 3; - this.bttOK.Text = "&OK"; + this.bttOK.Text = "&Close"; this.bttOK.UseVisualStyleBackColor = true; // // txtConfirmPassword @@ -140,7 +142,7 @@ private void InitializeComponent() this.txtConfirmPassword.Name = "txtConfirmPassword"; this.txtConfirmPassword.PasswordChar = '*'; this.txtConfirmPassword.Size = new System.Drawing.Size(113, 20); - this.txtConfirmPassword.TabIndex = 5; + this.txtConfirmPassword.TabIndex = 7; // // label5 // @@ -148,12 +150,12 @@ private void InitializeComponent() this.label5.Location = new System.Drawing.Point(12, 173); this.label5.Name = "label5"; this.label5.Size = new System.Drawing.Size(94, 13); - this.label5.TabIndex = 4; + this.label5.TabIndex = 6; this.label5.Text = "Confirm Password:"; // // bttCreateToken // - this.bttCreateToken.Location = new System.Drawing.Point(15, 259); + this.bttCreateToken.Location = new System.Drawing.Point(15, 230); this.bttCreateToken.Name = "bttCreateToken"; this.bttCreateToken.Size = new System.Drawing.Size(110, 23); this.bttCreateToken.TabIndex = 11; @@ -163,21 +165,23 @@ private void InitializeComponent() // // bttCreateCertificate // - this.bttCreateCertificate.Location = new System.Drawing.Point(131, 259); + this.bttCreateCertificate.Location = new System.Drawing.Point(131, 230); this.bttCreateCertificate.Name = "bttCreateCertificate"; this.bttCreateCertificate.Size = new System.Drawing.Size(110, 23); this.bttCreateCertificate.TabIndex = 12; - this.bttCreateCertificate.Text = "Create Ce&rtificate..."; + this.bttCreateCertificate.Text = "Create C&ertificate..."; this.bttCreateCertificate.UseVisualStyleBackColor = true; + this.bttCreateCertificate.Click += new System.EventHandler(this.bttCreateCertificate_Click); // // groupBox2 // - this.groupBox2.Controls.Add(this.bttRefreshCert); + this.groupBox2.Controls.Add(this.lblTokenExpiration); + this.groupBox2.Controls.Add(this.lblRegistration); + this.groupBox2.Controls.Add(this.bttRefresh); this.groupBox2.Controls.Add(this.label4); - this.groupBox2.Controls.Add(this.bttSelectCert); this.groupBox2.Controls.Add(this.txtCertName); - this.groupBox2.Controls.Add(this.cmbCertificate); this.groupBox2.Controls.Add(this.label6); + this.groupBox2.Controls.Add(this.bttImportCertificate); this.groupBox2.Controls.Add(this.bttCreateCertificate); this.groupBox2.Controls.Add(this.label2); this.groupBox2.Controls.Add(this.bttCreateToken); @@ -190,48 +194,45 @@ private void InitializeComponent() this.groupBox2.Location = new System.Drawing.Point(12, 12); this.groupBox2.Name = "groupBox2"; this.groupBox2.Size = new System.Drawing.Size(537, 288); - this.groupBox2.TabIndex = 1; + this.groupBox2.TabIndex = 0; this.groupBox2.TabStop = false; this.groupBox2.Text = "BlackBerry 10 Devices"; // - // bttRefreshCert + // lblTokenExpiration // - this.bttRefreshCert.Location = new System.Drawing.Point(321, 223); - this.bttRefreshCert.Name = "bttRefreshCert"; - this.bttRefreshCert.Size = new System.Drawing.Size(75, 23); - this.bttRefreshCert.TabIndex = 10; - this.bttRefreshCert.Text = "&Refresh"; - this.bttRefreshCert.UseVisualStyleBackColor = true; + this.lblTokenExpiration.AutoSize = true; + this.lblTokenExpiration.Location = new System.Drawing.Point(247, 264); + this.lblTokenExpiration.Name = "lblTokenExpiration"; + this.lblTokenExpiration.Size = new System.Drawing.Size(101, 13); + this.lblTokenExpiration.TabIndex = 14; + this.lblTokenExpiration.Text = "Token expires at: ---"; // - // bttSelectCert + // lblRegistration // - this.bttSelectCert.Location = new System.Drawing.Point(321, 223); - this.bttSelectCert.Name = "bttSelectCert"; - this.bttSelectCert.Size = new System.Drawing.Size(32, 23); - this.bttSelectCert.TabIndex = 9; - this.bttSelectCert.Text = "..."; - this.bttSelectCert.UseVisualStyleBackColor = true; + this.lblRegistration.AutoSize = true; + this.lblRegistration.Location = new System.Drawing.Point(247, 235); + this.lblRegistration.Name = "lblRegistration"; + this.lblRegistration.Size = new System.Drawing.Size(165, 13); + this.lblRegistration.TabIndex = 13; + this.lblRegistration.Text = "Registration has been completed."; + // + // bttRefresh + // + this.bttRefresh.Location = new System.Drawing.Point(321, 196); + this.bttRefresh.Name = "bttRefresh"; + this.bttRefresh.Size = new System.Drawing.Size(75, 23); + this.bttRefresh.TabIndex = 10; + this.bttRefresh.Text = "&Refresh"; + this.bttRefresh.UseVisualStyleBackColor = true; + this.bttRefresh.Click += new System.EventHandler(this.bttRefresh_Click); // // txtCertName // - this.txtCertName.Location = new System.Drawing.Point(131, 223); + this.txtCertName.Location = new System.Drawing.Point(131, 196); this.txtCertName.Name = "txtCertName"; + this.txtCertName.ReadOnly = true; this.txtCertName.Size = new System.Drawing.Size(184, 20); - this.txtCertName.TabIndex = 8; - // - // cmbCertificate - // - this.cmbCertificate.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; - this.cmbCertificate.FormattingEnabled = true; - this.cmbCertificate.Items.AddRange(new object[] { - "Use current", - "Create new", - "Select existing"}); - this.cmbCertificate.Location = new System.Drawing.Point(131, 196); - this.cmbCertificate.MaxDropDownItems = 20; - this.cmbCertificate.Name = "cmbCertificate"; - this.cmbCertificate.Size = new System.Drawing.Size(184, 21); - this.cmbCertificate.TabIndex = 7; + this.txtCertName.TabIndex = 9; // // label6 // @@ -239,9 +240,19 @@ private void InitializeComponent() this.label6.Location = new System.Drawing.Point(12, 199); this.label6.Name = "label6"; this.label6.Size = new System.Drawing.Size(57, 13); - this.label6.TabIndex = 6; + this.label6.TabIndex = 8; this.label6.Text = "Certificate:"; // + // bttImportCertificate + // + this.bttImportCertificate.Location = new System.Drawing.Point(131, 259); + this.bttImportCertificate.Name = "bttImportCertificate"; + this.bttImportCertificate.Size = new System.Drawing.Size(110, 23); + this.bttImportCertificate.TabIndex = 12; + this.bttImportCertificate.Text = "I&mport Certificate..."; + this.bttImportCertificate.UseVisualStyleBackColor = true; + this.bttImportCertificate.Click += new System.EventHandler(this.bttImportCertificate_Click); + // // txtLog // this.txtLog.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) @@ -277,7 +288,7 @@ private void InitializeComponent() this.groupBox3.Location = new System.Drawing.Point(555, 12); this.groupBox3.Name = "groupBox3"; this.groupBox3.Size = new System.Drawing.Size(537, 288); - this.groupBox3.TabIndex = 5; + this.groupBox3.TabIndex = 1; this.groupBox3.TabStop = false; this.groupBox3.Text = "BlackBerry Tablet"; // @@ -287,7 +298,7 @@ private void InitializeComponent() this.lblTabletRegistration.Location = new System.Drawing.Point(134, 264); this.lblTabletRegistration.Name = "lblTabletRegistration"; this.lblTabletRegistration.Size = new System.Drawing.Size(165, 13); - this.lblTabletRegistration.TabIndex = 13; + this.lblTabletRegistration.TabIndex = 16; this.lblTabletRegistration.Text = "Registration has been completed."; // // label13 @@ -297,7 +308,7 @@ private void InitializeComponent() this.label13.Location = new System.Drawing.Point(15, 73); this.label13.Name = "label13"; this.label13.Size = new System.Drawing.Size(519, 36); - this.label13.TabIndex = 1; + this.label13.TabIndex = 2; this.label13.Text = "To complete the registration both - BlackBerry Signer and developer certificate -" + " are required. Certificate will be created automatically here or at BlackBerry 1" + "0 devices section on left."; @@ -308,79 +319,79 @@ private void InitializeComponent() this.lnkMoreInfo.Location = new System.Drawing.Point(15, 54); this.lnkMoreInfo.Name = "lnkMoreInfo"; this.lnkMoreInfo.Size = new System.Drawing.Size(60, 13); - this.lnkMoreInfo.TabIndex = 12; + this.lnkMoreInfo.TabIndex = 1; this.lnkMoreInfo.TabStop = true; this.lnkMoreInfo.Text = "More info..."; this.lnkMoreInfo.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.lnkMoreInfo_LinkClicked); // // txtCskConfirmPassword // - this.txtCskConfirmPassword.Location = new System.Drawing.Point(134, 231); + this.txtCskConfirmPassword.Location = new System.Drawing.Point(134, 222); this.txtCskConfirmPassword.Name = "txtCskConfirmPassword"; this.txtCskConfirmPassword.PasswordChar = '*'; this.txtCskConfirmPassword.Size = new System.Drawing.Size(113, 20); - this.txtCskConfirmPassword.TabIndex = 9; + this.txtCskConfirmPassword.TabIndex = 14; // // txtCskPassword // - this.txtCskPassword.Location = new System.Drawing.Point(134, 205); + this.txtCskPassword.Location = new System.Drawing.Point(134, 196); this.txtCskPassword.Name = "txtCskPassword"; this.txtCskPassword.PasswordChar = '*'; this.txtCskPassword.Size = new System.Drawing.Size(113, 20); - this.txtCskPassword.TabIndex = 9; + this.txtCskPassword.TabIndex = 12; this.txtCskPassword.TextChanged += new System.EventHandler(this.txtCskPassword_TextChanged); // // label11 // this.label11.AutoSize = true; - this.label11.Location = new System.Drawing.Point(18, 208); + this.label11.Location = new System.Drawing.Point(15, 199); this.label11.Name = "label11"; this.label11.Size = new System.Drawing.Size(80, 13); - this.label11.TabIndex = 8; + this.label11.TabIndex = 11; this.label11.Text = "CSK Password:"; // // txtCsjPin // - this.txtCsjPin.Location = new System.Drawing.Point(134, 179); + this.txtCsjPin.Location = new System.Drawing.Point(134, 170); this.txtCsjPin.Name = "txtCsjPin"; this.txtCsjPin.PasswordChar = '*'; this.txtCsjPin.Size = new System.Drawing.Size(113, 20); - this.txtCsjPin.TabIndex = 7; + this.txtCsjPin.TabIndex = 10; // // label10 // this.label10.AutoSize = true; - this.label10.Location = new System.Drawing.Point(18, 182); + this.label10.Location = new System.Drawing.Point(15, 173); this.label10.Name = "label10"; this.label10.Size = new System.Drawing.Size(50, 13); - this.label10.TabIndex = 6; + this.label10.TabIndex = 9; this.label10.Text = "CSJ PIN:"; // // txtPbdtPath // this.txtPbdtPath.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); - this.txtPbdtPath.Location = new System.Drawing.Point(134, 153); + this.txtPbdtPath.Location = new System.Drawing.Point(134, 144); this.txtPbdtPath.Name = "txtPbdtPath"; this.txtPbdtPath.Size = new System.Drawing.Size(344, 20); - this.txtPbdtPath.TabIndex = 5; + this.txtPbdtPath.TabIndex = 7; // // label9 // this.label9.AutoSize = true; - this.label9.Location = new System.Drawing.Point(18, 156); + this.label9.Location = new System.Drawing.Point(15, 147); this.label9.Name = "label9"; this.label9.Size = new System.Drawing.Size(86, 13); - this.label9.TabIndex = 4; + this.label9.TabIndex = 6; this.label9.Text = "PBDT CSJ Path:"; // // bttPbdtNavigate // this.bttPbdtNavigate.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this.bttPbdtNavigate.Location = new System.Drawing.Point(484, 153); + this.bttPbdtNavigate.Location = new System.Drawing.Point(484, 144); this.bttPbdtNavigate.Name = "bttPbdtNavigate"; this.bttPbdtNavigate.Size = new System.Drawing.Size(38, 23); - this.bttPbdtNavigate.TabIndex = 3; + this.bttPbdtNavigate.TabIndex = 8; this.bttPbdtNavigate.Text = "..."; this.bttPbdtNavigate.UseVisualStyleBackColor = true; this.bttPbdtNavigate.Click += new System.EventHandler(this.bttPbdtNavigate_Click); @@ -388,10 +399,10 @@ private void InitializeComponent() // bttRdkNavigate // this.bttRdkNavigate.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this.bttRdkNavigate.Location = new System.Drawing.Point(484, 127); + this.bttRdkNavigate.Location = new System.Drawing.Point(484, 118); this.bttRdkNavigate.Name = "bttRdkNavigate"; this.bttRdkNavigate.Size = new System.Drawing.Size(38, 23); - this.bttRdkNavigate.TabIndex = 3; + this.bttRdkNavigate.TabIndex = 5; this.bttRdkNavigate.Text = "..."; this.bttRdkNavigate.UseVisualStyleBackColor = true; this.bttRdkNavigate.Click += new System.EventHandler(this.bttRdkNavigate_Click); @@ -401,8 +412,8 @@ private void InitializeComponent() this.bttCreateSigner.Location = new System.Drawing.Point(18, 259); this.bttCreateSigner.Name = "bttCreateSigner"; this.bttCreateSigner.Size = new System.Drawing.Size(110, 23); - this.bttCreateSigner.TabIndex = 11; - this.bttCreateSigner.Text = "&Create signer..."; + this.bttCreateSigner.TabIndex = 15; + this.bttCreateSigner.Text = "Create &Signer..."; this.bttCreateSigner.UseVisualStyleBackColor = true; this.bttCreateSigner.Click += new System.EventHandler(this.bttCreateSigner_Click); // @@ -410,18 +421,18 @@ private void InitializeComponent() // this.txtRdkPath.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); - this.txtRdkPath.Location = new System.Drawing.Point(134, 127); + this.txtRdkPath.Location = new System.Drawing.Point(134, 118); this.txtRdkPath.Name = "txtRdkPath"; this.txtRdkPath.Size = new System.Drawing.Size(344, 20); - this.txtRdkPath.TabIndex = 2; + this.txtRdkPath.TabIndex = 4; // // label8 // this.label8.AutoSize = true; - this.label8.Location = new System.Drawing.Point(18, 130); + this.label8.Location = new System.Drawing.Point(15, 121); this.label8.Name = "label8"; this.label8.Size = new System.Drawing.Size(80, 13); - this.label8.TabIndex = 1; + this.label8.TabIndex = 3; this.label8.Text = "RDK CSJ Path:"; // // label7 @@ -436,18 +447,30 @@ private void InitializeComponent() // label12 // this.label12.AutoSize = true; - this.label12.Location = new System.Drawing.Point(18, 234); + this.label12.Location = new System.Drawing.Point(15, 225); this.label12.Name = "label12"; this.label12.Size = new System.Drawing.Size(94, 13); - this.label12.TabIndex = 4; + this.label12.TabIndex = 13; this.label12.Text = "Confirm Password:"; // + // bttNavigate + // + this.bttNavigate.Location = new System.Drawing.Point(12, 398); + this.bttNavigate.Name = "bttNavigate"; + this.bttNavigate.Size = new System.Drawing.Size(75, 23); + this.bttNavigate.TabIndex = 4; + this.bttNavigate.Text = "&Navigate..."; + this.bttNavigate.UseVisualStyleBackColor = true; + this.bttNavigate.Click += new System.EventHandler(this.bttNavigate_Click); + // // RegistrationForm // this.AcceptButton = this.bttOK; this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.CancelButton = this.bttOK; this.ClientSize = new System.Drawing.Size(1104, 433); + this.Controls.Add(this.bttNavigate); this.Controls.Add(this.groupBox3); this.Controls.Add(this.txtLog); this.Controls.Add(this.groupBox2); @@ -459,7 +482,7 @@ private void InitializeComponent() this.ShowIcon = false; this.ShowInTaskbar = false; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; - this.Text = "Developer Registration Form"; + this.Text = "Developer Registration"; this.groupBox2.ResumeLayout(false); this.groupBox2.PerformLayout(); this.groupBox3.ResumeLayout(false); @@ -484,10 +507,7 @@ private void InitializeComponent() private System.Windows.Forms.Label label5; private System.Windows.Forms.GroupBox groupBox2; private System.Windows.Forms.TextBox txtLog; - private System.Windows.Forms.Button bttRefreshCert; - private System.Windows.Forms.Button bttSelectCert; private System.Windows.Forms.TextBox txtCertName; - private System.Windows.Forms.ComboBox cmbCertificate; private System.Windows.Forms.Label label6; private System.Windows.Forms.GroupBox groupBox3; private System.Windows.Forms.LinkLabel lnkMoreInfo; @@ -507,5 +527,10 @@ private void InitializeComponent() private System.Windows.Forms.Label label12; private System.Windows.Forms.Label label13; private System.Windows.Forms.Label lblTabletRegistration; + private System.Windows.Forms.Button bttRefresh; + private System.Windows.Forms.Button bttImportCertificate; + private System.Windows.Forms.Button bttNavigate; + private System.Windows.Forms.Label lblTokenExpiration; + private System.Windows.Forms.Label lblRegistration; } } \ No newline at end of file diff --git a/src_vs2012/VSNDK.Package/Options/Dialogs/RegistrationForm.cs b/src_vs2012/VSNDK.Package/Options/Dialogs/RegistrationForm.cs index 11c6ca62..bcd99e43 100644 --- a/src_vs2012/VSNDK.Package/Options/Dialogs/RegistrationForm.cs +++ b/src_vs2012/VSNDK.Package/Options/Dialogs/RegistrationForm.cs @@ -1,16 +1,17 @@ using System; using System.IO; using System.Windows.Forms; +using RIM.VSNDK_Package.Tools; using RIM.VSNDK_Package.ViewModels; namespace RIM.VSNDK_Package.Options.Dialogs { - public partial class RegistrationForm : Form + internal partial class RegistrationForm : Form { private const string ValidationCaption = "Validation"; private readonly DeveloperDefinition _developer; - internal RegistrationForm(DeveloperDefinition developer) + public RegistrationForm(DeveloperDefinition developer) { if (developer == null) throw new ArgumentNullException("developer"); @@ -18,8 +19,15 @@ internal RegistrationForm(DeveloperDefinition developer) InitializeComponent(); - Password = _developer.CskPassword; AuthorName = _developer.Name; + Password = _developer.CskPassword; + + if (_developer.HasCertificate) + Log("Found certificate: " + _developer.CertificateFullPath); + if (_developer.HasToken) + Log("Found BlackBerry 10 token (v: " + _developer.Token.Version + "): \"" + _developer.CskTokenFullPath + "\", from: " + _developer.Token.CreatedAtString); + if (_developer.HasTabletToken) + Log("Found Tablet token (v: " +_developer.TabletToken.Version + "): \"" + _developer.TabletCskTokenFullPath + "\", from: " + _developer.TabletToken.CreatedAtString); UpdateUI(); } @@ -156,7 +164,21 @@ private void UpdateUI() txtCsjPin.Enabled = txtCskPassword.Enabled = txtCskConfirmPassword.Enabled = !tabletRegistered; // BB10 devices section: + bool registered = _developer.IsRegistered; + + lblRegistration.Visible = registered; + lblTokenExpiration.Visible = _developer.HasToken; + lblTokenExpiration.Text = _developer.HasToken ? "Token expires at: " + _developer.Token.ValidDateString : string.Empty; + txtCertName.Text = _developer.CertificateFileName; + bttCreateCertificate.Enabled = !_developer.HasCertificate; + } + + private void UpdateActionButtons(bool enabled) + { + bttCreateCertificate.Enabled = enabled; + bttCreateSigner.Enabled = enabled; + bttCreateToken.Enabled = enabled; } private void txtPassword_TextChanged(object sender, EventArgs e) @@ -199,7 +221,7 @@ private void bttCreateToken_Click(object sender, EventArgs e) { if (form.StatusCode != 0) { - MessageBoxHelper.Show("Failed to obtain the BlackBerry ID token from Security Authority.\r\nPlease check your Internet connection", null, MessageBoxButtons.OK, MessageBoxIcon.Error); + MessageBoxHelper.Show("Failed to obtain the BlackBerry ID token.\r\nPlease check your Internet connection", null, MessageBoxButtons.OK, MessageBoxIcon.Error); } } @@ -243,6 +265,113 @@ private void bttCreateSigner_Click(object sender, EventArgs e) return; if (!CheckPath(txtPbdtPath, "PBDT path")) return; + + UpdateActionButtons(false); + Log("Starting registration..." + Environment.NewLine); + + // create CSK file: + bool successful; + string certificateFileName; + using (var runner = new KeyToolRegisterRunner(RunnerDefaults.ToolsDirectory, txtCsjPin.Text, txtCskPassword.Text, txtRdkPath.Text, txtPbdtPath.Text)) + { + successful = runner.Execute(); + certificateFileName = runner.CertificateFileName; + + // print results: + if (!string.IsNullOrEmpty(runner.LastOutput)) + Log(runner.LastOutput); + } + + // refresh the UI: + Log("Registration finished."); + _developer.InvalidateTokens(); + UpdateUI(); + + // and save the password: + if (successful) + { + _developer.UpdateCertificate(certificateFileName, txtCskPassword.Text, true); + + if (_developer.IsTabletRegistered) + { + // update the name of the developer (publisher): + txtName.Text = _developer.UpdateName(null); + MessageBoxHelper.Show("You have successfully registered your BlackBerry Tablet Signer", null, MessageBoxButtons.OK, MessageBoxIcon.Information); + } + else + { + MessageBoxHelper.Show("Sorry, something unexpected has happened. Please verify logs, unregister and try again.", null, MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + else + { + MessageBoxHelper.Show("Failed to create BlackBerry Tablet Signer. Examine logs for more details.", null, MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + + private void bttImportCertificate_Click(object sender, EventArgs e) + { + if (CertHelper.Import(_developer)) + { + AuthorName = _developer.Name; + Password = _developer.CskPassword; + + UpdateUI(); + } + } + + private void bttNavigate_Click(object sender, EventArgs e) + { + // open the folder, where all the certificates are placed: + DialogHelper.StartExplorer(_developer.DataPath); + } + + private void bttRefresh_Click(object sender, EventArgs e) + { + if (CertHelper.ReloadAuthor(_developer)) + { + AuthorName = _developer.Name; + Password = _developer.CskPassword; + } + } + + private void bttCreateCertificate_Click(object sender, EventArgs e) + { + if (!CheckPassword(txtPassword, txtConfirmPassword, null)) + return; + if (!CheckName(txtName)) + return; + + using (var runner = new KeyToolGenRunner(RunnerDefaults.ToolsDirectory, AuthorName, Password, null)) + { + Log("Started certificate generation..." + Environment.NewLine); + var success = runner.Execute(); + + // print results: + if (!string.IsNullOrEmpty(runner.LastError)) + Log(runner.LastError); + if (!string.IsNullOrEmpty(runner.LastOutput)) + Log(runner.LastOutput); + + Log("Certificate creation finished"); + // show result message: + if (success && string.IsNullOrEmpty(runner.LastError)) + { + _developer.UpdateCertificate(runner.CertificateFileName, txtCskPassword.Text, true); + + if (!string.IsNullOrEmpty(runner.LastOutput)) + { + MessageBoxHelper.Show("Keystore certificate has been succesfully created", null, MessageBoxButtons.OK, MessageBoxIcon.Information); + } + } + else + { + if (!string.IsNullOrEmpty(runner.LastError)) + { + MessageBoxHelper.Show("Failed to create developer profile", null, MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + } } } } diff --git a/src_vs2012/VSNDK.Package/Options/Dialogs/RegistrationForm.resx b/src_vs2012/VSNDK.Package/Options/Dialogs/RegistrationForm.resx index bca630d6..da816002 100644 --- a/src_vs2012/VSNDK.Package/Options/Dialogs/RegistrationForm.resx +++ b/src_vs2012/VSNDK.Package/Options/Dialogs/RegistrationForm.resx @@ -118,7 +118,7 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - To complete the registration both - BlackBerry ID token and developer certificate - are required. However if you created BlackBerry Signer at tablet's section, it can be also used to deploy and debug here. + To complete the registration both - BlackBerry ID token and developer certificate - are required. However if you created BlackBerry Signer at tablet's section, it can be also used to deploy and debug applications here. Type the password to use with the BlackBerry token. The browser will open and you will be asked to create or login to your BlackBerry ID. Token can be used to sign applications and publish in BlackBerry AppWorld or to create debug-tokens, required for debugging purposes on real devices. diff --git a/src_vs2012/VSNDK.Package/Options/SigningOptionControl.Designer.cs b/src_vs2012/VSNDK.Package/Options/SigningOptionControl.Designer.cs index f2cd6d18..f7dbd20e 100644 --- a/src_vs2012/VSNDK.Package/Options/SigningOptionControl.Designer.cs +++ b/src_vs2012/VSNDK.Package/Options/SigningOptionControl.Designer.cs @@ -30,6 +30,7 @@ private void InitializeComponent() { System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(SigningOptionControl)); this.groupBox1 = new System.Windows.Forms.GroupBox(); + this.lblStatus = new System.Windows.Forms.Label(); this.bttUnregister = new System.Windows.Forms.Button(); this.bttRegister = new System.Windows.Forms.Button(); this.lblMore = new System.Windows.Forms.LinkLabel(); @@ -46,7 +47,6 @@ private void InitializeComponent() this.bttChangeCert = new System.Windows.Forms.Button(); this.bttNavigate = new System.Windows.Forms.Button(); this.label4 = new System.Windows.Forms.Label(); - this.lblStatus = new System.Windows.Forms.Label(); this.groupBox1.SuspendLayout(); this.groupBox2.SuspendLayout(); this.SuspendLayout(); @@ -67,6 +67,16 @@ private void InitializeComponent() this.groupBox1.TabStop = false; this.groupBox1.Text = "BlackBerry Signing Authority"; // + // lblStatus + // + this.lblStatus.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Right))); + this.lblStatus.Location = new System.Drawing.Point(234, 48); + this.lblStatus.Name = "lblStatus"; + this.lblStatus.Size = new System.Drawing.Size(156, 45); + this.lblStatus.TabIndex = 4; + this.lblStatus.TextAlign = System.Drawing.ContentAlignment.BottomLeft; + // // bttUnregister // this.bttUnregister.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); @@ -221,7 +231,7 @@ private void InitializeComponent() this.bttChangeCert.Name = "bttChangeCert"; this.bttChangeCert.Size = new System.Drawing.Size(75, 23); this.bttChangeCert.TabIndex = 2; - this.bttChangeCert.Text = "&Select..."; + this.bttChangeCert.Text = "&Import..."; this.bttChangeCert.UseVisualStyleBackColor = true; this.bttChangeCert.Click += new System.EventHandler(this.bttChangeCert_Click); // @@ -232,7 +242,7 @@ private void InitializeComponent() this.bttNavigate.Name = "bttNavigate"; this.bttNavigate.Size = new System.Drawing.Size(75, 23); this.bttNavigate.TabIndex = 3; - this.bttNavigate.Text = "S&how..."; + this.bttNavigate.Text = "Detail&s..."; this.bttNavigate.UseVisualStyleBackColor = true; this.bttNavigate.Click += new System.EventHandler(this.bttNavigate_Click); // @@ -246,16 +256,6 @@ private void InitializeComponent() this.label4.TabIndex = 8; this.label4.Text = resources.GetString("label4.Text"); // - // lblStatus - // - this.lblStatus.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Right))); - this.lblStatus.Location = new System.Drawing.Point(234, 48); - this.lblStatus.Name = "lblStatus"; - this.lblStatus.Size = new System.Drawing.Size(156, 45); - this.lblStatus.TabIndex = 4; - this.lblStatus.TextAlign = System.Drawing.ContentAlignment.BottomLeft; - // // SigningOptionControl // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); diff --git a/src_vs2012/VSNDK.Package/Options/SigningOptionControl.cs b/src_vs2012/VSNDK.Package/Options/SigningOptionControl.cs index f272adae..91d4f0c4 100644 --- a/src_vs2012/VSNDK.Package/Options/SigningOptionControl.cs +++ b/src_vs2012/VSNDK.Package/Options/SigningOptionControl.cs @@ -1,7 +1,5 @@ using System; -using System.IO; using System.Windows.Forms; -using RIM.VSNDK_Package.Diagnostics; using RIM.VSNDK_Package.Options.Dialogs; using RIM.VSNDK_Package.Tools; using RIM.VSNDK_Package.ViewModels; @@ -59,27 +57,10 @@ public void OnActivate() private void ReloadAuthor() { - // try to reload info with cached password: - if (_vm.Developer.HasPassword) + if (CertHelper.ReloadAuthor(_vm.Developer)) { - Author = _vm.Developer.UpdateName(null); UpdateUI(); - - if (!string.IsNullOrEmpty(Author)) - return; } - - // if it failed, ask for new password: - var form = new PasswordForm(); - if (form.ShowDialog() != DialogResult.OK) - return; - - _vm.Developer.UpdatePassword(form.Password, form.ShouldRemember); - - // try again to reload data from certificate: - Author = _vm.Developer.UpdateName(null); - UpdateUI(); - VerifyAuthor(Author); } private void lblMore_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) @@ -87,108 +68,18 @@ private void lblMore_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) DialogHelper.StartURL("http://www.blackberry.com/go/codesigning/"); } - private static void VerifyAuthor(string author) - { - if (string.IsNullOrEmpty(author)) - { - MessageBoxHelper.Show("Unable to load info about author", "Invalid password or certificate file", MessageBoxButtons.OK, MessageBoxIcon.Warning); - } - } - - internal static void CopyExistingCert(DeveloperDefinition developer) - { - if (developer == null) - throw new ArgumentNullException("developer"); - if (string.IsNullOrEmpty(developer.DataPath)) - throw new ArgumentOutOfRangeException("developer"); - - // navigate for new certificate: - var form = DialogHelper.OpenCertFile(developer.DataPath); - - if (form.ShowDialog() == DialogResult.OK && File.Exists(form.FileName)) - { - // will need to move the file? - ask for confirmation, if one with the same name exists: - var srcPath = form.FileName; - var fileName = Path.GetFileName(srcPath); - var folderName = Path.GetDirectoryName(srcPath); - - if (string.IsNullOrEmpty(fileName) || string.IsNullOrEmpty(folderName)) - return; - - // copy the file: - if (string.Compare(developer.DataPath, folderName, StringComparison.InvariantCultureIgnoreCase) != 0) - { - var destPath = Path.Combine(developer.DataPath, fileName); - if (File.Exists(destPath)) - { - var result = MessageBoxHelper.Show("File \"" + fileName + "\" already exists in certificate storage folder.\r\nDo you want to overwrite it?", - null, MessageBoxButtons.YesNoCancel, MessageBoxIcon.Exclamation); - - if (result == DialogResult.Cancel) - return; - if (result == DialogResult.No) - { - // generate new name: - fileName = "author-" + DateTime.Now.ToString("yyyy-MM-dd") + ".p12"; - destPath = Path.Combine(developer.DataPath, fileName); - } - } - - try - { - File.Copy(srcPath, destPath, true); - } - catch (Exception ex) - { - TraceLog.WriteException(ex, "Unable to copy certificate file \"{0}\"", srcPath); - MessageBoxHelper.Show(ex.Message, "Certificate file error", MessageBoxButtons.OK, MessageBoxIcon.Error); - return; - } - } - - developer.UpdateCertificate(fileName); - - // ask for password several times: - while (true) - { - var passForm = new PasswordForm(); - - if (passForm.ShowDialog() == DialogResult.OK) - { - // load info from new certificate: - developer.UpdateName(passForm.Password); - - // succeeded - yes? - if (developer.HasName) - { - developer.UpdatePassword(passForm.Password, passForm.ShouldRemember); - break; - } - - // no - display error and ask again: - VerifyAuthor(developer.Name); - } - else - { - break; - } - } - } - } - private void bttChangeCert_Click(object sender, EventArgs e) { - CopyExistingCert(_vm.Developer); + CertHelper.Import(_vm.Developer); UpdateUI(); } private void bttNavigate_Click(object sender, EventArgs e) { - var path = _vm.Developer.CertificateFullPath; - if (string.IsNullOrEmpty(path)) - return; + var form = new CertificateDetailsForm(_vm.Developer); + form.ShowDialog(); - DialogHelper.StartExplorerForFile(path); + UpdateUI(); } private void bttDeletePassword_Click(object sender, EventArgs e) diff --git a/src_vs2012/VSNDK.Package/Tools/KeyToolGenRunner.cs b/src_vs2012/VSNDK.Package/Tools/KeyToolGenRunner.cs index eed35ce1..67006787 100644 --- a/src_vs2012/VSNDK.Package/Tools/KeyToolGenRunner.cs +++ b/src_vs2012/VSNDK.Package/Tools/KeyToolGenRunner.cs @@ -1,4 +1,6 @@ using System; +using System.IO; +using RIM.VSNDK_Package.ViewModels; namespace RIM.VSNDK_Package.Tools { @@ -79,30 +81,44 @@ public string StoreFileName } } + /// + /// Gets the name of the certificate file created (if needed) with info about the developer (publisher). + /// + public string CertificateFileName + { + get + { + string fileName = null; + + if (!string.IsNullOrEmpty(_storeFileName)) + { + fileName = Path.GetFileName(_storeFileName); + } + + return string.IsNullOrEmpty(fileName) ? DeveloperDefinition.DefaultCertificateName : fileName; + } + } + #endregion private void UpdateArguments() { - Arguments = string.Format(@"/C blackberry-keytool -genkeypair{0} -author ""{1}"" -storepass ""{2}""", - string.IsNullOrEmpty(StoreFileName) ? string.Empty : string.Concat(" -keystore \"", System.Environment.ExpandEnvironmentVariables(StoreFileName), "\""), - Name, Password); + if (string.IsNullOrEmpty(StoreFileName)) + { + Arguments = string.Format(@"/C blackberry-keytool -genkeypair -author ""{0}"" -storepass ""{1}""", Name, Password); + } + else + { + Arguments = string.Format(@"/C blackberry-keytool -genkeypair -author ""{0}"" -storepass ""{1}"" -keystore ""{2}""", + Name, Password, System.Environment.ExpandEnvironmentVariables(StoreFileName)); + } } protected override void ConsumeResults(string output, string error) { if (string.IsNullOrEmpty(error) && !string.IsNullOrEmpty(output)) { - var lines = output.Split(new[] { '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries); - - // check, if there is any runtime error message: - foreach (var line in lines) - { - if (line.StartsWith("error:", StringComparison.InvariantCultureIgnoreCase)) - { - LastError = line.Substring(6).Trim(); - break; - } - } + LastError = ExtractErrorMessages(output); } } } diff --git a/src_vs2012/VSNDK.Package/Tools/KeyToolRegisterRunner.cs b/src_vs2012/VSNDK.Package/Tools/KeyToolRegisterRunner.cs new file mode 100644 index 00000000..ad8da4e0 --- /dev/null +++ b/src_vs2012/VSNDK.Package/Tools/KeyToolRegisterRunner.cs @@ -0,0 +1,129 @@ +using System; +using RIM.VSNDK_Package.ViewModels; + +namespace RIM.VSNDK_Package.Tools +{ + /// + /// Runner, that calls specific tool to register Signing Authority based on CSJ files. + /// + internal sealed class KeyToolRegisterRunner : ToolRunner + { + private string _pin; + private string _password; + private string _rdkFileName; + private string _pbdtFileName; + + /// + /// Init constructor. + /// + /// Tools directory + public KeyToolRegisterRunner(string workingDirectory, string pin, string password, string rdkFileName, string pbdtFileName) + : base("cmd.exe", workingDirectory) + { + if (string.IsNullOrEmpty(pin)) + throw new ArgumentNullException("pin"); + if (string.IsNullOrEmpty(password)) + throw new ArgumentNullException("password"); + if (string.IsNullOrEmpty(rdkFileName)) + throw new ArgumentNullException("rdkFileName"); + if (string.IsNullOrEmpty(pbdtFileName)) + throw new ArgumentNullException("pbdtFileName"); + + _pin = pin; + _password = password; + _rdkFileName = rdkFileName; + _pbdtFileName = pbdtFileName; + UpdateArguments(); + } + + #region Properties + + /// + /// Gets or sets the PIN setup at the time CSJ files were generated. It is required to decode info form them. + /// + public string PIN + { + get { return _pin; } + set + { + if (!string.IsNullOrEmpty(value)) + { + _pin = value; + UpdateArguments(); + } + } + } + + /// + /// Gets or sets the access password for the generated certificate. + /// + public string Password + { + get { return _password; } + set + { + if (!string.IsNullOrEmpty(value)) + { + _password = value; + UpdateArguments(); + } + } + } + + /// + /// Gets or sets full path to the RDK file (received from BlackBerry). + /// + public string RdkFileName + { + get { return _rdkFileName; } + set + { + if (!string.IsNullOrEmpty(value)) + { + _rdkFileName = value; + UpdateArguments(); + } + } + } + + /// + /// Gets or sets full path to the PBDT file (received from BlackBerry). + /// + public string PbdtFileName + { + get { return _pbdtFileName; } + set + { + if (!string.IsNullOrEmpty(value)) + { + _pbdtFileName = value; + UpdateArguments(); + } + } + } + + /// + /// Gets the name of the certificate file created (if needed) with info about the developer (publisher). + /// + public string CertificateFileName + { + get { return DeveloperDefinition.DefaultCertificateName; } + } + + #endregion + + private void UpdateArguments() + { + Arguments = string.Format(@"/C blackberry-signer.bat -register -csjpin ""{0}"" -storepass ""{1}"" ""{2}"" ""{3}""", + _pin, _password, _rdkFileName, _pbdtFileName); + } + + protected override void ConsumeResults(string output, string error) + { + if (string.IsNullOrEmpty(error) && !string.IsNullOrEmpty(output)) + { + LastError = ExtractErrorMessages(output); + } + } + } +} diff --git a/src_vs2012/VSNDK.Package/Tools/KeyToolRemoveRunner.cs b/src_vs2012/VSNDK.Package/Tools/KeyToolRemoveRunner.cs index 06fc194c..c6439b1e 100644 --- a/src_vs2012/VSNDK.Package/Tools/KeyToolRemoveRunner.cs +++ b/src_vs2012/VSNDK.Package/Tools/KeyToolRemoveRunner.cs @@ -21,17 +21,7 @@ protected override void ConsumeResults(string output, string error) { if (string.IsNullOrEmpty(error) && !string.IsNullOrEmpty(output)) { - var lines = output.Split(new[] { '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries); - - // check, if there is any runtime error message: - foreach (var line in lines) - { - if (line.StartsWith("error:", StringComparison.InvariantCultureIgnoreCase)) - { - LastError = line.Substring(6).Trim(); - break; - } - } + LastError = ExtractErrorMessages(output); } } } diff --git a/src_vs2012/VSNDK.Package/VSNDK.Package.csproj b/src_vs2012/VSNDK.Package/VSNDK.Package.csproj index a4e16d09..c6c03c65 100644 --- a/src_vs2012/VSNDK.Package/VSNDK.Package.csproj +++ b/src_vs2012/VSNDK.Package/VSNDK.Package.csproj @@ -282,6 +282,7 @@ Component + Form @@ -295,6 +296,12 @@ AddLocalNdkForm.cs + + Form + + + CertificateDetailsForm.cs + Form @@ -376,6 +383,7 @@ + @@ -420,6 +428,9 @@ UpdateManagerDialog.xaml + + CertificateDetailsForm.cs + CskRequestForm.cs diff --git a/src_vs2012/VSNDK.Package/ViewModels/DeveloperDefinition.cs b/src_vs2012/VSNDK.Package/ViewModels/DeveloperDefinition.cs index 2baeacef..11b0cd7d 100644 --- a/src_vs2012/VSNDK.Package/ViewModels/DeveloperDefinition.cs +++ b/src_vs2012/VSNDK.Package/ViewModels/DeveloperDefinition.cs @@ -92,6 +92,14 @@ public string CertificateFullPath get { return string.IsNullOrEmpty(CertificateFileName) ? null : Path.Combine(DataPath, CertificateFileName); } } + /// + /// Gets an indication, if the certificate file exists. + /// + public bool HasCertificate + { + get { return !string.IsNullOrEmpty(CertificateFileName) && File.Exists(CertificateFullPath); } + } + /// /// Gets full path to the BlackBerry ID token file (bbidtoken.csk). /// @@ -184,7 +192,7 @@ public bool HasPassword /// public bool IsRegistered { - get { return !string.IsNullOrEmpty(CertificateFileName) && File.Exists(CertificateFullPath) && File.Exists(CskTokenFullPath); } + get { return HasCertificate && File.Exists(CskTokenFullPath); } } /// @@ -192,11 +200,32 @@ public bool IsRegistered /// public bool IsTabletRegistered { - get { return !string.IsNullOrEmpty(CertificateFileName) && File.Exists(CertificateFullPath) && File.Exists(TabletSignerFullPath) && File.Exists(TabletCskTokenFullPath); } + get + { + return HasCertificate + && File.Exists(TabletCskTokenFullPath) + && File.Exists(TabletSignerFullPath) && GetFileSize(TabletSignerFullPath) > 0; + } } #endregion + /// + /// Gets the size of the file. + /// + private static long GetFileSize(string path) + { + try + { + var info = new FileInfo(path); + return info.Length; + } + catch + { + return 0; + } + } + /// /// Invalidates loaded CSK tokens to force them load from disk again. /// @@ -391,6 +420,15 @@ public void UpdateCertificate(string fileName) } } + /// + /// Updates the certificate file name and password and saves it into registry if required. + /// + public void UpdateCertificate(string fileName, string password, bool remember) + { + UpdateCertificate(fileName); + UpdatePassword(password, remember); + } + /// /// Creates new developer-definition object based on info read from registry and around. /// diff --git a/src_vs2013/VSNDK.Package/VSNDK.Package.csproj b/src_vs2013/VSNDK.Package/VSNDK.Package.csproj index 73b4878b..48d55c51 100644 --- a/src_vs2013/VSNDK.Package/VSNDK.Package.csproj +++ b/src_vs2013/VSNDK.Package/VSNDK.Package.csproj @@ -315,6 +315,9 @@ Options\ApiLevelOptionPage.cs Component + + Options\CertHelper.cs + Options\DialogHelper.cs @@ -334,6 +337,14 @@ Options\Dialogs\AddLocalNdkForm.designer.cs AddLocalNdkForm.cs + + Options\Dialogs\CertificateDetailsForm.cs + Form + + + Options\Dialogs\CertificateDetailsForm.designer.cs + CertificateDetailsForm.cs + Options\Dialogs\CskRequestForm.cs Form @@ -465,6 +476,9 @@ Tools\KeyToolInfoRunner.cs + + Tools\KeyToolRegisterRunner.cs + Tools\KeyToolRemoveRunner.cs @@ -558,6 +572,10 @@ Options\Dialogs\AddLocalNdkForm.resx AddLocalNdkForm.cs + + Options\Dialogs\CertificateDetailsForm.resx + CertificateDetailsForm.cs + Options\Dialogs\CskRequestForm.resx CskRequestForm.cs From 76a7987ae3b7af9466bde41c5444299843b91607 Mon Sep 17 00:00:00 2001 From: Pawel Hofman Date: Thu, 29 May 2014 22:16:55 +0200 Subject: [PATCH 135/851] Made RegistrationForm narrow --- .../Dialogs/RegistrationForm.Designer.cs | 161 ++++++++++-------- .../Options/Dialogs/RegistrationForm.cs | 33 +++- .../Options/SigningOptionControl.cs | 2 +- 3 files changed, 122 insertions(+), 74 deletions(-) diff --git a/src_vs2012/VSNDK.Package/Options/Dialogs/RegistrationForm.Designer.cs b/src_vs2012/VSNDK.Package/Options/Dialogs/RegistrationForm.Designer.cs index 8aa19211..57866f43 100644 --- a/src_vs2012/VSNDK.Package/Options/Dialogs/RegistrationForm.Designer.cs +++ b/src_vs2012/VSNDK.Package/Options/Dialogs/RegistrationForm.Designer.cs @@ -40,15 +40,16 @@ private void InitializeComponent() this.label5 = new System.Windows.Forms.Label(); this.bttCreateToken = new System.Windows.Forms.Button(); this.bttCreateCertificate = new System.Windows.Forms.Button(); - this.groupBox2 = new System.Windows.Forms.GroupBox(); + this.groupBlackBerry10 = new System.Windows.Forms.GroupBox(); this.lblTokenExpiration = new System.Windows.Forms.Label(); this.lblRegistration = new System.Windows.Forms.Label(); this.bttRefresh = new System.Windows.Forms.Button(); this.txtCertName = new System.Windows.Forms.TextBox(); this.label6 = new System.Windows.Forms.Label(); this.bttImportCertificate = new System.Windows.Forms.Button(); + this.cmbSections = new System.Windows.Forms.ComboBox(); this.txtLog = new System.Windows.Forms.TextBox(); - this.groupBox3 = new System.Windows.Forms.GroupBox(); + this.groupTablet = new System.Windows.Forms.GroupBox(); this.lblTabletRegistration = new System.Windows.Forms.Label(); this.label13 = new System.Windows.Forms.Label(); this.lnkMoreInfo = new System.Windows.Forms.LinkLabel(); @@ -67,8 +68,8 @@ private void InitializeComponent() this.label7 = new System.Windows.Forms.Label(); this.label12 = new System.Windows.Forms.Label(); this.bttNavigate = new System.Windows.Forms.Button(); - this.groupBox2.SuspendLayout(); - this.groupBox3.SuspendLayout(); + this.groupBlackBerry10.SuspendLayout(); + this.groupTablet.SuspendLayout(); this.SuspendLayout(); // // label1 @@ -129,7 +130,7 @@ private void InitializeComponent() // this.bttOK.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.bttOK.DialogResult = System.Windows.Forms.DialogResult.OK; - this.bttOK.Location = new System.Drawing.Point(1017, 398); + this.bttOK.Location = new System.Drawing.Point(474, 433); this.bttOK.Name = "bttOK"; this.bttOK.Size = new System.Drawing.Size(75, 23); this.bttOK.TabIndex = 3; @@ -167,36 +168,37 @@ private void InitializeComponent() // this.bttCreateCertificate.Location = new System.Drawing.Point(131, 230); this.bttCreateCertificate.Name = "bttCreateCertificate"; - this.bttCreateCertificate.Size = new System.Drawing.Size(110, 23); + this.bttCreateCertificate.Size = new System.Drawing.Size(113, 23); this.bttCreateCertificate.TabIndex = 12; this.bttCreateCertificate.Text = "Create C&ertificate..."; this.bttCreateCertificate.UseVisualStyleBackColor = true; this.bttCreateCertificate.Click += new System.EventHandler(this.bttCreateCertificate_Click); // - // groupBox2 - // - this.groupBox2.Controls.Add(this.lblTokenExpiration); - this.groupBox2.Controls.Add(this.lblRegistration); - this.groupBox2.Controls.Add(this.bttRefresh); - this.groupBox2.Controls.Add(this.label4); - this.groupBox2.Controls.Add(this.txtCertName); - this.groupBox2.Controls.Add(this.label6); - this.groupBox2.Controls.Add(this.bttImportCertificate); - this.groupBox2.Controls.Add(this.bttCreateCertificate); - this.groupBox2.Controls.Add(this.label2); - this.groupBox2.Controls.Add(this.bttCreateToken); - this.groupBox2.Controls.Add(this.txtName); - this.groupBox2.Controls.Add(this.label3); - this.groupBox2.Controls.Add(this.label5); - this.groupBox2.Controls.Add(this.txtConfirmPassword); - this.groupBox2.Controls.Add(this.txtPassword); - this.groupBox2.Controls.Add(this.label1); - this.groupBox2.Location = new System.Drawing.Point(12, 12); - this.groupBox2.Name = "groupBox2"; - this.groupBox2.Size = new System.Drawing.Size(537, 288); - this.groupBox2.TabIndex = 0; - this.groupBox2.TabStop = false; - this.groupBox2.Text = "BlackBerry 10 Devices"; + // groupBlackBerry10 + // + this.groupBlackBerry10.Controls.Add(this.lblTokenExpiration); + this.groupBlackBerry10.Controls.Add(this.lblRegistration); + this.groupBlackBerry10.Controls.Add(this.bttRefresh); + this.groupBlackBerry10.Controls.Add(this.label4); + this.groupBlackBerry10.Controls.Add(this.txtCertName); + this.groupBlackBerry10.Controls.Add(this.label6); + this.groupBlackBerry10.Controls.Add(this.bttImportCertificate); + this.groupBlackBerry10.Controls.Add(this.bttCreateCertificate); + this.groupBlackBerry10.Controls.Add(this.label2); + this.groupBlackBerry10.Controls.Add(this.bttCreateToken); + this.groupBlackBerry10.Controls.Add(this.txtName); + this.groupBlackBerry10.Controls.Add(this.label3); + this.groupBlackBerry10.Controls.Add(this.label5); + this.groupBlackBerry10.Controls.Add(this.txtConfirmPassword); + this.groupBlackBerry10.Controls.Add(this.txtPassword); + this.groupBlackBerry10.Controls.Add(this.label1); + this.groupBlackBerry10.Location = new System.Drawing.Point(12, 12); + this.groupBlackBerry10.Name = "groupBlackBerry10"; + this.groupBlackBerry10.Size = new System.Drawing.Size(537, 288); + this.groupBlackBerry10.TabIndex = 0; + this.groupBlackBerry10.TabStop = false; + this.groupBlackBerry10.Text = "BlackBerry 10 Devices"; + this.groupBlackBerry10.Visible = false; // // lblTokenExpiration // @@ -210,9 +212,11 @@ private void InitializeComponent() // lblRegistration // this.lblRegistration.AutoSize = true; + this.lblRegistration.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(238))); + this.lblRegistration.ForeColor = System.Drawing.Color.Navy; this.lblRegistration.Location = new System.Drawing.Point(247, 235); this.lblRegistration.Name = "lblRegistration"; - this.lblRegistration.Size = new System.Drawing.Size(165, 13); + this.lblRegistration.Size = new System.Drawing.Size(197, 13); this.lblRegistration.TabIndex = 13; this.lblRegistration.Text = "Registration has been completed."; // @@ -247,12 +251,25 @@ private void InitializeComponent() // this.bttImportCertificate.Location = new System.Drawing.Point(131, 259); this.bttImportCertificate.Name = "bttImportCertificate"; - this.bttImportCertificate.Size = new System.Drawing.Size(110, 23); + this.bttImportCertificate.Size = new System.Drawing.Size(113, 23); this.bttImportCertificate.TabIndex = 12; this.bttImportCertificate.Text = "I&mport Certificate..."; this.bttImportCertificate.UseVisualStyleBackColor = true; this.bttImportCertificate.Click += new System.EventHandler(this.bttImportCertificate_Click); // + // cmbSections + // + this.cmbSections.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.cmbSections.FormattingEnabled = true; + this.cmbSections.Items.AddRange(new object[] { + "BlackBerry 10 Devices", + "BlackBerry PlayBook Tablet"}); + this.cmbSections.Location = new System.Drawing.Point(20, 8); + this.cmbSections.Name = "cmbSections"; + this.cmbSections.Size = new System.Drawing.Size(238, 21); + this.cmbSections.TabIndex = 16; + this.cmbSections.SelectedIndexChanged += new System.EventHandler(this.cmbSections_SelectedIndexChanged); + // // txtLog // this.txtLog.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) @@ -263,41 +280,44 @@ private void InitializeComponent() this.txtLog.Name = "txtLog"; this.txtLog.ReadOnly = true; this.txtLog.ScrollBars = System.Windows.Forms.ScrollBars.Vertical; - this.txtLog.Size = new System.Drawing.Size(1080, 86); + this.txtLog.Size = new System.Drawing.Size(537, 121); this.txtLog.TabIndex = 2; // - // groupBox3 - // - this.groupBox3.Controls.Add(this.lblTabletRegistration); - this.groupBox3.Controls.Add(this.label13); - this.groupBox3.Controls.Add(this.lnkMoreInfo); - this.groupBox3.Controls.Add(this.txtCskConfirmPassword); - this.groupBox3.Controls.Add(this.txtCskPassword); - this.groupBox3.Controls.Add(this.label11); - this.groupBox3.Controls.Add(this.txtCsjPin); - this.groupBox3.Controls.Add(this.label10); - this.groupBox3.Controls.Add(this.txtPbdtPath); - this.groupBox3.Controls.Add(this.label9); - this.groupBox3.Controls.Add(this.bttPbdtNavigate); - this.groupBox3.Controls.Add(this.bttRdkNavigate); - this.groupBox3.Controls.Add(this.bttCreateSigner); - this.groupBox3.Controls.Add(this.txtRdkPath); - this.groupBox3.Controls.Add(this.label8); - this.groupBox3.Controls.Add(this.label7); - this.groupBox3.Controls.Add(this.label12); - this.groupBox3.Location = new System.Drawing.Point(555, 12); - this.groupBox3.Name = "groupBox3"; - this.groupBox3.Size = new System.Drawing.Size(537, 288); - this.groupBox3.TabIndex = 1; - this.groupBox3.TabStop = false; - this.groupBox3.Text = "BlackBerry Tablet"; + // groupTablet + // + this.groupTablet.Controls.Add(this.lblTabletRegistration); + this.groupTablet.Controls.Add(this.label13); + this.groupTablet.Controls.Add(this.lnkMoreInfo); + this.groupTablet.Controls.Add(this.txtCskConfirmPassword); + this.groupTablet.Controls.Add(this.txtCskPassword); + this.groupTablet.Controls.Add(this.label11); + this.groupTablet.Controls.Add(this.txtCsjPin); + this.groupTablet.Controls.Add(this.label10); + this.groupTablet.Controls.Add(this.txtPbdtPath); + this.groupTablet.Controls.Add(this.label9); + this.groupTablet.Controls.Add(this.bttPbdtNavigate); + this.groupTablet.Controls.Add(this.bttRdkNavigate); + this.groupTablet.Controls.Add(this.bttCreateSigner); + this.groupTablet.Controls.Add(this.txtRdkPath); + this.groupTablet.Controls.Add(this.label8); + this.groupTablet.Controls.Add(this.label7); + this.groupTablet.Controls.Add(this.label12); + this.groupTablet.Location = new System.Drawing.Point(12, 12); + this.groupTablet.Name = "groupTablet"; + this.groupTablet.Size = new System.Drawing.Size(537, 288); + this.groupTablet.TabIndex = 1; + this.groupTablet.TabStop = false; + this.groupTablet.Text = "BlackBerry Tablet"; + this.groupTablet.Visible = false; // // lblTabletRegistration // this.lblTabletRegistration.AutoSize = true; + this.lblTabletRegistration.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(238))); + this.lblTabletRegistration.ForeColor = System.Drawing.Color.Navy; this.lblTabletRegistration.Location = new System.Drawing.Point(134, 264); this.lblTabletRegistration.Name = "lblTabletRegistration"; - this.lblTabletRegistration.Size = new System.Drawing.Size(165, 13); + this.lblTabletRegistration.Size = new System.Drawing.Size(197, 13); this.lblTabletRegistration.TabIndex = 16; this.lblTabletRegistration.Text = "Registration has been completed."; // @@ -455,7 +475,8 @@ private void InitializeComponent() // // bttNavigate // - this.bttNavigate.Location = new System.Drawing.Point(12, 398); + this.bttNavigate.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this.bttNavigate.Location = new System.Drawing.Point(12, 433); this.bttNavigate.Name = "bttNavigate"; this.bttNavigate.Size = new System.Drawing.Size(75, 23); this.bttNavigate.TabIndex = 4; @@ -469,12 +490,13 @@ private void InitializeComponent() this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.CancelButton = this.bttOK; - this.ClientSize = new System.Drawing.Size(1104, 433); + this.ClientSize = new System.Drawing.Size(561, 468); + this.Controls.Add(this.cmbSections); this.Controls.Add(this.bttNavigate); - this.Controls.Add(this.groupBox3); this.Controls.Add(this.txtLog); - this.Controls.Add(this.groupBox2); this.Controls.Add(this.bttOK); + this.Controls.Add(this.groupBlackBerry10); + this.Controls.Add(this.groupTablet); this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; this.MaximizeBox = false; this.MinimizeBox = false; @@ -483,10 +505,10 @@ private void InitializeComponent() this.ShowInTaskbar = false; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; this.Text = "Developer Registration"; - this.groupBox2.ResumeLayout(false); - this.groupBox2.PerformLayout(); - this.groupBox3.ResumeLayout(false); - this.groupBox3.PerformLayout(); + this.groupBlackBerry10.ResumeLayout(false); + this.groupBlackBerry10.PerformLayout(); + this.groupTablet.ResumeLayout(false); + this.groupTablet.PerformLayout(); this.ResumeLayout(false); this.PerformLayout(); @@ -505,11 +527,11 @@ private void InitializeComponent() private System.Windows.Forms.Label label1; private System.Windows.Forms.TextBox txtConfirmPassword; private System.Windows.Forms.Label label5; - private System.Windows.Forms.GroupBox groupBox2; + private System.Windows.Forms.GroupBox groupBlackBerry10; private System.Windows.Forms.TextBox txtLog; private System.Windows.Forms.TextBox txtCertName; private System.Windows.Forms.Label label6; - private System.Windows.Forms.GroupBox groupBox3; + private System.Windows.Forms.GroupBox groupTablet; private System.Windows.Forms.LinkLabel lnkMoreInfo; private System.Windows.Forms.TextBox txtCskConfirmPassword; private System.Windows.Forms.TextBox txtCskPassword; @@ -532,5 +554,6 @@ private void InitializeComponent() private System.Windows.Forms.Button bttNavigate; private System.Windows.Forms.Label lblTokenExpiration; private System.Windows.Forms.Label lblRegistration; + private System.Windows.Forms.ComboBox cmbSections; } } \ No newline at end of file diff --git a/src_vs2012/VSNDK.Package/Options/Dialogs/RegistrationForm.cs b/src_vs2012/VSNDK.Package/Options/Dialogs/RegistrationForm.cs index bcd99e43..20cbe270 100644 --- a/src_vs2012/VSNDK.Package/Options/Dialogs/RegistrationForm.cs +++ b/src_vs2012/VSNDK.Package/Options/Dialogs/RegistrationForm.cs @@ -11,7 +11,7 @@ internal partial class RegistrationForm : Form private const string ValidationCaption = "Validation"; private readonly DeveloperDefinition _developer; - public RegistrationForm(DeveloperDefinition developer) + public RegistrationForm(DeveloperDefinition developer, int startupSection) { if (developer == null) throw new ArgumentNullException("developer"); @@ -23,13 +23,14 @@ public RegistrationForm(DeveloperDefinition developer) Password = _developer.CskPassword; if (_developer.HasCertificate) - Log("Found certificate: " + _developer.CertificateFullPath); + Log(string.Format("Found certificate:\r\n * \"{0}\"", _developer.CertificateFullPath)); if (_developer.HasToken) - Log("Found BlackBerry 10 token (v: " + _developer.Token.Version + "): \"" + _developer.CskTokenFullPath + "\", from: " + _developer.Token.CreatedAtString); + Log(string.Format("Found BlackBerry 10 token:\r\n * \"{0}\"\r\n * version: {1}\r\n * created at: {2}", _developer.CskTokenFullPath, _developer.Token.Version, _developer.Token.CreatedAtString)); if (_developer.HasTabletToken) - Log("Found Tablet token (v: " +_developer.TabletToken.Version + "): \"" + _developer.TabletCskTokenFullPath + "\", from: " + _developer.TabletToken.CreatedAtString); + Log(string.Format("Found Tablet token:\r\n * \"{0}\"\r\n * version: {1}\r\n * created at: {2}", _developer.TabletCskTokenFullPath, _developer.TabletToken.Version, _developer.TabletToken.CreatedAtString)); UpdateUI(); + ActivateSection(startupSection); } #region Properties @@ -181,6 +182,11 @@ private void UpdateActionButtons(bool enabled) bttCreateToken.Enabled = enabled; } + private void ActivateSection(int index) + { + cmbSections.SelectedIndex = index; + } + private void txtPassword_TextChanged(object sender, EventArgs e) { txtConfirmPassword.Text = string.Empty; @@ -373,5 +379,24 @@ private void bttCreateCertificate_Click(object sender, EventArgs e) } } } + + private void cmbSections_SelectedIndexChanged(object sender, EventArgs e) + { + switch (cmbSections.SelectedIndex) + { + case 0: + groupBlackBerry10.Visible = true; + groupTablet.Visible = false; + ActiveControl = txtName; + break; + case 1: + groupBlackBerry10.Visible = false; + groupTablet.Visible = true; + ActiveControl = txtRdkPath; + break; + default: + throw new InvalidOperationException("Unsupported index to select"); + } + } } } diff --git a/src_vs2012/VSNDK.Package/Options/SigningOptionControl.cs b/src_vs2012/VSNDK.Package/Options/SigningOptionControl.cs index 91d4f0c4..25983f7c 100644 --- a/src_vs2012/VSNDK.Package/Options/SigningOptionControl.cs +++ b/src_vs2012/VSNDK.Package/Options/SigningOptionControl.cs @@ -181,7 +181,7 @@ private void bttRegister_Click(object sender, EventArgs e) /////////////////////////////// // REGISTER - var registrationForm = new RegistrationForm(_vm.Developer); + var registrationForm = new RegistrationForm(_vm.Developer, 0); registrationForm.ShowDialog(); UpdateUI(); From a5ed624fa05a631955dc391fa36edacf91ae0c29 Mon Sep 17 00:00:00 2001 From: Pawel Hofman Date: Thu, 29 May 2014 22:55:00 +0200 Subject: [PATCH 136/851] Patched to return 'CN=' instead of 'CommonName=' --- src_vs2012/VSNDK.Package/Model/CertificateInfo.cs | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src_vs2012/VSNDK.Package/Model/CertificateInfo.cs b/src_vs2012/VSNDK.Package/Model/CertificateInfo.cs index bdc1bfd1..8661d7a7 100644 --- a/src_vs2012/VSNDK.Package/Model/CertificateInfo.cs +++ b/src_vs2012/VSNDK.Package/Model/CertificateInfo.cs @@ -145,12 +145,12 @@ Found 1 private key } if (string.Compare("subject name:", lines[i], StringComparison.InvariantCultureIgnoreCase) == 0) { - result.SubjectName = lines[++i]; + result.SubjectName = GetCommonName(lines[++i]); continue; } if (string.Compare("issuer name:", lines[i], StringComparison.InvariantCultureIgnoreCase) == 0) { - result.Issuer = lines[++i]; + result.Issuer = GetCommonName(lines[++i]); continue; } if (string.Compare("valid from:", lines[i], StringComparison.InvariantCultureIgnoreCase) == 0) @@ -190,6 +190,17 @@ Found 1 private key return string.IsNullOrEmpty(result.Issuer) ? null : result; } + private static string GetCommonName(string text) + { + if (string.IsNullOrEmpty(text)) + return null; + + if (text.StartsWith("CommonName=", StringComparison.InvariantCultureIgnoreCase)) + return "CN=" + text.Substring(11); + + return text; + } + /// /// Parses the date out of given text. /// From 77301a80e49cb1e7caf93016d5ad3813c4c363ca Mon Sep 17 00:00:00 2001 From: Pawel Hofman Date: Thu, 29 May 2014 22:55:59 +0200 Subject: [PATCH 137/851] Exposing now ExitCode as a public property --- src_vs2012/VSNDK.Package/Tools/ToolRunner.cs | 23 +++++++++++++------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/src_vs2012/VSNDK.Package/Tools/ToolRunner.cs b/src_vs2012/VSNDK.Package/Tools/ToolRunner.cs index 30077ce8..165a7350 100644 --- a/src_vs2012/VSNDK.Package/Tools/ToolRunner.cs +++ b/src_vs2012/VSNDK.Package/Tools/ToolRunner.cs @@ -88,6 +88,12 @@ public bool IsProcessing get { return _isProcessing; } // using custom variable instead of _process.HasExited, as 'data processing' after tool termination should also indicate that state } + public int ExitCode + { + get; + private set; + } + public string LastOutput { get; @@ -134,7 +140,7 @@ public bool Execute() throw new InvalidOperationException("No executable to start"); PrepareExecution(); - int exitCode = int.MinValue; + ExitCode = int.MinValue; try { @@ -144,9 +150,9 @@ public bool Execute() _process.BeginErrorReadLine(); _process.BeginOutputReadLine(); _process.WaitForExit(); - exitCode = _process.ExitCode; + ExitCode = _process.ExitCode; - return exitCode == 0; + return ExitCode == 0; } catch (Exception ex) { @@ -158,7 +164,7 @@ public bool Execute() // release process resources: _process.Close(); - CompleteExecution(exitCode); + CompleteExecution(); } } @@ -170,6 +176,7 @@ public void ExecuteAsync() throw new ObjectDisposedException("ToolRunner"); PrepareExecution(); + ExitCode = int.MinValue; try { @@ -192,13 +199,13 @@ public void ExecuteAsync() private void AsyncProcessExited(object sender, EventArgs e) { - int exitCode = _process.ExitCode; + ExitCode = _process.ExitCode; _process.Exited -= AsyncProcessExited; // release process resources: _process.Close(); - CompleteExecution(exitCode); + CompleteExecution(); } private void NotifyFinished(int exitCode, string output, string error) @@ -231,7 +238,7 @@ private void PrepareExecution() PrepareStartup(); } - private void CompleteExecution(int exitCode) + private void CompleteExecution() { var outputText = _output.Length > 0 ? _output.ToString() : null; var errorText = _error.Length > 0 ? _error.ToString() : null; @@ -258,7 +265,7 @@ private void CompleteExecution(int exitCode) ConsumeResults(outputText, errorText); // notify other listeners, in case they want to get something extra: - NotifyFinished(exitCode, outputText, errorText); + NotifyFinished(ExitCode, outputText, errorText); _isProcessing = false; } From 6a03b333b56839018838b1723ad4daa2fe147ecb Mon Sep 17 00:00:00 2001 From: Pawel Hofman Date: Thu, 29 May 2014 22:56:36 +0200 Subject: [PATCH 138/851] Reloading issuer name, when creating new cert --- src_vs2012/VSNDK.Package/ViewModels/DeveloperDefinition.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/src_vs2012/VSNDK.Package/ViewModels/DeveloperDefinition.cs b/src_vs2012/VSNDK.Package/ViewModels/DeveloperDefinition.cs index 11b0cd7d..7d60d3a9 100644 --- a/src_vs2012/VSNDK.Package/ViewModels/DeveloperDefinition.cs +++ b/src_vs2012/VSNDK.Package/ViewModels/DeveloperDefinition.cs @@ -427,6 +427,7 @@ public void UpdateCertificate(string fileName, string password, bool remember) { UpdateCertificate(fileName); UpdatePassword(password, remember); + UpdateName(null); } /// From c504eb47d96a83b35f241a0e74e306ae56571850 Mon Sep 17 00:00:00 2001 From: Pawel Hofman Date: Thu, 29 May 2014 22:57:27 +0200 Subject: [PATCH 139/851] Removed unwanted white chars from the end of token --- src_vs2012/VSNDK.Package/Options/Dialogs/CskRequestForm.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src_vs2012/VSNDK.Package/Options/Dialogs/CskRequestForm.cs b/src_vs2012/VSNDK.Package/Options/Dialogs/CskRequestForm.cs index 9aa1ffc0..e959c06d 100644 --- a/src_vs2012/VSNDK.Package/Options/Dialogs/CskRequestForm.cs +++ b/src_vs2012/VSNDK.Package/Options/Dialogs/CskRequestForm.cs @@ -82,8 +82,14 @@ private void OnBeforeNavigating(object sender, WebBrowserBeforeNavigatingEventAr string[] data = postData.Split('&'); for (int i = 0; i < data.Length; i++) + { data[i] = HttpUtility.UrlDecode(data[i]); + // and remove some unwanted chars: + if (data[i] != null) + data[i] = data[i].TrimEnd('\t', ' '); + } + StatusCode = 200; Token = new CskTokenInfo(FindContentFor(data, "cskData=")); } From 2259d2ea1c867e8f7f5db74a5ae46ba25b940de9 Mon Sep 17 00:00:00 2001 From: Pawel Hofman Date: Thu, 29 May 2014 22:58:19 +0200 Subject: [PATCH 140/851] Fixed some UI quirks around developer registration --- .../Options/Dialogs/RegistrationForm.cs | 16 +++++++++++----- .../Options/SigningOptionControl.cs | 2 +- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/src_vs2012/VSNDK.Package/Options/Dialogs/RegistrationForm.cs b/src_vs2012/VSNDK.Package/Options/Dialogs/RegistrationForm.cs index 20cbe270..00c9dd61 100644 --- a/src_vs2012/VSNDK.Package/Options/Dialogs/RegistrationForm.cs +++ b/src_vs2012/VSNDK.Package/Options/Dialogs/RegistrationForm.cs @@ -172,6 +172,8 @@ private void UpdateUI() lblTokenExpiration.Text = _developer.HasToken ? "Token expires at: " + _developer.Token.ValidDateString : string.Empty; txtCertName.Text = _developer.CertificateFileName; + bttCreateToken.Enabled = true; + bttImportCertificate.Enabled = true; bttCreateCertificate.Enabled = !_developer.HasCertificate; } @@ -348,36 +350,40 @@ private void bttCreateCertificate_Click(object sender, EventArgs e) if (!CheckName(txtName)) return; + UpdateActionButtons(false); + using (var runner = new KeyToolGenRunner(RunnerDefaults.ToolsDirectory, AuthorName, Password, null)) { Log("Started certificate generation..." + Environment.NewLine); var success = runner.Execute(); // print results: + if (runner.ExitCode != 0) + Log("Exit code: " + runner.ExitCode); if (!string.IsNullOrEmpty(runner.LastError)) Log(runner.LastError); if (!string.IsNullOrEmpty(runner.LastOutput)) Log(runner.LastOutput); Log("Certificate creation finished"); + // show result message: if (success && string.IsNullOrEmpty(runner.LastError)) { _developer.UpdateCertificate(runner.CertificateFileName, txtCskPassword.Text, true); - if (!string.IsNullOrEmpty(runner.LastOutput)) - { - MessageBoxHelper.Show("Keystore certificate has been succesfully created", null, MessageBoxButtons.OK, MessageBoxIcon.Information); - } + MessageBoxHelper.Show("Keystore certificate has been succesfully created", null, MessageBoxButtons.OK, MessageBoxIcon.Information); } else { if (!string.IsNullOrEmpty(runner.LastError)) { - MessageBoxHelper.Show("Failed to create developer profile", null, MessageBoxButtons.OK, MessageBoxIcon.Error); + MessageBoxHelper.Show("Failed to create developer certificate", null, MessageBoxButtons.OK, MessageBoxIcon.Error); } } } + + UpdateUI(); } private void cmbSections_SelectedIndexChanged(object sender, EventArgs e) diff --git a/src_vs2012/VSNDK.Package/Options/SigningOptionControl.cs b/src_vs2012/VSNDK.Package/Options/SigningOptionControl.cs index 25983f7c..fa440790 100644 --- a/src_vs2012/VSNDK.Package/Options/SigningOptionControl.cs +++ b/src_vs2012/VSNDK.Package/Options/SigningOptionControl.cs @@ -154,7 +154,7 @@ private void bttUnregister_Click(object sender, EventArgs e) { if (!string.IsNullOrEmpty(runner.LastOutput)) { - MessageBoxHelper.Show(runner.LastOutput.Replace("CSK", "BB ID Token"), "Unregistered developer profile", MessageBoxButtons.OK, MessageBoxIcon.Information); + MessageBoxHelper.Show(runner.LastOutput.Replace("CSK", "BlackBerry ID token"), "Unregistered developer profile", MessageBoxButtons.OK, MessageBoxIcon.Information); } } else From 324455ea290d435d778146bc02b470658c7b24de Mon Sep 17 00:00:00 2001 From: Pawel Hofman Date: Fri, 30 May 2014 00:15:51 +0200 Subject: [PATCH 141/851] Updated documentation with sample commands --- README.md | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index db18953a..ec040eae 100644 --- a/README.md +++ b/README.md @@ -17,9 +17,18 @@ If Visual Studio 2013 is installed on a machine, where Visual Studio 2012 did al More info [here] (http://connect.microsoft.com/VisualStudio/feedback/details/814147/dia-sdk-installed-into-wrong-directory). ##Build commands -1. build.bat – A batch file that builds the various components of the BlackBerry Native Plug-in to the ..\_BuildResults folder. +1. build.bat – A batch file that builds the various components of the BlackBerry Native Plug-in to the "_BuildResults" folder. 2. setup.bat – A batch file that installs the newly built components of the BlackBerry Native Plug-in to the correct locations on your computer. +Examples: + build.bat - default, builds everything + build.bat vs2010 - to build only for Visual Studio 2010 + build.bat vs2012 "/out:D:\Shared folder\_BuildResults" - to build only for Visual Studio 2012 into specified directory + + setup.bat - installs plugin for all Visual Studio versions + setup.bat vs2010 - installs only for Visual Studio 2010 + setup.bat vs2012 /no-tools - installs plugin for Visual Studio 2012 without bbndk_vs and qnxtools folders copied + ##Contributing The BlackBerry Native Plug-in for Microsoft Visual Studio project currently contains the following code branches: From 337c3afadfb6db045c5deaea5bbe9da137207814 Mon Sep 17 00:00:00 2001 From: Pawel Hofman Date: Fri, 30 May 2014 00:26:56 +0200 Subject: [PATCH 142/851] Fixed build-commands doc layout --- README.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index ec040eae..9c7200e6 100644 --- a/README.md +++ b/README.md @@ -21,13 +21,13 @@ More info [here] (http://connect.microsoft.com/VisualStudio/feedback/details/814 2. setup.bat – A batch file that installs the newly built components of the BlackBerry Native Plug-in to the correct locations on your computer. Examples: - build.bat - default, builds everything - build.bat vs2010 - to build only for Visual Studio 2010 - build.bat vs2012 "/out:D:\Shared folder\_BuildResults" - to build only for Visual Studio 2012 into specified directory + **build.bat** - default, builds everything + **build.bat vs2010** - to build only for Visual Studio 2010 + **build.bat vs2012 "/out:D:\Shared folder\_BuildResults"** - to build only for Visual Studio 2012 into specified directory - setup.bat - installs plugin for all Visual Studio versions - setup.bat vs2010 - installs only for Visual Studio 2010 - setup.bat vs2012 /no-tools - installs plugin for Visual Studio 2012 without bbndk_vs and qnxtools folders copied + **setup.bat** - installs plugin for all Visual Studio versions + **setup.bat vs2010** - installs only for Visual Studio 2010 + **setup.bat vs2012 /no-tools** - installs plugin for Visual Studio 2012 without bbndk_vs and qnxtools folders copied ##Contributing The BlackBerry Native Plug-in for Microsoft Visual Studio project currently contains the following code branches: From 9bd41560cb9e8333f03762a25ba6e0625143791b Mon Sep 17 00:00:00 2001 From: Pawel Hofman Date: Fri, 30 May 2014 00:28:02 +0200 Subject: [PATCH 143/851] Tweaks in doc layout --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 9c7200e6..d9565dbc 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,8 @@ More info [here] (http://connect.microsoft.com/VisualStudio/feedback/details/814 1. build.bat – A batch file that builds the various components of the BlackBerry Native Plug-in to the "_BuildResults" folder. 2. setup.bat – A batch file that installs the newly built components of the BlackBerry Native Plug-in to the correct locations on your computer. -Examples: +Examples: + **build.bat** - default, builds everything **build.bat vs2010** - to build only for Visual Studio 2010 **build.bat vs2012 "/out:D:\Shared folder\_BuildResults"** - to build only for Visual Studio 2012 into specified directory From 7a99a4062317174af7e6c86468cb9cbb51eba87f Mon Sep 17 00:00:00 2001 From: Pawel Hofman Date: Fri, 30 May 2014 01:08:46 +0200 Subject: [PATCH 144/851] Fixed release mode compilation --- src_vs2012/VSNDK.Package.Test/ParserTests.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src_vs2012/VSNDK.Package.Test/ParserTests.cs b/src_vs2012/VSNDK.Package.Test/ParserTests.cs index 1a27db20..63558cd8 100644 --- a/src_vs2012/VSNDK.Package.Test/ParserTests.cs +++ b/src_vs2012/VSNDK.Package.Test/ParserTests.cs @@ -387,8 +387,8 @@ public void ParseDeviceId() [Test] public void ParseCskToken() { - const string cskTokenData = @"#Do not edit manually. Generated automatically by BlackBerry tools. -#Mon Sep 02 08:43:07 EDT 2013 + const string cskTokenData = "#Do not edit manually. Generated automatically by BlackBerry tools." + +@"#Mon Sep 02 08:43:07 EDT 2013 HMAC=111111111111111111111111111\= Salt=22222222222\= IV=33333333333\= From 5169a9c796db44d781e3d45b437d2dda328f6a4c Mon Sep 17 00:00:00 2001 From: Pawel Hofman Date: Fri, 30 May 2014 02:00:19 +0200 Subject: [PATCH 145/851] Typo in .reg generator --- build.bat | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/build.bat b/build.bat index c6b1d51b..0922a960 100644 --- a/build.bat +++ b/build.bat @@ -139,6 +139,7 @@ if %ActionGenScripts% equ 0 (goto skip_scripts) echo %actionNo%: Creating installation scripts if %ActionBuildVS2010% equ 0 (if %ActionGenScripts% neq 2 (goto skip_vs2010_scripts)) +echo Template... call :processTemplates 2010 10.0 :skip_vs2010_scripts @@ -216,7 +217,7 @@ set PluginPath=!PluginPath:)=^^)! REM Create empty file type nul > "%OutputFile%" -for /f "tokens=* delims=" %%l in ("%InputFile%") do ( +for /f "tokens=* delims=" %%l in (%InputFile%) do ( set line=%%l REM Inject empty line, so the sections are easier visible From 1db7c57439a35fc8757ddcc249d68e7fdde2628d Mon Sep 17 00:00:00 2001 From: Pawel Hofman Date: Sat, 31 May 2014 03:04:17 +0200 Subject: [PATCH 146/851] Fixed missing some of the task config files Since they were not copied into output folder, they were also not deployed on test machine, causing lots of strange errors, while compiling. --- src_vs2012/VSNDK.Tasks/VSNDK.Tasks.csproj | 28 +++++++++++++++++++++++ src_vs2013/VSNDK.Tasks/VSNDK.Tasks.csproj | 22 ++++++++++++++++++ 2 files changed, 50 insertions(+) diff --git a/src_vs2012/VSNDK.Tasks/VSNDK.Tasks.csproj b/src_vs2012/VSNDK.Tasks/VSNDK.Tasks.csproj index d8cfead8..3463b238 100644 --- a/src_vs2012/VSNDK.Tasks/VSNDK.Tasks.csproj +++ b/src_vs2012/VSNDK.Tasks/VSNDK.Tasks.csproj @@ -147,33 +147,43 @@ BlackBerrySimulator\Microsoft.Cpp.BlackBerrySimulator.default.props + Always BlackBerrySimulator\Microsoft.Cpp.BlackBerrySimulator.Packager.targets + Always BlackBerrySimulator\Microsoft.Cpp.BlackBerrySimulator.props + Always BlackBerrySimulator\Microsoft.Cpp.BlackBerrySimulator.targets + Always BlackBerrySimulator\Microsoft.CppBuild.BlackBerrySimulator.targets + Always BlackBerry\Microsoft.Cpp.BlackBerry.default.props + Always BlackBerry\Microsoft.Cpp.BlackBerry.Packager.targets + Always BlackBerry\Microsoft.Cpp.BlackBerry.props + Always BlackBerry\Microsoft.Cpp.BlackBerry.targets + Always BlackBerry\Microsoft.CppBuild.BlackBerry.targets + Always Designer @@ -196,57 +206,75 @@ BlackBerrySimulator\Rules\debugger_ndk.xml + Always BlackBerrySimulator\Rules\ndkProjectItemsSchema.xml + Always BlackBerrySimulator\Rules\ndk_directories.xml + Always BlackBerrySimulator\Rules\ndk_general.xml + Always BlackBerrySimulator\Rules\ndk_general_ps.xml + Always BlackBerrySimulator\Rules\packager.xml + Always BlackBerrySimulator\Rules\qcc_cl.xml + Always BlackBerrySimulator\Rules\qcc_lib.xml + Always BlackBerrySimulator\Rules\qcc_link.xml + Always BlackBerry\Rules\debugger_ndk.xml + Always BlackBerry\Rules\ndkProjectItemsSchema.xml + Always BlackBerry\Rules\ndk_directories.xml + Always BlackBerry\Rules\ndk_general.xml + Always BlackBerry\Rules\ndk_general_ps.xml + Always BlackBerry\Rules\packager.xml + Always BlackBerry\Rules\qcc_cl.xml + Always BlackBerry\Rules\qcc_lib.xml + Always BlackBerry\Rules\qcc_link.xml + Always diff --git a/src_vs2013/VSNDK.Tasks/VSNDK.Tasks.csproj b/src_vs2013/VSNDK.Tasks/VSNDK.Tasks.csproj index 88b3fd1b..562a8fc5 100644 --- a/src_vs2013/VSNDK.Tasks/VSNDK.Tasks.csproj +++ b/src_vs2013/VSNDK.Tasks/VSNDK.Tasks.csproj @@ -148,15 +148,19 @@ BlackBerrySimulator\Microsoft.Cpp.BlackBerrySimulator.Packager.targets + Always BlackBerrySimulator\Microsoft.CppBuild.BlackBerrySimulator.targets + Always BlackBerry\Microsoft.Cpp.BlackBerry.Packager.targets + Always BlackBerry\Microsoft.CppBuild.BlackBerry.targets + Always Designer @@ -203,57 +207,75 @@ BlackBerrySimulator\Rules\debugger_ndk.xml + Always BlackBerrySimulator\Rules\ndkProjectItemsSchema.xml + Always BlackBerrySimulator\Rules\ndk_directories.xml + Always BlackBerrySimulator\Rules\ndk_general.xml + Always BlackBerrySimulator\Rules\ndk_general_ps.xml + Always BlackBerrySimulator\Rules\packager.xml + Always BlackBerrySimulator\Rules\qcc_cl.xml + Always BlackBerrySimulator\Rules\qcc_lib.xml + Always BlackBerrySimulator\Rules\qcc_link.xml + Always BlackBerry\Rules\debugger_ndk.xml + Always BlackBerry\Rules\ndkProjectItemsSchema.xml + Always BlackBerry\Rules\ndk_directories.xml + Always BlackBerry\Rules\ndk_general.xml + Always BlackBerry\Rules\ndk_general_ps.xml + Always BlackBerry\Rules\packager.xml + Always BlackBerry\Rules\qcc_cl.xml + Always BlackBerry\Rules\qcc_lib.xml + Always BlackBerry\Rules\qcc_link.xml + Always From 2ca6038cc087dce50627cc68b26fdf10b77079ee Mon Sep 17 00:00:00 2001 From: Pawel Hofman Date: Sat, 31 May 2014 03:06:47 +0200 Subject: [PATCH 147/851] Fixed build system for Visual Studio 2010 As some of the includes does not exist in that version. --- .../BlackBerry/Microsoft.Cpp.BlackBerry.default.props | 3 ++- .../Microsoft.Cpp.BlackBerrySimulator.default.props | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/VSNDK.Tasks/BlackBerry/Microsoft.Cpp.BlackBerry.default.props b/src/VSNDK.Tasks/BlackBerry/Microsoft.Cpp.BlackBerry.default.props index 54e39098..e5dfc4b7 100644 --- a/src/VSNDK.Tasks/BlackBerry/Microsoft.Cpp.BlackBerry.default.props +++ b/src/VSNDK.Tasks/BlackBerry/Microsoft.Cpp.BlackBerry.default.props @@ -21,6 +21,7 @@ Copyright (C) Microsoft Corporation. All rights reserved. $(IntDir) - + diff --git a/src/VSNDK.Tasks/BlackBerrySimulator/Microsoft.Cpp.BlackBerrySimulator.default.props b/src/VSNDK.Tasks/BlackBerrySimulator/Microsoft.Cpp.BlackBerrySimulator.default.props index c633738b..f00e7738 100644 --- a/src/VSNDK.Tasks/BlackBerrySimulator/Microsoft.Cpp.BlackBerrySimulator.default.props +++ b/src/VSNDK.Tasks/BlackBerrySimulator/Microsoft.Cpp.BlackBerrySimulator.default.props @@ -21,6 +21,7 @@ Copyright (C) Microsoft Corporation. All rights reserved. $(IntDir) - + From 5d3749bd741718523f49794374122a49b32667b6 Mon Sep 17 00:00:00 2001 From: Pawel Hofman Date: Sat, 31 May 2014 03:26:37 +0200 Subject: [PATCH 148/851] Fixed 0-item selection problem in dynamic-menu --- .../VSNDK.Package/Model/Integration/DynamicMenuCommand.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src_vs2012/VSNDK.Package/Model/Integration/DynamicMenuCommand.cs b/src_vs2012/VSNDK.Package/Model/Integration/DynamicMenuCommand.cs index 2f6d5aaa..c8f16387 100644 --- a/src_vs2012/VSNDK.Package/Model/Integration/DynamicMenuCommand.cs +++ b/src_vs2012/VSNDK.Package/Model/Integration/DynamicMenuCommand.cs @@ -95,6 +95,7 @@ private static void InternalBeforeCollectionQueryStatusUpdate(object sender, Eve var command = (DynamicMenuCommand)sender; int index = command.MatchedCommandId == 0 ? 0 : command.MatchedCommandId - command.CommandID.ID; + command.MatchedCommandId = 0; // and ask for further status update: command._processedQueryStatus(command, command.Collection, index); @@ -105,6 +106,7 @@ private static void InternalInvokeHandler(object sender, EventArgs e) var command = (DynamicMenuCommand) sender; int index = command.MatchedCommandId == 0 ? 0 : command.MatchedCommandId - command.CommandID.ID; + command.MatchedCommandId = 0; // and notify about selection made: if (command._invokeHandler != null) From 1d6a189a2737cfade7ffb56690210c6d9b62ad07 Mon Sep 17 00:00:00 2001 From: Pawel Hofman Date: Sun, 1 Jun 2014 00:31:08 +0200 Subject: [PATCH 149/851] Added more comments --- src_vs2012/VSNDK.Package/Model/DeviceInfo.cs | 2 +- src_vs2012/VSNDK.Package/Tools/RunnerDefaults.cs | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src_vs2012/VSNDK.Package/Model/DeviceInfo.cs b/src_vs2012/VSNDK.Package/Model/DeviceInfo.cs index c00eaaf5..976dca31 100644 --- a/src_vs2012/VSNDK.Package/Model/DeviceInfo.cs +++ b/src_vs2012/VSNDK.Package/Model/DeviceInfo.cs @@ -223,7 +223,7 @@ public static DeviceInfo Parse(string text, out string error) if (string.IsNullOrEmpty(result.ModelName)) result.ModelName = "PlayBook"; if (string.IsNullOrEmpty(result.ModelNumber)) - result.ModelNumber = "STL100-0"; + result.ModelNumber = "STL100-0"; // copied from Z10 if (result.ScreenDPI == 0) result.ScreenDPI = 167; if (result.ScreenResolution.IsEmpty) diff --git a/src_vs2012/VSNDK.Package/Tools/RunnerDefaults.cs b/src_vs2012/VSNDK.Package/Tools/RunnerDefaults.cs index 9e9d949e..64b4dbfc 100644 --- a/src_vs2012/VSNDK.Package/Tools/RunnerDefaults.cs +++ b/src_vs2012/VSNDK.Package/Tools/RunnerDefaults.cs @@ -31,11 +31,14 @@ static RunnerDefaults() ToolsDirectory = Path.Combine(programFilesX86, "BlackBerry", "VSPlugin-NDK", "qnxtools", "bin"); NdkDirectory = Path.Combine(Path.GetPathRoot(Environment.GetFolderPath(Environment.SpecialFolder.System)), "bbndk_vs"); + // this would probably be much safer, when enumerating all folders and finding one with 'java.exe' or 'jre' in the name JavaHome = Path.Combine(NdkDirectory, "features", "com.qnx.tools.jre.win32_1.6.0.43", "jre"); // the base data folder is different for each platform... if (IsWindowsXP) { + // HINT: in general LocalApplicationData should point to similar path... + // but if you use localized version of Windows XP, the folder is different ;) DataDirectory = Path.Combine(Environment.ExpandEnvironmentVariables("%HomeDrive%%HomePath%"), "Local Settings", "Application Data", "Research In Motion"); } else From 03f15b23d65f598cf825484932c3746f1a7cffae Mon Sep 17 00:00:00 2001 From: Pawel Hofman Date: Mon, 2 Jun 2014 15:27:13 +0200 Subject: [PATCH 150/851] Added some comments --- src_vs2012/VSNDK.Package/Options/Dialogs/DeviceForm.cs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src_vs2012/VSNDK.Package/Options/Dialogs/DeviceForm.cs b/src_vs2012/VSNDK.Package/Options/Dialogs/DeviceForm.cs index b57f1530..9f186d61 100644 --- a/src_vs2012/VSNDK.Package/Options/Dialogs/DeviceForm.cs +++ b/src_vs2012/VSNDK.Package/Options/Dialogs/DeviceForm.cs @@ -126,6 +126,9 @@ public DeviceDefinition ToDevice() return new DeviceDefinition(DeviceName, DeviceIP, DevicePassword, DeviceClass == DialogDeviceClass.Simulator ? DeviceDefinitionType.Simulator : DeviceDefinitionType.Device); } + /// + /// Fills the fields of the form based on the given device. + /// public void FromDevice(DeviceDefinition device) { if (device == null) @@ -143,6 +146,10 @@ public void FromDevice(DeviceDefinition device) DevicePassword = device.Password; } + /// + /// Switches the default to PIN-discover mode. + /// In this mode name field is hidden, instead the combo-box with known devices along with PIN field are shown. + /// public void SetDiscoverMode(IEnumerable devices) { cmbType.Enabled = false; From b264a5f52de189094da090bc0030d2b6848214d4 Mon Sep 17 00:00:00 2001 From: Pawel Hofman Date: Mon, 2 Jun 2014 15:27:26 +0200 Subject: [PATCH 151/851] Removed unnecessary environment setup --- src_vs2012/VSNDK.Package/ViewModels/NdkDefinition.cs | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/src_vs2012/VSNDK.Package/ViewModels/NdkDefinition.cs b/src_vs2012/VSNDK.Package/ViewModels/NdkDefinition.cs index 4f843891..aa4b846c 100644 --- a/src_vs2012/VSNDK.Package/ViewModels/NdkDefinition.cs +++ b/src_vs2012/VSNDK.Package/ViewModels/NdkDefinition.cs @@ -134,17 +134,6 @@ public void Save() settings.SetValue(FieldHostPath, HostPath); settings.SetValue(FieldTargetPath, TargetPath); - - string qnxConfigPath = Path.Combine(RunnerDefaults.DataDirectory, "BlackBerry Native SDK"); - - // TODO: PH: copied from 'SettingsData.cs' - I don't quite get, why we need to overwrite EV - // as this will break Android as well as installed BB10 NDKs with Momentics... - Environment.SetEnvironmentVariable("QNX_TARGET", TargetPath); - Environment.SetEnvironmentVariable("QNX_HOST", HostPath); - Environment.SetEnvironmentVariable("QNX_CONFIGURATION", qnxConfigPath); - - string ndkpath = string.Format(@"{0}/usr/bin;{1}\bin;{0}/usr/qde/eclipse/jre/bin;", HostPath, qnxConfigPath) + Environment.GetEnvironmentVariable("PATH"); - Environment.SetEnvironmentVariable("PATH", ndkpath); } finally { From 46c9b53d994bc407a78dabb0d96219b68fc34cc2 Mon Sep 17 00:00:00 2001 From: Pawel Hofman Date: Mon, 2 Jun 2014 16:08:32 +0200 Subject: [PATCH 152/851] Adding new forms for installation of NDK/simulator --- .../Options/ApiLevelOptionControl.Designer.cs | 20 ++- .../Options/ApiLevelOptionControl.cs | 6 + .../Dialogs/InstallNdkForm.Designer.cs | 63 ++++++++- .../Dialogs/InstallSimulatorForm.Designer.cs | 66 ++++++++++ .../Options/Dialogs/InstallSimulatorForm.cs | 20 +++ .../Options/Dialogs/InstallSimulatorForm.resx | 120 ++++++++++++++++++ src_vs2012/VSNDK.Package/VSNDK.Package.csproj | 9 ++ 7 files changed, 299 insertions(+), 5 deletions(-) create mode 100644 src_vs2012/VSNDK.Package/Options/Dialogs/InstallSimulatorForm.Designer.cs create mode 100644 src_vs2012/VSNDK.Package/Options/Dialogs/InstallSimulatorForm.cs create mode 100644 src_vs2012/VSNDK.Package/Options/Dialogs/InstallSimulatorForm.resx diff --git a/src_vs2012/VSNDK.Package/Options/ApiLevelOptionControl.Designer.cs b/src_vs2012/VSNDK.Package/Options/ApiLevelOptionControl.Designer.cs index 68a934c1..c2aae8d4 100644 --- a/src_vs2012/VSNDK.Package/Options/ApiLevelOptionControl.Designer.cs +++ b/src_vs2012/VSNDK.Package/Options/ApiLevelOptionControl.Designer.cs @@ -34,6 +34,7 @@ private void InitializeComponent() this.bttAddLocal = new System.Windows.Forms.Button(); this.bttInstallNew = new System.Windows.Forms.Button(); this.label2 = new System.Windows.Forms.Label(); + this.bttNewSimulator = new System.Windows.Forms.Button(); this.SuspendLayout(); // // txtDescription @@ -74,7 +75,7 @@ private void InitializeComponent() // bttAddLocal // this.bttAddLocal.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this.bttAddLocal.Location = new System.Drawing.Point(292, 284); + this.bttAddLocal.Location = new System.Drawing.Point(168, 284); this.bttAddLocal.Name = "bttAddLocal"; this.bttAddLocal.Size = new System.Drawing.Size(118, 23); this.bttAddLocal.TabIndex = 4; @@ -85,11 +86,11 @@ private void InitializeComponent() // bttInstallNew // this.bttInstallNew.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this.bttInstallNew.Location = new System.Drawing.Point(416, 284); + this.bttInstallNew.Location = new System.Drawing.Point(292, 284); this.bttInstallNew.Name = "bttInstallNew"; this.bttInstallNew.Size = new System.Drawing.Size(118, 23); this.bttInstallNew.TabIndex = 5; - this.bttInstallNew.Text = "&Install New..."; + this.bttInstallNew.Text = "Install &NDK..."; this.bttInstallNew.UseVisualStyleBackColor = true; this.bttInstallNew.Click += new System.EventHandler(this.bttInstallNew_Click); // @@ -102,6 +103,17 @@ private void InitializeComponent() this.label2.TabIndex = 0; this.label2.Text = "Select the API Level that your application supports."; // + // bttNewSimulator + // + this.bttNewSimulator.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.bttNewSimulator.Location = new System.Drawing.Point(416, 284); + this.bttNewSimulator.Name = "bttNewSimulator"; + this.bttNewSimulator.Size = new System.Drawing.Size(118, 23); + this.bttNewSimulator.TabIndex = 5; + this.bttNewSimulator.Text = "Install &Simulator..."; + this.bttNewSimulator.UseVisualStyleBackColor = true; + this.bttNewSimulator.Click += new System.EventHandler(this.bttNewSimulator_Click); + // // ApiLevelOptionControl // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); @@ -111,6 +123,7 @@ private void InitializeComponent() this.Controls.Add(this.cmbNDKs); this.Controls.Add(this.label1); this.Controls.Add(this.bttAddLocal); + this.Controls.Add(this.bttNewSimulator); this.Controls.Add(this.bttInstallNew); this.Name = "ApiLevelOptionControl"; this.Size = new System.Drawing.Size(537, 310); @@ -127,5 +140,6 @@ private void InitializeComponent() private System.Windows.Forms.Button bttAddLocal; private System.Windows.Forms.Button bttInstallNew; private System.Windows.Forms.Label label2; + private System.Windows.Forms.Button bttNewSimulator; } } diff --git a/src_vs2012/VSNDK.Package/Options/ApiLevelOptionControl.cs b/src_vs2012/VSNDK.Package/Options/ApiLevelOptionControl.cs index 54a9898d..f75d5789 100644 --- a/src_vs2012/VSNDK.Package/Options/ApiLevelOptionControl.cs +++ b/src_vs2012/VSNDK.Package/Options/ApiLevelOptionControl.cs @@ -83,5 +83,11 @@ private void bttInstallNew_Click(object sender, EventArgs e) var form = new InstallNdkForm(); form.ShowDialog(); } + + private void bttNewSimulator_Click(object sender, EventArgs e) + { + var form = new InstallSimulatorForm(); + form.ShowDialog(); + } } } diff --git a/src_vs2012/VSNDK.Package/Options/Dialogs/InstallNdkForm.Designer.cs b/src_vs2012/VSNDK.Package/Options/Dialogs/InstallNdkForm.Designer.cs index da5242a9..c1a97bc5 100644 --- a/src_vs2012/VSNDK.Package/Options/Dialogs/InstallNdkForm.Designer.cs +++ b/src_vs2012/VSNDK.Package/Options/Dialogs/InstallNdkForm.Designer.cs @@ -29,26 +29,79 @@ protected override void Dispose(bool disposing) private void InitializeComponent() { this.bttOK = new System.Windows.Forms.Button(); + this.groupBox1 = new System.Windows.Forms.GroupBox(); + this.groupBox2 = new System.Windows.Forms.GroupBox(); + this.panelInstalled = new System.Windows.Forms.FlowLayoutPanel(); + this.panelAvailable = new System.Windows.Forms.FlowLayoutPanel(); + this.groupBox1.SuspendLayout(); + this.groupBox2.SuspendLayout(); this.SuspendLayout(); // // bttOK // this.bttOK.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.bttOK.DialogResult = System.Windows.Forms.DialogResult.OK; - this.bttOK.Location = new System.Drawing.Point(591, 390); + this.bttOK.Location = new System.Drawing.Point(399, 351); this.bttOK.Name = "bttOK"; this.bttOK.Size = new System.Drawing.Size(75, 23); this.bttOK.TabIndex = 0; this.bttOK.Text = "&OK"; this.bttOK.UseVisualStyleBackColor = true; // + // groupBox1 + // + this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.groupBox1.Controls.Add(this.panelInstalled); + this.groupBox1.Location = new System.Drawing.Point(12, 12); + this.groupBox1.Name = "groupBox1"; + this.groupBox1.Size = new System.Drawing.Size(462, 165); + this.groupBox1.TabIndex = 1; + this.groupBox1.TabStop = false; + this.groupBox1.Text = "Installed"; + // + // groupBox2 + // + this.groupBox2.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.groupBox2.Controls.Add(this.panelAvailable); + this.groupBox2.Location = new System.Drawing.Point(12, 183); + this.groupBox2.Name = "groupBox2"; + this.groupBox2.Size = new System.Drawing.Size(462, 162); + this.groupBox2.TabIndex = 2; + this.groupBox2.TabStop = false; + this.groupBox2.Text = "Available"; + // + // panelInstalled + // + this.panelInstalled.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.panelInstalled.Location = new System.Drawing.Point(6, 19); + this.panelInstalled.Name = "panelInstalled"; + this.panelInstalled.Size = new System.Drawing.Size(450, 140); + this.panelInstalled.TabIndex = 0; + // + // panelAvailable + // + this.panelAvailable.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.panelAvailable.Location = new System.Drawing.Point(6, 19); + this.panelAvailable.Name = "panelAvailable"; + this.panelAvailable.Size = new System.Drawing.Size(450, 137); + this.panelAvailable.TabIndex = 0; + // // InstallNdkForm // this.AcceptButton = this.bttOK; this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.CancelButton = this.bttOK; - this.ClientSize = new System.Drawing.Size(678, 425); + this.ClientSize = new System.Drawing.Size(486, 386); + this.Controls.Add(this.groupBox2); + this.Controls.Add(this.groupBox1); this.Controls.Add(this.bttOK); this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; this.MaximizeBox = false; @@ -57,6 +110,8 @@ private void InitializeComponent() this.ShowInTaskbar = false; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; this.Text = "NDK Installation"; + this.groupBox1.ResumeLayout(false); + this.groupBox2.ResumeLayout(false); this.ResumeLayout(false); } @@ -64,5 +119,9 @@ private void InitializeComponent() #endregion private System.Windows.Forms.Button bttOK; + private System.Windows.Forms.GroupBox groupBox1; + private System.Windows.Forms.GroupBox groupBox2; + private System.Windows.Forms.FlowLayoutPanel panelInstalled; + private System.Windows.Forms.FlowLayoutPanel panelAvailable; } } \ No newline at end of file diff --git a/src_vs2012/VSNDK.Package/Options/Dialogs/InstallSimulatorForm.Designer.cs b/src_vs2012/VSNDK.Package/Options/Dialogs/InstallSimulatorForm.Designer.cs new file mode 100644 index 00000000..5ee89910 --- /dev/null +++ b/src_vs2012/VSNDK.Package/Options/Dialogs/InstallSimulatorForm.Designer.cs @@ -0,0 +1,66 @@ +namespace RIM.VSNDK_Package.Options.Dialogs +{ + partial class InstallSimulatorForm + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.bttOK = new System.Windows.Forms.Button(); + this.SuspendLayout(); + // + // bttOK + // + this.bttOK.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.bttOK.Location = new System.Drawing.Point(552, 394); + this.bttOK.Name = "bttOK"; + this.bttOK.Size = new System.Drawing.Size(75, 23); + this.bttOK.TabIndex = 0; + this.bttOK.Text = "&OK"; + this.bttOK.UseVisualStyleBackColor = true; + // + // InstallSimulatorForm + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(639, 429); + this.Controls.Add(this.bttOK); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; + this.MaximizeBox = false; + this.MinimizeBox = false; + this.Name = "InstallSimulatorForm"; + this.ShowIcon = false; + this.ShowInTaskbar = false; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; + this.Text = "Simulators"; + this.ResumeLayout(false); + + } + + #endregion + + private System.Windows.Forms.Button bttOK; + } +} \ No newline at end of file diff --git a/src_vs2012/VSNDK.Package/Options/Dialogs/InstallSimulatorForm.cs b/src_vs2012/VSNDK.Package/Options/Dialogs/InstallSimulatorForm.cs new file mode 100644 index 00000000..790daaa1 --- /dev/null +++ b/src_vs2012/VSNDK.Package/Options/Dialogs/InstallSimulatorForm.cs @@ -0,0 +1,20 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace RIM.VSNDK_Package.Options.Dialogs +{ + public partial class InstallSimulatorForm : Form + { + public InstallSimulatorForm() + { + InitializeComponent(); + } + } +} diff --git a/src_vs2012/VSNDK.Package/Options/Dialogs/InstallSimulatorForm.resx b/src_vs2012/VSNDK.Package/Options/Dialogs/InstallSimulatorForm.resx new file mode 100644 index 00000000..29dcb1b3 --- /dev/null +++ b/src_vs2012/VSNDK.Package/Options/Dialogs/InstallSimulatorForm.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/src_vs2012/VSNDK.Package/VSNDK.Package.csproj b/src_vs2012/VSNDK.Package/VSNDK.Package.csproj index c6c03c65..2ce0063f 100644 --- a/src_vs2012/VSNDK.Package/VSNDK.Package.csproj +++ b/src_vs2012/VSNDK.Package/VSNDK.Package.csproj @@ -326,6 +326,12 @@ InstallNdkForm.cs + + Form + + + InstallSimulatorForm.cs + Form @@ -434,6 +440,9 @@ CskRequestForm.cs + + InstallSimulatorForm.cs + From f62a2d22779cbe889759e82bf91d63891d90d745 Mon Sep 17 00:00:00 2001 From: Pawel Hofman Date: Tue, 3 Jun 2014 03:03:32 +0200 Subject: [PATCH 153/851] Added origin path to NdkInfo To know, where this info come from. --- src_vs2012/VSNDK.Package/Model/NdkInfo.cs | 24 +++++++++++++------ .../Options/Dialogs/AddLocalNdkForm.cs | 2 +- 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/src_vs2012/VSNDK.Package/Model/NdkInfo.cs b/src_vs2012/VSNDK.Package/Model/NdkInfo.cs index 66d14eff..3ad3c27c 100644 --- a/src_vs2012/VSNDK.Package/Model/NdkInfo.cs +++ b/src_vs2012/VSNDK.Package/Model/NdkInfo.cs @@ -14,7 +14,7 @@ internal sealed class NdkInfo : ApiInfo, IComparable { private const string DescriptorFileName = "blackberry-sdk-descriptor.xml"; - public NdkInfo(string name, Version version, string hostPath, string targetPath, DeviceInfo[] devices) + public NdkInfo(string filePath, string name, Version version, string hostPath, string targetPath, DeviceInfo[] devices) : base(name, version) { if (string.IsNullOrEmpty(hostPath)) @@ -24,12 +24,13 @@ public NdkInfo(string name, Version version, string hostPath, string targetPath, if (devices == null) throw new ArgumentNullException("devices"); + FilePath = filePath; HostPath = hostPath; TargetPath = targetPath; Devices = devices; } - public NdkInfo(string name, Version version, string hostPath, string targetPath) + public NdkInfo(string filePath, string name, Version version, string hostPath, string targetPath) : base(name, version) { if (string.IsNullOrEmpty(hostPath)) @@ -37,6 +38,7 @@ public NdkInfo(string name, Version version, string hostPath, string targetPath) if (string.IsNullOrEmpty(targetPath)) throw new ArgumentNullException("targetPath"); + FilePath = filePath; HostPath = hostPath; TargetPath = targetPath; @@ -65,6 +67,12 @@ public NdkInfo(string name, Version version, string hostPath, string targetPath) #region Properties + public string FilePath + { + get; + private set; + } + public string HostPath { get; @@ -177,7 +185,7 @@ public string ToLongDescription() /// /// Loads info about a single NDK from specific config file, given as XML. /// - public static NdkInfo Load(XmlReader reader) + public static NdkInfo Load(string fileName, XmlReader reader) { if (reader == null) return null; @@ -219,7 +227,7 @@ public static NdkInfo Load(XmlReader reader) } // try to define info about the installation: - return new NdkInfo(name, version, hostPath, targetPath); + return new NdkInfo(fileName, name, version, hostPath, targetPath); } return null; @@ -281,7 +289,7 @@ public static NdkInfo[] Load(params string[] globalNdkConfigFolders) { using (var reader = XmlReader.Create(fileReader)) { - var info = Load(reader); + var info = Load(file, reader); if (info != null && info.Exists()) { var existingIndex = IndexOf(result, info); @@ -445,7 +453,7 @@ private static NdkInfo ScanByTargetFolder(string folder) version = new Version(10, 0, 1); } - return new NdkInfo(string.Concat("BlackBerry Local SDK ", version, " /", DateTime.Now.ToString("yyyy-MM-dd"), "/"), + return new NdkInfo(null, string.Concat("BlackBerry Local SDK ", version, " /", DateTime.Now.ToString("yyyy-MM-dd"), "/"), version, Path.Combine(hostDirs[0], "win32", "x86"), Path.Combine(folder, "qnx6")); } @@ -563,7 +571,9 @@ public bool Save(string outputDirectory) } // store it: - doc.Save(Path.Combine(outputDirectory, fileName.ToString())); + var fullFilePath = Path.Combine(outputDirectory, fileName.ToString()); + doc.Save(fullFilePath); + FilePath = fullFilePath; return true; } } diff --git a/src_vs2012/VSNDK.Package/Options/Dialogs/AddLocalNdkForm.cs b/src_vs2012/VSNDK.Package/Options/Dialogs/AddLocalNdkForm.cs index db777e04..c4de275f 100644 --- a/src_vs2012/VSNDK.Package/Options/Dialogs/AddLocalNdkForm.cs +++ b/src_vs2012/VSNDK.Package/Options/Dialogs/AddLocalNdkForm.cs @@ -118,7 +118,7 @@ private void bttOK_Click(object sender, EventArgs e) } // create result - NewNdk = new NdkInfo(NdkName, NdkVersion, NdkHostPath, NdkTargetPath); + NewNdk = new NdkInfo(null, NdkName, NdkVersion, NdkHostPath, NdkTargetPath); var existingIndex = PackageViewModel.Instance.IndexOfInstalled(NewNdk); var existingNDK = existingIndex >= 0 ? PackageViewModel.Instance.InstalledNDKs[existingIndex] : null; From 72be7b1fcd2f16b85c80401d6704b46698979e87 Mon Sep 17 00:00:00 2001 From: Pawel Hofman Date: Tue, 3 Jun 2014 03:04:04 +0200 Subject: [PATCH 154/851] Changed the order of loaded NDKs To have first loaded NDKs the plugin can modify --- src_vs2012/VSNDK.Package/ViewModels/PackageViewModel.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src_vs2012/VSNDK.Package/ViewModels/PackageViewModel.cs b/src_vs2012/VSNDK.Package/ViewModels/PackageViewModel.cs index 70b979d7..2633c43a 100644 --- a/src_vs2012/VSNDK.Package/ViewModels/PackageViewModel.cs +++ b/src_vs2012/VSNDK.Package/ViewModels/PackageViewModel.cs @@ -64,8 +64,8 @@ public NdkInfo[] InstalledNDKs { // load info about NDKs from specified locations: _installedNDKs = NdkInfo.Load(RunnerDefaults.PluginInstallationConfigDirectory, - RunnerDefaults.InstallationConfigDirectory, RunnerDefaults.SupplementaryInstallationConfigDirectory, + RunnerDefaults.InstallationConfigDirectory, RunnerDefaults.SupplementaryPlayBookInstallationConfigDirectory); } From c12c428ea131dca519eb3fe83481d21a5c8ec672 Mon Sep 17 00:00:00 2001 From: Pawel Hofman Date: Tue, 3 Jun 2014 03:05:36 +0200 Subject: [PATCH 155/851] Implementing new update-manager screens --- .../Options/ApiLevelOptionControl.cs | 3 +- .../Dialogs/InstallNdkForm.Designer.cs | 37 +++--- .../Options/Dialogs/InstallNdkForm.cs | 57 ++++++++- .../Dialogs/ListItemControl.Designer.cs | 88 +++++++++++++ .../Options/Dialogs/ListItemControl.cs | 95 ++++++++++++++ .../Options/Dialogs/ListItemControl.resx | 120 ++++++++++++++++++ src_vs2012/VSNDK.Package/VSNDK.Package.csproj | 10 ++ .../ViewModels/ApiLevelActionType.cs | 33 +++++ .../ViewModels/ApiLevelOptionViewModel.cs | 49 ++++++- 9 files changed, 471 insertions(+), 21 deletions(-) create mode 100644 src_vs2012/VSNDK.Package/Options/Dialogs/ListItemControl.Designer.cs create mode 100644 src_vs2012/VSNDK.Package/Options/Dialogs/ListItemControl.cs create mode 100644 src_vs2012/VSNDK.Package/Options/Dialogs/ListItemControl.resx create mode 100644 src_vs2012/VSNDK.Package/ViewModels/ApiLevelActionType.cs diff --git a/src_vs2012/VSNDK.Package/Options/ApiLevelOptionControl.cs b/src_vs2012/VSNDK.Package/Options/ApiLevelOptionControl.cs index f75d5789..84c783c5 100644 --- a/src_vs2012/VSNDK.Package/Options/ApiLevelOptionControl.cs +++ b/src_vs2012/VSNDK.Package/Options/ApiLevelOptionControl.cs @@ -15,6 +15,7 @@ public ApiLevelOptionControl() { InitializeComponent(); + _vm.Dispatcher = EventDispatcher.From(this); PopulateNDKs(); } @@ -80,7 +81,7 @@ private void bttAddLocal_Click(object sender, EventArgs e) private void bttInstallNew_Click(object sender, EventArgs e) { - var form = new InstallNdkForm(); + var form = new InstallNdkForm(_vm); form.ShowDialog(); } diff --git a/src_vs2012/VSNDK.Package/Options/Dialogs/InstallNdkForm.Designer.cs b/src_vs2012/VSNDK.Package/Options/Dialogs/InstallNdkForm.Designer.cs index c1a97bc5..6f717bd1 100644 --- a/src_vs2012/VSNDK.Package/Options/Dialogs/InstallNdkForm.Designer.cs +++ b/src_vs2012/VSNDK.Package/Options/Dialogs/InstallNdkForm.Designer.cs @@ -30,8 +30,8 @@ private void InitializeComponent() { this.bttOK = new System.Windows.Forms.Button(); this.groupBox1 = new System.Windows.Forms.GroupBox(); - this.groupBox2 = new System.Windows.Forms.GroupBox(); this.panelInstalled = new System.Windows.Forms.FlowLayoutPanel(); + this.groupBox2 = new System.Windows.Forms.GroupBox(); this.panelAvailable = new System.Windows.Forms.FlowLayoutPanel(); this.groupBox1.SuspendLayout(); this.groupBox2.SuspendLayout(); @@ -41,7 +41,7 @@ private void InitializeComponent() // this.bttOK.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.bttOK.DialogResult = System.Windows.Forms.DialogResult.OK; - this.bttOK.Location = new System.Drawing.Point(399, 351); + this.bttOK.Location = new System.Drawing.Point(484, 418); this.bttOK.Name = "bttOK"; this.bttOK.Size = new System.Drawing.Size(75, 23); this.bttOK.TabIndex = 0; @@ -55,34 +55,37 @@ private void InitializeComponent() this.groupBox1.Controls.Add(this.panelInstalled); this.groupBox1.Location = new System.Drawing.Point(12, 12); this.groupBox1.Name = "groupBox1"; - this.groupBox1.Size = new System.Drawing.Size(462, 165); + this.groupBox1.Size = new System.Drawing.Size(547, 197); this.groupBox1.TabIndex = 1; this.groupBox1.TabStop = false; this.groupBox1.Text = "Installed"; // + // panelInstalled + // + this.panelInstalled.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.panelInstalled.AutoScroll = true; + this.panelInstalled.FlowDirection = System.Windows.Forms.FlowDirection.TopDown; + this.panelInstalled.Location = new System.Drawing.Point(6, 19); + this.panelInstalled.Name = "panelInstalled"; + this.panelInstalled.Size = new System.Drawing.Size(535, 172); + this.panelInstalled.TabIndex = 0; + this.panelInstalled.WrapContents = false; + // // groupBox2 // this.groupBox2.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.groupBox2.Controls.Add(this.panelAvailable); - this.groupBox2.Location = new System.Drawing.Point(12, 183); + this.groupBox2.Location = new System.Drawing.Point(12, 215); this.groupBox2.Name = "groupBox2"; - this.groupBox2.Size = new System.Drawing.Size(462, 162); + this.groupBox2.Size = new System.Drawing.Size(547, 197); this.groupBox2.TabIndex = 2; this.groupBox2.TabStop = false; this.groupBox2.Text = "Available"; // - // panelInstalled - // - this.panelInstalled.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.panelInstalled.Location = new System.Drawing.Point(6, 19); - this.panelInstalled.Name = "panelInstalled"; - this.panelInstalled.Size = new System.Drawing.Size(450, 140); - this.panelInstalled.TabIndex = 0; - // // panelAvailable // this.panelAvailable.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) @@ -90,7 +93,7 @@ private void InitializeComponent() | System.Windows.Forms.AnchorStyles.Right))); this.panelAvailable.Location = new System.Drawing.Point(6, 19); this.panelAvailable.Name = "panelAvailable"; - this.panelAvailable.Size = new System.Drawing.Size(450, 137); + this.panelAvailable.Size = new System.Drawing.Size(535, 172); this.panelAvailable.TabIndex = 0; // // InstallNdkForm @@ -99,7 +102,7 @@ private void InitializeComponent() this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.CancelButton = this.bttOK; - this.ClientSize = new System.Drawing.Size(486, 386); + this.ClientSize = new System.Drawing.Size(571, 453); this.Controls.Add(this.groupBox2); this.Controls.Add(this.groupBox1); this.Controls.Add(this.bttOK); diff --git a/src_vs2012/VSNDK.Package/Options/Dialogs/InstallNdkForm.cs b/src_vs2012/VSNDK.Package/Options/Dialogs/InstallNdkForm.cs index b716a05c..cbe80f71 100644 --- a/src_vs2012/VSNDK.Package/Options/Dialogs/InstallNdkForm.cs +++ b/src_vs2012/VSNDK.Package/Options/Dialogs/InstallNdkForm.cs @@ -1,12 +1,65 @@ -using System.Windows.Forms; +using System; +using System.Collections.Generic; +using System.Windows.Forms; +using RIM.VSNDK_Package.Model; +using RIM.VSNDK_Package.ViewModels; namespace RIM.VSNDK_Package.Options.Dialogs { internal partial class InstallNdkForm : Form { - public InstallNdkForm() + #region Private Classes + + /// + /// Class to order APIs from higher to lower numbers. + /// + class DescApiComparer : IComparer + { + public int Compare(NdkInfo x, NdkInfo y) + { + if (x == null && y == null) + return 0; + if (x == null) + return 1; + if (y == null) + return -1; + + return y.Version.CompareTo(x.Version); + } + } + + #endregion + + private readonly ApiLevelOptionViewModel _vm; + + public InstallNdkForm(ApiLevelOptionViewModel vm) { + if (vm == null) + throw new ArgumentNullException("vm"); + InitializeComponent(); + _vm = vm; + + PopulateLists(); + } + + private void PopulateLists() + { + panelInstalled.Controls.Clear(); + + foreach (var definition in _vm.InstalledNDKs) + { + var item = new ListItemControl(); + object argument; + + item.Title = definition.Name; + item.Details = "Device support unknown"; + item.Width = panelInstalled.Width - SystemInformation.VerticalScrollBarWidth - 10; + item.Action = _vm.GetActionForNdk(definition, out argument); + item.ActionArgument = argument; + + panelInstalled.Controls.Add(item); + } } } } diff --git a/src_vs2012/VSNDK.Package/Options/Dialogs/ListItemControl.Designer.cs b/src_vs2012/VSNDK.Package/Options/Dialogs/ListItemControl.Designer.cs new file mode 100644 index 00000000..0e375939 --- /dev/null +++ b/src_vs2012/VSNDK.Package/Options/Dialogs/ListItemControl.Designer.cs @@ -0,0 +1,88 @@ +namespace RIM.VSNDK_Package.Options.Dialogs +{ + internal partial class ListItemControl + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Component Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.lblTitle = new System.Windows.Forms.Label(); + this.lblDetails = new System.Windows.Forms.Label(); + this.bttAction = new System.Windows.Forms.Button(); + this.SuspendLayout(); + // + // lblTitle + // + this.lblTitle.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.lblTitle.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(238))); + this.lblTitle.Location = new System.Drawing.Point(3, 0); + this.lblTitle.Name = "lblTitle"; + this.lblTitle.Size = new System.Drawing.Size(444, 18); + this.lblTitle.TabIndex = 0; + this.lblTitle.Text = "[Title]"; + // + // lblDetails + // + this.lblDetails.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.lblDetails.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Italic, System.Drawing.GraphicsUnit.Point, ((byte)(238))); + this.lblDetails.Location = new System.Drawing.Point(3, 19); + this.lblDetails.Name = "lblDetails"; + this.lblDetails.Size = new System.Drawing.Size(444, 13); + this.lblDetails.TabIndex = 1; + this.lblDetails.Text = "[Details]"; + // + // bttAction + // + this.bttAction.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.bttAction.Location = new System.Drawing.Point(453, 5); + this.bttAction.Name = "bttAction"; + this.bttAction.Size = new System.Drawing.Size(75, 23); + this.bttAction.TabIndex = 2; + this.bttAction.Text = "[Action]"; + this.bttAction.UseVisualStyleBackColor = true; + this.bttAction.Click += new System.EventHandler(this.bttAction_Click); + // + // ListItemControl + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.Controls.Add(this.bttAction); + this.Controls.Add(this.lblDetails); + this.Controls.Add(this.lblTitle); + this.Name = "ListItemControl"; + this.Size = new System.Drawing.Size(528, 36); + this.ResumeLayout(false); + + } + + #endregion + + private System.Windows.Forms.Label lblTitle; + private System.Windows.Forms.Label lblDetails; + private System.Windows.Forms.Button bttAction; + } +} diff --git a/src_vs2012/VSNDK.Package/Options/Dialogs/ListItemControl.cs b/src_vs2012/VSNDK.Package/Options/Dialogs/ListItemControl.cs new file mode 100644 index 00000000..5fb13bfe --- /dev/null +++ b/src_vs2012/VSNDK.Package/Options/Dialogs/ListItemControl.cs @@ -0,0 +1,95 @@ +using System; +using System.Windows.Forms; +using RIM.VSNDK_Package.ViewModels; + +namespace RIM.VSNDK_Package.Options.Dialogs +{ + internal partial class ListItemControl : UserControl + { + public EventHandler ExecuteAction; + + private ApiLevelActionType _action; + + public ListItemControl() + { + InitializeComponent(); + + Action = ApiLevelActionType.Nothing; + } + + #region Properties + + public string Title + { + get { return lblTitle.Text; } + set { lblTitle.Text = value; } + } + + public string Details + { + get { return lblDetails.Text; } + set { lblDetails.Text = value; } + } + + public string ActionName + { + get { return bttAction.Text; } + set { bttAction.Text = value; } + } + + public ApiLevelActionType Action + { + get { return _action; } + set + { + _action = value; + bttAction.Enabled = true; + bttAction.Visible = true; + + switch (_action) + { + case ApiLevelActionType.Hide: + ActionName = string.Empty; + bttAction.Visible = false; + break; + case ApiLevelActionType.Nothing: + ActionName = "Locked"; + bttAction.Enabled = false; + break; + case ApiLevelActionType.Install: + ActionName = "Install"; + break; + case ApiLevelActionType.InstallManually: + ActionName = "Download..."; + break; + case ApiLevelActionType.Uninstall: + ActionName = "Uninstall"; + break; + case ApiLevelActionType.Forget: + ActionName = "Forget"; + break; + + default: + throw new ArgumentOutOfRangeException("Specified action is not supported"); + } + } + } + + public object ActionArgument + { + get; + set; + } + + #endregion + + private void bttAction_Click(object sender, EventArgs e) + { + var actionHandler = ExecuteAction; + + // notify, that user requested to perform the action: + if (actionHandler != null) + actionHandler(this, e); + } + } +} diff --git a/src_vs2012/VSNDK.Package/Options/Dialogs/ListItemControl.resx b/src_vs2012/VSNDK.Package/Options/Dialogs/ListItemControl.resx new file mode 100644 index 00000000..29dcb1b3 --- /dev/null +++ b/src_vs2012/VSNDK.Package/Options/Dialogs/ListItemControl.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/src_vs2012/VSNDK.Package/VSNDK.Package.csproj b/src_vs2012/VSNDK.Package/VSNDK.Package.csproj index 2ce0063f..5397be1e 100644 --- a/src_vs2012/VSNDK.Package/VSNDK.Package.csproj +++ b/src_vs2012/VSNDK.Package/VSNDK.Package.csproj @@ -332,6 +332,12 @@ InstallSimulatorForm.cs + + UserControl + + + ListItemControl.cs + Form @@ -392,6 +398,7 @@ + @@ -443,6 +450,9 @@ InstallSimulatorForm.cs + + ListItemControl.cs + diff --git a/src_vs2012/VSNDK.Package/ViewModels/ApiLevelActionType.cs b/src_vs2012/VSNDK.Package/ViewModels/ApiLevelActionType.cs new file mode 100644 index 00000000..59025907 --- /dev/null +++ b/src_vs2012/VSNDK.Package/ViewModels/ApiLevelActionType.cs @@ -0,0 +1,33 @@ +namespace RIM.VSNDK_Package.ViewModels +{ + /// + /// Enumeration describing, what action can be performed over specified API Level. + /// + internal enum ApiLevelActionType + { + /// + /// Nothing can be done with this API Level (it was installed separatelly and just detected). + /// + Nothing = 0, + /// + /// New API Level can be installed. + /// + Install, + /// + /// Installation of the API Level must be done manually (specified URL should be opened in a browser). + /// + InstallManually, + /// + /// Installed API Level, owned by the plugin, can be removed. + /// + Uninstall, + /// + /// Link added by the developer to custom API Level (installed NDK), can be just removed. + /// + Forget, + /// + /// No action is allowed to be performed. + /// + Hide + } +} diff --git a/src_vs2012/VSNDK.Package/ViewModels/ApiLevelOptionViewModel.cs b/src_vs2012/VSNDK.Package/ViewModels/ApiLevelOptionViewModel.cs index 1698358d..4be9d5be 100644 --- a/src_vs2012/VSNDK.Package/ViewModels/ApiLevelOptionViewModel.cs +++ b/src_vs2012/VSNDK.Package/ViewModels/ApiLevelOptionViewModel.cs @@ -1,9 +1,13 @@ -using RIM.VSNDK_Package.Model; +using System; +using RIM.VSNDK_Package.Model; +using RIM.VSNDK_Package.Tools; namespace RIM.VSNDK_Package.ViewModels { internal sealed class ApiLevelOptionViewModel { + private readonly static Version LastPlayBookVersion = new Version(9, 99, 0, 0); + public NdkInfo[] InstalledNDKs { get { return PackageViewModel.Instance.InstalledNDKs; } @@ -15,10 +19,53 @@ public NdkInfo ActiveNDK set { PackageViewModel.Instance.ActiveNDK = value; } } + public IEventDispatcher Dispatcher + { + get; + set; + } + public void ReloadAndActivate(NdkInfo ndk) { PackageViewModel.Instance.ResetNDKs(); ActiveNDK = ndk; } + + public ApiLevelActionType GetActionForNdk(NdkInfo definition, out object argument) + { + argument = null; + + // nothing should be displayed for not defined NDK: + if (definition == null) + return ApiLevelActionType.Hide; + + // check, if it exists on disk: + bool exists = definition.Exists(); + + // is it NDK owned by the plugin itself? + if (exists && definition.TargetPath != null && definition.TargetPath.StartsWith(RunnerDefaults.NdkDirectory)) + { + return ApiLevelActionType.Uninstall; + } + + // is it a custom definition added? + if (definition.FilePath != null && definition.FilePath.StartsWith(RunnerDefaults.PluginInstallationConfigDirectory)) + { + return ApiLevelActionType.Forget; + } + + // is it a PlayBook NDK? + if (definition.Version <= LastPlayBookVersion) + { + if (exists) + return ApiLevelActionType.Nothing; + + argument = "http://developer.blackberry.com/playbook/native/download/"; + return ApiLevelActionType.InstallManually; + } + + // by default, check, if it can be installed, or it's not owned by the pluign: + return exists ? ApiLevelActionType.Nothing : ApiLevelActionType.Install; + } } } From 68423e530b425dfac28de575199ae49aff3786cd Mon Sep 17 00:00:00 2001 From: Pawel Hofman Date: Tue, 3 Jun 2014 16:51:14 +0200 Subject: [PATCH 156/851] Moved NdkInfo sorting etc. to parent class --- src_vs2012/VSNDK.Package/Model/ApiInfo.cs | 49 ++++++++++++++++++- src_vs2012/VSNDK.Package/Model/NdkInfo.cs | 57 ++++++++++++----------- 2 files changed, 78 insertions(+), 28 deletions(-) diff --git a/src_vs2012/VSNDK.Package/Model/ApiInfo.cs b/src_vs2012/VSNDK.Package/Model/ApiInfo.cs index 502ecc56..623f0289 100644 --- a/src_vs2012/VSNDK.Package/Model/ApiInfo.cs +++ b/src_vs2012/VSNDK.Package/Model/ApiInfo.cs @@ -5,7 +5,7 @@ namespace RIM.VSNDK_Package.Model /// /// Descriptor of a available remotely NDK. /// - internal class ApiInfo + internal class ApiInfo : IComparable { private readonly string _description; @@ -22,6 +22,9 @@ public ApiInfo(string name, Version version) var versionString = Version.ToString(); _description = Name.IndexOf(versionString, StringComparison.Ordinal) >= 0 ? Name : string.Concat(Name, " (", versionString, ")"); + + IsBeta = !string.IsNullOrEmpty(Name) + && (Name.IndexOf("beta", StringComparison.OrdinalIgnoreCase) >= 0 || Name.IndexOf("alpha", StringComparison.InvariantCultureIgnoreCase) >= 0); } #region Properties @@ -44,11 +47,55 @@ public Version Level private set; } + /// + /// Checks if it is really available on current machine. + /// + public virtual bool IsInstalled + { + get { return false; } + } + + /// + /// Gets an indication, if current API is in 'beta' state. + /// + public bool IsBeta + { + get; + private set; + } + #endregion + /// + /// Compares the current object with another object of the same type. + /// + /// + /// A value that indicates the relative order of the objects being compared. The return value has the following meanings: Value Meaning Less than zero This object is less than the parameter.Zero This object is equal to . Greater than zero This object is greater than . + /// + /// An object to compare with this object. + public int CompareTo(ApiInfo other) + { + if (other == null) + return 1; + + int cmp = Version.CompareTo(other.Version); + if (cmp != 0) + return cmp; + + return string.Compare(Name, other.Name, StringComparison.InvariantCultureIgnoreCase); + } + public override string ToString() { return _description; } + + /// + /// Creates an instance of the API for PlayBook. + /// + public static ApiInfo CreateTabletInfo() + { + return new ApiInfo("BlackBerry Native SDK for Tablet OS 2.1.0", new Version(2, 1, 0)); + } } } diff --git a/src_vs2012/VSNDK.Package/Model/NdkInfo.cs b/src_vs2012/VSNDK.Package/Model/NdkInfo.cs index 3ad3c27c..0cbae341 100644 --- a/src_vs2012/VSNDK.Package/Model/NdkInfo.cs +++ b/src_vs2012/VSNDK.Package/Model/NdkInfo.cs @@ -10,7 +10,7 @@ namespace RIM.VSNDK_Package.Model /// /// Descriptor of a locally installed NDK. /// - internal sealed class NdkInfo : ApiInfo, IComparable + internal sealed class NdkInfo : ApiInfo { private const string DescriptorFileName = "blackberry-sdk-descriptor.xml"; @@ -91,23 +91,23 @@ public DeviceInfo[] Devices private set; } - #endregion - - /// - /// Checks if given NDK is really available. - /// - public bool Exists() + public override bool IsInstalled { - try - { - return Directory.Exists(HostPath) && Directory.Exists(TargetPath); - } - catch + get { - return false; + try + { + return Directory.Exists(HostPath) && Directory.Exists(TargetPath); + } + catch + { + return false; + } } } + #endregion + /// /// Compares two paths, if they are identical. /// @@ -290,7 +290,7 @@ public static NdkInfo[] Load(params string[] globalNdkConfigFolders) using (var reader = XmlReader.Create(fileReader)) { var info = Load(file, reader); - if (info != null && info.Exists()) + if (info != null && info.IsInstalled) { var existingIndex = IndexOf(result, info); @@ -336,7 +336,7 @@ public static NdkInfo[] Load(params string[] globalNdkConfigFolders) /// public static int IndexOf(IEnumerable list, NdkInfo info) { - if (info != null) + if (info != null && list != null) { int i = 0; foreach (var item in list) @@ -350,22 +350,25 @@ public static int IndexOf(IEnumerable list, NdkInfo info) } /// - /// Compares the current object with another object of the same type. + /// Returns an index of NdkInfo inside a collection that has the same version. /// - /// - /// A value that indicates the relative order of the objects being compared. The return value has the following meanings: Value Meaning Less than zero This object is less than the parameter.Zero This object is equal to . Greater than zero This object is greater than . - /// - /// An object to compare with this object. - public int CompareTo(NdkInfo other) + public static int IndexOf(IEnumerable list, Version version) { - if (other == null) - return 1; + if (version == null) + throw new ArgumentNullException("version"); - int cmp = Version.CompareTo(other.Version); - if (cmp != 0) - return cmp; + if (list != null) + { + int i = 0; + foreach (var item in list) + { + if (item.Version == version) + return i; + i++; + } + } - return string.Compare(Name, other.Name, StringComparison.InvariantCultureIgnoreCase); + return -1; } /// From ba1bd719166f04cebd48201f4a2231d56c4d8dae Mon Sep 17 00:00:00 2001 From: Pawel Hofman Date: Tue, 3 Jun 2014 16:52:18 +0200 Subject: [PATCH 157/851] Created model class to represent an API Level --- .../VSNDK.Package/Model/ApiInfoArray.cs | 46 +++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 src_vs2012/VSNDK.Package/Model/ApiInfoArray.cs diff --git a/src_vs2012/VSNDK.Package/Model/ApiInfoArray.cs b/src_vs2012/VSNDK.Package/Model/ApiInfoArray.cs new file mode 100644 index 00000000..39da4cc5 --- /dev/null +++ b/src_vs2012/VSNDK.Package/Model/ApiInfoArray.cs @@ -0,0 +1,46 @@ +using System; +using System.Collections; +using System.Collections.Generic; + +namespace RIM.VSNDK_Package.Model +{ + /// + /// Wrapper class for array of API info that belong to the same API Level. + /// + internal sealed class ApiInfoArray : ApiInfo, IEnumerable + { + public ApiInfoArray(string name, Version version, ApiInfo[] items) + : base(name, version) + { + Items = items ?? new ApiInfo[0]; + } + + #region Properties + + public ApiInfo[] Items + { + get; + private set; + } + + /// + /// Gets the number of stored items. + /// + public int Length + { + get { return Items.Length; } + } + + #endregion + + public IEnumerator GetEnumerator() + { + return (IEnumerator)Items.GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetEnumerator(); + } + } +} From f78c59e6bc7d733ae60f6545aa996364c15f3179 Mon Sep 17 00:00:00 2001 From: Pawel Hofman Date: Tue, 3 Jun 2014 16:53:35 +0200 Subject: [PATCH 158/851] Loading available NDKs combines them in API-Level --- .../Tools/ApiLevelListLoadRunner.cs | 88 ++++++++++++++++++- .../VSNDK.Package/Tools/RunnerDefaults.cs | 2 +- 2 files changed, 86 insertions(+), 4 deletions(-) diff --git a/src_vs2012/VSNDK.Package/Tools/ApiLevelListLoadRunner.cs b/src_vs2012/VSNDK.Package/Tools/ApiLevelListLoadRunner.cs index 176a037d..faef0f78 100644 --- a/src_vs2012/VSNDK.Package/Tools/ApiLevelListLoadRunner.cs +++ b/src_vs2012/VSNDK.Package/Tools/ApiLevelListLoadRunner.cs @@ -1,11 +1,12 @@ using System; using System.Collections.Generic; +using System.Diagnostics; using RIM.VSNDK_Package.Model; namespace RIM.VSNDK_Package.Tools { /// - /// Runner, that calls specific tool to list available NDKs. + /// Runner, that calls specific tool to list available NDKs or simulator versions. /// internal sealed class ApiLevelListLoadRunner : ToolRunner { @@ -20,7 +21,7 @@ public ApiLevelListLoadRunner(string workingDirectory, ApiLevelListTypes type) #region Properties /// - /// Gets or sets the type of NDKs list to load. + /// Gets or sets the type of list to load. /// public ApiLevelListTypes Type { @@ -42,7 +43,7 @@ public Uri DescriptorLocation } /// - /// Gets the list of available NDKs. + /// Gets the list received from server. /// public ApiInfo[] APIs { @@ -50,6 +51,15 @@ public ApiInfo[] APIs private set; } + /// + /// Gets the grouped by Level list. + /// + public ApiInfoArray[] ApiLevels + { + get; + private set; + } + #endregion private void UpdateArguments() @@ -127,7 +137,79 @@ protected override void ConsumeResults(string output, string error) } APIs = result.ToArray(); + Array.Sort(APIs); + } + + // group the received list by level: + ApiLevels = GroupList(APIs); + } + + private static ApiInfoArray[] GroupList(ApiInfo[] list) + { + if (list == null || list.Length == 0) + return new ApiInfoArray[0]; + + var groups = new List>(); + + // inject info about tablet NDK: + Add(groups, ApiInfo.CreateTabletInfo()); + + // group BlackBerry 10 items together: + foreach (var item in list) + { + Add(groups, item); } + + // convert to pure arrays and assign the name for each group: + var result = new ApiInfoArray[groups.Count]; + int i = 0; + foreach (var item in groups) + { + result[i++] = new ApiInfoArray(SimplifyName(item[item.Count - 1]), item[0].Level, item.ToArray()); + } + + return result; + } + + /// + /// Get the name of specified item without full version. + /// + private static string SimplifyName(ApiInfo item) + { + if (item == null) + throw new ArgumentNullException("item"); + + if (item.Name.Contains(item.Version.ToString())) + return item.Name.Replace(item.Version.ToString(), item.Level.ToString()); + + return item.Name; + } + + private static void Add(ICollection> groups, ApiInfo item) + { + var group = Find(groups, item.Level); + if (group != null) + { + group.Add(item); + } + else + { + group = new List(); + group.Add(item); + groups.Add(group); + } + } + + private static List Find(IEnumerable> groups, Version level) + { + foreach (var item in groups) + { + Debug.Assert(item.Count > 0, "Invalid number of items!"); + if (item[0].Level == level) + return item; + } + + return null; } } } diff --git a/src_vs2012/VSNDK.Package/Tools/RunnerDefaults.cs b/src_vs2012/VSNDK.Package/Tools/RunnerDefaults.cs index 64b4dbfc..8b79013d 100644 --- a/src_vs2012/VSNDK.Package/Tools/RunnerDefaults.cs +++ b/src_vs2012/VSNDK.Package/Tools/RunnerDefaults.cs @@ -55,7 +55,7 @@ static RunnerDefaults() #if DEBUG // TODO: PH: 2014-05-08: for now hardcoded my repository path: TestToolsDirectory = @"S:\vs-plugin\qnxtools\bin"; - TestNdkDirectory = @"S:\vs-plugin\bbndk_vs"; + TestNdkDirectory = NdkDirectory; // @"S:\vs-plugin\bbndk_vs"; ToolsDirectory = TestToolsDirectory; #endif } From 232e5e86556a31fb8655d44d667d8ceea15e7be7 Mon Sep 17 00:00:00 2001 From: Pawel Hofman Date: Tue, 3 Jun 2014 16:58:27 +0200 Subject: [PATCH 159/851] Improved UI and flow of installing new NDKs --- .../InstallConfirmationForm.Designer.cs | 141 ++++++++++++++++++ .../Dialogs/InstallConfirmationForm.cs | 61 ++++++++ .../Dialogs/InstallConfirmationForm.resx | 120 +++++++++++++++ .../Dialogs/InstallNdkForm.Designer.cs | 3 + .../Options/Dialogs/InstallNdkForm.cs | 101 +++++++++++-- .../Options/Dialogs/ListItemControl.cs | 72 +++++---- src_vs2012/VSNDK.Package/VSNDK.Package.csproj | 13 ++ .../ViewModels/ApiLevelActionType.cs | 6 +- .../ViewModels/ApiLevelOptionViewModel.cs | 123 +++++++++++++-- .../ViewModels/PackageViewModel.cs | 34 ++++- .../ViewModels/UpdateActionTargets.cs | 12 ++ .../VSNDK.Package/ViewModels/UpdateActions.cs | 11 ++ .../VSNDK.Package/ViewModels/UpdateManager.cs | 98 ++++++++++++ 13 files changed, 738 insertions(+), 57 deletions(-) create mode 100644 src_vs2012/VSNDK.Package/Options/Dialogs/InstallConfirmationForm.Designer.cs create mode 100644 src_vs2012/VSNDK.Package/Options/Dialogs/InstallConfirmationForm.cs create mode 100644 src_vs2012/VSNDK.Package/Options/Dialogs/InstallConfirmationForm.resx create mode 100644 src_vs2012/VSNDK.Package/ViewModels/UpdateActionTargets.cs create mode 100644 src_vs2012/VSNDK.Package/ViewModels/UpdateActions.cs create mode 100644 src_vs2012/VSNDK.Package/ViewModels/UpdateManager.cs diff --git a/src_vs2012/VSNDK.Package/Options/Dialogs/InstallConfirmationForm.Designer.cs b/src_vs2012/VSNDK.Package/Options/Dialogs/InstallConfirmationForm.Designer.cs new file mode 100644 index 00000000..09fc5c55 --- /dev/null +++ b/src_vs2012/VSNDK.Package/Options/Dialogs/InstallConfirmationForm.Designer.cs @@ -0,0 +1,141 @@ +namespace RIM.VSNDK_Package.Options.Dialogs +{ + internal partial class InstallConfirmationForm + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.label1 = new System.Windows.Forms.Label(); + this.bttCancel = new System.Windows.Forms.Button(); + this.bttInstall = new System.Windows.Forms.Button(); + this.listView = new System.Windows.Forms.ListView(); + this.columnHeader1 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); + this.columnHeader2 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); + this.columnHeader3 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); + this.SuspendLayout(); + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Location = new System.Drawing.Point(9, 13); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(118, 13); + this.label1.TabIndex = 0; + this.label1.Text = "Select version to install:"; + // + // bttCancel + // + this.bttCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.bttCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel; + this.bttCancel.Location = new System.Drawing.Point(347, 212); + this.bttCancel.Name = "bttCancel"; + this.bttCancel.Size = new System.Drawing.Size(75, 23); + this.bttCancel.TabIndex = 3; + this.bttCancel.Text = "&Cancel"; + this.bttCancel.UseVisualStyleBackColor = true; + // + // bttInstall + // + this.bttInstall.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.bttInstall.DialogResult = System.Windows.Forms.DialogResult.OK; + this.bttInstall.Enabled = false; + this.bttInstall.Location = new System.Drawing.Point(266, 212); + this.bttInstall.Name = "bttInstall"; + this.bttInstall.Size = new System.Drawing.Size(75, 23); + this.bttInstall.TabIndex = 2; + this.bttInstall.Text = "&Install"; + this.bttInstall.UseVisualStyleBackColor = true; + // + // listView + // + this.listView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.listView.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { + this.columnHeader1, + this.columnHeader2, + this.columnHeader3}); + this.listView.FullRowSelect = true; + this.listView.GridLines = true; + this.listView.HideSelection = false; + this.listView.Location = new System.Drawing.Point(12, 29); + this.listView.Name = "listView"; + this.listView.Size = new System.Drawing.Size(410, 173); + this.listView.TabIndex = 1; + this.listView.UseCompatibleStateImageBehavior = false; + this.listView.View = System.Windows.Forms.View.Details; + this.listView.SelectedIndexChanged += new System.EventHandler(this.listView_SelectedIndexChanged); + // + // columnHeader1 + // + this.columnHeader1.Text = "Name"; + this.columnHeader1.Width = 200; + // + // columnHeader2 + // + this.columnHeader2.Text = "Version"; + this.columnHeader2.Width = 80; + // + // columnHeader3 + // + this.columnHeader3.Text = "State"; + this.columnHeader3.Width = 90; + // + // InstallConfirmationForm + // + this.AcceptButton = this.bttInstall; + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.CancelButton = this.bttCancel; + this.ClientSize = new System.Drawing.Size(434, 247); + this.Controls.Add(this.listView); + this.Controls.Add(this.bttInstall); + this.Controls.Add(this.bttCancel); + this.Controls.Add(this.label1); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; + this.MaximizeBox = false; + this.MinimizeBox = false; + this.Name = "InstallConfirmationForm"; + this.ShowIcon = false; + this.ShowInTaskbar = false; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; + this.Text = "Confirmation"; + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.Label label1; + private System.Windows.Forms.Button bttCancel; + private System.Windows.Forms.Button bttInstall; + private System.Windows.Forms.ListView listView; + private System.Windows.Forms.ColumnHeader columnHeader1; + private System.Windows.Forms.ColumnHeader columnHeader2; + private System.Windows.Forms.ColumnHeader columnHeader3; + } +} \ No newline at end of file diff --git a/src_vs2012/VSNDK.Package/Options/Dialogs/InstallConfirmationForm.cs b/src_vs2012/VSNDK.Package/Options/Dialogs/InstallConfirmationForm.cs new file mode 100644 index 00000000..213e83f3 --- /dev/null +++ b/src_vs2012/VSNDK.Package/Options/Dialogs/InstallConfirmationForm.cs @@ -0,0 +1,61 @@ +using System; +using System.Collections.Generic; +using System.Windows.Forms; +using RIM.VSNDK_Package.Model; + +namespace RIM.VSNDK_Package.Options.Dialogs +{ + /// + /// Dialog to show and select list of available versions per particular API Level. + /// + internal partial class InstallConfirmationForm : Form + { + public InstallConfirmationForm(string nameOverride, IEnumerable items, Func installationCheckHandler, Func pendingCheckHandler) + { + if (items == null) + throw new ArgumentNullException("items"); + + InitializeComponent(); + + foreach (var item in items) + { + var i = new ListViewItem(); + i.Tag = item; + i.Text = string.IsNullOrEmpty(nameOverride) || item.IsBeta ? CleanName(item.Name, item.Version, item.Level) : nameOverride; + i.SubItems.Add(item.Version.ToString()); + + // display status, if it's installed or is still under processing: + if (pendingCheckHandler != null && pendingCheckHandler(item)) + { + i.SubItems.Add("Pending..."); + } + else + { + if (installationCheckHandler != null && installationCheckHandler(item)) + i.SubItems.Add("Installed"); + } + + listView.Items.Insert(0, i); + } + } + + private static string CleanName(string text, Version version, Version level) + { + return text.Replace(version.ToString(), string.Empty).Replace(level.ToString(), string.Empty).Trim(); + } + + #region Properties + + public ApiInfo SelectedItem + { + get { return listView.SelectedItems.Count > 0 ? (ApiInfo) listView.SelectedItems[0].Tag : null; } + } + + #endregion + + private void listView_SelectedIndexChanged(object sender, EventArgs e) + { + bttInstall.Enabled = listView.SelectedIndices.Count > 0 && listView.SelectedItems[0].SubItems.Count <= 2; + } + } +} diff --git a/src_vs2012/VSNDK.Package/Options/Dialogs/InstallConfirmationForm.resx b/src_vs2012/VSNDK.Package/Options/Dialogs/InstallConfirmationForm.resx new file mode 100644 index 00000000..29dcb1b3 --- /dev/null +++ b/src_vs2012/VSNDK.Package/Options/Dialogs/InstallConfirmationForm.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/src_vs2012/VSNDK.Package/Options/Dialogs/InstallNdkForm.Designer.cs b/src_vs2012/VSNDK.Package/Options/Dialogs/InstallNdkForm.Designer.cs index 6f717bd1..6de6596b 100644 --- a/src_vs2012/VSNDK.Package/Options/Dialogs/InstallNdkForm.Designer.cs +++ b/src_vs2012/VSNDK.Package/Options/Dialogs/InstallNdkForm.Designer.cs @@ -91,10 +91,13 @@ private void InitializeComponent() this.panelAvailable.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); + this.panelAvailable.AutoScroll = true; + this.panelAvailable.FlowDirection = System.Windows.Forms.FlowDirection.TopDown; this.panelAvailable.Location = new System.Drawing.Point(6, 19); this.panelAvailable.Name = "panelAvailable"; this.panelAvailable.Size = new System.Drawing.Size(535, 172); this.panelAvailable.TabIndex = 0; + this.panelAvailable.WrapContents = false; // // InstallNdkForm // diff --git a/src_vs2012/VSNDK.Package/Options/Dialogs/InstallNdkForm.cs b/src_vs2012/VSNDK.Package/Options/Dialogs/InstallNdkForm.cs index cbe80f71..0e77f1ac 100644 --- a/src_vs2012/VSNDK.Package/Options/Dialogs/InstallNdkForm.cs +++ b/src_vs2012/VSNDK.Package/Options/Dialogs/InstallNdkForm.cs @@ -13,9 +13,9 @@ internal partial class InstallNdkForm : Form /// /// Class to order APIs from higher to lower numbers. /// - class DescApiComparer : IComparer + class DescApiComparer : IComparer { - public int Compare(NdkInfo x, NdkInfo y) + public int Compare(ApiInfoArray x, ApiInfoArray y) { if (x == null && y == null) return 0; @@ -39,26 +39,103 @@ public InstallNdkForm(ApiLevelOptionViewModel vm) InitializeComponent(); _vm = vm; + _vm.NdkListLoaded += NdkListLoaded; - PopulateLists(); + PopulateList(panelInstalled, _vm.InstalledNDKs, info => _vm.GetActionForNDK(info), "No installed Native SDK found", ApiLevelActionType.Hide); + LoadNDKs(false); } - private void PopulateLists() + private void LoadNDKs(bool refresh) { - panelInstalled.Controls.Clear(); + if (_vm.LoadNDKs(refresh)) + { + PopulateList(panelAvailable, null, null, "Loading...", ApiLevelActionType.Hide); + } + } + + protected override void OnClosed(EventArgs e) + { + _vm.NdkListLoaded -= NdkListLoaded; + base.OnClosed(e); + } + + private void NdkListLoaded(object sender, EventArgs eventArgs) + { + var suggested = (ApiInfoArray[]) _vm.RemoteNDKs.Clone(); + Array.Sort(suggested, new DescApiComparer()); + + PopulateList(panelAvailable, suggested, info => _vm.GetActionForNDK(info), "There was an error, while loading list of Native SDKs", ApiLevelActionType.Refresh); + } + + private void PopulateList(Panel panel, IEnumerable items, Func actionEvaluation, string missingItemsMessage, ApiLevelActionType missingItemsAction) + { + int itemsAdded = 0; - foreach (var definition in _vm.InstalledNDKs) + panel.Controls.Clear(); + if (items != null) + { + foreach (var definition in items) + { + var item = new ListItemControl(); + + item.Width = panel.Width - SystemInformation.VerticalScrollBarWidth - 10; + item.Title = definition.Name; + item.Details = "Device support unknown"; + item.Action = actionEvaluation != null ? actionEvaluation(definition) : ApiLevelActionType.Hide; + item.Tag = definition; + item.ExecuteAction += ItemOnExecuteAction; + + panel.Controls.Add(item); + itemsAdded++; + } + } + + if (itemsAdded == 0) { var item = new ListItemControl(); + item.Width = panel.Width - SystemInformation.VerticalScrollBarWidth - 10; + item.Title = missingItemsMessage; + item.Details = string.Empty; + item.Action = missingItemsAction; + + panel.Controls.Add(item); + } + } + + private void ItemOnExecuteAction(object sender, EventArgs eventArgs) + { + var listItem = (ListItemControl) sender; + var definition = listItem != null ? (ApiInfo) listItem.Tag : null; + + if (definition != null) + { object argument; + var action = _vm.GetActionForNDK(definition, out argument); - item.Title = definition.Name; - item.Details = "Device support unknown"; - item.Width = panelInstalled.Width - SystemInformation.VerticalScrollBarWidth - 10; - item.Action = _vm.GetActionForNdk(definition, out argument); - item.ActionArgument = argument; + switch (action) + { + case ApiLevelActionType.Install: + var apiInfoArray = definition as ApiInfoArray; + if (apiInfoArray != null) + { + var form = new InstallConfirmationForm(apiInfoArray.Name, apiInfoArray.Items, info => _vm.CheckIfNdkInstalled(info), info => _vm.IsProcessingNDK(info)); + if (form.ShowDialog() == DialogResult.OK) + { + var info = form.SelectedItem; + _vm.RequestNdk(info); - panelInstalled.Controls.Add(item); + MessageBoxHelper.Show("Scheduled \"" + info + "\" for installation. Please be patient, this might take some time.", + "Update Manager", MessageBoxButtons.OK, MessageBoxIcon.Information); + } + } + break; + case ApiLevelActionType.InstallManually: + DialogHelper.StartURL((string)argument); + break; + case ApiLevelActionType.Refresh: + LoadNDKs(true); + break; + } } } } diff --git a/src_vs2012/VSNDK.Package/Options/Dialogs/ListItemControl.cs b/src_vs2012/VSNDK.Package/Options/Dialogs/ListItemControl.cs index 5fb13bfe..8b9d6124 100644 --- a/src_vs2012/VSNDK.Package/Options/Dialogs/ListItemControl.cs +++ b/src_vs2012/VSNDK.Package/Options/Dialogs/ListItemControl.cs @@ -6,7 +6,7 @@ namespace RIM.VSNDK_Package.Options.Dialogs { internal partial class ListItemControl : UserControl { - public EventHandler ExecuteAction; + public event EventHandler ExecuteAction; private ApiLevelActionType _action; @@ -14,7 +14,8 @@ public ListItemControl() { InitializeComponent(); - Action = ApiLevelActionType.Nothing; + Action = ApiLevelActionType.Hide; + OnActionChanged(); } #region Properties @@ -42,39 +43,50 @@ public ApiLevelActionType Action get { return _action; } set { - _action = value; - bttAction.Enabled = true; - bttAction.Visible = true; - - switch (_action) + if (_action != value) { - case ApiLevelActionType.Hide: - ActionName = string.Empty; - bttAction.Visible = false; - break; - case ApiLevelActionType.Nothing: - ActionName = "Locked"; - bttAction.Enabled = false; - break; - case ApiLevelActionType.Install: - ActionName = "Install"; - break; - case ApiLevelActionType.InstallManually: - ActionName = "Download..."; - break; - case ApiLevelActionType.Uninstall: - ActionName = "Uninstall"; - break; - case ApiLevelActionType.Forget: - ActionName = "Forget"; - break; - - default: - throw new ArgumentOutOfRangeException("Specified action is not supported"); + _action = value; + OnActionChanged(); } } } + private void OnActionChanged() + { + bttAction.Enabled = true; + bttAction.Visible = true; + + switch (_action) + { + case ApiLevelActionType.Hide: + ActionName = string.Empty; + bttAction.Visible = false; + break; + case ApiLevelActionType.Nothing: + ActionName = "Locked"; + bttAction.Enabled = false; + break; + case ApiLevelActionType.Install: + ActionName = "Install"; + break; + case ApiLevelActionType.InstallManually: + ActionName = "Download..."; + break; + case ApiLevelActionType.Uninstall: + ActionName = "Uninstall"; + break; + case ApiLevelActionType.Forget: + ActionName = "Forget"; + break; + case ApiLevelActionType.Refresh: + ActionName = "Reload"; + break; + + default: + throw new ArgumentOutOfRangeException("Specified action is not supported"); + } + } + public object ActionArgument { get; diff --git a/src_vs2012/VSNDK.Package/VSNDK.Package.csproj b/src_vs2012/VSNDK.Package/VSNDK.Package.csproj index 5397be1e..5ad48006 100644 --- a/src_vs2012/VSNDK.Package/VSNDK.Package.csproj +++ b/src_vs2012/VSNDK.Package/VSNDK.Package.csproj @@ -260,6 +260,7 @@ + @@ -320,6 +321,12 @@ DeviceForm.cs + + Form + + + InstallConfirmationForm.cs + Form @@ -416,6 +423,9 @@ + + + Templates\VCWizards\BlackBerry\BarDescriptor\Templates\1033\bar-descriptor.cs bar-descriptor.xsd @@ -447,6 +457,9 @@ CskRequestForm.cs + + InstallConfirmationForm.cs + InstallSimulatorForm.cs diff --git a/src_vs2012/VSNDK.Package/ViewModels/ApiLevelActionType.cs b/src_vs2012/VSNDK.Package/ViewModels/ApiLevelActionType.cs index 59025907..4d86dafe 100644 --- a/src_vs2012/VSNDK.Package/ViewModels/ApiLevelActionType.cs +++ b/src_vs2012/VSNDK.Package/ViewModels/ApiLevelActionType.cs @@ -28,6 +28,10 @@ internal enum ApiLevelActionType /// /// No action is allowed to be performed. /// - Hide + Hide, + /// + /// Data is out-dated and needs to be reloaded. + /// + Refresh } } diff --git a/src_vs2012/VSNDK.Package/ViewModels/ApiLevelOptionViewModel.cs b/src_vs2012/VSNDK.Package/ViewModels/ApiLevelOptionViewModel.cs index 4be9d5be..9eb669c8 100644 --- a/src_vs2012/VSNDK.Package/ViewModels/ApiLevelOptionViewModel.cs +++ b/src_vs2012/VSNDK.Package/ViewModels/ApiLevelOptionViewModel.cs @@ -4,15 +4,28 @@ namespace RIM.VSNDK_Package.ViewModels { - internal sealed class ApiLevelOptionViewModel + internal sealed class ApiLevelOptionViewModel : IDisposable { + public event EventHandler NdkListLoaded; + private readonly static Version LastPlayBookVersion = new Version(9, 99, 0, 0); + private ApiLevelListLoadRunner _ndkLoadRunner; + + ~ApiLevelOptionViewModel() + { + Dispose(false); + } public NdkInfo[] InstalledNDKs { get { return PackageViewModel.Instance.InstalledNDKs; } } + public ApiInfoArray[] RemoteNDKs + { + get { return PackageViewModel.Instance.RemoteNDKs; } + } + public NdkInfo ActiveNDK { get { return PackageViewModel.Instance.ActiveNDK; } @@ -31,7 +44,14 @@ public void ReloadAndActivate(NdkInfo ndk) ActiveNDK = ndk; } - public ApiLevelActionType GetActionForNdk(NdkInfo definition, out object argument) + public ApiLevelActionType GetActionForNDK(ApiInfo definition) + { + object argument; + + return GetActionForNDK(definition, out argument); + } + + public ApiLevelActionType GetActionForNDK(ApiInfo definition, out object argument) { argument = null; @@ -40,24 +60,28 @@ public ApiLevelActionType GetActionForNdk(NdkInfo definition, out object argumen return ApiLevelActionType.Hide; // check, if it exists on disk: - bool exists = definition.Exists(); + bool isInstalled = PackageViewModel.Instance.IndexOfInstalled(definition.Version) >= 0; + var ndkInfo = definition as NdkInfo; - // is it NDK owned by the plugin itself? - if (exists && definition.TargetPath != null && definition.TargetPath.StartsWith(RunnerDefaults.NdkDirectory)) + if (ndkInfo != null) { - return ApiLevelActionType.Uninstall; - } + // is it NDK owned by the plugin itself? + if (isInstalled && ndkInfo.TargetPath != null && ndkInfo.TargetPath.StartsWith(RunnerDefaults.NdkDirectory)) + { + return ApiLevelActionType.Uninstall; + } - // is it a custom definition added? - if (definition.FilePath != null && definition.FilePath.StartsWith(RunnerDefaults.PluginInstallationConfigDirectory)) - { - return ApiLevelActionType.Forget; + // is it a custom definition added? + if (ndkInfo.FilePath != null && ndkInfo.FilePath.StartsWith(RunnerDefaults.PluginInstallationConfigDirectory)) + { + return ApiLevelActionType.Forget; + } } // is it a PlayBook NDK? if (definition.Version <= LastPlayBookVersion) { - if (exists) + if (isInstalled) return ApiLevelActionType.Nothing; argument = "http://developer.blackberry.com/playbook/native/download/"; @@ -65,7 +89,80 @@ public ApiLevelActionType GetActionForNdk(NdkInfo definition, out object argumen } // by default, check, if it can be installed, or it's not owned by the pluign: - return exists ? ApiLevelActionType.Nothing : ApiLevelActionType.Install; + return isInstalled ? ApiLevelActionType.Nothing : ApiLevelActionType.Install; + } + + public bool LoadNDKs(bool reload) + { + // is it still loading? + if (_ndkLoadRunner != null) + return false; + + // did we loaded it before + if (!reload && RemoteNDKs.Length > 0) + { + if (NdkListLoaded != null) + NdkListLoaded(this, EventArgs.Empty); + return false; + } + + _ndkLoadRunner = new ApiLevelListLoadRunner(RunnerDefaults.NdkDirectory, ApiLevelListTypes.Full); + _ndkLoadRunner.Dispatcher = Dispatcher; + _ndkLoadRunner.Finished += NdkLoadRunnerOnFinished; + _ndkLoadRunner.ExecuteAsync(); + return true; + } + + private void NdkLoadRunnerOnFinished(object sender, ToolRunnerEventArgs e) + { + PackageViewModel.Instance.RemoteNDKs = _ndkLoadRunner.ApiLevels; + _ndkLoadRunner.Finished -= NdkLoadRunnerOnFinished; + _ndkLoadRunner = null; + + if (NdkListLoaded != null) + { + NdkListLoaded(this, EventArgs.Empty); + } + } + + #region IDisposable Implementation + + public void Dispose() + { + Dispose(true); + GC.SuppressFinalize(this); + } + + private void Dispose(bool disposing) + { + if (_ndkLoadRunner != null) + { + _ndkLoadRunner.Dispose(); + _ndkLoadRunner = null; + } + } + + #endregion + + public bool CheckIfNdkInstalled(ApiInfo info) + { + return info != null && PackageViewModel.Instance.IndexOfInstalled(info.Version) >= 0; + } + + public bool IsProcessingNDK(ApiInfo info) + { + return info != null && PackageViewModel.Instance.UpdateManager.IsProcessingNDK(info.Version); + } + + /// + /// Requests to download NDK. + /// + public void RequestNdk(ApiInfo info) + { + if (info == null) + throw new ArgumentNullException("info"); + + PackageViewModel.Instance.UpdateManager.Request(UpdateActions.Install, UpdateActionTargets.NDK, info.Version); } } } diff --git a/src_vs2012/VSNDK.Package/ViewModels/PackageViewModel.cs b/src_vs2012/VSNDK.Package/ViewModels/PackageViewModel.cs index 2633c43a..817872a0 100644 --- a/src_vs2012/VSNDK.Package/ViewModels/PackageViewModel.cs +++ b/src_vs2012/VSNDK.Package/ViewModels/PackageViewModel.cs @@ -31,6 +31,7 @@ public static PackageViewModel Instance private DeveloperDefinition _developer; private NdkInfo[] _installedNDKs; + private ApiInfoArray[] _remoteNDKs; private NdkInfo _activeNDK; private DeviceDefinition[] _targetDevices; private DeviceDefinition _activeDevice; @@ -38,6 +39,8 @@ public static PackageViewModel Instance public PackageViewModel() { + _remoteNDKs = new ApiInfoArray[0]; + UpdateManager = new UpdateManager(this); } #region Properties @@ -56,6 +59,15 @@ public DeveloperDefinition Developer } } + public UpdateManager UpdateManager + { + get; + private set; + } + + /// + /// Gets the list of installed NDKs on the machine. + /// public NdkInfo[] InstalledNDKs { get @@ -73,6 +85,18 @@ public NdkInfo[] InstalledNDKs } } + /// + /// Gets the cached list of NDKs available on-line to install. + /// + public ApiInfoArray[] RemoteNDKs + { + get { return _remoteNDKs; } + set + { + _remoteNDKs = value ?? new ApiInfoArray[0]; + } + } + /// /// Loads info about currently used NDK from registry. /// @@ -228,12 +252,20 @@ public int IndexOfInstalled(NdkInfo info) return NdkInfo.IndexOf(InstalledNDKs, info); } + /// + /// Gets an index of installed NDK with identical version. + /// + public int IndexOfInstalled(Version version) + { + return NdkInfo.IndexOf(InstalledNDKs, version); + } + /// /// Persists info about currently selected NDK into the registry. /// private void SaveActiveNDK() { - if (_activeNDK == null || !_activeNDK.Exists()) + if (_activeNDK == null || !_activeNDK.IsInstalled) { TraceLog.WarnLine("Invalid NDK to set as active!"); return; diff --git a/src_vs2012/VSNDK.Package/ViewModels/UpdateActionTargets.cs b/src_vs2012/VSNDK.Package/ViewModels/UpdateActionTargets.cs new file mode 100644 index 00000000..3e2d53f5 --- /dev/null +++ b/src_vs2012/VSNDK.Package/ViewModels/UpdateActionTargets.cs @@ -0,0 +1,12 @@ +namespace RIM.VSNDK_Package.ViewModels +{ + /// + /// Targets processed by Update Manager + /// + internal enum UpdateActionTargets + { + NDK, + Simulator, + Runtime + } +} diff --git a/src_vs2012/VSNDK.Package/ViewModels/UpdateActions.cs b/src_vs2012/VSNDK.Package/ViewModels/UpdateActions.cs new file mode 100644 index 00000000..91d34c29 --- /dev/null +++ b/src_vs2012/VSNDK.Package/ViewModels/UpdateActions.cs @@ -0,0 +1,11 @@ +namespace RIM.VSNDK_Package.ViewModels +{ + /// + /// Actions to perform by Update Manager + /// + internal enum UpdateActions + { + Install, + Uninstall + } +} diff --git a/src_vs2012/VSNDK.Package/ViewModels/UpdateManager.cs b/src_vs2012/VSNDK.Package/ViewModels/UpdateManager.cs new file mode 100644 index 00000000..3095bbac --- /dev/null +++ b/src_vs2012/VSNDK.Package/ViewModels/UpdateManager.cs @@ -0,0 +1,98 @@ +using System; +using System.Collections.Generic; +using RIM.VSNDK_Package.Diagnostics; + +namespace RIM.VSNDK_Package.ViewModels +{ + internal sealed class UpdateManager + { + #region Internal Classes + + class ActionData + { + #region Properties + + public ActionData(UpdateActions action, UpdateActionTargets target, Version version) + { + if (version == null) + throw new ArgumentNullException("version"); + + Action = action; + Target = target; + Version = version; + } + + public UpdateActions Action + { + get; + private set; + } + + public UpdateActionTargets Target + { + get; + private set; + } + + public Version Version + { + get; + private set; + } + + #endregion + + public override string ToString() + { + return string.Concat(Action, "-Action of ", Target, "-", Version); + } + } + + #endregion + + private PackageViewModel _vm; + private List _actions; + + public UpdateManager(PackageViewModel vm) + { + if (vm == null) + throw new ArgumentNullException("vm"); + + _vm = vm; + _actions = new List(); + } + + public void Request(UpdateActions action, UpdateActionTargets target, Version version) + { + if (version == null) + throw new ArgumentNullException("version"); + + Schedule(new ActionData(action, target, version)); + } + + private void Schedule(ActionData action) + { + if (action == null) + throw new ArgumentNullException("action"); + + TraceLog.WriteLine("Scheduled: {0}", action); + + // PH: TODO: + _actions.Add(action); + } + + public bool IsProcessingNDK(Version version) + { + if (version == null) + return false; + + foreach (var action in _actions) + { + if (action.Target == UpdateActionTargets.NDK && action.Version == version) + return true; + } + + return false; + } + } +} From 16db74853072b836bbc2f3da09820bba36a0ea65 Mon Sep 17 00:00:00 2001 From: Pawel Hofman Date: Tue, 3 Jun 2014 17:00:57 +0200 Subject: [PATCH 160/851] Renamed installation UI to better reflect purpose --- ...rm.Designer.cs => InstallForm.Designer.cs} | 0 .../{InstallNdkForm.cs => InstallForm.cs} | 0 .../{InstallNdkForm.resx => InstallForm.resx} | 0 .../Dialogs/InstallSimulatorForm.Designer.cs | 66 ---------- .../Options/Dialogs/InstallSimulatorForm.cs | 20 --- .../Options/Dialogs/InstallSimulatorForm.resx | 120 ------------------ 6 files changed, 206 deletions(-) rename src_vs2012/VSNDK.Package/Options/Dialogs/{InstallNdkForm.Designer.cs => InstallForm.Designer.cs} (100%) rename src_vs2012/VSNDK.Package/Options/Dialogs/{InstallNdkForm.cs => InstallForm.cs} (100%) rename src_vs2012/VSNDK.Package/Options/Dialogs/{InstallNdkForm.resx => InstallForm.resx} (100%) delete mode 100644 src_vs2012/VSNDK.Package/Options/Dialogs/InstallSimulatorForm.Designer.cs delete mode 100644 src_vs2012/VSNDK.Package/Options/Dialogs/InstallSimulatorForm.cs delete mode 100644 src_vs2012/VSNDK.Package/Options/Dialogs/InstallSimulatorForm.resx diff --git a/src_vs2012/VSNDK.Package/Options/Dialogs/InstallNdkForm.Designer.cs b/src_vs2012/VSNDK.Package/Options/Dialogs/InstallForm.Designer.cs similarity index 100% rename from src_vs2012/VSNDK.Package/Options/Dialogs/InstallNdkForm.Designer.cs rename to src_vs2012/VSNDK.Package/Options/Dialogs/InstallForm.Designer.cs diff --git a/src_vs2012/VSNDK.Package/Options/Dialogs/InstallNdkForm.cs b/src_vs2012/VSNDK.Package/Options/Dialogs/InstallForm.cs similarity index 100% rename from src_vs2012/VSNDK.Package/Options/Dialogs/InstallNdkForm.cs rename to src_vs2012/VSNDK.Package/Options/Dialogs/InstallForm.cs diff --git a/src_vs2012/VSNDK.Package/Options/Dialogs/InstallNdkForm.resx b/src_vs2012/VSNDK.Package/Options/Dialogs/InstallForm.resx similarity index 100% rename from src_vs2012/VSNDK.Package/Options/Dialogs/InstallNdkForm.resx rename to src_vs2012/VSNDK.Package/Options/Dialogs/InstallForm.resx diff --git a/src_vs2012/VSNDK.Package/Options/Dialogs/InstallSimulatorForm.Designer.cs b/src_vs2012/VSNDK.Package/Options/Dialogs/InstallSimulatorForm.Designer.cs deleted file mode 100644 index 5ee89910..00000000 --- a/src_vs2012/VSNDK.Package/Options/Dialogs/InstallSimulatorForm.Designer.cs +++ /dev/null @@ -1,66 +0,0 @@ -namespace RIM.VSNDK_Package.Options.Dialogs -{ - partial class InstallSimulatorForm - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Windows Form Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - this.bttOK = new System.Windows.Forms.Button(); - this.SuspendLayout(); - // - // bttOK - // - this.bttOK.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this.bttOK.Location = new System.Drawing.Point(552, 394); - this.bttOK.Name = "bttOK"; - this.bttOK.Size = new System.Drawing.Size(75, 23); - this.bttOK.TabIndex = 0; - this.bttOK.Text = "&OK"; - this.bttOK.UseVisualStyleBackColor = true; - // - // InstallSimulatorForm - // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(639, 429); - this.Controls.Add(this.bttOK); - this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; - this.MaximizeBox = false; - this.MinimizeBox = false; - this.Name = "InstallSimulatorForm"; - this.ShowIcon = false; - this.ShowInTaskbar = false; - this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; - this.Text = "Simulators"; - this.ResumeLayout(false); - - } - - #endregion - - private System.Windows.Forms.Button bttOK; - } -} \ No newline at end of file diff --git a/src_vs2012/VSNDK.Package/Options/Dialogs/InstallSimulatorForm.cs b/src_vs2012/VSNDK.Package/Options/Dialogs/InstallSimulatorForm.cs deleted file mode 100644 index 790daaa1..00000000 --- a/src_vs2012/VSNDK.Package/Options/Dialogs/InstallSimulatorForm.cs +++ /dev/null @@ -1,20 +0,0 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Data; -using System.Drawing; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows.Forms; - -namespace RIM.VSNDK_Package.Options.Dialogs -{ - public partial class InstallSimulatorForm : Form - { - public InstallSimulatorForm() - { - InitializeComponent(); - } - } -} diff --git a/src_vs2012/VSNDK.Package/Options/Dialogs/InstallSimulatorForm.resx b/src_vs2012/VSNDK.Package/Options/Dialogs/InstallSimulatorForm.resx deleted file mode 100644 index 29dcb1b3..00000000 --- a/src_vs2012/VSNDK.Package/Options/Dialogs/InstallSimulatorForm.resx +++ /dev/null @@ -1,120 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - \ No newline at end of file From 3597ef5c0b9da4804e8194afa2e81cbc0565d039 Mon Sep 17 00:00:00 2001 From: Pawel Hofman Date: Tue, 3 Jun 2014 17:20:21 +0200 Subject: [PATCH 161/851] Fixed error displayed, when cancelled browsing --- .../Options/Dialogs/AddLocalNdkForm.cs | 34 +++++++++++-------- 1 file changed, 19 insertions(+), 15 deletions(-) diff --git a/src_vs2012/VSNDK.Package/Options/Dialogs/AddLocalNdkForm.cs b/src_vs2012/VSNDK.Package/Options/Dialogs/AddLocalNdkForm.cs index c4de275f..bc81f6a0 100644 --- a/src_vs2012/VSNDK.Package/Options/Dialogs/AddLocalNdkForm.cs +++ b/src_vs2012/VSNDK.Package/Options/Dialogs/AddLocalNdkForm.cs @@ -73,23 +73,27 @@ private void bttBrowseTarget_Click(object sender, EventArgs e) private void UpdateByPathSelection(TextBox sourceControl) { var folder = DialogHelper.BrowseForFolder(null, "Specify target-path, host-path or the root folder of those two"); - var ndk = NdkInfo.Scan(folder); - if (ndk == null) + if (!string.IsNullOrEmpty(folder)) { - MessageBoxHelper.Show("Specified folder is not a valid NDK root", folder ?? string.Empty, MessageBoxButtons.OK, MessageBoxIcon.Error); - sourceControl.Text = folder; - } - else - { - if (string.IsNullOrEmpty(NdkName)) - NdkName = ndk.Name; - if (string.IsNullOrEmpty(NdkHostPath)) - NdkHostPath = ndk.HostPath; - if (string.IsNullOrEmpty(NdkTargetPath)) - NdkTargetPath = ndk.TargetPath; - if (string.IsNullOrEmpty(txtVersion.Text)) - NdkVersion = ndk.Version; + var ndk = NdkInfo.Scan(folder); + + if (ndk == null) + { + MessageBoxHelper.Show("Specified folder is not a valid NDK root", folder, MessageBoxButtons.OK, MessageBoxIcon.Error); + sourceControl.Text = folder; + } + else + { + if (string.IsNullOrEmpty(NdkName)) + NdkName = ndk.Name; + if (string.IsNullOrEmpty(NdkHostPath)) + NdkHostPath = ndk.HostPath; + if (string.IsNullOrEmpty(NdkTargetPath)) + NdkTargetPath = ndk.TargetPath; + if (string.IsNullOrEmpty(txtVersion.Text)) + NdkVersion = ndk.Version; + } } } From 3c06fffcd4fa01168a7cfc94eb55258b2e1ad8ce Mon Sep 17 00:00:00 2001 From: Pawel Hofman Date: Tue, 3 Jun 2014 17:21:09 +0200 Subject: [PATCH 162/851] Redesigned layout on API-Level options page --- .../Options/ApiLevelOptionControl.Designer.cs | 35 +++++++++---------- .../Options/ApiLevelOptionControl.cs | 6 ---- 2 files changed, 17 insertions(+), 24 deletions(-) diff --git a/src_vs2012/VSNDK.Package/Options/ApiLevelOptionControl.Designer.cs b/src_vs2012/VSNDK.Package/Options/ApiLevelOptionControl.Designer.cs index c2aae8d4..28534462 100644 --- a/src_vs2012/VSNDK.Package/Options/ApiLevelOptionControl.Designer.cs +++ b/src_vs2012/VSNDK.Package/Options/ApiLevelOptionControl.Designer.cs @@ -34,7 +34,7 @@ private void InitializeComponent() this.bttAddLocal = new System.Windows.Forms.Button(); this.bttInstallNew = new System.Windows.Forms.Button(); this.label2 = new System.Windows.Forms.Label(); - this.bttNewSimulator = new System.Windows.Forms.Button(); + this.bttStatus = new System.Windows.Forms.Button(); this.SuspendLayout(); // // txtDescription @@ -75,22 +75,22 @@ private void InitializeComponent() // bttAddLocal // this.bttAddLocal.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this.bttAddLocal.Location = new System.Drawing.Point(168, 284); + this.bttAddLocal.Location = new System.Drawing.Point(378, 284); this.bttAddLocal.Name = "bttAddLocal"; - this.bttAddLocal.Size = new System.Drawing.Size(118, 23); + this.bttAddLocal.Size = new System.Drawing.Size(75, 23); this.bttAddLocal.TabIndex = 4; - this.bttAddLocal.Text = "&Add Existing..."; + this.bttAddLocal.Text = "&Add..."; this.bttAddLocal.UseVisualStyleBackColor = true; this.bttAddLocal.Click += new System.EventHandler(this.bttAddLocal_Click); // // bttInstallNew // this.bttInstallNew.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this.bttInstallNew.Location = new System.Drawing.Point(292, 284); + this.bttInstallNew.Location = new System.Drawing.Point(459, 284); this.bttInstallNew.Name = "bttInstallNew"; - this.bttInstallNew.Size = new System.Drawing.Size(118, 23); + this.bttInstallNew.Size = new System.Drawing.Size(75, 23); this.bttInstallNew.TabIndex = 5; - this.bttInstallNew.Text = "Install &NDK..."; + this.bttInstallNew.Text = "&Install..."; this.bttInstallNew.UseVisualStyleBackColor = true; this.bttInstallNew.Click += new System.EventHandler(this.bttInstallNew_Click); // @@ -103,27 +103,26 @@ private void InitializeComponent() this.label2.TabIndex = 0; this.label2.Text = "Select the API Level that your application supports."; // - // bttNewSimulator + // bttStatus // - this.bttNewSimulator.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this.bttNewSimulator.Location = new System.Drawing.Point(416, 284); - this.bttNewSimulator.Name = "bttNewSimulator"; - this.bttNewSimulator.Size = new System.Drawing.Size(118, 23); - this.bttNewSimulator.TabIndex = 5; - this.bttNewSimulator.Text = "Install &Simulator..."; - this.bttNewSimulator.UseVisualStyleBackColor = true; - this.bttNewSimulator.Click += new System.EventHandler(this.bttNewSimulator_Click); + this.bttStatus.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this.bttStatus.Location = new System.Drawing.Point(6, 284); + this.bttStatus.Name = "bttStatus"; + this.bttStatus.Size = new System.Drawing.Size(75, 23); + this.bttStatus.TabIndex = 6; + this.bttStatus.Text = "&Status..."; + this.bttStatus.UseVisualStyleBackColor = true; // // ApiLevelOptionControl // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.Controls.Add(this.bttStatus); this.Controls.Add(this.label2); this.Controls.Add(this.txtDescription); this.Controls.Add(this.cmbNDKs); this.Controls.Add(this.label1); this.Controls.Add(this.bttAddLocal); - this.Controls.Add(this.bttNewSimulator); this.Controls.Add(this.bttInstallNew); this.Name = "ApiLevelOptionControl"; this.Size = new System.Drawing.Size(537, 310); @@ -140,6 +139,6 @@ private void InitializeComponent() private System.Windows.Forms.Button bttAddLocal; private System.Windows.Forms.Button bttInstallNew; private System.Windows.Forms.Label label2; - private System.Windows.Forms.Button bttNewSimulator; + private System.Windows.Forms.Button bttStatus; } } diff --git a/src_vs2012/VSNDK.Package/Options/ApiLevelOptionControl.cs b/src_vs2012/VSNDK.Package/Options/ApiLevelOptionControl.cs index 84c783c5..112e2531 100644 --- a/src_vs2012/VSNDK.Package/Options/ApiLevelOptionControl.cs +++ b/src_vs2012/VSNDK.Package/Options/ApiLevelOptionControl.cs @@ -84,11 +84,5 @@ private void bttInstallNew_Click(object sender, EventArgs e) var form = new InstallNdkForm(_vm); form.ShowDialog(); } - - private void bttNewSimulator_Click(object sender, EventArgs e) - { - var form = new InstallSimulatorForm(); - form.ShowDialog(); - } } } From 9a5b79e5b253f17ca0e5949c2201a5d1cc0cbf80 Mon Sep 17 00:00:00 2001 From: Pawel Hofman Date: Tue, 3 Jun 2014 17:21:26 +0200 Subject: [PATCH 163/851] Merged NDK and simulator download screens --- .../Options/Dialogs/InstallForm.Designer.cs | 69 +++++++++++++++---- src_vs2012/VSNDK.Package/VSNDK.Package.csproj | 19 ++--- 2 files changed, 61 insertions(+), 27 deletions(-) diff --git a/src_vs2012/VSNDK.Package/Options/Dialogs/InstallForm.Designer.cs b/src_vs2012/VSNDK.Package/Options/Dialogs/InstallForm.Designer.cs index 6de6596b..df59b3ac 100644 --- a/src_vs2012/VSNDK.Package/Options/Dialogs/InstallForm.Designer.cs +++ b/src_vs2012/VSNDK.Package/Options/Dialogs/InstallForm.Designer.cs @@ -33,15 +33,20 @@ private void InitializeComponent() this.panelInstalled = new System.Windows.Forms.FlowLayoutPanel(); this.groupBox2 = new System.Windows.Forms.GroupBox(); this.panelAvailable = new System.Windows.Forms.FlowLayoutPanel(); + this.tabPage2 = new System.Windows.Forms.TabPage(); + this.tabPage1 = new System.Windows.Forms.TabPage(); + this.tabControl1 = new System.Windows.Forms.TabControl(); this.groupBox1.SuspendLayout(); this.groupBox2.SuspendLayout(); + this.tabPage1.SuspendLayout(); + this.tabControl1.SuspendLayout(); this.SuspendLayout(); // // bttOK // this.bttOK.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.bttOK.DialogResult = System.Windows.Forms.DialogResult.OK; - this.bttOK.Location = new System.Drawing.Point(484, 418); + this.bttOK.Location = new System.Drawing.Point(497, 462); this.bttOK.Name = "bttOK"; this.bttOK.Size = new System.Drawing.Size(75, 23); this.bttOK.TabIndex = 0; @@ -53,9 +58,9 @@ private void InitializeComponent() this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.groupBox1.Controls.Add(this.panelInstalled); - this.groupBox1.Location = new System.Drawing.Point(12, 12); + this.groupBox1.Location = new System.Drawing.Point(6, 6); this.groupBox1.Name = "groupBox1"; - this.groupBox1.Size = new System.Drawing.Size(547, 197); + this.groupBox1.Size = new System.Drawing.Size(543, 197); this.groupBox1.TabIndex = 1; this.groupBox1.TabStop = false; this.groupBox1.Text = "Installed"; @@ -69,19 +74,18 @@ private void InitializeComponent() this.panelInstalled.FlowDirection = System.Windows.Forms.FlowDirection.TopDown; this.panelInstalled.Location = new System.Drawing.Point(6, 19); this.panelInstalled.Name = "panelInstalled"; - this.panelInstalled.Size = new System.Drawing.Size(535, 172); + this.panelInstalled.Size = new System.Drawing.Size(531, 172); this.panelInstalled.TabIndex = 0; this.panelInstalled.WrapContents = false; // // groupBox2 // - this.groupBox2.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left) + this.groupBox2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.groupBox2.Controls.Add(this.panelAvailable); - this.groupBox2.Location = new System.Drawing.Point(12, 215); + this.groupBox2.Location = new System.Drawing.Point(6, 210); this.groupBox2.Name = "groupBox2"; - this.groupBox2.Size = new System.Drawing.Size(547, 197); + this.groupBox2.Size = new System.Drawing.Size(543, 197); this.groupBox2.TabIndex = 2; this.groupBox2.TabStop = false; this.groupBox2.Text = "Available"; @@ -95,19 +99,53 @@ private void InitializeComponent() this.panelAvailable.FlowDirection = System.Windows.Forms.FlowDirection.TopDown; this.panelAvailable.Location = new System.Drawing.Point(6, 19); this.panelAvailable.Name = "panelAvailable"; - this.panelAvailable.Size = new System.Drawing.Size(535, 172); + this.panelAvailable.Size = new System.Drawing.Size(531, 172); this.panelAvailable.TabIndex = 0; this.panelAvailable.WrapContents = false; // + // tabPage2 + // + this.tabPage2.Location = new System.Drawing.Point(4, 22); + this.tabPage2.Name = "tabPage2"; + this.tabPage2.Padding = new System.Windows.Forms.Padding(3); + this.tabPage2.Size = new System.Drawing.Size(623, 418); + this.tabPage2.TabIndex = 1; + this.tabPage2.Text = "Simulator"; + this.tabPage2.UseVisualStyleBackColor = true; + // + // tabPage1 + // + this.tabPage1.Controls.Add(this.groupBox1); + this.tabPage1.Controls.Add(this.groupBox2); + this.tabPage1.Location = new System.Drawing.Point(4, 22); + this.tabPage1.Name = "tabPage1"; + this.tabPage1.Padding = new System.Windows.Forms.Padding(3); + this.tabPage1.Size = new System.Drawing.Size(558, 418); + this.tabPage1.TabIndex = 0; + this.tabPage1.Text = "BlackBerry Native SDK"; + this.tabPage1.UseVisualStyleBackColor = true; + // + // tabControl1 + // + this.tabControl1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.tabControl1.Controls.Add(this.tabPage1); + this.tabControl1.Controls.Add(this.tabPage2); + this.tabControl1.Location = new System.Drawing.Point(12, 12); + this.tabControl1.Name = "tabControl1"; + this.tabControl1.SelectedIndex = 0; + this.tabControl1.Size = new System.Drawing.Size(566, 444); + this.tabControl1.TabIndex = 3; + // // InstallNdkForm // this.AcceptButton = this.bttOK; this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.CancelButton = this.bttOK; - this.ClientSize = new System.Drawing.Size(571, 453); - this.Controls.Add(this.groupBox2); - this.Controls.Add(this.groupBox1); + this.ClientSize = new System.Drawing.Size(584, 497); + this.Controls.Add(this.tabControl1); this.Controls.Add(this.bttOK); this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; this.MaximizeBox = false; @@ -115,9 +153,11 @@ private void InitializeComponent() this.Name = "InstallNdkForm"; this.ShowInTaskbar = false; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; - this.Text = "NDK Installation"; + this.Text = "Installation"; this.groupBox1.ResumeLayout(false); this.groupBox2.ResumeLayout(false); + this.tabPage1.ResumeLayout(false); + this.tabControl1.ResumeLayout(false); this.ResumeLayout(false); } @@ -129,5 +169,8 @@ private void InitializeComponent() private System.Windows.Forms.GroupBox groupBox2; private System.Windows.Forms.FlowLayoutPanel panelInstalled; private System.Windows.Forms.FlowLayoutPanel panelAvailable; + private System.Windows.Forms.TabPage tabPage2; + private System.Windows.Forms.TabPage tabPage1; + private System.Windows.Forms.TabControl tabControl1; } } \ No newline at end of file diff --git a/src_vs2012/VSNDK.Package/VSNDK.Package.csproj b/src_vs2012/VSNDK.Package/VSNDK.Package.csproj index 5ad48006..2a0c171e 100644 --- a/src_vs2012/VSNDK.Package/VSNDK.Package.csproj +++ b/src_vs2012/VSNDK.Package/VSNDK.Package.csproj @@ -327,17 +327,11 @@ InstallConfirmationForm.cs - + Form - - InstallNdkForm.cs - - - Form - - - InstallSimulatorForm.cs + + InstallForm.cs UserControl @@ -460,8 +454,8 @@ InstallConfirmationForm.cs - - InstallSimulatorForm.cs + + InstallForm.cs ListItemControl.cs @@ -600,9 +594,6 @@ DeviceForm.cs - - InstallNdkForm.cs - PasswordForm.cs From 42247a925a35878fa9eb2da10bd56109fb8ba917 Mon Sep 17 00:00:00 2001 From: Pawel Hofman Date: Wed, 4 Jun 2014 01:02:44 +0200 Subject: [PATCH 164/851] Added 'forget' support in ViewModels --- .../ViewModels/ApiLevelOptionViewModel.cs | 13 ++++++ .../ViewModels/PackageViewModel.cs | 45 ++++++++++++++++--- 2 files changed, 52 insertions(+), 6 deletions(-) diff --git a/src_vs2012/VSNDK.Package/ViewModels/ApiLevelOptionViewModel.cs b/src_vs2012/VSNDK.Package/ViewModels/ApiLevelOptionViewModel.cs index 9eb669c8..0f851708 100644 --- a/src_vs2012/VSNDK.Package/ViewModels/ApiLevelOptionViewModel.cs +++ b/src_vs2012/VSNDK.Package/ViewModels/ApiLevelOptionViewModel.cs @@ -164,5 +164,18 @@ public void RequestNdk(ApiInfo info) PackageViewModel.Instance.UpdateManager.Request(UpdateActions.Install, UpdateActionTargets.NDK, info.Version); } + + /// + /// Removes the reference, created by developer some time ago. + /// + public void Forget(ApiInfo info) + { + var ndkInfo = info as NdkInfo; + + if (ndkInfo != null) + { + PackageViewModel.Instance.Forget(ndkInfo); + } + } } } diff --git a/src_vs2012/VSNDK.Package/ViewModels/PackageViewModel.cs b/src_vs2012/VSNDK.Package/ViewModels/PackageViewModel.cs index 817872a0..2e4dbe2a 100644 --- a/src_vs2012/VSNDK.Package/ViewModels/PackageViewModel.cs +++ b/src_vs2012/VSNDK.Package/ViewModels/PackageViewModel.cs @@ -1,4 +1,5 @@ using System; +using System.IO; using RIM.VSNDK_Package.Diagnostics; using RIM.VSNDK_Package.Model; using RIM.VSNDK_Package.Tools; @@ -130,12 +131,21 @@ public NdkInfo ActiveNDK if (value != null && !value.Matches(_activeNDK) && InstalledNDKs.Length > 0) { var index = IndexOfInstalled(value); - if (index < 0) - throw new ArgumentOutOfRangeException("value", "Invalid value set, it must belong to the InstalledNDKs first"); - - _activeNDK = _installedNDKs[index]; - TraceLog.WriteLine("Changed active NDK to: \"{0}\"", _activeNDK); - SaveActiveNDK(); + if (index >= 0) + { + _activeNDK = _installedNDKs[index]; + TraceLog.WriteLine("Changed active NDK to: \"{0}\"", _activeNDK); + SaveActiveNDK(); + } + else + { + if (_activeNDK != null) + { + TraceLog.WriteLine("Removed active NDK: \"{0}\"", _activeNDK); + _activeNDK = null; + SaveActiveNDK(); + } + } } } } @@ -267,6 +277,7 @@ private void SaveActiveNDK() { if (_activeNDK == null || !_activeNDK.IsInstalled) { + NdkDefinition.Delete(); TraceLog.WarnLine("Invalid NDK to set as active!"); return; } @@ -305,5 +316,27 @@ public void ResetNDKs() _installedNDKs = null; _activeNDK = null; } + + /// + /// Removes custom reference to existing NDK, created by developer some time ago. + /// + public void Forget(NdkInfo info) + { + if (info == null) + throw new ArgumentNullException("info"); + if (string.IsNullOrEmpty(info.FilePath)) + return; + + try + { + if (File.Exists(info.FilePath)) + File.Delete(info.FilePath); + ResetNDKs(); + } + catch (Exception ex) + { + TraceLog.WriteException(ex, "Problem removing file: \"{0}\"", info.FilePath); + } + } } } From c7c9b24fec6e0397565844f663ce1109fa198904 Mon Sep 17 00:00:00 2001 From: Pawel Hofman Date: Wed, 4 Jun 2014 01:03:30 +0200 Subject: [PATCH 165/851] Added 'forget' support on UI --- .../VSNDK.Package/Options/Dialogs/InstallForm.cs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src_vs2012/VSNDK.Package/Options/Dialogs/InstallForm.cs b/src_vs2012/VSNDK.Package/Options/Dialogs/InstallForm.cs index 0e77f1ac..4d3589ad 100644 --- a/src_vs2012/VSNDK.Package/Options/Dialogs/InstallForm.cs +++ b/src_vs2012/VSNDK.Package/Options/Dialogs/InstallForm.cs @@ -41,6 +41,11 @@ public InstallNdkForm(ApiLevelOptionViewModel vm) _vm = vm; _vm.NdkListLoaded += NdkListLoaded; + UpdateUI(); + } + + private void UpdateUI() + { PopulateList(panelInstalled, _vm.InstalledNDKs, info => _vm.GetActionForNDK(info), "No installed Native SDK found", ApiLevelActionType.Hide); LoadNDKs(false); } @@ -135,6 +140,13 @@ private void ItemOnExecuteAction(object sender, EventArgs eventArgs) case ApiLevelActionType.Refresh: LoadNDKs(true); break; + case ApiLevelActionType.Forget: + if (MessageBoxHelper.Show(definition.ToString(), "Remove own reference to existing NDK?", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) + { + _vm.Forget(definition); + UpdateUI(); + } + break; } } } From 17ffd35cd4cb051a171f8230838742154a8e1ee8 Mon Sep 17 00:00:00 2001 From: Pawel Hofman Date: Wed, 4 Jun 2014 01:03:50 +0200 Subject: [PATCH 166/851] Renamed a handler to better reflect its purpose --- .../Options/Dialogs/InstallConfirmationForm.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src_vs2012/VSNDK.Package/Options/Dialogs/InstallConfirmationForm.cs b/src_vs2012/VSNDK.Package/Options/Dialogs/InstallConfirmationForm.cs index 213e83f3..2b9127ff 100644 --- a/src_vs2012/VSNDK.Package/Options/Dialogs/InstallConfirmationForm.cs +++ b/src_vs2012/VSNDK.Package/Options/Dialogs/InstallConfirmationForm.cs @@ -10,7 +10,7 @@ namespace RIM.VSNDK_Package.Options.Dialogs /// internal partial class InstallConfirmationForm : Form { - public InstallConfirmationForm(string nameOverride, IEnumerable items, Func installationCheckHandler, Func pendingCheckHandler) + public InstallConfirmationForm(string nameOverride, IEnumerable items, Func installationCheckHandler, Func processingCheckHandler) { if (items == null) throw new ArgumentNullException("items"); @@ -25,9 +25,9 @@ public InstallConfirmationForm(string nameOverride, IEnumerable items, i.SubItems.Add(item.Version.ToString()); // display status, if it's installed or is still under processing: - if (pendingCheckHandler != null && pendingCheckHandler(item)) + if (processingCheckHandler != null && processingCheckHandler(item)) { - i.SubItems.Add("Pending..."); + i.SubItems.Add("Processing..."); } else { From 23d43252bbc35b343808a536169d7dd678208fe5 Mon Sep 17 00:00:00 2001 From: Pawel Hofman Date: Wed, 4 Jun 2014 01:04:25 +0200 Subject: [PATCH 167/851] Updated UI and stability of API-Level options --- .../Options/ApiLevelOptionControl.Designer.cs | 10 +++---- .../Options/ApiLevelOptionControl.cs | 27 ++++++++++++++----- 2 files changed, 25 insertions(+), 12 deletions(-) diff --git a/src_vs2012/VSNDK.Package/Options/ApiLevelOptionControl.Designer.cs b/src_vs2012/VSNDK.Package/Options/ApiLevelOptionControl.Designer.cs index 28534462..88de5c47 100644 --- a/src_vs2012/VSNDK.Package/Options/ApiLevelOptionControl.Designer.cs +++ b/src_vs2012/VSNDK.Package/Options/ApiLevelOptionControl.Designer.cs @@ -1,6 +1,6 @@ namespace RIM.VSNDK_Package.Options { - partial class ApiLevelOptionControl + internal partial class ApiLevelOptionControl { /// /// Required designer variable. @@ -75,10 +75,10 @@ private void InitializeComponent() // bttAddLocal // this.bttAddLocal.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this.bttAddLocal.Location = new System.Drawing.Point(378, 284); + this.bttAddLocal.Location = new System.Drawing.Point(459, 284); this.bttAddLocal.Name = "bttAddLocal"; this.bttAddLocal.Size = new System.Drawing.Size(75, 23); - this.bttAddLocal.TabIndex = 4; + this.bttAddLocal.TabIndex = 6; this.bttAddLocal.Text = "&Add..."; this.bttAddLocal.UseVisualStyleBackColor = true; this.bttAddLocal.Click += new System.EventHandler(this.bttAddLocal_Click); @@ -86,7 +86,7 @@ private void InitializeComponent() // bttInstallNew // this.bttInstallNew.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this.bttInstallNew.Location = new System.Drawing.Point(459, 284); + this.bttInstallNew.Location = new System.Drawing.Point(378, 284); this.bttInstallNew.Name = "bttInstallNew"; this.bttInstallNew.Size = new System.Drawing.Size(75, 23); this.bttInstallNew.TabIndex = 5; @@ -109,7 +109,7 @@ private void InitializeComponent() this.bttStatus.Location = new System.Drawing.Point(6, 284); this.bttStatus.Name = "bttStatus"; this.bttStatus.Size = new System.Drawing.Size(75, 23); - this.bttStatus.TabIndex = 6; + this.bttStatus.TabIndex = 4; this.bttStatus.Text = "&Status..."; this.bttStatus.UseVisualStyleBackColor = true; // diff --git a/src_vs2012/VSNDK.Package/Options/ApiLevelOptionControl.cs b/src_vs2012/VSNDK.Package/Options/ApiLevelOptionControl.cs index 112e2531..23d4f52b 100644 --- a/src_vs2012/VSNDK.Package/Options/ApiLevelOptionControl.cs +++ b/src_vs2012/VSNDK.Package/Options/ApiLevelOptionControl.cs @@ -7,7 +7,7 @@ namespace RIM.VSNDK_Package.Options { - public partial class ApiLevelOptionControl : UserControl + internal partial class ApiLevelOptionControl : UserControl { private readonly ApiLevelOptionViewModel _vm = new ApiLevelOptionViewModel(); @@ -16,17 +16,23 @@ public ApiLevelOptionControl() InitializeComponent(); _vm.Dispatcher = EventDispatcher.From(this); - PopulateNDKs(); + PopulateNDKs(true); } - private void PopulateNDKs() + private void PopulateNDKs(bool ignoreCurrentSelection) { + var currentlySelected = ignoreCurrentSelection ? _vm.ActiveNDK : SelectedNDK; + + txtDescription.Text = string.Empty; cmbNDKs.Items.Clear(); foreach (var ndk in _vm.InstalledNDKs) + { cmbNDKs.Items.Add(ndk); + } - cmbNDKs.SelectedItem = _vm.ActiveNDK; + _vm.ActiveNDK = currentlySelected; // here the currentlySelected will cause a match-by-folders-search + cmbNDKs.SelectedItem = _vm.ActiveNDK; // and _vm.ActiveNDK != currentlySelected instances } private void cmbNDKs_SelectedIndexChanged(object sender, EventArgs e) @@ -43,16 +49,22 @@ public bool HasSelectedNDK get { return cmbNDKs.SelectedItem != null; } } + public NdkInfo SelectedNDK + { + get { return cmbNDKs.SelectedItem as NdkInfo; } + set { cmbNDKs.SelectedItem = value; } + } + #endregion internal void OnApply() { - _vm.ActiveNDK = cmbNDKs.SelectedItem as NdkInfo; + _vm.ActiveNDK = SelectedNDK; } public void OnClosed() { - PopulateNDKs(); + PopulateNDKs(true); } private void bttAddLocal_Click(object sender, EventArgs e) @@ -69,7 +81,7 @@ private void bttAddLocal_Click(object sender, EventArgs e) { // reload NDKs _vm.ReloadAndActivate(ndk); - PopulateNDKs(); + PopulateNDKs(true); } else { @@ -83,6 +95,7 @@ private void bttInstallNew_Click(object sender, EventArgs e) { var form = new InstallNdkForm(_vm); form.ShowDialog(); + PopulateNDKs(false); } } } From dba320e168ff1dbc6faabc33b39866ba0892727e Mon Sep 17 00:00:00 2001 From: Pawel Hofman Date: Wed, 4 Jun 2014 01:29:11 +0200 Subject: [PATCH 168/851] Corrected last PlayBook NDK version --- src_vs2012/VSNDK.Package/Model/ApiInfo.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src_vs2012/VSNDK.Package/Model/ApiInfo.cs b/src_vs2012/VSNDK.Package/Model/ApiInfo.cs index 623f0289..e35fd62b 100644 --- a/src_vs2012/VSNDK.Package/Model/ApiInfo.cs +++ b/src_vs2012/VSNDK.Package/Model/ApiInfo.cs @@ -95,7 +95,7 @@ public override string ToString() /// public static ApiInfo CreateTabletInfo() { - return new ApiInfo("BlackBerry Native SDK for Tablet OS 2.1.0", new Version(2, 1, 0)); + return new ApiInfo("BlackBerry Native SDK for Tablet OS 2.1.0", new Version(2, 1, 0, 1032)); } } } From 7e9306c7b9f4e933dccdb562091038eecf4720c0 Mon Sep 17 00:00:00 2001 From: Pawel Hofman Date: Wed, 4 Jun 2014 01:29:20 +0200 Subject: [PATCH 169/851] Improved disabling 'Install' mode if all sub-items are installed --- .../VSNDK.Package/Model/ApiInfoArray.cs | 12 +----------- .../ViewModels/ApiLevelOptionViewModel.cs | 19 ++++++++++++++++++- 2 files changed, 19 insertions(+), 12 deletions(-) diff --git a/src_vs2012/VSNDK.Package/Model/ApiInfoArray.cs b/src_vs2012/VSNDK.Package/Model/ApiInfoArray.cs index 39da4cc5..1c30191c 100644 --- a/src_vs2012/VSNDK.Package/Model/ApiInfoArray.cs +++ b/src_vs2012/VSNDK.Package/Model/ApiInfoArray.cs @@ -7,7 +7,7 @@ namespace RIM.VSNDK_Package.Model /// /// Wrapper class for array of API info that belong to the same API Level. /// - internal sealed class ApiInfoArray : ApiInfo, IEnumerable + internal sealed class ApiInfoArray : ApiInfo { public ApiInfoArray(string name, Version version, ApiInfo[] items) : base(name, version) @@ -32,15 +32,5 @@ public int Length } #endregion - - public IEnumerator GetEnumerator() - { - return (IEnumerator)Items.GetEnumerator(); - } - - IEnumerator IEnumerable.GetEnumerator() - { - return GetEnumerator(); - } } } diff --git a/src_vs2012/VSNDK.Package/ViewModels/ApiLevelOptionViewModel.cs b/src_vs2012/VSNDK.Package/ViewModels/ApiLevelOptionViewModel.cs index 0f851708..6704c501 100644 --- a/src_vs2012/VSNDK.Package/ViewModels/ApiLevelOptionViewModel.cs +++ b/src_vs2012/VSNDK.Package/ViewModels/ApiLevelOptionViewModel.cs @@ -60,7 +60,7 @@ public ApiLevelActionType GetActionForNDK(ApiInfo definition, out object argumen return ApiLevelActionType.Hide; // check, if it exists on disk: - bool isInstalled = PackageViewModel.Instance.IndexOfInstalled(definition.Version) >= 0; + bool isInstalled = PackageViewModel.Instance.IndexOfInstalled(definition.Version) >= 0 || AreItemsInstalled(definition as ApiInfoArray); var ndkInfo = definition as NdkInfo; if (ndkInfo != null) @@ -92,6 +92,23 @@ public ApiLevelActionType GetActionForNDK(ApiInfo definition, out object argumen return isInstalled ? ApiLevelActionType.Nothing : ApiLevelActionType.Install; } + /// + /// Checks, if all items owned by an array are already installed. + /// + private static bool AreItemsInstalled(ApiInfoArray definition) + { + if (definition == null) + return false; + + foreach (var item in definition.Items) + { + if (PackageViewModel.Instance.IndexOfInstalled(item.Version) < 0) + return false; + } + + return true; + } + public bool LoadNDKs(bool reload) { // is it still loading? From ad7ec84fd8de2bebd4140900e2a282569f372480 Mon Sep 17 00:00:00 2001 From: Pawel Hofman Date: Wed, 4 Jun 2014 16:13:59 +0200 Subject: [PATCH 170/851] Added prototype of UpdateManager's status UI --- .../Options/ApiLevelOptionControl.Designer.cs | 1 + .../Options/ApiLevelOptionControl.cs | 6 + .../VSNDK.Package/Options/DialogHelper.cs | 3 +- .../UpdateManagerStatusForm.Designer.cs | 178 ++++++++++++++++++ .../Dialogs/UpdateManagerStatusForm.cs | 12 ++ .../Dialogs/UpdateManagerStatusForm.resx | 120 ++++++++++++ src_vs2012/VSNDK.Package/VSNDK.Package.csproj | 9 + 7 files changed, 327 insertions(+), 2 deletions(-) create mode 100644 src_vs2012/VSNDK.Package/Options/Dialogs/UpdateManagerStatusForm.Designer.cs create mode 100644 src_vs2012/VSNDK.Package/Options/Dialogs/UpdateManagerStatusForm.cs create mode 100644 src_vs2012/VSNDK.Package/Options/Dialogs/UpdateManagerStatusForm.resx diff --git a/src_vs2012/VSNDK.Package/Options/ApiLevelOptionControl.Designer.cs b/src_vs2012/VSNDK.Package/Options/ApiLevelOptionControl.Designer.cs index 88de5c47..c293a7ba 100644 --- a/src_vs2012/VSNDK.Package/Options/ApiLevelOptionControl.Designer.cs +++ b/src_vs2012/VSNDK.Package/Options/ApiLevelOptionControl.Designer.cs @@ -112,6 +112,7 @@ private void InitializeComponent() this.bttStatus.TabIndex = 4; this.bttStatus.Text = "&Status..."; this.bttStatus.UseVisualStyleBackColor = true; + this.bttStatus.Click += new System.EventHandler(this.bttStatus_Click); // // ApiLevelOptionControl // diff --git a/src_vs2012/VSNDK.Package/Options/ApiLevelOptionControl.cs b/src_vs2012/VSNDK.Package/Options/ApiLevelOptionControl.cs index 23d4f52b..f1351b34 100644 --- a/src_vs2012/VSNDK.Package/Options/ApiLevelOptionControl.cs +++ b/src_vs2012/VSNDK.Package/Options/ApiLevelOptionControl.cs @@ -97,5 +97,11 @@ private void bttInstallNew_Click(object sender, EventArgs e) form.ShowDialog(); PopulateNDKs(false); } + + private void bttStatus_Click(object sender, EventArgs e) + { + var form = new UpdateManagerStatusForm(); + form.ShowDialog(); + } } } diff --git a/src_vs2012/VSNDK.Package/Options/DialogHelper.cs b/src_vs2012/VSNDK.Package/Options/DialogHelper.cs index 6e4f4b54..46822fcf 100644 --- a/src_vs2012/VSNDK.Package/Options/DialogHelper.cs +++ b/src_vs2012/VSNDK.Package/Options/DialogHelper.cs @@ -1,5 +1,4 @@ -using System; -using System.Diagnostics; +using System.Diagnostics; using System.IO; using System.Windows.Forms; diff --git a/src_vs2012/VSNDK.Package/Options/Dialogs/UpdateManagerStatusForm.Designer.cs b/src_vs2012/VSNDK.Package/Options/Dialogs/UpdateManagerStatusForm.Designer.cs new file mode 100644 index 00000000..45f69400 --- /dev/null +++ b/src_vs2012/VSNDK.Package/Options/Dialogs/UpdateManagerStatusForm.Designer.cs @@ -0,0 +1,178 @@ +namespace RIM.VSNDK_Package.Options.Dialogs +{ + internal partial class UpdateManagerStatusForm + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.bttClose = new System.Windows.Forms.Button(); + this.groupBox1 = new System.Windows.Forms.GroupBox(); + this.label1 = new System.Windows.Forms.Label(); + this.label2 = new System.Windows.Forms.Label(); + this.progressBar1 = new System.Windows.Forms.ProgressBar(); + this.groupBox2 = new System.Windows.Forms.GroupBox(); + this.bttAbort = new System.Windows.Forms.Button(); + this.listBox1 = new System.Windows.Forms.ListBox(); + this.bttDelete = new System.Windows.Forms.Button(); + this.groupBox1.SuspendLayout(); + this.groupBox2.SuspendLayout(); + this.SuspendLayout(); + // + // bttClose + // + this.bttClose.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.bttClose.DialogResult = System.Windows.Forms.DialogResult.OK; + this.bttClose.Location = new System.Drawing.Point(504, 316); + this.bttClose.Name = "bttClose"; + this.bttClose.Size = new System.Drawing.Size(75, 23); + this.bttClose.TabIndex = 0; + this.bttClose.Text = "&Close"; + this.bttClose.UseVisualStyleBackColor = true; + // + // groupBox1 + // + this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.groupBox1.Controls.Add(this.bttAbort); + this.groupBox1.Controls.Add(this.progressBar1); + this.groupBox1.Controls.Add(this.label2); + this.groupBox1.Controls.Add(this.label1); + this.groupBox1.Location = new System.Drawing.Point(12, 12); + this.groupBox1.Name = "groupBox1"; + this.groupBox1.Size = new System.Drawing.Size(567, 122); + this.groupBox1.TabIndex = 1; + this.groupBox1.TabStop = false; + this.groupBox1.Text = "Current"; + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Location = new System.Drawing.Point(9, 25); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(35, 13); + this.label1.TabIndex = 0; + this.label1.Text = "label1"; + // + // label2 + // + this.label2.AutoSize = true; + this.label2.Location = new System.Drawing.Point(9, 49); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(35, 13); + this.label2.TabIndex = 1; + this.label2.Text = "label2"; + // + // progressBar1 + // + this.progressBar1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.progressBar1.Location = new System.Drawing.Point(12, 78); + this.progressBar1.Name = "progressBar1"; + this.progressBar1.Size = new System.Drawing.Size(468, 23); + this.progressBar1.TabIndex = 2; + // + // groupBox2 + // + this.groupBox2.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.groupBox2.Controls.Add(this.bttDelete); + this.groupBox2.Controls.Add(this.listBox1); + this.groupBox2.Location = new System.Drawing.Point(12, 140); + this.groupBox2.Name = "groupBox2"; + this.groupBox2.Size = new System.Drawing.Size(567, 170); + this.groupBox2.TabIndex = 2; + this.groupBox2.TabStop = false; + this.groupBox2.Text = "Pending"; + // + // bttAbort + // + this.bttAbort.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.bttAbort.Location = new System.Drawing.Point(486, 78); + this.bttAbort.Name = "bttAbort"; + this.bttAbort.Size = new System.Drawing.Size(75, 23); + this.bttAbort.TabIndex = 3; + this.bttAbort.Text = "&Abort"; + this.bttAbort.UseVisualStyleBackColor = true; + // + // listBox1 + // + this.listBox1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.listBox1.FormattingEnabled = true; + this.listBox1.Location = new System.Drawing.Point(12, 25); + this.listBox1.Name = "listBox1"; + this.listBox1.Size = new System.Drawing.Size(468, 134); + this.listBox1.TabIndex = 0; + // + // bttDelete + // + this.bttDelete.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.bttDelete.Location = new System.Drawing.Point(486, 25); + this.bttDelete.Name = "bttDelete"; + this.bttDelete.Size = new System.Drawing.Size(75, 23); + this.bttDelete.TabIndex = 1; + this.bttDelete.Text = "&Delete"; + this.bttDelete.UseVisualStyleBackColor = true; + // + // UpdateManagerStatusForm + // + this.AcceptButton = this.bttClose; + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.CancelButton = this.bttClose; + this.ClientSize = new System.Drawing.Size(591, 351); + this.Controls.Add(this.groupBox2); + this.Controls.Add(this.groupBox1); + this.Controls.Add(this.bttClose); + this.MaximizeBox = false; + this.MinimizeBox = false; + this.Name = "UpdateManagerStatusForm"; + this.ShowIcon = false; + this.ShowInTaskbar = false; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; + this.Text = "Installation Status"; + this.groupBox1.ResumeLayout(false); + this.groupBox1.PerformLayout(); + this.groupBox2.ResumeLayout(false); + this.ResumeLayout(false); + + } + + #endregion + + private System.Windows.Forms.Button bttClose; + private System.Windows.Forms.GroupBox groupBox1; + private System.Windows.Forms.Button bttAbort; + private System.Windows.Forms.ProgressBar progressBar1; + private System.Windows.Forms.Label label2; + private System.Windows.Forms.Label label1; + private System.Windows.Forms.GroupBox groupBox2; + private System.Windows.Forms.ListBox listBox1; + private System.Windows.Forms.Button bttDelete; + } +} \ No newline at end of file diff --git a/src_vs2012/VSNDK.Package/Options/Dialogs/UpdateManagerStatusForm.cs b/src_vs2012/VSNDK.Package/Options/Dialogs/UpdateManagerStatusForm.cs new file mode 100644 index 00000000..65afe149 --- /dev/null +++ b/src_vs2012/VSNDK.Package/Options/Dialogs/UpdateManagerStatusForm.cs @@ -0,0 +1,12 @@ +using System.Windows.Forms; + +namespace RIM.VSNDK_Package.Options.Dialogs +{ + internal partial class UpdateManagerStatusForm : Form + { + public UpdateManagerStatusForm() + { + InitializeComponent(); + } + } +} diff --git a/src_vs2012/VSNDK.Package/Options/Dialogs/UpdateManagerStatusForm.resx b/src_vs2012/VSNDK.Package/Options/Dialogs/UpdateManagerStatusForm.resx new file mode 100644 index 00000000..29dcb1b3 --- /dev/null +++ b/src_vs2012/VSNDK.Package/Options/Dialogs/UpdateManagerStatusForm.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/src_vs2012/VSNDK.Package/VSNDK.Package.csproj b/src_vs2012/VSNDK.Package/VSNDK.Package.csproj index 2a0c171e..a0c694ea 100644 --- a/src_vs2012/VSNDK.Package/VSNDK.Package.csproj +++ b/src_vs2012/VSNDK.Package/VSNDK.Package.csproj @@ -357,6 +357,12 @@ RegistrationForm.cs + + Form + + + UpdateManagerStatusForm.cs + UserControl @@ -460,6 +466,9 @@ ListItemControl.cs + + UpdateManagerStatusForm.cs + From f2035814bc7c250d2853640e3950e0bbdd808035 Mon Sep 17 00:00:00 2001 From: Pawel Hofman Date: Wed, 4 Jun 2014 16:47:41 +0200 Subject: [PATCH 171/851] Added list loading of runtimes --- src_vs2012/VSNDK.Package/Model/ApiLevelListTypes.cs | 3 ++- src_vs2012/VSNDK.Package/Tools/ApiLevelListLoadRunner.cs | 3 +++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src_vs2012/VSNDK.Package/Model/ApiLevelListTypes.cs b/src_vs2012/VSNDK.Package/Model/ApiLevelListTypes.cs index b38b7489..18254361 100644 --- a/src_vs2012/VSNDK.Package/Model/ApiLevelListTypes.cs +++ b/src_vs2012/VSNDK.Package/Model/ApiLevelListTypes.cs @@ -7,6 +7,7 @@ internal enum ApiLevelListTypes { Default, Full, - Simulators + Simulators, + Runtimes } } diff --git a/src_vs2012/VSNDK.Package/Tools/ApiLevelListLoadRunner.cs b/src_vs2012/VSNDK.Package/Tools/ApiLevelListLoadRunner.cs index faef0f78..a410fab5 100644 --- a/src_vs2012/VSNDK.Package/Tools/ApiLevelListLoadRunner.cs +++ b/src_vs2012/VSNDK.Package/Tools/ApiLevelListLoadRunner.cs @@ -77,6 +77,9 @@ private void UpdateArguments() case ApiLevelListTypes.Simulators: args += " --list-all --simulator"; break; + case ApiLevelListTypes.Runtimes: + args += " --list-all --runtime"; + break; default: throw new InvalidOperationException("Specified list type is unsupported"); } From 2d8e8790c85e1c3b83d65ab03cd935b96ea98847 Mon Sep 17 00:00:00 2001 From: Pawel Hofman Date: Wed, 4 Jun 2014 16:47:57 +0200 Subject: [PATCH 172/851] Updated comments --- src_vs2012/VSNDK.Package/ViewModels/PackageViewModel.cs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src_vs2012/VSNDK.Package/ViewModels/PackageViewModel.cs b/src_vs2012/VSNDK.Package/ViewModels/PackageViewModel.cs index 2e4dbe2a..b22d60bf 100644 --- a/src_vs2012/VSNDK.Package/ViewModels/PackageViewModel.cs +++ b/src_vs2012/VSNDK.Package/ViewModels/PackageViewModel.cs @@ -33,6 +33,7 @@ public static PackageViewModel Instance private DeveloperDefinition _developer; private NdkInfo[] _installedNDKs; private ApiInfoArray[] _remoteNDKs; + private ApiInfoArray[] _remoteSimulators; private NdkInfo _activeNDK; private DeviceDefinition[] _targetDevices; private DeviceDefinition _activeDevice; @@ -41,11 +42,15 @@ public static PackageViewModel Instance public PackageViewModel() { _remoteNDKs = new ApiInfoArray[0]; + _remoteSimulators = new ApiInfoArray[0]; UpdateManager = new UpdateManager(this); } #region Properties + /// + /// Gets the description of current developer (publisher). + /// public DeveloperDefinition Developer { get @@ -60,6 +65,9 @@ public DeveloperDefinition Developer } } + /// + /// Gets the reference to the UpdateManager, responsible for adding and removing features (like install new NDK, simulator or runtime) + /// public UpdateManager UpdateManager { get; From 31b1f077619a1638ef90fb1202597b6eaf8b6c9d Mon Sep 17 00:00:00 2001 From: Pawel Hofman Date: Mon, 9 Jun 2014 01:12:23 +0200 Subject: [PATCH 173/851] Refactored existing -Info types and added new ones --- src_vs2012/VSNDK.Package/Model/ApiInfo.cs | 58 +++++++++++++ .../VSNDK.Package/Model/ApiInfoArray.cs | 14 ++- src_vs2012/VSNDK.Package/Model/NdkInfo.cs | 67 +++++---------- src_vs2012/VSNDK.Package/Model/RuntimeInfo.cs | 85 +++++++++++++++++++ .../VSNDK.Package/Model/SimulatorInfo.cs | 85 +++++++++++++++++++ 5 files changed, 261 insertions(+), 48 deletions(-) create mode 100644 src_vs2012/VSNDK.Package/Model/RuntimeInfo.cs create mode 100644 src_vs2012/VSNDK.Package/Model/SimulatorInfo.cs diff --git a/src_vs2012/VSNDK.Package/Model/ApiInfo.cs b/src_vs2012/VSNDK.Package/Model/ApiInfo.cs index e35fd62b..a8567af7 100644 --- a/src_vs2012/VSNDK.Package/Model/ApiInfo.cs +++ b/src_vs2012/VSNDK.Package/Model/ApiInfo.cs @@ -1,4 +1,5 @@ using System; +using System.Collections.Generic; namespace RIM.VSNDK_Package.Model { @@ -47,6 +48,15 @@ public Version Level private set; } + /// + /// Gets the optional description of this API Level. + /// + public string Details + { + get; + protected set; + } + /// /// Checks if it is really available on current machine. /// @@ -97,5 +107,53 @@ public static ApiInfo CreateTabletInfo() { return new ApiInfo("BlackBerry Native SDK for Tablet OS 2.1.0", new Version(2, 1, 0, 1032)); } + + /// + /// Returns an index of NdkInfo inside a collection that has the same version. + /// + public static int IndexOf(IEnumerable list, Version version) + { + if (version == null) + throw new ArgumentNullException("version"); + + if (list != null) + { + int i = 0; + foreach (var item in list) + { + if (item.Version == version) + return i; + i++; + } + } + + return -1; + } + + /// + /// Extracts the 'version' fragment out of the given directory name. Or returns 'null' in case of any problems. + /// + protected static Version GetVersionFromFolderName(string directoryName) + { + if (string.IsNullOrEmpty(directoryName)) + return null; + + int i = directoryName.Length; + + // find the version substring at the end of the name: + while (i > 0 && directoryName[i - 1] == '_' || directoryName[i - 1] == '.' || char.IsDigit(directoryName[i - 1])) + i--; + + // we might read one char too much: + if (i < directoryName.Length && !char.IsDigit(directoryName[i])) + i++; + + // parse: + var versionString = directoryName.Substring(i).Trim().Replace('_', '.'); + if (string.IsNullOrEmpty(versionString) || versionString.IndexOf('.') < 0) + return null; + + return new Version(versionString); + } } } diff --git a/src_vs2012/VSNDK.Package/Model/ApiInfoArray.cs b/src_vs2012/VSNDK.Package/Model/ApiInfoArray.cs index 1c30191c..28e496bd 100644 --- a/src_vs2012/VSNDK.Package/Model/ApiInfoArray.cs +++ b/src_vs2012/VSNDK.Package/Model/ApiInfoArray.cs @@ -1,6 +1,4 @@ using System; -using System.Collections; -using System.Collections.Generic; namespace RIM.VSNDK_Package.Model { @@ -32,5 +30,17 @@ public int Length } #endregion + + public override bool IsInstalled + { + get + { + foreach (var item in Items) + if (!item.IsInstalled) + return false; + + return true; + } + } } } diff --git a/src_vs2012/VSNDK.Package/Model/NdkInfo.cs b/src_vs2012/VSNDK.Package/Model/NdkInfo.cs index 0cbae341..fa3214f6 100644 --- a/src_vs2012/VSNDK.Package/Model/NdkInfo.cs +++ b/src_vs2012/VSNDK.Package/Model/NdkInfo.cs @@ -63,6 +63,7 @@ public NdkInfo(string filePath, string name, Version version, string hostPath, s // OK, give up, and say it's unknown: Devices = devices ?? new DeviceInfo[0]; + Details = ToShortDeviceDescription(); } #region Properties @@ -116,7 +117,7 @@ private static bool HasPath(string pathA, string pathB) if (string.IsNullOrEmpty(pathA) && string.IsNullOrEmpty(pathB)) return true; - // assuming that paths we aquired by Path.GetFullPath(...) + // assuming that paths we acquired by Path.GetFullPath(...) return string.Compare(pathA, pathB, StringComparison.InvariantCultureIgnoreCase) == 0; } @@ -182,6 +183,25 @@ public string ToLongDescription() return result.ToString(); } + private string ToShortDeviceDescription() + { + if (Devices == null || Devices.Length == 0) + return "Device support unknown"; + + var result = new StringBuilder("Supports "); + int i = 0; + + foreach (var device in Devices) + { + if (i > 0) + result.Append(", "); + result.Append(device.ModelFullName); + i++; + } + + return result.ToString(); + } + /// /// Loads info about a single NDK from specific config file, given as XML. /// @@ -349,28 +369,6 @@ public static int IndexOf(IEnumerable list, NdkInfo info) return -1; } - /// - /// Returns an index of NdkInfo inside a collection that has the same version. - /// - public static int IndexOf(IEnumerable list, Version version) - { - if (version == null) - throw new ArgumentNullException("version"); - - if (list != null) - { - int i = 0; - foreach (var item in list) - { - if (item.Version == version) - return i; - i++; - } - } - - return -1; - } - /// /// Try to find an NDK definition somewhere in specified folder or around. /// @@ -487,29 +485,6 @@ private static Version GetVersionFromInstallationInfo(string[] lines) return null; } - private static Version GetVersionFromFolderName(string directoryName) - { - if (string.IsNullOrEmpty(directoryName)) - return null; - - int i = directoryName.Length; - - // find the version substring at the end of the name: - while (i > 0 && directoryName[i - 1] == '_' || directoryName[i - 1] == '.' || char.IsDigit(directoryName[i - 1])) - i--; - - // we might read one char too much: - if (i < directoryName.Length && !char.IsDigit(directoryName[i])) - i++; - - // parse: - var versionString = directoryName.Substring(i).Trim().Replace('_', '.'); - if (string.IsNullOrEmpty(versionString) || versionString.IndexOf('.') < 0) - return null; - - return new Version(versionString); - } - public bool Save(string outputDirectory) { if (string.IsNullOrEmpty(outputDirectory)) diff --git a/src_vs2012/VSNDK.Package/Model/RuntimeInfo.cs b/src_vs2012/VSNDK.Package/Model/RuntimeInfo.cs new file mode 100644 index 00000000..25c59e19 --- /dev/null +++ b/src_vs2012/VSNDK.Package/Model/RuntimeInfo.cs @@ -0,0 +1,85 @@ +using System; +using System.Collections.Generic; +using System.IO; +using RIM.VSNDK_Package.Diagnostics; + +namespace RIM.VSNDK_Package.Model +{ + /// + /// Description of locally installed runtime libraries. + /// + internal sealed class RuntimeInfo : ApiInfo + { + public RuntimeInfo(string folder, string name, Version version) + : base(name, version) + { + Folder = folder; + Details = Version.ToString(); + } + + #region Properties + + public string Folder + { + get; + private set; + } + + public override bool IsInstalled + { + get { return !string.IsNullOrEmpty(Folder) && Directory.Exists(Folder); } + } + + #endregion + + /// + /// Loads descriptions of installed runtimes from specified folders. + /// + public static RuntimeInfo[] Load(params string[] globalRuntimeConfigFolders) + { + if (globalRuntimeConfigFolders == null) + throw new ArgumentNullException("globalRuntimeConfigFolders"); + + var result = new List(); + + foreach (var folder in globalRuntimeConfigFolders) + { + if (Directory.Exists(folder)) + { + try + { + string[] runtimeDirectories = Directory.GetDirectories(folder); + + foreach (string runtimeDirectory in runtimeDirectories) + { + if (runtimeDirectory.Contains("runtime_")) + { + var name = Path.GetFileName(runtimeDirectory); // 'runtime_xx_yy_zz'... + var version = GetVersionFromFolderName(name); + + if (version != null) + { + var runtimeInfo = new RuntimeInfo(runtimeDirectory, string.Concat("BlackBerry Runtime Libraries ", version.Major, ".", version.Minor), version); + + result.Add(runtimeInfo); + } + else + { + TraceLog.WarnLine("Unable to find runtime libraries version number in folder: \"{0}\"", runtimeDirectory); + } + } + } + + } + catch (Exception ex) + { + TraceLog.WriteException(ex, "Unable to load info about runtime libraries from folder: \"{0}\"", folder); + } + } + } + + result.Sort(); + return result.ToArray(); + } + } +} diff --git a/src_vs2012/VSNDK.Package/Model/SimulatorInfo.cs b/src_vs2012/VSNDK.Package/Model/SimulatorInfo.cs new file mode 100644 index 00000000..8fbb9ce0 --- /dev/null +++ b/src_vs2012/VSNDK.Package/Model/SimulatorInfo.cs @@ -0,0 +1,85 @@ +using System; +using System.Collections.Generic; +using System.IO; +using RIM.VSNDK_Package.Diagnostics; + +namespace RIM.VSNDK_Package.Model +{ + /// + /// Description of locally installed simulator. + /// + internal sealed class SimulatorInfo : ApiInfo + { + public SimulatorInfo(string folder, string name, Version version) + : base(name, version) + { + Folder = folder; + Details = Version.ToString(); + } + + #region Properties + + public string Folder + { + get; + private set; + } + + public override bool IsInstalled + { + get { return !string.IsNullOrEmpty(Folder) && Directory.Exists(Folder); } + } + + #endregion + + /// + /// Loads descriptions of installed simulators from specified folders. + /// + public static SimulatorInfo[] Load(params string[] globalSimulatorConfigFolders) + { + if (globalSimulatorConfigFolders == null) + throw new ArgumentNullException("globalSimulatorConfigFolders"); + + var result = new List(); + + foreach (var folder in globalSimulatorConfigFolders) + { + if (Directory.Exists(folder)) + { + try + { + string[] simulatorDirectories = Directory.GetFiles(folder, "*.vmxf", SearchOption.AllDirectories); + + foreach (string simDirectory in simulatorDirectories) + { + if (simDirectory.Contains("simulator_")) + { + var name = Path.GetDirectoryName(simDirectory); // 'simulator_xx_yy_zz'... + var version = GetVersionFromFolderName(name); + + if (version != null) + { + var simulatorInfo = new SimulatorInfo(name, string.Concat("BlackBerry Simulator ", version.Major, ".", version.Minor), version); + + result.Add(simulatorInfo); + } + else + { + TraceLog.WarnLine("Unable to find simulator version number in folder: \"{0}\"", simDirectory); + } + } + } + + } + catch (Exception ex) + { + TraceLog.WriteException(ex, "Unable to load info about simulators from folder: \"{0}\"", folder); + } + } + } + + result.Sort(); + return result.ToArray(); + } + } +} From b9f9de0343e3633ff6d9adc86c4d8d27b1f9b5d2 Mon Sep 17 00:00:00 2001 From: Pawel Hofman Date: Mon, 9 Jun 2014 01:13:21 +0200 Subject: [PATCH 174/851] Added TODO --- src_vs2012/VSNDK.Package/Tools/RunnerDefaults.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src_vs2012/VSNDK.Package/Tools/RunnerDefaults.cs b/src_vs2012/VSNDK.Package/Tools/RunnerDefaults.cs index 8b79013d..f69e6814 100644 --- a/src_vs2012/VSNDK.Package/Tools/RunnerDefaults.cs +++ b/src_vs2012/VSNDK.Package/Tools/RunnerDefaults.cs @@ -31,7 +31,7 @@ static RunnerDefaults() ToolsDirectory = Path.Combine(programFilesX86, "BlackBerry", "VSPlugin-NDK", "qnxtools", "bin"); NdkDirectory = Path.Combine(Path.GetPathRoot(Environment.GetFolderPath(Environment.SpecialFolder.System)), "bbndk_vs"); - // this would probably be much safer, when enumerating all folders and finding one with 'java.exe' or 'jre' in the name + // PH: TODO: this would probably be much safer, when enumerating all folders and finding one with 'java.exe' or 'jre' in the name JavaHome = Path.Combine(NdkDirectory, "features", "com.qnx.tools.jre.win32_1.6.0.43", "jre"); // the base data folder is different for each platform... From 890b49f3a2469e6ec439d91dbd9536d347bc3895 Mon Sep 17 00:00:00 2001 From: Pawel Hofman Date: Mon, 9 Jun 2014 01:14:05 +0200 Subject: [PATCH 175/851] Improved ordering in PATH for started processes --- src/VSNDK.Package/VSNDK.PackagePackage.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/VSNDK.Package/VSNDK.PackagePackage.cs b/src/VSNDK.Package/VSNDK.PackagePackage.cs index 057ec0cb..b32bff7c 100644 --- a/src/VSNDK.Package/VSNDK.PackagePackage.cs +++ b/src/VSNDK.Package/VSNDK.PackagePackage.cs @@ -986,8 +986,8 @@ protected override void Initialize() { e["QNX_TARGET"] = ndk.TargetPath; e["QNX_HOST"] = ndk.HostPath; - e["PATH"] = string.Concat(Path.Combine(ndk.HostPath, "usr", "bin"), ";", - Path.Combine(RunnerDefaults.JavaHome, "bin"), ";", e["PATH"]); + e["PATH"] = string.Concat(Path.Combine(RunnerDefaults.JavaHome, "bin"), ";", e["PATH"], + Path.Combine(ndk.HostPath, "usr", "bin"), ";"); } else { From 94849e9aa1a001940d534e51b10bafa7ad3c6b53 Mon Sep 17 00:00:00 2001 From: Pawel Hofman Date: Mon, 9 Jun 2014 01:16:30 +0200 Subject: [PATCH 176/851] Improved namings for remote API Levels --- .../Tools/ApiLevelListLoadRunner.cs | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/src_vs2012/VSNDK.Package/Tools/ApiLevelListLoadRunner.cs b/src_vs2012/VSNDK.Package/Tools/ApiLevelListLoadRunner.cs index a410fab5..25ce0a82 100644 --- a/src_vs2012/VSNDK.Package/Tools/ApiLevelListLoadRunner.cs +++ b/src_vs2012/VSNDK.Package/Tools/ApiLevelListLoadRunner.cs @@ -128,12 +128,16 @@ protected override void ConsumeResults(string output, string error) if (name.EndsWith("(SIMULATOR)", StringComparison.InvariantCultureIgnoreCase)) { - name = name.Substring(0, name.Length - 11); + name = name.Substring(0, name.Length - 11).Replace("10 Native SDK", "Simulator").Replace("Native SDK", "Simulator"); } if (name.EndsWith("(EXTERNAL_NDK)", StringComparison.InvariantCultureIgnoreCase)) { name = name.Substring(0, name.Length - 14); } + if (name.EndsWith("(RUNTIME)", StringComparison.InvariantCultureIgnoreCase)) + { + name = name.Substring(0, name.Length - 9).Replace("10 Native SDK", "Runtime Libraries").Replace("Native SDK", "Runtime Libraries"); + } result.Add(new ApiInfo(name.Trim(), new Version(version))); } @@ -144,19 +148,22 @@ protected override void ConsumeResults(string output, string error) } // group the received list by level: - ApiLevels = GroupList(APIs); + ApiLevels = GroupList(APIs, Type != ApiLevelListTypes.Simulators && Type != ApiLevelListTypes.Runtimes); } - private static ApiInfoArray[] GroupList(ApiInfo[] list) + private static ApiInfoArray[] GroupList(ApiInfo[] list, bool injectPlayBook) { if (list == null || list.Length == 0) return new ApiInfoArray[0]; var groups = new List>(); - // inject info about tablet NDK: - Add(groups, ApiInfo.CreateTabletInfo()); - + if (injectPlayBook) + { + // inject info about tablet NDK: + Add(groups, ApiInfo.CreateTabletInfo()); + } + // group BlackBerry 10 items together: foreach (var item in list) { From af51e92ac085ff977e67d7a1c17ee4536022d0d4 Mon Sep 17 00:00:00 2001 From: Pawel Hofman Date: Mon, 9 Jun 2014 01:19:12 +0200 Subject: [PATCH 177/851] Completed implementation of 'Installation' UI --- .../Options/ApiLevelOptionControl.cs | 2 +- .../Dialogs/InstallConfirmationForm.cs | 7 +- .../Options/Dialogs/InstallForm.Designer.cs | 240 ++++++-- .../Options/Dialogs/InstallForm.cs | 97 +++- .../Dialogs/ListItemControl.Designer.cs | 1 + .../Options/Dialogs/ListItemControl.cs | 12 + src_vs2012/VSNDK.Package/VSNDK.Package.csproj | 2 + .../ViewModels/ApiLevelOptionViewModel.cs | 526 ++++++++++++++---- .../ViewModels/PackageViewModel.cs | 93 +++- .../VSNDK.Package/ViewModels/UpdateManager.cs | 4 +- 10 files changed, 812 insertions(+), 172 deletions(-) diff --git a/src_vs2012/VSNDK.Package/Options/ApiLevelOptionControl.cs b/src_vs2012/VSNDK.Package/Options/ApiLevelOptionControl.cs index f1351b34..1d59fbac 100644 --- a/src_vs2012/VSNDK.Package/Options/ApiLevelOptionControl.cs +++ b/src_vs2012/VSNDK.Package/Options/ApiLevelOptionControl.cs @@ -93,7 +93,7 @@ private void bttAddLocal_Click(object sender, EventArgs e) private void bttInstallNew_Click(object sender, EventArgs e) { - var form = new InstallNdkForm(_vm); + var form = new InstallForm(_vm); form.ShowDialog(); PopulateNDKs(false); } diff --git a/src_vs2012/VSNDK.Package/Options/Dialogs/InstallConfirmationForm.cs b/src_vs2012/VSNDK.Package/Options/Dialogs/InstallConfirmationForm.cs index 2b9127ff..a738c347 100644 --- a/src_vs2012/VSNDK.Package/Options/Dialogs/InstallConfirmationForm.cs +++ b/src_vs2012/VSNDK.Package/Options/Dialogs/InstallConfirmationForm.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.Windows.Forms; using RIM.VSNDK_Package.Model; +using RIM.VSNDK_Package.ViewModels; namespace RIM.VSNDK_Package.Options.Dialogs { @@ -10,7 +11,7 @@ namespace RIM.VSNDK_Package.Options.Dialogs /// internal partial class InstallConfirmationForm : Form { - public InstallConfirmationForm(string nameOverride, IEnumerable items, Func installationCheckHandler, Func processingCheckHandler) + public InstallConfirmationForm(string nameOverride, IEnumerable items, UpdateActionTargets target, Func installationCheckHandler, Func processingCheckHandler) { if (items == null) throw new ArgumentNullException("items"); @@ -25,13 +26,13 @@ public InstallConfirmationForm(string nameOverride, IEnumerable items, i.SubItems.Add(item.Version.ToString()); // display status, if it's installed or is still under processing: - if (processingCheckHandler != null && processingCheckHandler(item)) + if (processingCheckHandler != null && processingCheckHandler(item, target)) { i.SubItems.Add("Processing..."); } else { - if (installationCheckHandler != null && installationCheckHandler(item)) + if (installationCheckHandler != null && installationCheckHandler(item, target)) i.SubItems.Add("Installed"); } diff --git a/src_vs2012/VSNDK.Package/Options/Dialogs/InstallForm.Designer.cs b/src_vs2012/VSNDK.Package/Options/Dialogs/InstallForm.Designer.cs index df59b3ac..77e6b971 100644 --- a/src_vs2012/VSNDK.Package/Options/Dialogs/InstallForm.Designer.cs +++ b/src_vs2012/VSNDK.Package/Options/Dialogs/InstallForm.Designer.cs @@ -1,6 +1,6 @@ namespace RIM.VSNDK_Package.Options.Dialogs { - internal partial class InstallNdkForm + internal partial class InstallForm { /// /// Required designer variable. @@ -30,23 +30,38 @@ private void InitializeComponent() { this.bttOK = new System.Windows.Forms.Button(); this.groupBox1 = new System.Windows.Forms.GroupBox(); - this.panelInstalled = new System.Windows.Forms.FlowLayoutPanel(); + this.panelInstalledNDKs = new System.Windows.Forms.FlowLayoutPanel(); this.groupBox2 = new System.Windows.Forms.GroupBox(); - this.panelAvailable = new System.Windows.Forms.FlowLayoutPanel(); + this.panelAvailableNDKs = new System.Windows.Forms.FlowLayoutPanel(); this.tabPage2 = new System.Windows.Forms.TabPage(); + this.groupBox4 = new System.Windows.Forms.GroupBox(); + this.panelAvailableSimulators = new System.Windows.Forms.FlowLayoutPanel(); + this.groupBox3 = new System.Windows.Forms.GroupBox(); + this.panelInstalledSimulators = new System.Windows.Forms.FlowLayoutPanel(); this.tabPage1 = new System.Windows.Forms.TabPage(); - this.tabControl1 = new System.Windows.Forms.TabControl(); + this.tabControl = new System.Windows.Forms.TabControl(); + this.tabPage3 = new System.Windows.Forms.TabPage(); + this.groupBox5 = new System.Windows.Forms.GroupBox(); + this.panelAvailableRuntimes = new System.Windows.Forms.FlowLayoutPanel(); + this.groupBox6 = new System.Windows.Forms.GroupBox(); + this.panelInstalledRuntimes = new System.Windows.Forms.FlowLayoutPanel(); this.groupBox1.SuspendLayout(); this.groupBox2.SuspendLayout(); + this.tabPage2.SuspendLayout(); + this.groupBox4.SuspendLayout(); + this.groupBox3.SuspendLayout(); this.tabPage1.SuspendLayout(); - this.tabControl1.SuspendLayout(); + this.tabControl.SuspendLayout(); + this.tabPage3.SuspendLayout(); + this.groupBox5.SuspendLayout(); + this.groupBox6.SuspendLayout(); this.SuspendLayout(); // // bttOK // this.bttOK.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.bttOK.DialogResult = System.Windows.Forms.DialogResult.OK; - this.bttOK.Location = new System.Drawing.Point(497, 462); + this.bttOK.Location = new System.Drawing.Point(758, 462); this.bttOK.Name = "bttOK"; this.bttOK.Size = new System.Drawing.Size(75, 23); this.bttOK.TabIndex = 0; @@ -57,62 +72,114 @@ private void InitializeComponent() // this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); - this.groupBox1.Controls.Add(this.panelInstalled); + this.groupBox1.Controls.Add(this.panelInstalledNDKs); this.groupBox1.Location = new System.Drawing.Point(6, 6); this.groupBox1.Name = "groupBox1"; - this.groupBox1.Size = new System.Drawing.Size(543, 197); + this.groupBox1.Size = new System.Drawing.Size(804, 197); this.groupBox1.TabIndex = 1; this.groupBox1.TabStop = false; this.groupBox1.Text = "Installed"; // - // panelInstalled + // panelInstalledNDKs // - this.panelInstalled.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + this.panelInstalledNDKs.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); - this.panelInstalled.AutoScroll = true; - this.panelInstalled.FlowDirection = System.Windows.Forms.FlowDirection.TopDown; - this.panelInstalled.Location = new System.Drawing.Point(6, 19); - this.panelInstalled.Name = "panelInstalled"; - this.panelInstalled.Size = new System.Drawing.Size(531, 172); - this.panelInstalled.TabIndex = 0; - this.panelInstalled.WrapContents = false; + this.panelInstalledNDKs.AutoScroll = true; + this.panelInstalledNDKs.FlowDirection = System.Windows.Forms.FlowDirection.TopDown; + this.panelInstalledNDKs.Location = new System.Drawing.Point(6, 19); + this.panelInstalledNDKs.Name = "panelInstalledNDKs"; + this.panelInstalledNDKs.Size = new System.Drawing.Size(792, 172); + this.panelInstalledNDKs.TabIndex = 0; + this.panelInstalledNDKs.WrapContents = false; // // groupBox2 // this.groupBox2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); - this.groupBox2.Controls.Add(this.panelAvailable); + this.groupBox2.Controls.Add(this.panelAvailableNDKs); this.groupBox2.Location = new System.Drawing.Point(6, 210); this.groupBox2.Name = "groupBox2"; - this.groupBox2.Size = new System.Drawing.Size(543, 197); + this.groupBox2.Size = new System.Drawing.Size(804, 197); this.groupBox2.TabIndex = 2; this.groupBox2.TabStop = false; this.groupBox2.Text = "Available"; // - // panelAvailable + // panelAvailableNDKs // - this.panelAvailable.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + this.panelAvailableNDKs.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); - this.panelAvailable.AutoScroll = true; - this.panelAvailable.FlowDirection = System.Windows.Forms.FlowDirection.TopDown; - this.panelAvailable.Location = new System.Drawing.Point(6, 19); - this.panelAvailable.Name = "panelAvailable"; - this.panelAvailable.Size = new System.Drawing.Size(531, 172); - this.panelAvailable.TabIndex = 0; - this.panelAvailable.WrapContents = false; + this.panelAvailableNDKs.AutoScroll = true; + this.panelAvailableNDKs.FlowDirection = System.Windows.Forms.FlowDirection.TopDown; + this.panelAvailableNDKs.Location = new System.Drawing.Point(6, 19); + this.panelAvailableNDKs.Name = "panelAvailableNDKs"; + this.panelAvailableNDKs.Size = new System.Drawing.Size(792, 172); + this.panelAvailableNDKs.TabIndex = 0; + this.panelAvailableNDKs.WrapContents = false; // // tabPage2 // + this.tabPage2.Controls.Add(this.groupBox4); + this.tabPage2.Controls.Add(this.groupBox3); this.tabPage2.Location = new System.Drawing.Point(4, 22); this.tabPage2.Name = "tabPage2"; this.tabPage2.Padding = new System.Windows.Forms.Padding(3); - this.tabPage2.Size = new System.Drawing.Size(623, 418); + this.tabPage2.Size = new System.Drawing.Size(819, 418); this.tabPage2.TabIndex = 1; this.tabPage2.Text = "Simulator"; this.tabPage2.UseVisualStyleBackColor = true; // + // groupBox4 + // + this.groupBox4.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.groupBox4.Controls.Add(this.panelAvailableSimulators); + this.groupBox4.Location = new System.Drawing.Point(6, 210); + this.groupBox4.Name = "groupBox4"; + this.groupBox4.Size = new System.Drawing.Size(804, 197); + this.groupBox4.TabIndex = 3; + this.groupBox4.TabStop = false; + this.groupBox4.Text = "Available"; + // + // panelAvailableSimulators + // + this.panelAvailableSimulators.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.panelAvailableSimulators.AutoScroll = true; + this.panelAvailableSimulators.FlowDirection = System.Windows.Forms.FlowDirection.TopDown; + this.panelAvailableSimulators.Location = new System.Drawing.Point(6, 19); + this.panelAvailableSimulators.Name = "panelAvailableSimulators"; + this.panelAvailableSimulators.Size = new System.Drawing.Size(792, 172); + this.panelAvailableSimulators.TabIndex = 0; + this.panelAvailableSimulators.WrapContents = false; + // + // groupBox3 + // + this.groupBox3.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.groupBox3.Controls.Add(this.panelInstalledSimulators); + this.groupBox3.Location = new System.Drawing.Point(6, 6); + this.groupBox3.Name = "groupBox3"; + this.groupBox3.Size = new System.Drawing.Size(804, 197); + this.groupBox3.TabIndex = 2; + this.groupBox3.TabStop = false; + this.groupBox3.Text = "Installed"; + // + // panelInstalledSimulators + // + this.panelInstalledSimulators.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.panelInstalledSimulators.AutoScroll = true; + this.panelInstalledSimulators.FlowDirection = System.Windows.Forms.FlowDirection.TopDown; + this.panelInstalledSimulators.Location = new System.Drawing.Point(6, 19); + this.panelInstalledSimulators.Name = "panelInstalledSimulators"; + this.panelInstalledSimulators.Size = new System.Drawing.Size(792, 172); + this.panelInstalledSimulators.TabIndex = 0; + this.panelInstalledSimulators.WrapContents = false; + // // tabPage1 // this.tabPage1.Controls.Add(this.groupBox1); @@ -120,44 +187,112 @@ private void InitializeComponent() this.tabPage1.Location = new System.Drawing.Point(4, 22); this.tabPage1.Name = "tabPage1"; this.tabPage1.Padding = new System.Windows.Forms.Padding(3); - this.tabPage1.Size = new System.Drawing.Size(558, 418); + this.tabPage1.Size = new System.Drawing.Size(819, 418); this.tabPage1.TabIndex = 0; - this.tabPage1.Text = "BlackBerry Native SDK"; + this.tabPage1.Text = "Native SDK"; this.tabPage1.UseVisualStyleBackColor = true; // - // tabControl1 + // tabControl + // + this.tabControl.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.tabControl.Controls.Add(this.tabPage1); + this.tabControl.Controls.Add(this.tabPage2); + this.tabControl.Controls.Add(this.tabPage3); + this.tabControl.Location = new System.Drawing.Point(6, 6); + this.tabControl.Name = "tabControl"; + this.tabControl.SelectedIndex = 0; + this.tabControl.Size = new System.Drawing.Size(827, 444); + this.tabControl.TabIndex = 3; + // + // tabPage3 + // + this.tabPage3.Controls.Add(this.groupBox5); + this.tabPage3.Controls.Add(this.groupBox6); + this.tabPage3.Location = new System.Drawing.Point(4, 22); + this.tabPage3.Name = "tabPage3"; + this.tabPage3.Size = new System.Drawing.Size(819, 418); + this.tabPage3.TabIndex = 2; + this.tabPage3.Text = "Runtime Library"; + this.tabPage3.UseVisualStyleBackColor = true; + // + // groupBox5 + // + this.groupBox5.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.groupBox5.Controls.Add(this.panelAvailableRuntimes); + this.groupBox5.Location = new System.Drawing.Point(6, 210); + this.groupBox5.Name = "groupBox5"; + this.groupBox5.Size = new System.Drawing.Size(804, 197); + this.groupBox5.TabIndex = 5; + this.groupBox5.TabStop = false; + this.groupBox5.Text = "Available"; + // + // panelAvailableRuntimes + // + this.panelAvailableRuntimes.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.panelAvailableRuntimes.AutoScroll = true; + this.panelAvailableRuntimes.FlowDirection = System.Windows.Forms.FlowDirection.TopDown; + this.panelAvailableRuntimes.Location = new System.Drawing.Point(6, 19); + this.panelAvailableRuntimes.Name = "panelAvailableRuntimes"; + this.panelAvailableRuntimes.Size = new System.Drawing.Size(792, 172); + this.panelAvailableRuntimes.TabIndex = 0; + this.panelAvailableRuntimes.WrapContents = false; + // + // groupBox6 + // + this.groupBox6.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.groupBox6.Controls.Add(this.panelInstalledRuntimes); + this.groupBox6.Location = new System.Drawing.Point(6, 6); + this.groupBox6.Name = "groupBox6"; + this.groupBox6.Size = new System.Drawing.Size(804, 197); + this.groupBox6.TabIndex = 4; + this.groupBox6.TabStop = false; + this.groupBox6.Text = "Installed"; + // + // panelInstalledRuntimes // - this.tabControl1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + this.panelInstalledRuntimes.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); - this.tabControl1.Controls.Add(this.tabPage1); - this.tabControl1.Controls.Add(this.tabPage2); - this.tabControl1.Location = new System.Drawing.Point(12, 12); - this.tabControl1.Name = "tabControl1"; - this.tabControl1.SelectedIndex = 0; - this.tabControl1.Size = new System.Drawing.Size(566, 444); - this.tabControl1.TabIndex = 3; + this.panelInstalledRuntimes.AutoScroll = true; + this.panelInstalledRuntimes.FlowDirection = System.Windows.Forms.FlowDirection.TopDown; + this.panelInstalledRuntimes.Location = new System.Drawing.Point(6, 19); + this.panelInstalledRuntimes.Name = "panelInstalledRuntimes"; + this.panelInstalledRuntimes.Size = new System.Drawing.Size(792, 172); + this.panelInstalledRuntimes.TabIndex = 0; + this.panelInstalledRuntimes.WrapContents = false; // - // InstallNdkForm + // InstallForm // this.AcceptButton = this.bttOK; this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.CancelButton = this.bttOK; - this.ClientSize = new System.Drawing.Size(584, 497); - this.Controls.Add(this.tabControl1); + this.ClientSize = new System.Drawing.Size(845, 497); + this.Controls.Add(this.tabControl); this.Controls.Add(this.bttOK); this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; this.MaximizeBox = false; this.MinimizeBox = false; - this.Name = "InstallNdkForm"; + this.Name = "InstallForm"; this.ShowInTaskbar = false; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; this.Text = "Installation"; this.groupBox1.ResumeLayout(false); this.groupBox2.ResumeLayout(false); + this.tabPage2.ResumeLayout(false); + this.groupBox4.ResumeLayout(false); + this.groupBox3.ResumeLayout(false); this.tabPage1.ResumeLayout(false); - this.tabControl1.ResumeLayout(false); + this.tabControl.ResumeLayout(false); + this.tabPage3.ResumeLayout(false); + this.groupBox5.ResumeLayout(false); + this.groupBox6.ResumeLayout(false); this.ResumeLayout(false); } @@ -167,10 +302,19 @@ private void InitializeComponent() private System.Windows.Forms.Button bttOK; private System.Windows.Forms.GroupBox groupBox1; private System.Windows.Forms.GroupBox groupBox2; - private System.Windows.Forms.FlowLayoutPanel panelInstalled; - private System.Windows.Forms.FlowLayoutPanel panelAvailable; + private System.Windows.Forms.FlowLayoutPanel panelInstalledNDKs; + private System.Windows.Forms.FlowLayoutPanel panelAvailableNDKs; private System.Windows.Forms.TabPage tabPage2; private System.Windows.Forms.TabPage tabPage1; - private System.Windows.Forms.TabControl tabControl1; + private System.Windows.Forms.TabControl tabControl; + private System.Windows.Forms.TabPage tabPage3; + private System.Windows.Forms.GroupBox groupBox4; + private System.Windows.Forms.FlowLayoutPanel panelAvailableSimulators; + private System.Windows.Forms.GroupBox groupBox3; + private System.Windows.Forms.FlowLayoutPanel panelInstalledSimulators; + private System.Windows.Forms.GroupBox groupBox5; + private System.Windows.Forms.FlowLayoutPanel panelAvailableRuntimes; + private System.Windows.Forms.GroupBox groupBox6; + private System.Windows.Forms.FlowLayoutPanel panelInstalledRuntimes; } } \ No newline at end of file diff --git a/src_vs2012/VSNDK.Package/Options/Dialogs/InstallForm.cs b/src_vs2012/VSNDK.Package/Options/Dialogs/InstallForm.cs index 4d3589ad..125fb390 100644 --- a/src_vs2012/VSNDK.Package/Options/Dialogs/InstallForm.cs +++ b/src_vs2012/VSNDK.Package/Options/Dialogs/InstallForm.cs @@ -6,7 +6,7 @@ namespace RIM.VSNDK_Package.Options.Dialogs { - internal partial class InstallNdkForm : Form + internal partial class InstallForm : Form { #region Private Classes @@ -32,7 +32,7 @@ public int Compare(ApiInfoArray x, ApiInfoArray y) private readonly ApiLevelOptionViewModel _vm; - public InstallNdkForm(ApiLevelOptionViewModel vm) + public InstallForm(ApiLevelOptionViewModel vm) { if (vm == null) throw new ArgumentNullException("vm"); @@ -40,27 +40,49 @@ public InstallNdkForm(ApiLevelOptionViewModel vm) InitializeComponent(); _vm = vm; _vm.NdkListLoaded += NdkListLoaded; + _vm.SimulatorListLoaded += SimulatorListLoaded; + _vm.RuntimeListLoaded += RuntimeListLoaded; UpdateUI(); } + #region Properties + + /// + /// Gets or sets the active tab. + /// + public int ActiveTab + { + get { return tabControl.SelectedIndex; } + set { tabControl.SelectedIndex = value; } + } + + #endregion + private void UpdateUI() { - PopulateList(panelInstalled, _vm.InstalledNDKs, info => _vm.GetActionForNDK(info), "No installed Native SDK found", ApiLevelActionType.Hide); - LoadNDKs(false); + PopulateList(panelInstalledNDKs, _vm.InstalledNDKs, UpdateActionTargets.NDK, (info, target) => _vm.GetAction(info, target), "No installed Native SDK found", ApiLevelActionType.Hide); + PopulateList(panelInstalledSimulators, _vm.InstalledSimulators, UpdateActionTargets.Simulator, (info, target) => _vm.GetAction(info, target), "No installed simulators found", ApiLevelActionType.Hide); + PopulateList(panelInstalledRuntimes, _vm.InstalledRuntimes, UpdateActionTargets.Runtime, (info, target) => _vm.GetAction(info, target), "No installed runtimes found", ApiLevelActionType.Hide); + + LoadList(panelAvailableNDKs, UpdateActionTargets.NDK, false); + LoadList(panelAvailableSimulators, UpdateActionTargets.Simulator, false); + LoadList(panelAvailableRuntimes, UpdateActionTargets.Runtime, false); } - private void LoadNDKs(bool refresh) + private void LoadList(Panel panel, UpdateActionTargets target, bool refresh) { - if (_vm.LoadNDKs(refresh)) + if (_vm.Load(target, refresh)) { - PopulateList(panelAvailable, null, null, "Loading...", ApiLevelActionType.Hide); + PopulateList(panel, null, target, null, "Loading...", ApiLevelActionType.Hide); } } protected override void OnClosed(EventArgs e) { _vm.NdkListLoaded -= NdkListLoaded; + _vm.SimulatorListLoaded -= SimulatorListLoaded; + _vm.RuntimeListLoaded -= RuntimeListLoaded; base.OnClosed(e); } @@ -69,11 +91,30 @@ private void NdkListLoaded(object sender, EventArgs eventArgs) var suggested = (ApiInfoArray[]) _vm.RemoteNDKs.Clone(); Array.Sort(suggested, new DescApiComparer()); - PopulateList(panelAvailable, suggested, info => _vm.GetActionForNDK(info), "There was an error, while loading list of Native SDKs", ApiLevelActionType.Refresh); + PopulateList(panelAvailableNDKs, suggested, UpdateActionTargets.NDK, (info, target) => _vm.GetAction(info, target), "There was an error, while loading list of Native SDKs", ApiLevelActionType.Refresh); } - private void PopulateList(Panel panel, IEnumerable items, Func actionEvaluation, string missingItemsMessage, ApiLevelActionType missingItemsAction) + private void SimulatorListLoaded(object sender, EventArgs e) { + var suggested = (ApiInfoArray[])_vm.RemoteSimulators.Clone(); + Array.Sort(suggested, new DescApiComparer()); + + PopulateList(panelAvailableSimulators, suggested, UpdateActionTargets.Simulator, (info, target) => _vm.GetAction(info, target), "There was an error, while loading list of Simulators", ApiLevelActionType.Refresh); + } + + private void RuntimeListLoaded(object sender, EventArgs e) + { + var suggested = (ApiInfoArray[])_vm.RemoteRuntimes.Clone(); + Array.Sort(suggested, new DescApiComparer()); + + PopulateList(panelAvailableRuntimes, suggested, UpdateActionTargets.Runtime, (info, target) => _vm.GetAction(info, target), "There was an error, while loading list of Runtime Libraries", ApiLevelActionType.Refresh); + } + + private void PopulateList(Panel panel, IEnumerable items, UpdateActionTargets target, Func actionEvaluation, string missingItemsMessage, ApiLevelActionType missingItemsAction) + { + if (panel == null) + return; + int itemsAdded = 0; panel.Controls.Clear(); @@ -85,9 +126,11 @@ private void PopulateList(Panel panel, IEnumerable items, Func items, Func _vm.CheckIfNdkInstalled(info), info => _vm.IsProcessingNDK(info)); + var form = new InstallConfirmationForm(apiInfoArray.Name, apiInfoArray.Items, actionTarget, (info, target) => _vm.CheckIfInstalled(info, target), (info, target) => _vm.IsProcessing(info, target)); if (form.ShowDialog() == DialogResult.OK) { var info = form.SelectedItem; - _vm.RequestNdk(info); + _vm.RequestInstall(info, actionTarget); MessageBoxHelper.Show("Scheduled \"" + info + "\" for installation. Please be patient, this might take some time.", "Update Manager", MessageBoxButtons.OK, MessageBoxIcon.Information); @@ -137,9 +186,6 @@ private void ItemOnExecuteAction(object sender, EventArgs eventArgs) case ApiLevelActionType.InstallManually: DialogHelper.StartURL((string)argument); break; - case ApiLevelActionType.Refresh: - LoadNDKs(true); - break; case ApiLevelActionType.Forget: if (MessageBoxHelper.Show(definition.ToString(), "Remove own reference to existing NDK?", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { @@ -147,8 +193,25 @@ private void ItemOnExecuteAction(object sender, EventArgs eventArgs) UpdateUI(); } break; + case ApiLevelActionType.Uninstall: + if (MessageBoxHelper.Show(definition.ToString(), "Do you want to remove this item?", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) + { + _vm.RequestRemoval(definition, actionTarget); + UpdateUI(); + + MessageBoxHelper.Show("Scheduled \"" + definition + "\" for removal. Please be patient, this might take some time.", + "Update Manager", MessageBoxButtons.OK, MessageBoxIcon.Information); + } + break; } } + + switch (action) + { + case ApiLevelActionType.Refresh: + LoadList(panel, actionTarget, true); + break; + } } } } diff --git a/src_vs2012/VSNDK.Package/Options/Dialogs/ListItemControl.Designer.cs b/src_vs2012/VSNDK.Package/Options/Dialogs/ListItemControl.Designer.cs index 0e375939..8c1e1c53 100644 --- a/src_vs2012/VSNDK.Package/Options/Dialogs/ListItemControl.Designer.cs +++ b/src_vs2012/VSNDK.Package/Options/Dialogs/ListItemControl.Designer.cs @@ -48,6 +48,7 @@ private void InitializeComponent() // this.lblDetails.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); + this.lblDetails.AutoEllipsis = true; this.lblDetails.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Italic, System.Drawing.GraphicsUnit.Point, ((byte)(238))); this.lblDetails.Location = new System.Drawing.Point(3, 19); this.lblDetails.Name = "lblDetails"; diff --git a/src_vs2012/VSNDK.Package/Options/Dialogs/ListItemControl.cs b/src_vs2012/VSNDK.Package/Options/Dialogs/ListItemControl.cs index 8b9d6124..2070e118 100644 --- a/src_vs2012/VSNDK.Package/Options/Dialogs/ListItemControl.cs +++ b/src_vs2012/VSNDK.Package/Options/Dialogs/ListItemControl.cs @@ -51,6 +51,18 @@ public ApiLevelActionType Action } } + public UpdateActionTargets Target + { + get; + set; + } + + public Panel ParentPanel + { + get; + set; + } + private void OnActionChanged() { bttAction.Enabled = true; diff --git a/src_vs2012/VSNDK.Package/VSNDK.Package.csproj b/src_vs2012/VSNDK.Package/VSNDK.Package.csproj index a0c694ea..0c9b10dc 100644 --- a/src_vs2012/VSNDK.Package/VSNDK.Package.csproj +++ b/src_vs2012/VSNDK.Package/VSNDK.Package.csproj @@ -274,6 +274,8 @@ Component + + UserControl diff --git a/src_vs2012/VSNDK.Package/ViewModels/ApiLevelOptionViewModel.cs b/src_vs2012/VSNDK.Package/ViewModels/ApiLevelOptionViewModel.cs index 6704c501..f98c4e09 100644 --- a/src_vs2012/VSNDK.Package/ViewModels/ApiLevelOptionViewModel.cs +++ b/src_vs2012/VSNDK.Package/ViewModels/ApiLevelOptionViewModel.cs @@ -6,139 +6,439 @@ namespace RIM.VSNDK_Package.ViewModels { internal sealed class ApiLevelOptionViewModel : IDisposable { - public event EventHandler NdkListLoaded; + #region Internal Classes - private readonly static Version LastPlayBookVersion = new Version(9, 99, 0, 0); - private ApiLevelListLoadRunner _ndkLoadRunner; + private abstract class LoaderViewModel : IDisposable + { + /// + /// Event fired, when data is loaded. + /// + public event EventHandler Loaded; - ~ApiLevelOptionViewModel() + private ApiLevelListLoadRunner _runner; + private readonly ApiLevelListTypes _type; + + #region Properties + + public abstract ApiInfoArray[] Remote + { + get; + protected set; + } + + #endregion + + public LoaderViewModel(ApiLevelListTypes type) + { + _type = type; + } + + ~LoaderViewModel() + { + Dispose(false); + } + + public bool Load(bool reload, IEventDispatcher dispatcher) + { + // is it still loading? + if (_runner != null) + return true; + + // was it loaded before? + if (!reload && Remote != null && Remote.Length > 0) + { + NotifyListLoaded(); + return false; + } + + _runner = new ApiLevelListLoadRunner(RunnerDefaults.NdkDirectory, _type); + _runner.Dispatcher = dispatcher; + _runner.Finished += RunnerOnFinished; + _runner.ExecuteAsync(); + return true; + } + + private void RunnerOnFinished(object sender, ToolRunnerEventArgs e) + { + Remote = _runner.ApiLevels; + _runner.Finished -= RunnerOnFinished; + _runner = null; + + NotifyListLoaded(); + } + + private void NotifyListLoaded() + { + var handler = Loaded; + if (handler != null) + handler(this, EventArgs.Empty); + } + + public ApiLevelActionType GetAction(ApiInfo info) + { + object argument; + return GetAction(info, out argument); + } + + public abstract ApiLevelActionType GetAction(ApiInfo info, out object argument); + + public abstract bool IsInstalled(ApiInfo info); + + public abstract bool IsProcessing(ApiInfo info); + + #region IDisposable Implementation + + public void Dispose() + { + GC.SuppressFinalize(this); + Dispose(true); + } + + protected virtual void Dispose(bool disposing) + { + if (disposing) + { + if (_runner != null) + { + _runner.Dispose(); + _runner = null; + } + } + } + + #endregion + } + + private sealed class NdkLoaderViewModel : LoaderViewModel { - Dispose(false); + private readonly static Version LastPlayBookVersion = new Version(9, 99, 0, 0); + + public NdkLoaderViewModel() + : base(ApiLevelListTypes.Full) + { + } + + public override ApiInfoArray[] Remote + { + get { return PackageViewModel.Instance.RemoteNDKs; } + protected set { PackageViewModel.Instance.RemoteNDKs = value; } + } + + public NdkInfo[] Installed + { + get { return PackageViewModel.Instance.InstalledNDKs; } + } + + public NdkInfo Active + { + get { return PackageViewModel.Instance.ActiveNDK; } + set { PackageViewModel.Instance.ActiveNDK = value; } + } + + public override ApiLevelActionType GetAction(ApiInfo info, out object argument) + { + argument = null; + + // nothing should be displayed for not defined NDK: + if (info == null) + return ApiLevelActionType.Hide; + + // check, if it exists on disk: + bool isInstalled = IsInstalled(info) || AreItemsInstalled(info as ApiInfoArray); + var ndkInfo = info as NdkInfo; + + if (ndkInfo != null) + { + // is it NDK owned by the plugin itself? + if (isInstalled && ndkInfo.TargetPath != null && ndkInfo.TargetPath.StartsWith(RunnerDefaults.NdkDirectory, StringComparison.InvariantCultureIgnoreCase)) + { + return IsProcessing(info) ? ApiLevelActionType.Nothing : ApiLevelActionType.Uninstall; + } + + // is it a custom definition added? + if (ndkInfo.FilePath != null && ndkInfo.FilePath.StartsWith(RunnerDefaults.PluginInstallationConfigDirectory, StringComparison.InvariantCultureIgnoreCase)) + { + return ApiLevelActionType.Forget; + } + } + + // is it a PlayBook NDK? + if (info.Version <= LastPlayBookVersion) + { + if (isInstalled) + return ApiLevelActionType.Nothing; + + argument = "http://developer.blackberry.com/playbook/native/download/"; + return ApiLevelActionType.InstallManually; + } + + // by default, check, if it can be installed, or it's not owned by the plugin: + return isInstalled ? ApiLevelActionType.Nothing : ApiLevelActionType.Install; + } + + public override bool IsInstalled(ApiInfo info) + { + return info != null && PackageViewModel.Instance.IndexOfInstalledNDK(info.Version) >= 0; + } + + public override bool IsProcessing(ApiInfo info) + { + return info != null && PackageViewModel.Instance.UpdateManager.IsProcessing(info.Version, UpdateActionTargets.NDK); + } + + /// + /// Checks, if all items owned by an array are already installed. + /// + private bool AreItemsInstalled(ApiInfoArray definition) + { + if (definition == null) + return false; + + foreach (var item in definition.Items) + { + if (!IsInstalled(item)) + return false; + } + + return true; + } + + public void ReloadAndActivate(NdkInfo ndk) + { + PackageViewModel.Instance.ResetNDKs(); + Active = ndk; + } } - public NdkInfo[] InstalledNDKs + private sealed class SimulatorLoaderViewModel : LoaderViewModel { - get { return PackageViewModel.Instance.InstalledNDKs; } + public SimulatorLoaderViewModel() + : base(ApiLevelListTypes.Simulators) + { + } + + public override ApiInfoArray[] Remote + { + get { return PackageViewModel.Instance.RemoteSimulators; } + protected set { PackageViewModel.Instance.RemoteSimulators = value; } + } + + public SimulatorInfo[] Installed + { + get { return PackageViewModel.Instance.InstalledSimulators; } + } + + public override ApiLevelActionType GetAction(ApiInfo info, out object argument) + { + argument = null; + + // nothing should be displayed for invalid simulator: + if (info == null) + return ApiLevelActionType.Hide; + + // check, if it exists on disk: + var infoArray = info as ApiInfoArray; + bool isInstalled = IsInstalled(info) || (infoArray != null && infoArray.IsInstalled); + var simulatorInfo = info as SimulatorInfo; + + if (simulatorInfo != null) + { + return isInstalled && !IsProcessing(info) ? ApiLevelActionType.Uninstall : ApiLevelActionType.Nothing; + } + + return isInstalled ? ApiLevelActionType.Nothing : ApiLevelActionType.Install; + } + + public override bool IsInstalled(ApiInfo info) + { + return info != null && PackageViewModel.Instance.IndexOfInstalledSimulator(info.Version) >= 0; + } + + public override bool IsProcessing(ApiInfo info) + { + return info != null && PackageViewModel.Instance.UpdateManager.IsProcessing(info.Version, UpdateActionTargets.Simulator); + } } - public ApiInfoArray[] RemoteNDKs + private sealed class RuntimeLoaderViewModel : LoaderViewModel { - get { return PackageViewModel.Instance.RemoteNDKs; } + public RuntimeLoaderViewModel() + : base(ApiLevelListTypes.Runtimes) + { + } + + public override ApiInfoArray[] Remote + { + get { return PackageViewModel.Instance.RemoteRuntimes; } + protected set { PackageViewModel.Instance.RemoteRuntimes = value; } + } + + public RuntimeInfo[] Installed + { + get { return PackageViewModel.Instance.InstalledRuntimes; } + } + + public override ApiLevelActionType GetAction(ApiInfo info, out object argument) + { + argument = null; + + // nothing should be displayed for invalid runtime libraries: + if (info == null) + return ApiLevelActionType.Hide; + + // check, if it exists on disk: + var infoArray = info as ApiInfoArray; + bool isInstalled = IsInstalled(info) || (infoArray != null && infoArray.IsInstalled); + var runtimeInfo = info as RuntimeInfo; + + if (runtimeInfo != null) + { + return isInstalled && !IsProcessing(info) ? ApiLevelActionType.Uninstall : ApiLevelActionType.Nothing; + } + + return isInstalled ? ApiLevelActionType.Nothing : ApiLevelActionType.Install; + } + + public override bool IsInstalled(ApiInfo info) + { + return info != null && PackageViewModel.Instance.IndexOfInstalledRuntime(info.Version) >= 0; + } + + public override bool IsProcessing(ApiInfo info) + { + return info != null && PackageViewModel.Instance.UpdateManager.IsProcessing(info.Version, UpdateActionTargets.Runtime); + } } - public NdkInfo ActiveNDK + #endregion + + public event EventHandler NdkListLoaded { - get { return PackageViewModel.Instance.ActiveNDK; } - set { PackageViewModel.Instance.ActiveNDK = value; } + add { _ndk.Loaded += value; } + remove { _ndk.Loaded -= value; } } - public IEventDispatcher Dispatcher + public event EventHandler SimulatorListLoaded { - get; - set; + add { _simulator.Loaded += value; } + remove { _simulator.Loaded -= value; } } - public void ReloadAndActivate(NdkInfo ndk) + public event EventHandler RuntimeListLoaded { - PackageViewModel.Instance.ResetNDKs(); - ActiveNDK = ndk; + add { _runtime.Loaded += value; } + remove { _runtime.Loaded -= value; } } - public ApiLevelActionType GetActionForNDK(ApiInfo definition) + private readonly NdkLoaderViewModel _ndk; + private readonly SimulatorLoaderViewModel _simulator; + private readonly RuntimeLoaderViewModel _runtime; + + public ApiLevelOptionViewModel() { - object argument; + _ndk = new NdkLoaderViewModel(); + _simulator = new SimulatorLoaderViewModel(); + _runtime = new RuntimeLoaderViewModel(); + } - return GetActionForNDK(definition, out argument); + ~ApiLevelOptionViewModel() + { + Dispose(false); } - public ApiLevelActionType GetActionForNDK(ApiInfo definition, out object argument) + public NdkInfo[] InstalledNDKs { - argument = null; + get { return _ndk.Installed; } + } - // nothing should be displayed for not defined NDK: - if (definition == null) - return ApiLevelActionType.Hide; + public ApiInfoArray[] RemoteNDKs + { + get { return _ndk.Remote; } + } - // check, if it exists on disk: - bool isInstalled = PackageViewModel.Instance.IndexOfInstalled(definition.Version) >= 0 || AreItemsInstalled(definition as ApiInfoArray); - var ndkInfo = definition as NdkInfo; + public SimulatorInfo[] InstalledSimulators + { + get { return _simulator.Installed; } + } - if (ndkInfo != null) - { - // is it NDK owned by the plugin itself? - if (isInstalled && ndkInfo.TargetPath != null && ndkInfo.TargetPath.StartsWith(RunnerDefaults.NdkDirectory)) - { - return ApiLevelActionType.Uninstall; - } + public ApiInfoArray[] RemoteSimulators + { + get { return _simulator.Remote; } + } - // is it a custom definition added? - if (ndkInfo.FilePath != null && ndkInfo.FilePath.StartsWith(RunnerDefaults.PluginInstallationConfigDirectory)) - { - return ApiLevelActionType.Forget; - } - } + public RuntimeInfo[] InstalledRuntimes + { + get { return _runtime.Installed; } + } - // is it a PlayBook NDK? - if (definition.Version <= LastPlayBookVersion) - { - if (isInstalled) - return ApiLevelActionType.Nothing; + public ApiInfoArray[] RemoteRuntimes + { + get { return _runtime.Remote; } + } - argument = "http://developer.blackberry.com/playbook/native/download/"; - return ApiLevelActionType.InstallManually; - } + public NdkInfo ActiveNDK + { + get { return _ndk.Active; } + set { _ndk.Active = value; } + } - // by default, check, if it can be installed, or it's not owned by the pluign: - return isInstalled ? ApiLevelActionType.Nothing : ApiLevelActionType.Install; + public IEventDispatcher Dispatcher + { + get; + set; } - /// - /// Checks, if all items owned by an array are already installed. - /// - private static bool AreItemsInstalled(ApiInfoArray definition) + public void ReloadAndActivate(NdkInfo ndk) { - if (definition == null) - return false; + _ndk.ReloadAndActivate(ndk); + } - foreach (var item in definition.Items) + public ApiLevelActionType GetAction(ApiInfo info, UpdateActionTargets target) + { + switch (target) { - if (PackageViewModel.Instance.IndexOfInstalled(item.Version) < 0) - return false; + case UpdateActionTargets.NDK: + return _ndk.GetAction(info); + case UpdateActionTargets.Simulator: + return _simulator.GetAction(info); + case UpdateActionTargets.Runtime: + return _runtime.GetAction(info); + default: + throw new ArgumentOutOfRangeException("target"); } - - return true; } - public bool LoadNDKs(bool reload) + public ApiLevelActionType GetAction(ApiInfo info, UpdateActionTargets target, out object argument) { - // is it still loading? - if (_ndkLoadRunner != null) - return false; - - // did we loaded it before - if (!reload && RemoteNDKs.Length > 0) + switch (target) { - if (NdkListLoaded != null) - NdkListLoaded(this, EventArgs.Empty); - return false; + case UpdateActionTargets.NDK: + return _ndk.GetAction(info, out argument); + case UpdateActionTargets.Simulator: + return _simulator.GetAction(info, out argument); + case UpdateActionTargets.Runtime: + return _runtime.GetAction(info, out argument); + default: + throw new ArgumentOutOfRangeException("target"); } - - _ndkLoadRunner = new ApiLevelListLoadRunner(RunnerDefaults.NdkDirectory, ApiLevelListTypes.Full); - _ndkLoadRunner.Dispatcher = Dispatcher; - _ndkLoadRunner.Finished += NdkLoadRunnerOnFinished; - _ndkLoadRunner.ExecuteAsync(); - return true; } - private void NdkLoadRunnerOnFinished(object sender, ToolRunnerEventArgs e) + /// + /// Loads the list of remote NDKs. + /// If data is already available this method will return 'false'. 'True', if loading in progress. + /// + public bool Load(UpdateActionTargets target, bool reload) { - PackageViewModel.Instance.RemoteNDKs = _ndkLoadRunner.ApiLevels; - _ndkLoadRunner.Finished -= NdkLoadRunnerOnFinished; - _ndkLoadRunner = null; - - if (NdkListLoaded != null) + switch (target) { - NdkListLoaded(this, EventArgs.Empty); + case UpdateActionTargets.NDK: + return _ndk.Load(reload, Dispatcher); + case UpdateActionTargets.Simulator: + return _simulator.Load(reload, Dispatcher); + case UpdateActionTargets.Runtime: + return _runtime.Load(reload, Dispatcher); + default: + throw new ArgumentOutOfRangeException("target"); } } @@ -146,40 +446,72 @@ private void NdkLoadRunnerOnFinished(object sender, ToolRunnerEventArgs e) public void Dispose() { - Dispose(true); GC.SuppressFinalize(this); + Dispose(true); } private void Dispose(bool disposing) { - if (_ndkLoadRunner != null) + if (disposing) { - _ndkLoadRunner.Dispose(); - _ndkLoadRunner = null; + _ndk.Dispose(); + _simulator.Dispose(); + _runtime.Dispose(); } } #endregion - public bool CheckIfNdkInstalled(ApiInfo info) + public bool CheckIfInstalled(ApiInfo info, UpdateActionTargets target) { - return info != null && PackageViewModel.Instance.IndexOfInstalled(info.Version) >= 0; + switch (target) + { + case UpdateActionTargets.NDK: + return _ndk.IsInstalled(info); + case UpdateActionTargets.Simulator: + return _simulator.IsInstalled(info); + case UpdateActionTargets.Runtime: + return _runtime.IsInstalled(info); + default: + throw new ArgumentOutOfRangeException("target"); + } + } + + public bool IsProcessing(ApiInfo info, UpdateActionTargets target) + { + switch (target) + { + case UpdateActionTargets.NDK: + return _ndk.IsProcessing(info); + case UpdateActionTargets.Simulator: + return _simulator.IsProcessing(info); + case UpdateActionTargets.Runtime: + return _runtime.IsProcessing(info); + default: + throw new ArgumentOutOfRangeException("target"); + } } - public bool IsProcessingNDK(ApiInfo info) + /// + /// Requests to download and install something. + /// + public void RequestInstall(ApiInfo info, UpdateActionTargets target) { - return info != null && PackageViewModel.Instance.UpdateManager.IsProcessingNDK(info.Version); + if (info == null) + throw new ArgumentNullException("info"); + + PackageViewModel.Instance.UpdateManager.Request(UpdateActions.Install, target, info.Version); } /// - /// Requests to download NDK. + /// Requests to uninstall and remove something. /// - public void RequestNdk(ApiInfo info) + public void RequestRemoval(ApiInfo info, UpdateActionTargets target) { if (info == null) throw new ArgumentNullException("info"); - PackageViewModel.Instance.UpdateManager.Request(UpdateActions.Install, UpdateActionTargets.NDK, info.Version); + PackageViewModel.Instance.UpdateManager.Request(UpdateActions.Uninstall, target, info.Version); } /// diff --git a/src_vs2012/VSNDK.Package/ViewModels/PackageViewModel.cs b/src_vs2012/VSNDK.Package/ViewModels/PackageViewModel.cs index b22d60bf..7df618d2 100644 --- a/src_vs2012/VSNDK.Package/ViewModels/PackageViewModel.cs +++ b/src_vs2012/VSNDK.Package/ViewModels/PackageViewModel.cs @@ -32,8 +32,11 @@ public static PackageViewModel Instance private DeveloperDefinition _developer; private NdkInfo[] _installedNDKs; + private SimulatorInfo[] _installedSimulators; + private RuntimeInfo[] _installedRuntimes; private ApiInfoArray[] _remoteNDKs; private ApiInfoArray[] _remoteSimulators; + private ApiInfoArray[] _remoteRuntimes; private NdkInfo _activeNDK; private DeviceDefinition[] _targetDevices; private DeviceDefinition _activeDevice; @@ -43,6 +46,7 @@ public PackageViewModel() { _remoteNDKs = new ApiInfoArray[0]; _remoteSimulators = new ApiInfoArray[0]; + _remoteRuntimes = new ApiInfoArray[0]; UpdateManager = new UpdateManager(this); } @@ -100,12 +104,61 @@ public NdkInfo[] InstalledNDKs public ApiInfoArray[] RemoteNDKs { get { return _remoteNDKs; } - set + set { _remoteNDKs = value ?? new ApiInfoArray[0]; } + } + + /// + /// Gets the list of installed simulators. + /// + public SimulatorInfo[] InstalledSimulators + { + get + { + if (_installedSimulators == null) + { + // load info about simulators from specified locations: + _installedSimulators = SimulatorInfo.Load(RunnerDefaults.NdkDirectory); + } + + return _installedSimulators; + } + } + + /// + /// Gets the cached list of simulators available on-line to install. + /// + public ApiInfoArray[] RemoteSimulators + { + get { return _remoteSimulators; } + set { _remoteSimulators = value ?? new ApiInfoArray[0]; } + } + + /// + /// Gets the list of installed runtimes. + /// + public RuntimeInfo[] InstalledRuntimes + { + get { - _remoteNDKs = value ?? new ApiInfoArray[0]; + if (_installedRuntimes == null) + { + // load info about runtimes from specified locations: + _installedRuntimes = RuntimeInfo.Load(RunnerDefaults.NdkDirectory); + } + + return _installedRuntimes; } } + /// + /// Gets the cached list of runtimes available on-line to install. + /// + public ApiInfoArray[] RemoteRuntimes + { + get { return _remoteRuntimes; } + set { _remoteRuntimes = value ?? new ApiInfoArray[0]; } + } + /// /// Loads info about currently used NDK from registry. /// @@ -273,9 +326,25 @@ public int IndexOfInstalled(NdkInfo info) /// /// Gets an index of installed NDK with identical version. /// - public int IndexOfInstalled(Version version) + public int IndexOfInstalledNDK(Version version) { - return NdkInfo.IndexOf(InstalledNDKs, version); + return ApiInfo.IndexOf(InstalledNDKs, version); + } + + /// + /// Gets an index of installed simulator with identical version. + /// + public int IndexOfInstalledSimulator(Version version) + { + return ApiInfo.IndexOf(InstalledSimulators, version); + } + + /// + /// Gets an index of installed runtime with identical version. + /// + public int IndexOfInstalledRuntime(Version version) + { + return ApiInfo.IndexOf(InstalledRuntimes, version); } /// @@ -325,6 +394,22 @@ public void ResetNDKs() _activeNDK = null; } + /// + /// Resets the cached list of simulators, allowing to reload them again. + /// + public void ResetSimulators() + { + _installedSimulators = null; + } + + /// + /// Resets the cached list of runtimes, allowing to reload them again. + /// + public void ResetRuntimes() + { + _installedRuntimes = null; + } + /// /// Removes custom reference to existing NDK, created by developer some time ago. /// diff --git a/src_vs2012/VSNDK.Package/ViewModels/UpdateManager.cs b/src_vs2012/VSNDK.Package/ViewModels/UpdateManager.cs index 3095bbac..e428d43a 100644 --- a/src_vs2012/VSNDK.Package/ViewModels/UpdateManager.cs +++ b/src_vs2012/VSNDK.Package/ViewModels/UpdateManager.cs @@ -81,14 +81,14 @@ private void Schedule(ActionData action) _actions.Add(action); } - public bool IsProcessingNDK(Version version) + public bool IsProcessing(Version version, UpdateActionTargets target) { if (version == null) return false; foreach (var action in _actions) { - if (action.Target == UpdateActionTargets.NDK && action.Version == version) + if (action.Target == target && action.Version == version) return true; } From 7c1442ad1fb90560443c2c57d2b429f8d88107dc Mon Sep 17 00:00:00 2001 From: Pawel Hofman Date: Mon, 9 Jun 2014 10:30:02 +0200 Subject: [PATCH 178/851] Moved option to add custom NDK to Installation Currently it was presented as separate button. But since this option is not supposed to be used often, it was moved to regular 'Installation UI' and hidden a bit as last item appeared. --- src_vs2012/VSNDK.Package/Model/ApiInfo.cs | 8 ++++ .../Options/ApiLevelOptionControl.Designer.cs | 16 +------- .../Options/ApiLevelOptionControl.cs | 24 ------------ .../Dialogs/AddLocalNdkForm.Designer.cs | 2 +- .../Options/Dialogs/InstallForm.cs | 28 ++++++++++++++ .../Options/Dialogs/ListItemControl.cs | 3 ++ .../Tools/ApiLevelListLoadRunner.cs | 3 ++ .../ViewModels/ApiLevelActionType.cs | 6 ++- .../ViewModels/ApiLevelOptionViewModel.cs | 37 +++++++++++++++++-- 9 files changed, 82 insertions(+), 45 deletions(-) diff --git a/src_vs2012/VSNDK.Package/Model/ApiInfo.cs b/src_vs2012/VSNDK.Package/Model/ApiInfo.cs index a8567af7..3dca38d9 100644 --- a/src_vs2012/VSNDK.Package/Model/ApiInfo.cs +++ b/src_vs2012/VSNDK.Package/Model/ApiInfo.cs @@ -108,6 +108,14 @@ public static ApiInfo CreateTabletInfo() return new ApiInfo("BlackBerry Native SDK for Tablet OS 2.1.0", new Version(2, 1, 0, 1032)); } + /// + /// Creates an instance of the API to allow custom NDK insertion. + /// + public static ApiInfo CreateAddCustomInfo() + { + return new ApiInfo("Add Custom NDK", new Version()); + } + /// /// Returns an index of NdkInfo inside a collection that has the same version. /// diff --git a/src_vs2012/VSNDK.Package/Options/ApiLevelOptionControl.Designer.cs b/src_vs2012/VSNDK.Package/Options/ApiLevelOptionControl.Designer.cs index c293a7ba..66340a6d 100644 --- a/src_vs2012/VSNDK.Package/Options/ApiLevelOptionControl.Designer.cs +++ b/src_vs2012/VSNDK.Package/Options/ApiLevelOptionControl.Designer.cs @@ -31,7 +31,6 @@ private void InitializeComponent() this.txtDescription = new System.Windows.Forms.TextBox(); this.cmbNDKs = new System.Windows.Forms.ComboBox(); this.label1 = new System.Windows.Forms.Label(); - this.bttAddLocal = new System.Windows.Forms.Button(); this.bttInstallNew = new System.Windows.Forms.Button(); this.label2 = new System.Windows.Forms.Label(); this.bttStatus = new System.Windows.Forms.Button(); @@ -72,21 +71,10 @@ private void InitializeComponent() this.label1.TabIndex = 1; this.label1.Text = "Current API Level:"; // - // bttAddLocal - // - this.bttAddLocal.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this.bttAddLocal.Location = new System.Drawing.Point(459, 284); - this.bttAddLocal.Name = "bttAddLocal"; - this.bttAddLocal.Size = new System.Drawing.Size(75, 23); - this.bttAddLocal.TabIndex = 6; - this.bttAddLocal.Text = "&Add..."; - this.bttAddLocal.UseVisualStyleBackColor = true; - this.bttAddLocal.Click += new System.EventHandler(this.bttAddLocal_Click); - // // bttInstallNew // this.bttInstallNew.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this.bttInstallNew.Location = new System.Drawing.Point(378, 284); + this.bttInstallNew.Location = new System.Drawing.Point(459, 284); this.bttInstallNew.Name = "bttInstallNew"; this.bttInstallNew.Size = new System.Drawing.Size(75, 23); this.bttInstallNew.TabIndex = 5; @@ -123,7 +111,6 @@ private void InitializeComponent() this.Controls.Add(this.txtDescription); this.Controls.Add(this.cmbNDKs); this.Controls.Add(this.label1); - this.Controls.Add(this.bttAddLocal); this.Controls.Add(this.bttInstallNew); this.Name = "ApiLevelOptionControl"; this.Size = new System.Drawing.Size(537, 310); @@ -137,7 +124,6 @@ private void InitializeComponent() private System.Windows.Forms.TextBox txtDescription; private System.Windows.Forms.ComboBox cmbNDKs; private System.Windows.Forms.Label label1; - private System.Windows.Forms.Button bttAddLocal; private System.Windows.Forms.Button bttInstallNew; private System.Windows.Forms.Label label2; private System.Windows.Forms.Button bttStatus; diff --git a/src_vs2012/VSNDK.Package/Options/ApiLevelOptionControl.cs b/src_vs2012/VSNDK.Package/Options/ApiLevelOptionControl.cs index 1d59fbac..949948ab 100644 --- a/src_vs2012/VSNDK.Package/Options/ApiLevelOptionControl.cs +++ b/src_vs2012/VSNDK.Package/Options/ApiLevelOptionControl.cs @@ -67,30 +67,6 @@ public void OnClosed() PopulateNDKs(true); } - private void bttAddLocal_Click(object sender, EventArgs e) - { - var form = new AddLocalNdkForm(); - - if (form.ShowDialog() == DialogResult.OK) - { - var ndk = form.NewNdk; - if (ndk != null) - { - // save inside 'installation config' directory: - if (ndk.Save(RunnerDefaults.PluginInstallationConfigDirectory)) - { - // reload NDKs - _vm.ReloadAndActivate(ndk); - PopulateNDKs(true); - } - else - { - MessageBoxHelper.Show("Unable to save NDK information", "API Level Updater", MessageBoxButtons.OK, MessageBoxIcon.Error); - } - } - } - } - private void bttInstallNew_Click(object sender, EventArgs e) { var form = new InstallForm(_vm); diff --git a/src_vs2012/VSNDK.Package/Options/Dialogs/AddLocalNdkForm.Designer.cs b/src_vs2012/VSNDK.Package/Options/Dialogs/AddLocalNdkForm.Designer.cs index 205bc84f..0320458f 100644 --- a/src_vs2012/VSNDK.Package/Options/Dialogs/AddLocalNdkForm.Designer.cs +++ b/src_vs2012/VSNDK.Package/Options/Dialogs/AddLocalNdkForm.Designer.cs @@ -203,7 +203,7 @@ private void InitializeComponent() this.ShowIcon = false; this.ShowInTaskbar = false; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; - this.Text = "New NDK"; + this.Text = "New Custom NDK"; this.groupBox1.ResumeLayout(false); this.groupBox1.PerformLayout(); this.ResumeLayout(false); diff --git a/src_vs2012/VSNDK.Package/Options/Dialogs/InstallForm.cs b/src_vs2012/VSNDK.Package/Options/Dialogs/InstallForm.cs index 125fb390..4acf7592 100644 --- a/src_vs2012/VSNDK.Package/Options/Dialogs/InstallForm.cs +++ b/src_vs2012/VSNDK.Package/Options/Dialogs/InstallForm.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.Windows.Forms; using RIM.VSNDK_Package.Model; +using RIM.VSNDK_Package.Tools; using RIM.VSNDK_Package.ViewModels; namespace RIM.VSNDK_Package.Options.Dialogs @@ -186,6 +187,9 @@ private void ItemOnExecuteAction(object sender, EventArgs eventArgs) case ApiLevelActionType.InstallManually: DialogHelper.StartURL((string)argument); break; + case ApiLevelActionType.AddExisting: + AddExistingNDK(); + break; case ApiLevelActionType.Forget: if (MessageBoxHelper.Show(definition.ToString(), "Remove own reference to existing NDK?", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { @@ -213,5 +217,29 @@ private void ItemOnExecuteAction(object sender, EventArgs eventArgs) break; } } + + private void AddExistingNDK() + { + var form = new AddLocalNdkForm(); + + if (form.ShowDialog() == DialogResult.OK) + { + var ndk = form.NewNdk; + if (ndk != null) + { + // save inside 'installation config' directory: + if (ndk.Save(RunnerDefaults.PluginInstallationConfigDirectory)) + { + // reload NDKs + _vm.Reset(UpdateActionTargets.NDK); + UpdateUI(); + } + else + { + MessageBoxHelper.Show("Unable to save NDK information", "Update Manager", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + } + } } } diff --git a/src_vs2012/VSNDK.Package/Options/Dialogs/ListItemControl.cs b/src_vs2012/VSNDK.Package/Options/Dialogs/ListItemControl.cs index 2070e118..3697d526 100644 --- a/src_vs2012/VSNDK.Package/Options/Dialogs/ListItemControl.cs +++ b/src_vs2012/VSNDK.Package/Options/Dialogs/ListItemControl.cs @@ -84,6 +84,9 @@ private void OnActionChanged() case ApiLevelActionType.InstallManually: ActionName = "Download..."; break; + case ApiLevelActionType.AddExisting: + ActionName = "Add..."; + break; case ApiLevelActionType.Uninstall: ActionName = "Uninstall"; break; diff --git a/src_vs2012/VSNDK.Package/Tools/ApiLevelListLoadRunner.cs b/src_vs2012/VSNDK.Package/Tools/ApiLevelListLoadRunner.cs index 25ce0a82..edc14377 100644 --- a/src_vs2012/VSNDK.Package/Tools/ApiLevelListLoadRunner.cs +++ b/src_vs2012/VSNDK.Package/Tools/ApiLevelListLoadRunner.cs @@ -162,6 +162,9 @@ private static ApiInfoArray[] GroupList(ApiInfo[] list, bool injectPlayBook) { // inject info about tablet NDK: Add(groups, ApiInfo.CreateTabletInfo()); + + // inject info about 'custom NDK': + Add(groups, ApiInfo.CreateAddCustomInfo()); } // group BlackBerry 10 items together: diff --git a/src_vs2012/VSNDK.Package/ViewModels/ApiLevelActionType.cs b/src_vs2012/VSNDK.Package/ViewModels/ApiLevelActionType.cs index 4d86dafe..4d05f0a5 100644 --- a/src_vs2012/VSNDK.Package/ViewModels/ApiLevelActionType.cs +++ b/src_vs2012/VSNDK.Package/ViewModels/ApiLevelActionType.cs @@ -14,10 +14,14 @@ internal enum ApiLevelActionType /// Install, /// - /// Installation of the API Level must be done manually (specified URL should be opened in a browser). + /// Installation of the API Level must be done manually (specified URL should be opened in a browser). /// InstallManually, /// + /// Installation of the API Level was already done, but not detected automatically. + /// + AddExisting, + /// /// Installed API Level, owned by the plugin, can be removed. /// Uninstall, diff --git a/src_vs2012/VSNDK.Package/ViewModels/ApiLevelOptionViewModel.cs b/src_vs2012/VSNDK.Package/ViewModels/ApiLevelOptionViewModel.cs index f98c4e09..4d99d94e 100644 --- a/src_vs2012/VSNDK.Package/ViewModels/ApiLevelOptionViewModel.cs +++ b/src_vs2012/VSNDK.Package/ViewModels/ApiLevelOptionViewModel.cs @@ -86,6 +86,8 @@ public ApiLevelActionType GetAction(ApiInfo info) public abstract bool IsProcessing(ApiInfo info); + public abstract void Reset(); + #region IDisposable Implementation public void Dispose() @@ -162,6 +164,13 @@ public override ApiLevelActionType GetAction(ApiInfo info, out object argument) } } + // is it an option to manually add NDK? + if (info.Version.Major == 0 && info.Version.Minor == 0) + { + argument = RunnerDefaults.NdkDirectory; + return ApiLevelActionType.AddExisting; + } + // is it a PlayBook NDK? if (info.Version <= LastPlayBookVersion) { @@ -203,10 +212,9 @@ private bool AreItemsInstalled(ApiInfoArray definition) return true; } - public void ReloadAndActivate(NdkInfo ndk) + public override void Reset() { PackageViewModel.Instance.ResetNDKs(); - Active = ndk; } } @@ -258,6 +266,11 @@ public override bool IsProcessing(ApiInfo info) { return info != null && PackageViewModel.Instance.UpdateManager.IsProcessing(info.Version, UpdateActionTargets.Simulator); } + + public override void Reset() + { + PackageViewModel.Instance.ResetSimulators(); + } } private sealed class RuntimeLoaderViewModel : LoaderViewModel @@ -308,6 +321,11 @@ public override bool IsProcessing(ApiInfo info) { return info != null && PackageViewModel.Instance.UpdateManager.IsProcessing(info.Version, UpdateActionTargets.Runtime); } + + public override void Reset() + { + PackageViewModel.Instance.ResetRuntimes(); + } } #endregion @@ -388,9 +406,20 @@ public IEventDispatcher Dispatcher set; } - public void ReloadAndActivate(NdkInfo ndk) + public void Reset(UpdateActionTargets target) { - _ndk.ReloadAndActivate(ndk); + switch (target) + { + case UpdateActionTargets.NDK: + _ndk.Reset(); + break; + case UpdateActionTargets.Simulator: + _simulator.Reset(); + break; + case UpdateActionTargets.Runtime: + _runtime.Reset(); + break; + } } public ApiLevelActionType GetAction(ApiInfo info, UpdateActionTargets target) From 041afdcd5fb869911d4b29e8711e2f890d042503 Mon Sep 17 00:00:00 2001 From: Pawel Hofman Date: Mon, 9 Jun 2014 11:39:20 +0200 Subject: [PATCH 179/851] Renamed API-Level enums to better reflect purpose --- .../ViewModels/{UpdateActions.cs => ApiLevelAction.cs} | 0 .../ViewModels/{UpdateActionTargets.cs => ApiLevelTarget.cs} | 0 .../ViewModels/{ApiLevelActionType.cs => ApiLevelTask.cs} | 0 3 files changed, 0 insertions(+), 0 deletions(-) rename src_vs2012/VSNDK.Package/ViewModels/{UpdateActions.cs => ApiLevelAction.cs} (100%) rename src_vs2012/VSNDK.Package/ViewModels/{UpdateActionTargets.cs => ApiLevelTarget.cs} (100%) rename src_vs2012/VSNDK.Package/ViewModels/{ApiLevelActionType.cs => ApiLevelTask.cs} (100%) diff --git a/src_vs2012/VSNDK.Package/ViewModels/UpdateActions.cs b/src_vs2012/VSNDK.Package/ViewModels/ApiLevelAction.cs similarity index 100% rename from src_vs2012/VSNDK.Package/ViewModels/UpdateActions.cs rename to src_vs2012/VSNDK.Package/ViewModels/ApiLevelAction.cs diff --git a/src_vs2012/VSNDK.Package/ViewModels/UpdateActionTargets.cs b/src_vs2012/VSNDK.Package/ViewModels/ApiLevelTarget.cs similarity index 100% rename from src_vs2012/VSNDK.Package/ViewModels/UpdateActionTargets.cs rename to src_vs2012/VSNDK.Package/ViewModels/ApiLevelTarget.cs diff --git a/src_vs2012/VSNDK.Package/ViewModels/ApiLevelActionType.cs b/src_vs2012/VSNDK.Package/ViewModels/ApiLevelTask.cs similarity index 100% rename from src_vs2012/VSNDK.Package/ViewModels/ApiLevelActionType.cs rename to src_vs2012/VSNDK.Package/ViewModels/ApiLevelTask.cs From 3d5131e611a50a7ba8378c6cf36ec0e81073217f Mon Sep 17 00:00:00 2001 From: Pawel Hofman Date: Mon, 9 Jun 2014 11:42:31 +0200 Subject: [PATCH 180/851] Started implementation of UpdateManager + UI --- .../Options/ApiLevelOptionControl.cs | 2 +- .../UpdateManagerStatusForm.Designer.cs | 116 ++++++++------- .../Dialogs/UpdateManagerStatusForm.cs | 40 ++++- src_vs2012/VSNDK.Package/VSNDK.Package.csproj | 6 +- .../ViewModels/ApiLevelOptionViewModel.cs | 15 +- .../ViewModels/PackageViewModel.cs | 2 +- .../VSNDK.Package/ViewModels/UpdateManager.cs | 140 ++++++++++++++++-- 7 files changed, 242 insertions(+), 79 deletions(-) diff --git a/src_vs2012/VSNDK.Package/Options/ApiLevelOptionControl.cs b/src_vs2012/VSNDK.Package/Options/ApiLevelOptionControl.cs index 949948ab..41d5b468 100644 --- a/src_vs2012/VSNDK.Package/Options/ApiLevelOptionControl.cs +++ b/src_vs2012/VSNDK.Package/Options/ApiLevelOptionControl.cs @@ -76,7 +76,7 @@ private void bttInstallNew_Click(object sender, EventArgs e) private void bttStatus_Click(object sender, EventArgs e) { - var form = new UpdateManagerStatusForm(); + var form = new UpdateManagerStatusForm(_vm); form.ShowDialog(); } } diff --git a/src_vs2012/VSNDK.Package/Options/Dialogs/UpdateManagerStatusForm.Designer.cs b/src_vs2012/VSNDK.Package/Options/Dialogs/UpdateManagerStatusForm.Designer.cs index 45f69400..7654b3c8 100644 --- a/src_vs2012/VSNDK.Package/Options/Dialogs/UpdateManagerStatusForm.Designer.cs +++ b/src_vs2012/VSNDK.Package/Options/Dialogs/UpdateManagerStatusForm.Designer.cs @@ -30,13 +30,13 @@ private void InitializeComponent() { this.bttClose = new System.Windows.Forms.Button(); this.groupBox1 = new System.Windows.Forms.GroupBox(); - this.label1 = new System.Windows.Forms.Label(); - this.label2 = new System.Windows.Forms.Label(); - this.progressBar1 = new System.Windows.Forms.ProgressBar(); - this.groupBox2 = new System.Windows.Forms.GroupBox(); this.bttAbort = new System.Windows.Forms.Button(); - this.listBox1 = new System.Windows.Forms.ListBox(); + this.progressBar = new System.Windows.Forms.ProgressBar(); + this.lblActionLog2 = new System.Windows.Forms.Label(); + this.lblActionLog1 = new System.Windows.Forms.Label(); + this.groupBox2 = new System.Windows.Forms.GroupBox(); this.bttDelete = new System.Windows.Forms.Button(); + this.listActions = new System.Windows.Forms.ListBox(); this.groupBox1.SuspendLayout(); this.groupBox2.SuspendLayout(); this.SuspendLayout(); @@ -57,9 +57,9 @@ private void InitializeComponent() this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.groupBox1.Controls.Add(this.bttAbort); - this.groupBox1.Controls.Add(this.progressBar1); - this.groupBox1.Controls.Add(this.label2); - this.groupBox1.Controls.Add(this.label1); + this.groupBox1.Controls.Add(this.progressBar); + this.groupBox1.Controls.Add(this.lblActionLog2); + this.groupBox1.Controls.Add(this.lblActionLog1); this.groupBox1.Location = new System.Drawing.Point(12, 12); this.groupBox1.Name = "groupBox1"; this.groupBox1.Size = new System.Drawing.Size(567, 122); @@ -67,32 +67,47 @@ private void InitializeComponent() this.groupBox1.TabStop = false; this.groupBox1.Text = "Current"; // - // label1 + // bttAbort + // + this.bttAbort.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.bttAbort.Enabled = false; + this.bttAbort.Location = new System.Drawing.Point(486, 78); + this.bttAbort.Name = "bttAbort"; + this.bttAbort.Size = new System.Drawing.Size(75, 23); + this.bttAbort.TabIndex = 3; + this.bttAbort.Text = "&Abort"; + this.bttAbort.UseVisualStyleBackColor = true; + // + // progressBar // - this.label1.AutoSize = true; - this.label1.Location = new System.Drawing.Point(9, 25); - this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(35, 13); - this.label1.TabIndex = 0; - this.label1.Text = "label1"; + this.progressBar.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.progressBar.Location = new System.Drawing.Point(12, 78); + this.progressBar.Name = "progressBar"; + this.progressBar.Size = new System.Drawing.Size(468, 23); + this.progressBar.TabIndex = 2; // - // label2 + // lblActionLog2 // - this.label2.AutoSize = true; - this.label2.Location = new System.Drawing.Point(9, 49); - this.label2.Name = "label2"; - this.label2.Size = new System.Drawing.Size(35, 13); - this.label2.TabIndex = 1; - this.label2.Text = "label2"; + this.lblActionLog2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.lblActionLog2.AutoEllipsis = true; + this.lblActionLog2.Location = new System.Drawing.Point(9, 49); + this.lblActionLog2.Name = "lblActionLog2"; + this.lblActionLog2.Size = new System.Drawing.Size(552, 13); + this.lblActionLog2.TabIndex = 1; + this.lblActionLog2.Text = "-"; // - // progressBar1 + // lblActionLog1 // - this.progressBar1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + this.lblActionLog1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); - this.progressBar1.Location = new System.Drawing.Point(12, 78); - this.progressBar1.Name = "progressBar1"; - this.progressBar1.Size = new System.Drawing.Size(468, 23); - this.progressBar1.TabIndex = 2; + this.lblActionLog1.AutoEllipsis = true; + this.lblActionLog1.Location = new System.Drawing.Point(9, 25); + this.lblActionLog1.Name = "lblActionLog1"; + this.lblActionLog1.Size = new System.Drawing.Size(552, 13); + this.lblActionLog1.TabIndex = 0; + this.lblActionLog1.Text = "-"; // // groupBox2 // @@ -100,7 +115,7 @@ private void InitializeComponent() | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.groupBox2.Controls.Add(this.bttDelete); - this.groupBox2.Controls.Add(this.listBox1); + this.groupBox2.Controls.Add(this.listActions); this.groupBox2.Location = new System.Drawing.Point(12, 140); this.groupBox2.Name = "groupBox2"; this.groupBox2.Size = new System.Drawing.Size(567, 170); @@ -108,30 +123,10 @@ private void InitializeComponent() this.groupBox2.TabStop = false; this.groupBox2.Text = "Pending"; // - // bttAbort - // - this.bttAbort.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this.bttAbort.Location = new System.Drawing.Point(486, 78); - this.bttAbort.Name = "bttAbort"; - this.bttAbort.Size = new System.Drawing.Size(75, 23); - this.bttAbort.TabIndex = 3; - this.bttAbort.Text = "&Abort"; - this.bttAbort.UseVisualStyleBackColor = true; - // - // listBox1 - // - this.listBox1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.listBox1.FormattingEnabled = true; - this.listBox1.Location = new System.Drawing.Point(12, 25); - this.listBox1.Name = "listBox1"; - this.listBox1.Size = new System.Drawing.Size(468, 134); - this.listBox1.TabIndex = 0; - // // bttDelete // this.bttDelete.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.bttDelete.Enabled = false; this.bttDelete.Location = new System.Drawing.Point(486, 25); this.bttDelete.Name = "bttDelete"; this.bttDelete.Size = new System.Drawing.Size(75, 23); @@ -139,6 +134,18 @@ private void InitializeComponent() this.bttDelete.Text = "&Delete"; this.bttDelete.UseVisualStyleBackColor = true; // + // listActions + // + this.listActions.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.listActions.FormattingEnabled = true; + this.listActions.Location = new System.Drawing.Point(12, 25); + this.listActions.Name = "listActions"; + this.listActions.Size = new System.Drawing.Size(468, 134); + this.listActions.TabIndex = 0; + this.listActions.SelectedIndexChanged += new System.EventHandler(this.listActions_SelectedIndexChanged); + // // UpdateManagerStatusForm // this.AcceptButton = this.bttClose; @@ -157,7 +164,6 @@ private void InitializeComponent() this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; this.Text = "Installation Status"; this.groupBox1.ResumeLayout(false); - this.groupBox1.PerformLayout(); this.groupBox2.ResumeLayout(false); this.ResumeLayout(false); @@ -168,11 +174,11 @@ private void InitializeComponent() private System.Windows.Forms.Button bttClose; private System.Windows.Forms.GroupBox groupBox1; private System.Windows.Forms.Button bttAbort; - private System.Windows.Forms.ProgressBar progressBar1; - private System.Windows.Forms.Label label2; - private System.Windows.Forms.Label label1; + private System.Windows.Forms.ProgressBar progressBar; + private System.Windows.Forms.Label lblActionLog2; + private System.Windows.Forms.Label lblActionLog1; private System.Windows.Forms.GroupBox groupBox2; - private System.Windows.Forms.ListBox listBox1; + private System.Windows.Forms.ListBox listActions; private System.Windows.Forms.Button bttDelete; } } \ No newline at end of file diff --git a/src_vs2012/VSNDK.Package/Options/Dialogs/UpdateManagerStatusForm.cs b/src_vs2012/VSNDK.Package/Options/Dialogs/UpdateManagerStatusForm.cs index 65afe149..d410290f 100644 --- a/src_vs2012/VSNDK.Package/Options/Dialogs/UpdateManagerStatusForm.cs +++ b/src_vs2012/VSNDK.Package/Options/Dialogs/UpdateManagerStatusForm.cs @@ -1,12 +1,48 @@ -using System.Windows.Forms; +using System; +using System.Windows.Forms; +using RIM.VSNDK_Package.ViewModels; namespace RIM.VSNDK_Package.Options.Dialogs { internal partial class UpdateManagerStatusForm : Form { - public UpdateManagerStatusForm() + private readonly ApiLevelOptionViewModel _vm; + + public UpdateManagerStatusForm(ApiLevelOptionViewModel vm) { + if (vm == null) + throw new ArgumentNullException("vm"); + _vm = vm; + InitializeComponent(); + + ///_vm.UpdateManager.Log + + UpdateUI(); + } + + private void UpdateUI() + { + listActions.Items.Clear(); + foreach (var item in _vm.UpdateManager.Actions) + { + listActions.Items.Add(item); + } + + UpdateLog(_vm.UpdateManager.CurrentAction); + } + + private void UpdateLog(ViewModels.UpdateManager.ActionData action) + { + lblActionLog1.Text = action != null ? string.Concat("Processing ", action.Name, "...") : "Nothing is currently executing"; + lblActionLog2.Text = "-"; + progressBar.Value = 0; + bttAbort.Enabled = action != null && action.CanAbort; + } + + private void listActions_SelectedIndexChanged(object sender, EventArgs e) + { + bttDelete.Enabled = listActions.SelectedIndex >= 0; } } } diff --git a/src_vs2012/VSNDK.Package/VSNDK.Package.csproj b/src_vs2012/VSNDK.Package/VSNDK.Package.csproj index 0c9b10dc..6ec6cb5e 100644 --- a/src_vs2012/VSNDK.Package/VSNDK.Package.csproj +++ b/src_vs2012/VSNDK.Package/VSNDK.Package.csproj @@ -407,8 +407,10 @@ - + + + @@ -425,8 +427,6 @@ - - Templates\VCWizards\BlackBerry\BarDescriptor\Templates\1033\bar-descriptor.cs diff --git a/src_vs2012/VSNDK.Package/ViewModels/ApiLevelOptionViewModel.cs b/src_vs2012/VSNDK.Package/ViewModels/ApiLevelOptionViewModel.cs index 4d99d94e..e9aee436 100644 --- a/src_vs2012/VSNDK.Package/ViewModels/ApiLevelOptionViewModel.cs +++ b/src_vs2012/VSNDK.Package/ViewModels/ApiLevelOptionViewModel.cs @@ -192,7 +192,7 @@ public override bool IsInstalled(ApiInfo info) public override bool IsProcessing(ApiInfo info) { - return info != null && PackageViewModel.Instance.UpdateManager.IsProcessing(info.Version, UpdateActionTargets.NDK); + return info != null && PackageViewModel.Instance.UpdateManager.IsProcessing(UpdateActionTargets.NDK, info.Version); } /// @@ -264,7 +264,7 @@ public override bool IsInstalled(ApiInfo info) public override bool IsProcessing(ApiInfo info) { - return info != null && PackageViewModel.Instance.UpdateManager.IsProcessing(info.Version, UpdateActionTargets.Simulator); + return info != null && PackageViewModel.Instance.UpdateManager.IsProcessing(UpdateActionTargets.Simulator, info.Version); } public override void Reset() @@ -319,7 +319,7 @@ public override bool IsInstalled(ApiInfo info) public override bool IsProcessing(ApiInfo info) { - return info != null && PackageViewModel.Instance.UpdateManager.IsProcessing(info.Version, UpdateActionTargets.Runtime); + return info != null && PackageViewModel.Instance.UpdateManager.IsProcessing(UpdateActionTargets.Runtime, info.Version); } public override void Reset() @@ -406,6 +406,11 @@ public IEventDispatcher Dispatcher set; } + public UpdateManager UpdateManager + { + get { return PackageViewModel.Instance.UpdateManager; } + } + public void Reset(UpdateActionTargets target) { switch (target) @@ -529,7 +534,7 @@ public void RequestInstall(ApiInfo info, UpdateActionTargets target) if (info == null) throw new ArgumentNullException("info"); - PackageViewModel.Instance.UpdateManager.Request(UpdateActions.Install, target, info.Version); + PackageViewModel.Instance.UpdateManager.Request(UpdateActions.Install, target, info.Name, info.Version); } /// @@ -540,7 +545,7 @@ public void RequestRemoval(ApiInfo info, UpdateActionTargets target) if (info == null) throw new ArgumentNullException("info"); - PackageViewModel.Instance.UpdateManager.Request(UpdateActions.Uninstall, target, info.Version); + PackageViewModel.Instance.UpdateManager.Request(UpdateActions.Uninstall, target, info.Name, info.Version); } /// diff --git a/src_vs2012/VSNDK.Package/ViewModels/PackageViewModel.cs b/src_vs2012/VSNDK.Package/ViewModels/PackageViewModel.cs index 7df618d2..abe157c7 100644 --- a/src_vs2012/VSNDK.Package/ViewModels/PackageViewModel.cs +++ b/src_vs2012/VSNDK.Package/ViewModels/PackageViewModel.cs @@ -47,7 +47,7 @@ public PackageViewModel() _remoteNDKs = new ApiInfoArray[0]; _remoteSimulators = new ApiInfoArray[0]; _remoteRuntimes = new ApiInfoArray[0]; - UpdateManager = new UpdateManager(this); + UpdateManager = new UpdateManager(this, RunnerDefaults.NdkDirectory); } #region Properties diff --git a/src_vs2012/VSNDK.Package/ViewModels/UpdateManager.cs b/src_vs2012/VSNDK.Package/ViewModels/UpdateManager.cs index e428d43a..b9b2bb22 100644 --- a/src_vs2012/VSNDK.Package/ViewModels/UpdateManager.cs +++ b/src_vs2012/VSNDK.Package/ViewModels/UpdateManager.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.IO; using RIM.VSNDK_Package.Diagnostics; namespace RIM.VSNDK_Package.ViewModels @@ -8,20 +9,40 @@ internal sealed class UpdateManager { #region Internal Classes - class ActionData + /// + /// Description of actions scheduled to execution by UpdateManager. + /// + public sealed class ActionData { #region Properties - public ActionData(UpdateActions action, UpdateActionTargets target, Version version) + internal ActionData(UpdateManager manager, UpdateActions action, UpdateActionTargets target, string name, Version version) { + if (manager == null) + throw new ArgumentNullException("manager"); + if (string.IsNullOrEmpty(name)) + throw new ArgumentNullException("name"); if (version == null) throw new ArgumentNullException("version"); + UpdateManager = manager; Action = action; Target = target; + Name = name; Version = version; } + private UpdateManager UpdateManager + { + get; + set; + } + + public bool CanAbort + { + get { return true; } + } + public UpdateActions Action { get; @@ -34,6 +55,12 @@ public UpdateActionTargets Target private set; } + public string Name + { + get; + private set; + } + public Version Version { get; @@ -46,28 +73,80 @@ public override string ToString() { return string.Concat(Action, "-Action of ", Target, "-", Version); } + + internal void Abort() + { + + } } #endregion - private PackageViewModel _vm; - private List _actions; + private readonly PackageViewModel _vm; + private readonly List _actions; - public UpdateManager(PackageViewModel vm) + public UpdateManager(PackageViewModel vm, string folder) { if (vm == null) throw new ArgumentNullException("vm"); + if (string.IsNullOrEmpty(folder)) + throw new ArgumentNullException("folder"); _vm = vm; + Folder = folder; + SyncFilePath = Path.Combine(Folder, "vsplugin.pid"); _actions = new List(); + Actions = new ActionData[0]; + } + + #region Properties + + /// + /// Gets the currently running action. + /// + public ActionData CurrentAction + { + get; + private set; + } + + /// + /// Thread-safe read-only collection of performed actions. + /// + public ActionData[] Actions + { + get; + private set; } - public void Request(UpdateActions action, UpdateActionTargets target, Version version) + /// + /// Gets the playground folder for sync between different instances of Visual Studio. + /// + private string Folder { + get; + set; + } + + private string SyncFilePath + { + get; + set; + } + + #endregion + + /// + /// Requests installation or removal over specified item and version. + /// + public void Request(UpdateActions action, UpdateActionTargets target, string name, Version version) + { + if (string.IsNullOrEmpty(name)) + throw new ArgumentNullException("name"); if (version == null) throw new ArgumentNullException("version"); - Schedule(new ActionData(action, target, version)); + Schedule(new ActionData(this, action, target, name, version)); } private void Schedule(ActionData action) @@ -75,18 +154,49 @@ private void Schedule(ActionData action) if (action == null) throw new ArgumentNullException("action"); - TraceLog.WriteLine("Scheduled: {0}", action); + lock (GetType()) + { + TraceLog.WriteLine("Scheduled: {0}", action); + + // add action to execution: + _actions.Add(action); + Actions = _actions.ToArray(); + } - // PH: TODO: - _actions.Add(action); + // and try to start it: + Start(); } - public bool IsProcessing(Version version, UpdateActionTargets target) + private void Remove(ActionData action) + { + if (action == null) + throw new ArgumentNullException("action"); + + lock (GetType()) + { + TraceLog.WarnLine("Removed: {0}", action); + + // remove from execution: + if (action.CanAbort) + { + action.Abort(); + if (_actions.Remove(action)) + { + Actions = _actions.ToArray(); + } + } + } + } + + /// + /// Checks, if there exists scheduled action for specified item. + /// + public bool IsProcessing(UpdateActionTargets target, Version version) { if (version == null) return false; - foreach (var action in _actions) + foreach (var action in Actions) { if (action.Target == target && action.Version == version) return true; @@ -94,5 +204,11 @@ public bool IsProcessing(Version version, UpdateActionTargets target) return false; } + + private void Start() + { + + + } } } From 141756266516bbd64267c9855669e2ffe243e222 Mon Sep 17 00:00:00 2001 From: Pawel Hofman Date: Mon, 9 Jun 2014 11:48:32 +0200 Subject: [PATCH 181/851] Renamed types after recent file name changes --- .../Dialogs/InstallConfirmationForm.cs | 2 +- .../Options/Dialogs/InstallForm.cs | 46 +++---- .../Options/Dialogs/ListItemControl.cs | 24 ++-- .../ViewModels/ApiLevelAction.cs | 4 +- .../ViewModels/ApiLevelOptionViewModel.cs | 112 +++++++++--------- .../ViewModels/ApiLevelTarget.cs | 2 +- .../VSNDK.Package/ViewModels/ApiLevelTask.cs | 2 +- .../VSNDK.Package/ViewModels/UpdateManager.cs | 10 +- 8 files changed, 101 insertions(+), 101 deletions(-) diff --git a/src_vs2012/VSNDK.Package/Options/Dialogs/InstallConfirmationForm.cs b/src_vs2012/VSNDK.Package/Options/Dialogs/InstallConfirmationForm.cs index a738c347..6f59af06 100644 --- a/src_vs2012/VSNDK.Package/Options/Dialogs/InstallConfirmationForm.cs +++ b/src_vs2012/VSNDK.Package/Options/Dialogs/InstallConfirmationForm.cs @@ -11,7 +11,7 @@ namespace RIM.VSNDK_Package.Options.Dialogs /// internal partial class InstallConfirmationForm : Form { - public InstallConfirmationForm(string nameOverride, IEnumerable items, UpdateActionTargets target, Func installationCheckHandler, Func processingCheckHandler) + public InstallConfirmationForm(string nameOverride, IEnumerable items, ApiLevelTarget target, Func installationCheckHandler, Func processingCheckHandler) { if (items == null) throw new ArgumentNullException("items"); diff --git a/src_vs2012/VSNDK.Package/Options/Dialogs/InstallForm.cs b/src_vs2012/VSNDK.Package/Options/Dialogs/InstallForm.cs index 4acf7592..7b7f5161 100644 --- a/src_vs2012/VSNDK.Package/Options/Dialogs/InstallForm.cs +++ b/src_vs2012/VSNDK.Package/Options/Dialogs/InstallForm.cs @@ -62,20 +62,20 @@ public int ActiveTab private void UpdateUI() { - PopulateList(panelInstalledNDKs, _vm.InstalledNDKs, UpdateActionTargets.NDK, (info, target) => _vm.GetAction(info, target), "No installed Native SDK found", ApiLevelActionType.Hide); - PopulateList(panelInstalledSimulators, _vm.InstalledSimulators, UpdateActionTargets.Simulator, (info, target) => _vm.GetAction(info, target), "No installed simulators found", ApiLevelActionType.Hide); - PopulateList(panelInstalledRuntimes, _vm.InstalledRuntimes, UpdateActionTargets.Runtime, (info, target) => _vm.GetAction(info, target), "No installed runtimes found", ApiLevelActionType.Hide); + PopulateList(panelInstalledNDKs, _vm.InstalledNDKs, ApiLevelTarget.NDK, (info, target) => _vm.GetTask(info, target), "No installed Native SDK found", ApiLevelTask.Hide); + PopulateList(panelInstalledSimulators, _vm.InstalledSimulators, ApiLevelTarget.Simulator, (info, target) => _vm.GetTask(info, target), "No installed simulators found", ApiLevelTask.Hide); + PopulateList(panelInstalledRuntimes, _vm.InstalledRuntimes, ApiLevelTarget.Runtime, (info, target) => _vm.GetTask(info, target), "No installed runtimes found", ApiLevelTask.Hide); - LoadList(panelAvailableNDKs, UpdateActionTargets.NDK, false); - LoadList(panelAvailableSimulators, UpdateActionTargets.Simulator, false); - LoadList(panelAvailableRuntimes, UpdateActionTargets.Runtime, false); + LoadList(panelAvailableNDKs, ApiLevelTarget.NDK, false); + LoadList(panelAvailableSimulators, ApiLevelTarget.Simulator, false); + LoadList(panelAvailableRuntimes, ApiLevelTarget.Runtime, false); } - private void LoadList(Panel panel, UpdateActionTargets target, bool refresh) + private void LoadList(Panel panel, ApiLevelTarget target, bool refresh) { if (_vm.Load(target, refresh)) { - PopulateList(panel, null, target, null, "Loading...", ApiLevelActionType.Hide); + PopulateList(panel, null, target, null, "Loading...", ApiLevelTask.Hide); } } @@ -92,7 +92,7 @@ private void NdkListLoaded(object sender, EventArgs eventArgs) var suggested = (ApiInfoArray[]) _vm.RemoteNDKs.Clone(); Array.Sort(suggested, new DescApiComparer()); - PopulateList(panelAvailableNDKs, suggested, UpdateActionTargets.NDK, (info, target) => _vm.GetAction(info, target), "There was an error, while loading list of Native SDKs", ApiLevelActionType.Refresh); + PopulateList(panelAvailableNDKs, suggested, ApiLevelTarget.NDK, (info, target) => _vm.GetTask(info, target), "There was an error, while loading list of Native SDKs", ApiLevelTask.Refresh); } private void SimulatorListLoaded(object sender, EventArgs e) @@ -100,7 +100,7 @@ private void SimulatorListLoaded(object sender, EventArgs e) var suggested = (ApiInfoArray[])_vm.RemoteSimulators.Clone(); Array.Sort(suggested, new DescApiComparer()); - PopulateList(panelAvailableSimulators, suggested, UpdateActionTargets.Simulator, (info, target) => _vm.GetAction(info, target), "There was an error, while loading list of Simulators", ApiLevelActionType.Refresh); + PopulateList(panelAvailableSimulators, suggested, ApiLevelTarget.Simulator, (info, target) => _vm.GetTask(info, target), "There was an error, while loading list of Simulators", ApiLevelTask.Refresh); } private void RuntimeListLoaded(object sender, EventArgs e) @@ -108,10 +108,10 @@ private void RuntimeListLoaded(object sender, EventArgs e) var suggested = (ApiInfoArray[])_vm.RemoteRuntimes.Clone(); Array.Sort(suggested, new DescApiComparer()); - PopulateList(panelAvailableRuntimes, suggested, UpdateActionTargets.Runtime, (info, target) => _vm.GetAction(info, target), "There was an error, while loading list of Runtime Libraries", ApiLevelActionType.Refresh); + PopulateList(panelAvailableRuntimes, suggested, ApiLevelTarget.Runtime, (info, target) => _vm.GetTask(info, target), "There was an error, while loading list of Runtime Libraries", ApiLevelTask.Refresh); } - private void PopulateList(Panel panel, IEnumerable items, UpdateActionTargets target, Func actionEvaluation, string missingItemsMessage, ApiLevelActionType missingItemsAction) + private void PopulateList(Panel panel, IEnumerable items, ApiLevelTarget target, Func actionEvaluation, string missingItemsMessage, ApiLevelTask missingItemsAction) { if (panel == null) return; @@ -129,7 +129,7 @@ private void PopulateList(Panel panel, IEnumerable items, UpdateActionT item.Title = definition.Name; item.Details = definition.Details; item.Target = target; - item.Action = actionEvaluation != null ? actionEvaluation(definition, target) : ApiLevelActionType.Hide; + item.Action = actionEvaluation != null ? actionEvaluation(definition, target) : ApiLevelTask.Hide; item.Tag = definition; item.ParentPanel = panel; item.ExecuteAction += ItemOnExecuteAction; @@ -158,18 +158,18 @@ private void ItemOnExecuteAction(object sender, EventArgs eventArgs) { var listItem = (ListItemControl) sender; var definition = listItem != null ? (ApiInfo) listItem.Tag : null; - var actionTarget = listItem != null ? listItem.Target : UpdateActionTargets.NDK; + var actionTarget = listItem != null ? listItem.Target : ApiLevelTarget.NDK; var panel = listItem != null ? listItem.ParentPanel : null; - var action = listItem != null ? listItem.Action : ApiLevelActionType.Nothing; + var action = listItem != null ? listItem.Action : ApiLevelTask.Nothing; if (definition != null) { object argument; - action = _vm.GetAction(definition, actionTarget, out argument); + action = _vm.GetTask(definition, actionTarget, out argument); switch (action) { - case ApiLevelActionType.Install: + case ApiLevelTask.Install: var apiInfoArray = definition as ApiInfoArray; if (apiInfoArray != null) { @@ -184,20 +184,20 @@ private void ItemOnExecuteAction(object sender, EventArgs eventArgs) } } break; - case ApiLevelActionType.InstallManually: + case ApiLevelTask.InstallManually: DialogHelper.StartURL((string)argument); break; - case ApiLevelActionType.AddExisting: + case ApiLevelTask.AddExisting: AddExistingNDK(); break; - case ApiLevelActionType.Forget: + case ApiLevelTask.Forget: if (MessageBoxHelper.Show(definition.ToString(), "Remove own reference to existing NDK?", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { _vm.Forget(definition); UpdateUI(); } break; - case ApiLevelActionType.Uninstall: + case ApiLevelTask.Uninstall: if (MessageBoxHelper.Show(definition.ToString(), "Do you want to remove this item?", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { _vm.RequestRemoval(definition, actionTarget); @@ -212,7 +212,7 @@ private void ItemOnExecuteAction(object sender, EventArgs eventArgs) switch (action) { - case ApiLevelActionType.Refresh: + case ApiLevelTask.Refresh: LoadList(panel, actionTarget, true); break; } @@ -231,7 +231,7 @@ private void AddExistingNDK() if (ndk.Save(RunnerDefaults.PluginInstallationConfigDirectory)) { // reload NDKs - _vm.Reset(UpdateActionTargets.NDK); + _vm.Reset(ApiLevelTarget.NDK); UpdateUI(); } else diff --git a/src_vs2012/VSNDK.Package/Options/Dialogs/ListItemControl.cs b/src_vs2012/VSNDK.Package/Options/Dialogs/ListItemControl.cs index 3697d526..f4dff953 100644 --- a/src_vs2012/VSNDK.Package/Options/Dialogs/ListItemControl.cs +++ b/src_vs2012/VSNDK.Package/Options/Dialogs/ListItemControl.cs @@ -8,13 +8,13 @@ internal partial class ListItemControl : UserControl { public event EventHandler ExecuteAction; - private ApiLevelActionType _action; + private ApiLevelTask _action; public ListItemControl() { InitializeComponent(); - Action = ApiLevelActionType.Hide; + Action = ApiLevelTask.Hide; OnActionChanged(); } @@ -38,7 +38,7 @@ public string ActionName set { bttAction.Text = value; } } - public ApiLevelActionType Action + public ApiLevelTask Action { get { return _action; } set @@ -51,7 +51,7 @@ public ApiLevelActionType Action } } - public UpdateActionTargets Target + public ApiLevelTarget Target { get; set; @@ -70,30 +70,30 @@ private void OnActionChanged() switch (_action) { - case ApiLevelActionType.Hide: + case ApiLevelTask.Hide: ActionName = string.Empty; bttAction.Visible = false; break; - case ApiLevelActionType.Nothing: + case ApiLevelTask.Nothing: ActionName = "Locked"; bttAction.Enabled = false; break; - case ApiLevelActionType.Install: + case ApiLevelTask.Install: ActionName = "Install"; break; - case ApiLevelActionType.InstallManually: + case ApiLevelTask.InstallManually: ActionName = "Download..."; break; - case ApiLevelActionType.AddExisting: + case ApiLevelTask.AddExisting: ActionName = "Add..."; break; - case ApiLevelActionType.Uninstall: + case ApiLevelTask.Uninstall: ActionName = "Uninstall"; break; - case ApiLevelActionType.Forget: + case ApiLevelTask.Forget: ActionName = "Forget"; break; - case ApiLevelActionType.Refresh: + case ApiLevelTask.Refresh: ActionName = "Reload"; break; diff --git a/src_vs2012/VSNDK.Package/ViewModels/ApiLevelAction.cs b/src_vs2012/VSNDK.Package/ViewModels/ApiLevelAction.cs index 91d34c29..ac49d3c4 100644 --- a/src_vs2012/VSNDK.Package/ViewModels/ApiLevelAction.cs +++ b/src_vs2012/VSNDK.Package/ViewModels/ApiLevelAction.cs @@ -1,9 +1,9 @@ namespace RIM.VSNDK_Package.ViewModels { /// - /// Actions to perform by Update Manager + /// Actions to perform by Update Manager. /// - internal enum UpdateActions + internal enum ApiLevelAction { Install, Uninstall diff --git a/src_vs2012/VSNDK.Package/ViewModels/ApiLevelOptionViewModel.cs b/src_vs2012/VSNDK.Package/ViewModels/ApiLevelOptionViewModel.cs index e9aee436..4d30e9a3 100644 --- a/src_vs2012/VSNDK.Package/ViewModels/ApiLevelOptionViewModel.cs +++ b/src_vs2012/VSNDK.Package/ViewModels/ApiLevelOptionViewModel.cs @@ -74,13 +74,13 @@ private void NotifyListLoaded() handler(this, EventArgs.Empty); } - public ApiLevelActionType GetAction(ApiInfo info) + public ApiLevelTask GetTask(ApiInfo info) { object argument; - return GetAction(info, out argument); + return GetTask(info, out argument); } - public abstract ApiLevelActionType GetAction(ApiInfo info, out object argument); + public abstract ApiLevelTask GetTask(ApiInfo info, out object argument); public abstract bool IsInstalled(ApiInfo info); @@ -137,13 +137,13 @@ public NdkInfo Active set { PackageViewModel.Instance.ActiveNDK = value; } } - public override ApiLevelActionType GetAction(ApiInfo info, out object argument) + public override ApiLevelTask GetTask(ApiInfo info, out object argument) { argument = null; // nothing should be displayed for not defined NDK: if (info == null) - return ApiLevelActionType.Hide; + return ApiLevelTask.Hide; // check, if it exists on disk: bool isInstalled = IsInstalled(info) || AreItemsInstalled(info as ApiInfoArray); @@ -154,13 +154,13 @@ public override ApiLevelActionType GetAction(ApiInfo info, out object argument) // is it NDK owned by the plugin itself? if (isInstalled && ndkInfo.TargetPath != null && ndkInfo.TargetPath.StartsWith(RunnerDefaults.NdkDirectory, StringComparison.InvariantCultureIgnoreCase)) { - return IsProcessing(info) ? ApiLevelActionType.Nothing : ApiLevelActionType.Uninstall; + return IsProcessing(info) ? ApiLevelTask.Nothing : ApiLevelTask.Uninstall; } // is it a custom definition added? if (ndkInfo.FilePath != null && ndkInfo.FilePath.StartsWith(RunnerDefaults.PluginInstallationConfigDirectory, StringComparison.InvariantCultureIgnoreCase)) { - return ApiLevelActionType.Forget; + return ApiLevelTask.Forget; } } @@ -168,21 +168,21 @@ public override ApiLevelActionType GetAction(ApiInfo info, out object argument) if (info.Version.Major == 0 && info.Version.Minor == 0) { argument = RunnerDefaults.NdkDirectory; - return ApiLevelActionType.AddExisting; + return ApiLevelTask.AddExisting; } // is it a PlayBook NDK? if (info.Version <= LastPlayBookVersion) { if (isInstalled) - return ApiLevelActionType.Nothing; + return ApiLevelTask.Nothing; argument = "http://developer.blackberry.com/playbook/native/download/"; - return ApiLevelActionType.InstallManually; + return ApiLevelTask.InstallManually; } // by default, check, if it can be installed, or it's not owned by the plugin: - return isInstalled ? ApiLevelActionType.Nothing : ApiLevelActionType.Install; + return isInstalled ? ApiLevelTask.Nothing : ApiLevelTask.Install; } public override bool IsInstalled(ApiInfo info) @@ -192,7 +192,7 @@ public override bool IsInstalled(ApiInfo info) public override bool IsProcessing(ApiInfo info) { - return info != null && PackageViewModel.Instance.UpdateManager.IsProcessing(UpdateActionTargets.NDK, info.Version); + return info != null && PackageViewModel.Instance.UpdateManager.IsProcessing(ApiLevelTarget.NDK, info.Version); } /// @@ -236,13 +236,13 @@ public SimulatorInfo[] Installed get { return PackageViewModel.Instance.InstalledSimulators; } } - public override ApiLevelActionType GetAction(ApiInfo info, out object argument) + public override ApiLevelTask GetTask(ApiInfo info, out object argument) { argument = null; // nothing should be displayed for invalid simulator: if (info == null) - return ApiLevelActionType.Hide; + return ApiLevelTask.Hide; // check, if it exists on disk: var infoArray = info as ApiInfoArray; @@ -251,10 +251,10 @@ public override ApiLevelActionType GetAction(ApiInfo info, out object argument) if (simulatorInfo != null) { - return isInstalled && !IsProcessing(info) ? ApiLevelActionType.Uninstall : ApiLevelActionType.Nothing; + return isInstalled && !IsProcessing(info) ? ApiLevelTask.Uninstall : ApiLevelTask.Nothing; } - return isInstalled ? ApiLevelActionType.Nothing : ApiLevelActionType.Install; + return isInstalled ? ApiLevelTask.Nothing : ApiLevelTask.Install; } public override bool IsInstalled(ApiInfo info) @@ -264,7 +264,7 @@ public override bool IsInstalled(ApiInfo info) public override bool IsProcessing(ApiInfo info) { - return info != null && PackageViewModel.Instance.UpdateManager.IsProcessing(UpdateActionTargets.Simulator, info.Version); + return info != null && PackageViewModel.Instance.UpdateManager.IsProcessing(ApiLevelTarget.Simulator, info.Version); } public override void Reset() @@ -291,13 +291,13 @@ public RuntimeInfo[] Installed get { return PackageViewModel.Instance.InstalledRuntimes; } } - public override ApiLevelActionType GetAction(ApiInfo info, out object argument) + public override ApiLevelTask GetTask(ApiInfo info, out object argument) { argument = null; // nothing should be displayed for invalid runtime libraries: if (info == null) - return ApiLevelActionType.Hide; + return ApiLevelTask.Hide; // check, if it exists on disk: var infoArray = info as ApiInfoArray; @@ -306,10 +306,10 @@ public override ApiLevelActionType GetAction(ApiInfo info, out object argument) if (runtimeInfo != null) { - return isInstalled && !IsProcessing(info) ? ApiLevelActionType.Uninstall : ApiLevelActionType.Nothing; + return isInstalled && !IsProcessing(info) ? ApiLevelTask.Uninstall : ApiLevelTask.Nothing; } - return isInstalled ? ApiLevelActionType.Nothing : ApiLevelActionType.Install; + return isInstalled ? ApiLevelTask.Nothing : ApiLevelTask.Install; } public override bool IsInstalled(ApiInfo info) @@ -319,7 +319,7 @@ public override bool IsInstalled(ApiInfo info) public override bool IsProcessing(ApiInfo info) { - return info != null && PackageViewModel.Instance.UpdateManager.IsProcessing(UpdateActionTargets.Runtime, info.Version); + return info != null && PackageViewModel.Instance.UpdateManager.IsProcessing(ApiLevelTarget.Runtime, info.Version); } public override void Reset() @@ -411,47 +411,47 @@ public UpdateManager UpdateManager get { return PackageViewModel.Instance.UpdateManager; } } - public void Reset(UpdateActionTargets target) + public void Reset(ApiLevelTarget target) { switch (target) { - case UpdateActionTargets.NDK: + case ApiLevelTarget.NDK: _ndk.Reset(); break; - case UpdateActionTargets.Simulator: + case ApiLevelTarget.Simulator: _simulator.Reset(); break; - case UpdateActionTargets.Runtime: + case ApiLevelTarget.Runtime: _runtime.Reset(); break; } } - public ApiLevelActionType GetAction(ApiInfo info, UpdateActionTargets target) + public ApiLevelTask GetTask(ApiInfo info, ApiLevelTarget target) { switch (target) { - case UpdateActionTargets.NDK: - return _ndk.GetAction(info); - case UpdateActionTargets.Simulator: - return _simulator.GetAction(info); - case UpdateActionTargets.Runtime: - return _runtime.GetAction(info); + case ApiLevelTarget.NDK: + return _ndk.GetTask(info); + case ApiLevelTarget.Simulator: + return _simulator.GetTask(info); + case ApiLevelTarget.Runtime: + return _runtime.GetTask(info); default: throw new ArgumentOutOfRangeException("target"); } } - public ApiLevelActionType GetAction(ApiInfo info, UpdateActionTargets target, out object argument) + public ApiLevelTask GetTask(ApiInfo info, ApiLevelTarget target, out object argument) { switch (target) { - case UpdateActionTargets.NDK: - return _ndk.GetAction(info, out argument); - case UpdateActionTargets.Simulator: - return _simulator.GetAction(info, out argument); - case UpdateActionTargets.Runtime: - return _runtime.GetAction(info, out argument); + case ApiLevelTarget.NDK: + return _ndk.GetTask(info, out argument); + case ApiLevelTarget.Simulator: + return _simulator.GetTask(info, out argument); + case ApiLevelTarget.Runtime: + return _runtime.GetTask(info, out argument); default: throw new ArgumentOutOfRangeException("target"); } @@ -461,15 +461,15 @@ public ApiLevelActionType GetAction(ApiInfo info, UpdateActionTargets target, ou /// Loads the list of remote NDKs. /// If data is already available this method will return 'false'. 'True', if loading in progress. /// - public bool Load(UpdateActionTargets target, bool reload) + public bool Load(ApiLevelTarget target, bool reload) { switch (target) { - case UpdateActionTargets.NDK: + case ApiLevelTarget.NDK: return _ndk.Load(reload, Dispatcher); - case UpdateActionTargets.Simulator: + case ApiLevelTarget.Simulator: return _simulator.Load(reload, Dispatcher); - case UpdateActionTargets.Runtime: + case ApiLevelTarget.Runtime: return _runtime.Load(reload, Dispatcher); default: throw new ArgumentOutOfRangeException("target"); @@ -496,30 +496,30 @@ private void Dispose(bool disposing) #endregion - public bool CheckIfInstalled(ApiInfo info, UpdateActionTargets target) + public bool CheckIfInstalled(ApiInfo info, ApiLevelTarget target) { switch (target) { - case UpdateActionTargets.NDK: + case ApiLevelTarget.NDK: return _ndk.IsInstalled(info); - case UpdateActionTargets.Simulator: + case ApiLevelTarget.Simulator: return _simulator.IsInstalled(info); - case UpdateActionTargets.Runtime: + case ApiLevelTarget.Runtime: return _runtime.IsInstalled(info); default: throw new ArgumentOutOfRangeException("target"); } } - public bool IsProcessing(ApiInfo info, UpdateActionTargets target) + public bool IsProcessing(ApiInfo info, ApiLevelTarget target) { switch (target) { - case UpdateActionTargets.NDK: + case ApiLevelTarget.NDK: return _ndk.IsProcessing(info); - case UpdateActionTargets.Simulator: + case ApiLevelTarget.Simulator: return _simulator.IsProcessing(info); - case UpdateActionTargets.Runtime: + case ApiLevelTarget.Runtime: return _runtime.IsProcessing(info); default: throw new ArgumentOutOfRangeException("target"); @@ -529,23 +529,23 @@ public bool IsProcessing(ApiInfo info, UpdateActionTargets target) /// /// Requests to download and install something. /// - public void RequestInstall(ApiInfo info, UpdateActionTargets target) + public void RequestInstall(ApiInfo info, ApiLevelTarget target) { if (info == null) throw new ArgumentNullException("info"); - PackageViewModel.Instance.UpdateManager.Request(UpdateActions.Install, target, info.Name, info.Version); + PackageViewModel.Instance.UpdateManager.Request(ApiLevelAction.Install, target, info.Name, info.Version); } /// /// Requests to uninstall and remove something. /// - public void RequestRemoval(ApiInfo info, UpdateActionTargets target) + public void RequestRemoval(ApiInfo info, ApiLevelTarget target) { if (info == null) throw new ArgumentNullException("info"); - PackageViewModel.Instance.UpdateManager.Request(UpdateActions.Uninstall, target, info.Name, info.Version); + PackageViewModel.Instance.UpdateManager.Request(ApiLevelAction.Uninstall, target, info.Name, info.Version); } /// diff --git a/src_vs2012/VSNDK.Package/ViewModels/ApiLevelTarget.cs b/src_vs2012/VSNDK.Package/ViewModels/ApiLevelTarget.cs index 3e2d53f5..75344cd5 100644 --- a/src_vs2012/VSNDK.Package/ViewModels/ApiLevelTarget.cs +++ b/src_vs2012/VSNDK.Package/ViewModels/ApiLevelTarget.cs @@ -3,7 +3,7 @@ /// /// Targets processed by Update Manager /// - internal enum UpdateActionTargets + internal enum ApiLevelTarget { NDK, Simulator, diff --git a/src_vs2012/VSNDK.Package/ViewModels/ApiLevelTask.cs b/src_vs2012/VSNDK.Package/ViewModels/ApiLevelTask.cs index 4d05f0a5..74b72ead 100644 --- a/src_vs2012/VSNDK.Package/ViewModels/ApiLevelTask.cs +++ b/src_vs2012/VSNDK.Package/ViewModels/ApiLevelTask.cs @@ -3,7 +3,7 @@ /// /// Enumeration describing, what action can be performed over specified API Level. /// - internal enum ApiLevelActionType + internal enum ApiLevelTask { /// /// Nothing can be done with this API Level (it was installed separatelly and just detected). diff --git a/src_vs2012/VSNDK.Package/ViewModels/UpdateManager.cs b/src_vs2012/VSNDK.Package/ViewModels/UpdateManager.cs index b9b2bb22..d930f33b 100644 --- a/src_vs2012/VSNDK.Package/ViewModels/UpdateManager.cs +++ b/src_vs2012/VSNDK.Package/ViewModels/UpdateManager.cs @@ -16,7 +16,7 @@ public sealed class ActionData { #region Properties - internal ActionData(UpdateManager manager, UpdateActions action, UpdateActionTargets target, string name, Version version) + internal ActionData(UpdateManager manager, ApiLevelAction action, ApiLevelTarget target, string name, Version version) { if (manager == null) throw new ArgumentNullException("manager"); @@ -43,13 +43,13 @@ public bool CanAbort get { return true; } } - public UpdateActions Action + public ApiLevelAction Action { get; private set; } - public UpdateActionTargets Target + public ApiLevelTarget Target { get; private set; @@ -139,7 +139,7 @@ private string SyncFilePath /// /// Requests installation or removal over specified item and version. /// - public void Request(UpdateActions action, UpdateActionTargets target, string name, Version version) + public void Request(ApiLevelAction action, ApiLevelTarget target, string name, Version version) { if (string.IsNullOrEmpty(name)) throw new ArgumentNullException("name"); @@ -191,7 +191,7 @@ private void Remove(ActionData action) /// /// Checks, if there exists scheduled action for specified item. /// - public bool IsProcessing(UpdateActionTargets target, Version version) + public bool IsProcessing(ApiLevelTarget target, Version version) { if (version == null) return false; From d14743b00722067449ccc4f8468859b0ffa8e844 Mon Sep 17 00:00:00 2001 From: Pawel Hofman Date: Mon, 9 Jun 2014 17:53:50 +0200 Subject: [PATCH 182/851] Implemented beta-working version of UpdateManager Should support NDK, simulator and runtime libraries --- .../VSNDK.Package.Test/ToolRunnerTests.cs | 11 +- .../UpdateManagerStatusForm.Designer.cs | 6 + .../Dialogs/UpdateManagerStatusForm.cs | 71 ++- .../Dialogs/UpdateManagerStatusForm.resx | 3 + .../Tools/ApiLevelListLoadRunner.cs | 2 +- .../Tools/ApiLevelUpdateLogEventArgs.cs | 46 ++ .../Tools/ApiLevelUpdateRunner.cs | 566 ++++++++++++++++++ src_vs2012/VSNDK.Package/Tools/ToolRunner.cs | 42 +- src_vs2012/VSNDK.Package/VSNDK.Package.csproj | 4 + .../ViewModels/PackageViewModel.cs | 21 + .../VSNDK.Package/ViewModels/UpdateManager.cs | 250 +++++++- 11 files changed, 996 insertions(+), 26 deletions(-) create mode 100644 src_vs2012/VSNDK.Package/Tools/ApiLevelUpdateLogEventArgs.cs create mode 100644 src_vs2012/VSNDK.Package/Tools/ApiLevelUpdateRunner.cs diff --git a/src_vs2012/VSNDK.Package.Test/ToolRunnerTests.cs b/src_vs2012/VSNDK.Package.Test/ToolRunnerTests.cs index 2c1f57af..52c55115 100644 --- a/src_vs2012/VSNDK.Package.Test/ToolRunnerTests.cs +++ b/src_vs2012/VSNDK.Package.Test/ToolRunnerTests.cs @@ -1,5 +1,4 @@ #if DEBUG - using System; using System.IO; using System.Threading; @@ -191,6 +190,16 @@ public void LoadInfoAboutCertificate() Assert.IsNotNull(runner.Info); Assert.IsNotNull(runner.Info.Issuer); } + + [Test] + public void InstallSimulator() + { + var runner = new ApiLevelUpdateRunner(RunnerDefaults.NdkDirectory, ApiLevelAction.Install, ApiLevelTarget.Simulator, new Version(10, 1, 0, 2354)); + var result = runner.Execute(); + + runner.Wait(); + Assert.IsTrue(result); + } } } diff --git a/src_vs2012/VSNDK.Package/Options/Dialogs/UpdateManagerStatusForm.Designer.cs b/src_vs2012/VSNDK.Package/Options/Dialogs/UpdateManagerStatusForm.Designer.cs index 7654b3c8..e507b15a 100644 --- a/src_vs2012/VSNDK.Package/Options/Dialogs/UpdateManagerStatusForm.Designer.cs +++ b/src_vs2012/VSNDK.Package/Options/Dialogs/UpdateManagerStatusForm.Designer.cs @@ -28,6 +28,7 @@ protected override void Dispose(bool disposing) /// private void InitializeComponent() { + this.components = new System.ComponentModel.Container(); this.bttClose = new System.Windows.Forms.Button(); this.groupBox1 = new System.Windows.Forms.GroupBox(); this.bttAbort = new System.Windows.Forms.Button(); @@ -37,6 +38,7 @@ private void InitializeComponent() this.groupBox2 = new System.Windows.Forms.GroupBox(); this.bttDelete = new System.Windows.Forms.Button(); this.listActions = new System.Windows.Forms.ListBox(); + this.toolTip = new System.Windows.Forms.ToolTip(this.components); this.groupBox1.SuspendLayout(); this.groupBox2.SuspendLayout(); this.SuspendLayout(); @@ -77,6 +79,7 @@ private void InitializeComponent() this.bttAbort.TabIndex = 3; this.bttAbort.Text = "&Abort"; this.bttAbort.UseVisualStyleBackColor = true; + this.bttAbort.Click += new System.EventHandler(this.bttAbort_Click); // // progressBar // @@ -133,6 +136,7 @@ private void InitializeComponent() this.bttDelete.TabIndex = 1; this.bttDelete.Text = "&Delete"; this.bttDelete.UseVisualStyleBackColor = true; + this.bttDelete.Click += new System.EventHandler(this.bttDelete_Click); // // listActions // @@ -156,6 +160,7 @@ private void InitializeComponent() this.Controls.Add(this.groupBox2); this.Controls.Add(this.groupBox1); this.Controls.Add(this.bttClose); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; this.MaximizeBox = false; this.MinimizeBox = false; this.Name = "UpdateManagerStatusForm"; @@ -180,5 +185,6 @@ private void InitializeComponent() private System.Windows.Forms.GroupBox groupBox2; private System.Windows.Forms.ListBox listActions; private System.Windows.Forms.Button bttDelete; + private System.Windows.Forms.ToolTip toolTip; } } \ No newline at end of file diff --git a/src_vs2012/VSNDK.Package/Options/Dialogs/UpdateManagerStatusForm.cs b/src_vs2012/VSNDK.Package/Options/Dialogs/UpdateManagerStatusForm.cs index d410290f..91b38cfb 100644 --- a/src_vs2012/VSNDK.Package/Options/Dialogs/UpdateManagerStatusForm.cs +++ b/src_vs2012/VSNDK.Package/Options/Dialogs/UpdateManagerStatusForm.cs @@ -1,5 +1,6 @@ using System; using System.Windows.Forms; +using RIM.VSNDK_Package.Tools; using RIM.VSNDK_Package.ViewModels; namespace RIM.VSNDK_Package.Options.Dialogs @@ -7,17 +8,41 @@ namespace RIM.VSNDK_Package.Options.Dialogs internal partial class UpdateManagerStatusForm : Form { private readonly ApiLevelOptionViewModel _vm; + private readonly IEventDispatcher _dispatcher; public UpdateManagerStatusForm(ApiLevelOptionViewModel vm) { if (vm == null) throw new ArgumentNullException("vm"); + InitializeComponent(); + _vm = vm; + UpdateUI(); - InitializeComponent(); + _dispatcher = _vm.Dispatcher ?? EventDispatcher.From(this); + _vm.UpdateManager.Completed += OnActionCompleted; + _vm.UpdateManager.Log += OnLog; // this will cause the last message to be sent again... + } + + protected override void OnClosed(EventArgs e) + { + _vm.UpdateManager.Completed -= OnActionCompleted; + _vm.UpdateManager.Log -= OnLog; + base.OnClosed(e); + } - ///_vm.UpdateManager.Log + private void OnActionCompleted(object sender, EventArgs e) + { + _dispatcher.Invoke(UpdateUI, (object)null); + } + + private void OnLog(object sender, ApiLevelUpdateLogEventArgs e) + { + _dispatcher.Invoke(UpdateLog, e); + } + private void UpdateUI(object sender) + { UpdateUI(); } @@ -37,12 +62,54 @@ private void UpdateLog(ViewModels.UpdateManager.ActionData action) lblActionLog1.Text = action != null ? string.Concat("Processing ", action.Name, "...") : "Nothing is currently executing"; lblActionLog2.Text = "-"; progressBar.Value = 0; + toolTip.SetToolTip(progressBar, null); bttAbort.Enabled = action != null && action.CanAbort; } + private void UpdateLog(ApiLevelUpdateLogEventArgs e) + { + if (e != null && !string.IsNullOrEmpty(e.Message)) + { + lblActionLog2.Text = e.Message; + } + if (e != null && e.Progress >= 0) + { + progressBar.Value = e.Progress; + toolTip.SetToolTip(progressBar, progressBar.Value + "%"); + } + bttAbort.Enabled = e != null && e.CanAbort; + } + private void listActions_SelectedIndexChanged(object sender, EventArgs e) { bttDelete.Enabled = listActions.SelectedIndex >= 0; } + + private void bttAbort_Click(object sender, EventArgs e) + { + var action = _vm.UpdateManager.CurrentAction; + if (action != null) + { + if (MessageBoxHelper.Show(action.ToString(), "Do you want to abort currently running action?", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) + { + action.Abort(); + UpdateUI(); + } + } + } + + private void bttDelete_Click(object sender, EventArgs e) + { + var action = listActions.SelectedItem as ViewModels.UpdateManager.ActionData; + + if (action != null) + { + if (MessageBoxHelper.Show(action.ToString(), "Do you want to delete this step?", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) + { + action.Delete(); + UpdateUI(); + } + } + } } } diff --git a/src_vs2012/VSNDK.Package/Options/Dialogs/UpdateManagerStatusForm.resx b/src_vs2012/VSNDK.Package/Options/Dialogs/UpdateManagerStatusForm.resx index 29dcb1b3..1ca1e9b0 100644 --- a/src_vs2012/VSNDK.Package/Options/Dialogs/UpdateManagerStatusForm.resx +++ b/src_vs2012/VSNDK.Package/Options/Dialogs/UpdateManagerStatusForm.resx @@ -117,4 +117,7 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + 17, 17 + \ No newline at end of file diff --git a/src_vs2012/VSNDK.Package/Tools/ApiLevelListLoadRunner.cs b/src_vs2012/VSNDK.Package/Tools/ApiLevelListLoadRunner.cs index edc14377..907a6003 100644 --- a/src_vs2012/VSNDK.Package/Tools/ApiLevelListLoadRunner.cs +++ b/src_vs2012/VSNDK.Package/Tools/ApiLevelListLoadRunner.cs @@ -81,7 +81,7 @@ private void UpdateArguments() args += " --list-all --runtime"; break; default: - throw new InvalidOperationException("Specified list type is unsupported"); + throw new InvalidOperationException("Specified list type is unsupported (" + Type + ")"); } Arguments = args; diff --git a/src_vs2012/VSNDK.Package/Tools/ApiLevelUpdateLogEventArgs.cs b/src_vs2012/VSNDK.Package/Tools/ApiLevelUpdateLogEventArgs.cs new file mode 100644 index 00000000..2b65ac65 --- /dev/null +++ b/src_vs2012/VSNDK.Package/Tools/ApiLevelUpdateLogEventArgs.cs @@ -0,0 +1,46 @@ +using System; + +namespace RIM.VSNDK_Package.Tools +{ + /// + /// Arguments passed along with 'Log' event. + /// + internal class ApiLevelUpdateLogEventArgs : EventArgs + { + public ApiLevelUpdateLogEventArgs(string message, int progress, bool canAbort) + { + Message = message; + Progress = progress; + CanAbort = canAbort; + } + + public ApiLevelUpdateLogEventArgs(string message) + { + Message = message; + Progress = -1; + CanAbort = true; + } + + #region Properties + + public string Message + { + get; + private set; + } + + public int Progress + { + get; + private set; + } + + public bool CanAbort + { + get; + private set; + } + + #endregion + } +} \ No newline at end of file diff --git a/src_vs2012/VSNDK.Package/Tools/ApiLevelUpdateRunner.cs b/src_vs2012/VSNDK.Package/Tools/ApiLevelUpdateRunner.cs new file mode 100644 index 00000000..62d48d77 --- /dev/null +++ b/src_vs2012/VSNDK.Package/Tools/ApiLevelUpdateRunner.cs @@ -0,0 +1,566 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Globalization; +using System.IO; +using System.Management; +using System.Text; +using RIM.VSNDK_Package.Diagnostics; +using RIM.VSNDK_Package.ViewModels; + +namespace RIM.VSNDK_Package.Tools +{ + /// + /// Runner, that calls specific tool to update specified target within the NDK (new API Level, new simulator or runtime). + /// + internal sealed class ApiLevelUpdateRunner : ToolRunner + { + #region Internal Classes + + /// + /// Description of the file fetched from the server. + /// + [DebuggerDisplay("{Name} ({Read} / {Size})")] + sealed class LogFetchFile + { + public LogFetchFile(string name) + { + if (string.IsNullOrEmpty(name)) + throw new ArgumentNullException("name"); + + Name = name; + } + + #region Properties + + public string Name + { + get; + private set; + } + + public long Read + { + get; + set; + } + + public long Size + { + get; + set; + } + + #endregion + } + + public enum LogState + { + Waiting, + Preparing, + Downloading, + Installing, + Configuring, + Completed + } + + public sealed class LogParser + { + public event EventHandler Log; + + private LogState _state; + private readonly ApiLevelUpdateRunner _parent; + private readonly List _files; + + public LogParser(ApiLevelUpdateRunner parent) + { + if (parent == null) + throw new ArgumentNullException("parent"); + + _state = LogState.Waiting; + _parent = parent; + _files = new List(); + } + + public void Reset() + { + State = LogState.Waiting; + _files.Clear(); + _parent.CanAbort = true; + } + + /// + /// Converts the log message from the runner into a notification with similar data. + /// + public void Consume(string line) + { + if (string.IsNullOrEmpty(line)) + return; + + if (line.StartsWith("downloading ", StringComparison.OrdinalIgnoreCase)) + { + State = LogState.Downloading; + + // ok, new file to download: + var name = line.Substring(12).Trim(); + _files.Add(new LogFetchFile(name)); + + Notify(string.Concat("Preparing ", name, "..."), 10, true); + return; + } + + if (line.StartsWith("fetching ", StringComparison.OrdinalIgnoreCase)) + { + long progress; + long size; + string originalFileName = ExtractFileName(line, out progress, out size); + var fileName = originalFileName; + + var file = Get(fileName, _files); + if (file == null) + { + fileName = Path.GetFileNameWithoutExtension(fileName); + file = Get(fileName, _files); + } + + if (file != null && size > 0) + { + file.Read = progress; + file.Size = size; + } + + // show nice log message, this is the one developer sees most often: + var overallProgress = 10 + (int)((CalculateDownloadProgress() * 70d)); // expected from 10-80% + if (file != null) + { + const double MegaByte = 1024d * 1024d; + double dProgress = file.Read / MegaByte; + double dSize = (file.Size / MegaByte); + if (dSize < 1) // just a guard, to make it look like, there is always something to download + dSize = 1; + + Notify(string.Concat("Downloading ", originalFileName, " (", dProgress.ToString("N2"), "MB of ", dSize.ToString("N2"), "MB)..."), overallProgress, true); + } + else + { + Notify(string.Concat("Downloading ", originalFileName, "..."), overallProgress, true); + } + return; + } + + if (line.StartsWith("installing ", StringComparison.OrdinalIgnoreCase)) + { + var file = Find(line, _files); + if (file != null) + { + // mark as completed download + file.Read = file.Size; + State = LogState.Installing; + + Notify(line, 80, false); + return; + } + + Notify(line, 5, true); + return; + } + + if (line.StartsWith("configuring ", StringComparison.OrdinalIgnoreCase)) + { + State = LogState.Configuring; + Notify(line, 90, false); + return; + } + + if (line.StartsWith("preparing to commit ", StringComparison.OrdinalIgnoreCase)) + { + Notify(line, 95, false); + return; + } + + if (line.StartsWith("committing ", StringComparison.OrdinalIgnoreCase)) + { + State = LogState.Completed; + Notify(line, 100, false); + return; + } + } + + private double CalculateDownloadProgress() + { + // go through all files and measure global progress: + long size = 0; + long read = 0; + + foreach (var file in _files) + { + read += file.Read; + size += file.Size; + } + + return size == 0 ? 0d : read / (double) size; + } + + private string ExtractFileName(string text, out long progress, out long size) + { + progress = 0; + size = 0; + + if (string.IsNullOrEmpty(text)) + return null; + + int startAt = text.IndexOf(' '); // from first space + int endAt = text.IndexOf('('); // till the bracket with progress + + if (startAt < 0 || endAt < 0) + return null; + + var name = text.Substring(startAt + 1, endAt - startAt - 1).Trim(); + + int progressEndAt = text.IndexOf(" of ", endAt, StringComparison.OrdinalIgnoreCase); + int sizeEndAt = text.IndexOf(" at ", endAt, StringComparison.OrdinalIgnoreCase); + + if (progressEndAt < 0 || sizeEndAt < 0) + return name; + + try + { + progress = GetLong(text.Substring(endAt + 1, progressEndAt - endAt - 1).Trim()); + } + catch (Exception ex) + { + TraceLog.WriteException(ex); + return name; + } + + try + { + size = GetLong(text.Substring(progressEndAt + 4, sizeEndAt - progressEndAt - 4).Trim()); + } + catch (Exception ex) + { + TraceLog.WriteException(ex); + return name; + } + + return name; + } + + private long GetLong(string text) + { + decimal multiplier = 1; + + if (string.IsNullOrEmpty(text)) + return 0; + + if (text.EndsWith("kB", StringComparison.OrdinalIgnoreCase)) + { + multiplier = 1024; + text = text.Substring(0, text.Length - 2); + } + else if (text.EndsWith("MB", StringComparison.OrdinalIgnoreCase)) + { + multiplier = 1024 * 1024; + text = text.Substring(0, text.Length - 2); + } + else + { + if (text.EndsWith("GB", StringComparison.OrdinalIgnoreCase)) + { + multiplier = 1024 * 1024 * 1024; + text = text.Substring(0, text.Length - 2); + } + else + { + text = text.Substring(0, text.Length - 1); + } + } + + // clean-up from some strange local chars: + for (int i = 0; i < text.Length; i++) + { + if (!char.IsDigit(text[i]) && text[i] != '.' && text[i] != ',') + { + text = text.Remove(i, 1); + i--; + } + } + + // and convert the number finally: + decimal value; + if (decimal.TryParse(text, NumberStyles.Number, CultureInfo.CurrentCulture, out value)) + return (long) (value * multiplier); + + if (decimal.TryParse(text, NumberStyles.Number, CultureInfo.InvariantCulture, out value)) + return (long) (value * multiplier); + + return 0; + } + + private static LogFetchFile Find(string text, IReadOnlyCollection files) + { + if (string.IsNullOrEmpty(text) || files == null || files.Count == 0) + return null; + + foreach (var file in files) + { + if (text.IndexOf(file.Name, StringComparison.CurrentCulture) >= 0) + return file; + } + + return null; + } + + private static LogFetchFile Get(string text, IReadOnlyCollection files) + { + if (string.IsNullOrEmpty(text) || files == null || files.Count == 0) + return null; + + foreach (var file in files) + { + if (string.Compare(text, file.Name, StringComparison.CurrentCulture) == 0) + return file; + } + + return null; + } + + private void Notify(string message) + { + Notify(message, -1, true); + } + + private void Notify(string message, int progress, bool canAbort) + { + _parent.CanAbort = canAbort; + + var handler = Log; + if (handler != null) + handler(_parent, new ApiLevelUpdateLogEventArgs(message, progress, canAbort)); + } + + #region Properties + + public LogState State + { + get { return _state; } + private set + { + if (_state != value) + { + _state = value; + TraceLog.WriteLine("New state: {0}", State); + } + } + } + + #endregion + } + + #endregion + + /// + /// Event fired each time progress of an update has been changed. + /// + public event EventHandler Log + { + add { _parser.Log += value; } + remove { _parser.Log -= value; } + } + + private readonly List _runningInstallers; + private LogParser _parser; + + private ApiLevelAction _action; + private ApiLevelTarget _target; + private Version _version; + + public ApiLevelUpdateRunner(string workingDirectory, ApiLevelAction action, ApiLevelTarget target, Version version) + : base("cmd.exe", workingDirectory) + { + if (version == null) + throw new ArgumentNullException("version"); + + _action = action; + _target = target; + _version = version; + _runningInstallers = new List(); + _parser = new LogParser(this); + CanAbort = true; + + UpdateArguments(); + } + + #region Properties + + /// + /// Gets or sets the action to be performed. + /// + public ApiLevelAction Action + { + get { return _action; } + set + { + _action = value; + UpdateArguments(); + } + } + + /// + /// Gets or sets the target the action is performed over. + /// + public ApiLevelTarget Target + { + get { return _target; } + set + { + _target = value; + UpdateArguments(); + } + } + + /// + /// Gets or sets the version of the target operation is performed over. + /// + public Version Version + { + get { return _version; } + set + { + if (value != null) + { + _version = value; + UpdateArguments(); + } + } + } + + /// + /// Gets an indication, if this task entered a moment, when can not be aborted. + /// + public bool CanAbort + { + get; + private set; + } + + #endregion + + private void UpdateArguments() + { + var args = new StringBuilder("/C eclipsec.exe"); + + switch (Action) + { + case ApiLevelAction.Install: + args.Append(" --install"); + break; + case ApiLevelAction.Uninstall: + args.Append(" --uninstall"); + break; + default: + throw new InvalidOperationException("Specified action is unsupported (" + Action + ")"); + } + args.Append(' ').Append(Version); + + switch (Target) + { + case ApiLevelTarget.NDK: + // do nothing + break; + case ApiLevelTarget.Simulator: + args.Append(" --simulator"); + break; + case ApiLevelTarget.Runtime: + args.Append(" --runtime"); + break; + default: + throw new InvalidOperationException("Specified target is unsupported (" + Target + ")"); + } + + Arguments = args.ToString(); + } + + protected override void PrepareStartup() + { + base.PrepareStartup(); + _runningInstallers.Clear(); + _parser.Reset(); + } + + protected override void PrepareStarted(int pid) + { + var searcher = new ManagementObjectSearcher("SELECT * FROM Win32_Process WHERE ParentProcessId=" + pid); + foreach (var item in searcher.Get()) + { + try + { + _runningInstallers.Add(Convert.ToInt32(item["ProcessId"].ToString())); + } + catch (Exception ex) + { + TraceLog.WriteException(ex, "Unable to acquire installation process-id"); + } + } + + } + + protected override void ProcessOutputLine(string text) + { + _parser.Consume(text); + } + + protected override void ConsumeResults(string output, string error) + { + _runningInstallers.Clear(); + } + + /// + /// Waits for update to complete. + /// + public void Wait() + { + foreach (int pid in _runningInstallers) + { + using (var process = Process.GetProcessById(pid)) + { + process.WaitForExit(); + } + } + } + + /// + /// Aborts running update. + /// + public bool Abort() + { + if (!CanAbort) + return false; + + foreach (int pid in _runningInstallers) + { + try + { + using (var process = Process.GetProcessById(pid)) + { + process.Kill(); + } + } + catch (Exception ex) + { + TraceLog.WriteException(ex, "Unable to abort update ({0}, {1}, {2})", Action, Target, Version); + } + } + + _runningInstallers.Clear(); + return true; + } + + protected override void Dispose(bool disposing) + { + base.Dispose(disposing); + + Abort(); // kill all spawned processes if available... + } + } +} diff --git a/src_vs2012/VSNDK.Package/Tools/ToolRunner.cs b/src_vs2012/VSNDK.Package/Tools/ToolRunner.cs index 165a7350..3b03efa3 100644 --- a/src_vs2012/VSNDK.Package/Tools/ToolRunner.cs +++ b/src_vs2012/VSNDK.Package/Tools/ToolRunner.cs @@ -114,11 +114,21 @@ public object Tag #endregion + protected virtual void ProcessOutputLine(string text) + { + _output.AppendLine(text); + } + + protected virtual void ProcessErrorLine(string text) + { + _error.AppendLine(text); + } + private void OutputDataReceived(object sender, DataReceivedEventArgs e) { if (e.Data != null) { - _output.AppendLine(e.Data); + ProcessOutputLine(e.Data); } } @@ -126,7 +136,7 @@ private void ErrorDataReceived(object sender, DataReceivedEventArgs e) { if (e.Data != null) { - _error.AppendLine(e.Data); + ProcessErrorLine(e.Data); } } @@ -149,6 +159,8 @@ public bool Execute() _process.BeginErrorReadLine(); _process.BeginOutputReadLine(); + + PrepareStarted(_process.Id); _process.WaitForExit(); ExitCode = _process.ExitCode; @@ -186,6 +198,8 @@ public void ExecuteAsync() _process.Start(); _process.BeginErrorReadLine(); _process.BeginOutputReadLine(); + + PrepareStarted(_process.Id); } catch (Exception ex) { @@ -281,6 +295,13 @@ protected virtual void PrepareStartup() handler(this, new ToolRunnerStartupEventArgs(this)); } + /// + /// Method executed just after staring the tool, to setup extra behavior of the runner. + /// + protected virtual void PrepareStarted(int pid) + { + } + protected virtual void ConsumeResults(string output, string error) { // do nothing, subclasses should handle parsing output @@ -317,19 +338,16 @@ public void Dispose() protected virtual void Dispose(bool disposing) { - if (disposing) + if (_process != null) { - if (_process != null) - { - _process.OutputDataReceived -= OutputDataReceived; - _process.ErrorDataReceived -= ErrorDataReceived; - - _process.Dispose(); - _process = null; - } + _process.OutputDataReceived -= OutputDataReceived; + _process.ErrorDataReceived -= ErrorDataReceived; - Finished = null; + _process.Dispose(); + _process = null; } + + Finished = null; } #endregion diff --git a/src_vs2012/VSNDK.Package/VSNDK.Package.csproj b/src_vs2012/VSNDK.Package/VSNDK.Package.csproj index 6ec6cb5e..ebb8faf2 100644 --- a/src_vs2012/VSNDK.Package/VSNDK.Package.csproj +++ b/src_vs2012/VSNDK.Package/VSNDK.Package.csproj @@ -401,6 +401,10 @@ Component + + + Code + diff --git a/src_vs2012/VSNDK.Package/ViewModels/PackageViewModel.cs b/src_vs2012/VSNDK.Package/ViewModels/PackageViewModel.cs index abe157c7..be5a01fb 100644 --- a/src_vs2012/VSNDK.Package/ViewModels/PackageViewModel.cs +++ b/src_vs2012/VSNDK.Package/ViewModels/PackageViewModel.cs @@ -410,6 +410,27 @@ public void ResetRuntimes() _installedRuntimes = null; } + /// + /// Resets the cached list of given type. + /// + public void Reset(ApiLevelTarget target) + { + switch (target) + { + case ApiLevelTarget.NDK: + ResetNDKs(); + break; + case ApiLevelTarget.Simulator: + ResetSimulators(); + break; + case ApiLevelTarget.Runtime: + ResetRuntimes(); + break; + default: + throw new InvalidOperationException("Unsupported target type (" + target + ")"); + } + } + /// /// Removes custom reference to existing NDK, created by developer some time ago. /// diff --git a/src_vs2012/VSNDK.Package/ViewModels/UpdateManager.cs b/src_vs2012/VSNDK.Package/ViewModels/UpdateManager.cs index d930f33b..14321cc5 100644 --- a/src_vs2012/VSNDK.Package/ViewModels/UpdateManager.cs +++ b/src_vs2012/VSNDK.Package/ViewModels/UpdateManager.cs @@ -2,10 +2,11 @@ using System.Collections.Generic; using System.IO; using RIM.VSNDK_Package.Diagnostics; +using RIM.VSNDK_Package.Tools; namespace RIM.VSNDK_Package.ViewModels { - internal sealed class UpdateManager + internal sealed class UpdateManager : IDisposable { #region Internal Classes @@ -14,6 +15,9 @@ internal sealed class UpdateManager /// public sealed class ActionData { + private readonly string _description; + private ApiLevelUpdateRunner _runner; + #region Properties internal ActionData(UpdateManager manager, ApiLevelAction action, ApiLevelTarget target, string name, Version version) @@ -30,6 +34,23 @@ internal ActionData(UpdateManager manager, ApiLevelAction action, ApiLevelTarget Target = target; Name = name; Version = version; + + _description = Name.Contains(Version.ToString()) + ? string.Concat(GetActionName(Action), " ", Name) + : string.Concat(GetActionName(Action), " ", Name, " (", Version, ")"); + } + + private static string GetActionName(ApiLevelAction action) + { + switch (action) + { + case ApiLevelAction.Install: + return "Install"; + case ApiLevelAction.Uninstall: + return "Remove"; + default: + throw new ArgumentOutOfRangeException("action"); + } } private UpdateManager UpdateManager @@ -71,18 +92,88 @@ public Version Version public override string ToString() { - return string.Concat(Action, "-Action of ", Target, "-", Version); + return _description; } internal void Abort() { + bool aborted = false; + lock (GetType()) + { + if (_runner != null) + { + aborted = _runner.Abort(); + } + } + + if (aborted) + { + UpdateManager.Finished(this); + } + } + + public void Start() + { + lock (GetType()) + { + // already running? + if (_runner != null) + return; + + _runner = new ApiLevelUpdateRunner(RunnerDefaults.NdkDirectory, Action, Target, Version); + _runner.Finished += OnFinished; + _runner.Log += OnLog; + _runner.ExecuteAsync(); + } + } + + private void OnLog(object sender, ApiLevelUpdateLogEventArgs e) + { + UpdateManager.NotifyLog(e); + } + + private void OnFinished(object sender, ToolRunnerEventArgs e) + { + lock (GetType()) + { + _runner.Finished -= OnFinished; + _runner.Log -= OnLog; + _runner = null; + } + + UpdateManager.Finished(this); + } + + public void Delete() + { + UpdateManager.Remove(this); } } #endregion + private event EventHandler HiddenLog; + + public event EventHandler Log + { + add + { + HiddenLog += value; + + // send again the last log message... + if (value != null && _lastLog != null) + { + value(this, _lastLog); + } + } + remove { HiddenLog -= value; } + } + + public event EventHandler Completed; + private readonly PackageViewModel _vm; + private ApiLevelUpdateLogEventArgs _lastLog; private readonly List _actions; public UpdateManager(PackageViewModel vm, string folder) @@ -94,11 +185,16 @@ public UpdateManager(PackageViewModel vm, string folder) _vm = vm; Folder = folder; - SyncFilePath = Path.Combine(Folder, "vsplugin.pid"); + SyncFilePath = Path.Combine(Folder, "vsplugin.lock"); _actions = new List(); Actions = new ActionData[0]; } + ~UpdateManager() + { + Dispose(false); + } + #region Properties /// @@ -128,6 +224,12 @@ private string Folder set; } + private StreamWriter SyncFile + { + get; + set; + } + private string SyncFilePath { get; @@ -177,13 +279,10 @@ private void Remove(ActionData action) TraceLog.WarnLine("Removed: {0}", action); // remove from execution: - if (action.CanAbort) + action.Abort(); + if (_actions.Remove(action)) { - action.Abort(); - if (_actions.Remove(action)) - { - Actions = _actions.ToArray(); - } + Actions = _actions.ToArray(); } } } @@ -196,6 +295,10 @@ public bool IsProcessing(ApiLevelTarget target, Version version) if (version == null) return false; + var current = CurrentAction; + if (current != null && current.Target == target && current.Version == version) + return true; + foreach (var action in Actions) { if (action.Target == target && action.Version == version) @@ -207,8 +310,135 @@ public bool IsProcessing(ApiLevelTarget target, Version version) private void Start() { + // already started... + if (SyncFile != null) + return; + if (CurrentAction != null) + return; + + try + { + SyncFile = new StreamWriter(File.Open(SyncFilePath, FileMode.Create, FileAccess.ReadWrite, FileShare.None)); + } + catch (Exception) + { + // ok, probably occupied by another instance of Visual Studio... retry in some time... + return; + } + + lock (GetType()) + { + if (_actions.Count == 0) + return; + + CurrentAction = _actions[0]; + _actions.RemoveAt(0); + Actions = _actions.ToArray(); + + // go-go-go: + NotifyLog(new ApiLevelUpdateLogEventArgs("Starting...")); + CurrentAction.Start(); + } + } + + private void Finished(ActionData action) + { + bool completed = false; - + lock (GetType()) + { + if (CurrentAction == action) + { + CurrentAction = null; + _lastLog = null; + + // and now reload underlying stored lists: + _vm.Reset(action.Target); + completed = true; + } + } + + if (completed) + { + NotifyCompleted(); + } + + // and start the next action from the queue: + Start(); + } + + private void UpdateLastLog(ApiLevelUpdateLogEventArgs e) + { + if (e == null) + return; + + // this method is a bit complex, as logger sends partial data, + // and here we want to maintain the 'full picture': + if (string.IsNullOrEmpty(e.Message) || e.Progress < 0) + { + _lastLog = new ApiLevelUpdateLogEventArgs(string.IsNullOrEmpty(e.Message) ? (_lastLog != null ? _lastLog.Message : null) + : e.Message, + e.Progress < 0 ? (_lastLog != null ? _lastLog.Progress : 0) + : e.Progress, e.CanAbort); + } + else + { + _lastLog = e; + } } + + private void NotifyLog(ApiLevelUpdateLogEventArgs e) + { + var handler = HiddenLog; + UpdateLastLog(e); + + if (handler != null) + handler(this, e); + } + + private void NotifyCompleted() + { + var handler = Completed; + + if (handler != null) + handler(this, EventArgs.Empty); + } + + #region IDisposable Implementation + + public void Dispose() + { + GC.SuppressFinalize(this); + Dispose(true); + } + + private void Dispose(bool disposing) + { + if (disposing) + { + ActionData[] copiedActions; + + lock (GetType()) + { + if (SyncFile != null) + { + SyncFile.Dispose(); + SyncFile = null; + } + + copiedActions = Actions; + _actions.Clear(); + Actions = new ActionData[0]; + + // and abort all actions: + foreach (var action in copiedActions) + { + action.Abort(); + } + } + } + } + + #endregion } } From 5802e1413515171a0a0ca335130c176ce6e21f01 Mon Sep 17 00:00:00 2001 From: Pawel Hofman Date: Tue, 10 Jun 2014 00:38:35 +0200 Subject: [PATCH 183/851] Added parameterless method support in Dispatcher --- .../VSNDK.Package/Tools/EventDispatcher.cs | 39 +++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/src_vs2012/VSNDK.Package/Tools/EventDispatcher.cs b/src_vs2012/VSNDK.Package/Tools/EventDispatcher.cs index 6fc77da2..3f550ff8 100644 --- a/src_vs2012/VSNDK.Package/Tools/EventDispatcher.cs +++ b/src_vs2012/VSNDK.Package/Tools/EventDispatcher.cs @@ -11,6 +11,7 @@ namespace RIM.VSNDK_Package.Tools internal interface IEventDispatcher { void Invoke(EventHandler eventHandler, object sender, T e) where T : EventArgs; + void Invoke(Action action); void Invoke(Action action, T e); } @@ -49,6 +50,21 @@ public void Invoke(EventHandler eventHandler, object sender, T e) where T } } + public void Invoke(Action action) + { + if (action != null) + { + if (_control.InvokeRequired) + { + _control.Invoke(action); + } + else + { + action(); + } + } + } + public void Invoke(Action action, T e) { if (action != null) @@ -86,6 +102,14 @@ public void Invoke(EventHandler eventHandler, object sender, T e) where T } } + public void Invoke(Action action) + { + if (action != null) + { + action(); + } + } + public void Invoke(Action action, T e) { if (action != null) @@ -139,6 +163,21 @@ public void Invoke(EventHandler eventHandler, object sender, T e) where T } } + public void Invoke(Action action) + { + if (action != null) + { + if (_dispacher.CheckAccess()) + { + action(); + } + else + { + _dispacher.BeginInvoke(action); + } + } + } + public void Invoke(Action action, T e) { if (action != null) From da69ba1adf8a650fe4f0bd76883488ec93ed684c Mon Sep 17 00:00:00 2001 From: Pawel Hofman Date: Tue, 10 Jun 2014 00:45:30 +0200 Subject: [PATCH 184/851] Updated continuation and some UI refreshing New installed NDKs and simulators should then appear instantly on most of the screen. --- .../Options/ApiLevelOptionControl.cs | 6 ++ .../Options/Dialogs/InstallForm.cs | 10 ++- .../Dialogs/UpdateManagerStatusForm.cs | 21 ++--- .../VSNDK.Package/ViewModels/UpdateManager.cs | 76 +++++++++++++++---- 4 files changed, 89 insertions(+), 24 deletions(-) diff --git a/src_vs2012/VSNDK.Package/Options/ApiLevelOptionControl.cs b/src_vs2012/VSNDK.Package/Options/ApiLevelOptionControl.cs index 41d5b468..a4839cf2 100644 --- a/src_vs2012/VSNDK.Package/Options/ApiLevelOptionControl.cs +++ b/src_vs2012/VSNDK.Package/Options/ApiLevelOptionControl.cs @@ -16,9 +16,15 @@ public ApiLevelOptionControl() InitializeComponent(); _vm.Dispatcher = EventDispatcher.From(this); + _vm.UpdateManager.Completed += OnApiLevelChanged; PopulateNDKs(true); } + private void OnApiLevelChanged(object sender, EventArgs e) + { + PopulateNDKs(false); + } + private void PopulateNDKs(bool ignoreCurrentSelection) { var currentlySelected = ignoreCurrentSelection ? _vm.ActiveNDK : SelectedNDK; diff --git a/src_vs2012/VSNDK.Package/Options/Dialogs/InstallForm.cs b/src_vs2012/VSNDK.Package/Options/Dialogs/InstallForm.cs index 7b7f5161..6ebdc40f 100644 --- a/src_vs2012/VSNDK.Package/Options/Dialogs/InstallForm.cs +++ b/src_vs2012/VSNDK.Package/Options/Dialogs/InstallForm.cs @@ -43,10 +43,12 @@ public InstallForm(ApiLevelOptionViewModel vm) _vm.NdkListLoaded += NdkListLoaded; _vm.SimulatorListLoaded += SimulatorListLoaded; _vm.RuntimeListLoaded += RuntimeListLoaded; + _vm.UpdateManager.Completed += ApiLevelChanged; UpdateUI(); } + #region Properties /// @@ -84,6 +86,7 @@ protected override void OnClosed(EventArgs e) _vm.NdkListLoaded -= NdkListLoaded; _vm.SimulatorListLoaded -= SimulatorListLoaded; _vm.RuntimeListLoaded -= RuntimeListLoaded; + _vm.UpdateManager.Completed -= ApiLevelChanged; base.OnClosed(e); } @@ -111,6 +114,11 @@ private void RuntimeListLoaded(object sender, EventArgs e) PopulateList(panelAvailableRuntimes, suggested, ApiLevelTarget.Runtime, (info, target) => _vm.GetTask(info, target), "There was an error, while loading list of Runtime Libraries", ApiLevelTask.Refresh); } + private void ApiLevelChanged(object sender, EventArgs e) + { + _vm.Dispatcher.Invoke(UpdateUI); + } + private void PopulateList(Panel panel, IEnumerable items, ApiLevelTarget target, Func actionEvaluation, string missingItemsMessage, ApiLevelTask missingItemsAction) { if (panel == null) @@ -179,7 +187,7 @@ private void ItemOnExecuteAction(object sender, EventArgs eventArgs) var info = form.SelectedItem; _vm.RequestInstall(info, actionTarget); - MessageBoxHelper.Show("Scheduled \"" + info + "\" for installation. Please be patient, this might take some time.", + MessageBoxHelper.Show("Scheduled \"" + info + "\" for installation. Please be patient, this might take some time.\r\n\r\nProgress can be monitored in Status window.", "Update Manager", MessageBoxButtons.OK, MessageBoxIcon.Information); } } diff --git a/src_vs2012/VSNDK.Package/Options/Dialogs/UpdateManagerStatusForm.cs b/src_vs2012/VSNDK.Package/Options/Dialogs/UpdateManagerStatusForm.cs index 91b38cfb..178ae3fe 100644 --- a/src_vs2012/VSNDK.Package/Options/Dialogs/UpdateManagerStatusForm.cs +++ b/src_vs2012/VSNDK.Package/Options/Dialogs/UpdateManagerStatusForm.cs @@ -20,20 +20,22 @@ public UpdateManagerStatusForm(ApiLevelOptionViewModel vm) UpdateUI(); _dispatcher = _vm.Dispatcher ?? EventDispatcher.From(this); - _vm.UpdateManager.Completed += OnActionCompleted; + _vm.UpdateManager.Started += OnActionChanged; + _vm.UpdateManager.Completed += OnActionChanged; _vm.UpdateManager.Log += OnLog; // this will cause the last message to be sent again... } protected override void OnClosed(EventArgs e) { - _vm.UpdateManager.Completed -= OnActionCompleted; + _vm.UpdateManager.Started -= OnActionChanged; + _vm.UpdateManager.Completed -= OnActionChanged; _vm.UpdateManager.Log -= OnLog; base.OnClosed(e); } - private void OnActionCompleted(object sender, EventArgs e) + private void OnActionChanged(object sender, EventArgs e) { - _dispatcher.Invoke(UpdateUI, (object)null); + _dispatcher.Invoke(UpdateUI); } private void OnLog(object sender, ApiLevelUpdateLogEventArgs e) @@ -41,12 +43,13 @@ private void OnLog(object sender, ApiLevelUpdateLogEventArgs e) _dispatcher.Invoke(UpdateLog, e); } - private void UpdateUI(object sender) + private void UpdateUI() { - UpdateUI(); + UpdateList(); + UpdateLog(_vm.UpdateManager.CurrentAction); } - private void UpdateUI() + private void UpdateList() { listActions.Items.Clear(); foreach (var item in _vm.UpdateManager.Actions) @@ -54,7 +57,7 @@ private void UpdateUI() listActions.Items.Add(item); } - UpdateLog(_vm.UpdateManager.CurrentAction); + listActions_SelectedIndexChanged(null, EventArgs.Empty); } private void UpdateLog(ViewModels.UpdateManager.ActionData action) @@ -107,7 +110,7 @@ private void bttDelete_Click(object sender, EventArgs e) if (MessageBoxHelper.Show(action.ToString(), "Do you want to delete this step?", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { action.Delete(); - UpdateUI(); + UpdateList(); } } } diff --git a/src_vs2012/VSNDK.Package/ViewModels/UpdateManager.cs b/src_vs2012/VSNDK.Package/ViewModels/UpdateManager.cs index 14321cc5..f3c1a657 100644 --- a/src_vs2012/VSNDK.Package/ViewModels/UpdateManager.cs +++ b/src_vs2012/VSNDK.Package/ViewModels/UpdateManager.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using System.IO; +using System.Windows.Forms; using RIM.VSNDK_Package.Diagnostics; using RIM.VSNDK_Package.Tools; @@ -170,11 +171,15 @@ public event EventHandler Log remove { HiddenLog -= value; } } + private const int DelayInterval = 30000; // in milisec + + public event EventHandler Started; public event EventHandler Completed; private readonly PackageViewModel _vm; private ApiLevelUpdateLogEventArgs _lastLog; private readonly List _actions; + private Timer _timer; public UpdateManager(PackageViewModel vm, string folder) { @@ -316,20 +321,24 @@ private void Start() if (CurrentAction != null) return; - try - { - SyncFile = new StreamWriter(File.Open(SyncFilePath, FileMode.Create, FileAccess.ReadWrite, FileShare.None)); - } - catch (Exception) - { - // ok, probably occupied by another instance of Visual Studio... retry in some time... - return; - } - lock (GetType()) { if (_actions.Count == 0) return; + if (SyncFile != null) + return; + + try + { + SyncFile = new StreamWriter(File.Open(SyncFilePath, FileMode.Create, FileAccess.ReadWrite, FileShare.None)); + SyncFile.Write(System.Diagnostics.Process.GetCurrentProcess().Id); + } + catch (Exception) + { + // ok, probably occupied by another instance of Visual Studio... retry in some time... + StartLater(); + return; + } CurrentAction = _actions[0]; _actions.RemoveAt(0); @@ -339,10 +348,34 @@ private void Start() NotifyLog(new ApiLevelUpdateLogEventArgs("Starting...")); CurrentAction.Start(); } + + NotifyStarted(); + } + + private void StartLater() + { + if (_timer == null) + { + _timer = new Timer(); + _timer.Interval = DelayInterval; // in milisec + _timer.Tick += TimerOnTick; + _timer.Start(); + } + } + + private void TimerOnTick(object sender, EventArgs e) + { + _timer.Dispose(); + _timer = null; + + Start(); } private void Finished(ActionData action) { + if (SyncFile == null) + return; + bool completed = false; lock (GetType()) @@ -355,6 +388,9 @@ private void Finished(ActionData action) // and now reload underlying stored lists: _vm.Reset(action.Target); completed = true; + + SyncFile.Close(); + SyncFile = null; } } @@ -396,6 +432,14 @@ private void NotifyLog(ApiLevelUpdateLogEventArgs e) handler(this, e); } + private void NotifyStarted() + { + var handler = Started; + + if (handler != null) + handler(this, EventArgs.Empty); + } + private void NotifyCompleted() { var handler = Completed; @@ -416,8 +460,6 @@ private void Dispose(bool disposing) { if (disposing) { - ActionData[] copiedActions; - lock (GetType()) { if (SyncFile != null) @@ -426,9 +468,9 @@ private void Dispose(bool disposing) SyncFile = null; } - copiedActions = Actions; - _actions.Clear(); + ActionData[] copiedActions = Actions; Actions = new ActionData[0]; + _actions.Clear(); // and abort all actions: foreach (var action in copiedActions) @@ -436,6 +478,12 @@ private void Dispose(bool disposing) action.Abort(); } } + + if (_timer != null) + { + _timer.Dispose(); + _timer = null; + } } } From 75bc581714dedec41ab748f964ac6d304b07e203 Mon Sep 17 00:00:00 2001 From: Pawel Hofman Date: Tue, 10 Jun 2014 16:21:13 +0200 Subject: [PATCH 185/851] Removed unnecessary printout --- build.bat | 1 - 1 file changed, 1 deletion(-) diff --git a/build.bat b/build.bat index 0922a960..89a196df 100644 --- a/build.bat +++ b/build.bat @@ -139,7 +139,6 @@ if %ActionGenScripts% equ 0 (goto skip_scripts) echo %actionNo%: Creating installation scripts if %ActionBuildVS2010% equ 0 (if %ActionGenScripts% neq 2 (goto skip_vs2010_scripts)) -echo Template... call :processTemplates 2010 10.0 :skip_vs2010_scripts From 1ce3b00c4916c5a20bb4a31a450e2ee5b8c44bdf Mon Sep 17 00:00:00 2001 From: Pawel Hofman Date: Tue, 10 Jun 2014 16:21:31 +0200 Subject: [PATCH 186/851] Fixed missing bracket in build-system --- .../Microsoft.Cpp.BlackBerrySimulator.default.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/VSNDK.Tasks/BlackBerrySimulator/Microsoft.Cpp.BlackBerrySimulator.default.props b/src/VSNDK.Tasks/BlackBerrySimulator/Microsoft.Cpp.BlackBerrySimulator.default.props index f00e7738..f8cd47d5 100644 --- a/src/VSNDK.Tasks/BlackBerrySimulator/Microsoft.Cpp.BlackBerrySimulator.default.props +++ b/src/VSNDK.Tasks/BlackBerrySimulator/Microsoft.Cpp.BlackBerrySimulator.default.props @@ -21,7 +21,7 @@ Copyright (C) Microsoft Corporation. All rights reserved. $(IntDir) - From 1b68e440e445339adc6acf840180def92bfa8087 Mon Sep 17 00:00:00 2001 From: Pawel Hofman Date: Tue, 10 Jun 2014 16:22:03 +0200 Subject: [PATCH 187/851] Aligned panels to have labels at the same location --- .../Dialogs/RegistrationForm.Designer.cs | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src_vs2012/VSNDK.Package/Options/Dialogs/RegistrationForm.Designer.cs b/src_vs2012/VSNDK.Package/Options/Dialogs/RegistrationForm.Designer.cs index 57866f43..df6e5d1a 100644 --- a/src_vs2012/VSNDK.Package/Options/Dialogs/RegistrationForm.Designer.cs +++ b/src_vs2012/VSNDK.Package/Options/Dialogs/RegistrationForm.Designer.cs @@ -325,9 +325,9 @@ private void InitializeComponent() // this.label13.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); - this.label13.Location = new System.Drawing.Point(15, 73); + this.label13.Location = new System.Drawing.Point(12, 73); this.label13.Name = "label13"; - this.label13.Size = new System.Drawing.Size(519, 36); + this.label13.Size = new System.Drawing.Size(520, 36); this.label13.TabIndex = 2; this.label13.Text = "To complete the registration both - BlackBerry Signer and developer certificate -" + " are required. Certificate will be created automatically here or at BlackBerry 1" + @@ -336,7 +336,7 @@ private void InitializeComponent() // lnkMoreInfo // this.lnkMoreInfo.AutoSize = true; - this.lnkMoreInfo.Location = new System.Drawing.Point(15, 54); + this.lnkMoreInfo.Location = new System.Drawing.Point(12, 54); this.lnkMoreInfo.Name = "lnkMoreInfo"; this.lnkMoreInfo.Size = new System.Drawing.Size(60, 13); this.lnkMoreInfo.TabIndex = 1; @@ -364,7 +364,7 @@ private void InitializeComponent() // label11 // this.label11.AutoSize = true; - this.label11.Location = new System.Drawing.Point(15, 199); + this.label11.Location = new System.Drawing.Point(12, 199); this.label11.Name = "label11"; this.label11.Size = new System.Drawing.Size(80, 13); this.label11.TabIndex = 11; @@ -381,7 +381,7 @@ private void InitializeComponent() // label10 // this.label10.AutoSize = true; - this.label10.Location = new System.Drawing.Point(15, 173); + this.label10.Location = new System.Drawing.Point(12, 173); this.label10.Name = "label10"; this.label10.Size = new System.Drawing.Size(50, 13); this.label10.TabIndex = 9; @@ -399,7 +399,7 @@ private void InitializeComponent() // label9 // this.label9.AutoSize = true; - this.label9.Location = new System.Drawing.Point(15, 147); + this.label9.Location = new System.Drawing.Point(12, 147); this.label9.Name = "label9"; this.label9.Size = new System.Drawing.Size(86, 13); this.label9.TabIndex = 6; @@ -429,7 +429,7 @@ private void InitializeComponent() // // bttCreateSigner // - this.bttCreateSigner.Location = new System.Drawing.Point(18, 259); + this.bttCreateSigner.Location = new System.Drawing.Point(15, 259); this.bttCreateSigner.Name = "bttCreateSigner"; this.bttCreateSigner.Size = new System.Drawing.Size(110, 23); this.bttCreateSigner.TabIndex = 15; @@ -449,7 +449,7 @@ private void InitializeComponent() // label8 // this.label8.AutoSize = true; - this.label8.Location = new System.Drawing.Point(15, 121); + this.label8.Location = new System.Drawing.Point(12, 121); this.label8.Name = "label8"; this.label8.Size = new System.Drawing.Size(80, 13); this.label8.TabIndex = 3; @@ -457,9 +457,9 @@ private void InitializeComponent() // // label7 // - this.label7.Location = new System.Drawing.Point(15, 20); + this.label7.Location = new System.Drawing.Point(12, 20); this.label7.Name = "label7"; - this.label7.Size = new System.Drawing.Size(516, 40); + this.label7.Size = new System.Drawing.Size(520, 40); this.label7.TabIndex = 0; this.label7.Text = "Specify signing properties, that were submitted at BlackBerry CodeSigning page. Y" + "ou should receive required RDK and PBDT files via email before."; @@ -467,7 +467,7 @@ private void InitializeComponent() // label12 // this.label12.AutoSize = true; - this.label12.Location = new System.Drawing.Point(15, 225); + this.label12.Location = new System.Drawing.Point(12, 225); this.label12.Name = "label12"; this.label12.Size = new System.Drawing.Size(94, 13); this.label12.TabIndex = 13; @@ -495,8 +495,8 @@ private void InitializeComponent() this.Controls.Add(this.bttNavigate); this.Controls.Add(this.txtLog); this.Controls.Add(this.bttOK); - this.Controls.Add(this.groupBlackBerry10); this.Controls.Add(this.groupTablet); + this.Controls.Add(this.groupBlackBerry10); this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; this.MaximizeBox = false; this.MinimizeBox = false; From b021f68f95d3c8028401adb409e558369eb6d02e Mon Sep 17 00:00:00 2001 From: Pawel Hofman Date: Tue, 10 Jun 2014 16:52:19 +0200 Subject: [PATCH 188/851] Double-click can work as pressing 'Install' button --- .../Options/Dialogs/InstallConfirmationForm.Designer.cs | 1 + .../Options/Dialogs/InstallConfirmationForm.cs | 9 +++++++++ 2 files changed, 10 insertions(+) diff --git a/src_vs2012/VSNDK.Package/Options/Dialogs/InstallConfirmationForm.Designer.cs b/src_vs2012/VSNDK.Package/Options/Dialogs/InstallConfirmationForm.Designer.cs index 09fc5c55..a86c9a15 100644 --- a/src_vs2012/VSNDK.Package/Options/Dialogs/InstallConfirmationForm.Designer.cs +++ b/src_vs2012/VSNDK.Package/Options/Dialogs/InstallConfirmationForm.Designer.cs @@ -88,6 +88,7 @@ private void InitializeComponent() this.listView.UseCompatibleStateImageBehavior = false; this.listView.View = System.Windows.Forms.View.Details; this.listView.SelectedIndexChanged += new System.EventHandler(this.listView_SelectedIndexChanged); + this.listView.DoubleClick += new System.EventHandler(this.listView_DoubleClick); // // columnHeader1 // diff --git a/src_vs2012/VSNDK.Package/Options/Dialogs/InstallConfirmationForm.cs b/src_vs2012/VSNDK.Package/Options/Dialogs/InstallConfirmationForm.cs index 6f59af06..d857a951 100644 --- a/src_vs2012/VSNDK.Package/Options/Dialogs/InstallConfirmationForm.cs +++ b/src_vs2012/VSNDK.Package/Options/Dialogs/InstallConfirmationForm.cs @@ -58,5 +58,14 @@ private void listView_SelectedIndexChanged(object sender, EventArgs e) { bttInstall.Enabled = listView.SelectedIndices.Count > 0 && listView.SelectedItems[0].SubItems.Count <= 2; } + + private void listView_DoubleClick(object sender, EventArgs e) + { + if (bttInstall.Enabled && SelectedItem != null) + { + DialogResult = bttInstall.DialogResult; + Close(); + } + } } } From 463b202515d766516dca0162b1895eced11ac389 Mon Sep 17 00:00:00 2001 From: Pawel Hofman Date: Tue, 10 Jun 2014 16:52:49 +0200 Subject: [PATCH 189/851] Added another corner case of debug-token data On PlayBook, when a valid debug-token is removed, sometimes it will return 'null' JSON data instead of boolean! --- src_vs2012/VSNDK.Package/Model/DeviceInfo.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src_vs2012/VSNDK.Package/Model/DeviceInfo.cs b/src_vs2012/VSNDK.Package/Model/DeviceInfo.cs index 976dca31..908c33d2 100644 --- a/src_vs2012/VSNDK.Package/Model/DeviceInfo.cs +++ b/src_vs2012/VSNDK.Package/Model/DeviceInfo.cs @@ -345,6 +345,8 @@ private static bool GetBool(string text) // PH: no reason, but sometimes boolean field is presented as JSON (especially debug-token-valid field)... if (string.CompareOrdinal(text, "{}") == 0) return false; + if (string.CompareOrdinal(text, "null") == 0) + return false; throw new FormatException("Invalid boolean value"); } From 22e29eeb3ee97a0320ac51a217a86b83d0a9a3a1 Mon Sep 17 00:00:00 2001 From: Pawel Hofman Date: Tue, 10 Jun 2014 16:54:12 +0200 Subject: [PATCH 190/851] Aligned VS2010 and VS2013 projects --- src/VSNDK.Package/VSNDK.Package.csproj | 79 +++++++++++++++++-- .../Tools/ApiLevelUpdateRunner.cs | 17 ++-- src_vs2013/VSNDK.Package/VSNDK.Package.csproj | 78 ++++++++++++++++-- 3 files changed, 146 insertions(+), 28 deletions(-) diff --git a/src/VSNDK.Package/VSNDK.Package.csproj b/src/VSNDK.Package/VSNDK.Package.csproj index 39cfb518..a14e2fdf 100644 --- a/src/VSNDK.Package/VSNDK.Package.csproj +++ b/src/VSNDK.Package/VSNDK.Package.csproj @@ -162,6 +162,9 @@ Model\ApiInfo.cs + + Model\ApiInfoArray.cs + Model\ApiLevelListTypes.cs @@ -196,6 +199,12 @@ Model\NdkInfo.cs + + Model\RuntimeInfo.cs + + + Model\SimulatorInfo.cs + Options\ApiLevelOptionControl.cs UserControl @@ -262,13 +271,29 @@ Options\Dialogs\DeviceForm.designer.cs DeviceForm.cs - - Options\Dialogs\InstallNdkForm.cs + + Options\Dialogs\InstallConfirmationForm.cs + Form + + + Options\Dialogs\InstallConfirmationForm.designer.cs + InstallConfirmationForm.cs + + + Options\Dialogs\InstallForm.cs Form - - Options\Dialogs\InstallNdkForm.designer.cs - InstallNdkForm.cs + + Options\Dialogs\InstallForm.designer.cs + InstallForm.cs + + + Options\Dialogs\ListItemControl.cs + UserControl + + + Options\Dialogs\ListItemControl.designer.cs + ListItemControl.cs Options\Dialogs\PasswordForm.cs @@ -294,6 +319,14 @@ Options\Dialogs\RegistrationForm.designer.cs RegistrationForm.cs + + Options\Dialogs\UpdateManagerStatusForm.cs + Form + + + Options\Dialogs\UpdateManagerStatusForm.designer.cs + UpdateManagerStatusForm.cs + Options\GeneralOptionControl.cs UserControl @@ -345,6 +378,12 @@ Tools\ApiLevelListLoadRunner.cs + + Tools\ApiLevelUpdateLogEventArgs.cs + + + Tools\ApiLevelUpdateRunner.cs + Tools\ApplicationRemoveRunner.cs @@ -387,9 +426,18 @@ Tools\ToolRunnerStartupEventArgs.cs + + ViewModels\ApiLevelAction.cs + ViewModels\ApiLevelOptionViewModel.cs + + ViewModels\ApiLevelTarget.cs + + + ViewModels\ApiLevelTask.cs + ViewModels\DeveloperDefinition.cs @@ -411,6 +459,9 @@ ViewModels\TargetsOptionViewModel.cs + + ViewModels\UpdateManager.cs + @@ -520,9 +571,17 @@ Options\Dialogs\DeviceForm.resx DeviceForm.cs - - Options\Dialogs\InstallNdkForm.resx - InstallNdkForm.cs + + Options\Dialogs\InstallConfirmationForm.resx + InstallConfirmationForm.cs + + + Options\Dialogs\InstallForm.resx + InstallForm.cs + + + Options\Dialogs\ListItemControl.resx + ListItemControl.cs Options\Dialogs\PasswordForm.resx @@ -536,6 +595,10 @@ Options\Dialogs\RegistrationForm.resx RegistrationForm.cs + + Options\Dialogs\UpdateManagerStatusForm.resx + UpdateManagerStatusForm.cs + Options\GeneralOptionControl.resx GeneralOptionControl.cs diff --git a/src_vs2012/VSNDK.Package/Tools/ApiLevelUpdateRunner.cs b/src_vs2012/VSNDK.Package/Tools/ApiLevelUpdateRunner.cs index 62d48d77..3fc3b32a 100644 --- a/src_vs2012/VSNDK.Package/Tools/ApiLevelUpdateRunner.cs +++ b/src_vs2012/VSNDK.Package/Tools/ApiLevelUpdateRunner.cs @@ -133,9 +133,9 @@ public void Consume(string line) var overallProgress = 10 + (int)((CalculateDownloadProgress() * 70d)); // expected from 10-80% if (file != null) { - const double MegaByte = 1024d * 1024d; - double dProgress = file.Read / MegaByte; - double dSize = (file.Size / MegaByte); + const double megaByte = 1024d * 1024d; + double dProgress = file.Read / megaByte; + double dSize = (file.Size / megaByte); if (dSize < 1) // just a guard, to make it look like, there is always something to download dSize = 1; @@ -182,7 +182,6 @@ public void Consume(string line) { State = LogState.Completed; Notify(line, 100, false); - return; } } @@ -297,7 +296,7 @@ private long GetLong(string text) return 0; } - private static LogFetchFile Find(string text, IReadOnlyCollection files) + private static LogFetchFile Find(string text, ICollection files) { if (string.IsNullOrEmpty(text) || files == null || files.Count == 0) return null; @@ -311,7 +310,7 @@ private static LogFetchFile Find(string text, IReadOnlyCollection return null; } - private static LogFetchFile Get(string text, IReadOnlyCollection files) + private static LogFetchFile Get(string text, ICollection files) { if (string.IsNullOrEmpty(text) || files == null || files.Count == 0) return null; @@ -325,11 +324,6 @@ private static LogFetchFile Get(string text, IReadOnlyCollection f return null; } - private void Notify(string message) - { - Notify(message, -1, true); - } - private void Notify(string message, int progress, bool canAbort) { _parent.CanAbort = canAbort; @@ -502,7 +496,6 @@ protected override void PrepareStarted(int pid) TraceLog.WriteException(ex, "Unable to acquire installation process-id"); } } - } protected override void ProcessOutputLine(string text) diff --git a/src_vs2013/VSNDK.Package/VSNDK.Package.csproj b/src_vs2013/VSNDK.Package/VSNDK.Package.csproj index 48d55c51..5fea7744 100644 --- a/src_vs2013/VSNDK.Package/VSNDK.Package.csproj +++ b/src_vs2013/VSNDK.Package/VSNDK.Package.csproj @@ -269,6 +269,9 @@ Model\ApiInfo.cs + + Model\ApiInfoArray.cs + Model\ApiLevelListTypes.cs @@ -303,6 +306,12 @@ Model\NdkInfo.cs + + Model\RuntimeInfo.cs + + + Model\SimulatorInfo.cs + Options\ApiLevelOptionControl.cs UserControl @@ -369,13 +378,28 @@ Options\Dialogs\DeviceForm.designer.cs DeviceForm.cs - - Options\Dialogs\InstallNdkForm.cs + + Options\Dialogs\InstallConfirmationForm.cs + Form + + + Options\Dialogs\InstallConfirmationForm.designer.cs + InstallConfirmationForm.cs + + + Options\Dialogs\InstallForm.cs Form - - Options\Dialogs\InstallNdkForm.designer.cs - InstallNdkForm.cs + + Options\Dialogs\InstallForm.designer.cs + InstallForm.cs + + + Options\Dialogs\ListItemControl.cs + + + Options\Dialogs\ListItemControl.designer.cs + ListItemControl.cs Options\Dialogs\PasswordForm.cs @@ -401,6 +425,14 @@ Options\Dialogs\RegistrationForm.designer.cs RegistrationForm.cs + + Options\Dialogs\UpdateManagerStatusForm.cs + Form + + + Options\Dialogs\UpdateManagerStatusForm.designer.cs + UpdateManagerStatusForm.cs + Options\GeneralOptionControl.cs UserControl @@ -452,6 +484,12 @@ Tools\ApiLevelListLoadRunner.cs + + Tools\ApiLevelUpdateLogEventArgs.cs + + + Tools\ApiLevelUpdateRunner.cs + Tools\ApplicationRemoveRunner.cs @@ -494,9 +532,18 @@ Tools\ToolRunnerStartupEventArgs.cs + + ViewModels\ApiLevelAction.cs + ViewModels\ApiLevelOptionViewModel.cs + + ViewModels\ApiLevelTarget.cs + + + ViewModels\ApiLevelTask.cs + ViewModels\DeveloperDefinition.cs @@ -518,6 +565,9 @@ ViewModels\TargetsOptionViewModel.cs + + ViewModels\UpdateManager.cs + Templates\VCWizards\BlackBerry\BarDescriptor\Templates\1033\bar-descriptor.cs bar-descriptor.xsd @@ -588,9 +638,17 @@ Options\Dialogs\DeviceForm.resx DeviceForm.cs - - Options\Dialogs\InstallNdkForm.resx - InstallNdkForm.cs + + Options\Dialogs\InstallConfirmationForm.resx + InstallConfirmationForm.cs + + + Options\Dialogs\InstallForm.resx + InstallForm.cs + + + Options\Dialogs\ListItemControl.resx + ListItemControl.cs Options\Dialogs\PasswordForm.resx @@ -604,6 +662,10 @@ Options\Dialogs\RegistrationForm.resx RegistrationForm.cs + + Options\Dialogs\UpdateManagerStatusForm.resx + UpdateManagerStatusForm.cs + Options\GeneralOptionControl.resx GeneralOptionControl.cs From fd0fc97f73b662dd712c7b5eeac4fe30997edeb5 Mon Sep 17 00:00:00 2001 From: Pawel Hofman Date: Tue, 10 Jun 2014 16:54:42 +0200 Subject: [PATCH 191/851] Improve preventing abort of installations --- .../VSNDK.Package/ViewModels/UpdateManager.cs | 26 ++++++++++++++++--- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/src_vs2012/VSNDK.Package/ViewModels/UpdateManager.cs b/src_vs2012/VSNDK.Package/ViewModels/UpdateManager.cs index f3c1a657..3a92a88d 100644 --- a/src_vs2012/VSNDK.Package/ViewModels/UpdateManager.cs +++ b/src_vs2012/VSNDK.Package/ViewModels/UpdateManager.cs @@ -60,9 +60,15 @@ private UpdateManager UpdateManager set; } + public bool IsRunning + { + get { return _runner != null; } + } + public bool CanAbort { - get { return true; } + get; + private set; } public ApiLevelAction Action @@ -102,7 +108,7 @@ internal void Abort() lock (GetType()) { - if (_runner != null) + if (_runner != null && CanAbort) { aborted = _runner.Abort(); } @@ -118,8 +124,8 @@ public void Start() { lock (GetType()) { - // already running? - if (_runner != null) + // do nothing if already running + if (IsRunning) return; _runner = new ApiLevelUpdateRunner(RunnerDefaults.NdkDirectory, Action, Target, Version); @@ -131,6 +137,11 @@ public void Start() private void OnLog(object sender, ApiLevelUpdateLogEventArgs e) { + if (e != null) + { + CanAbort = e.CanAbort; + } + UpdateManager.NotifyLog(e); } @@ -148,6 +159,10 @@ private void OnFinished(object sender, ToolRunnerEventArgs e) public void Delete() { + // don't allow deletion, if already running: + if (IsRunning) + return; + UpdateManager.Remove(this); } } @@ -356,6 +371,9 @@ private void StartLater() { if (_timer == null) { + NotifyLog(new ApiLevelUpdateLogEventArgs("Another instance of Visual Studio is already performing an update. Waiting...", 0, true)); + TraceLog.WriteLine("Another instance of Visual Studio occupies the UpdateManager. Waiting for own time slot..."); + _timer = new Timer(); _timer.Interval = DelayInterval; // in milisec _timer.Tick += TimerOnTick; From 318f1769a03a851b9ebb903140db521923034958 Mon Sep 17 00:00:00 2001 From: Pawel Hofman Date: Sun, 15 Jun 2014 10:30:18 +0200 Subject: [PATCH 192/851] Removed duplicated code of basic functionalities Since new settings has been implemented, it made some of the existing screens obsolete: * debug-token * signing * update-manager * Package.Tests There is still required some coding to add extra startup checks, that were handled by the removed code. --- .../DebugTokenDataTestClass.cs | 180 --- src/VSNDK.Package.Test/SettingsDataTests.cs | 641 --------- .../SigningDataTestClass.cs | 252 ---- .../UpdateManagerDataTestClass.cs | 152 --- .../VSNDK.Package.Test.csproj | 13 +- .../DebugToken/DebugTokenDialog.xaml | 59 - .../DebugToken/DebugTokenDialog.xaml.cs | 143 -- .../DebugToken/Model/DebugTokenData.cs | 866 ------------ src/VSNDK.Package/PkgCmdID.cs | 3 - .../Settings/Model/SettingsData.cs | 432 ------ .../Settings/SettingsDialog.xaml | 49 - .../Settings/SettingsDialog.xaml.cs | 108 -- src/VSNDK.Package/Signing/Browser.Designer.cs | 158 --- src/VSNDK.Package/Signing/Browser.cs | 22 - src/VSNDK.Package/Signing/Browser.resx | 120 -- .../Signing/DeRegisterWindow.xaml | 18 - .../Signing/DeRegisterWindow.xaml.cs | 77 -- .../Signing/Models/SigningData.cs | 449 ------- .../Signing/RegistrationWindow.xaml | 25 - .../Signing/RegistrationWindow.xaml.cs | 84 -- src/VSNDK.Package/Signing/SigningDialog.xaml | 35 - .../Signing/SigningDialog.xaml.cs | 126 -- .../UpdateManager/Model/UpdateManagerData.cs | 1185 ----------------- .../UpdateManager/SimulatorManager.xaml | 61 - .../UpdateManager/SimulatorManager.xaml.cs | 162 --- .../UpdateManager/UpdateManager.xaml | 48 - .../UpdateManager/UpdateManager.xaml.cs | 216 --- .../UpdateManager/UpdateManagerDialog.xaml | 30 - .../UpdateManager/UpdateManagerDialog.xaml.cs | 161 --- src/VSNDK.Package/VSNDK.Package.csproj | 69 - src/VSNDK.Package/VSNDK.PackagePackage.cs | 905 +------------ src/VSNDK.Package/ViewModel.cs | 11 +- .../VSNDK.Package.Test.csproj | 12 - .../VSNDK.Package/VSNDK.Package.Menu.vsct | 27 - src_vs2012/VSNDK.Package/VSNDK.Package.csproj | 96 -- src_vs2013/VSNDK.AddIn/VSNDK.AddIn.xml | 10 + .../VSNDK.Package.Test.csproj | 19 +- src_vs2013/VSNDK.Package/VSNDK.Package.csproj | 97 +- 38 files changed, 44 insertions(+), 7077 deletions(-) delete mode 100644 src/VSNDK.Package.Test/DebugTokenDataTestClass.cs delete mode 100644 src/VSNDK.Package.Test/SettingsDataTests.cs delete mode 100644 src/VSNDK.Package.Test/SigningDataTestClass.cs delete mode 100644 src/VSNDK.Package.Test/UpdateManagerDataTestClass.cs delete mode 100644 src/VSNDK.Package/DebugToken/DebugTokenDialog.xaml delete mode 100644 src/VSNDK.Package/DebugToken/DebugTokenDialog.xaml.cs delete mode 100644 src/VSNDK.Package/DebugToken/Model/DebugTokenData.cs delete mode 100644 src/VSNDK.Package/Settings/Model/SettingsData.cs delete mode 100644 src/VSNDK.Package/Settings/SettingsDialog.xaml delete mode 100644 src/VSNDK.Package/Settings/SettingsDialog.xaml.cs delete mode 100644 src/VSNDK.Package/Signing/Browser.Designer.cs delete mode 100644 src/VSNDK.Package/Signing/Browser.cs delete mode 100644 src/VSNDK.Package/Signing/Browser.resx delete mode 100644 src/VSNDK.Package/Signing/DeRegisterWindow.xaml delete mode 100644 src/VSNDK.Package/Signing/DeRegisterWindow.xaml.cs delete mode 100644 src/VSNDK.Package/Signing/Models/SigningData.cs delete mode 100644 src/VSNDK.Package/Signing/RegistrationWindow.xaml delete mode 100644 src/VSNDK.Package/Signing/RegistrationWindow.xaml.cs delete mode 100644 src/VSNDK.Package/Signing/SigningDialog.xaml delete mode 100644 src/VSNDK.Package/Signing/SigningDialog.xaml.cs delete mode 100644 src/VSNDK.Package/UpdateManager/Model/UpdateManagerData.cs delete mode 100644 src/VSNDK.Package/UpdateManager/SimulatorManager.xaml delete mode 100644 src/VSNDK.Package/UpdateManager/SimulatorManager.xaml.cs delete mode 100644 src/VSNDK.Package/UpdateManager/UpdateManager.xaml delete mode 100644 src/VSNDK.Package/UpdateManager/UpdateManager.xaml.cs delete mode 100644 src/VSNDK.Package/UpdateManager/UpdateManagerDialog.xaml delete mode 100644 src/VSNDK.Package/UpdateManager/UpdateManagerDialog.xaml.cs diff --git a/src/VSNDK.Package.Test/DebugTokenDataTestClass.cs b/src/VSNDK.Package.Test/DebugTokenDataTestClass.cs deleted file mode 100644 index 8fc1d0de..00000000 --- a/src/VSNDK.Package.Test/DebugTokenDataTestClass.cs +++ /dev/null @@ -1,180 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using NUnit.Framework; -using RIM.VSNDK_Package.DebugToken.Model; -using Microsoft.Win32; - -namespace VSNDK.Package.Test -{ - [TestFixture] - public class DebugTokenDataTestClass - { - private DebugTokenData DebugTokenObject; - - /// - /// Setup for testing - /// - [SetUp] - public void Setup() - { - /// Create Object - DebugTokenObject = new RIM.VSNDK_Package.DebugToken.Model.DebugTokenData(); - - /// Set Paths - This would normally be done by the creation of the package. - RegistryKey rkHKCU = Registry.CurrentUser; - RegistryKey rkNDKPath = null; - string qnx_target = ""; - string qnx_host = ""; - - rkNDKPath = rkHKCU.CreateSubKey("Software\\BlackBerry\\BlackBerryVSPlugin"); - qnx_host = rkNDKPath.GetValue("NDKHostPath").ToString(); - qnx_target = rkNDKPath.GetValue("NDKHostPath").ToString(); - - string qnx_config = System.Environment.GetFolderPath(System.Environment.SpecialFolder.LocalApplicationData) + @"\Research In Motion\BlackBerry Native SDK"; - - System.Environment.SetEnvironmentVariable("QNX_TARGET", qnx_target); - System.Environment.SetEnvironmentVariable("QNX_HOST", qnx_host); - System.Environment.SetEnvironmentVariable("QNX_CONFIGURATION", qnx_config); - - string ndkpath = string.Format(@"{0}/usr/bin;{1}\bin;{0}/usr/qde/eclipse/jre/bin;", qnx_host, qnx_config) + System.Environment.GetEnvironmentVariable("PATH"); - System.Environment.SetEnvironmentVariable("PATH", ndkpath); - } - - /// - /// Test for constructor - /// - [TestCase] - public void DebugTokenDataConstructorTest() - { - /// Verify Test Case - Assert.IsNotNull(DebugTokenObject); - } - - /// - /// Test what happens when Signing Certificate is unset. - /// - [TestCase] - public void CreateDebugToken_NoCert_Test() - { - /// Initialize Test Case - DebugTokenObject.CertPath = ""; - bool result = DebugTokenObject.createDebugToken(); - - /// Verify Test Case - Assert.IsFalse(result); - } - - /// - /// Test what happens when an invalid Key Store Password is sent - /// - [TestCase] - public void CreateDebugToken_InvalidKeyStore_Test() - { - /// Initialize Test Case - DebugTokenObject.KeyStorePassword = "invalid"; - bool result = DebugTokenObject.createDebugToken(); - - /// Verify Test Case - Assert.IsFalse(result); - } - - /// - /// Test what happens when an invalid Signing certificate path is sent - /// - [TestCase] - public void CreateDebugToken_InvalidCertPath_Test() - { - /// Initialize Test Case - DebugTokenObject.CertPath = @"C:\"; - bool result = DebugTokenObject.createDebugToken(); - - /// Verify Test Case - Assert.IsFalse(result); - } - - /// - /// Test what happens when an invalid Device PIN is sent - /// - [TestCase] - public void CreateDebugToken_InvalidDevicePIN_Test() - { - /// Initialize Test Case - DebugTokenObject.DevicePIN = "error"; - bool result = DebugTokenObject.createDebugToken(); - - /// Verify Test Case - Assert.IsFalse(result); - } - - /// - /// Test success test - /// - [TestCase] - public void CreateDebugToken_Success_Test() - { - - bool result = DebugTokenObject.createDebugToken(); - - /// Verify Test Case - Assert.IsTrue(result); - - } - - /// - /// Test what happens when DeviceID is empty - /// - [TestCase] - public void getDevicePin_EmptyDeviceID_Test() - { - /// Initialize Test Case - DebugTokenObject.DeviceIP = ""; - bool result = DebugTokenObject.getDeviceInfo(); - - /// Verify Test Case - Assert.IsFalse(result); - } - - /// - /// Test what happens when a successful command is run - /// - [TestCase] - public void getDevicePin_Success_Test() - { - /// Initialize Test Case - bool result = DebugTokenObject.getDeviceInfo(); - - /// Verify Test Case - Assert.IsTrue(result); - } - - /// - /// Test what happens when an invalid password is sent - /// - [TestCase] - public void getDevicePin_InvalidPassword_Test() - { - /// Initialize Test Case - DebugTokenObject.DevicePassword = "error"; - bool result = DebugTokenObject.getDeviceInfo(); - - /// Verify Test Case - Assert.IsFalse(result); - } - - /// - /// Test what happens when an invalid Device IP is sent - /// - [TestCase] - public void getDevicePin_InvalidDeviceIP_Test() - { - /// Initialize Test Case - DebugTokenObject.DeviceIP = "1.1.1.1"; - bool result = DebugTokenObject.getDeviceInfo(); - - /// Verify Test Case - Assert.IsFalse(result); - } - } -} diff --git a/src/VSNDK.Package.Test/SettingsDataTests.cs b/src/VSNDK.Package.Test/SettingsDataTests.cs deleted file mode 100644 index 303f817c..00000000 --- a/src/VSNDK.Package.Test/SettingsDataTests.cs +++ /dev/null @@ -1,641 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using NUnit.Framework; -using RIM.VSNDK_Package.Settings.Models; -using RIM.VSNDK_Package; -using Microsoft.Win32; -using System.Collections; -using System.IO; -using System.Xml; -using System.Windows.Data; - -namespace VSNDK.Package.Test -{ - [TestFixture] - class SettingsDataTests - { - private SettingsData settingsDataObject; - - /// - /// Setup for testing - /// - [TestFixtureSetUp] - public void TFSetup() - { - /// Create Object - settingsDataObject = new SettingsData(); - - /// Backup NDK Entries - string[] dirPaths = new string[2]; - dirPaths[0] = Path.GetPathRoot(Environment.GetFolderPath(Environment.SpecialFolder.System)) + @"bbndk_vs\..\qconfig\"; - dirPaths[1] = System.Environment.GetFolderPath(System.Environment.SpecialFolder.LocalApplicationData) + @"\Research In Motion\BlackBerry Native SDK\qconfig\"; - - for (int i = 0; i < 2; i++) - { - if (!Directory.Exists(dirPaths[i])) - continue; - - string[] filePaths = Directory.GetFiles(dirPaths[i], "*.xml"); - - foreach (string file in filePaths) - { - try - { - File.Move(file, file.Replace(".xml", ".tmp")); - } - catch - { - break; - } - } - } - } - - - /// - /// Setup for testing - /// - [TestFixtureTearDown] - public void TFTearDown() - { - /// Backup NDK Entries - string[] dirPaths = new string[2]; - dirPaths[0] = Path.GetPathRoot(Environment.GetFolderPath(Environment.SpecialFolder.System)) + @"bbndk_vs\..\qconfig\"; - dirPaths[1] = System.Environment.GetFolderPath(System.Environment.SpecialFolder.LocalApplicationData) + @"\Research In Motion\BlackBerry Native SDK\qconfig\"; - - for (int i = 0; i < 2; i++) - { - if (!Directory.Exists(dirPaths[i])) - continue; - - string[] filePaths = Directory.GetFiles(dirPaths[i], "*.tmp"); - - foreach (string file in filePaths) - { - try - { - File.Move(file, file.Replace(".tmp", ".xml")); - } - catch - { - break; - } - } - } - } - - - /// - /// Test function with key values not set. - /// - [TestCase] - public void GetDeviceInfoTest_KeyValuesNotSet() - { - /// Setup - settingsDataObject.DeviceIP = ""; - settingsDataObject.DevicePassword = ""; - - string keyName = @"Software\BlackBerry\BlackBerryVSPlugin"; - using (RegistryKey key = Registry.CurrentUser.OpenSubKey(keyName, true)) - { - if (key == null) - { - // Do Nothing - } - else - { - - key.DeleteValue("device_password", false); - key.DeleteValue("device_IP", false); - } - } - - settingsDataObject.GetDeviceInfo(); - - Assert.IsNullOrEmpty(settingsDataObject.DeviceIP, "Device IP is not empty or null, " + settingsDataObject.DeviceIP); - Assert.IsNullOrEmpty(settingsDataObject.DevicePassword, "Device Password is not empty or null, " + settingsDataObject.DevicePassword); - } - - /// - /// Test function with keys set. - /// - [TestCase] - public void GetDeviceInfoTest_KeyValuesSet() - { - string ipAddr = "127.0.0.1"; - string password = "password"; - - /// Setup - settingsDataObject.DeviceIP = ""; - settingsDataObject.DevicePassword = ""; - - - string keyName = @"Software\BlackBerry\BlackBerryVSPlugin"; - using (RegistryKey key = Registry.CurrentUser.OpenSubKey(keyName, true)) - { - if (key == null) - { - // Do Nothing - } - else - { - key.SetValue("device_password", GlobalFunctions.Encrypt(password), RegistryValueKind.String); - key.SetValue("device_IP", ipAddr, RegistryValueKind.String); - } - } - - settingsDataObject.GetDeviceInfo(); - - Assert.IsTrue(settingsDataObject.DeviceIP == ipAddr , "Device IP value is not equal to test value, " + ipAddr + "!= " + settingsDataObject.DeviceIP); - Assert.IsTrue(settingsDataObject.DevicePassword == password, "Device Password value is not equal to test value, " + password + " != " + settingsDataObject.DevicePassword); - } - - /// - /// Test function to set device info - /// - [TestCase] - public void SetDeviceInfoTest() - { - string deviceIP = "127.0.0.1"; - string devicePassword = "password"; - - /// Setup - settingsDataObject.DeviceIP = deviceIP; - settingsDataObject.DevicePassword = devicePassword; - - settingsDataObject.SetDeviceInfo(); - - - string keyName = @"Software\BlackBerry\BlackBerryVSPlugin"; - using (RegistryKey key = Registry.CurrentUser.OpenSubKey(keyName, true)) - { - if (key == null) - { - // Do Nothing - } - else - { - Assert.IsTrue(deviceIP == key.GetValue("device_IP").ToString(), "Device IP value is not equal to test value, " + deviceIP + "!= " + key.GetValue("device_IP").ToString()); - Assert.IsTrue(devicePassword == GlobalFunctions.Decrypt(key.GetValue("device_password").ToString()), "Device Password value is not equal to test value, " + devicePassword + " != " + GlobalFunctions.Decrypt(key.GetValue("device_password").ToString())); - } - } - - } - - /// - /// Test function with key value not set - /// - [TestCase] - public void GetSimulatorInfoTest_KeyValuesNotSet() - { - /// Setup - settingsDataObject.SimulatorIP = ""; - settingsDataObject.SimulatorPassword = ""; - - string keyName = @"Software\BlackBerry\BlackBerryVSPlugin"; - using (RegistryKey key = Registry.CurrentUser.OpenSubKey(keyName, true)) - { - if (key == null) - { - // Do Nothing - } - else - { - - key.DeleteValue("simulator_password", false); - key.DeleteValue("simulator_IP", false); - } - } - - settingsDataObject.GetSimulatorInfo(); - - Assert.IsNullOrEmpty(settingsDataObject.SimulatorIP, "Simulator IP is not empty or null, " + settingsDataObject.SimulatorIP); - Assert.IsNullOrEmpty(settingsDataObject.SimulatorPassword, "Simulator Password is not empty or null, " + settingsDataObject.SimulatorPassword); - } - - /// - /// Test function with key values set - /// - [TestCase] - public void GetSimulatorInfoTest_KeyValuesSet() - { - string ipAddr = "127.0.0.1"; - string password = "password"; - - /// Setup - settingsDataObject.SimulatorIP = ""; - settingsDataObject.SimulatorPassword = ""; - - - string keyName = @"Software\BlackBerry\BlackBerryVSPlugin"; - using (RegistryKey key = Registry.CurrentUser.OpenSubKey(keyName, true)) - { - if (key == null) - { - // Do Nothing - } - else - { - key.SetValue("simulator_password", GlobalFunctions.Encrypt(password), RegistryValueKind.String); - key.SetValue("simulator_IP", ipAddr, RegistryValueKind.String); - } - } - - settingsDataObject.GetSimulatorInfo(); - - Assert.IsTrue(settingsDataObject.SimulatorIP == ipAddr , "Simulator IP value is not equal to test value, " + ipAddr + "!= " + settingsDataObject.SimulatorIP); - Assert.IsTrue(settingsDataObject.SimulatorPassword == password, "Simulator Password value is not equal to test value, " + password + " != " + settingsDataObject.SimulatorPassword); - } - - /// - /// Test function to set simulator info - /// - [TestCase] - public void SetSimulatorInfoTest() - { - string simulatorIP = "127.0.0.1"; - string simulatorPassword = "password"; - - /// Setup - settingsDataObject.SimulatorIP = simulatorIP; - settingsDataObject.SimulatorPassword = simulatorPassword; - - settingsDataObject.SetSimulatorInfo(); - - - string keyName = @"Software\BlackBerry\BlackBerryVSPlugin"; - using (RegistryKey key = Registry.CurrentUser.OpenSubKey(keyName, true)) - { - if (key == null) - { - // Do Nothing - } - else - { - Assert.IsTrue(simulatorIP == key.GetValue("simulator_IP").ToString(), "Simulator IP value is not equal to test value, " + simulatorIP + "!= " + key.GetValue("simulator_IP").ToString()); - Assert.IsTrue(simulatorPassword == GlobalFunctions.Decrypt(key.GetValue("simulator_password").ToString()), "Simulator Password value is not equal to test value, " + simulatorPassword + " != " + GlobalFunctions.Decrypt(key.GetValue("simulator_password").ToString())); - } - } - - } - - /// - /// Test function with key value not set - /// - [TestCase] - public void GetNDKPathTest_KeyValuesNotSet() - { - /// Setup - settingsDataObject.HostPath = ""; - settingsDataObject.TargetPath = ""; - - string keyName = @"Software\BlackBerry\BlackBerryVSPlugin"; - using (RegistryKey key = Registry.CurrentUser.OpenSubKey(keyName, true)) - { - if (key == null) - { - // Do Nothing - } - else - { - - key.DeleteValue("NDKHostPath", false); - key.DeleteValue("NDKTargetPath", false); - } - } - - settingsDataObject.GetNDKPath(); - - Assert.IsNullOrEmpty(settingsDataObject.HostPath, "Host Path is not empty or null, " + settingsDataObject.HostPath); - Assert.IsNullOrEmpty(settingsDataObject.TargetPath, "Target Path is not empty or null, " + settingsDataObject.TargetPath); - } - - /// - /// Test function with key values set - /// - [TestCase] - public void GetNDKPathTest_KeyValuesSet() - { - string hostPath = @"C:\bbndk_vs\host\"; - string targetPath = @"C:\bbndk_vs\target\"; - - /// Setup - settingsDataObject.HostPath = ""; - settingsDataObject.TargetPath = ""; - - - string keyName = @"Software\BlackBerry\BlackBerryVSPlugin"; - using (RegistryKey key = Registry.CurrentUser.OpenSubKey(keyName, true)) - { - if (key == null) - { - // Do Nothing - } - else - { - key.SetValue("NDKHostPath", hostPath, RegistryValueKind.String); - key.SetValue("NDKTargetPath", targetPath, RegistryValueKind.String); - } - } - - settingsDataObject.GetNDKPath(); - - Assert.IsTrue(settingsDataObject.HostPath == hostPath, "Host Path value is not equal to test value, " + hostPath + "!= " + settingsDataObject.HostPath); - Assert.IsTrue(settingsDataObject.TargetPath == targetPath, "Target Path value is not equal to test value, " + targetPath + " != " + settingsDataObject.TargetPath); - } - - /// - /// Test function with valid version number - /// - [TestCase] - public void GetAPINameTest_ValidVersion() - { - string version = "10.2.0.1155"; - string name = "BlackBerry Native SDK 10.2"; - - string result = settingsDataObject.GetAPIName(version); - - Assert.IsTrue(result == name, "API Name does not matched expected result., " + result + "!= " + name); - } - - /// - /// Test function with invalid version number - /// - [TestCase] - public void GetAPINameTest_InvalidVersion() - { - string version = "1.1.1.1"; - string name = ""; - - string result = settingsDataObject.GetAPIName(version); - - Assert.IsTrue(result == name, "API Name does not matched expected result., " + result + "!= " + name); - } - - /// - /// Test function with no API's - /// - [TestCase] - public void RefreshScreen_NoAPIs() - { - settingsDataObject.RefreshScreen(); - - Assert.IsTrue(settingsDataObject.NDKEntries.Count == 0, "NDK Entries should be empty. "); - } - - /// - /// Test function with a single API in standard folder - /// - [TestCase] - public void RefreshScreen_APIs1() - { - string version = "10.2.0.1155"; - - GenerateXMLFiles(Path.GetPathRoot(Environment.GetFolderPath(Environment.SpecialFolder.System)) + @"bbndk_vs\..\qconfig\", version); - - settingsDataObject.RefreshScreen(); - - Assert.IsTrue(settingsDataObject.NDKEntries.Count == 1, "Number of Entries is unexpected. "); - Assert.IsTrue(((NDKEntryClass)settingsDataObject.NDKEntries.GetItemAt(0)).HostPath == @"C:/bbndk_vs/host_" + version.Replace('.', '_') + @"/win32/x86", "Host Path is not expected"); - Assert.IsTrue(((NDKEntryClass)settingsDataObject.NDKEntries.GetItemAt(0)).TargetPath == @"C:/bbndk_vs/target_" + version.Replace('.', '_') + @"/win32/qnx6", "Target Path is not expected"); - Assert.IsTrue(((NDKEntryClass)settingsDataObject.NDKEntries.GetItemAt(0)).NDKName == "BlackBerry Native SDK 10.2", "NDK Name is not expected"); - - RemoveXmlFiles(); - } - - /// - /// Test function with a single API in momentics folder - /// - [TestCase] - public void RefreshScreen_APIs2() - { - string version = "10.2.0.1155"; - - GenerateXMLFiles(Path.GetPathRoot(Environment.GetFolderPath(Environment.SpecialFolder.System)) + @"bbndk_vs\..\qconfig\", version); - - settingsDataObject.RefreshScreen(); - - Assert.IsTrue(settingsDataObject.NDKEntries.Count == 1, "Number of Entries is unexpected. "); - Assert.IsTrue(((NDKEntryClass)settingsDataObject.NDKEntries.GetItemAt(0)).HostPath == @"C:/bbndk_vs/host_" + version.Replace('.', '_') + @"/win32/x86", "Host Path is not expected"); - Assert.IsTrue(((NDKEntryClass)settingsDataObject.NDKEntries.GetItemAt(0)).TargetPath == @"C:/bbndk_vs/target_" + version.Replace('.', '_') + @"/win32/qnx6", "Target Path is not expected"); - Assert.IsTrue(((NDKEntryClass)settingsDataObject.NDKEntries.GetItemAt(0)).NDKName == "BlackBerry Native SDK 10.2", "NDK Name is not expected"); - - RemoveXmlFiles(); - } - - /// - /// Test function with multiple APIs - /// - [TestCase] - public void RefreshScreen_APIs3() - { - string version = "10.2.0.1155"; - string version2 = "10.2.0.1200"; - - GenerateXMLFiles(System.Environment.GetFolderPath(System.Environment.SpecialFolder.LocalApplicationData) + @"\Research In Motion\BlackBerry Native SDK\qconfig\", version2); - GenerateXMLFiles(Path.GetPathRoot(Environment.GetFolderPath(Environment.SpecialFolder.System)) + @"bbndk_vs\..\qconfig\", version); - - settingsDataObject.RefreshScreen(); - - Assert.IsTrue(settingsDataObject.NDKEntries.Count == 2, "Number of Entries is unexpected. "); - Assert.IsTrue(((NDKEntryClass)settingsDataObject.NDKEntries.GetItemAt(0)).HostPath == @"C:/bbndk_vs/host_" + version.Replace('.', '_') + @"/win32/x86", "Host Path is not expected"); - Assert.IsTrue(((NDKEntryClass)settingsDataObject.NDKEntries.GetItemAt(0)).TargetPath == @"C:/bbndk_vs/target_" + version.Replace('.', '_') + @"/win32/qnx6", "Target Path is not expected"); - Assert.IsTrue(((NDKEntryClass)settingsDataObject.NDKEntries.GetItemAt(0)).NDKName == "BlackBerry Native SDK 10.2", "NDK Name is not expected"); - Assert.IsTrue(((NDKEntryClass)settingsDataObject.NDKEntries.GetItemAt(1)).HostPath == @"C:/bbndk_vs/host_" + version2.Replace('.', '_') + @"/win32/x86", "Host Path is not expected"); - Assert.IsTrue(((NDKEntryClass)settingsDataObject.NDKEntries.GetItemAt(1)).TargetPath == @"C:/bbndk_vs/target_" + version2.Replace('.', '_') + @"/win32/qnx6", "Target Path is not expected"); - Assert.IsTrue(((NDKEntryClass)settingsDataObject.NDKEntries.GetItemAt(1)).NDKName == "BlackBerry Native SDK 10.2", "NDK Name is not expected"); - - RemoveXmlFiles(); - } - - /// - /// Test function for selecting no API - /// - [TestCase] - public void RefreshScreen_SelectedAPI1() - { - string version = "10.2.0.1155"; - string version2 = "10.2.0.1200"; - - GenerateXMLFiles(System.Environment.GetFolderPath(System.Environment.SpecialFolder.LocalApplicationData) + @"\Research In Motion\BlackBerry Native SDK\qconfig\", version2); - GenerateXMLFiles(Path.GetPathRoot(Environment.GetFolderPath(Environment.SpecialFolder.System)) + @"bbndk_vs\..\qconfig\", version); - - string keyName = @"Software\BlackBerry\BlackBerryVSPlugin"; - using (RegistryKey key = Registry.CurrentUser.OpenSubKey(keyName, true)) - { - if (key == null) - { - // Do Nothing - } - else - { - key.SetValue("NDKHostPath", "", RegistryValueKind.String); - key.SetValue("NDKTargetPath", "", RegistryValueKind.String); - } - } - - settingsDataObject.RefreshScreen(); - - Assert.IsTrue(settingsDataObject.NDKEntryClass.HostPath == "", "Host path is not blank"); - Assert.IsTrue(settingsDataObject.NDKEntryClass.TargetPath == "", "Target path is not blank"); - Assert.IsTrue(settingsDataObject.NDKEntryClass.NDKName == "", "NDK name is not blank"); - - RemoveXmlFiles(); - } - - - /// - /// Test function for selecting a single api - /// - [TestCase] - public void RefreshScreen_SelectedAPI2() - { - string version = "10.2.0.1155"; - string version2 = "10.2.0.1200"; - - GenerateXMLFiles(System.Environment.GetFolderPath(System.Environment.SpecialFolder.LocalApplicationData) + @"\Research In Motion\BlackBerry Native SDK\qconfig\", version2); - GenerateXMLFiles(Path.GetPathRoot(Environment.GetFolderPath(Environment.SpecialFolder.System)) + @"bbndk_vs\..\qconfig\", version); - - string keyName = @"Software\BlackBerry\BlackBerryVSPlugin"; - using (RegistryKey key = Registry.CurrentUser.OpenSubKey(keyName, true)) - { - if (key == null) - { - // Do Nothing - } - else - { - key.SetValue("NDKHostPath", @"C:/bbndk_vs/host_" + version.Replace('.', '_') + @"/win32/x86", RegistryValueKind.String); - key.SetValue("NDKTargetPath", @"C:/bbndk_vs/target_" + version.Replace('.', '_') + @"/win32/qnx6", RegistryValueKind.String); - } - } - - settingsDataObject.RefreshScreen(); - - Assert.IsTrue(settingsDataObject.NDKEntryClass.HostPath == @"C:/bbndk_vs/host_" + version.Replace('.', '_') + @"/win32/x86", "Host path is not " + @"C:/bbndk_vs/host_" + version.Replace('.', '_') + @"/win32/x86"); - Assert.IsTrue(settingsDataObject.NDKEntryClass.TargetPath == @"C:/bbndk_vs/target_" + version.Replace('.', '_') + @"/win32/qnx6", "Target path is not " + @"C:/bbndk_vs/target_" + version.Replace('.', '_') + @"/win32/qnx6"); - Assert.IsTrue(settingsDataObject.NDKEntryClass.NDKName == "BlackBerry Native SDK 10.2", "BlackBerry Native SDK 10.2"); - - RemoveXmlFiles(); - } - - /// - /// Test the setting of the NDK Paths - /// - [TestCase] - public void TC_setNDKPaths() - { - // Initialize Test - string targetPath = ((NDKEntryClass)settingsDataObject.NDKEntries.GetItemAt(0)).TargetPath; - string hostPath = ((NDKEntryClass)settingsDataObject.NDKEntries.GetItemAt(0)).HostPath; - string qnx_config = System.Environment.GetFolderPath(System.Environment.SpecialFolder.LocalApplicationData) + @"\Research In Motion\BlackBerry Native SDK"; - - settingsDataObject.NDKEntryClass = (NDKEntryClass)settingsDataObject.NDKEntries.GetItemAt(0); - - RegistryKey regKeyCurrentUser = Registry.CurrentUser; - RegistryKey regKey = regKeyCurrentUser.CreateSubKey("Software\\BlackBerry\\BlackBerryVSPlugin"); - regKey.SetValue("NDKTargetPath", ""); - regKey.SetValue("NDKHostPath", ""); - - // Run Test - settingsDataObject.SetNDKPaths(); - - // Validate Test - Assert.IsTrue(regKey.GetValue("NDKHostPath").ToString() == hostPath, "Host path does not match expected result"); - Assert.IsTrue(regKey.GetValue("NDKTargetPath").ToString() == targetPath, "Target path does not match expected result"); - Assert.IsTrue(System.Environment.GetEnvironmentVariable("QNX_TARGET") == targetPath, "QNX_TARGET system variable is not match expected result"); - Assert.IsTrue(System.Environment.GetEnvironmentVariable("QNX_HOST") == hostPath, "QNX_HOST system variable is not match expected result"); - Assert.IsTrue(System.Environment.GetEnvironmentVariable("QNX_CONFIGURATION") == qnx_config, "QNX_CONFIGURATION system variable is not match expected result"); - Assert.IsTrue(System.Environment.GetEnvironmentVariable("PATH").Contains(hostPath), "Path system variable does not contain host path"); - Assert.IsTrue(System.Environment.GetEnvironmentVariable("PATH").Contains(qnx_config), "Path system variable does not contain config path"); - } - - /// - /// Helper function to generate XML Files - /// - /// - private void GenerateXMLFiles(string path, string version) - { - XmlDocument doc = new XmlDocument(); - XmlNode docNode = doc.CreateXmlDeclaration("1.0", "UTF-8", "no"); - doc.AppendChild(docNode); - - XmlNode sysDefNode = doc.CreateElement("qnxSystemDefinition"); - doc.AppendChild(sysDefNode); - - XmlNode installationNode = doc.CreateElement("installation"); - sysDefNode.AppendChild(installationNode); - - XmlNode baseNode = doc.CreateElement("base"); - baseNode.InnerText = @"C:/bbndk_vs"; - installationNode.AppendChild(baseNode); - - XmlNode hostNode = doc.CreateElement("host"); - hostNode.InnerText = @"C:/bbndk_vs/host_" + version.Replace('.', '_') + @"/win32/x86"; - installationNode.AppendChild(hostNode); - - XmlNode nameNode = doc.CreateElement("name"); - nameNode.InnerText = "BlackBerry Native SDK 10.2"; - installationNode.AppendChild(nameNode); - - XmlNode targetNode = doc.CreateElement("target"); - targetNode.InnerText = @"C:/bbndk_vs/target_" + version.Replace('.', '_') + @"/win32/qnx6"; - installationNode.AppendChild(targetNode); - - XmlNode versionNode = doc.CreateElement("version"); - versionNode.InnerText = version; - installationNode.AppendChild(versionNode); - - XmlNode annotationNode = doc.CreateElement("annotation"); - installationNode.AppendChild(annotationNode); - - XmlNode appInfoNode = doc.CreateElement("appInfo"); - XmlAttribute appInfoAttribute = doc.CreateAttribute("source"); - appInfoAttribute.Value = "p2install"; - appInfoNode.Attributes.Append(appInfoAttribute); - annotationNode.AppendChild(appInfoNode); - - XmlNode dversionNode = doc.CreateElement("detailedVersion"); - dversionNode.InnerText = version; - appInfoNode.AppendChild(dversionNode); - - Directory.CreateDirectory(path); - doc.Save(path + version + ".xml"); - } - - /// - /// Helper function to remove test xml files - /// - private void RemoveXmlFiles() - { - /// Remove NDK Entries - string[] dirPaths = new string[2]; - dirPaths[0] = Path.GetPathRoot(Environment.GetFolderPath(Environment.SpecialFolder.System)) + @"bbndk_vs\..\qconfig\"; - dirPaths[1] = System.Environment.GetFolderPath(System.Environment.SpecialFolder.LocalApplicationData) + @"\Research In Motion\BlackBerry Native SDK\qconfig\"; - - for (int i = 0; i < 2; i++) - { - if (!Directory.Exists(dirPaths[i])) - continue; - - string[] filePaths = Directory.GetFiles(dirPaths[i], "*.xml"); - - foreach (string file in filePaths) - { - try - { - File.Delete(file); - } - catch - { - break; - } - } - } - } - - - } -} diff --git a/src/VSNDK.Package.Test/SigningDataTestClass.cs b/src/VSNDK.Package.Test/SigningDataTestClass.cs deleted file mode 100644 index ae30ef85..00000000 --- a/src/VSNDK.Package.Test/SigningDataTestClass.cs +++ /dev/null @@ -1,252 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using NUnit.Framework; -using RIM.VSNDK_Package.Signing.Models; -using RIM.VSNDK_Package; -using System.IO; -using Microsoft.Win32; - -namespace VSNDK.Package.Test -{ - [TestFixture] - public class SigningData_BackupRestore_TestClass - { - private SigningData _signingData = null; - private string _certName = ""; - private string _certTmpPath = ""; - - /// - /// Setup for testing - /// - [TestFixtureSetUp] - public void TFSetup() - { - /// Create Object - _signingData = new SigningData(); - _certName = "BackupTest.zip"; - _certTmpPath = @"\temp"; - } - - /// - /// Setup for testing - /// - [TestFixtureTearDown] - public void TFTearDown() - { - /// Remove Zip file and unzipped files - File.Delete(_signingData.CertPath + _certName); - Directory.Delete(_signingData.CertPath + _certTmpPath); - } - - /// - /// Test the backup functionality - /// - [TestCase] - public void SigningDataBackupTest() - { - _signingData.Backup(_certName); - Assert.True(File.Exists(_signingData.CertPath + _certName)); - } - - - /// - /// Test the restore functionality - /// - [TestCase] - public void SigningDataRestoreTest() - { - string certName = "BackupTest.zip"; - _signingData.CertPath = _signingData.CertPath + @"temp\"; - _signingData.Restore(certName); - Assert.True(Directory.Exists(_signingData.CertPath), "Restore directory not created"); - - DirectoryInfo di = new DirectoryInfo(_signingData.CertPath); - FileInfo[] fileList = di.GetFiles(); - - foreach (FileInfo file in fileList) - { - FileInfo file2 = new FileInfo(_signingData.CertPath + @"..\" + file.Name); - FileAssert.AreEqual(file, file2, "File isn't the same: " + file.Name); - } - } - } - - [TestFixture] - public class SigningData_Register_TestClass - { - private SigningData _signingData = null; - private string _cskPassword = ""; - private string _certName = ""; - private string _certTmpName = ""; - - /// - /// Setup for testing - /// - [TestFixtureSetUp] - public void TFSetup() - { - /// Create Object - _signingData = new SigningData(); - - _certName = @"/bbidtoken.csk"; - _certTmpName = @"/bbidtoken.csk.bak"; - - if (_signingData.Registered) - { - /// Backup CSK Password - RegistryKey rkHKCU = Registry.CurrentUser; - RegistryKey rkCDKPass = null; - rkCDKPass = rkHKCU.CreateSubKey("Software\\BlackBerry\\BlackBerryVSPlugin"); - _cskPassword = GlobalFunctions.Decrypt(rkCDKPass.GetValue("CSKPass").ToString()); - rkCDKPass.Close(); - rkHKCU.Close(); - - /// Backup CSK File.. - File.Copy(_signingData.CertPath + _certName, _signingData.CertPath + _certTmpName); - - /// Remove Key so we can register again. - _signingData.UnRegister(); - - /// Backup CSK File.. - File.Copy(_signingData.CertPath + _certTmpName, _signingData.CertPath + _certName); - } - else - { - Assert.Ignore(); - } - } - - /// - /// Setup for testing - /// - [TestFixtureTearDown] - public void TFTearDown() - { - /// Remove backup file - File.Delete(_signingData.CertPath + _certTmpName); - } - - /// - /// Test the unregister function - All Registered - /// - [TestCase] - public void SigningDataRegisterTest() - { - string password = ""; - - /// Check success Fail - _signingData.Register("Test", _cskPassword); - - /// Check return value from remote call - StringAssert.IsMatch("CSK file deleted.\n", _signingData.Messages, "Return value from command is not as expected. " + _signingData.Messages); - - /// Check return value for errors - StringAssert.DoesNotMatch("", _signingData.Errors, "Errors have been regturned from remote call. " + _signingData.Errors); - - /// Check to see that the cert file was removed - Assert.True(File.Exists(_signingData.CertPath + @"/author.p12"), "Certificate File is not present"); - - /// Check to see that the csk file was removed - Assert.True(File.Exists(_signingData.CertPath + @"/bbidtoken.csk"), "CSK File is not present."); - - /// Get CSK Password - RegistryKey rkHKCU = Registry.CurrentUser; - RegistryKey rkCDKPass = null; - rkCDKPass = rkHKCU.CreateSubKey("Software\\BlackBerry\\BlackBerryVSPlugin"); - password = GlobalFunctions.Decrypt(rkCDKPass.GetValue("CSKPass").ToString()); - StringAssert.IsMatch(_cskPassword, password, "Password is not a match " + _cskPassword + " != " + password); - rkCDKPass.Close(); - rkHKCU.Close(); - } - - } - - [TestFixture] - public class SigningData_UnRegister_TestClass - { - private SigningData _signingData = null; - private string _cskPassword = ""; - private string _certName = ""; - private string _certTmpName = ""; - - /// - /// Setup for testing - /// - [TestFixtureSetUp] - public void TFSetup() - { - /// Create Object - _signingData = new SigningData(); - - _certName = @"/bbidtoken.csk"; - _certTmpName = @"/bbidtoken.csk.bak"; - - if (_signingData.Registered) - { - /// Backup CSK Password - RegistryKey rkHKCU = Registry.CurrentUser; - RegistryKey rkCDKPass = null; - rkCDKPass = rkHKCU.CreateSubKey("Software\\BlackBerry\\BlackBerryVSPlugin"); - _cskPassword = rkCDKPass.GetValue("CSKPass").ToString(); - rkCDKPass.Close(); - rkHKCU.Close(); - - /// Backup CSK File.. - File.Copy(_signingData.CertPath + _certName, _signingData.CertPath + _certTmpName); - } - else - { - Assert.Ignore(); - } - } - - /// - /// Setup for testing - /// - [TestFixtureTearDown] - public void TFTearDown() - { - /// Backup CSK File.. - File.Copy(_signingData.CertPath + _certTmpName, _signingData.CertPath + _certName); - - /// Check success Fail - _signingData.Register("Test Company", _cskPassword); - - /// Remove backup file - File.Delete(_signingData.CertPath + _certTmpName); - } - - /// - /// Test the unregister function - All Registered - /// - [TestCase] - public void SigningDataUnregisterTest() - { - /// Check success Fail - _signingData.UnRegister(); - - /// Check return value from remote call - StringAssert.IsMatch("CSK file deleted.\n", _signingData.Messages, "Return value from command is not as expected. " + _signingData.Messages); - - /// Check return value for errors - StringAssert.DoesNotMatch("", _signingData.Errors, "Errors have been regturned from remote call. " + _signingData.Errors); - - /// Check to see that the cert file was removed - Assert.False(File.Exists(_signingData.CertPath + @"/author.p12"), "Certificate File is still present"); - - /// Check to see that the csk file was removed - Assert.False(File.Exists(_signingData.CertPath + @"/bbidtoken.csk"), "CSK File is still present."); - - /// Get CSK Password - RegistryKey rkHKCU = Registry.CurrentUser; - RegistryKey rkCDKPass = null; - rkCDKPass = rkHKCU.CreateSubKey("Software\\BlackBerry\\BlackBerryVSPlugin"); - StringAssert.IsMatch("", GlobalFunctions.Decrypt(rkCDKPass.GetValue("CSKPass").ToString()), "Password is not set to blank"); - rkCDKPass.Close(); - rkHKCU.Close(); - } - - } -} diff --git a/src/VSNDK.Package.Test/UpdateManagerDataTestClass.cs b/src/VSNDK.Package.Test/UpdateManagerDataTestClass.cs deleted file mode 100644 index fcc16bf8..00000000 --- a/src/VSNDK.Package.Test/UpdateManagerDataTestClass.cs +++ /dev/null @@ -1,152 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using NUnit.Framework; -using RIM.VSNDK_Package.UpdateManager.Model; -using RIM.VSNDK_Package; -using System.IO; -using Microsoft.Win32; - -namespace VSNDK.Package.Test -{ - [TestFixture] - class UpdateManagerDataTestClass - { - private UpdateManagerData updateManagerDataObject; - - /// - /// Setup for testing - /// - [TestFixtureSetUp] - public void TF_Setup() - { - /// Create Object - updateManagerDataObject = new UpdateManagerData(); - - } - - [TestFixtureTearDown] - public void TF_TearDown() - { - - } - - /// - /// Test GetAPILevel with a bad version expecting a no match - /// - [TestCase] - public void TC_GetAPILevel_NoMatch() - { - /// Initialize Test - string version = "1.0.0.0"; - string expectedResult = ""; - - /// Run Test - string result = updateManagerDataObject.GetAPILevel(version); - - /// Validate Test - Assert.IsTrue(result == expectedResult, "Expected result is not empty, " + result); - } - - /// - /// Test GetAPILevel with a valid version expecting the correct API Level - /// - [TestCase] - public void TC_GetAPILevel_Match() - { - /// Initialize Test - string version = "10.2.0"; - string expectedResult = "10.2.0.1155"; - - /// Run Test - string result = updateManagerDataObject.GetAPILevel(version); - - /// Validate Test - Assert.IsTrue(result == expectedResult, "Expected result does not match, " + result + " != " + expectedResult); - } - - /// - /// Test IsRuntimeInstalled with a invalid version expecting blank - /// - [TestCase] - public void TC_IsRuntimeInstalled_NoMatch() - { - /// Initialize Test - string version = "10.2.0.1197"; - - /// Run Test - bool result = updateManagerDataObject.IsRuntimeInstalled(version); - - /// Validate Test - Assert.IsFalse(result, "Result should be false."); - } - - /// - /// Test IsRuntimeInstalled with a invalid version expecting blank - /// - [TestCase] - public void TC_IsRuntimeInstalled_Match() - { - /// Initialize Test - string version = "10.2.0.1197"; - Directory.CreateDirectory(GlobalFunctions.bbndkPathConst + @"\runtime_" + version.Replace(".", "_")); - - /// Run Test - bool result = updateManagerDataObject.IsRuntimeInstalled(version); - - /// Validate Test - Assert.IsTrue(result, "Result should be true."); - - ///Clean Up Test - Directory.Delete(GlobalFunctions.bbndkPathConst + @"\runtime_" + version.Replace(".", "_")); - } - - /// - /// Test getCurrentAPIVersion when an API Version is not set. - /// - [TestCase] - public void TC_getCurrentAPIVersion_Unset() - { - /// Initialize Test - RegistryKey regKeyCurrentUser = Registry.CurrentUser; - RegistryKey regKey = regKeyCurrentUser.CreateSubKey("Software\\BlackBerry\\BlackBerryVSPlugin"); - regKey.SetValue("NDKTargetPath", ""); - regKey.Close(); - regKeyCurrentUser.Close(); - - /// Run Test - string result = updateManagerDataObject.getCurrentAPIVersion(); - - /// Validate Test - Assert.IsTrue(result == "", "Return value doesn't match expected result. " + result + " != " + ""); - - } - - /// - /// Test getCurrentAPIVersion when an API Version is set. - /// - [TestCase] - public void TC_getCurrentAPIVersion_Set() - { - /// Initialize Test - string version = "10.2.0.1155"; - RegistryKey regKeyCurrentUser = Registry.CurrentUser; - RegistryKey regKey = regKeyCurrentUser.CreateSubKey("Software\\BlackBerry\\BlackBerryVSPlugin"); - regKey.SetValue("NDKTargetPath", @"C:/bbndk_vs/target_" + version.Replace('.', '_') + "/qnx6"); - - /// Run Test - string result = updateManagerDataObject.getCurrentAPIVersion(); - - /// Validate Test - Assert.IsTrue(result == version, "Return value doesn't match expected result. " + result + " != " + version); - - /// Clean Up - regKey.SetValue("NDKTargetPath", ""); - regKey.Close(); - regKeyCurrentUser.Close(); - } - - - } -} diff --git a/src/VSNDK.Package.Test/VSNDK.Package.Test.csproj b/src/VSNDK.Package.Test/VSNDK.Package.Test.csproj index 8b92a324..359457c0 100644 --- a/src/VSNDK.Package.Test/VSNDK.Package.Test.csproj +++ b/src/VSNDK.Package.Test/VSNDK.Package.Test.csproj @@ -48,11 +48,16 @@ - + + DiagnosticTests.cs + + + ParserTests.cs + + + ToolRunnerTests.cs + - - - diff --git a/src/VSNDK.Package/DebugToken/DebugTokenDialog.xaml b/src/VSNDK.Package/DebugToken/DebugTokenDialog.xaml deleted file mode 100644 index 32105fca..00000000 --- a/src/VSNDK.Package/DebugToken/DebugTokenDialog.xaml +++ /dev/null @@ -1,59 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/VSNDK.Package/Signing/RegistrationWindow.xaml.cs b/src/VSNDK.Package/Signing/RegistrationWindow.xaml.cs deleted file mode 100644 index 41f8fa22..00000000 --- a/src/VSNDK.Package/Signing/RegistrationWindow.xaml.cs +++ /dev/null @@ -1,84 +0,0 @@ -//* Copyright 2010-2011 Research In Motion Limited. -//* -//* Licensed under the Apache License, Version 2.0 (the "License"); -//* you may not use this file except in compliance with the License. -//* You may obtain a copy of the License at -//* -//* http://www.apache.org/licenses/LICENSE-2.0 -//* -//* Unless required by applicable law or agreed to in writing, software -//* distributed under the License is distributed on an "AS IS" BASIS, -//* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -//* See the License for the specific language governing permissions and -//* limitations under the License. - -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Windows; -using System.Windows.Controls; -using System.Windows.Data; -using System.Windows.Documents; -using System.Windows.Input; -using System.Windows.Media; -using System.Windows.Media.Imaging; -using System.Windows.Shapes; -using RIM.VSNDK_Package.Signing.Models; -using System.IO; -using System.ComponentModel; - -namespace RIM.VSNDK_Package.Signing -{ - /// - /// Interaction logic for RegistrationWindow.xaml - /// - public partial class RegistrationWindow : Window - { - private SigningData signingData = null; - - /// - /// RegistrationWindow Constructor - /// - public RegistrationWindow() - { - InitializeComponent(); - - signingData = new SigningData(); - gridMain.DataContext = signingData; - } - - /// - /// Perform actions on the OK button click - /// - /// - /// - private void btnOk_Click(object sender, RoutedEventArgs e) - { - if (!signingData.Register(tbAuthor.Text, tbPassword.Password)) - { - MessageBox.Show(signingData.Errors, "Registration Window", MessageBoxButton.OK, MessageBoxImage.Exclamation, MessageBoxResult.OK); - signingData.Errors = null; - e.Handled = true; - return; - } - else if (!string.IsNullOrEmpty(signingData.Messages)) - { - signingData.Messages = signingData.Messages.Replace("CSK", "BB ID Token"); - MessageBox.Show(signingData.Messages, "Registration Window", MessageBoxButton.OK, MessageBoxImage.Information, MessageBoxResult.OK); - signingData.Messages = null; - } - - DialogResult = true; - } - - /// - /// Perform actions on close of dialog. - /// - /// - protected override void OnClosing(CancelEventArgs e) - { - signingData.CleanUp(); - } - } -} \ No newline at end of file diff --git a/src/VSNDK.Package/Signing/SigningDialog.xaml b/src/VSNDK.Package/Signing/SigningDialog.xaml deleted file mode 100644 index 6b1c91c5..00000000 --- a/src/VSNDK.Package/Signing/SigningDialog.xaml +++ /dev/null @@ -1,35 +0,0 @@ - - - - - - - - - - public void setAuthorInfo() { + // PH: FIXME: add loading author info from debug-token... + /* if (!File.Exists(_localRIMFolder + "DebugToken.bar")) { // Create the dialog instance without Help support. @@ -956,6 +958,7 @@ public void setAuthorInfo() if (!DebugTokenDialog.IsClosing) DebugTokenDialog.ShowDialog(); } + */ System.Diagnostics.Process p = new System.Diagnostics.Process(); System.Diagnostics.ProcessStartInfo startInfo = p.StartInfo; diff --git a/src_vs2012/VSNDK.Package.Test/VSNDK.Package.Test.csproj b/src_vs2012/VSNDK.Package.Test/VSNDK.Package.Test.csproj index f3cd4314..2c94ec6f 100644 --- a/src_vs2012/VSNDK.Package.Test/VSNDK.Package.Test.csproj +++ b/src_vs2012/VSNDK.Package.Test/VSNDK.Package.Test.csproj @@ -58,21 +58,9 @@ - - DebugTokenDataTestClass.cs - Properties\AssemblyInfo.cs - - SettingsDataTests.cs - - - SigningDataTestClass.cs - - - UpdateManagerDataTestClass.cs - diff --git a/src_vs2012/VSNDK.Package/VSNDK.Package.Menu.vsct b/src_vs2012/VSNDK.Package/VSNDK.Package.Menu.vsct index 094753c0..d79b3211 100644 --- a/src_vs2012/VSNDK.Package/VSNDK.Package.Menu.vsct +++ b/src_vs2012/VSNDK.Package/VSNDK.Package.Menu.vsct @@ -76,29 +76,6 @@ - - - - - - public virtual string Package + public string Package { get { - if (base.IsPropertySet(PACKAGE)) + if (IsPropertySet(PACKAGE)) { - return base.ActiveToolSwitches[PACKAGE].Value; + return ActiveToolSwitches[PACKAGE].Value; } return null; } set { - base.ActiveToolSwitches.Remove(PACKAGE); + ActiveToolSwitches.Remove(PACKAGE); ToolSwitch toolSwitch = new ToolSwitch(ToolSwitchType.String) { Name = PACKAGE, @@ -528,8 +527,8 @@ public virtual string Package SwitchValue = "-package ", Value = value }; - base.ActiveToolSwitches.Add(PACKAGE, toolSwitch); - base.AddActiveSwitchToolValue(toolSwitch); + ActiveToolSwitches.Add(PACKAGE, toolSwitch); + AddActiveSwitchToolValue(toolSwitch); } } @@ -537,19 +536,19 @@ public virtual string Package /// Getter/Setter for PackageId property /// [Output] - public virtual string PackageId + public string PackageId { get { - if (base.IsPropertySet(PACKAGE_ID)) + if (IsPropertySet(PACKAGE_ID)) { - return base.ActiveToolSwitches[PACKAGE_ID].Value; + return ActiveToolSwitches[PACKAGE_ID].Value; } return null; } set { - base.ActiveToolSwitches.Remove(PACKAGE_ID); + ActiveToolSwitches.Remove(PACKAGE_ID); ToolSwitch toolSwitch = new ToolSwitch(ToolSwitchType.String) { Name = PACKAGE_ID, @@ -558,8 +557,8 @@ public virtual string PackageId SwitchValue = "-package-id ", Value = value }; - base.ActiveToolSwitches.Add(PACKAGE_ID, toolSwitch); - base.AddActiveSwitchToolValue(toolSwitch); + ActiveToolSwitches.Add(PACKAGE_ID, toolSwitch); + AddActiveSwitchToolValue(toolSwitch); } } @@ -567,19 +566,19 @@ public virtual string PackageId /// Getter/Setter for PackageName property /// [Output] - public virtual string PackageName + public string PackageName { get { - if (base.IsPropertySet(PACKAGE_NAME)) + if (IsPropertySet(PACKAGE_NAME)) { - return base.ActiveToolSwitches[PACKAGE_NAME].Value; + return ActiveToolSwitches[PACKAGE_NAME].Value; } return null; } set { - base.ActiveToolSwitches.Remove(PACKAGE_NAME); + ActiveToolSwitches.Remove(PACKAGE_NAME); ToolSwitch toolSwitch = new ToolSwitch(ToolSwitchType.String) { Name = PACKAGE_NAME, @@ -588,8 +587,8 @@ public virtual string PackageName SwitchValue = "-package-name ", Value = value }; - base.ActiveToolSwitches.Add(PACKAGE_NAME, toolSwitch); - base.AddActiveSwitchToolValue(toolSwitch); + ActiveToolSwitches.Add(PACKAGE_NAME, toolSwitch); + AddActiveSwitchToolValue(toolSwitch); } } @@ -597,7 +596,7 @@ public virtual string PackageName /// Getter/Setter for LocalManifestFile property /// We need the local manifest in order to determine PackageId and PackageName. /// - public virtual string LocalManifestFile + public string LocalManifestFile { get { @@ -631,7 +630,7 @@ public virtual string LocalManifestFile /// Getter/Setter for the TargetManifestFile /// [Output] - public virtual string TargetManifestFile + public string TargetManifestFile { get { @@ -642,55 +641,30 @@ public virtual string TargetManifestFile /// /// Getter/Setter for the TrackerLogDirectory property /// - public virtual string TrackerLogDirectory + public string TrackerLogDirectory { get { - if (base.IsPropertySet(TRACKER_LOG_DIRECTORY)) + if (IsPropertySet(TRACKER_LOG_DIRECTORY)) { - return base.ActiveToolSwitches[TRACKER_LOG_DIRECTORY].Value; + return ActiveToolSwitches[TRACKER_LOG_DIRECTORY].Value; } return null; } set { - base.ActiveToolSwitches.Remove(TRACKER_LOG_DIRECTORY); + ActiveToolSwitches.Remove(TRACKER_LOG_DIRECTORY); ToolSwitch switch2 = new ToolSwitch(ToolSwitchType.Directory) { DisplayName = "Tracker Log Directory", Description = "Tracker Log Directory.", - Value = VCToolTask.EnsureTrailingSlash(value) + Value = EnsureTrailingSlash(value) }; - base.ActiveToolSwitches.Add(TRACKER_LOG_DIRECTORY, switch2); - base.AddActiveSwitchToolValue(switch2); + ActiveToolSwitches.Add(TRACKER_LOG_DIRECTORY, switch2); + AddActiveSwitchToolValue(switch2); } } #endregion - - /// - /// Decrypts a given string. - /// - /// A base64 encoded string that was created - /// through the or - /// extension methods. - /// The decrypted string. - /// Keep in mind that the decrypted string remains in memory - /// and makes your application vulnerable per se. If runtime protection - /// is essential, should be used. - /// If - /// is a null reference. - public string Decrypt(string cipher) - { - if (cipher == null) throw new ArgumentNullException("cipher"); - - //parse base64 string - byte[] data = Convert.FromBase64String(cipher); - - //decrypt data - byte[] decrypted = ProtectedData.Unprotect(data, null, DataProtectionScope.LocalMachine); - - return Encoding.Unicode.GetString(decrypted); - } } } diff --git a/src_vs2010/BuildTasks/BBNativePackager.cs b/src_vs2010/BuildTasks/BBNativePackager.cs index dab03799..7e7a04e4 100644 --- a/src_vs2010/BuildTasks/BBNativePackager.cs +++ b/src_vs2010/BuildTasks/BBNativePackager.cs @@ -22,14 +22,16 @@ namespace BlackBerry.BuildTasks { - public class BBNativePackager : TrackedVCToolTask + public sealed class BBNativePackager : BBTask { #region Member Variable and Constant Declarations - protected ArrayList switchOrderList; + + private readonly ArrayList _switchOrderList; private static BarDescriptor.qnx _descriptor; - private string _projDir; + private string _projectDirectory; private string _appName; private string _barDescriptorPath = ""; + private const string OUTPUT_FILE = "OutputFiles"; private const string APP_DESCRIPTOR = "ApplicationDescriptorXml"; private const string TARGET_FORMAT = "TargetFormat"; @@ -42,28 +44,28 @@ public class BBNativePackager : TrackedVCToolTask private const string TRACKER_LOG_DIRECTORY = "TrackerLogDirectory"; private const string GET_TARGET_FILE_MAP = "GetTargetFileMap"; private const string WORKSPACE_LOC = "${workspace_loc:/"; + #endregion /// - /// BBNativePackager Constructor + /// BBNativePackager default constructor /// public BBNativePackager() : base(Resources.ResourceManager) { - this.switchOrderList = new ArrayList(); - this.switchOrderList.Add(TARGET_FORMAT); - this.switchOrderList.Add(BUILD_ID); - this.switchOrderList.Add(BUILD_ID_FILE); - this.switchOrderList.Add(DEV_MODE); - this.switchOrderList.Add(GET_TARGET_FILE_MAP); - this.switchOrderList.Add(PACKAGE_MANIFEST_ONLY); - this.switchOrderList.Add(OUTPUT_FILE); - this.switchOrderList.Add(APP_DESCRIPTOR); - this.switchOrderList.Add(TRACKER_LOG_DIRECTORY); + _switchOrderList = new ArrayList(); + _switchOrderList.Add(TARGET_FORMAT); + _switchOrderList.Add(BUILD_ID); + _switchOrderList.Add(BUILD_ID_FILE); + _switchOrderList.Add(DEV_MODE); + _switchOrderList.Add(GET_TARGET_FILE_MAP); + _switchOrderList.Add(PACKAGE_MANIFEST_ONLY); + _switchOrderList.Add(OUTPUT_FILE); + _switchOrderList.Add(APP_DESCRIPTOR); + _switchOrderList.Add(TRACKER_LOG_DIRECTORY); } - #region overrides - + #region Overrides /// /// Return the response file switch. @@ -95,7 +97,7 @@ protected override string GenerateResponseFileCommands() string cmd = base.GenerateResponseFileCommands(); PackagerCmdBuilder clb = new PackagerCmdBuilder(); AppendResources(clb); - cmd += " " + clb.ToString(); + cmd += " " + clb; // Output the .bar file's manifest to a file so we can parse it. if (PackageManifestOnly) @@ -134,7 +136,6 @@ private void AppendResources(CommandLineBuilder clb) /// /// Return the assets from the bardescriptor.xml /// - /// private ITaskItem[] GetAssetsFile() { @@ -195,20 +196,22 @@ private ITaskItem[] GetAssetsFile() } } - int clen = (configAssets == null) ? 0 : configAssets.Length; - int glen = (globalAssets == null) ? 0 : globalAssets.Length; + int clen = configAssets == null ? 0 : configAssets.Length; + int glen = globalAssets == null ? 0 : globalAssets.Length; var items = new ITaskItem[glen + clen]; - for (int i = 0; i < glen; i++) + if (globalAssets != null) { - string path = globalAssets[i].path; - path = path.Replace("}", string.Empty).Replace(WORKSPACE_LOC, SolutionDir); - string target = globalAssets[i].Value; - items[i] = new TaskItem(path); - items[i].SetMetadata("target", target); + for (int i = 0; i < glen; i++) + { + string path = globalAssets[i].path; + path = path.Replace("}", string.Empty).Replace(WORKSPACE_LOC, SolutionDir); + string target = globalAssets[i].Value; + items[i] = new TaskItem(path); + items[i].SetMetadata("target", target); + } } - if (configAssets != null) { for (int i = 0; i < configAssets.Length; i++) @@ -222,7 +225,6 @@ private ITaskItem[] GetAssetsFile() } return items; - } /// @@ -232,7 +234,7 @@ protected override ArrayList SwitchOrderList { get { - return this.switchOrderList; + return _switchOrderList; } } @@ -274,49 +276,49 @@ protected override string ToolName } } - #endregion overrides + #endregion - #region properties + #region Properties /// /// Getter/Setter for Device property /// [Output] - public virtual string Device { get; set; } + public string Device { get; set; } /// /// Getter/Setter for Password property /// [Output] - public virtual string Password { get; set;} + public string Password { get; set;} /// /// Getter/Setter for BarDeploy property /// [Output] - public virtual string BarDeploy { get; set; } + public string BarDeploy { get; set; } /// /// Getter/Setter for OutputFile property /// [Required] [Output] - public virtual string OutputFile + public string OutputFile { get { - if (base.IsPropertySet(OUTPUT_FILE) && base.IsExplicitlySetToFalse(PACKAGE_MANIFEST_ONLY)) + if (IsPropertySet(OUTPUT_FILE) && IsExplicitlySetToFalse(PACKAGE_MANIFEST_ONLY)) { - return base.ActiveToolSwitches[OUTPUT_FILE].Value; + return ActiveToolSwitches[OUTPUT_FILE].Value; } return null; } set { - base.ActiveToolSwitches.Remove(OUTPUT_FILE); + ActiveToolSwitches.Remove(OUTPUT_FILE); String switchValue = ""; - if (base.IsPropertySet(OUTPUT_FILE) && base.IsExplicitlySetToFalse(PACKAGE_MANIFEST_ONLY)) + if (IsPropertySet(OUTPUT_FILE) && IsExplicitlySetToFalse(PACKAGE_MANIFEST_ONLY)) { switchValue = "-package "; } @@ -330,8 +332,8 @@ public virtual string OutputFile Name = OUTPUT_FILE, Value = value }; - base.ActiveToolSwitches.Add(OUTPUT_FILE, switch2); - base.AddActiveSwitchToolValue(switch2); + ActiveToolSwitches.Add(OUTPUT_FILE, switch2); + AddActiveSwitchToolValue(switch2); } } @@ -339,15 +341,15 @@ public virtual string OutputFile /// Getter/Setter for ProjectDir property /// [Required] - public virtual string ProjectDir + public string ProjectDir { get { - return _projDir; + return _projectDirectory; } set { - _projDir = value; + _projectDirectory = value; _descriptor = BarDescriptor.Parser.Load(Path.Combine(ProjectDir, ApplicationDescriptorXml)); } } @@ -356,7 +358,7 @@ public virtual string ProjectDir /// Getter/Setter for AppName property /// [Required] - public virtual string AppName + public string AppName { get { @@ -381,7 +383,7 @@ public virtual string AppName } } - base.ActiveToolSwitches.Remove(APP_DESCRIPTOR); + ActiveToolSwitches.Remove(APP_DESCRIPTOR); ToolSwitch switch2 = new ToolSwitch(ToolSwitchType.File) { @@ -391,8 +393,8 @@ public virtual string AppName Name = APP_DESCRIPTOR, Value = _barDescriptorPath }; - base.ActiveToolSwitches.Add(APP_DESCRIPTOR, switch2); - base.AddActiveSwitchToolValue(switch2); + ActiveToolSwitches.Add(APP_DESCRIPTOR, switch2); + AddActiveSwitchToolValue(switch2); } } @@ -400,15 +402,15 @@ public virtual string AppName /// Getter/Setter for SolutionDir property /// [Required] - public virtual string SolutionDir { get; set; } + public string SolutionDir { get; set; } - public virtual string ApplicationDescriptorXml + public string ApplicationDescriptorXml { get { - if (base.IsPropertySet(APP_DESCRIPTOR)) + if (IsPropertySet(APP_DESCRIPTOR)) { - return base.ActiveToolSwitches[APP_DESCRIPTOR].Value; + return ActiveToolSwitches[APP_DESCRIPTOR].Value; } return null; } @@ -421,31 +423,31 @@ public virtual string ApplicationDescriptorXml /// /// Getter/Setter for TargetFormat property /// - public virtual string TargetFormat + public string TargetFormat { get { - if (base.IsPropertySet(TARGET_FORMAT)) + if (IsPropertySet(TARGET_FORMAT)) { - return base.ActiveToolSwitches[TARGET_FORMAT].Value; + return ActiveToolSwitches[TARGET_FORMAT].Value; } return null; } set { - base.ActiveToolSwitches.Remove(TARGET_FORMAT); + ActiveToolSwitches.Remove(TARGET_FORMAT); ToolSwitch switch2 = new ToolSwitch(ToolSwitchType.String) { DisplayName = "Target format", Description = "Select the build target format( -target bar -target bar-debug)", ArgumentRelationList = new ArrayList() }; - string[][] switchMap = new string[][] - { - new string[] { "bar", "-target bar" }, - new string[] { "bar-debug", "-target bar-debug" } + string[][] switchMap = + { + new[] { "bar", "-target bar" }, + new[] { "bar-debug", "-target bar-debug" } }; - switch2.SwitchValue = base.ReadSwitchMap(TARGET_FORMAT, switchMap, value); + switch2.SwitchValue = ReadSwitchMap(TARGET_FORMAT, switchMap, value); switch2.Name = TARGET_FORMAT; switch2.Value = value; #if PLATFORM_VS2010 @@ -453,58 +455,58 @@ public virtual string TargetFormat #else switch2.MultipleValues = true; #endif - base.ActiveToolSwitches.Add(TARGET_FORMAT, switch2); - base.AddActiveSwitchToolValue(switch2); + ActiveToolSwitches.Add(TARGET_FORMAT, switch2); + AddActiveSwitchToolValue(switch2); } } /// /// Getter/Setter for BuildID property /// - public virtual int BuildID + public int BuildID { get { - if (base.IsPropertySet(BUILD_ID)) + if (IsPropertySet(BUILD_ID)) { - return base.ActiveToolSwitches[BUILD_ID].Number; + return ActiveToolSwitches[BUILD_ID].Number; } return 0; } set { - base.ActiveToolSwitches.Remove(BUILD_ID); + ActiveToolSwitches.Remove(BUILD_ID); ToolSwitch switch2 = new ToolSwitch(ToolSwitchType.Integer) { DisplayName = "Build Id", Description = "set the build id ( the fourth segment of the version ). Must be a number from 0 to 65535" }; switch2.ArgumentRelationList = new ArrayList(); - switch2.IsValid = base.ValidateInteger(BUILD_ID, 0, 65535, value); + switch2.IsValid = ValidateInteger(BUILD_ID, 0, 65535, value); switch2.Name = BUILD_ID; switch2.Number = value; switch2.SwitchValue = "-buildId "; - base.ActiveToolSwitches.Add(BUILD_ID, switch2); - base.AddActiveSwitchToolValue(switch2); + ActiveToolSwitches.Add(BUILD_ID, switch2); + AddActiveSwitchToolValue(switch2); } } /// /// Getter/Setter for BuildIDFile property /// - public virtual string BuildIDFile + public string BuildIDFile { get { - if (base.IsPropertySet(BUILD_ID_FILE)) + if (IsPropertySet(BUILD_ID_FILE)) { - return base.ActiveToolSwitches[BUILD_ID_FILE].Value; + return ActiveToolSwitches[BUILD_ID_FILE].Value; } return null; } set { - base.ActiveToolSwitches.Remove(BUILD_ID_FILE); + ActiveToolSwitches.Remove(BUILD_ID_FILE); ToolSwitch switch2 = new ToolSwitch(ToolSwitchType.File) { DisplayName = "Build ID File", @@ -514,23 +516,23 @@ public virtual string BuildIDFile SwitchValue = "-buildIdFile ", Value = value }; - base.ActiveToolSwitches.Add(BUILD_ID_FILE, switch2); - base.AddActiveSwitchToolValue(switch2); + ActiveToolSwitches.Add(BUILD_ID_FILE, switch2); + AddActiveSwitchToolValue(switch2); } } /// /// Getter/Setter for DevMode property /// - public virtual bool DevMode + public bool DevMode { get { - return (base.IsPropertySet(DEV_MODE) && base.ActiveToolSwitches[DEV_MODE].BooleanValue); + return (IsPropertySet(DEV_MODE) && ActiveToolSwitches[DEV_MODE].BooleanValue); } set { - base.ActiveToolSwitches.Remove(DEV_MODE); + ActiveToolSwitches.Remove(DEV_MODE); ToolSwitch switch2 = new ToolSwitch(ToolSwitchType.Boolean) { Name = DEV_MODE, @@ -540,23 +542,23 @@ public virtual bool DevMode SwitchValue = "-devMode", BooleanValue = value }; - base.ActiveToolSwitches.Add(DEV_MODE, switch2); - base.AddActiveSwitchToolValue(switch2); + ActiveToolSwitches.Add(DEV_MODE, switch2); + AddActiveSwitchToolValue(switch2); } } /// /// Getter/Setter for PackageManifestOnly property /// - public virtual bool PackageManifestOnly + public bool PackageManifestOnly { get { - return (base.IsPropertySet(PACKAGE_MANIFEST_ONLY) && base.ActiveToolSwitches[PACKAGE_MANIFEST_ONLY].BooleanValue); + return (IsPropertySet(PACKAGE_MANIFEST_ONLY) && ActiveToolSwitches[PACKAGE_MANIFEST_ONLY].BooleanValue); } set { - base.ActiveToolSwitches.Remove(PACKAGE_MANIFEST_ONLY); + ActiveToolSwitches.Remove(PACKAGE_MANIFEST_ONLY); ToolSwitch switch2 = new ToolSwitch(ToolSwitchType.Boolean) { DisplayName = "Package manifest only.", @@ -566,23 +568,23 @@ public virtual bool PackageManifestOnly Name = PACKAGE_MANIFEST_ONLY, BooleanValue = value }; - base.ActiveToolSwitches.Add(PACKAGE_MANIFEST_ONLY, switch2); - base.AddActiveSwitchToolValue(switch2); + ActiveToolSwitches.Add(PACKAGE_MANIFEST_ONLY, switch2); + AddActiveSwitchToolValue(switch2); } } /// /// Getter/Setter for GetTargetFileMap property /// - public virtual bool GetTargetFileMap + public bool GetTargetFileMap { get { - return (base.IsPropertySet(GET_TARGET_FILE_MAP) && base.ActiveToolSwitches[GET_TARGET_FILE_MAP].BooleanValue); + return (IsPropertySet(GET_TARGET_FILE_MAP) && ActiveToolSwitches[GET_TARGET_FILE_MAP].BooleanValue); } set { - base.ActiveToolSwitches.Remove(GET_TARGET_FILE_MAP); + ActiveToolSwitches.Remove(GET_TARGET_FILE_MAP); ToolSwitch toolSwitch = new ToolSwitch(ToolSwitchType.Boolean) { Name = GET_TARGET_FILE_MAP, @@ -592,27 +594,27 @@ public virtual bool GetTargetFileMap SwitchValue = "-targetFileMap ", BooleanValue = value }; - base.ActiveToolSwitches.Add(GET_TARGET_FILE_MAP, toolSwitch); - base.AddActiveSwitchToolValue(toolSwitch); + ActiveToolSwitches.Add(GET_TARGET_FILE_MAP, toolSwitch); + AddActiveSwitchToolValue(toolSwitch); } } /// /// Getter/Setter for DebugToken property /// - public virtual string DebugToken + public string DebugToken { get { - if (base.IsPropertySet(DEBUG_TOKEN)) + if (IsPropertySet(DEBUG_TOKEN)) { - return base.ActiveToolSwitches[DEBUG_TOKEN].Value; + return ActiveToolSwitches[DEBUG_TOKEN].Value; } return null; } set { - base.ActiveToolSwitches.Remove(DEBUG_TOKEN); + ActiveToolSwitches.Remove(DEBUG_TOKEN); ToolSwitch switch2 = new ToolSwitch(ToolSwitchType.Directory) { DisplayName = "Debug Token", @@ -622,45 +624,43 @@ public virtual string DebugToken Value = value }; switch2.Parents.AddLast(DEV_MODE); - base.ActiveToolSwitches.Add(DEBUG_TOKEN, switch2); - base.AddActiveSwitchToolValue(switch2); + ActiveToolSwitches.Add(DEBUG_TOKEN, switch2); + AddActiveSwitchToolValue(switch2); } } /// /// Getter/Setter for TrackerLogDirectory property. /// - public virtual string TrackerLogDirectory + public string TrackerLogDirectory { get { - if (base.IsPropertySet(TRACKER_LOG_DIRECTORY)) + if (IsPropertySet(TRACKER_LOG_DIRECTORY)) { - return base.ActiveToolSwitches[TRACKER_LOG_DIRECTORY].Value; + return ActiveToolSwitches[TRACKER_LOG_DIRECTORY].Value; } return null; } set { - base.ActiveToolSwitches.Remove(TRACKER_LOG_DIRECTORY); + ActiveToolSwitches.Remove(TRACKER_LOG_DIRECTORY); ToolSwitch switch2 = new ToolSwitch(ToolSwitchType.Directory) { DisplayName = "Tracker Log Directory", Description = "Tracker Log Directory.", ArgumentRelationList = new ArrayList(), - Value = VCToolTask.EnsureTrailingSlash(value) + Value = EnsureTrailingSlash(value) }; - base.ActiveToolSwitches.Add(TRACKER_LOG_DIRECTORY, switch2); - base.AddActiveSwitchToolValue(switch2); + ActiveToolSwitches.Add(TRACKER_LOG_DIRECTORY, switch2); + AddActiveSwitchToolValue(switch2); } } - #endregion properties - /// /// Getter for the TrackedInputFiles /// - protected override Microsoft.Build.Framework.ITaskItem[] TrackedInputFiles + protected override ITaskItem[] TrackedInputFiles { get { @@ -675,9 +675,9 @@ protected override string TrackerIntermediateDirectory { get { - if (this.TrackerLogDirectory != null) + if (TrackerLogDirectory != null) { - return this.TrackerLogDirectory; + return TrackerLogDirectory; } return string.Empty; } @@ -687,19 +687,19 @@ protected override string TrackerIntermediateDirectory /// Getter/Seter for the Sources property /// [Required] - public virtual ITaskItem[] Sources + public ITaskItem[] Sources { get { - if (base.IsPropertySet(SOURCES)) + if (IsPropertySet(SOURCES)) { - return base.ActiveToolSwitches[SOURCES].TaskItemArray; + return ActiveToolSwitches[SOURCES].TaskItemArray; } return null; } set { - base.ActiveToolSwitches.Remove(SOURCES); + ActiveToolSwitches.Remove(SOURCES); ToolSwitch switch2 = new ToolSwitch(ToolSwitchType.ITaskItemArray) { Separator = " ", @@ -707,8 +707,8 @@ public virtual ITaskItem[] Sources ArgumentRelationList = new ArrayList(), TaskItemArray = value }; - base.ActiveToolSwitches.Add(SOURCES, switch2); - base.AddActiveSwitchToolValue(switch2); + ActiveToolSwitches.Add(SOURCES, switch2); + AddActiveSwitchToolValue(switch2); } } @@ -731,5 +731,7 @@ public string Platform get; set; } + + #endregion } } diff --git a/src_vs2010/BuildTasks/BBSigner.cs b/src_vs2010/BuildTasks/BBSigner.cs index e6a3c6f2..e106ddbc 100644 --- a/src_vs2010/BuildTasks/BBSigner.cs +++ b/src_vs2010/BuildTasks/BBSigner.cs @@ -12,10 +12,7 @@ //* See the License for the specific language governing permissions and //* limitations under the License. -using System; using System.Collections; -using System.Security.Cryptography; -using System.Text; using BlackBerry.BuildTasks.Properties; using Microsoft.Build.CPPTasks; using Microsoft.Build.Framework; @@ -26,10 +23,12 @@ namespace BlackBerry.BuildTasks /// MSBuild Task responsible for the signing of the BlackBerry Bar files /// for deploy to a secure device not in development mode. /// - public class BBSigner : TrackedVCToolTask + public sealed class BBSigner : BBTask { #region Member Variables and Constants Declaration - protected ArrayList switchOrderList; + + private readonly ArrayList _switchOrderList; + private const string REGISTER = "Register"; private const string KEYSTOREPASSWORD = "KeyStorePassword"; private const string CSJPIN = "CSJPin"; @@ -37,33 +36,31 @@ public class BBSigner : TrackedVCToolTask private const string SOURCES = "Sources"; private const string OUTPUT_FILE = "OutputFiles"; private const string TRACKER_LOG_DIRECTORY = "TrackerLogDirectory"; + #endregion /// - /// BBSigner Constructor Fuction + /// BBSigner default constructor /// public BBSigner() : base(Resources.ResourceManager) { - this.switchOrderList = new ArrayList(); - this.switchOrderList.Add("AlwaysAppend"); - this.switchOrderList.Add(REGISTER); - this.switchOrderList.Add(CSJPIN); - this.switchOrderList.Add(KEYSTOREPASSWORD); - this.switchOrderList.Add(CSJFILES); - this.switchOrderList.Add(OUTPUT_FILE); - this.switchOrderList.Add(TRACKER_LOG_DIRECTORY); + _switchOrderList = new ArrayList(); + _switchOrderList.Add("AlwaysAppend"); + _switchOrderList.Add(REGISTER); + _switchOrderList.Add(CSJPIN); + _switchOrderList.Add(KEYSTOREPASSWORD); + _switchOrderList.Add(CSJFILES); + _switchOrderList.Add(OUTPUT_FILE); + _switchOrderList.Add(TRACKER_LOG_DIRECTORY); } - - #region overrides + #region Overrides /// /// Return the GetResposeFile Switch /// Note: don't use response file for msbuild because it is removed before qcc to run GCC compiler /// - /// - /// protected override string GetResponseFileSwitch(string responseFilePath) { return string.Empty; @@ -87,12 +84,12 @@ protected override string GenerateResponseFileCommands() { if (!Register) { - switchOrderList.Remove(REGISTER); - switchOrderList.Remove(CSJPIN); - switchOrderList.Remove(CSJFILES); + _switchOrderList.Remove(REGISTER); + _switchOrderList.Remove(CSJPIN); + _switchOrderList.Remove(CSJFILES); } else - switchOrderList.Remove(OUTPUT_FILE); + _switchOrderList.Remove(OUTPUT_FILE); return base.GenerateResponseFileCommands(); } @@ -103,7 +100,7 @@ protected override ArrayList SwitchOrderList { get { - return this.switchOrderList; + return _switchOrderList; } } @@ -120,13 +117,13 @@ protected override string CommandTLogName /// protected override string[] ReadTLogNames { - get { return new string[] { "BBSigner.read.1.tlog", "BBSigner.*.read.1.tlog" }; } + get { return new[] { "BBSigner.read.1.tlog", "BBSigner.*.read.1.tlog" }; } } protected override string[] WriteTLogNames { get { - return new string[] { "BBSigner.write.1.tlog", "BBSigner.*.write.1.tlog" }; + return new[] { "BBSigner.write.1.tlog", "BBSigner.*.write.1.tlog" }; } } @@ -148,9 +145,9 @@ protected override string TrackerIntermediateDirectory { get { - if (this.TrackerLogDirectory != null) + if (TrackerLogDirectory != null) { - return this.TrackerLogDirectory; + return TrackerLogDirectory; } return string.Empty; } @@ -164,23 +161,23 @@ protected override ITaskItem[] TrackedInputFiles get { return Sources; } } - #endregion overrides + #endregion - #region properties + #region Properties /// /// Getter/Setter for the Register property /// [Required] - public virtual bool Register + public bool Register { get { - return (base.IsPropertySet(REGISTER) && base.ActiveToolSwitches[REGISTER].BooleanValue); + return (IsPropertySet(REGISTER) && ActiveToolSwitches[REGISTER].BooleanValue); } set { - base.ActiveToolSwitches.Remove(REGISTER); + ActiveToolSwitches.Remove(REGISTER); ToolSwitch switch2 = new ToolSwitch(ToolSwitchType.Boolean) { DisplayName = "Register", @@ -190,8 +187,8 @@ public virtual bool Register Name = REGISTER, BooleanValue = value }; - base.ActiveToolSwitches.Add(REGISTER, switch2); - base.AddActiveSwitchToolValue(switch2); + ActiveToolSwitches.Add(REGISTER, switch2); + AddActiveSwitchToolValue(switch2); } } @@ -199,19 +196,19 @@ public virtual bool Register /// Getter/Setter for the Sources property /// [Required] - public virtual ITaskItem[] Sources + public ITaskItem[] Sources { get { - if (base.IsPropertySet(SOURCES)) + if (IsPropertySet(SOURCES)) { - return base.ActiveToolSwitches[SOURCES].TaskItemArray; + return ActiveToolSwitches[SOURCES].TaskItemArray; } return null; } set { - base.ActiveToolSwitches.Remove(SOURCES); + ActiveToolSwitches.Remove(SOURCES); ToolSwitch switch2 = new ToolSwitch(ToolSwitchType.ITaskItemArray) { Separator = " ", @@ -219,27 +216,27 @@ public virtual ITaskItem[] Sources ArgumentRelationList = new ArrayList(), TaskItemArray = value }; - base.ActiveToolSwitches.Add(SOURCES, switch2); - base.AddActiveSwitchToolValue(switch2); + ActiveToolSwitches.Add(SOURCES, switch2); + AddActiveSwitchToolValue(switch2); } } /// /// Getter/Setter for the CSJFiles property /// - public virtual ITaskItem[] CSJFiles + public ITaskItem[] CSJFiles { get { - if (base.IsPropertySet(CSJFILES)) + if (IsPropertySet(CSJFILES)) { - return base.ActiveToolSwitches[CSJFILES].TaskItemArray; + return ActiveToolSwitches[CSJFILES].TaskItemArray; } return null; } set { - base.ActiveToolSwitches.Remove(CSJFILES); + ActiveToolSwitches.Remove(CSJFILES); ToolSwitch switch2 = new ToolSwitch(ToolSwitchType.ITaskItemArray) { Separator = " ", @@ -248,27 +245,27 @@ public virtual ITaskItem[] CSJFiles Name = CSJFILES, TaskItemArray = value }; - base.ActiveToolSwitches.Add(CSJFILES, switch2); - base.AddActiveSwitchToolValue(switch2); + ActiveToolSwitches.Add(CSJFILES, switch2); + AddActiveSwitchToolValue(switch2); } } /// /// Getter/Setter for the KeyStorePassword property /// - public virtual string KeyStorePassword + public string KeyStorePassword { get { - if (base.IsPropertySet(KEYSTOREPASSWORD)) + if (IsPropertySet(KEYSTOREPASSWORD)) { - return base.ActiveToolSwitches[KEYSTOREPASSWORD].Value; + return ActiveToolSwitches[KEYSTOREPASSWORD].Value; } return null; } set { - base.ActiveToolSwitches.Remove(KEYSTOREPASSWORD); + ActiveToolSwitches.Remove(KEYSTOREPASSWORD); ToolSwitch switch2 = new ToolSwitch(ToolSwitchType.File) { @@ -277,55 +274,30 @@ public virtual string KeyStorePassword ArgumentRelationList = new ArrayList(), SwitchValue = "-storepass ", Name = KEYSTOREPASSWORD, - Value = Decrypt(value) + Value = DecryptPassword(value) }; - base.ActiveToolSwitches.Add(KEYSTOREPASSWORD, switch2); - base.AddActiveSwitchToolValue(switch2); + ActiveToolSwitches.Add(KEYSTOREPASSWORD, switch2); + AddActiveSwitchToolValue(switch2); } } - /// - /// Decrypts a given string. - /// - /// A base64 encoded string that was created - /// through the or - /// extension methods. - /// The decrypted string. - /// Keep in mind that the decrypted string remains in memory - /// and makes your application vulnerable per se. If runtime protection - /// is essential, should be used. - /// If - /// is a null reference. - public string Decrypt(string cipher) - { - if (cipher == null) throw new ArgumentNullException("cipher"); - - //parse base64 string - byte[] data = Convert.FromBase64String(cipher); - - //decrypt data - byte[] decrypted = ProtectedData.Unprotect(data, null, DataProtectionScope.LocalMachine); - - return Encoding.Unicode.GetString(decrypted); - } - /// /// Getter/Setter for the CSJPin property /// - public virtual string CSJPin + public string CSJPin { get { - if (base.IsPropertySet(CSJPIN)) + if (IsPropertySet(CSJPIN)) { - return base.ActiveToolSwitches[CSJPIN].Value; + return ActiveToolSwitches[CSJPIN].Value; } return null; } set { - base.ActiveToolSwitches.Remove(CSJPIN); + ActiveToolSwitches.Remove(CSJPIN); ToolSwitch switch2 = new ToolSwitch(ToolSwitchType.File) { DisplayName = "Keystore password", @@ -335,8 +307,8 @@ public virtual string CSJPin Name = CSJPIN, Value = value }; - base.ActiveToolSwitches.Add(CSJPIN, switch2); - base.AddActiveSwitchToolValue(switch2); + ActiveToolSwitches.Add(CSJPIN, switch2); + AddActiveSwitchToolValue(switch2); } } @@ -345,19 +317,19 @@ public virtual string CSJPin /// [Required] [Output] - public virtual string OutputFile + public string OutputFile { get { - if (base.IsPropertySet(OUTPUT_FILE)) + if (IsPropertySet(OUTPUT_FILE)) { - return base.ActiveToolSwitches[OUTPUT_FILE].Value; + return ActiveToolSwitches[OUTPUT_FILE].Value; } return null; } set { - base.ActiveToolSwitches.Remove(OUTPUT_FILE); + ActiveToolSwitches.Remove(OUTPUT_FILE); ToolSwitch switch2 = new ToolSwitch(ToolSwitchType.File) { DisplayName = "Output bar file name to be signed", @@ -366,41 +338,40 @@ public virtual string OutputFile Name = OUTPUT_FILE, Value = value }; - base.ActiveToolSwitches.Add(OUTPUT_FILE, switch2); - base.AddActiveSwitchToolValue(switch2); + ActiveToolSwitches.Add(OUTPUT_FILE, switch2); + AddActiveSwitchToolValue(switch2); } } /// /// Getter/Setter for the TrackerLogDirectory property /// - public virtual string TrackerLogDirectory + public string TrackerLogDirectory { get { - if (base.IsPropertySet(TRACKER_LOG_DIRECTORY)) + if (IsPropertySet(TRACKER_LOG_DIRECTORY)) { - return base.ActiveToolSwitches[TRACKER_LOG_DIRECTORY].Value; + return ActiveToolSwitches[TRACKER_LOG_DIRECTORY].Value; } return null; } set { - base.ActiveToolSwitches.Remove(TRACKER_LOG_DIRECTORY); + ActiveToolSwitches.Remove(TRACKER_LOG_DIRECTORY); ToolSwitch switch2 = new ToolSwitch(ToolSwitchType.Directory) { DisplayName = "Tracker Log Directory", Description = "Tracker Log Directory.", ArgumentRelationList = new ArrayList(), - Value = VCToolTask.EnsureTrailingSlash(value) + Value = EnsureTrailingSlash(value) }; - base.ActiveToolSwitches.Add(TRACKER_LOG_DIRECTORY, switch2); - base.AddActiveSwitchToolValue(switch2); + ActiveToolSwitches.Add(TRACKER_LOG_DIRECTORY, switch2); + AddActiveSwitchToolValue(switch2); } } - #endregion properties - + #endregion } } \ No newline at end of file diff --git a/src_vs2010/BuildTasks/BBTask.cs b/src_vs2010/BuildTasks/BBTask.cs new file mode 100644 index 00000000..f98196d8 --- /dev/null +++ b/src_vs2010/BuildTasks/BBTask.cs @@ -0,0 +1,27 @@ +using System; +using System.IO; +using System.Resources; +using BlackBerry.NativeCore; +using BlackBerry.NativeCore.Helpers; +using Microsoft.Build.CPPTasks; + +namespace BlackBerry.BuildTasks +{ + public abstract class BBTask : TrackedVCToolTask + { + internal BBTask(ResourceManager taskResources) + : base(taskResources) + { + var newPath = string.Concat("PATH=", Path.Combine(ConfigDefaults.JavaHome, "bin"), ";", Environment.GetEnvironmentVariable("Path", EnvironmentVariableTarget.Process)); + EnvironmentVariables = new[] { newPath }; + } + + /// + /// Decrypts a given string. + /// + protected string DecryptPassword(string value) + { + return GlobalHelper.Decrypt(value); + } + } +} diff --git a/src_vs2010/BuildTasks/BlackBerry.BuildTasks.csproj b/src_vs2010/BuildTasks/BlackBerry.BuildTasks.csproj index 260cc5d3..5fec68a8 100644 --- a/src_vs2010/BuildTasks/BlackBerry.BuildTasks.csproj +++ b/src_vs2010/BuildTasks/BlackBerry.BuildTasks.csproj @@ -72,6 +72,12 @@ + + ConfigDefaults.cs + + + Helpers\GlobalHelper.cs + bar-descriptor.xsd @@ -80,6 +86,8 @@ + + @@ -88,7 +96,6 @@ - True True diff --git a/src_vs2010/BuildTasks/BlackBerry/Rules/packager.xml b/src_vs2010/BuildTasks/BlackBerry/Rules/packager.xml index 8d460806..b37a4cd1 100644 --- a/src_vs2010/BuildTasks/BlackBerry/Rules/packager.xml +++ b/src_vs2010/BuildTasks/BlackBerry/Rules/packager.xml @@ -28,7 +28,7 @@ Category="General" Switch="PackageManifestOnly" F1Keyword="" > diff --git a/src_vs2010/BuildTasks/BlackBerrySimulator/Rules/packager.xml b/src_vs2010/BuildTasks/BlackBerrySimulator/Rules/packager.xml index 8d460806..b37a4cd1 100644 --- a/src_vs2010/BuildTasks/BlackBerrySimulator/Rules/packager.xml +++ b/src_vs2010/BuildTasks/BlackBerrySimulator/Rules/packager.xml @@ -28,7 +28,7 @@ Category="General" Switch="PackageManifestOnly" F1Keyword="" > diff --git a/src_vs2010/BuildTasks/CheckIfInstalled.cs b/src_vs2010/BuildTasks/CheckIfInstalled.cs index 4cc34be0..aca53844 100644 --- a/src_vs2010/BuildTasks/CheckIfInstalled.cs +++ b/src_vs2010/BuildTasks/CheckIfInstalled.cs @@ -20,14 +20,16 @@ namespace BlackBerry.BuildTasks { /// - /// MSBuild Task to check to see if the application was previously installed. + /// MSBuild Task to check if the application was previously installed. /// - public class CheckIfInstalled : Task + public sealed class CheckIfInstalled : Task { #region Member Variables and Constants + private string _listFile; private string _appName; private bool _isAppInstalled; + #endregion /// @@ -36,7 +38,6 @@ public class CheckIfInstalled : Task /// True on successful execution public override bool Execute() { - try { _isAppInstalled = false; @@ -57,8 +58,6 @@ public override bool Execute() { return false; } - - } /// diff --git a/src_vs2010/BuildTasks/DiffManifests.cs b/src_vs2010/BuildTasks/DiffManifests.cs index 8061bcd2..accdd770 100644 --- a/src_vs2010/BuildTasks/DiffManifests.cs +++ b/src_vs2010/BuildTasks/DiffManifests.cs @@ -24,9 +24,10 @@ namespace BlackBerry.BuildTasks /// /// MSBuild task to compare the manifest file from the bar file being uploaded against the one already installed on the device. /// - public class DiffManifests : Task + public sealed class DiffManifests : Task { #region Member Variables and Constants + private string _localManifestFile; private string _targetManifestFile; private string _targetFileMap; @@ -34,12 +35,12 @@ public class DiffManifests : Task private ArrayList _deletedFiles; private int _modifiedFilesCount; private int _deletedFilesCount; + #endregion /// /// Execute the MSBuild Task. /// - /// public override bool Execute() { _modifiedFiles = new ArrayList(); @@ -104,7 +105,7 @@ public override bool Execute() if (!targetFiles.Contains(file)) { TaskItem item = new TaskItem(file.Key); - item.SetMetadata("SourcePath", getSourcePath(file.Key, targetFileMap)); + item.SetMetadata("SourcePath", GetSourcePath(file.Key, targetFileMap)); _modifiedFiles.Add(item); } } @@ -135,8 +136,7 @@ public override bool Execute() /// /// Path to the source file /// Target file map - /// - private string getSourcePath(string sourcePath, string[] targetFileMap) + private string GetSourcePath(string sourcePath, string[] targetFileMap) { foreach (string line in targetFileMap) { @@ -226,7 +226,7 @@ public string TargetManifestFile /// Setter for the targetFileMap property /// [Required] - public string targetFileMap + public string TargetFileMap { set { diff --git a/src_vs2010/BuildTasks/GenerateMakefile.cs b/src_vs2010/BuildTasks/GenerateMakefile.cs index 403b5a1d..8b64e500 100644 --- a/src_vs2010/BuildTasks/GenerateMakefile.cs +++ b/src_vs2010/BuildTasks/GenerateMakefile.cs @@ -14,9 +14,6 @@ using System.Collections.Generic; using System.IO; -using System.Linq; -using System.Runtime.InteropServices; -using System.Text; using Microsoft.Build.Framework; using Microsoft.Build.Utilities; @@ -25,10 +22,11 @@ namespace BlackBerry.BuildTasks /// /// MSBuild Task for generating a make file for packaging the bar file. /// - public class GenerateMakefile : Task + public sealed class GenerateMakefile : Task { #region Member Variables and Constants - private string _projectDir; + + private string _projectDirectory; private string _intDir; private string _outDir; @@ -85,9 +83,10 @@ public class GenerateMakefile : Task "-include $(II_DEPS)\n" + "endif\n" + "endif\n\n"; + #endregion - #region properties + #region Properties /// /// Getter/Setter for CompileItems property @@ -112,8 +111,8 @@ public ITaskItem[] LinkItems /// public string ProjectDir { - set { _projectDir = value.Replace('\\', '/'); } - get { return _projectDir; } + set { _projectDirectory = value.Replace('\\', '/'); } + get { return _projectDirectory; } } /// @@ -161,7 +160,6 @@ public string[] ExcludeDirectories get; } - /// /// Getter/Setter for TargetName property /// @@ -209,22 +207,6 @@ public string Platform #endregion - /// - /// Interface to unmanaged code for getting the SHortPathName for a given directory. - /// - /// Path to be converted - /// Returned ShortPathName - /// Length of the ShortPathName - /// - [DllImport("kernel32.dll", CharSet = CharSet.Auto)] - public static extern int GetShortPathName( - [MarshalAs(UnmanagedType.LPTStr)] - string path, - [MarshalAs(UnmanagedType.LPTStr)] - StringBuilder shortPath, - int shortPathLength - ); - /// /// Execute MSBuild Task /// @@ -243,7 +225,6 @@ public override bool Execute() using (StreamWriter outFile = new StreamWriter(IntDir + "makefile")) { outFile.Write(INITIAL_DEFINITIONS); - // System.Diagnostics.Debugger.Launch(); foreach (ITaskItem compileItem in CompileItems) { // Get the metadata we need from this compile item. @@ -261,16 +242,13 @@ public override bool Execute() string additionalOptions = compileItem.GetMetadata("AdditionalOptions"); string fullPath = compileItem.GetMetadata("FullPath").Replace('\\', '/'); - /// if CompileItem is in the ExcludedPath then continue. - if (isExcludedPath(fullPath)) + // if CompileItem is in the ExcludedPath then continue. + if (IsExcludedPath(fullPath)) { - continue; } - StringBuilder shortPath = new StringBuilder(1024); - GetShortPathName(fullPath, shortPath, shortPath.Capacity); - string fullPathShortened = shortPath.ToString(); + string fullPathShortened = NativeMethods.GetShortPathName(fullPath); string handleExceptions = compileItem.GetMetadata("GccExceptionHandling"); @@ -282,7 +260,7 @@ public override bool Execute() { // Prepend ProjectDir to relative paths -- otherwise they will be interpreted // as being relative to the build dir, e.g. ProjectDir/BlackBerry/Debug - if (additionalIncludeDirs[i] != "" && !additionalIncludeDirs[i].Contains(':')) + if (!string.IsNullOrEmpty(additionalIncludeDirs[i]) && additionalIncludeDirs[i].IndexOf(':') < 0) additionalIncludeDirs[i] = ProjectDir + additionalIncludeDirs[i]; } @@ -388,10 +366,7 @@ public override bool Execute() outFile.WriteLine(); string rootedOutDir = (Path.IsPathRooted(OutDir)) ? OutDir : ProjectDir + OutDir; - - StringBuilder shortOutPath = new StringBuilder(1024); - GetShortPathName(rootedOutDir, shortOutPath, shortOutPath.Capacity); - rootedOutDir = shortOutPath.ToString(); + rootedOutDir = NativeMethods.GetShortPathName(rootedOutDir); if (ConfigurationType == "StaticLibrary") { @@ -421,7 +396,7 @@ public override bool Execute() for (int i = 0; i < libDirs.Length; i++) { // Prepend ProjectDir to relative paths. - if (libDirs[i] != "" && !libDirs[i].Contains(':')) + if (!string.IsNullOrEmpty(libDirs[i]) && libDirs[i].IndexOf(':') < 0) libDirs[i] = ProjectDir + libDirs[i]; } @@ -495,22 +470,16 @@ public override bool Execute() /// /// Check to see if path is in the excluded list /// - /// - /// - private bool isExcludedPath(string path) + private bool IsExcludedPath(string path) { if (ExcludeDirectories != null) { - foreach (string exDir in ExcludeDirectories) + foreach (string excludedDir in ExcludeDirectories) { - if (Path.GetFullPath(path).Contains(Path.GetFullPath(exDir))) + if (Path.GetFullPath(path).Contains(Path.GetFullPath(excludedDir))) { return true; } -/* else - { - return false; - }*/ } } return false; diff --git a/src_vs2010/BuildTasks/GetAppInfo.cs b/src_vs2010/BuildTasks/GetAppInfo.cs index 82113f8c..f8d6b7e3 100644 --- a/src_vs2010/BuildTasks/GetAppInfo.cs +++ b/src_vs2010/BuildTasks/GetAppInfo.cs @@ -22,7 +22,7 @@ namespace BlackBerry.BuildTasks /// /// MSBuid Task to retrieve the application info /// - public class GetAppInfo : Task + public sealed class GetAppInfo : Task { #region Member Variables and Constants private string _projectDir; @@ -34,7 +34,6 @@ public class GetAppInfo : Task /// /// Execute the MSBuild Task /// - /// public override bool Execute() { string rootedOutDir = (Path.IsPathRooted(_barDescriptorPath)) ? _barDescriptorPath : _projectDir + _barDescriptorPath; @@ -50,13 +49,13 @@ public override bool Execute() /// public string ApplicationDescriptorXml { - set + set { _barDescriptorPath = value; } - get + get { - return _barDescriptorPath; + return _barDescriptorPath; } } diff --git a/src_vs2010/BuildTasks/MakeAllAndFormatOutputMessages.cs b/src_vs2010/BuildTasks/MakeAllAndFormatOutputMessages.cs index 125201ce..efaea04b 100644 --- a/src_vs2010/BuildTasks/MakeAllAndFormatOutputMessages.cs +++ b/src_vs2010/BuildTasks/MakeAllAndFormatOutputMessages.cs @@ -15,7 +15,6 @@ using System; using System.Diagnostics; using System.IO; -using System.Runtime.InteropServices; using System.Text; using System.Text.RegularExpressions; using Microsoft.Build.Framework; @@ -25,7 +24,7 @@ namespace BlackBerry.BuildTasks /// /// Cancelabe MSBuild Task for Running the Make file for the build. /// - public class MakeAllAndFormatOutputMessages : ICancelableTask + public sealed class MakeAllAndFormatOutputMessages : ICancelableTask { #region Member Variables and Constants @@ -35,7 +34,7 @@ public class MakeAllAndFormatOutputMessages : ICancelableTask private static StringBuilder _stdOutput; private static StringBuilder _errorOutput; private IBuildEngine _buildEngine; - private Process _proc; + private Process _process; private ITaskHost _hostObject; private string _numProcessors; @@ -106,39 +105,39 @@ public bool Execute() else pArgs = "/c " + ToolsPath + @"\make all"; - System.Diagnostics.ProcessStartInfo procStartInfo = new System.Diagnostics.ProcessStartInfo(pCommand, pArgs); + ProcessStartInfo startInfo = new ProcessStartInfo(pCommand, pArgs); // Set UseShellExecute to false for redirection. - procStartInfo.UseShellExecute = false; + startInfo.UseShellExecute = false; // The following commands are needed to redirect the standard and error outputs. // These streams are read asynchronously using an event handler. - procStartInfo.RedirectStandardOutput = true; - _stdOutput = new StringBuilder(""); - procStartInfo.RedirectStandardError = true; - _errorOutput = new StringBuilder(""); + startInfo.RedirectStandardOutput = true; + startInfo.RedirectStandardError = true; + _stdOutput = new StringBuilder(); + _errorOutput = new StringBuilder(); // Setting the work directory. - string rootedOutDir = (Path.IsPathRooted(OutDir)) ? OutDir : ProjectDir + OutDir; - procStartInfo.WorkingDirectory = rootedOutDir; + string rootedOutDir = Path.IsPathRooted(OutDir) ? OutDir : ProjectDir + OutDir; + startInfo.WorkingDirectory = rootedOutDir; // Do not create the black window. - procStartInfo.CreateNoWindow = true; + startInfo.CreateNoWindow = true; // Create a process and assign its ProcessStartInfo - _proc = new Process(); - _proc.StartInfo = procStartInfo; + _process = new Process(); + _process.StartInfo = startInfo; // Set ours events handlers to asynchronously read the standard and error outputs. - _proc.OutputDataReceived += StdOutputHandler; - _proc.ErrorDataReceived += ErrorOutputHandler; + _process.OutputDataReceived += StdOutputHandler; + _process.ErrorDataReceived += ErrorOutputHandler; // Start the process - _proc.Start(); + _process.Start(); // Start the asynchronous read of the standard and error output stream. - _proc.BeginOutputReadLine(); - _proc.BeginErrorReadLine(); + _process.BeginOutputReadLine(); + _process.BeginErrorReadLine(); do { @@ -146,7 +145,7 @@ public bool Execute() // This code is correct, don't remove it. WaitForExit freezes the IDE while waiting for the end of the build process. // With this loop and the time out, the IDE won't be frozen enabling the build process to be cancelled. } - while (!_proc.WaitForExit(1000)); + while (!_process.WaitForExit(1000)); } catch (Exception e) @@ -160,12 +159,10 @@ public bool Execute() int pos = _errorOutput.ToString().LastIndexOf("\\make:"); if (pos == -1) return true; - else - { - pos = _errorOutput.ToString().IndexOf("Error ", pos); - if (pos == -1) - return true; - } + + pos = _errorOutput.ToString().IndexOf("Error ", pos); + if (pos == -1) + return true; } return false; @@ -179,11 +176,11 @@ public bool Execute() /// Output Text private void StdOutputHandler(object sendingProcess, DataReceivedEventArgs outLine) { - if (!String.IsNullOrEmpty(outLine.Data)) + if (!string.IsNullOrEmpty(outLine.Data)) { string outputText = outLine.Data; - int tilde = outputText.IndexOf("~"); + int tilde = outputText.IndexOf("~", StringComparison.InvariantCulture); while (tilde != -1) { int end = outputText.IndexOf(':', tilde); @@ -205,10 +202,9 @@ private void StdOutputHandler(object sendingProcess, DataReceivedEventArgs outLi int begin1 = outputText.LastIndexOf(' ', tilde) + 1; if (begin < begin1) begin = begin1; - StringBuilder longPathName = new StringBuilder(1024); string shortPathName = outputText.Substring(begin, end - begin); - GetLongPathName(shortPathName, longPathName, longPathName.Capacity); - if (longPathName.ToString() == "") + var longPathName = NativeMethods.GetLongPathName(shortPathName); + if (string.IsNullOrEmpty(longPathName)) { int sep = shortPathName.LastIndexOf('/'); int sep2 = shortPathName.LastIndexOf('\\'); @@ -217,24 +213,16 @@ private void StdOutputHandler(object sendingProcess, DataReceivedEventArgs outLi if (sep != -1) { shortPathName = shortPathName.Remove(sep + 1); - GetLongPathName(shortPathName, longPathName, longPathName.Capacity); + longPathName = NativeMethods.GetLongPathName(shortPathName); } } - if (longPathName.ToString() != "") - outputText = outputText.Replace(shortPathName, longPathName.ToString()); + if (!string.IsNullOrEmpty(longPathName)) + outputText = outputText.Replace(shortPathName, longPathName); - tilde = outputText.IndexOf("~", tilde + 1); + tilde = outputText.IndexOf("~", tilde + 1, StringComparison.InvariantCulture); } - - try - { - BuildMessageEventArgs taskEvent = new BuildMessageEventArgs(outputText, "", "", MessageImportance.High); - BuildEngine.LogMessageEvent(taskEvent); - } - catch - { - } + NotifyMessage(new BuildMessageEventArgs(outputText, "", "", MessageImportance.High)); } } @@ -285,10 +273,9 @@ private void ErrorOutputHandler(object sendingProcess, DataReceivedEventArgs out tilde = newPath.IndexOf("~"); if (tilde != -1) { - StringBuilder longPathName = new StringBuilder(1024); string shortPathName = newPath.Substring(0, end); - GetLongPathName(shortPathName, longPathName, longPathName.Capacity); - newPath = longPathName.ToString() + newPath.Substring(end); + var longPathName = NativeMethods.GetLongPathName(shortPathName); + newPath = longPathName + newPath.Substring(end); } diff += (newPath.Length - oldPath.Length); @@ -333,9 +320,8 @@ private void ErrorOutputHandler(object sendingProcess, DataReceivedEventArgs out tilde = newPath.IndexOf("~"); if (tilde != -1) { - StringBuilder longPathName = new StringBuilder(1024); string shortPathName = newPath.Substring(0, end); - GetLongPathName(shortPathName, longPathName, longPathName.Capacity); + var longPathName = NativeMethods.GetLongPathName(shortPathName); newPath = longPathName + newPath.Substring(end); } @@ -369,10 +355,9 @@ private void ErrorOutputHandler(object sendingProcess, DataReceivedEventArgs out int begin1 = outputText.LastIndexOf(' ', tilde) + 1; if (begin < begin1) begin = begin1; - StringBuilder longPathName = new StringBuilder(1024); string shortPathName = outputText.Substring(begin, end - begin); - GetLongPathName(shortPathName, longPathName, longPathName.Capacity); - if (longPathName.ToString() == "") + var longPathName = NativeMethods.GetLongPathName(shortPathName); + if (string.IsNullOrEmpty(longPathName)) { int sep = shortPathName.LastIndexOf('/'); int sep2 = shortPathName.LastIndexOf('\\'); @@ -381,11 +366,11 @@ private void ErrorOutputHandler(object sendingProcess, DataReceivedEventArgs out if (sep != -1) { shortPathName = shortPathName.Remove(sep + 1); - GetLongPathName(shortPathName, longPathName, longPathName.Capacity); + longPathName = NativeMethods.GetLongPathName(shortPathName); } } - if (longPathName.ToString() != "") - outputText = outputText.Replace(shortPathName, longPathName.ToString()); + if (!string.IsNullOrEmpty(longPathName)) + outputText = outputText.Replace(shortPathName, longPathName); tilde = outputText.IndexOf("~", tilde + 1); } @@ -420,8 +405,7 @@ private void ErrorOutputHandler(object sendingProcess, DataReceivedEventArgs out int colNum = 0; string messageErr = outputText.Substring(outputText.IndexOf(": error:") + 9); fileName = fileName.Substring(0, fileName.IndexOf('(')); - BuildErrorEventArgs errorEvent = new BuildErrorEventArgs("", "", fileName, lineNum, colNum, 0, 0, messageErr, "", ""); - BuildEngine.LogErrorEvent(errorEvent); + NotifyError(new BuildErrorEventArgs("", "", fileName, lineNum, colNum, 0, 0, messageErr, "", "")); } else if (outputText.IndexOf(": warning:") > 0) { @@ -451,8 +435,7 @@ private void ErrorOutputHandler(object sendingProcess, DataReceivedEventArgs out int colNum = 0; string messageErr = outputText.Substring(outputText.IndexOf(": warning:") + 11); fileName = fileName.Substring(0, fileName.IndexOf('(')); - BuildWarningEventArgs warningEvent = new BuildWarningEventArgs("", "", fileName, lineNum, colNum, 0, 0, messageErr, "", ""); - BuildEngine.LogWarningEvent(warningEvent); + NotifyWarning(new BuildWarningEventArgs("", "", fileName, lineNum, colNum, 0, 0, messageErr, "", "")); } else if (outputText.Contains("undefined reference")) { @@ -482,13 +465,11 @@ private void ErrorOutputHandler(object sendingProcess, DataReceivedEventArgs out message = outputText.Substring(outputText.LastIndexOf(':') + 1).Trim(); } - BuildErrorEventArgs errorEvent = new BuildErrorEventArgs("", "", fileName, lineNum, 1, 0, 0, message, "", ""); - BuildEngine.LogErrorEvent(errorEvent); + NotifyError(new BuildErrorEventArgs("", "", fileName, lineNum, 1, 0, 0, message, "", "")); } else { - BuildMessageEventArgs taskEvent = new BuildMessageEventArgs(outputText, "", "", MessageImportance.High); - BuildEngine.LogMessageEvent(taskEvent); + NotifyMessage(new BuildMessageEventArgs(outputText, "", "", MessageImportance.High)); } // Add the text to the collected output. @@ -496,21 +477,59 @@ private void ErrorOutputHandler(object sendingProcess, DataReceivedEventArgs out } } + private void NotifyMessage(BuildMessageEventArgs e) + { + if (e != null) + { + try + { + if (BuildEngine != null) + { + BuildEngine.LogMessageEvent(e); + } + } + catch (Exception ex) + { + Trace.WriteLine(ex.Message, "BlackBerry.Build.Log"); + } + } + } + + private void NotifyWarning(BuildWarningEventArgs e) + { + if (e != null) + { + try + { + if (BuildEngine != null) + { + BuildEngine.LogWarningEvent(e); + } + } + catch (Exception ex) + { + Trace.WriteLine(ex.Message, "BlackBerry.Build.Warning"); + } + } + } - /// GDB works with short path names only, which requires converting the path names to/from long ones. This function - /// returns the long path name for a given short one. - /// Short path name. - /// Returns this long path name. - /// Lenght of this long path name. - /// - [DllImport("kernel32.dll", CharSet = CharSet.Auto)] - public static extern int GetLongPathName( - [MarshalAs(UnmanagedType.LPTStr)] - string path, - [MarshalAs(UnmanagedType.LPTStr)] - StringBuilder longPath, - int longPathLength - ); + private void NotifyError(BuildErrorEventArgs e) + { + if (e != null) + { + try + { + if (BuildEngine != null) + { + BuildEngine.LogErrorEvent(e); + } + } + catch (Exception ex) + { + Trace.WriteLine(ex.Message, "BlackBerry.Build.Error"); + } + } + } [Required] public string ProjectDir @@ -540,14 +559,12 @@ public void Cancel() { try { - _proc.Kill(); + _process.Kill(); } catch (Exception ex) { - BuildMessageEventArgs taskEvent2 = new BuildMessageEventArgs(ex.Message, "", "", MessageImportance.High); - BuildEngine.LogMessageEvent(taskEvent2); + NotifyMessage(new BuildMessageEventArgs(ex.Message, "", "", MessageImportance.High)); } - } } } diff --git a/src_vs2010/BuildTasks/NativeMethods.cs b/src_vs2010/BuildTasks/NativeMethods.cs new file mode 100644 index 00000000..7e9129c3 --- /dev/null +++ b/src_vs2010/BuildTasks/NativeMethods.cs @@ -0,0 +1,92 @@ +using System.Runtime.InteropServices; +using System.Text; + +namespace BlackBerry.BuildTasks +{ + internal static class NativeMethods + { + /// + /// Interface to unmanaged code for getting the ShortPathName for a given directory. + /// + /// Path to be converted + /// Returned ShortPathName + /// Length of the ShortPathName + /// + [DllImport("kernel32.dll", CharSet = CharSet.Auto)] + private static extern int GetShortPathName( + [MarshalAs(UnmanagedType.LPTStr)] + string path, + [MarshalAs(UnmanagedType.LPTStr)] + StringBuilder shortPath, + int shortPathLength); + /// GDB works with short path names only, which requires converting the path names to/from long ones. This function + /// returns the long path name for a given short one. + /// Short path name. + /// Returns this long path name. + /// Lenght of this long path name. + /// + [DllImport("kernel32.dll", CharSet = CharSet.Auto)] + private static extern int GetLongPathName( + [MarshalAs(UnmanagedType.LPTStr)] + string path, + [MarshalAs(UnmanagedType.LPTStr)] + StringBuilder longPath, + int longPathLength); + + /// + /// Gets the short version of specified path. + /// + public static string GetShortPathName(string path) + { + const int size = 1024; + var buffer = new StringBuilder(size); + + do + { + int result = GetShortPathName(path, buffer, buffer.Capacity); + + // did the call failed to convert the path? + if (result == 0) + return null; + // was the buffer too small: + if (result == buffer.Capacity) + { + buffer.Capacity += size; + continue; + } + + return buffer.ToString(0, result); + } while (false); + + return null; + } + + /// + /// Gets the long version of specified path. + /// + public static string GetLongPathName(string path) + { + const int size = 1024; + var buffer = new StringBuilder(size); + + do + { + int result = GetLongPathName(path, buffer, buffer.Capacity); + + // did the call failed to convert the path? + if (result == 0) + return null; + // was the buffer too small: + if (result == buffer.Capacity) + { + buffer.Capacity += size; + continue; + } + + return buffer.ToString(0, result); + } while (false); + + return null; + } + } +} diff --git a/src_vs2010/BuildTasks/PackagerCmdBuilder.cs b/src_vs2010/BuildTasks/PackagerCmdBuilder.cs index 0d5ef1b6..4c231bd7 100644 --- a/src_vs2010/BuildTasks/PackagerCmdBuilder.cs +++ b/src_vs2010/BuildTasks/PackagerCmdBuilder.cs @@ -16,10 +16,10 @@ namespace BlackBerry.BuildTasks { - class PackagerCmdBuilder : CommandLineBuilder + sealed class PackagerCmdBuilder : CommandLineBuilder { /// - /// Constructor + /// Default constructor /// public PackagerCmdBuilder() : base(true) @@ -27,7 +27,7 @@ public PackagerCmdBuilder() } /// - /// Override of IsQuotingRequired function. Always return true. + /// Override of IsQuotingRequired function. Always return true. /// protected override bool IsQuotingRequired(string parameter) { diff --git a/src_vs2010/BuildTasks/QccCompiler.cs b/src_vs2010/BuildTasks/QccCompiler.cs index b98bc9b0..49505830 100644 --- a/src_vs2010/BuildTasks/QccCompiler.cs +++ b/src_vs2010/BuildTasks/QccCompiler.cs @@ -20,11 +20,12 @@ namespace BlackBerry.BuildTasks { - public class QccCompiler : VSNDKTasks + public sealed class QccCompiler : QccTask { - #region fields + #region Fields + // Fields - private ITaskItem[] preprocessOutput; + private ITaskItem[] _preprocessOutput; //constant fields private const string ADDITIONAL_INCLUDEDIRECTORIES = "AdditionalIncludeDirectories"; @@ -36,27 +37,30 @@ public class QccCompiler : VSNDKTasks private const string RUNTIME_TYPE_INFO = "RuntimeTypeInfo"; private const string OBJECT_FILE_NAME = "ObjectFileName"; private const string ANSI = "Ansi"; + #endregion - #region ctors + /// + /// QccCompiler default constructor + /// public QccCompiler() : base(Resources.ResourceManager) { - this.preprocessOutput = new ITaskItem[0]; - this.switchOrderList.Add(ADDITIONAL_INCLUDEDIRECTORIES); - this.switchOrderList.Add(ANSI); - this.switchOrderList.Add(PREPROCESSOR_DEFINITIONS); - this.switchOrderList.Add(UNDEFINE_PREPROCESSOR_DEFINITION); - this.switchOrderList.Add(PREPROCESS_TO_FILE); - this.switchOrderList.Add(PREPROCESS_TO_STDOUT); - this.switchOrderList.Add(PREPROCESS_KEEP_COMMENTS); - this.switchOrderList.Add(RUNTIME_TYPE_INFO); - this.switchOrderList.Add(OBJECT_FILE_NAME); - this.switchOrderList.Add(SOURCES); + _preprocessOutput = new ITaskItem[0]; + _switchOrderList.Add(ADDITIONAL_INCLUDEDIRECTORIES); + _switchOrderList.Add(ANSI); + _switchOrderList.Add(PREPROCESSOR_DEFINITIONS); + _switchOrderList.Add(UNDEFINE_PREPROCESSOR_DEFINITION); + _switchOrderList.Add(PREPROCESS_TO_FILE); + _switchOrderList.Add(PREPROCESS_TO_STDOUT); + _switchOrderList.Add(PREPROCESS_KEEP_COMMENTS); + _switchOrderList.Add(RUNTIME_TYPE_INFO); + _switchOrderList.Add(OBJECT_FILE_NAME); + _switchOrderList.Add(SOURCES); } - #endregion - #region overrides + #region Overrides + /// /// Getter/Setter for the AlwaysAppend property /// @@ -82,7 +86,7 @@ public override bool AttributeFileTracking /// /// Getter/Setter for the TrackedInputFiles property /// - protected override Microsoft.Build.Framework.ITaskItem[] TrackedInputFiles + protected override ITaskItem[] TrackedInputFiles { get { @@ -99,7 +103,7 @@ protected override Microsoft.Build.Framework.ITaskItem[] TrackedInputFiles /// protected override int ExecuteTool(string pathToTool, string responseFileCommands, string commandLineCommands) { - foreach (ITaskItem item in this.Sources) + foreach (ITaskItem item in Sources) { string source = item.ItemSpec; base.LogEventsFromTextOutput(source, MessageImportance.High); @@ -114,7 +118,7 @@ protected override string[] WriteTLogNames { get { - return new string[] { "qcc_compiler.write.1.tlog", "qcc_compiler.*.write.1.tlog" }; + return new[] { "qcc_compiler.write.1.tlog", "qcc_compiler.*.write.1.tlog" }; } } @@ -136,12 +140,12 @@ protected override string[] ReadTLogNames { get { - return new string[] { "qcc_compiler.read.1.tlog", "qcc_compiler.*.read.1.tlog" }; + return new[] { "qcc_compiler.read.1.tlog", "qcc_compiler.*.read.1.tlog" }; } } - #endregion //override + #endregion - #region properties + #region Properties /// /// GetterSetter for the AdditionalIncludeDirectories property. @@ -150,15 +154,15 @@ public string[] AdditionalIncludeDirectories { get { - if (base.IsPropertySet(ADDITIONAL_INCLUDEDIRECTORIES)) + if (IsPropertySet(ADDITIONAL_INCLUDEDIRECTORIES)) { - return base.ActiveToolSwitches[ADDITIONAL_INCLUDEDIRECTORIES].StringList; + return ActiveToolSwitches[ADDITIONAL_INCLUDEDIRECTORIES].StringList; } return null; } set { - base.ActiveToolSwitches.Remove(ADDITIONAL_INCLUDEDIRECTORIES); + ActiveToolSwitches.Remove(ADDITIONAL_INCLUDEDIRECTORIES); ToolSwitch switch2 = new ToolSwitch(ToolSwitchType.StringArray) { DisplayName = "Additional Include Directories", @@ -168,8 +172,8 @@ public string[] AdditionalIncludeDirectories Name = ADDITIONAL_INCLUDEDIRECTORIES, StringList = value }; - base.ActiveToolSwitches.Add(ADDITIONAL_INCLUDEDIRECTORIES, switch2); - base.AddActiveSwitchToolValue(switch2); + ActiveToolSwitches.Add(ADDITIONAL_INCLUDEDIRECTORIES, switch2); + AddActiveSwitchToolValue(switch2); } } @@ -180,11 +184,11 @@ public bool Ansi { get { - return (base.IsPropertySet(ANSI) && base.ActiveToolSwitches[ANSI].BooleanValue); + return (IsPropertySet(ANSI) && ActiveToolSwitches[ANSI].BooleanValue); } set { - base.ActiveToolSwitches.Remove(ANSI); + ActiveToolSwitches.Remove(ANSI); ToolSwitch switch2 = new ToolSwitch(ToolSwitchType.Boolean) { DisplayName = "Compile ANSI code", @@ -194,23 +198,23 @@ public bool Ansi Name = ANSI, BooleanValue = value }; - base.ActiveToolSwitches.Add(ANSI, switch2); - base.AddActiveSwitchToolValue(switch2); + ActiveToolSwitches.Add(ANSI, switch2); + AddActiveSwitchToolValue(switch2); } } /// /// Getter/Setter for the MinimalRebuild property /// - public virtual bool MinimalRebuild + public bool MinimalRebuild { get { - return (base.IsPropertySet("MinimalRebuild") && base.ActiveToolSwitches["MinimalRebuild"].BooleanValue); + return (IsPropertySet("MinimalRebuild") && ActiveToolSwitches["MinimalRebuild"].BooleanValue); } set { - base.ActiveToolSwitches.Remove("MinimalRebuild"); + ActiveToolSwitches.Remove("MinimalRebuild"); ToolSwitch switch2 = new ToolSwitch(ToolSwitchType.Boolean) { DisplayName = "Enable Minimal Rebuild", @@ -221,8 +225,8 @@ public virtual bool MinimalRebuild Name = "MinimalRebuild", BooleanValue = value }; - base.ActiveToolSwitches.Add("MinimalRebuild", switch2); - base.AddActiveSwitchToolValue(switch2); + ActiveToolSwitches.Add("MinimalRebuild", switch2); + AddActiveSwitchToolValue(switch2); switch2.Overrides.AddLast(new KeyValuePair("Gm", "Gm-")); switch2.Overrides.AddLast(new KeyValuePair("Gm-", "Gm")); } @@ -235,15 +239,15 @@ public string ObjectFileName { get { - if (base.IsPropertySet(OBJECT_FILE_NAME)) + if (IsPropertySet(OBJECT_FILE_NAME)) { - return base.ActiveToolSwitches[OBJECT_FILE_NAME].Value; + return ActiveToolSwitches[OBJECT_FILE_NAME].Value; } return null; } set { - base.ActiveToolSwitches.Remove(OBJECT_FILE_NAME); + ActiveToolSwitches.Remove(OBJECT_FILE_NAME); ToolSwitch switch2 = new ToolSwitch(ToolSwitchType.File) { DisplayName = "Object File Name", @@ -253,8 +257,8 @@ public string ObjectFileName Name = OBJECT_FILE_NAME, Value = value }; - base.ActiveToolSwitches.Add(OBJECT_FILE_NAME, switch2); - base.AddActiveSwitchToolValue(switch2); + ActiveToolSwitches.Add(OBJECT_FILE_NAME, switch2); + AddActiveSwitchToolValue(switch2); } } @@ -265,11 +269,11 @@ public bool ExpandAttributedSource { get { - return (base.IsPropertySet("ExpandAttributedSource") && base.ActiveToolSwitches["ExpandAttributedSource"].BooleanValue); + return (IsPropertySet("ExpandAttributedSource") && ActiveToolSwitches["ExpandAttributedSource"].BooleanValue); } set { - base.ActiveToolSwitches.Remove("ExpandAttributedSource"); + ActiveToolSwitches.Remove("ExpandAttributedSource"); ToolSwitch switch2 = new ToolSwitch(ToolSwitchType.Boolean) { DisplayName = "Expand Attributed Source", @@ -279,8 +283,8 @@ public bool ExpandAttributedSource Name = "ExpandAttributedSource", BooleanValue = value }; - base.ActiveToolSwitches.Add("ExpandAttributedSource", switch2); - base.AddActiveSwitchToolValue(switch2); + ActiveToolSwitches.Add("ExpandAttributedSource", switch2); + AddActiveSwitchToolValue(switch2); } } @@ -291,28 +295,33 @@ public string FavorSizeOrSpeed { get { - if (base.IsPropertySet("FavorSizeOrSpeed")) + if (IsPropertySet("FavorSizeOrSpeed")) { - return base.ActiveToolSwitches["FavorSizeOrSpeed"].Value; + return ActiveToolSwitches["FavorSizeOrSpeed"].Value; } return null; } set { - base.ActiveToolSwitches.Remove("FavorSizeOrSpeed"); + ActiveToolSwitches.Remove("FavorSizeOrSpeed"); ToolSwitch switch2 = new ToolSwitch(ToolSwitchType.String) { DisplayName = "Favor Size Or Speed", Description = "Whether to favor code size or code speed; 'Global Optimization' must be turned on. (/Ot, /Os)", ArgumentRelationList = new ArrayList() }; - string[][] switchMap = new string[][] { new string[] { "Size", "/Os" }, new string[] { "Speed", "/Ot" }, new string[] { "Neither", "" } }; - switch2.SwitchValue = base.ReadSwitchMap("FavorSizeOrSpeed", switchMap, value); + string[][] switchMap = + { + new[] { "Size", "/Os" }, + new[] { "Speed", "/Ot" }, + new[] { "Neither", "" } + }; + switch2.SwitchValue = ReadSwitchMap("FavorSizeOrSpeed", switchMap, value); switch2.Name = "FavorSizeOrSpeed"; switch2.Value = value; switch2.MultipleValues = true; - base.ActiveToolSwitches.Add("FavorSizeOrSpeed", switch2); - base.AddActiveSwitchToolValue(switch2); + ActiveToolSwitches.Add("FavorSizeOrSpeed", switch2); + AddActiveSwitchToolValue(switch2); } } @@ -323,11 +332,11 @@ public bool PreprocessKeepComments { get { - return (base.IsPropertySet(PREPROCESS_KEEP_COMMENTS) && base.ActiveToolSwitches[PREPROCESS_KEEP_COMMENTS].BooleanValue); + return (IsPropertySet(PREPROCESS_KEEP_COMMENTS) && ActiveToolSwitches[PREPROCESS_KEEP_COMMENTS].BooleanValue); } set { - base.ActiveToolSwitches.Remove(PREPROCESS_KEEP_COMMENTS); + ActiveToolSwitches.Remove(PREPROCESS_KEEP_COMMENTS); ToolSwitch switch2 = new ToolSwitch(ToolSwitchType.Boolean) { DisplayName = "Keep Comments", @@ -337,8 +346,8 @@ public bool PreprocessKeepComments Name = PREPROCESS_KEEP_COMMENTS, BooleanValue = value }; - base.ActiveToolSwitches.Add(PREPROCESS_KEEP_COMMENTS, switch2); - base.AddActiveSwitchToolValue(switch2); + ActiveToolSwitches.Add(PREPROCESS_KEEP_COMMENTS, switch2); + AddActiveSwitchToolValue(switch2); } } @@ -349,15 +358,15 @@ public string[] PreprocessorDefinitions { get { - if (base.IsPropertySet(PREPROCESSOR_DEFINITIONS)) + if (IsPropertySet(PREPROCESSOR_DEFINITIONS)) { - return base.ActiveToolSwitches[PREPROCESSOR_DEFINITIONS].StringList; + return ActiveToolSwitches[PREPROCESSOR_DEFINITIONS].StringList; } return null; } set { - base.ActiveToolSwitches.Remove(PREPROCESSOR_DEFINITIONS); + ActiveToolSwitches.Remove(PREPROCESSOR_DEFINITIONS); ToolSwitch switch2 = new ToolSwitch(ToolSwitchType.StringArray) { DisplayName = "Preprocessor Definitions", @@ -367,8 +376,8 @@ public string[] PreprocessorDefinitions Name = PREPROCESSOR_DEFINITIONS, StringList = value }; - base.ActiveToolSwitches.Add(PREPROCESSOR_DEFINITIONS, switch2); - base.AddActiveSwitchToolValue(switch2); + ActiveToolSwitches.Add(PREPROCESSOR_DEFINITIONS, switch2); + AddActiveSwitchToolValue(switch2); } } @@ -380,11 +389,11 @@ public ITaskItem[] PreprocessOutput { get { - return this.preprocessOutput; + return _preprocessOutput; } set { - this.preprocessOutput = value; + _preprocessOutput = value; } } @@ -395,26 +404,26 @@ public string PreprocessOutputPath { get { - if (base.IsPropertySet(PREPROCESS_TO_STDOUT)) + if (IsPropertySet(PREPROCESS_TO_STDOUT)) { - return base.ActiveToolSwitches[PREPROCESS_TO_STDOUT].Value; + return ActiveToolSwitches[PREPROCESS_TO_STDOUT].Value; } return null; } set { - base.ActiveToolSwitches.Remove(PREPROCESS_TO_STDOUT); + ActiveToolSwitches.Remove(PREPROCESS_TO_STDOUT); ToolSwitch switch2 = new ToolSwitch(ToolSwitchType.String) { DisplayName = "Preprocess Output Path", - Description = "Specify the output path for the preprocesser. The default location is the same as the source file(s).", + Description = "Specify the output path for the preprocessor. The default location is the same as the source file(s).", ArgumentRelationList = new ArrayList(), Name = PREPROCESS_TO_STDOUT, Value = value, SwitchValue = "E" }; - base.ActiveToolSwitches.Add(PREPROCESS_TO_STDOUT, switch2); - base.AddActiveSwitchToolValue(switch2); + ActiveToolSwitches.Add(PREPROCESS_TO_STDOUT, switch2); + AddActiveSwitchToolValue(switch2); } } @@ -425,11 +434,11 @@ public bool PreprocessSuppressLineNumbers { get { - return (base.IsPropertySet("PreprocessSuppressLineNumbers") && base.ActiveToolSwitches["PreprocessSuppressLineNumbers"].BooleanValue); + return (IsPropertySet("PreprocessSuppressLineNumbers") && ActiveToolSwitches["PreprocessSuppressLineNumbers"].BooleanValue); } set { - base.ActiveToolSwitches.Remove("PreprocessSuppressLineNumbers"); + ActiveToolSwitches.Remove("PreprocessSuppressLineNumbers"); ToolSwitch switch2 = new ToolSwitch(ToolSwitchType.Boolean) { DisplayName = "Preprocess Suppress Line Numbers", @@ -439,8 +448,8 @@ public bool PreprocessSuppressLineNumbers Name = "PreprocessSuppressLineNumbers", BooleanValue = value }; - base.ActiveToolSwitches.Add("PreprocessSuppressLineNumbers", switch2); - base.AddActiveSwitchToolValue(switch2); + ActiveToolSwitches.Add("PreprocessSuppressLineNumbers", switch2); + AddActiveSwitchToolValue(switch2); } } @@ -451,11 +460,11 @@ public bool PreprocessToFile { get { - return (base.IsPropertySet(PREPROCESS_TO_FILE) && base.ActiveToolSwitches[PREPROCESS_TO_FILE].BooleanValue); + return (IsPropertySet(PREPROCESS_TO_FILE) && ActiveToolSwitches[PREPROCESS_TO_FILE].BooleanValue); } set { - base.ActiveToolSwitches.Remove(PREPROCESS_TO_FILE); + ActiveToolSwitches.Remove(PREPROCESS_TO_FILE); ToolSwitch switch2 = new ToolSwitch(ToolSwitchType.Boolean) { DisplayName = "Preprocess to a File", @@ -465,8 +474,8 @@ public bool PreprocessToFile Name = PREPROCESS_TO_FILE, BooleanValue = value }; - base.ActiveToolSwitches.Add(PREPROCESS_TO_FILE, switch2); - base.AddActiveSwitchToolValue(switch2); + ActiveToolSwitches.Add(PREPROCESS_TO_FILE, switch2); + AddActiveSwitchToolValue(switch2); } } @@ -477,15 +486,15 @@ public string[] UndefinePreprocessorDefinition { get { - if (base.IsPropertySet(UNDEFINE_PREPROCESSOR_DEFINITION)) + if (IsPropertySet(UNDEFINE_PREPROCESSOR_DEFINITION)) { - return base.ActiveToolSwitches[UNDEFINE_PREPROCESSOR_DEFINITION].StringList; + return ActiveToolSwitches[UNDEFINE_PREPROCESSOR_DEFINITION].StringList; } return null; } set { - base.ActiveToolSwitches.Remove(UNDEFINE_PREPROCESSOR_DEFINITION); + ActiveToolSwitches.Remove(UNDEFINE_PREPROCESSOR_DEFINITION); ToolSwitch switch2 = new ToolSwitch(ToolSwitchType.StringArray) { DisplayName = "Undefine Preprocessor Definitions", @@ -495,13 +504,14 @@ public string[] UndefinePreprocessorDefinition Name = UNDEFINE_PREPROCESSOR_DEFINITION, StringList = value }; - base.ActiveToolSwitches.Add(UNDEFINE_PREPROCESSOR_DEFINITION, switch2); - base.AddActiveSwitchToolValue(switch2); + ActiveToolSwitches.Add(UNDEFINE_PREPROCESSOR_DEFINITION, switch2); + AddActiveSwitchToolValue(switch2); } } public bool RuntimeTypeInfo { get; set; } public bool ShortEnums { get; set; } - #endregion //properties + + #endregion } } diff --git a/src_vs2010/BuildTasks/QccLib.cs b/src_vs2010/BuildTasks/QccLib.cs index ac319a9d..170dd016 100644 --- a/src_vs2010/BuildTasks/QccLib.cs +++ b/src_vs2010/BuildTasks/QccLib.cs @@ -18,30 +18,32 @@ namespace BlackBerry.BuildTasks { - public class QccLib : VSNDKTasks + public sealed class QccLib : QccTask { #region Member Variables and Constants + private const string ADDITIONAL_DEPENDENCIES = "AdditionalDependencies"; private const string ADDITIONAL_LIB_DIR = "AdditionalLibraryDirectories"; private const string OUTPUT_FILE = "OutputFile"; private const string LINK_STATIC = "LinkStatic"; private const string TREAT_LIB_WARNING_AS_ERROR = "TreatLibWarningAsErrors"; + #endregion /// - /// QccLib Constructor + /// QccLib default constructor /// public QccLib() : base(Resources.ResourceManager) { - this.switchOrderList.Add(ADDITIONAL_DEPENDENCIES); - this.switchOrderList.Add(ADDITIONAL_LIB_DIR); - this.switchOrderList.Add(TREAT_LIB_WARNING_AS_ERROR); - this.switchOrderList.Add(OUTPUT_FILE); - this.switchOrderList.Add(SOURCES); + _switchOrderList.Add(ADDITIONAL_DEPENDENCIES); + _switchOrderList.Add(ADDITIONAL_LIB_DIR); + _switchOrderList.Add(TREAT_LIB_WARNING_AS_ERROR); + _switchOrderList.Add(OUTPUT_FILE); + _switchOrderList.Add(SOURCES); } - #region overrides + #region Overrides /// /// Getter/Setter for the AlwaysAppend property @@ -67,7 +69,7 @@ protected override string CommandTLogName /// protected override string[] ReadTLogNames { - get { return new string[] { "qcc_lib.read.1.tlog", "qcc_lib.*.read.1.tlog" }; } + get { return new[] { "qcc_lib.read.1.tlog", "qcc_lib.*.read.1.tlog" }; } } /// @@ -77,7 +79,7 @@ protected override string[] WriteTLogNames { get { - return new string[] { "qcc_lib.write.1.tlog", "qcc_lib.*.write.1.tlog" }; + return new[] { "qcc_lib.write.1.tlog", "qcc_lib.*.write.1.tlog" }; } } @@ -89,9 +91,10 @@ protected override string GetEnhancedSecuritySwitchValue() { return string.Empty; } - #endregion overrides - #region properties + #endregion + + #region Properties /// /// Getter/Setter for the LinkStatic property /// @@ -99,11 +102,11 @@ public bool LinkStatic { get { - return (base.IsPropertySet(LINK_STATIC) && base.ActiveToolSwitches[LINK_STATIC].BooleanValue); + return (IsPropertySet(LINK_STATIC) && ActiveToolSwitches[LINK_STATIC].BooleanValue); } set { - base.ActiveToolSwitches.Remove(LINK_STATIC); + ActiveToolSwitches.Remove(LINK_STATIC); ToolSwitch switch2 = new ToolSwitch(ToolSwitchType.Boolean) { DisplayName = "Link Static", @@ -113,27 +116,27 @@ public bool LinkStatic Name = LINK_STATIC, BooleanValue = value }; - base.ActiveToolSwitches.Add(LINK_STATIC, switch2); - base.AddActiveSwitchToolValue(switch2); + ActiveToolSwitches.Add(LINK_STATIC, switch2); + AddActiveSwitchToolValue(switch2); } } /// /// Getter/Setter for the AdditionalDependencies property /// - public virtual string[] AdditionalDependencies + public string[] AdditionalDependencies { get { - if (base.IsPropertySet(ADDITIONAL_DEPENDENCIES)) + if (IsPropertySet(ADDITIONAL_DEPENDENCIES)) { - return base.ActiveToolSwitches[ADDITIONAL_DEPENDENCIES].StringList; + return ActiveToolSwitches[ADDITIONAL_DEPENDENCIES].StringList; } return null; } set { - base.ActiveToolSwitches.Remove(ADDITIONAL_DEPENDENCIES); + ActiveToolSwitches.Remove(ADDITIONAL_DEPENDENCIES); ToolSwitch switch2 = new ToolSwitch(ToolSwitchType.StringArray) { DisplayName = "Additional Dependencies", @@ -143,27 +146,27 @@ public virtual string[] AdditionalDependencies Name = ADDITIONAL_DEPENDENCIES, StringList = value }; - base.ActiveToolSwitches.Add(ADDITIONAL_DEPENDENCIES, switch2); - base.AddActiveSwitchToolValue(switch2); + ActiveToolSwitches.Add(ADDITIONAL_DEPENDENCIES, switch2); + AddActiveSwitchToolValue(switch2); } } /// /// Getter/Setter for the AdditionalLibraryDirectories property /// - public virtual string[] AdditionalLibraryDirectories + public string[] AdditionalLibraryDirectories { get { - if (base.IsPropertySet(ADDITIONAL_LIB_DIR)) + if (IsPropertySet(ADDITIONAL_LIB_DIR)) { - return base.ActiveToolSwitches[ADDITIONAL_LIB_DIR].StringList; + return ActiveToolSwitches[ADDITIONAL_LIB_DIR].StringList; } return null; } set { - base.ActiveToolSwitches.Remove(ADDITIONAL_LIB_DIR); + ActiveToolSwitches.Remove(ADDITIONAL_LIB_DIR); ToolSwitch switch2 = new ToolSwitch(ToolSwitchType.StringArray) { DisplayName = "Additional Library Directories", @@ -173,23 +176,23 @@ public virtual string[] AdditionalLibraryDirectories Name = ADDITIONAL_LIB_DIR, StringList = value }; - base.ActiveToolSwitches.Add(ADDITIONAL_LIB_DIR, switch2); - base.AddActiveSwitchToolValue(switch2); + ActiveToolSwitches.Add(ADDITIONAL_LIB_DIR, switch2); + AddActiveSwitchToolValue(switch2); } } /// /// Getter/Setter for the TreatLibWarningAsErrors property /// - public virtual bool TreatLibWarningAsErrors + public bool TreatLibWarningAsErrors { get { - return (base.IsPropertySet(TREAT_LIB_WARNING_AS_ERROR) && base.ActiveToolSwitches[TREAT_LIB_WARNING_AS_ERROR].BooleanValue); + return (IsPropertySet(TREAT_LIB_WARNING_AS_ERROR) && ActiveToolSwitches[TREAT_LIB_WARNING_AS_ERROR].BooleanValue); } set { - base.ActiveToolSwitches.Remove(TREAT_LIB_WARNING_AS_ERROR); + ActiveToolSwitches.Remove(TREAT_LIB_WARNING_AS_ERROR); ToolSwitch switch2 = new ToolSwitch(ToolSwitchType.Boolean) { DisplayName = "Treat Lib Warning As Errors", @@ -199,27 +202,27 @@ public virtual bool TreatLibWarningAsErrors Name = TREAT_LIB_WARNING_AS_ERROR, BooleanValue = value }; - base.ActiveToolSwitches.Add(TREAT_LIB_WARNING_AS_ERROR, switch2); - base.AddActiveSwitchToolValue(switch2); + ActiveToolSwitches.Add(TREAT_LIB_WARNING_AS_ERROR, switch2); + AddActiveSwitchToolValue(switch2); } } /// /// GetterSetter for the OutputFile property /// - public virtual string OutputFile + public string OutputFile { get { - if (base.IsPropertySet(OUTPUT_FILE)) + if (IsPropertySet(OUTPUT_FILE)) { - return base.ActiveToolSwitches[OUTPUT_FILE].Value; + return ActiveToolSwitches[OUTPUT_FILE].Value; } return null; } set { - base.ActiveToolSwitches.Remove(OUTPUT_FILE); + ActiveToolSwitches.Remove(OUTPUT_FILE); ToolSwitch switch2 = new ToolSwitch(ToolSwitchType.File) { //Separator = ":", @@ -230,10 +233,11 @@ public virtual string OutputFile Name = OUTPUT_FILE, Value = value }; - base.ActiveToolSwitches.Add(OUTPUT_FILE, switch2); - base.AddActiveSwitchToolValue(switch2); + ActiveToolSwitches.Add(OUTPUT_FILE, switch2); + AddActiveSwitchToolValue(switch2); } } - #endregion properties + + #endregion } } diff --git a/src_vs2010/BuildTasks/QccLink.cs b/src_vs2010/BuildTasks/QccLink.cs index 710096ae..20f4026a 100644 --- a/src_vs2010/BuildTasks/QccLink.cs +++ b/src_vs2010/BuildTasks/QccLink.cs @@ -19,9 +19,10 @@ namespace BlackBerry.BuildTasks { - public class QccLink : VSNDKTasks + public sealed class QccLink : QccTask { #region Member Variables and Constants + private const string ADDITIONAL_DEPENDENCIES = "AdditionalDependencies"; private const string LINK_ERROR_REPORTING = "LinkErrorReporting"; private const string ADDITIONAL_LIB_DIR = "AdditionalLibraryDirectories"; @@ -33,29 +34,30 @@ public class QccLink : VSNDKTasks private const string LINK_LIB_DEP = "LinkLibraryDependencies"; private const string OUTPUT_FILE = "OutputFile"; private const string TREAT_LINK_WARNING_AS_ERR = "TreatLinkerWarningAsErrors"; + #endregion /// - /// QccLink Constructor + /// QccLink default constructor /// public QccLink() : base(Resources.ResourceManager) { - this.switchOrderList.Add(ADDITIONAL_DEPENDENCIES); - this.switchOrderList.Add(LINK_ERROR_REPORTING); - this.switchOrderList.Add(ADDITIONAL_LIB_DIR); - this.switchOrderList.Add(GENERATE_MAP_FILE); - this.switchOrderList.Add(IGNORE_ALL_DEFAULT_LIB); - this.switchOrderList.Add(IGNOR_ALL_DEFAULT_CPP_LIB); - this.switchOrderList.Add(LINK_INCREMENTAL); - this.switchOrderList.Add(LINK_STATUS); - this.switchOrderList.Add(LINK_LIB_DEP); - this.switchOrderList.Add(OUTPUT_FILE); - this.switchOrderList.Add(TREAT_LINK_WARNING_AS_ERR); - this.switchOrderList.Add(SOURCES); + _switchOrderList.Add(ADDITIONAL_DEPENDENCIES); + _switchOrderList.Add(LINK_ERROR_REPORTING); + _switchOrderList.Add(ADDITIONAL_LIB_DIR); + _switchOrderList.Add(GENERATE_MAP_FILE); + _switchOrderList.Add(IGNORE_ALL_DEFAULT_LIB); + _switchOrderList.Add(IGNOR_ALL_DEFAULT_CPP_LIB); + _switchOrderList.Add(LINK_INCREMENTAL); + _switchOrderList.Add(LINK_STATUS); + _switchOrderList.Add(LINK_LIB_DEP); + _switchOrderList.Add(OUTPUT_FILE); + _switchOrderList.Add(TREAT_LINK_WARNING_AS_ERR); + _switchOrderList.Add(SOURCES); } - #region overrides + #region Overrides /// /// Getter/Setter for AlwaysAppend property @@ -81,7 +83,7 @@ protected override string CommandTLogName /// protected override string[] ReadTLogNames { - get { return new string[] { "qcc_linker.read.1.tlog", "qcc_linker.*.read.1.tlog" }; } + get { return new[] { "qcc_linker.read.1.tlog", "qcc_linker.*.read.1.tlog" }; } } /// @@ -91,38 +93,37 @@ protected override string[] WriteTLogNames { get { - return new string[] { "qcc_linker.write.1.tlog", "qcc_linker.*.write.1.tlog" }; + return new[] { "qcc_linker.write.1.tlog", "qcc_linker.*.write.1.tlog" }; } } /// /// Function to return the Enhanced Security value. /// - /// protected override string GetEnhancedSecuritySwitchValue() { return "-Wl,-z,relro -Wl,-z,now"; } #endregion - #region properties + #region Properties /// /// Getter/Setter for the AdditionalDependencies property /// - public virtual string[] AdditionalDependencies + public string[] AdditionalDependencies { get { - if (base.IsPropertySet(ADDITIONAL_DEPENDENCIES)) + if (IsPropertySet(ADDITIONAL_DEPENDENCIES)) { - return base.ActiveToolSwitches[ADDITIONAL_DEPENDENCIES].StringList; + return ActiveToolSwitches[ADDITIONAL_DEPENDENCIES].StringList; } return null; } set { - base.ActiveToolSwitches.Remove(ADDITIONAL_DEPENDENCIES); + ActiveToolSwitches.Remove(ADDITIONAL_DEPENDENCIES); ToolSwitch switch2 = new ToolSwitch(ToolSwitchType.StringArray) { DisplayName = "Additional Dependencies", @@ -132,27 +133,27 @@ public virtual string[] AdditionalDependencies Name = ADDITIONAL_DEPENDENCIES, StringList = value }; - base.ActiveToolSwitches.Add(ADDITIONAL_DEPENDENCIES, switch2); - base.AddActiveSwitchToolValue(switch2); + ActiveToolSwitches.Add(ADDITIONAL_DEPENDENCIES, switch2); + AddActiveSwitchToolValue(switch2); } } /// /// Getter/Setter for the AdditionalLibraryDirectories property /// - public virtual string[] AdditionalLibraryDirectories + public string[] AdditionalLibraryDirectories { get { - if (base.IsPropertySet(ADDITIONAL_LIB_DIR)) + if (IsPropertySet(ADDITIONAL_LIB_DIR)) { - return base.ActiveToolSwitches[ADDITIONAL_LIB_DIR].StringList; + return ActiveToolSwitches[ADDITIONAL_LIB_DIR].StringList; } return null; } set { - base.ActiveToolSwitches.Remove(ADDITIONAL_LIB_DIR); + ActiveToolSwitches.Remove(ADDITIONAL_LIB_DIR); ToolSwitch switch2 = new ToolSwitch(ToolSwitchType.StringArray) { DisplayName = "Additional Library Directories", @@ -162,23 +163,23 @@ public virtual string[] AdditionalLibraryDirectories Name = ADDITIONAL_LIB_DIR, StringList = value }; - base.ActiveToolSwitches.Add(ADDITIONAL_LIB_DIR, switch2); - base.AddActiveSwitchToolValue(switch2); + ActiveToolSwitches.Add(ADDITIONAL_LIB_DIR, switch2); + AddActiveSwitchToolValue(switch2); } } /// /// Getter/Setter for the GenerateMapFile property /// - public virtual bool GenerateMapFile + public bool GenerateMapFile { get { - return (base.IsPropertySet(GENERATE_MAP_FILE) && base.ActiveToolSwitches[GENERATE_MAP_FILE].BooleanValue); + return (IsPropertySet(GENERATE_MAP_FILE) && ActiveToolSwitches[GENERATE_MAP_FILE].BooleanValue); } set { - base.ActiveToolSwitches.Remove(GENERATE_MAP_FILE); + ActiveToolSwitches.Remove(GENERATE_MAP_FILE); ToolSwitch switch2 = new ToolSwitch(ToolSwitchType.Boolean) { DisplayName = "Generate Map File", @@ -189,23 +190,23 @@ public virtual bool GenerateMapFile switch2.SwitchValue = "-M"; switch2.Name = GENERATE_MAP_FILE; switch2.BooleanValue = value; - base.ActiveToolSwitches.Add(GENERATE_MAP_FILE, switch2); - base.AddActiveSwitchToolValue(switch2); + ActiveToolSwitches.Add(GENERATE_MAP_FILE, switch2); + AddActiveSwitchToolValue(switch2); } } /// /// Getter/Setter for the IgnoreAllDefaultLibraries /// - public virtual bool IgnoreAllDefaultLibraries + public bool IgnoreAllDefaultLibraries { get { - return (base.IsPropertySet(IGNORE_ALL_DEFAULT_LIB) && base.ActiveToolSwitches[IGNORE_ALL_DEFAULT_LIB].BooleanValue); + return (IsPropertySet(IGNORE_ALL_DEFAULT_LIB) && ActiveToolSwitches[IGNORE_ALL_DEFAULT_LIB].BooleanValue); } set { - base.ActiveToolSwitches.Remove(IGNORE_ALL_DEFAULT_LIB); + ActiveToolSwitches.Remove(IGNORE_ALL_DEFAULT_LIB); ToolSwitch switch2 = new ToolSwitch(ToolSwitchType.Boolean) { DisplayName = "Ignore All Default Libraries", @@ -215,23 +216,23 @@ public virtual bool IgnoreAllDefaultLibraries Name = IGNORE_ALL_DEFAULT_LIB, BooleanValue = value }; - base.ActiveToolSwitches.Add(IGNORE_ALL_DEFAULT_LIB, switch2); - base.AddActiveSwitchToolValue(switch2); + ActiveToolSwitches.Add(IGNORE_ALL_DEFAULT_LIB, switch2); + AddActiveSwitchToolValue(switch2); } } /// /// Getter/Setter for the IgnoreAllDefaultCppLibraries property /// - public virtual bool IgnoreAllDefaultCppLibraries + public bool IgnoreAllDefaultCppLibraries { get { - return (base.IsPropertySet(IGNOR_ALL_DEFAULT_CPP_LIB) && base.ActiveToolSwitches[IGNOR_ALL_DEFAULT_CPP_LIB].BooleanValue); + return (IsPropertySet(IGNOR_ALL_DEFAULT_CPP_LIB) && ActiveToolSwitches[IGNOR_ALL_DEFAULT_CPP_LIB].BooleanValue); } set { - base.ActiveToolSwitches.Remove(IGNOR_ALL_DEFAULT_CPP_LIB); + ActiveToolSwitches.Remove(IGNOR_ALL_DEFAULT_CPP_LIB); ToolSwitch switch2 = new ToolSwitch(ToolSwitchType.Boolean) { DisplayName = "Ignore All Default C++ Libraries", @@ -241,23 +242,23 @@ public virtual bool IgnoreAllDefaultCppLibraries Name = IGNOR_ALL_DEFAULT_CPP_LIB, BooleanValue = value }; - base.ActiveToolSwitches.Add(IGNOR_ALL_DEFAULT_CPP_LIB, switch2); - base.AddActiveSwitchToolValue(switch2); + ActiveToolSwitches.Add(IGNOR_ALL_DEFAULT_CPP_LIB, switch2); + AddActiveSwitchToolValue(switch2); } } /// /// Getter/Setter for the LinkIncremental Property /// - public virtual bool LinkIncremental + public bool LinkIncremental { get { - return (base.IsPropertySet(LINK_INCREMENTAL) && base.ActiveToolSwitches[LINK_INCREMENTAL].BooleanValue); + return (IsPropertySet(LINK_INCREMENTAL) && ActiveToolSwitches[LINK_INCREMENTAL].BooleanValue); } set { - base.ActiveToolSwitches.Remove(LINK_INCREMENTAL); + ActiveToolSwitches.Remove(LINK_INCREMENTAL); ToolSwitch switch2 = new ToolSwitch(ToolSwitchType.Boolean) { DisplayName = "Enable Incremental Linking", @@ -268,8 +269,8 @@ public virtual bool LinkIncremental Name = LINK_INCREMENTAL, BooleanValue = value }; - base.ActiveToolSwitches.Add(LINK_INCREMENTAL, switch2); - base.AddActiveSwitchToolValue(switch2); + ActiveToolSwitches.Add(LINK_INCREMENTAL, switch2); + AddActiveSwitchToolValue(switch2); switch2.Overrides.AddLast(new KeyValuePair("INCREMENTAL", "INCREMENTAL:NO")); switch2.Overrides.AddLast(new KeyValuePair("INCREMENTAL:NO", "INCREMENTAL")); } @@ -278,15 +279,15 @@ public virtual bool LinkIncremental /// /// Getter/Setter for the LinkStatus property /// - public virtual bool LinkStatus + public bool LinkStatus { get { - return (base.IsPropertySet(LINK_STATUS) && base.ActiveToolSwitches[LINK_STATUS].BooleanValue); + return (IsPropertySet(LINK_STATUS) && ActiveToolSwitches[LINK_STATUS].BooleanValue); } set { - base.ActiveToolSwitches.Remove(LINK_STATUS); + ActiveToolSwitches.Remove(LINK_STATUS); ToolSwitch switch2 = new ToolSwitch(ToolSwitchType.Boolean) { DisplayName = "Link Status", @@ -297,8 +298,8 @@ public virtual bool LinkStatus Name = LINK_STATUS, BooleanValue = value }; - base.ActiveToolSwitches.Add(LINK_STATUS, switch2); - base.AddActiveSwitchToolValue(switch2); + ActiveToolSwitches.Add(LINK_STATUS, switch2); + AddActiveSwitchToolValue(switch2); switch2.Overrides.AddLast(new KeyValuePair("LTCG:STATUS", "LTCG:NOSTATUS")); switch2.Overrides.AddLast(new KeyValuePair("LTCG:NOSTATUS", "LTCG:STATUS")); } @@ -307,15 +308,15 @@ public virtual bool LinkStatus /// /// Getter/Setter for the LinkLibraryDependencies /// - public virtual bool LinkLibraryDependencies + public bool LinkLibraryDependencies { get { - return (base.IsPropertySet(LINK_LIB_DEP) && base.ActiveToolSwitches[LINK_LIB_DEP].BooleanValue); + return (IsPropertySet(LINK_LIB_DEP) && ActiveToolSwitches[LINK_LIB_DEP].BooleanValue); } set { - base.ActiveToolSwitches.Remove(LINK_LIB_DEP); + ActiveToolSwitches.Remove(LINK_LIB_DEP); ToolSwitch switch2 = new ToolSwitch(ToolSwitchType.Boolean) { DisplayName = "Link Library Dependencies", @@ -324,27 +325,27 @@ public virtual bool LinkLibraryDependencies Name = LINK_LIB_DEP, BooleanValue = value }; - base.ActiveToolSwitches.Add(LINK_LIB_DEP, switch2); - base.AddActiveSwitchToolValue(switch2); + ActiveToolSwitches.Add(LINK_LIB_DEP, switch2); + AddActiveSwitchToolValue(switch2); } } /// /// Getter/Setter for the OutputFile property /// - public virtual string OutputFile + public string OutputFile { get { - if (base.IsPropertySet(OUTPUT_FILE)) + if (IsPropertySet(OUTPUT_FILE)) { - return base.ActiveToolSwitches[OUTPUT_FILE].Value; + return ActiveToolSwitches[OUTPUT_FILE].Value; } return null; } set { - base.ActiveToolSwitches.Remove(OUTPUT_FILE); + ActiveToolSwitches.Remove(OUTPUT_FILE); ToolSwitch switch2 = new ToolSwitch(ToolSwitchType.File) { @@ -355,23 +356,23 @@ public virtual string OutputFile Name = OUTPUT_FILE, Value = value }; - base.ActiveToolSwitches.Add(OUTPUT_FILE, switch2); - base.AddActiveSwitchToolValue(switch2); + ActiveToolSwitches.Add(OUTPUT_FILE, switch2); + AddActiveSwitchToolValue(switch2); } } /// /// Getter/Setter for the TreatLinkerWarningAsErrors property. /// - public virtual bool TreatLinkerWarningAsErrors + public bool TreatLinkerWarningAsErrors { get { - return (base.IsPropertySet(TREAT_LINK_WARNING_AS_ERR) && base.ActiveToolSwitches[TREAT_LINK_WARNING_AS_ERR].BooleanValue); + return (IsPropertySet(TREAT_LINK_WARNING_AS_ERR) && ActiveToolSwitches[TREAT_LINK_WARNING_AS_ERR].BooleanValue); } set { - base.ActiveToolSwitches.Remove(TREAT_LINK_WARNING_AS_ERR); + ActiveToolSwitches.Remove(TREAT_LINK_WARNING_AS_ERR); ToolSwitch switch2 = new ToolSwitch(ToolSwitchType.Boolean) { DisplayName = "Treat Linker Warning As Errors", @@ -382,13 +383,13 @@ public virtual bool TreatLinkerWarningAsErrors Name = TREAT_LINK_WARNING_AS_ERR, BooleanValue = value }; - base.ActiveToolSwitches.Add(TREAT_LINK_WARNING_AS_ERR, switch2); - base.AddActiveSwitchToolValue(switch2); + ActiveToolSwitches.Add(TREAT_LINK_WARNING_AS_ERR, switch2); + AddActiveSwitchToolValue(switch2); switch2.Overrides.AddLast(new KeyValuePair("WX", "WX:NO")); switch2.Overrides.AddLast(new KeyValuePair("WX:NO", "WX")); } } - #endregion + #endregion } } diff --git a/src_vs2010/BuildTasks/RemoveFlagFile.cs b/src_vs2010/BuildTasks/RemoveFlagFile.cs index e5132d98..e52955dd 100644 --- a/src_vs2010/BuildTasks/RemoveFlagFile.cs +++ b/src_vs2010/BuildTasks/RemoveFlagFile.cs @@ -22,7 +22,7 @@ namespace BlackBerry.BuildTasks /// /// MSBuild Task for reading in the flag file from the start debugging button. /// - public class RemoveFlagFile : Task + public sealed class RemoveFlagFile : Task { #region Member Variables and Constants. private string _flagFile; @@ -31,7 +31,6 @@ public class RemoveFlagFile : Task /// /// Execute the MSBuild Task /// - /// public override bool Execute() { bool removed; diff --git a/src_vs2010/BuildTasks/SSHDelete.cs b/src_vs2010/BuildTasks/SSHDelete.cs index 641fce5b..d4081aef 100644 --- a/src_vs2010/BuildTasks/SSHDelete.cs +++ b/src_vs2010/BuildTasks/SSHDelete.cs @@ -19,33 +19,36 @@ namespace BlackBerry.BuildTasks { - public class SSHDelete : TrackedVCToolTask + public sealed class SSHDelete : TrackedVCToolTask { #region Member Variables and Constants - protected ArrayList switchOrderList; + + private readonly ArrayList _switchOrderList; private const string DEVICE = "Device"; private const string PRIVATE_KEY_PATH = "PrivateKeyPath"; private const string DELETE_FILES = "DeleteFiles"; private const string PACKAGE_ID = "PackageId"; private const string PACKAGE_NAME = "PackageName"; + #endregion /// - /// SSHDelete Constructor + /// SSHDelete default constructor /// public SSHDelete() : base(Resources.ResourceManager) { - this.switchOrderList = new ArrayList(); - this.switchOrderList.Add(PRIVATE_KEY_PATH); + _switchOrderList = new ArrayList(); + _switchOrderList.Add(PRIVATE_KEY_PATH); } + #region Overrides + /// /// Return the Response File Switch string /// /// - /// protected override string GetResponseFileSwitch(string responseFilePath) { return string.Empty; @@ -54,7 +57,6 @@ protected override string GetResponseFileSwitch(string responseFilePath) /// /// Return the command line string /// - /// protected override string GenerateCommandLineCommands() { return GenerateResponseFileCommands(); @@ -73,7 +75,7 @@ protected override string CommandTLogName /// protected override string[] ReadTLogNames { - get { return new string[] { "SSHDelete.read.1.tlog", "SSHDelete.*.read.1.tlog" }; } + get { return new[] { "SSHDelete.read.1.tlog", "SSHDelete.*.read.1.tlog" }; } } /// @@ -83,7 +85,7 @@ protected override string[] WriteTLogNames { get { - return new string[] { "SSHDelete.write.1.tlog", "SSHDelete.*.write.1.tlog" }; + return new[] { "SSHDelete.write.1.tlog", "SSHDelete.*.write.1.tlog" }; } } @@ -94,9 +96,9 @@ protected override ITaskItem[] TrackedInputFiles { get { - if (base.IsPropertySet(DELETE_FILES)) + if (IsPropertySet(DELETE_FILES)) { - return base.ActiveToolSwitches[DELETE_FILES].TaskItemArray; + return ActiveToolSwitches[DELETE_FILES].TaskItemArray; } return null; } @@ -127,23 +129,22 @@ protected override string TrackerIntermediateDirectory /// /// Function to generate the response file commands string /// - /// protected override string GenerateResponseFileCommands() { string cmd = base.GenerateResponseFileCommands(); cmd += " -o \"StrictHostKeyChecking no\""; - if (base.IsPropertySet(DEVICE)) + if (IsPropertySet(DEVICE)) { - cmd += " devuser@" + base.ActiveToolSwitches[DEVICE].Value; + cmd += " devuser@" + ActiveToolSwitches[DEVICE].Value; } - if (base.IsPropertySet(DELETE_FILES)) + if (IsPropertySet(DELETE_FILES)) { string path = "../../../../apps/" + PackageName + "." + PackageId + "/"; cmd += " '"; - foreach (ITaskItem taskItem in base.ActiveToolSwitches[DELETE_FILES].TaskItemArray) + foreach (ITaskItem taskItem in ActiveToolSwitches[DELETE_FILES].TaskItemArray) { cmd += "rm " + path + taskItem.GetMetadata("Identity") + "; "; } @@ -164,26 +165,30 @@ protected override ArrayList SwitchOrderList { get { - return this.switchOrderList; + return _switchOrderList; } } + #endregion + + #region Properties + /// /// Getter/Setter for the Device property /// - public virtual string Device + public string Device { get { - if (base.IsPropertySet(DEVICE)) + if (IsPropertySet(DEVICE)) { - return base.ActiveToolSwitches[DEVICE].Value; + return ActiveToolSwitches[DEVICE].Value; } return null; } set { - base.ActiveToolSwitches.Remove(DEVICE); + ActiveToolSwitches.Remove(DEVICE); ToolSwitch toolSwitch = new ToolSwitch(ToolSwitchType.String) { Name = DEVICE, @@ -193,27 +198,27 @@ public virtual string Device SwitchValue = "devuser@", Value = value }; - base.ActiveToolSwitches.Add(DEVICE, toolSwitch); - base.AddActiveSwitchToolValue(toolSwitch); + ActiveToolSwitches.Add(DEVICE, toolSwitch); + AddActiveSwitchToolValue(toolSwitch); } } /// /// Getter/Setter for the PrivateKeyPath property /// - public virtual string PrivateKeyPath + public string PrivateKeyPath { get { - if (base.IsPropertySet(PRIVATE_KEY_PATH)) + if (IsPropertySet(PRIVATE_KEY_PATH)) { - return base.ActiveToolSwitches[PRIVATE_KEY_PATH].Value; + return ActiveToolSwitches[PRIVATE_KEY_PATH].Value; } return null; } set { - base.ActiveToolSwitches.Remove(PRIVATE_KEY_PATH); + ActiveToolSwitches.Remove(PRIVATE_KEY_PATH); ToolSwitch toolSwitch = new ToolSwitch(ToolSwitchType.String) { Name = PRIVATE_KEY_PATH, @@ -223,27 +228,27 @@ public virtual string PrivateKeyPath SwitchValue = "-i ", Value = value }; - base.ActiveToolSwitches.Add(PRIVATE_KEY_PATH, toolSwitch); - base.AddActiveSwitchToolValue(toolSwitch); + ActiveToolSwitches.Add(PRIVATE_KEY_PATH, toolSwitch); + AddActiveSwitchToolValue(toolSwitch); } } /// /// Getter/Setter for the PackageId property /// - public virtual string PackageId + public string PackageId { get { - if (base.IsPropertySet(PACKAGE_ID)) + if (IsPropertySet(PACKAGE_ID)) { - return base.ActiveToolSwitches[PACKAGE_ID].Value; + return ActiveToolSwitches[PACKAGE_ID].Value; } return null; } set { - base.ActiveToolSwitches.Remove(PACKAGE_ID); + ActiveToolSwitches.Remove(PACKAGE_ID); ToolSwitch toolSwitch = new ToolSwitch(ToolSwitchType.String) { Name = PACKAGE_ID, @@ -253,27 +258,27 @@ public virtual string PackageId SwitchValue = "-package-id ", Value = value }; - base.ActiveToolSwitches.Add(PACKAGE_ID, toolSwitch); - base.AddActiveSwitchToolValue(toolSwitch); + ActiveToolSwitches.Add(PACKAGE_ID, toolSwitch); + AddActiveSwitchToolValue(toolSwitch); } } /// /// Getter/Setter for the PackageName property /// - public virtual string PackageName + public string PackageName { get { - if (base.IsPropertySet(PACKAGE_NAME)) + if (IsPropertySet(PACKAGE_NAME)) { - return base.ActiveToolSwitches[PACKAGE_NAME].Value; + return ActiveToolSwitches[PACKAGE_NAME].Value; } return null; } set { - base.ActiveToolSwitches.Remove(PACKAGE_NAME); + ActiveToolSwitches.Remove(PACKAGE_NAME); ToolSwitch toolSwitch = new ToolSwitch(ToolSwitchType.String) { Name = PACKAGE_NAME, @@ -283,27 +288,27 @@ public virtual string PackageName SwitchValue = "-package-name ", Value = value }; - base.ActiveToolSwitches.Add(PACKAGE_NAME, toolSwitch); - base.AddActiveSwitchToolValue(toolSwitch); + ActiveToolSwitches.Add(PACKAGE_NAME, toolSwitch); + AddActiveSwitchToolValue(toolSwitch); } } /// /// Getter/Setter for the DeleteFiles property /// - public virtual ITaskItem[] DeleteFiles + public ITaskItem[] DeleteFiles { get { - if (base.IsPropertySet(DELETE_FILES)) + if (IsPropertySet(DELETE_FILES)) { - return base.ActiveToolSwitches[DELETE_FILES].TaskItemArray; + return ActiveToolSwitches[DELETE_FILES].TaskItemArray; } return null; } set { - base.ActiveToolSwitches.Remove(DELETE_FILES); + ActiveToolSwitches.Remove(DELETE_FILES); ToolSwitch toolSwitch = new ToolSwitch(ToolSwitchType.ITaskItemArray) { Name = DELETE_FILES, @@ -311,9 +316,11 @@ public virtual ITaskItem[] DeleteFiles Description = "Delete all items in the array from the device.", TaskItemArray = value }; - base.ActiveToolSwitches.Add(DELETE_FILES, toolSwitch); - base.AddActiveSwitchToolValue(toolSwitch); + ActiveToolSwitches.Add(DELETE_FILES, toolSwitch); + AddActiveSwitchToolValue(toolSwitch); } } + + #endregion } } diff --git a/src_vs2010/BuildTasks/VSNDKTasks.cs b/src_vs2010/BuildTasks/VSNDKTasks.cs index 3cc93850..b5938438 100644 --- a/src_vs2010/BuildTasks/VSNDKTasks.cs +++ b/src_vs2010/BuildTasks/VSNDKTasks.cs @@ -20,60 +20,60 @@ namespace BlackBerry.BuildTasks { - public abstract class VSNDKTasks : TrackedVCToolTask + public abstract class QccTask : TrackedVCToolTask { - #region fields + #region Fields + // Fields - protected ArrayList switchOrderList; + protected readonly ArrayList _switchOrderList; //constant fields - protected const string GENERATE_DEBUG_INFORMATION = "GenerateDebugInformation"; - protected const string WARING_LEVEL = "WarningLevel"; - protected const string TREAT_WARNING_AS_ERROR = "TreatWarningAsError"; - protected const string TRACKER_LOG_DIRECTORY = "TrackerLogDirectory"; - protected const string OPTIMIZATION = "Optimization"; - protected const string GCC_EXCEPTION_HANDLING = "GccExceptionHandling"; + private const string GENERATE_DEBUG_INFORMATION = "GenerateDebugInformation"; + private const string WARING_LEVEL = "WarningLevel"; + private const string TREAT_WARNING_AS_ERROR = "TreatWarningAsError"; + private const string TRACKER_LOG_DIRECTORY = "TrackerLogDirectory"; + private const string OPTIMIZATION = "Optimization"; + private const string GCC_EXCEPTION_HANDLING = "GccExceptionHandling"; protected const string SOURCES = "Sources"; - protected const string ADDITIONAL_OPTIONS = "AdditionalOptions"; - protected const string BUILDING_IN_IDE = "BuildingInIDE"; - protected const string ENHANCED_SECURITY = "EnhancedSecurity"; - protected const string POSITION_INDEPENDENT_EXECUTABLE = "PIE"; - protected const string COMPILER_VERSION_TARGET = "CompilerVersionTarget"; - protected const string VERBOSE = "Verbose"; - protected const string COMPILE_AS = "CompileAs"; + private const string ADDITIONAL_OPTIONS = "AdditionalOptions"; + private const string BUILDING_IN_IDE = "BuildingInIDE"; + private const string ENHANCED_SECURITY = "EnhancedSecurity"; + private const string POSITION_INDEPENDENT_EXECUTABLE = "PIE"; + private const string COMPILER_VERSION_TARGET = "CompilerVersionTarget"; + private const string VERBOSE = "Verbose"; + private const string COMPILE_AS = "CompileAs"; private static string ERROR = " error:"; private static string WARNING = " warning:"; - #endregion - #region ctors + #endregion /// - /// VSNDKTasks Constructor + /// QnxTasks default constructor /// /// - public VSNDKTasks(ResourceManager res) + public QccTask(ResourceManager res) : base(res) { - this.switchOrderList = new ArrayList(); - this.switchOrderList.Add(COMPILER_VERSION_TARGET); - this.switchOrderList.Add("AlwaysAppend"); - this.switchOrderList.Add(GENERATE_DEBUG_INFORMATION); - this.switchOrderList.Add(VERBOSE); - this.switchOrderList.Add(WARING_LEVEL); - this.switchOrderList.Add(TREAT_WARNING_AS_ERROR); - this.switchOrderList.Add(TRACKER_LOG_DIRECTORY); - this.switchOrderList.Add(OPTIMIZATION); - this.switchOrderList.Add(GCC_EXCEPTION_HANDLING); - this.switchOrderList.Add(ADDITIONAL_OPTIONS); - this.switchOrderList.Add(BUILDING_IN_IDE); - this.switchOrderList.Add(ENHANCED_SECURITY); - this.switchOrderList.Add(POSITION_INDEPENDENT_EXECUTABLE); - this.switchOrderList.Add(COMPILE_AS); + _switchOrderList = new ArrayList(); + _switchOrderList.Add(COMPILER_VERSION_TARGET); + _switchOrderList.Add("AlwaysAppend"); + _switchOrderList.Add(GENERATE_DEBUG_INFORMATION); + _switchOrderList.Add(VERBOSE); + _switchOrderList.Add(WARING_LEVEL); + _switchOrderList.Add(TREAT_WARNING_AS_ERROR); + _switchOrderList.Add(TRACKER_LOG_DIRECTORY); + _switchOrderList.Add(OPTIMIZATION); + _switchOrderList.Add(GCC_EXCEPTION_HANDLING); + _switchOrderList.Add(ADDITIONAL_OPTIONS); + _switchOrderList.Add(BUILDING_IN_IDE); + _switchOrderList.Add(ENHANCED_SECURITY); + _switchOrderList.Add(POSITION_INDEPENDENT_EXECUTABLE); + _switchOrderList.Add(COMPILE_AS); } - #endregion - #region overrides + #region Overrides + /// /// don't use response file for msbuild because it is removed before qcc to run GCC compiler /// @@ -101,7 +101,7 @@ protected override string GenerateCommandLineCommands() /// protected override ITaskItem[] AssignOutOfDateSources(ITaskItem[] sources) { - base.ActiveToolSwitches[SOURCES].TaskItemArray = sources; + ActiveToolSwitches[SOURCES].TaskItemArray = sources; return sources; } @@ -112,14 +112,14 @@ protected override ArrayList SwitchOrderList { get { - return this.switchOrderList; + return _switchOrderList; } } /// /// Getter/Setter for TrackedInputFiles property /// - protected override Microsoft.Build.Framework.ITaskItem[] TrackedInputFiles + protected override ITaskItem[] TrackedInputFiles { get { @@ -134,9 +134,9 @@ protected override string TrackerIntermediateDirectory { get { - if (this.TrackerLogDirectory != null) + if (TrackerLogDirectory != null) { - return this.TrackerLogDirectory; + return TrackerLogDirectory; } return string.Empty; } @@ -177,9 +177,9 @@ private string Reformat(string singleLine) string[] separators = { ERROR, WARNING }; string errCode = singleLine.Contains(ERROR) ? "error qcc" : "warning qcc"; string[] parts = singleLine.Split(separators, StringSplitOptions.None); - if (parts != null && parts.Length > 1) + if (parts.Length > 1) { - string[] segments = parts[0].Split(new Char[]{':'}, StringSplitOptions.RemoveEmptyEntries); + string[] segments = parts[0].Split(new[]{':'}, StringSplitOptions.RemoveEmptyEntries); if (segments.Length == 3) msbuilError = String.Format("{0}({1}-{2}): {3}: {4}", segments[0], segments[1], segments[2], errCode, parts[1]); if ( segments.Length == 2 ) @@ -195,30 +195,30 @@ protected override bool UseUnicodeOutput { get { - return this.BuildingInIDE; + return BuildingInIDE; } } - #endregion //override + #endregion - #region properties + #region Properties /// /// Getter/Setter for GenerateDebugInformation property /// - public virtual bool GenerateDebugInformation + public bool GenerateDebugInformation { get { - if (base.IsPropertySet(GENERATE_DEBUG_INFORMATION)) + if (IsPropertySet(GENERATE_DEBUG_INFORMATION)) { - return base.ActiveToolSwitches[GENERATE_DEBUG_INFORMATION].BooleanValue; + return ActiveToolSwitches[GENERATE_DEBUG_INFORMATION].BooleanValue; } return false; } set { - base.ActiveToolSwitches.Remove(GENERATE_DEBUG_INFORMATION); + ActiveToolSwitches.Remove(GENERATE_DEBUG_INFORMATION); ToolSwitch switch2 = new ToolSwitch(ToolSwitchType.Boolean) { DisplayName = "Generate Debug Info", @@ -228,46 +228,48 @@ public virtual bool GenerateDebugInformation switch2.SwitchValue = "-g"; switch2.Name = GENERATE_DEBUG_INFORMATION; switch2.BooleanValue = value; - base.ActiveToolSwitches.Add(GENERATE_DEBUG_INFORMATION, switch2); - base.AddActiveSwitchToolValue(switch2); + ActiveToolSwitches.Add(GENERATE_DEBUG_INFORMATION, switch2); + AddActiveSwitchToolValue(switch2); } } /// /// Getter/Setter for WarningLevel property /// - public virtual string WarningLevel + public string WarningLevel { get { - if (base.IsPropertySet(WARING_LEVEL)) + if (IsPropertySet(WARING_LEVEL)) { - return base.ActiveToolSwitches[WARING_LEVEL].Value; + return ActiveToolSwitches[WARING_LEVEL].Value; } return null; } set { - base.ActiveToolSwitches.Remove(WARING_LEVEL); + ActiveToolSwitches.Remove(WARING_LEVEL); ToolSwitch switch2 = new ToolSwitch(ToolSwitchType.String) { DisplayName = "Warning Level", Description = "Select how strict you want the compiler to be about code errors. (-w0 - -w4)", ArgumentRelationList = new ArrayList() }; - string[][] switchMap = new string[][] - { new string[] { "TurnOffAllWarnings", "-w0" }, - new string[] { "Level1", "-w1" }, - new string[] { "Level2", "-w2" }, - new string[] { "Level3", "-w3" }, - new string[] { "Level4", "-w4" }, - new string[] { "Level5", "-w5" }, - new string[] { "Level6", "-w6" }, - new string[] { "Level7", "-w7" }, - new string[] { "Level8", "-w8" }, - new string[] { "Level9", "-w9" }, - new string[] { "EnableAllWarnings", "-Wall" } }; - switch2.SwitchValue = base.ReadSwitchMap(WARING_LEVEL, switchMap, value); + string[][] switchMap = + { + new[] { "TurnOffAllWarnings", "-w0" }, + new[] { "Level1", "-w1" }, + new[] { "Level2", "-w2" }, + new[] { "Level3", "-w3" }, + new[] { "Level4", "-w4" }, + new[] { "Level5", "-w5" }, + new[] { "Level6", "-w6" }, + new[] { "Level7", "-w7" }, + new[] { "Level8", "-w8" }, + new[] { "Level9", "-w9" }, + new[] { "EnableAllWarnings", "-Wall" } + }; + switch2.SwitchValue = ReadSwitchMap(WARING_LEVEL, switchMap, value); switch2.Name = WARING_LEVEL; switch2.Value = value; #if PLATFORM_VS2010 @@ -275,27 +277,27 @@ public virtual string WarningLevel #else switch2.MultipleValues = true; #endif - base.ActiveToolSwitches.Add(WARING_LEVEL, switch2); - base.AddActiveSwitchToolValue(switch2); + ActiveToolSwitches.Add(WARING_LEVEL, switch2); + AddActiveSwitchToolValue(switch2); } } /// /// Getter/Setter for TreatWarningAsError property /// - public virtual bool TreatWarningAsError + public bool TreatWarningAsError { get { - if (base.IsPropertySet(TREAT_WARNING_AS_ERROR)) + if (IsPropertySet(TREAT_WARNING_AS_ERROR)) { - return base.ActiveToolSwitches[TREAT_WARNING_AS_ERROR].BooleanValue; + return ActiveToolSwitches[TREAT_WARNING_AS_ERROR].BooleanValue; } return false; } set { - base.ActiveToolSwitches.Remove(TREAT_WARNING_AS_ERROR); + ActiveToolSwitches.Remove(TREAT_WARNING_AS_ERROR); ToolSwitch switch2 = new ToolSwitch(ToolSwitchType.Boolean) { DisplayName = "Treat Warnings as Errors", @@ -306,58 +308,64 @@ public virtual bool TreatWarningAsError switch2.SwitchValue = "-Werror"; switch2.Name = TREAT_WARNING_AS_ERROR; switch2.BooleanValue = value; - base.ActiveToolSwitches.Add(TREAT_WARNING_AS_ERROR, switch2); - base.AddActiveSwitchToolValue(switch2); + ActiveToolSwitches.Add(TREAT_WARNING_AS_ERROR, switch2); + AddActiveSwitchToolValue(switch2); } } /// /// Getter/Setter for BuildingInIDE property /// - public virtual bool BuildingInIDE + public bool BuildingInIDE { get { - return (base.IsPropertySet(BUILDING_IN_IDE) && base.ActiveToolSwitches[BUILDING_IN_IDE].BooleanValue); + return (IsPropertySet(BUILDING_IN_IDE) && ActiveToolSwitches[BUILDING_IN_IDE].BooleanValue); } set { - base.ActiveToolSwitches.Remove(BUILDING_IN_IDE); + ActiveToolSwitches.Remove(BUILDING_IN_IDE); ToolSwitch switch2 = new ToolSwitch(ToolSwitchType.Boolean) { ArgumentRelationList = new ArrayList(), Name = BUILDING_IN_IDE, BooleanValue = value }; - base.ActiveToolSwitches.Add(BUILDING_IN_IDE, switch2); - base.AddActiveSwitchToolValue(switch2); + ActiveToolSwitches.Add(BUILDING_IN_IDE, switch2); + AddActiveSwitchToolValue(switch2); } } /// /// Getter/Setter for GccExceptHandling property /// - public virtual string GccExceptionHandling + public string GccExceptionHandling { get { - if (base.IsPropertySet("ExceptionHandling")) + if (IsPropertySet("ExceptionHandling")) { - return base.ActiveToolSwitches["ExceptionHandling"].Value; + return ActiveToolSwitches["ExceptionHandling"].Value; } return null; } set { - base.ActiveToolSwitches.Remove("ExceptionHandling"); + ActiveToolSwitches.Remove("ExceptionHandling"); ToolSwitch switch2 = new ToolSwitch(ToolSwitchType.String) { DisplayName = "Enable C++ Exceptions", Description = "Specifies the model of exception handling to be used by the compiler.", ArgumentRelationList = new ArrayList() }; - string[][] switchMap = new string[][] { new string[] { "Async", "/EHa" }, new string[] { "Sync", "/EHsc" }, new string[] { "SyncCThrow", "/EHs" }, new string[] { "false", "" } }; - switch2.SwitchValue = base.ReadSwitchMap("ExceptionHandling", switchMap, value); + string[][] switchMap = + { + new[] { "Async", "/EHa" }, + new[] { "Sync", "/EHsc" }, + new[] { "SyncCThrow", "/EHs" }, + new[] { "false", "" } + }; + switch2.SwitchValue = ReadSwitchMap("ExceptionHandling", switchMap, value); switch2.Name = "ExceptionHandling"; switch2.Value = value; #if PLATFORM_VS2010 @@ -365,36 +373,41 @@ public virtual string GccExceptionHandling #else switch2.MultipleValues = true; #endif - base.ActiveToolSwitches.Add("ExceptionHandling", switch2); - base.AddActiveSwitchToolValue(switch2); + ActiveToolSwitches.Add("ExceptionHandling", switch2); + AddActiveSwitchToolValue(switch2); } } /// /// Getter/Setter for Optimization property /// - public virtual string Optimization + public string Optimization { get { - if (base.IsPropertySet(OPTIMIZATION)) + if (IsPropertySet(OPTIMIZATION)) { - return base.ActiveToolSwitches[OPTIMIZATION].Value; + return ActiveToolSwitches[OPTIMIZATION].Value; } return null; } set { - base.ActiveToolSwitches.Remove(OPTIMIZATION); + ActiveToolSwitches.Remove(OPTIMIZATION); ToolSwitch switch2 = new ToolSwitch(ToolSwitchType.String) { DisplayName = OPTIMIZATION, Description = "Select option for code optimization; choose Custom to use specific optimization options. (-O0, -O1, -O2, -O3)", ArgumentRelationList = new ArrayList() }; - string[][] switchMap = new string[][] { new string[] { "Disabled", "-O0" }, new string[] { "MinSpace", "-O1" }, - new string[] { "MaxSpeed", "-O2" }, new string[] { "Full", "-O3" } }; - switch2.SwitchValue = base.ReadSwitchMap(OPTIMIZATION, switchMap, value); + string[][] switchMap = + { + new[] { "Disabled", "-O0" }, + new[] { "MinSpace", "-O1" }, + new[] { "MaxSpeed", "-O2" }, + new[] { "Full", "-O3" } + }; + switch2.SwitchValue = ReadSwitchMap(OPTIMIZATION, switchMap, value); switch2.Name = OPTIMIZATION; switch2.Value = value; #if PLATFORM_VS2010 @@ -402,15 +415,15 @@ public virtual string Optimization #else switch2.MultipleValues = true; #endif - base.ActiveToolSwitches.Add(OPTIMIZATION, switch2); - base.AddActiveSwitchToolValue(switch2); + ActiveToolSwitches.Add(OPTIMIZATION, switch2); + AddActiveSwitchToolValue(switch2); } } /// /// Getter/Setter for PlatformToolset property /// - public virtual string PlatformToolset + public string PlatformToolset { get { @@ -421,55 +434,68 @@ public virtual string PlatformToolset /// /// Getter/Setter for TrackerLogDirectory /// - public virtual string TrackerLogDirectory - { - get - { - if ( base.IsPropertySet( TRACKER_LOG_DIRECTORY ) ) - { - return base.ActiveToolSwitches[TRACKER_LOG_DIRECTORY].Value; - } - return null; - } - set - { - base.ActiveToolSwitches.Remove( TRACKER_LOG_DIRECTORY ); - ToolSwitch switch2 = new ToolSwitch( ToolSwitchType.Directory ) - { - DisplayName = "Tracker Log Directory", - Description = "Tracker Log Directory.", - ArgumentRelationList = new ArrayList(), - Value = VCToolTask.EnsureTrailingSlash( value ) - }; - base.ActiveToolSwitches.Add( TRACKER_LOG_DIRECTORY, switch2 ); - base.AddActiveSwitchToolValue( switch2 ); - } - } + public string TrackerLogDirectory + { + get + { + if (IsPropertySet(TRACKER_LOG_DIRECTORY)) + { + return ActiveToolSwitches[TRACKER_LOG_DIRECTORY].Value; + } + return null; + } + set + { + ActiveToolSwitches.Remove(TRACKER_LOG_DIRECTORY); + ToolSwitch switch2 = new ToolSwitch(ToolSwitchType.Directory) + { + DisplayName = "Tracker Log Directory", + Description = "Tracker Log Directory.", + ArgumentRelationList = new ArrayList(), + Value = EnsureTrailingSlash(value) + }; + ActiveToolSwitches.Add(TRACKER_LOG_DIRECTORY, switch2); + AddActiveSwitchToolValue(switch2); + } + } /// /// Getter/Setter for TargetMachine property /// - public virtual string TargetMachine + public string TargetMachine { get { - if (base.IsPropertySet("TargetMachine")) + if (IsPropertySet("TargetMachine")) { - return base.ActiveToolSwitches["TargetMachine"].Value; + return ActiveToolSwitches["TargetMachine"].Value; } return null; } set { - base.ActiveToolSwitches.Remove("TargetMachine"); + ActiveToolSwitches.Remove("TargetMachine"); ToolSwitch switch2 = new ToolSwitch(ToolSwitchType.String) { DisplayName = "Target Machine", Description = "The /MACHINE option specifies the target platform for the program.", ArgumentRelationList = new ArrayList() }; - string[][] switchMap = new string[][] { new string[] { "MachineARM", "/MACHINE:ARM" }, new string[] { "MachineEBC", "/MACHINE:EBC" }, new string[] { "MachineIA64", "/MACHINE:IA64" }, new string[] { "MachineMIPS", "/MACHINE:MIPS" }, new string[] { "MachineMIPS16", "/MACHINE:MIPS16" }, new string[] { "MachineMIPSFPU", "/MACHINE:MIPSFPU" }, new string[] { "MachineMIPSFPU16", "/MACHINE:MIPSFPU16" }, new string[] { "MachineSH4", "/MACHINE:SH4" }, new string[] { "MachineTHUMB", "/MACHINE:THUMB" }, new string[] { "MachineX64", "/MACHINE:X64" }, new string[] { "MachineX86", "/MACHINE:X86" } }; - switch2.SwitchValue = base.ReadSwitchMap("TargetMachine", switchMap, value); + string[][] switchMap = + { + new[] { "MachineARM", "/MACHINE:ARM" }, + new[] { "MachineEBC", "/MACHINE:EBC" }, + new[] { "MachineIA64", "/MACHINE:IA64" }, + new[] { "MachineMIPS", "/MACHINE:MIPS" }, + new[] { "MachineMIPS16", "/MACHINE:MIPS16" }, + new[] { "MachineMIPSFPU", "/MACHINE:MIPSFPU" }, + new[] { "MachineMIPSFPU16", "/MACHINE:MIPSFPU16" }, + new[] { "MachineSH4", "/MACHINE:SH4" }, + new[] { "MachineTHUMB", "/MACHINE:THUMB" }, + new[] { "MachineX64", "/MACHINE:X64" }, + new[] { "MachineX86", "/MACHINE:X86" } + }; + switch2.SwitchValue = ReadSwitchMap("TargetMachine", switchMap, value); switch2.Name = "TargetMachine"; switch2.Value = value; #if PLATFORM_VS2010 @@ -477,35 +503,39 @@ public virtual string TargetMachine #else switch2.MultipleValues = true; #endif - base.ActiveToolSwitches.Add("TargetMachine", switch2); - base.AddActiveSwitchToolValue(switch2); + ActiveToolSwitches.Add("TargetMachine", switch2); + AddActiveSwitchToolValue(switch2); } } /// /// Getter/Setter for CompileAs property /// - public virtual string CompileAs + public string CompileAs { get { - if (base.IsPropertySet(COMPILE_AS)) + if (IsPropertySet(COMPILE_AS)) { - return base.ActiveToolSwitches[COMPILE_AS].Value; + return ActiveToolSwitches[COMPILE_AS].Value; } return null; } set { - base.ActiveToolSwitches.Remove(COMPILE_AS); + ActiveToolSwitches.Remove(COMPILE_AS); ToolSwitch switch2 = new ToolSwitch(ToolSwitchType.String) { DisplayName = "Compile As", Description = "Select compile language option for .c and .cpp files. (-lang-c, -lang-c++)", ArgumentRelationList = new ArrayList() }; - string[][] switchMap = new string[][] { new string[] { "CompileAsC", "-lang-c" }, new string[] { "CompileAsCpp", "-lang-c++" } }; - switch2.SwitchValue = base.ReadSwitchMap(COMPILE_AS, switchMap, value); + string[][] switchMap = + { + new[] { "CompileAsC", "-lang-c" }, + new[] { "CompileAsCpp", "-lang-c++" } + }; + switch2.SwitchValue = ReadSwitchMap(COMPILE_AS, switchMap, value); switch2.Name = COMPILE_AS; switch2.Value = value; #if PLATFORM_VS2010 @@ -513,8 +543,8 @@ public virtual string CompileAs #else switch2.MultipleValues = true; #endif - base.ActiveToolSwitches.Add(COMPILE_AS, switch2); - base.AddActiveSwitchToolValue(switch2); + ActiveToolSwitches.Add(COMPILE_AS, switch2); + AddActiveSwitchToolValue(switch2); } } @@ -525,11 +555,11 @@ public bool Verbose { get { - return (base.IsPropertySet(VERBOSE) && base.ActiveToolSwitches[VERBOSE].BooleanValue); + return (IsPropertySet(VERBOSE) && ActiveToolSwitches[VERBOSE].BooleanValue); } set { - base.ActiveToolSwitches.Remove(VERBOSE); + ActiveToolSwitches.Remove(VERBOSE); ToolSwitch switch2 = new ToolSwitch(ToolSwitchType.Boolean) { DisplayName = "Verbose", @@ -539,23 +569,23 @@ public bool Verbose Name = VERBOSE, BooleanValue = value }; - base.ActiveToolSwitches.Add(VERBOSE, switch2); - base.AddActiveSwitchToolValue(switch2); + ActiveToolSwitches.Add(VERBOSE, switch2); + AddActiveSwitchToolValue(switch2); } } /// - /// Getter/Setter for EnhancedSecutiry property + /// Getter/Setter for EnhancedSecurity property /// - public virtual bool EnhancedSecurity + public bool EnhancedSecurity { get { - return (base.IsPropertySet(ENHANCED_SECURITY) && base.ActiveToolSwitches[ENHANCED_SECURITY].BooleanValue); + return (IsPropertySet(ENHANCED_SECURITY) && ActiveToolSwitches[ENHANCED_SECURITY].BooleanValue); } set { - base.ActiveToolSwitches.Remove(ENHANCED_SECURITY); + ActiveToolSwitches.Remove(ENHANCED_SECURITY); ToolSwitch switch2 = new ToolSwitch(ToolSwitchType.Boolean) { DisplayName = "Enhanced Security(-fstack-protector-all)", @@ -565,15 +595,14 @@ public virtual bool EnhancedSecurity Name = ENHANCED_SECURITY, BooleanValue = value }; - base.ActiveToolSwitches.Add(ENHANCED_SECURITY, switch2); - base.AddActiveSwitchToolValue(switch2); + ActiveToolSwitches.Add(ENHANCED_SECURITY, switch2); + AddActiveSwitchToolValue(switch2); } } /// /// Return the Get Enhanced Security string. /// - /// protected virtual string GetEnhancedSecuritySwitchValue() { return "-fstack-protector-all"; @@ -586,11 +615,11 @@ public bool PIE { get { - return (base.IsPropertySet(POSITION_INDEPENDENT_EXECUTABLE) && base.ActiveToolSwitches[POSITION_INDEPENDENT_EXECUTABLE].BooleanValue); + return (IsPropertySet(POSITION_INDEPENDENT_EXECUTABLE) && ActiveToolSwitches[POSITION_INDEPENDENT_EXECUTABLE].BooleanValue); } set { - base.ActiveToolSwitches.Remove(POSITION_INDEPENDENT_EXECUTABLE); + ActiveToolSwitches.Remove(POSITION_INDEPENDENT_EXECUTABLE); ToolSwitch switch2 = new ToolSwitch(ToolSwitchType.Boolean) { DisplayName = "Position Independent Executable(fPIE)", @@ -600,8 +629,8 @@ public bool PIE Name = POSITION_INDEPENDENT_EXECUTABLE, BooleanValue = value }; - base.ActiveToolSwitches.Add(POSITION_INDEPENDENT_EXECUTABLE, switch2); - base.AddActiveSwitchToolValue(switch2); + ActiveToolSwitches.Add(POSITION_INDEPENDENT_EXECUTABLE, switch2); + AddActiveSwitchToolValue(switch2); } } @@ -632,15 +661,15 @@ public string CompilerVersionTarget { get { - if (base.IsPropertySet(COMPILER_VERSION_TARGET)) + if (IsPropertySet(COMPILER_VERSION_TARGET)) { - return base.ActiveToolSwitches[COMPILER_VERSION_TARGET].Value; + return ActiveToolSwitches[COMPILER_VERSION_TARGET].Value; } return null; } set { - base.ActiveToolSwitches.Remove(COMPILER_VERSION_TARGET); + ActiveToolSwitches.Remove(COMPILER_VERSION_TARGET); ToolSwitch switch2 = new ToolSwitch(ToolSwitchType.String) { DisplayName = "Compiler version and target", @@ -651,33 +680,33 @@ public string CompilerVersionTarget switch2.Name = COMPILER_VERSION_TARGET; switch2.Value = value; - base.ActiveToolSwitches.Add(COMPILER_VERSION_TARGET, switch2); - base.AddActiveSwitchToolValue(switch2); + ActiveToolSwitches.Add(COMPILER_VERSION_TARGET, switch2); + AddActiveSwitchToolValue(switch2); } } /// /// Getter/Setter for the LinkSharedLibrary property /// - public virtual bool LinkSharedLibrary { get; set; } + public bool LinkSharedLibrary { get; set; } /// /// Getter/Setter for the Sources property /// [Required] - public virtual ITaskItem[] Sources + public ITaskItem[] Sources { get { - if (base.IsPropertySet(SOURCES)) + if (IsPropertySet(SOURCES)) { - return base.ActiveToolSwitches[SOURCES].TaskItemArray; + return ActiveToolSwitches[SOURCES].TaskItemArray; } return null; } set { - base.ActiveToolSwitches.Remove(SOURCES); + ActiveToolSwitches.Remove(SOURCES); ToolSwitch switch2 = new ToolSwitch(ToolSwitchType.ITaskItemArray) { Separator = " ", @@ -685,10 +714,10 @@ public virtual ITaskItem[] Sources ArgumentRelationList = new ArrayList(), TaskItemArray = value }; - base.ActiveToolSwitches.Add(SOURCES, switch2); - base.AddActiveSwitchToolValue(switch2); + ActiveToolSwitches.Add(SOURCES, switch2); + AddActiveSwitchToolValue(switch2); } } - #endregion //properties + #endregion } } diff --git a/src_vs2012/BuildTasks/BlackBerry.BuildTasks.csproj b/src_vs2012/BuildTasks/BlackBerry.BuildTasks.csproj index f0300fc4..e21fe404 100644 --- a/src_vs2012/BuildTasks/BlackBerry.BuildTasks.csproj +++ b/src_vs2012/BuildTasks/BlackBerry.BuildTasks.csproj @@ -94,6 +94,9 @@ BBSigner.cs + + BBTask.cs + CheckIfInstalled.cs @@ -109,6 +112,9 @@ MakeAllAndFormatOutputMessages.cs + + NativeMethods.cs + PackagerCmdBuilder.cs @@ -139,6 +145,12 @@ VSNDKTasks.cs + + ConfigDefaults.cs + + + Helpers\GlobalHelper.cs + diff --git a/src_vs2013/BuildTasks/BlackBerry.BuildTasks.csproj b/src_vs2013/BuildTasks/BlackBerry.BuildTasks.csproj index b9f53077..e0d1a0ef 100644 --- a/src_vs2013/BuildTasks/BlackBerry.BuildTasks.csproj +++ b/src_vs2013/BuildTasks/BlackBerry.BuildTasks.csproj @@ -95,6 +95,9 @@ BBSigner.cs + + BBTask.cs + CheckIfInstalled.cs @@ -110,6 +113,9 @@ MakeAllAndFormatOutputMessages.cs + + NativeMethods.cs + PackagerCmdBuilder.cs @@ -140,6 +146,12 @@ VSNDKTasks.cs + + ConfigDefaults.cs + + + Helpers\GlobalHelper.cs + From 65fc1e290db74c98c79a7fd35f5ecf66b0fe0740 Mon Sep 17 00:00:00 2001 From: Pawel Hofman Date: Mon, 23 Jun 2014 16:00:35 +0200 Subject: [PATCH 267/851] Ranamed Qcc-base task to more descriptive name --- src_vs2010/BuildTasks/{VSNDKTasks.cs => QccTask.cs} | 0 src_vs2012/BuildTasks/BlackBerry.BuildTasks.csproj | 6 +++--- src_vs2013/BuildTasks/BlackBerry.BuildTasks.csproj | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) rename src_vs2010/BuildTasks/{VSNDKTasks.cs => QccTask.cs} (100%) diff --git a/src_vs2010/BuildTasks/VSNDKTasks.cs b/src_vs2010/BuildTasks/QccTask.cs similarity index 100% rename from src_vs2010/BuildTasks/VSNDKTasks.cs rename to src_vs2010/BuildTasks/QccTask.cs diff --git a/src_vs2012/BuildTasks/BlackBerry.BuildTasks.csproj b/src_vs2012/BuildTasks/BlackBerry.BuildTasks.csproj index e21fe404..d173a246 100644 --- a/src_vs2012/BuildTasks/BlackBerry.BuildTasks.csproj +++ b/src_vs2012/BuildTasks/BlackBerry.BuildTasks.csproj @@ -136,15 +136,15 @@ QccLink.cs + + QccTask.cs + RemoveFlagFile.cs SSHDelete.cs - - VSNDKTasks.cs - ConfigDefaults.cs diff --git a/src_vs2013/BuildTasks/BlackBerry.BuildTasks.csproj b/src_vs2013/BuildTasks/BlackBerry.BuildTasks.csproj index e0d1a0ef..8b769ddf 100644 --- a/src_vs2013/BuildTasks/BlackBerry.BuildTasks.csproj +++ b/src_vs2013/BuildTasks/BlackBerry.BuildTasks.csproj @@ -137,15 +137,15 @@ QccLink.cs + + QccTask.cs + RemoveFlagFile.cs SSHDelete.cs - - VSNDKTasks.cs - ConfigDefaults.cs From 6829a291616069b3bf39ed80a275641b5870d2fc Mon Sep 17 00:00:00 2001 From: Pawel Hofman Date: Mon, 23 Jun 2014 16:13:35 +0200 Subject: [PATCH 268/851] Moved Dialogs to the main folder --- src_vs2010/Package/BlackBerry.Package.csproj | 168 ++++++++--------- src_vs2012/Package/BlackBerry.Package.csproj | 84 ++++----- .../Dialogs/AboutForm.Designer.cs | 0 .../{Options => }/Dialogs/AboutForm.cs | 0 .../{Options => }/Dialogs/AboutForm.resx | 0 .../Dialogs/AddLocalNdkForm.Designer.cs | 0 .../{Options => }/Dialogs/AddLocalNdkForm.cs | 0 .../Dialogs/AddLocalNdkForm.resx | 0 .../CertificateDetailsForm.Designer.cs | 0 .../Dialogs/CertificateDetailsForm.cs | 0 .../Dialogs/CertificateDetailsForm.resx | 0 .../Dialogs/CskRequestForm.Designer.cs | 0 .../{Options => }/Dialogs/CskRequestForm.cs | 0 .../{Options => }/Dialogs/CskRequestForm.resx | 0 .../DebugTokenDeploymentForm.Designer.cs | 0 .../Dialogs/DebugTokenDeploymentForm.cs | 0 .../Dialogs/DebugTokenDeploymentForm.resx | 0 .../Dialogs/DeviceForm.Designer.cs | 0 .../{Options => }/Dialogs/DeviceForm.cs | 0 .../{Options => }/Dialogs/DeviceForm.resx | 0 .../InstallConfirmationForm.Designer.cs | 0 .../Dialogs/InstallConfirmationForm.cs | 0 .../Dialogs/InstallConfirmationForm.resx | 0 .../Dialogs/InstallForm.Designer.cs | 0 .../{Options => }/Dialogs/InstallForm.cs | 0 .../{Options => }/Dialogs/InstallForm.resx | 0 .../Dialogs/ListItemControl.Designer.cs | 0 .../{Options => }/Dialogs/ListItemControl.cs | 0 .../Dialogs/ListItemControl.resx | 0 .../MissingNdkInstalledForm.Designer.cs | 0 .../Dialogs/MissingNdkInstalledForm.cs | 0 .../Dialogs/MissingNdkInstalledForm.resx | 0 .../Dialogs/PasswordForm.Designer.cs | 0 .../{Options => }/Dialogs/PasswordForm.cs | 0 .../{Options => }/Dialogs/PasswordForm.resx | 0 .../Dialogs/PinListForm.Designer.cs | 0 .../{Options => }/Dialogs/PinListForm.cs | 0 .../{Options => }/Dialogs/PinListForm.resx | 0 .../Dialogs/RegistrationForm.Designer.cs | 0 .../{Options => }/Dialogs/RegistrationForm.cs | 0 .../Dialogs/RegistrationForm.resx | 0 .../UpdateManagerStatusForm.Designer.cs | 0 .../Dialogs/UpdateManagerStatusForm.cs | 0 .../Dialogs/UpdateManagerStatusForm.resx | 0 src_vs2013/Package/BlackBerry.Package.csproj | 169 +++++++++--------- 45 files changed, 211 insertions(+), 210 deletions(-) rename src_vs2012/Package/{Options => }/Dialogs/AboutForm.Designer.cs (100%) rename src_vs2012/Package/{Options => }/Dialogs/AboutForm.cs (100%) rename src_vs2012/Package/{Options => }/Dialogs/AboutForm.resx (100%) rename src_vs2012/Package/{Options => }/Dialogs/AddLocalNdkForm.Designer.cs (100%) rename src_vs2012/Package/{Options => }/Dialogs/AddLocalNdkForm.cs (100%) rename src_vs2012/Package/{Options => }/Dialogs/AddLocalNdkForm.resx (100%) rename src_vs2012/Package/{Options => }/Dialogs/CertificateDetailsForm.Designer.cs (100%) rename src_vs2012/Package/{Options => }/Dialogs/CertificateDetailsForm.cs (100%) rename src_vs2012/Package/{Options => }/Dialogs/CertificateDetailsForm.resx (100%) rename src_vs2012/Package/{Options => }/Dialogs/CskRequestForm.Designer.cs (100%) rename src_vs2012/Package/{Options => }/Dialogs/CskRequestForm.cs (100%) rename src_vs2012/Package/{Options => }/Dialogs/CskRequestForm.resx (100%) rename src_vs2012/Package/{Options => }/Dialogs/DebugTokenDeploymentForm.Designer.cs (100%) rename src_vs2012/Package/{Options => }/Dialogs/DebugTokenDeploymentForm.cs (100%) rename src_vs2012/Package/{Options => }/Dialogs/DebugTokenDeploymentForm.resx (100%) rename src_vs2012/Package/{Options => }/Dialogs/DeviceForm.Designer.cs (100%) rename src_vs2012/Package/{Options => }/Dialogs/DeviceForm.cs (100%) rename src_vs2012/Package/{Options => }/Dialogs/DeviceForm.resx (100%) rename src_vs2012/Package/{Options => }/Dialogs/InstallConfirmationForm.Designer.cs (100%) rename src_vs2012/Package/{Options => }/Dialogs/InstallConfirmationForm.cs (100%) rename src_vs2012/Package/{Options => }/Dialogs/InstallConfirmationForm.resx (100%) rename src_vs2012/Package/{Options => }/Dialogs/InstallForm.Designer.cs (100%) rename src_vs2012/Package/{Options => }/Dialogs/InstallForm.cs (100%) rename src_vs2012/Package/{Options => }/Dialogs/InstallForm.resx (100%) rename src_vs2012/Package/{Options => }/Dialogs/ListItemControl.Designer.cs (100%) rename src_vs2012/Package/{Options => }/Dialogs/ListItemControl.cs (100%) rename src_vs2012/Package/{Options => }/Dialogs/ListItemControl.resx (100%) rename src_vs2012/Package/{Options => }/Dialogs/MissingNdkInstalledForm.Designer.cs (100%) rename src_vs2012/Package/{Options => }/Dialogs/MissingNdkInstalledForm.cs (100%) rename src_vs2012/Package/{Options => }/Dialogs/MissingNdkInstalledForm.resx (100%) rename src_vs2012/Package/{Options => }/Dialogs/PasswordForm.Designer.cs (100%) rename src_vs2012/Package/{Options => }/Dialogs/PasswordForm.cs (100%) rename src_vs2012/Package/{Options => }/Dialogs/PasswordForm.resx (100%) rename src_vs2012/Package/{Options => }/Dialogs/PinListForm.Designer.cs (100%) rename src_vs2012/Package/{Options => }/Dialogs/PinListForm.cs (100%) rename src_vs2012/Package/{Options => }/Dialogs/PinListForm.resx (100%) rename src_vs2012/Package/{Options => }/Dialogs/RegistrationForm.Designer.cs (100%) rename src_vs2012/Package/{Options => }/Dialogs/RegistrationForm.cs (100%) rename src_vs2012/Package/{Options => }/Dialogs/RegistrationForm.resx (100%) rename src_vs2012/Package/{Options => }/Dialogs/UpdateManagerStatusForm.Designer.cs (100%) rename src_vs2012/Package/{Options => }/Dialogs/UpdateManagerStatusForm.cs (100%) rename src_vs2012/Package/{Options => }/Dialogs/UpdateManagerStatusForm.resx (100%) diff --git a/src_vs2010/Package/BlackBerry.Package.csproj b/src_vs2010/Package/BlackBerry.Package.csproj index cd91ba10..f1ebd699 100644 --- a/src_vs2010/Package/BlackBerry.Package.csproj +++ b/src_vs2010/Package/BlackBerry.Package.csproj @@ -212,116 +212,116 @@ Options\ApiLevelOptionPage.cs Component - - Options\Dialogs\AboutForm.cs + + Dialogs\AboutForm.cs Form - - Options\Dialogs\AboutForm.designer.cs + + Dialogs\AboutForm.designer.cs AboutForm.cs - - Options\Dialogs\AddLocalNdkForm.cs + + Dialogs\AddLocalNdkForm.cs Form - - Options\Dialogs\AddLocalNdkForm.designer.cs + + Dialogs\AddLocalNdkForm.designer.cs AddLocalNdkForm.cs - - Options\Dialogs\CertificateDetailsForm.cs + + Dialogs\CertificateDetailsForm.cs Form - - Options\Dialogs\CertificateDetailsForm.designer.cs + + Dialogs\CertificateDetailsForm.designer.cs CertificateDetailsForm.cs - - Options\Dialogs\CskRequestForm.cs + + Dialogs\CskRequestForm.cs Form - - Options\Dialogs\CskRequestForm.designer.cs + + Dialogs\CskRequestForm.designer.cs CskRequestForm.cs - - Options\Dialogs\DebugTokenDeploymentForm.cs + + Dialogs\DebugTokenDeploymentForm.cs Form - - Options\Dialogs\DebugTokenDeploymentForm.designer.cs + + Dialogs\DebugTokenDeploymentForm.designer.cs DebugTokenDeploymentForm.cs - - Options\Dialogs\DeviceForm.cs + + Dialogs\DeviceForm.cs Form - - Options\Dialogs\DeviceForm.designer.cs + + Dialogs\DeviceForm.designer.cs DeviceForm.cs - - Options\Dialogs\InstallConfirmationForm.cs + + Dialogs\InstallConfirmationForm.cs Form - - Options\Dialogs\InstallConfirmationForm.designer.cs + + Dialogs\InstallConfirmationForm.designer.cs InstallConfirmationForm.cs - - Options\Dialogs\InstallForm.cs + + Dialogs\InstallForm.cs Form - - Options\Dialogs\InstallForm.designer.cs + + Dialogs\InstallForm.designer.cs InstallForm.cs - - Options\Dialogs\ListItemControl.cs + + Dialogs\ListItemControl.cs UserControl - - Options\Dialogs\ListItemControl.designer.cs + + Dialogs\ListItemControl.designer.cs ListItemControl.cs - - Options\Dialogs\MissingNdkInstalledForm.cs + + Dialogs\MissingNdkInstalledForm.cs Form - - Options\Dialogs\MissingNdkInstalledForm.designer.cs + + Dialogs\MissingNdkInstalledForm.designer.cs MissingNdkInstalledForm.cs - - Options\Dialogs\PasswordForm.cs + + Dialogs\PasswordForm.cs Form - - Options\Dialogs\PasswordForm.designer.cs + + Dialogs\PasswordForm.designer.cs PasswordForm.cs - - Options\Dialogs\PinListForm.cs + + Dialogs\PinListForm.cs Form - - Options\Dialogs\PinListForm.designer.cs + + Dialogs\PinListForm.designer.cs PinListForm.cs - - Options\Dialogs\RegistrationForm.cs + + Dialogs\RegistrationForm.cs Form - - Options\Dialogs\RegistrationForm.designer.cs + + Dialogs\RegistrationForm.designer.cs RegistrationForm.cs - - Options\Dialogs\UpdateManagerStatusForm.cs + + Dialogs\UpdateManagerStatusForm.cs Form - - Options\Dialogs\UpdateManagerStatusForm.designer.cs + + Dialogs\UpdateManagerStatusForm.designer.cs UpdateManagerStatusForm.cs @@ -428,60 +428,60 @@ Options\ApiLevelOptionControl.resx ApiLevelOptionControl.cs - - Options\Dialogs\AboutForm.resx + + Dialogs\AboutForm.resx AboutForm.cs - - Options\Dialogs\AddLocalNdkForm.resx + + Dialogs\AddLocalNdkForm.resx AddLocalNdkForm.cs - - Options\Dialogs\CertificateDetailsForm.resx + + Dialogs\CertificateDetailsForm.resx CertificateDetailsForm.cs - - Options\Dialogs\CskRequestForm.resx + + Dialogs\CskRequestForm.resx CskRequestForm.cs - - Options\Dialogs\DebugTokenDeploymentForm.resx + + Dialogs\DebugTokenDeploymentForm.resx DebugTokenDeploymentForm.cs - - Options\Dialogs\DeviceForm.resx + + Dialogs\DeviceForm.resx DeviceForm.cs - - Options\Dialogs\InstallConfirmationForm.resx + + Dialogs\InstallConfirmationForm.resx InstallConfirmationForm.cs - - Options\Dialogs\InstallForm.resx + + Dialogs\InstallForm.resx InstallForm.cs - - Options\Dialogs\ListItemControl.resx + + Dialogs\ListItemControl.resx ListItemControl.cs - - Options\Dialogs\MissingNdkInstalledForm.resx + + Dialogs\MissingNdkInstalledForm.resx MissingNdkInstalledForm.cs - - Options\Dialogs\PasswordForm.resx + + Dialogs\PasswordForm.resx PasswordForm.cs - - Options\Dialogs\PinListForm.resx + + Dialogs\PinListForm.resx PinListForm.cs - - Options\Dialogs\RegistrationForm.resx + + Dialogs\RegistrationForm.resx RegistrationForm.cs - - Options\Dialogs\UpdateManagerStatusForm.resx + + Dialogs\UpdateManagerStatusForm.resx UpdateManagerStatusForm.cs diff --git a/src_vs2012/Package/BlackBerry.Package.csproj b/src_vs2012/Package/BlackBerry.Package.csproj index 7d355db9..442ed7da 100644 --- a/src_vs2012/Package/BlackBerry.Package.csproj +++ b/src_vs2012/Package/BlackBerry.Package.csproj @@ -204,88 +204,88 @@ Component - + Form - + AboutForm.cs - + Form - + AddLocalNdkForm.cs - + Form - + CertificateDetailsForm.cs - + Form - + CskRequestForm.cs - + Form - + DebugTokenDeploymentForm.cs - + Form - + DeviceForm.cs - + Form - + InstallConfirmationForm.cs - + Form - + InstallForm.cs - + UserControl - + ListItemControl.cs - + Form - + MissingNdkInstalledForm.cs - + Form - + PasswordForm.cs - + Form - + PinListForm.cs - + Form - + RegistrationForm.cs - + Form - + UpdateManagerStatusForm.cs @@ -337,25 +337,25 @@ Always - + CertificateDetailsForm.cs - + CskRequestForm.cs - + InstallConfirmationForm.cs - + InstallForm.cs - + ListItemControl.cs - + MissingNdkInstalledForm.cs - + UpdateManagerStatusForm.cs @@ -454,25 +454,25 @@ ApiLevelOptionControl.cs - + AboutForm.cs - + AddLocalNdkForm.cs - + DebugTokenDeploymentForm.cs - + DeviceForm.cs - + PasswordForm.cs - + PinListForm.cs - + RegistrationForm.cs diff --git a/src_vs2012/Package/Options/Dialogs/AboutForm.Designer.cs b/src_vs2012/Package/Dialogs/AboutForm.Designer.cs similarity index 100% rename from src_vs2012/Package/Options/Dialogs/AboutForm.Designer.cs rename to src_vs2012/Package/Dialogs/AboutForm.Designer.cs diff --git a/src_vs2012/Package/Options/Dialogs/AboutForm.cs b/src_vs2012/Package/Dialogs/AboutForm.cs similarity index 100% rename from src_vs2012/Package/Options/Dialogs/AboutForm.cs rename to src_vs2012/Package/Dialogs/AboutForm.cs diff --git a/src_vs2012/Package/Options/Dialogs/AboutForm.resx b/src_vs2012/Package/Dialogs/AboutForm.resx similarity index 100% rename from src_vs2012/Package/Options/Dialogs/AboutForm.resx rename to src_vs2012/Package/Dialogs/AboutForm.resx diff --git a/src_vs2012/Package/Options/Dialogs/AddLocalNdkForm.Designer.cs b/src_vs2012/Package/Dialogs/AddLocalNdkForm.Designer.cs similarity index 100% rename from src_vs2012/Package/Options/Dialogs/AddLocalNdkForm.Designer.cs rename to src_vs2012/Package/Dialogs/AddLocalNdkForm.Designer.cs diff --git a/src_vs2012/Package/Options/Dialogs/AddLocalNdkForm.cs b/src_vs2012/Package/Dialogs/AddLocalNdkForm.cs similarity index 100% rename from src_vs2012/Package/Options/Dialogs/AddLocalNdkForm.cs rename to src_vs2012/Package/Dialogs/AddLocalNdkForm.cs diff --git a/src_vs2012/Package/Options/Dialogs/AddLocalNdkForm.resx b/src_vs2012/Package/Dialogs/AddLocalNdkForm.resx similarity index 100% rename from src_vs2012/Package/Options/Dialogs/AddLocalNdkForm.resx rename to src_vs2012/Package/Dialogs/AddLocalNdkForm.resx diff --git a/src_vs2012/Package/Options/Dialogs/CertificateDetailsForm.Designer.cs b/src_vs2012/Package/Dialogs/CertificateDetailsForm.Designer.cs similarity index 100% rename from src_vs2012/Package/Options/Dialogs/CertificateDetailsForm.Designer.cs rename to src_vs2012/Package/Dialogs/CertificateDetailsForm.Designer.cs diff --git a/src_vs2012/Package/Options/Dialogs/CertificateDetailsForm.cs b/src_vs2012/Package/Dialogs/CertificateDetailsForm.cs similarity index 100% rename from src_vs2012/Package/Options/Dialogs/CertificateDetailsForm.cs rename to src_vs2012/Package/Dialogs/CertificateDetailsForm.cs diff --git a/src_vs2012/Package/Options/Dialogs/CertificateDetailsForm.resx b/src_vs2012/Package/Dialogs/CertificateDetailsForm.resx similarity index 100% rename from src_vs2012/Package/Options/Dialogs/CertificateDetailsForm.resx rename to src_vs2012/Package/Dialogs/CertificateDetailsForm.resx diff --git a/src_vs2012/Package/Options/Dialogs/CskRequestForm.Designer.cs b/src_vs2012/Package/Dialogs/CskRequestForm.Designer.cs similarity index 100% rename from src_vs2012/Package/Options/Dialogs/CskRequestForm.Designer.cs rename to src_vs2012/Package/Dialogs/CskRequestForm.Designer.cs diff --git a/src_vs2012/Package/Options/Dialogs/CskRequestForm.cs b/src_vs2012/Package/Dialogs/CskRequestForm.cs similarity index 100% rename from src_vs2012/Package/Options/Dialogs/CskRequestForm.cs rename to src_vs2012/Package/Dialogs/CskRequestForm.cs diff --git a/src_vs2012/Package/Options/Dialogs/CskRequestForm.resx b/src_vs2012/Package/Dialogs/CskRequestForm.resx similarity index 100% rename from src_vs2012/Package/Options/Dialogs/CskRequestForm.resx rename to src_vs2012/Package/Dialogs/CskRequestForm.resx diff --git a/src_vs2012/Package/Options/Dialogs/DebugTokenDeploymentForm.Designer.cs b/src_vs2012/Package/Dialogs/DebugTokenDeploymentForm.Designer.cs similarity index 100% rename from src_vs2012/Package/Options/Dialogs/DebugTokenDeploymentForm.Designer.cs rename to src_vs2012/Package/Dialogs/DebugTokenDeploymentForm.Designer.cs diff --git a/src_vs2012/Package/Options/Dialogs/DebugTokenDeploymentForm.cs b/src_vs2012/Package/Dialogs/DebugTokenDeploymentForm.cs similarity index 100% rename from src_vs2012/Package/Options/Dialogs/DebugTokenDeploymentForm.cs rename to src_vs2012/Package/Dialogs/DebugTokenDeploymentForm.cs diff --git a/src_vs2012/Package/Options/Dialogs/DebugTokenDeploymentForm.resx b/src_vs2012/Package/Dialogs/DebugTokenDeploymentForm.resx similarity index 100% rename from src_vs2012/Package/Options/Dialogs/DebugTokenDeploymentForm.resx rename to src_vs2012/Package/Dialogs/DebugTokenDeploymentForm.resx diff --git a/src_vs2012/Package/Options/Dialogs/DeviceForm.Designer.cs b/src_vs2012/Package/Dialogs/DeviceForm.Designer.cs similarity index 100% rename from src_vs2012/Package/Options/Dialogs/DeviceForm.Designer.cs rename to src_vs2012/Package/Dialogs/DeviceForm.Designer.cs diff --git a/src_vs2012/Package/Options/Dialogs/DeviceForm.cs b/src_vs2012/Package/Dialogs/DeviceForm.cs similarity index 100% rename from src_vs2012/Package/Options/Dialogs/DeviceForm.cs rename to src_vs2012/Package/Dialogs/DeviceForm.cs diff --git a/src_vs2012/Package/Options/Dialogs/DeviceForm.resx b/src_vs2012/Package/Dialogs/DeviceForm.resx similarity index 100% rename from src_vs2012/Package/Options/Dialogs/DeviceForm.resx rename to src_vs2012/Package/Dialogs/DeviceForm.resx diff --git a/src_vs2012/Package/Options/Dialogs/InstallConfirmationForm.Designer.cs b/src_vs2012/Package/Dialogs/InstallConfirmationForm.Designer.cs similarity index 100% rename from src_vs2012/Package/Options/Dialogs/InstallConfirmationForm.Designer.cs rename to src_vs2012/Package/Dialogs/InstallConfirmationForm.Designer.cs diff --git a/src_vs2012/Package/Options/Dialogs/InstallConfirmationForm.cs b/src_vs2012/Package/Dialogs/InstallConfirmationForm.cs similarity index 100% rename from src_vs2012/Package/Options/Dialogs/InstallConfirmationForm.cs rename to src_vs2012/Package/Dialogs/InstallConfirmationForm.cs diff --git a/src_vs2012/Package/Options/Dialogs/InstallConfirmationForm.resx b/src_vs2012/Package/Dialogs/InstallConfirmationForm.resx similarity index 100% rename from src_vs2012/Package/Options/Dialogs/InstallConfirmationForm.resx rename to src_vs2012/Package/Dialogs/InstallConfirmationForm.resx diff --git a/src_vs2012/Package/Options/Dialogs/InstallForm.Designer.cs b/src_vs2012/Package/Dialogs/InstallForm.Designer.cs similarity index 100% rename from src_vs2012/Package/Options/Dialogs/InstallForm.Designer.cs rename to src_vs2012/Package/Dialogs/InstallForm.Designer.cs diff --git a/src_vs2012/Package/Options/Dialogs/InstallForm.cs b/src_vs2012/Package/Dialogs/InstallForm.cs similarity index 100% rename from src_vs2012/Package/Options/Dialogs/InstallForm.cs rename to src_vs2012/Package/Dialogs/InstallForm.cs diff --git a/src_vs2012/Package/Options/Dialogs/InstallForm.resx b/src_vs2012/Package/Dialogs/InstallForm.resx similarity index 100% rename from src_vs2012/Package/Options/Dialogs/InstallForm.resx rename to src_vs2012/Package/Dialogs/InstallForm.resx diff --git a/src_vs2012/Package/Options/Dialogs/ListItemControl.Designer.cs b/src_vs2012/Package/Dialogs/ListItemControl.Designer.cs similarity index 100% rename from src_vs2012/Package/Options/Dialogs/ListItemControl.Designer.cs rename to src_vs2012/Package/Dialogs/ListItemControl.Designer.cs diff --git a/src_vs2012/Package/Options/Dialogs/ListItemControl.cs b/src_vs2012/Package/Dialogs/ListItemControl.cs similarity index 100% rename from src_vs2012/Package/Options/Dialogs/ListItemControl.cs rename to src_vs2012/Package/Dialogs/ListItemControl.cs diff --git a/src_vs2012/Package/Options/Dialogs/ListItemControl.resx b/src_vs2012/Package/Dialogs/ListItemControl.resx similarity index 100% rename from src_vs2012/Package/Options/Dialogs/ListItemControl.resx rename to src_vs2012/Package/Dialogs/ListItemControl.resx diff --git a/src_vs2012/Package/Options/Dialogs/MissingNdkInstalledForm.Designer.cs b/src_vs2012/Package/Dialogs/MissingNdkInstalledForm.Designer.cs similarity index 100% rename from src_vs2012/Package/Options/Dialogs/MissingNdkInstalledForm.Designer.cs rename to src_vs2012/Package/Dialogs/MissingNdkInstalledForm.Designer.cs diff --git a/src_vs2012/Package/Options/Dialogs/MissingNdkInstalledForm.cs b/src_vs2012/Package/Dialogs/MissingNdkInstalledForm.cs similarity index 100% rename from src_vs2012/Package/Options/Dialogs/MissingNdkInstalledForm.cs rename to src_vs2012/Package/Dialogs/MissingNdkInstalledForm.cs diff --git a/src_vs2012/Package/Options/Dialogs/MissingNdkInstalledForm.resx b/src_vs2012/Package/Dialogs/MissingNdkInstalledForm.resx similarity index 100% rename from src_vs2012/Package/Options/Dialogs/MissingNdkInstalledForm.resx rename to src_vs2012/Package/Dialogs/MissingNdkInstalledForm.resx diff --git a/src_vs2012/Package/Options/Dialogs/PasswordForm.Designer.cs b/src_vs2012/Package/Dialogs/PasswordForm.Designer.cs similarity index 100% rename from src_vs2012/Package/Options/Dialogs/PasswordForm.Designer.cs rename to src_vs2012/Package/Dialogs/PasswordForm.Designer.cs diff --git a/src_vs2012/Package/Options/Dialogs/PasswordForm.cs b/src_vs2012/Package/Dialogs/PasswordForm.cs similarity index 100% rename from src_vs2012/Package/Options/Dialogs/PasswordForm.cs rename to src_vs2012/Package/Dialogs/PasswordForm.cs diff --git a/src_vs2012/Package/Options/Dialogs/PasswordForm.resx b/src_vs2012/Package/Dialogs/PasswordForm.resx similarity index 100% rename from src_vs2012/Package/Options/Dialogs/PasswordForm.resx rename to src_vs2012/Package/Dialogs/PasswordForm.resx diff --git a/src_vs2012/Package/Options/Dialogs/PinListForm.Designer.cs b/src_vs2012/Package/Dialogs/PinListForm.Designer.cs similarity index 100% rename from src_vs2012/Package/Options/Dialogs/PinListForm.Designer.cs rename to src_vs2012/Package/Dialogs/PinListForm.Designer.cs diff --git a/src_vs2012/Package/Options/Dialogs/PinListForm.cs b/src_vs2012/Package/Dialogs/PinListForm.cs similarity index 100% rename from src_vs2012/Package/Options/Dialogs/PinListForm.cs rename to src_vs2012/Package/Dialogs/PinListForm.cs diff --git a/src_vs2012/Package/Options/Dialogs/PinListForm.resx b/src_vs2012/Package/Dialogs/PinListForm.resx similarity index 100% rename from src_vs2012/Package/Options/Dialogs/PinListForm.resx rename to src_vs2012/Package/Dialogs/PinListForm.resx diff --git a/src_vs2012/Package/Options/Dialogs/RegistrationForm.Designer.cs b/src_vs2012/Package/Dialogs/RegistrationForm.Designer.cs similarity index 100% rename from src_vs2012/Package/Options/Dialogs/RegistrationForm.Designer.cs rename to src_vs2012/Package/Dialogs/RegistrationForm.Designer.cs diff --git a/src_vs2012/Package/Options/Dialogs/RegistrationForm.cs b/src_vs2012/Package/Dialogs/RegistrationForm.cs similarity index 100% rename from src_vs2012/Package/Options/Dialogs/RegistrationForm.cs rename to src_vs2012/Package/Dialogs/RegistrationForm.cs diff --git a/src_vs2012/Package/Options/Dialogs/RegistrationForm.resx b/src_vs2012/Package/Dialogs/RegistrationForm.resx similarity index 100% rename from src_vs2012/Package/Options/Dialogs/RegistrationForm.resx rename to src_vs2012/Package/Dialogs/RegistrationForm.resx diff --git a/src_vs2012/Package/Options/Dialogs/UpdateManagerStatusForm.Designer.cs b/src_vs2012/Package/Dialogs/UpdateManagerStatusForm.Designer.cs similarity index 100% rename from src_vs2012/Package/Options/Dialogs/UpdateManagerStatusForm.Designer.cs rename to src_vs2012/Package/Dialogs/UpdateManagerStatusForm.Designer.cs diff --git a/src_vs2012/Package/Options/Dialogs/UpdateManagerStatusForm.cs b/src_vs2012/Package/Dialogs/UpdateManagerStatusForm.cs similarity index 100% rename from src_vs2012/Package/Options/Dialogs/UpdateManagerStatusForm.cs rename to src_vs2012/Package/Dialogs/UpdateManagerStatusForm.cs diff --git a/src_vs2012/Package/Options/Dialogs/UpdateManagerStatusForm.resx b/src_vs2012/Package/Dialogs/UpdateManagerStatusForm.resx similarity index 100% rename from src_vs2012/Package/Options/Dialogs/UpdateManagerStatusForm.resx rename to src_vs2012/Package/Dialogs/UpdateManagerStatusForm.resx diff --git a/src_vs2013/Package/BlackBerry.Package.csproj b/src_vs2013/Package/BlackBerry.Package.csproj index b141aa92..d0a99898 100644 --- a/src_vs2013/Package/BlackBerry.Package.csproj +++ b/src_vs2013/Package/BlackBerry.Package.csproj @@ -216,115 +216,116 @@ Options\ApiLevelOptionPage.cs Component - - Options\Dialogs\AboutForm.cs + + Dialogs\AboutForm.cs Form - - Options\Dialogs\AboutForm.designer.cs + + Dialogs\AboutForm.designer.cs AboutForm.cs - - Options\Dialogs\AddLocalNdkForm.cs + + Dialogs\AddLocalNdkForm.cs Form - - Options\Dialogs\AddLocalNdkForm.designer.cs + + Dialogs\AddLocalNdkForm.designer.cs AddLocalNdkForm.cs - - Options\Dialogs\CertificateDetailsForm.cs + + Dialogs\CertificateDetailsForm.cs Form - - Options\Dialogs\CertificateDetailsForm.designer.cs + + Dialogs\CertificateDetailsForm.designer.cs CertificateDetailsForm.cs - - Options\Dialogs\CskRequestForm.cs + + Dialogs\CskRequestForm.cs Form - - Options\Dialogs\CskRequestForm.designer.cs + + Dialogs\CskRequestForm.designer.cs CskRequestForm.cs - - Options\Dialogs\DebugTokenDeploymentForm.cs + + Dialogs\DebugTokenDeploymentForm.cs Form - - Options\Dialogs\DebugTokenDeploymentForm.designer.cs + + Dialogs\DebugTokenDeploymentForm.designer.cs DebugTokenDeploymentForm.cs - - Options\Dialogs\DeviceForm.cs + + Dialogs\DeviceForm.cs Form - - Options\Dialogs\DeviceForm.designer.cs + + Dialogs\DeviceForm.designer.cs DeviceForm.cs - - Options\Dialogs\InstallConfirmationForm.cs + + Dialogs\InstallConfirmationForm.cs Form - - Options\Dialogs\InstallConfirmationForm.designer.cs + + Dialogs\InstallConfirmationForm.designer.cs InstallConfirmationForm.cs - - Options\Dialogs\InstallForm.cs + + Dialogs\InstallForm.cs Form - - Options\Dialogs\InstallForm.designer.cs + + Dialogs\InstallForm.designer.cs InstallForm.cs - - Options\Dialogs\ListItemControl.cs + + Dialogs\ListItemControl.cs UserControl - - Options\Dialogs\ListItemControl.designer.cs + + Dialogs\ListItemControl.designer.cs ListItemControl.cs - - Options\Dialogs\MissingNdkInstalledForm.cs + + Dialogs\MissingNdkInstalledForm.cs + Form - - Options\Dialogs\MissingNdkInstalledForm.designer.cs + + Dialogs\MissingNdkInstalledForm.designer.cs MissingNdkInstalledForm.cs - - Options\Dialogs\PasswordForm.cs + + Dialogs\PasswordForm.cs Form - - Options\Dialogs\PasswordForm.designer.cs + + Dialogs\PasswordForm.designer.cs PasswordForm.cs - - Options\Dialogs\PinListForm.cs + + Dialogs\PinListForm.cs Form - - Options\Dialogs\PinListForm.designer.cs + + Dialogs\PinListForm.designer.cs PinListForm.cs - - Options\Dialogs\RegistrationForm.cs + + Dialogs\RegistrationForm.cs Form - - Options\Dialogs\RegistrationForm.designer.cs + + Dialogs\RegistrationForm.designer.cs RegistrationForm.cs - - Options\Dialogs\UpdateManagerStatusForm.cs + + Dialogs\UpdateManagerStatusForm.cs Form - - Options\Dialogs\UpdateManagerStatusForm.designer.cs + + Dialogs\UpdateManagerStatusForm.designer.cs UpdateManagerStatusForm.cs @@ -428,60 +429,60 @@ Options\ApiLevelOptionControl.resx ApiLevelOptionControl.cs - - Options\Dialogs\AboutForm.resx + + Dialogs\AboutForm.resx AboutForm.cs - - Options\Dialogs\AddLocalNdkForm.resx + + Dialogs\AddLocalNdkForm.resx AddLocalNdkForm.cs - - Options\Dialogs\CertificateDetailsForm.resx + + Dialogs\CertificateDetailsForm.resx CertificateDetailsForm.cs - - Options\Dialogs\CskRequestForm.resx + + Dialogs\CskRequestForm.resx CskRequestForm.cs - - Options\Dialogs\DebugTokenDeploymentForm.resx + + Dialogs\DebugTokenDeploymentForm.resx DebugTokenDeploymentForm.cs - - Options\Dialogs\DeviceForm.resx + + Dialogs\DeviceForm.resx DeviceForm.cs - - Options\Dialogs\InstallConfirmationForm.resx + + Dialogs\InstallConfirmationForm.resx InstallConfirmationForm.cs - - Options\Dialogs\InstallForm.resx + + Dialogs\InstallForm.resx InstallForm.cs - - Options\Dialogs\ListItemControl.resx + + Dialogs\ListItemControl.resx ListItemControl.cs - - Options\Dialogs\MissingNdkInstalledForm.resx + + Dialogs\MissingNdkInstalledForm.resx MissingNdkInstalledForm.cs - - Options\Dialogs\PasswordForm.resx + + Dialogs\PasswordForm.resx PasswordForm.cs - - Options\Dialogs\PinListForm.resx + + Dialogs\PinListForm.resx PinListForm.cs - - Options\Dialogs\RegistrationForm.resx + + Dialogs\RegistrationForm.resx RegistrationForm.cs - - Options\Dialogs\UpdateManagerStatusForm.resx + + Dialogs\UpdateManagerStatusForm.resx UpdateManagerStatusForm.cs From a2f7fcc179ac12c505d8cf894660f86103c3c05b Mon Sep 17 00:00:00 2001 From: Pawel Hofman Date: Mon, 23 Jun 2014 16:16:46 +0200 Subject: [PATCH 269/851] Updated namespaces for recently moved Dialogs --- src_vs2012/Package/BlackBerryPackage.cs | 2 +- src_vs2012/Package/Dialogs/AboutForm.Designer.cs | 2 +- src_vs2012/Package/Dialogs/AboutForm.cs | 2 +- src_vs2012/Package/Dialogs/AddLocalNdkForm.Designer.cs | 2 +- src_vs2012/Package/Dialogs/AddLocalNdkForm.cs | 2 +- src_vs2012/Package/Dialogs/CertificateDetailsForm.Designer.cs | 2 +- src_vs2012/Package/Dialogs/CertificateDetailsForm.cs | 2 +- src_vs2012/Package/Dialogs/CskRequestForm.Designer.cs | 2 +- src_vs2012/Package/Dialogs/CskRequestForm.cs | 2 +- .../Package/Dialogs/DebugTokenDeploymentForm.Designer.cs | 2 +- src_vs2012/Package/Dialogs/DebugTokenDeploymentForm.cs | 2 +- src_vs2012/Package/Dialogs/DeviceForm.Designer.cs | 2 +- src_vs2012/Package/Dialogs/DeviceForm.cs | 2 +- src_vs2012/Package/Dialogs/InstallConfirmationForm.Designer.cs | 2 +- src_vs2012/Package/Dialogs/InstallConfirmationForm.cs | 2 +- src_vs2012/Package/Dialogs/InstallForm.Designer.cs | 2 +- src_vs2012/Package/Dialogs/InstallForm.cs | 3 +-- src_vs2012/Package/Dialogs/ListItemControl.Designer.cs | 2 +- src_vs2012/Package/Dialogs/ListItemControl.cs | 2 +- src_vs2012/Package/Dialogs/MissingNdkInstalledForm.Designer.cs | 2 +- src_vs2012/Package/Dialogs/MissingNdkInstalledForm.cs | 2 +- src_vs2012/Package/Dialogs/PasswordForm.Designer.cs | 2 +- src_vs2012/Package/Dialogs/PasswordForm.cs | 2 +- src_vs2012/Package/Dialogs/PinListForm.Designer.cs | 2 +- src_vs2012/Package/Dialogs/PinListForm.cs | 2 +- src_vs2012/Package/Dialogs/RegistrationForm.Designer.cs | 2 +- src_vs2012/Package/Dialogs/RegistrationForm.cs | 2 +- src_vs2012/Package/Dialogs/UpdateManagerStatusForm.Designer.cs | 2 +- src_vs2012/Package/Dialogs/UpdateManagerStatusForm.cs | 3 +-- src_vs2012/Package/Helpers/CertHelper.cs | 2 +- src_vs2012/Package/Options/ApiLevelOptionControl.cs | 2 +- src_vs2012/Package/Options/SigningOptionControl.cs | 2 +- src_vs2012/Package/Options/TargetsOptionControl.cs | 2 +- 33 files changed, 33 insertions(+), 35 deletions(-) diff --git a/src_vs2012/Package/BlackBerryPackage.cs b/src_vs2012/Package/BlackBerryPackage.cs index 1f18add6..cad696b3 100644 --- a/src_vs2012/Package/BlackBerryPackage.cs +++ b/src_vs2012/Package/BlackBerryPackage.cs @@ -23,11 +23,11 @@ using BlackBerry.NativeCore.Tools; using BlackBerry.Package.Components; using BlackBerry.Package.Diagnostics; +using BlackBerry.Package.Dialogs; using BlackBerry.Package.Editors; using BlackBerry.Package.Helpers; using BlackBerry.Package.Model.Integration; using BlackBerry.Package.Options; -using BlackBerry.Package.Options.Dialogs; using BlackBerry.Package.ViewModels; using Microsoft.Win32; using Microsoft.VisualStudio; diff --git a/src_vs2012/Package/Dialogs/AboutForm.Designer.cs b/src_vs2012/Package/Dialogs/AboutForm.Designer.cs index e7b94a81..97745900 100644 --- a/src_vs2012/Package/Dialogs/AboutForm.Designer.cs +++ b/src_vs2012/Package/Dialogs/AboutForm.Designer.cs @@ -1,4 +1,4 @@ -namespace BlackBerry.Package.Options.Dialogs +namespace BlackBerry.Package.Dialogs { internal partial class AboutForm { diff --git a/src_vs2012/Package/Dialogs/AboutForm.cs b/src_vs2012/Package/Dialogs/AboutForm.cs index b79c983a..70294918 100644 --- a/src_vs2012/Package/Dialogs/AboutForm.cs +++ b/src_vs2012/Package/Dialogs/AboutForm.cs @@ -4,7 +4,7 @@ using System.Windows.Forms; using BlackBerry.Package.Helpers; -namespace BlackBerry.Package.Options.Dialogs +namespace BlackBerry.Package.Dialogs { internal partial class AboutForm : Form { diff --git a/src_vs2012/Package/Dialogs/AddLocalNdkForm.Designer.cs b/src_vs2012/Package/Dialogs/AddLocalNdkForm.Designer.cs index 9fab3cfe..01fbbd26 100644 --- a/src_vs2012/Package/Dialogs/AddLocalNdkForm.Designer.cs +++ b/src_vs2012/Package/Dialogs/AddLocalNdkForm.Designer.cs @@ -1,4 +1,4 @@ -namespace BlackBerry.Package.Options.Dialogs +namespace BlackBerry.Package.Dialogs { internal partial class AddLocalNdkForm { diff --git a/src_vs2012/Package/Dialogs/AddLocalNdkForm.cs b/src_vs2012/Package/Dialogs/AddLocalNdkForm.cs index 300550db..f564cc64 100644 --- a/src_vs2012/Package/Dialogs/AddLocalNdkForm.cs +++ b/src_vs2012/Package/Dialogs/AddLocalNdkForm.cs @@ -6,7 +6,7 @@ using BlackBerry.Package.Model.Integration; using BlackBerry.Package.ViewModels; -namespace BlackBerry.Package.Options.Dialogs +namespace BlackBerry.Package.Dialogs { internal partial class AddLocalNdkForm : Form { diff --git a/src_vs2012/Package/Dialogs/CertificateDetailsForm.Designer.cs b/src_vs2012/Package/Dialogs/CertificateDetailsForm.Designer.cs index 3df22e49..829cdc97 100644 --- a/src_vs2012/Package/Dialogs/CertificateDetailsForm.Designer.cs +++ b/src_vs2012/Package/Dialogs/CertificateDetailsForm.Designer.cs @@ -1,4 +1,4 @@ -namespace BlackBerry.Package.Options.Dialogs +namespace BlackBerry.Package.Dialogs { internal partial class CertificateDetailsForm { diff --git a/src_vs2012/Package/Dialogs/CertificateDetailsForm.cs b/src_vs2012/Package/Dialogs/CertificateDetailsForm.cs index 3f70fffe..11e9f9ec 100644 --- a/src_vs2012/Package/Dialogs/CertificateDetailsForm.cs +++ b/src_vs2012/Package/Dialogs/CertificateDetailsForm.cs @@ -6,7 +6,7 @@ using BlackBerry.NativeCore.Tools; using BlackBerry.Package.Helpers; -namespace BlackBerry.Package.Options.Dialogs +namespace BlackBerry.Package.Dialogs { internal partial class CertificateDetailsForm : Form { diff --git a/src_vs2012/Package/Dialogs/CskRequestForm.Designer.cs b/src_vs2012/Package/Dialogs/CskRequestForm.Designer.cs index fc8a8e9e..18aa23ae 100644 --- a/src_vs2012/Package/Dialogs/CskRequestForm.Designer.cs +++ b/src_vs2012/Package/Dialogs/CskRequestForm.Designer.cs @@ -1,6 +1,6 @@ using BlackBerry.Package.Model.Integration; -namespace BlackBerry.Package.Options.Dialogs +namespace BlackBerry.Package.Dialogs { partial class CskRequestForm { diff --git a/src_vs2012/Package/Dialogs/CskRequestForm.cs b/src_vs2012/Package/Dialogs/CskRequestForm.cs index 57108fb0..9d412787 100644 --- a/src_vs2012/Package/Dialogs/CskRequestForm.cs +++ b/src_vs2012/Package/Dialogs/CskRequestForm.cs @@ -7,7 +7,7 @@ using BlackBerry.NativeCore.Model; using BlackBerry.Package.Model.Integration; -namespace BlackBerry.Package.Options.Dialogs +namespace BlackBerry.Package.Dialogs { internal partial class CskRequestForm : Form { diff --git a/src_vs2012/Package/Dialogs/DebugTokenDeploymentForm.Designer.cs b/src_vs2012/Package/Dialogs/DebugTokenDeploymentForm.Designer.cs index e9587422..3cc49014 100644 --- a/src_vs2012/Package/Dialogs/DebugTokenDeploymentForm.Designer.cs +++ b/src_vs2012/Package/Dialogs/DebugTokenDeploymentForm.Designer.cs @@ -1,4 +1,4 @@ -namespace BlackBerry.Package.Options.Dialogs +namespace BlackBerry.Package.Dialogs { internal partial class DebugTokenDeploymentForm { diff --git a/src_vs2012/Package/Dialogs/DebugTokenDeploymentForm.cs b/src_vs2012/Package/Dialogs/DebugTokenDeploymentForm.cs index 4e4111b3..bfc7cd86 100644 --- a/src_vs2012/Package/Dialogs/DebugTokenDeploymentForm.cs +++ b/src_vs2012/Package/Dialogs/DebugTokenDeploymentForm.cs @@ -9,7 +9,7 @@ using BlackBerry.Package.Model.Integration; using BlackBerry.Package.ViewModels; -namespace BlackBerry.Package.Options.Dialogs +namespace BlackBerry.Package.Dialogs { internal partial class DebugTokenDeploymentForm : Form { diff --git a/src_vs2012/Package/Dialogs/DeviceForm.Designer.cs b/src_vs2012/Package/Dialogs/DeviceForm.Designer.cs index 6ae06ae5..c8dcc795 100644 --- a/src_vs2012/Package/Dialogs/DeviceForm.Designer.cs +++ b/src_vs2012/Package/Dialogs/DeviceForm.Designer.cs @@ -1,4 +1,4 @@ -namespace BlackBerry.Package.Options.Dialogs +namespace BlackBerry.Package.Dialogs { partial class DeviceForm { diff --git a/src_vs2012/Package/Dialogs/DeviceForm.cs b/src_vs2012/Package/Dialogs/DeviceForm.cs index 6538cf8d..9a01fdeb 100644 --- a/src_vs2012/Package/Dialogs/DeviceForm.cs +++ b/src_vs2012/Package/Dialogs/DeviceForm.cs @@ -8,7 +8,7 @@ using BlackBerry.Package.Helpers; using BlackBerry.Package.Model.Integration; -namespace BlackBerry.Package.Options.Dialogs +namespace BlackBerry.Package.Dialogs { /// /// Internal dialog for adding and testing target device. diff --git a/src_vs2012/Package/Dialogs/InstallConfirmationForm.Designer.cs b/src_vs2012/Package/Dialogs/InstallConfirmationForm.Designer.cs index 139f3c35..082fac02 100644 --- a/src_vs2012/Package/Dialogs/InstallConfirmationForm.Designer.cs +++ b/src_vs2012/Package/Dialogs/InstallConfirmationForm.Designer.cs @@ -1,4 +1,4 @@ -namespace BlackBerry.Package.Options.Dialogs +namespace BlackBerry.Package.Dialogs { internal partial class InstallConfirmationForm { diff --git a/src_vs2012/Package/Dialogs/InstallConfirmationForm.cs b/src_vs2012/Package/Dialogs/InstallConfirmationForm.cs index 3c7c4841..9328c3b9 100644 --- a/src_vs2012/Package/Dialogs/InstallConfirmationForm.cs +++ b/src_vs2012/Package/Dialogs/InstallConfirmationForm.cs @@ -3,7 +3,7 @@ using System.Windows.Forms; using BlackBerry.NativeCore.Model; -namespace BlackBerry.Package.Options.Dialogs +namespace BlackBerry.Package.Dialogs { /// /// Dialog to show and select list of available versions per particular API Level. diff --git a/src_vs2012/Package/Dialogs/InstallForm.Designer.cs b/src_vs2012/Package/Dialogs/InstallForm.Designer.cs index 0687aea2..e11dd3e2 100644 --- a/src_vs2012/Package/Dialogs/InstallForm.Designer.cs +++ b/src_vs2012/Package/Dialogs/InstallForm.Designer.cs @@ -1,4 +1,4 @@ -namespace BlackBerry.Package.Options.Dialogs +namespace BlackBerry.Package.Dialogs { internal partial class InstallForm { diff --git a/src_vs2012/Package/Dialogs/InstallForm.cs b/src_vs2012/Package/Dialogs/InstallForm.cs index e72e637d..8458fb05 100644 --- a/src_vs2012/Package/Dialogs/InstallForm.cs +++ b/src_vs2012/Package/Dialogs/InstallForm.cs @@ -3,11 +3,10 @@ using System.Windows.Forms; using BlackBerry.NativeCore; using BlackBerry.NativeCore.Model; -using BlackBerry.NativeCore.Tools; using BlackBerry.Package.Helpers; using BlackBerry.Package.ViewModels; -namespace BlackBerry.Package.Options.Dialogs +namespace BlackBerry.Package.Dialogs { internal partial class InstallForm : Form { diff --git a/src_vs2012/Package/Dialogs/ListItemControl.Designer.cs b/src_vs2012/Package/Dialogs/ListItemControl.Designer.cs index a01ecee4..dd3d5220 100644 --- a/src_vs2012/Package/Dialogs/ListItemControl.Designer.cs +++ b/src_vs2012/Package/Dialogs/ListItemControl.Designer.cs @@ -1,4 +1,4 @@ -namespace BlackBerry.Package.Options.Dialogs +namespace BlackBerry.Package.Dialogs { internal partial class ListItemControl { diff --git a/src_vs2012/Package/Dialogs/ListItemControl.cs b/src_vs2012/Package/Dialogs/ListItemControl.cs index 3b45bf50..25815b7a 100644 --- a/src_vs2012/Package/Dialogs/ListItemControl.cs +++ b/src_vs2012/Package/Dialogs/ListItemControl.cs @@ -2,7 +2,7 @@ using System.Windows.Forms; using BlackBerry.NativeCore.Model; -namespace BlackBerry.Package.Options.Dialogs +namespace BlackBerry.Package.Dialogs { internal partial class ListItemControl : UserControl { diff --git a/src_vs2012/Package/Dialogs/MissingNdkInstalledForm.Designer.cs b/src_vs2012/Package/Dialogs/MissingNdkInstalledForm.Designer.cs index 5af3fa18..0fa13390 100644 --- a/src_vs2012/Package/Dialogs/MissingNdkInstalledForm.Designer.cs +++ b/src_vs2012/Package/Dialogs/MissingNdkInstalledForm.Designer.cs @@ -1,4 +1,4 @@ -namespace BlackBerry.Package.Options.Dialogs +namespace BlackBerry.Package.Dialogs { internal partial class MissingNdkInstalledForm { diff --git a/src_vs2012/Package/Dialogs/MissingNdkInstalledForm.cs b/src_vs2012/Package/Dialogs/MissingNdkInstalledForm.cs index 72bec67b..d33cdf6e 100644 --- a/src_vs2012/Package/Dialogs/MissingNdkInstalledForm.cs +++ b/src_vs2012/Package/Dialogs/MissingNdkInstalledForm.cs @@ -1,7 +1,7 @@ using System.Windows.Forms; using BlackBerry.Package.ViewModels; -namespace BlackBerry.Package.Options.Dialogs +namespace BlackBerry.Package.Dialogs { internal partial class MissingNdkInstalledForm : Form { diff --git a/src_vs2012/Package/Dialogs/PasswordForm.Designer.cs b/src_vs2012/Package/Dialogs/PasswordForm.Designer.cs index 2775c168..8b2c68c6 100644 --- a/src_vs2012/Package/Dialogs/PasswordForm.Designer.cs +++ b/src_vs2012/Package/Dialogs/PasswordForm.Designer.cs @@ -1,4 +1,4 @@ -namespace BlackBerry.Package.Options.Dialogs +namespace BlackBerry.Package.Dialogs { internal partial class PasswordForm { diff --git a/src_vs2012/Package/Dialogs/PasswordForm.cs b/src_vs2012/Package/Dialogs/PasswordForm.cs index 1ab00c04..e3f7dfd1 100644 --- a/src_vs2012/Package/Dialogs/PasswordForm.cs +++ b/src_vs2012/Package/Dialogs/PasswordForm.cs @@ -2,7 +2,7 @@ using System.Windows.Forms; using BlackBerry.Package.Helpers; -namespace BlackBerry.Package.Options.Dialogs +namespace BlackBerry.Package.Dialogs { internal partial class PasswordForm : Form { diff --git a/src_vs2012/Package/Dialogs/PinListForm.Designer.cs b/src_vs2012/Package/Dialogs/PinListForm.Designer.cs index e840cc12..1c96c0c8 100644 --- a/src_vs2012/Package/Dialogs/PinListForm.Designer.cs +++ b/src_vs2012/Package/Dialogs/PinListForm.Designer.cs @@ -1,4 +1,4 @@ -namespace BlackBerry.Package.Options.Dialogs +namespace BlackBerry.Package.Dialogs { internal partial class PinListForm { diff --git a/src_vs2012/Package/Dialogs/PinListForm.cs b/src_vs2012/Package/Dialogs/PinListForm.cs index 49d325f9..45b299fc 100644 --- a/src_vs2012/Package/Dialogs/PinListForm.cs +++ b/src_vs2012/Package/Dialogs/PinListForm.cs @@ -5,7 +5,7 @@ using BlackBerry.NativeCore.Model; using BlackBerry.Package.Helpers; -namespace BlackBerry.Package.Options.Dialogs +namespace BlackBerry.Package.Dialogs { /// /// Dialog for creating list of device PINs. diff --git a/src_vs2012/Package/Dialogs/RegistrationForm.Designer.cs b/src_vs2012/Package/Dialogs/RegistrationForm.Designer.cs index b23a15c0..90c1b47b 100644 --- a/src_vs2012/Package/Dialogs/RegistrationForm.Designer.cs +++ b/src_vs2012/Package/Dialogs/RegistrationForm.Designer.cs @@ -1,4 +1,4 @@ -namespace BlackBerry.Package.Options.Dialogs +namespace BlackBerry.Package.Dialogs { internal partial class RegistrationForm { diff --git a/src_vs2012/Package/Dialogs/RegistrationForm.cs b/src_vs2012/Package/Dialogs/RegistrationForm.cs index f7cef319..97ad7fa8 100644 --- a/src_vs2012/Package/Dialogs/RegistrationForm.cs +++ b/src_vs2012/Package/Dialogs/RegistrationForm.cs @@ -6,7 +6,7 @@ using BlackBerry.NativeCore.Tools; using BlackBerry.Package.Helpers; -namespace BlackBerry.Package.Options.Dialogs +namespace BlackBerry.Package.Dialogs { internal partial class RegistrationForm : Form { diff --git a/src_vs2012/Package/Dialogs/UpdateManagerStatusForm.Designer.cs b/src_vs2012/Package/Dialogs/UpdateManagerStatusForm.Designer.cs index 5ab52a0f..335108ed 100644 --- a/src_vs2012/Package/Dialogs/UpdateManagerStatusForm.Designer.cs +++ b/src_vs2012/Package/Dialogs/UpdateManagerStatusForm.Designer.cs @@ -1,4 +1,4 @@ -namespace BlackBerry.Package.Options.Dialogs +namespace BlackBerry.Package.Dialogs { internal partial class UpdateManagerStatusForm { diff --git a/src_vs2012/Package/Dialogs/UpdateManagerStatusForm.cs b/src_vs2012/Package/Dialogs/UpdateManagerStatusForm.cs index 3c2eda9e..56f05831 100644 --- a/src_vs2012/Package/Dialogs/UpdateManagerStatusForm.cs +++ b/src_vs2012/Package/Dialogs/UpdateManagerStatusForm.cs @@ -1,12 +1,11 @@ using System; using System.Windows.Forms; -using BlackBerry.NativeCore; using BlackBerry.NativeCore.Components; using BlackBerry.NativeCore.Tools; using BlackBerry.Package.Helpers; using BlackBerry.Package.ViewModels; -namespace BlackBerry.Package.Options.Dialogs +namespace BlackBerry.Package.Dialogs { internal partial class UpdateManagerStatusForm : Form { diff --git a/src_vs2012/Package/Helpers/CertHelper.cs b/src_vs2012/Package/Helpers/CertHelper.cs index aa093a11..fac92954 100644 --- a/src_vs2012/Package/Helpers/CertHelper.cs +++ b/src_vs2012/Package/Helpers/CertHelper.cs @@ -3,7 +3,7 @@ using System.Windows.Forms; using BlackBerry.NativeCore.Diagnostics; using BlackBerry.NativeCore.Model; -using BlackBerry.Package.Options.Dialogs; +using BlackBerry.Package.Dialogs; namespace BlackBerry.Package.Helpers { diff --git a/src_vs2012/Package/Options/ApiLevelOptionControl.cs b/src_vs2012/Package/Options/ApiLevelOptionControl.cs index c7cfc01d..df743241 100644 --- a/src_vs2012/Package/Options/ApiLevelOptionControl.cs +++ b/src_vs2012/Package/Options/ApiLevelOptionControl.cs @@ -2,7 +2,7 @@ using System.Windows.Forms; using BlackBerry.NativeCore.Components; using BlackBerry.NativeCore.Model; -using BlackBerry.Package.Options.Dialogs; +using BlackBerry.Package.Dialogs; using BlackBerry.Package.ViewModels; using BlackBerry.NativeCore.Tools; diff --git a/src_vs2012/Package/Options/SigningOptionControl.cs b/src_vs2012/Package/Options/SigningOptionControl.cs index 72635b92..44871633 100644 --- a/src_vs2012/Package/Options/SigningOptionControl.cs +++ b/src_vs2012/Package/Options/SigningOptionControl.cs @@ -2,8 +2,8 @@ using System.Windows.Forms; using BlackBerry.NativeCore; using BlackBerry.NativeCore.Tools; +using BlackBerry.Package.Dialogs; using BlackBerry.Package.Helpers; -using BlackBerry.Package.Options.Dialogs; using BlackBerry.Package.ViewModels; namespace BlackBerry.Package.Options diff --git a/src_vs2012/Package/Options/TargetsOptionControl.cs b/src_vs2012/Package/Options/TargetsOptionControl.cs index 3052653f..1b9c1da1 100644 --- a/src_vs2012/Package/Options/TargetsOptionControl.cs +++ b/src_vs2012/Package/Options/TargetsOptionControl.cs @@ -1,8 +1,8 @@ using System; using System.Windows.Forms; using BlackBerry.NativeCore.Model; +using BlackBerry.Package.Dialogs; using BlackBerry.Package.Helpers; -using BlackBerry.Package.Options.Dialogs; using BlackBerry.Package.ViewModels; namespace BlackBerry.Package.Options From 14d40870bc2f35c7ee5c0ae96492f0bd7e0c444b Mon Sep 17 00:00:00 2001 From: Pawel Hofman Date: Mon, 23 Jun 2014 16:34:13 +0200 Subject: [PATCH 270/851] Reverted PackageViewModel file name --- src_vs2010/Package/BlackBerry.Package.csproj | 4 ++-- src_vs2012/Package/BlackBerry.Package.csproj | 2 +- .../{PackageOptionViewModel.cs => PackageViewModel.cs} | 0 src_vs2013/Package/BlackBerry.Package.csproj | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) rename src_vs2012/Package/ViewModels/{PackageOptionViewModel.cs => PackageViewModel.cs} (100%) diff --git a/src_vs2010/Package/BlackBerry.Package.csproj b/src_vs2010/Package/BlackBerry.Package.csproj index f1ebd699..913eabaa 100644 --- a/src_vs2010/Package/BlackBerry.Package.csproj +++ b/src_vs2010/Package/BlackBerry.Package.csproj @@ -384,8 +384,8 @@ ViewModels\BarEditorViewModel.cs - - ViewModels\PackageOptionViewModel.cs + + ViewModels\PackageViewModel.cs ViewModels\SigningOptionViewModel.cs diff --git a/src_vs2012/Package/BlackBerry.Package.csproj b/src_vs2012/Package/BlackBerry.Package.csproj index 442ed7da..d1ed5d53 100644 --- a/src_vs2012/Package/BlackBerry.Package.csproj +++ b/src_vs2012/Package/BlackBerry.Package.csproj @@ -328,7 +328,7 @@ - + diff --git a/src_vs2012/Package/ViewModels/PackageOptionViewModel.cs b/src_vs2012/Package/ViewModels/PackageViewModel.cs similarity index 100% rename from src_vs2012/Package/ViewModels/PackageOptionViewModel.cs rename to src_vs2012/Package/ViewModels/PackageViewModel.cs diff --git a/src_vs2013/Package/BlackBerry.Package.csproj b/src_vs2013/Package/BlackBerry.Package.csproj index d0a99898..de28e8fa 100644 --- a/src_vs2013/Package/BlackBerry.Package.csproj +++ b/src_vs2013/Package/BlackBerry.Package.csproj @@ -388,8 +388,8 @@ ViewModels\BarEditorViewModel.cs - - ViewModels\PackageOptionViewModel.cs + + ViewModels\PackageViewModel.cs ViewModels\SigningOptionViewModel.cs From 70141ebf5cdddc5fc2d49893c13ca9d2804dbe33 Mon Sep 17 00:00:00 2001 From: Pawel Hofman Date: Mon, 23 Jun 2014 16:45:04 +0200 Subject: [PATCH 271/851] Finalized dialog shown on-build without NDK installed --- .../MissingNdkInstalledForm.Designer.cs | 51 ++++++++----- .../Dialogs/MissingNdkInstalledForm.cs | 76 ++++++++++++++++++- .../ViewModels/ApiLevelOptionViewModel.cs | 8 ++ .../Package/ViewModels/PackageViewModel.cs | 5 +- 4 files changed, 117 insertions(+), 23 deletions(-) diff --git a/src_vs2012/Package/Dialogs/MissingNdkInstalledForm.Designer.cs b/src_vs2012/Package/Dialogs/MissingNdkInstalledForm.Designer.cs index 0fa13390..82b4232d 100644 --- a/src_vs2012/Package/Dialogs/MissingNdkInstalledForm.Designer.cs +++ b/src_vs2012/Package/Dialogs/MissingNdkInstalledForm.Designer.cs @@ -41,9 +41,10 @@ private void InitializeComponent() this.bttClose = new System.Windows.Forms.Button(); this.groupBox1 = new System.Windows.Forms.GroupBox(); this.label1 = new System.Windows.Forms.Label(); - this.comboBox1 = new System.Windows.Forms.ComboBox(); + this.cmbNDKs = new System.Windows.Forms.ComboBox(); this.bttInstall = new System.Windows.Forms.Button(); this.bttStatus = new System.Windows.Forms.Button(); + this.label2 = new System.Windows.Forms.Label(); this.groupBox1.SuspendLayout(); this.SuspendLayout(); // @@ -51,7 +52,7 @@ private void InitializeComponent() // this.bttClose.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.bttClose.DialogResult = System.Windows.Forms.DialogResult.OK; - this.bttClose.Location = new System.Drawing.Point(341, 129); + this.bttClose.Location = new System.Drawing.Point(361, 148); this.bttClose.Name = "bttClose"; this.bttClose.Size = new System.Drawing.Size(75, 23); this.bttClose.TabIndex = 0; @@ -63,12 +64,13 @@ private void InitializeComponent() this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); + this.groupBox1.Controls.Add(this.label2); this.groupBox1.Controls.Add(this.label1); - this.groupBox1.Controls.Add(this.comboBox1); + this.groupBox1.Controls.Add(this.cmbNDKs); this.groupBox1.Controls.Add(this.bttInstall); this.groupBox1.Location = new System.Drawing.Point(12, 12); this.groupBox1.Name = "groupBox1"; - this.groupBox1.Size = new System.Drawing.Size(404, 111); + this.groupBox1.Size = new System.Drawing.Size(424, 130); this.groupBox1.TabIndex = 1; this.groupBox1.TabStop = false; this.groupBox1.Text = "Selection"; @@ -80,25 +82,27 @@ private void InitializeComponent() | System.Windows.Forms.AnchorStyles.Right))); this.label1.Location = new System.Drawing.Point(15, 20); this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(383, 47); + this.label1.Size = new System.Drawing.Size(403, 66); this.label1.TabIndex = 2; this.label1.Text = "Toolset for building BlackBerry native application is missing. Please make sure t" + "here is any NDK installed and select it from the list below."; // - // comboBox1 + // cmbNDKs // - this.comboBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) + this.cmbNDKs.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); - this.comboBox1.FormattingEnabled = true; - this.comboBox1.Location = new System.Drawing.Point(15, 72); - this.comboBox1.Name = "comboBox1"; - this.comboBox1.Size = new System.Drawing.Size(302, 21); - this.comboBox1.TabIndex = 1; + this.cmbNDKs.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.cmbNDKs.FormattingEnabled = true; + this.cmbNDKs.Location = new System.Drawing.Point(15, 91); + this.cmbNDKs.Name = "cmbNDKs"; + this.cmbNDKs.Size = new System.Drawing.Size(322, 21); + this.cmbNDKs.TabIndex = 1; + this.cmbNDKs.SelectedIndexChanged += new System.EventHandler(this.cmbNDKs_SelectedIndexChanged); // // bttInstall // this.bttInstall.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this.bttInstall.Location = new System.Drawing.Point(323, 70); + this.bttInstall.Location = new System.Drawing.Point(343, 89); this.bttInstall.Name = "bttInstall"; this.bttInstall.Size = new System.Drawing.Size(75, 23); this.bttInstall.TabIndex = 0; @@ -109,13 +113,25 @@ private void InitializeComponent() // bttStatus // this.bttStatus.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); - this.bttStatus.Location = new System.Drawing.Point(12, 129); + this.bttStatus.Location = new System.Drawing.Point(12, 148); this.bttStatus.Name = "bttStatus"; this.bttStatus.Size = new System.Drawing.Size(75, 23); this.bttStatus.TabIndex = 2; this.bttStatus.Text = "&Status..."; this.bttStatus.UseVisualStyleBackColor = true; this.bttStatus.Click += new System.EventHandler(this.bttStatus_Click); + // + // label2 + // + this.label2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.label2.Location = new System.Drawing.Point(15, 53); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(403, 32); + this.label2.TabIndex = 3; + this.label2.Text = "NOTE: It might take some time to download everything. You can close this dialog a" + + "nd continue coding, but you won\'t be able to build and deploy until all is finis" + + "hed."; // // MissingNdkInstalledForm // @@ -123,7 +139,7 @@ private void InitializeComponent() this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.CancelButton = this.bttClose; - this.ClientSize = new System.Drawing.Size(428, 164); + this.ClientSize = new System.Drawing.Size(448, 183); this.Controls.Add(this.bttStatus); this.Controls.Add(this.groupBox1); this.Controls.Add(this.bttClose); @@ -134,7 +150,7 @@ private void InitializeComponent() this.ShowIcon = false; this.ShowInTaskbar = false; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; - this.Text = "Default BlackBerry NDK selection"; + this.Text = "Default BlackBerry API Level selection"; this.groupBox1.ResumeLayout(false); this.ResumeLayout(false); @@ -145,8 +161,9 @@ private void InitializeComponent() private System.Windows.Forms.Button bttClose; private System.Windows.Forms.GroupBox groupBox1; private System.Windows.Forms.Label label1; - private System.Windows.Forms.ComboBox comboBox1; + private System.Windows.Forms.ComboBox cmbNDKs; private System.Windows.Forms.Button bttInstall; private System.Windows.Forms.Button bttStatus; + private System.Windows.Forms.Label label2; } } \ No newline at end of file diff --git a/src_vs2012/Package/Dialogs/MissingNdkInstalledForm.cs b/src_vs2012/Package/Dialogs/MissingNdkInstalledForm.cs index d33cdf6e..fc226d1e 100644 --- a/src_vs2012/Package/Dialogs/MissingNdkInstalledForm.cs +++ b/src_vs2012/Package/Dialogs/MissingNdkInstalledForm.cs @@ -1,4 +1,8 @@ -using System.Windows.Forms; +using System; +using System.Windows.Forms; +using BlackBerry.NativeCore.Components; +using BlackBerry.NativeCore.Model; +using BlackBerry.NativeCore.Tools; using BlackBerry.Package.ViewModels; namespace BlackBerry.Package.Dialogs @@ -10,18 +14,84 @@ internal partial class MissingNdkInstalledForm : Form public MissingNdkInstalledForm() { InitializeComponent(); + + _vm.Dispatcher = EventDispatcher.From(this); + _vm.UpdateManager.Completed += OnApiLevelChanged; + + PopulateNDKs(true); + } + + protected override void OnClosed(EventArgs e) + { + _vm.ActiveNDK = SelectedNDK; + _vm.UpdateManager.Completed -= OnApiLevelChanged; + base.OnClosed(e); + } + + private void OnApiLevelChanged(object sender, UpdateManagerCompletedEventArgs e) + { + PopulateNDKs(false); + } + + #region Properties + + public NdkInfo SelectedNDK + { + get { return cmbNDKs.SelectedItem as NdkInfo; } + set { cmbNDKs.SelectedItem = value; } } - private void bttStatus_Click(object sender, System.EventArgs e) + #endregion + + private void PopulateNDKs(bool ignoreCurrentSelection) + { + NdkInfo currentlySelected = null; + + if (ignoreCurrentSelection) + { + currentlySelected = _vm.ActiveNDK; + } + else + { + if (SelectedNDK == null) + { + // select the last from the list, if possible: + SelectedNDK = _vm.GetLatestInstalledNDK(); + } + else + { + currentlySelected = SelectedNDK; + } + } + + // populate list of NDKs: + cmbNDKs.Items.Clear(); + foreach (var ndk in _vm.InstalledNDKs) + { + cmbNDKs.Items.Add(ndk); + } + + _vm.ActiveNDK = currentlySelected; // here the currentlySelected will cause a match-by-folders-search + cmbNDKs.SelectedItem = _vm.ActiveNDK; // and _vm.ActiveNDK != currentlySelected instances + } + + private void bttStatus_Click(object sender, EventArgs e) { var form = new UpdateManagerStatusForm(_vm); form.ShowDialog(); + PopulateNDKs(false); } - private void bttInstall_Click(object sender, System.EventArgs e) + private void bttInstall_Click(object sender, EventArgs e) { var form = new InstallForm(_vm); form.ShowDialog(); + PopulateNDKs(false); + } + + private void cmbNDKs_SelectedIndexChanged(object sender, EventArgs e) + { + _vm.ActiveNDK = SelectedNDK; } } } diff --git a/src_vs2012/Package/ViewModels/ApiLevelOptionViewModel.cs b/src_vs2012/Package/ViewModels/ApiLevelOptionViewModel.cs index afb6c110..1f021733 100644 --- a/src_vs2012/Package/ViewModels/ApiLevelOptionViewModel.cs +++ b/src_vs2012/Package/ViewModels/ApiLevelOptionViewModel.cs @@ -560,5 +560,13 @@ public void Forget(ApiInfo info) PackageViewModel.Instance.Forget(ndkInfo); } } + + /// + /// Gets the instance of the latest available NDK. + /// + public NdkInfo GetLatestInstalledNDK() + { + return PackageViewModel.Instance.GetLatestInstalledNDK(); + } } } diff --git a/src_vs2012/Package/ViewModels/PackageViewModel.cs b/src_vs2012/Package/ViewModels/PackageViewModel.cs index c8427126..17dbc4cf 100644 --- a/src_vs2012/Package/ViewModels/PackageViewModel.cs +++ b/src_vs2012/Package/ViewModels/PackageViewModel.cs @@ -4,7 +4,6 @@ using BlackBerry.NativeCore.Components; using BlackBerry.NativeCore.Diagnostics; using BlackBerry.NativeCore.Model; -using BlackBerry.NativeCore.Tools; namespace BlackBerry.Package.ViewModels { @@ -473,14 +472,14 @@ public void EnsureActiveNDK() NdkDefinition.Delete(); // then select correct NDK: - ActiveNDK = GetLatestNDK(); + ActiveNDK = GetLatestInstalledNDK(); } } /// /// Gets the reference to the latest version of the NDK installed locally. /// - private NdkInfo GetLatestNDK() + public NdkInfo GetLatestInstalledNDK() { // get the last one, as this list is already sorted by version: int length = InstalledNDKs.Length; From d490cbbb55f072d3a567503338a3612bc91a447d Mon Sep 17 00:00:00 2001 From: Pawel Hofman Date: Mon, 23 Jun 2014 16:58:14 +0200 Subject: [PATCH 272/851] Added a FIXME comment to remember --- src_vs2012/NativeCore/Components/TokenProcessor.cs | 1 + src_vs2012/NativeCore/Model/DeviceDefinition.cs | 1 - src_vs2012/NativeCore/Model/NdkDefinition.cs | 1 - 3 files changed, 1 insertion(+), 2 deletions(-) diff --git a/src_vs2012/NativeCore/Components/TokenProcessor.cs b/src_vs2012/NativeCore/Components/TokenProcessor.cs index bad27e6d..f7e1a1e7 100644 --- a/src_vs2012/NativeCore/Components/TokenProcessor.cs +++ b/src_vs2012/NativeCore/Components/TokenProcessor.cs @@ -261,6 +261,7 @@ public void UntokenFile(string source, string destination) // only if the file is executable, not if it is a dll, a library or // any other type of binary file. + // PH: FIXME: No idea, why someone checks for exe/dll binary kind here (x86/x64/DOS/...)... uint binaryType; if (!NativeMethods.GetBinaryType(source, out binaryType)) { diff --git a/src_vs2012/NativeCore/Model/DeviceDefinition.cs b/src_vs2012/NativeCore/Model/DeviceDefinition.cs index e857ab82..40e9a7bd 100644 --- a/src_vs2012/NativeCore/Model/DeviceDefinition.cs +++ b/src_vs2012/NativeCore/Model/DeviceDefinition.cs @@ -2,7 +2,6 @@ using System.Collections.Generic; using System.Globalization; using BlackBerry.NativeCore.Helpers; -using BlackBerry.NativeCore.Tools; using Microsoft.Win32; namespace BlackBerry.NativeCore.Model diff --git a/src_vs2012/NativeCore/Model/NdkDefinition.cs b/src_vs2012/NativeCore/Model/NdkDefinition.cs index 2836eda6..0ad41408 100644 --- a/src_vs2012/NativeCore/Model/NdkDefinition.cs +++ b/src_vs2012/NativeCore/Model/NdkDefinition.cs @@ -1,7 +1,6 @@ using System; using System.IO; using BlackBerry.NativeCore.Helpers; -using BlackBerry.NativeCore.Tools; using Microsoft.Win32; namespace BlackBerry.NativeCore.Model From 37a2639a760aa697bd3b2e82815c430a1e08b2ea Mon Sep 17 00:00:00 2001 From: Pawel Hofman Date: Mon, 23 Jun 2014 17:09:10 +0200 Subject: [PATCH 273/851] Made more space for custom NDK name --- src_vs2012/Package/Dialogs/AddLocalNdkForm.Designer.cs | 2 +- src_vs2012/Package/Dialogs/AddLocalNdkForm.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src_vs2012/Package/Dialogs/AddLocalNdkForm.Designer.cs b/src_vs2012/Package/Dialogs/AddLocalNdkForm.Designer.cs index 01fbbd26..f5487227 100644 --- a/src_vs2012/Package/Dialogs/AddLocalNdkForm.Designer.cs +++ b/src_vs2012/Package/Dialogs/AddLocalNdkForm.Designer.cs @@ -178,7 +178,7 @@ private void InitializeComponent() // this.txtName.Location = new System.Drawing.Point(106, 61); this.txtName.Name = "txtName"; - this.txtName.Size = new System.Drawing.Size(274, 20); + this.txtName.Size = new System.Drawing.Size(335, 20); this.txtName.TabIndex = 2; // // label3 diff --git a/src_vs2012/Package/Dialogs/AddLocalNdkForm.cs b/src_vs2012/Package/Dialogs/AddLocalNdkForm.cs index f564cc64..6620698c 100644 --- a/src_vs2012/Package/Dialogs/AddLocalNdkForm.cs +++ b/src_vs2012/Package/Dialogs/AddLocalNdkForm.cs @@ -148,7 +148,7 @@ private void bttOK_Click(object sender, EventArgs e) if (existingNDK != null) { - if (MessageBoxHelper.Show("Are you sure, you want to add it?\r\nIt won't probably show up to select as duplicates are not allowed.", + if (MessageBoxHelper.Show("Are you sure, you want to add it?\r\nIt won't probably show up to select as duplicates are ignored, when populating lists.", "Configuration duplicates \"" + existingNDK.Name + "\"", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No) { From c6c091a082f2f021d716ccf02ff962059d3dd039 Mon Sep 17 00:00:00 2001 From: Pawel Hofman Date: Mon, 23 Jun 2014 17:09:30 +0200 Subject: [PATCH 274/851] Incremented version --- src_vs2012/Package/BlackBerryPackage.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src_vs2012/Package/BlackBerryPackage.cs b/src_vs2012/Package/BlackBerryPackage.cs index cad696b3..7a3e479c 100644 --- a/src_vs2012/Package/BlackBerryPackage.cs +++ b/src_vs2012/Package/BlackBerryPackage.cs @@ -85,7 +85,7 @@ namespace BlackBerry.Package [ProvideOptionPage(typeof(SigningOptionPage), "BlackBerry", "Signing", 1001, 1006, true)] public sealed class BlackBerryPackage : Microsoft.VisualStudio.Shell.Package, IDisposable { - public const string VersionString = "2.1.2014.0622"; + public const string VersionString = "2.1.2014.0623"; #region private member variables From f834fb85c8b42ec6d16e032ad3d5beed73effb2b Mon Sep 17 00:00:00 2001 From: Pawel Hofman Date: Tue, 24 Jun 2014 10:44:06 +0200 Subject: [PATCH 275/851] Removed unused debugger task --- src_vs2010/BuildTasks/LaunchDebugEngine.cs | 83 ---------------------- 1 file changed, 83 deletions(-) delete mode 100644 src_vs2010/BuildTasks/LaunchDebugEngine.cs diff --git a/src_vs2010/BuildTasks/LaunchDebugEngine.cs b/src_vs2010/BuildTasks/LaunchDebugEngine.cs deleted file mode 100644 index bd688a79..00000000 --- a/src_vs2010/BuildTasks/LaunchDebugEngine.cs +++ /dev/null @@ -1,83 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using Microsoft.Build.Utilities; -using Microsoft.Build.Framework; - -using EnvDTE; -using EnvDTE80; -using Microsoft.VisualStudio.Shell; -using Microsoft.VisualStudio.Shell.Interop; -using Microsoft.VisualStudio.OLE.Interop; -using System.Runtime.InteropServices; - -namespace VSNDK.Tasks -{ - /*[ComImport] - [Guid("23EB4AF8-BE9C-4b49-B3A4-24F4FF657B27")] - * */ - - public abstract class LaunchDebugEngine : Microsoft.Build.Utilities.Task - { - /* - [DllImport("ole32.dll")] - static extern int CoInitializeEx(IntPtr pvReserved, uint dwCoInit); - */ - private DTE2 _applicationObject; - private string _filePath; - - public override bool Execute() - { - System.Diagnostics.Debugger.Launch(); - //CoInitializeEx(NULL, COINIT_MULTITHREADED); - //enum comEnum = {COINIT_MULTITHREADED=0}; - //CoInitializeEx((IntPtr)null, (uint)0); - - _applicationObject = (EnvDTE80.DTE2)System.Runtime.InteropServices.Marshal.GetActiveObject("VisualStudio.DTE.10.0"); - - Microsoft.VisualStudio.Shell.ServiceProvider sp = - new Microsoft.VisualStudio.Shell.ServiceProvider((Microsoft.VisualStudio.OLE.Interop.IServiceProvider)_applicationObject); - - IVsDebugger dbg = (IVsDebugger)sp.GetService(typeof(SVsShellDebugger)); - - VsDebugTargetInfo info = new VsDebugTargetInfo(); - info.cbSize = (uint)System.Runtime.InteropServices.Marshal.SizeOf(info); - info.dlo = Microsoft.VisualStudio.Shell.Interop.DEBUG_LAUNCH_OPERATION.DLO_CreateProcess; - - info.bstrExe = _filePath; - info.bstrCurDir = System.IO.Path.GetDirectoryName(info.bstrExe); - info.bstrArg = null; // no command line parameters - info.bstrRemoteMachine = null; // debug locally - info.fSendStdoutToOutputWindow = 0; // Let stdout stay with the application. - info.clsidCustom = new Guid("{D951924A-4999-42a0-9217-1EB5233D1D5A}"); // Set the launching engine the sample engine guid - info.grfLaunch = 0; - - IntPtr pInfo = System.Runtime.InteropServices.Marshal.AllocCoTaskMem((int)info.cbSize); - System.Runtime.InteropServices.Marshal.StructureToPtr(info, pInfo, false); - - try - { - dbg.LaunchDebugTargets(1, pInfo); - } - finally - { - if (pInfo != IntPtr.Zero) - { - System.Runtime.InteropServices.Marshal.FreeCoTaskMem(pInfo); - } - } - - return true; - } - - [Required] - public string FilePath - { - set - { - _filePath = value; - } - } - } -} From 62ce6fccae6a8d5c49a42830f29a917ee1077b00 Mon Sep 17 00:00:00 2001 From: Pawel Hofman Date: Tue, 24 Jun 2014 13:36:43 +0200 Subject: [PATCH 276/851] Improved NDK debugger detection by Visual Studio --- .../BlackBerry/Microsoft.CppBuild.BlackBerry.targets | 3 ++- .../qcc/Microsoft.Cpp.BlackBerry.qcc.props | 2 +- src_vs2010/BuildTasks/BlackBerry/Rules/debugger_ndk.xml | 7 ++++++- .../Microsoft.CppBuild.BlackBerrySimulator.targets | 3 ++- .../qcc/Microsoft.Cpp.BlackBerrySimulator.qcc.props | 2 +- .../BuildTasks/BlackBerrySimulator/Rules/debugger_ndk.xml | 2 +- .../qcc/Microsoft.Cpp.BlackBerry.qcc.props | 2 +- .../qcc/Microsoft.Cpp.BlackBerrySimulator.qcc.props | 2 +- .../qcc/Microsoft.Cpp.BlackBerry.qcc.props | 2 +- .../qcc/Microsoft.Cpp.BlackBerrySimulator.qcc.props | 2 +- 10 files changed, 17 insertions(+), 10 deletions(-) diff --git a/src_vs2010/BuildTasks/BlackBerry/Microsoft.CppBuild.BlackBerry.targets b/src_vs2010/BuildTasks/BlackBerry/Microsoft.CppBuild.BlackBerry.targets index 196ff386..8b89f13a 100644 --- a/src_vs2010/BuildTasks/BlackBerry/Microsoft.CppBuild.BlackBerry.targets +++ b/src_vs2010/BuildTasks/BlackBerry/Microsoft.CppBuild.BlackBerry.targets @@ -27,7 +27,8 @@ Copyright (C) Microsoft Corporation. All rights reserved. - VSNDKDebugEngine + BlackBerryDebugEngine diff --git a/src_vs2010/BuildTasks/BlackBerry/Rules/debugger_ndk.xml b/src_vs2010/BuildTasks/BlackBerry/Rules/debugger_ndk.xml index cb53a5b7..d0478a7b 100644 --- a/src_vs2010/BuildTasks/BlackBerry/Rules/debugger_ndk.xml +++ b/src_vs2010/BuildTasks/BlackBerry/Rules/debugger_ndk.xml @@ -1,6 +1,6 @@  - + diff --git a/src_vs2010/BuildTasks/BlackBerrySimulator/Microsoft.CppBuild.BlackBerrySimulator.targets b/src_vs2010/BuildTasks/BlackBerrySimulator/Microsoft.CppBuild.BlackBerrySimulator.targets index 4ab9e314..d557c1f2 100644 --- a/src_vs2010/BuildTasks/BlackBerrySimulator/Microsoft.CppBuild.BlackBerrySimulator.targets +++ b/src_vs2010/BuildTasks/BlackBerrySimulator/Microsoft.CppBuild.BlackBerrySimulator.targets @@ -27,7 +27,8 @@ Copyright (C) Microsoft Corporation. All rights reserved. - VSNDKDebugEngine + BlackBerryDebugEngine diff --git a/src_vs2010/BuildTasks/BlackBerrySimulator/Rules/debugger_ndk.xml b/src_vs2010/BuildTasks/BlackBerrySimulator/Rules/debugger_ndk.xml index cb53a5b7..9f1b5bb8 100644 --- a/src_vs2010/BuildTasks/BlackBerrySimulator/Rules/debugger_ndk.xml +++ b/src_vs2010/BuildTasks/BlackBerrySimulator/Rules/debugger_ndk.xml @@ -1,6 +1,6 @@  - - VSNDKDebugEngine + BlackBerryDebugEngine diff --git a/src_vs2012/BuildTasks/BlackBerrySimulator/PlatformToolsets/qcc/Microsoft.Cpp.BlackBerrySimulator.qcc.props b/src_vs2012/BuildTasks/BlackBerrySimulator/PlatformToolsets/qcc/Microsoft.Cpp.BlackBerrySimulator.qcc.props index be94c836..97c9e890 100644 --- a/src_vs2012/BuildTasks/BlackBerrySimulator/PlatformToolsets/qcc/Microsoft.Cpp.BlackBerrySimulator.qcc.props +++ b/src_vs2012/BuildTasks/BlackBerrySimulator/PlatformToolsets/qcc/Microsoft.Cpp.BlackBerrySimulator.qcc.props @@ -35,7 +35,7 @@ Copyright (C) Microsoft Corporation. All rights reserved. - VSNDKDebugEngine + BlackBerryDebugEngine diff --git a/src_vs2013/BuildTasks/BlackBerry/PlatformToolsets/qcc/Microsoft.Cpp.BlackBerry.qcc.props b/src_vs2013/BuildTasks/BlackBerry/PlatformToolsets/qcc/Microsoft.Cpp.BlackBerry.qcc.props index b51e0747..d73f64bf 100644 --- a/src_vs2013/BuildTasks/BlackBerry/PlatformToolsets/qcc/Microsoft.Cpp.BlackBerry.qcc.props +++ b/src_vs2013/BuildTasks/BlackBerry/PlatformToolsets/qcc/Microsoft.Cpp.BlackBerry.qcc.props @@ -35,7 +35,7 @@ Copyright (C) Microsoft Corporation. All rights reserved. - VSNDKDebugEngine + BlackBerryDebugEngine diff --git a/src_vs2013/BuildTasks/BlackBerrySimulator/PlatformToolsets/qcc/Microsoft.Cpp.BlackBerrySimulator.qcc.props b/src_vs2013/BuildTasks/BlackBerrySimulator/PlatformToolsets/qcc/Microsoft.Cpp.BlackBerrySimulator.qcc.props index ddf65edd..ab8b0b7f 100644 --- a/src_vs2013/BuildTasks/BlackBerrySimulator/PlatformToolsets/qcc/Microsoft.Cpp.BlackBerrySimulator.qcc.props +++ b/src_vs2013/BuildTasks/BlackBerrySimulator/PlatformToolsets/qcc/Microsoft.Cpp.BlackBerrySimulator.qcc.props @@ -35,7 +35,7 @@ Copyright (C) Microsoft Corporation. All rights reserved. - VSNDKDebugEngine + BlackBerryDebugEngine From aab1945a36a99e5bb7e7da6e0b5c6d2a340ed790 Mon Sep 17 00:00:00 2001 From: Pawel Hofman Date: Tue, 24 Jun 2014 13:37:22 +0200 Subject: [PATCH 277/851] Failing VS2013 build, when no NDK is selected --- src_vs2013/BuildTasks/BlackBerry/Platform.targets | 1 + 1 file changed, 1 insertion(+) diff --git a/src_vs2013/BuildTasks/BlackBerry/Platform.targets b/src_vs2013/BuildTasks/BlackBerry/Platform.targets index 308437cc..24a53e60 100644 --- a/src_vs2013/BuildTasks/BlackBerry/Platform.targets +++ b/src_vs2013/BuildTasks/BlackBerry/Platform.targets @@ -162,6 +162,7 @@ Copyright (C) Microsoft Corporation. All rights reserved. + From 71212c0c22ad645b19fac0d04d6be5f7f1fe499d Mon Sep 17 00:00:00 2001 From: Pawel Hofman Date: Tue, 24 Jun 2014 13:37:53 +0200 Subject: [PATCH 278/851] Ignoring more per-user-config files --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index cf2478a6..5baac33b 100644 --- a/.gitignore +++ b/.gitignore @@ -21,6 +21,7 @@ src_vs2010/BlackBerry.NativePlugin.sln.DotSettings.user src_vs2010/BlackBerry.NativePlugin.suo src_vs2010/GDBParser/GDBParser.vcxproj.user src_vs2010/GDBWrapper/GDBWrapper.vcxproj.user +src_vs2010/BuildTasks/BlackBerry.BuildTasks.csproj.user src_vs2010/DebugEngine/BlackBerry.DebugEngine.csproj.user src_vs2010/DebugEngine/BlackBerry.DebugEngine.csproj.DotSettings src_vs2010/NativeCore/BlackBerry.NativeCore.csproj.user From 0106839a0b4b11447122635e0e75e9bbd63b332c Mon Sep 17 00:00:00 2001 From: Pawel Hofman Date: Tue, 24 Jun 2014 13:38:18 +0200 Subject: [PATCH 279/851] Removed spaces from MSBuild rule's descriptions --- src_vs2010/BuildTasks/BlackBerry/Rules/qcc_cl.xml | 6 +++--- src_vs2010/BuildTasks/BlackBerry/Rules/qcc_link.xml | 6 +++--- src_vs2010/BuildTasks/BlackBerrySimulator/Rules/qcc_cl.xml | 6 +++--- .../BuildTasks/BlackBerrySimulator/Rules/qcc_link.xml | 6 +++--- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src_vs2010/BuildTasks/BlackBerry/Rules/qcc_cl.xml b/src_vs2010/BuildTasks/BlackBerry/Rules/qcc_cl.xml index 90de68d9..582cf32d 100644 --- a/src_vs2010/BuildTasks/BlackBerry/Rules/qcc_cl.xml +++ b/src_vs2010/BuildTasks/BlackBerry/Rules/qcc_cl.xml @@ -118,11 +118,11 @@ Switch="fstack-protector-all" /> - - - diff --git a/src_vs2010/BuildTasks/BlackBerry/Rules/qcc_link.xml b/src_vs2010/BuildTasks/BlackBerry/Rules/qcc_link.xml index c35bcb63..02673da3 100644 --- a/src_vs2010/BuildTasks/BlackBerry/Rules/qcc_link.xml +++ b/src_vs2010/BuildTasks/BlackBerry/Rules/qcc_link.xml @@ -189,11 +189,11 @@ Switch="-Wl,-z,relro -Wl,-z,now" /> - - - diff --git a/src_vs2010/BuildTasks/BlackBerrySimulator/Rules/qcc_cl.xml b/src_vs2010/BuildTasks/BlackBerrySimulator/Rules/qcc_cl.xml index 9a799fa8..28bc10e2 100644 --- a/src_vs2010/BuildTasks/BlackBerrySimulator/Rules/qcc_cl.xml +++ b/src_vs2010/BuildTasks/BlackBerrySimulator/Rules/qcc_cl.xml @@ -118,11 +118,11 @@ Switch="fstack-protector-all" /> - - - diff --git a/src_vs2010/BuildTasks/BlackBerrySimulator/Rules/qcc_link.xml b/src_vs2010/BuildTasks/BlackBerrySimulator/Rules/qcc_link.xml index c35bcb63..02673da3 100644 --- a/src_vs2010/BuildTasks/BlackBerrySimulator/Rules/qcc_link.xml +++ b/src_vs2010/BuildTasks/BlackBerrySimulator/Rules/qcc_link.xml @@ -189,11 +189,11 @@ Switch="-Wl,-z,relro -Wl,-z,now" /> - - - From 2726fd8d0f0c8530935e6783d04cbae8a9205adb Mon Sep 17 00:00:00 2001 From: Pawel Hofman Date: Tue, 24 Jun 2014 15:24:02 +0200 Subject: [PATCH 280/851] Moved registration attribute into new location --- src_vs2010/Package/BlackBerry.Package.csproj | 6 +++--- src_vs2012/Package/BlackBerry.Package.csproj | 2 +- .../XmlEditorDesignerViewRegistrationAttribute.cs} | 0 src_vs2013/Package/BlackBerry.Package.csproj | 6 +++--- 4 files changed, 7 insertions(+), 7 deletions(-) rename src_vs2012/Package/{Editors/XmlEditorDesignerViewRegistration.cs => Registration/XmlEditorDesignerViewRegistrationAttribute.cs} (100%) diff --git a/src_vs2010/Package/BlackBerry.Package.csproj b/src_vs2010/Package/BlackBerry.Package.csproj index 913eabaa..35e8a03c 100644 --- a/src_vs2010/Package/BlackBerry.Package.csproj +++ b/src_vs2010/Package/BlackBerry.Package.csproj @@ -166,9 +166,6 @@ Editors\EditorFactoryNotifyForProject.cs - - Editors\XmlEditorDesignerViewRegistration.cs - GuidList.cs @@ -375,6 +372,9 @@ PackageCommands.cs + + Registration\XmlEditorDesignerViewRegistrationAttribute.cs + StandardCommands.cs diff --git a/src_vs2012/Package/BlackBerry.Package.csproj b/src_vs2012/Package/BlackBerry.Package.csproj index d1ed5d53..c600e2f5 100644 --- a/src_vs2012/Package/BlackBerry.Package.csproj +++ b/src_vs2012/Package/BlackBerry.Package.csproj @@ -182,7 +182,6 @@ - @@ -325,6 +324,7 @@ Component + diff --git a/src_vs2012/Package/Editors/XmlEditorDesignerViewRegistration.cs b/src_vs2012/Package/Registration/XmlEditorDesignerViewRegistrationAttribute.cs similarity index 100% rename from src_vs2012/Package/Editors/XmlEditorDesignerViewRegistration.cs rename to src_vs2012/Package/Registration/XmlEditorDesignerViewRegistrationAttribute.cs diff --git a/src_vs2013/Package/BlackBerry.Package.csproj b/src_vs2013/Package/BlackBerry.Package.csproj index de28e8fa..9ac14c3a 100644 --- a/src_vs2013/Package/BlackBerry.Package.csproj +++ b/src_vs2013/Package/BlackBerry.Package.csproj @@ -170,9 +170,6 @@ Editors\EditorFactoryNotifyForProject.cs - - Editors\XmlEditorDesignerViewRegistration.cs - GuidList.cs @@ -379,6 +376,9 @@ PackageCommands.cs + + Registration\XmlEditorDesignerViewRegistrationAttribute.cs + StandardCommands.cs From 2f6864e3791fd7cfe03000c5017e7e296138ae5d Mon Sep 17 00:00:00 2001 From: Pawel Hofman Date: Tue, 24 Jun 2014 15:27:54 +0200 Subject: [PATCH 281/851] Refactored a bit XmlEditor registration attribute --- src_vs2012/Package/BlackBerryPackage.cs | 1 + .../Editors/EditorFactoryNotifyForProject.cs | 2 +- ...EditorDesignerViewRegistrationAttribute.cs | 101 ++++++++---------- 3 files changed, 49 insertions(+), 55 deletions(-) diff --git a/src_vs2012/Package/BlackBerryPackage.cs b/src_vs2012/Package/BlackBerryPackage.cs index 7a3e479c..2fde10ba 100644 --- a/src_vs2012/Package/BlackBerryPackage.cs +++ b/src_vs2012/Package/BlackBerryPackage.cs @@ -28,6 +28,7 @@ using BlackBerry.Package.Helpers; using BlackBerry.Package.Model.Integration; using BlackBerry.Package.Options; +using BlackBerry.Package.Registration; using BlackBerry.Package.ViewModels; using Microsoft.Win32; using Microsoft.VisualStudio; diff --git a/src_vs2012/Package/Editors/EditorFactoryNotifyForProject.cs b/src_vs2012/Package/Editors/EditorFactoryNotifyForProject.cs index a33a9336..64d7899b 100644 --- a/src_vs2012/Package/Editors/EditorFactoryNotifyForProject.cs +++ b/src_vs2012/Package/Editors/EditorFactoryNotifyForProject.cs @@ -16,7 +16,7 @@ using System.Globalization; using Microsoft.VisualStudio.Shell; -namespace BlackBerry.Package +namespace BlackBerry.Package.Editors { /// /// This attribute adds a File Extension for a Project System so that the Project diff --git a/src_vs2012/Package/Registration/XmlEditorDesignerViewRegistrationAttribute.cs b/src_vs2012/Package/Registration/XmlEditorDesignerViewRegistrationAttribute.cs index ac60601f..584bfe6b 100644 --- a/src_vs2012/Package/Registration/XmlEditorDesignerViewRegistrationAttribute.cs +++ b/src_vs2012/Package/Registration/XmlEditorDesignerViewRegistrationAttribute.cs @@ -17,7 +17,7 @@ using System.IO; using Microsoft.VisualStudio; -namespace BlackBerry.Package +namespace BlackBerry.Package.Registration { /// /// Register our bardescriptor.xml custom editor @@ -31,13 +31,13 @@ public sealed class XmlEditorDesignerViewRegistrationAttribute : RegistrationAtt const string XmlEditorFactoryGuid = "{FA3CD31E-987B-443A-9B81-186104E8DAC1}"; /// Declare Private Member Variables - private string keyName; - private string defaultExtension; - private Guid defaultLogicalView; - private int xmlChooserPriority; + private readonly string _keyName; + private readonly string _defaultExtension; + private Guid _defaultLogicalView; + private readonly int _xmlChooserPriority; /// - /// Construtor + /// Init constructor /// /// Registry key name /// Default extension for editor @@ -45,53 +45,44 @@ public sealed class XmlEditorDesignerViewRegistrationAttribute : RegistrationAtt /// XML Priority public XmlEditorDesignerViewRegistrationAttribute(string keyName, string defaultExtension, object defaultLogicalViewEditorFactory, int xmlChooserPriority) { - /// Validate parameter input + // Validate parameter input if (string.IsNullOrWhiteSpace(keyName)) - { throw new ArgumentException("Editor description cannot be null or empty.", "editorDescription"); - } if (string.IsNullOrWhiteSpace(defaultExtension)) - { throw new ArgumentException("Extension cannot be null or empty.", "extension"); - } if (defaultLogicalViewEditorFactory == null) - { throw new ArgumentNullException("defaultLogicalViewEditorFactory"); - } - /// Set Member Variables - this.keyName = keyName; - this.defaultExtension = defaultExtension; - this.defaultLogicalView = TryGetGuidFromObject(defaultLogicalViewEditorFactory); - this.xmlChooserPriority = xmlChooserPriority; + // Set Member Variables + _keyName = keyName; + _defaultExtension = defaultExtension; + _defaultLogicalView = TryGetGuidFromObject(defaultLogicalViewEditorFactory); + _xmlChooserPriority = xmlChooserPriority; - this.CodeLogicalViewEditor = XmlEditorFactoryGuid; - this.DebuggingLogicalViewEditor = XmlEditorFactoryGuid; - this.DesignerLogicalViewEditor = XmlEditorFactoryGuid; - this.TextLogicalViewEditor = XmlEditorFactoryGuid; + CodeLogicalViewEditor = XmlEditorFactoryGuid; + DebuggingLogicalViewEditor = XmlEditorFactoryGuid; + DesignerLogicalViewEditor = XmlEditorFactoryGuid; + TextLogicalViewEditor = XmlEditorFactoryGuid; } /// /// Register the custom editor /// - /// - public override void Register(RegistrationAttribute.RegistrationContext context) + public override void Register(RegistrationContext context) { - /// Validate parameter input + // Validate parameter input if (context == null) - { throw new ArgumentNullException("context"); - } - /// Set extension key + // Set extension key Key extensionKey = context.CreateKey(XmlChooserEditorExtensionsKeyPath); - extensionKey.SetValue(defaultExtension, xmlChooserPriority); + extensionKey.SetValue(_defaultExtension, _xmlChooserPriority); extensionKey.Close(); - /// set editor key - Key editorKey = context.CreateKey(Path.Combine(XmlChooserFactory, keyName)); - editorKey.SetValue("DefaultLogicalView", defaultLogicalView.ToString("B").ToUpperInvariant()); - editorKey.SetValue("Extension", defaultExtension); + // Set editor key + Key editorKey = context.CreateKey(Path.Combine(XmlChooserFactory, _keyName)); + editorKey.SetValue("DefaultLogicalView", _defaultLogicalView.ToString("B").ToUpperInvariant()); + editorKey.SetValue("Extension", _defaultExtension); if (!string.IsNullOrWhiteSpace(Namespace)) { editorKey.SetValue("Namespace", Namespace); @@ -104,22 +95,26 @@ public override void Register(RegistrationAttribute.RegistrationContext context) { editorKey.SetValue("IsDataSet", Convert.ToInt32(IsDataSet.Value)); } - /// Set DebuggingLogicalViewEditor Mapping + + // Set DebuggingLogicalViewEditor Mapping if (DebuggingLogicalViewEditor != null) { editorKey.SetValue(VSConstants.LOGVIEWID_Debugging.ToString("B").ToUpperInvariant(), TryGetGuidFromObject(DebuggingLogicalViewEditor).ToString("B").ToUpperInvariant()); } - /// Set CodeLogicalViewEditor Mapping + + // Set CodeLogicalViewEditor Mapping if (CodeLogicalViewEditor != null) { editorKey.SetValue(VSConstants.LOGVIEWID_Code.ToString("B").ToUpperInvariant(), TryGetGuidFromObject(CodeLogicalViewEditor).ToString("B").ToUpperInvariant()); } - /// Set DesignerLogicalViewEditor Mapping + + // Set DesignerLogicalViewEditor Mapping if (DesignerLogicalViewEditor != null) { editorKey.SetValue(VSConstants.LOGVIEWID_Designer.ToString("B").ToUpperInvariant(), TryGetGuidFromObject(DesignerLogicalViewEditor).ToString("B").ToUpperInvariant()); } - /// Set TextLogicalViewEditor Mapping + + // Set TextLogicalViewEditor Mapping if (TextLogicalViewEditor != null) { editorKey.SetValue(VSConstants.LOGVIEWID_TextView.ToString("B").ToUpperInvariant(), TryGetGuidFromObject(TextLogicalViewEditor).ToString("B").ToUpperInvariant()); @@ -130,38 +125,36 @@ public override void Register(RegistrationAttribute.RegistrationContext context) /// /// Unregister the custom editor /// - /// public override void Unregister(RegistrationContext context) { - /// Validate parameter input + // Validate parameter input if (context == null) - { throw new ArgumentNullException("context"); - } - /// Remove Key - context.RemoveKey(Path.Combine(XmlChooserFactory, keyName)); - context.RemoveValue(XmlChooserEditorExtensionsKeyPath, defaultExtension); + // Remove Key + context.RemoveKey(Path.Combine(XmlChooserFactory, _keyName)); + context.RemoveValue(XmlChooserEditorExtensionsKeyPath, _defaultExtension); context.RemoveKeyIfEmpty(XmlChooserEditorExtensionsKeyPath); } - /// /// Private member function to return the GUID of an object. /// - /// - /// private Guid TryGetGuidFromObject(object guidObject) { // figure out what type of object they passed in and get the GUID from it - if (guidObject is string) - return new Guid((string)guidObject); - else if (guidObject is Type) - return ((Type)guidObject).GUID; - else if (guidObject is Guid) + var strObject = guidObject as string; + if (strObject != null) + return new Guid(strObject); + + var typeObject = guidObject as Type; + if (typeObject != null) + return typeObject.GUID; + + if (guidObject is Guid) return (Guid)guidObject; - else - throw new ArgumentException("Could not determine Guid from supplied object.", "guidObject"); + + throw new ArgumentException("Could not determine Guid from supplied object.", "guidObject"); } /// From af3d2e7082bbd1672adef5b05f2e569dfc9e00cf Mon Sep 17 00:00:00 2001 From: Pawel Hofman Date: Tue, 24 Jun 2014 23:47:06 +0200 Subject: [PATCH 282/851] Simplified the way DebugEngine is registered --- build.bat | 121 +--------- setup.bat | 47 ++-- setup_install.template | 103 -------- setup_uninstall.template | 43 ---- src_vs2010/Package/BlackBerry.Package.csproj | 6 + src_vs2012/Package/BlackBerry.Package.csproj | 2 + src_vs2012/Package/BlackBerryPackage.cs | 19 +- src_vs2012/Package/Helpers/AttributeHelper.cs | 121 ++++++++++ .../DebugEngineRegistrationAttribute.cs | 228 ++++++++++++++++++ ...EditorDesignerViewRegistrationAttribute.cs | 37 +-- src_vs2013/Package/BlackBerry.Package.csproj | 6 + 11 files changed, 406 insertions(+), 327 deletions(-) delete mode 100644 setup_install.template delete mode 100644 setup_uninstall.template create mode 100644 src_vs2012/Package/Helpers/AttributeHelper.cs create mode 100644 src_vs2012/Package/Registration/DebugEngineRegistrationAttribute.cs diff --git a/build.bat b/build.bat index e11e6236..85cd864b 100644 --- a/build.bat +++ b/build.bat @@ -9,13 +9,11 @@ REM **************************************************************************** :: Process parameters, to limit the solutions to build if "%~1" == "" ( set ActionClean=1 - set ActionGenScripts=1 set ActionBuildVS2010=1 set ActionBuildVS2012=1 set ActionBuildVS2013=1 ) else ( set ActionClean=1 - set ActionGenScripts=0 set ActionBuildVS2010=0 set ActionBuildVS2012=0 set ActionBuildVS2013=0 @@ -27,12 +25,9 @@ if "%arg%" == "" (goto args_parsing_done) if /i "%arg%" == "/all" set ActionBuildVS2010=1 && set ActionBuildVS2012=1 && set ActionBuildVS2013=1 if /i "%arg%" == "/noclean" set ActionClean=0 if /i "%arg%" == "/no-clean" set ActionClean=0 -if /i "%arg%" == "/scripts" set ActionGenScripts=2 -if /i "%arg%" == "/noscripts" set ActionGenScripts=0 -if /i "%arg%" == "/no-scripts" set ActionGenScripts=0 -if /i "%arg%" == "vs2010" set ActionBuildVS2010=1 && set ActionGenScripts=1 -if /i "%arg%" == "vs2012" set ActionBuildVS2012=1 && set ActionGenScripts=1 -if /i "%arg%" == "vs2013" set ActionBuildVS2013=1 && set ActionGenScripts=1 +if /i "%arg%" == "vs2010" set ActionBuildVS2010=1 +if /i "%arg%" == "vs2012" set ActionBuildVS2012=1 +if /i "%arg%" == "vs2013" set ActionBuildVS2013=1 if /i "%arg:~0,5%" == "/out:" set CustomOutputDir=%arg:~5% shift /1 @@ -131,116 +126,6 @@ set /a actionNo += 1 :skip_vs2013 -REM ******************************************************************************************** -REM Create Installation/Uninstallation Registry Scripts -REM ******************************************************************************************** -if %ActionGenScripts% equ 0 (goto skip_scripts) - -echo %actionNo%: Creating installation scripts - -if %ActionBuildVS2010% equ 0 (if %ActionGenScripts% neq 2 (goto skip_vs2010_scripts)) -call :processTemplates 2010 10.0 -:skip_vs2010_scripts - -if %ActionBuildVS2012% equ 0 (if %ActionGenScripts% neq 2 (goto skip_vs2012_scripts)) -call :processTemplates 2012 11.0 -:skip_vs2012_scripts - -if %ActionBuildVS2013% equ 0 (if %ActionGenScripts% neq 2 (goto skip_vs2013_scripts)) -call :processTemplates 2013 12.0 -:skip_vs2013_scripts - -echo %actionNo%: Writing - DONE -set /a actionNo += 1 - -:skip_scripts - -REM ******************************************************************************************** -REM Helper functions -REM ******************************************************************************************** -goto EOF - -REM ******************************************************************************************** -REM Generates a set of templates for specified Visual Studio version -REM $1 - Visual Studio number (2010) -REM $2 - Visual Studio version (10.0) -:processTemplates -setlocal EnableDelayedExpansion - -set InstallTemplate="%thisDir%\setup_install.template" -set UninstallTemplate="%thisDir%\setup_uninstall.template" - -set VSYear=%~1 -set VSVersion=%~2 -set PluginRegistryNodeName=BlackBerryVSPlugin -set PluginPathX86="C:\Program Files\BlackBerry\VSPlugin-NDK" -set PluginPathX64="C:\Program Files (x86)\BlackBerry\VSPlugin-NDK" -set DebuggerRegistryNodeX86="HKEY_LOCAL_MACHINE\SOFTWARE" -set DebuggerRegistryNodeX64="HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node" - -set InstallOutputFileX86="%BuildResults%\setup_VS%VSYear%_install_x86.reg" -set InstallOutputFileX64="%BuildResults%\setup_VS%VSYear%_install_x64.reg" -set UninstallOutputFile="%BuildResults%\setup_VS%VSYear%_uninstall.reg" - -call :processTemplate %InstallTemplate% %InstallOutputFileX86% %VSYear% %VSVersion% %PluginRegistryNodeName% %PluginPathX86% %DebuggerRegistryNodeX86% -call :processTemplate %InstallTemplate% %InstallOutputFileX64% %VSYear% %VSVersion% %PluginRegistryNodeName% %PluginPathX64% %DebuggerRegistryNodeX64% - -call :processTemplate %UninstallTemplate% %UninstallOutputFile% %VSYear% %VSVersion% %PluginRegistryNodeName% "" "" - -endlocal -exit /b - -REM ******************************************************************************************** -REM Generates single file from specified template -REM $1 - input template path -REM $2 - output name -REM $3 - Visual Studio number (2010) -REM $4 - Visual Studio version (10.0) -REM $5 - registry node name of the plugin (BlackBerryVSPlugin) -REM $6 - plugin installation directory (C:\Program Files (x86)\BlackBerry\VSPlugin-NDK) -REM $7 - registry root node for debugger info (HKEY_LOCAL_MACHINE\SOFTWARE or HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node) -:processTemplate -setlocal EnableDelayedExpansion - -set InputFile=%~1 -set OutputFile=%~2 -set OutputShortFileName=%~n2%~x2 -set VSYear=%~3 -set VSVersion=%~4 -set PluginRegistryNodeName=%~5 -set PluginPath=%~6 -set DebuggerRegistryRoot=%~7 - -REM Tweak a bit the path, to be better consumed by delayed evaluation -REM and printed correctly into output (preserve parenthesis and double path-chars) -set PluginPath=!PluginPath:\=\\! -set PluginPath=!PluginPath:(=^^(! -set PluginPath=!PluginPath:)=^^)! - -REM Create empty file -type nul > "%OutputFile%" - -for /f "tokens=* delims=" %%l in (%InputFile%) do ( - set line=%%l - - REM Inject empty line, so the sections are easier visible - set first=!line:~0,1! - if "!first!" == "[" echo.>> "%OutputFile%" - - REM Replace markers within the template - set line=!line:#VSVersion#=%VSVersion%! - set line=!line:#VSYear#=%VSYear%! - set line=!line:#PluginRegistryNodeName#=%PluginRegistryNodeName%! - set line=!line:#PluginPath#=%PluginPath%! - set line=!line:#DebuggerRegistryRoot#=%DebuggerRegistryRoot%! - echo.!line! >> "%OutputFile%" -) -echo.>> "%OutputFile%" -echo %actionNo%: Completed template "%OutputShortFileName%" - -endlocal -exit /b - REM ******************************************************************************************** REM DONE REM ******************************************************************************************** diff --git a/setup.bat b/setup.bat index fe2cb25d..dd3d14b4 100644 --- a/setup.bat +++ b/setup.bat @@ -121,17 +121,6 @@ set /a actionNo += 1 call :processPlugin "%BuildPath%" "%PluginRoot%" "%VSPluginPath%" "%MSBuildTargetPath%" "%VSWizardsPath%" set /a actionNo += 1 -if %ActionUninstall% neq 0 (goto uninstall_reg) - -REM Registering debug-ending and other support classes -echo %actionNo%: Registering debug-engine [%BuildResults%\setup_VS%VSYear%_install_%SystemArch%.reg] -REGEDIT.EXE /S "%BuildResults%\setup_VS%VSYear%_install_%SystemArch%.reg" -goto processSetup_End - -:uninstall_reg -echo %actionNo%: Unregistering debug-engine [%BuildResults%\setup_VS%VSYear%_uninstall.reg] -REGEDIT.EXE /S "%BuildResults%\setup_VS%VSYear%_uninstall.reg" - :processSetup_End endlocal exit /b @@ -162,16 +151,6 @@ md "%OutputPluginPath%" echo Make Directory "%OutputVsPath%" md "%OutputVsPath%" -REM Install -echo Copy "%InputPath%\GDBParser.dll" to "%OutputVsPath%\GDBParser.dll" -copy "%InputPath%\GDBParser.dll" "%OutputVsPath%\GDBParser.dll" -echo Copy "%InputPath%\GDBWrapper.exe" to "%OutputPluginPath%\GDBWrapper.exe" -copy "%InputPath%\GDBWrapper.exe" "%OutputPluginPath%\GDBWrapper.exe" -echo Copy "%InputPath%\Instructions.txt" to "%OutputPluginPath%\Instructions.txt" -copy "%InputPath%\Instructions.txt" "%OutputPluginPath%\Instructions.txt" -echo Copy "%InputPath%\BlackBerry.DebugEngine.dll" to "%OutputPluginPath%\BlackBerry.DebugEngine.dll" -copy "%InputPath%\BlackBerry.DebugEngine.dll" "%OutputPluginPath%\BlackBerry.DebugEngine.dll" - REM Install Package Files echo "%InputPath%\extension.vsixmanifest" to "%OutputVsPath%\extension.vsixmanifest" copy "%InputPath%\extension.vsixmanifest" "%OutputVsPath%\extension.vsixmanifest" @@ -181,6 +160,14 @@ echo "%InputPath%\BlackBerry.Package.dll" to "%OutputVsPath%\BlackBerry.Package. copy "%InputPath%\BlackBerry.Package.dll" "%OutputVsPath%\BlackBerry.Package.dll" echo "%InputPath%\BlackBerry.Package.pkgdef" to "%OutputVsPath%\BlackBerry.Package.pkgdef" copy "%InputPath%\BlackBerry.Package.pkgdef" "%OutputVsPath%\BlackBerry.Package.pkgdef" +echo "%InputPath%\GDBParser.dll" to "%OutputVsPath%\GDBParser.dll" +copy "%InputPath%\GDBParser.dll" "%OutputVsPath%\GDBParser.dll" +echo "%InputPath%\GDBWrapper.exe" to "%OutputVsPath%\GDBWrapper.exe" +copy "%InputPath%\GDBWrapper.exe" "%OutputVsPath%\GDBWrapper.exe" +echo "%InputPath%\Instructions.txt" to "%OutputVsPath%\Instructions.txt" +copy "%InputPath%\Instructions.txt" "%OutputVsPath%\Instructions.txt" +echo "%InputPath%\BlackBerry.DebugEngine.dll" to "%OutputVsPath%\BlackBerry.DebugEngine.dll" +copy "%InputPath%\BlackBerry.DebugEngine.dll" "%OutputVsPath%\BlackBerry.DebugEngine.dll" REM MSBuild Files echo Copy BlackBerry MSBuild directory [%OutputMsBuildTargetsPath%] @@ -199,18 +186,10 @@ goto processPlugin_End :uninstall_Plugin -REM Uninstall echo %actionNo%: Removing plugin binaries -echo Deleting "%OutputVsPath%\GDBParser.dll" -del "%OutputVsPath%\GDBParser.dll" -echo Deleting "%OutputPluginPath%\GDBWrapper.exe" -del "%OutputPluginPath%\GDBWrapper.exe" -echo Deleting "%OutputPluginPath%\Instructions.txt" -del "%OutputPluginPath%\Instructions.txt" -echo Deleting "%OutputPluginPath%\BlackBerry.DebugEngine.dll" -del "%OutputPluginPath%\BlackBerry.DebugEngine.dll" REM Uninstall Package Files + echo Deleting "%OutputVsPath%\extension.vsixmanifest" del "%OutputVsPath%\extension.vsixmanifest" echo Deleting "%OutputVsPath%\BlackBerry.NativeCore.dll" @@ -219,6 +198,14 @@ echo Deleting "%OutputVsPath%\BlackBerry.Package.dll" del "%OutputVsPath%\BlackBerry.Package.dll" echo Deleting "%OutputVsPath%\BlackBerry.Package.pkgdef" del "%OutputVsPath%\BlackBerry.Package.pkgdef" +echo Deleting "%OutputVsPath%\GDBParser.dll" +del "%OutputVsPath%\GDBParser.dll" +echo Deleting "%OutputVsPath%\GDBWrapper.exe" +del "%OutputVsPath%\GDBWrapper.exe" +echo Deleting "%OutputVsPath%\Instructions.txt" +del "%OutputVsPath%\Instructions.txt" +echo Deleting "%OutputVsPath%\BlackBerry.DebugEngine.dll" +del "%OutputVsPath%\BlackBerry.DebugEngine.dll" REM Remove folders echo Remove Directory "%OutputPluginPath%" diff --git a/setup_install.template b/setup_install.template deleted file mode 100644 index 2a1d5aca..00000000 --- a/setup_install.template +++ /dev/null @@ -1,103 +0,0 @@ -REGEDIT4 - -[HKEY_CURRENT_USER\SOFTWARE\BlackBerry\#PluginRegistryNodeName#] -"device_password"="" -"device_IP"="169.254.0.1" -"simulator_password"="" -"simulator_IP"="" -"NDKHostPath"="" -"NDKTargetPath"="" -"NDKRemotePath"="" - -[#DebuggerRegistryRoot#\Microsoft\AD7Metrics\Engine\{E5A37609-2F43-4830-AA85-D94CFA035DD2}] -"AddressBP"=dword:00000000 -"AutoSelectPriority"=dword:00000004 -"CallstackBP"=dword:00000001 -"ProgramProvider"="{AD06FD46-C790-4D5C-A274-8815DF9511B8}" -"Attach"=dword:00000001 -"CLSID"="{904AA6E0-942C-4D11-9094-7BAAEB3EE4B9}" -"AlwaysLoadLocal"="1" -"PortSupplier"="{92A2B753-00BD-40FF-9964-6AB64A1D6C9F}" -"Name"="BlackBerry Native SDK Debug Engine" -@="guidDebuggingSampleEngine" - -[#DebuggerRegistryRoot#\Microsoft\AD7Metrics\Engine\{E5A37609-2F43-4830-AA85-D94CFA035DD2}\IncompatibleList] -"guidScriptEng"="{F200A7E7-DEA5-11D0-B854-00A0244A1DE2}" -"guidNativeOnlyEng"="{449EC4CC-30D2-4032-9256-EE18EB41B62B}" -"guidCOMPlusOnlyEng"="{449EC4CC-30D2-4032-9256-EE18EB41B62B}" -"guidCOMPlusNativeEng"="{92EF0900-2251-11D2-B72E-0000F87572EF}" - -[#DebuggerRegistryRoot#\Microsoft\VisualStudio\#VSVersion#\CLSID\{AD06FD46-C790-4D5C-A274-8815DF9511B8}] -"CodeBase"="#PluginPath#\\BlackBerry.DebugEngine.dll" -"InprocServer32"="C:\\Windows\\System32\\mscoree.dll" -"Class"="BlackBerry.DebugEngine.AD7ProgramProvider" -"Assembly"="BlackBerry.DebugEngine" - -[#DebuggerRegistryRoot#\Microsoft\VisualStudio\#VSVersion#\CLSID\{904AA6E0-942C-4D11-9094-7BAAEB3EE4B9}] -"CodeBase"="#PluginPath#\\BlackBerry.DebugEngine.dll" -"InprocServer32"="C:\\Windows\\System32\\mscoree.dll" -"Class"="BlackBerry.DebugEngine.AD7Engine" -"Assembly"="BlackBerry.DebugEngine" - -[#DebuggerRegistryRoot#\Microsoft\VisualStudio\#VSVersion#\CLSID\{BDC2218C-D50C-4A5A-A2F6-66BDC94FF8D6}] -@="BlackBerrySupplier" -"Assembly"="BlackBerry.DebugEngine" -"Class"="BlackBerry.DebugEngine.AD7PortSupplier" -"InprocServer32"="C:\\Windows\\System32\\mscoree.dll" -"CodeBase"="#PluginPath#\\BlackBerry.DebugEngine.dll" -"ThreadingModel"="Free" - -[#DebuggerRegistryRoot#\Microsoft\VisualStudio\#VSVersion#\AD7Metrics\PortSupplier\{92A2B753-00BD-40FF-9964-6AB64A1D6C9F}] -"Name"="BlackBerry" -"DisallowUserEnteredPorts"=dword:00000000 -"CLSID"="{BDC2218C-D50C-4A5A-A2F6-66BDC94FF8D6}" -@="BlackBerry Native SDK" -"PortPickerCLSID"="{3FAA02D6-72D8-4F69-A1E6-BB05ECB4E37A}" - -[#DebuggerRegistryRoot#\Microsoft\VisualStudio\#VSVersion#\AD7Metrics\Engine\{E5A37609-2F43-4830-AA85-D94CFA035DD2}] -"AlwaysLoadLocal"="1" -"PortSupplier"="{BDC2218C-D50C-4A5A-A2F6-66BDC94FF8D6}" -"Name"="BlackBerry Native SDK Debug Engine" -"CallstackBP"=dword:00000001 -"AutoSelectPriority"=dword:00000004 -"AddressBP"=dword:00000000 -"Attach"=dword:00000001 -"ProgramProvider"="{AD06FD46-C790-4D5C-A274-8815DF9511B8}" -"CLSID"="{904AA6E0-942C-4D11-9094-7BAAEB3EE4B9}" -@="guidDebuggingSampleEngine" - -[#DebuggerRegistryRoot#\Microsoft\VisualStudio\#VSVersion#\AD7Metrics\Engine\{E5A37609-2F43-4830-AA85-D94CFA035DD2}\IncompatibleList] -"guidScriptEng"="{F200A7E7-DEA5-11D0-B854-00A0244A1DE2}" -"guidNativeOnlyEng"="{449EC4CC-30D2-4032-9256-EE18EB41B62B}" -"guidCOMPlusOnlyEng"="{449EC4CC-30D2-4032-9256-EE18EB41B62B}" -"guidCOMPlusNativeEng"="{92EF0900-2251-11D2-B72E-0000F87572EF}" - -[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\#VSVersion#\CLSID\{AD06FD46-C790-4D5C-A274-8815DF9511B8}] -"CodeBase"="#PluginPath#\\BlackBerry.DebugEngine.dll" -"InprocServer32"="C:\\Windows\\System32\\mscoree.dll" -"Class"="BlackBerry.DebugEngine.AD7ProgramProvider" -"Assembly"="BlackBerry.DebugEngine" - -[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\#VSVersion#\CLSID\{904AA6E0-942C-4D11-9094-7BAAEB3EE4B9}] -"CodeBase"="#PluginPath#\\BlackBerry.DebugEngine.dll" -"Assembly"="BlackBerry.DebugEngine" -"Class"="BlackBerry.DebugEngine.AD7Engine" -"InprocServer32"="C:\\Windows\\System32\\mscoree.dll" - -[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\#VSVersion#\AD7Metrics\Engine\{E5A37609-2F43-4830-AA85-D94CFA035DD2}] -"Attach"=dword:00000001 -"ProgramProvider"="{AD06FD46-C790-4D5C-A274-8815DF9511B8}" -"CLSID"="{904AA6E0-942C-4D11-9094-7BAAEB3EE4B9}" -@="guidDebuggingSampleEngine" -"AlwaysLoadLocal"="1" -"AutoSelectPriority"=dword:00000004 -"PortSupplier"="{92A2B753-00BD-40FF-9964-6AB64A1D6C9F}" -"Name"="BlackBerry Native SDK Debug Engine" -"CallstackBP"=dword:00000001 -"AddressBP"=dword:00000000 - -[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\#VSVersion#\AD7Metrics\Engine\{E5A37609-2F43-4830-AA85-D94CFA035DD2}\IncompatibleList] -"guidNativeOnlyEng"="{449EC4CC-30D2-4032-9256-EE18EB41B62B}" -"guidCOMPlusOnlyEng"="{449EC4CC-30D2-4032-9256-EE18EB41B62B}" -"guidScriptEng"="{F200A7E7-DEA5-11D0-B854-00A0244A1DE2}" -"guidCOMPlusNativeEng"="{92EF0900-2251-11D2-B72E-0000F87572EF}" \ No newline at end of file diff --git a/setup_uninstall.template b/setup_uninstall.template deleted file mode 100644 index 420fe407..00000000 --- a/setup_uninstall.template +++ /dev/null @@ -1,43 +0,0 @@ -REGEDIT4 - -[-HKEY_CURRENT_USER\SOFTWARE\BlackBerry\#PluginRegistryNodeName#] - -[-HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\AD7Metrics\Engine\{E5A37609-2F43-4830-AA85-D94CFA035DD2}\IncompatibleList] - -[-HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\AD7Metrics\Engine\{E5A37609-2F43-4830-AA85-D94CFA035DD2}] - -[-HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\#VSVersion#\CLSID\{AD06FD46-C790-4D5C-A274-8815DF9511B8}] - -[-HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\#VSVersion#\CLSID\{904AA6E0-942C-4D11-9094-7BAAEB3EE4B9}] - -[-HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\#VSVersion#\CLSID\{BDC2218C-D50C-4A5A-A2F6-66BDC94FF8D6}] - -[-HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\#VSVersion#\AD7Metrics\PortSupplier\{92A2B753-00BD-40FF-9964-6AB64A1D6C9F}] - -[-HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\#VSVersion#\AD7Metrics\Engine\{E5A37609-2F43-4830-AA85-D94CFA035DD2}\IncompatibleList] - -[-HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\#VSVersion#\AD7Metrics\Engine\{E5A37609-2F43-4830-AA85-D94CFA035DD2}] - -[-HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\AD7Metrics\Engine\{E5A37609-2F43-4830-AA85-D94CFA035DD2}\IncompatibleList] - -[-HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\AD7Metrics\Engine\{E5A37609-2F43-4830-AA85-D94CFA035DD2}] - -[-HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\#VSVersion#\CLSID\{AD06FD46-C790-4D5C-A274-8815DF9511B8}] - -[-HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\#VSVersion#\CLSID\{904AA6E0-942C-4D11-9094-7BAAEB3EE4B9}] - -[-HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\#VSVersion#\CLSID\{BDC2218C-D50C-4A5A-A2F6-66BDC94FF8D6}] - -[-HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\#VSVersion#\AD7Metrics\PortSupplier\{92A2B753-00BD-40FF-9964-6AB64A1D6C9F}] - -[-HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\#VSVersion#\AD7Metrics\Engine\{E5A37609-2F43-4830-AA85-D94CFA035DD2}\IncompatibleList] - -[-HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\#VSVersion#\AD7Metrics\Engine\{E5A37609-2F43-4830-AA85-D94CFA035DD2}] - -[-HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\#VSVersion#\CLSID\{AD06FD46-C790-4D5C-A274-8815DF9511B8}] - -[-HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\#VSVersion#\CLSID\{904AA6E0-942C-4D11-9094-7BAAEB3EE4B9}] - -[-HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\#VSVersion#\AD7Metrics\Engine\{E5A37609-2F43-4830-AA85-D94CFA035DD2}\IncompatibleList] - -[-HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\#VSVersion#\AD7Metrics\Engine\{E5A37609-2F43-4830-AA85-D94CFA035DD2}] \ No newline at end of file diff --git a/src_vs2010/Package/BlackBerry.Package.csproj b/src_vs2010/Package/BlackBerry.Package.csproj index 35e8a03c..5c972cd4 100644 --- a/src_vs2010/Package/BlackBerry.Package.csproj +++ b/src_vs2010/Package/BlackBerry.Package.csproj @@ -169,6 +169,9 @@ GuidList.cs + + Helpers\AttributeHelper.cs + Helpers\CertHelper.cs @@ -372,6 +375,9 @@ PackageCommands.cs + + Registration\DebugEngineRegistrationAttribute.cs + Registration\XmlEditorDesignerViewRegistrationAttribute.cs diff --git a/src_vs2012/Package/BlackBerry.Package.csproj b/src_vs2012/Package/BlackBerry.Package.csproj index c600e2f5..c645b626 100644 --- a/src_vs2012/Package/BlackBerry.Package.csproj +++ b/src_vs2012/Package/BlackBerry.Package.csproj @@ -183,6 +183,7 @@ + @@ -324,6 +325,7 @@ Component + diff --git a/src_vs2012/Package/BlackBerryPackage.cs b/src_vs2012/Package/BlackBerryPackage.cs index 2fde10ba..282a44a2 100644 --- a/src_vs2012/Package/BlackBerryPackage.cs +++ b/src_vs2012/Package/BlackBerryPackage.cs @@ -68,6 +68,14 @@ namespace BlackBerry.Package // Microsoft Visual C# Project [EditorFactoryNotifyForProject("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}", BarDescriptorEditorFactory.DefaultExtension, GuidList.guidVSNDK_PackageEditorFactoryString)] + // Registration of custom debugger + [DebugEngineRegistration("BlackBerry NDK DebugEngine", "{E5A37609-2F43-4830-AA85-D94CFA035DD2}", + Attach = true, AddressBreakpoints = false, CallstackBreakpoints = true, AlwaysLoadLocal = true, AutoSelectPriority = 4, + DebugEngineClassGUID = "{904AA6E0-942C-4D11-9094-7BAAEB3EE4B9}", DebugEngineClassName = "BlackBerry.DebugEngine.AD7Engine", + ProgramProviderClassGUID = "{AD06FD46-C790-4D5C-A274-8815DF9511B8}", ProgramProviderClassName = "BlackBerry.DebugEngine.AD7ProgramProvider", + PortSupplierClassGUID = "{BDC2218C-D50C-4A5A-A2F6-66BDC94FF8D6}", PortSupplierClassName = "BlackBerry.DebugEngine.AD7PortSupplier", + AssemblyName = "BlackBerry.DebugEngine.dll")] + // This attribute is used to register the informations needed to show the this package // in the Help/About dialog of Visual Studio. [InstalledProductRegistration("#110", "#112", VersionString, IconResourceID = 400)] @@ -79,14 +87,15 @@ namespace BlackBerry.Package // This attribute defines set of settings pages provided by this package. // They are automatically instantiated and displayed inside [Visual Studio -> Tools -> Options...] dialog. - [ProvideOptionPage(typeof(GeneralOptionPage), "BlackBerry", "General", 1001, 1002, true)] - [ProvideOptionPage(typeof(LogsOptionPage), "BlackBerry", "Logs", 1001, 1003, true)] - [ProvideOptionPage(typeof(ApiLevelOptionPage), "BlackBerry", "API Levels", 1001, 1004, true)] - [ProvideOptionPage(typeof(TargetsOptionPage), "BlackBerry", "Targets", 1001, 1005, true)] - [ProvideOptionPage(typeof(SigningOptionPage), "BlackBerry", "Signing", 1001, 1006, true)] + [ProvideOptionPage(typeof(GeneralOptionPage), OptionsCategoryName, "General", 1001, 1002, true)] + [ProvideOptionPage(typeof(LogsOptionPage), OptionsCategoryName, "Logs", 1001, 1003, true)] + [ProvideOptionPage(typeof(ApiLevelOptionPage), OptionsCategoryName, "API Levels", 1001, 1004, true)] + [ProvideOptionPage(typeof(TargetsOptionPage), OptionsCategoryName, "Targets", 1001, 1005, true)] + [ProvideOptionPage(typeof(SigningOptionPage), OptionsCategoryName, "Signing", 1001, 1006, true)] public sealed class BlackBerryPackage : Microsoft.VisualStudio.Shell.Package, IDisposable { public const string VersionString = "2.1.2014.0623"; + public const string OptionsCategoryName = "BlackBerry"; #region private member variables diff --git a/src_vs2012/Package/Helpers/AttributeHelper.cs b/src_vs2012/Package/Helpers/AttributeHelper.cs new file mode 100644 index 00000000..522b5310 --- /dev/null +++ b/src_vs2012/Package/Helpers/AttributeHelper.cs @@ -0,0 +1,121 @@ +using System; + +namespace BlackBerry.Package.Helpers +{ + /// + /// Helper class for custom attributes. + /// + internal static class AttributeHelper + { + /// + /// Returns the GUID from an object. + /// + public static Guid GetGuidFrom(object guidObject) + { + // figure out what type of object they passed in and get the GUID from it + var strObject = guidObject as string; + if (strObject != null) + return new Guid(strObject); + + var typeObject = guidObject as Type; + if (typeObject != null) + return typeObject.GUID; + + var byteObject = guidObject as byte[]; + if (byteObject != null && byteObject.Length == 16) + return new Guid(byteObject); + + if (guidObject is Guid) + return (Guid)guidObject; + + throw new ArgumentException("Could not determine Guid from supplied object.", "guidObject"); + } + + /// + /// Gets the string representation of the GUID valid for registry settings. + /// + public static string Format(Guid guid) + { + return guid.ToString("B").ToUpperInvariant(); + } + + /// + /// Gets the string representation of the GUID valid for registry settings. + /// GUID is passed anyhow (string, type or GUID itself). + /// + public static string Format(object guidObject) + { + return Format(GetGuidFrom(guidObject)); + } + + /// + /// Gets the array of GUIDs from specified argument. + /// Argument can be any type (string, type or GUID itself). + /// + public static Guid[] GetArrayFrom(object guidArray) + { + var strObject = guidArray as string; + if (strObject != null) + { + return Convert(strObject.Split(',', ';', '|')); + } + + var strArrayObject = guidArray as string[]; + if (strArrayObject != null) + { + return Convert(strArrayObject); + } + + if (guidArray is Guid) + return new[] { (Guid) guidArray }; + + var guidArrayObject = guidArray as Guid[]; + if (guidArrayObject != null) + return guidArrayObject; + + var typeObject = guidArray as Type; + if (typeObject != null) + return new[] { typeObject.GUID }; + + var typeArrayObject = guidArray as Type[]; + if (typeArrayObject != null) + { + return Convert(typeArrayObject); + } + + var byteObject = guidArray as byte[]; + if (byteObject != null && byteObject.Length == 16) + return new[] { new Guid(byteObject) }; + + throw new ArgumentException("Invalid GUID array", "guidArray"); + } + + private static Guid[] Convert(string[] stringArray) + { + if (stringArray == null || stringArray.Length == 0) + return null; + + var result = new Guid[stringArray.Length]; + for (int i = 0; i < result.Length; i++) + { + result[i] = new Guid(stringArray[i]); + } + + return result; + } + + private static Guid[] Convert(Type[] typeArray) + { + if (typeArray == null || typeArray.Length == 0) + return null; + + var result = new Guid[typeArray.Length]; + for (int i = 0; i < result.Length; i++) + { + result[i] = typeArray[i].GUID; + } + + return result; + } + } +} diff --git a/src_vs2012/Package/Registration/DebugEngineRegistrationAttribute.cs b/src_vs2012/Package/Registration/DebugEngineRegistrationAttribute.cs new file mode 100644 index 00000000..1fd4b044 --- /dev/null +++ b/src_vs2012/Package/Registration/DebugEngineRegistrationAttribute.cs @@ -0,0 +1,228 @@ +using System; +using BlackBerry.Package.Helpers; +using Microsoft.VisualStudio.Shell; + +namespace BlackBerry.Package.Registration +{ + /// + /// Registration attribute providing info about custom DebugEndine implemented withing this package. + /// + public sealed class DebugEngineRegistrationAttribute : RegistrationAttribute + { + private const string DefaultInprocServerPath = "$WinDir$\\System32\\mscoree.dll"; + + /// + /// Init constructor. + /// + public DebugEngineRegistrationAttribute(string name, object debugEngineGUID) + { + if (string.IsNullOrEmpty(name)) + throw new ArgumentNullException("name"); + if (debugEngineGUID == null) + throw new ArgumentNullException("debugEngineGUID"); + + Name = name; + DebugEngineGUID = debugEngineGUID; + } + + #region Properties + + public string Name + { + get; + private set; + } + + /// + /// Gets or sets the indication of support for attachment to existing programs. + /// + public bool Attach + { + get; + set; + } + + /// + /// Gets or sets an indication of support for address breakpoints. + /// + public bool AddressBreakpoints + { + get; + set; + } + + /// + /// Gets or set an indication of support for callstack breakpoints. + /// + public bool CallstackBreakpoints + { + get; + set; + } + + /// + /// Gets or sets an indication of support for suspending thread execution. + /// + public bool SuspendThread + { + get; + set; + } + + /// + /// Gets or sets indication if always load the debug engine locally. + /// + public bool AlwaysLoadLocal + { + get; + set; + } + + public uint AutoSelectPriority + { + get; + set; + } + + public object DebugEngineGUID + { + get; + private set; + } + + /// + /// Gets or sets the GUID for a class implementing IDebugEngine interface. + /// + public object DebugEngineClassGUID + { + get; + set; + } + + public string DebugEngineClassName + { + get; + set; + } + + /// + /// Gets or sets the GUID of the program provider class. + /// + public object ProgramProviderClassGUID + { + get; + set; + } + + public string ProgramProviderClassName + { + get; + set; + } + + /// + /// Gets or set the comma-separated list of the port supplier(s) + /// + public object PortSupplierClassGUID + { + get; + set; + } + + public string PortSupplierClassName + { + get; + set; + } + + public string AssemblyName + { + get; + set; + } + + #endregion + + public override void Register(RegistrationContext context) + { + if (context == null) + throw new ArgumentNullException("context"); + + var key = context.CreateKey(@"AD7Metrics\Engine\" + AttributeHelper.Format(DebugEngineGUID)); + + key.SetValue("Attach", Format(Attach)); + key.SetValue("AddressBP", Format(AddressBreakpoints)); + key.SetValue("CallstackBP", Format(CallstackBreakpoints)); + key.SetValue("SuspendThread", Format(SuspendThread)); + key.SetValue("AlwaysLoadLocal", Format(AlwaysLoadLocal)); + key.SetValue("AutoSelectPriority", AutoSelectPriority); + if (DebugEngineClassGUID != null) + key.SetValue("CLSID", AttributeHelper.Format(DebugEngineClassGUID)); + if (ProgramProviderClassGUID != null) + key.SetValue("ProgramProvider", AttributeHelper.Format(ProgramProviderClassGUID)); + + // Port suppliers + if (PortSupplierClassGUID != null) + { + var portSupplierFormattedGuid = AttributeHelper.Format(PortSupplierClassGUID); + + key.SetValue("PortSupplier", portSupplierFormattedGuid); + + var supplierDetailsKey = context.CreateKey(@"AD7Metrics\PortSupplier\" + portSupplierFormattedGuid); + supplierDetailsKey.SetValue("DisallowUserEnteredPorts", 0u); + supplierDetailsKey.SetValue("CLSID", portSupplierFormattedGuid); + //supplierDetailsKey.SetValue("PortPickerCLSID", "{3FAA02D6-72D8-4F69-A1E6-BB05ECB4E37A}"); + supplierDetailsKey.Close(); + } + key.Close(); + + // describe classes: + RegisterClass(context, DebugEngineClassGUID, DebugEngineClassName); + RegisterClass(context, ProgramProviderClassGUID, ProgramProviderClassName); + RegisterClass(context, PortSupplierClassGUID, PortSupplierClassName); + } + + /// + /// Registers reference to specified class. + /// + private void RegisterClass(RegistrationContext context, object classGuid, string className) + { + if (classGuid != null) + { + var key = context.CreateKey(@"CLSID\" + AttributeHelper.Format(classGuid)); + if (!string.IsNullOrEmpty(className)) + key.SetValue("Class", className); + if (!string.IsNullOrEmpty(AssemblyName)) + { + key.SetValue("InprocServer32", DefaultInprocServerPath); + key.SetValue("CodeBase", "$PackageFolder$\\" + AssemblyName); + } + key.Close(); + } + } + + private static void UnregisterClass(RegistrationContext context, object classGuid) + { + if (classGuid != null) + { + context.RemoveKey(@"CLSID\" + AttributeHelper.Format(classGuid)); + } + } + + private static uint Format(bool value) + { + return value ? 1u : 0u; + } + + public override void Unregister(RegistrationContext context) + { + if (context == null) + throw new ArgumentNullException("context"); + + context.RemoveKey(@"AD7Metrics\Engine\" + AttributeHelper.Format(DebugEngineGUID)); + UnregisterClass(context, DebugEngineClassGUID); + UnregisterClass(context, ProgramProviderClassGUID); + UnregisterClass(context, PortSupplierClassGUID); + } + } +} diff --git a/src_vs2012/Package/Registration/XmlEditorDesignerViewRegistrationAttribute.cs b/src_vs2012/Package/Registration/XmlEditorDesignerViewRegistrationAttribute.cs index 584bfe6b..3b21d6d2 100644 --- a/src_vs2012/Package/Registration/XmlEditorDesignerViewRegistrationAttribute.cs +++ b/src_vs2012/Package/Registration/XmlEditorDesignerViewRegistrationAttribute.cs @@ -13,6 +13,7 @@ //* limitations under the License. using System; +using BlackBerry.Package.Helpers; using Microsoft.VisualStudio.Shell; using System.IO; using Microsoft.VisualStudio; @@ -33,7 +34,7 @@ public sealed class XmlEditorDesignerViewRegistrationAttribute : RegistrationAtt /// Declare Private Member Variables private readonly string _keyName; private readonly string _defaultExtension; - private Guid _defaultLogicalView; + private readonly Guid _defaultLogicalView; private readonly int _xmlChooserPriority; /// @@ -56,13 +57,13 @@ public XmlEditorDesignerViewRegistrationAttribute(string keyName, string default // Set Member Variables _keyName = keyName; _defaultExtension = defaultExtension; - _defaultLogicalView = TryGetGuidFromObject(defaultLogicalViewEditorFactory); + _defaultLogicalView = AttributeHelper.GetGuidFrom(defaultLogicalViewEditorFactory); _xmlChooserPriority = xmlChooserPriority; CodeLogicalViewEditor = XmlEditorFactoryGuid; DebuggingLogicalViewEditor = XmlEditorFactoryGuid; DesignerLogicalViewEditor = XmlEditorFactoryGuid; - TextLogicalViewEditor = XmlEditorFactoryGuid; + TextLogicalViewEditor = XmlEditorFactoryGuid; } /// @@ -81,7 +82,7 @@ public override void Register(RegistrationContext context) // Set editor key Key editorKey = context.CreateKey(Path.Combine(XmlChooserFactory, _keyName)); - editorKey.SetValue("DefaultLogicalView", _defaultLogicalView.ToString("B").ToUpperInvariant()); + editorKey.SetValue("DefaultLogicalView", AttributeHelper.Format(_defaultLogicalView)); editorKey.SetValue("Extension", _defaultExtension); if (!string.IsNullOrWhiteSpace(Namespace)) { @@ -99,25 +100,25 @@ public override void Register(RegistrationContext context) // Set DebuggingLogicalViewEditor Mapping if (DebuggingLogicalViewEditor != null) { - editorKey.SetValue(VSConstants.LOGVIEWID_Debugging.ToString("B").ToUpperInvariant(), TryGetGuidFromObject(DebuggingLogicalViewEditor).ToString("B").ToUpperInvariant()); + editorKey.SetValue(AttributeHelper.Format(VSConstants.LOGVIEWID_Debugging), AttributeHelper.Format(DebuggingLogicalViewEditor)); } // Set CodeLogicalViewEditor Mapping if (CodeLogicalViewEditor != null) { - editorKey.SetValue(VSConstants.LOGVIEWID_Code.ToString("B").ToUpperInvariant(), TryGetGuidFromObject(CodeLogicalViewEditor).ToString("B").ToUpperInvariant()); + editorKey.SetValue(AttributeHelper.Format(VSConstants.LOGVIEWID_Code), AttributeHelper.Format(CodeLogicalViewEditor)); } // Set DesignerLogicalViewEditor Mapping if (DesignerLogicalViewEditor != null) { - editorKey.SetValue(VSConstants.LOGVIEWID_Designer.ToString("B").ToUpperInvariant(), TryGetGuidFromObject(DesignerLogicalViewEditor).ToString("B").ToUpperInvariant()); + editorKey.SetValue(AttributeHelper.Format(VSConstants.LOGVIEWID_Designer), AttributeHelper.Format(DesignerLogicalViewEditor)); } // Set TextLogicalViewEditor Mapping if (TextLogicalViewEditor != null) { - editorKey.SetValue(VSConstants.LOGVIEWID_TextView.ToString("B").ToUpperInvariant(), TryGetGuidFromObject(TextLogicalViewEditor).ToString("B").ToUpperInvariant()); + editorKey.SetValue(AttributeHelper.Format(VSConstants.LOGVIEWID_TextView), AttributeHelper.Format(TextLogicalViewEditor)); } editorKey.Close(); } @@ -137,26 +138,6 @@ public override void Unregister(RegistrationContext context) context.RemoveKeyIfEmpty(XmlChooserEditorExtensionsKeyPath); } - /// - /// Private member function to return the GUID of an object. - /// - private Guid TryGetGuidFromObject(object guidObject) - { - // figure out what type of object they passed in and get the GUID from it - var strObject = guidObject as string; - if (strObject != null) - return new Guid(strObject); - - var typeObject = guidObject as Type; - if (typeObject != null) - return typeObject.GUID; - - if (guidObject is Guid) - return (Guid)guidObject; - - throw new ArgumentException("Could not determine Guid from supplied object.", "guidObject"); - } - /// /// The editor factor for the Code View Editor /// diff --git a/src_vs2013/Package/BlackBerry.Package.csproj b/src_vs2013/Package/BlackBerry.Package.csproj index 9ac14c3a..b546331b 100644 --- a/src_vs2013/Package/BlackBerry.Package.csproj +++ b/src_vs2013/Package/BlackBerry.Package.csproj @@ -173,6 +173,9 @@ GuidList.cs + + Helpers\AttributeHelper.cs + Helpers\CertHelper.cs @@ -376,6 +379,9 @@ PackageCommands.cs + + Registration\DebugEngineRegistrationAttribute.cs + Registration\XmlEditorDesignerViewRegistrationAttribute.cs From 23603f58f50df34e7b781b5ddcb0e3d3fe3ac3c0 Mon Sep 17 00:00:00 2001 From: Pawel Hofman Date: Wed, 25 Jun 2014 00:03:06 +0200 Subject: [PATCH 283/851] Temporarly loading private-debug version of DebugEngine Only for a time of refactoring all over to remove the C++ code dependency. Normally the BlackBerry.DebugEngine.dll depends on the BlackBerry.Package.dll and GDBParser.dll, while it should be reverted. The Package should reference DebugEngine to have it automatically included inside the VSIX-package. GDBParser should be rewritten to C# and placed inside NativeCore library. This will eliminate the artificial x86 code enforcement. --- src_vs2010/DebugEngine/AD7.Impl/AD7PortSupplier.cs | 2 +- src_vs2012/Package/BlackBerryPackage.cs | 7 ++++++- .../Registration/DebugEngineRegistrationAttribute.cs | 11 ++++++++++- 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/src_vs2010/DebugEngine/AD7.Impl/AD7PortSupplier.cs b/src_vs2010/DebugEngine/AD7.Impl/AD7PortSupplier.cs index 12ab44ec..44eb03c8 100644 --- a/src_vs2010/DebugEngine/AD7.Impl/AD7PortSupplier.cs +++ b/src_vs2010/DebugEngine/AD7.Impl/AD7PortSupplier.cs @@ -68,7 +68,7 @@ public class AD7PortSupplier : IDebugPortSupplier2, IDebugPortSupplierDescriptio /// public AD7PortSupplier() { - m_name = "BlackBerry"; + m_name = "BlackBerry Native Debugger"; m_description = "The BlackBerry transport lets you select a process that is running in a BlackBerry Device/Simulator"; } diff --git a/src_vs2012/Package/BlackBerryPackage.cs b/src_vs2012/Package/BlackBerryPackage.cs index 282a44a2..7c9e6d2e 100644 --- a/src_vs2012/Package/BlackBerryPackage.cs +++ b/src_vs2012/Package/BlackBerryPackage.cs @@ -74,7 +74,12 @@ namespace BlackBerry.Package DebugEngineClassGUID = "{904AA6E0-942C-4D11-9094-7BAAEB3EE4B9}", DebugEngineClassName = "BlackBerry.DebugEngine.AD7Engine", ProgramProviderClassGUID = "{AD06FD46-C790-4D5C-A274-8815DF9511B8}", ProgramProviderClassName = "BlackBerry.DebugEngine.AD7ProgramProvider", PortSupplierClassGUID = "{BDC2218C-D50C-4A5A-A2F6-66BDC94FF8D6}", PortSupplierClassName = "BlackBerry.DebugEngine.AD7PortSupplier", - AssemblyName = "BlackBerry.DebugEngine.dll")] +#if DEBUG + AssemblyName = @"S:\vs-plugin\src_vs2012\DebugEngine\bin\Debug\BlackBerry.DebugEngine.dll" +#else + AssemblyName = "BlackBerry.DebugEngine.dll" +#endif +)] // This attribute is used to register the informations needed to show the this package // in the Help/About dialog of Visual Studio. diff --git a/src_vs2012/Package/Registration/DebugEngineRegistrationAttribute.cs b/src_vs2012/Package/Registration/DebugEngineRegistrationAttribute.cs index 1fd4b044..6eef97fa 100644 --- a/src_vs2012/Package/Registration/DebugEngineRegistrationAttribute.cs +++ b/src_vs2012/Package/Registration/DebugEngineRegistrationAttribute.cs @@ -195,7 +195,16 @@ private void RegisterClass(RegistrationContext context, object classGuid, string if (!string.IsNullOrEmpty(AssemblyName)) { key.SetValue("InprocServer32", DefaultInprocServerPath); - key.SetValue("CodeBase", "$PackageFolder$\\" + AssemblyName); + + // check if full-path specified or relative to the package location: + if ((AssemblyName.Length > 2 && AssemblyName[1] == ':') || AssemblyName.StartsWith("file://", StringComparison.InvariantCultureIgnoreCase)) + { + key.SetValue("CodeBase", AssemblyName); + } + else + { + key.SetValue("CodeBase", "$PackageFolder$\\" + AssemblyName); + } } key.Close(); } From 45a2b2aa9b559012a1cc25df987035d4665e4cc7 Mon Sep 17 00:00:00 2001 From: Pawel Hofman Date: Wed, 25 Jun 2014 00:26:11 +0200 Subject: [PATCH 284/851] Moving files to revert project dependencies --- .../ControlDebugEngine.cs => DebugEngine/DebugEngineStatus.cs} | 0 .../{Package => NativeCore}/Helpers/NameValueCollectionHelper.cs | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename src_vs2010/{Package/ControlDebugEngine.cs => DebugEngine/DebugEngineStatus.cs} (100%) rename src_vs2012/{Package => NativeCore}/Helpers/NameValueCollectionHelper.cs (100%) diff --git a/src_vs2010/Package/ControlDebugEngine.cs b/src_vs2010/DebugEngine/DebugEngineStatus.cs similarity index 100% rename from src_vs2010/Package/ControlDebugEngine.cs rename to src_vs2010/DebugEngine/DebugEngineStatus.cs diff --git a/src_vs2012/Package/Helpers/NameValueCollectionHelper.cs b/src_vs2012/NativeCore/Helpers/NameValueCollectionHelper.cs similarity index 100% rename from src_vs2012/Package/Helpers/NameValueCollectionHelper.cs rename to src_vs2012/NativeCore/Helpers/NameValueCollectionHelper.cs From b59f073e1a06591d57a71fa8b039f65b99c34604 Mon Sep 17 00:00:00 2001 From: Pawel Hofman Date: Wed, 25 Jun 2014 00:44:26 +0200 Subject: [PATCH 285/851] Finished reverting project dependencies --- src_vs2010/DebugEngine/AD7.Impl/AD7Engine.cs | 13 ++++++------- .../DebugEngine/AD7.Impl/AD7PendingBreakpoint.cs | 3 +-- .../DebugEngine/AD7.Impl/AD7PortSupplier.cs | 2 +- .../DebugEngine/BlackBerry.DebugEngine.csproj | 10 ++++------ src_vs2010/DebugEngine/DebugEngineStatus.cs | 13 ++++++++++--- .../DebugEngine/Engine.Impl/EventDispatcher.cs | 7 +++---- .../NativeCore/BlackBerry.NativeCore.csproj | 3 +++ src_vs2010/Package/BlackBerry.Package.csproj | 8 ++++---- .../DebugEngine/BlackBerry.DebugEngine.csproj | 13 +++++++------ .../NativeCore/BlackBerry.NativeCore.csproj | 1 + src_vs2012/NativeCore/Helpers/GlobalHelper.cs | 2 +- .../Helpers/NameValueCollectionHelper.cs | 15 +++++---------- src_vs2012/NativeCore/Model/NdkDefinition.cs | 2 +- src_vs2012/Package/BlackBerry.Package.csproj | 8 ++++---- src_vs2012/Package/BlackBerryPackage.cs | 4 +++- .../DebugEngine/BlackBerry.DebugEngine.csproj | 12 ++++++------ .../NativeCore/BlackBerry.NativeCore.csproj | 3 +++ src_vs2013/Package/BlackBerry.Package.csproj | 10 ++++------ 18 files changed, 67 insertions(+), 62 deletions(-) diff --git a/src_vs2010/DebugEngine/AD7.Impl/AD7Engine.cs b/src_vs2010/DebugEngine/AD7.Impl/AD7Engine.cs index fb95c9ca..0ab6139f 100644 --- a/src_vs2010/DebugEngine/AD7.Impl/AD7Engine.cs +++ b/src_vs2010/DebugEngine/AD7.Impl/AD7Engine.cs @@ -15,8 +15,7 @@ using System; using System.Runtime.InteropServices; using BlackBerry.NativeCore; -using BlackBerry.Package; -using BlackBerry.Package.Helpers; +using BlackBerry.NativeCore.Helpers; using Microsoft.VisualStudio; using Microsoft.VisualStudio.Debugger.Interop; using System.Diagnostics; @@ -226,7 +225,7 @@ int IDebugEngine2.Attach(IDebugProgram2[] rgpPrograms, IDebugProgramNode2[] rgpP // by LaunchSuspended and ResumeProcess methods when debugging an open project. if (m_engineCallback == null) { - ControlDebugEngine.isDebugEngineRunning = true; + DebugEngineStatus.IsRunning = true; m_engineCallback = new EngineCallback(this, ad7Callback); AD7ProgramNodeAttach pnt = (AD7ProgramNodeAttach)m_program; @@ -281,7 +280,7 @@ int IDebugEngine2.Attach(IDebugProgram2[] rgpPrograms, IDebugProgramNode2[] rgpP else { GDBParser.exitGDB(); - ControlDebugEngine.isDebugEngineRunning = false; + DebugEngineStatus.IsRunning = false; return VSConstants.E_FAIL; } } @@ -334,7 +333,7 @@ int IDebugEngine2.CauseBreak() m_running.Set(); - if (ControlDebugEngine.isDebugEngineRunning) + if (DebugEngineStatus.IsRunning) HandleProcessExecution.m_mre.Reset(); } } @@ -568,7 +567,7 @@ int IDebugEngineLaunch2.LaunchSuspended(string pszServer, IDebugPort2 port, stri try { - ControlDebugEngine.isDebugEngineRunning = true; + DebugEngineStatus.IsRunning = true; m_engineCallback = new EngineCallback(this, ad7Callback); // Read arguments back from the args string @@ -604,7 +603,7 @@ int IDebugEngineLaunch2.LaunchSuspended(string pszServer, IDebugPort2 port, stri else { GDBParser.exitGDB(); - ControlDebugEngine.isDebugEngineRunning = false; + DebugEngineStatus.IsRunning = false; return VSConstants.E_FAIL; } } diff --git a/src_vs2010/DebugEngine/AD7.Impl/AD7PendingBreakpoint.cs b/src_vs2010/DebugEngine/AD7.Impl/AD7PendingBreakpoint.cs index 65e737b5..cfb573ca 100644 --- a/src_vs2010/DebugEngine/AD7.Impl/AD7PendingBreakpoint.cs +++ b/src_vs2010/DebugEngine/AD7.Impl/AD7PendingBreakpoint.cs @@ -15,7 +15,6 @@ using System; using System.Collections.Generic; using System.Runtime.InteropServices; -using BlackBerry.Package; using Microsoft.VisualStudio; using Microsoft.VisualStudio.Debugger.Interop; using System.Text; @@ -171,7 +170,7 @@ int IDebugPendingBreakpoint2.Bind() // Visual Studio returns a start position that is one less than it actually is xBBP = new AD7BoundBreakpoint(m_engine, m_bpRequestInfo, this); - if (ControlDebugEngine.isDebugEngineRunning == false) + if (DebugEngineStatus.IsRunning == false) { return VSConstants.S_FALSE; } diff --git a/src_vs2010/DebugEngine/AD7.Impl/AD7PortSupplier.cs b/src_vs2010/DebugEngine/AD7.Impl/AD7PortSupplier.cs index 44eb03c8..e13ae02a 100644 --- a/src_vs2010/DebugEngine/AD7.Impl/AD7PortSupplier.cs +++ b/src_vs2010/DebugEngine/AD7.Impl/AD7PortSupplier.cs @@ -134,7 +134,7 @@ private int verifyAndAddPorts() } catch (Exception ex) { - System.Windows.Forms.MessageBox.Show(ex.Message, "Microsoft Visual Studio", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error); + MessageBox.Show(ex.Message, "Microsoft Visual Studio", System.Windows.Forms.MessageBoxButtons.OK, MessageBoxIcon.Error); } rkPluginRegKey.Close(); diff --git a/src_vs2010/DebugEngine/BlackBerry.DebugEngine.csproj b/src_vs2010/DebugEngine/BlackBerry.DebugEngine.csproj index 9cb82aaa..425c090a 100644 --- a/src_vs2010/DebugEngine/BlackBerry.DebugEngine.csproj +++ b/src_vs2010/DebugEngine/BlackBerry.DebugEngine.csproj @@ -68,9 +68,6 @@ - - ConfigDefaults.cs - @@ -94,6 +91,7 @@ + @@ -105,9 +103,9 @@ {CC7B28E0-CB31-44F7-A380-E7072F670F38} GDBParser - - {3D6EFFAF-FF39-497D-B6F8-0B6169E90C6D} - BlackBerry.Package + + {36D4495B-9A92-478F-BF95-AEA13804A7BA} + BlackBerry.NativeCore diff --git a/src_vs2010/DebugEngine/DebugEngineStatus.cs b/src_vs2010/DebugEngine/DebugEngineStatus.cs index a9955125..76159c3f 100644 --- a/src_vs2010/DebugEngine/DebugEngineStatus.cs +++ b/src_vs2010/DebugEngine/DebugEngineStatus.cs @@ -1,7 +1,14 @@ -namespace BlackBerry.Package +namespace BlackBerry.DebugEngine { - public static class ControlDebugEngine + public static class DebugEngineStatus { - public static bool isDebugEngineRunning = false; + /// + /// Gets or sets an indication, if the DebugEngine is running. + /// + public static bool IsRunning + { + get; + set; + } } } diff --git a/src_vs2010/DebugEngine/Engine.Impl/EventDispatcher.cs b/src_vs2010/DebugEngine/Engine.Impl/EventDispatcher.cs index ab92c8db..75bba30e 100644 --- a/src_vs2010/DebugEngine/Engine.Impl/EventDispatcher.cs +++ b/src_vs2010/DebugEngine/Engine.Impl/EventDispatcher.cs @@ -15,7 +15,6 @@ using System; using System.Collections.Generic; using System.Diagnostics; -using BlackBerry.Package; using Microsoft.VisualStudio.Debugger.Interop; using VSNDK.Parser; using System.Threading; @@ -117,7 +116,7 @@ public void endDebugSession(uint exitCode) GDBParser.exitGDB(); // Notify the AddIn that this debug session has ended. - ControlDebugEngine.isDebugEngineRunning = false; + DebugEngineStatus.IsRunning = false; } @@ -290,7 +289,7 @@ private bool setBreakpointImpl(string command, string command2, out uint GDB_ID, GDB_address = ""; GDB_line = 0; - if (ControlDebugEngine.isDebugEngineRunning) + if (DebugEngineStatus.IsRunning) { prepareToModifyBreakpoint(); @@ -303,7 +302,7 @@ private bool setBreakpointImpl(string command, string command2, out uint GDB_ID, response = GDBParser.parseCommand(command2, 6); } - if (((response.Length < 2) && (ControlDebugEngine.isDebugEngineRunning == false)) || (response == "Function not found!")) + if (((response.Length < 2) && (DebugEngineStatus.IsRunning == false)) || (response == "Function not found!")) { resumeFromInterrupt(); return false; diff --git a/src_vs2010/NativeCore/BlackBerry.NativeCore.csproj b/src_vs2010/NativeCore/BlackBerry.NativeCore.csproj index 4166067d..7ae4f547 100644 --- a/src_vs2010/NativeCore/BlackBerry.NativeCore.csproj +++ b/src_vs2010/NativeCore/BlackBerry.NativeCore.csproj @@ -71,6 +71,9 @@ Helpers\GlobalHelper.cs + + Helpers\NameValueCollectionHelper.cs + Model\ApiInfo.cs diff --git a/src_vs2010/Package/BlackBerry.Package.csproj b/src_vs2010/Package/BlackBerry.Package.csproj index 5c972cd4..07d1078c 100644 --- a/src_vs2010/Package/BlackBerry.Package.csproj +++ b/src_vs2010/Package/BlackBerry.Package.csproj @@ -184,9 +184,6 @@ Helpers\MessageBoxHelper.cs - - Helpers\NameValueCollectionHelper.cs - Model\bar-descriptor.cs @@ -399,7 +396,6 @@ ViewModels\TargetsOptionViewModel.cs - Import.xaml @@ -608,6 +604,10 @@ + + {59A7B188-E307-4495-A3AF-4ED76B086A87} + BlackBerry.DebugEngine + {CC7B28E0-CB31-44F7-A380-E7072F670F38} GDBParser diff --git a/src_vs2012/DebugEngine/BlackBerry.DebugEngine.csproj b/src_vs2012/DebugEngine/BlackBerry.DebugEngine.csproj index 976f4120..71c061bb 100644 --- a/src_vs2012/DebugEngine/BlackBerry.DebugEngine.csproj +++ b/src_vs2012/DebugEngine/BlackBerry.DebugEngine.csproj @@ -78,9 +78,9 @@ {cc7b28e0-cb31-44f7-a380-e7072f670f38} GDBParser - - {3d6effaf-ff39-497d-b6f8-0b6169e90c6d} - BlackBerry.Package + + {faddd789-6cb5-4f9d-8481-1c0c72e5f19f} + BlackBerry.NativeCore @@ -153,6 +153,9 @@ AD7.Impl\AD7Thread.cs + + DebugEngineStatus.cs + Engine.Impl\BreakpointManager.cs @@ -168,10 +171,8 @@ Properties\AssemblyInfo.cs - - ConfigDefaults.cs - + diff --git a/src_vs2012/NativeCore/BlackBerry.NativeCore.csproj b/src_vs2012/NativeCore/BlackBerry.NativeCore.csproj index 96849ba4..e59d734e 100644 --- a/src_vs2012/NativeCore/BlackBerry.NativeCore.csproj +++ b/src_vs2012/NativeCore/BlackBerry.NativeCore.csproj @@ -53,6 +53,7 @@ + diff --git a/src_vs2012/NativeCore/Helpers/GlobalHelper.cs b/src_vs2012/NativeCore/Helpers/GlobalHelper.cs index d6d31439..f16a33f1 100644 --- a/src_vs2012/NativeCore/Helpers/GlobalHelper.cs +++ b/src_vs2012/NativeCore/Helpers/GlobalHelper.cs @@ -21,7 +21,7 @@ public static bool IsOnline { try { - var ipHostEntry = Dns.GetHostEntry("downloads.blackberry.com"); + Dns.GetHostEntry("downloads.blackberry.com"); return true; } catch (SocketException) diff --git a/src_vs2012/NativeCore/Helpers/NameValueCollectionHelper.cs b/src_vs2012/NativeCore/Helpers/NameValueCollectionHelper.cs index eeb88f46..a365f233 100644 --- a/src_vs2012/NativeCore/Helpers/NameValueCollectionHelper.cs +++ b/src_vs2012/NativeCore/Helpers/NameValueCollectionHelper.cs @@ -16,34 +16,29 @@ using System.Text; using System.Collections.Specialized; -namespace BlackBerry.Package.Helpers +namespace BlackBerry.NativeCore.Helpers { /// - /// + /// Helper class in managing key-value collection. /// public static class NameValueCollectionHelper { - /// - /// + /// Dumps given collection into a single string. /// - /// - /// public static string DumpToString(NameValueCollection value) { var xSB = new StringBuilder(); foreach (string xKey in value.Keys) { - xSB.AppendFormat("{0}={1};", xKey, (string)value[xKey]); + xSB.AppendFormat("{0}={1};", xKey, value[xKey]); } return xSB.ToString(); } /// - /// + /// Updates the collection with a value parsed out from a given string. /// - /// - /// public static void LoadFromString(NameValueCollection target, string value) { if (target.Count > 0) diff --git a/src_vs2012/NativeCore/Model/NdkDefinition.cs b/src_vs2012/NativeCore/Model/NdkDefinition.cs index 0ad41408..c02899fd 100644 --- a/src_vs2012/NativeCore/Model/NdkDefinition.cs +++ b/src_vs2012/NativeCore/Model/NdkDefinition.cs @@ -66,7 +66,7 @@ public static NdkDefinition Load() } catch { - // no pluging info found at all... + // no plugin info found at all... return null; } if (settings == null) diff --git a/src_vs2012/Package/BlackBerry.Package.csproj b/src_vs2012/Package/BlackBerry.Package.csproj index c645b626..8e538d9e 100644 --- a/src_vs2012/Package/BlackBerry.Package.csproj +++ b/src_vs2012/Package/BlackBerry.Package.csproj @@ -151,9 +151,6 @@ - - ControlDebugEngine.cs - GlobalSuppressions.cs @@ -188,7 +185,6 @@ - @@ -555,6 +551,10 @@ + + {59a7b188-e307-4495-a3af-4ed76b086a87} + BlackBerry.DebugEngine + {cc7b28e0-cb31-44f7-a380-e7072f670f38} GDBParser diff --git a/src_vs2012/Package/BlackBerryPackage.cs b/src_vs2012/Package/BlackBerryPackage.cs index 7c9e6d2e..6e98667e 100644 --- a/src_vs2012/Package/BlackBerryPackage.cs +++ b/src_vs2012/Package/BlackBerryPackage.cs @@ -17,8 +17,10 @@ using System.Globalization; using System.Runtime.InteropServices; using System.ComponentModel.Design; +using BlackBerry.DebugEngine; using BlackBerry.NativeCore; using BlackBerry.NativeCore.Diagnostics; +using BlackBerry.NativeCore.Helpers; using BlackBerry.NativeCore.Model; using BlackBerry.NativeCore.Tools; using BlackBerry.Package.Components; @@ -885,7 +887,7 @@ private void StartDebugCommandEvents_BeforeExecute(string guid, int id, object c Debug.WriteLine("Before Start Debug"); - if (ControlDebugEngine.isDebugEngineRunning || !bbPlatform) + if (DebugEngineStatus.IsRunning || !bbPlatform) { // Disable the override of F5 (this allows the debugged process to continue execution) cancelDefault = false; diff --git a/src_vs2013/DebugEngine/BlackBerry.DebugEngine.csproj b/src_vs2013/DebugEngine/BlackBerry.DebugEngine.csproj index 06562c0d..c75f06b3 100644 --- a/src_vs2013/DebugEngine/BlackBerry.DebugEngine.csproj +++ b/src_vs2013/DebugEngine/BlackBerry.DebugEngine.csproj @@ -143,6 +143,9 @@ AD7.Impl\AD7Thread.cs + + DebugEngineStatus.cs + Engine.Impl\BreakpointManager.cs @@ -158,18 +161,15 @@ Properties\AssemblyInfo.cs - - ConfigDefaults.cs - {CC7B28E0-CB31-44F7-A380-E7072F670F38} GDBParser - - {3d6effaf-ff39-497d-b6f8-0b6169e90c6d} - BlackBerry.Package + + {ae6bee3e-3273-4214-a215-2924e33246ca} + BlackBerry.NativeCore diff --git a/src_vs2013/NativeCore/BlackBerry.NativeCore.csproj b/src_vs2013/NativeCore/BlackBerry.NativeCore.csproj index 84c386c9..aad07acf 100644 --- a/src_vs2013/NativeCore/BlackBerry.NativeCore.csproj +++ b/src_vs2013/NativeCore/BlackBerry.NativeCore.csproj @@ -66,6 +66,9 @@ Helpers\GlobalHelper.cs + + Helpers\NameValueCollectionHelper.cs + Model\ApiInfo.cs diff --git a/src_vs2013/Package/BlackBerry.Package.csproj b/src_vs2013/Package/BlackBerry.Package.csproj index b546331b..f9b979be 100644 --- a/src_vs2013/Package/BlackBerry.Package.csproj +++ b/src_vs2013/Package/BlackBerry.Package.csproj @@ -126,9 +126,6 @@ - - ControlDebugEngine.cs - GlobalSuppressions.cs @@ -188,9 +185,6 @@ Helpers\MessageBoxHelper.cs - - Helpers\NameValueCollectionHelper.cs - Model\bar-descriptor.cs @@ -674,6 +668,10 @@ + + {59a7b188-e307-4495-a3af-4ed76b086a87} + BlackBerry.DebugEngine + {cc7b28e0-cb31-44f7-a380-e7072f670f38} GDBParser From 901b98c9c039e388ecc2cd89aab8562a66d35a2d Mon Sep 17 00:00:00 2001 From: Pawel Hofman Date: Wed, 25 Jun 2014 02:04:42 +0200 Subject: [PATCH 286/851] Simplified AD7PortRequest and AD7PortSupplier --- src_vs2010/DebugEngine/AD7.Impl/AD7Engine.cs | 5 +- src_vs2010/DebugEngine/AD7.Impl/AD7Enums.cs | 9 +- .../DebugEngine/AD7.Impl/AD7PortRequest.cs | 40 +++- .../DebugEngine/AD7.Impl/AD7PortSupplier.cs | 211 +++++------------- src_vs2010/DebugEngine/AD7.Impl/AD7Thread.cs | 2 +- src_vs2010/Package/BlackBerry.Package.csproj | 1 + src_vs2012/NativeCore/Model/NdkDefinition.cs | 5 + src_vs2012/Package/BlackBerry.Package.csproj | 1 + src_vs2012/Package/BlackBerryPackage.cs | 2 +- src_vs2013/Package/BlackBerry.Package.csproj | 1 + 10 files changed, 93 insertions(+), 184 deletions(-) diff --git a/src_vs2010/DebugEngine/AD7.Impl/AD7Engine.cs b/src_vs2010/DebugEngine/AD7.Impl/AD7Engine.cs index 0ab6139f..9e9f800b 100644 --- a/src_vs2010/DebugEngine/AD7.Impl/AD7Engine.cs +++ b/src_vs2010/DebugEngine/AD7.Impl/AD7Engine.cs @@ -153,8 +153,7 @@ public AD7Thread[] thread /// - /// This is the engine GUID of the VSNDK debug engine. It needs to be changed here and in the registration when creating a - /// new engine. + /// This is the engine GUID of the VSNDK debug engine. It needs to be changed here and in the registration when creating a new engine. /// public const string Id = "{E5A37609-2F43-4830-AA85-D94CFA035DD2}"; @@ -178,7 +177,7 @@ public enum DE_STATE /// public AD7Engine() { - m_breakpointManager = new BreakpointManager(this); + m_breakpointManager = new BreakpointManager(this); m_state = DE_STATE.DESIGN_MODE; } diff --git a/src_vs2010/DebugEngine/AD7.Impl/AD7Enums.cs b/src_vs2010/DebugEngine/AD7.Impl/AD7Enums.cs index f519acc1..1f4b2c75 100644 --- a/src_vs2010/DebugEngine/AD7.Impl/AD7Enums.cs +++ b/src_vs2010/DebugEngine/AD7.Impl/AD7Enums.cs @@ -166,7 +166,6 @@ public AD7ProcessEnum(IDebugProcess2[] data) { } - /// /// Returns the next set of elements from the enumeration. (http://msdn.microsoft.com/en-ca/library/bb147027.aspx) /// @@ -180,13 +179,11 @@ public int Next(uint celt, IDebugProcess2[] rgelt, ref uint celtFetched) } } - /// /// This class enumerates the ports of a machine or port supplier. (http://msdn.microsoft.com/en-ca/library/bb145137.aspx) /// - class AD7PortEnum : AD7Enum, IEnumDebugPorts2 + sealed class AD7PortEnum : AD7Enum, IEnumDebugPorts2 { - /// /// Constructor. /// @@ -196,7 +193,6 @@ public AD7PortEnum(IDebugPort2[] data) { } - /// /// Returns the next set of elements from the enumeration. (http://msdn.microsoft.com/en-ca/library/bb147027.aspx) /// @@ -210,9 +206,6 @@ public int Next(uint celt, IDebugPort2[] rgelt, ref uint celtFetched) } } - - - /// /// This class enumerates the programs running in the current debug session. (http://msdn.microsoft.com/en-ca/library/bb146727.aspx) /// diff --git a/src_vs2010/DebugEngine/AD7.Impl/AD7PortRequest.cs b/src_vs2010/DebugEngine/AD7.Impl/AD7PortRequest.cs index 50fbe748..83074cf0 100644 --- a/src_vs2010/DebugEngine/AD7.Impl/AD7PortRequest.cs +++ b/src_vs2010/DebugEngine/AD7.Impl/AD7PortRequest.cs @@ -12,6 +12,8 @@ //* See the License for the specific language governing permissions and //* limitations under the License. +using System; +using BlackBerry.NativeCore.Model; using Microsoft.VisualStudio; using Microsoft.VisualStudio.Debugger.Interop; @@ -22,24 +24,40 @@ namespace BlackBerry.DebugEngine /// /// It implements IDebugPortRequest2 (http://msdn.microsoft.com/en-us/library/bb146168.aspx) /// - public class AD7PortRequest : IDebugPortRequest2 + public sealed class AD7PortRequest : IDebugPortRequest2 { /// - /// The name of the port to be created. + /// Constructor. /// - private string m_name; + /// The name of the port. + /// Detailed info about the device. + public AD7PortRequest(string name, DeviceDefinition device) + { + if (string.IsNullOrEmpty(name)) + throw new ArgumentNullException("name"); + if (device == null) + throw new ArgumentNullException("device"); + Name = name; + Device = device; + } - /// - /// Constructor. - /// - /// The name of the port. It is contains the IP and password of the Device/Simulator. The password must be - /// removed when creating the port because this name will be displayed in Attach to Process UI. - public AD7PortRequest(string name) + #region Properties + + public string Name + { + get; + private set; + } + + public DeviceDefinition Device { - m_name = name; + get; + private set; } + #endregion + #region Implementation of IDebugPortRequest2 /// @@ -49,7 +67,7 @@ public AD7PortRequest(string name) /// VSConstants.S_OK. public int GetPortName(out string portName) { - portName = m_name; + portName = Name; return VSConstants.S_OK; } diff --git a/src_vs2010/DebugEngine/AD7.Impl/AD7PortSupplier.cs b/src_vs2010/DebugEngine/AD7.Impl/AD7PortSupplier.cs index e13ae02a..074f61f1 100644 --- a/src_vs2010/DebugEngine/AD7.Impl/AD7PortSupplier.cs +++ b/src_vs2010/DebugEngine/AD7.Impl/AD7PortSupplier.cs @@ -14,14 +14,11 @@ using System; using System.Collections.Generic; -using System.Linq; -using System.Text; +using BlackBerry.NativeCore.Model; using Microsoft.VisualStudio.Debugger.Interop; using System.Runtime.InteropServices; using Microsoft.VisualStudio; -using Microsoft.Win32; using System.Windows.Forms; -using System.Security.Cryptography; using VSNDK.Parser; namespace BlackBerry.DebugEngine @@ -38,147 +35,71 @@ namespace BlackBerry.DebugEngine /// It is needed to enable updating the list of processes in the "attach to process" user interface. /// [ComVisible(true)] - [Guid("BDC2218C-D50C-4A5A-A2F6-66BDC94FF8D6")] - public class AD7PortSupplier : IDebugPortSupplier2, IDebugPortSupplierDescription2 + [Guid(ClassGuid)] + public sealed class AD7PortSupplier : IDebugPortSupplier2, IDebugPortSupplierDescription2 { + public const string PublicName = "BlackBerry Native Debugger"; + public const string ClassGuid = "BDC2218C-D50C-4A5A-A2F6-66BDC94FF8D6"; + public const string ClassName = "BlackBerry.DebugEngine.AD7PortSupplier"; - /// - /// The name of the port supplier. - /// - private string m_name; - - /// - /// The description for the port supplier. - /// - private string m_description; + private const string DevicePortGuid = "{69519DBB-5329-4CCE-88A9-EC1628AD99C2}"; + private const string SimulatorPortGuid = "{25040BDD-6683-4D5C-8EFA-EB4DDF5CA08E}"; /// /// The NDK host path. /// - private string m_toolsPath = ""; + private string _toolsPath = ""; /// /// List of ports for this port supplier. /// - Dictionary m_ports = new Dictionary(); - + private readonly Dictionary _ports = new Dictionary(); - /// - /// Constructor. - /// - public AD7PortSupplier() + private int VerifyAndAddPorts() { - m_name = "BlackBerry Native Debugger"; - m_description = "The BlackBerry transport lets you select a process that is running in a BlackBerry Device/Simulator"; - } - - private int verifyAndAddPorts() - { - if (GDBParser.s_running == true) // Returning because VS can debug only one app at a time. + // Returning because VS can debug only one app at a time. + if (GDBParser.s_running) return 0; - RegistryKey rkHKCU = Registry.CurrentUser; - RegistryKey rkPluginRegKey = null; - string DeviceIP = ""; - string DevicePassword = ""; - string SimulatorIP = ""; - string SimulatorPassword = ""; - - try - { - rkPluginRegKey = rkHKCU.OpenSubKey("Software\\BlackBerry\\BlackBerryVSPlugin"); - m_toolsPath = rkPluginRegKey.GetValue("NDKHostPath").ToString(); - - if ((m_toolsPath == null) || (m_toolsPath == "")) - return -1; - - m_toolsPath += "/usr/bin"; - - DeviceIP = rkPluginRegKey.GetValue("device_IP").ToString(); - if ((DeviceIP != "") && (DeviceIP != null)) - { - DevicePassword = rkPluginRegKey.GetValue("device_password").ToString(); - if ((DevicePassword != "") && (DevicePassword != null)) - { - try - { - DevicePassword = Decrypt(DevicePassword); - } - catch - { - DevicePassword = ""; - } - } - if (DevicePassword == "") - { - MessageBox.Show("Missing Device password", "Missing Device Password", MessageBoxButtons.OK, MessageBoxIcon.Information); - } - } - else - { - DeviceIP = ""; - } - SimulatorIP = rkPluginRegKey.GetValue("simulator_IP").ToString(); - SimulatorPassword = rkPluginRegKey.GetValue("simulator_password").ToString(); - if ((SimulatorPassword != "") && (SimulatorPassword != null)) - { - try - { - SimulatorPassword = Decrypt(SimulatorPassword); - } - catch - { - SimulatorPassword = ""; - } - } - } - catch (Exception ex) - { - MessageBox.Show(ex.Message, "Microsoft Visual Studio", System.Windows.Forms.MessageBoxButtons.OK, MessageBoxIcon.Error); - } + var ndk = NdkDefinition.Load(); + var device = DeviceDefinition.Load(DeviceDefinitionType.Device); + var simulator = DeviceDefinition.Load(DeviceDefinitionType.Simulator); - rkPluginRegKey.Close(); - rkHKCU.Close(); + if (ndk == null || string.IsNullOrEmpty(ndk.ToolsPath)) + return -1; + _toolsPath = ndk.ToolsPath; - if ((DeviceIP != "") && (DevicePassword != "")) + if (device != null) { IDebugPort2 p; - AddPort(new AD7PortRequest("Device: " + DeviceIP + "-" + DevicePassword), out p); + AddPort(new AD7PortRequest("Device: " + device.IP, device), out p); } - if (SimulatorIP != "") + if (simulator != null) { IDebugPort2 p; - AddPort(new AD7PortRequest("Simulator: " + SimulatorIP + "-" + SimulatorPassword), out p); + AddPort(new AD7PortRequest("Simulator: " + simulator.IP, simulator), out p); } return 1; } - /// /// Creates an AD7Port. /// - /// Port request. - /// Returns an AD7Port. - AD7Port CreatePort(AD7PortRequest port_request) + /// Port request + /// Returns an AD7Port + AD7Port CreatePort(AD7PortRequest request) { - string portname; - Guid guid; - bool isSimulator = false; - port_request.GetPortName(out portname); - string password = portname.Substring(portname.IndexOf('-') + 1); - portname = portname.Remove(portname.IndexOf('-')); - if (portname.Substring(0, 6) == "Device") - guid = new Guid("{69519DBB-5329-4CCE-88A9-EC1628AD99C2}"); - else - { - guid = new Guid("{25040BDD-6683-4D5C-8EFA-EB4DDF5CA08E}"); - isSimulator = true; - } + if (request == null) + throw new ArgumentNullException("request"); + if (request.Device == null) + throw new ArgumentOutOfRangeException("request"); - return new AD7Port(this, port_request, guid, portname, password, isSimulator, m_toolsPath); - } + bool isSimulator = request.Device.Type == DeviceDefinitionType.Simulator; + var guid = isSimulator ? new Guid(SimulatorPortGuid) : new Guid(DevicePortGuid); + return new AD7Port(this, request, guid, request.Name, request.Device.Password, isSimulator, _toolsPath); + } #region Implementation of IDebugPortSupplier2 @@ -190,20 +111,21 @@ AD7Port CreatePort(AD7PortRequest port_request) /// VSConstants.S_OK. public int AddPort(IDebugPortRequest2 pRequest, out IDebugPort2 ppPort) { - bool sucess = true; + bool success = true; AD7PortRequest port_request = null; AD7Port port = null; + try { port_request = (AD7PortRequest)pRequest; } catch { - sucess = false; + success = false; string portRequestName; AD7Port defaultPort = null; pRequest.GetPortName(out portRequestName); - string search = ""; + string search; if (portRequestName.ToLower().Contains("device")) search = "device"; else if (portRequestName.ToLower().Contains("simulator")) @@ -212,13 +134,13 @@ public int AddPort(IDebugPortRequest2 pRequest, out IDebugPort2 ppPort) { search = portRequestName.ToLower(); } - foreach (var p in m_ports) + foreach (var p in _ports) { AD7Port tempPort = p.Value; if (defaultPort == null) defaultPort = tempPort; - string tempPortName = ""; + string tempPortName; tempPort.GetPortName(out tempPortName); if (tempPortName.ToLower().Contains(search)) { @@ -257,12 +179,12 @@ public int AddPort(IDebugPortRequest2 pRequest, out IDebugPort2 ppPort) port = new AD7Port(this, port_request, Guid.NewGuid(), "", "", true, ""); } } - if (sucess) + if (success) { port = CreatePort(port_request); Guid portGuid; port.GetPortId(out portGuid); - m_ports.Add(portGuid, port); + _ports.Add(portGuid, port); } ppPort = port; return VSConstants.S_OK; @@ -278,7 +200,6 @@ public int CanAddPort() return VSConstants.S_OK; } - /// /// Retrieves a list of all the ports supplied by a port supplier. (http://msdn.microsoft.com/en-ca/library/bb146984.aspx) /// @@ -286,14 +207,14 @@ public int CanAddPort() /// VSConstants.S_OK. public int EnumPorts(out IEnumDebugPorts2 ppEnum) { - m_ports.Clear(); - int success = verifyAndAddPorts(); - AD7Port[] ports = new AD7Port[m_ports.Count()]; + _ports.Clear(); + int success = VerifyAndAddPorts(); + AD7Port[] ports = new AD7Port[_ports.Count]; - if (m_ports.Count() > 0) + if (_ports.Count > 0) { int i = 0; - foreach (var p in m_ports) + foreach (var p in _ports) { ports[i] = p.Value; i++; @@ -313,7 +234,6 @@ public int EnumPorts(out IEnumDebugPorts2 ppEnum) return VSConstants.S_OK; } - /// /// Gets a port from a port supplier. (http://msdn.microsoft.com/en-ca/library/bb161812.aspx) /// @@ -322,11 +242,10 @@ public int EnumPorts(out IEnumDebugPorts2 ppEnum) /// VSConstants.S_OK. public int GetPort(ref Guid guidPort, out IDebugPort2 ppPort) { - ppPort = m_ports[guidPort]; + ppPort = _ports[guidPort]; return VSConstants.S_OK; } - /// /// Gets the port supplier identifier. (http://msdn.microsoft.com/en-ca/library/bb146617.aspx) /// @@ -334,11 +253,10 @@ public int GetPort(ref Guid guidPort, out IDebugPort2 ppPort) /// VSConstants.S_OK. public int GetPortSupplierId(out Guid pguidPortSupplier) { - pguidPortSupplier = this.GetType().GUID; + pguidPortSupplier = new Guid(ClassGuid); return VSConstants.S_OK; } - /// /// Gets the port supplier name. (http://msdn.microsoft.com/en-ca/library/bb162136.aspx) /// @@ -346,11 +264,10 @@ public int GetPortSupplierId(out Guid pguidPortSupplier) /// VSConstants.S_OK. public int GetPortSupplierName(out string pbstrName) { - pbstrName = m_name; + pbstrName = PublicName; return VSConstants.S_OK; } - /// /// Removes a port. Not implemented. (http://msdn.microsoft.com/en-ca/library/bb162306.aspx) /// @@ -363,7 +280,6 @@ public int RemovePort(IDebugPort2 pPort) #endregion - #region Implementation of IDebugPortSupplierDescription2 /// @@ -374,35 +290,10 @@ public int RemovePort(IDebugPort2 pPort) /// VSConstants.S_OK. public int GetDescription(enum_PORT_SUPPLIER_DESCRIPTION_FLAGS[] pdwFlags, out string pbstrText) { - pbstrText = m_description; + pbstrText = "The BlackBerry Native Transport lets you select and attach to a process that is running on a device or simulator"; return VSConstants.S_OK; } #endregion - - /// - /// Decrypts a given string. - /// - /// A base64 encoded string that was created - /// through the or - /// extension methods. - /// The decrypted string. - /// Keep in mind that the decrypted string remains in memory - /// and makes your application vulnerable per se. If runtime protection - /// is essential, should be used. - /// If - /// is a null reference. - public string Decrypt(string cipher) - { - if (cipher == null) throw new ArgumentNullException("cipher"); - - //parse base64 string - byte[] data = Convert.FromBase64String(cipher); - - //decrypt data - byte[] decrypted = ProtectedData.Unprotect(data, null, DataProtectionScope.LocalMachine); - - return Encoding.Unicode.GetString(decrypted); - } } } \ No newline at end of file diff --git a/src_vs2010/DebugEngine/AD7.Impl/AD7Thread.cs b/src_vs2010/DebugEngine/AD7.Impl/AD7Thread.cs index 0055bed0..722a40e9 100644 --- a/src_vs2010/DebugEngine/AD7.Impl/AD7Thread.cs +++ b/src_vs2010/DebugEngine/AD7.Impl/AD7Thread.cs @@ -48,7 +48,7 @@ public class AD7Thread : IDebugThread2, IDebugThread100 /// /// The AD7Engine object that represents the DE. /// - public AD7Engine _engine = null; + public AD7Engine _engine; /// /// Thread's name. diff --git a/src_vs2010/Package/BlackBerry.Package.csproj b/src_vs2010/Package/BlackBerry.Package.csproj index 07d1078c..fd5bdd74 100644 --- a/src_vs2010/Package/BlackBerry.Package.csproj +++ b/src_vs2010/Package/BlackBerry.Package.csproj @@ -53,6 +53,7 @@ + diff --git a/src_vs2012/NativeCore/Model/NdkDefinition.cs b/src_vs2012/NativeCore/Model/NdkDefinition.cs index c02899fd..7cf2b2fe 100644 --- a/src_vs2012/NativeCore/Model/NdkDefinition.cs +++ b/src_vs2012/NativeCore/Model/NdkDefinition.cs @@ -40,6 +40,11 @@ public string TargetPath private set; } + public string ToolsPath + { + get { return string.IsNullOrEmpty(HostPath) ? null : Path.Combine(HostPath, "usr", "bin"); } + } + public DeviceFamilyType Type { get; diff --git a/src_vs2012/Package/BlackBerry.Package.csproj b/src_vs2012/Package/BlackBerry.Package.csproj index 8e538d9e..f8ab86c7 100644 --- a/src_vs2012/Package/BlackBerry.Package.csproj +++ b/src_vs2012/Package/BlackBerry.Package.csproj @@ -65,6 +65,7 @@ + False diff --git a/src_vs2012/Package/BlackBerryPackage.cs b/src_vs2012/Package/BlackBerryPackage.cs index 6e98667e..4c70dd19 100644 --- a/src_vs2012/Package/BlackBerryPackage.cs +++ b/src_vs2012/Package/BlackBerryPackage.cs @@ -75,7 +75,7 @@ namespace BlackBerry.Package Attach = true, AddressBreakpoints = false, CallstackBreakpoints = true, AlwaysLoadLocal = true, AutoSelectPriority = 4, DebugEngineClassGUID = "{904AA6E0-942C-4D11-9094-7BAAEB3EE4B9}", DebugEngineClassName = "BlackBerry.DebugEngine.AD7Engine", ProgramProviderClassGUID = "{AD06FD46-C790-4D5C-A274-8815DF9511B8}", ProgramProviderClassName = "BlackBerry.DebugEngine.AD7ProgramProvider", - PortSupplierClassGUID = "{BDC2218C-D50C-4A5A-A2F6-66BDC94FF8D6}", PortSupplierClassName = "BlackBerry.DebugEngine.AD7PortSupplier", + PortSupplierClassGUID = AD7PortSupplier.ClassGuid, PortSupplierClassName = AD7PortSupplier.ClassName, #if DEBUG AssemblyName = @"S:\vs-plugin\src_vs2012\DebugEngine\bin\Debug\BlackBerry.DebugEngine.dll" #else diff --git a/src_vs2013/Package/BlackBerry.Package.csproj b/src_vs2013/Package/BlackBerry.Package.csproj index f9b979be..81524944 100644 --- a/src_vs2013/Package/BlackBerry.Package.csproj +++ b/src_vs2013/Package/BlackBerry.Package.csproj @@ -64,6 +64,7 @@ + From f996bc2c0c5ece5205e81980d75de27522a9c6a4 Mon Sep 17 00:00:00 2001 From: Pawel Hofman Date: Wed, 25 Jun 2014 16:02:38 +0200 Subject: [PATCH 287/851] Refactored AD7Port and AD7Supplier to accept more input Fixed also nice bug, causing list of processes to crash on NullRefException. Trick was the lastTimeRefresh initialization timestamp. If object was created and used within 1 sec, it thought cache was already filled and populated null return array. --- src_vs2010/DebugEngine/AD7.Impl/AD7Engine.cs | 5 +- src_vs2010/DebugEngine/AD7.Impl/AD7Port.cs | 164 ++++++------ .../DebugEngine/AD7.Impl/AD7PortSupplier.cs | 253 ++++++++++-------- 3 files changed, 219 insertions(+), 203 deletions(-) diff --git a/src_vs2010/DebugEngine/AD7.Impl/AD7Engine.cs b/src_vs2010/DebugEngine/AD7.Impl/AD7Engine.cs index 9e9f800b..f8fc5d2f 100644 --- a/src_vs2010/DebugEngine/AD7.Impl/AD7Engine.cs +++ b/src_vs2010/DebugEngine/AD7.Impl/AD7Engine.cs @@ -16,6 +16,7 @@ using System.Runtime.InteropServices; using BlackBerry.NativeCore; using BlackBerry.NativeCore.Helpers; +using BlackBerry.NativeCore.Model; using Microsoft.VisualStudio; using Microsoft.VisualStudio.Debugger.Interop; using System.Diagnostics; @@ -248,7 +249,7 @@ int IDebugEngine2.Attach(IDebugProgram2[] rgpPrograms, IDebugProgramNode2[] rgpP processesPaths = ""; } - string searchProgName = progName + "_" + port.m_isSimulator; + string searchProgName = progName + "_" + (port.Device.Type == DeviceDefinitionType.Simulator); int begin = processesPaths.IndexOf(searchProgName + ":>"); if (begin != -1) @@ -265,7 +266,7 @@ int IDebugEngine2.Attach(IDebugProgram2[] rgpPrograms, IDebugProgramNode2[] rgpP exePath = exePath.Replace("\\", "\\\\\\\\"); - if (GDBParser.LaunchProcess(pnt.m_programID, exePath, port.m_IP, port.m_isSimulator, port.m_toolsPath, publicKeyPath, port.m_password)) + if (GDBParser.LaunchProcess(pnt.m_programID, exePath, port.Device.IP, port.Device.Type == DeviceDefinitionType.Simulator, port.NDK.ToolsPath, publicKeyPath, port.Device.Password)) { if (exePath == "CannotAttachToRunningProcess") { diff --git a/src_vs2010/DebugEngine/AD7.Impl/AD7Port.cs b/src_vs2010/DebugEngine/AD7.Impl/AD7Port.cs index dc4800ae..45d604f2 100644 --- a/src_vs2010/DebugEngine/AD7.Impl/AD7Port.cs +++ b/src_vs2010/DebugEngine/AD7.Impl/AD7Port.cs @@ -16,6 +16,7 @@ using System.Collections.Generic; using System.Linq; using BlackBerry.NativeCore; +using BlackBerry.NativeCore.Model; using Microsoft.VisualStudio.Debugger.Interop; using Microsoft.VisualStudio; using VSNDK.Parser; @@ -33,113 +34,104 @@ namespace BlackBerry.DebugEngine /// connectable and provides the IConnectionPoint interface. (http://msdn.microsoft.com/en-CA/library/ms683857.aspx) /// - IConnectionPoint - Supports connection points for connectable objects. (http://msdn.microsoft.com/en-us/library/ms694318.aspx) /// - public class AD7Port : IDebugPort2 + public sealed class AD7Port : IDebugPort2 { - - /// - /// The name of the port. - /// - private readonly string m_name; - - /// - /// The IP of the port. - /// - public readonly string m_IP; - /// - /// The password needed to have access to the port. + /// Represents the request that was used to create the port. /// - public readonly string m_password; + private readonly AD7PortRequest _request; /// - /// Boolean variable that indicates if the port is associated to the Simulator or the Device. + /// Represents the port supplier for this port. /// - public readonly bool m_isSimulator; + private readonly AD7PortSupplier _supplier; /// - /// The NDK host path. + /// Stores the last time that the list of running processes was refreshed. + /// Used to avoid issues in case the user spams the refresh button. /// - public readonly string m_toolsPath; + private DateTime _lastTimeRefresh = DateTime.MinValue; /// - /// List of processes running on this port. + /// Stores the list of running processes in the simulator/device. /// - private readonly List m_processes = new List(); + private IDebugProcess2[] _processes; /// - /// The GUID that identifies the port. + /// Constructor. /// - private readonly Guid m_guid; + /// The port supplier for this port. + /// The request used to create the port. + /// The GUID that identifies the port. + /// The name of the port. + /// Description of the device it should communicate with. + /// The NDK host path. + public AD7Port(AD7PortSupplier supplier, AD7PortRequest request, Guid guid, string name, DeviceDefinition device, NdkDefinition ndk) + { + if (supplier == null) + throw new ArgumentNullException("supplier"); + if (string.IsNullOrEmpty(name)) + throw new ArgumentNullException("name"); + if (device == null) + throw new ArgumentNullException("device"); + if (ndk == null) + throw new ArgumentNullException("ndk"); + + Name = name; + _request = request; + _supplier = supplier; + Guid = guid; + Device = device; + NDK = ndk; + } - /// - /// Represents the request that was used to create the port. - /// - private readonly AD7PortRequest m_request; + #region Properties /// - /// Represents the port supplier for this port. + /// Gets or set the GUID that identifies the port. /// - private readonly AD7PortSupplier m_supplier; + public Guid Guid + { + get; + private set; + } /// - /// Stores the last time that the list of running processes was refreshed. - /// Used to avoid issues in case the user spams the refresh button. + /// Gets or sets the name of the port. /// - private DateTime lastTimeRefresh = DateTime.Now; + public string Name + { + get; + private set; + } - /// - /// Stores the list of running processes in the simulator/device. - /// - private IDebugProcess2[] processes = null; + public DeviceDefinition Device + { + get; + private set; + } /// - /// Constructor. + /// Gets or sets the NDK reference. /// - /// The port supplier for this port. - /// The request used to create the port. - /// The GUID that identifies the port. - /// The name of the port. - /// The password needed to have access to the port. - /// Variable that indicates if the port is associated to the Simulator or the Device. - /// The NDK host path. - public AD7Port(AD7PortSupplier supplier, AD7PortRequest request, Guid guid, string portName, string password, bool isSimulator, string toolsPath) + public NdkDefinition NDK { - m_name = portName; - m_request = request; - m_supplier = supplier; - m_guid = guid; - if (m_name != "") - { - if (isSimulator) - m_IP = m_name.Substring(11); - else - m_IP = m_name.Substring(8); - } - else - { - m_name = " "; - m_IP = ""; - } - m_password = password; - m_isSimulator = isSimulator; - m_toolsPath = toolsPath; + get; + private set; } + #endregion /// /// Gets the list of processes running on this port. /// /// Returns the list of processes running on this port. - IEnumerable GetProcesses() + private AD7Process[] GetProcesses() { - if (m_processes.Count != 0) - { - m_processes.Clear(); - } - + var result = new List(); string publicKeyPath = ConfigDefaults.SshPublicKeyPath; - string response = GDBParser.GetPIDsThroughGDB(m_IP, m_password, m_isSimulator, m_toolsPath, publicKeyPath, 12); + string response = GDBParser.GetPIDsThroughGDB(Device.IP, Device.Password, Device.Type == DeviceDefinitionType.Simulator, NDK.ToolsPath, publicKeyPath, 12); if ((response == "TIMEOUT!") || (response.IndexOf("1^error,msg=", 0) != -1)) //found an error { @@ -194,10 +186,11 @@ IEnumerable GetProcesses() break; } AD7Process proc = new AD7Process(this, process.Substring(process.IndexOf("- ") + 2), process.Remove(process.IndexOf(" "))); - m_processes.Add(proc); + result.Add(proc); } } - return m_processes; + + return result.ToArray(); } @@ -210,11 +203,10 @@ IEnumerable GetProcesses() /// VSConstants.S_OK. public int GetPortName(out string pbstrName) { - pbstrName = m_name; + pbstrName = Name; return VSConstants.S_OK; } - /// /// Returns the port identifier. (http://msdn.microsoft.com/en-us/library/bb146747.aspx) /// @@ -222,11 +214,10 @@ public int GetPortName(out string pbstrName) /// VSConstants.S_OK. public int GetPortId(out Guid pguidPort) { - pguidPort = m_guid; + pguidPort = Guid; return VSConstants.S_OK; } - /// /// Returns the request used to create a port. (http://msdn.microsoft.com/en-us/library/bb145127.aspx) /// @@ -234,11 +225,10 @@ public int GetPortId(out Guid pguidPort) /// VSConstants.S_OK. public int GetPortRequest(out IDebugPortRequest2 ppRequest) { - ppRequest = m_request; + ppRequest = _request; return VSConstants.S_OK; } - /// /// Returns the port supplier for this port. (http://msdn.microsoft.com/en-us/library/bb146688.aspx) /// @@ -246,11 +236,10 @@ public int GetPortRequest(out IDebugPortRequest2 ppRequest) /// VSConstants.S_OK. public int GetPortSupplier(out IDebugPortSupplier2 ppSupplier) { - ppSupplier = m_supplier; + ppSupplier = _supplier; return VSConstants.S_OK; } - /// /// Returns the specified process running on a port. (http://msdn.microsoft.com/en-us/library/bb145867.aspx) /// @@ -275,36 +264,35 @@ public int GetProcess(AD_PROCESS_ID ProcessId, out IDebugProcess2 ppProcess) /// VSConstants.S_OK. public int EnumProcesses(out IEnumDebugProcesses2 ppEnum) { - if (this.m_IP == "") + if (string.IsNullOrEmpty(Device.IP)) { - processes = new IDebugProcess2[0]; + _processes = new IDebugProcess2[0]; } else { DateTime now = DateTime.Now; - TimeSpan diff = now - lastTimeRefresh; + TimeSpan diff = now - _lastTimeRefresh; double seconds = diff.TotalSeconds; if (seconds > 1) { IEnumerable procList = GetProcesses(); - processes = new IDebugProcess2[procList.Count()]; + _processes = new IDebugProcess2[procList.Count()]; int i = 0; foreach (var debugProcess in procList) { - processes[i] = debugProcess; + _processes[i] = debugProcess; i++; } - lastTimeRefresh = DateTime.Now; + _lastTimeRefresh = DateTime.Now; } } - ppEnum = new AD7ProcessEnum(processes); + ppEnum = new AD7ProcessEnum(_processes); return VSConstants.S_OK; } #endregion - } } diff --git a/src_vs2010/DebugEngine/AD7.Impl/AD7PortSupplier.cs b/src_vs2010/DebugEngine/AD7.Impl/AD7PortSupplier.cs index 074f61f1..b7759ee3 100644 --- a/src_vs2010/DebugEngine/AD7.Impl/AD7PortSupplier.cs +++ b/src_vs2010/DebugEngine/AD7.Impl/AD7PortSupplier.cs @@ -14,6 +14,7 @@ using System; using System.Collections.Generic; +using System.Data; using BlackBerry.NativeCore.Model; using Microsoft.VisualStudio.Debugger.Interop; using System.Runtime.InteropServices; @@ -42,63 +43,60 @@ public sealed class AD7PortSupplier : IDebugPortSupplier2, IDebugPortSupplierDes public const string ClassGuid = "BDC2218C-D50C-4A5A-A2F6-66BDC94FF8D6"; public const string ClassName = "BlackBerry.DebugEngine.AD7PortSupplier"; - private const string DevicePortGuid = "{69519DBB-5329-4CCE-88A9-EC1628AD99C2}"; - private const string SimulatorPortGuid = "{25040BDD-6683-4D5C-8EFA-EB4DDF5CA08E}"; - /// - /// The NDK host path. + /// The NDK reference. /// - private string _toolsPath = ""; + private NdkDefinition _ndk; /// /// List of ports for this port supplier. /// private readonly Dictionary _ports = new Dictionary(); - private int VerifyAndAddPorts() + private IDebugPort2[] CreateDefaultPorts() { - // Returning because VS can debug only one app at a time. - if (GDBParser.s_running) - return 0; - var ndk = NdkDefinition.Load(); - var device = DeviceDefinition.Load(DeviceDefinitionType.Device); - var simulator = DeviceDefinition.Load(DeviceDefinitionType.Simulator); + var devices = DeviceDefinition.LoadAll(); if (ndk == null || string.IsNullOrEmpty(ndk.ToolsPath)) - return -1; - _toolsPath = ndk.ToolsPath; + return null; + _ndk = ndk; - if (device != null) - { - IDebugPort2 p; - AddPort(new AD7PortRequest("Device: " + device.IP, device), out p); - } + var result = new List(); - if (simulator != null) + if (devices != null) { - IDebugPort2 p; - AddPort(new AD7PortRequest("Simulator: " + simulator.IP, simulator), out p); + foreach (var device in devices) + { + result.Add(CreatePort(this, new AD7PortRequest(GetPortRequestName(device), device), _ndk)); + } } - return 1; + + return result.ToArray(); + } + + private static string GetPortRequestName(DeviceDefinition device) + { + if (device == null) + throw new ArgumentNullException("device"); + + string prefix = device.Type == DeviceDefinitionType.Device ? "Device: " : "Simulator: "; + string name = string.IsNullOrEmpty(device.Name) ? device.IP : string.Concat(device.Name, " (", device.IP, ")"); + + return prefix + name; } /// /// Creates an AD7Port. /// - /// Port request - /// Returns an AD7Port - AD7Port CreatePort(AD7PortRequest request) + private static AD7Port CreatePort(AD7PortSupplier supplier, AD7PortRequest request, NdkDefinition ndk) { if (request == null) throw new ArgumentNullException("request"); if (request.Device == null) throw new ArgumentOutOfRangeException("request"); - bool isSimulator = request.Device.Type == DeviceDefinitionType.Simulator; - var guid = isSimulator ? new Guid(SimulatorPortGuid) : new Guid(DevicePortGuid); - - return new AD7Port(this, request, guid, request.Name, request.Device.Password, isSimulator, _toolsPath); + return new AD7Port(supplier, request, Guid.NewGuid(), request.Name, request.Device, ndk); } #region Implementation of IDebugPortSupplier2 @@ -111,85 +109,105 @@ AD7Port CreatePort(AD7PortRequest request) /// VSConstants.S_OK. public int AddPort(IDebugPortRequest2 pRequest, out IDebugPort2 ppPort) { - bool success = true; - AD7PortRequest port_request = null; - AD7Port port = null; + if (pRequest == null || _ndk == null) + { + ppPort = null; + return VSConstants.S_OK; + } - try + // is it one of the default requests created by the AD7PortSupplier? + var portRequest = pRequest as AD7PortRequest; + if (portRequest != null) { - port_request = (AD7PortRequest)pRequest; + var port = CreatePort(this, portRequest, _ndk); + _ports[port.Guid] = port; + ppPort = port; + return VSConstants.S_OK; } - catch + + string requestName; + if (pRequest.GetPortName(out requestName) == VSConstants.S_OK) { - success = false; - string portRequestName; - AD7Port defaultPort = null; - pRequest.GetPortName(out portRequestName); - string search; - if (portRequestName.ToLower().Contains("device")) - search = "device"; - else if (portRequestName.ToLower().Contains("simulator")) - search = "simulator"; - else - { - search = portRequestName.ToLower(); - } - foreach (var p in _ports) - { - AD7Port tempPort = p.Value; - if (defaultPort == null) - defaultPort = tempPort; + requestName = requestName.Trim(); + var port = FindPort(requestName); - string tempPortName; - tempPort.GetPortName(out tempPortName); - if (tempPortName.ToLower().Contains(search)) - { - port = tempPort; - break; - } - else - { - string IP = search; - do - { - int pos = IP.LastIndexOf('.'); - if (pos != -1) - { - IP = IP.Remove(pos); - if (tempPortName.Contains(IP)) - { - port = tempPort; - break; - } - } - else - IP = ""; - } while (IP != ""); - if (IP != "") - break; - } - } + // create something at hoc? if (port == null) { - if (defaultPort != null) + var device = CreateAdHocDevice(requestName); + if (device != null) { - port = defaultPort; + ppPort = new AD7Port(this, null, Guid.NewGuid(), GetPortRequestName(device), device, _ndk); + return VSConstants.S_OK; } - else - port = new AD7Port(this, port_request, Guid.NewGuid(), "", "", true, ""); + + MessageBox.Show("Too few information about device you are trying to connect.\n\nPlease, follow the pattern: \"(device|simulator) IP password\".", "Unable to create device connection", MessageBoxButtons.OK, MessageBoxIcon.Warning); + } + else + { + ppPort = port; + return VSConstants.S_OK; } } - if (success) + + ppPort = null; + return VSConstants.E_INVALIDARG; + } + + private AD7Port FindPort(string text) + { + if (string.IsNullOrEmpty(text)) + return null; + + foreach (var port in _ports.Values) { - port = CreatePort(port_request); - Guid portGuid; - port.GetPortId(out portGuid); - _ports.Add(portGuid, port); + if (port.Device.HasIdenticalIP(text) || port.Device.HasIdenticalName(text)) + return port; } - ppPort = port; - return VSConstants.S_OK; + + return null; } + private static DeviceDefinition CreateAdHocDevice(string text) + { + if (string.IsNullOrEmpty(text)) + return null; + + var items = text.Split(new[] { ' ', '|', ':', ',' }, StringSplitOptions.RemoveEmptyEntries); + if (items.Length < 2) + return null; + + int i = 0; + var type = DeviceDefinitionType.Device; + string ip = null; + string password = null; + + if (string.Compare("simulator", items[i], StringComparison.OrdinalIgnoreCase) == 0 + || string.Compare("sim", items[i], StringComparison.OrdinalIgnoreCase) == 0) + { + type = DeviceDefinitionType.Simulator; + i++; + } + if (string.Compare("device", items[i], StringComparison.OrdinalIgnoreCase) == 0) + { + type = DeviceDefinitionType.Device; + i++; + } + if (items.Length > i && items[i].IndexOf('.') > 0) + { + ip = items[i++]; + } + if (items.Length > i) + { + password = items[i]; + } + + // verify input: + if (string.IsNullOrEmpty(ip) || string.IsNullOrEmpty(password)) + return null; + + return new DeviceDefinition("Ad-hoc Connection", ip, password, type); + } /// /// Verifies that a port supplier can add new ports. (http://msdn.microsoft.com/en-ca/library/bb145880.aspx) @@ -207,30 +225,39 @@ public int CanAddPort() /// VSConstants.S_OK. public int EnumPorts(out IEnumDebugPorts2 ppEnum) { - _ports.Clear(); - int success = VerifyAndAddPorts(); - AD7Port[] ports = new AD7Port[_ports.Count]; + // Returning because VS can debug only one app at a time. + if (GDBParser.s_running) + { + MessageBox.Show("Visual Studio can debug only one BlackBerry application at a time.\n\nPlease, select a different transport or close the current debug session.", "Visual Studio is already debugging an application", MessageBoxButtons.OK, MessageBoxIcon.Warning); + ppEnum = null; + return VSConstants.S_OK; + } - if (_ports.Count > 0) + var defaultPorts = CreateDefaultPorts(); + if (defaultPorts == null) { - int i = 0; - foreach (var p in _ports) - { - ports[i] = p.Value; - i++; - } + MessageBox.Show("You must select an API Level to be able to attach to a running process.\n\nPlease, use \"BlackBerry -> Options -> API Level\" to download or select one.", "Missing NDK", MessageBoxButtons.OK, MessageBoxIcon.Warning); + ppEnum = null; + return VSConstants.S_OK; } - else + if (defaultPorts.Length == 0) { - if (success == 0) - MessageBox.Show("Visual Studio can debug only one BlackBerry application at a time.\n\nPlease, select a different transport or close the current debug session.", "Visual Studio is already debugging an application", MessageBoxButtons.OK, MessageBoxIcon.Warning); - else if (success == -1) - MessageBox.Show("You must select an API Level to be able to attach to a running process.\n\nPlease, use \"BlackBerry -> Settings -> Get more\" to download one.", "Missing NDK", MessageBoxButtons.OK, MessageBoxIcon.Warning); - else - MessageBox.Show("Missing Device/Simulator information. Please, use menu BlackBerry -> Settings to add any of those information.", "Missing Device/Simulator Data", MessageBoxButtons.OK, MessageBoxIcon.Information); + MessageBox.Show("Missing Device/Simulator information. Please, use menu BlackBerry -> Settings to add any of those information.", "Missing Device/Simulator Data", MessageBoxButtons.OK, MessageBoxIcon.Information); + ppEnum = null; + return VSConstants.S_OK; + } + + _ports.Clear(); + foreach (var port in defaultPorts) + { + Guid portGuid; + if (port.GetPortId(out portGuid) == VSConstants.S_OK) + { + _ports[portGuid] = (AD7Port) port; + } } - ppEnum = new AD7PortEnum(ports); + ppEnum = new AD7PortEnum(defaultPorts); return VSConstants.S_OK; } @@ -275,7 +302,7 @@ public int GetPortSupplierName(out string pbstrName) /// Not implemented. It should returns S_OK if successful; or an error code. public int RemovePort(IDebugPort2 pPort) { - throw new NotImplementedException(); + return VSConstants.E_NOTIMPL; } #endregion From 912c6e64646870a5825df8007b23020e55c301ee Mon Sep 17 00:00:00 2001 From: Pawel Hofman Date: Wed, 25 Jun 2014 17:09:00 +0200 Subject: [PATCH 288/851] Cross AD7 naming refactoring --- .../AD7.Impl/AD7BoundBreakpoint.cs | 235 +++++---- src_vs2010/DebugEngine/AD7.Impl/AD7Engine.cs | 8 +- src_vs2010/DebugEngine/AD7.Impl/AD7Enums.cs | 90 ++-- src_vs2010/DebugEngine/AD7.Impl/AD7Events.cs | 207 +++----- .../DebugEngine/AD7.Impl/AD7Expression.cs | 40 +- src_vs2010/DebugEngine/AD7.Impl/AD7Port.cs | 1 - .../DebugEngine/AD7.Impl/AD7PortSupplier.cs | 8 +- src_vs2010/DebugEngine/AD7.Impl/AD7Thread.cs | 33 +- .../Engine.Impl/BreakpointManager.cs | 71 ++- .../DebugEngine/Engine.Impl/EngineCallback.cs | 60 +-- .../DebugEngine/Engine.Impl/EngineUtils.cs | 46 +- .../Engine.Impl/EventDispatcher.cs | 456 +++++++++--------- 12 files changed, 556 insertions(+), 699 deletions(-) diff --git a/src_vs2010/DebugEngine/AD7.Impl/AD7BoundBreakpoint.cs b/src_vs2010/DebugEngine/AD7.Impl/AD7BoundBreakpoint.cs index 191b1daf..5fe3395c 100644 --- a/src_vs2010/DebugEngine/AD7.Impl/AD7BoundBreakpoint.cs +++ b/src_vs2010/DebugEngine/AD7.Impl/AD7BoundBreakpoint.cs @@ -28,15 +28,15 @@ namespace BlackBerry.DebugEngine /// a child of the pending breakpoint in the breakpoints window. Otherwise, only one is displayed. /// (http://msdn.microsoft.com/en-us/library/bb161979.aspx) /// - public class AD7BoundBreakpoint : IDebugBoundBreakpoint2 + public sealed class AD7BoundBreakpoint : IDebugBoundBreakpoint2 { - private AD7PendingBreakpoint m_pendingBreakpoint; - private AD7BreakpointResolution m_breakpointResolution; - private AD7Engine m_engine; + private readonly AD7PendingBreakpoint _pendingBreakpoint; + private readonly AD7BreakpointResolution _breakpointResolution; + private readonly AD7Engine _engine; - private bool m_enabled; - private bool m_deleted; - public uint m_hitCount; + private bool _enabled; + private bool _deleted; + public uint _hitCount; public uint m_bpLocationType; public string m_filename = ""; @@ -47,7 +47,7 @@ public class AD7BoundBreakpoint : IDebugBoundBreakpoint2 /// /// This breakpoint's index in the list of active bound breakpoints. /// - protected int m_remoteID = -1; + private int m_remoteID = -1; public int RemoteID { get { return m_remoteID; } @@ -59,32 +59,32 @@ public int RemoteID /// /// TRUE if the program has to stop when the hit count is equal to a given value. /// - public bool m_isHitCountEqual = false; + public bool _isHitCountEqual; /// /// Different than 0 if the program has to stop whenever the hit count is multiple of a given value /// - public uint m_hitCountMultiple = 0; - public bool m_breakWhenCondChanged = false; - public string m_previousCondEvaluation = ""; + public uint _hitCountMultiple; + public bool _breakWhenCondChanged; + public string _previousCondEvaluation = ""; /// /// Indicates if a given breakpoint is being manipulated in one of these 2 methods: SetPassCount and BreakpointHit. /// - public bool m_blockedPassCount = false; + public bool _blockedPassCount; /// /// Indicates if a given breakpoint is being manipulated in one of these 2 methods: SetCondition and BreakpointHit. /// - public bool m_blockedConditional = false; + public bool _blockedConditional; /// /// GDB member variables. /// - protected uint m_GDB_ID = 0; - protected string m_GDB_filename = ""; - protected uint m_GDB_linePos = 0; - protected string m_GDB_Address = ""; + private uint _GDB_ID; + private string _GDB_filename = ""; + private uint _GDB_linePos; + private string _GDB_Address = ""; /// @@ -92,18 +92,17 @@ public int RemoteID /// public uint GDB_ID { - get { return m_GDB_ID; } - set { m_GDB_ID = value; } + get { return _GDB_ID; } + set { _GDB_ID = value; } } - /// /// GDB_FileName Property. /// public string GDB_FileName { - get { return m_GDB_filename; } - set { m_GDB_filename = value; } + get { return _GDB_filename; } + set { _GDB_filename = value; } } @@ -112,8 +111,8 @@ public string GDB_FileName /// public uint GDB_LinePos { - get { return m_GDB_linePos; } - set { m_GDB_linePos = value; } + get { return _GDB_linePos; } + set { _GDB_linePos = value; } } @@ -122,8 +121,8 @@ public uint GDB_LinePos /// public string GDB_Address { - get { return m_GDB_Address; } - set { m_GDB_Address = value; } + get { return _GDB_Address; } + set { _GDB_Address = value; } } @@ -170,16 +169,16 @@ public AD7BoundBreakpoint(AD7Engine engine, BP_REQUEST_INFO bpReqInfo, AD7Pendin TEXT_POSITION[] endPosition = new TEXT_POSITION[1]; docPosition.GetRange(startPosition, endPosition); - m_engine = engine; + _engine = engine; m_bpLocationType = (uint)enum_BP_LOCATION_TYPE.BPLT_CODE_FILE_LINE; m_filename = shortPath.ToString(); m_line = startPosition[0].dwLine + 1; - m_pendingBreakpoint = pendingBreakpoint; - m_enabled = true; - m_deleted = false; - m_hitCount = 0; - m_remoteID = m_engine.BPMgr.RemoteAdd(this); + _pendingBreakpoint = pendingBreakpoint; + _enabled = true; + _deleted = false; + _hitCount = 0; + m_remoteID = _engine.BPMgr.RemoteAdd(this); } else if (bpReqInfo.bpLocation.bpLocationType == (uint)enum_BP_LOCATION_TYPE.BPLT_CODE_FUNC_OFFSET) { @@ -188,14 +187,14 @@ public AD7BoundBreakpoint(AD7Engine engine, BP_REQUEST_INFO bpReqInfo, AD7Pendin IDebugFunctionPosition2 funcPosition = (IDebugFunctionPosition2)(Marshal.GetObjectForIUnknown(bpReqInfo.bpLocation.unionmember2)); funcPosition.GetFunctionName(out func); - m_engine = engine; + _engine = engine; m_func = func; - m_enabled = true; - m_deleted = false; - m_hitCount = 0; + _enabled = true; + _deleted = false; + _hitCount = 0; m_bpLocationType = (uint)enum_BP_LOCATION_TYPE.BPLT_CODE_FUNC_OFFSET; - m_pendingBreakpoint = pendingBreakpoint; - m_remoteID = m_engine.BPMgr.RemoteAdd(this); + _pendingBreakpoint = pendingBreakpoint; + m_remoteID = _engine.BPMgr.RemoteAdd(this); } // if ((m_remoteID == 0) && (VSNDK.AddIn.VSNDKAddIn.isDebugEngineRunning == false)) @@ -212,16 +211,16 @@ public AD7BoundBreakpoint(AD7Engine engine, BP_REQUEST_INFO bpReqInfo, AD7Pendin // Get the Line Position sent back from GDB TEXT_POSITION tpos = new TEXT_POSITION(); - tpos.dwLine = m_GDB_linePos - 1; + tpos.dwLine = _GDB_linePos - 1; - uint xAddress = UInt32.Parse(m_GDB_Address.Substring(2), System.Globalization.NumberStyles.HexNumber); + uint xAddress = UInt32.Parse(_GDB_Address.Substring(2), System.Globalization.NumberStyles.HexNumber); - AD7MemoryAddress codeContext = new AD7MemoryAddress(m_engine, xAddress); - AD7DocumentContext documentContext = new AD7DocumentContext(m_GDB_filename, tpos, tpos, codeContext); + AD7MemoryAddress codeContext = new AD7MemoryAddress(_engine, xAddress); + AD7DocumentContext documentContext = new AD7DocumentContext(_GDB_filename, tpos, tpos, codeContext); - m_breakpointResolution = new AD7BreakpointResolution(m_engine, xAddress, documentContext); + _breakpointResolution = new AD7BreakpointResolution(_engine, xAddress, documentContext); - m_engine.Callback.OnBreakpointBound(this, 0); + _engine.Callback.OnBreakpointBound(this, 0); } @@ -235,34 +234,34 @@ public int SetPassCount(BP_PASSCOUNT bpPassCount) { bool isRunning = false; int result = VSConstants.S_FALSE; - while (!m_engine.eDispatcher.lockedBreakpoint(this, true, false)) + while (!_engine.eDispatcher.lockedBreakpoint(this, true, false)) { Thread.Sleep(0); } - while (!m_engine.eDispatcher.enterCriticalRegion()) + while (!_engine.eDispatcher.enterCriticalRegion()) { Thread.Sleep(0); } - if ((m_engine.m_state == AD7Engine.DE_STATE.RUN_MODE) && (EventDispatcher.m_GDBRunMode == true)) + if ((_engine.m_state == AD7Engine.DE_STATE.RUN_MODE) && (EventDispatcher._GDBRunMode == true)) { isRunning = true; - m_engine.eDispatcher.prepareToModifyBreakpoint(); + _engine.eDispatcher.PrepareToModifyBreakpoint(); } m_bpPassCount = bpPassCount; if (bpPassCount.stylePassCount == enum_BP_PASSCOUNT_STYLE.BP_PASSCOUNT_EQUAL_OR_GREATER) { - m_isHitCountEqual = false; - m_hitCountMultiple = 0; - if (!m_breakWhenCondChanged) + _isHitCountEqual = false; + _hitCountMultiple = 0; + if (!_breakWhenCondChanged) { - if ((int)((bpPassCount.dwPassCount - m_hitCount)) >= 0) + if ((int)((bpPassCount.dwPassCount - _hitCount)) >= 0) { - if (m_engine.eDispatcher.ignoreHitCount(GDB_ID, (int)(bpPassCount.dwPassCount - m_hitCount))) + if (_engine.eDispatcher.ignoreHitCount(GDB_ID, (int)(bpPassCount.dwPassCount - _hitCount))) result = VSConstants.S_OK; } else { - if (m_engine.eDispatcher.ignoreHitCount(GDB_ID, 1)) + if (_engine.eDispatcher.ignoreHitCount(GDB_ID, 1)) result = VSConstants.S_OK; } @@ -272,11 +271,11 @@ public int SetPassCount(BP_PASSCOUNT bpPassCount) } else if (bpPassCount.stylePassCount == enum_BP_PASSCOUNT_STYLE.BP_PASSCOUNT_EQUAL) { - m_hitCountMultiple = 0; - m_isHitCountEqual = true; - if (!m_breakWhenCondChanged) + _hitCountMultiple = 0; + _isHitCountEqual = true; + if (!_breakWhenCondChanged) { - if (m_engine.eDispatcher.ignoreHitCount(GDB_ID, (int)(bpPassCount.dwPassCount - m_hitCount))) + if (_engine.eDispatcher.ignoreHitCount(GDB_ID, (int)(bpPassCount.dwPassCount - _hitCount))) result = VSConstants.S_OK; } else @@ -284,11 +283,11 @@ public int SetPassCount(BP_PASSCOUNT bpPassCount) } else if (bpPassCount.stylePassCount == enum_BP_PASSCOUNT_STYLE.BP_PASSCOUNT_MOD) { - m_isHitCountEqual = false; - m_hitCountMultiple = bpPassCount.dwPassCount; - if (!m_breakWhenCondChanged) + _isHitCountEqual = false; + _hitCountMultiple = bpPassCount.dwPassCount; + if (!_breakWhenCondChanged) { - if (m_engine.eDispatcher.ignoreHitCount(GDB_ID, (int)(m_hitCountMultiple - (m_hitCount % m_hitCountMultiple)))) + if (_engine.eDispatcher.ignoreHitCount(GDB_ID, (int)(_hitCountMultiple - (_hitCount % _hitCountMultiple)))) result = VSConstants.S_OK; } else @@ -296,11 +295,11 @@ public int SetPassCount(BP_PASSCOUNT bpPassCount) } else if (bpPassCount.stylePassCount == enum_BP_PASSCOUNT_STYLE.BP_PASSCOUNT_NONE) { - m_isHitCountEqual = false; - m_hitCountMultiple = 0; - if (!m_breakWhenCondChanged) + _isHitCountEqual = false; + _hitCountMultiple = 0; + if (!_breakWhenCondChanged) { - if (m_engine.eDispatcher.ignoreHitCount(GDB_ID, 1)) // ignoreHitCount decrement by 1 automatically, so sending 1 means to stop ignoring (or ignore 0) + if (_engine.eDispatcher.ignoreHitCount(GDB_ID, 1)) // ignoreHitCount decrement by 1 automatically, so sending 1 means to stop ignoring (or ignore 0) result = VSConstants.S_OK; } else @@ -310,11 +309,11 @@ public int SetPassCount(BP_PASSCOUNT bpPassCount) if (isRunning) { isRunning = false; - m_engine.eDispatcher.resumeFromInterrupt(); + _engine.eDispatcher.ResumeFromInterrupt(); } - m_engine.eDispatcher.leaveCriticalRegion(); - m_engine.eDispatcher.unlockBreakpoint(this, true, false); + _engine.eDispatcher.leaveCriticalRegion(); + _engine.eDispatcher.unlockBreakpoint(this, true, false); return result; } @@ -326,74 +325,74 @@ public int SetPassCount(BP_PASSCOUNT bpPassCount) /// VSConstants.S_OK if successful, VSConstants.S_FALSE if not. public int SetCondition(BP_CONDITION bpCondition) { - bool updatingCondBreak = this.m_engine.m_updatingConditionalBreakpoint.WaitOne(0); + bool updatingCondBreak = this._engine.m_updatingConditionalBreakpoint.WaitOne(0); bool isRunning = false; bool verifyCondition = false; int result = VSConstants.S_FALSE; - while (!m_engine.eDispatcher.lockedBreakpoint(this, false, true)) + while (!_engine.eDispatcher.lockedBreakpoint(this, false, true)) { Thread.Sleep(0); } - if (m_hitCount != 0) + if (_hitCount != 0) { - m_engine.eDispatcher.resetHitCount(this, false); + _engine.eDispatcher.resetHitCount(this, false); } - while (!m_engine.eDispatcher.enterCriticalRegion()) + while (!_engine.eDispatcher.enterCriticalRegion()) { Thread.Sleep(0); } - if ((m_engine.m_state == AD7Engine.DE_STATE.RUN_MODE) && (EventDispatcher.m_GDBRunMode == true)) + if ((_engine.m_state == AD7Engine.DE_STATE.RUN_MODE) && (EventDispatcher._GDBRunMode == true)) { isRunning = true; - m_engine.eDispatcher.prepareToModifyBreakpoint(); - m_engine.m_state = AD7Engine.DE_STATE.BREAK_MODE; + _engine.eDispatcher.PrepareToModifyBreakpoint(); + _engine.m_state = AD7Engine.DE_STATE.BREAK_MODE; } m_bpCondition = bpCondition; if (bpCondition.styleCondition == enum_BP_COND_STYLE.BP_COND_WHEN_TRUE) { - if (m_breakWhenCondChanged) + if (_breakWhenCondChanged) { - m_breakWhenCondChanged = false; + _breakWhenCondChanged = false; verifyCondition = true; } else - m_breakWhenCondChanged = false; + _breakWhenCondChanged = false; - m_previousCondEvaluation = ""; - if (m_engine.eDispatcher.setBreakpointCondition(GDB_ID, bpCondition.bstrCondition)) + _previousCondEvaluation = ""; + if (_engine.eDispatcher.setBreakpointCondition(GDB_ID, bpCondition.bstrCondition)) result = VSConstants.S_OK; } else if (bpCondition.styleCondition == enum_BP_COND_STYLE.BP_COND_WHEN_CHANGED) { - m_breakWhenCondChanged = true; - m_previousCondEvaluation = bpCondition.bstrCondition; // just to initialize this variable - m_engine.eDispatcher.ignoreHitCount(GDB_ID, 1); // have to break always to evaluate this option because GDB doesn't support it. - m_engine.eDispatcher.setBreakpointCondition(GDB_ID, ""); + _breakWhenCondChanged = true; + _previousCondEvaluation = bpCondition.bstrCondition; // just to initialize this variable + _engine.eDispatcher.ignoreHitCount(GDB_ID, 1); // have to break always to evaluate this option because GDB doesn't support it. + _engine.eDispatcher.setBreakpointCondition(GDB_ID, ""); result = VSConstants.S_OK; } else if (bpCondition.styleCondition == enum_BP_COND_STYLE.BP_COND_NONE) { - if (m_breakWhenCondChanged) + if (_breakWhenCondChanged) { - m_breakWhenCondChanged = false; + _breakWhenCondChanged = false; verifyCondition = true; } else - m_breakWhenCondChanged = false; + _breakWhenCondChanged = false; - m_previousCondEvaluation = ""; - if (m_engine.eDispatcher.setBreakpointCondition(GDB_ID, "")) + _previousCondEvaluation = ""; + if (_engine.eDispatcher.setBreakpointCondition(GDB_ID, "")) result = VSConstants.S_OK; } - m_engine.eDispatcher.leaveCriticalRegion(); - m_engine.eDispatcher.unlockBreakpoint(this, false, true); + _engine.eDispatcher.leaveCriticalRegion(); + _engine.eDispatcher.unlockBreakpoint(this, false, true); if (verifyCondition) { @@ -404,11 +403,11 @@ public int SetCondition(BP_CONDITION bpCondition) if (isRunning) { isRunning = false; - m_engine.m_state = AD7Engine.DE_STATE.RUN_MODE; - m_engine.eDispatcher.resumeFromInterrupt(); + _engine.m_state = AD7Engine.DE_STATE.RUN_MODE; + _engine.eDispatcher.ResumeFromInterrupt(); } - this.m_engine.m_updatingConditionalBreakpoint.Set(); + this._engine.m_updatingConditionalBreakpoint.Set(); return result; } @@ -422,12 +421,12 @@ public int SetCondition(BP_CONDITION bpCondition) /// VSConstants.S_OK int IDebugBoundBreakpoint2.Delete() { - if (!m_deleted) + if (!_deleted) { - m_enabled = false; - m_deleted = true; - m_pendingBreakpoint.OnBoundBreakpointDeleted(this); - m_engine.BPMgr.RemoteDelete(this); + _enabled = false; + _deleted = true; + _pendingBreakpoint.OnBoundBreakpointDeleted(this); + _engine.BPMgr.RemoteDelete(this); m_remoteID = -1; } return VSConstants.S_OK; @@ -443,17 +442,17 @@ int IDebugBoundBreakpoint2.Delete() int IDebugBoundBreakpoint2.Enable(int fEnable) { bool xEnabled = fEnable != 0; - if (m_enabled != xEnabled) + if (_enabled != xEnabled) { if (xEnabled) { - m_engine.BPMgr.RemoteEnable(this); + _engine.BPMgr.RemoteEnable(this); } else { - m_engine.BPMgr.RemoteDisable(this); + _engine.BPMgr.RemoteDisable(this); } - m_enabled = xEnabled; + _enabled = xEnabled; } return VSConstants.S_OK; } @@ -467,7 +466,7 @@ int IDebugBoundBreakpoint2.Enable(int fEnable) /// VSConstants.S_OK int IDebugBoundBreakpoint2.GetBreakpointResolution(out IDebugBreakpointResolution2 ppBPResolution) { - ppBPResolution = m_breakpointResolution; + ppBPResolution = _breakpointResolution; return VSConstants.S_OK; } @@ -479,7 +478,7 @@ int IDebugBoundBreakpoint2.GetBreakpointResolution(out IDebugBreakpointResolutio /// VSConstants.S_OK int IDebugBoundBreakpoint2.GetPendingBreakpoint(out IDebugPendingBreakpoint2 ppPendingBreakpoint) { - ppPendingBreakpoint = m_pendingBreakpoint; + ppPendingBreakpoint = _pendingBreakpoint; return VSConstants.S_OK; } @@ -493,15 +492,15 @@ int IDebugBoundBreakpoint2.GetState(enum_BP_STATE[] pState) { pState[0] = 0; - if (m_deleted) + if (_deleted) { pState[0] = enum_BP_STATE.BPS_DELETED; } - else if (m_enabled) + else if (_enabled) { pState[0] = enum_BP_STATE.BPS_ENABLED; } - else if (!m_enabled) + else if (!_enabled) { pState[0] = enum_BP_STATE.BPS_DISABLED; } @@ -517,14 +516,14 @@ int IDebugBoundBreakpoint2.GetState(enum_BP_STATE[] pState) /// AD7_HRESULT.E_BP_DELETED if the breakpoint was deleted; or VSConstants.S_OK if not. int IDebugBoundBreakpoint2.GetHitCount(out uint pdwHitCount) { - if (m_deleted) + if (_deleted) { pdwHitCount = 0; return AD7_HRESULT.E_BP_DELETED; } else { - pdwHitCount = m_hitCount; + pdwHitCount = _hitCount; return VSConstants.S_OK; } } @@ -548,19 +547,19 @@ int IDebugBoundBreakpoint2.SetCondition(BP_CONDITION bpCondition) /// AD7_HRESULT.E_BP_DELETED if the breakpoint was deleted; or VSConstants.S_OK if not. int IDebugBoundBreakpoint2.SetHitCount(uint dwHitCount) { - if (m_deleted) + if (_deleted) { return AD7_HRESULT.E_BP_DELETED; } else { - if ((dwHitCount == 0) && (m_hitCount != 0)) + if ((dwHitCount == 0) && (_hitCount != 0)) { - m_hitCount = dwHitCount; - m_engine.eDispatcher.resetHitCount(this, true); + _hitCount = dwHitCount; + _engine.eDispatcher.resetHitCount(this, true); } else - m_hitCount = dwHitCount; + _hitCount = dwHitCount; return VSConstants.S_OK; } } diff --git a/src_vs2010/DebugEngine/AD7.Impl/AD7Engine.cs b/src_vs2010/DebugEngine/AD7.Impl/AD7Engine.cs index f8fc5d2f..3991209d 100644 --- a/src_vs2010/DebugEngine/AD7.Impl/AD7Engine.cs +++ b/src_vs2010/DebugEngine/AD7.Impl/AD7Engine.cs @@ -319,7 +319,7 @@ int IDebugEngine2.CauseBreak() // If not already broken, send the interrupt if (m_state != DE_STATE.DESIGN_MODE && m_state != DE_STATE.BREAK_MODE && m_state != DE_STATE.STEP_MODE) { - if (EventDispatcher.m_GDBRunMode) + if (EventDispatcher._GDBRunMode) { HandleProcessExecution.m_mre.Reset(); m_running.WaitOne(); @@ -667,7 +667,7 @@ int IDebugEngineLaunch2.TerminateProcess(IDebugProcess2 process) if (eDispatcher != null) { eDispatcher.killProcess(); - eDispatcher.endDebugSession(0); + eDispatcher.EndDebugSession(0); } return VSConstants.S_OK; @@ -726,7 +726,7 @@ public int Detach() m_breakpointManager.ClearBoundBreakpoints(); // TODO: Check if active bound BP list needs to be updated too? if (eDispatcher != null) - eDispatcher.endDebugSession(0); + eDispatcher.EndDebugSession(0); return VSConstants.S_OK; } @@ -985,7 +985,7 @@ public int GetProgramId(out Guid guidProgramId) public int Step(IDebugThread2 pThread, enum_STEPKIND sk, enum_STEPUNIT Step) { // Don't allow stepping through unknown code because it can lead to future problems with stepping and break-all. - if (EventDispatcher.m_unknownCode) + if (EventDispatcher._unknownCode) { m_state = AD7Engine.DE_STATE.STEP_MODE; m_eventDispatcher.continueExecution(); diff --git a/src_vs2010/DebugEngine/AD7.Impl/AD7Enums.cs b/src_vs2010/DebugEngine/AD7.Impl/AD7Enums.cs index 1f4b2c75..7e36e1e9 100644 --- a/src_vs2010/DebugEngine/AD7.Impl/AD7Enums.cs +++ b/src_vs2010/DebugEngine/AD7.Impl/AD7Enums.cs @@ -12,15 +12,14 @@ //* See the License for the specific language governing permissions and //* limitations under the License. +using System; using Microsoft.VisualStudio; using Microsoft.VisualStudio.Debugger.Interop; - namespace BlackBerry.DebugEngine { #region Base Class - /// /// These classes use a generic enumerator implementation to create the various enumerators required by the engine. /// They allow the enumeration of everything from programs to breakpoints. @@ -29,9 +28,8 @@ namespace BlackBerry.DebugEngine /// Enumerator interface. class AD7Enum where I: class { - readonly T[] m_data; - uint m_position; - + private readonly T[] _data; + private uint _position; /// /// Constructor. @@ -39,10 +37,14 @@ class AD7Enum where I: class /// Array of T elements. public AD7Enum(T[] data) { - m_data = data; - m_position = 0; - } +#if DEBUG + if (data == null) + throw new ArgumentNullException("data"); +#endif + _data = data; + _position = 0; + } /// /// Returns a copy of the current enumeration as a separate object. Not implemented. @@ -55,7 +57,6 @@ public int Clone(out I ppEnum) return VSConstants.E_NOTIMPL; } - /// /// Returns the number of elements in the enumeration. /// @@ -63,11 +64,10 @@ public int Clone(out I ppEnum) /// VSConstants.S_OK. public int GetCount(out uint pcelt) { - pcelt = (uint)m_data.Length; + pcelt = (uint)_data.Length; return VSConstants.S_OK; } - /// /// Returns the next set of elements from the enumeration. /// @@ -80,7 +80,6 @@ public int Next(uint celt, T[] rgelt, out uint celtFetched) return Move(celt, rgelt, out celtFetched); } - /// /// Resets the enumeration to the first element. /// @@ -89,13 +88,12 @@ public int Reset() { lock (this) { - m_position = 0; + _position = 0; return VSConstants.S_OK; } } - /// /// Skips over the specified number of elements. /// @@ -108,7 +106,6 @@ public int Skip(uint celt) return Move(celt, null, out celtFetched); } - /// /// Returns/Skips over the specified number of elements. /// @@ -121,7 +118,7 @@ private int Move(uint celt, T[] rgelt, out uint celtFetched) lock (this) { int hr = VSConstants.S_OK; - celtFetched = (uint)m_data.Length - m_position; + celtFetched = (uint)_data.Length - _position; if (celt > celtFetched) { @@ -136,27 +133,24 @@ private int Move(uint celt, T[] rgelt, out uint celtFetched) { for (int c = 0; c < celtFetched; c++) { - rgelt[c] = m_data[m_position + c]; + rgelt[c] = _data[_position + c]; } } - m_position += celtFetched; + _position += celtFetched; return hr; } } } - #endregion Base Class - - + #endregion /// /// This class enumerates the processes running on a debug port. (http://msdn.microsoft.com/en-ca/library/bb145005.aspx) /// - class AD7ProcessEnum : AD7Enum, IEnumDebugProcesses2 + sealed class AD7ProcessEnum : AD7Enum, IEnumDebugProcesses2 { - /// /// Constructor. /// @@ -209,18 +203,17 @@ public int Next(uint celt, IDebugPort2[] rgelt, ref uint celtFetched) /// /// This class enumerates the programs running in the current debug session. (http://msdn.microsoft.com/en-ca/library/bb146727.aspx) /// - class AD7ProgramEnum : AD7Enum, IEnumDebugPrograms2 + sealed class AD7ProgramEnum : AD7Enum, IEnumDebugPrograms2 { - /// /// Constructor. /// /// Array of IDebugProgram2 elements. - public AD7ProgramEnum(IDebugProgram2[] data) : base(data) + public AD7ProgramEnum(IDebugProgram2[] data) + : base(data) { } - /// /// Returns the next set of elements from the enumeration. (http://msdn.microsoft.com/en-ca/library/bb147027.aspx) /// @@ -234,13 +227,11 @@ public int Next(uint celt, IDebugProgram2[] rgelt, ref uint celtFetched) } } - /// /// This class enumerates FRAMEINFO structures. (http://msdn.microsoft.com/en-us/library/bb147119.aspx) /// - class AD7FrameInfoEnum : AD7Enum, IEnumDebugFrameInfo2 + sealed class AD7FrameInfoEnum : AD7Enum, IEnumDebugFrameInfo2 { - /// /// Constructor. /// @@ -250,7 +241,6 @@ public AD7FrameInfoEnum(FRAMEINFO[] data) { } - /// /// Returns the next set of elements from the enumeration. (http://msdn.microsoft.com/en-us/library/bb146293.aspx) /// @@ -264,13 +254,11 @@ public int Next(uint celt, FRAMEINFO[] rgelt, ref uint celtFetched) } } - /// /// This class enumerates DEBUG_PROPERTY_INFO structures. (http://msdn.microsoft.com/en-ca/library/bb162336.aspx) /// - class AD7PropertyInfoEnum : AD7Enum, IEnumDebugPropertyInfo2 + sealed class AD7PropertyInfoEnum : AD7Enum, IEnumDebugPropertyInfo2 { - /// /// Constructor. /// @@ -281,13 +269,11 @@ public AD7PropertyInfoEnum(DEBUG_PROPERTY_INFO[] data) } } - /// /// This class enumerates the threads running in the current debug session. (http://msdn.microsoft.com/en-ca/library/bb145142.aspx) /// - class AD7ThreadEnum : AD7Enum, IEnumDebugThreads2 + sealed class AD7ThreadEnum : AD7Enum, IEnumDebugThreads2 { - /// /// Constructor. /// @@ -295,10 +281,8 @@ class AD7ThreadEnum : AD7Enum, IEnumDebugThre public AD7ThreadEnum(IDebugThread2[] threads) : base(threads) { - } - /// /// Returns the next set of elements from the enumeration. (http://msdn.microsoft.com/en-ca/library/bb161679.aspx) /// @@ -312,13 +296,11 @@ public int Next(uint celt, IDebugThread2[] rgelt, ref uint celtFetched) } } - /// /// This class enumerates a list of modules. (http://msdn.microsoft.com/en-ca/library/bb145925.aspx) /// - class AD7ModuleEnum : AD7Enum, IEnumDebugModules2 + sealed class AD7ModuleEnum : AD7Enum, IEnumDebugModules2 { - /// /// Constructor. /// @@ -326,10 +308,8 @@ class AD7ModuleEnum : AD7Enum, IEnumDebugModu public AD7ModuleEnum(IDebugModule2[] modules) : base(modules) { - } - /// /// Returns the next set of elements from the enumeration. (http://msdn.microsoft.com/en-ca/library/bb145898.aspx) /// @@ -343,13 +323,11 @@ public int Next(uint celt, IDebugModule2[] rgelt, ref uint celtFetched) } } - /// /// This class enumerates DEBUG_PROPERTY_INFO structures. (http://msdn.microsoft.com/en-ca/library/bb162336.aspx) /// - class AD7PropertyEnum : AD7Enum, IEnumDebugPropertyInfo2 + sealed class AD7PropertyEnum : AD7Enum, IEnumDebugPropertyInfo2 { - /// /// Constructor. /// @@ -357,18 +335,15 @@ class AD7PropertyEnum : AD7Enum, I public AD7PropertyEnum(DEBUG_PROPERTY_INFO[] properties) : base(properties) { - } } - /// /// This class enumerates the code contexts associated with the debug session, or with a particular program or document. /// (http://msdn.microsoft.com/en-us/library/bb146612.aspx) /// - class AD7CodeContextEnum : AD7Enum, IEnumDebugCodeContexts2 + sealed class AD7CodeContextEnum : AD7Enum, IEnumDebugCodeContexts2 { - /// /// Constructor. /// @@ -376,12 +351,10 @@ class AD7CodeContextEnum : AD7Enum, public AD7CodeContextEnum(IDebugCodeContext2[] codeContexts) : base(codeContexts) { - } - /// - /// Returns the next set of elements from the enumeration. ()http://msdn.microsoft.com/en-us/library/bb145085.aspx + /// Returns the next set of elements from the enumeration. (http://msdn.microsoft.com/en-us/library/bb145085.aspx) /// /// The number of elements to retrieve. Also specifies the maximum size of the rgelt array. /// Array of IDebugCodeContext2 elements to be filled in. @@ -393,14 +366,12 @@ public int Next(uint celt, IDebugCodeContext2[] rgelt, ref uint celtFetched) } } - /// /// This class enumerates the bound breakpoints associated with a pending breakpoint or breakpoint bound event. /// (http://msdn.microsoft.com/en-ca/library/bb162182.aspx) /// - class AD7BoundBreakpointsEnum : AD7Enum, IEnumDebugBoundBreakpoints2 + sealed class AD7BoundBreakpointsEnum : AD7Enum, IEnumDebugBoundBreakpoints2 { - /// /// Constructor. /// @@ -408,10 +379,8 @@ class AD7BoundBreakpointsEnum : AD7Enum /// Returns the next set of elements from the enumeration. (http://msdn.microsoft.com/en-ca/library/bb161772.aspx) /// @@ -423,6 +392,5 @@ public int Next(uint celt, IDebugBoundBreakpoint2[] rgelt, ref uint celtFetched) { return Next(celt, rgelt, out celtFetched); } - } - + } } diff --git a/src_vs2010/DebugEngine/AD7.Impl/AD7Events.cs b/src_vs2010/DebugEngine/AD7.Impl/AD7Events.cs index a764a284..ca8b8f05 100644 --- a/src_vs2010/DebugEngine/AD7.Impl/AD7Events.cs +++ b/src_vs2010/DebugEngine/AD7.Impl/AD7Events.cs @@ -25,8 +25,7 @@ namespace BlackBerry.DebugEngine { - #region Event base classes - + #region Event Base Classes /// /// Used to communicate both critical debug information and non-critical information. @@ -36,7 +35,6 @@ class AD7AsynchronousEvent : IDebugEvent2 { public const uint Attributes = (uint)enum_EVENTATTRIBUTES.EVENT_ASYNCHRONOUS; - /// /// Gets the attributes for this debug event. (http://msdn.microsoft.com/en-us/library/bb145575.aspx) /// @@ -49,7 +47,6 @@ int IDebugEvent2.GetAttributes(out uint eventAttributes) } } - /// /// Used to communicate both critical debug information and non-critical information. /// (http://msdn.microsoft.com/en-us/library/bb161977.aspx) @@ -58,7 +55,6 @@ class AD7StoppingEvent : IDebugEvent2 { public const uint Attributes = (uint)enum_EVENTATTRIBUTES.EVENT_ASYNC_STOP; - /// /// Gets the attributes for this debug event. (http://msdn.microsoft.com/en-us/library/bb145575.aspx) /// @@ -71,7 +67,6 @@ int IDebugEvent2.GetAttributes(out uint eventAttributes) } } - /// /// Used to communicate both critical debug information and non-critical information. /// (http://msdn.microsoft.com/en-us/library/bb161977.aspx) @@ -80,7 +75,6 @@ class AD7SynchronousEvent : IDebugEvent2 { public const uint Attributes = (uint)enum_EVENTATTRIBUTES.EVENT_SYNCHRONOUS; - /// /// Gets the attributes for this debug event. (http://msdn.microsoft.com/en-us/library/bb145575.aspx) /// @@ -93,7 +87,6 @@ int IDebugEvent2.GetAttributes(out uint eventAttributes) } } - /// /// Used to communicate both critical debug information and non-critical information. /// (http://msdn.microsoft.com/en-us/library/bb161977.aspx) @@ -102,7 +95,6 @@ class AD7SynchronousStoppingEvent : IDebugEvent2 { public const uint Attributes = (uint)enum_EVENTATTRIBUTES.EVENT_STOPPING | (uint)enum_EVENTATTRIBUTES.EVENT_SYNCHRONOUS; - /// /// Gets the attributes for this debug event. (http://msdn.microsoft.com/en-us/library/bb145575.aspx) /// @@ -114,9 +106,8 @@ int IDebugEvent2.GetAttributes(out uint eventAttributes) return VSConstants.S_OK; } } - - #endregion + #endregion /// /// The debug engine (DE) sends this interface to the session debug manager (SDM) when an instance of the DE is created. @@ -125,19 +116,18 @@ int IDebugEvent2.GetAttributes(out uint eventAttributes) sealed class AD7EngineCreateEvent : AD7AsynchronousEvent, IDebugEngineCreateEvent2 { public const string IID = "FE5B734C-759D-4E59-AB04-F103343BDD06"; - private IDebugEngine2 m_engine; - + private readonly IDebugEngine2 _engine; + /// /// Constructor. /// /// The AD7Engine object that represents the DE. AD7EngineCreateEvent(AD7Engine engine) { - m_engine = engine; + _engine = engine; } - /// /// Sends the event. /// @@ -147,7 +137,6 @@ public static void Send(AD7Engine engine) AD7EngineCreateEvent eventObject = new AD7EngineCreateEvent(engine); engine.Callback.Send(eventObject, IID, null, null); } - /// /// Retrieves the object that represents the newly created debug engine (DE). @@ -157,30 +146,19 @@ public static void Send(AD7Engine engine) /// VSConstants.S_OK. int IDebugEngineCreateEvent2.GetEngine(out IDebugEngine2 engine) { - engine = m_engine; - + engine = _engine; return VSConstants.S_OK; } } - /// /// This interface is sent when a process is launched. (http://msdn.microsoft.com/en-ca/library/bb161755.aspx) /// - class AD7ProcessCreateEvent : IDebugEvent2, IDebugProcessCreateEvent2 + sealed class AD7ProcessCreateEvent : IDebugEvent2, IDebugProcessCreateEvent2 { - private Guid IID = new Guid("9020DEE3-362D-4FF2-8CA9-8F6791F0EC85"); + public const string IID = "9020DEE3-362D-4FF2-8CA9-8F6791F0EC85"; public const uint Attributes = (uint)enum_EVENTATTRIBUTES.EVENT_IMMEDIATE; - /// - /// Gets the GUID of this event. - /// - /// Returns the GUID of this event. - public Guid getGuid() - { - return IID; - } - /// /// Gets the attributes for this debug event. (http://msdn.microsoft.com/en-us/library/bb145575.aspx) /// @@ -193,25 +171,15 @@ int IDebugEvent2.GetAttributes(out uint eventAttributes) } } - /// /// This interface is sent when a process is terminated, exits atypically, or is detached from. /// (http://msdn.microsoft.com/en-us/library/bb145152.aspx) /// - class AD7ProcessDestroyEvent : IDebugEvent2, IDebugProcessDestroyEvent2 + sealed class AD7ProcessDestroyEvent : IDebugEvent2, IDebugProcessDestroyEvent2 { - private Guid IID = new Guid("29DAA0AC-C718-4F93-A11E-6D15681476C7"); + public const string IID = "29DAA0AC-C718-4F93-A11E-6D15681476C7"; public const uint Attributes = (uint)enum_EVENTATTRIBUTES.EVENT_IMMEDIATE; - /// - /// Gets the GUID of this event. - /// - /// Returns the GUID of this event. - public Guid getGuid() - { - return IID; - } - /// /// Gets the attributes for this debug event. (http://msdn.microsoft.com/en-us/library/bb145575.aspx) /// @@ -224,7 +192,6 @@ int IDebugEvent2.GetAttributes(out uint eventAttributes) } } - /// /// This interface is sent by the debug engine (DE) to the session debug manager (SDM) when a program is attached to. /// (http://msdn.microsoft.com/en-ca/library/bb161345.aspx) @@ -232,8 +199,7 @@ int IDebugEvent2.GetAttributes(out uint eventAttributes) sealed class AD7ProgramCreateEvent : AD7AsynchronousEvent, IDebugProgramCreateEvent2 { public const string IID = "96CD11EE-ECD4-4E89-957E-B5D496FC4139"; - - + /// /// Sends the event. /// @@ -245,7 +211,6 @@ internal static void Send(AD7Engine engine) } } - /// /// This interface is sent by the debug engine (DE) to the session debug manager (SDM) when asynchronous expression evaluation /// is complete. (http://msdn.microsoft.com/en-ca/library/bb161810.aspx) @@ -253,9 +218,9 @@ internal static void Send(AD7Engine engine) sealed class AD7ExpressionEvaluationCompleteEvent : AD7AsynchronousEvent, IDebugExpressionEvaluationCompleteEvent2 { public const string IID = "C0E13A85-238A-4800-8315-D947C960A843"; - private readonly IDebugExpression2 m_expression; - private readonly IDebugProperty2 m_property; - + + private readonly IDebugExpression2 _expression; + private readonly IDebugProperty2 _property; /// /// Constructor. @@ -264,10 +229,9 @@ sealed class AD7ExpressionEvaluationCompleteEvent : AD7AsynchronousEvent, IDebug /// The IDebugProperty2 object that represents the result of the expression evaluation. public AD7ExpressionEvaluationCompleteEvent(IDebugExpression2 expression, IDebugProperty2 property) { - this.m_expression = expression; - this.m_property = property; + _expression = expression; + _property = property; } - /// /// Gets the original expression. (http://msdn.microsoft.com/en-ca/library/bb162323.aspx) @@ -276,10 +240,9 @@ public AD7ExpressionEvaluationCompleteEvent(IDebugExpression2 expression, IDebug /// VSConstants.S_OK. public int GetExpression(out IDebugExpression2 ppExpr) { - ppExpr = m_expression; + ppExpr = _expression; return VSConstants.S_OK; } - /// /// Gets the result of expression evaluation. (http://msdn.microsoft.com/en-ca/library/bb161962.aspx) @@ -288,12 +251,11 @@ public int GetExpression(out IDebugExpression2 ppExpr) /// VSConstants.S_OK. public int GetResult(out IDebugProperty2 ppResult) { - ppResult = m_property; + ppResult = _property; return VSConstants.S_OK; } } - /// /// This interface is sent by the debug engine (DE) to the session debug manager (SDM) when a module is loaded or unloaded. /// (http://msdn.microsoft.com/en-ca/library/bb146706.aspx) @@ -301,11 +263,10 @@ public int GetResult(out IDebugProperty2 ppResult) sealed class AD7ModuleLoadEvent : AD7AsynchronousEvent, IDebugModuleLoadEvent2 { public const string IID = "989DB083-0D7C-40D1-A9D9-921BF611A4B2"; - - readonly AD7Module m_module; - readonly bool m_fLoad; - + private readonly AD7Module _module; + private readonly bool _fLoad; + /// /// Constructor. /// @@ -313,11 +274,10 @@ sealed class AD7ModuleLoadEvent : AD7AsynchronousEvent, IDebugModuleLoadEvent2 /// onzero (TRUE) if the module is loading and zero (FALSE) if the module is unloading. public AD7ModuleLoadEvent(AD7Module module, bool fLoad) { - m_module = module; - m_fLoad = fLoad; + _module = module; + _fLoad = fLoad; } - /// /// Gets the module that is being loaded or unloaded. (http://msdn.microsoft.com/en-ca/library/bb161763.aspx) /// @@ -329,21 +289,11 @@ public AD7ModuleLoadEvent(AD7Module module, bool fLoad) /// VSConstants.S_OK. int IDebugModuleLoadEvent2.GetModule(out IDebugModule2 module, ref string debugMessage, ref int fIsLoad) { - module = m_module; - - if (m_fLoad) - { - fIsLoad = 1; - } - else - { - fIsLoad = 0; - } - + module = _module; + fIsLoad = _fLoad ? 1 : 0; return VSConstants.S_OK; } - /// /// Sends the event. /// @@ -357,7 +307,6 @@ internal static void Send(AD7Engine engine, AD7Module aModule, bool fLoad) } } - /// /// This interface is sent by the debug engine (DE) to the session debug manager (SDM) when a program has run to completion /// or is otherwise destroyed. (http://msdn.microsoft.com/en-ca/library/bb161972.aspx) @@ -366,8 +315,7 @@ sealed class AD7ProgramDestroyEvent : AD7SynchronousEvent, IDebugProgramDestroyE { public const string IID = "E147E9E3-6440-4073-A7B7-A65592C714B5"; - readonly uint m_exitCode; - + private readonly uint _exitCode; /// /// Constructor. @@ -375,12 +323,11 @@ sealed class AD7ProgramDestroyEvent : AD7SynchronousEvent, IDebugProgramDestroyE /// The program's exit code. public AD7ProgramDestroyEvent(uint exitCode) { - m_exitCode = exitCode; + _exitCode = exitCode; } #region IDebugProgramDestroyEvent2 Members - /// /// Gets the program's exit code. (http://msdn.microsoft.com/en-ca/library/bb146724.aspx) /// @@ -388,7 +335,7 @@ public AD7ProgramDestroyEvent(uint exitCode) /// VSConstants.S_OK. int IDebugProgramDestroyEvent2.GetExitCode(out uint exitCode) { - exitCode = m_exitCode; + exitCode = _exitCode; return VSConstants.S_OK; } @@ -407,7 +354,6 @@ internal static void Send(AD7Engine engine, uint exitCode) #endregion } - /// /// This interface is sent by the debug engine (DE) to the session debug manager (SDM) when a thread is created in a program /// being debugged. (http://msdn.microsoft.com/en-ca/library/bb161327.aspx) @@ -417,7 +363,6 @@ sealed class AD7ThreadCreateEvent : AD7AsynchronousEvent, IDebugThreadCreateEven public const string IID = "2090CCFC-70C5-491D-A5E8-BAD2DD9EE3EA"; } - /// /// This interface is sent by the debug engine (DE) to the session debug manager (SDM) when a thread has run to completion. /// (http://msdn.microsoft.com/en-ca/library/bb162330.aspx) @@ -426,8 +371,7 @@ sealed class AD7ThreadDestroyEvent : AD7AsynchronousEvent, IDebugThreadDestroyEv { public const string IID = "2C3B7532-A36F-4A6E-9072-49BE649B8541"; - readonly uint m_exitCode; - + private readonly uint _exitCode; /// /// Constructor. @@ -435,12 +379,11 @@ sealed class AD7ThreadDestroyEvent : AD7AsynchronousEvent, IDebugThreadDestroyEv /// The thread's exit code. public AD7ThreadDestroyEvent(uint exitCode) { - m_exitCode = exitCode; + _exitCode = exitCode; } #region IDebugThreadDestroyEvent2 Members - /// /// Gets the exit code for a thread. (http://msdn.microsoft.com/en-ca/library/bb146996.aspx) /// @@ -448,12 +391,10 @@ public AD7ThreadDestroyEvent(uint exitCode) /// VSConstants.S_OK. int IDebugThreadDestroyEvent2.GetExitCode(out uint exitCode) { - exitCode = m_exitCode; - + exitCode = _exitCode; return VSConstants.S_OK; } - /// /// Sends the event. /// @@ -480,7 +421,6 @@ internal static void Send(AD7Engine engine, uint exitCode, AD7Thread thread) #endregion } - /// /// This interface is sent by the debug engine (DE) to the session debug manager (SDM) when a program is loaded, but before /// any code is executed. (http://msdn.microsoft.com/en-ca/library/bb145834.aspx) @@ -489,28 +429,18 @@ sealed class AD7LoadCompleteEvent : AD7StoppingEvent, IDebugLoadCompleteEvent2 { public const string IID = "B1844850-1349-45D4-9F12-495212F5EB0B"; - - /// - /// Constructor. - /// - public AD7LoadCompleteEvent() - { - } - - /// /// Sends the event. /// - /// The AD7Engine object that represents the DE. - /// The AD7Thread object that represents the thread. - internal static void Send(AD7Engine aEngine, AD7Thread aThread) + /// The AD7Engine object that represents the DE. + /// The AD7Thread object that represents the thread. + internal static void Send(AD7Engine engine, AD7Thread thread) { - var xMessage = new AD7LoadCompleteEvent(); - aEngine.Callback.Send(xMessage, IID, aThread); + var message = new AD7LoadCompleteEvent(); + engine.Callback.Send(message, IID, thread); } } - /// /// This interface tells the session debug manager (SDM) that an asynchronous break has been successfully completed. /// (http://msdn.microsoft.com/en-ca/library/bb146180.aspx) @@ -520,7 +450,6 @@ sealed class AD7AsyncBreakCompleteEvent : AD7StoppingEvent, IDebugBreakEvent2 public const string IID = "c7405d1d-e24b-44e0-b707-d8a5a4e1641b"; } - /// /// This interface is sent by the debug engine (DE) to the session debug manager (SDM) to output a string. /// (http://msdn.microsoft.com/en-ca/library/bb146756.aspx) @@ -529,16 +458,15 @@ sealed class AD7OutputDebugStringEvent : AD7AsynchronousEvent, IDebugOutputStrin { public const string IID = "569c4bb1-7b82-46fc-ae28-4536ddad753e"; - private string m_str; - + private readonly string _message; /// /// Constructor. /// - /// The displayable message. - public AD7OutputDebugStringEvent(string str) + /// The displayable message. + public AD7OutputDebugStringEvent(string message) { - m_str = str; + _message = message; } #region IDebugOutputStringEvent2 Members @@ -550,14 +478,13 @@ public AD7OutputDebugStringEvent(string str) /// VSConstants.S_OK. int IDebugOutputStringEvent2.GetString(out string pbstrString) { - pbstrString = m_str; + pbstrString = _message; return VSConstants.S_OK; } #endregion } - /// /// This interface is sent by the debug engine (DE) to indicate that the debugging symbols for a module being debugged have /// been loaded. (http://msdn.microsoft.com/en-ca/library/bb160924.aspx) @@ -566,9 +493,9 @@ sealed class AD7SymbolSearchEvent : AD7AsynchronousEvent, IDebugSymbolSearchEven { public const string IID = "638F7C54-C160-4c7b-B2D0-E0337BC61F8C"; - private AD7Module m_module; - private string m_searchInfo; - private uint m_symbolFlags; + private readonly AD7Module _module; + private readonly string _searchInfo; + private readonly uint _symbolFlags; /// @@ -580,9 +507,9 @@ sealed class AD7SymbolSearchEvent : AD7AsynchronousEvent, IDebugSymbolSearchEven /// symbols were loaded. public AD7SymbolSearchEvent(AD7Module module, string searchInfo, uint symbolFlags) { - m_module = module; - m_searchInfo = searchInfo; - m_symbolFlags = symbolFlags; + _module = module; + _searchInfo = searchInfo; + _symbolFlags = symbolFlags; } #region IDebugSymbolSearchEvent2 Members @@ -599,16 +526,15 @@ public AD7SymbolSearchEvent(AD7Module module, string searchInfo, uint symbolFlag /// VSConstants.S_OK. int IDebugSymbolSearchEvent2.GetSymbolSearchInfo(out IDebugModule3 pModule, ref string pbstrDebugMessage, enum_MODULE_INFO_FLAGS[] pdwModuleInfoFlags) { - pModule = m_module; - pbstrDebugMessage = m_searchInfo; - pdwModuleInfoFlags[0] = (enum_MODULE_INFO_FLAGS)m_symbolFlags; + pModule = _module; + pbstrDebugMessage = _searchInfo; + pdwModuleInfoFlags[0] = (enum_MODULE_INFO_FLAGS)_symbolFlags; return VSConstants.S_OK; } #endregion } - /// /// This interface tells the session debug manager (SDM) that a pending breakpoint has been successfully bound to a loaded program. @@ -618,10 +544,9 @@ sealed class AD7BreakpointBoundEvent : AD7AsynchronousEvent, IDebugBreakpointBou { public const string IID = "1dddb704-cf99-4b8a-b746-dabb01dd13a0"; - private AD7PendingBreakpoint m_pendingBreakpoint; - private AD7BoundBreakpoint m_boundBreakpoint; + private readonly AD7PendingBreakpoint _pendingBreakpoint; + private readonly AD7BoundBreakpoint _boundBreakpoint; - /// /// Constructor. /// @@ -629,8 +554,8 @@ sealed class AD7BreakpointBoundEvent : AD7AsynchronousEvent, IDebugBreakpointBou /// The AD7BoundBreakpoint object that represents the breakpoint being bound. public AD7BreakpointBoundEvent(AD7PendingBreakpoint pendingBreakpoint, AD7BoundBreakpoint boundBreakpoint) { - m_pendingBreakpoint = pendingBreakpoint; - m_boundBreakpoint = boundBreakpoint; + _pendingBreakpoint = pendingBreakpoint; + _boundBreakpoint = boundBreakpoint; } #region IDebugBreakpointBoundEvent2 Members @@ -644,12 +569,11 @@ public AD7BreakpointBoundEvent(AD7PendingBreakpoint pendingBreakpoint, AD7BoundB int IDebugBreakpointBoundEvent2.EnumBoundBreakpoints(out IEnumDebugBoundBreakpoints2 ppEnum) { IDebugBoundBreakpoint2[] boundBreakpoints = new IDebugBoundBreakpoint2[1]; - boundBreakpoints[0] = m_boundBreakpoint; + boundBreakpoints[0] = _boundBreakpoint; ppEnum = new AD7BoundBreakpointsEnum(boundBreakpoints); return VSConstants.S_OK; } - /// /// Gets the pending breakpoint that is being bound. (http://msdn.microsoft.com/en-us/library/bb146558.aspx) /// @@ -658,14 +582,13 @@ int IDebugBreakpointBoundEvent2.EnumBoundBreakpoints(out IEnumDebugBoundBreakpoi /// VSConstants.S_OK. int IDebugBreakpointBoundEvent2.GetPendingBreakpoint(out IDebugPendingBreakpoint2 ppPendingBP) { - ppPendingBP = m_pendingBreakpoint; + ppPendingBP = _pendingBreakpoint; return VSConstants.S_OK; } #endregion } - /// /// The debug engine (DE) sends this interface to the session debug manager (SDM) when a program stops at a breakpoint. /// (http://msdn.microsoft.com/en-us/library/bb145927.aspx) @@ -674,9 +597,8 @@ sealed class AD7BreakpointEvent : AD7StoppingEvent, IDebugBreakpointEvent2 { public const string IID = "501C1E21-C557-48B8-BA30-A1EAB0BC4A74"; - IEnumDebugBoundBreakpoints2 m_boundBreakpoints; + private readonly IEnumDebugBoundBreakpoints2 _boundBreakpoints; - /// /// Constructor. /// @@ -684,7 +606,7 @@ sealed class AD7BreakpointEvent : AD7StoppingEvent, IDebugBreakpointEvent2 /// the current code location. public AD7BreakpointEvent(IEnumDebugBoundBreakpoints2 boundBreakpoints) { - m_boundBreakpoints = boundBreakpoints; + _boundBreakpoints = boundBreakpoints; } #region IDebugBreakpointEvent2 Members @@ -698,7 +620,7 @@ public AD7BreakpointEvent(IEnumDebugBoundBreakpoints2 boundBreakpoints) /// VSConstants.S_OK. int IDebugBreakpointEvent2.EnumBreakpoints(out IEnumDebugBoundBreakpoints2 ppEnum) { - ppEnum = m_boundBreakpoints; + ppEnum = _boundBreakpoints; return VSConstants.S_OK; } @@ -715,15 +637,14 @@ sealed class AD7StepCompletedEvent : IDebugEvent2, IDebugStepCompleteEvent2 { public const string IID = "0F7F24C1-74D9-4EA6-A3EA-7EDB2D81441D"; - /// /// Sends the event. /// /// The AD7Engine object that represents the DE. public static void Send(AD7Engine engine) { - var xEvent = new AD7StepCompletedEvent(); - engine.Callback.Send(xEvent, IID, engine.CurrentThread()); + var eventObject = new AD7StepCompletedEvent(); + engine.Callback.Send(eventObject, IID, engine.CurrentThread()); } #region IDebugEvent2 Members @@ -742,7 +663,6 @@ public int GetAttributes(out uint pdwAttrib) #endregion } - /// /// The debug engine (DE) sends this interface to the session debug manager (SDM) when the program is about to execute its /// first instruction of user code. (http://msdn.microsoft.com/en-us/library/bb161265.aspx) @@ -751,15 +671,14 @@ sealed class AD7EntryPointEvent : AD7SynchronousStoppingEvent, IDebugEntryPointE { public const string IID = "86D5A99E-C721-4625-A401-4D052DF38475"; - /// /// Sends the event. /// /// The AD7Engine object that represents the DE. public static void Send(AD7Engine engine) { - var xEvent = new AD7EntryPointEvent(); - engine.Callback.Send(xEvent, IID, engine.CurrentThread()); + var eventObject = new AD7EntryPointEvent(); + engine.Callback.Send(eventObject, IID, engine.CurrentThread()); } } } diff --git a/src_vs2010/DebugEngine/AD7.Impl/AD7Expression.cs b/src_vs2010/DebugEngine/AD7.Impl/AD7Expression.cs index 953780e8..2e0e6fcf 100644 --- a/src_vs2010/DebugEngine/AD7.Impl/AD7Expression.cs +++ b/src_vs2010/DebugEngine/AD7.Impl/AD7Expression.cs @@ -25,40 +25,38 @@ namespace BlackBerry.DebugEngine /// It allows the debugger to obtain the values of an expression in the debuggee. /// (http://msdn.microsoft.com/en-ca/library/bb162308.aspx) /// - public class AD7Expression : IDebugExpression2 + public sealed class AD7Expression : IDebugExpression2 { /// /// The expression to be evaluated. /// - private string exp; + private readonly string _expression; /// /// The class that manages debug events for the debug engine. /// - private EventDispatcher m_eventDispatcher; + private readonly EventDispatcher _eventDispatcher; /// /// Current stack frame. /// - private AD7StackFrame m_frame; - + private readonly AD7StackFrame _frame; /// /// Constructor. /// - /// The expression to be evaluated. + /// The expression to be evaluated. /// Current stack frame. /// Represents the class that manages debug events for the debug engine. - public AD7Expression(string exp, AD7StackFrame frame, EventDispatcher dispatcher) + public AD7Expression(string expression, AD7StackFrame frame, EventDispatcher dispatcher) { - this.exp = exp; - this.m_eventDispatcher = dispatcher; - this.m_frame = frame; + _expression = expression; + _eventDispatcher = dispatcher; + _frame = frame; } #region IDebugExpression2 Members - /// /// This method cancels asynchronous expression evaluation as started by a call to the IDebugExpression2::EvaluateAsync method. /// Not implemented yet because it was not needed till now. (http://msdn.microsoft.com/en-ca/library/bb145924.aspx) @@ -69,19 +67,17 @@ int IDebugExpression2.Abort() throw new NotImplementedException(); } - /// /// Thread responsible for evaluating expressions asynchronously. /// - public void evaluatingAsync() + public void EvaluatingAsync() { - VariableInfo vi = VariableInfo.get(exp, m_eventDispatcher, m_frame); + VariableInfo vi = VariableInfo.get(_expression, _eventDispatcher, _frame); AD7Property ppResult = new AD7Property(vi); - m_frame.m_engine.Callback.Send(new AD7ExpressionEvaluationCompleteEvent(this, ppResult), AD7ExpressionEvaluationCompleteEvent.IID, m_frame.m_engine, m_frame.m_thread); + _frame.m_engine.Callback.Send(new AD7ExpressionEvaluationCompleteEvent(this, ppResult), AD7ExpressionEvaluationCompleteEvent.IID, _frame.m_engine, _frame.m_thread); } - /// /// This method evaluates the expression asynchronously. /// This is primarily used for the immediate window. (http://msdn.microsoft.com/en-ca/library/bb146752.aspx) @@ -92,14 +88,12 @@ public void evaluatingAsync() int IDebugExpression2.EvaluateAsync(enum_EVALFLAGS dwFlags, IDebugEventCallback2 pExprCallback) { // Creating a thread to evaluate the expression asynchronously. - Thread m_processingThread; - m_processingThread = new Thread(evaluatingAsync); - m_processingThread.Start(); + Thread processingThread = new Thread(EvaluatingAsync); + processingThread.Start(); return VSConstants.S_OK; } - /// /// This method evaluates the expression synchronously. (http://msdn.microsoft.com/en-ca/library/bb146982.aspx) /// @@ -111,12 +105,12 @@ int IDebugExpression2.EvaluateAsync(enum_EVALFLAGS dwFlags, IDebugEventCallback2 /// VSConstants.S_OK. int IDebugExpression2.EvaluateSync(enum_EVALFLAGS dwFlags, uint dwTimeout, IDebugEventCallback2 pExprCallback, out IDebugProperty2 ppResult) { - VariableInfo vi = VariableInfo.get(exp, m_eventDispatcher, m_frame); + VariableInfo vi = VariableInfo.get(_expression, _eventDispatcher, _frame); ppResult = new AD7Property(vi); - m_frame._lastEvaluatedExpression = vi; + _frame._lastEvaluatedExpression = vi; return VSConstants.S_OK; } #endregion } -} \ No newline at end of file +} diff --git a/src_vs2010/DebugEngine/AD7.Impl/AD7Port.cs b/src_vs2010/DebugEngine/AD7.Impl/AD7Port.cs index 45d604f2..23013d0f 100644 --- a/src_vs2010/DebugEngine/AD7.Impl/AD7Port.cs +++ b/src_vs2010/DebugEngine/AD7.Impl/AD7Port.cs @@ -193,7 +193,6 @@ private AD7Process[] GetProcesses() return result.ToArray(); } - #region Implementation of IDebugPort2 /// diff --git a/src_vs2010/DebugEngine/AD7.Impl/AD7PortSupplier.cs b/src_vs2010/DebugEngine/AD7.Impl/AD7PortSupplier.cs index b7759ee3..c078ee9b 100644 --- a/src_vs2010/DebugEngine/AD7.Impl/AD7PortSupplier.cs +++ b/src_vs2010/DebugEngine/AD7.Impl/AD7PortSupplier.cs @@ -151,7 +151,7 @@ public int AddPort(IDebugPortRequest2 pRequest, out IDebugPort2 ppPort) } ppPort = null; - return VSConstants.E_INVALIDARG; + return VSConstants.S_FALSE; } private AD7Port FindPort(string text) @@ -230,7 +230,7 @@ public int EnumPorts(out IEnumDebugPorts2 ppEnum) { MessageBox.Show("Visual Studio can debug only one BlackBerry application at a time.\n\nPlease, select a different transport or close the current debug session.", "Visual Studio is already debugging an application", MessageBoxButtons.OK, MessageBoxIcon.Warning); ppEnum = null; - return VSConstants.S_OK; + return VSConstants.S_FALSE; } var defaultPorts = CreateDefaultPorts(); @@ -238,13 +238,13 @@ public int EnumPorts(out IEnumDebugPorts2 ppEnum) { MessageBox.Show("You must select an API Level to be able to attach to a running process.\n\nPlease, use \"BlackBerry -> Options -> API Level\" to download or select one.", "Missing NDK", MessageBoxButtons.OK, MessageBoxIcon.Warning); ppEnum = null; - return VSConstants.S_OK; + return VSConstants.S_FALSE; } if (defaultPorts.Length == 0) { MessageBox.Show("Missing Device/Simulator information. Please, use menu BlackBerry -> Settings to add any of those information.", "Missing Device/Simulator Data", MessageBoxButtons.OK, MessageBoxIcon.Information); ppEnum = null; - return VSConstants.S_OK; + return VSConstants.S_FALSE; } _ports.Clear(); diff --git a/src_vs2010/DebugEngine/AD7.Impl/AD7Thread.cs b/src_vs2010/DebugEngine/AD7.Impl/AD7Thread.cs index 722a40e9..808c7772 100644 --- a/src_vs2010/DebugEngine/AD7.Impl/AD7Thread.cs +++ b/src_vs2010/DebugEngine/AD7.Impl/AD7Thread.cs @@ -22,20 +22,6 @@ namespace BlackBerry.DebugEngine { - - /// - /// Thread's category, from http://social.msdn.microsoft.com/Forums/en-US/vsx/thread/807e26cc-4f3f-4e90-a9a8-b550d484b8c1 - /// - enum enum_THREADCATEGORY - { - THREADCATEGORY_Worker = 0, - THREADCATEGORY_UI = (THREADCATEGORY_Worker + 1), - THREADCATEGORY_Main = (THREADCATEGORY_UI + 1), - THREADCATEGORY_RPC = (THREADCATEGORY_Main + 1), - THREADCATEGORY_Unknown = (THREADCATEGORY_RPC + 1) - }; - - /// /// This class represents a thread running in a program and it implements: /// @@ -45,6 +31,21 @@ enum enum_THREADCATEGORY /// public class AD7Thread : IDebugThread2, IDebugThread100 { + #region Internal Types + /// + /// Thread's category, from http://social.msdn.microsoft.com/Forums/en-US/vsx/thread/807e26cc-4f3f-4e90-a9a8-b550d484b8c1 + /// + enum enum_THREADCATEGORY + { + THREADCATEGORY_Worker = 0, + THREADCATEGORY_UI = (THREADCATEGORY_Worker + 1), + THREADCATEGORY_Main = (THREADCATEGORY_UI + 1), + THREADCATEGORY_RPC = (THREADCATEGORY_Main + 1), + THREADCATEGORY_Unknown = (THREADCATEGORY_RPC + 1) + } + + #endregion + /// /// The AD7Engine object that represents the DE. /// @@ -74,12 +75,12 @@ public class AD7Thread : IDebugThread2, IDebugThread100 /// Contains flags that specifies the information that were already verified about this thread's stack frame object. /// Used to avoid reevaluating stack frames that were already evaluated. /// - public int _alreadyEvaluated = 0; + public int _alreadyEvaluated; /// /// Contains the stack frames for this thread /// - public ArrayList __stackFrames = null; + public ArrayList __stackFrames; /// /// A FRAMEINFO structure that is filled in with the description of the previous stack frame that works as a cache, to avoid diff --git a/src_vs2010/DebugEngine/Engine.Impl/BreakpointManager.cs b/src_vs2010/DebugEngine/Engine.Impl/BreakpointManager.cs index 97fb2370..a6ce380e 100644 --- a/src_vs2010/DebugEngine/Engine.Impl/BreakpointManager.cs +++ b/src_vs2010/DebugEngine/Engine.Impl/BreakpointManager.cs @@ -12,6 +12,7 @@ //* See the License for the specific language governing permissions and //* limitations under the License. +using System; using System.Collections.Generic; using Microsoft.VisualStudio.Debugger.Interop; @@ -20,24 +21,22 @@ namespace BlackBerry.DebugEngine /// /// This class manages breakpoints for the engine. /// - public class BreakpointManager + public sealed class BreakpointManager { - /// /// The AD7Engine object that represents the DE. /// - private AD7Engine m_engine; + private readonly AD7Engine _engine; /// /// List of pending breakpoints. /// - private List m_pendingBreakpoints; + private readonly List _pendingBreakpoints; /// /// List of active breakpoints. /// - private List m_activeBPs; - + private readonly List _activeBPs; /// /// Breakpoint manager constructor. @@ -45,11 +44,13 @@ public class BreakpointManager /// Associated Debug Engine. public BreakpointManager(AD7Engine engine) { - m_engine = engine; - m_pendingBreakpoints = new System.Collections.Generic.List(); - m_activeBPs = new System.Collections.Generic.List(); - } + if (engine == null) + throw new ArgumentNullException("engine"); + _engine = engine; + _pendingBreakpoints = new List(); + _activeBPs = new List(); + } /// /// A helper method used to construct a new pending breakpoint. @@ -58,36 +59,34 @@ public BreakpointManager(AD7Engine engine) /// Returns an IDebugPendingBreakpoint2 object that represents the pending breakpoint. public void CreatePendingBreakpoint(IDebugBreakpointRequest2 pBPRequest, out IDebugPendingBreakpoint2 ppPendingBP) { - AD7PendingBreakpoint pendingBreakpoint = new AD7PendingBreakpoint(pBPRequest, m_engine, this); - ppPendingBP = (IDebugPendingBreakpoint2)pendingBreakpoint; - m_pendingBreakpoints.Add(pendingBreakpoint); + AD7PendingBreakpoint pendingBreakpoint = new AD7PendingBreakpoint(pBPRequest, _engine, this); + ppPendingBP = pendingBreakpoint; + _pendingBreakpoints.Add(pendingBreakpoint); } - /// /// Return the active bound breakpoint matching the given GDB ID. /// - /// Breakpoint ID in GDB. + /// Breakpoint ID in GDB. /// If successful, returns the active bound breakpoint; otherwise, returns null. - public AD7BoundBreakpoint getBoundBreakpointForGDBID(uint GDB_ID) + public AD7BoundBreakpoint GetBoundBreakpointForGDBID(uint gdbID) { - foreach (AD7BoundBreakpoint bbp in m_activeBPs) + foreach (AD7BoundBreakpoint bbp in _activeBPs) { - if ((bbp != null) && (bbp.GDB_ID == GDB_ID)) + if (bbp != null && bbp.GDB_ID == gdbID) { - return bbp; + return bbp; } } return null; } - /// /// Called from the engine's detach method to remove the debugger's breakpoint instructions. /// public void ClearBoundBreakpoints() { - foreach (AD7PendingBreakpoint pendingBreakpoint in m_pendingBreakpoints) + foreach (AD7PendingBreakpoint pendingBreakpoint in _pendingBreakpoints) { pendingBreakpoint.ClearBoundBreakpoints(); } @@ -100,7 +99,7 @@ public void ClearBoundBreakpoints() /// Breakpoint ID Number. public int RemoteAdd(AD7BoundBreakpoint aBBP) { - // Call GDB to set a breakpoint based on filename and line no. in aBBP + // Call GDB to set a breakpoint based on filename and line no. in aBBP uint GDB_ID = 0; uint GDB_LinePos = 0; string GDB_Filename = ""; @@ -109,16 +108,16 @@ public int RemoteAdd(AD7BoundBreakpoint aBBP) if (aBBP.m_bpLocationType == (uint)enum_BP_LOCATION_TYPE.BPLT_CODE_FILE_LINE) { - ret = m_engine.eDispatcher.setBreakpoint(aBBP.m_filename, aBBP.m_line, out GDB_ID, out GDB_LinePos, out GDB_Filename, out GDB_address); + ret = _engine.eDispatcher.SetBreakpoint(aBBP.m_filename, aBBP.m_line, out GDB_ID, out GDB_LinePos, out GDB_Filename, out GDB_address); } else if (aBBP.m_bpLocationType == (uint)enum_BP_LOCATION_TYPE.BPLT_CODE_FUNC_OFFSET) { - ret = m_engine.eDispatcher.setBreakpoint(aBBP.m_func, out GDB_ID, out GDB_LinePos, out GDB_Filename, out GDB_address); + ret = _engine.eDispatcher.SetBreakpoint(aBBP.m_func, out GDB_ID, out GDB_LinePos, out GDB_Filename, out GDB_address); } if (ret) { - m_activeBPs.Add(aBBP); + _activeBPs.Add(aBBP); aBBP.GDB_ID = GDB_ID; aBBP.GDB_FileName = GDB_Filename; @@ -131,31 +130,29 @@ public int RemoteAdd(AD7BoundBreakpoint aBBP) /// /// Enable bound breakpoint. /// - /// The Bound breakpoint to enable. - public void RemoteEnable(AD7BoundBreakpoint aBBP) + /// The Bound breakpoint to enable. + public void RemoteEnable(AD7BoundBreakpoint breakpoint) { - m_engine.eDispatcher.enableBreakpoint(aBBP.GDB_ID, true); + _engine.eDispatcher.enableBreakpoint(breakpoint.GDB_ID, true); } - /// /// Disable bound breakpoint. /// - /// The Bound breakpoint to disable. - public void RemoteDisable(AD7BoundBreakpoint aBBP) + /// The Bound breakpoint to disable. + public void RemoteDisable(AD7BoundBreakpoint breakpoint) { - m_engine.eDispatcher.enableBreakpoint(aBBP.GDB_ID, false); + _engine.eDispatcher.enableBreakpoint(breakpoint.GDB_ID, false); } - /// /// Remove the associated bound breakpoint. /// - /// The breakpoint to remove. - public void RemoteDelete(AD7BoundBreakpoint aBBP) + /// The breakpoint to remove. + public void RemoteDelete(AD7BoundBreakpoint breakpoint) { - m_activeBPs.Remove(aBBP); - m_engine.eDispatcher.deleteBreakpoint(aBBP.GDB_ID); + _activeBPs.Remove(breakpoint); + _engine.eDispatcher.DeleteBreakpoint(breakpoint.GDB_ID); } } } diff --git a/src_vs2010/DebugEngine/Engine.Impl/EngineCallback.cs b/src_vs2010/DebugEngine/Engine.Impl/EngineCallback.cs index acf71137..282be107 100644 --- a/src_vs2010/DebugEngine/Engine.Impl/EngineCallback.cs +++ b/src_vs2010/DebugEngine/Engine.Impl/EngineCallback.cs @@ -23,17 +23,15 @@ namespace BlackBerry.DebugEngine /// public class EngineCallback { - /// /// The IDebugEventCallback2 object that receives debugger events. /// - readonly IDebugEventCallback2 m_ad7Callback; + private readonly IDebugEventCallback2 _ad7Callback; /// /// The AD7Engine object that represents the DE. /// - readonly AD7Engine m_engine; - + private readonly AD7Engine _engine; /// /// Constructor. @@ -42,10 +40,14 @@ public class EngineCallback /// The IDebugEventCallback2 object that receives debugger events. public EngineCallback(AD7Engine engine, IDebugEventCallback2 ad7Callback) { - m_ad7Callback = ad7Callback; - m_engine = engine; - } + if (engine == null) + throw new ArgumentNullException("engine"); + if (ad7Callback == null) + throw new ArgumentNullException("ad7Callback"); + _engine = engine; + _ad7Callback = ad7Callback; + } /// /// Send events to the debugger. @@ -61,25 +63,24 @@ public void Send(IDebugEvent2 eventObject, string iidEvent, IDebugProgram2 progr EngineUtils.RequireOk(eventObject.GetAttributes(out attributes)); - if ((thread == null) && (m_engine != null) && (m_engine.thread != null) && (program != null) && (eventObject != null) && (riidEvent != null) && (attributes != 0)) + if ((thread == null) && (_engine != null) && (_engine.thread != null) && (program != null) && (eventObject != null) && (riidEvent != null) && (attributes != 0)) { - if (m_engine._currentThreadIndex != -1) + if (_engine._currentThreadIndex != -1) { - EngineUtils.RequireOk(m_ad7Callback.Event(m_engine, null, program, m_engine.thread[m_engine._currentThreadIndex], eventObject, ref riidEvent, attributes)); + EngineUtils.RequireOk(_ad7Callback.Event(_engine, null, program, _engine.thread[_engine._currentThreadIndex], eventObject, ref riidEvent, attributes)); } else { - if (m_engine.thread != null) - EngineUtils.RequireOk(m_ad7Callback.Event(m_engine, null, program, m_engine.thread[0], eventObject, ref riidEvent, attributes)); + if (_engine.thread != null) + EngineUtils.RequireOk(_ad7Callback.Event(_engine, null, program, _engine.thread[0], eventObject, ref riidEvent, attributes)); else - EngineUtils.RequireOk(m_ad7Callback.Event(m_engine, null, program, null, eventObject, ref riidEvent, attributes)); + EngineUtils.RequireOk(_ad7Callback.Event(_engine, null, program, null, eventObject, ref riidEvent, attributes)); } } else - EngineUtils.RequireOk(m_ad7Callback.Event(m_engine, null, program, thread, eventObject, ref riidEvent, attributes)); + EngineUtils.RequireOk(_ad7Callback.Event(_engine, null, program, thread, eventObject, ref riidEvent, attributes)); } - /// /// Call the method that will send the event to the debugger with all the arguments. /// @@ -88,10 +89,9 @@ public void Send(IDebugEvent2 eventObject, string iidEvent, IDebugProgram2 progr /// A thread running in a program. public void Send(IDebugEvent2 eventObject, string iidEvent, IDebugThread2 thread) { - Send(eventObject, iidEvent, m_engine, thread); + Send(eventObject, iidEvent, _engine, thread); } - /// /// IDebugErrorEvent2 is used to report error messages to the user when something goes wrong in the debug engine. /// The VSNDK debug engine doesn't take advantage of this. Not implemented. @@ -101,7 +101,6 @@ public void OnError(int hrErr) { } - /// /// The VSNDK debug engine does not support binding breakpoints as modules load since the primary exe is the only module /// symbols are loaded for. A production debugger will need to bind breakpoints when a new module is loaded. @@ -109,15 +108,10 @@ public void OnError(int hrErr) /// A module loaded in the debugged process. public void OnModuleLoad(AD7Module debuggedModule) { - // AD7Module ad7Module = new AD7Module(debuggedModule); AD7ModuleLoadEvent eventObject = new AD7ModuleLoadEvent(debuggedModule, true /* this is a module load */); - - // debuggedModule.Client = ad7Module; - Send(eventObject, AD7ModuleLoadEvent.IID, null); } - /// /// Send to the session debug manager (SDM) an event to output a string. /// Not used. @@ -126,11 +120,9 @@ public void OnModuleLoad(AD7Module debuggedModule) public void OnOutputString(string outputString) { AD7OutputDebugStringEvent eventObject = new AD7OutputDebugStringEvent(outputString); - Send(eventObject, AD7OutputDebugStringEvent.IID, null); } - /// /// Send an event to SDM with the breakpoint that was hit. /// @@ -141,19 +133,16 @@ public void OnBreakpoint(AD7Thread thread, IList clients IDebugBoundBreakpoint2[] boundBreakpoints = new IDebugBoundBreakpoint2[clients.Count]; int i = 0; - foreach (object objCurrentBreakpoint in clients) + foreach (var breakpoint in clients) { - boundBreakpoints[i] = (IDebugBoundBreakpoint2)objCurrentBreakpoint; - i++; + boundBreakpoints[i++] = breakpoint; } AD7BoundBreakpointsEnum boundBreakpointsEnum = new AD7BoundBreakpointsEnum(boundBreakpoints); - AD7BreakpointEvent eventObject = new AD7BreakpointEvent(boundBreakpointsEnum); - + AD7BreakpointEvent eventObject = new AD7BreakpointEvent(boundBreakpointsEnum); Send(eventObject, AD7BreakpointEvent.IID, thread); } - /// // Exception events are sent when an exception occurs in the debugged that the debugger was not expecting. // The VSNDK debug engine does not support these. Not implemented. @@ -163,18 +152,16 @@ public void OnException() throw new Exception("The method or operation is not implemented."); } - /// /// Step complete is sent when a step has finished. Not implemented. /// public void OnStepComplete() { throw new Exception("The method or operation is not implemented."); -// AD7StepCompletedEvent.Send(m_engine); + // AD7StepCompletedEvent.Send(m_engine); // TODO: implement this method... } - /// /// This will get called when the engine receives the breakpoint event that is created when the user /// hits the pause button in VS. @@ -186,7 +173,6 @@ public void OnAsyncBreakComplete(AD7Thread thread) Send(eventObject, AD7AsyncBreakCompleteEvent.IID, thread); } - /// /// Engines notify the debugger about the results of a symbol search by sending an instance of IDebugSymbolSearchEvent2. /// Not used. @@ -196,13 +182,12 @@ public void OnAsyncBreakComplete(AD7Thread thread) /// public void OnSymbolSearch(AD7Module module, string status, uint dwStatusFlags) { - string statusString = (dwStatusFlags == 1 ? "Symbols Loaded - " : "No symbols loaded") + status; + string statusString = (dwStatusFlags == 1 ? "Symbols loaded - " : "No symbols loaded - ") + status; AD7SymbolSearchEvent eventObject = new AD7SymbolSearchEvent(module, statusString, dwStatusFlags); Send(eventObject, AD7SymbolSearchEvent.IID, null); } - /// /// Engines notify the debugger that a breakpoint has bound through the breakpoint bound event. /// @@ -218,7 +203,6 @@ public void OnBreakpointBound(object objBoundBreakpoint, uint address) Send(eventObject, AD7BreakpointBoundEvent.IID, null); } - /// /// Send an event to notify the SDM that this thread was created. /// diff --git a/src_vs2010/DebugEngine/Engine.Impl/EngineUtils.cs b/src_vs2010/DebugEngine/Engine.Impl/EngineUtils.cs index 62f4b483..16774242 100644 --- a/src_vs2010/DebugEngine/Engine.Impl/EngineUtils.cs +++ b/src_vs2010/DebugEngine/Engine.Impl/EngineUtils.cs @@ -16,36 +16,34 @@ using Microsoft.VisualStudio; using System.Diagnostics; -namespace BlackBerry.DebugEngine -{ +namespace BlackBerry.DebugEngine +{ /// /// Some utilities used in VSNDK debug engine projects. - /// - public static class EngineUtils - { - + /// + public static class EngineUtils + { /// /// /// - /// An integer value. - public static void RequireOk(int hr) - { - if (hr != 0) - { - throw new InvalidOperationException(); - } - } - - + /// An integer value. + public static void RequireOk(int hr) + { + if (hr != VSConstants.S_OK) + { + throw new InvalidOperationException(); + } + } + /// /// /// /// Exception. - /// VSConstants.E_NOTIMPL. - public static int UnexpectedException(Exception e) - { - Debug.Fail("Unexpected exception:" + e); - return VSConstants.E_NOTIMPL; - } - } -} + /// VSConstants.E_NOTIMPL. + public static int UnexpectedException(Exception e) + { + Debug.Fail("Unexpected exception:" + e); + return VSConstants.E_NOTIMPL; + } + } +} diff --git a/src_vs2010/DebugEngine/Engine.Impl/EventDispatcher.cs b/src_vs2010/DebugEngine/Engine.Impl/EventDispatcher.cs index 75bba30e..b009265f 100644 --- a/src_vs2010/DebugEngine/Engine.Impl/EventDispatcher.cs +++ b/src_vs2010/DebugEngine/Engine.Impl/EventDispatcher.cs @@ -30,65 +30,47 @@ namespace BlackBerry.DebugEngine /// inserted). /// Call debug engine methods to notify the SDM of an event (e.g. if a breakpoint is hit, call EngineCallback.OnBreakpoint()). /// - public class EventDispatcher + public sealed class EventDispatcher { - /// - /// The private AD7Engine object that represents the DE. - /// - private AD7Engine m_engine; - - /// - /// The public AD7Engine object that represents the DE. - /// - public AD7Engine engine - { - get { return m_engine; } - } - - /// - /// Thread responsible for handling asynchronous output from GDB. - /// - private Thread m_processingThread; - /// /// Represents the object that process asynchronous GDB's output by classifying it by type (e.g. breakpoint event). /// - GDBOutput m_gdbOutput; + private readonly GDBOutput _gdbOutput; /// /// Boolean variable that indicates if the current code is known or unknown, i.e., if there is a source code file associated. /// - public static bool m_unknownCode = false; + public static bool _unknownCode; /// /// Object used to control the access to the critical section that exists in the "lockedBreakpoint" method. /// - private Object m_lockBreakpoint = new Object(); + private readonly Object _lockBreakpoint = new Object(); /// /// Object used to control the access to the critical section that exists in the "unlockBreakpoint" method. /// - private Object m_unlockBreakpoint = new Object(); + private readonly Object _unlockBreakpoint = new Object(); /// /// Object used to control the access to the critical section that exists in the "enterCriticalRegion" method. /// - private Object m_criticalRegion = new Object(); + private readonly Object _criticalRegion = new Object(); /// /// Object used to control the access to the critical section that exists in the "leaveCriticalRegion" method. /// - private Object m_leaveCriticalRegion = new Object(); + private readonly Object _leaveCriticalRegion = new Object(); /// /// Boolean variable that indicates the GDB state: TRUE -> run mode; FALSE -> break mode. /// - public static bool m_GDBRunMode = true; + public static bool _GDBRunMode = true; /// /// Variable that is manipulated only in methods enterCriticalRegion and leaveCriticalRegion /// - public bool inCriticalRegion = false; + public bool _inCriticalRegion; /// /// There is a GDB bug that causes a message "Quit (expect signal SIGINT when the program is resumed)". If this message occurs @@ -96,21 +78,33 @@ public AD7Engine engine /// that is received in a sequence. /// public int countSIGINT = 0; - + + #region Properties + + /// + /// The public AD7Engine object that represents the DE. + /// + public AD7Engine Engine + { + get; + private set; + } + + #endregion /// /// Ends the debug session by closing GDB, sending the appropriate events to the SDM, and breaking out of all /// buffer- and event-listening loops. /// /// The exit code. - public void endDebugSession(uint exitCode) + public void EndDebugSession(uint exitCode) { // Exit the event dispatch loop. - m_gdbOutput._running = false; + _gdbOutput.IsRunning = false; // Send events to the SDM. - AD7ThreadDestroyEvent.Send(engine, exitCode, null); - AD7ProgramDestroyEvent.Send(engine, exitCode); + AD7ThreadDestroyEvent.Send(Engine, exitCode, null); + AD7ProgramDestroyEvent.Send(Engine, exitCode); // Exit GDB. GDBParser.exitGDB(); @@ -126,65 +120,73 @@ public void endDebugSession(uint exitCode) /// The AD7Engine object that represents the DE. public EventDispatcher(AD7Engine engine) { - m_engine = engine; + if (engine == null) + throw new ArgumentNullException("engine"); - m_gdbOutput = new GDBOutput(this); - m_processingThread = new Thread(m_gdbOutput.processingGDBOutput); - m_processingThread.Start(); - } + Engine = engine; + _gdbOutput = new GDBOutput(this); + var processingThread = new Thread(_gdbOutput.ProcessingGDBOutput); + processingThread.Start(); + } /// /// Process asynchronous GDB's output by classifying it by type (e.g. breakpoint event). /// - public class GDBOutput + public sealed class GDBOutput { /// /// This object manages debug events in the engine. /// - private EventDispatcher m_eventDispatcher; + private readonly EventDispatcher _eventDispatcher; /// /// This object manages breakpoints events. /// - private HandleBreakpoints m_hBreakpoints; + private HandleBreakpoints _hBreakpoints; /// /// This object manages events related to execution control (processes, threads, programs). /// - private HandleProcessExecution m_hProcExe; + private HandleProcessExecution _hProcExe; /// /// This object manages events related to output messages. /// - private HandleOutputs m_hOutputs; + private HandleOutputs _hOutputs; /// - /// Boolean variable that corresponds to the event dispatcher status. When false, exit the event dispatch loop. + /// Constructor. /// - public bool _running = true; + /// This object manages debug events in the engine. + public GDBOutput(EventDispatcher ed) + { + _eventDispatcher = ed; + IsRunning = true; + } + #region Properties /// - /// Constructor. + /// Corresponds to the event-dispatcher status. When false, exit the event dispatch loop. /// - /// This object manages debug events in the engine. - public GDBOutput(EventDispatcher ed) + public bool IsRunning { - m_eventDispatcher = ed; - _running = true; + get; + set; } + #endregion /// /// Thread responsible for handling asynchronous GDB output. /// - public void processingGDBOutput() + public void ProcessingGDBOutput() { - while (_running) + while (IsRunning) { string response = ""; - while ((response = GDBParser.removeGDBResponse()) == "" && _running) + while ((response = GDBParser.removeGDBResponse()) == "" && IsRunning) { }; @@ -196,9 +198,9 @@ public void processingGDBOutput() { if (ev.Length > 1) // only to avoid empty events, when there are two delimiters characters together. { - if (m_eventDispatcher.countSIGINT > 0) + if (_eventDispatcher.countSIGINT > 0) if ((ev.Substring(0, 2) != "50") && (ev.Substring(0, 2) != "80")) - m_eventDispatcher.countSIGINT = 0; // Reset the counter, if GDB has recovered from a GDB bug. + _eventDispatcher.countSIGINT = 0; // Reset the counter, if GDB has recovered from a GDB bug. switch (ev[0]) { case '0': // Events related to starting GDB. @@ -206,26 +208,26 @@ public void processingGDBOutput() case '1': // Not used. break; case '2': // Events related to breakpoints (including breakpoint hits). - m_hBreakpoints = new HandleBreakpoints(m_eventDispatcher); - m_hBreakpoints.handle(ev); + _hBreakpoints = new HandleBreakpoints(_eventDispatcher); + _hBreakpoints.handle(ev); break; case '3': // Not used. break; case '4': // Events related to execution control (processes, threads, programs) 1. - m_hProcExe = new HandleProcessExecution(m_eventDispatcher); - m_hProcExe.handle(ev); + _hProcExe = new HandleProcessExecution(_eventDispatcher); + _hProcExe.handle(ev); break; case '5': // Events related to execution control (processes, threads, programs and GDB Bugs) 2. - m_hProcExe = new HandleProcessExecution(m_eventDispatcher); - m_hProcExe.handle(ev); + _hProcExe = new HandleProcessExecution(_eventDispatcher); + _hProcExe.handle(ev); break; case '6': // Events related to evaluating expressions. Not used. break; case '7': // Events related to stack frames. Not used. break; case '8': // Events related to output. - m_hOutputs = new HandleOutputs(m_eventDispatcher); - m_hOutputs.handle(ev); + _hOutputs = new HandleOutputs(_eventDispatcher); + _hOutputs.handle(ev); break; case '9': // Not used. break; @@ -242,21 +244,21 @@ public void processingGDBOutput() /// /// Interrupt the debugged process if necessary before changing a breakpoint. /// - public void prepareToModifyBreakpoint() + public void PrepareToModifyBreakpoint() { - if (m_engine.m_state != AD7Engine.DE_STATE.DESIGN_MODE - && m_engine.m_state != AD7Engine.DE_STATE.BREAK_MODE) + if (Engine.m_state != AD7Engine.DE_STATE.DESIGN_MODE + && Engine.m_state != AD7Engine.DE_STATE.BREAK_MODE) { HandleProcessExecution.m_needsResumeAfterInterrupt = true; - m_engine.CauseBreak(); - } + Engine.CauseBreak(); + } } /// /// If the process was running when the breakpoint was changed, resume the process. /// - public void resumeFromInterrupt() + public void ResumeFromInterrupt() { if (HandleProcessExecution.m_needsResumeAfterInterrupt) { @@ -278,7 +280,7 @@ public void resumeFromInterrupt() /// Returns the breakpoint File Name. /// Returns the Breakpoint Address. /// If successful, returns true; otherwise, returns false. - private bool setBreakpointImpl(string command, string command2, out uint GDB_ID, out uint GDB_line, out string GDB_filename, out string GDB_address) + private bool SetBreakpointImpl(string command, string command2, out uint GDB_ID, out uint GDB_line, out string GDB_filename, out string GDB_address) { string response; string bpointAddress; @@ -291,7 +293,7 @@ private bool setBreakpointImpl(string command, string command2, out uint GDB_ID, if (DebugEngineStatus.IsRunning) { - prepareToModifyBreakpoint(); + PrepareToModifyBreakpoint(); // Gets the parsed response for the GDB/MI command that inserts breakpoint in a given line or a given function. // (http://sourceware.org/gdb/onlinedocs/gdb/GDB_002fMI-Breakpoint-Commands.html) @@ -304,7 +306,7 @@ private bool setBreakpointImpl(string command, string command2, out uint GDB_ID, if (((response.Length < 2) && (DebugEngineStatus.IsRunning == false)) || (response == "Function not found!")) { - resumeFromInterrupt(); + ResumeFromInterrupt(); return false; } @@ -320,7 +322,7 @@ private bool setBreakpointImpl(string command, string command2, out uint GDB_ID, // Gets the parsed response for the GDB command that print information about the specified breakpoint, in this // case, only its address. (http://sourceware.org/gdb/onlinedocs/gdb/Set-Breaks.html) - bpointAddress = GDBParser.parseCommand("info b " + GDB_ID.ToString(), 18); + bpointAddress = GDBParser.parseCommand("info b " + GDB_ID, 18); // Gets the parsed response for the GDB command that inquire what source line covers a particular address. // (http://sourceware.org/gdb/onlinedocs/gdb/Machine-Code.html) @@ -334,7 +336,7 @@ private bool setBreakpointImpl(string command, string command2, out uint GDB_ID, GDB_line = (uint)hBreakpoints.linePos; } - resumeFromInterrupt(); + ResumeFromInterrupt(); return true; } @@ -353,14 +355,14 @@ private bool setBreakpointImpl(string command, string command2, out uint GDB_ID, /// Returns the breakpoint File Name. /// Returns the Breakpoint Address. /// If successful, returns true; otherwise, returns false. - public bool setBreakpoint(string filename, uint line, out uint GDB_ID, out uint GDB_line, out string GDB_filename, out string GDB_address) + public bool SetBreakpoint(string filename, uint line, out uint GDB_ID, out uint GDB_line, out string GDB_filename, out string GDB_address) { string cmd = @"-break-insert --thread-group i1 -f " + filename + ":" + line; int i = filename.LastIndexOf('\\'); if ((i != -1) && (i + 1 < filename.Length)) filename = filename.Substring(i + 1); string cmd2 = @"-break-insert --thread-group i1 -f " + filename + ":" + line; - return setBreakpointImpl(cmd, cmd2, out GDB_ID, out GDB_line, out GDB_filename, out GDB_address); + return SetBreakpointImpl(cmd, cmd2, out GDB_ID, out GDB_line, out GDB_filename, out GDB_address); } /// @@ -372,10 +374,10 @@ public bool setBreakpoint(string filename, uint line, out uint GDB_ID, out uint /// Returns the breakpoint File Name. /// Returns the Breakpoint Address. /// If successful, returns true; otherwise, returns false. - public bool setBreakpoint(string func, out uint GDB_ID, out uint GDB_line, out string GDB_filename, out string GDB_address) + public bool SetBreakpoint(string func, out uint GDB_ID, out uint GDB_line, out string GDB_filename, out string GDB_address) { string cmd = @"-break-insert " + func; - return setBreakpointImpl(cmd, "", out GDB_ID, out GDB_line, out GDB_filename, out GDB_address); + return SetBreakpointImpl(cmd, "", out GDB_ID, out GDB_line, out GDB_filename, out GDB_address); } /// @@ -428,23 +430,23 @@ public bool resetHitCount(AD7BoundBreakpoint bbp, bool resetCondition) uint GDB_ID = bbp.GDB_ID; // Deleting GDB breakpoint. - deleteBreakpoint(GDB_ID); + DeleteBreakpoint(GDB_ID); // Creating a new GDB breakpoint. bool ret = false; if (bbp.m_bpLocationType == (uint)enum_BP_LOCATION_TYPE.BPLT_CODE_FILE_LINE) { - ret = setBreakpoint(bbp.m_filename, bbp.m_line, out GDB_ID, out GDB_LinePos, out GDB_Filename, out GDB_address); + ret = SetBreakpoint(bbp.m_filename, bbp.m_line, out GDB_ID, out GDB_LinePos, out GDB_Filename, out GDB_address); } else if (bbp.m_bpLocationType == (uint)enum_BP_LOCATION_TYPE.BPLT_CODE_FUNC_OFFSET) { - ret = setBreakpoint(bbp.m_func, out GDB_ID, out GDB_LinePos, out GDB_Filename, out GDB_address); + ret = SetBreakpoint(bbp.m_func, out GDB_ID, out GDB_LinePos, out GDB_Filename, out GDB_address); } if (ret) { bbp.GDB_ID = GDB_ID; - bbp.m_hitCount = 0; + bbp._hitCount = 0; bbp.SetPassCount(bbp.m_bpPassCount); if (resetCondition) bbp.SetCondition(bbp.m_bpCondition); @@ -454,10 +456,6 @@ public bool resetHitCount(AD7BoundBreakpoint bbp, bool resetCondition) return false; } - - - - /// /// Set breakpoint condition in GDB. /// @@ -491,18 +489,18 @@ public bool setBreakpointCondition(uint GDB_ID, string condition) /// /// Breakpoint ID in GDB. /// If successful, returns true; otherwise, returns false. - public bool deleteBreakpoint(uint GDB_ID) + public bool DeleteBreakpoint(uint GDB_ID) { - if (m_gdbOutput._running) + if (_gdbOutput.IsRunning) { - prepareToModifyBreakpoint(); + PrepareToModifyBreakpoint(); // Gets the parsed response for the GDB/MI command that deletes the breakpoint "GDB_ID". // (http://sourceware.org/gdb/onlinedocs/gdb/GDB_002fMI-Breakpoint-Commands.html) string response = GDBParser.parseCommand(@"-break-delete " + GDB_ID, 7); if (response == null || response == "") { - resumeFromInterrupt(); + ResumeFromInterrupt(); return false; } @@ -510,7 +508,7 @@ public bool deleteBreakpoint(uint GDB_ID) hBreakpoints.handle(response); uint retID = (uint)hBreakpoints.number; - resumeFromInterrupt(); + ResumeFromInterrupt(); if (GDB_ID != retID) { @@ -530,7 +528,7 @@ public bool deleteBreakpoint(uint GDB_ID) /// If successful, returns true; otherwise, returns false. public bool enableBreakpoint(uint GDB_ID, bool fEnable) { - prepareToModifyBreakpoint(); + PrepareToModifyBreakpoint(); string inputCommand; string sEnable = "enable"; @@ -549,7 +547,7 @@ public bool enableBreakpoint(uint GDB_ID, bool fEnable) hBreakpoints.handle(response); uint retID = (uint)hBreakpoints.number; - resumeFromInterrupt(); + ResumeFromInterrupt(); if (GDB_ID != retID) { return false; @@ -566,10 +564,10 @@ public bool enableBreakpoint(uint GDB_ID, bool fEnable) /// Hit count. public void updateHitCount(uint ID, uint hitCount) { - var bbp = m_engine.BPMgr.getBoundBreakpointForGDBID(ID); + var bbp = Engine.BPMgr.GetBoundBreakpointForGDBID(ID); if (bbp != null) { - if (!bbp.m_breakWhenCondChanged) + if (!bbp._breakWhenCondChanged) ((IDebugBoundBreakpoint2)bbp).SetHitCount(hitCount); } } @@ -588,30 +586,30 @@ public void updateHitCount(uint ID, uint hitCount) /// If successful, returns true; otherwise, returns false. public bool lockedBreakpoint(AD7BoundBreakpoint bbp, bool hit, bool cond) { - lock (m_lockBreakpoint) + lock (_lockBreakpoint) { if (hit && cond) { - if ((!bbp.m_blockedPassCount) && (!bbp.m_blockedConditional)) + if ((!bbp._blockedPassCount) && (!bbp._blockedConditional)) { - bbp.m_blockedPassCount = true; - bbp.m_blockedConditional = true; + bbp._blockedPassCount = true; + bbp._blockedConditional = true; return true; } } else if (hit) { - if (!bbp.m_blockedPassCount) + if (!bbp._blockedPassCount) { - bbp.m_blockedPassCount = true; + bbp._blockedPassCount = true; return true; } } else if (cond) { - if (!bbp.m_blockedConditional) + if (!bbp._blockedConditional) { - bbp.m_blockedConditional = true; + bbp._blockedConditional = true; return true; } } @@ -632,20 +630,20 @@ public bool lockedBreakpoint(AD7BoundBreakpoint bbp, bool hit, bool cond) /// when event dispatcher is handling a breakpoint hit. public void unlockBreakpoint(AD7BoundBreakpoint bbp, bool hit, bool cond) { - lock (m_unlockBreakpoint) + lock (_unlockBreakpoint) { if (hit && cond) { - bbp.m_blockedPassCount = false; - bbp.m_blockedConditional = false; + bbp._blockedPassCount = false; + bbp._blockedConditional = false; } else if (hit) { - bbp.m_blockedPassCount = false; + bbp._blockedPassCount = false; } else if (cond) { - bbp.m_blockedConditional = false; + bbp._blockedConditional = false; } } } @@ -659,11 +657,11 @@ public void unlockBreakpoint(AD7BoundBreakpoint bbp, bool hit, bool cond) /// If successful, returns true; otherwise, returns false. public bool enterCriticalRegion() { - lock (m_criticalRegion) + lock (_criticalRegion) { - if (!inCriticalRegion) + if (!_inCriticalRegion) { - inCriticalRegion = true; + _inCriticalRegion = true; return true; } return false; @@ -678,9 +676,9 @@ public bool enterCriticalRegion() /// public void leaveCriticalRegion() { - lock (m_leaveCriticalRegion) + lock (_leaveCriticalRegion) { - inCriticalRegion = false; + _inCriticalRegion = false; } } @@ -695,7 +693,7 @@ public void breakpointHit(uint ID, string threadID) var xBoundBreakpoints = new List(); // Search the active bound BPs and find ones that match the ID. - var bbp = m_engine.BPMgr.getBoundBreakpointForGDBID(ID); + var bbp = Engine.BPMgr.GetBoundBreakpointForGDBID(ID); if (bbp != null) xBoundBreakpoints.Add(bbp); @@ -718,63 +716,63 @@ public void breakpointHit(uint ID, string threadID) bool breakExecution = true; - if (bbp.m_breakWhenCondChanged) + if (bbp._breakWhenCondChanged) { string result = ""; bool valid = VariableInfo.evaluateExpression(bbp.m_bpCondition.bstrCondition, ref result, null); - if ((valid) && (bbp.m_previousCondEvaluation != result)) // check if condition evaluation has changed + if ((valid) && (bbp._previousCondEvaluation != result)) // check if condition evaluation has changed { - if ((bbp.m_bpPassCount.stylePassCount == enum_BP_PASSCOUNT_STYLE.BP_PASSCOUNT_EQUAL) && (bbp.m_hitCount != bbp.m_bpPassCount.dwPassCount)) + if ((bbp.m_bpPassCount.stylePassCount == enum_BP_PASSCOUNT_STYLE.BP_PASSCOUNT_EQUAL) && (bbp._hitCount != bbp.m_bpPassCount.dwPassCount)) { breakExecution = false; } - else if ((bbp.m_bpPassCount.stylePassCount == enum_BP_PASSCOUNT_STYLE.BP_PASSCOUNT_EQUAL_OR_GREATER) && (bbp.m_hitCount < bbp.m_bpPassCount.dwPassCount)) + else if ((bbp.m_bpPassCount.stylePassCount == enum_BP_PASSCOUNT_STYLE.BP_PASSCOUNT_EQUAL_OR_GREATER) && (bbp._hitCount < bbp.m_bpPassCount.dwPassCount)) { breakExecution = false; } - else if ((bbp.m_bpPassCount.stylePassCount == enum_BP_PASSCOUNT_STYLE.BP_PASSCOUNT_MOD) && ((bbp.m_hitCount % bbp.m_bpPassCount.dwPassCount) != 0)) + else if ((bbp.m_bpPassCount.stylePassCount == enum_BP_PASSCOUNT_STYLE.BP_PASSCOUNT_MOD) && ((bbp._hitCount % bbp.m_bpPassCount.dwPassCount) != 0)) { breakExecution = false; } - bbp.m_previousCondEvaluation = result; + bbp._previousCondEvaluation = result; } else breakExecution = false; } if (!breakExecution) // must continue the execution { - bool hitBreakAll = m_engine.m_running.WaitOne(0); + bool hitBreakAll = Engine.m_running.WaitOne(0); if (hitBreakAll) { - m_engine.m_state = AD7Engine.DE_STATE.RUN_MODE; + Engine.m_state = AD7Engine.DE_STATE.RUN_MODE; // Sends the GDB command that resumes the execution of the inferior program. // (http://sourceware.org/gdb/onlinedocs/gdb/GDB_002fMI-Program-Execution.html) GDBParser.addGDBCommand(@"-exec-continue --thread-group i1"); - EventDispatcher.m_GDBRunMode = true; - m_engine.m_running.Set(); + EventDispatcher._GDBRunMode = true; + Engine.m_running.Set(); } } else { - if (bbp.m_breakWhenCondChanged) - bbp.m_hitCount += 1; + if (bbp._breakWhenCondChanged) + bbp._hitCount += 1; // Transition DE state - EventDispatcher.m_GDBRunMode = false; - m_engine.m_state = AD7Engine.DE_STATE.BREAK_MODE; + EventDispatcher._GDBRunMode = false; + Engine.m_state = AD7Engine.DE_STATE.BREAK_MODE; // Found a bound breakpoint - m_engine.Callback.OnBreakpoint(m_engine.SelectThread(threadID), xBoundBreakpoints.AsReadOnly()); + Engine.Callback.OnBreakpoint(Engine.SelectThread(threadID), xBoundBreakpoints.AsReadOnly()); - if (bbp.m_isHitCountEqual) + if (bbp._isHitCountEqual) { // Have to ignore the biggest number of times to keep the breakpoint enabled and to avoid stopping on it. ignoreHitCount(ID, int.MaxValue); } - else if (bbp.m_hitCountMultiple != 0) + else if (bbp._hitCountMultiple != 0) { - ignoreHitCount(ID, (int)(bbp.m_hitCountMultiple - (bbp.m_hitCount % bbp.m_hitCountMultiple))); + ignoreHitCount(ID, (int)(bbp._hitCountMultiple - (bbp._hitCount % bbp._hitCountMultiple))); } } leaveCriticalRegion(); @@ -787,16 +785,16 @@ public void breakpointHit(uint ID, string threadID) Thread.Sleep(0); } - bool hitBreakAll = m_engine.m_running.WaitOne(0); + bool hitBreakAll = Engine.m_running.WaitOne(0); if (hitBreakAll) { - m_engine.m_state = AD7Engine.DE_STATE.RUN_MODE; + Engine.m_state = AD7Engine.DE_STATE.RUN_MODE; // Sends the GDB command that resumes the execution of the inferior program. // (http://sourceware.org/gdb/onlinedocs/gdb/GDB_002fMI-Program-Execution.html) GDBParser.addGDBCommand(@"-exec-continue --thread-group i1"); - EventDispatcher.m_GDBRunMode = true; - m_engine.m_running.Set(); + EventDispatcher._GDBRunMode = true; + Engine.m_running.Set(); } leaveCriticalRegion(); @@ -822,7 +820,7 @@ public AD7DocumentContext getDocumentContext(string filename, uint line) endPosition[0].dwColumn = 0; uint address = 0; - AD7MemoryAddress codeContext = new AD7MemoryAddress(m_engine, address); + AD7MemoryAddress codeContext = new AD7MemoryAddress(Engine, address); return new AD7DocumentContext(filename, startPosition[0], endPosition[0], codeContext); } @@ -948,16 +946,16 @@ public void killProcess() public void continueExecution() { //** Transition DE state - bool hitBreakAll = m_engine.m_running.WaitOne(0); + bool hitBreakAll = Engine.m_running.WaitOne(0); if (hitBreakAll) { - m_engine.m_state = AD7Engine.DE_STATE.RUN_MODE; + Engine.m_state = AD7Engine.DE_STATE.RUN_MODE; // Sends the GDB command that resumes the execution of the inferior program. // (http://sourceware.org/gdb/onlinedocs/gdb/GDB_002fMI-Program-Execution.html) GDBParser.addGDBCommand(@"-exec-continue --thread-group i1"); - EventDispatcher.m_GDBRunMode = true; - m_engine.m_running.Set(); + EventDispatcher._GDBRunMode = true; + Engine.m_running.Set(); } } } @@ -1094,7 +1092,7 @@ public void handle(string ev) if (m_addr == "") { m_func = "??"; - EventDispatcher.m_unknownCode = true; + EventDispatcher._unknownCode = true; m_filename = ""; m_line = 0; m_hits = 0; @@ -1140,11 +1138,11 @@ public void handle(string ev) // Need to set the flag for unknown code if necessary. if (m_func == "??") { - EventDispatcher.m_unknownCode = true; + EventDispatcher._unknownCode = true; } else { - EventDispatcher.m_unknownCode = false; + EventDispatcher._unknownCode = false; } ini = end + 1; @@ -1204,11 +1202,11 @@ public void handle(string ev) case '7': // Breakpoint hit. // Example: 27,1,C:/Users/xxxxxx/vsplugin-ndk/samples/Square/Square/main.c,319;1\r\n - bool updatingCondBreak = this.m_eventDispatcher.engine.m_updatingConditionalBreakpoint.WaitOne(0); + bool updatingCondBreak = m_eventDispatcher.Engine.m_updatingConditionalBreakpoint.WaitOne(0); if (updatingCondBreak) { - m_eventDispatcher.engine.resetStackFrames(); + m_eventDispatcher.Engine.resetStackFrames(); ini = 3; end = ev.IndexOf(';', 3); @@ -1225,28 +1223,28 @@ public void handle(string ev) ini = end + 1; m_threadID = ev.Substring(ini, (ev.Length - ini)); - this.m_eventDispatcher.engine.cleanEvaluatedThreads(); + m_eventDispatcher.Engine.cleanEvaluatedThreads(); // Call the method/event that will stop SDM because a breakpoint was hit here. - if (m_eventDispatcher.engine._updateThreads) + if (m_eventDispatcher.Engine._updateThreads) { - m_eventDispatcher.engine.UpdateListOfThreads(); + m_eventDispatcher.Engine.UpdateListOfThreads(); } - m_eventDispatcher.engine.SelectThread(m_threadID).setCurrentLocation(m_filename, (uint)m_line); - m_eventDispatcher.engine.SetAsCurrentThread(m_threadID); + m_eventDispatcher.Engine.SelectThread(m_threadID).setCurrentLocation(m_filename, (uint)m_line); + m_eventDispatcher.Engine.SetAsCurrentThread(m_threadID); // A breakpoint can be hit during a step - if (m_eventDispatcher.engine.m_state == AD7Engine.DE_STATE.STEP_MODE) + if (m_eventDispatcher.Engine.m_state == AD7Engine.DE_STATE.STEP_MODE) { HandleProcessExecution.onStepCompleted(m_eventDispatcher, m_filename, (uint)m_line); } else { // Visual Studio shows the line position one more than it actually is - m_eventDispatcher.engine.m_docContext = m_eventDispatcher.getDocumentContext(m_filename, (uint)(m_line - 1)); + m_eventDispatcher.Engine.m_docContext = m_eventDispatcher.getDocumentContext(m_filename, (uint)(m_line - 1)); m_eventDispatcher.breakpointHit((uint)m_number, m_threadID); } - this.m_eventDispatcher.engine.m_updatingConditionalBreakpoint.Set(); + m_eventDispatcher.Engine.m_updatingConditionalBreakpoint.Set(); } break; case '8': @@ -1368,7 +1366,7 @@ public void handle(string ev) { case '0': // Thread created. Example: 40,2,20537438 - EventDispatcher.m_GDBRunMode = true; + EventDispatcher._GDBRunMode = true; ini = 3; end = ev.IndexOf(";", 3); m_threadId = Convert.ToInt32(ev.Substring(ini, (end - ini))); @@ -1383,18 +1381,18 @@ public void handle(string ev) m_processId = 0; } - m_eventDispatcher.engine._updateThreads = true; + m_eventDispatcher.Engine._updateThreads = true; break; case '1': // Process running. Example: 41,1 (when threadId is 0 means "all threads": example: 41,0) - EventDispatcher.m_GDBRunMode = true; + EventDispatcher._GDBRunMode = true; m_threadId = Convert.ToInt32(ev.Substring(3, (ev.Length - 3))); break; case '2': // Program exited normally. Example: 42 - m_eventDispatcher.endDebugSession(0); + m_eventDispatcher.EndDebugSession(0); break; case '3': @@ -1402,7 +1400,7 @@ public void handle(string ev) // TODO: not tested yet end = ev.IndexOf(";", 3); uint exitCode = Convert.ToUInt32(ev.Substring(3, (end - 3))); - m_eventDispatcher.endDebugSession(exitCode); + m_eventDispatcher.EndDebugSession(exitCode); break; case '4': @@ -1411,8 +1409,8 @@ public void handle(string ev) // 44,ADDR,FUNC,THREAD-ID // 44,ADDR,FUNC,FILENAME,LINE,THREAD-ID - m_eventDispatcher.engine.resetStackFrames(); - EventDispatcher.m_GDBRunMode = false; + m_eventDispatcher.Engine.resetStackFrames(); + EventDispatcher._GDBRunMode = false; numCommas = 0; foreach (char c in ev) { @@ -1430,11 +1428,11 @@ public void handle(string ev) if (m_func == "??") { - EventDispatcher.m_unknownCode = true; + EventDispatcher._unknownCode = true; } else { - EventDispatcher.m_unknownCode = false; + EventDispatcher._unknownCode = false; } switch (numCommas) @@ -1443,7 +1441,7 @@ public void handle(string ev) // Thread ID ini = end + 1; m_threadId = Convert.ToInt32(ev.Substring(ini, (ev.Length - ini))); - EventDispatcher.m_unknownCode = true; + EventDispatcher._unknownCode = true; break; case 4: // Filename and line number @@ -1471,17 +1469,17 @@ public void handle(string ev) break; } - this.m_eventDispatcher.engine.cleanEvaluatedThreads(); + this.m_eventDispatcher.Engine.cleanEvaluatedThreads(); - if (m_eventDispatcher.engine._updateThreads) + if (m_eventDispatcher.Engine._updateThreads) { - m_eventDispatcher.engine.UpdateListOfThreads(); + m_eventDispatcher.Engine.UpdateListOfThreads(); } if (m_threadId > 0) { - m_eventDispatcher.engine.SelectThread(m_threadId.ToString()).setCurrentLocation(m_file, (uint)m_line); - m_eventDispatcher.engine.SetAsCurrentThread(m_threadId.ToString()); + m_eventDispatcher.Engine.SelectThread(m_threadId.ToString()).setCurrentLocation(m_file, (uint)m_line); + m_eventDispatcher.Engine.SetAsCurrentThread(m_threadId.ToString()); } // Call the method/event that will let SDM know that the debugged program was interrupted. @@ -1494,8 +1492,8 @@ public void handle(string ev) case '5': // End-stepping-range. - m_eventDispatcher.engine.resetStackFrames(); - EventDispatcher.m_GDBRunMode = false; + m_eventDispatcher.Engine.resetStackFrames(); + EventDispatcher._GDBRunMode = false; ini = 3; end = ev.IndexOf(';', 3); if (end == -1) @@ -1515,7 +1513,7 @@ public void handle(string ev) m_file = ""; m_line = 1; m_threadId = Convert.ToInt32(temp); - EventDispatcher.m_unknownCode = true; + EventDispatcher._unknownCode = true; } else { @@ -1524,21 +1522,21 @@ public void handle(string ev) ini = end + 1; m_threadId = Convert.ToInt32(ev.Substring(ini, (ev.Length - ini))); - EventDispatcher.m_unknownCode = false; + EventDispatcher._unknownCode = false; } - this.m_eventDispatcher.engine.cleanEvaluatedThreads(); + this.m_eventDispatcher.Engine.cleanEvaluatedThreads(); - if (m_eventDispatcher.engine._updateThreads) + if (m_eventDispatcher.Engine._updateThreads) { - m_eventDispatcher.engine.UpdateListOfThreads(); + m_eventDispatcher.Engine.UpdateListOfThreads(); } if (m_threadId > 0) { - if ((EventDispatcher.m_unknownCode == false) && (m_file != "")) - m_eventDispatcher.engine.SelectThread(m_threadId.ToString()).setCurrentLocation(m_file, (uint)m_line); - m_eventDispatcher.engine.SetAsCurrentThread(m_threadId.ToString()); + if ((EventDispatcher._unknownCode == false) && (m_file != "")) + m_eventDispatcher.Engine.SelectThread(m_threadId.ToString()).setCurrentLocation(m_file, (uint)m_line); + m_eventDispatcher.Engine.SetAsCurrentThread(m_threadId.ToString()); } HandleProcessExecution.onStepCompleted(m_eventDispatcher, m_file, (uint)m_line); @@ -1546,8 +1544,8 @@ public void handle(string ev) break; case '6': // Function-finished. - m_eventDispatcher.engine.resetStackFrames(); - EventDispatcher.m_GDBRunMode = false; + m_eventDispatcher.Engine.resetStackFrames(); + EventDispatcher._GDBRunMode = false; ini = 3; end = ev.IndexOf(';', 3); if (end == -1) @@ -1556,7 +1554,7 @@ public void handle(string ev) m_file = ""; m_line = 1; m_threadId = Convert.ToInt32(ev.Substring(ini, (ev.Length - ini))); - EventDispatcher.m_unknownCode = true; + EventDispatcher._unknownCode = true; } else { @@ -1567,20 +1565,20 @@ public void handle(string ev) ini = end + 1; m_threadId = Convert.ToInt32(ev.Substring(ini, (ev.Length - ini))); - EventDispatcher.m_unknownCode = false; + EventDispatcher._unknownCode = false; } - this.m_eventDispatcher.engine.cleanEvaluatedThreads(); + m_eventDispatcher.Engine.cleanEvaluatedThreads(); - if (m_eventDispatcher.engine._updateThreads) + if (m_eventDispatcher.Engine._updateThreads) { - m_eventDispatcher.engine.UpdateListOfThreads(); + m_eventDispatcher.Engine.UpdateListOfThreads(); } if (m_threadId > 0) { - if ((EventDispatcher.m_unknownCode == false) && (m_file != "")) - m_eventDispatcher.engine.SelectThread(m_threadId.ToString()).setCurrentLocation(m_file, (uint)m_line); - m_eventDispatcher.engine.SetAsCurrentThread(m_threadId.ToString()); + if ((EventDispatcher._unknownCode == false) && (m_file != "")) + m_eventDispatcher.Engine.SelectThread(m_threadId.ToString()).setCurrentLocation(m_file, (uint)m_line); + m_eventDispatcher.Engine.SetAsCurrentThread(m_threadId.ToString()); } HandleProcessExecution.onStepCompleted(m_eventDispatcher, m_file, (uint)m_line); @@ -1588,25 +1586,25 @@ public void handle(string ev) break; case '7': // -exec-interrupt or signal-meaning="Killed". There's nothing to do in this case. - m_eventDispatcher.engine.resetStackFrames(); - EventDispatcher.m_GDBRunMode = false; + m_eventDispatcher.Engine.resetStackFrames(); + EventDispatcher._GDBRunMode = false; - this.m_eventDispatcher.engine.cleanEvaluatedThreads(); + m_eventDispatcher.Engine.cleanEvaluatedThreads(); m_threadId = Convert.ToInt32(ev.Substring(3, (ev.Length - 3))); - if (m_eventDispatcher.engine._updateThreads) + if (m_eventDispatcher.Engine._updateThreads) { - m_eventDispatcher.engine.UpdateListOfThreads(); + m_eventDispatcher.Engine.UpdateListOfThreads(); } if (m_threadId > 0) { - if ((EventDispatcher.m_unknownCode == false) && (m_file != "")) - m_eventDispatcher.engine.SelectThread(m_threadId.ToString()).setCurrentLocation(m_file, (uint)m_line); - m_eventDispatcher.engine.SetAsCurrentThread(m_threadId.ToString()); + if ((EventDispatcher._unknownCode == false) && (m_file != "")) + m_eventDispatcher.Engine.SelectThread(m_threadId.ToString()).setCurrentLocation(m_file, (uint)m_line); + m_eventDispatcher.Engine.SetAsCurrentThread(m_threadId.ToString()); } - if (m_eventDispatcher.engine.m_state != AD7Engine.DE_STATE.BREAK_MODE) + if (m_eventDispatcher.Engine.m_state != AD7Engine.DE_STATE.BREAK_MODE) { onInterrupt(m_threadId); } @@ -1616,16 +1614,16 @@ public void handle(string ev) break; case '8': // SIGKILL - m_eventDispatcher.endDebugSession(0); + m_eventDispatcher.EndDebugSession(0); break; case '9': // ERROR, ex: 49,Cannot find bounds of current function - m_eventDispatcher.engine.resetStackFrames(); - this.m_eventDispatcher.engine.cleanEvaluatedThreads(); + m_eventDispatcher.Engine.resetStackFrames(); + m_eventDispatcher.Engine.cleanEvaluatedThreads(); - if (m_eventDispatcher.engine._updateThreads) + if (m_eventDispatcher.Engine._updateThreads) { - m_eventDispatcher.engine.UpdateListOfThreads(); + m_eventDispatcher.Engine.UpdateListOfThreads(); } if (ev.Length >= 3) @@ -1634,8 +1632,8 @@ public void handle(string ev) if (m_error == "Cannot find bounds of current function") { // We don't have symbols for this function so further stepping won't be possible. Return from this function. - EventDispatcher.m_unknownCode = true; - m_eventDispatcher.engine.Step(m_eventDispatcher.engine.CurrentThread(), enum_STEPKIND.STEP_OUT, enum_STEPUNIT.STEP_LINE); + EventDispatcher._unknownCode = true; + m_eventDispatcher.Engine.Step(m_eventDispatcher.Engine.CurrentThread(), enum_STEPKIND.STEP_OUT, enum_STEPUNIT.STEP_LINE); } } break; @@ -1651,7 +1649,7 @@ public void handle(string ev) m_eventDispatcher.countSIGINT += 1; if (m_eventDispatcher.countSIGINT > 5) { - m_eventDispatcher.endDebugSession(0); + m_eventDispatcher.EndDebugSession(0); MessageBox.Show("Lost communication with GDB. Please refer to documentation for more details.", "GDB failure", MessageBoxButtons.OK, MessageBoxIcon.Error); } break; @@ -1660,19 +1658,19 @@ public void handle(string ev) ini = 3; m_threadId = Convert.ToInt32(ev.Substring(ini, (ev.Length - ini))); - m_eventDispatcher.engine._updateThreads = true; + m_eventDispatcher.Engine._updateThreads = true; break; case '2': // GDB Bugs, like "... 2374: internal-error: frame_cleanup_after_sniffer ...". Example: 52 - m_eventDispatcher.endDebugSession(0); + m_eventDispatcher.EndDebugSession(0); MessageBox.Show("This is a known issue that can happen when interrupting GDB's execution by hitting the \"break all\" or toggling a breakpoint in run mode. \n\n GDB CRASHED. Details: \"../../gdb/frame.c:2374: internal-error: frame_cleanup_after_sniffer: Assertion `frame->prologue_cache == NULL' failed.\nA problem internal to GDB has been detected,\nfurther debugging may prove unreliable.\" \r\n \nPlease close the app in the device/simulator if you want to debug it again.", "GDB failure", MessageBoxButtons.OK, MessageBoxIcon.Error); break; case '3': // Lost communication with device/simulator: ^error,msg="Remote communication error: No error." MessageBox.Show("Lost communication with the device/simulator.", "Communication lost", MessageBoxButtons.OK, MessageBoxIcon.Error); - m_eventDispatcher.endDebugSession(0); + m_eventDispatcher.EndDebugSession(0); break; case '4': @@ -1681,8 +1679,8 @@ public void handle(string ev) // 54,ADDR,FUNC,THREAD-ID // 54,ADDR,FUNC,FILENAME,LINE,THREAD-ID - m_eventDispatcher.engine.resetStackFrames(); - EventDispatcher.m_GDBRunMode = false; + m_eventDispatcher.Engine.resetStackFrames(); + EventDispatcher._GDBRunMode = false; numCommas = 0; foreach (char c in ev) { @@ -1700,11 +1698,11 @@ public void handle(string ev) if (m_func == "??") { - EventDispatcher.m_unknownCode = true; + EventDispatcher._unknownCode = true; } else { - EventDispatcher.m_unknownCode = false; + EventDispatcher._unknownCode = false; } switch (numCommas) @@ -1713,7 +1711,7 @@ public void handle(string ev) // Thread ID ini = end + 1; m_threadId = Convert.ToInt32(ev.Substring(ini, (ev.Length - ini))); - EventDispatcher.m_unknownCode = true; + EventDispatcher._unknownCode = true; break; case 5: // Filename, line number and thread ID @@ -1734,16 +1732,16 @@ public void handle(string ev) MessageBox.Show("Segmentation Fault: If you continue debugging could take the environment to an unstable state.", "Segmentation Fault", MessageBoxButtons.OK, MessageBoxIcon.Warning); - this.m_eventDispatcher.engine.cleanEvaluatedThreads(); + m_eventDispatcher.Engine.cleanEvaluatedThreads(); - if (m_eventDispatcher.engine._updateThreads) + if (m_eventDispatcher.Engine._updateThreads) { - m_eventDispatcher.engine.UpdateListOfThreads(); + m_eventDispatcher.Engine.UpdateListOfThreads(); } if (m_threadId > 0) { - m_eventDispatcher.engine.SelectThread(m_threadId.ToString()).setCurrentLocation(m_file, (uint)m_line); - m_eventDispatcher.engine.SetAsCurrentThread(m_threadId.ToString()); + m_eventDispatcher.Engine.SelectThread(m_threadId.ToString()).setCurrentLocation(m_file, (uint)m_line); + m_eventDispatcher.Engine.SetAsCurrentThread(m_threadId.ToString()); } onInterrupt(m_threadId); @@ -1773,19 +1771,19 @@ public void handle(string ev) if (m_signalMeaning == "Segmentation fault") { MessageBox.Show("Segmentation Fault: Closing debugger.", "Segmentation Fault", MessageBoxButtons.OK, MessageBoxIcon.Error); - m_eventDispatcher.endDebugSession(0); + m_eventDispatcher.EndDebugSession(0); } if (m_signalMeaning == "Aborted") { MessageBox.Show("Program aborted: Closing debugger.", "Program Aborted", MessageBoxButtons.OK, MessageBoxIcon.Error); - m_eventDispatcher.endDebugSession(0); + m_eventDispatcher.EndDebugSession(0); } break; case '6': // GDB Bugs, like "... 3550: internal-error: handle_inferior_event ...". Example: 56 - m_eventDispatcher.endDebugSession(0); + m_eventDispatcher.EndDebugSession(0); MessageBox.Show("This is a known issue that can happen while debugging multithreaded programs. \n\n GDB CRASHED. Details: \"../../gdb/infrun.c:3550: internal-error: handle_inferior_event: Assertion ptid_equal (singlestep_ptid, ecs->ptid)' failed.\nA problem internal to GDB has been detected,\nfurther debugging may prove unreliable.\" \r\n \nPlease close the app in the device/simulator if you want to debug it again.", "GDB failure", MessageBoxButtons.OK, MessageBoxIcon.Error); break; @@ -1813,13 +1811,13 @@ public void handle(string ev) /// Line number. public static void onStepCompleted(EventDispatcher eventDispatcher, string file, uint line) { - if (eventDispatcher.engine.m_state == AD7Engine.DE_STATE.STEP_MODE) + if (eventDispatcher.Engine.m_state == AD7Engine.DE_STATE.STEP_MODE) { - eventDispatcher.engine.m_state = AD7Engine.DE_STATE.BREAK_MODE; + eventDispatcher.Engine.m_state = AD7Engine.DE_STATE.BREAK_MODE; // Visual Studio shows the line position one more than it actually is - eventDispatcher.engine.m_docContext = eventDispatcher.getDocumentContext(file, line - 1); - AD7StepCompletedEvent.Send(eventDispatcher.engine); + eventDispatcher.Engine.m_docContext = eventDispatcher.getDocumentContext(file, line - 1); + AD7StepCompletedEvent.Send(eventDispatcher.Engine); } } @@ -1830,19 +1828,19 @@ public static void onStepCompleted(EventDispatcher eventDispatcher, string file, /// Thread ID. private void onInterrupt(int threadID) { - Debug.Assert(m_eventDispatcher.engine.m_state == AD7Engine.DE_STATE.RUN_MODE); - m_eventDispatcher.engine.m_state = AD7Engine.DE_STATE.BREAK_MODE; + Debug.Assert(m_eventDispatcher.Engine.m_state == AD7Engine.DE_STATE.RUN_MODE); + m_eventDispatcher.Engine.m_state = AD7Engine.DE_STATE.BREAK_MODE; if (m_file != "" && m_line > 0) { // Visual Studio shows the line position one more than it actually is - m_eventDispatcher.engine.m_docContext = m_eventDispatcher.getDocumentContext(m_file, (uint)(m_line - 1)); + m_eventDispatcher.Engine.m_docContext = m_eventDispatcher.getDocumentContext(m_file, (uint)(m_line - 1)); } // Only send OnAsyncBreakComplete if break-all was requested by the user if (!m_needsResumeAfterInterrupt) { - m_eventDispatcher.engine.Callback.OnAsyncBreakComplete(m_eventDispatcher.engine.SelectThread(threadID.ToString())); + m_eventDispatcher.Engine.Callback.OnAsyncBreakComplete(m_eventDispatcher.Engine.SelectThread(threadID.ToString())); } } } From c5674fe625930a0a53e18755ea1b22ffd3c043ca Mon Sep 17 00:00:00 2001 From: Pawel Hofman Date: Wed, 25 Jun 2014 17:39:02 +0200 Subject: [PATCH 289/851] Started porting GDB parsert to C# --- .../NativeCore/BlackBerry.NativeCore.csproj | 6 +++ src_vs2012/NativeCore/Debugger/Instruction.cs | 39 +++++++++++++++++++ 2 files changed, 45 insertions(+) create mode 100644 src_vs2012/NativeCore/Debugger/Instruction.cs diff --git a/src_vs2012/NativeCore/BlackBerry.NativeCore.csproj b/src_vs2012/NativeCore/BlackBerry.NativeCore.csproj index e59d734e..a4c62cdf 100644 --- a/src_vs2012/NativeCore/BlackBerry.NativeCore.csproj +++ b/src_vs2012/NativeCore/BlackBerry.NativeCore.csproj @@ -48,6 +48,7 @@ + @@ -96,6 +97,11 @@ + + + Resources\Instructions.txt + + diff --git a/src_vs2010/BuildTasks/BlackBerrySimulator/Rules/debugger_ndk.xml b/src_vs2010/BuildTasks/BlackBerrySimulator/Rules/debugger_ndk.xml index 9f1b5bb8..f00b842e 100644 --- a/src_vs2010/BuildTasks/BlackBerrySimulator/Rules/debugger_ndk.xml +++ b/src_vs2010/BuildTasks/BlackBerrySimulator/Rules/debugger_ndk.xml @@ -1,9 +1,9 @@  From 59b7b65c2f6940c4a6c22b57eb547b4283a94d7e Mon Sep 17 00:00:00 2001 From: Pawel Hofman Date: Mon, 7 Jul 2014 11:53:06 +0200 Subject: [PATCH 337/851] Extracted copying templates in setup script Into separate subproceure. It turned out, this wizard is also used, when only testing debugger (along with /msbuild-only switch) --- setup.bat | 46 ++++++++++++++++++++++++++++++++++------------ 1 file changed, 34 insertions(+), 12 deletions(-) diff --git a/setup.bat b/setup.bat index b940eddb..a7c1745b 100644 --- a/setup.bat +++ b/setup.bat @@ -128,17 +128,49 @@ call :processTools "%thisDir%" "%PluginRoot%" "%SystemDrive%" set /a actionNo += 1 :skip_tools -call :processPlugin "%BuildPath%" "%PluginRoot%" "%VSPluginPath%" "%VSWizardsPath%" +call :processPlugin "%BuildPath%" "%PluginRoot%" "%VSPluginPath%" set /a actionNo += 1 :msbuild_only -call :processMSBuild "%BuildPath%" "%MSBuildTargetPath%" +call :processMSBuild "%BuildPath%" "%MSBuildTargetPath%" +set /a actionNo += 1 + +call :processTemplates "%BuildPath%" "%VSWizardsPath%" set /a actionNo += 1 :processSetup_End endlocal exit /b +REM ******************************************************************************************** +REM Templates +REM ******************************************************************************************** +REM $1 - from +REM $2 - Wizards path +:processTemplates +setlocal + +set InputPath=%~1 +set OutputWizardsPath=%~2 + +if %ActionUninstall% neq 0 (goto uninstall_Templates) + +REM Templates +echo Copy BlackBerry VCWizards directory +xcopy "%InputPath%\Templates\VCWizards" "%OutputWizardsPath%" /e /i /y + +goto processTemplates_End + +:uninstall_Templates + +REM Remove Templates +echo Delete BlackBerry VCWizards directory +rd "%OutputWizardsPath%\BlackBerry" /s /q + +:processTemplates_End +endlocal +exit /b + REM ******************************************************************************************** REM MSBuild system upgrade REM ******************************************************************************************** @@ -180,14 +212,12 @@ REM **************************************************************************** REM $1 - from REM $2 - to (plugin path) REM $3 - to (Visual Studio path) -REM $4 - Wizards path :processPlugin setlocal EnableDelayedExpansion set InputPath=%~1 set OutputPluginPath=%~2 set OutputVsPath=%~3 -set OutputWizardsPath=%~4 if %ActionUninstall% neq 0 (goto uninstall_Plugin) @@ -216,10 +246,6 @@ copy "%InputPath%\Instructions.txt" "%OutputVsPath%\Instructions.txt" echo "%InputPath%\BlackBerry.DebugEngine.dll" to "%OutputVsPath%\BlackBerry.DebugEngine.dll" copy "%InputPath%\BlackBerry.DebugEngine.dll" "%OutputVsPath%\BlackBerry.DebugEngine.dll" -REM Templates -echo Copy BlackBerry VCWizards directory -xcopy "%InputPath%\Templates\VCWizards" "%OutputWizardsPath%" /e /i /y - goto processPlugin_End :uninstall_Plugin @@ -251,10 +277,6 @@ rd "%OutputPluginPath%" echo Remove Directory "%OutputVsPath%" rd "%OutputVsPath%" -REM Remove Templates -echo Delete BlackBerry VCWizards directory -rd "%OutputWizardsPath%\BlackBerry" /s /q - :processPlugin_End endlocal exit /b From 07f3927f6919bd71546b4b22238a72bba0344ff8 Mon Sep 17 00:00:00 2001 From: Pawel Hofman Date: Mon, 7 Jul 2014 12:01:49 +0200 Subject: [PATCH 338/851] Updated improper QCC switches in build-system Some of them were passed to QCC with '--', instead of single '-'. --- .../BlackBerry/Rules/ndk_general.xml | 29 +- .../BlackBerry/Rules/ndk_general_ps.xml | 3 +- .../BuildTasks/BlackBerry/Rules/qcc_cl.xml | 194 +++------- .../BuildTasks/BlackBerry/Rules/qcc_lib.xml | 120 +----- .../BuildTasks/BlackBerry/Rules/qcc_link.xml | 352 ++--------------- .../BlackBerrySimulator/Rules/ndk_general.xml | 160 +++----- .../BlackBerrySimulator/Rules/qcc_cl.xml | 194 +++------- .../BlackBerrySimulator/Rules/qcc_lib.xml | 119 +----- .../BlackBerrySimulator/Rules/qcc_link.xml | 360 ++---------------- 9 files changed, 258 insertions(+), 1273 deletions(-) diff --git a/src_vs2010/BuildTasks/BlackBerry/Rules/ndk_general.xml b/src_vs2010/BuildTasks/BlackBerry/Rules/ndk_general.xml index 2b834759..28ad434c 100644 --- a/src_vs2010/BuildTasks/BlackBerry/Rules/ndk_general.xml +++ b/src_vs2010/BuildTasks/BlackBerry/Rules/ndk_general.xml @@ -81,8 +81,8 @@ F1Keyword="VC.Project.VCConfiguration.ConfigurationType"> - - + + - - + + - + - - - - - - - - diff --git a/src_vs2010/BuildTasks/BlackBerry/Rules/ndk_general_ps.xml b/src_vs2010/BuildTasks/BlackBerry/Rules/ndk_general_ps.xml index d7389bc0..8a7ae903 100644 --- a/src_vs2010/BuildTasks/BlackBerry/Rules/ndk_general_ps.xml +++ b/src_vs2010/BuildTasks/BlackBerry/Rules/ndk_general_ps.xml @@ -42,8 +42,7 @@ + Category="General"> diff --git a/src_vs2010/BuildTasks/BlackBerry/Rules/qcc_cl.xml b/src_vs2010/BuildTasks/BlackBerry/Rules/qcc_cl.xml index 582cf32d..6ebc828e 100644 --- a/src_vs2010/BuildTasks/BlackBerry/Rules/qcc_cl.xml +++ b/src_vs2010/BuildTasks/BlackBerry/Rules/qcc_cl.xml @@ -16,181 +16,97 @@ + - - + - + Category="General" Switch="j" /> - - - - + + - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + - - + - + IncludeInCommandLine="false" Visible="false" /> - - - - + - - - - - - - - + + + + - - - - - - + - - - - - - + + + + + + - - - - + + - - + - - - - + + - - - - - - + + + \ No newline at end of file diff --git a/src_vs2010/BuildTasks/BlackBerry/Rules/qcc_lib.xml b/src_vs2010/BuildTasks/BlackBerry/Rules/qcc_lib.xml index aa53f443..36115ecb 100644 --- a/src_vs2010/BuildTasks/BlackBerry/Rules/qcc_lib.xml +++ b/src_vs2010/BuildTasks/BlackBerry/Rules/qcc_lib.xml @@ -23,132 +23,28 @@ Description="Allows the user to override the environmental library path" Category="General" Switch="L" F1Keyword="VC.Project.VCLibrarianTool.AdditionalLibraryDirectories"> - + + - - - + Category="General" Switch="Wl,-hname" > - + - - - + - \ No newline at end of file diff --git a/src_vs2010/BuildTasks/BlackBerry/Rules/qcc_link.xml b/src_vs2010/BuildTasks/BlackBerry/Rules/qcc_link.xml index 02673da3..86f987a7 100644 --- a/src_vs2010/BuildTasks/BlackBerry/Rules/qcc_link.xml +++ b/src_vs2010/BuildTasks/BlackBerry/Rules/qcc_link.xml @@ -14,52 +14,14 @@ - - + - - - - - - - - - + - - - - + - - - - - - - - - - - - - - - - + + + + + + + - - - - + + - - - - - - - - + + + + - - - - + + diff --git a/src_vs2010/BuildTasks/BlackBerrySimulator/Rules/ndk_general.xml b/src_vs2010/BuildTasks/BlackBerrySimulator/Rules/ndk_general.xml index 4a7e8cb8..304109b5 100644 --- a/src_vs2010/BuildTasks/BlackBerrySimulator/Rules/ndk_general.xml +++ b/src_vs2010/BuildTasks/BlackBerrySimulator/Rules/ndk_general.xml @@ -1,66 +1,67 @@ - + - - + + + Description="Specifies a path to the output file directory; can include environment variables. Relative paths are relative to the project directory." + Category="General" Default="$(Platform)\$(Configuration)\" + Subtype="folder" + F1Keyword="VC.Project.VCConfiguration.OutputDirectory"> + DisplayName="Intermediate Directory" + Description="Specifies a path to the intermediate file directory; can include environment variables. Relative paths are relative to the project directory." + Category="General" Default="$(Platform)\$(Configuration)\" + Subtype="folder" + F1Keyword="VC.Project.VCConfiguration.IntermediateDirectory"> + Description="Specifies a file name that this project will generate." + F1Keyword="VC.Project.VCConfiguration.TargetName" + Category="General" Default="$(ProjectName)"> + Description="Specifies a file extension that this project will generate. (Example: .exe or .dll)" + F1Keyword="VC.Project.VCConfiguration.TargetExt" + Category="General"> + DisplayName="Extensions to Delete on Clean" + Description="Semi-colon delimited wildcard specification for which files in the intermediate directory to delete on clean or rebuild." + Category="General" Separator=";" + F1Keyword="VC.Project.VCConfiguration.DeleteExtensionsOnClean"> + Description="Specifies the build log file to write to when build logging is enabled." + F1Keyword="VC.Project.VCConfiguration.BuildLogFile" + Category="General" + Default="$(ProjectDir)\$(MSBuildProjectName).log" Subtype="file"> @@ -71,40 +72,28 @@ xmlns="http://schemas.microsoft.com/build/2009/properties"> Description="Specifies the project property sheets this configuration or property sheet inherits from." Category="General" Separator=";" Subtype="file" /> --> + DisplayName="Platform Toolset" EnumProvider="Toolsets" + Description="Specifies the toolset used for building the current configuration; If not set, the default toolset is used" + F1Keyword="VC.Project.VCConfiguration.PlatformToolset" + Category="General" /> - - - - - + DisplayName="Configuration Type" + Description="Specifies the type of output this configuration generates." + Category="ProjectDefaults" + F1Keyword="VC.Project.VCConfiguration.ConfigurationType"> + + + + + - - - + Description="Tells the compiler to use the specified character set; aids in localization issues." + Category="ProjectDefaults" + F1Keyword="VC.Project.VCConfiguration.CharacterSet"> + + + - - + Description="Specifies that the compiler target is simulator or device." + Category="ProjectDefaults" Visible="false"> + + - + - + + DisplayName="Project File Version" + Description="Specifies the version of the conversion tool used to create this project file." + Category="General" Visible="false"> - - - - - - - diff --git a/src_vs2010/BuildTasks/BlackBerrySimulator/Rules/qcc_cl.xml b/src_vs2010/BuildTasks/BlackBerrySimulator/Rules/qcc_cl.xml index 28bc10e2..77a79c0a 100644 --- a/src_vs2010/BuildTasks/BlackBerrySimulator/Rules/qcc_cl.xml +++ b/src_vs2010/BuildTasks/BlackBerrySimulator/Rules/qcc_cl.xml @@ -17,180 +17,94 @@ - - + - + Category="General" Switch="j" /> - - - + Category="General" Switch="ansi" /> + - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + - - + - + IncludeInCommandLine="false" Visible="false" /> - - - - + - - - - - - - - + + + + - - - - - - - - - - - - - + + + + + + + + - - - - + + - - + - - - - + + - - - - - - + + + \ No newline at end of file diff --git a/src_vs2010/BuildTasks/BlackBerrySimulator/Rules/qcc_lib.xml b/src_vs2010/BuildTasks/BlackBerrySimulator/Rules/qcc_lib.xml index aa53f443..64b2e66d 100644 --- a/src_vs2010/BuildTasks/BlackBerrySimulator/Rules/qcc_lib.xml +++ b/src_vs2010/BuildTasks/BlackBerrySimulator/Rules/qcc_lib.xml @@ -23,132 +23,29 @@ Description="Allows the user to override the environmental library path" Category="General" Switch="L" F1Keyword="VC.Project.VCLibrarianTool.AdditionalLibraryDirectories"> - + - + - + Category="General" Switch="Wl,-hname" > - + - - - + - \ No newline at end of file diff --git a/src_vs2010/BuildTasks/BlackBerrySimulator/Rules/qcc_link.xml b/src_vs2010/BuildTasks/BlackBerrySimulator/Rules/qcc_link.xml index 02673da3..7202ecd4 100644 --- a/src_vs2010/BuildTasks/BlackBerrySimulator/Rules/qcc_link.xml +++ b/src_vs2010/BuildTasks/BlackBerrySimulator/Rules/qcc_link.xml @@ -14,52 +14,14 @@ - - + - - - - - - - - + - - - - - + - - - - - - - - - - - - - - - - + + + + + + + - - - - + + - - - - - - - - - - - - + + + + - - - - + + From ee50a8491e1b97b122a65bb41db0470c2b51c81c Mon Sep 17 00:00:00 2001 From: Pawel Hofman Date: Mon, 7 Jul 2014 12:38:11 +0200 Subject: [PATCH 339/851] Fixed debugger start when F5 hit in Visual Studio --- src_vs2012/Package/BlackBerryPackage.cs | 12 ++++++----- .../Components/BuildPlatformsManager.cs | 4 ++-- src_vs2012/Package/Helpers/CommandHelper.cs | 21 ++++++++++++++----- 3 files changed, 25 insertions(+), 12 deletions(-) diff --git a/src_vs2012/Package/BlackBerryPackage.cs b/src_vs2012/Package/BlackBerryPackage.cs index 243ba53d..9712108a 100644 --- a/src_vs2012/Package/BlackBerryPackage.cs +++ b/src_vs2012/Package/BlackBerryPackage.cs @@ -120,6 +120,9 @@ public sealed class BlackBerryPackage : Microsoft.VisualStudio.Shell.Package, ID private bool _isDebugConfiguration = true; private string _processName = ""; + private CommandEvents _eventsDebug; + private CommandEvents _eventsDebugContext; + #endregion #region Package Members @@ -186,9 +189,8 @@ protected override void Initialize() TraceLog.WriteLine(" * registered editors"); _buildPlatformsManager = new BuildPlatformsManager(_dte); - CommandHelper.Register(_dte, GuidList.guidVSStd97String, StandardCommands.cmdidStartDebug, StartDebugCommandEvents_AfterExecute, StartDebugCommandEvents_BeforeExecute); - CommandHelper.Register(_dte, GuidList.guidVSStd97String, StandardCommands.cmdidStartDebug, StartDebugCommandEvents_AfterExecute, StartDebugCommandEvents_BeforeExecute); - CommandHelper.Register(_dte, GuidList.guidVSStd2KString, StandardCommands.cmdidStartDebugContext, StartDebugCommandEvents_AfterExecute, StartDebugCommandEvents_BeforeExecute); + _eventsDebug = CommandHelper.Register(_dte, GuidList.guidVSStd97String, StandardCommands.cmdidStartDebug, StartDebugCommandEvents_BeforeExecute, StartDebugCommandEvents_AfterExecute); + _eventsDebugContext = CommandHelper.Register(_dte, GuidList.guidVSStd2KString, StandardCommands.cmdidStartDebugContext, StartDebugCommandEvents_BeforeExecute, StartDebugCommandEvents_AfterExecute); TraceLog.WriteLine(" * registered build-platforms manager"); _buildEvents = _dte.Events.BuildEvents; @@ -825,7 +827,7 @@ private bool CheckDebugConfiguration() } } } - return (false); + return false; } @@ -965,11 +967,11 @@ private void StartDebugCommandEvents_BeforeExecute(string guid, int id, object c cancelDefault = true; } else + */ { BuildBar(); cancelDefault = true; } - */ } else { diff --git a/src_vs2012/Package/Components/BuildPlatformsManager.cs b/src_vs2012/Package/Components/BuildPlatformsManager.cs index 13c2c3d3..19f1d2f5 100644 --- a/src_vs2012/Package/Components/BuildPlatformsManager.cs +++ b/src_vs2012/Package/Components/BuildPlatformsManager.cs @@ -64,8 +64,8 @@ public BuildPlatformsManager(DTE2 dte) _configTable = new List(); // register for command events, when accessing build platforms: - CommandHelper.Register(_dte, GuidList.guidVSStd2KString, StandardCommands.cmdidSolutionPlatform, cmdNewPlatform_afterExec, cmdNewPlatform_beforeExec); - CommandHelper.Register(_dte, GuidList.guidVSDebugGroup, StandardCommands.cmdidDebugBreakatFunction, cmdNewFunctionBreakpoint_afterExec, cmdNewFunctionBreakpoint_beforeExec); + CommandHelper.Register(_dte, GuidList.guidVSStd2KString, StandardCommands.cmdidSolutionPlatform, cmdNewPlatform_beforeExec, cmdNewPlatform_afterExec); + CommandHelper.Register(_dte, GuidList.guidVSDebugGroup, StandardCommands.cmdidDebugBreakatFunction, cmdNewFunctionBreakpoint_beforeExec, cmdNewFunctionBreakpoint_afterExec); DisableIntelliSenseErrorReport(true); CheckSolutionPlatformCommand(); diff --git a/src_vs2012/Package/Helpers/CommandHelper.cs b/src_vs2012/Package/Helpers/CommandHelper.cs index c5a4d6e4..2e7d8fd2 100644 --- a/src_vs2012/Package/Helpers/CommandHelper.cs +++ b/src_vs2012/Package/Helpers/CommandHelper.cs @@ -4,25 +4,36 @@ namespace BlackBerry.Package.Helpers { - internal sealed class CommandHelper + internal static class CommandHelper { /// /// Registers specified handlers for a command given by guid:id anywhere inside Visual Studio. /// - public static void Register(DTE2 dte, string commandGuid, int commandId, _dispCommandEvents_AfterExecuteEventHandler afterHandler, - _dispCommandEvents_BeforeExecuteEventHandler beforeHandler) + public static CommandEvents Register(DTE2 dte, string commandGuid, int commandId, _dispCommandEvents_BeforeExecuteEventHandler beforeHandler, + _dispCommandEvents_AfterExecuteEventHandler afterHandler) { if (dte == null) throw new ArgumentNullException("dte"); if (dte.Events == null) throw new ArgumentOutOfRangeException("dte"); + if (beforeHandler == null && afterHandler == null) + return null; + var commandEvents = dte.Events.CommandEvents[commandGuid, commandId]; if (commandEvents != null) { - commandEvents.BeforeExecute += beforeHandler; - commandEvents.AfterExecute += afterHandler; + if (beforeHandler != null) + { + commandEvents.BeforeExecute += beforeHandler; + } + if (afterHandler != null) + { + commandEvents.AfterExecute += afterHandler; + } } + + return commandEvents; } } } From 10a816b94b28571f9430ecbf688c596b7b4c3889 Mon Sep 17 00:00:00 2001 From: Pawel Hofman Date: Mon, 7 Jul 2014 13:24:03 +0200 Subject: [PATCH 340/851] Moved importing NativeCore project to main-menu --- src_vs2012/Package/BlackBerryPackage.cs | 22 +++++--------- src_vs2012/Package/Helpers/DialogHelper.cs | 18 +++++++++++ src_vs2012/Package/PackageCommands.cs | 6 ++-- .../Package/Resources/Package.Menu.vsct | 30 ++++++------------- 4 files changed, 36 insertions(+), 40 deletions(-) diff --git a/src_vs2012/Package/BlackBerryPackage.cs b/src_vs2012/Package/BlackBerryPackage.cs index 9712108a..ae2c61c0 100644 --- a/src_vs2012/Package/BlackBerryPackage.cs +++ b/src_vs2012/Package/BlackBerryPackage.cs @@ -261,9 +261,9 @@ protected override void Initialize() MenuCommand configureMenu = new MenuCommand((s, e) => ShowOptionPage(typeof(TargetsOptionPage)), configureCommandID); mcs.AddCommand(configureMenu); - // Create the command for the menu item. - CommandID projectCommandID = new CommandID(GuidList.guidVSNDK_PackageCmdSet, PackageCommands.cmdidfooLocalBox); - OleMenuCommand projectItem = new OleMenuCommand(MenuItemCallback, projectCommandID); + // Create the command for 'Import BlackBerry Native Project' menu item. + CommandID projectCommandID = new CommandID(GuidList.guidVSNDK_PackageCmdSet, PackageCommands.cmdidBlackBerryCommonProjectImport); + OleMenuCommand projectItem = new OleMenuCommand(ImportBlackBerryProject, projectCommandID); mcs.AddCommand(projectItem); TraceLog.WriteLine(" * initialized menus"); @@ -1032,20 +1032,12 @@ private void OnBuildBegin(vsBuildScope scope, vsBuildAction action) } } - private void MenuItemCallback(object sender, EventArgs e) + private void ImportBlackBerryProject(object sender, EventArgs e) { - Microsoft.Win32.OpenFileDialog dlg = new Microsoft.Win32.OpenFileDialog(); - dlg.DefaultExt = ".cproject"; // Default file extension - dlg.Filter = "Native Core Application Project Files (*.cproject, *.project)|*.cproject;*.project;"; - dlg.Title = "Open BlackBerry Core Native Application Project Files"; - dlg.Multiselect = false; - dlg.InitialDirectory = Environment.SpecialFolder.MyComputer.ToString(); - dlg.CheckFileExists = true; - - bool? result = dlg.ShowDialog(); - if (result == true) + var form = DialogHelper.OpenNativeCoreProject("Open Core Native Application Project", null); + if (form.ShowDialog() == DialogResult.OK) { - string filename = dlg.FileName; + string filename = form.FileName; FileInfo fi = new FileInfo(filename); string folderName = fi.DirectoryName; diff --git a/src_vs2012/Package/Helpers/DialogHelper.cs b/src_vs2012/Package/Helpers/DialogHelper.cs index cd07076a..a14c8a32 100644 --- a/src_vs2012/Package/Helpers/DialogHelper.cs +++ b/src_vs2012/Package/Helpers/DialogHelper.cs @@ -22,6 +22,24 @@ public static string BrowseForFolder(string startupPath, string description) return startupPath; } + /// + /// Returns preconfigured window for opening .cproject files. + /// + public static OpenFileDialog OpenNativeCoreProject(string title, string startupPath) + { + var openFile = new OpenFileDialog(); + openFile.Title = title; + openFile.InitialDirectory = startupPath; + openFile.DefaultExt = ".cproject"; + openFile.Filter = "Native Core Project|*.cproject;*.project|All files|*.*"; + + openFile.FilterIndex = 0; + openFile.CheckFileExists = true; + openFile.CheckPathExists = true; + + return openFile; + } + /// /// Returns preconfigured window for opening BAR files. /// diff --git a/src_vs2012/Package/PackageCommands.cs b/src_vs2012/Package/PackageCommands.cs index d9b2fcd7..fb78c2e0 100644 --- a/src_vs2012/Package/PackageCommands.cs +++ b/src_vs2012/Package/PackageCommands.cs @@ -16,6 +16,8 @@ namespace BlackBerry.Package { internal static class PackageCommands { + public const int cmdidBlackBerryCommonProjectImport = 0x0201; + public const int cmdidBlackBerryOptions = 0x301; public const int cmdidBlackBerryTargetsDevicesPlaceholder = 0x501; public const int cmdidBlackBerryTargetsApiLevelsPlaceholder = 0x601; @@ -31,9 +33,5 @@ internal static class PackageCommands public const int cmdidBlackBerryHelpSamplesPlayBook = 0x1103; public const int cmdidBlackBerryHelpSamplesOpenSource = 0x1104; public const int cmdidBlackBerryHelpAbout = 0x1201; - - - public const int cmdidBlackBerryProjectImport = 0x0104; - public const int cmdidfooLocalBox = 0x0105; } } diff --git a/src_vs2012/Package/Resources/Package.Menu.vsct b/src_vs2012/Package/Resources/Package.Menu.vsct index d79b3211..d862f26a 100644 --- a/src_vs2012/Package/Resources/Package.Menu.vsct +++ b/src_vs2012/Package/Resources/Package.Menu.vsct @@ -66,18 +66,19 @@ - - - - - - + + - + - - - @@ -268,6 +259,7 @@ + @@ -278,10 +270,6 @@ - - - - From 3184b215418bb02684d3ada10006e1c2947fff20 Mon Sep 17 00:00:00 2001 From: Pawel Hofman Date: Mon, 7 Jul 2014 13:25:46 +0200 Subject: [PATCH 341/851] Removed need of accessing registry in package --- src_vs2012/Package/BlackBerryPackage.cs | 62 ++++++++++--------------- 1 file changed, 25 insertions(+), 37 deletions(-) diff --git a/src_vs2012/Package/BlackBerryPackage.cs b/src_vs2012/Package/BlackBerryPackage.cs index ae2c61c0..7d53f6bb 100644 --- a/src_vs2012/Package/BlackBerryPackage.cs +++ b/src_vs2012/Package/BlackBerryPackage.cs @@ -32,7 +32,6 @@ using BlackBerry.Package.Options; using BlackBerry.Package.Registration; using BlackBerry.Package.ViewModels; -using Microsoft.Win32; using Microsoft.VisualStudio; using Microsoft.VisualStudio.Shell.Interop; using Microsoft.VisualStudio.Shell; @@ -43,8 +42,6 @@ using EnvDTE80; using System.Text.RegularExpressions; using System.Collections.Specialized; -using System.Security.Cryptography; -using System.Text; using VSNDK.Parser; namespace BlackBerry.Package @@ -189,6 +186,8 @@ protected override void Initialize() TraceLog.WriteLine(" * registered editors"); _buildPlatformsManager = new BuildPlatformsManager(_dte); + // INFO: the references to returned objects must be stored and live as long, as the handlers are needed, + // since they are COM objects and will be automatically reclaimed on next GC.Collect(), causing handlers to be unsubscribed... _eventsDebug = CommandHelper.Register(_dte, GuidList.guidVSStd97String, StandardCommands.cmdidStartDebug, StartDebugCommandEvents_BeforeExecute, StartDebugCommandEvents_AfterExecute); _eventsDebugContext = CommandHelper.Register(_dte, GuidList.guidVSStd2KString, StandardCommands.cmdidStartDebugContext, StartDebugCommandEvents_BeforeExecute, StartDebugCommandEvents_AfterExecute); TraceLog.WriteLine(" * registered build-platforms manager"); @@ -416,6 +415,14 @@ private bool IsBlackBerrySolution(DTE2 dte) return false; } + /// + /// Gets the currently selected device all actions should be performed against. + /// + private DeviceDefinition ActiveDevice + { + get { return PackageViewModel.Instance.ActiveDevice; } + } + /// /// Gets the number of installed NDKs. /// @@ -465,10 +472,6 @@ private bool BuildBar() { if (_buildThese.Count != 0) { - RegistryKey key = Registry.CurrentUser.CreateSubKey("VSNDK"); - key.SetValue("Run", "True"); - key.Close(); - _buildEvents.OnBuildDone += OnBuildDone; try @@ -544,10 +547,6 @@ private void Built() /// private void Deployed() { - RegistryKey key = Registry.CurrentUser.CreateSubKey("VSNDK"); - key.SetValue("Run", "False"); - key.Close(); - string pidString = ""; string toolsPath = ""; string publicKeyPath = ""; @@ -647,37 +646,26 @@ private bool GetProcessInfo(DTE2 dte, ref string pidString, ref string toolsPath publicKeyPath = ConfigDefaults.SshPublicKeyPath; publicKeyPath = publicKeyPath.Replace('\\', '/'); - try - { - RegistryKey rkHKCU = Registry.CurrentUser; - RegistryKey rkPluginRegKey = rkHKCU.OpenSubKey("Software\\BlackBerry\\BlackBerryVSPlugin"); - toolsPath = rkPluginRegKey.GetValue("NDKHostPath") + "/usr/bin"; - toolsPath = toolsPath.Replace('\\', '/'); + var ndk = ActiveNDK; + var device = ActiveDevice; - if (_isSimulator) - { - targetIP = rkPluginRegKey.GetValue("simulator_IP").ToString(); - password = rkPluginRegKey.GetValue("simulator_password").ToString(); - } - else - { - targetIP = rkPluginRegKey.GetValue("device_IP").ToString(); - password = rkPluginRegKey.GetValue("device_password").ToString(); - } - - // Decrypt stored password. - byte[] data = Convert.FromBase64String(password); - if (data.Length > 0) - { - byte[] decrypted = ProtectedData.Unprotect(data, null, DataProtectionScope.LocalMachine); - password = Encoding.Unicode.GetString(decrypted); - } + if (ndk == null) + { + MessageBoxHelper.Show("Missing NDK selected. Please install any and mark as active using BlackBerry menu options.", null, + MessageBoxButtons.OK, MessageBoxIcon.Error); + return false; } - catch (Exception ex) + if (device == null) { - MessageBox.Show(ex.Message, "Microsoft Visual Studio", MessageBoxButtons.OK, MessageBoxIcon.Error); + MessageBoxHelper.Show("Missing device selected. Please define an IP, password and mark a device as active using BlackBerry menu options.", null, + MessageBoxButtons.OK, MessageBoxIcon.Error); + return false; } + toolsPath = ndk.ToDefinition().ToolsPath; + targetIP = device.IP; + password = device.Password; + pidString = GetPIDfromGDB(_processName, targetIP, password, _isSimulator, toolsPath, publicKeyPath); if (pidString == "") From be74df781e859d42911a0de994e2da36fd8027cf Mon Sep 17 00:00:00 2001 From: Pawel Hofman Date: Mon, 7 Jul 2014 15:02:39 +0200 Subject: [PATCH 342/851] Refactored Targets to allow waiting and cleanup --- src_vs2012/NativeCore/Components/Targets.cs | 86 ++++++++++++++++++++- 1 file changed, 83 insertions(+), 3 deletions(-) diff --git a/src_vs2012/NativeCore/Components/Targets.cs b/src_vs2012/NativeCore/Components/Targets.cs index 1b00da4b..f97fe78f 100644 --- a/src_vs2012/NativeCore/Components/Targets.cs +++ b/src_vs2012/NativeCore/Components/Targets.cs @@ -1,5 +1,7 @@ using System; using System.Collections.Generic; +using System.Threading; +using BlackBerry.NativeCore.Debugger; using BlackBerry.NativeCore.Model; using BlackBerry.NativeCore.Tools; @@ -31,13 +33,19 @@ public TargetInfo(DeviceDefinition device, string sshPublicKeyPath) Runner.StatusChanged += OnConnectionStatusChanged; } - private void OnConnectionStatusChanged(object sender, EventArgs eventArgs) + private void OnConnectionStatusChanged(object sender, EventArgs e) { + // notify external handler: var statusHandler = StatusChanged; + var args = ToEventArgs(); + if (statusHandler != null) { - statusHandler(null, ToEventArgs()); + statusHandler(null, args); } + + // then notify Targets class, so it updates the internal state: + OnChildConnectionStatusChanged(this, args); } ~TargetInfo() @@ -65,8 +73,8 @@ public DeviceConnectRunner Runner public void Dispose() { - GC.SuppressFinalize(this); Dispose(true); + GC.SuppressFinalize(this); } private void Dispose(bool disposing) @@ -227,6 +235,31 @@ public static void Connect(DeviceDefinition device, string sshPublicKeyPath, Eve } } + private static void OnChildConnectionStatusChanged(object sender, TargetConnectionEventArgs e) + { + bool removed = false; + var target = sender as TargetInfo; + if (target == null) + throw new ArgumentNullException("sender"); + + if (e.Status == TargetStatus.Disconnected) + { + lock (_sync) + { + removed = _activeTargets.Remove(target); + } + } + + // only release the object, when it belong to the list + // (to avoid double-releases, in case external handlers manipulated the list): + if (removed) + { + // and release resources: + target.Dispose(); + } + } + + /// /// Stops receiving more events related to the connection state to the target device. /// @@ -302,5 +335,52 @@ public static bool Disconnect(DeviceDefinition device) return Disconnect(device.IP); } + + /// + /// Waits until connection status changes to connected or failed for a given device. + /// + public static void Wait(DeviceDefinition device) + { + if (device == null) + throw new ArgumentNullException("device"); + + Wait(device.IP); + } + + /// + /// Waits until connection status changes to connected or failed for a given device. + /// + public static void Wait(string ip) + { + if (string.IsNullOrEmpty(ip)) + throw new ArgumentNullException("ip"); + + Wait(GdbProcessor.ShortInfinite, ip); + } + + /// + /// Waits until connection status changes to connected or failed for a given device. + /// + public static void Wait(int millisecondsTimeout, DeviceDefinition device) + { + if (device == null) + throw new ArgumentNullException("device"); + + Wait(millisecondsTimeout, device.IP); + } + + /// + /// Waits until connection status changes to connected or failed for a given device. + /// + public static void Wait(int millisecondsTimeout, string ip) + { + if (string.IsNullOrEmpty(ip)) + throw new ArgumentNullException("ip"); + + DateTime timesUp = millisecondsTimeout < 0 ? DateTime.MaxValue : DateTime.Now.AddMilliseconds(millisecondsTimeout); + + while (DateTime.Now < timesUp && !IsConnectedOrFailed(ip)) + Thread.Sleep(10); + } } } From b8fc94a9431be1945f6521d2b299753156d2e49a Mon Sep 17 00:00:00 2001 From: Pawel Hofman Date: Mon, 7 Jul 2014 15:03:33 +0200 Subject: [PATCH 343/851] GdbRunner now forwards some API calls to internal GdbProcessor --- src_vs2012/NativeCore/Tools/GdbRunner.cs | 53 ++++++++++++++++++++++++ src_vs2012/UnitTests/DebuggerTests.cs | 49 +++++++++++----------- 2 files changed, 77 insertions(+), 25 deletions(-) diff --git a/src_vs2012/NativeCore/Tools/GdbRunner.cs b/src_vs2012/NativeCore/Tools/GdbRunner.cs index 5439db94..9eff6f94 100644 --- a/src_vs2012/NativeCore/Tools/GdbRunner.cs +++ b/src_vs2012/NativeCore/Tools/GdbRunner.cs @@ -127,5 +127,58 @@ protected override void ProcessOutputLine(string text) } #endregion + + #region Forwarded Communication + + /// + /// Reads next response from the buffer. + /// If there is nothing received until last call, null value is returned. + /// + public Response Read() + { + if (_processor == null) + throw new ObjectDisposedException("GdbRunner"); + + return _processor.Read(); + } + + /// + /// This method sends a desired request to the GDB. + /// + public bool Send(Request request) + { + if (request == null) + throw new ArgumentNullException("request"); + if (_processor == null) + throw new ObjectDisposedException("GdbRunner"); + + return _processor.Send(request); + } + + /// + /// Waits until a valid message was not received. + /// + /// Returns 'true', if the signal was received and data is valid, 'false' in case of timeout. + public bool Wait(out Response response) + { + if (_processor == null) + throw new ObjectDisposedException("GdbRunner"); + + return _processor.Wait(out response); + } + + /// + /// Waits until a valid message was not received. + /// + /// Returns 'true', if the signal was received and data is valid, 'false' in case of timeout. + public bool Wait(int millisecondsTimeout, out Response response) + { + if (_processor == null) + throw new ObjectDisposedException("GdbRunner"); + + return _processor.Wait(millisecondsTimeout, out response); + } + + #endregion } } diff --git a/src_vs2012/UnitTests/DebuggerTests.cs b/src_vs2012/UnitTests/DebuggerTests.cs index e230ff0a..0bf81178 100644 --- a/src_vs2012/UnitTests/DebuggerTests.cs +++ b/src_vs2012/UnitTests/DebuggerTests.cs @@ -20,8 +20,7 @@ public void Setup() { Targets.Connect(Defaults.IP, Defaults.Password, DeviceDefinitionType.Device, Defaults.SshPublicKeyPath, OnDeviceConnectionStatusChanged); - while (!Targets.IsConnectedOrFailed(Defaults.IP)) - Thread.Sleep(10); + Targets.Wait(Defaults.IP); Assert.IsTrue(Targets.IsConnected(Defaults.IP), "Connection was not established properly"); } @@ -87,12 +86,12 @@ public void StartGDB() Response message; bool result; - result = runner.Processor.Wait(out message); + result = runner.Wait(out message); Assert.IsTrue(result, "Should receive GDB startup info"); runner.Break(); - result = runner.Processor.Wait(3 * 1000, out message); + result = runner.Wait(3 * 1000, out message); Assert.IsFalse(result, "Did not expect any notification"); runner.Abort(); @@ -109,11 +108,11 @@ public void SendExitToGdbAndNotCrash() Response message; bool result; - result = runner.Processor.Wait(out message); + result = runner.Wait(out message); Assert.IsTrue(result, "Should receive GDB startup info"); var exitRequest = RequestsFactory.Exit(); - runner.Processor.Send(exitRequest); + runner.Send(exitRequest); result = exitRequest.Wait(); Assert.IsTrue(result, "Exit command should be confirmed by the GDB"); @@ -136,21 +135,21 @@ public void SendMultipleRequestAtOnce() bool result; // ok, wait util GDB is initialized: - result = runner.Processor.Wait(out message); + result = runner.Wait(out message); Assert.IsTrue(result, "Should receive GDB startup info"); // send invalid request and wait for error: var rubbish1 = new Request("gdb-exit-rubbish"); var rubbish2 = new Request("xxx-yyy-zzz"); - runner.Processor.Send(rubbish1); - runner.Processor.Send(rubbish2); + runner.Send(rubbish1); + runner.Send(rubbish2); rubbish1.Wait(); - message = runner.Processor.Read(); + message = runner.Read(); Assert.IsNotNull(message, "Should already receive a message"); // for rubbish 2: - result = runner.Processor.Wait(out message); + result = runner.Wait(out message); Assert.IsTrue(result, "Should already receive a message"); Assert.AreEqual(rubbish2.ID, message.ID, "Request and respose should have identical ID"); } @@ -165,13 +164,13 @@ public void LoadListOfProcesses() bool result; // ok, wait util GDB is initialized: - result = runner.Processor.Wait(out message); + result = runner.Wait(out message); Assert.IsTrue(result, "Should receive GDB startup info"); var selectDevice = RequestsFactory.SetTargetDevice(Defaults.IP); var listRequest = RequestsFactory.ListProcesses(); - runner.Processor.Send(selectDevice); - runner.Processor.Send(listRequest); + runner.Send(selectDevice); + runner.Send(listRequest); listRequest.Wait(); Assert.IsNotNull(listRequest.Response); @@ -186,7 +185,7 @@ public void LoadListOfProcessesByGroup() var selectDevice = RequestsFactory.SetTargetDevice(Defaults.IP); var listRequest = RequestsFactory.ListProcesses(); var group = RequestsFactory.Group(selectDevice, listRequest); - runner.Processor.Send(group); + runner.Send(group); group.Wait(); Assert.IsNotNull(listRequest.Response); @@ -203,7 +202,7 @@ public void ListAvailableFeaturesExtraGrouped() // yes, it's not necessary to wrap it into any group, but just for testing purposes: var group = RequestsFactory.Group(RequestsFactory.Group(listFeatures)); - runner.Processor.Send(group); + runner.Send(group); group.Wait(); Assert.IsNotNull(listFeatures.Response); @@ -220,8 +219,8 @@ public void ListAvailableTargetFeatures() var selectTarget = RequestsFactory.SetTargetDevice(Defaults.IP); var listTargetFeatures = RequestsFactory.ListTargetFeatures(); - runner.Processor.Send(selectTarget); - runner.Processor.Send(listTargetFeatures); + runner.Send(selectTarget); + runner.Send(listTargetFeatures); listTargetFeatures.Wait(); Assert.IsNotNull(listTargetFeatures.Response); @@ -238,7 +237,7 @@ public void AttachToProcess() var listProcesses = RequestsFactory.ListProcesses(); var procGroup = RequestsFactory.Group(enablePending, selectDevice, listProcesses); - runner.Processor.Send(procGroup); + runner.Send(procGroup); procGroup.Wait(); // at this point, we should receive a list of running processes // find the PID of FallingBlocks sample: @@ -253,7 +252,7 @@ public void AttachToProcess() var stackTrace = RequestsFactory.StackTraceListFrames(); var attachGroup = RequestsFactory.Group(setLibSearchPath, setExecutable, attachProcess, stackDepth, stackTrace, infoThreads); - runner.Processor.Send(attachGroup); + runner.Send(attachGroup); attachGroup.Wait(); // insert a breakpoint @@ -261,12 +260,12 @@ public void AttachToProcess() //var bp = RequestsFactory.InsertBreakpoint("update"); var breakGroup = RequestsFactory.Group(bp); - runner.Processor.Send(breakGroup); + runner.Send(breakGroup); breakGroup.Wait(); // resume execution: var continueExec = RequestsFactory.Continue(); - runner.Processor.Send(continueExec); + runner.Send(continueExec); continueExec.Wait(); for (int i = 0; i < 1000; i++) @@ -274,12 +273,12 @@ public void AttachToProcess() // delete the breakpoint: var delBp = RequestsFactory.DeleteBreakpoint(1); // PH: FIXME: assuming this BP-id, should be updated, when parsing responses is fully implemented - runner.Processor.Send(delBp); + runner.Send(delBp); delBp.Wait(); // resume after breakpoint: var contGroup = RequestsFactory.Group(stackTrace, continueExec); - runner.Processor.Send(contGroup); + runner.Send(contGroup); contGroup.Wait(); for (int i = 0; i < 1000; i++) @@ -288,7 +287,7 @@ public void AttachToProcess() // detach: runner.Break(); var detachProcess = RequestsFactory.DetachTargetProcess(); - runner.Processor.Send(detachProcess); + runner.Send(detachProcess); detachProcess.Wait(); } From b32f28227564afa043317ccdc813033458579c76 Mon Sep 17 00:00:00 2001 From: Pawel Hofman Date: Mon, 7 Jul 2014 15:55:38 +0200 Subject: [PATCH 344/851] Fixed random buffer displayed, when no GDB exec specified --- src_vs2012/GDBHost/main.cpp | 32 ++++++++++++++++++-- src_vs2012/NativeCore/Tools/GdbHostRunner.cs | 4 +-- 2 files changed, 31 insertions(+), 5 deletions(-) diff --git a/src_vs2012/GDBHost/main.cpp b/src_vs2012/GDBHost/main.cpp index 2e869a69..726bcb07 100644 --- a/src_vs2012/GDBHost/main.cpp +++ b/src_vs2012/GDBHost/main.cpp @@ -41,6 +41,10 @@ static LPCTSTR ConcatGdbCommand(int argc, _TCHAR* argv[], LPCTSTR exePath, int a _tcscat_s(result, length, exePath); _tcscat_s(result, length, _T("\"")); } + else + { + result[0] = '\0'; + } for (int i = argsFrom; i < argc; i++) { @@ -52,6 +56,13 @@ static LPCTSTR ConcatGdbCommand(int argc, _TCHAR* argv[], LPCTSTR exePath, int a return result; } +static BOOL FileExists(LPCTSTR lpszPath) +{ + DWORD attributes = GetFileAttributes(lpszPath); + + return (attributes != INVALID_FILE_ATTRIBUTES && !(attributes & FILE_ATTRIBUTE_DIRECTORY)); +} + /// /// GDBWrapper Main function. /// @@ -63,6 +74,8 @@ static LPCTSTR ConcatGdbCommand(int argc, _TCHAR* argv[], LPCTSTR exePath, int a /// 0 int _tmain(int argc, _TCHAR* argv[]) { + SetConsoleTitle(_T("BlackBerry GDB Host Application")); + LogInitialize(); LogPrint(_T("Starting")); @@ -80,6 +93,7 @@ int _tmain(int argc, _TCHAR* argv[]) PrintMessage(_T(" (host-options) - single parameter starting with '-', which defines custom behavior of the host process itself\r\n")); PrintMessage(_T("Host options:\r\n")); PrintMessage(_T(" s - [silent] - disable all custom console logs\r\n")); + PrintMessage(_T(" c - skip checking GDB executable existance, before executing\r\n")); PrintMessage(_T("\r\n\r\n")); return 0; } @@ -91,20 +105,26 @@ int _tmain(int argc, _TCHAR* argv[]) LPCTSTR eventNameCtrlC = argv[1]; LPCTSTR eventNameTerminate = argv[2]; int gdbArgsStartFrom = 4; + BOOL checkGdbExistence = TRUE; // check, if we passed some optional arguments for the host... if (hostOptions[0] == '-') { - gdbExecutablePath = argv[4]; + gdbExecutablePath = argc >= 5 ? argv[4] : NULL; gdbArgsStartFrom = 5; // and parse host options: int optionsLength = _tcslen(hostOptions); for (int i = 1; i < optionsLength; i++) { - if (hostOptions[i] == 's') + switch(hostOptions[i]) { + case 's': DisableConsolePrinting(); + break; + case 'c': + checkGdbExistence = FALSE; + break; } } } @@ -130,6 +150,12 @@ int _tmain(int argc, _TCHAR* argv[]) PrintMessage(_T(" Ctrl-C handler: name: \"%s\", handle: 0x%p\r\n"), eventNameCtrlC, handleCtrlC); PrintMessage(_T(" Terminate handler: name: \"%s\", handle: 0x%p\r\n"), eventNameTerminate, handleTerminate); + if (gdbExecutablePath == NULL || gdbExecutablePath[0] == '\0' || (checkGdbExistence && !FileExists(gdbExecutablePath))) + { + PrintMessage(_T("Error: Unable to find GDB executable (%s)\r\n"), gdbExecutablePath != NULL ? gdbExecutablePath : _T("-missing path-")); + return 1; + } + // Initialize GDB LPCTSTR gdbCommand = ConcatGdbCommand(argc, argv, gdbExecutablePath, gdbArgsStartFrom); GDBWrapper* gdb = new GDBWrapper(gdbCommand, handleCtrlC, handleTerminate); @@ -143,7 +169,7 @@ int _tmain(int argc, _TCHAR* argv[]) if (!gdb->StartProcess()) { PrintMessage(_T("Error: Failed to start the GDB process (%s)\r\n"), gdbExecutablePath); - return 1; + return 2; } HANDLE handles[] = { handleCtrlC, handleTerminate, gdb->GetProcessHandle() }; diff --git a/src_vs2012/NativeCore/Tools/GdbHostRunner.cs b/src_vs2012/NativeCore/Tools/GdbHostRunner.cs index 85f5267d..da2bcc0a 100644 --- a/src_vs2012/NativeCore/Tools/GdbHostRunner.cs +++ b/src_vs2012/NativeCore/Tools/GdbHostRunner.cs @@ -33,10 +33,10 @@ public GdbHostRunner(string gdbHostFileName, GdbInfo gdb) // 1. the name of the event, which set will trigger the Ctrl+C signal to the GDB // 2. the name of the event, which set will exit the host process and GDB // 3. the path to GDB executable itself, that will run - // 4. optional settings for GDBHost (-s => disable custom console logs) + // 4. optional settings for GDBHost (-s => disable custom console logs, -c => skip checking for GDB-executable existence) // 5. all the other arguments that should be passed to GDB (although it's possible to pass arguments to GDB via the executable path, // but in practice they can't be escaped this way; that's why passing them as last arguments of the host are the recommended approach) - Arguments = string.Concat(eventCtrlCName, " ", eventTerminateName, " -s ", "\"", gdb.Executable, "\" ", gdb.Arguments); + Arguments = string.Concat(eventCtrlCName, " ", eventTerminateName, " -sc ", "\"", gdb.Executable, "\" ", gdb.Arguments); } /// From b06df6af6bbb5461ee904c5bda66ae0a0d539543 Mon Sep 17 00:00:00 2001 From: Pawel Hofman Date: Mon, 7 Jul 2014 15:56:25 +0200 Subject: [PATCH 345/851] Parsing callstack line number won't use exceptions --- src_vs2010/DebugEngine/AD7.Impl/AD7Thread.cs | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/src_vs2010/DebugEngine/AD7.Impl/AD7Thread.cs b/src_vs2010/DebugEngine/AD7.Impl/AD7Thread.cs index 9ebcc5ed..39d34247 100644 --- a/src_vs2010/DebugEngine/AD7.Impl/AD7Thread.cs +++ b/src_vs2010/DebugEngine/AD7.Impl/AD7Thread.cs @@ -139,15 +139,7 @@ public AD7Thread(AD7Engine aEngine, string id, string targetID, string state, st else _filename = fullname; - try - { - _line = Convert.ToUInt32(line); - } - catch - { - _line = 0; - } - + uint.TryParse(line, out _line); // stopping on that exception was just horrible... _id = id; _state = state; _targetID = targetID; From c384bb45a8b0ce926e70ed57f9022eee83e5b6d6 Mon Sep 17 00:00:00 2001 From: Pawel Hofman Date: Mon, 7 Jul 2014 15:59:18 +0200 Subject: [PATCH 346/851] GdbInfo carries more info about the device itself --- .../NativeCore/Debugger/RequestsFactory.cs | 9 ++++++++ src_vs2012/NativeCore/Model/GdbInfo.cs | 22 +++++++++++-------- src_vs2012/NativeCore/Tools/GdbRunner.cs | 8 +++++++ src_vs2012/UnitTests/DebuggerTests.cs | 11 +++++----- 4 files changed, 36 insertions(+), 14 deletions(-) diff --git a/src_vs2012/NativeCore/Debugger/RequestsFactory.cs b/src_vs2012/NativeCore/Debugger/RequestsFactory.cs index d88b8532..07e45e8b 100644 --- a/src_vs2012/NativeCore/Debugger/RequestsFactory.cs +++ b/src_vs2012/NativeCore/Debugger/RequestsFactory.cs @@ -1,6 +1,7 @@ using System; using System.IO; using System.Text; +using BlackBerry.NativeCore.Model; namespace BlackBerry.NativeCore.Debugger { @@ -32,6 +33,14 @@ public static Request SetTargetDevice(string ip) return new Request(string.Concat("target-select qnx ", ip, ":8000")); } + public static Request SetTargetDevice(DeviceDefinition device) + { + if (device == null) + throw new ArgumentNullException("device"); + + return SetTargetDevice(device.IP); + } + public static Request ListProcesses() { return new CliRequest("info pidlist"); diff --git a/src_vs2012/NativeCore/Model/GdbInfo.cs b/src_vs2012/NativeCore/Model/GdbInfo.cs index ce753a79..01239be0 100644 --- a/src_vs2012/NativeCore/Model/GdbInfo.cs +++ b/src_vs2012/NativeCore/Model/GdbInfo.cs @@ -10,7 +10,7 @@ namespace BlackBerry.NativeCore.Model /// public sealed class GdbInfo { - public GdbInfo(NdkDefinition ndk, DeviceDefinitionType deviceType, RuntimeDefinition runtime, IEnumerable additionalLibraryPaths) + public GdbInfo(NdkDefinition ndk, DeviceDefinition device, RuntimeDefinition runtime, IEnumerable additionalLibraryPaths) { if (ndk == null) throw new ArgumentNullException("ndk"); @@ -18,17 +18,21 @@ public GdbInfo(NdkDefinition ndk, DeviceDefinitionType deviceType, RuntimeDefini throw new ArgumentOutOfRangeException("ndk"); if (string.IsNullOrEmpty(ndk.TargetPath)) throw new ArgumentOutOfRangeException("ndk"); + if (device == null) + throw new ArgumentNullException("device"); + if (string.IsNullOrEmpty(device.IP)) + throw new ArgumentOutOfRangeException("device"); NDK = ndk; - DeviceType = deviceType; + Device = device; Runtime = runtime; - LibraryPaths = CreateLibraryPaths(ndk, runtime, deviceType, additionalLibraryPaths); - Executable = Path.Combine(NDK.HostPath, "usr", "bin", GetName(deviceType)); + LibraryPaths = CreateLibraryPaths(ndk, runtime, device.Type, additionalLibraryPaths); + Executable = Path.Combine(NDK.HostPath, "usr", "bin", GetName(device.Type)); Arguments = "--interpreter=mi2"; } - public GdbInfo(NdkInfo ndk, DeviceDefinitionType deviceType, RuntimeDefinition runtime, IEnumerable additionalLibraryPaths) - : this(ndk != null ? ndk.ToDefinition() : null, deviceType, runtime, additionalLibraryPaths) + public GdbInfo(NdkInfo ndk, DeviceDefinition device, RuntimeDefinition runtime, IEnumerable additionalLibraryPaths) + : this(ndk != null ? ndk.ToDefinition() : null, device, runtime, additionalLibraryPaths) { } @@ -40,7 +44,7 @@ public NdkDefinition NDK private set; } - public DeviceDefinitionType DeviceType + public DeviceDefinition Device { get; private set; @@ -50,14 +54,14 @@ public string Architecture { get { - switch (DeviceType) + switch (Device.Type) { case DeviceDefinitionType.Device: return "ARM"; case DeviceDefinitionType.Simulator: return "x86"; default: - throw new InvalidEnumArgumentException("Unsupported enum value (" + DeviceType + ")"); + throw new InvalidEnumArgumentException("Unsupported enum value (" + Device.Type + ")"); } } } diff --git a/src_vs2012/NativeCore/Tools/GdbRunner.cs b/src_vs2012/NativeCore/Tools/GdbRunner.cs index 9eff6f94..ab0fd219 100644 --- a/src_vs2012/NativeCore/Tools/GdbRunner.cs +++ b/src_vs2012/NativeCore/Tools/GdbRunner.cs @@ -53,6 +53,14 @@ public GdbInfo GDB private set; } + /// + /// Gets the target device the GDB is supposed to connect. + /// + public DeviceDefinition Device + { + get { return GDB.Device; } + } + /// /// Gets the runtime state and events from the GDB. /// diff --git a/src_vs2012/UnitTests/DebuggerTests.cs b/src_vs2012/UnitTests/DebuggerTests.cs index 0bf81178..675fc269 100644 --- a/src_vs2012/UnitTests/DebuggerTests.cs +++ b/src_vs2012/UnitTests/DebuggerTests.cs @@ -55,9 +55,10 @@ public static GdbHostRunner CreateDebuggerRunner(string runtimeFolder) Assert.IsNotNull(ndk); var runtime = string.IsNullOrEmpty(runtimeFolder) ? null : new RuntimeDefinition(runtimeFolder); + var device = new DeviceDefinition("Test Device", Defaults.IP, Defaults.Password, DeviceDefinitionType.Device); // get the description of GDB for a device: - var gdb = new GdbInfo(ndk, DeviceDefinitionType.Device, runtime, null); + var gdb = new GdbInfo(ndk, device, runtime, null); Assert.IsNotNull(gdb); // start the GDB: @@ -167,7 +168,7 @@ public void LoadListOfProcesses() result = runner.Wait(out message); Assert.IsTrue(result, "Should receive GDB startup info"); - var selectDevice = RequestsFactory.SetTargetDevice(Defaults.IP); + var selectDevice = RequestsFactory.SetTargetDevice(runner.Device); var listRequest = RequestsFactory.ListProcesses(); runner.Send(selectDevice); runner.Send(listRequest); @@ -182,7 +183,7 @@ public void LoadListOfProcessesByGroup() var runner = CreateDebuggerRunner(); runner.ExecuteAsync(); - var selectDevice = RequestsFactory.SetTargetDevice(Defaults.IP); + var selectDevice = RequestsFactory.SetTargetDevice(runner.Device); var listRequest = RequestsFactory.ListProcesses(); var group = RequestsFactory.Group(selectDevice, listRequest); runner.Send(group); @@ -216,7 +217,7 @@ public void ListAvailableTargetFeatures() var runner = CreateDebuggerRunner(); runner.ExecuteAsync(); - var selectTarget = RequestsFactory.SetTargetDevice(Defaults.IP); + var selectTarget = RequestsFactory.SetTargetDevice(runner.Device); var listTargetFeatures = RequestsFactory.ListTargetFeatures(); runner.Send(selectTarget); @@ -233,7 +234,7 @@ public void AttachToProcess() runner.ExecuteAsync(); var enablePending = RequestsFactory.SetPendingBreakpoints(true); - var selectDevice = RequestsFactory.SetTargetDevice(Defaults.IP); + var selectDevice = RequestsFactory.SetTargetDevice(runner.Device); var listProcesses = RequestsFactory.ListProcesses(); var procGroup = RequestsFactory.Group(enablePending, selectDevice, listProcesses); From c27fec05bd5f06d5a83cb47b6563519fb8d7815a Mon Sep 17 00:00:00 2001 From: Pawel Hofman Date: Mon, 7 Jul 2014 17:41:02 +0200 Subject: [PATCH 347/851] Simplified some Targets APIs --- src_vs2012/NativeCore/Components/Targets.cs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src_vs2012/NativeCore/Components/Targets.cs b/src_vs2012/NativeCore/Components/Targets.cs index f97fe78f..5558aa6f 100644 --- a/src_vs2012/NativeCore/Components/Targets.cs +++ b/src_vs2012/NativeCore/Components/Targets.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.Threading; using BlackBerry.NativeCore.Debugger; +using BlackBerry.NativeCore.Diagnostics; using BlackBerry.NativeCore.Model; using BlackBerry.NativeCore.Tools; @@ -39,6 +40,8 @@ private void OnConnectionStatusChanged(object sender, EventArgs e) var statusHandler = StatusChanged; var args = ToEventArgs(); + TraceLog.WriteLine("Target status changed to {0} ({1}) for device {2}", args.Status, args.Message ?? "-", Device); + if (statusHandler != null) { statusHandler(null, args); @@ -170,6 +173,14 @@ public static bool IsConnected(string ip) return connection != null && connection.Runner.IsConnected; } + /// + /// Gets an indication, if there is already a valid connection to the device with given IP. + /// + public static bool IsConnected(DeviceDefinition device) + { + return device != null && IsConnected(device.IP); + } + /// /// Gets an indication, if there is already a valid or broken connection to the device with given IP. /// @@ -179,6 +190,14 @@ public static bool IsConnectedOrFailed(string ip) return connection == null || connection.Runner.IsConnected || connection.Runner.IsConnectionFailed; } + /// + /// Gets an indication, if there is already a valid or broken connection to the device with given IP. + /// + public static bool IsConnectedOrFailed(DeviceDefinition device) + { + return device != null && IsConnectedOrFailed(device.IP); + } + /// /// Requests secure connection setup to given device. /// From d97afc739d252a80e79ec7dc0d6502696053c90a Mon Sep 17 00:00:00 2001 From: Pawel Hofman Date: Mon, 7 Jul 2014 17:42:32 +0200 Subject: [PATCH 348/851] Moved detection of debuggee PID into the DebugEngine --- src_vs2010/DebugEngine/AD7.Impl/AD7Engine.cs | 51 ++++++++++++++- src_vs2012/NativeCore/ConfigDefaults.cs | 3 + src_vs2012/Package/BlackBerryPackage.cs | 69 ++++++++++++++++++-- 3 files changed, 117 insertions(+), 6 deletions(-) diff --git a/src_vs2010/DebugEngine/AD7.Impl/AD7Engine.cs b/src_vs2010/DebugEngine/AD7.Impl/AD7Engine.cs index bff3a030..68787fe9 100644 --- a/src_vs2010/DebugEngine/AD7.Impl/AD7Engine.cs +++ b/src_vs2010/DebugEngine/AD7.Impl/AD7Engine.cs @@ -15,6 +15,7 @@ using System; using System.Runtime.InteropServices; using BlackBerry.NativeCore; +using BlackBerry.NativeCore.Debugger; using BlackBerry.NativeCore.Helpers; using BlackBerry.NativeCore.Model; using Microsoft.VisualStudio; @@ -572,6 +573,7 @@ int IDebugEngineLaunch2.LaunchSuspended(string pszServer, IDebugPort2 port, stri NameValueCollectionHelper.LoadFromString(nvc, args); string pid = nvc.GetValues("pid")[0]; + uint pidNumber; string exePath = exe; string targetIP = nvc.GetValues("targetIP")[0]; bool isSimulator = Convert.ToBoolean(nvc.GetValues("isSimulator")[0]); @@ -583,7 +585,12 @@ int IDebugEngineLaunch2.LaunchSuspended(string pszServer, IDebugPort2 port, stri if (passwordArray != null) password = passwordArray[0]; - if (GDBParser.LaunchProcess(pid, exePath, targetIP, isSimulator, toolsPath, publicKeyPath, password)) + if (!uint.TryParse(pid, out pidNumber)) + { + uint.TryParse(GetPIDfromGDB(pid, targetIP, password, isSimulator, toolsPath, publicKeyPath), out pidNumber); + } + + if (GDBParser.LaunchProcess(pidNumber.ToString(), exePath, targetIP, isSimulator, toolsPath, publicKeyPath, password)) { process = _process = new AD7Process(this, port); EventDispatcher = new EventDispatcher(this); @@ -609,6 +616,46 @@ int IDebugEngineLaunch2.LaunchSuspended(string pszServer, IDebugPort2 port, stri } } + private string GetPIDfromGDB(string processName, string ip, string password, bool isSimulator, string toolsPath, string publicKeyPath) + { + string pid = ""; + string response = GDBParser.GetPIDsThroughGDB(ip, password, isSimulator, toolsPath, publicKeyPath, 7); + + if ((response == "TIMEOUT!") || (response.IndexOf("1^error,msg=", 0, StringComparison.Ordinal) != -1)) //found an error + { + if (response == "TIMEOUT!") // Timeout error, normally happen when the device is not connected. + { + MessageBox.Show("Please, verify if the Device/Simulator IP in \"BlackBerry -> Settings\" menu is correct and check if it is connected.", "Device/Simulator not connected or not configured properly", MessageBoxButtons.OK, MessageBoxIcon.Warning); + } + else + if (response[29] == ':') // error: 1^error,msg="169.254.0.3:8000: The requested address is not valid in its context." + { + string txt = response.Substring(13, response.IndexOf(':', 13) - 13) + response.Substring(29, response.IndexOf('"', 31) - 29); + string caption; + if (txt.IndexOf("The requested address is not valid in its context.") != -1) + { + txt += "\n\nPlease, verify the BlackBerry device/simulator IP settings."; + caption = "Invalid IP"; + } + else + { + txt += "\n\nPlease, verify if the device/simulator is connected."; + caption = "Connection failed"; + } + MessageBox.Show(txt, caption, MessageBoxButtons.OK, MessageBoxIcon.Warning); + } + } + else if (response.Contains("^done")) + { + int i = response.IndexOf(processName + " - ", StringComparison.Ordinal); + if (i != -1) + { + i += processName.Length + 3; + pid = response.Substring(i, response.IndexOf('/', i) - i); + } + } + return pid; + } /// /// Resume a process launched by IDebugEngineLaunch2.LaunchSuspended. (http://msdn.microsoft.com/en-us/library/bb146261.aspx) @@ -1376,7 +1423,7 @@ public int AddThreadsToProgram() if (_currentThreadIndex != -1) { - foreach (AD7Thread t in Threads) + foreach (AD7Thread t in threads) { Callback.OnThreadStart(t); } diff --git a/src_vs2012/NativeCore/ConfigDefaults.cs b/src_vs2012/NativeCore/ConfigDefaults.cs index 72314ccb..e6f806e2 100644 --- a/src_vs2012/NativeCore/ConfigDefaults.cs +++ b/src_vs2012/NativeCore/ConfigDefaults.cs @@ -18,6 +18,8 @@ static class ConfigDefaults public static readonly string JavaHome; public static readonly string SshPublicKeyPath; public static readonly string BuildDebugNativePath; + public static readonly string GdbHostPath; + /// /// Plugin-owned installation cache config directory. @@ -56,6 +58,7 @@ static ConfigDefaults() SshPublicKeyPath = Path.Combine(DataDirectory, "bbt_id_rsa.pub"); BuildDebugNativePath = Path.Combine(DataDirectory, "vsndk-debugNative.txt"); RegistryPath = @"Software\BlackBerry\BlackBerryVSPlugin"; + GdbHostPath = @"S:\vs-plugin\src_vs2012\Debug\BlackBerry.GDBHost.exe"; } /// diff --git a/src_vs2012/Package/BlackBerryPackage.cs b/src_vs2012/Package/BlackBerryPackage.cs index 7d53f6bb..b0bb5d0f 100644 --- a/src_vs2012/Package/BlackBerryPackage.cs +++ b/src_vs2012/Package/BlackBerryPackage.cs @@ -19,6 +19,8 @@ using System.ComponentModel.Design; using BlackBerry.DebugEngine; using BlackBerry.NativeCore; +using BlackBerry.NativeCore.Components; +using BlackBerry.NativeCore.Debugger; using BlackBerry.NativeCore.Diagnostics; using BlackBerry.NativeCore.Helpers; using BlackBerry.NativeCore.Model; @@ -547,6 +549,40 @@ private void Built() /// private void Deployed() { + string currentPath = ""; + string executablePath; + + foreach (string[] paths in _targetDir) + { + if (paths[0] == _processName) + { + currentPath = paths[1]; + break; + } + } + + executablePath = currentPath + _processName; // The executable path + executablePath = executablePath.Replace('\\', '/'); + + var ndk = ActiveNDK; + var device = ActiveDevice; + + if (ndk == null) + { + MessageBoxHelper.Show("Missing NDK selected. Please install any and mark as active using BlackBerry menu options.", null, + MessageBoxButtons.OK, MessageBoxIcon.Error); + return; + } + if (device == null) + { + MessageBoxHelper.Show("Missing device selected. Please define an IP, password and mark a device as active using BlackBerry menu options.", null, + MessageBoxButtons.OK, MessageBoxIcon.Error); + return; + } + + LaunchDebugTarget(_processName, ndk.ToDefinition().ToolsPath, ConfigDefaults.SshPublicKeyPath.Replace('\\', '/'), device.IP, device.Password, executablePath); + + /* string pidString = ""; string toolsPath = ""; string publicKeyPath = ""; @@ -561,6 +597,7 @@ private void Deployed() { MessageBox.Show("Failed to debug the application.\n\nPlease, close the app in case it was launched in the device/simulator.", "Failed to launch debugger", MessageBoxButtons.OK, MessageBoxIcon.Error); } + */ } /// @@ -622,6 +659,7 @@ private bool LaunchDebugTarget(string pidString, string toolsPath, string public return false; } + /* /// /// Get the PID of the launched native app by parsing text from the output window. /// @@ -662,10 +700,26 @@ private bool GetProcessInfo(DTE2 dte, ref string pidString, ref string toolsPath return false; } + var gdbInfo = new GdbInfo(ndk, device, null, null); + toolsPath = ndk.ToDefinition().ToolsPath; targetIP = device.IP; password = device.Password; + Targets.Connect(device, publicKeyPath, null); + Targets.Wait(device); + + var runner = new GdbHostRunner(ConfigDefaults.GdbHostPath, gdbInfo); + runner.ExecuteAsync(); + + var processesResponse = RequestsFactory.ListProcesses(); + var request = RequestsFactory.Group(RequestsFactory.SetTargetDevice(gdbInfo.Device), processesResponse, RequestsFactory.Exit()); + runner.Send(request); + request.Wait(); + + var message = processesResponse.Response; + + pidString = GetPIDfromGDB(_processName, targetIP, password, _isSimulator, toolsPath, publicKeyPath); if (pidString == "") @@ -793,7 +847,7 @@ private string GetPIDfromGDB(string processName, string ip, string password, boo } return pid; } - + */ /// /// Verify if the app configuration is Debug. @@ -859,6 +913,15 @@ private void StartDebugCommandEvents_AfterExecute(string guid, int id, object cu /// Cancel the default execution of the command. private void StartDebugCommandEvents_BeforeExecute(string guid, int id, object customIn, object customOut, ref bool cancelDefault) { + Debug.WriteLine("Before Start Debug"); + + if (DebugEngineStatus.IsRunning) + { + // Disable the override of F5 (this allows the debugged process to continue execution) + cancelDefault = false; + return; + } + bool bbPlatform = false; if (_dte.Solution.SolutionBuild.ActiveConfiguration != null) { @@ -875,9 +938,7 @@ private void StartDebugCommandEvents_BeforeExecute(string guid, int id, object c } } - Debug.WriteLine("Before Start Debug"); - - if (DebugEngineStatus.IsRunning || !bbPlatform) + if (!bbPlatform) { // Disable the override of F5 (this allows the debugged process to continue execution) cancelDefault = false; From 56b01d4b9875ac044af2d1311af28705ed5992c3 Mon Sep 17 00:00:00 2001 From: Pawel Hofman Date: Mon, 7 Jul 2014 17:43:11 +0200 Subject: [PATCH 349/851] Disabled disabling IntelliSense error-reporting Looks like a hack to me. I would rather search for a solution, to add defines for IntelliSense, to correctly report errors, instead of disabling it for good. I wish still to see errors I made in my app. --- src_vs2012/Package/Components/BuildPlatformsManager.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src_vs2012/Package/Components/BuildPlatformsManager.cs b/src_vs2012/Package/Components/BuildPlatformsManager.cs index 19f1d2f5..c8801dde 100644 --- a/src_vs2012/Package/Components/BuildPlatformsManager.cs +++ b/src_vs2012/Package/Components/BuildPlatformsManager.cs @@ -67,7 +67,7 @@ public BuildPlatformsManager(DTE2 dte) CommandHelper.Register(_dte, GuidList.guidVSStd2KString, StandardCommands.cmdidSolutionPlatform, cmdNewPlatform_beforeExec, cmdNewPlatform_afterExec); CommandHelper.Register(_dte, GuidList.guidVSDebugGroup, StandardCommands.cmdidDebugBreakatFunction, cmdNewFunctionBreakpoint_beforeExec, cmdNewFunctionBreakpoint_afterExec); - DisableIntelliSenseErrorReport(true); + //DisableIntelliSenseErrorReport(true); CheckSolutionPlatformCommand(); } From 5678b176a4673324622df00b1eb77b7cae705c5a Mon Sep 17 00:00:00 2001 From: Pawel Hofman Date: Mon, 7 Jul 2014 21:21:18 +0200 Subject: [PATCH 350/851] Package project doesn't depend on GDBParser Finally! --- src_vs2010/Package/BlackBerry.Package.csproj | 5 ----- src_vs2012/NativeCore/Components/Targets.cs | 2 +- src_vs2012/Package/BlackBerry.Package.csproj | 4 ---- src_vs2012/Package/BlackBerryPackage.cs | 3 --- src_vs2013/Package/BlackBerry.Package.csproj | 4 ---- 5 files changed, 1 insertion(+), 17 deletions(-) diff --git a/src_vs2010/Package/BlackBerry.Package.csproj b/src_vs2010/Package/BlackBerry.Package.csproj index 59293dc9..abcb56ac 100644 --- a/src_vs2010/Package/BlackBerry.Package.csproj +++ b/src_vs2010/Package/BlackBerry.Package.csproj @@ -610,11 +610,6 @@ {59A7B188-E307-4495-A3AF-4ED76B086A87} BlackBerry.DebugEngine - - {CC7B28E0-CB31-44F7-A380-E7072F670F38} - GDBParser - False - {36D4495B-9A92-478F-BF95-AEA13804A7BA} BlackBerry.NativeCore diff --git a/src_vs2012/NativeCore/Components/Targets.cs b/src_vs2012/NativeCore/Components/Targets.cs index 5558aa6f..22a7302c 100644 --- a/src_vs2012/NativeCore/Components/Targets.cs +++ b/src_vs2012/NativeCore/Components/Targets.cs @@ -40,7 +40,7 @@ private void OnConnectionStatusChanged(object sender, EventArgs e) var statusHandler = StatusChanged; var args = ToEventArgs(); - TraceLog.WriteLine("Target status changed to {0} ({1}) for device {2}", args.Status, args.Message ?? "-", Device); + TraceLog.WriteLine("Target status changed to {0} (message: \"{1}\") for device {2}", args.Status, args.Message ?? "-", Device); if (statusHandler != null) { diff --git a/src_vs2012/Package/BlackBerry.Package.csproj b/src_vs2012/Package/BlackBerry.Package.csproj index 2a332afe..75ee9698 100644 --- a/src_vs2012/Package/BlackBerry.Package.csproj +++ b/src_vs2012/Package/BlackBerry.Package.csproj @@ -557,10 +557,6 @@ {59a7b188-e307-4495-a3af-4ed76b086a87} BlackBerry.DebugEngine - - {cc7b28e0-cb31-44f7-a380-e7072f670f38} - GDBParser - {faddd789-6cb5-4f9d-8481-1c0c72e5f19f} BlackBerry.NativeCore diff --git a/src_vs2012/Package/BlackBerryPackage.cs b/src_vs2012/Package/BlackBerryPackage.cs index b0bb5d0f..57f19988 100644 --- a/src_vs2012/Package/BlackBerryPackage.cs +++ b/src_vs2012/Package/BlackBerryPackage.cs @@ -19,8 +19,6 @@ using System.ComponentModel.Design; using BlackBerry.DebugEngine; using BlackBerry.NativeCore; -using BlackBerry.NativeCore.Components; -using BlackBerry.NativeCore.Debugger; using BlackBerry.NativeCore.Diagnostics; using BlackBerry.NativeCore.Helpers; using BlackBerry.NativeCore.Model; @@ -44,7 +42,6 @@ using EnvDTE80; using System.Text.RegularExpressions; using System.Collections.Specialized; -using VSNDK.Parser; namespace BlackBerry.Package { diff --git a/src_vs2013/Package/BlackBerry.Package.csproj b/src_vs2013/Package/BlackBerry.Package.csproj index 89f0e1b2..ad74b4cc 100644 --- a/src_vs2013/Package/BlackBerry.Package.csproj +++ b/src_vs2013/Package/BlackBerry.Package.csproj @@ -674,10 +674,6 @@ {59a7b188-e307-4495-a3af-4ed76b086a87} BlackBerry.DebugEngine - - {cc7b28e0-cb31-44f7-a380-e7072f670f38} - GDBParser - {AE6BEE3E-3273-4214-A215-2924E33246CA} BlackBerry.NativeCore From ccae5e0dad7c2d7dc49fc0ba6f5db3734cb0107c Mon Sep 17 00:00:00 2001 From: Pawel Hofman Date: Mon, 7 Jul 2014 22:43:24 +0200 Subject: [PATCH 351/851] Fixed exception thrown each time parsing line number --- src_vs2010/DebugEngine/AD7.Impl/AD7StackFrame.cs | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src_vs2010/DebugEngine/AD7.Impl/AD7StackFrame.cs b/src_vs2010/DebugEngine/AD7.Impl/AD7StackFrame.cs index e4b2c26c..9ec80295 100644 --- a/src_vs2010/DebugEngine/AD7.Impl/AD7StackFrame.cs +++ b/src_vs2010/DebugEngine/AD7.Impl/AD7StackFrame.cs @@ -716,11 +716,8 @@ public AD7StackFrame(AD7Engine engine, AD7Thread thread, string[] frameInfo) string address = frameInfo[1]; m_functionName = frameInfo[2]; m_documentName = frameInfo[3]; - try - { - m_lineNum = Convert.ToUInt32(frameInfo[4]); - } - catch (Exception) + + if (!uint.TryParse(frameInfo[4], out m_lineNum)) { m_lineNum = 0; } From c87fe2db4c348338cb2f49627641a94bbf5a158e Mon Sep 17 00:00:00 2001 From: Pawel Hofman Date: Mon, 7 Jul 2014 22:44:06 +0200 Subject: [PATCH 352/851] Moved build-related code to BuildPlatformManager --- src_vs2012/Package/BlackBerryPackage.cs | 711 +----------------- .../Components/BuildPlatformsManager.cs | 488 +++++++++++- 2 files changed, 499 insertions(+), 700 deletions(-) diff --git a/src_vs2012/Package/BlackBerryPackage.cs b/src_vs2012/Package/BlackBerryPackage.cs index 57f19988..8aa95fa9 100644 --- a/src_vs2012/Package/BlackBerryPackage.cs +++ b/src_vs2012/Package/BlackBerryPackage.cs @@ -20,7 +20,6 @@ using BlackBerry.DebugEngine; using BlackBerry.NativeCore; using BlackBerry.NativeCore.Diagnostics; -using BlackBerry.NativeCore.Helpers; using BlackBerry.NativeCore.Model; using BlackBerry.NativeCore.Tools; using BlackBerry.Package.Components; @@ -36,12 +35,9 @@ using Microsoft.VisualStudio.Shell.Interop; using Microsoft.VisualStudio.Shell; using System.IO; -using System.Collections.Generic; using EnvDTE; using System.Windows.Forms; using EnvDTE80; -using System.Text.RegularExpressions; -using System.Collections.Specialized; namespace BlackBerry.Package { @@ -100,26 +96,9 @@ public sealed class BlackBerryPackage : Microsoft.VisualStudio.Shell.Package, ID public const string VersionString = "2.1.2014.0623"; public const string OptionsCategoryName = "BlackBerry"; - #region private member variables - private BlackBerryPaneTraceListener _traceWindow; private DTE2 _dte; private BuildPlatformsManager _buildPlatformsManager; - private bool _isSimulator; - private BuildEvents _buildEvents; - private List _targetDir; - private List _buildThese; - private bool _hitPlay; - private int _amountOfProjects; - private bool _isDeploying; - private OutputWindowPane _owP; - private bool _isDebugConfiguration = true; - private string _processName = ""; - - private CommandEvents _eventsDebug; - private CommandEvents _eventsDebugContext; - - #endregion #region Package Members @@ -183,19 +162,11 @@ protected override void Initialize() //Create Editor Factory. Note that the base Package class will call Dispose on it. RegisterEditorFactory(new BarDescriptorEditorFactory()); TraceLog.WriteLine(" * registered editors"); - _buildPlatformsManager = new BuildPlatformsManager(_dte); - // INFO: the references to returned objects must be stored and live as long, as the handlers are needed, - // since they are COM objects and will be automatically reclaimed on next GC.Collect(), causing handlers to be unsubscribed... - _eventsDebug = CommandHelper.Register(_dte, GuidList.guidVSStd97String, StandardCommands.cmdidStartDebug, StartDebugCommandEvents_BeforeExecute, StartDebugCommandEvents_AfterExecute); - _eventsDebugContext = CommandHelper.Register(_dte, GuidList.guidVSStd2KString, StandardCommands.cmdidStartDebugContext, StartDebugCommandEvents_BeforeExecute, StartDebugCommandEvents_AfterExecute); + _buildPlatformsManager = new BuildPlatformsManager(_dte); + _buildPlatformsManager.Initialize(); TraceLog.WriteLine(" * registered build-platforms manager"); - _buildEvents = _dte.Events.BuildEvents; - _buildEvents.OnBuildBegin += OnBuildBegin; - - TraceLog.WriteLine(" * subscribed to IDE events"); - // Add our command handlers for menu (commands must exist in the .vsct file) OleMenuCommandService mcs = GetService(typeof(IMenuCommandService)) as OleMenuCommandService; if ( null != mcs ) @@ -271,7 +242,7 @@ protected override void Initialize() // make sure there is an NDK selected and developer knows about it: EnsureActiveNDK(); - if (!HasActiveNDK) + if (_buildPlatformsManager.IsBlackBerrySolution(_dte) && ActiveNDK == null) { var form = new MissingNdkInstalledForm(); form.ShowDialog(); @@ -390,38 +361,6 @@ private void OpenHelpWebPage(object sender, EventArgs e) #endregion - #region private methods - - /// - /// Check to see if current solution is configured with a BlackBerry Configuration. - /// - private bool IsBlackBerrySolution(DTE2 dte) - { - if (dte.Solution != null) - { - var projects = dte.Solution.Projects; - if (projects != null) - { - foreach (Project project in projects) - { - var platformName = project.ConfigurationManager != null ? project.ConfigurationManager.ActiveConfiguration.PlatformName : null; - if (platformName == "BlackBerry" || platformName == "BlackBerrySimulator") - return true; - } - } - } - - return false; - } - - /// - /// Gets the currently selected device all actions should be performed against. - /// - private DeviceDefinition ActiveDevice - { - get { return PackageViewModel.Instance.ActiveDevice; } - } - /// /// Gets the number of installed NDKs. /// @@ -438,20 +377,6 @@ private NdkInfo ActiveNDK get { return PackageViewModel.Instance.ActiveNDK; } } - public bool HasActiveNDK - { - get - { -#if DEBUG - TraceLog.WriteLine("Is BlackBerry solution: {0}\r\nNDK count: {1}\r\nActive NDK: {2}", - IsBlackBerrySolution(_dte), GetInstalledNdkCount(), - ActiveNDK != null ? ActiveNDK.ToString() : "(none)"); -#endif - return !IsBlackBerrySolution(_dte) || ActiveNDK != null; - } - } - - /// /// Makes sure the NDK is selected and its paths are stored inside registry for build toolset. /// @@ -460,418 +385,25 @@ private void EnsureActiveNDK() PackageViewModel.Instance.EnsureActiveNDK(); } - /// - /// Identify the projects to be build and start the build process. - /// - /// TRUE if successful, FALSE if not. - private bool BuildBar() - { - bool success = true; - try - { - if (_buildThese.Count != 0) - { - _buildEvents.OnBuildDone += OnBuildDone; - - try - { - Solution2 solution = (Solution2)_dte.Solution; - _hitPlay = true; - _amountOfProjects = _buildThese.Count; // OnBuildDone will call build() only after receiving "amountOfProjects" events - foreach (string projectName in _buildThese) - solution.SolutionBuild.BuildProject("Debug", projectName, false); - } - catch (Exception ex) - { - Debug.WriteLine(ex.Message); - success = false; - } - } - else - { - success = false; - } - } - catch (Exception e) - { - Debug.WriteLine(e.Message); - success = false; - } - return success; - } - - /// - /// Verify if the build process was successful. If so, start deploying the app. - /// - private void Built() - { - _owP.TextDocument.Selection.SelectAll(); - string outputText = _owP.TextDocument.Selection.Text; - - if ((outputText == "") || (Regex.IsMatch(outputText, ">Build succeeded.\r\n")) || (!outputText.Contains("): error :"))) - { - if (_isDebugConfiguration) - { - // Write file to flag the deploy task that it should use the -debugNative option - string fileContent = "Use -debugNative.\r\n"; - using (var file = new StreamWriter(ConfigDefaults.BuildDebugNativePath)) - { - file.WriteLine(fileContent); - } - - _buildEvents.OnBuildDone += OnBuildDone; - } - - foreach (String startupProject in (Array)_dte.Solution.SolutionBuild.StartupProjects) - { - foreach (SolutionContext sc in _dte.Solution.SolutionBuild.ActiveConfiguration.SolutionContexts) - { - if (sc.ProjectName == startupProject) - { - sc.ShouldDeploy = true; - } - else - { - sc.ShouldDeploy = false; - } - } - } - _isDeploying = true; - _dte.Solution.SolutionBuild.Deploy(true); - } - } - - /// - /// Get the process ID and launch an executable using the BlackBerry debug engine. - /// - private void Deployed() - { - string currentPath = ""; - string executablePath; - - foreach (string[] paths in _targetDir) - { - if (paths[0] == _processName) - { - currentPath = paths[1]; - break; - } - } - - executablePath = currentPath + _processName; // The executable path - executablePath = executablePath.Replace('\\', '/'); - - var ndk = ActiveNDK; - var device = ActiveDevice; - - if (ndk == null) - { - MessageBoxHelper.Show("Missing NDK selected. Please install any and mark as active using BlackBerry menu options.", null, - MessageBoxButtons.OK, MessageBoxIcon.Error); - return; - } - if (device == null) - { - MessageBoxHelper.Show("Missing device selected. Please define an IP, password and mark a device as active using BlackBerry menu options.", null, - MessageBoxButtons.OK, MessageBoxIcon.Error); - return; - } - - LaunchDebugTarget(_processName, ndk.ToDefinition().ToolsPath, ConfigDefaults.SshPublicKeyPath.Replace('\\', '/'), device.IP, device.Password, executablePath); - - /* - string pidString = ""; - string toolsPath = ""; - string publicKeyPath = ""; - string targetIP = ""; - string password = ""; - string executablePath = ""; - if (GetProcessInfo(_dte, ref pidString, ref toolsPath, ref publicKeyPath, ref targetIP, ref password, ref executablePath)) - { - bool CancelDefault = LaunchDebugTarget(pidString, toolsPath, publicKeyPath, targetIP, password, executablePath); - } - else - { - MessageBox.Show("Failed to debug the application.\n\nPlease, close the app in case it was launched in the device/simulator.", "Failed to launch debugger", MessageBoxButtons.OK, MessageBoxIcon.Error); - } - */ - } - - /// - /// Launch an executable using the BlackBerry debug engine. - /// - /// Process ID in string format. - /// TRUE if successful, False if not. - private bool LaunchDebugTarget(string pidString, string toolsPath, string publicKeyPath, string targetIP, string password, string executablePath) - { - ServiceProvider sp = new ServiceProvider((Microsoft.VisualStudio.OLE.Interop.IServiceProvider)_dte); - IVsDebugger dbg = (IVsDebugger)sp.GetService(typeof(SVsShellDebugger)); - VsDebugTargetInfo info = new VsDebugTargetInfo(); - - info.cbSize = (uint)Marshal.SizeOf(info); - info.dlo = DEBUG_LAUNCH_OPERATION.DLO_CreateProcess; - - // Store all debugger arguments in a string - var nvc = new NameValueCollection(); - nvc.Add("pid", pidString); - nvc.Add("targetIP", targetIP); // The device (IP address) - info.bstrExe = executablePath; // The executable path - nvc.Add("isSimulator", _isSimulator.ToString()); - nvc.Add("ToolsPath", toolsPath); - nvc.Add("PublicKeyPath", publicKeyPath); - nvc.Add("Password", password); - - info.bstrArg = NameValueCollectionHelper.DumpToString(nvc); - - info.bstrRemoteMachine = null; // debug locally - info.fSendStdoutToOutputWindow = 0; // Let stdout stay with the application. - info.clsidCustom = new Guid(AD7Engine.DebugEngineGuid); // Set the launching engine as the BlackBerry debug-engine - info.grfLaunch = 0; - - IntPtr pInfo = Marshal.AllocCoTaskMem((int)info.cbSize); - Marshal.StructureToPtr(info, pInfo, false); - - try - { - int result = dbg.LaunchDebugTargets(1, pInfo); - - if (result != VSConstants.S_OK) - { - string msg; - IVsUIShell sh = (IVsUIShell)sp.GetService(typeof(SVsUIShell)); - sh.GetErrorInfo(out msg); - Debug.WriteLine("LaunchDebugTargets: " + msg); - - return true; - } - } - finally - { - if (pInfo != IntPtr.Zero) - { - Marshal.FreeCoTaskMem(pInfo); - } - } - - return false; - } - - /* - /// - /// Get the PID of the launched native app by parsing text from the output window. - /// - /// Application Object. - /// Returns the Process ID as a string. - /// TRUE if successful, False if not. - private bool GetProcessInfo(DTE2 dte, ref string pidString, ref string toolsPath, ref string publicKeyPath, ref string targetIP, ref string password, ref string executablePath) - { - string currentPath = ""; - - foreach (string[] paths in _targetDir) - { - if (paths[0] == _processName) - { - currentPath = paths[1]; - break; - } - } - - executablePath = currentPath + _processName; // The executable path - executablePath = executablePath.Replace('\\', '/'); - publicKeyPath = ConfigDefaults.SshPublicKeyPath; - publicKeyPath = publicKeyPath.Replace('\\', '/'); - - var ndk = ActiveNDK; - var device = ActiveDevice; - - if (ndk == null) - { - MessageBoxHelper.Show("Missing NDK selected. Please install any and mark as active using BlackBerry menu options.", null, - MessageBoxButtons.OK, MessageBoxIcon.Error); - return false; - } - if (device == null) - { - MessageBoxHelper.Show("Missing device selected. Please define an IP, password and mark a device as active using BlackBerry menu options.", null, - MessageBoxButtons.OK, MessageBoxIcon.Error); - return false; - } - - var gdbInfo = new GdbInfo(ndk, device, null, null); - - toolsPath = ndk.ToDefinition().ToolsPath; - targetIP = device.IP; - password = device.Password; - - Targets.Connect(device, publicKeyPath, null); - Targets.Wait(device); - - var runner = new GdbHostRunner(ConfigDefaults.GdbHostPath, gdbInfo); - runner.ExecuteAsync(); - - var processesResponse = RequestsFactory.ListProcesses(); - var request = RequestsFactory.Group(RequestsFactory.SetTargetDevice(gdbInfo.Device), processesResponse, RequestsFactory.Exit()); - runner.Send(request); - request.Wait(); - - var message = processesResponse.Response; - - - pidString = GetPIDfromGDB(_processName, targetIP, password, _isSimulator, toolsPath, publicKeyPath); - - if (pidString == "") - { - // Select all of the text - _owP.TextDocument.Selection.SelectAll(); - string outputText = _owP.TextDocument.Selection.Text; - - // Check for successful deployment - if (Regex.IsMatch(outputText, "Info: done")) - { - string pattern = @"\s+result::(\d+)\r\n.+|\s+result::(\d+) \(TaskId:"; - Regex r = new Regex(pattern, RegexOptions.IgnoreCase); - - // Match the regular expression pattern against a text string. - Match m = r.Match(outputText); - - // Take first match - if (m.Success) - { - Group g = m.Groups[1]; - CaptureCollection cc = g.Captures; - if (cc.Count == 0) - { // Diagnostic verbosity mode - g = m.Groups[2]; - cc = g.Captures; - } - - if (cc.Count != 0) - { - Capture c = cc[0]; - pidString = c.ToString(); - } - } - } - } - - if (pidString != "") - { - - // Store process name and file location into ProcessesPath.txt, so "Attach To Process" would be able to find the - // source code for a running process. - // First read the file. - _processName += "_" + _isSimulator; - - string processesPaths; - try - { - StreamReader readProcessesPathsFile = new StreamReader(Path.Combine(ConfigDefaults.DataDirectory, "ProcessesPath.txt")); - processesPaths = readProcessesPathsFile.ReadToEnd(); - readProcessesPathsFile.Close(); - } - catch (Exception) - { - processesPaths = ""; - } - - // Updating the contents. - int begin = processesPaths.IndexOf(_processName + ":>", StringComparison.Ordinal); - - if (begin != -1) - { - begin += _processName.Length + 2; - int end = processesPaths.IndexOf("\r\n", begin, System.StringComparison.Ordinal); - processesPaths = processesPaths.Substring(0, begin) + currentPath + processesPaths.Substring(end); - } - else - { - processesPaths = processesPaths + _processName + ":>" + currentPath + "\r\n"; - } - - // Writing contents to file. - try - { - StreamWriter writeProcessesPathsFile = new StreamWriter(Path.Combine(ConfigDefaults.DataDirectory, "ProcessesPath.txt"), false); - writeProcessesPathsFile.Write(processesPaths); - writeProcessesPathsFile.Close(); - } - catch (Exception) - { - } - - return true; - } - return false; - } - - private string GetPIDfromGDB(string processName, string ip, string password, bool isSimulator, string toolsPath, string publicKeyPath) + private void ImportBlackBerryProject(object sender, EventArgs e) { - string pid = ""; - string response = GDBParser.GetPIDsThroughGDB(ip, password, isSimulator, toolsPath, publicKeyPath, 7); - - if ((response == "TIMEOUT!") || (response.IndexOf("1^error,msg=", 0, StringComparison.Ordinal) != -1)) //found an error - { - if (response == "TIMEOUT!") // Timeout error, normally happen when the device is not connected. - { - MessageBox.Show("Please, verify if the Device/Simulator IP in \"BlackBerry -> Settings\" menu is correct and check if it is connected.", "Device/Simulator not connected or not configured properly", MessageBoxButtons.OK, MessageBoxIcon.Warning); - } - else - if (response[29] == ':') // error: 1^error,msg="169.254.0.3:8000: The requested address is not valid in its context." - { - string txt = response.Substring(13, response.IndexOf(':', 13) - 13) + response.Substring(29, response.IndexOf('"', 31) - 29); - string caption; - if (txt.IndexOf("The requested address is not valid in its context.") != -1) - { - txt += "\n\nPlease, verify the BlackBerry device/simulator IP settings."; - caption = "Invalid IP"; - } - else - { - txt += "\n\nPlease, verify if the device/simulator is connected."; - caption = "Connection failed"; - } - MessageBox.Show(txt, caption, MessageBoxButtons.OK, MessageBoxIcon.Warning); - } - } - else if (response.Contains("^done")) + var form = DialogHelper.OpenNativeCoreProject("Open Core Native Application Project", null); + if (form.ShowDialog() == DialogResult.OK) { - int i = response.IndexOf(processName + " - ", StringComparison.Ordinal); - if (i != -1) - { - i += processName.Length + 3; - pid = response.Substring(i, response.IndexOf('/', i) - i); - } - } - return pid; - } - */ + string filename = form.FileName; + FileInfo fi = new FileInfo(filename); + string folderName = fi.DirectoryName; - /// - /// Verify if the app configuration is Debug. - /// - /// True if Debug configuration; False otherwise. - private bool CheckDebugConfiguration() - { - Solution2 solution = (Solution2)_dte.Solution; - foreach (String startupProject in (Array)solution.SolutionBuild.StartupProjects) - { - foreach (Project p1 in solution.Projects) - { - if (p1.UniqueName == startupProject) - { - ConfigurationManager config = p1.ConfigurationManager; - Configuration active = config.ActiveConfiguration; + Array projects = (Array)_dte.ActiveSolutionProjects; + Project project = (Project)projects.GetValue(0); + string name = project.FullName; - return active.ConfigurationName.ToUpper() == "DEBUG"; - } - } + // Create the dialog instance without Help support. + var importSummary = new Import.Import(project, folderName, name); + importSummary.ShowModel2(); } - return false; } - - #endregion - #region IDisposable Implementation /// @@ -885,218 +417,5 @@ public void Dispose() } #endregion - - #region Event Handlers - - /// - /// New Start Debug Command Events After Execution Event Handler. - /// - /// Command GUID. - /// Command ID. - /// Custom IN Object. - /// Custom OUT Object. - private void StartDebugCommandEvents_AfterExecute(string guid, int id, object customIn, object customOut) - { - Debug.WriteLine("After Start Debug"); - } - - /// - /// New Start Debug Command Events Before Execution Event Handler. Call the method responsible for building the app. - /// - /// Command GUID. - /// Command ID. - /// Custom IN Object. - /// Custom OUT Object. - /// Cancel the default execution of the command. - private void StartDebugCommandEvents_BeforeExecute(string guid, int id, object customIn, object customOut, ref bool cancelDefault) - { - Debug.WriteLine("Before Start Debug"); - - if (DebugEngineStatus.IsRunning) - { - // Disable the override of F5 (this allows the debugged process to continue execution) - cancelDefault = false; - return; - } - - bool bbPlatform = false; - if (_dte.Solution.SolutionBuild.ActiveConfiguration != null) - { - _isDebugConfiguration = CheckDebugConfiguration(); - - SolutionContexts scCollection = _dte.Solution.SolutionBuild.ActiveConfiguration.SolutionContexts; - foreach (SolutionContext sc in scCollection) - { - if (sc.PlatformName == "BlackBerry" || sc.PlatformName == "BlackBerrySimulator") - { - bbPlatform = true; - _isSimulator = sc.PlatformName == "BlackBerrySimulator"; - } - } - } - - if (!bbPlatform) - { - // Disable the override of F5 (this allows the debugged process to continue execution) - cancelDefault = false; - } - else - { - try - { - Solution2 solution = (Solution2)_dte.Solution; - _buildThese = new List(); - _targetDir = new List(); - - foreach (String startupProject in (Array)solution.SolutionBuild.StartupProjects) - { - foreach (Project p1 in solution.Projects) - { - if (p1.UniqueName == startupProject) - { - _buildThese.Add(p1.FullName); - _processName = p1.Name; - - ConfigurationManager config = p1.ConfigurationManager; - Configuration active = config.ActiveConfiguration; - - foreach (Property prop in active.Properties) - { - try - { - if (prop.Name == "OutputPath") - { - string[] path = new string[2]; - path[0] = p1.Name; - path[1] = prop.Value.ToString(); - _targetDir.Add(path); - break; - } - } - catch - { - } - } - - break; - } - } - } - } - catch (Exception ex) - { - Debug.WriteLine(ex.Message); - } - - - // Create a reference to the Output window. - // Create a tool window reference for the Output window - // and window pane. - OutputWindow ow = _dte.ToolWindows.OutputWindow; - - // Select the Build pane in the Output window. - _owP = ow.OutputWindowPanes.Item("Build"); - _owP.Activate(); - - if (_isDebugConfiguration) - { - /* - PH: FIXME: update API Level vs current project verification... - UpdateManagerData upData; - if (_targetDir.Count > 0) - upData = new UpdateManagerData(_targetDir[0][1]); - else - upData = new UpdateManagerData(); - - if (!upData.validateDeviceVersion(_isSimulator)) - { - cancelDefault = true; - } - else - */ - { - BuildBar(); - cancelDefault = true; - } - } - else - { - BuildBar(); - cancelDefault = true; - } - } - } - - - /// - /// This event is fired only when the build/rebuild/clean process ends. - /// - /// Represents the scope of the build. - /// Represents the type of build action that is occurring, such as a build or a deploy action. - private void OnBuildDone(vsBuildScope scope, vsBuildAction action) - { - if (action == vsBuildAction.vsBuildActionBuild) - { - _amountOfProjects -= 1; - if (_amountOfProjects == 0) - { - _buildEvents.OnBuildDone -= OnBuildDone; - Built(); - } - } - else if (action == vsBuildAction.vsBuildActionDeploy) - { - _buildEvents.OnBuildDone -= OnBuildDone; - _isDeploying = false; - Deployed(); - } - } - - /// - /// This event is fired only when user wants to build, rebuild or clean the project. - /// - /// Represents the scope of the build. - /// Represents the type of build action that is occurring, such as a build or a deploy action. - private void OnBuildBegin(vsBuildScope scope, vsBuildAction action) - { - if (!HasActiveNDK) - { - var form = new MissingNdkInstalledForm(); - form.ShowDialog(); - return; - } - - if (action == vsBuildAction.vsBuildActionBuild || action == vsBuildAction.vsBuildActionRebuildAll) - { - if (!_hitPlay && !_isDeploying) - { - // means that the "play" building and deploying process was cancelled before, so we have to disable the - // OnBuildDone event to avoid deploying in case user only wants to build. - _buildEvents.OnBuildDone -= OnBuildDone; - } - _hitPlay = false; - } - } - - private void ImportBlackBerryProject(object sender, EventArgs e) - { - var form = DialogHelper.OpenNativeCoreProject("Open Core Native Application Project", null); - if (form.ShowDialog() == DialogResult.OK) - { - string filename = form.FileName; - FileInfo fi = new FileInfo(filename); - string folderName = fi.DirectoryName; - - Array projects = (Array)_dte.ActiveSolutionProjects; - Project project = (Project)projects.GetValue(0); - string name = project.FullName; - - // Create the dialog instance without Help support. - var importSummary = new Import.Import(project, folderName, name); - importSummary.ShowModel2(); - } - } - - #endregion } } diff --git a/src_vs2012/Package/Components/BuildPlatformsManager.cs b/src_vs2012/Package/Components/BuildPlatformsManager.cs index c8801dde..17a9ac66 100644 --- a/src_vs2012/Package/Components/BuildPlatformsManager.cs +++ b/src_vs2012/Package/Components/BuildPlatformsManager.cs @@ -14,14 +14,27 @@ using System; using System.Collections.Generic; +using System.Collections.Specialized; using System.Diagnostics; using System.IO; using System.Linq; +using System.Runtime.InteropServices; +using System.Text.RegularExpressions; +using System.Windows.Forms; +using BlackBerry.DebugEngine; +using BlackBerry.NativeCore; using BlackBerry.NativeCore.Components; +using BlackBerry.NativeCore.Helpers; +using BlackBerry.NativeCore.Model; +using BlackBerry.Package.Dialogs; using BlackBerry.Package.Helpers; +using BlackBerry.Package.ViewModels; using EnvDTE; using EnvDTE80; +using Microsoft.VisualStudio; using Microsoft.VisualStudio.CommandBars; +using Microsoft.VisualStudio.Shell; +using Microsoft.VisualStudio.Shell.Interop; using Microsoft.VisualStudio.VCProjectEngine; namespace BlackBerry.Package.Components @@ -46,6 +59,22 @@ sealed class ConfigTableEntry private TokenProcessor _tokenProcessor; private readonly List _configTable; + private bool _isSimulator; + private List _targetDir; + private List _buildThese; + private bool _hitPlay; + private int _amountOfProjects; + private bool _isDeploying; + private OutputWindowPane _owP; + private bool _isDebugConfiguration = true; + private string _processName = ""; + + private BuildEvents _buildEvents; + + private CommandEvents _eventsDebug; + private CommandEvents _eventsDebugContext; + + private const string BLACKBERRY = "BlackBerry"; private const string BLACKBERRYSIMULATOR = "BlackBerrySimulator"; private const string STANDARD_TOOL_BAR = "Standard"; @@ -62,15 +91,46 @@ public BuildPlatformsManager(DTE2 dte) // initialize variables: _dte = dte; _configTable = new List(); + } + public void Initialize() + { // register for command events, when accessing build platforms: CommandHelper.Register(_dte, GuidList.guidVSStd2KString, StandardCommands.cmdidSolutionPlatform, cmdNewPlatform_beforeExec, cmdNewPlatform_afterExec); CommandHelper.Register(_dte, GuidList.guidVSDebugGroup, StandardCommands.cmdidDebugBreakatFunction, cmdNewFunctionBreakpoint_beforeExec, cmdNewFunctionBreakpoint_afterExec); //DisableIntelliSenseErrorReport(true); CheckSolutionPlatformCommand(); + + // INFO: the references to returned objects must be stored and live as long, as the handlers are needed, + // since they are COM objects and will be automatically reclaimed on next GC.Collect(), causing handlers to be unsubscribed... + _eventsDebug = CommandHelper.Register(_dte, GuidList.guidVSStd97String, StandardCommands.cmdidStartDebug, StartDebugCommandEvents_BeforeExecute, StartDebugCommandEvents_AfterExecute); + _eventsDebugContext = CommandHelper.Register(_dte, GuidList.guidVSStd2KString, StandardCommands.cmdidStartDebugContext, StartDebugCommandEvents_BeforeExecute, StartDebugCommandEvents_AfterExecute); + + _buildEvents = _dte.Events.BuildEvents; + _buildEvents.OnBuildBegin += OnBuildBegin; + } + + #region Properties + + /// + /// Gets the currently selected device all actions should be performed against. + /// + private DeviceDefinition ActiveDevice + { + get { return PackageViewModel.Instance.ActiveDevice; } } + /// + /// Gets the currently selected NDK to build against. + /// + private NdkInfo ActiveNDK + { + get { return PackageViewModel.Instance.ActiveNDK; } + } + + #endregion + /// /// Terminate the manager. /// @@ -136,7 +196,7 @@ private void DisableIntelliSenseErrorReport(bool disable) /// Cancel the default execution of the command. private void cmdNewPlatform_beforeExec(string Guid, int ID, object CustomIn, object CustomOut, ref bool CancelDefault) { - GetSolutionPlarformConfig(); + GetSolutionPlatformConfig(); } /// @@ -148,7 +208,7 @@ private void cmdNewPlatform_beforeExec(string Guid, int ID, object CustomIn, obj /// Custom OUT Object. private void cmdNewPlatform_afterExec(string Guid, int ID, object CustomIn, object CustomOut) { - SolutionPlarformConfig(); + SolutionPlatformConfig(); AddBarDescriptor(); } @@ -189,7 +249,7 @@ private void cmdNewFunctionBreakpoint_afterExec(string Guid, int ID, object Cust /// /// Set solution config after edit /// - private void SolutionPlarformConfig() + private void SolutionPlatformConfig() { DTE dte = _dte as DTE; @@ -224,7 +284,7 @@ private void SolutionPlarformConfig() /// /// Get solution configuration before edit /// - private void GetSolutionPlarformConfig() + private void GetSolutionPlatformConfig() { DTE dte = _dte as DTE; @@ -342,5 +402,425 @@ private void AddBarDescriptor() Debug.WriteLine(e.Message); } } + + + /// + /// Identify the projects to be build and start the build process. + /// + /// TRUE if successful, FALSE if not. + private bool BuildBar() + { + bool success = true; + try + { + if (_buildThese.Count != 0) + { + _buildEvents.OnBuildDone += OnBuildDone; + + try + { + Solution2 solution = (Solution2)_dte.Solution; + _hitPlay = true; + _amountOfProjects = _buildThese.Count; // OnBuildDone will call build() only after receiving "amountOfProjects" events + foreach (string projectName in _buildThese) + solution.SolutionBuild.BuildProject("Debug", projectName, false); + } + catch (Exception ex) + { + Debug.WriteLine(ex.Message); + success = false; + } + } + else + { + success = false; + } + } + catch (Exception e) + { + Debug.WriteLine(e.Message); + success = false; + } + return success; + } + + /// + /// Verify if the build process was successful. If so, start deploying the app. + /// + private void Built() + { + _owP.TextDocument.Selection.SelectAll(); + string outputText = _owP.TextDocument.Selection.Text; + + if ((outputText == "") || (Regex.IsMatch(outputText, ">Build succeeded.\r\n")) || (!outputText.Contains("): error :"))) + { + if (_isDebugConfiguration) + { + // Write file to flag the deploy task that it should use the -debugNative option + string fileContent = "Use -debugNative.\r\n"; + using (var file = new StreamWriter(ConfigDefaults.BuildDebugNativePath)) + { + file.WriteLine(fileContent); + } + + _buildEvents.OnBuildDone += OnBuildDone; + } + + foreach (String startupProject in (Array)_dte.Solution.SolutionBuild.StartupProjects) + { + foreach (SolutionContext sc in _dte.Solution.SolutionBuild.ActiveConfiguration.SolutionContexts) + { + if (sc.ProjectName == startupProject) + { + sc.ShouldDeploy = true; + } + else + { + sc.ShouldDeploy = false; + } + } + } + _isDeploying = true; + _dte.Solution.SolutionBuild.Deploy(true); + } + } + + /// + /// Get the process ID and launch an executable using the BlackBerry debug engine. + /// + private void Deployed() + { + string currentPath = ""; + string executablePath; + + foreach (string[] paths in _targetDir) + { + if (paths[0] == _processName) + { + currentPath = paths[1]; + break; + } + } + + executablePath = currentPath + _processName; // The executable path + executablePath = executablePath.Replace('\\', '/'); + + var ndk = ActiveNDK; + var device = ActiveDevice; + + if (ndk == null) + { + MessageBoxHelper.Show("Missing NDK selected. Please install any and mark as active using BlackBerry menu options.", null, + MessageBoxButtons.OK, MessageBoxIcon.Error); + return; + } + if (device == null) + { + MessageBoxHelper.Show("Missing device selected. Please define an IP, password and mark a device as active using BlackBerry menu options.", null, + MessageBoxButtons.OK, MessageBoxIcon.Error); + return; + } + + LaunchDebugTarget(_processName, ndk.ToDefinition().ToolsPath, ConfigDefaults.SshPublicKeyPath.Replace('\\', '/'), device.IP, device.Password, executablePath); + } + + /// + /// Launch an executable using the BlackBerry debug engine. + /// + /// Process ID in string format. + /// TRUE if successful, False if not. + private bool LaunchDebugTarget(string pidString, string toolsPath, string publicKeyPath, string targetIP, string password, string executablePath) + { + ServiceProvider sp = new ServiceProvider((Microsoft.VisualStudio.OLE.Interop.IServiceProvider)_dte); + IVsDebugger dbg = (IVsDebugger)sp.GetService(typeof(SVsShellDebugger)); + VsDebugTargetInfo info = new VsDebugTargetInfo(); + + info.cbSize = (uint)Marshal.SizeOf(info); + info.dlo = DEBUG_LAUNCH_OPERATION.DLO_CreateProcess; + + // Store all debugger arguments in a string + var nvc = new NameValueCollection(); + nvc.Add("pid", pidString); + nvc.Add("targetIP", targetIP); // The device (IP address) + info.bstrExe = executablePath; // The executable path + nvc.Add("isSimulator", _isSimulator.ToString()); + nvc.Add("ToolsPath", toolsPath); + nvc.Add("PublicKeyPath", publicKeyPath); + nvc.Add("Password", password); + + info.bstrArg = NameValueCollectionHelper.DumpToString(nvc); + + info.bstrRemoteMachine = null; // debug locally + info.fSendStdoutToOutputWindow = 0; // Let stdout stay with the application. + info.clsidCustom = new Guid(AD7Engine.DebugEngineGuid); // Set the launching engine as the BlackBerry debug-engine + info.grfLaunch = 0; + + IntPtr pInfo = Marshal.AllocCoTaskMem((int)info.cbSize); + Marshal.StructureToPtr(info, pInfo, false); + + try + { + int result = dbg.LaunchDebugTargets(1, pInfo); + + if (result != VSConstants.S_OK) + { + string msg; + IVsUIShell sh = (IVsUIShell)sp.GetService(typeof(SVsUIShell)); + sh.GetErrorInfo(out msg); + Debug.WriteLine("LaunchDebugTargets: " + msg); + + return true; + } + } + finally + { + if (pInfo != IntPtr.Zero) + { + Marshal.FreeCoTaskMem(pInfo); + } + } + + return false; + } + + + #region Event Handlers + + /// + /// New Start Debug Command Events After Execution Event Handler. + /// + /// Command GUID. + /// Command ID. + /// Custom IN Object. + /// Custom OUT Object. + private void StartDebugCommandEvents_AfterExecute(string guid, int id, object customIn, object customOut) + { + Debug.WriteLine("After Start Debug"); + } + + /// + /// New Start Debug Command Events Before Execution Event Handler. Call the method responsible for building the app. + /// + /// Command GUID. + /// Command ID. + /// Custom IN Object. + /// Custom OUT Object. + /// Cancel the default execution of the command. + private void StartDebugCommandEvents_BeforeExecute(string guid, int id, object customIn, object customOut, ref bool cancelDefault) + { + Debug.WriteLine("Before Start Debug"); + + if (DebugEngineStatus.IsRunning) + { + // Disable the override of F5 (this allows the debugged process to continue execution) + cancelDefault = false; + return; + } + + bool bbPlatform = false; + if (_dte.Solution.SolutionBuild.ActiveConfiguration != null) + { + _isDebugConfiguration = CheckDebugConfiguration(); + + SolutionContexts scCollection = _dte.Solution.SolutionBuild.ActiveConfiguration.SolutionContexts; + foreach (SolutionContext sc in scCollection) + { + if (sc.PlatformName == "BlackBerry" || sc.PlatformName == "BlackBerrySimulator") + { + bbPlatform = true; + _isSimulator = sc.PlatformName == "BlackBerrySimulator"; + } + } + } + + if (!bbPlatform) + { + // Disable the override of F5 (this allows the debugged process to continue execution) + cancelDefault = false; + } + else + { + try + { + Solution2 solution = (Solution2)_dte.Solution; + _buildThese = new List(); + _targetDir = new List(); + + foreach (String startupProject in (Array)solution.SolutionBuild.StartupProjects) + { + foreach (Project p1 in solution.Projects) + { + if (p1.UniqueName == startupProject) + { + _buildThese.Add(p1.FullName); + _processName = p1.Name; + + ConfigurationManager config = p1.ConfigurationManager; + Configuration active = config.ActiveConfiguration; + + foreach (Property prop in active.Properties) + { + try + { + if (prop.Name == "OutputPath") + { + string[] path = new string[2]; + path[0] = p1.Name; + path[1] = prop.Value.ToString(); + _targetDir.Add(path); + break; + } + } + catch + { + } + } + + break; + } + } + } + } + catch (Exception ex) + { + Debug.WriteLine(ex.Message); + } + + + // Create a reference to the Output window. + // Create a tool window reference for the Output window + // and window pane. + OutputWindow ow = _dte.ToolWindows.OutputWindow; + + // Select the Build pane in the Output window. + _owP = ow.OutputWindowPanes.Item("Build"); + _owP.Activate(); + + if (_isDebugConfiguration) + { + /* + PH: FIXME: update API Level vs current project verification... + UpdateManagerData upData; + if (_targetDir.Count > 0) + upData = new UpdateManagerData(_targetDir[0][1]); + else + upData = new UpdateManagerData(); + + if (!upData.validateDeviceVersion(_isSimulator)) + { + cancelDefault = true; + } + else + */ + { + BuildBar(); + cancelDefault = true; + } + } + else + { + BuildBar(); + cancelDefault = true; + } + } + } + + + /// + /// This event is fired only when the build/rebuild/clean process ends. + /// + /// Represents the scope of the build. + /// Represents the type of build action that is occurring, such as a build or a deploy action. + private void OnBuildDone(vsBuildScope scope, vsBuildAction action) + { + if (action == vsBuildAction.vsBuildActionBuild) + { + _amountOfProjects -= 1; + if (_amountOfProjects == 0) + { + _buildEvents.OnBuildDone -= OnBuildDone; + Built(); + } + } + else if (action == vsBuildAction.vsBuildActionDeploy) + { + _buildEvents.OnBuildDone -= OnBuildDone; + _isDeploying = false; + Deployed(); + } + } + + /// + /// This event is fired only when user wants to build, rebuild or clean the project. + /// + /// Represents the scope of the build. + /// Represents the type of build action that is occurring, such as a build or a deploy action. + private void OnBuildBegin(vsBuildScope scope, vsBuildAction action) + { + if (IsBlackBerrySolution(_dte) && ActiveNDK == null) + { + var form = new MissingNdkInstalledForm(); + form.ShowDialog(); + return; + } + + if (action == vsBuildAction.vsBuildActionBuild || action == vsBuildAction.vsBuildActionRebuildAll) + { + if (!_hitPlay && !_isDeploying) + { + // means that the "play" building and deploying process was cancelled before, so we have to disable the + // OnBuildDone event to avoid deploying in case user only wants to build. + _buildEvents.OnBuildDone -= OnBuildDone; + } + _hitPlay = false; + } + } + + #endregion + + /// + /// Check to see if current solution is configured with a BlackBerry Configuration. + /// + public bool IsBlackBerrySolution(DTE2 dte) + { + if (dte.Solution != null) + { + var projects = dte.Solution.Projects; + if (projects != null) + { + foreach (Project project in projects) + { + var platformName = project.ConfigurationManager != null ? project.ConfigurationManager.ActiveConfiguration.PlatformName : null; + if (platformName == "BlackBerry" || platformName == "BlackBerrySimulator") + return true; + } + } + } + + return false; + } + + /// + /// Verify if the app configuration is Debug. + /// + /// True if Debug configuration; False otherwise. + private bool CheckDebugConfiguration() + { + Solution2 solution = (Solution2)_dte.Solution; + foreach (String startupProject in (Array)solution.SolutionBuild.StartupProjects) + { + foreach (Project p1 in solution.Projects) + { + if (p1.UniqueName == startupProject) + { + ConfigurationManager config = p1.ConfigurationManager; + Configuration active = config.ActiveConfiguration; + + return active.ConfigurationName.ToUpper() == "DEBUG"; + } + } + } + return false; + } } } From 7900c5acfe9d6c397420be383e6a9822875c4103 Mon Sep 17 00:00:00 2001 From: Pawel Hofman Date: Tue, 8 Jul 2014 03:25:37 +0200 Subject: [PATCH 353/851] Extending Win32 project with BlackBerry platform targets --- src_vs2010/Package/BlackBerry.Package.csproj | 3 + src_vs2012/Package/BlackBerry.Package.csproj | 1 + src_vs2012/Package/BlackBerryPackage.cs | 31 +- .../Components/BuildPlatformsManager.cs | 270 +++++------------- src_vs2012/Package/Helpers/DteHelper.cs | 35 +++ src_vs2012/Package/PackageCommands.cs | 3 +- .../Package/Resources/Package.Menu.vsct | 12 +- src_vs2013/Package/BlackBerry.Package.csproj | 3 + 8 files changed, 145 insertions(+), 213 deletions(-) create mode 100644 src_vs2012/Package/Helpers/DteHelper.cs diff --git a/src_vs2010/Package/BlackBerry.Package.csproj b/src_vs2010/Package/BlackBerry.Package.csproj index abcb56ac..a45996ed 100644 --- a/src_vs2010/Package/BlackBerry.Package.csproj +++ b/src_vs2010/Package/BlackBerry.Package.csproj @@ -183,6 +183,9 @@ Helpers\DialogHelper.cs + + Helpers\DteHelper.cs + Helpers\MessageBoxHelper.cs diff --git a/src_vs2012/Package/BlackBerry.Package.csproj b/src_vs2012/Package/BlackBerry.Package.csproj index 75ee9698..069d036f 100644 --- a/src_vs2012/Package/BlackBerry.Package.csproj +++ b/src_vs2012/Package/BlackBerry.Package.csproj @@ -186,6 +186,7 @@ + diff --git a/src_vs2012/Package/BlackBerryPackage.cs b/src_vs2012/Package/BlackBerryPackage.cs index 8aa95fa9..c540bb45 100644 --- a/src_vs2012/Package/BlackBerryPackage.cs +++ b/src_vs2012/Package/BlackBerryPackage.cs @@ -230,7 +230,12 @@ protected override void Initialize() MenuCommand configureMenu = new MenuCommand((s, e) => ShowOptionPage(typeof(TargetsOptionPage)), configureCommandID); mcs.AddCommand(configureMenu); - // Create the command for 'Import BlackBerry Native Project' menu item. + // Create the command for 'Add BlackBerry Platforms' menu item + CommandID platformsCommandID = new CommandID(GuidList.guidVSNDK_PackageCmdSet, PackageCommands.cmdidBlackBerryCommonAddPlatformTargets); + OleMenuCommand platformsItem = new OleMenuCommand(AddBlackBerryTargetPlatforms, platformsCommandID); + mcs.AddCommand(platformsItem); + + // Create the command for 'Import BlackBerry Native Project' menu item CommandID projectCommandID = new CommandID(GuidList.guidVSNDK_PackageCmdSet, PackageCommands.cmdidBlackBerryCommonProjectImport); OleMenuCommand projectItem = new OleMenuCommand(ImportBlackBerryProject, projectCommandID); mcs.AddCommand(projectItem); @@ -361,14 +366,6 @@ private void OpenHelpWebPage(object sender, EventArgs e) #endregion - /// - /// Gets the number of installed NDKs. - /// - private int GetInstalledNdkCount() - { - return PackageViewModel.Instance.InstalledNDKs.Length; - } - /// /// Gets the currently selected NDK to build against. /// @@ -385,6 +382,22 @@ private void EnsureActiveNDK() PackageViewModel.Instance.EnsureActiveNDK(); } + private void AddBlackBerryTargetPlatforms(object sender, EventArgs e) + { + var projects = DteHelper.GetProjects(_dte); + + if (projects == null || projects.Length == 0) + { + MessageBoxHelper.Show("Unable to add BlackBerry Platforms. Please open a solution with Visual C++ projects", null, MessageBoxButtons.OK, MessageBoxIcon.Error); + return; + } + + foreach (var project in projects) + { + _buildPlatformsManager.AddPlatforms(project); + } + } + private void ImportBlackBerryProject(object sender, EventArgs e) { var form = DialogHelper.OpenNativeCoreProject("Open Core Native Application Project", null); diff --git a/src_vs2012/Package/Components/BuildPlatformsManager.cs b/src_vs2012/Package/Components/BuildPlatformsManager.cs index 17a9ac66..13981a53 100644 --- a/src_vs2012/Package/Components/BuildPlatformsManager.cs +++ b/src_vs2012/Package/Components/BuildPlatformsManager.cs @@ -17,13 +17,13 @@ using System.Collections.Specialized; using System.Diagnostics; using System.IO; -using System.Linq; using System.Runtime.InteropServices; using System.Text.RegularExpressions; using System.Windows.Forms; using BlackBerry.DebugEngine; using BlackBerry.NativeCore; using BlackBerry.NativeCore.Components; +using BlackBerry.NativeCore.Diagnostics; using BlackBerry.NativeCore.Helpers; using BlackBerry.NativeCore.Model; using BlackBerry.Package.Dialogs; @@ -32,7 +32,6 @@ using EnvDTE; using EnvDTE80; using Microsoft.VisualStudio; -using Microsoft.VisualStudio.CommandBars; using Microsoft.VisualStudio.Shell; using Microsoft.VisualStudio.Shell.Interop; using Microsoft.VisualStudio.VCProjectEngine; @@ -44,20 +43,8 @@ namespace BlackBerry.Package.Components /// internal sealed class BuildPlatformsManager { - #region Internal Classes - - sealed class ConfigTableEntry - { - public string config; - public string platform; - public bool deployable; - } - - #endregion - private readonly DTE2 _dte; private TokenProcessor _tokenProcessor; - private readonly List _configTable; private bool _isSimulator; private List _targetDir; @@ -71,15 +58,13 @@ sealed class ConfigTableEntry private BuildEvents _buildEvents; + private CommandEvents _deploymentEvents; private CommandEvents _eventsDebug; private CommandEvents _eventsDebugContext; private const string BLACKBERRY = "BlackBerry"; private const string BLACKBERRYSIMULATOR = "BlackBerrySimulator"; - private const string STANDARD_TOOL_BAR = "Standard"; - private const string SOLUTION_CONFIGURATIONS = "Solution Configurations"; - private const string SOLUTION_PLATFORMS = "Solution Platforms"; private const string BAR_DESCRIPTOR = "bar-descriptor.xml"; private const string BAR_DESCRIPTOR_PATH = @"\..\VCWizards\CodeWiz\BlackBerry\BarDescriptor\Templates\1033\"; @@ -90,17 +75,16 @@ public BuildPlatformsManager(DTE2 dte) // initialize variables: _dte = dte; - _configTable = new List(); } public void Initialize() { // register for command events, when accessing build platforms: - CommandHelper.Register(_dte, GuidList.guidVSStd2KString, StandardCommands.cmdidSolutionPlatform, cmdNewPlatform_beforeExec, cmdNewPlatform_afterExec); - CommandHelper.Register(_dte, GuidList.guidVSDebugGroup, StandardCommands.cmdidDebugBreakatFunction, cmdNewFunctionBreakpoint_beforeExec, cmdNewFunctionBreakpoint_afterExec); + _deploymentEvents = CommandHelper.Register(_dte, GuidList.guidVSStd2KString, StandardCommands.cmdidSolutionPlatform, null, cmdNewPlatform_afterExec); + //CommandHelper.Register(_dte, GuidList.guidVSDebugGroup, StandardCommands.cmdidDebugBreakatFunction, cmdNewFunctionBreakpoint_beforeExec, cmdNewFunctionBreakpoint_afterExec); //DisableIntelliSenseErrorReport(true); - CheckSolutionPlatformCommand(); + //CheckSolutionPlatformCommand(); // INFO: the references to returned objects must be stored and live as long, as the handlers are needed, // since they are COM objects and will be automatically reclaimed on next GC.Collect(), causing handlers to be unsubscribed... @@ -139,37 +123,7 @@ public void Close() //DisableIntelliSenseErrorReport(false); } - /// - /// Solution Platform command is shown in the Standard toolbar by default with Visual C++ settings. Add the - /// command if not in the Standard toolbar. - /// - private void CheckSolutionPlatformCommand() - { - DTE dte = (DTE)_dte; - CommandBars commandBars = (CommandBars)dte.CommandBars; - CommandBar standardCommandBar = commandBars[STANDARD_TOOL_BAR]; - int pos = 0; - foreach (CommandBarControl cmd in standardCommandBar.Controls) - { - if (cmd.Caption == SOLUTION_CONFIGURATIONS) - pos = cmd.Index; - if (cmd.Caption == SOLUTION_PLATFORMS) - return; - } - - Command sp = null; - foreach (Command c in dte.Commands) - { - if (c.Guid == GuidList.guidVSStd2KString && c.ID == StandardCommands.cmdidSolutionPlatform) - { - sp = c; - break; - } - } - if (sp != null) - sp.AddControl(standardCommandBar, pos + 1); - } - + /* /// /// Set the DisableErrorReporting property value. /// @@ -185,19 +139,7 @@ private void DisableIntelliSenseErrorReport(bool disable) prop.Value = disable; } } - - /// - /// New Platform Before Execution Event Handler. - /// - /// Command GUID. - /// Command ID. - /// Custom IN Object. - /// Custom OUT Object. - /// Cancel the default execution of the command. - private void cmdNewPlatform_beforeExec(string Guid, int ID, object CustomIn, object CustomOut, ref bool CancelDefault) - { - GetSolutionPlatformConfig(); - } + */ /// /// New Platform After Execution Event Handler. @@ -208,8 +150,7 @@ private void cmdNewPlatform_beforeExec(string Guid, int ID, object CustomIn, obj /// Custom OUT Object. private void cmdNewPlatform_afterExec(string Guid, int ID, object CustomIn, object CustomOut) { - SolutionPlatformConfig(); - AddBarDescriptor(); + //EnableDeploymentForSolutionPlatforms(); } /// @@ -247,159 +188,57 @@ private void cmdNewFunctionBreakpoint_afterExec(string Guid, int ID, object Cust } /// - /// Set solution config after edit + /// Enable deployment feature for all BlackBerry projects. /// - private void SolutionPlatformConfig() + private void EnableDeploymentForSolutionPlatforms() { - DTE dte = _dte as DTE; - - SolutionConfigurations SGS = dte.Solution.SolutionBuild.SolutionConfigurations; - - foreach (SolutionConfiguration SG in SGS) + SolutionConfigurations solutionConfigurations = _dte.Solution.SolutionBuild.SolutionConfigurations; + foreach (SolutionConfiguration configuration in solutionConfigurations) { - string name = SG.Name; - - SolutionContexts SCS = SG.SolutionContexts; - foreach (SolutionContext SC in SCS) + foreach (SolutionContext context in configuration.SolutionContexts) { - string cname = SC.ConfigurationName; - string pname = SC.PlatformName; - string prname = SC.ProjectName; - - ConfigTableEntry e = _configTable.Find(i => (i.config == cname) && (i.platform == pname)); - - if (e != null) - { - _configTable.Remove(e); - } - else + if (context.PlatformName == "BlackBerry" || context.PlatformName == "BlackBerrySimulator") { - SC.ShouldDeploy = true; + context.ShouldDeploy = true; } - } } } - /// - /// Get solution configuration before edit - /// - private void GetSolutionPlatformConfig() + private void AddBarDescriptorToProject(Project project) { - DTE dte = _dte as DTE; - - SolutionConfigurations SGS = dte.Solution.SolutionBuild.SolutionConfigurations; - - foreach (SolutionConfiguration SG in SGS) - { - string name = SG.Name; - - SolutionContexts SCS = SG.SolutionContexts; - foreach (SolutionContext SC in SCS) - { - string cname = SC.ConfigurationName; - string pname = SC.PlatformName; - string prname = SC.ProjectName; - - ConfigTableEntry c = new ConfigTableEntry(); - c.platform = pname; - c.config = cname; - c.deployable = SC.ShouldDeploy; + if (project == null) + throw new ArgumentNullException("project"); - _configTable.Add(c); - } - } - } - - /// - /// Add Bar Descriptor to each project. - /// - private void AddBarDescriptor() - { - try + ProjectItem baritem = project.ProjectItems.Item(BAR_DESCRIPTOR); + string n = project.Name; + if (baritem == null) { - DTE dte = _dte as DTE; - Projects projs = dte.Solution.Projects; - - - List projList = new List(); - foreach (Project proj in projs) - { - projList.Add(proj); - } - - while (projList.Count > 0) + _tokenProcessor = new TokenProcessor(); + Debug.WriteLine("Add bar descriptor file to the project"); + string templatePath = _dte.Solution.ProjectItemsTemplatePath(project.Kind); + templatePath += BAR_DESCRIPTOR_PATH + BAR_DESCRIPTOR; + _tokenProcessor.AddReplace(@"[!output PROJECT_NAME]", project.Name); + string destination = Path.GetFileName(templatePath); + + // Remove directory used in previous versions of this plug-in. + string folder = Path.Combine(Path.GetDirectoryName(project.FullName), project.Name + "_barDescriptor"); + if (Directory.Exists(folder)) { - Project proj = projList.ElementAt(0); - projList.RemoveAt(0); - - Configuration config; - Property prop; try { - config = proj.ConfigurationManager.ActiveConfiguration; - prop = config.Properties.Item("ConfigurationType"); - } - catch - { - config = null; - prop = null; - } - - if (prop == null) - { - if (proj.ProjectItems != null) - { - foreach (ProjectItem projItem in proj.ProjectItems) - { - if (projItem.SubProject != null) - projList.Add(projItem.SubProject); - } - } - continue; + Directory.Delete(folder); } - - if (Convert.ToInt16(prop.Value) != Convert.ToInt16(ConfigurationTypes.typeApplication)) - continue; - - if (config.PlatformName != BLACKBERRY && config.PlatformName != BLACKBERRYSIMULATOR) - continue; - - ProjectItem baritem = proj.ProjectItems.Item(BAR_DESCRIPTOR); - string n = proj.Name; - if (baritem == null) + catch (Exception) { - _tokenProcessor = new TokenProcessor(); - Debug.WriteLine("Add bar descriptor file to the project"); - string templatePath = dte.Solution.ProjectItemsTemplatePath(proj.Kind); - templatePath += BAR_DESCRIPTOR_PATH + BAR_DESCRIPTOR; - _tokenProcessor.AddReplace(@"[!output PROJECT_NAME]", proj.Name); - string destination = Path.GetFileName(templatePath); - - // Remove directory used in previous versions of this plug-in. - string folder = Path.Combine(Path.GetDirectoryName(proj.FullName), proj.Name + "_barDescriptor"); - if (Directory.Exists(folder)) - { - try - { - Directory.Delete(folder); - } - catch (Exception) - { - } - } - - folder = Path.Combine(Path.GetDirectoryName(proj.FullName), "BlackBerry-" + proj.Name); - Directory.CreateDirectory(folder); - destination = Path.Combine(folder, destination); - _tokenProcessor.UntokenFile(templatePath, destination); - ProjectItem projectitem = proj.ProjectItems.AddFromFile(destination); } } - } - catch (Exception e) - { - Debug.WriteLine(e.Message); + + folder = Path.Combine(Path.GetDirectoryName(project.FullName), "BlackBerry-" + project.Name); + Directory.CreateDirectory(folder); + destination = Path.Combine(folder, destination); + _tokenProcessor.UntokenFile(templatePath, destination); + project.ProjectItems.AddFromFile(destination); } } @@ -583,7 +422,6 @@ private bool LaunchDebugTarget(string pidString, string toolsPath, string public return false; } - #region Event Handlers /// @@ -822,5 +660,35 @@ private bool CheckDebugConfiguration() } return false; } + + /// + /// Adds BlackBerry specific target platforms. + /// + public bool AddPlatforms(Project project) + { + if (project == null) + throw new ArgumentNullException("project"); + + try + { + AddBarDescriptorToProject(project); + project.ConfigurationManager.AddPlatform("BlackBerry", "BlackBerry", true); + project.ConfigurationManager.AddPlatform("BlackBerrySimulator", "BlackBerrySimulator", true); + EnableDeploymentForSolutionPlatforms(); + + project.ConfigurationManager.DeletePlatform("Win32"); + project.ConfigurationManager.DeletePlatform("x64"); + project.ConfigurationManager.DeletePlatform("ARM"); + project.ConfigurationManager.DeleteConfigurationRow("Win32"); + project.ConfigurationManager.DeleteConfigurationRow("x64"); + project.ConfigurationManager.DeleteConfigurationRow("ARM"); + return true; + } + catch (Exception e) + { + TraceLog.WriteException(e); + return false; + } + } } } diff --git a/src_vs2012/Package/Helpers/DteHelper.cs b/src_vs2012/Package/Helpers/DteHelper.cs new file mode 100644 index 00000000..9bbdf95d --- /dev/null +++ b/src_vs2012/Package/Helpers/DteHelper.cs @@ -0,0 +1,35 @@ +using System; +using System.Collections.Generic; +using EnvDTE; +using EnvDTE80; +using Microsoft.VisualStudio.VCProjectEngine; + +namespace BlackBerry.Package.Helpers +{ + /// + /// Helper class providing info from DTE in simple way. + /// + internal static class DteHelper + { + /// + /// Gets the list of VisualC++ projects within the solution. + /// + public static Project[] GetProjects(DTE2 dte) + { + if (dte == null) + throw new ArgumentNullException("dte"); + + var result = new List(); + foreach (Project project in dte.Solution.Projects) + { + var vc = project.Object as VCProject; + if (vc != null) + { + result.Add(project); + } + } + + return result.ToArray(); + } + } +} diff --git a/src_vs2012/Package/PackageCommands.cs b/src_vs2012/Package/PackageCommands.cs index fb78c2e0..1c7375a5 100644 --- a/src_vs2012/Package/PackageCommands.cs +++ b/src_vs2012/Package/PackageCommands.cs @@ -16,7 +16,8 @@ namespace BlackBerry.Package { internal static class PackageCommands { - public const int cmdidBlackBerryCommonProjectImport = 0x0201; + public const int cmdidBlackBerryCommonAddPlatformTargets = 0x0201; + public const int cmdidBlackBerryCommonProjectImport = 0x0202; public const int cmdidBlackBerryOptions = 0x301; public const int cmdidBlackBerryTargetsDevicesPlaceholder = 0x501; diff --git a/src_vs2012/Package/Resources/Package.Menu.vsct b/src_vs2012/Package/Resources/Package.Menu.vsct index d862f26a..e44bfc29 100644 --- a/src_vs2012/Package/Resources/Package.Menu.vsct +++ b/src_vs2012/Package/Resources/Package.Menu.vsct @@ -71,10 +71,17 @@ + + @@ -259,7 +266,8 @@ - + + diff --git a/src_vs2013/Package/BlackBerry.Package.csproj b/src_vs2013/Package/BlackBerry.Package.csproj index ad74b4cc..346fbba4 100644 --- a/src_vs2013/Package/BlackBerry.Package.csproj +++ b/src_vs2013/Package/BlackBerry.Package.csproj @@ -184,6 +184,9 @@ Helpers\DialogHelper.cs + + Helpers\DteHelper.cs + Helpers\MessageBoxHelper.cs From 369dd88dc94d2529fc0e65bae0311bf340e7abe4 Mon Sep 17 00:00:00 2001 From: Pawel Hofman Date: Tue, 8 Jul 2014 11:35:25 +0200 Subject: [PATCH 354/851] Reverted not showing platform-manager on toolbar --- .../Components/BuildPlatformsManager.cs | 39 ++++++++++++++++++- 1 file changed, 38 insertions(+), 1 deletion(-) diff --git a/src_vs2012/Package/Components/BuildPlatformsManager.cs b/src_vs2012/Package/Components/BuildPlatformsManager.cs index 13981a53..cc606943 100644 --- a/src_vs2012/Package/Components/BuildPlatformsManager.cs +++ b/src_vs2012/Package/Components/BuildPlatformsManager.cs @@ -32,6 +32,7 @@ using EnvDTE; using EnvDTE80; using Microsoft.VisualStudio; +using Microsoft.VisualStudio.CommandBars; using Microsoft.VisualStudio.Shell; using Microsoft.VisualStudio.Shell.Interop; using Microsoft.VisualStudio.VCProjectEngine; @@ -65,6 +66,9 @@ internal sealed class BuildPlatformsManager private const string BLACKBERRY = "BlackBerry"; private const string BLACKBERRYSIMULATOR = "BlackBerrySimulator"; + private const string STANDARD_TOOL_BAR = "Standard"; + private const string SOLUTION_CONFIGURATIONS = "Solution Configurations"; + private const string SOLUTION_PLATFORMS = "Solution Platforms"; private const string BAR_DESCRIPTOR = "bar-descriptor.xml"; private const string BAR_DESCRIPTOR_PATH = @"\..\VCWizards\CodeWiz\BlackBerry\BarDescriptor\Templates\1033\"; @@ -84,7 +88,7 @@ public void Initialize() //CommandHelper.Register(_dte, GuidList.guidVSDebugGroup, StandardCommands.cmdidDebugBreakatFunction, cmdNewFunctionBreakpoint_beforeExec, cmdNewFunctionBreakpoint_afterExec); //DisableIntelliSenseErrorReport(true); - //CheckSolutionPlatformCommand(); + ShowSolutionPlatformSelector(); // INFO: the references to returned objects must be stored and live as long, as the handlers are needed, // since they are COM objects and will be automatically reclaimed on next GC.Collect(), causing handlers to be unsubscribed... @@ -141,6 +145,39 @@ private void DisableIntelliSenseErrorReport(bool disable) } */ + /// + /// Solution Platform command is shown in the Standard toolbar by default with Visual C++ settings. Add the + /// command if not in the Standard toolbar. + /// + private void ShowSolutionPlatformSelector() + { + DTE dte = (DTE)_dte; + CommandBars commandBars = (CommandBars)dte.CommandBars; + CommandBar standardCommandBar = commandBars[STANDARD_TOOL_BAR]; + int pos = 0; + foreach (CommandBarControl cmd in standardCommandBar.Controls) + { + if (cmd.Caption == SOLUTION_CONFIGURATIONS) + pos = cmd.Index; + if (cmd.Caption == SOLUTION_PLATFORMS) + return; + } + + + Command sp = null; + foreach (Command c in dte.Commands) + { + if (c.Guid == GuidList.guidVSStd2KString && c.ID == StandardCommands.cmdidSolutionPlatform) + { + sp = c; + break; + } + } + if (sp != null) + sp.AddControl(standardCommandBar, pos + 1); + } + + /// /// New Platform After Execution Event Handler. /// From b649fc3ca47c50a1e1cb3ebcc179cb114d810e4b Mon Sep 17 00:00:00 2001 From: Pawel Hofman Date: Tue, 8 Jul 2014 11:36:04 +0200 Subject: [PATCH 355/851] Fixed used VCProject library --- src_vs2012/Package/BlackBerry.Package.csproj | 2 -- 1 file changed, 2 deletions(-) diff --git a/src_vs2012/Package/BlackBerry.Package.csproj b/src_vs2012/Package/BlackBerry.Package.csproj index 069d036f..ff7abbad 100644 --- a/src_vs2012/Package/BlackBerry.Package.csproj +++ b/src_vs2012/Package/BlackBerry.Package.csproj @@ -83,9 +83,7 @@ - False True - ..\..\..\..\..\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\PublicAssemblies\Microsoft.VisualStudio.VCProjectEngine.dll ..\..\..\..\..\Windows\Microsoft.NET\assembly\GAC_MSIL\Microsoft.VisualStudio.XmlEditor\v4.0_11.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.XmlEditor.dll From 7278bf57895cf993d3964b2ec55853c79495d082 Mon Sep 17 00:00:00 2001 From: Pawel Hofman Date: Tue, 8 Jul 2014 16:18:10 +0200 Subject: [PATCH 356/851] Refactored BPM to handle debug and nodebug startup F5 & Ctrl+F5 --- src_vs2012/Package/BlackBerryPackage.cs | 2 +- .../Components/BuildPlatformsManager.cs | 678 ++++++++---------- src_vs2012/Package/Helpers/CommandHelper.cs | 23 +- src_vs2012/Package/Helpers/DteHelper.cs | 28 + 4 files changed, 363 insertions(+), 368 deletions(-) diff --git a/src_vs2012/Package/BlackBerryPackage.cs b/src_vs2012/Package/BlackBerryPackage.cs index c540bb45..004b0748 100644 --- a/src_vs2012/Package/BlackBerryPackage.cs +++ b/src_vs2012/Package/BlackBerryPackage.cs @@ -247,7 +247,7 @@ protected override void Initialize() // make sure there is an NDK selected and developer knows about it: EnsureActiveNDK(); - if (_buildPlatformsManager.IsBlackBerrySolution(_dte) && ActiveNDK == null) + if (_buildPlatformsManager.IsBlackBerrySolution() && ActiveNDK == null) { var form = new MissingNdkInstalledForm(); form.ShowDialog(); diff --git a/src_vs2012/Package/Components/BuildPlatformsManager.cs b/src_vs2012/Package/Components/BuildPlatformsManager.cs index cc606943..96117ddb 100644 --- a/src_vs2012/Package/Components/BuildPlatformsManager.cs +++ b/src_vs2012/Package/Components/BuildPlatformsManager.cs @@ -15,7 +15,6 @@ using System; using System.Collections.Generic; using System.Collections.Specialized; -using System.Diagnostics; using System.IO; using System.Runtime.InteropServices; using System.Text.RegularExpressions; @@ -35,7 +34,6 @@ using Microsoft.VisualStudio.CommandBars; using Microsoft.VisualStudio.Shell; using Microsoft.VisualStudio.Shell.Interop; -using Microsoft.VisualStudio.VCProjectEngine; namespace BlackBerry.Package.Components { @@ -45,46 +43,48 @@ namespace BlackBerry.Package.Components internal sealed class BuildPlatformsManager { private readonly DTE2 _dte; - private TokenProcessor _tokenProcessor; - private bool _isSimulator; - private List _targetDir; private List _buildThese; private bool _hitPlay; private int _amountOfProjects; private bool _isDeploying; - private OutputWindowPane _owP; - private bool _isDebugConfiguration = true; - private string _processName = ""; + private Project _startProject; + private bool _startDebugger; - private BuildEvents _buildEvents; + private OutputWindowPane _outputWindowPane; + private BuildEvents _buildEvents; private CommandEvents _deploymentEvents; private CommandEvents _eventsDebug; + private CommandEvents _eventsNoDebug; private CommandEvents _eventsDebugContext; + private const string ConfigNameBlackBerry = "BlackBerry"; + private const string ConfigNameBlackBerrySimulator = "BlackBerrySimulator"; + private const string ToolbarNameStandard = "Standard"; + private const string SolutionConfigurationsName = "Solution Configurations"; + private const string SolutionPlatformsName = "Solution Platforms"; + private const string BarDescriptorFileName = "bar-descriptor.xml"; + private const string BarDescriptorFolder = @"..\VCWizards\CodeWiz\BlackBerry\BarDescriptor\Templates\1033"; - private const string BLACKBERRY = "BlackBerry"; - private const string BLACKBERRYSIMULATOR = "BlackBerrySimulator"; - private const string STANDARD_TOOL_BAR = "Standard"; - private const string SOLUTION_CONFIGURATIONS = "Solution Configurations"; - private const string SOLUTION_PLATFORMS = "Solution Platforms"; - private const string BAR_DESCRIPTOR = "bar-descriptor.xml"; - private const string BAR_DESCRIPTOR_PATH = @"\..\VCWizards\CodeWiz\BlackBerry\BarDescriptor\Templates\1033\"; - + /// + /// Init constructor. + /// public BuildPlatformsManager(DTE2 dte) { if (dte == null) throw new ArgumentNullException("dte"); - // initialize variables: _dte = dte; } public void Initialize() { + if (_buildEvents != null) + return; + // register for command events, when accessing build platforms: - _deploymentEvents = CommandHelper.Register(_dte, GuidList.guidVSStd2KString, StandardCommands.cmdidSolutionPlatform, null, cmdNewPlatform_afterExec); + _deploymentEvents = CommandHelper.Register(_dte, VSConstants.GUID_VSStandardCommandSet97, VSConstants.VSStd2KCmdID.SolutionPlatform, null, OnNewPlatform_AfterExecute); //CommandHelper.Register(_dte, GuidList.guidVSDebugGroup, StandardCommands.cmdidDebugBreakatFunction, cmdNewFunctionBreakpoint_beforeExec, cmdNewFunctionBreakpoint_afterExec); //DisableIntelliSenseErrorReport(true); @@ -92,8 +92,9 @@ public void Initialize() // INFO: the references to returned objects must be stored and live as long, as the handlers are needed, // since they are COM objects and will be automatically reclaimed on next GC.Collect(), causing handlers to be unsubscribed... - _eventsDebug = CommandHelper.Register(_dte, GuidList.guidVSStd97String, StandardCommands.cmdidStartDebug, StartDebugCommandEvents_BeforeExecute, StartDebugCommandEvents_AfterExecute); - _eventsDebugContext = CommandHelper.Register(_dte, GuidList.guidVSStd2KString, StandardCommands.cmdidStartDebugContext, StartDebugCommandEvents_BeforeExecute, StartDebugCommandEvents_AfterExecute); + _eventsDebug = CommandHelper.Register(_dte, VSConstants.GUID_VSStandardCommandSet97, VSConstants.VSStd97CmdID.Start, StartDebugCommandEvents_BeforeExecute, null); + _eventsNoDebug = CommandHelper.Register(_dte, VSConstants.GUID_VSStandardCommandSet97, VSConstants.VSStd97CmdID.StartNoDebug, StartNoDebugCommandEvents_BeforeExecute, null); + _eventsDebugContext = CommandHelper.Register(_dte, VSConstants.VSStd2K, VSConstants.VSStd2KCmdID.PROJSTARTDEBUG, StartDebugCommandEvents_BeforeExecute, null); _buildEvents = _dte.Events.BuildEvents; _buildEvents.OnBuildBegin += OnBuildBegin; @@ -145,31 +146,35 @@ private void DisableIntelliSenseErrorReport(bool disable) } */ + #region Managing Configurations + /// /// Solution Platform command is shown in the Standard toolbar by default with Visual C++ settings. Add the /// command if not in the Standard toolbar. /// private void ShowSolutionPlatformSelector() { - DTE dte = (DTE)_dte; - CommandBars commandBars = (CommandBars)dte.CommandBars; - CommandBar standardCommandBar = commandBars[STANDARD_TOOL_BAR]; + CommandBars commandBars = (CommandBars)_dte.CommandBars; + CommandBar standardCommandBar = commandBars[ToolbarNameStandard]; + int pos = 0; foreach (CommandBarControl cmd in standardCommandBar.Controls) { - if (cmd.Caption == SOLUTION_CONFIGURATIONS) + if (cmd.Caption == SolutionConfigurationsName) pos = cmd.Index; - if (cmd.Caption == SOLUTION_PLATFORMS) + if (cmd.Caption == SolutionPlatformsName) return; } - Command sp = null; - foreach (Command c in dte.Commands) + string expectedGuid = VSConstants.VSStd2K.ToString("B"); + int expectedID = (int) VSConstants.VSStd2KCmdID.SolutionPlatform; + + foreach (Command command in _dte.Commands) { - if (c.Guid == GuidList.guidVSStd2KString && c.ID == StandardCommands.cmdidSolutionPlatform) + if (command.Guid == expectedGuid && command.ID == expectedID) { - sp = c; + sp = command; break; } } @@ -177,40 +182,121 @@ private void ShowSolutionPlatformSelector() sp.AddControl(standardCommandBar, pos + 1); } + /// + /// Adds BlackBerry specific target platforms. + /// + public bool AddPlatforms(Project project) + { + if (project == null) + throw new ArgumentNullException("project"); - /// - /// New Platform After Execution Event Handler. + try + { + AddBarDescriptorToProject(project); + project.ConfigurationManager.AddPlatform(ConfigNameBlackBerry, ConfigNameBlackBerry, true); + project.ConfigurationManager.AddPlatform(ConfigNameBlackBerrySimulator, ConfigNameBlackBerrySimulator, true); + EnableDeploymentForSolutionPlatforms(); + + project.ConfigurationManager.DeletePlatform("Win32"); + project.ConfigurationManager.DeletePlatform("x64"); + project.ConfigurationManager.DeletePlatform("ARM"); + project.ConfigurationManager.DeleteConfigurationRow("Win32"); + project.ConfigurationManager.DeleteConfigurationRow("x64"); + project.ConfigurationManager.DeleteConfigurationRow("ARM"); + return true; + } + catch (Exception e) + { + TraceLog.WriteException(e); + return false; + } + } + + /// + /// Enable deployment feature for all BlackBerry projects. /// - /// Command GUID. - /// Command ID. - /// Custom IN Object. - /// Custom OUT Object. - private void cmdNewPlatform_afterExec(string Guid, int ID, object CustomIn, object CustomOut) + private void EnableDeploymentForSolutionPlatforms() { - //EnableDeploymentForSolutionPlatforms(); + SolutionConfigurations solutionConfigurations = _dte.Solution.SolutionBuild.SolutionConfigurations; + foreach (SolutionConfiguration configuration in solutionConfigurations) + { + foreach (SolutionContext context in configuration.SolutionContexts) + { + if (context.PlatformName == ConfigNameBlackBerry || context.PlatformName == ConfigNameBlackBerrySimulator) + { + context.ShouldDeploy = true; + } + } + } + } + + private void AddBarDescriptorToProject(Project project) + { + if (project == null) + throw new ArgumentNullException("project"); + + ProjectItem existingBarItem = project.ProjectItems.Item(BarDescriptorFileName); + if (existingBarItem == null) + { + TraceLog.WriteLine("Adding bar descriptor file to the project"); + + string projectFolder = Path.GetDirectoryName(project.FullName); + + // Remove directory used in previous versions of this plug-in. + if (!string.IsNullOrEmpty(project.FullName)) + { + if (!string.IsNullOrEmpty(projectFolder)) + { + string oldFolder = Path.Combine(projectFolder, project.Name + "_barDescriptor"); + if (Directory.Exists(oldFolder)) + { + try + { + Directory.Delete(oldFolder, true); + } + catch (Exception ex) + { + TraceLog.WriteException(ex); + } + } + } + } + + string templatePath = Path.Combine(_dte.Solution.ProjectItemsTemplatePath(project.Kind), BarDescriptorFolder, BarDescriptorFileName); + string destination = string.IsNullOrEmpty(projectFolder) ? BarDescriptorFileName : Path.Combine(projectFolder, BarDescriptorFileName); + + var tokenProcessor = new TokenProcessor(); + tokenProcessor.AddReplace(@"[!output PROJECT_NAME]", project.Name); + + tokenProcessor.UntokenFile(templatePath, destination); + project.ProjectItems.AddFromFile(destination); + } } + #endregion + + #region Build Event Handlers + /// - /// New Function Breakpoint Before Execution Event Handler. + /// New Platform After Execution Event Handler. /// - /// Command GUID. - /// Command ID. - /// Custom IN Object. - /// Custom OUT Object. - /// Cancel the default execution of the command. - private void cmdNewFunctionBreakpoint_beforeExec(string Guid, int ID, object CustomIn, object CustomOut, ref bool CancelDefault) + /// Command GUID. + /// Command ID. + /// Custom IN Object. + /// Custom OUT Object. + private void OnNewPlatform_AfterExecute(string guid, int id, object customIn, object customOut) { - // Add Code Here + EnableDeploymentForSolutionPlatforms(); } /// /// New Function Breakpoint After Execution Event Handler. /// - /// Command GUID. - /// Command ID. - /// Custom IN Object. - /// Custom OUT Object. - private void cmdNewFunctionBreakpoint_afterExec(string Guid, int ID, object CustomIn, object CustomOut) + /// Command GUID. + /// Command ID. + /// Custom IN Object. + /// Custom OUT Object. + private void OnNewFunctionBreakpoint_AfterExecute(string guid, int id, object customIn, object customOut) { Breakpoint functionBP = _dte.Debugger.Breakpoints.Item(_dte.Debugger.Breakpoints.Count); @@ -218,70 +304,167 @@ private void cmdNewFunctionBreakpoint_afterExec(string Guid, int ID, object Cust { if ((functionBP.FunctionColumnOffset != 1) || (functionBP.FunctionLineOffset != 1)) { - System.Windows.Forms.MessageBox.Show("The breakpoint cannot be set. Function breakpoints are only supported on the first line.", "Microsoft Visual Studio", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error); + MessageBoxHelper.Show("The breakpoint cannot be set. Function breakpoints are only supported on the first line.", null, MessageBoxButtons.OK, MessageBoxIcon.Error); functionBP.Delete(); } } } - /// - /// Enable deployment feature for all BlackBerry projects. + /// + /// This event is fired only when user wants to build, rebuild or clean the project. /// - private void EnableDeploymentForSolutionPlatforms() + /// Represents the scope of the build. + /// Represents the type of build action that is occurring, such as a build or a deploy action. + private void OnBuildBegin(vsBuildScope scope, vsBuildAction action) { - SolutionConfigurations solutionConfigurations = _dte.Solution.SolutionBuild.SolutionConfigurations; - foreach (SolutionConfiguration configuration in solutionConfigurations) + if (IsBlackBerrySolution() && ActiveNDK == null) { - foreach (SolutionContext context in configuration.SolutionContexts) + var form = new MissingNdkInstalledForm(); + form.ShowDialog(); + return; + } + + if (action == vsBuildAction.vsBuildActionBuild || action == vsBuildAction.vsBuildActionRebuildAll) + { + if (!_hitPlay && !_isDeploying) { - if (context.PlatformName == "BlackBerry" || context.PlatformName == "BlackBerrySimulator") + // means that the "play" building and deploying process was cancelled before, so we have to disable the + // OnBuildDone event to avoid deploying in case user only wants to build. + _buildEvents.OnBuildDone -= OnBuildDone; + } + _hitPlay = false; + } + } + + + /// + /// New Start Debug Command Events Before Execution Event Handler. Call the method responsible for building the app. + /// + /// Command GUID. + /// Command ID. + /// Custom IN Object. + /// Custom OUT Object. + /// Cancel the default execution of the command. + private void StartNoDebugCommandEvents_BeforeExecute(string guid, int id, object customIn, object customOut, ref bool cancelDefault) + { + TraceLog.WriteLine("Before Start NoDebug"); + _startDebugger = false; + StartBuild(out cancelDefault); + } + + /// + /// New Start Debug Command Events Before Execution Event Handler. Call the method responsible for building the app. + /// + /// Command GUID. + /// Command ID. + /// Custom IN Object. + /// Custom OUT Object. + /// Cancel the default execution of the command. + private void StartDebugCommandEvents_BeforeExecute(string guid, int id, object customIn, object customOut, ref bool cancelDefault) + { + TraceLog.WriteLine("Before Start Debug"); + _startDebugger = true; + StartBuild(out cancelDefault); + } + + /// + /// This event is fired only when the build/rebuild/clean process ends. + /// + /// Represents the scope of the build. + /// Represents the type of build action that is occurring, such as a build or a deploy action. + private void OnBuildDone(vsBuildScope scope, vsBuildAction action) + { + switch (action) + { + case vsBuildAction.vsBuildActionBuild: + _amountOfProjects--; + if (_amountOfProjects == 0) { - context.ShouldDeploy = true; + _buildEvents.OnBuildDone -= OnBuildDone; + Built(); } - } + break; + + case vsBuildAction.vsBuildActionDeploy: + _buildEvents.OnBuildDone -= OnBuildDone; + _isDeploying = false; + Deployed(); + break; } } - private void AddBarDescriptorToProject(Project project) + private void StartBuild(out bool cancelDefault) { - if (project == null) - throw new ArgumentNullException("project"); + if (DebugEngineStatus.IsRunning) + { + // Disable the override of F5 (this allows the debugged process to continue execution) + cancelDefault = false; + return; + } + + if (!IsBlackBerryConfigurationActive()) + { + // Disable the override of F5 (this allows the debugged process to continue execution) + cancelDefault = false; + return; + } - ProjectItem baritem = project.ProjectItems.Item(BAR_DESCRIPTOR); - string n = project.Name; - if (baritem == null) + try { - _tokenProcessor = new TokenProcessor(); - Debug.WriteLine("Add bar descriptor file to the project"); - string templatePath = _dte.Solution.ProjectItemsTemplatePath(project.Kind); - templatePath += BAR_DESCRIPTOR_PATH + BAR_DESCRIPTOR; - _tokenProcessor.AddReplace(@"[!output PROJECT_NAME]", project.Name); - string destination = Path.GetFileName(templatePath); + _buildThese = new List(); + _startProject = null; - // Remove directory used in previous versions of this plug-in. - string folder = Path.Combine(Path.GetDirectoryName(project.FullName), project.Name + "_barDescriptor"); - if (Directory.Exists(folder)) + foreach (String startupProject in (Array) _dte.Solution.SolutionBuild.StartupProjects) { - try - { - Directory.Delete(folder); - } - catch (Exception) + foreach (Project project in _dte.Solution.Projects) { + if (project.UniqueName == startupProject) + { + _buildThese.Add(project.FullName); + _startProject = project; + } } } + } + catch (Exception ex) + { + TraceLog.WriteException(ex); + } - folder = Path.Combine(Path.GetDirectoryName(project.FullName), "BlackBerry-" + project.Name); - Directory.CreateDirectory(folder); - destination = Path.Combine(folder, destination); - _tokenProcessor.UntokenFile(templatePath, destination); - project.ProjectItems.AddFromFile(destination); + + // Create a reference to the Output window. + // Create a tool window reference for the Output window + // and window pane. + OutputWindow ow = _dte.ToolWindows.OutputWindow; + + // Select the Build pane in the Output window. + _outputWindowPane = ow.OutputWindowPanes.Item("Build"); + _outputWindowPane.Activate(); + + if (_startDebugger) + { + /* + PH: FIXME: update API Level vs current project verification... + UpdateManagerData upData; + if (_targetDir.Count > 0) + upData = new UpdateManagerData(_targetDir[0][1]); + else + upData = new UpdateManagerData(); + + if (!upData.validateDeviceVersion(_isSimulator)) + { + cancelDefault = true; + } + else + */ } - } + BuildBar(); + cancelDefault = true; + } /// - /// Identify the projects to be build and start the build process. + /// Identify the projects to be build and start the build process. /// /// TRUE if successful, FALSE if not. private bool BuildBar() @@ -299,11 +482,13 @@ private bool BuildBar() _hitPlay = true; _amountOfProjects = _buildThese.Count; // OnBuildDone will call build() only after receiving "amountOfProjects" events foreach (string projectName in _buildThese) - solution.SolutionBuild.BuildProject("Debug", projectName, false); + { + solution.SolutionBuild.BuildProject(solution.SolutionBuild.ActiveConfiguration.Name, projectName, false); + } } catch (Exception ex) { - Debug.WriteLine(ex.Message); + TraceLog.WriteException(ex); success = false; } } @@ -312,11 +497,12 @@ private bool BuildBar() success = false; } } - catch (Exception e) + catch (Exception ex) { - Debug.WriteLine(e.Message); + TraceLog.WriteException(ex); success = false; } + return success; } @@ -325,24 +511,19 @@ private bool BuildBar() /// private void Built() { - _owP.TextDocument.Selection.SelectAll(); - string outputText = _owP.TextDocument.Selection.Text; + _outputWindowPane.TextDocument.Selection.SelectAll(); + string outputText = _outputWindowPane.TextDocument.Selection.Text; - if ((outputText == "") || (Regex.IsMatch(outputText, ">Build succeeded.\r\n")) || (!outputText.Contains("): error :"))) + if (string.IsNullOrEmpty(outputText) || Regex.IsMatch(outputText, ">Build succeeded.\r\n") || !outputText.Contains("): error :")) { - if (_isDebugConfiguration) + if (_startDebugger) { // Write file to flag the deploy task that it should use the -debugNative option - string fileContent = "Use -debugNative.\r\n"; - using (var file = new StreamWriter(ConfigDefaults.BuildDebugNativePath)) - { - file.WriteLine(fileContent); - } - + File.WriteAllText(ConfigDefaults.BuildDebugNativePath, "Use -debugNative.\r\n"); _buildEvents.OnBuildDone += OnBuildDone; } - foreach (String startupProject in (Array)_dte.Solution.SolutionBuild.StartupProjects) + foreach (string startupProject in (Array)_dte.Solution.SolutionBuild.StartupProjects) { foreach (SolutionContext sc in _dte.Solution.SolutionBuild.ActiveConfiguration.SolutionContexts) { @@ -366,21 +547,14 @@ private void Built() /// private void Deployed() { - string currentPath = ""; - string executablePath; - - foreach (string[] paths in _targetDir) + if (_startProject == null) { - if (paths[0] == _processName) - { - currentPath = paths[1]; - break; - } + MessageBoxHelper.Show("Unable to determine the executable to start.", null, MessageBoxButtons.OK, MessageBoxIcon.Error); + return; } - executablePath = currentPath + _processName; // The executable path - executablePath = executablePath.Replace('\\', '/'); - + var targetName = _startProject.Name; // name of the binary... should be better way to detect it... although whole deploying fails, if binary-name != project-name + var executablePath = Path.Combine(DteHelper.GetOutputPath(_startProject), targetName); var ndk = ActiveNDK; var device = ActiveDevice; @@ -397,15 +571,19 @@ private void Deployed() return; } - LaunchDebugTarget(_processName, ndk.ToDefinition().ToolsPath, ConfigDefaults.SshPublicKeyPath.Replace('\\', '/'), device.IP, device.Password, executablePath); + if (_startDebugger) + { + var isSimulator = _startProject.ConfigurationManager.ActiveConfiguration.PlatformName == ConfigNameBlackBerrySimulator; + LaunchDebugTarget(targetName, ndk.ToDefinition().ToolsPath, ConfigDefaults.SshPublicKeyPath, device.IP, device.Password, isSimulator, executablePath); + } } /// /// Launch an executable using the BlackBerry debug engine. /// - /// Process ID in string format. + /// Process ID in string format or the binary name for debugger to attach to. /// TRUE if successful, False if not. - private bool LaunchDebugTarget(string pidString, string toolsPath, string publicKeyPath, string targetIP, string password, string executablePath) + private bool LaunchDebugTarget(string pidOrTargetName, string toolsPath, string publicKeyPath, string targetIP, string password, bool isSimulator, string executablePath) { ServiceProvider sp = new ServiceProvider((Microsoft.VisualStudio.OLE.Interop.IServiceProvider)_dte); IVsDebugger dbg = (IVsDebugger)sp.GetService(typeof(SVsShellDebugger)); @@ -416,12 +594,12 @@ private bool LaunchDebugTarget(string pidString, string toolsPath, string public // Store all debugger arguments in a string var nvc = new NameValueCollection(); - nvc.Add("pid", pidString); + nvc.Add("pid", pidOrTargetName); nvc.Add("targetIP", targetIP); // The device (IP address) - info.bstrExe = executablePath; // The executable path - nvc.Add("isSimulator", _isSimulator.ToString()); + info.bstrExe = executablePath.Replace('\\', '/'); // The executable path + nvc.Add("isSimulator", isSimulator.ToString()); nvc.Add("ToolsPath", toolsPath); - nvc.Add("PublicKeyPath", publicKeyPath); + nvc.Add("PublicKeyPath", publicKeyPath.Replace('\\', '/')); nvc.Add("Password", password); info.bstrArg = NameValueCollectionHelper.DumpToString(nvc); @@ -443,7 +621,7 @@ private bool LaunchDebugTarget(string pidString, string toolsPath, string public string msg; IVsUIShell sh = (IVsUIShell)sp.GetService(typeof(SVsUIShell)); sh.GetErrorInfo(out msg); - Debug.WriteLine("LaunchDebugTargets: " + msg); + TraceLog.WriteLine("LaunchDebugTargets: " + msg); return true; } @@ -459,214 +637,22 @@ private bool LaunchDebugTarget(string pidString, string toolsPath, string public return false; } - #region Event Handlers - - /// - /// New Start Debug Command Events After Execution Event Handler. - /// - /// Command GUID. - /// Command ID. - /// Custom IN Object. - /// Custom OUT Object. - private void StartDebugCommandEvents_AfterExecute(string guid, int id, object customIn, object customOut) - { - Debug.WriteLine("After Start Debug"); - } - - /// - /// New Start Debug Command Events Before Execution Event Handler. Call the method responsible for building the app. - /// - /// Command GUID. - /// Command ID. - /// Custom IN Object. - /// Custom OUT Object. - /// Cancel the default execution of the command. - private void StartDebugCommandEvents_BeforeExecute(string guid, int id, object customIn, object customOut, ref bool cancelDefault) - { - Debug.WriteLine("Before Start Debug"); - - if (DebugEngineStatus.IsRunning) - { - // Disable the override of F5 (this allows the debugged process to continue execution) - cancelDefault = false; - return; - } - - bool bbPlatform = false; - if (_dte.Solution.SolutionBuild.ActiveConfiguration != null) - { - _isDebugConfiguration = CheckDebugConfiguration(); - - SolutionContexts scCollection = _dte.Solution.SolutionBuild.ActiveConfiguration.SolutionContexts; - foreach (SolutionContext sc in scCollection) - { - if (sc.PlatformName == "BlackBerry" || sc.PlatformName == "BlackBerrySimulator") - { - bbPlatform = true; - _isSimulator = sc.PlatformName == "BlackBerrySimulator"; - } - } - } - - if (!bbPlatform) - { - // Disable the override of F5 (this allows the debugged process to continue execution) - cancelDefault = false; - } - else - { - try - { - Solution2 solution = (Solution2)_dte.Solution; - _buildThese = new List(); - _targetDir = new List(); - - foreach (String startupProject in (Array)solution.SolutionBuild.StartupProjects) - { - foreach (Project p1 in solution.Projects) - { - if (p1.UniqueName == startupProject) - { - _buildThese.Add(p1.FullName); - _processName = p1.Name; - - ConfigurationManager config = p1.ConfigurationManager; - Configuration active = config.ActiveConfiguration; - - foreach (Property prop in active.Properties) - { - try - { - if (prop.Name == "OutputPath") - { - string[] path = new string[2]; - path[0] = p1.Name; - path[1] = prop.Value.ToString(); - _targetDir.Add(path); - break; - } - } - catch - { - } - } - - break; - } - } - } - } - catch (Exception ex) - { - Debug.WriteLine(ex.Message); - } - - - // Create a reference to the Output window. - // Create a tool window reference for the Output window - // and window pane. - OutputWindow ow = _dte.ToolWindows.OutputWindow; - - // Select the Build pane in the Output window. - _owP = ow.OutputWindowPanes.Item("Build"); - _owP.Activate(); - - if (_isDebugConfiguration) - { - /* - PH: FIXME: update API Level vs current project verification... - UpdateManagerData upData; - if (_targetDir.Count > 0) - upData = new UpdateManagerData(_targetDir[0][1]); - else - upData = new UpdateManagerData(); - - if (!upData.validateDeviceVersion(_isSimulator)) - { - cancelDefault = true; - } - else - */ - { - BuildBar(); - cancelDefault = true; - } - } - else - { - BuildBar(); - cancelDefault = true; - } - } - } - - - /// - /// This event is fired only when the build/rebuild/clean process ends. - /// - /// Represents the scope of the build. - /// Represents the type of build action that is occurring, such as a build or a deploy action. - private void OnBuildDone(vsBuildScope scope, vsBuildAction action) - { - if (action == vsBuildAction.vsBuildActionBuild) - { - _amountOfProjects -= 1; - if (_amountOfProjects == 0) - { - _buildEvents.OnBuildDone -= OnBuildDone; - Built(); - } - } - else if (action == vsBuildAction.vsBuildActionDeploy) - { - _buildEvents.OnBuildDone -= OnBuildDone; - _isDeploying = false; - Deployed(); - } - } - - /// - /// This event is fired only when user wants to build, rebuild or clean the project. - /// - /// Represents the scope of the build. - /// Represents the type of build action that is occurring, such as a build or a deploy action. - private void OnBuildBegin(vsBuildScope scope, vsBuildAction action) - { - if (IsBlackBerrySolution(_dte) && ActiveNDK == null) - { - var form = new MissingNdkInstalledForm(); - form.ShowDialog(); - return; - } - - if (action == vsBuildAction.vsBuildActionBuild || action == vsBuildAction.vsBuildActionRebuildAll) - { - if (!_hitPlay && !_isDeploying) - { - // means that the "play" building and deploying process was cancelled before, so we have to disable the - // OnBuildDone event to avoid deploying in case user only wants to build. - _buildEvents.OnBuildDone -= OnBuildDone; - } - _hitPlay = false; - } - } - #endregion /// - /// Check to see if current solution is configured with a BlackBerry Configuration. + /// Check to see if current solution is configured with a BlackBerry configurations. /// - public bool IsBlackBerrySolution(DTE2 dte) + public bool IsBlackBerrySolution() { - if (dte.Solution != null) + if (_dte.Solution != null) { - var projects = dte.Solution.Projects; + var projects = _dte.Solution.Projects; if (projects != null) { foreach (Project project in projects) { var platformName = project.ConfigurationManager != null ? project.ConfigurationManager.ActiveConfiguration.PlatformName : null; - if (platformName == "BlackBerry" || platformName == "BlackBerrySimulator") + if (platformName == ConfigNameBlackBerry || platformName == ConfigNameBlackBerrySimulator) return true; } } @@ -675,57 +661,19 @@ public bool IsBlackBerrySolution(DTE2 dte) return false; } - /// - /// Verify if the app configuration is Debug. - /// - /// True if Debug configuration; False otherwise. - private bool CheckDebugConfiguration() + public bool IsBlackBerryConfigurationActive() { - Solution2 solution = (Solution2)_dte.Solution; - foreach (String startupProject in (Array)solution.SolutionBuild.StartupProjects) + if (_dte.Solution != null && _dte.Solution.SolutionBuild != null && _dte.Solution.SolutionBuild.ActiveConfiguration != null) { - foreach (Project p1 in solution.Projects) + foreach (SolutionContext context in _dte.Solution.SolutionBuild.ActiveConfiguration.SolutionContexts) { - if (p1.UniqueName == startupProject) - { - ConfigurationManager config = p1.ConfigurationManager; - Configuration active = config.ActiveConfiguration; - - return active.ConfigurationName.ToUpper() == "DEBUG"; - } + string platformName = context.PlatformName; + if (platformName == ConfigNameBlackBerry || platformName == ConfigNameBlackBerrySimulator) + return true; } } - return false; - } - - /// - /// Adds BlackBerry specific target platforms. - /// - public bool AddPlatforms(Project project) - { - if (project == null) - throw new ArgumentNullException("project"); - - try - { - AddBarDescriptorToProject(project); - project.ConfigurationManager.AddPlatform("BlackBerry", "BlackBerry", true); - project.ConfigurationManager.AddPlatform("BlackBerrySimulator", "BlackBerrySimulator", true); - EnableDeploymentForSolutionPlatforms(); - project.ConfigurationManager.DeletePlatform("Win32"); - project.ConfigurationManager.DeletePlatform("x64"); - project.ConfigurationManager.DeletePlatform("ARM"); - project.ConfigurationManager.DeleteConfigurationRow("Win32"); - project.ConfigurationManager.DeleteConfigurationRow("x64"); - project.ConfigurationManager.DeleteConfigurationRow("ARM"); - return true; - } - catch (Exception e) - { - TraceLog.WriteException(e); - return false; - } + return false; } } } diff --git a/src_vs2012/Package/Helpers/CommandHelper.cs b/src_vs2012/Package/Helpers/CommandHelper.cs index 2e7d8fd2..64ddb1a6 100644 --- a/src_vs2012/Package/Helpers/CommandHelper.cs +++ b/src_vs2012/Package/Helpers/CommandHelper.cs @@ -1,6 +1,7 @@ using System; using EnvDTE; using EnvDTE80; +using Microsoft.VisualStudio; namespace BlackBerry.Package.Helpers { @@ -9,7 +10,25 @@ internal static class CommandHelper /// /// Registers specified handlers for a command given by guid:id anywhere inside Visual Studio. /// - public static CommandEvents Register(DTE2 dte, string commandGuid, int commandId, _dispCommandEvents_BeforeExecuteEventHandler beforeHandler, + public static CommandEvents Register(DTE2 dte, Guid commandGuid, VSConstants.VSStd97CmdID commandId, _dispCommandEvents_BeforeExecuteEventHandler beforeHandler, + _dispCommandEvents_AfterExecuteEventHandler afterHandler) + { + return Register(dte, commandGuid, (int)commandId, beforeHandler, afterHandler); + } + + /// + /// Registers specified handlers for a command given by guid:id anywhere inside Visual Studio. + /// + public static CommandEvents Register(DTE2 dte, Guid commandGuid, VSConstants.VSStd2KCmdID commandId, _dispCommandEvents_BeforeExecuteEventHandler beforeHandler, + _dispCommandEvents_AfterExecuteEventHandler afterHandler) + { + return Register(dte, commandGuid, (int)commandId, beforeHandler, afterHandler); + } + + /// + /// Registers specified handlers for a command given by guid:id anywhere inside Visual Studio. + /// + public static CommandEvents Register(DTE2 dte, Guid commandGuid, int commandId, _dispCommandEvents_BeforeExecuteEventHandler beforeHandler, _dispCommandEvents_AfterExecuteEventHandler afterHandler) { if (dte == null) @@ -20,7 +39,7 @@ public static CommandEvents Register(DTE2 dte, string commandGuid, int commandId if (beforeHandler == null && afterHandler == null) return null; - var commandEvents = dte.Events.CommandEvents[commandGuid, commandId]; + var commandEvents = dte.Events.CommandEvents[commandGuid.ToString("B"), commandId]; if (commandEvents != null) { if (beforeHandler != null) diff --git a/src_vs2012/Package/Helpers/DteHelper.cs b/src_vs2012/Package/Helpers/DteHelper.cs index 9bbdf95d..cb1c12ee 100644 --- a/src_vs2012/Package/Helpers/DteHelper.cs +++ b/src_vs2012/Package/Helpers/DteHelper.cs @@ -31,5 +31,33 @@ public static Project[] GetProjects(DTE2 dte) return result.ToArray(); } + + /// + /// Gets the output path for specified project. + /// + public static string GetOutputPath(Project project) + { + if (project == null) + throw new ArgumentNullException("project"); + + ConfigurationManager config = project.ConfigurationManager; + Configuration active = config.ActiveConfiguration; + + foreach (Property prop in active.Properties) + { + try + { + if (prop.Name == "OutputPath") + { + return prop.Value.ToString(); + } + } + catch + { + } + } + + return null; + } } } From 2965b69f57aa970fd8cfeb7997872d4291d3615d Mon Sep 17 00:00:00 2001 From: Pawel Hofman Date: Tue, 8 Jul 2014 17:02:44 +0200 Subject: [PATCH 357/851] Fixed broken simulator build --- ...rosoft.Cpp.BlackBerrySimulator.Packager.targets | 4 ++-- .../Microsoft.Cpp.BlackBerrySimulator.props | 14 -------------- 2 files changed, 2 insertions(+), 16 deletions(-) diff --git a/src_vs2010/BuildTasks/BlackBerrySimulator/Microsoft.Cpp.BlackBerrySimulator.Packager.targets b/src_vs2010/BuildTasks/BlackBerrySimulator/Microsoft.Cpp.BlackBerrySimulator.Packager.targets index ed9076bc..cbbd0b11 100644 --- a/src_vs2010/BuildTasks/BlackBerrySimulator/Microsoft.Cpp.BlackBerrySimulator.Packager.targets +++ b/src_vs2010/BuildTasks/BlackBerrySimulator/Microsoft.Cpp.BlackBerrySimulator.Packager.targets @@ -124,7 +124,7 @@ Copyright (C) Microsoft Corporation. All rights reserved. TargetFormat ="%(BuildBar.TargetFormat)" OutputFile ="%(BuildBar.OutputFile)" ToolExe ="$(BuildBarToolExe)" - ToolPath ="$(ToolPath)" + ToolPath ="$(BuildBarToolPath)" TrackFileAccess ="$(TrackFileAccess)" MinimalRebuildFromTracking ="$(BuildBar_MinimalRebuildFromTracking)" TrackerLogDirectory ="%(BuildBar.TrackerLogDirectory)" @@ -207,7 +207,7 @@ Copyright (C) Microsoft Corporation. All rights reserved. - + lib - - x86 - - - armle-v7 - - - - $(from_file) - gcc_ntox86 - gcc_ntoarmv7le - $(QNX_TARGET)\$(CPUVARDIR)\lib - - $([System.IO.Path]::Combine($(ProjectDir),$(OutDir)$(LibPrefix)$(TargetName)$(TargetExt))) From b5326ba694636c39484848e159ae100680203d32 Mon Sep 17 00:00:00 2001 From: Pawel Hofman Date: Wed, 9 Jul 2014 01:22:02 +0200 Subject: [PATCH 358/851] Updated debug comments --- src_vs2012/Package/BlackBerryPackage.cs | 7 +++++-- .../Components/BuildPlatformsManager.cs | 20 ++++++++++++++----- 2 files changed, 20 insertions(+), 7 deletions(-) diff --git a/src_vs2012/Package/BlackBerryPackage.cs b/src_vs2012/Package/BlackBerryPackage.cs index 004b0748..e38aa595 100644 --- a/src_vs2012/Package/BlackBerryPackage.cs +++ b/src_vs2012/Package/BlackBerryPackage.cs @@ -93,7 +93,7 @@ namespace BlackBerry.Package [ProvideOptionPage(typeof(SigningOptionPage), OptionsCategoryName, "Signing", 1001, 1006, true)] public sealed class BlackBerryPackage : Microsoft.VisualStudio.Shell.Package, IDisposable { - public const string VersionString = "2.1.2014.0623"; + public const string VersionString = "2.1.2014.709"; public const string OptionsCategoryName = "BlackBerry"; private BlackBerryPaneTraceListener _traceWindow; @@ -388,7 +388,7 @@ private void AddBlackBerryTargetPlatforms(object sender, EventArgs e) if (projects == null || projects.Length == 0) { - MessageBoxHelper.Show("Unable to add BlackBerry Platforms. Please open a solution with Visual C++ projects", null, MessageBoxButtons.OK, MessageBoxIcon.Error); + MessageBoxHelper.Show("Please open a solution with Visual C++ projects", "Unable to add BlackBerry Platforms.", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } @@ -396,6 +396,9 @@ private void AddBlackBerryTargetPlatforms(object sender, EventArgs e) { _buildPlatformsManager.AddPlatforms(project); } + + MessageBoxHelper.Show("You might now:\r\n * restart Visual Studio, as it has the 'deploy' option disabled\r\n * update the Author Information within the bar-descriptor.xml", "BlackBerry and BlackBerrySimulator targets have been added to solution configurations.", MessageBoxButtons.OK, MessageBoxIcon.Information); + } private void ImportBlackBerryProject(object sender, EventArgs e) diff --git a/src_vs2012/Package/Components/BuildPlatformsManager.cs b/src_vs2012/Package/Components/BuildPlatformsManager.cs index 96117ddb..9e2c38b6 100644 --- a/src_vs2012/Package/Components/BuildPlatformsManager.cs +++ b/src_vs2012/Package/Components/BuildPlatformsManager.cs @@ -347,7 +347,7 @@ private void OnBuildBegin(vsBuildScope scope, vsBuildAction action) /// Cancel the default execution of the command. private void StartNoDebugCommandEvents_BeforeExecute(string guid, int id, object customIn, object customOut, ref bool cancelDefault) { - TraceLog.WriteLine("Before Start NoDebug"); + TraceLog.WriteLine("BUILD: Start no Debug"); _startDebugger = false; StartBuild(out cancelDefault); } @@ -362,7 +362,7 @@ private void StartNoDebugCommandEvents_BeforeExecute(string guid, int id, object /// Cancel the default execution of the command. private void StartDebugCommandEvents_BeforeExecute(string guid, int id, object customIn, object customOut, ref bool cancelDefault) { - TraceLog.WriteLine("Before Start Debug"); + TraceLog.WriteLine("BUILD: Start Debug"); _startDebugger = true; StartBuild(out cancelDefault); } @@ -397,6 +397,8 @@ private void StartBuild(out bool cancelDefault) { if (DebugEngineStatus.IsRunning) { + TraceLog.WriteLine("BUILD: StartBuild - Debugger running"); + // Disable the override of F5 (this allows the debugged process to continue execution) cancelDefault = false; return; @@ -404,6 +406,8 @@ private void StartBuild(out bool cancelDefault) if (!IsBlackBerryConfigurationActive()) { + TraceLog.WriteLine("BUILD: StartBuild - not a BlackBerry project"); + // Disable the override of F5 (this allows the debugged process to continue execution) cancelDefault = false; return; @@ -469,6 +473,8 @@ private void StartBuild(out bool cancelDefault) /// TRUE if successful, FALSE if not. private bool BuildBar() { + TraceLog.WriteLine("BUILD: BuildBar"); + bool success = true; try { @@ -511,6 +517,8 @@ private bool BuildBar() /// private void Built() { + TraceLog.WriteLine("BUILD: Built"); + _outputWindowPane.TextDocument.Selection.SelectAll(); string outputText = _outputWindowPane.TextDocument.Selection.Text; @@ -547,6 +555,8 @@ private void Built() /// private void Deployed() { + TraceLog.WriteLine("BUILD: Deployed"); + if (_startProject == null) { MessageBoxHelper.Show("Unable to determine the executable to start.", null, MessageBoxButtons.OK, MessageBoxIcon.Error); @@ -618,10 +628,10 @@ private bool LaunchDebugTarget(string pidOrTargetName, string toolsPath, string if (result != VSConstants.S_OK) { - string msg; + string message; IVsUIShell sh = (IVsUIShell)sp.GetService(typeof(SVsUIShell)); - sh.GetErrorInfo(out msg); - TraceLog.WriteLine("LaunchDebugTargets: " + msg); + sh.GetErrorInfo(out message); + TraceLog.WriteLine("LaunchDebugTargets: " + message.Trim()); return true; } From 8ec7afa041bdbae262ddbcd93f4f3a9b50b621bd Mon Sep 17 00:00:00 2001 From: Pawel Hofman Date: Wed, 9 Jul 2014 02:31:47 +0200 Subject: [PATCH 359/851] Fixed running the project on virtual-machine --- src_vs2010/GDBHost/BlackBerry.GDBHost.vcxproj | 2 +- src_vs2010/GDBParser/gdb-connect.cpp | 12 +++++++++--- src_vs2012/GDBHost/BlackBerry.GDBHost.vcxproj | 2 +- src_vs2013/GDBHost/BlackBerry.GDBHost.vcxproj | 2 +- 4 files changed, 12 insertions(+), 6 deletions(-) diff --git a/src_vs2010/GDBHost/BlackBerry.GDBHost.vcxproj b/src_vs2010/GDBHost/BlackBerry.GDBHost.vcxproj index c99d80f1..3efb1b94 100644 --- a/src_vs2010/GDBHost/BlackBerry.GDBHost.vcxproj +++ b/src_vs2010/GDBHost/BlackBerry.GDBHost.vcxproj @@ -78,7 +78,7 @@ false - xcopy "$(OutDir)GDBWrapper.*" "$(OutputPath)" /d /y + xcopy "$(OutDir)BlackBerry.GDBHost.exe" "$(OutputPath)" /d /y Copying Executable to output directory. diff --git a/src_vs2010/GDBParser/gdb-connect.cpp b/src_vs2010/GDBParser/gdb-connect.cpp index 85e46368..2c991e02 100644 --- a/src_vs2010/GDBParser/gdb-connect.cpp +++ b/src_vs2010/GDBParser/gdb-connect.cpp @@ -32,7 +32,8 @@ using namespace std; using namespace System; - +using namespace System::IO; +using namespace System::Reflection; /// /// Used to send parameters for the listeningGDB thread (the one that is listening GDB responses). @@ -370,7 +371,12 @@ void GDBConsole::prepAndLaunchRedirectedChild(void) flags = CREATE_NEW_CONSOLE; - String^ StringFilePath = "S:\\vs-plugin\\src_vs2012\\Debug\\BlackBerry.GDBHost.exe"; // Environment::GetFolderPath(Environment::SpecialFolder::ProgramFilesX86) + "\\BlackBerry\\VSPlugin-NDK\\GDBWrapper.exe"; +#if DEBUG + String^ StringFilePath = "S:\\vs-plugin\\src_vs2012\\Debug\\BlackBerry.GDBHost.exe"; +#else + String^ StringFilePath = Path::Combine(Path::GetDirectoryName(Assembly::GetExecutingAssembly()->Location), "BlackBerry.GDBHost.exe"); + //Environment::GetFolderPath(Environment::SpecialFolder::ProgramFilesX86) + "\\BlackBerry\\VSPlugin-NDK\\BlackBerry.GDBHost.exe"; +#endif pin_ptr FilePath = PtrToStringChars(StringFilePath); if (!m_pcGDBCmd) { @@ -379,7 +385,7 @@ void GDBConsole::prepAndLaunchRedirectedChild(void) } /* CreateProcess can modify pCmdLine thus we allocate memory */ - size_t numChars = _tcslen(m_pcGDBCmd) + MAX_EVENT_NAME_LENGTH * 2 + 1; + size_t numChars = _tcslen(m_pcGDBCmd) + MAX_EVENT_NAME_LENGTH * 2 + 1 + StringFilePath->Length; TCHAR* pCmdLine = new TCHAR[numChars * sizeof(TCHAR)]; if (pCmdLine == 0) { diff --git a/src_vs2012/GDBHost/BlackBerry.GDBHost.vcxproj b/src_vs2012/GDBHost/BlackBerry.GDBHost.vcxproj index 3a43841e..831a0ade 100644 --- a/src_vs2012/GDBHost/BlackBerry.GDBHost.vcxproj +++ b/src_vs2012/GDBHost/BlackBerry.GDBHost.vcxproj @@ -80,7 +80,7 @@ false - xcopy "$(OutDir)GDBWrapper.*" "$(OutputPath)" /d /y + xcopy "$(OutDir)BlackBerry.GDBHost.exe" "$(OutputPath)" /d /y Copying Executable to output directory. diff --git a/src_vs2013/GDBHost/BlackBerry.GDBHost.vcxproj b/src_vs2013/GDBHost/BlackBerry.GDBHost.vcxproj index d914396a..b1b7c928 100644 --- a/src_vs2013/GDBHost/BlackBerry.GDBHost.vcxproj +++ b/src_vs2013/GDBHost/BlackBerry.GDBHost.vcxproj @@ -80,7 +80,7 @@ false - xcopy "$(OutDir)GDBWrapper.*" "$(OutputPath)" /d /y + xcopy "$(OutDir)BlackBerry.GDBHost.exe" "$(OutputPath)" /d /y Copying Executable to output directory. From 41c5d5f360e1dbe7b57e83838c46e0d058c188c5 Mon Sep 17 00:00:00 2001 From: Pawel Hofman Date: Wed, 9 Jul 2014 14:54:46 +0200 Subject: [PATCH 360/851] Removed not required reference to RichEdit library --- src_vs2010/Package/BlackBerry.Package.csproj | 20 -------------------- src_vs2012/Package/BlackBerry.Package.csproj | 11 ----------- src_vs2013/Package/BlackBerry.Package.csproj | 11 ----------- 3 files changed, 42 deletions(-) diff --git a/src_vs2010/Package/BlackBerry.Package.csproj b/src_vs2010/Package/BlackBerry.Package.csproj index a45996ed..d0faa6fe 100644 --- a/src_vs2010/Package/BlackBerry.Package.csproj +++ b/src_vs2010/Package/BlackBerry.Package.csproj @@ -135,15 +135,6 @@ False False - - {00020430-0000-0000-C000-000000000046} - 2 - 0 - 0 - primary - False - False - @@ -560,17 +551,6 @@ - - - {8CC497C9-A1DF-11CE-8098-00AA0047BE5D} - 1 - 0 - 0 - tlbimp - False - True - - diff --git a/src_vs2012/Package/BlackBerry.Package.csproj b/src_vs2012/Package/BlackBerry.Package.csproj index ff7abbad..1bb8ea07 100644 --- a/src_vs2012/Package/BlackBerry.Package.csproj +++ b/src_vs2012/Package/BlackBerry.Package.csproj @@ -507,17 +507,6 @@ Designer - - - {8CC497C9-A1DF-11CE-8098-00AA0047BE5D} - 1 - 0 - 0 - tlbimp - False - True - - Import\Import.xaml diff --git a/src_vs2013/Package/BlackBerry.Package.csproj b/src_vs2013/Package/BlackBerry.Package.csproj index 346fbba4..e3f953ad 100644 --- a/src_vs2013/Package/BlackBerry.Package.csproj +++ b/src_vs2013/Package/BlackBerry.Package.csproj @@ -627,17 +627,6 @@ Designer - - - {8CC497C9-A1DF-11CE-8098-00AA0047BE5D} - 1 - 0 - 0 - tlbimp - False - True - - Import\Import.xaml From b054828fc29a940b3fd8a18060143552b1d4d254 Mon Sep 17 00:00:00 2001 From: Pawel Hofman Date: Wed, 9 Jul 2014 17:23:34 +0200 Subject: [PATCH 361/851] Updated the way arguments are passed to the DE Now arguments support better escaping and are immunite to ';' and '=' chars passed inside values. Also keys are validated against those chars. --- src_vs2010/DebugEngine/AD7.Impl/AD7Engine.cs | 21 ++--- src_vs2010/UnitTests/UnitTests.csproj | 3 + .../Helpers/NameValueCollectionHelper.cs | 76 ++++++++++++------- .../Components/BuildPlatformsManager.cs | 42 +++++----- src_vs2012/UnitTests/CollectionHelperTests.cs | 66 ++++++++++++++++ src_vs2012/UnitTests/UnitTests.csproj | 1 + src_vs2013/UnitTests/UnitTests.csproj | 3 + 7 files changed, 154 insertions(+), 58 deletions(-) create mode 100644 src_vs2012/UnitTests/CollectionHelperTests.cs diff --git a/src_vs2010/DebugEngine/AD7.Impl/AD7Engine.cs b/src_vs2010/DebugEngine/AD7.Impl/AD7Engine.cs index 68787fe9..cc35f927 100644 --- a/src_vs2010/DebugEngine/AD7.Impl/AD7Engine.cs +++ b/src_vs2010/DebugEngine/AD7.Impl/AD7Engine.cs @@ -569,28 +569,23 @@ int IDebugEngineLaunch2.LaunchSuspended(string pszServer, IDebugPort2 port, stri Callback = new EngineCallback(this, ad7Callback); // Read arguments back from the args string - var nvc = new NameValueCollection(); - NameValueCollectionHelper.LoadFromString(nvc, args); + var nvc = CollectionHelper.Deserialize(args); - string pid = nvc.GetValues("pid")[0]; + string pid = nvc["pid"]; uint pidNumber; string exePath = exe; - string targetIP = nvc.GetValues("targetIP")[0]; - bool isSimulator = Convert.ToBoolean(nvc.GetValues("isSimulator")[0]); - string toolsPath = nvc.GetValues("ToolsPath")[0]; - string publicKeyPath = nvc.GetValues("PublicKeyPath")[0]; - - string password = null; - string[] passwordArray = nvc.GetValues("Password"); - if (passwordArray != null) - password = passwordArray[0]; + string targetIP = nvc["targetIP"]; + bool isSimulator = Convert.ToBoolean(nvc["isSimulator"]); + string toolsPath = nvc["ToolsPath"]; + string publicKeyPath = nvc["PublicKeyPath"]; + string password = nvc["Password"]; if (!uint.TryParse(pid, out pidNumber)) { uint.TryParse(GetPIDfromGDB(pid, targetIP, password, isSimulator, toolsPath, publicKeyPath), out pidNumber); } - if (GDBParser.LaunchProcess(pidNumber.ToString(), exePath, targetIP, isSimulator, toolsPath, publicKeyPath, password)) + if (GDBParser.LaunchProcess(pidNumber.ToString(), exePath.Replace("\\", "\\\\"), targetIP, isSimulator, toolsPath, publicKeyPath, password)) { process = _process = new AD7Process(this, port); EventDispatcher = new EventDispatcher(this); diff --git a/src_vs2010/UnitTests/UnitTests.csproj b/src_vs2010/UnitTests/UnitTests.csproj index e6c95fd0..8b0e866c 100644 --- a/src_vs2010/UnitTests/UnitTests.csproj +++ b/src_vs2010/UnitTests/UnitTests.csproj @@ -49,6 +49,9 @@ + + CollectionHelperTests.cs + DebuggerProcessorTests.cs diff --git a/src_vs2012/NativeCore/Helpers/NameValueCollectionHelper.cs b/src_vs2012/NativeCore/Helpers/NameValueCollectionHelper.cs index a365f233..cb04d578 100644 --- a/src_vs2012/NativeCore/Helpers/NameValueCollectionHelper.cs +++ b/src_vs2012/NativeCore/Helpers/NameValueCollectionHelper.cs @@ -13,56 +13,78 @@ //* limitations under the License. using System; +using System.Collections.Generic; using System.Text; -using System.Collections.Specialized; namespace BlackBerry.NativeCore.Helpers { /// - /// Helper class in managing key-value collection. + /// Helper class for managing key-value collection. /// - public static class NameValueCollectionHelper + public static class CollectionHelper { /// /// Dumps given collection into a single string. + /// All values are converted to Base64 (just to avoid possible collisions with special separator chars: ';' and '='). /// - public static string DumpToString(NameValueCollection value) + public static string Serialize(Dictionary dictionary) { - var xSB = new StringBuilder(); - foreach (string xKey in value.Keys) + if (dictionary == null) + throw new ArgumentNullException("dictionary"); + + var result = new StringBuilder(); + foreach (var pair in dictionary) { - xSB.AppendFormat("{0}={1};", xKey, value[xKey]); + if (pair.Key.IndexOf('=') >= 0 || pair.Key.IndexOf(';') >= 0) + throw new ArgumentOutOfRangeException("dictionary", "Forbidden char found in key name (" + pair.Key + ")"); + + result.Append(pair.Key).Append('='); + if (pair.Value == null) + result.Append('~'); + else + { + if (!string.IsNullOrEmpty(pair.Value)) + result.Append(Convert.ToBase64String(Encoding.UTF8.GetBytes(pair.Value))); + } + result.Append(';'); } - return xSB.ToString(); + return result.ToString(); } /// /// Updates the collection with a value parsed out from a given string. /// - public static void LoadFromString(NameValueCollection target, string value) + public static Dictionary Deserialize(string data) { - if (target.Count > 0) - { - throw new Exception("Target is not empty!"); - } - if (String.IsNullOrEmpty(value)) - { - return; - } + var result = new Dictionary(); - string[] xPairs = value.Split(new[] { ';' }, StringSplitOptions.RemoveEmptyEntries); - foreach (var xPair in xPairs) + // if there was any input data: + if (!string.IsNullOrEmpty(data)) { - string[] xParts = xPair.Split('='); - if (xParts.Length > 1) + string[] entryDescriptor = data.Split(new[] { ';' }, StringSplitOptions.RemoveEmptyEntries); + foreach (var item in entryDescriptor) { - target.Add(xParts[0], xParts[1]); - } - else - { - target.Add(xParts[0], ""); + int valueAt = item.IndexOf('='); + if (valueAt < 0) + throw new ArgumentOutOfRangeException("data", "Missing value definition in entry: \"" + item + "\""); + + var key = item.Substring(0, valueAt); + var value = item.Substring(valueAt + 1); + if (string.IsNullOrEmpty(value)) + { + result.Add(key, string.Empty); + } + else + { + if (value == "~") + result.Add(key, null); + else + result.Add(key, Encoding.UTF8.GetString(Convert.FromBase64String(value))); + } } } + + return result; } } -} \ No newline at end of file +} diff --git a/src_vs2012/Package/Components/BuildPlatformsManager.cs b/src_vs2012/Package/Components/BuildPlatformsManager.cs index 9e2c38b6..b5a3981e 100644 --- a/src_vs2012/Package/Components/BuildPlatformsManager.cs +++ b/src_vs2012/Package/Components/BuildPlatformsManager.cs @@ -14,7 +14,6 @@ using System; using System.Collections.Generic; -using System.Collections.Specialized; using System.IO; using System.Runtime.InteropServices; using System.Text.RegularExpressions; @@ -110,6 +109,14 @@ private DeviceDefinition ActiveDevice get { return PackageViewModel.Instance.ActiveDevice; } } + /// + /// Gets the currently selected simulator all actions should be performed against. + /// + private DeviceDefinition ActiveSimulator + { + get { return PackageViewModel.Instance.ActiveSimulator; } + } + /// /// Gets the currently selected NDK to build against. /// @@ -168,7 +175,7 @@ private void ShowSolutionPlatformSelector() Command sp = null; string expectedGuid = VSConstants.VSStd2K.ToString("B"); - int expectedID = (int) VSConstants.VSStd2KCmdID.SolutionPlatform; + const int expectedID = (int) VSConstants.VSStd2KCmdID.SolutionPlatform; foreach (Command command in _dte.Commands) { @@ -565,8 +572,9 @@ private void Deployed() var targetName = _startProject.Name; // name of the binary... should be better way to detect it... although whole deploying fails, if binary-name != project-name var executablePath = Path.Combine(DteHelper.GetOutputPath(_startProject), targetName); + bool isSimulator = _startProject.ConfigurationManager.ActiveConfiguration.PlatformName == ConfigNameBlackBerrySimulator; var ndk = ActiveNDK; - var device = ActiveDevice; + var device = isSimulator ? ActiveSimulator : ActiveDevice; if (ndk == null) { @@ -583,8 +591,7 @@ private void Deployed() if (_startDebugger) { - var isSimulator = _startProject.ConfigurationManager.ActiveConfiguration.PlatformName == ConfigNameBlackBerrySimulator; - LaunchDebugTarget(targetName, ndk.ToDefinition().ToolsPath, ConfigDefaults.SshPublicKeyPath, device.IP, device.Password, isSimulator, executablePath); + LaunchDebugTarget(targetName, ndk, device, ConfigDefaults.SshPublicKeyPath, executablePath); } } @@ -593,27 +600,27 @@ private void Deployed() /// /// Process ID in string format or the binary name for debugger to attach to. /// TRUE if successful, False if not. - private bool LaunchDebugTarget(string pidOrTargetName, string toolsPath, string publicKeyPath, string targetIP, string password, bool isSimulator, string executablePath) + private bool LaunchDebugTarget(string pidOrTargetName, NdkInfo ndk, DeviceDefinition device, string publicKeyPath, string executablePath) { + TraceLog.WriteLine("BUILD: Starting debugger ('{0}', {1})", pidOrTargetName, executablePath); + ServiceProvider sp = new ServiceProvider((Microsoft.VisualStudio.OLE.Interop.IServiceProvider)_dte); IVsDebugger dbg = (IVsDebugger)sp.GetService(typeof(SVsShellDebugger)); VsDebugTargetInfo info = new VsDebugTargetInfo(); info.cbSize = (uint)Marshal.SizeOf(info); info.dlo = DEBUG_LAUNCH_OPERATION.DLO_CreateProcess; + info.bstrExe = executablePath; // The executable path // Store all debugger arguments in a string - var nvc = new NameValueCollection(); - nvc.Add("pid", pidOrTargetName); - nvc.Add("targetIP", targetIP); // The device (IP address) - info.bstrExe = executablePath.Replace('\\', '/'); // The executable path - nvc.Add("isSimulator", isSimulator.ToString()); - nvc.Add("ToolsPath", toolsPath); - nvc.Add("PublicKeyPath", publicKeyPath.Replace('\\', '/')); - nvc.Add("Password", password); - - info.bstrArg = NameValueCollectionHelper.DumpToString(nvc); - + var nvc = new Dictionary(); + nvc["pid"] = pidOrTargetName; + nvc["ToolsPath"] = ndk.ToDefinition().ToolsPath; + nvc["PublicKeyPath"] = publicKeyPath; + nvc["targetIP"] = device.IP; // The device (IP address) + nvc["Password"] = device.Password; + nvc["isSimulator"] = (device.Type == DeviceDefinitionType.Simulator).ToString(); + info.bstrArg = CollectionHelper.Serialize(nvc); info.bstrRemoteMachine = null; // debug locally info.fSendStdoutToOutputWindow = 0; // Let stdout stay with the application. info.clsidCustom = new Guid(AD7Engine.DebugEngineGuid); // Set the launching engine as the BlackBerry debug-engine @@ -625,7 +632,6 @@ private bool LaunchDebugTarget(string pidOrTargetName, string toolsPath, string try { int result = dbg.LaunchDebugTargets(1, pInfo); - if (result != VSConstants.S_OK) { string message; diff --git a/src_vs2012/UnitTests/CollectionHelperTests.cs b/src_vs2012/UnitTests/CollectionHelperTests.cs new file mode 100644 index 00000000..649d728d --- /dev/null +++ b/src_vs2012/UnitTests/CollectionHelperTests.cs @@ -0,0 +1,66 @@ +using System; +using System.Collections.Generic; +using BlackBerry.NativeCore.Helpers; +using NUnit.Framework; + +namespace UnitTests +{ + [TestFixture] + public sealed class CollectionHelperTests + { + [Test] + [ExpectedException(typeof(ArgumentOutOfRangeException))] + public void SerializeInvalidKey_with_failure() + { + var dict = new Dictionary(); + + dict["a;"] = "1"; + + CollectionHelper.Serialize(dict); + Assert.Fail("Serialization should fail already"); + } + + [Test] + public void SerializeEmptyValues_with_success() + { + var dict = new Dictionary(); + + dict["abcdef"] = null; + dict["123456"] = string.Empty; + dict["xyz"] = " "; + + var result = CollectionHelper.Serialize(dict); + Assert.IsNotNull(result); + + var deserialized = CollectionHelper.Deserialize(result); + Assert.IsNotNull(deserialized); + Assert.IsNull(deserialized["abcdef"]); + Assert.AreEqual(string.Empty, deserialized["123456"]); + Assert.AreEqual(" ", deserialized["xyz"]); + } + + [Test] + public void SerializeTypicalValues_with_success() + { + var dict = new Dictionary(); + + dict["libs"] = "abc;def;ghi;jkl"; + dict["json"] = "{\"a\": 1, \"b\": \"=5,123;48\"}"; + dict["path"] = "C:\\Windows\\system32\\cmd.exe"; + dict["key-val"] = "a=1;b=2;c=3"; + + var result = CollectionHelper.Serialize(dict); + Assert.IsNotNull(result); + + var deserialized = CollectionHelper.Deserialize(result); + Assert.IsNotNull(deserialized); + Assert.AreEqual(dict.Count, deserialized.Count, "Deserialized data has a different size!"); + + // compare each value: + foreach (var pair in dict) + { + Assert.AreEqual(pair.Value, deserialized[pair.Key], "Deserialized data is not matching"); + } + } + } +} diff --git a/src_vs2012/UnitTests/UnitTests.csproj b/src_vs2012/UnitTests/UnitTests.csproj index 4893c33d..f5191111 100644 --- a/src_vs2012/UnitTests/UnitTests.csproj +++ b/src_vs2012/UnitTests/UnitTests.csproj @@ -53,6 +53,7 @@ + diff --git a/src_vs2013/UnitTests/UnitTests.csproj b/src_vs2013/UnitTests/UnitTests.csproj index f37b98c5..21e3b01f 100644 --- a/src_vs2013/UnitTests/UnitTests.csproj +++ b/src_vs2013/UnitTests/UnitTests.csproj @@ -53,6 +53,9 @@ + + CollectionHelperTests.cs + DebuggerProcessorTests.cs From e25418d1c8ccad6daeaefdddda959a16c50a225a Mon Sep 17 00:00:00 2001 From: Pawel Hofman Date: Wed, 9 Jul 2014 22:25:11 +0200 Subject: [PATCH 362/851] Improved debugging in VS2010 --- src_vs2010/GDBParser/gdb-connect.cpp | 2 +- src_vs2012/Package/BlackBerryPackage.cs | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src_vs2010/GDBParser/gdb-connect.cpp b/src_vs2010/GDBParser/gdb-connect.cpp index 2c991e02..66cd54a8 100644 --- a/src_vs2010/GDBParser/gdb-connect.cpp +++ b/src_vs2010/GDBParser/gdb-connect.cpp @@ -371,7 +371,7 @@ void GDBConsole::prepAndLaunchRedirectedChild(void) flags = CREATE_NEW_CONSOLE; -#if DEBUG +#if _DEBUG String^ StringFilePath = "S:\\vs-plugin\\src_vs2012\\Debug\\BlackBerry.GDBHost.exe"; #else String^ StringFilePath = Path::Combine(Path::GetDirectoryName(Assembly::GetExecutingAssembly()->Location), "BlackBerry.GDBHost.exe"); diff --git a/src_vs2012/Package/BlackBerryPackage.cs b/src_vs2012/Package/BlackBerryPackage.cs index e38aa595..bdc7103a 100644 --- a/src_vs2012/Package/BlackBerryPackage.cs +++ b/src_vs2012/Package/BlackBerryPackage.cs @@ -69,7 +69,15 @@ namespace BlackBerry.Package ProgramProviderClassGUID = AD7ProgramProvider.ClassGuid, ProgramProviderClassName = AD7ProgramProvider.ClassName, PortSupplierClassGUID = AD7PortSupplier.ClassGuid, PortSupplierClassName = AD7PortSupplier.ClassName, #if DEBUG +# if PLATFORM_VS2010 + AssemblyName = @"S:\vs-plugin\src_vs2010\DebugEngine\bin\Debug\BlackBerry.DebugEngine.dll" +# elif PLATFORM_VS2012 AssemblyName = @"S:\vs-plugin\src_vs2012\DebugEngine\bin\Debug\BlackBerry.DebugEngine.dll" +# elif PLATFORM_VS2013 + AssemblyName = @"S:\vs-plugin\src_vs2013\DebugEngine\bin\Debug\BlackBerry.DebugEngine.dll" +#else +# error Define path to debug version of the DebugEngine.dll to make the debugging working. +#endif #else AssemblyName = "BlackBerry.DebugEngine.dll" #endif From 2560ee5e7198e8aa450c7f2807aa93b2982c89ce Mon Sep 17 00:00:00 2001 From: Pawel Hofman Date: Wed, 9 Jul 2014 22:25:50 +0200 Subject: [PATCH 363/851] Starting secure-connection as early as possible This should speed-up debugger startup --- .../Components/BuildPlatformsManager.cs | 41 ++++++++++++++----- 1 file changed, 31 insertions(+), 10 deletions(-) diff --git a/src_vs2012/Package/Components/BuildPlatformsManager.cs b/src_vs2012/Package/Components/BuildPlatformsManager.cs index b5a3981e..e9b50f93 100644 --- a/src_vs2012/Package/Components/BuildPlatformsManager.cs +++ b/src_vs2012/Package/Components/BuildPlatformsManager.cs @@ -125,6 +125,20 @@ private NdkInfo ActiveNDK get { return PackageViewModel.Instance.ActiveNDK; } } + /// + /// Gets the active target, where the application will be deployed and run on. + /// + private DeviceDefinition ActiveTarget + { + get + { + bool isSimulator = _startProject != null && _startProject.ConfigurationManager != null + && _startProject.ConfigurationManager.ActiveConfiguration != null + && _startProject.ConfigurationManager.ActiveConfiguration.PlatformName == ConfigNameBlackBerrySimulator; + return isSimulator ? ActiveSimulator : ActiveDevice; + } + } + #endregion /// @@ -552,6 +566,14 @@ private void Built() } } } + + // OK, project builds, so make sure there is a connection to the device, to speed-up further debugging: + var target = ActiveTarget; + if (target != null) + { + Targets.Connect(ActiveTarget, ConfigDefaults.SshPublicKeyPath, null); + } + _isDeploying = true; _dte.Solution.SolutionBuild.Deploy(true); } @@ -572,9 +594,8 @@ private void Deployed() var targetName = _startProject.Name; // name of the binary... should be better way to detect it... although whole deploying fails, if binary-name != project-name var executablePath = Path.Combine(DteHelper.GetOutputPath(_startProject), targetName); - bool isSimulator = _startProject.ConfigurationManager.ActiveConfiguration.PlatformName == ConfigNameBlackBerrySimulator; var ndk = ActiveNDK; - var device = isSimulator ? ActiveSimulator : ActiveDevice; + var device = ActiveTarget; if (ndk == null) { @@ -584,7 +605,7 @@ private void Deployed() } if (device == null) { - MessageBoxHelper.Show("Missing device selected. Please define an IP, password and mark a device as active using BlackBerry menu options.", null, + MessageBoxHelper.Show("Missing target device selected. Please define an IP, password and mark a device as active using BlackBerry menu options.", null, MessageBoxButtons.OK, MessageBoxIcon.Error); return; } @@ -598,11 +619,11 @@ private void Deployed() /// /// Launch an executable using the BlackBerry debug engine. /// - /// Process ID in string format or the binary name for debugger to attach to. + /// Process ID in string format or the binary name for debugger to attach to. /// TRUE if successful, False if not. - private bool LaunchDebugTarget(string pidOrTargetName, NdkInfo ndk, DeviceDefinition device, string publicKeyPath, string executablePath) + private bool LaunchDebugTarget(string pidOrTargetAppName, NdkInfo ndk, DeviceDefinition target, string publicKeyPath, string executablePath) { - TraceLog.WriteLine("BUILD: Starting debugger ('{0}', {1})", pidOrTargetName, executablePath); + TraceLog.WriteLine("BUILD: Starting debugger ('{0}', {1})", pidOrTargetAppName, executablePath); ServiceProvider sp = new ServiceProvider((Microsoft.VisualStudio.OLE.Interop.IServiceProvider)_dte); IVsDebugger dbg = (IVsDebugger)sp.GetService(typeof(SVsShellDebugger)); @@ -614,12 +635,12 @@ private bool LaunchDebugTarget(string pidOrTargetName, NdkInfo ndk, DeviceDefini // Store all debugger arguments in a string var nvc = new Dictionary(); - nvc["pid"] = pidOrTargetName; + nvc["pid"] = pidOrTargetAppName; nvc["ToolsPath"] = ndk.ToDefinition().ToolsPath; nvc["PublicKeyPath"] = publicKeyPath; - nvc["targetIP"] = device.IP; // The device (IP address) - nvc["Password"] = device.Password; - nvc["isSimulator"] = (device.Type == DeviceDefinitionType.Simulator).ToString(); + nvc["targetIP"] = target.IP; // The device (IP address) + nvc["Password"] = target.Password; + nvc["isSimulator"] = (target.Type == DeviceDefinitionType.Simulator).ToString(); info.bstrArg = CollectionHelper.Serialize(nvc); info.bstrRemoteMachine = null; // debug locally info.fSendStdoutToOutputWindow = 0; // Let stdout stay with the application. From e49a073f90f4431b02710f67b6328d186e7e6adf Mon Sep 17 00:00:00 2001 From: Pawel Hofman Date: Thu, 10 Jul 2014 01:21:27 +0200 Subject: [PATCH 364/851] Reverted option and have the registry files for debugger As a backup. Is disabled by default in setup.bat script. --- build.bat | 137 ++++++++++++++++++++++++++++++++++++--- setup.bat | 33 ++++++++++ setup_install.template | 103 +++++++++++++++++++++++++++++ setup_uninstall.template | 43 ++++++++++++ 4 files changed, 308 insertions(+), 8 deletions(-) create mode 100644 setup_install.template create mode 100644 setup_uninstall.template diff --git a/build.bat b/build.bat index 85cd864b..e7511f82 100644 --- a/build.bat +++ b/build.bat @@ -9,11 +9,15 @@ REM **************************************************************************** :: Process parameters, to limit the solutions to build if "%~1" == "" ( set ActionClean=1 + set ActionGenScripts=1 + set ActionDebugScript=0 set ActionBuildVS2010=1 set ActionBuildVS2012=1 set ActionBuildVS2013=1 ) else ( set ActionClean=1 + set ActionGenScripts=0 + set ActionDebugScript=0 set ActionBuildVS2010=0 set ActionBuildVS2012=0 set ActionBuildVS2013=0 @@ -21,14 +25,19 @@ if "%~1" == "" ( :args_parsing set arg=%~1 -if "%arg%" == "" (goto args_parsing_done) -if /i "%arg%" == "/all" set ActionBuildVS2010=1 && set ActionBuildVS2012=1 && set ActionBuildVS2013=1 -if /i "%arg%" == "/noclean" set ActionClean=0 -if /i "%arg%" == "/no-clean" set ActionClean=0 -if /i "%arg%" == "vs2010" set ActionBuildVS2010=1 -if /i "%arg%" == "vs2012" set ActionBuildVS2012=1 -if /i "%arg%" == "vs2013" set ActionBuildVS2013=1 -if /i "%arg:~0,5%" == "/out:" set CustomOutputDir=%arg:~5% +if "%arg%" == "" (goto args_parsing_done) +if /i "%arg%" == "/all" set ActionBuildVS2010=1 && set ActionBuildVS2012=1 && set ActionBuildVS2013=1 +if /i "%arg%" == "/noclean" set ActionClean=0 +if /i "%arg%" == "/no-clean" set ActionClean=0 +if /i "%arg%" == "/script" set ActionGenScripts=1 +if /i "%arg%" == "/scripts" set ActionGenScripts=2 +if /i "%arg%" == "/noscripts" set ActionGenScripts=0 +if /i "%arg%" == "/no-scripts" set ActionGenScripts=0 +if /i "%arg%" == "/debug-script" set ActionDebugScript=1 +if /i "%arg%" == "vs2010" set ActionBuildVS2010=1 +if /i "%arg%" == "vs2012" set ActionBuildVS2012=1 +if /i "%arg%" == "vs2013" set ActionBuildVS2013=1 +if /i "%arg:~0,5%" == "/out:" set CustomOutputDir=%arg:~5% shift /1 goto args_parsing @@ -126,6 +135,118 @@ set /a actionNo += 1 :skip_vs2013 +REM ******************************************************************************************** +REM Create Installation/Uninstallation Registry Scripts +REM ******************************************************************************************** +if %ActionGenScripts% equ 0 (goto skip_scripts) + +echo %actionNo%: Creating installation scripts + +if %ActionBuildVS2010% equ 0 (if %ActionGenScripts% neq 2 (goto skip_vs2010_scripts)) +call :processTemplates 2010 10.0 +:skip_vs2010_scripts + +if %ActionBuildVS2012% equ 0 (if %ActionGenScripts% neq 2 (goto skip_vs2012_scripts)) +call :processTemplates 2012 11.0 +:skip_vs2012_scripts + +if %ActionBuildVS2013% equ 0 (if %ActionGenScripts% neq 2 (goto skip_vs2013_scripts)) +call :processTemplates 2013 12.0 +:skip_vs2013_scripts + +echo %actionNo%: Writing - DONE +set /a actionNo += 1 + +:skip_scripts + +REM ******************************************************************************************** +REM Helper functions +REM ******************************************************************************************** +goto EOF + +REM ******************************************************************************************** +REM Generates a set of templates for specified Visual Studio version +REM $1 - Visual Studio number (2010) +REM $2 - Visual Studio version (10.0) +:processTemplates +setlocal EnableDelayedExpansion + +set InstallTemplate="%thisDir%\setup_install.template" +set UninstallTemplate="%thisDir%\setup_uninstall.template" + +set VSYear=%~1 +set VSVersion=%~2 +set PluginRegistryNodeName=BlackBerryVSPlugin +set PluginPathX86="C:\Program Files\BlackBerry\VSPlugin-NDK" +set PluginPathX64="C:\Program Files (x86)\BlackBerry\VSPlugin-NDK" +set DebuggerRegistryNodeX86="HKEY_LOCAL_MACHINE\SOFTWARE" +set DebuggerRegistryNodeX64="HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node" + +set InstallOutputFileX86="%BuildResults%\setup_VS%VSYear%_install_x86.reg" +set InstallOutputFileX64="%BuildResults%\setup_VS%VSYear%_install_x64.reg" +set UninstallOutputFile="%BuildResults%\setup_VS%VSYear%_uninstall.reg" + +call :processTemplate %InstallTemplate% %InstallOutputFileX86% %VSYear% %VSVersion% %PluginRegistryNodeName% %PluginPathX86% %DebuggerRegistryNodeX86% +call :processTemplate %InstallTemplate% %InstallOutputFileX64% %VSYear% %VSVersion% %PluginRegistryNodeName% %PluginPathX64% %DebuggerRegistryNodeX64% + +call :processTemplate %UninstallTemplate% %UninstallOutputFile% %VSYear% %VSVersion% %PluginRegistryNodeName% "" "" + +endlocal +exit /b + +REM ******************************************************************************************** +REM Generates single file from specified template +REM $1 - input template path +REM $2 - output name +REM $3 - Visual Studio number (2010) +REM $4 - Visual Studio version (10.0) +REM $5 - registry node name of the plugin (BlackBerryVSPlugin) +REM $6 - plugin installation directory (C:\Program Files (x86)\BlackBerry\VSPlugin-NDK) +REM $7 - registry root node for debugger info (HKEY_LOCAL_MACHINE\SOFTWARE or HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node) +:processTemplate +setlocal EnableDelayedExpansion + +set InputFile=%~1 +set OutputFile=%~2 +set OutputShortFileName=%~n2%~x2 +set VSYear=%~3 +set VSVersion=%~4 +set PluginRegistryNodeName=%~5 +set PluginPath=%~6 +set DebuggerRegistryRoot=%~7 + +if ActionDebugScript neq 0 set PluginPath=S:\vs-plugin\src_vs%VSYear%\DebugEngine\bin\Debug + +REM Tweak a bit the path, to be better consumed by delayed evaluation +REM and printed correctly into output (preserve parenthesis and double path-chars) +set PluginPath=!PluginPath:\=\\! +set PluginPath=!PluginPath:(=^^(! +set PluginPath=!PluginPath:)=^^)! + +REM Create empty file +type nul > "%OutputFile%" + +for /f "tokens=* delims=" %%l in (%InputFile%) do ( + set line=%%l + + REM Inject empty line, so the sections are easier visible + set first=!line:~0,1! + if "!first!" == "[" echo.>> "%OutputFile%" + + REM Replace markers within the template + set line=!line:#VSVersion#=%VSVersion%! + set line=!line:#VSYear#=%VSYear%! + set line=!line:#PluginRegistryNodeName#=%PluginRegistryNodeName%! + set line=!line:#PluginPath#=%PluginPath%! + set line=!line:#DebuggerRegistryRoot#=%DebuggerRegistryRoot%! + echo.!line! >> "%OutputFile%" +) +echo.>> "%OutputFile%" +echo %actionNo%: Completed template "%OutputShortFileName%" + +endlocal +exit /b + REM ******************************************************************************************** REM DONE REM ******************************************************************************************** diff --git a/setup.bat b/setup.bat index a7c1745b..45a9f4a0 100644 --- a/setup.bat +++ b/setup.bat @@ -13,6 +13,7 @@ if "%~1" == "" ( set ActionUninstall=0 set ActionSkipTools=0 set ActionMSBuildOnly=0 + set ActionUseRegistry=0 ) else ( set ActionVS2010=0 set ActionVS2012=0 @@ -20,6 +21,7 @@ if "%~1" == "" ( set ActionUninstall=0 set ActionSkipTools=0 set ActionMSBuildOnly=0 + set ActionUseRegistry=0 for %%a in (%*) do ( if /i "%%a" == "/all" set ActionVS2010=1 && set ActionVS2012=1 && set ActionVS2013=1 if /i "%%a" == "/uninstall" set ActionUninstall=1 @@ -34,6 +36,9 @@ if "%~1" == "" ( if /i "%%a" == "/msbuildonly" set ActionMSBuildOnly=1 if /i "%%a" == "/only-msbuild" set ActionMSBuildOnly=1 if /i "%%a" == "/onlymsbuild" set ActionMSBuildOnly=1 + if /i "%%a" == "/registry" set ActionUseRegistry=1 + if /i "%%a" == "/reg" set ActionUseRegistry=1 + if /i "%%a" == "/noregistry" set ActionUseRegistry=1 if /i "%%a" == "vs2010" set ActionVS2010=1 if /i "%%a" == "vs2012" set ActionVS2012=1 if /i "%%a" == "vs2013" set ActionVS2013=1 @@ -135,6 +140,11 @@ set /a actionNo += 1 call :processMSBuild "%BuildPath%" "%MSBuildTargetPath%" set /a actionNo += 1 +if %ActionUseRegistry% neq 1 goto skip_registry +call :processRegistry +set /a actionNo += 1 +:skip_registry + call :processTemplates "%BuildPath%" "%VSWizardsPath%" set /a actionNo += 1 @@ -206,6 +216,29 @@ rd "%OutputMsBuildTargetsPath%\BlackBerrySimulator" /s /q endlocal exit /b + +REM ******************************************************************************************** +REM Upgrade system registry +REM ******************************************************************************************** +:processRegistry +setlocal + +if %ActionUninstall% neq 0 (goto uninstall_reg) + +REM Registering debug-ending and other support classes +echo %actionNo%: Registering debug-engine [%BuildResults%\setup_VS%VSYear%_install_%SystemArch%.reg] +REGEDIT.EXE /S "%BuildResults%\setup_VS%VSYear%_install_%SystemArch%.reg" +goto processRegistry_End + +:uninstall_reg +echo %actionNo%: Unregistering debug-engine [%BuildResults%\setup_VS%VSYear%_uninstall.reg] +REGEDIT.EXE /S "%BuildResults%\setup_VS%VSYear%_uninstall.reg" + +:processRegistry_End +endlocal +exit /b + + REM ******************************************************************************************** REM Copy GDBParser and DebugEngine Files REM ******************************************************************************************** diff --git a/setup_install.template b/setup_install.template new file mode 100644 index 00000000..5d35c772 --- /dev/null +++ b/setup_install.template @@ -0,0 +1,103 @@ +REGEDIT4 + +[HKEY_CURRENT_USER\SOFTWARE\BlackBerry\#PluginRegistryNodeName#] +"device_password"="" +"device_IP"="169.254.0.1" +"simulator_password"="" +"simulator_IP"="" +"NDKHostPath"="" +"NDKTargetPath"="" +"NDKRemotePath"="" + +[#DebuggerRegistryRoot#\Microsoft\AD7Metrics\Engine\{E5A37609-2F43-4830-AA85-D94CFA035DD2}] +"AddressBP"=dword:00000000 +"AutoSelectPriority"=dword:00000004 +"CallstackBP"=dword:00000001 +"ProgramProvider"="{AD06FD46-C790-4D5C-A274-8815DF9511B8}" +"Attach"=dword:00000001 +"CLSID"="{904AA6E0-942C-4D11-9094-7BAAEB3EE4B9}" +"AlwaysLoadLocal"="1" +"PortSupplier"="{92A2B753-00BD-40FF-9964-6AB64A1D6C9F}" +"Name"="BlackBerry Native SDK Debug Engine" +@="guidDebuggingSampleEngine" + +[#DebuggerRegistryRoot#\Microsoft\AD7Metrics\Engine\{E5A37609-2F43-4830-AA85-D94CFA035DD2}\IncompatibleList] +"guidScriptEng"="{F200A7E7-DEA5-11D0-B854-00A0244A1DE2}" +"guidNativeOnlyEng"="{449EC4CC-30D2-4032-9256-EE18EB41B62B}" +"guidCOMPlusOnlyEng"="{449EC4CC-30D2-4032-9256-EE18EB41B62B}" +"guidCOMPlusNativeEng"="{92EF0900-2251-11D2-B72E-0000F87572EF}" + +[#DebuggerRegistryRoot#\Microsoft\VisualStudio\#VSVersion#\CLSID\{AD06FD46-C790-4D5C-A274-8815DF9511B8}] +"CodeBase"="#PluginPath#\\BlackBerry.DebugEngine.dll" +"InprocServer32"="C:\\Windows\\System32\\mscoree.dll" +"Class"="BlackBerry.DebugEngine.AD7ProgramProvider" +"Assembly"="BlackBerry.DebugEngine" + +[#DebuggerRegistryRoot#\Microsoft\VisualStudio\#VSVersion#\CLSID\{904AA6E0-942C-4D11-9094-7BAAEB3EE4B9}] +"CodeBase"="#PluginPath#\\BlackBerry.DebugEngine.dll" +"InprocServer32"="C:\\Windows\\System32\\mscoree.dll" +"Class"="BlackBerry.DebugEngine.AD7Engine" +"Assembly"="BlackBerry.DebugEngine" + +[#DebuggerRegistryRoot#\Microsoft\VisualStudio\#VSVersion#\CLSID\{BDC2218C-D50C-4A5A-A2F6-66BDC94FF8D6}] +@="BlackBerrySupplier" +"Assembly"="BlackBerry.DebugEngine" +"Class"="BlackBerry.DebugEngine.AD7PortSupplier" +"InprocServer32"="C:\\Windows\\System32\\mscoree.dll" +"CodeBase"="#PluginPath#\\BlackBerry.DebugEngine.dll" +"ThreadingModel"="Free" + +[#DebuggerRegistryRoot#\Microsoft\VisualStudio\#VSVersion#\AD7Metrics\PortSupplier\{92A2B753-00BD-40FF-9964-6AB64A1D6C9F}] +"Name"="BlackBerry" +"DisallowUserEnteredPorts"=dword:00000000 +"CLSID"="{BDC2218C-D50C-4A5A-A2F6-66BDC94FF8D6}" +@="BlackBerry Native SDK" +"PortPickerCLSID"="{3FAA02D6-72D8-4F69-A1E6-BB05ECB4E37A}" + +[#DebuggerRegistryRoot#\Microsoft\VisualStudio\#VSVersion#\AD7Metrics\Engine\{E5A37609-2F43-4830-AA85-D94CFA035DD2}] +"AlwaysLoadLocal"="1" +"PortSupplier"="{BDC2218C-D50C-4A5A-A2F6-66BDC94FF8D6}" +"Name"="BlackBerry Native SDK Debug Engine" +"CallstackBP"=dword:00000001 +"AutoSelectPriority"=dword:00000004 +"AddressBP"=dword:00000000 +"Attach"=dword:00000001 +"ProgramProvider"="{AD06FD46-C790-4D5C-A274-8815DF9511B8}" +"CLSID"="{904AA6E0-942C-4D11-9094-7BAAEB3EE4B9}" +@="guidDebuggingSampleEngine" + +[#DebuggerRegistryRoot#\Microsoft\VisualStudio\#VSVersion#\AD7Metrics\Engine\{E5A37609-2F43-4830-AA85-D94CFA035DD2}\IncompatibleList] +"guidScriptEng"="{F200A7E7-DEA5-11D0-B854-00A0244A1DE2}" +"guidNativeOnlyEng"="{449EC4CC-30D2-4032-9256-EE18EB41B62B}" +"guidCOMPlusOnlyEng"="{449EC4CC-30D2-4032-9256-EE18EB41B62B}" +"guidCOMPlusNativeEng"="{92EF0900-2251-11D2-B72E-0000F87572EF}" + +[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\#VSVersion#\CLSID\{AD06FD46-C790-4D5C-A274-8815DF9511B8}] +"CodeBase"="#PluginPath#\\BlackBerry.DebugEngine.dll" +"InprocServer32"="C:\\Windows\\System32\\mscoree.dll" +"Class"="BlackBerry.DebugEngine.AD7ProgramProvider" +"Assembly"="BlackBerry.DebugEngine" + +[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\#VSVersion#\CLSID\{904AA6E0-942C-4D11-9094-7BAAEB3EE4B9}] +"CodeBase"="#PluginPath#\\BlackBerry.DebugEngine.dll" +"Assembly"="BlackBerry.DebugEngine" +"Class"="BlackBerry.DebugEngine.AD7Engine" +"InprocServer32"="C:\\Windows\\System32\\mscoree.dll" + +[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\#VSVersion#\AD7Metrics\Engine\{E5A37609-2F43-4830-AA85-D94CFA035DD2}] +"Attach"=dword:00000001 +"ProgramProvider"="{AD06FD46-C790-4D5C-A274-8815DF9511B8}" +"CLSID"="{904AA6E0-942C-4D11-9094-7BAAEB3EE4B9}" +@="guidDebuggingSampleEngine" +"AlwaysLoadLocal"="1" +"AutoSelectPriority"=dword:00000004 +"PortSupplier"="{92A2B753-00BD-40FF-9964-6AB64A1D6C9F}" +"Name"="BlackBerry Native SDK Debug Engine" +"CallstackBP"=dword:00000001 +"AddressBP"=dword:00000000 + +[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\#VSVersion#\AD7Metrics\Engine\{E5A37609-2F43-4830-AA85-D94CFA035DD2}\IncompatibleList] +"guidNativeOnlyEng"="{449EC4CC-30D2-4032-9256-EE18EB41B62B}" +"guidCOMPlusOnlyEng"="{449EC4CC-30D2-4032-9256-EE18EB41B62B}" +"guidScriptEng"="{F200A7E7-DEA5-11D0-B854-00A0244A1DE2}" +"guidCOMPlusNativeEng"="{92EF0900-2251-11D2-B72E-0000F87572EF}" diff --git a/setup_uninstall.template b/setup_uninstall.template new file mode 100644 index 00000000..2fd34696 --- /dev/null +++ b/setup_uninstall.template @@ -0,0 +1,43 @@ +REGEDIT4 + +[-HKEY_CURRENT_USER\SOFTWARE\BlackBerry\#PluginRegistryNodeName#] + +[-HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\AD7Metrics\Engine\{E5A37609-2F43-4830-AA85-D94CFA035DD2}\IncompatibleList] + +[-HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\AD7Metrics\Engine\{E5A37609-2F43-4830-AA85-D94CFA035DD2}] + +[-HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\#VSVersion#\CLSID\{AD06FD46-C790-4D5C-A274-8815DF9511B8}] + +[-HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\#VSVersion#\CLSID\{904AA6E0-942C-4D11-9094-7BAAEB3EE4B9}] + +[-HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\#VSVersion#\CLSID\{BDC2218C-D50C-4A5A-A2F6-66BDC94FF8D6}] + +[-HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\#VSVersion#\AD7Metrics\PortSupplier\{92A2B753-00BD-40FF-9964-6AB64A1D6C9F}] + +[-HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\#VSVersion#\AD7Metrics\Engine\{E5A37609-2F43-4830-AA85-D94CFA035DD2}\IncompatibleList] + +[-HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\#VSVersion#\AD7Metrics\Engine\{E5A37609-2F43-4830-AA85-D94CFA035DD2}] + +[-HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\AD7Metrics\Engine\{E5A37609-2F43-4830-AA85-D94CFA035DD2}\IncompatibleList] + +[-HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\AD7Metrics\Engine\{E5A37609-2F43-4830-AA85-D94CFA035DD2}] + +[-HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\#VSVersion#\CLSID\{AD06FD46-C790-4D5C-A274-8815DF9511B8}] + +[-HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\#VSVersion#\CLSID\{904AA6E0-942C-4D11-9094-7BAAEB3EE4B9}] + +[-HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\#VSVersion#\CLSID\{BDC2218C-D50C-4A5A-A2F6-66BDC94FF8D6}] + +[-HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\#VSVersion#\AD7Metrics\PortSupplier\{92A2B753-00BD-40FF-9964-6AB64A1D6C9F}] + +[-HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\#VSVersion#\AD7Metrics\Engine\{E5A37609-2F43-4830-AA85-D94CFA035DD2}\IncompatibleList] + +[-HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\#VSVersion#\AD7Metrics\Engine\{E5A37609-2F43-4830-AA85-D94CFA035DD2}] + +[-HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\#VSVersion#\CLSID\{AD06FD46-C790-4D5C-A274-8815DF9511B8}] + +[-HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\#VSVersion#\CLSID\{904AA6E0-942C-4D11-9094-7BAAEB3EE4B9}] + +[-HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\#VSVersion#\AD7Metrics\Engine\{E5A37609-2F43-4830-AA85-D94CFA035DD2}\IncompatibleList] + +[-HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\#VSVersion#\AD7Metrics\Engine\{E5A37609-2F43-4830-AA85-D94CFA035DD2}] From d280e0d9b6472f7ca0fb5c3c213bf369282209a4 Mon Sep 17 00:00:00 2001 From: Pawel Hofman Date: Thu, 10 Jul 2014 01:33:46 +0200 Subject: [PATCH 365/851] Added request for parsing list of processes --- .../NativeCore/BlackBerry.NativeCore.csproj | 7 ++ src_vs2010/UnitTests/UnitTests.csproj | 3 + .../NativeCore/BlackBerry.NativeCore.csproj | 2 + src_vs2012/NativeCore/ConfigDefaults.cs | 6 + src_vs2012/NativeCore/Debugger/CliRequest.cs | 2 +- .../NativeCore/Debugger/Model/ProcessInfo.cs | 38 ++++++ src_vs2012/NativeCore/Debugger/Request.cs | 19 ++- .../NativeCore/Debugger/RequestGroup.cs | 2 +- .../Debugger/Requests/ProcessListRequest.cs | 112 ++++++++++++++++++ .../NativeCore/Debugger/RequestsFactory.cs | 22 +++- src_vs2012/UnitTests/ResponseParsingTests.cs | 32 +++++ src_vs2012/UnitTests/UnitTests.csproj | 1 + .../NativeCore/BlackBerry.NativeCore.csproj | 6 + src_vs2013/UnitTests/UnitTests.csproj | 3 + 14 files changed, 250 insertions(+), 5 deletions(-) create mode 100644 src_vs2012/NativeCore/Debugger/Model/ProcessInfo.cs create mode 100644 src_vs2012/NativeCore/Debugger/Requests/ProcessListRequest.cs create mode 100644 src_vs2012/UnitTests/ResponseParsingTests.cs diff --git a/src_vs2010/NativeCore/BlackBerry.NativeCore.csproj b/src_vs2010/NativeCore/BlackBerry.NativeCore.csproj index 47f693d2..3ec5aa30 100644 --- a/src_vs2010/NativeCore/BlackBerry.NativeCore.csproj +++ b/src_vs2010/NativeCore/BlackBerry.NativeCore.csproj @@ -80,6 +80,9 @@ Debugger\InstructionCollection.cs + + Debugger\Model\ProcessInfo.cs + Debugger\Request.cs @@ -89,6 +92,9 @@ Debugger\RequestsFactory.cs + + Debugger\Requests\ProcessListRequest.cs + Debugger\Response.cs @@ -260,6 +266,7 @@ Resources\Instructions.txt + - + + + + - + + - + public abstract class BaseViewItem : INotifyPropertyChanged { + private bool _isSelected; private bool _isExpanded; private bool _isLoading; + private ImageSource _imageSource; + private object _content; - protected static readonly BaseViewItem ExpandPlaceholder = new ProgressViewItem("X-X-X"); + protected static readonly BaseViewItem ExpandPlaceholder = new ProgressViewItem(null, "X-X-X"); /// /// Default constructor. /// - public BaseViewItem() + public BaseViewItem(TargetNavigatorViewModel viewModel) { + ViewModel = viewModel; Children = new ObservableCollection(); } #region Properties - public abstract string Name + public TargetNavigatorViewModel ViewModel { get; + private set; } - public abstract ImageSource ImageSource + public abstract string Name { get; } + public ImageSource ImageSource + { + get { return _imageSource; } + set + { + if (_imageSource != value) + { + _imageSource = value; + NotifyPropertyChanged("ImageSource"); + } + } + } + public ObservableCollection Children { get; @@ -67,6 +85,37 @@ public bool IsExpanded } } + public bool IsSelected + { + get { return _isSelected; } + set + { + if (_isSelected != value) + { + _isSelected = value; + NotifyPropertyChanged("IsSelected"); + if (value) + { + ViewModel.SelectedItem = this; + Selected(); + } + } + } + } + + public object Content + { + get { return _content; } + set + { + if (_content != value) + { + _content = value; + NotifyPropertyChanged("Content"); + } + } + } + #endregion protected void AddExpandablePlaceholder() @@ -99,29 +148,45 @@ public void Collapse() private void InternalLoadItems(object state) { - LoadItems(); + try + { + LoadItems(); + } + catch (Exception ex) + { + // to make sure, all async loads always 'complete', when exception crashed them... + OnItemsLoaded(new BaseViewItem[] { new MessageViewItem(ViewModel, ex) }); + } } /// /// Method called after asynchronous items were loaded to populate them to the UI. /// protected void OnItemsLoaded(BaseViewItem[] items) + { + OnItemsLoaded(items, null); + } + + /// + /// Method called after asynchronous items were loaded to populate them to the UI. + /// + protected void OnItemsLoaded(BaseViewItem[] items, object state) { var dispatcher = Application.Current.Dispatcher; if (dispatcher == null || dispatcher.CheckAccess()) { - InternalRefreshItemsLoaded(items); + InternalRefreshItemsLoaded(items, state); } else { - dispatcher.BeginInvoke(DispatcherPriority.Background, new Action(InternalRefreshItemsLoaded), items); + dispatcher.BeginInvoke(DispatcherPriority.Background, new Action(InternalRefreshItemsLoaded), items, state); } } /// /// Refreshes the collection of child-items. Since it automatically fires the collection-changed events, it should be only called from the UI thread. /// - private void InternalRefreshItemsLoaded(BaseViewItem[] items) + private void InternalRefreshItemsLoaded(BaseViewItem[] items, object state) { Children.Clear(); @@ -142,25 +207,64 @@ private void InternalRefreshItemsLoaded(BaseViewItem[] items) } } + ItemsCompleted(state); _isLoading = false; } protected virtual BaseViewItem CreateProgressPlaceholder() { - return new ProgressViewItem("Loading..."); + return new ProgressViewItem(ViewModel, "Loading..."); } protected virtual BaseViewItem CreateErrorPlaceholder() { - return new ProgressViewItem("Failed to list items"); + return new ProgressViewItem(ViewModel, "Failed to list items"); } + /// + /// Method invoked on background thread to list children of this item. + /// It can take as much time as needed. The progress indicator is returned by CreateProgressPlaceholder() call. + /// protected virtual void LoadItems() { // by default display empty list: OnItemsLoaded(new BaseViewItem[0]); } + /// + /// Invoked on UI thread, when all items have been populated. + /// + protected virtual void ItemsCompleted(object state) + { + } + + /// + /// Invoked on UI thread, when current ViewItem has been selected. + /// + protected virtual void Selected() + { + } + + /// + /// Updates the Content property from any thread. + /// + protected void UpdateContent(object content) + { + if (Application.Current.Dispatcher.CheckAccess()) + { + InternalUpdateContent(content); + } + else + { + Application.Current.Dispatcher.BeginInvoke(DispatcherPriority.Background, new Action(InternalUpdateContent), content); + } + } + + private void InternalUpdateContent(object content) + { + Content = content; + } + #region INotifyPropertyChanged Implementation public event PropertyChangedEventHandler PropertyChanged; diff --git a/src_vs2012/Package/ToolWindows/ViewModel/FileSystemViewItem.cs b/src_vs2012/Package/ToolWindows/ViewModel/FileSystemViewItem.cs index 2c834e4d..ad96c024 100644 --- a/src_vs2012/Package/ToolWindows/ViewModel/FileSystemViewItem.cs +++ b/src_vs2012/Package/ToolWindows/ViewModel/FileSystemViewItem.cs @@ -1,6 +1,5 @@ using System; using System.Collections.Generic; -using System.Windows.Media; using BlackBerry.NativeCore.QConn.Model; using BlackBerry.NativeCore.QConn.Services; @@ -12,7 +11,8 @@ public sealed class FileSystemViewItem : BaseViewItem private readonly TargetServiceFile _service; private readonly Predicate _filter; - public FileSystemViewItem(string name, TargetServiceFile service, string path, Predicate filter) + public FileSystemViewItem(TargetNavigatorViewModel viewModel, string name, TargetServiceFile service, string path, Predicate filter) + : base(viewModel) { if (string.IsNullOrEmpty(name)) throw new ArgumentNullException("name"); @@ -24,6 +24,7 @@ public FileSystemViewItem(string name, TargetServiceFile service, string path, P Path = string.IsNullOrEmpty(path) ? "/" : path; _filter = filter; + ImageSource = ViewModel.GetIconForFolder(false); AddExpandablePlaceholder(); } @@ -34,11 +35,6 @@ public override string Name get { return _name; } } - public override ImageSource ImageSource - { - get { return null; } - } - public string Path { get; @@ -56,23 +52,33 @@ protected override void LoadItems() var path = _service.Stat(Path); if (path == null) { - items = new BaseViewItem[] { new MessageViewItem("Invalid path, reload the parent folder to check if not deleted") }; + items = new BaseViewItem[] { new MessageViewItem(ViewModel, "Invalid path, reload the parent folder to check if not deleted") }; } else { - items = ListItems(_service, path, _filter); + items = ListItems(ViewModel, _service, path, _filter); } } catch (Exception ex) { - items = new BaseViewItem[] { new MessageViewItem(ex) }; + items = new BaseViewItem[] { new MessageViewItem(ViewModel, ex) }; } OnItemsLoaded(items); } - internal static BaseViewItem[] ListItems(TargetServiceFile service, TargetFile path, Predicate filter) + /// + /// Method to list synchronously content of the folder. + /// + internal static BaseViewItem[] ListItems(TargetNavigatorViewModel viewModel, TargetServiceFile service, TargetFile path, Predicate filter) { + if (viewModel == null) + throw new ArgumentNullException("viewModel"); + if (service == null) + throw new ArgumentNullException("service"); + if (path == null) + throw new ArgumentNullException("path"); + BaseViewItem[] items; // we need to lock on that service here, not to allow the user to expand two nodes at the same time @@ -89,7 +95,7 @@ internal static BaseViewItem[] ListItems(TargetServiceFile service, TargetFile p items = new BaseViewItem[files.Length]; for (int i = 0; i < files.Length; i++) { - items[i] = new FileViewItem(service, files[i], filter); + items[i] = new FileViewItem(viewModel, service, files[i], filter); } } else @@ -100,7 +106,7 @@ internal static BaseViewItem[] ListItems(TargetServiceFile service, TargetFile p { if (filter(file)) { - filtered.Add(new FileViewItem(service, file, filter)); + filtered.Add(new FileViewItem(viewModel, service, file, filter)); } } items = filtered.ToArray(); @@ -108,7 +114,7 @@ internal static BaseViewItem[] ListItems(TargetServiceFile service, TargetFile p } catch (Exception ex) { - items = new BaseViewItem[] { new MessageViewItem(ex) }; + items = new BaseViewItem[] { new MessageViewItem(viewModel, ex) }; } } diff --git a/src_vs2012/Package/ToolWindows/ViewModel/FileViewItem.cs b/src_vs2012/Package/ToolWindows/ViewModel/FileViewItem.cs index 433a006a..49581074 100644 --- a/src_vs2012/Package/ToolWindows/ViewModel/FileViewItem.cs +++ b/src_vs2012/Package/ToolWindows/ViewModel/FileViewItem.cs @@ -1,18 +1,19 @@ using System; -using System.Collections.Generic; -using System.Windows.Media; +using System.Text; using BlackBerry.NativeCore.QConn.Model; using BlackBerry.NativeCore.QConn.Services; +using BlackBerry.NativeCore.QConn.Visitors; namespace BlackBerry.Package.ToolWindows.ViewModel { public class FileViewItem : BaseViewItem { private readonly TargetServiceFile _service; - private readonly TargetFile _path; + private TargetFile _path; private readonly Predicate _filter; - public FileViewItem(TargetServiceFile service, TargetFile path, Predicate filter) + public FileViewItem(TargetNavigatorViewModel viewModel, TargetServiceFile service, TargetFile path, Predicate filter) + : base(viewModel) { if (service == null) throw new ArgumentNullException("service"); @@ -25,8 +26,13 @@ public FileViewItem(TargetServiceFile service, TargetFile path, Predicate + /// Converter class to help hide UI items with 'null' value. + /// + public sealed class NullToVisibilityConverter : IValueConverter + { + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + return value == null ? Visibility.Collapsed : Visibility.Visible; + } + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + throw new NotImplementedException(); + } + } +} diff --git a/src_vs2012/Package/ToolWindows/ViewModel/ProcessListViewItem.cs b/src_vs2012/Package/ToolWindows/ViewModel/ProcessListViewItem.cs index 3c4655aa..cf99ba2b 100644 --- a/src_vs2012/Package/ToolWindows/ViewModel/ProcessListViewItem.cs +++ b/src_vs2012/Package/ToolWindows/ViewModel/ProcessListViewItem.cs @@ -1,17 +1,18 @@ using System; -using System.Windows.Media; using BlackBerry.NativeCore.QConn.Services; namespace BlackBerry.Package.ToolWindows.ViewModel { public sealed class ProcessListViewItem : BaseViewItem { - public ProcessListViewItem(TargetServiceSysInfo service) + public ProcessListViewItem(TargetNavigatorViewModel viewModel, TargetServiceSysInfo service) + : base(viewModel) { if (service == null) throw new ArgumentNullException("service"); Service = service; + ImageSource = ViewModel.GetIconForFolder(false); AddExpandablePlaceholder(); } @@ -22,11 +23,6 @@ public override string Name get { return "Processes"; } } - public override ImageSource ImageSource - { - get { return null; } - } - public TargetServiceSysInfo Service { get; @@ -46,12 +42,12 @@ protected override void LoadItems() items = new BaseViewItem[processes.Length]; for (int i = 0; i < processes.Length; i++) { - items[i] = new ProcessViewItem(processes[i]); + items[i] = new ProcessViewItem(ViewModel, processes[i]); } } catch (Exception ex) { - items = new BaseViewItem[] { new MessageViewItem(ex) }; + items = new BaseViewItem[] { new MessageViewItem(ViewModel, ex) }; } OnItemsLoaded(items); diff --git a/src_vs2012/Package/ToolWindows/ViewModel/ProcessViewItem.cs b/src_vs2012/Package/ToolWindows/ViewModel/ProcessViewItem.cs index 8359f04b..a8e8c4b6 100644 --- a/src_vs2012/Package/ToolWindows/ViewModel/ProcessViewItem.cs +++ b/src_vs2012/Package/ToolWindows/ViewModel/ProcessViewItem.cs @@ -1,5 +1,4 @@ using System; -using System.Windows.Media; using BlackBerry.NativeCore.QConn.Model; namespace BlackBerry.Package.ToolWindows.ViewModel @@ -11,12 +10,14 @@ public sealed class ProcessViewItem : BaseViewItem /// /// Init constructor. /// - public ProcessViewItem(SystemInfoProcess process) + public ProcessViewItem(TargetNavigatorViewModel viewModel, SystemInfoProcess process) + : base(viewModel) { if (process == null) throw new ArgumentNullException("process"); _process = process; + ImageSource = ViewModel.GetIconForProcess(); } #region Properties @@ -26,11 +27,6 @@ public override string Name get { return _process.ExecutablePath; } } - public override ImageSource ImageSource - { - get { return null; } - } - #endregion } } diff --git a/src_vs2012/Package/ToolWindows/ViewModel/ProgressViewItem.cs b/src_vs2012/Package/ToolWindows/ViewModel/ProgressViewItem.cs index e64f6710..9f1e99d7 100644 --- a/src_vs2012/Package/ToolWindows/ViewModel/ProgressViewItem.cs +++ b/src_vs2012/Package/ToolWindows/ViewModel/ProgressViewItem.cs @@ -1,5 +1,4 @@ using System; -using System.Windows.Media; namespace BlackBerry.Package.ToolWindows.ViewModel { @@ -7,7 +6,8 @@ public sealed class ProgressViewItem : BaseViewItem { private readonly string _title; - public ProgressViewItem(string title) + public ProgressViewItem(TargetNavigatorViewModel viewModel, string title) + : base(viewModel) { if (string.IsNullOrEmpty(title)) throw new ArgumentNullException("title"); @@ -22,11 +22,6 @@ public override string Name get { return _title; } } - public override ImageSource ImageSource - { - get { return null; } - } - #endregion } } diff --git a/src_vs2012/Package/ToolWindows/ViewModel/TargetNavigatorViewModel.cs b/src_vs2012/Package/ToolWindows/ViewModel/TargetNavigatorViewModel.cs index a9357b90..e47573ed 100644 --- a/src_vs2012/Package/ToolWindows/ViewModel/TargetNavigatorViewModel.cs +++ b/src_vs2012/Package/ToolWindows/ViewModel/TargetNavigatorViewModel.cs @@ -1,4 +1,10 @@ -using System.Collections.ObjectModel; +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.IO; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using BlackBerry.Package.Helpers; using BlackBerry.Package.ViewModels; namespace BlackBerry.Package.ToolWindows.ViewModel @@ -8,13 +14,17 @@ namespace BlackBerry.Package.ToolWindows.ViewModel /// public sealed class TargetNavigatorViewModel { + private readonly Dictionary _iconCache; + public TargetNavigatorViewModel() { + _iconCache = new Dictionary(); + // initialize target devices: Targets = new ObservableCollection(); foreach (var target in PackageViewModel.Instance.TargetDevices) { - Targets.Add(new TargetViewItem(target)); + Targets.Add(new TargetViewItem(this, target)); } } @@ -26,6 +36,73 @@ public ObservableCollection Targets private set; } + public BaseViewItem SelectedItem + { + get; + set; + } + #endregion + + public ImageSource GetIconForTarget(bool connected) + { + return GetIcon(connected ? "target.png" : "target_disconnected.png"); + } + + public ImageSource GetIconForFolder(bool opened) + { + return GetIcon(opened ? "folder_opened.png" : "folder_closed.png"); + } + + public ImageSource GetIconForFile(string name) + { + string extension = string.IsNullOrEmpty(name) ? ".txt" : Path.GetExtension(name); + if (string.IsNullOrEmpty(extension)) + extension = ".txt"; + + // extensions must have start with a dot! + if (extension[0] != '.') + throw new ArgumentOutOfRangeException("name"); + + return GetIcon(extension); + } + + public ImageSource GetIconForProcess() + { + return GetIcon("process.png"); + } + + public ImageSource GetIconForThread() + { + return GetIcon("thread.png"); + } + + private ImageSource GetIcon(string name) + { + if (string.IsNullOrEmpty(name)) + throw new ArgumentNullException("name"); + + ImageSource result; + + // check if cached: + if (_iconCache.TryGetValue(name, out result)) + return result; + + // check if looking for a matching image for any file: + if (name[0] == '.') + { + result = IconHelper.GetIcon(name, true, false, false); // load system-shell image for specified extension + } + else + { + // or dedicated item image: + result = new BitmapImage(new Uri("pack://application:,,,/BlackBerry.Package;component/Resources/Navigator/" + name)); + result.Freeze(); + } + + // cache it and done: + _iconCache[name] = result; + return result; + } } } diff --git a/src_vs2012/Package/ToolWindows/ViewModel/TargetViewItem.cs b/src_vs2012/Package/ToolWindows/ViewModel/TargetViewItem.cs index 0ea5e7d8..e4f28071 100644 --- a/src_vs2012/Package/ToolWindows/ViewModel/TargetViewItem.cs +++ b/src_vs2012/Package/ToolWindows/ViewModel/TargetViewItem.cs @@ -1,5 +1,4 @@ using System; -using System.Windows.Media; using BlackBerry.NativeCore.Components; using BlackBerry.NativeCore.Model; @@ -7,12 +6,14 @@ namespace BlackBerry.Package.ToolWindows.ViewModel { public sealed class TargetViewItem : BaseViewItem { - public TargetViewItem(DeviceDefinition device) + public TargetViewItem(TargetNavigatorViewModel viewModel, DeviceDefinition device) + : base(viewModel) { if (device == null) throw new ArgumentNullException("device"); Device = device; + ImageSource = ViewModel.GetIconForTarget(false); AddExpandablePlaceholder(); } @@ -29,18 +30,13 @@ public override string Name get { return Device.ShortName; } } - public override ImageSource ImageSource - { - get { return null; } - } - #endregion #region Overrides protected override BaseViewItem CreateProgressPlaceholder() { - return new ProgressViewItem("Connecting..."); + return new ProgressViewItem(ViewModel, "Connecting..."); } protected override void LoadItems() @@ -64,11 +60,11 @@ private void OnDeviceStatusChanged(object sender, TargetConnectionEventArgs e) case TargetStatus.Connected: items = new BaseViewItem[] { - new ProcessListViewItem(e.Client.SysInfoService), - new FileSystemViewItem("Sandboxes", e.Client.FileService, "/accounts/1000/appdata", file => !file.NoAccess), - new FileSystemViewItem("Shared", e.Client.FileService, "/accounts/1000/shared", null), - new FileSystemViewItem("Developer", e.Client.FileService, "/accounts/devuser", null), - new FileSystemViewItem("System", e.Client.FileService, null, null) + new ProcessListViewItem(ViewModel, e.Client.SysInfoService), + new FileSystemViewItem(ViewModel, "Sandboxes", e.Client.FileService, "/accounts/1000/appdata", file => !file.NoAccess), + new FileSystemViewItem(ViewModel, "Shared", e.Client.FileService, "/accounts/1000/shared", null), + new FileSystemViewItem(ViewModel, "Developer", e.Client.FileService, "/accounts/devuser", null), + new FileSystemViewItem(ViewModel, "System", e.Client.FileService, null, null) }; break; case TargetStatus.Disconnected: @@ -78,18 +74,28 @@ private void OnDeviceStatusChanged(object sender, TargetConnectionEventArgs e) case TargetStatus.Failed: items = new BaseViewItem[] { - new MessageViewItem(e.Message) + new MessageViewItem(ViewModel, e.Message) }; break; default: items = new BaseViewItem[] { - new MessageViewItem(string.Concat("Unsupported device state (", e.Status, ")")) + new MessageViewItem(ViewModel, string.Concat("Unsupported device state (", e.Status, ")")) }; break; } - OnItemsLoaded(items); + OnItemsLoaded(items, e); + } + + protected override void ItemsCompleted(object state) + { + var e = state as TargetConnectionEventArgs; + + if (e != null) + { + ImageSource = ViewModel.GetIconForTarget(e.Status == TargetStatus.Connected); + } } #endregion From 8a287d8877555a53d249895711794ce80705c3e1 Mon Sep 17 00:00:00 2001 From: Pawel Hofman Date: Mon, 15 Sep 2014 10:40:45 +0200 Subject: [PATCH 505/851] Moved some 'common' WPF components into one folder --- src_vs2012/Package/BlackBerry.Package.csproj | 2 +- .../Common/NullToVisibilityConverter.cs} | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename src_vs2012/Package/{ToolWindows/ViewModel/NullToVisibilityIndicator.cs => ViewModels/Common/NullToVisibilityConverter.cs} (100%) diff --git a/src_vs2012/Package/BlackBerry.Package.csproj b/src_vs2012/Package/BlackBerry.Package.csproj index 35728b07..9dbdaa7f 100644 --- a/src_vs2012/Package/BlackBerry.Package.csproj +++ b/src_vs2012/Package/BlackBerry.Package.csproj @@ -330,7 +330,6 @@ - @@ -343,6 +342,7 @@ + diff --git a/src_vs2012/Package/ToolWindows/ViewModel/NullToVisibilityIndicator.cs b/src_vs2012/Package/ViewModels/Common/NullToVisibilityConverter.cs similarity index 100% rename from src_vs2012/Package/ToolWindows/ViewModel/NullToVisibilityIndicator.cs rename to src_vs2012/Package/ViewModels/Common/NullToVisibilityConverter.cs From 22e4a77632d4a64ab1d53bd314118e6e51946907 Mon Sep 17 00:00:00 2001 From: Pawel Hofman Date: Mon, 15 Sep 2014 14:56:23 +0200 Subject: [PATCH 506/851] Added Extension property to TargetFile --- src_vs2012/NativeCore/QConn/Model/TargetFile.cs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src_vs2012/NativeCore/QConn/Model/TargetFile.cs b/src_vs2012/NativeCore/QConn/Model/TargetFile.cs index c46620f1..6be9e6c2 100644 --- a/src_vs2012/NativeCore/QConn/Model/TargetFile.cs +++ b/src_vs2012/NativeCore/QConn/Model/TargetFile.cs @@ -41,6 +41,8 @@ public TargetFile(uint mode, ulong size, uint flags, string path) CreationTime = DateTime.MinValue; Path = path; Name = PathHelper.ExtractName(path); + Extension = System.IO.Path.GetExtension(Name); + UpdateFormatting(); UpdateAccess(); } @@ -58,6 +60,7 @@ public TargetFile(string path, string name) NoAccess = true; Path = path; Name = string.IsNullOrEmpty(name) ? PathHelper.ExtractName(path) : name; + Extension = System.IO.Path.GetExtension(Name); UpdateFormatting(); } @@ -72,6 +75,7 @@ public TargetFile(FileSystemInfo info) Path = info.FullName; Name = info.Name; + Extension = info.Extension; if (info.Exists) { @@ -164,6 +168,12 @@ public string Name private set; } + public string Extension + { + get; + private set; + } + public bool IsFile { get { return Type == TypeRegularFile; } From f1da5aca0d5dc9c9d3a2b322ff12f954379a292a Mon Sep 17 00:00:00 2001 From: Pawel Hofman Date: Mon, 15 Sep 2014 14:56:45 +0200 Subject: [PATCH 507/851] Returning Source file next to Data buffer --- .../NativeCore/QConn/Visitors/BufferVisitor.cs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src_vs2012/NativeCore/QConn/Visitors/BufferVisitor.cs b/src_vs2012/NativeCore/QConn/Visitors/BufferVisitor.cs index efcc5a9d..1d39799b 100644 --- a/src_vs2012/NativeCore/QConn/Visitors/BufferVisitor.cs +++ b/src_vs2012/NativeCore/QConn/Visitors/BufferVisitor.cs @@ -36,6 +36,22 @@ public Tuple[] Buffers private set; } + /// + /// Gets the source file name of the first item. + /// + public TargetFile Source + { + get + { + if (Buffers.Length > 0) + { + return Buffers[0].Item1; + } + + return null; + } + } + /// /// Gets the buffer value of the first item. /// From aebb66b4b04596b3dea3f3742c8b4ecc41189862 Mon Sep 17 00:00:00 2001 From: Pawel Hofman Date: Mon, 15 Sep 2014 15:12:15 +0200 Subject: [PATCH 508/851] Improved Target Navigator UI It can now dynamically distinguish between string/image/process/folder/binary content and choose preview respectively. --- src_vs2012/Package/BlackBerry.Package.csproj | 6 + .../ToolWindows/TargetNavigatorControl.xaml | 102 +++++++++++++++-- .../ToolWindows/ViewModel/BaseViewItem.cs | 11 +- .../ViewModel/FileSystemViewItem.cs | 20 +++- .../ToolWindows/ViewModel/FileViewItem.cs | 108 +++++++++++++++++- .../ToolWindows/ViewModel/ProcessViewItem.cs | 16 +++ .../ToolWindows/ViewModel/TargetViewItem.cs | 2 +- .../Common/BinaryToStringConverter.cs | 63 ++++++++++ .../Common/ContentTemplateSelector.cs | 95 +++++++++++++++ .../Common/NullToVisibilityConverter.cs | 2 +- 10 files changed, 400 insertions(+), 25 deletions(-) create mode 100644 src_vs2012/Package/ViewModels/Common/BinaryToStringConverter.cs create mode 100644 src_vs2012/Package/ViewModels/Common/ContentTemplateSelector.cs diff --git a/src_vs2012/Package/BlackBerry.Package.csproj b/src_vs2012/Package/BlackBerry.Package.csproj index 9dbdaa7f..22c971f0 100644 --- a/src_vs2012/Package/BlackBerry.Package.csproj +++ b/src_vs2012/Package/BlackBerry.Package.csproj @@ -342,6 +342,12 @@ + + Code + + + Code + diff --git a/src_vs2012/Package/ToolWindows/TargetNavigatorControl.xaml b/src_vs2012/Package/ToolWindows/TargetNavigatorControl.xaml index b2a7c10b..5e25a127 100644 --- a/src_vs2012/Package/ToolWindows/TargetNavigatorControl.xaml +++ b/src_vs2012/Package/ToolWindows/TargetNavigatorControl.xaml @@ -4,17 +4,100 @@ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:local="clr-namespace:BlackBerry.Package.ToolWindows.ViewModel" + xmlns:common="clr-namespace:BlackBerry.Package.ViewModels.Common" mc:Ignorable="d" d:DesignHeight="300" d:DesignWidth="300"> - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + @@ -27,7 +110,7 @@ -