From 1e44ec84bd90ec9078027d1d9d78e83c7d305f2a Mon Sep 17 00:00:00 2001 From: BlueWall Date: Tue, 31 Aug 2010 17:02:36 -0400 Subject: Build system upgrade: Upgrading Prebuild.exe to correctly construct build solutions for crossplatform tools such as xbuild, monodevelop and nant. NOTE: Module prebuild files will need modification to work, as the prebuild must correctly define the reference path for all assemblies shipped in the OpenSimulator ./bin directory. These include assemblies such as XMLRPC.dll, OpenMetaverse.dll, Nini.dll, etc. . The entries should follow the form: See the distributed prebuild.xml for further examples. Crossplatform tools: xbuild and monodevelop use the vs2008 OpenSim.sln and the .csproj files in each namespace. Changes to the Prebuild.exe are against svn 322 and are included in a patch attached to the mantis. And the dnpb source are available@ svn co https://dnpb.svn.sourceforge.net/svnroot/dnpb dnpb The patches are pending application by the dnpb team. After which, the un-modified upstream Prebuild.exe will work as expected. --- Prebuild/clean.bat | 1 - Prebuild/clean.sh | 1 - Prebuild/doc/prebuild-example1.xml | 300 ---- Prebuild/doc/prebuild-example2.xml | 72 - Prebuild/doc/prebuild-example3.xml | 113 -- Prebuild/doc/prebuild-example4.xml | 715 -------- Prebuild/doc/prebuild-example5.xml | 187 -- Prebuild/prebuild.xml | 73 - Prebuild/scripts/Clean.bat | 2 - Prebuild/scripts/Clean.sh | 4 - Prebuild/scripts/Help.bat | 2 - Prebuild/scripts/MonoDevelop.sh | 2 - Prebuild/scripts/Prebuild.nsi | 231 --- Prebuild/scripts/SharpDevelop.bat | 4 - Prebuild/scripts/SharpDevelop2.bat | 4 - Prebuild/scripts/VS2002.bat | 4 - Prebuild/scripts/VS2003.bat | 4 - Prebuild/scripts/VS2005.bat | 4 - Prebuild/scripts/VS2008.bat | 4 - Prebuild/scripts/autotools.bat | 4 - Prebuild/scripts/autotools.sh | 5 - Prebuild/scripts/makefile.bat | 4 - Prebuild/scripts/makefile.sh | 10 - Prebuild/scripts/nant.bat | 4 - Prebuild/scripts/nant.sh | 2 - Prebuild/scripts/xcode.bat | 4 - Prebuild/scripts/xcode.sh | 2 - Prebuild/src/App.ico | Bin 4286 -> 0 bytes Prebuild/src/Core/Attributes/DataNodeAttribute.cs | 72 - .../src/Core/Attributes/OptionNodeAttribute.cs | 71 - Prebuild/src/Core/Attributes/TargetAttribute.cs | 71 - Prebuild/src/Core/FatalException.cs | 85 - Prebuild/src/Core/Interfaces/IDataNode.cs | 47 - Prebuild/src/Core/Interfaces/ITarget.cs | 51 - Prebuild/src/Core/Kernel.cs | 831 --------- Prebuild/src/Core/Nodes/AuthorNode.cs | 89 - Prebuild/src/Core/Nodes/ConfigurationNode.cs | 178 -- Prebuild/src/Core/Nodes/DataNode.cs | 117 -- Prebuild/src/Core/Nodes/DatabaseProjectNode.cs | 94 -- Prebuild/src/Core/Nodes/DatabaseReferenceNode.cs | 63 - Prebuild/src/Core/Nodes/DescriptionNode.cs | 89 - Prebuild/src/Core/Nodes/ExcludeNode.cs | 89 - Prebuild/src/Core/Nodes/FileNode.cs | 271 --- Prebuild/src/Core/Nodes/FilesNode.cs | 247 --- Prebuild/src/Core/Nodes/MatchNode.cs | 330 ---- Prebuild/src/Core/Nodes/OptionsNode.cs | 644 ------- Prebuild/src/Core/Nodes/ProcessNode.cs | 110 -- Prebuild/src/Core/Nodes/ProjectNode.cs | 580 ------- Prebuild/src/Core/Nodes/ReferenceNode.cs | 144 -- Prebuild/src/Core/Nodes/ReferencePathNode.cs | 99 -- Prebuild/src/Core/Nodes/SolutionNode.cs | 358 ---- Prebuild/src/Core/Parse/IfContext.cs | 154 -- Prebuild/src/Core/Parse/Preprocessor.cs | 663 -------- Prebuild/src/Core/Targets/AutotoolsTarget.cs | 1782 -------------------- Prebuild/src/Core/Targets/DebugTarget.cs | 102 -- Prebuild/src/Core/Targets/MakefileTarget.cs | 471 ------ Prebuild/src/Core/Targets/MonoDevelopTarget.cs | 464 ----- Prebuild/src/Core/Targets/NAntTarget.cs | 738 -------- Prebuild/src/Core/Targets/SharpDevelop2Target.cs | 82 - Prebuild/src/Core/Targets/SharpDevelopTarget.cs | 428 ----- Prebuild/src/Core/Targets/ToolInfo.cs | 197 --- Prebuild/src/Core/Targets/VS2002Target.cs | 87 - Prebuild/src/Core/Targets/VS2003Target.cs | 602 ------- Prebuild/src/Core/Targets/VS2005Target.cs | 149 -- Prebuild/src/Core/Targets/VS2008Target.cs | 132 -- Prebuild/src/Core/Targets/VS2010Target.cs | 134 -- Prebuild/src/Core/Targets/VSGenericTarget.cs | 887 ---------- Prebuild/src/Core/Targets/VSVersion.cs | 54 - Prebuild/src/Core/Targets/XcodeTarget.cs | 596 ------- Prebuild/src/Core/UnknownLanguageException.cs | 63 - .../src/Core/Utilities/CommandLineCollection.cs | 153 -- Prebuild/src/Core/Utilities/CurrentDirectory.cs | 80 - Prebuild/src/Core/Utilities/Helper.cs | 654 ------- Prebuild/src/Core/Utilities/Log.cs | 270 --- Prebuild/src/Core/WarningException.cs | 84 - Prebuild/src/Prebuild.cs | 165 -- Prebuild/src/Prebuild.snk | Bin 596 -> 0 bytes Prebuild/src/Properties/AssemblyInfo.cs | 112 -- Prebuild/src/data/autotools.xml | 790 --------- Prebuild/src/data/dnpb-1.0.xsd | 183 -- Prebuild/src/data/dnpb-1.1.xsd | 184 -- Prebuild/src/data/dnpb-1.2.xsd | 198 --- Prebuild/src/data/dnpb-1.3.xsd | 206 --- Prebuild/src/data/dnpb-1.4.xsd | 212 --- Prebuild/src/data/dnpb-1.5.xsd | 215 --- Prebuild/src/data/prebuild-1.6.xsd | 231 --- Prebuild/src/data/prebuild-1.7.xsd | 331 ---- Prebuild/tests/Makefile | 24 - Prebuild/tests/README.txt | 5 - Prebuild/tests/include-001.expected | 46 - Prebuild/tests/include-001.include | 33 - Prebuild/tests/include-001.prebuild | 22 - Prebuild/tests/include-002-2.include | 8 - Prebuild/tests/include-002.expected | 26 - Prebuild/tests/include-002.include | 14 - Prebuild/tests/include-002.prebuild | 7 - bin/Prebuild.exe | Bin 237568 -> 227840 bytes prebuild.xml | 1176 ++++++------- runprebuild.sh | 3 - 99 files changed, 560 insertions(+), 19149 deletions(-) delete mode 100755 Prebuild/clean.bat delete mode 100755 Prebuild/clean.sh delete mode 100644 Prebuild/doc/prebuild-example1.xml delete mode 100644 Prebuild/doc/prebuild-example2.xml delete mode 100644 Prebuild/doc/prebuild-example3.xml delete mode 100644 Prebuild/doc/prebuild-example4.xml delete mode 100644 Prebuild/doc/prebuild-example5.xml delete mode 100644 Prebuild/prebuild.xml delete mode 100755 Prebuild/scripts/Clean.bat delete mode 100755 Prebuild/scripts/Clean.sh delete mode 100755 Prebuild/scripts/Help.bat delete mode 100755 Prebuild/scripts/MonoDevelop.sh delete mode 100644 Prebuild/scripts/Prebuild.nsi delete mode 100755 Prebuild/scripts/SharpDevelop.bat delete mode 100755 Prebuild/scripts/SharpDevelop2.bat delete mode 100755 Prebuild/scripts/VS2002.bat delete mode 100755 Prebuild/scripts/VS2003.bat delete mode 100755 Prebuild/scripts/VS2005.bat delete mode 100755 Prebuild/scripts/VS2008.bat delete mode 100755 Prebuild/scripts/autotools.bat delete mode 100755 Prebuild/scripts/autotools.sh delete mode 100755 Prebuild/scripts/makefile.bat delete mode 100755 Prebuild/scripts/makefile.sh delete mode 100755 Prebuild/scripts/nant.bat delete mode 100755 Prebuild/scripts/nant.sh delete mode 100755 Prebuild/scripts/xcode.bat delete mode 100755 Prebuild/scripts/xcode.sh delete mode 100644 Prebuild/src/App.ico delete mode 100644 Prebuild/src/Core/Attributes/DataNodeAttribute.cs delete mode 100644 Prebuild/src/Core/Attributes/OptionNodeAttribute.cs delete mode 100644 Prebuild/src/Core/Attributes/TargetAttribute.cs delete mode 100644 Prebuild/src/Core/FatalException.cs delete mode 100644 Prebuild/src/Core/Interfaces/IDataNode.cs delete mode 100644 Prebuild/src/Core/Interfaces/ITarget.cs delete mode 100644 Prebuild/src/Core/Kernel.cs delete mode 100644 Prebuild/src/Core/Nodes/AuthorNode.cs delete mode 100644 Prebuild/src/Core/Nodes/ConfigurationNode.cs delete mode 100644 Prebuild/src/Core/Nodes/DataNode.cs delete mode 100644 Prebuild/src/Core/Nodes/DatabaseProjectNode.cs delete mode 100644 Prebuild/src/Core/Nodes/DatabaseReferenceNode.cs delete mode 100644 Prebuild/src/Core/Nodes/DescriptionNode.cs delete mode 100644 Prebuild/src/Core/Nodes/ExcludeNode.cs delete mode 100644 Prebuild/src/Core/Nodes/FileNode.cs delete mode 100644 Prebuild/src/Core/Nodes/FilesNode.cs delete mode 100644 Prebuild/src/Core/Nodes/MatchNode.cs delete mode 100644 Prebuild/src/Core/Nodes/OptionsNode.cs delete mode 100644 Prebuild/src/Core/Nodes/ProcessNode.cs delete mode 100644 Prebuild/src/Core/Nodes/ProjectNode.cs delete mode 100644 Prebuild/src/Core/Nodes/ReferenceNode.cs delete mode 100644 Prebuild/src/Core/Nodes/ReferencePathNode.cs delete mode 100644 Prebuild/src/Core/Nodes/SolutionNode.cs delete mode 100644 Prebuild/src/Core/Parse/IfContext.cs delete mode 100644 Prebuild/src/Core/Parse/Preprocessor.cs delete mode 100644 Prebuild/src/Core/Targets/AutotoolsTarget.cs delete mode 100644 Prebuild/src/Core/Targets/DebugTarget.cs delete mode 100644 Prebuild/src/Core/Targets/MakefileTarget.cs delete mode 100644 Prebuild/src/Core/Targets/MonoDevelopTarget.cs delete mode 100644 Prebuild/src/Core/Targets/NAntTarget.cs delete mode 100644 Prebuild/src/Core/Targets/SharpDevelop2Target.cs delete mode 100644 Prebuild/src/Core/Targets/SharpDevelopTarget.cs delete mode 100644 Prebuild/src/Core/Targets/ToolInfo.cs delete mode 100644 Prebuild/src/Core/Targets/VS2002Target.cs delete mode 100644 Prebuild/src/Core/Targets/VS2003Target.cs delete mode 100644 Prebuild/src/Core/Targets/VS2005Target.cs delete mode 100644 Prebuild/src/Core/Targets/VS2008Target.cs delete mode 100644 Prebuild/src/Core/Targets/VS2010Target.cs delete mode 100644 Prebuild/src/Core/Targets/VSGenericTarget.cs delete mode 100644 Prebuild/src/Core/Targets/VSVersion.cs delete mode 100644 Prebuild/src/Core/Targets/XcodeTarget.cs delete mode 100644 Prebuild/src/Core/UnknownLanguageException.cs delete mode 100644 Prebuild/src/Core/Utilities/CommandLineCollection.cs delete mode 100644 Prebuild/src/Core/Utilities/CurrentDirectory.cs delete mode 100644 Prebuild/src/Core/Utilities/Helper.cs delete mode 100644 Prebuild/src/Core/Utilities/Log.cs delete mode 100644 Prebuild/src/Core/WarningException.cs delete mode 100644 Prebuild/src/Prebuild.cs delete mode 100644 Prebuild/src/Prebuild.snk delete mode 100644 Prebuild/src/Properties/AssemblyInfo.cs delete mode 100644 Prebuild/src/data/autotools.xml delete mode 100644 Prebuild/src/data/dnpb-1.0.xsd delete mode 100644 Prebuild/src/data/dnpb-1.1.xsd delete mode 100644 Prebuild/src/data/dnpb-1.2.xsd delete mode 100644 Prebuild/src/data/dnpb-1.3.xsd delete mode 100644 Prebuild/src/data/dnpb-1.4.xsd delete mode 100644 Prebuild/src/data/dnpb-1.5.xsd delete mode 100644 Prebuild/src/data/prebuild-1.6.xsd delete mode 100644 Prebuild/src/data/prebuild-1.7.xsd delete mode 100644 Prebuild/tests/Makefile delete mode 100644 Prebuild/tests/README.txt delete mode 100644 Prebuild/tests/include-001.expected delete mode 100644 Prebuild/tests/include-001.include delete mode 100644 Prebuild/tests/include-001.prebuild delete mode 100644 Prebuild/tests/include-002-2.include delete mode 100644 Prebuild/tests/include-002.expected delete mode 100644 Prebuild/tests/include-002.include delete mode 100644 Prebuild/tests/include-002.prebuild diff --git a/Prebuild/clean.bat b/Prebuild/clean.bat deleted file mode 100755 index 1d71cbf..0000000 --- a/Prebuild/clean.bat +++ /dev/null @@ -1 +0,0 @@ -NAnt.exe clean \ No newline at end of file diff --git a/Prebuild/clean.sh b/Prebuild/clean.sh deleted file mode 100755 index 900b6ed..0000000 --- a/Prebuild/clean.sh +++ /dev/null @@ -1 +0,0 @@ -nant clean diff --git a/Prebuild/doc/prebuild-example1.xml b/Prebuild/doc/prebuild-example1.xml deleted file mode 100644 index a2cee42..0000000 --- a/Prebuild/doc/prebuild-example1.xml +++ /dev/null @@ -1,300 +0,0 @@ - - - - - - TRACE;DEBUG - false - false - false - 4 - false - 1591;219;1573;1572;168 - ..\bin - true - false - true - 285212672 - 4096 - false - Docs.xml - - - - - TRACE - true - false - false - 4 - false - 1591;219;1573;1572;168 - ..\bin - false - false - true - 285212672 - 4096 - false - Docs.xml - - - - - - - ..\bin\lib\Utility - RealmForge.Utility.xml - - - - - ..\bin\lib\Utility - RealmForge.Utility.xml - - - ../bin - - - - - - - - - - - - - - - ..\bin\lib\Framework - RealmForge.Framework.xml - - - - - ..\bin\lib\Framework - RealmForge.Framework.xml - - - ../bin - - - - - - - - - - - - - - - - - - - - - ..\bin\lib\Genres - RealmForge.Genres.xml - - - - - ..\bin\lib\Genres - RealmForge.Genres.xml - - - ../bin - - - - - - - - - - - - - - - - - ..\bin\lib\Forms - RealmForge.UI.Forms.xml - true - - - - - ..\bin\lib\Forms - RealmForge.UI.Forms.xml - true - - - ../bin - - - - - - - - - - - - IDE\Resources\ImagesCaptionIDE.bmp - IDE\Resources\ImagesCaptionPlain.bmp - IDE\Resources\ImagesMenuControl.bmp - IDE\Resources\ImagesPopupMenu.bmp - IDE\Resources\ImagesTabbedGroups.bmp - IDE\Resources\ImagesTabControl.bmp - IDE\Resources\LibraryIcon.ico - IDE\Resources\TabbedInvalid.cur - IDE\Resources\TabbedValid.cur - IDE\Resources\WizardPicture.bmp - Controls\Trees\tv_minus.bmp - Controls\Trees\tv_plus.bmp - Controls\Trees\treeview.bmp - Controls\Trees\listview.bmp - IDE\Menus\MenuControl.bmp - IDE\Controls\InertButton.bmp - IDE\Controls\TabbedGroups.bmp - IDE\Controls\TabCOntrol.bmp - IDE\Controls\WizardControl.bmp - Forms\IDETest.resx - Forms\IDEWindow.resx - Forms\Launcher.resx - Forms\MainRenderFrame.resx - - - - - - - - ..\bin\lib\RAGE - RealmForge.RAGE.xml - - - - - ..\bin\lib\RAGE - RealmForge.RAGE.xml - - - ../bin - ../bin - - - - - - - - - - - - - - - - - - - - - - - - - - - ..\bin\ScriptLibrary - RealmForge.ScriptLibrary.xml - - - - - ..\bin\ScriptLibrary - RealmForge.ScriptLibrary.xml - - - ../bin - - - - - - - - - - - - - - - - - - - - ..\bin\lib\Updater - Updater.xml - - - - - ..\bin\lib\Updater - Updater.xml - - - ../bin - - - - - - - - - - - - - - ..\bin - DemoGame.xml - - - - - ..\bin - DemoGame.xml - - - ../bin - - - - - - - - - - - - - - - diff --git a/Prebuild/doc/prebuild-example2.xml b/Prebuild/doc/prebuild-example2.xml deleted file mode 100644 index bd23c4f..0000000 --- a/Prebuild/doc/prebuild-example2.xml +++ /dev/null @@ -1,72 +0,0 @@ - - - - - - - DEBUG;TRACE;WIN32;NET - - DEBUG;TRACE;POSIX - - false - bin\Debug - true - 1595 - - - - - - TRACE;WIN32;NET - - TRACE;POSIX - - bin\Release - true - false - 1595 - - - - prebuild.xml - - - - - - - DEBUG;TRACE;WIN32;NET - - DEBUG;TRACE;POSIX - - false - bin\Debug - true - Prebuild.xml - 1595 - - - - - - TRACE;WIN32;NET - - TRACE;POSIX - - bin\Release - true - false - Prebuild.xml - 1595 - - - - - - - - - - - - diff --git a/Prebuild/doc/prebuild-example3.xml b/Prebuild/doc/prebuild-example3.xml deleted file mode 100644 index 0111562..0000000 --- a/Prebuild/doc/prebuild-example3.xml +++ /dev/null @@ -1,113 +0,0 @@ - - - - - - - - - - DEBUG;TRACE;WIN32 - - DEBUG;TRACE;POSIX - - false - false - false - 4 - - - false - 1591;219;1573;1572;168 - - - ..\bin - true - false - true - 285212672 - 4096 - false - Docs.xml - - - - - TRACE - true - false - false - 4 - false - 1591;219;1573;1572;168 - ..\bin - false - false - true - 285212672 - 4096 - false - Docs.xml - - - - - - - - ..\bin\lib\Utility - RealmForge.Utility.xml - - - - - ..\bin\lib\Utility - RealmForge.Utility.xml - - - ../bin - - - - - - - - - - - - - - - - - - - ..\bin - DemoGame.xml - - - - - ..\bin - DemoGame.xml - - - ../bin - - - - - - - - - - - - - - - - diff --git a/Prebuild/doc/prebuild-example4.xml b/Prebuild/doc/prebuild-example4.xml deleted file mode 100644 index e5861b8..0000000 --- a/Prebuild/doc/prebuild-example4.xml +++ /dev/null @@ -1,715 +0,0 @@ - - - - - - DEBUG;TRACE - false - false - bin\Debug - true - 4 - 1595 - - - - - TRACE - true - false - bin\Release - false - 1 - 1595 - - - - SdlDotNet.build - prebuild.xml - - - - - DEBUG;TRACE - false - false - bin\Debug - true - SdlDotNet.xml - 4 - 1595 - - - - - TRACE - true - false - bin\Release - SdlDotNet.xml - false - 1 - 1595 - - - - - - - - - - - - - - - - - - DEBUG;TRACE - false - false - bin\Debug - true - Rectangles.xml - 4 - 1595 - - - - - TRACE - true - false - bin\Release - false - Rectangles.xml - 1 - 1595 - - - - - - - App.ico - - - - - - - DEBUG;TRACE - false - false - bin\Debug - true - Gears.xml - 4 - 1595 - - - - - TRACE - true - false - bin\Release - false - Gears.xml - 1 - 1595 - - - - - - - - App.ico - - - - - - - DEBUG;TRACE - false - false - bin\Debug - true - CDPlayer.xml - 4 - 1595 - - - - - TRACE - true - false - bin\Release - false - CDPlayer.xml - 1 - 1595 - - - - - - - - App.ico - CDPlayer.cs - - - - - - - - - DEBUG;TRACE - false - false - bin\Debug - true - MoviePlayer.xml - 4 - 1595 - - - - - TRACE - true - false - bin\Release - false - MoviePlayer.xml - 1 - 1595 - - - - - - - App.ico - - - - - - - DEBUG;TRACE - false - false - bin\Debug - true - SimpleGame.xml - 4 - 1595 - - - - - TRACE - true - false - bin\Release - false - SimpleGame.xml - 1 - 1595 - - - - - - - App.ico - - - - - - - DEBUG;TRACE - false - false - bin\Debug - true - BombRun.xml - 4 - 1595 - - - - - TRACE - true - false - bin\Release - false - BombRun.xml - 1 - 1595 - - - - - - - App.ico - - - - - - - DEBUG;TRACE - false - false - bin\Debug - true - SnowDemo.xml - 4 - 1595 - - - - - TRACE - true - false - bin\Release - false - SnowDemo.xml - 1 - 1595 - - - - - - - App.ico - - - - - - - DEBUG;TRACE - false - false - bin\Debug - true - BounceSprites.xml - 4 - 1595 - - - - - TRACE - true - false - bin\Release - false - BounceSprites.xml - 1 - 1595 - - - - - - - App.ico - - - - - - - DEBUG;TRACE - false - false - bin\Debug - true - Triad.xml - 4 - 1595 - - - - - TRACE - true - false - bin\Release - false - Triad.xml - 1 - 1595 - - - - - - - - App.ico - - - - - - - DEBUG;TRACE - false - false - bin\Debug - true - GuiExample.xml - 4 - 1595 - - - - - TRACE - true - false - bin\Release - false - GuiExample.xml - 1 - 1595 - - - - - - - - - - - - - DEBUG;TRACE - false - false - bin\Debug - true - SpriteGuiDemos.xml - 4 - 1595 - - - - - TRACE - true - false - bin\Release - false - SpriteGuiDemos.xml - 1 - 1595 - - - - - - - - App.ico - - - - - - - DEBUG;TRACE - false - false - bin\Debug - true - SdlDotNet.Tests.xml - 4 - 1595 - - - - - TRACE - true - false - bin\Release - false - SdlDotNet.Tests.xml - 1 - 1595 - - - - - - - - - - - - - - - - DEBUG;TRACE - false - false - bin\Debug - true - AudioExample.xml - 4 - 1595 - - - - - TRACE - true - false - bin\Release - false - AudioExample.xml - 1 - 1595 - - - - - - - App.ico - - - - - - - DEBUG;TRACE - false - false - bin\Debug - true - SdlDotNet.Particles.xml - 4 - 1595 - - - - - TRACE - true - false - bin\Release - false - SdlDotNet.Particles.xml - 1 - 1595 - - - - - - - - - - - - - DEBUG;TRACE - false - false - bin\Debug - true - ParticlesExample.xml - 4 - 1595 - - - - - TRACE - true - false - bin\Release - false - ParticlesExample.xml - 1 - 1595 - - - - - - - - App.ico - - - - - - - - DEBUG;TRACE - false - false - bin\Debug - true - NeHe.xml - 4 - 1595 - - - - - TRACE - true - false - bin\Release - false - NeHe.xml - 1 - 1595 - - - - - - - - - - - App.ico - NeHe.cs - - - - - - - - - DEBUG;TRACE - false - false - bin\Debug - true - RedBook.xml - 4 - 1595 - - - - - TRACE - true - false - bin\Release - false - RedBook.xml - 1 - 1595 - - - - - - - - - - - App.ico - RedBook.cs - - - - - - - - - DEBUG;TRACE - false - false - bin\Debug - true - PhysFsTest.xml - 4 - 1595 - - - - - TRACE - true - false - bin\Release - false - PhysFsTest.xml - 1 - 1595 - - - - - - - - App.ico - - - - - diff --git a/Prebuild/doc/prebuild-example5.xml b/Prebuild/doc/prebuild-example5.xml deleted file mode 100644 index 5221547..0000000 --- a/Prebuild/doc/prebuild-example5.xml +++ /dev/null @@ -1,187 +0,0 @@ - - - - - - DEBUG;TRACE;WIN32 - false - true - bin\Debug - Tao.Sdl.xml - true - - - - - TRACE;WIN32 - true - true - bin\Release - Tao.Sdl.xml - false - - - - Tao.Sdl.License.txt - Tao.Sdl.Readme.txt - Tao.Sdl.snk - Tao.Sdl.dll.config - - - - - AssemblyInfo.cs - Sdl.cs - SdlImage.cs - SdlMixer.cs - SdlTtf.cs - SdlNet.cs - SdlGfx.cs - Smpeg.cs - DelegateCallingConventionCdeclAttribute.cs - - - - - - DEBUG;TRACE;WIN32 - false - false - bin\Debug - Tao.Sdl.Tests.xml - true - - - - - TRACE;WIN32 - true - false - bin\Release - Tao.Sdl.Tests.xml - false - - - - - - - AssemblyInfo.cs - SdlTest.cs - SdlTestVideo.cs - SdlTestImage.cs - SdlTestTtf.cs - SdlTestMixer.cs - SdlTestGfx.cs - SmpegTest.cs - - - - - - DEBUG;TRACE;WIN32 - false - false - bin\Debug - true - - - - - TRACE;WIN32 - true - false - bin\Release - false - - - - - - AssemblyInfo.cs - Rectangles.cs - - - - - - DEBUG;TRACE;WIN32 - false - false - bin\Debug - true - - - - - TRACE;WIN32 - true - false - bin\Release - false - - - - - - AssemblyInfo.cs - SmpegPlayer.cs - - - - - - DEBUG;TRACE;WIN32 - false - false - bin\Debug - true - - - - - TRACE;WIN32 - true - false - bin\Release - false - - - - - - AssemblyInfo.cs - GfxPrimitives.cs - - - - - - DEBUG;TRACE;WIN32 - false - false - bin\Debug - true - - - - - TRACE;WIN32 - true - false - bin\Release - false - - - - - AssemblyInfo.cs - AppMain.cs - BuildProcessor.cs - Options.cs - ReleaseBuildProcessor.cs - UsageHelp.cs - - - - diff --git a/Prebuild/prebuild.xml b/Prebuild/prebuild.xml deleted file mode 100644 index 1f81086..0000000 --- a/Prebuild/prebuild.xml +++ /dev/null @@ -1,73 +0,0 @@ - - - - - - DEBUG;TRACE - false - bin/Debug - true - 1595 - - - - - TRACE - bin/Release - true - false - 1595 - - - - prebuild.xml - prebuild - - - Matthew Holmes (matthew@wildfiregames.com) - Dan Moorehead (dan05a@gmail.com) - Dave Hudson (jendave@yahoo.com) - Rob Loach (http://robloach.net) - C.J. Adams-Collier (cjac@colliertech.org) - The Prebuild project generator - - - DEBUG;TRACE - false - bin/Debug - true - Prebuild.snk - 1595 - - - - - TRACE - bin/Release - true - false - Prebuild.snk - 1595 - - - - - - - - - - - - - - diff --git a/Prebuild/scripts/Clean.bat b/Prebuild/scripts/Clean.bat deleted file mode 100755 index 806bbe8..0000000 --- a/Prebuild/scripts/Clean.bat +++ /dev/null @@ -1,2 +0,0 @@ -cd .. -Prebuild.exe /clean /yes /removedir obj /file prebuild.xml /build NET_2_0 /pause diff --git a/Prebuild/scripts/Clean.sh b/Prebuild/scripts/Clean.sh deleted file mode 100755 index b0a6530..0000000 --- a/Prebuild/scripts/Clean.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/sh - -./prebuild /clean /removedir obj /file ../prebuild.xml /pause -rm -rf ../Makefile diff --git a/Prebuild/scripts/Help.bat b/Prebuild/scripts/Help.bat deleted file mode 100755 index 7c843c4..0000000 --- a/Prebuild/scripts/Help.bat +++ /dev/null @@ -1,2 +0,0 @@ -cd .. -Prebuild.exe /usage /pause \ No newline at end of file diff --git a/Prebuild/scripts/MonoDevelop.sh b/Prebuild/scripts/MonoDevelop.sh deleted file mode 100755 index fbd7669..0000000 --- a/Prebuild/scripts/MonoDevelop.sh +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -prebuild /target monodev /file ../prebuild.xml /build NET_1_1 /pause diff --git a/Prebuild/scripts/Prebuild.nsi b/Prebuild/scripts/Prebuild.nsi deleted file mode 100644 index 8f9854e..0000000 --- a/Prebuild/scripts/Prebuild.nsi +++ /dev/null @@ -1,231 +0,0 @@ -!verbose 3 - -!define PRODUCT_NAME "Prebuild" -!define PRODUCT_VERSION "1.3.1" -!define PRODUCT_PUBLISHER "Prebuild" -!define PRODUCT_PACKAGE "prebuild" -!define PRODUCT_WEB_SITE "http://dnpb.sourceforge.net" -!define PRODUCT_DIR_REGKEY "Software\Microsoft\Windows\CurrentVersion\App Paths\Prebuild" -!define PRODUCT_UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\Prebuild" -!define PRODUCT_UNINST_ROOT_KEY "HKLM" -!define PRODUCT_PATH ".." - -;!define MUI_WELCOMEFINISHPAGE_BITMAP "PrebuildLogo.bmp" -;!define MUI_WELCOMEFINISHPAGE_BITMAP_NOSTRETCH -;!define MUI_UNWELCOMEFINISHPAGE_BITMAP "PrebuildLogo.bmp" -;!define MUI_UNWELCOMEFINISHPAGE_BITMAP_NOSTRETCH - -BrandingText "© 2003-2006 David Hudson, http://dnpb.sourceforge.net/" -SetCompressor lzma -CRCCheck on - -; File Association defines -;!include "fileassoc.nsh" - -; MUI 1.67 compatible ------ -!include "MUI.nsh" - -; MUI Settings -!define MUI_ABORTWARNING -!define MUI_ICON "${NSISDIR}\Contrib\Graphics\Icons\modern-install.ico" -!define MUI_UNICON "${NSISDIR}\Contrib\Graphics\Icons\modern-uninstall.ico" - -;-------------------------------- -;Variables - -;-------------------------------- -;Installer Pages - -; Welcome page -!insertmacro MUI_PAGE_WELCOME -; License page -!insertmacro MUI_PAGE_LICENSE "..\doc\license.txt" -; Directory page -!insertmacro MUI_PAGE_DIRECTORY - -; Instfiles page -!insertmacro MUI_PAGE_INSTFILES - -; Finish page -!insertmacro MUI_PAGE_FINISH - -;------------------------------------ -; Uninstaller pages -!insertmacro MUI_UNPAGE_CONFIRM -!insertmacro MUI_UNPAGE_INSTFILES -!insertmacro MUI_UNPAGE_FINISH -;------------------------------------ - -; Language files -!insertmacro MUI_LANGUAGE "English" - -; Reserve files -!insertmacro MUI_RESERVEFILE_INSTALLOPTIONS - -; MUI end ------ - -Name "${PRODUCT_NAME} ${PRODUCT_VERSION}" -OutFile "..\${PRODUCT_PACKAGE}-${PRODUCT_VERSION}-setup.exe" -InstallDir "$PROGRAMFILES\Prebuild" -InstallDirRegKey HKLM "${PRODUCT_DIR_REGKEY}" "" -ShowInstDetails show -ShowUnInstDetails show - -; .NET Framework check -; http://msdn.microsoft.com/netframework/default.aspx?pull=/library/en-us/dnnetdep/html/redistdeploy1_1.asp -; Section "Detecting that the .NET Framework 1.1 is installed" -Function .onInit - ReadRegDWORD $R0 HKLM "SOFTWARE\Microsoft\NET Framework Setup\NDP\v1.1.4322" Install - StrCmp $R0 "" 0 CheckPreviousVersion - MessageBox MB_OK "Microsoft .NET Framework 1.1 was not found on this system.$\r$\n$\r$\nUnable to continue this installation." - Abort - - CheckPreviousVersion: - ReadRegStr $R0 ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayName" - StrCmp $R0 "" CheckOSVersion 0 - MessageBox MB_OK "An old version of Prebuild is installed on this computer, please uninstall first.$\r$\n$\r$\nUnable to continue this installation." - Abort - - CheckOSVersion: - Call IsSupportedWindowsVersion - Pop $R0 - StrCmp $R0 "False" NoAbort 0 - MessageBox MB_OK "The operating system you are using is not supported by Prebuild (95/98/ME/NT3.x/NT4.x)." - Abort - - NoAbort: -FunctionEnd - -Section "Source" SecSource - SetOverwrite ifnewer - SetOutPath "$INSTDIR\src" - File /r /x *.swp /x .svn /x *.xml /x *.csproj /x *.user /x *.build /x *.prjx /x *.mdp /x bin /x obj /x *.nsi ${PRODUCT_PATH}\src\*.* - - ;Store installation folder - WriteRegStr HKCU "Software\Prebuild" "" $INSTDIR - -SectionEnd - -Section "Runtime" SecRuntime - SetOverwrite ifnewer - SetOutPath "$INSTDIR" - File /r /x *.swp /x .svn /x *.nsi /x src /x *.sln /x *.cmbx /x *.mds ${PRODUCT_PATH}\Prebuild.exe ${PRODUCT_PATH}\prebuild.xml - - ;Store installation folder - WriteRegStr HKCU "Software\Prebuild" "" $INSTDIR - -SectionEnd - -Section "Documentation" SecDocs - SetOverwrite ifnewer - SetOutPath "$INSTDIR\doc" - File /r /x *.swp /x .svn /x *.exe ${PRODUCT_PATH}\doc\*.* - - ;Store installation folder - WriteRegStr HKCU "Software\Prebuild" "" $INSTDIR -SectionEnd - -Section "Scripts" SecScripts - SetOverwrite ifnewer - SetOutPath "$INSTDIR\scripts" - File /r /x *.swp /x .svn /x *.nsi /x *.exe ${PRODUCT_PATH}\scripts\*.* - - ;Store installation folder - WriteRegStr HKCU "Software\Prebuild" "" $INSTDIR -SectionEnd - -;Language strings - -Section -AdditionalIcons - WriteIniStr "$INSTDIR\${PRODUCT_NAME}.url" "InternetShortcut" "URL" "${PRODUCT_WEB_SITE}" -SectionEnd - -Section -Post - WriteUninstaller "$INSTDIR\uninst.exe" - WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayName" "$(^Name)" - WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "UninstallString" "$INSTDIR\uninst.exe" - WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayVersion" "${PRODUCT_VERSION}" - WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "URLInfoAbout" "${PRODUCT_WEB_SITE}" - WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "Publisher" "${PRODUCT_PUBLISHER}" -SectionEnd - -Section Uninstall - - DeleteRegKey ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" - DeleteRegKey HKLM "${PRODUCT_DIR_REGKEY}" - RMDir /r "$INSTDIR" - -SectionEnd - -; GetWindowsVersion, taken from NSIS help, modified for our purposes -Function IsSupportedWindowsVersion - - Push $R0 - Push $R1 - - ReadRegStr $R0 HKLM \ - "SOFTWARE\Microsoft\Windows NT\CurrentVersion" CurrentVersion - - IfErrors 0 lbl_winnt - - ; we are not NT - ReadRegStr $R0 HKLM \ - "SOFTWARE\Microsoft\Windows\CurrentVersion" VersionNumber - - StrCpy $R1 $R0 1 - StrCmp $R1 '4' 0 lbl_error - - StrCpy $R1 $R0 3 - - StrCmp $R1 '4.0' lbl_win32_95 - StrCmp $R1 '4.9' lbl_win32_ME lbl_win32_98 - - lbl_win32_95: - StrCpy $R0 'False' - Goto lbl_done - - lbl_win32_98: - StrCpy $R0 'False' - Goto lbl_done - - lbl_win32_ME: - StrCpy $R0 'False' - Goto lbl_done - - lbl_winnt: - - StrCpy $R1 $R0 1 - - StrCmp $R1 '3' lbl_winnt_x - StrCmp $R1 '4' lbl_winnt_x - - StrCpy $R1 $R0 3 - - StrCmp $R1 '5.0' lbl_winnt_2000 - StrCmp $R1 '5.1' lbl_winnt_XP - StrCmp $R1 '5.2' lbl_winnt_2003 lbl_error - - lbl_winnt_x: - StrCpy $R0 'False' - Goto lbl_done - - lbl_winnt_2000: - Strcpy $R0 'True' - Goto lbl_done - - lbl_winnt_XP: - Strcpy $R0 'True' - Goto lbl_done - - lbl_winnt_2003: - Strcpy $R0 'True' - Goto lbl_done - - lbl_error: - Strcpy $R0 'False' - lbl_done: - - Pop $R1 - Exch $R0 - -FunctionEnd diff --git a/Prebuild/scripts/SharpDevelop.bat b/Prebuild/scripts/SharpDevelop.bat deleted file mode 100755 index 08fea0b..0000000 --- a/Prebuild/scripts/SharpDevelop.bat +++ /dev/null @@ -1,4 +0,0 @@ -@rem Generates a combine (.cmbx) and a set of project files (.prjx) -@rem for SharpDevelop (http://icsharpcode.net/OpenSource/SD/Default.aspx) -cd .. -Prebuild.exe /target sharpdev /file prebuild.xml /build NET_1_1 /pause diff --git a/Prebuild/scripts/SharpDevelop2.bat b/Prebuild/scripts/SharpDevelop2.bat deleted file mode 100755 index 49120ab..0000000 --- a/Prebuild/scripts/SharpDevelop2.bat +++ /dev/null @@ -1,4 +0,0 @@ -@rem Generates a combine (.cmbx) and a set of project files (.prjx) -@rem for SharpDevelop (http://icsharpcode.net/OpenSource/SD/Default.aspx) -cd .. -Prebuild.exe /target sharpdev2 /file prebuild.xml /pause diff --git a/Prebuild/scripts/VS2002.bat b/Prebuild/scripts/VS2002.bat deleted file mode 100755 index dc5b6a7..0000000 --- a/Prebuild/scripts/VS2002.bat +++ /dev/null @@ -1,4 +0,0 @@ -@rem Generates a solution (.sln) and a set of project files (.csproj) -@rem for Microsoft Visual Studio .NET 2002 -cd .. -Prebuild.exe /target vs2002 /file prebuild.xml /build NET_1_1 /pause diff --git a/Prebuild/scripts/VS2003.bat b/Prebuild/scripts/VS2003.bat deleted file mode 100755 index 929a480..0000000 --- a/Prebuild/scripts/VS2003.bat +++ /dev/null @@ -1,4 +0,0 @@ -@rem Generates a solution (.sln) and a set of project files (.csproj) -@rem for Microsoft Visual Studio .NET 2002 -cd .. -Prebuild.exe /target vs2003 /file prebuild.xml /build NET_1_1 /pause diff --git a/Prebuild/scripts/VS2005.bat b/Prebuild/scripts/VS2005.bat deleted file mode 100755 index 7a7af1d..0000000 --- a/Prebuild/scripts/VS2005.bat +++ /dev/null @@ -1,4 +0,0 @@ -@rem Generates a solution (.sln) and a set of project files (.csproj, .vbproj, etc.) -@rem for Microsoft Visual Studio .NET 2005 -cd .. -Prebuild.exe /target vs2005 /file prebuild.xml /build NET_2_0 /pause diff --git a/Prebuild/scripts/VS2008.bat b/Prebuild/scripts/VS2008.bat deleted file mode 100755 index eb51a82..0000000 --- a/Prebuild/scripts/VS2008.bat +++ /dev/null @@ -1,4 +0,0 @@ -@rem Generates a solution (.sln) and a set of project files (.csproj, .vbproj, etc.) -@rem for Microsoft Visual Studio .NET 2008 -cd .. -Prebuild.exe /target vs2008 /file prebuild.xml /pause diff --git a/Prebuild/scripts/autotools.bat b/Prebuild/scripts/autotools.bat deleted file mode 100755 index 43f9a74..0000000 --- a/Prebuild/scripts/autotools.bat +++ /dev/null @@ -1,4 +0,0 @@ -@rem Generates Makefiles -@rem for autotools -cd .. -Prebuild.exe /target autotools /file prebuild.xml /pause diff --git a/Prebuild/scripts/autotools.sh b/Prebuild/scripts/autotools.sh deleted file mode 100755 index 4d140ce..0000000 --- a/Prebuild/scripts/autotools.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/sh -RUNTIME=`which mono` - -SCRIPTDIR=`dirname $0` -${RUNTIME} ${SCRIPTDIR}/../Prebuild.exe /target autotools /file ${SCRIPTDIR}/../prebuild.xml /build NET_2_0 diff --git a/Prebuild/scripts/makefile.bat b/Prebuild/scripts/makefile.bat deleted file mode 100755 index eef9a69..0000000 --- a/Prebuild/scripts/makefile.bat +++ /dev/null @@ -1,4 +0,0 @@ -@rem Generates makefiles -@rem for make -cd .. -Prebuild.exe /target makefile /file prebuild.xml /pause diff --git a/Prebuild/scripts/makefile.sh b/Prebuild/scripts/makefile.sh deleted file mode 100755 index 2e656cb..0000000 --- a/Prebuild/scripts/makefile.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/sh - -./prebuild /target makefile /file ../prebuild.xml /pause - -if [ -f ../Makefile ] -then - rm -rf ../Makefile -fi - -mv ../Prebuild.make ../Makefile diff --git a/Prebuild/scripts/nant.bat b/Prebuild/scripts/nant.bat deleted file mode 100755 index 925467d..0000000 --- a/Prebuild/scripts/nant.bat +++ /dev/null @@ -1,4 +0,0 @@ -@rem Generates a .build files -@rem for NAnt -cd .. -Prebuild.exe /target nant /file prebuild.xml /pause diff --git a/Prebuild/scripts/nant.sh b/Prebuild/scripts/nant.sh deleted file mode 100755 index 0311971..0000000 --- a/Prebuild/scripts/nant.sh +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -prebuild /target nant /file ../prebuild.xml /pause diff --git a/Prebuild/scripts/xcode.bat b/Prebuild/scripts/xcode.bat deleted file mode 100755 index 9883edf..0000000 --- a/Prebuild/scripts/xcode.bat +++ /dev/null @@ -1,4 +0,0 @@ -@rem Generates a Xcode files -@rem for NAnt -cd .. -Prebuild.exe /target xcode /file prebuild.xml /pause diff --git a/Prebuild/scripts/xcode.sh b/Prebuild/scripts/xcode.sh deleted file mode 100755 index e9b58f9..0000000 --- a/Prebuild/scripts/xcode.sh +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -prebuild /target xcode /file ../prebuild.xml /pause diff --git a/Prebuild/src/App.ico b/Prebuild/src/App.ico deleted file mode 100644 index ac4ea6f..0000000 Binary files a/Prebuild/src/App.ico and /dev/null differ diff --git a/Prebuild/src/Core/Attributes/DataNodeAttribute.cs b/Prebuild/src/Core/Attributes/DataNodeAttribute.cs deleted file mode 100644 index f1938a2..0000000 --- a/Prebuild/src/Core/Attributes/DataNodeAttribute.cs +++ /dev/null @@ -1,72 +0,0 @@ -#region BSD License -/* -Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com) - -Redistribution and use in source and binary forms, with or without modification, are permitted -provided that the following conditions are met: - -* Redistributions of source code must retain the above copyright notice, this list of conditions - and the following disclaimer. -* Redistributions in binary form must reproduce the above copyright notice, this list of conditions - and the following disclaimer in the documentation and/or other materials provided with the - distribution. -* The name of the author may not be used to endorse or promote products derived from this software - without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, -BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY -OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING -IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ -#endregion - -using System; -using System.Collections.Specialized; - -namespace Prebuild.Core.Attributes -{ - /// - /// - /// - [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct, AllowMultiple=true)] - public sealed class DataNodeAttribute : Attribute - { - #region Fields - - private string m_Name = "unknown"; - - #endregion - - #region Constructors - - /// - /// Initializes a new instance of the class. - /// - /// The name. - public DataNodeAttribute(string name) - { - m_Name = name; - } - - #endregion - - #region Properties - - /// - /// Gets the name. - /// - /// The name. - public string Name - { - get - { - return m_Name; - } - } - - #endregion - } -} diff --git a/Prebuild/src/Core/Attributes/OptionNodeAttribute.cs b/Prebuild/src/Core/Attributes/OptionNodeAttribute.cs deleted file mode 100644 index 2d6a6a7..0000000 --- a/Prebuild/src/Core/Attributes/OptionNodeAttribute.cs +++ /dev/null @@ -1,71 +0,0 @@ -#region BSD License -/* -Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com) - -Redistribution and use in source and binary forms, with or without modification, are permitted -provided that the following conditions are met: - -* Redistributions of source code must retain the above copyright notice, this list of conditions - and the following disclaimer. -* Redistributions in binary form must reproduce the above copyright notice, this list of conditions - and the following disclaimer in the documentation and/or other materials provided with the - distribution. -* The name of the author may not be used to endorse or promote products derived from this software - without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, -BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY -OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING -IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ -#endregion - -using System; - -namespace Prebuild.Core.Attributes -{ - /// - /// - /// - [AttributeUsage(AttributeTargets.Field)] - public sealed class OptionNodeAttribute : Attribute - { - #region Fields - - private string m_NodeName; - - #endregion - - #region Constructors - - /// - /// Initializes a new instance of the class. - /// - /// Name of the node. - public OptionNodeAttribute(string nodeName) - { - m_NodeName = nodeName; - } - - #endregion - - #region Properties - - /// - /// Gets the name of the node. - /// - /// The name of the node. - public string NodeName - { - get - { - return m_NodeName; - } - } - - #endregion - } -} diff --git a/Prebuild/src/Core/Attributes/TargetAttribute.cs b/Prebuild/src/Core/Attributes/TargetAttribute.cs deleted file mode 100644 index 5ad62ee..0000000 --- a/Prebuild/src/Core/Attributes/TargetAttribute.cs +++ /dev/null @@ -1,71 +0,0 @@ -#region BSD License -/* -Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com) - -Redistribution and use in source and binary forms, with or without modification, are permitted -provided that the following conditions are met: - -* Redistributions of source code must retain the above copyright notice, this list of conditions - and the following disclaimer. -* Redistributions in binary form must reproduce the above copyright notice, this list of conditions - and the following disclaimer in the documentation and/or other materials provided with the - distribution. -* The name of the author may not be used to endorse or promote products derived from this software - without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, -BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY -OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING -IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ -#endregion - -using System; - -namespace Prebuild.Core.Attributes -{ - /// - /// - /// - [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct)] - public sealed class TargetAttribute : Attribute - { - #region Fields - - private string m_Name; - - #endregion - - #region Constructors - - /// - /// Initializes a new instance of the class. - /// - /// The name. - public TargetAttribute(string name) - { - m_Name = name; - } - - #endregion - - #region Properties - - /// - /// Gets the name. - /// - /// The name. - public string Name - { - get - { - return m_Name; - } - } - - #endregion - } -} diff --git a/Prebuild/src/Core/FatalException.cs b/Prebuild/src/Core/FatalException.cs deleted file mode 100644 index 3487905..0000000 --- a/Prebuild/src/Core/FatalException.cs +++ /dev/null @@ -1,85 +0,0 @@ -#region BSD License -/* -Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com) - -Redistribution and use in source and binary forms, with or without modification, are permitted -provided that the following conditions are met: - -* Redistributions of source code must retain the above copyright notice, this list of conditions - and the following disclaimer. -* Redistributions in binary form must reproduce the above copyright notice, this list of conditions - and the following disclaimer in the documentation and/or other materials provided with the - distribution. -* The name of the author may not be used to endorse or promote products derived from this software - without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, -BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY -OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING -IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ -#endregion - -using System; -using System.Runtime.Serialization; - -namespace Prebuild.Core -{ - /// - /// - /// - [Serializable()] - public class FatalException : Exception - { - #region Constructors - - - /// - /// Initializes a new instance of the class. - /// - public FatalException() - { - } - - /// - /// Initializes a new instance of the class. - /// - /// The format. - /// The args. - public FatalException(string format, params object[] args) - : base(String.Format(format, args)) - { - } - - /// - /// Exception with specified string - /// - /// Exception message - public FatalException(string message): base(message) - { - } - - /// - /// - /// - /// - /// - public FatalException(string message, Exception exception) : base(message, exception) - { - } - - /// - /// - /// - /// - /// - protected FatalException(SerializationInfo info, StreamingContext context) : base( info, context ) - { - } - - #endregion - } -} diff --git a/Prebuild/src/Core/Interfaces/IDataNode.cs b/Prebuild/src/Core/Interfaces/IDataNode.cs deleted file mode 100644 index 986dd2d..0000000 --- a/Prebuild/src/Core/Interfaces/IDataNode.cs +++ /dev/null @@ -1,47 +0,0 @@ -#region BSD License -/* -Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com) - -Redistribution and use in source and binary forms, with or without modification, are permitted -provided that the following conditions are met: - -* Redistributions of source code must retain the above copyright notice, this list of conditions - and the following disclaimer. -* Redistributions in binary form must reproduce the above copyright notice, this list of conditions - and the following disclaimer in the documentation and/or other materials provided with the - distribution. -* The name of the author may not be used to endorse or promote products derived from this software - without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, -BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY -OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING -IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ -#endregion - -using System; -using System.Xml; - -namespace Prebuild.Core.Interfaces -{ - /// - /// - /// - public interface IDataNode - { - /// - /// Gets or sets the parent. - /// - /// The parent. - IDataNode Parent { get; set; } - /// - /// Parses the specified node. - /// - /// The node. - void Parse(XmlNode node); - } -} diff --git a/Prebuild/src/Core/Interfaces/ITarget.cs b/Prebuild/src/Core/Interfaces/ITarget.cs deleted file mode 100644 index 47115c6..0000000 --- a/Prebuild/src/Core/Interfaces/ITarget.cs +++ /dev/null @@ -1,51 +0,0 @@ -#region BSD License -/* -Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com) - -Redistribution and use in source and binary forms, with or without modification, are permitted -provided that the following conditions are met: - -* Redistributions of source code must retain the above copyright notice, this list of conditions - and the following disclaimer. -* Redistributions in binary form must reproduce the above copyright notice, this list of conditions - and the following disclaimer in the documentation and/or other materials provided with the - distribution. -* The name of the author may not be used to endorse or promote products derived from this software - without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, -BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY -OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING -IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ -#endregion - -using System; - -namespace Prebuild.Core.Interfaces -{ - /// - /// - /// - public interface ITarget - { - /// - /// Writes the specified kern. - /// - /// The kern. - void Write(Kernel kern); - /// - /// Cleans the specified kern. - /// - /// The kern. - void Clean(Kernel kern); - /// - /// Gets the name. - /// - /// The name. - string Name { get; } - } -} \ No newline at end of file diff --git a/Prebuild/src/Core/Kernel.cs b/Prebuild/src/Core/Kernel.cs deleted file mode 100644 index 95ef04e..0000000 --- a/Prebuild/src/Core/Kernel.cs +++ /dev/null @@ -1,831 +0,0 @@ -#region BSD License -/* -Copyright (c) 2004-2008 -Matthew Holmes (matthew@wildfiregames.com), -Dan Moorehead (dan05a@gmail.com), -Rob Loach (http://www.robloach.net), -C.J. Adams-Collier (cjac@colliertech.org) - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - -* Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - -* Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - -* The name of the author may not be used to endorse or promote - products derived from this software without specific prior written - permission. - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR -IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, -INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, -STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING -IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -POSSIBILITY OF SUCH DAMAGE. - -*/ -#endregion - -using System; -using System.Collections.Generic; -using System.Diagnostics; -using System.Collections; -using System.Collections.Specialized; -using System.IO; -using System.Reflection; -using System.Xml; -using System.Xml.Schema; -using System.Text; - -using Prebuild.Core.Attributes; -using Prebuild.Core.Interfaces; -using Prebuild.Core.Nodes; -using Prebuild.Core.Parse; -using Prebuild.Core.Utilities; - -namespace Prebuild.Core -{ - /// - /// - /// - public class Kernel : IDisposable - { - #region Inner Classes - - private struct NodeEntry - { - public Type Type; - public DataNodeAttribute Attribute; - } - - #endregion - - #region Fields - - private static readonly Kernel m_Instance = new Kernel(); - - /// - /// This must match the version of the schema that is embeeded - /// - private const string m_SchemaVersion = "1.7"; - private const string m_Schema = "prebuild-" + m_SchemaVersion + ".xsd"; - private const string m_SchemaURI = "http://dnpb.sourceforge.net/schemas/" + m_Schema; - bool disposed; - private Version m_Version; - private const string m_Revision = ""; - private CommandLineCollection m_CommandLine; - private Log m_Log; - private CurrentDirectory m_CurrentWorkingDirectory; - private XmlSchemaCollection m_Schemas; - - private Hashtable m_Targets; - private Hashtable m_Nodes; - - readonly List m_Solutions = new List(); - string m_Target; - string m_Clean; - string[] m_RemoveDirectories; - XmlDocument m_CurrentDoc; - bool m_PauseAfterFinish; - string[] m_ProjectGroups; - - #endregion - - #region Constructors - - private Kernel() - { - } - - #endregion - - #region Properties - - /// - /// Gets a value indicating whether [pause after finish]. - /// - /// true if [pause after finish]; otherwise, false. - public bool PauseAfterFinish - { - get - { - return m_PauseAfterFinish; - } - } - - /// - /// Gets the instance. - /// - /// The instance. - public static Kernel Instance - { - get - { - return m_Instance; - } - } - - /// - /// Gets the version. - /// - /// The version. - public string Version - { - get - { - return String.Format("{0}.{1}.{2}{3}", m_Version.Major, m_Version.Minor, m_Version.Build, m_Revision); - } - } - - /// - /// Gets the command line. - /// - /// The command line. - public CommandLineCollection CommandLine - { - get - { - return m_CommandLine; - } - } - - /// - /// Gets the targets. - /// - /// The targets. - public Hashtable Targets - { - get - { - return m_Targets; - } - } - - /// - /// Gets the log. - /// - /// The log. - public Log Log - { - get - { - return m_Log; - } - } - - /// - /// Gets the current working directory. - /// - /// The current working directory. - public CurrentDirectory CurrentWorkingDirectory - { - get - { - return m_CurrentWorkingDirectory; - } - } - - /// - /// Gets the solutions. - /// - /// The solutions. - public List Solutions - { - get - { - return m_Solutions; - } - } - - /// - /// Gets the XmlDocument object representing the prebuild.xml - /// being processed - /// - /// The XmlDocument object - public XmlDocument CurrentDoc - { - get - { - return m_CurrentDoc; - } - } - - #endregion - - #region Private Methods - - private static void RemoveDirectories(string rootDir, string[] dirNames) - { - foreach(string dir in Directory.GetDirectories(rootDir)) - { - string simpleName = Path.GetFileName(dir); - - if(Array.IndexOf(dirNames, simpleName) != -1) - { - //delete if the name matches one of the directory names to delete - string fullDirPath = Path.GetFullPath(dir); - Directory.Delete(fullDirPath,true); - } - else//not a match, so check children - { - RemoveDirectories(dir,dirNames); - //recurse, checking children for them - } - } - } - -// private void RemoveDirectoryMatches(string rootDir, string dirPattern) -// { -// foreach(string dir in Directory.GetDirectories(rootDir)) -// { -// foreach(string match in Directory.GetDirectories(dir)) -// {//delete all child directories that match -// Directory.Delete(Path.GetFullPath(match),true); -// } -// //recure through the rest checking for nested matches to delete -// RemoveDirectoryMatches(dir,dirPattern); -// } -// } - - private void LoadSchema() - { - Assembly assembly = this.GetType().Assembly; - Stream stream = assembly.GetManifestResourceStream("Prebuild.data." + m_Schema); - if(stream == null) - { - //try without the default namespace prepending to it in case was compiled with SharpDevelop or MonoDevelop instead of Visual Studio .NET - stream = assembly.GetManifestResourceStream(m_Schema); - if(stream == null) - { - throw new System.Reflection.TargetException(string.Format("Could not find the scheme embedded resource file '{0}'.", m_Schema)); - } - } - XmlReader schema = new XmlTextReader(stream); - - m_Schemas = new XmlSchemaCollection(); - m_Schemas.Add(m_SchemaURI, schema); - } - - private void CacheVersion() - { - m_Version = Assembly.GetEntryAssembly().GetName().Version; - } - - private void CacheTargets(Assembly assm) - { - foreach(Type t in assm.GetTypes()) - { - TargetAttribute ta = (TargetAttribute)Helper.CheckType(t, typeof(TargetAttribute), typeof(ITarget)); - - if(ta == null) - continue; - - if (t.IsAbstract) - continue; - - ITarget target = (ITarget)assm.CreateInstance(t.FullName); - if (target == null) - { - throw new MissingMethodException("Could not create ITarget instance"); - } - - m_Targets[ta.Name] = target; - } - } - - private void CacheNodeTypes(Assembly assm) - { - foreach(Type t in assm.GetTypes()) - { - foreach (DataNodeAttribute dna in t.GetCustomAttributes(typeof(DataNodeAttribute), true)) - { - NodeEntry ne = new NodeEntry(); - ne.Type = t; - ne.Attribute = dna; - m_Nodes[dna.Name] = ne; - } - } - } - - private void LogBanner() - { - m_Log.Write("Prebuild v" + this.Version); - m_Log.Write("Copyright (c) 2004-2008"); - m_Log.Write("Matthew Holmes (matthew@wildfiregames.com),"); - m_Log.Write("Dan Moorehead (dan05a@gmail.com),"); - m_Log.Write("David Hudson (jendave@yahoo.com),"); - m_Log.Write("Rob Loach (http://www.robloach.net),"); - m_Log.Write("C.J. Adams-Collier (cjac@colliertech.org),"); - - m_Log.Write("See 'prebuild /usage' for help"); - m_Log.Write(); - } - - - - private void ProcessFile(string file) - { - ProcessFile(file, this.m_Solutions); - } - - public void ProcessFile(ProcessNode node, SolutionNode parent) - { - if (node.IsValid) - { - List list = new List(); - ProcessFile(node.Path, list); - - foreach (SolutionNode solution in list) - parent.SolutionsTable[solution.Name] = solution; - } - } - - /// - /// - /// - /// - /// - /// - public void ProcessFile(string file, IList solutions) - { - m_CurrentWorkingDirectory.Push(); - - string path = file; - try - { - try - { - path = Helper.ResolvePath(path); - } - catch(ArgumentException) - { - m_Log.Write("Could not open Prebuild file: " + path); - m_CurrentWorkingDirectory.Pop(); - return; - } - - Helper.SetCurrentDir(Path.GetDirectoryName(path)); - - XmlTextReader reader = new XmlTextReader(path); - - Core.Parse.Preprocessor pre = new Core.Parse.Preprocessor(); - - //register command line arguments as XML variables - IDictionaryEnumerator dict = m_CommandLine.GetEnumerator(); - while (dict.MoveNext()) - { - string name = dict.Key.ToString().Trim(); - if (name.Length > 0) - pre.RegisterVariable(name, dict.Value.ToString()); - } - - string xml = pre.Process(reader);//remove script and evaulate pre-proccessing to get schema-conforming XML - - // See if the user put into a pseudo target of "prebuild:preprocessed-input" to indicate they want to see the - // output before the system processes it. - if (m_CommandLine.WasPassed("ppi")) - { - // Get the filename if there is one, otherwise use a default. - string ppiFile = m_CommandLine["ppi"]; - if (ppiFile == null || ppiFile.Trim().Length == 0) - { - ppiFile = "preprocessed-input.xml"; - } - - // Write out the string to the given stream. - try - { - using (StreamWriter ppiWriter = new StreamWriter(ppiFile)) - { - ppiWriter.WriteLine(xml); - } - } - catch(IOException ex) - { - Console.WriteLine("Could not write PPI file '{0}': {1}", ppiFile, ex.Message); - } - - // Finish processing this special tag. - return; - } - - m_CurrentDoc = new XmlDocument(); - try - { - XmlValidatingReader validator = new XmlValidatingReader(new XmlTextReader(new StringReader(xml))); - - //validate while reading from string into XmlDocument DOM structure in memory - foreach(XmlSchema schema in m_Schemas) - { - validator.Schemas.Add(schema); - } - m_CurrentDoc.Load(validator); - } - catch(XmlException e) - { - throw new XmlException(e.ToString()); - } - - //is there a purpose to writing it? An syntax/schema problem would have been found during pre.Process() and reported with details - if(m_CommandLine.WasPassed("ppo")) - { - string ppoFile = m_CommandLine["ppo"]; - if(ppoFile == null || ppoFile.Trim().Length < 1) - { - ppoFile = "preprocessed.xml"; - } - - StreamWriter writer = null; - try - { - writer = new StreamWriter(ppoFile); - writer.Write(xml); - } - catch(IOException ex) - { - Console.WriteLine("Could not write PPO file '{0}': {1}", ppoFile, ex.Message); - } - finally - { - if(writer != null) - { - writer.Close(); - } - } - return; - } - //start reading the xml config file - XmlElement rootNode = m_CurrentDoc.DocumentElement; - //string suggestedVersion = Helper.AttributeValue(rootNode,"version","1.0"); - Helper.CheckForOSVariables = Helper.ParseBoolean(rootNode,"checkOsVars",false); - - foreach(XmlNode node in rootNode.ChildNodes)//solutions or if pre-proc instructions - { - IDataNode dataNode = ParseNode(node, null); - if(dataNode is ProcessNode) - { - ProcessNode proc = (ProcessNode)dataNode; - if(proc.IsValid) - { - ProcessFile(proc.Path); - } - } - else if(dataNode is SolutionNode) - { - solutions.Add((SolutionNode)dataNode); - } - } - } - catch(XmlSchemaException xse) - { - m_Log.Write("XML validation error at line {0} in {1}:\n\n{2}", - xse.LineNumber, path, xse.Message); - } - finally - { - m_CurrentWorkingDirectory.Pop(); - } - } - - #endregion - - #region Public Methods - - /// - /// Allows the project. - /// - /// The project groups flags. - /// - public bool AllowProject(string projectGroupsFlags) - { - if(m_ProjectGroups != null && m_ProjectGroups.Length > 0) - { - if(projectGroupsFlags != null && projectGroupsFlags.Length == 0) - { - foreach(string group in projectGroupsFlags.Split('|')) - { - if(Array.IndexOf(m_ProjectGroups, group) != -1) //if included in the filter list - { - return true; - } - } - } - return false;//not included in the list or no groups specified for the project - } - return true;//no filter specified in the command line args - } - - /// - /// Gets the type of the node. - /// - /// The node. - /// - public Type GetNodeType(XmlNode node) - { - if( node == null ) - { - throw new ArgumentNullException("node"); - } - if(!m_Nodes.ContainsKey(node.Name)) - { - return null; - } - - NodeEntry ne = (NodeEntry)m_Nodes[node.Name]; - return ne.Type; - } - - /// - /// - /// - /// - /// - /// - public IDataNode ParseNode(XmlNode node, IDataNode parent) - { - return ParseNode(node, parent, null); - } - - //Create an instance of the data node type that is mapped to the name of the xml DOM node - /// - /// Parses the node. - /// - /// The node. - /// The parent. - /// The pre node. - /// - public IDataNode ParseNode(XmlNode node, IDataNode parent, IDataNode preNode) - { - IDataNode dataNode; - - try - { - if( node == null ) - { - throw new ArgumentNullException("node"); - } - if(preNode == null) - { - if(!m_Nodes.ContainsKey(node.Name)) - { - //throw new XmlException("Unknown XML node: " + node.Name); - return null; - } - - NodeEntry ne = (NodeEntry)m_Nodes[node.Name]; - Type type = ne.Type; - //DataNodeAttribute dna = ne.Attribute; - - dataNode = (IDataNode)type.Assembly.CreateInstance(type.FullName); - if(dataNode == null) - { - throw new System.Reflection.TargetException("Could not create new parser instance: " + type.FullName); - } - } - else - dataNode = preNode; - - dataNode.Parent = parent; - dataNode.Parse(node); - } - catch(WarningException wex) - { - m_Log.Write(LogType.Warning, wex.Message); - return null; - } - catch(FatalException fex) - { - m_Log.WriteException(LogType.Error, fex); - throw; - } - catch(Exception ex) - { - m_Log.WriteException(LogType.Error, ex); - throw; - } - - return dataNode; - } - - /// - /// Initializes the specified target. - /// - /// The target. - /// The args. - public void Initialize(LogTargets target, string[] args) - { - m_Targets = new Hashtable(); - CacheTargets(this.GetType().Assembly); - m_Nodes = new Hashtable(); - CacheNodeTypes(this.GetType().Assembly); - CacheVersion(); - - m_CommandLine = new CommandLineCollection(args); - - string logFile = null; - if(m_CommandLine.WasPassed("log")) - { - logFile = m_CommandLine["log"]; - - if(logFile != null && logFile.Length == 0) - { - logFile = "Prebuild.log"; - } - } - else - { - target = target & ~LogTargets.File; //dont output to a file - } - - m_Log = new Log(target, logFile); - LogBanner(); - - m_CurrentWorkingDirectory = new CurrentDirectory(); - - m_Target = m_CommandLine["target"]; - m_Clean = m_CommandLine["clean"]; - string removeDirs = m_CommandLine["removedir"]; - if(removeDirs != null && removeDirs.Length == 0) - { - m_RemoveDirectories = removeDirs.Split('|'); - } - - string flags = m_CommandLine["allowedgroups"];//allows filtering by specifying a pipe-delimited list of groups to include - if(flags != null && flags.Length == 0) - { - m_ProjectGroups = flags.Split('|'); - } - m_PauseAfterFinish = m_CommandLine.WasPassed("pause"); - - LoadSchema(); - } - - /// - /// Processes this instance. - /// - public void Process() - { - bool perfomedOtherTask = false; - if(m_RemoveDirectories != null && m_RemoveDirectories.Length > 0) - { - try - { - RemoveDirectories(".",m_RemoveDirectories); - } - catch(IOException e) - { - m_Log.Write("Failed to remove directories named {0}",m_RemoveDirectories); - m_Log.WriteException(LogType.Error,e); - } - catch(UnauthorizedAccessException e) - { - m_Log.Write("Failed to remove directories named {0}",m_RemoveDirectories); - m_Log.WriteException(LogType.Error,e); - } - perfomedOtherTask = true; - } - - if(m_Target != null && m_Clean != null) - { - m_Log.Write(LogType.Error, "The options /target and /clean cannot be passed together"); - return; - } - - if(m_Target == null && m_Clean == null) - { - if(perfomedOtherTask) //finished - { - return; - } - m_Log.Write(LogType.Error, "Must pass either /target or /clean to process a Prebuild file"); - return; - } - - string file = "./prebuild.xml"; - if(m_CommandLine.WasPassed("file")) - { - file = m_CommandLine["file"]; - } - - ProcessFile(file); - - string target = (m_Target != null ? m_Target.ToLower() : m_Clean.ToLower()); - bool clean = (m_Target == null); - if(clean && target != null && target.Length == 0) - { - target = "all"; - } - if(clean && target == "all")//default to all if no target was specified for clean - { - //check if they passed yes - if (!m_CommandLine.WasPassed("yes")) - { - Console.WriteLine("WARNING: This operation will clean ALL project files for all targets, are you sure? (y/n):"); - string ret = Console.ReadLine(); - if(ret == null) - { - return; - } - ret = ret.Trim().ToLower(); - if((ret.ToLower() != "y" && ret.ToLower() != "yes")) - { - return; - } - } - //clean all targets (just cleaning vs2002 target didn't clean nant) - foreach(ITarget targ in m_Targets.Values) - { - targ.Clean(this); - } - } - else - { - if (!m_Targets.Contains(target)) { - m_Log.Write(LogType.Error, "Unknown Target \"{0}\"", target); - return; - } - ITarget targ = (ITarget)m_Targets[target]; - - if(clean) - { - targ.Clean(this); - } - else - { - targ.Write(this); - } - } - - m_Log.Flush(); - } - - #endregion - - #region IDisposable Members - - /// - /// - /// - public void Dispose() - { - Dispose(true); - GC.SuppressFinalize(this); - } - - /// - /// Dispose objects - /// - /// - /// If true, it will dispose close the handle - /// - /// - /// Will dispose managed and unmanaged resources. - /// - protected virtual void Dispose(bool disposing) - { - if (!this.disposed) - { - if (disposing) - { - if (this.m_Log != null) - { - this.m_Log.Close(); - this.m_Log = null; - } - } - } - this.disposed = true; - } - - /// - /// - /// - ~Kernel() - { - this.Dispose(false); - } - - /// - /// Closes and destroys this object - /// - /// - /// Same as Dispose(true) - /// - public void Close() - { - Dispose(); - } - - #endregion - } -} diff --git a/Prebuild/src/Core/Nodes/AuthorNode.cs b/Prebuild/src/Core/Nodes/AuthorNode.cs deleted file mode 100644 index 20e72c0..0000000 --- a/Prebuild/src/Core/Nodes/AuthorNode.cs +++ /dev/null @@ -1,89 +0,0 @@ -#region BSD License -/* -Copyright (c) 2007 C.J. Adams-Collier (cjac@colliertech.org) - -Redistribution and use in source and binary forms, with or without modification, are permitted -provided that the following conditions are met: - -* Redistributions of source code must retain the above copyright notice, this list of conditions - and the following disclaimer. -* Redistributions in binary form must reproduce the above copyright notice, this list of conditions - and the following disclaimer in the documentation and/or other materials provided with the - distribution. -* The name of the author may not be used to endorse or promote products derived from this software - without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, -BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY -OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING -IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ -#endregion - -using System; -using System.Collections; -using System.Collections.Specialized; -using System.Xml; - -using Prebuild.Core.Attributes; -using Prebuild.Core.Interfaces; -using Prebuild.Core.Utilities; - -namespace Prebuild.Core.Nodes -{ - /// - /// - /// - [DataNode("Author")] - public class AuthorNode : DataNode - { - #region Fields - - private string m_Signature; - - #endregion - - #region Properties - - /// - /// Gets the signature. - /// - /// The signature. - public string Signature - { - get - { - return m_Signature; - } - } - - #endregion - - #region Public Methods - - /// - /// Parses the specified node. - /// - /// The node. - public override void Parse(XmlNode node) - { - if( node == null ) - { - throw new ArgumentNullException("node"); - } - - m_Signature = Helper.InterpolateForEnvironmentVariables(node.InnerText); - if(m_Signature == null) - { - m_Signature = ""; - } - - m_Signature = m_Signature.Trim(); - } - - #endregion - } -} diff --git a/Prebuild/src/Core/Nodes/ConfigurationNode.cs b/Prebuild/src/Core/Nodes/ConfigurationNode.cs deleted file mode 100644 index 67d78d5..0000000 --- a/Prebuild/src/Core/Nodes/ConfigurationNode.cs +++ /dev/null @@ -1,178 +0,0 @@ -#region BSD License -/* -Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com) - -Redistribution and use in source and binary forms, with or without modification, are permitted -provided that the following conditions are met: - -* Redistributions of source code must retain the above copyright notice, this list of conditions - and the following disclaimer. -* Redistributions in binary form must reproduce the above copyright notice, this list of conditions - and the following disclaimer in the documentation and/or other materials provided with the - distribution. -* The name of the author may not be used to endorse or promote products derived from this software - without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, -BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY -OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING -IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ -#endregion - -using System; -using System.Xml; - -using Prebuild.Core.Attributes; -using Prebuild.Core.Interfaces; -using Prebuild.Core.Utilities; - -namespace Prebuild.Core.Nodes -{ - /// - /// - /// - [DataNode("Configuration")] - public class ConfigurationNode : DataNode, ICloneable, IComparable - { - #region Fields - - private string m_Name = "unknown"; - private OptionsNode m_Options; - - #endregion - - #region Constructors - - /// - /// Initializes a new instance of the class. - /// - public ConfigurationNode() - { - m_Options = new OptionsNode(); - } - - #endregion - - #region Properties - - /// - /// Gets or sets the parent. - /// - /// The parent. - public override IDataNode Parent - { - get - { - return base.Parent; - } - set - { - base.Parent = value; - if(base.Parent is SolutionNode) - { - SolutionNode node = (SolutionNode)base.Parent; - if(node != null && node.Options != null) - { - node.Options.CopyTo(m_Options); - } - } - } - } - - /// - /// Gets the name. - /// - /// The name. - public string Name - { - get - { - return m_Name; - } - } - - /// - /// Gets or sets the options. - /// - /// The options. - public OptionsNode Options - { - get - { - return m_Options; - } - set - { - m_Options = value; - } - } - - #endregion - - #region Public Methods - - /// - /// Parses the specified node. - /// - /// The node. - public override void Parse(XmlNode node) - { - m_Name = Helper.AttributeValue(node, "name", m_Name); - if( node == null ) - { - throw new ArgumentNullException("node"); - } - foreach(XmlNode child in node.ChildNodes) - { - IDataNode dataNode = Kernel.Instance.ParseNode(child, this); - if(dataNode is OptionsNode) - { - ((OptionsNode)dataNode).CopyTo(m_Options); - } - } - } - - /// - /// Copies to. - /// - /// The conf. - public void CopyTo(ConfigurationNode conf) - { - m_Options.CopyTo(conf.m_Options); - } - - #endregion - - #region ICloneable Members - - /// - /// Creates a new object that is a copy of the current instance. - /// - /// - /// A new object that is a copy of this instance. - /// - public object Clone() - { - ConfigurationNode ret = new ConfigurationNode(); - ret.m_Name = m_Name; - m_Options.CopyTo(ret.m_Options); - return ret; - } - - #endregion - - #region IComparable Members - - public int CompareTo(object obj) - { - ConfigurationNode that = (ConfigurationNode) obj; - return this.m_Name.CompareTo(that.m_Name); - } - - #endregion - } -} diff --git a/Prebuild/src/Core/Nodes/DataNode.cs b/Prebuild/src/Core/Nodes/DataNode.cs deleted file mode 100644 index 763e6c3..0000000 --- a/Prebuild/src/Core/Nodes/DataNode.cs +++ /dev/null @@ -1,117 +0,0 @@ -#region BSD License -/* -Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com) - -Redistribution and use in source and binary forms, with or without modification, are permitted -provided that the following conditions are met: - -* Redistributions of source code must retain the above copyright notice, this list of conditions - and the following disclaimer. -* Redistributions in binary form must reproduce the above copyright notice, this list of conditions - and the following disclaimer in the documentation and/or other materials provided with the - distribution. -* The name of the author may not be used to endorse or promote products derived from this software - without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, -BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY -OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING -IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ -#endregion - -using System; -using System.Xml; - -using Prebuild.Core.Attributes; -using Prebuild.Core.Interfaces; -using System.IO; - -namespace Prebuild.Core.Nodes -{ - /// - /// - /// - public abstract class DataNode : IDataNode - { - #region Fields - - private IDataNode parent; - string[] m_WebTypes = new string[] { "aspx", "ascx", "master", "ashx", "asmx" }; - - #endregion - - #region IDataNode Members - - /// - /// Gets or sets the parent. - /// - /// The parent. - public virtual IDataNode Parent - { - get - { - return parent; - } - set - { - parent = value; - } - } - public string[] WebTypes - { - get { return m_WebTypes; } - } - /// - /// Parses the specified node. - /// - /// The node. - public virtual void Parse(XmlNode node) - { - } - public BuildAction GetBuildActionByFileName(string fileName) - { - string extension = Path.GetExtension(fileName).ToLower(); - foreach (string type in WebTypes) - { - if (extension == type) - return BuildAction.Content; - } - return BuildAction.Compile; - } - /// - /// Parses the file type to figure out what type it is - /// - /// - public SubType GetSubTypeByFileName(string fileName) - { - string extension = System.IO.Path.GetExtension(fileName).ToLower(); - string designer = String.Format(".designer{0}", extension); - string path = fileName.ToLower(); - if (extension == ".resx") - { - return SubType.Designer; - } - else if (path.EndsWith(".settings")) - { - return SubType.Settings; - } - else - { - - foreach (string type in WebTypes) - { - if (path.EndsWith(string.Format("{0}{1}", type, extension))) - { - return SubType.CodeBehind; - } - } - } - return SubType.Code; - } - #endregion - } -} diff --git a/Prebuild/src/Core/Nodes/DatabaseProjectNode.cs b/Prebuild/src/Core/Nodes/DatabaseProjectNode.cs deleted file mode 100644 index 27c2051..0000000 --- a/Prebuild/src/Core/Nodes/DatabaseProjectNode.cs +++ /dev/null @@ -1,94 +0,0 @@ -using System; -using System.Collections; -using System.Collections.Generic; -using System.Text; -using System.Xml; - -using Prebuild.Core.Attributes; -using Prebuild.Core.Interfaces; -using Prebuild.Core.Utilities; - -namespace Prebuild.Core.Nodes -{ - [DataNode("DatabaseProject")] - public class DatabaseProjectNode : DataNode - { - string name; - string path; - string fullpath; - Guid guid = Guid.NewGuid(); - readonly List authors = new List(); - readonly List references = new List(); - - public Guid Guid - { - get { return guid; } - } - - public string Name - { - get { return name; } - } - - public string Path - { - get { return path; } - } - - public string FullPath - { - get { return fullpath; } - } - - public IEnumerable References - { - get { return references; } - } - - public override void Parse(XmlNode node) - { - name = Helper.AttributeValue(node, "name", name); - path = Helper.AttributeValue(node, "path", name); - - try - { - fullpath = Helper.ResolvePath(path); - } - catch - { - throw new WarningException("Could not resolve Solution path: {0}", path); - } - - Kernel.Instance.CurrentWorkingDirectory.Push(); - - try - { - Helper.SetCurrentDir(fullpath); - - if (node == null) - { - throw new ArgumentNullException("node"); - } - - foreach (XmlNode child in node.ChildNodes) - { - IDataNode dataNode = Kernel.Instance.ParseNode(child, this); - - if (dataNode == null) - continue; - - if (dataNode is AuthorNode) - authors.Add((AuthorNode)dataNode); - else if (dataNode is DatabaseReferenceNode) - references.Add((DatabaseReferenceNode)dataNode); - } - } - finally - { - Kernel.Instance.CurrentWorkingDirectory.Pop(); - } - - base.Parse(node); - } - } -} diff --git a/Prebuild/src/Core/Nodes/DatabaseReferenceNode.cs b/Prebuild/src/Core/Nodes/DatabaseReferenceNode.cs deleted file mode 100644 index 845db24..0000000 --- a/Prebuild/src/Core/Nodes/DatabaseReferenceNode.cs +++ /dev/null @@ -1,63 +0,0 @@ -using System; -using Prebuild.Core.Attributes; -using Prebuild.Core.Utilities; - -namespace Prebuild.Core.Nodes -{ - [DataNode("DatabaseReference")] - public class DatabaseReferenceNode : DataNode - { - string name; - Guid providerId; - string connectionString; - - public string Name - { - get { return name; } - } - - public Guid ProviderId - { - get { return providerId; } - } - - public string ConnectionString - { - get { return connectionString; } - } - - public override void Parse(System.Xml.XmlNode node) - { - name = Helper.AttributeValue(node, "name", name); - - string providerName = Helper.AttributeValue(node, "providerName", string.Empty); - if (providerName != null) - { - switch (providerName) - { - // digitaljeebus: pulled from HKLM\SOFTWARE\Microsoft\VisualStudio\9.0\DataProviders\* - // Not sure if these will help other operating systems, or if there's a better way. - case "Microsoft.SqlServerCe.Client.3.5": - providerId = new Guid("7C602B5B-ACCB-4acd-9DC0-CA66388C1533"); break; - case "System.Data.OleDb": - providerId = new Guid("7F041D59-D76A-44ed-9AA2-FBF6B0548B80"); break; - case "System.Data.OracleClient": - providerId = new Guid("8F5C5018-AE09-42cf-B2CC-2CCCC7CFC2BB"); break; - case "System.Data.SqlClient": - providerId = new Guid("91510608-8809-4020-8897-FBA057E22D54"); break; - case "System.Data.Odbc": - providerId = new Guid("C3D4F4CE-2C48-4381-B4D6-34FA50C51C86"); break; - - default: - throw new ArgumentOutOfRangeException("providerName", providerName, "Could not provider name to an id."); - } - } - else - providerId = new Guid(Helper.AttributeValue(node, "providerId", Guid.Empty.ToString("B"))); - - connectionString = Helper.AttributeValue(node, "connectionString", connectionString); - - base.Parse(node); - } - } -} diff --git a/Prebuild/src/Core/Nodes/DescriptionNode.cs b/Prebuild/src/Core/Nodes/DescriptionNode.cs deleted file mode 100644 index 353a5ae..0000000 --- a/Prebuild/src/Core/Nodes/DescriptionNode.cs +++ /dev/null @@ -1,89 +0,0 @@ -#region BSD License -/* -Copyright (c) 2007 C.J. Adams-Collier (cjac@colliertech.org) - -Redistribution and use in source and binary forms, with or without modification, are permitted -provided that the following conditions are met: - -* Redistributions of source code must retain the above copyright notice, this list of conditions - and the following disclaimer. -* Redistributions in binary form must reproduce the above copyright notice, this list of conditions - and the following disclaimer in the documentation and/or other materials provided with the - distribution. -* The name of the author may not be used to endorse or promote products derived from this software - without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, -BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY -OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING -IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ -#endregion - -using System; -using System.Collections; -using System.Collections.Specialized; -using System.Xml; - -using Prebuild.Core.Attributes; -using Prebuild.Core.Interfaces; -using Prebuild.Core.Utilities; - -namespace Prebuild.Core.Nodes -{ - /// - /// The object representing the /Prebuild/Solution/Project/Description element - /// - [DataNode("Description")] - public class DescriptionNode : DataNode - { - #region Fields - - private string m_Value; - - #endregion - - #region Properties - - /// - /// Gets the description Value. - /// - /// The description Value. - public string Value - { - get - { - return m_Value; - } - } - - #endregion - - #region Public Methods - - /// - /// Parses the specified node. - /// - /// The node. - public override void Parse(XmlNode node) - { - if( node == null ) - { - throw new ArgumentNullException("node"); - } - - m_Value = Helper.InterpolateForEnvironmentVariables(node.InnerText); - if(m_Value == null) - { - m_Value = ""; - } - - m_Value = m_Value.Trim(); - } - - #endregion - } -} diff --git a/Prebuild/src/Core/Nodes/ExcludeNode.cs b/Prebuild/src/Core/Nodes/ExcludeNode.cs deleted file mode 100644 index 7f04cba..0000000 --- a/Prebuild/src/Core/Nodes/ExcludeNode.cs +++ /dev/null @@ -1,89 +0,0 @@ -#region BSD License -/* -Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com) - -Redistribution and use in source and binary forms, with or without modification, are permitted -provided that the following conditions are met: - -* Redistributions of source code must retain the above copyright notice, this list of conditions - and the following disclaimer. -* Redistributions in binary form must reproduce the above copyright notice, this list of conditions - and the following disclaimer in the documentation and/or other materials provided with the - distribution. -* The name of the author may not be used to endorse or promote products derived from this software - without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, -BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY -OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING -IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ -#endregion - -using System; -using System.Xml; - -using Prebuild.Core.Attributes; -using Prebuild.Core.Interfaces; -using Prebuild.Core.Utilities; - -namespace Prebuild.Core.Nodes -{ - /// - /// - /// - [DataNode("Exclude")] - public class ExcludeNode : DataNode - { - #region Fields - - private string m_Pattern = ""; - - #endregion - - #region Properties - - /// - /// Gets the name. - /// - /// The name. - public string Name - { - get - { - return m_Pattern; - } - } - - /// - /// Gets the pattern. - /// - /// The pattern. - public string Pattern - { - get - { - return m_Pattern; - } - } - - #endregion - - #region Public Methods - - /// - /// Parses the specified node. - /// - /// The node. - public override void Parse(XmlNode node) - { - m_Pattern = Helper.AttributeValue( node, "name", m_Pattern ); - m_Pattern = Helper.AttributeValue(node, "pattern", m_Pattern ); - } - - #endregion - } -} diff --git a/Prebuild/src/Core/Nodes/FileNode.cs b/Prebuild/src/Core/Nodes/FileNode.cs deleted file mode 100644 index 1520fcb..0000000 --- a/Prebuild/src/Core/Nodes/FileNode.cs +++ /dev/null @@ -1,271 +0,0 @@ -#region BSD License -/* -Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com) - -Redistribution and use in source and binary forms, with or without modification, are permitted -provided that the following conditions are met: - -* Redistributions of source code must retain the above copyright notice, this list of conditions - and the following disclaimer. -* Redistributions in binary form must reproduce the above copyright notice, this list of conditions - and the following disclaimer in the documentation and/or other materials provided with the - distribution. -* The name of the author may not be used to endorse or promote products derived from this software - without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, -BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY -OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING -IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ -#endregion - -using System; -using System.IO; -using System.Xml; - -using Prebuild.Core.Attributes; -using Prebuild.Core.Interfaces; -using Prebuild.Core.Utilities; -using Prebuild.Core.Targets; - -namespace Prebuild.Core.Nodes -{ - /// - /// - /// - public enum BuildAction - { - /// - /// - /// - None, - /// - /// - /// - Compile, - /// - /// - /// - Content, - /// - /// - /// - EmbeddedResource - } - - /// - /// - /// - public enum SubType - { - /// - /// - /// - Code, - /// - /// - /// - Component, - /// - /// - /// - Designer, - /// - /// - /// - Form, - /// - /// - /// - Settings, - /// - /// - /// - UserControl, - /// - /// - /// - CodeBehind, - } - - public enum CopyToOutput - { - Never, - Always, - PreserveNewest - } - - /// - /// - /// - [DataNode("File")] - public class FileNode : DataNode - { - #region Fields - - private string m_Path; - private string m_ResourceName = ""; - private BuildAction? m_BuildAction; - private bool m_Valid; - private SubType? m_SubType; - private CopyToOutput m_CopyToOutput = CopyToOutput.Never; - private bool m_Link = false; - private string m_LinkPath = string.Empty; - private bool m_PreservePath = false; - - - #endregion - - #region Properties - - /// - /// - /// - public string Path - { - get - { - return m_Path; - } - } - - /// - /// - /// - public string ResourceName - { - get - { - return m_ResourceName; - } - } - - /// - /// - /// - public BuildAction BuildAction - { - get - { - if (m_BuildAction != null) - return m_BuildAction.Value; - else - return GetBuildActionByFileName(this.Path); - - } - } - - public CopyToOutput CopyToOutput - { - get - { - return this.m_CopyToOutput; - } - } - - public bool IsLink - { - get - { - return this.m_Link; - } - } - - public string LinkPath - { - get - { - return this.m_LinkPath; - } - } - /// - /// - /// - public SubType SubType - { - get - { - if (m_SubType != null) - return m_SubType.Value; - else - return GetSubTypeByFileName(this.Path); - } - } - - /// - /// - /// - public bool IsValid - { - get - { - return m_Valid; - } - } - - /// - /// - /// - /// - /// - public bool PreservePath - { - get - { - return m_PreservePath; - } - } - - #endregion - - #region Public Methods - - /// - /// - /// - /// - public override void Parse(XmlNode node) - { - string buildAction = Helper.AttributeValue(node, "buildAction", String.Empty); - if (buildAction != string.Empty) - m_BuildAction = (BuildAction)Enum.Parse(typeof(BuildAction), buildAction); - string subType = Helper.AttributeValue(node, "subType", string.Empty); - if (subType != String.Empty) - m_SubType = (SubType)Enum.Parse(typeof(SubType), subType); - - m_ResourceName = Helper.AttributeValue(node, "resourceName", m_ResourceName.ToString()); - this.m_Link = bool.Parse(Helper.AttributeValue(node, "link", bool.FalseString)); - if ( this.m_Link == true ) - { - this.m_LinkPath = Helper.AttributeValue( node, "linkPath", string.Empty ); - } - this.m_CopyToOutput = (CopyToOutput) Enum.Parse(typeof(CopyToOutput), Helper.AttributeValue(node, "copyToOutput", this.m_CopyToOutput.ToString())); - this.m_PreservePath = bool.Parse( Helper.AttributeValue( node, "preservePath", bool.FalseString ) ); - - if( node == null ) - { - throw new ArgumentNullException("node"); - } - - m_Path = Helper.InterpolateForEnvironmentVariables(node.InnerText); - if(m_Path == null) - { - m_Path = ""; - } - - m_Path = m_Path.Trim(); - m_Valid = true; - if(!File.Exists(m_Path)) - { - m_Valid = false; - Kernel.Instance.Log.Write(LogType.Warning, "File does not exist: {0}", m_Path); - } - } - - #endregion - } -} diff --git a/Prebuild/src/Core/Nodes/FilesNode.cs b/Prebuild/src/Core/Nodes/FilesNode.cs deleted file mode 100644 index dc306c2..0000000 --- a/Prebuild/src/Core/Nodes/FilesNode.cs +++ /dev/null @@ -1,247 +0,0 @@ -#region BSD License -/* -Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com) - -Redistribution and use in source and binary forms, with or without modification, are permitted -provided that the following conditions are met: - -* Redistributions of source code must retain the above copyright notice, this list of conditions - and the following disclaimer. -* Redistributions in binary form must reproduce the above copyright notice, this list of conditions - and the following disclaimer in the documentation and/or other materials provided with the - distribution. -* The name of the author may not be used to endorse or promote products derived from this software - without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, -BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY -OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING -IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ -#endregion - -using System; -using System.Collections; -using System.Collections.Specialized; -using System.Xml; - -using Prebuild.Core.Attributes; -using Prebuild.Core.Interfaces; -using System.IO; - -namespace Prebuild.Core.Nodes -{ - /// - /// - /// - [DataNode("Files")] - public class FilesNode : DataNode - { - #region Fields - - private StringCollection m_Files; - private Hashtable m_BuildActions; - private Hashtable m_SubTypes; - private Hashtable m_ResourceNames; - private Hashtable m_CopyToOutputs; - private Hashtable m_Links; - private Hashtable m_LinkPaths; - private Hashtable m_PreservePaths; - - #endregion - - #region Constructors - - /// - /// - /// - public FilesNode() - { - m_Files = new StringCollection(); - m_BuildActions = new Hashtable(); - m_SubTypes = new Hashtable(); - m_ResourceNames = new Hashtable(); - m_CopyToOutputs = new Hashtable(); - m_Links = new Hashtable(); - m_LinkPaths = new Hashtable(); - m_PreservePaths = new Hashtable(); - } - - #endregion - - #region Properties - - /// - /// - /// - public int Count - { - get - { - return m_Files.Count; - } - } - - #endregion - - #region Public Methods - - /// - /// - /// - /// - /// - public BuildAction GetBuildAction(string file) - { - if(!m_BuildActions.ContainsKey(file)) - { - return BuildAction.Compile; - } - - return (BuildAction)m_BuildActions[file]; - } - - public CopyToOutput GetCopyToOutput(string file) - { - if (!this.m_CopyToOutputs.ContainsKey(file)) - { - return CopyToOutput.Never; - } - return (CopyToOutput) this.m_CopyToOutputs[file]; - } - - public bool GetIsLink(string file) - { - if (!this.m_Links.ContainsKey(file)) - { - return false; - } - return (bool) this.m_Links[file]; - } - - public string GetLinkPath( string file ) - { - if ( !this.m_LinkPaths.ContainsKey( file ) ) - { - return string.Empty; - } - return (string)this.m_LinkPaths[ file ]; - } - - /// - /// - /// - /// - /// - public SubType GetSubType(string file) - { - if(!m_SubTypes.ContainsKey(file)) - { - return SubType.Code; - } - - return (SubType)m_SubTypes[file]; - } - - /// - /// - /// - /// - /// - public string GetResourceName(string file) - { - if(!m_ResourceNames.ContainsKey(file)) - { - return ""; - } - - return (string)m_ResourceNames[file]; - } - - /// - /// - /// - /// - /// - public bool GetPreservePath( string file ) - { - if ( !m_PreservePaths.ContainsKey( file ) ) - { - return false; - } - - return (bool)m_PreservePaths[ file ]; - } - - /// - /// - /// - /// - public override void Parse(XmlNode node) - { - if( node == null ) - { - throw new ArgumentNullException("node"); - } - foreach(XmlNode child in node.ChildNodes) - { - IDataNode dataNode = Kernel.Instance.ParseNode(child, this); - if(dataNode is FileNode) - { - FileNode fileNode = (FileNode)dataNode; - if(fileNode.IsValid) - { - if (!m_Files.Contains(fileNode.Path)) - { - m_Files.Add(fileNode.Path); - m_BuildActions[fileNode.Path] = fileNode.BuildAction; - m_SubTypes[fileNode.Path] = fileNode.SubType; - m_ResourceNames[fileNode.Path] = fileNode.ResourceName; - this.m_PreservePaths[ fileNode.Path ] = fileNode.PreservePath; - this.m_Links[ fileNode.Path ] = fileNode.IsLink; - this.m_LinkPaths[ fileNode.Path ] = fileNode.LinkPath; - this.m_CopyToOutputs[ fileNode.Path ] = fileNode.CopyToOutput; - - } - } - } - else if(dataNode is MatchNode) - { - foreach(string file in ((MatchNode)dataNode).Files) - { - MatchNode matchNode = (MatchNode)dataNode; - if (!m_Files.Contains(file)) - { - m_Files.Add(file); - m_BuildActions[ file ] = matchNode.BuildAction == null ? GetBuildActionByFileName(file) : matchNode.BuildAction; - m_SubTypes[file] = matchNode.SubType == null ? GetSubTypeByFileName(file) : matchNode.SubType.Value; - m_ResourceNames[ file ] = matchNode.ResourceName; - this.m_PreservePaths[ file ] = matchNode.PreservePath; - this.m_Links[ file ] = matchNode.IsLink; - this.m_LinkPaths[ file ] = matchNode.LinkPath; - this.m_CopyToOutputs[ file ] = matchNode.CopyToOutput; - - } - } - } - } - } - - // TODO: Check in to why StringCollection's enumerator doesn't implement - // IEnumerator? - /// - /// - /// - /// - public StringEnumerator GetEnumerator() - { - return m_Files.GetEnumerator(); - } - - #endregion - - } -} diff --git a/Prebuild/src/Core/Nodes/MatchNode.cs b/Prebuild/src/Core/Nodes/MatchNode.cs deleted file mode 100644 index 656d7d0..0000000 --- a/Prebuild/src/Core/Nodes/MatchNode.cs +++ /dev/null @@ -1,330 +0,0 @@ -#region BSD License -/* -Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com) - -Redistribution and use in source and binary forms, with or without modification, are permitted -provided that the following conditions are met: - -* Redistributions of source code must retain the above copyright notice, this list of conditions - and the following disclaimer. -* Redistributions in binary form must reproduce the above copyright notice, this list of conditions - and the following disclaimer in the documentation and/or other materials provided with the - distribution. -* The name of the author may not be used to endorse or promote products derived from this software - without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, -BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY -OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING -IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ -#endregion - -using System; -using System.Collections.Generic; -using System.Collections.Specialized; -using System.IO; -using System.Text.RegularExpressions; -using System.Xml; - -using Prebuild.Core.Attributes; -using Prebuild.Core.Interfaces; -using Prebuild.Core.Utilities; -using System.Collections; - -namespace Prebuild.Core.Nodes -{ - /// - /// - /// - [DataNode("Match")] - public class MatchNode : DataNode - { - #region Fields - - private readonly StringCollection m_Files = new StringCollection(); - private Regex m_Regex; - private BuildAction? m_BuildAction; - private SubType? m_SubType; - string m_ResourceName = ""; - private CopyToOutput m_CopyToOutput; - private bool m_Link; - private string m_LinkPath; - private bool m_PreservePath; - private readonly List m_Exclusions = new List(); - - #endregion - - #region Properties - - /// - /// - /// - public StringCollection Files - { - get - { - return m_Files; - } - } - - /// - /// - /// - public BuildAction? BuildAction - { - get - { - return m_BuildAction; - } - } - - /// - /// - /// - public SubType? SubType - { - get - { - return m_SubType; - } - } - - public CopyToOutput CopyToOutput - { - get - { - return this.m_CopyToOutput; - } - } - - public bool IsLink - { - get - { - return this.m_Link; - } - } - - public string LinkPath - { - get - { - return this.m_LinkPath; - } - } - /// - /// - /// - public string ResourceName - { - get - { - return m_ResourceName; - } - } - - public bool PreservePath - { - get - { - return m_PreservePath; - } - } - - #endregion - - #region Private Methods - - /// - /// Recurses the directories. - /// - /// The path. - /// The pattern. - /// if set to true [recurse]. - /// if set to true [use regex]. - private void RecurseDirectories(string path, string pattern, bool recurse, bool useRegex, List exclusions) - { - Match match; - Boolean excludeFile; - try - { - string[] files; - - if(!useRegex) - { - files = Directory.GetFiles(path, pattern); - if(files != null) - { - string fileTemp; - foreach (string file in files) - { - excludeFile = false; - if (file.Substring(0,2) == "./" || file.Substring(0,2) == ".\\") - { - fileTemp = file.Substring(2); - } - else - { - fileTemp = file; - } - - // Check all excludions and set flag if there are any hits. - foreach ( ExcludeNode exclude in exclusions ) - { - Regex exRegEx = new Regex( exclude.Pattern ); - match = exRegEx.Match( file ); - excludeFile |= match.Success; - } - - if ( !excludeFile ) - { - m_Files.Add( fileTemp ); - } - - } - } - else - { - return; - } - } - else - { - files = Directory.GetFiles(path); - foreach(string file in files) - { - excludeFile = false; - - match = m_Regex.Match(file); - if(match.Success) - { - // Check all excludions and set flag if there are any hits. - foreach ( ExcludeNode exclude in exclusions ) - { - Regex exRegEx = new Regex( exclude.Pattern ); - match = exRegEx.Match( file ); - excludeFile |= !match.Success; - } - - if ( !excludeFile ) - { - m_Files.Add( file ); - } - } - } - } - - if(recurse) - { - string[] dirs = Directory.GetDirectories(path); - if(dirs != null && dirs.Length > 0) - { - foreach(string str in dirs) - { - RecurseDirectories(Helper.NormalizePath(str), pattern, recurse, useRegex, exclusions); - } - } - } - } - catch(DirectoryNotFoundException) - { - return; - } - catch(ArgumentException) - { - return; - } - } - - #endregion - - #region Public Methods - - /// - /// - /// - /// - public override void Parse(XmlNode node) - { - if( node == null ) - { - throw new ArgumentNullException("node"); - } - string path = Helper.AttributeValue(node, "path", "."); - string pattern = Helper.AttributeValue(node, "pattern", "*"); - bool recurse = (bool)Helper.TranslateValue(typeof(bool), Helper.AttributeValue(node, "recurse", "false")); - bool useRegex = (bool)Helper.TranslateValue(typeof(bool), Helper.AttributeValue(node, "useRegex", "false")); - string buildAction = Helper.AttributeValue(node, "buildAction", String.Empty); - if (buildAction != string.Empty) - m_BuildAction = (BuildAction)Enum.Parse(typeof(BuildAction), buildAction); - - //TODO: Figure out where the subtype node is being assigned - //string subType = Helper.AttributeValue(node, "subType", string.Empty); - //if (subType != String.Empty) - // m_SubType = (SubType)Enum.Parse(typeof(SubType), subType); - m_ResourceName = Helper.AttributeValue(node, "resourceName", m_ResourceName.ToString()); - this.m_CopyToOutput = (CopyToOutput) Enum.Parse(typeof(CopyToOutput), Helper.AttributeValue(node, "copyToOutput", this.m_CopyToOutput.ToString())); - this.m_Link = bool.Parse(Helper.AttributeValue(node, "link", bool.FalseString)); - if ( this.m_Link == true ) - { - this.m_LinkPath = Helper.AttributeValue( node, "linkPath", string.Empty ); - } - this.m_PreservePath = bool.Parse( Helper.AttributeValue( node, "preservePath", bool.FalseString ) ); - - - if(path != null && path.Length == 0) - { - path = ".";//use current directory - } - //throw new WarningException("Match must have a 'path' attribute"); - - if(pattern == null) - { - throw new WarningException("Match must have a 'pattern' attribute"); - } - - path = Helper.NormalizePath(path); - if(!Directory.Exists(path)) - { - throw new WarningException("Match path does not exist: {0}", path); - } - - try - { - if(useRegex) - { - m_Regex = new Regex(pattern); - } - } - catch(ArgumentException ex) - { - throw new WarningException("Could not compile regex pattern: {0}", ex.Message); - } - - - foreach(XmlNode child in node.ChildNodes) - { - IDataNode dataNode = Kernel.Instance.ParseNode(child, this); - if(dataNode is ExcludeNode) - { - ExcludeNode excludeNode = (ExcludeNode)dataNode; - m_Exclusions.Add( excludeNode ); - } - } - - RecurseDirectories( path, pattern, recurse, useRegex, m_Exclusions ); - - if(m_Files.Count < 1) - { - throw new WarningException("Match returned no files: {0}{1}", Helper.EndPath(path), pattern); - } - m_Regex = null; - } - - #endregion - } -} diff --git a/Prebuild/src/Core/Nodes/OptionsNode.cs b/Prebuild/src/Core/Nodes/OptionsNode.cs deleted file mode 100644 index b63034b..0000000 --- a/Prebuild/src/Core/Nodes/OptionsNode.cs +++ /dev/null @@ -1,644 +0,0 @@ -#region BSD License -/* -Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com) - -Redistribution and use in source and binary forms, with or without modification, are permitted -provided that the following conditions are met: - -* Redistributions of source code must retain the above copyright notice, this list of conditions - and the following disclaimer. -* Redistributions in binary form must reproduce the above copyright notice, this list of conditions - and the following disclaimer in the documentation and/or other materials provided with the - distribution. -* The name of the author may not be used to endorse or promote products derived from this software - without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, -BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY -OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING -IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ -#endregion - -using System; -using System.Collections; -using System.Collections.Specialized; -using System.Reflection; -using System.Xml; - -using Prebuild.Core.Attributes; -using Prebuild.Core.Interfaces; -using Prebuild.Core.Utilities; - -namespace Prebuild.Core.Nodes -{ - /// - /// - /// - [DataNode("Options")] - public class OptionsNode : DataNode - { - #region Fields - - private static Hashtable m_OptionFields; - - [OptionNode("CompilerDefines")] - private string m_CompilerDefines = ""; - - /// - /// - /// - public string CompilerDefines - { - get - { - return m_CompilerDefines; - } - set - { - m_CompilerDefines = value; - } - } - - [OptionNode("OptimizeCode")] - private bool m_OptimizeCode; - - /// - /// - /// - public bool OptimizeCode - { - get - { - return m_OptimizeCode; - } - set - { - m_OptimizeCode = value; - } - } - - [OptionNode("CheckUnderflowOverflow")] - private bool m_CheckUnderflowOverflow; - - /// - /// - /// - public bool CheckUnderflowOverflow - { - get - { - return m_CheckUnderflowOverflow; - } - set - { - m_CheckUnderflowOverflow = value; - } - } - - [OptionNode("AllowUnsafe")] - private bool m_AllowUnsafe; - - /// - /// - /// - public bool AllowUnsafe - { - get - { - return m_AllowUnsafe; - } - set - { - m_AllowUnsafe = value; - } - } - - [OptionNode("PreBuildEvent")] - private string m_PreBuildEvent; - - /// - /// - /// - public string PreBuildEvent - { - get - { - return m_PreBuildEvent; - } - set - { - m_PreBuildEvent = value; - } - } - - [OptionNode("PostBuildEvent")] - private string m_PostBuildEvent; - - /// - /// - /// - public string PostBuildEvent - { - get - { - return m_PostBuildEvent; - } - set - { - m_PostBuildEvent = value; - } - } - - [OptionNode("PreBuildEventArgs")] - private string m_PreBuildEventArgs; - - /// - /// - /// - public string PreBuildEventArgs - { - get - { - return m_PreBuildEventArgs; - } - set - { - m_PreBuildEventArgs = value; - } - } - - [OptionNode("PostBuildEventArgs")] - private string m_PostBuildEventArgs; - - /// - /// - /// - public string PostBuildEventArgs - { - get - { - return m_PostBuildEventArgs; - } - set - { - m_PostBuildEventArgs = value; - } - } - - [OptionNode("RunPostBuildEvent")] - private string m_RunPostBuildEvent; - - /// - /// - /// - public string RunPostBuildEvent - { - get - { - return m_RunPostBuildEvent; - } - set - { - m_RunPostBuildEvent = value; - } - } - - [OptionNode("RunScript")] - private string m_RunScript; - - /// - /// - /// - public string RunScript - { - get - { - return m_RunScript; - } - set - { - m_RunScript = value; - } - } - - [OptionNode("WarningLevel")] - private int m_WarningLevel = 4; - - /// - /// - /// - public int WarningLevel - { - get - { - return m_WarningLevel; - } - set - { - m_WarningLevel = value; - } - } - - [OptionNode("WarningsAsErrors")] - private bool m_WarningsAsErrors; - - /// - /// - /// - public bool WarningsAsErrors - { - get - { - return m_WarningsAsErrors; - } - set - { - m_WarningsAsErrors = value; - } - } - - [OptionNode("SuppressWarnings")] - private string m_SuppressWarnings = ""; - - /// - /// - /// - public string SuppressWarnings - { - get - { - return m_SuppressWarnings; - } - set - { - m_SuppressWarnings = value; - } - } - - [OptionNode("OutputPath")] - private string m_OutputPath = "bin/"; - - /// - /// - /// - public string OutputPath - { - get - { - return m_OutputPath; - } - set - { - m_OutputPath = value; - } - } - - [OptionNode("GenerateDocumentation")] - private bool m_GenerateDocumentation; - - /// - /// - /// - public bool GenerateDocumentation - { - get - { - return m_GenerateDocumentation; - } - set - { - m_GenerateDocumentation = value; - } - } - - [OptionNode("GenerateXmlDocFile")] - private bool m_GenerateXmlDocFile; - - /// - /// - /// - public bool GenerateXmlDocFile - { - get - { - return m_GenerateXmlDocFile; - } - set - { - m_GenerateXmlDocFile = value; - } - } - - [OptionNode("XmlDocFile")] - private string m_XmlDocFile = ""; - - /// - /// - /// - public string XmlDocFile - { - get - { - return m_XmlDocFile; - } - set - { - m_XmlDocFile = value; - } - } - - [OptionNode("KeyFile")] - private string m_KeyFile = ""; - - /// - /// - /// - public string KeyFile - { - get - { - return m_KeyFile; - } - set - { - m_KeyFile = value; - } - } - - [OptionNode("DebugInformation")] - private bool m_DebugInformation; - - /// - /// - /// - public bool DebugInformation - { - get - { - return m_DebugInformation; - } - set - { - m_DebugInformation = value; - } - } - - [OptionNode("RegisterComInterop")] - private bool m_RegisterComInterop; - - /// - /// - /// - public bool RegisterComInterop - { - get - { - return m_RegisterComInterop; - } - set - { - m_RegisterComInterop = value; - } - } - - [OptionNode("RemoveIntegerChecks")] - private bool m_RemoveIntegerChecks; - - /// - /// - /// - public bool RemoveIntegerChecks - { - get - { - return m_RemoveIntegerChecks; - } - set - { - m_RemoveIntegerChecks = value; - } - } - - [OptionNode("IncrementalBuild")] - private bool m_IncrementalBuild; - - /// - /// - /// - public bool IncrementalBuild - { - get - { - return m_IncrementalBuild; - } - set - { - m_IncrementalBuild = value; - } - } - - [OptionNode("BaseAddress")] - private string m_BaseAddress = "285212672"; - - /// - /// - /// - public string BaseAddress - { - get - { - return m_BaseAddress; - } - set - { - m_BaseAddress = value; - } - } - - [OptionNode("FileAlignment")] - private int m_FileAlignment = 4096; - - /// - /// - /// - public int FileAlignment - { - get - { - return m_FileAlignment; - } - set - { - m_FileAlignment = value; - } - } - - [OptionNode("NoStdLib")] - private bool m_NoStdLib; - - /// - /// - /// - public bool NoStdLib - { - get - { - return m_NoStdLib; - } - set - { - m_NoStdLib = value; - } - } - - private StringCollection m_FieldsDefined; - - #endregion - - #region Constructors - - /// - /// Initializes the class. - /// - static OptionsNode() - { - Type t = typeof(OptionsNode); - - m_OptionFields = new Hashtable(); - foreach(FieldInfo f in t.GetFields(BindingFlags.NonPublic | BindingFlags.Instance)) - { - object[] attrs = f.GetCustomAttributes(typeof(OptionNodeAttribute), false); - if(attrs == null || attrs.Length < 1) - { - continue; - } - - OptionNodeAttribute ona = (OptionNodeAttribute)attrs[0]; - m_OptionFields[ona.NodeName] = f; - } - } - - /// - /// Initializes a new instance of the class. - /// - public OptionsNode() - { - m_FieldsDefined = new StringCollection(); - } - - #endregion - - #region Properties - - /// - /// Gets the at the specified index. - /// - /// - public object this[string index] - { - get - { - if(!m_OptionFields.ContainsKey(index)) - { - return null; - } - - FieldInfo f = (FieldInfo)m_OptionFields[index]; - return f.GetValue(this); - } - } - - /// - /// Gets the at the specified index. - /// - /// - public object this[string index, object defaultValue] - { - get - { - object valueObject = this[index]; - if(valueObject != null && valueObject is string && ((string)valueObject).Length == 0) - { - return defaultValue; - } - return valueObject; - } - } - - - #endregion - - #region Private Methods - - private void FlagDefined(string name) - { - if(!m_FieldsDefined.Contains(name)) - { - m_FieldsDefined.Add(name); - } - } - - private void SetOption(string nodeName, string val) - { - lock(m_OptionFields) - { - if(!m_OptionFields.ContainsKey(nodeName)) - { - return; - } - - FieldInfo f = (FieldInfo)m_OptionFields[nodeName]; - f.SetValue(this, Helper.TranslateValue(f.FieldType, val)); - FlagDefined(f.Name); - } - } - - #endregion - - #region Public Methods - - /// - /// Parses the specified node. - /// - /// The node. - public override void Parse(XmlNode node) - { - if( node == null ) - { - throw new ArgumentNullException("node"); - } - - foreach(XmlNode child in node.ChildNodes) - { - SetOption(child.Name, Helper.InterpolateForEnvironmentVariables(child.InnerText)); - } - } - - /// - /// Copies to. - /// - /// The opt. - public void CopyTo(OptionsNode opt) - { - if(opt == null) - { - return; - } - - foreach(FieldInfo f in m_OptionFields.Values) - { - if(m_FieldsDefined.Contains(f.Name)) - { - f.SetValue(opt, f.GetValue(this)); - opt.m_FieldsDefined.Add(f.Name); - } - } - } - - #endregion - } -} diff --git a/Prebuild/src/Core/Nodes/ProcessNode.cs b/Prebuild/src/Core/Nodes/ProcessNode.cs deleted file mode 100644 index 6bfbe16..0000000 --- a/Prebuild/src/Core/Nodes/ProcessNode.cs +++ /dev/null @@ -1,110 +0,0 @@ -#region BSD License -/* -Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com) - -Redistribution and use in source and binary forms, with or without modification, are permitted -provided that the following conditions are met: - -* Redistributions of source code must retain the above copyright notice, this list of conditions - and the following disclaimer. -* Redistributions in binary form must reproduce the above copyright notice, this list of conditions - and the following disclaimer in the documentation and/or other materials provided with the - distribution. -* The name of the author may not be used to endorse or promote products derived from this software - without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, -BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY -OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING -IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ -#endregion - -using System; -using System.Collections; -using System.Collections.Specialized; -using System.Xml; - -using Prebuild.Core.Attributes; -using Prebuild.Core.Interfaces; -using Prebuild.Core.Utilities; - -namespace Prebuild.Core.Nodes -{ - /// - /// - /// - [DataNode("Process")] - public class ProcessNode : DataNode - { - #region Fields - - private string m_Path; - private bool m_IsValid = true; - - #endregion - - #region Properties - - /// - /// Gets the path. - /// - /// The path. - public string Path - { - get - { - return m_Path; - } - } - - /// - /// Gets a value indicating whether this instance is valid. - /// - /// true if this instance is valid; otherwise, false. - public bool IsValid - { - get - { - return m_IsValid; - } - } - - #endregion - - #region Public Methods - - /// - /// Parses the specified node. - /// - /// The node. - public override void Parse(XmlNode node) - { - if( node == null ) - { - throw new ArgumentNullException("node"); - } - - m_Path = Helper.InterpolateForEnvironmentVariables(node.InnerText); - if(m_Path == null) - { - m_Path = ""; - } - - try - { - m_Path = Helper.ResolvePath(m_Path); - } - catch(ArgumentException) - { - Kernel.Instance.Log.Write(LogType.Warning, "Could not find prebuild file for processing: {0}", m_Path); - m_IsValid = false; - } - } - - #endregion - } -} diff --git a/Prebuild/src/Core/Nodes/ProjectNode.cs b/Prebuild/src/Core/Nodes/ProjectNode.cs deleted file mode 100644 index 04af7a3..0000000 --- a/Prebuild/src/Core/Nodes/ProjectNode.cs +++ /dev/null @@ -1,580 +0,0 @@ -#region BSD License -/* -Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com) - -Redistribution and use in source and binary forms, with or without modification, are permitted -provided that the following conditions are met: - -* Redistributions of source code must retain the above copyright notice, this list of conditions - and the following disclaimer. -* Redistributions in binary form must reproduce the above copyright notice, this list of conditions - and the following disclaimer in the documentation and/or other materials provided with the - distribution. -* The name of the author may not be used to endorse or promote products derived from this software - without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, -BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY -OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING -IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ -#endregion - -using System; -using System.Collections; -using System.Collections.Generic; -using System.IO; -using System.Xml; - -using Prebuild.Core.Attributes; -using Prebuild.Core.Interfaces; -using Prebuild.Core.Utilities; - -namespace Prebuild.Core.Nodes -{ - /// - /// A set of values that the Project's type can be - /// - public enum ProjectType - { - /// - /// The project is a console executable - /// - Exe, - /// - /// The project is a windows executable - /// - WinExe, - /// - /// The project is a library - /// - Library, - /// - /// The project is a website - /// - Web, - } - - /// - /// - /// - public enum ClrRuntime - { - /// - /// - /// - Microsoft, - /// - /// - /// - Mono - } - /// - /// The version of the .NET framework to use (Required for VS2008) - /// We don't need .NET 1.1 in here, it'll default when using vs2003. - /// - public enum FrameworkVersion - { - /// - /// .NET 2.0 - /// - v2_0, - /// - /// .NET 3.0 - /// - v3_0, - /// - /// .NET 3.5 - /// - v3_5, - /// - /// .NET 4.0 - /// - v4_0, - } - /// - /// The Node object representing /Prebuild/Solution/Project elements - /// - [DataNode("Project")] - public class ProjectNode : DataNode, IComparable - { - #region Fields - - private string m_Name = "unknown"; - private string m_Path = ""; - private string m_FullPath = ""; - private string m_AssemblyName; - private string m_AppIcon = ""; - private string m_ConfigFile = ""; - private string m_DesignerFolder = ""; - private string m_Language = "C#"; - private ProjectType m_Type = ProjectType.Exe; - private ClrRuntime m_Runtime = ClrRuntime.Microsoft; - private FrameworkVersion m_Framework = FrameworkVersion.v2_0; - private string m_StartupObject = ""; - private string m_RootNamespace; - private string m_FilterGroups = ""; - private string m_Version = ""; - private Guid m_Guid; - private string m_DebugStartParameters; - - private Hashtable m_Configurations = new Hashtable(); - private readonly List m_ReferencePaths = new List(); - private readonly List m_References = new List(); - private readonly List m_Authors = new List(); - private FilesNode m_Files; - - #endregion - - #region Properties - - /// - /// Gets the name. - /// - /// The name. - public string Name - { - get - { - return m_Name; - } - } - /// - /// The version of the .NET Framework to compile under - /// - public FrameworkVersion FrameworkVersion - { - get - { - return this.m_Framework; - } - } - /// - /// Gets the path. - /// - /// The path. - public string Path - { - get - { - return m_Path; - } - } - - /// - /// Gets the filter groups. - /// - /// The filter groups. - public string FilterGroups - { - get - { - return m_FilterGroups; - } - } - - /// - /// Gets the project's version - /// - /// The project's version. - public string Version - { - get - { - return m_Version; - } - } - - /// - /// Gets the full path. - /// - /// The full path. - public string FullPath - { - get - { - return m_FullPath; - } - } - - /// - /// Gets the name of the assembly. - /// - /// The name of the assembly. - public string AssemblyName - { - get - { - return m_AssemblyName; - } - } - - /// - /// Gets the app icon. - /// - /// The app icon. - public string AppIcon - { - get - { - return m_AppIcon; - } - } - - /// - /// Gets the app icon. - /// - /// The app icon. - public string ConfigFile - { - get - { - return m_ConfigFile; - } - } - - /// - /// - /// - public string DesignerFolder - { - get - { - return m_DesignerFolder; - } - } - - /// - /// Gets the language. - /// - /// The language. - public string Language - { - get - { - return m_Language; - } - } - - /// - /// Gets the type. - /// - /// The type. - public ProjectType Type - { - get - { - return m_Type; - } - } - - /// - /// Gets the runtime. - /// - /// The runtime. - public ClrRuntime Runtime - { - get - { - return m_Runtime; - } - } - - private bool m_GenerateAssemblyInfoFile = false; - - /// - /// - /// - public bool GenerateAssemblyInfoFile - { - get - { - return m_GenerateAssemblyInfoFile; - } - set - { - m_GenerateAssemblyInfoFile = value; - } - } - - /// - /// Gets the startup object. - /// - /// The startup object. - public string StartupObject - { - get - { - return m_StartupObject; - } - } - - /// - /// Gets the root namespace. - /// - /// The root namespace. - public string RootNamespace - { - get - { - return m_RootNamespace; - } - } - - /// - /// Gets the configurations. - /// - /// The configurations. - public IList Configurations - { - get - { - ArrayList tmp = new ArrayList(ConfigurationsTable.Values); - tmp.Sort(); - return tmp; - } - } - - /// - /// Gets the configurations table. - /// - /// The configurations table. - public Hashtable ConfigurationsTable - { - get - { - return m_Configurations; - } - } - - /// - /// Gets the reference paths. - /// - /// The reference paths. - public List ReferencePaths - { - get - { - List tmp = new List(m_ReferencePaths); - tmp.Sort(); - return tmp; - } - } - - /// - /// Gets the references. - /// - /// The references. - public List References - { - get - { - List tmp = new List(m_References); - tmp.Sort(); - return tmp; - } - } - - /// - /// Gets the Authors list. - /// - /// The list of the project's authors. - public List Authors - { - get - { - return m_Authors; - } - } - - /// - /// Gets the files. - /// - /// The files. - public FilesNode Files - { - get - { - return m_Files; - } - } - - /// - /// Gets or sets the parent. - /// - /// The parent. - public override IDataNode Parent - { - get - { - return base.Parent; - } - set - { - base.Parent = value; - if(base.Parent is SolutionNode && m_Configurations.Count < 1) - { - SolutionNode parent = (SolutionNode)base.Parent; - foreach(ConfigurationNode conf in parent.Configurations) - { - m_Configurations[conf.Name] = conf.Clone(); - } - } - } - } - - /// - /// Gets the GUID. - /// - /// The GUID. - public Guid Guid - { - get - { - return m_Guid; - } - } - - public string DebugStartParameters - { - get - { - return m_DebugStartParameters; - } - } - - #endregion - - #region Private Methods - - private void HandleConfiguration(ConfigurationNode conf) - { - if(String.Compare(conf.Name, "all", true) == 0) //apply changes to all, this may not always be applied first, - //so it *may* override changes to the same properties for configurations defines at the project level - { - foreach(ConfigurationNode confNode in this.m_Configurations.Values) - { - conf.CopyTo(confNode);//update the config templates defines at the project level with the overrides - } - } - if(m_Configurations.ContainsKey(conf.Name)) - { - ConfigurationNode parentConf = (ConfigurationNode)m_Configurations[conf.Name]; - conf.CopyTo(parentConf);//update the config templates defines at the project level with the overrides - } - else - { - m_Configurations[conf.Name] = conf; - } - } - - #endregion - - #region Public Methods - - /// - /// Parses the specified node. - /// - /// The node. - public override void Parse(XmlNode node) - { - m_Name = Helper.AttributeValue(node, "name", m_Name); - m_Path = Helper.AttributeValue(node, "path", m_Path); - m_FilterGroups = Helper.AttributeValue(node, "filterGroups", m_FilterGroups); - m_Version = Helper.AttributeValue(node, "version", m_Version); - m_AppIcon = Helper.AttributeValue(node, "icon", m_AppIcon); - m_ConfigFile = Helper.AttributeValue(node, "configFile", m_ConfigFile); - m_DesignerFolder = Helper.AttributeValue(node, "designerFolder", m_DesignerFolder); - m_AssemblyName = Helper.AttributeValue(node, "assemblyName", m_AssemblyName); - m_Language = Helper.AttributeValue(node, "language", m_Language); - m_Type = (ProjectType)Helper.EnumAttributeValue(node, "type", typeof(ProjectType), m_Type); - m_Runtime = (ClrRuntime)Helper.EnumAttributeValue(node, "runtime", typeof(ClrRuntime), m_Runtime); - m_Framework = (FrameworkVersion)Helper.EnumAttributeValue(node, "frameworkVersion", typeof(FrameworkVersion), m_Framework); - m_StartupObject = Helper.AttributeValue(node, "startupObject", m_StartupObject); - m_RootNamespace = Helper.AttributeValue(node, "rootNamespace", m_RootNamespace); - - int hash = m_Name.GetHashCode(); - Guid guidByHash = new Guid(hash, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); - string guid = Helper.AttributeValue(node, "guid", guidByHash.ToString()); - m_Guid = new Guid(guid); - - m_GenerateAssemblyInfoFile = Helper.ParseBoolean(node, "generateAssemblyInfoFile", false); - m_DebugStartParameters = Helper.AttributeValue(node, "debugStartParameters", string.Empty); - - if(m_AssemblyName == null || m_AssemblyName.Length < 1) - { - m_AssemblyName = m_Name; - } - - if(m_RootNamespace == null || m_RootNamespace.Length < 1) - { - m_RootNamespace = m_Name; - } - - m_FullPath = m_Path; - try - { - m_FullPath = Helper.ResolvePath(m_FullPath); - } - catch - { - throw new WarningException("Could not resolve Solution path: {0}", m_Path); - } - - Kernel.Instance.CurrentWorkingDirectory.Push(); - try - { - Helper.SetCurrentDir(m_FullPath); - - if( node == null ) - { - throw new ArgumentNullException("node"); - } - - foreach(XmlNode child in node.ChildNodes) - { - IDataNode dataNode = Kernel.Instance.ParseNode(child, this); - if(dataNode is ConfigurationNode) - { - HandleConfiguration((ConfigurationNode)dataNode); - } - else if(dataNode is ReferencePathNode) - { - m_ReferencePaths.Add((ReferencePathNode)dataNode); - } - else if(dataNode is ReferenceNode) - { - m_References.Add((ReferenceNode)dataNode); - } - else if(dataNode is AuthorNode) - { - m_Authors.Add((AuthorNode)dataNode); - } - else if(dataNode is FilesNode) - { - m_Files = (FilesNode)dataNode; - } - } - } - finally - { - Kernel.Instance.CurrentWorkingDirectory.Pop(); - } - } - - #endregion - - #region IComparable Members - - public int CompareTo(object obj) - { - ProjectNode that = (ProjectNode)obj; - return this.m_Name.CompareTo(that.m_Name); - } - - #endregion - } -} diff --git a/Prebuild/src/Core/Nodes/ReferenceNode.cs b/Prebuild/src/Core/Nodes/ReferenceNode.cs deleted file mode 100644 index 9c5d1a3..0000000 --- a/Prebuild/src/Core/Nodes/ReferenceNode.cs +++ /dev/null @@ -1,144 +0,0 @@ -#region BSD License -/* -Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com) - -Redistribution and use in source and binary forms, with or without modification, are permitted -provided that the following conditions are met: - -* Redistributions of source code must retain the above copyright notice, this list of conditions - and the following disclaimer. -* Redistributions in binary form must reproduce the above copyright notice, this list of conditions - and the following disclaimer in the documentation and/or other materials provided with the - distribution. -* The name of the author may not be used to endorse or promote products derived from this software - without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, -BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY -OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING -IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ -#endregion - -using System; -using System.Xml; - -using Prebuild.Core.Attributes; -using Prebuild.Core.Interfaces; -using Prebuild.Core.Utilities; - -namespace Prebuild.Core.Nodes -{ - /// - /// - /// - [DataNode("Reference")] - public class ReferenceNode : DataNode, IComparable - { - #region Fields - - private string m_Name = "unknown"; - private string m_Path; - private string m_LocalCopy; - private string m_Version; - - #endregion - - #region Properties - - /// - /// Gets the name. - /// - /// The name. - public string Name - { - get - { - return m_Name; - } - } - - /// - /// Gets the path. - /// - /// The path. - public string Path - { - get - { - return m_Path; - } - } - - /// - /// Gets a value indicating whether [local copy specified]. - /// - /// true if [local copy specified]; otherwise, false. - public bool LocalCopySpecified - { - get - { - return ( m_LocalCopy != null && m_LocalCopy.Length == 0); - } - } - - /// - /// Gets a value indicating whether [local copy]. - /// - /// true if [local copy]; otherwise, false. - public bool LocalCopy - { - get - { - if( m_LocalCopy == null) - { - return false; - } - return bool.Parse(m_LocalCopy); - } - } - - /// - /// Gets the version. - /// - /// The version. - public string Version - { - get - { - return m_Version; - } - } - - #endregion - - #region Public Methods - - /// - /// Parses the specified node. - /// - /// The node. - public override void Parse(XmlNode node) - { - m_Name = Helper.AttributeValue(node, "name", m_Name); - m_Path = Helper.AttributeValue(node, "path", m_Path); - m_LocalCopy = Helper.AttributeValue(node, "localCopy", m_LocalCopy); - m_Version = Helper.AttributeValue(node, "version", m_Version); - } - - #endregion - - #region IComparable Members - - public int CompareTo(object obj) - { - ReferenceNode that = (ReferenceNode)obj; - return this.m_Name.CompareTo(that.m_Name); - } - - #endregion - } -} diff --git a/Prebuild/src/Core/Nodes/ReferencePathNode.cs b/Prebuild/src/Core/Nodes/ReferencePathNode.cs deleted file mode 100644 index f0543c2..0000000 --- a/Prebuild/src/Core/Nodes/ReferencePathNode.cs +++ /dev/null @@ -1,99 +0,0 @@ -#region BSD License -/* -Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com) - -Redistribution and use in source and binary forms, with or without modification, are permitted -provided that the following conditions are met: - -* Redistributions of source code must retain the above copyright notice, this list of conditions - and the following disclaimer. -* Redistributions in binary form must reproduce the above copyright notice, this list of conditions - and the following disclaimer in the documentation and/or other materials provided with the - distribution. -* The name of the author may not be used to endorse or promote products derived from this software - without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, -BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY -OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING -IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ -#endregion - -using System; -using System.Collections; -using System.Collections.Specialized; -using System.Xml; - -using Prebuild.Core.Attributes; -using Prebuild.Core.Interfaces; -using Prebuild.Core.Utilities; - -namespace Prebuild.Core.Nodes -{ - /// - /// - /// - [DataNode("ReferencePath")] - public class ReferencePathNode : DataNode, IComparable - { - #region Fields - - private string m_Path; - - #endregion - - #region Properties - - /// - /// Gets the path. - /// - /// The path. - public string Path - { - get - { - return m_Path; - } - } - - #endregion - - #region Public Methods - - /// - /// Parses the specified node. - /// - /// The node. - public override void Parse(XmlNode node) - { - if( node == null ) - { - throw new ArgumentNullException("node"); - } - - m_Path = Helper.InterpolateForEnvironmentVariables(node.InnerText); - if(m_Path == null) - { - m_Path = ""; - } - - m_Path = m_Path.Trim(); - } - - #endregion - - #region IComparable Members - - public int CompareTo(object obj) - { - ReferencePathNode that = (ReferencePathNode)obj; - return this.m_Path.CompareTo(that.m_Path); - } - - #endregion - } -} diff --git a/Prebuild/src/Core/Nodes/SolutionNode.cs b/Prebuild/src/Core/Nodes/SolutionNode.cs deleted file mode 100644 index 2a1b8e2..0000000 --- a/Prebuild/src/Core/Nodes/SolutionNode.cs +++ /dev/null @@ -1,358 +0,0 @@ -#region BSD License -/* -Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com) - -Redistribution and use in source and binary forms, with or without modification, are permitted -provided that the following conditions are met: - -* Redistributions of source code must retain the above copyright notice, this list of conditions - and the following disclaimer. -* Redistributions in binary form must reproduce the above copyright notice, this list of conditions - and the following disclaimer in the documentation and/or other materials provided with the - distribution. -* The name of the author may not be used to endorse or promote products derived from this software - without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, -BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY -OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING -IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ -#endregion - -using System; -using System.Collections; -using System.Collections.Generic; -using System.Diagnostics; -using System.IO; -using System.Xml; - -using Prebuild.Core.Attributes; -using Prebuild.Core.Interfaces; -using Prebuild.Core.Utilities; - -namespace Prebuild.Core.Nodes -{ - /// - /// - /// - [DataNode("Solution")] - [DataNode("EmbeddedSolution")] - [DebuggerDisplay("{Name}")] - public class SolutionNode : DataNode - { - #region Fields - - private Guid m_Guid = Guid.NewGuid(); - private string m_Name = "unknown"; - private string m_Path = ""; - private string m_FullPath = ""; - private string m_ActiveConfig = "Debug"; - private string m_Version = "1.0.0"; - - private OptionsNode m_Options; - private FilesNode m_Files; - private readonly Hashtable m_Configurations = new Hashtable(); - private readonly Hashtable m_Projects = new Hashtable(); - private readonly Hashtable m_DatabaseProjects = new Hashtable(); - private readonly List m_ProjectsOrder = new List(); - private readonly Hashtable m_Solutions = new Hashtable(); - - #endregion - - #region Properties - public override IDataNode Parent - { - get - { - return base.Parent; - } - set - { - if (value is SolutionNode) - { - SolutionNode solution = (SolutionNode)value; - foreach (ConfigurationNode conf in solution.Configurations) - { - m_Configurations[conf.Name] = conf.Clone(); - } - } - - base.Parent = value; - } - } - - public Guid Guid - { - get - { - return m_Guid; - } - set - { - m_Guid = value; - } - } - /// - /// Gets or sets the active config. - /// - /// The active config. - public string ActiveConfig - { - get - { - return m_ActiveConfig; - } - set - { - m_ActiveConfig = value; - } - } - - /// - /// Gets the name. - /// - /// The name. - public string Name - { - get - { - return m_Name; - } - } - - /// - /// Gets the path. - /// - /// The path. - public string Path - { - get - { - return m_Path; - } - } - - /// - /// Gets the full path. - /// - /// The full path. - public string FullPath - { - get - { - return m_FullPath; - } - } - - /// - /// Gets the version. - /// - /// The version. - public string Version - { - get - { - return m_Version; - } - } - - /// - /// Gets the options. - /// - /// The options. - public OptionsNode Options - { - get - { - return m_Options; - } - } - - /// - /// Gets the files. - /// - /// The files. - public FilesNode Files - { - get - { - return m_Files; - } - } - - /// - /// Gets the configurations. - /// - /// The configurations. - public ICollection Configurations - { - get - { - ArrayList tmp = new ArrayList(ConfigurationsTable.Values); - tmp.Sort(); - return tmp; - } - } - - /// - /// Gets the configurations table. - /// - /// The configurations table. - public Hashtable ConfigurationsTable - { - get - { - return m_Configurations; - } - } - /// - /// Gets the database projects. - /// - public ICollection DatabaseProjects - { - get - { - return m_DatabaseProjects.Values; - } - } - /// - /// Gets the nested solutions. - /// - public ICollection Solutions - { - get - { - return m_Solutions.Values; - } - } - /// - /// Gets the nested solutions hash table. - /// - public Hashtable SolutionsTable - { - get - { - return this.m_Solutions; - } - } - /// - /// Gets the projects. - /// - /// The projects. - public ICollection Projects - { - get - { - ArrayList tmp = new ArrayList(m_Projects.Values); - tmp.Sort(); - return tmp; - } - } - - /// - /// Gets the projects table. - /// - /// The projects table. - public Hashtable ProjectsTable - { - get - { - return m_Projects; - } - } - - /// - /// Gets the projects table. - /// - /// The projects table. - public List ProjectsTableOrder - { - get - { - return m_ProjectsOrder; - } - } - - #endregion - - #region Public Methods - - /// - /// Parses the specified node. - /// - /// The node. - public override void Parse(XmlNode node) - { - m_Name = Helper.AttributeValue(node, "name", m_Name); - m_ActiveConfig = Helper.AttributeValue(node, "activeConfig", m_ActiveConfig); - m_Path = Helper.AttributeValue(node, "path", m_Path); - m_Version = Helper.AttributeValue(node, "version", m_Version); - - m_FullPath = m_Path; - try - { - m_FullPath = Helper.ResolvePath(m_FullPath); - } - catch - { - throw new WarningException("Could not resolve solution path: {0}", m_Path); - } - - Kernel.Instance.CurrentWorkingDirectory.Push(); - try - { - Helper.SetCurrentDir(m_FullPath); - - if( node == null ) - { - throw new ArgumentNullException("node"); - } - - foreach(XmlNode child in node.ChildNodes) - { - IDataNode dataNode = Kernel.Instance.ParseNode(child, this); - if(dataNode is OptionsNode) - { - m_Options = (OptionsNode)dataNode; - } - else if(dataNode is FilesNode) - { - m_Files = (FilesNode)dataNode; - } - else if(dataNode is ConfigurationNode) - { - m_Configurations[((ConfigurationNode)dataNode).Name] = dataNode; - } - else if(dataNode is ProjectNode) - { - m_Projects[((ProjectNode)dataNode).Name] = dataNode; - m_ProjectsOrder.Add((ProjectNode)dataNode); - } - else if(dataNode is SolutionNode) - { - m_Solutions[((SolutionNode)dataNode).Name] = dataNode; - } - else if (dataNode is ProcessNode) - { - ProcessNode p = (ProcessNode)dataNode; - Kernel.Instance.ProcessFile(p, this); - } - else if (dataNode is DatabaseProjectNode) - { - m_DatabaseProjects[((DatabaseProjectNode)dataNode).Name] = dataNode; - } - } - } - finally - { - Kernel.Instance.CurrentWorkingDirectory.Pop(); - } - } - - #endregion - } -} diff --git a/Prebuild/src/Core/Parse/IfContext.cs b/Prebuild/src/Core/Parse/IfContext.cs deleted file mode 100644 index 3c79d38..0000000 --- a/Prebuild/src/Core/Parse/IfContext.cs +++ /dev/null @@ -1,154 +0,0 @@ -#region BSD License -/* -Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com) - -Redistribution and use in source and binary forms, with or without modification, are permitted -provided that the following conditions are met: - -* Redistributions of source code must retain the above copyright notice, this list of conditions - and the following disclaimer. -* Redistributions in binary form must reproduce the above copyright notice, this list of conditions - and the following disclaimer in the documentation and/or other materials provided with the - distribution. -* The name of the author may not be used to endorse or promote products derived from this software - without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, -BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY -OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING -IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ -#endregion - -using System; - -namespace Prebuild.Core.Parse -{ - /// - /// - /// - public enum IfState - { - /// - /// - /// - None, - /// - /// - /// - If, - /// - /// - /// - ElseIf, - /// - /// - /// - Else - } - - /// - /// Summary description for IfContext. - /// - // Inspired by the equivalent WiX class (see www.sourceforge.net/projects/wix/) - public class IfContext - { - #region Properties - - bool m_Active; - bool m_Keep; - bool m_EverKept; - IfState m_State = IfState.None; - - #endregion - - #region Constructors - - /// - /// Initializes a new instance of the class. - /// - /// if set to true [active]. - /// if set to true [keep]. - /// The state. - public IfContext(bool active, bool keep, IfState state) - { - m_Active = active; - m_Keep = keep; - m_EverKept = keep; - m_State = state; - } - - #endregion - - #region Properties - - /// - /// Gets or sets a value indicating whether this is active. - /// - /// true if active; otherwise, false. - public bool Active - { - get - { - return m_Active; - } - set - { - m_Active = value; - } - } - - /// - /// Gets or sets a value indicating whether this is keep. - /// - /// true if keep; otherwise, false. - public bool Keep - { - get - { - return m_Keep; - } - set - { - m_Keep = value; - if(m_Keep) - { - m_EverKept = true; - } - } - } - - /// - /// Gets a value indicating whether [ever kept]. - /// - /// true if [ever kept]; otherwise, false. - public bool EverKept - { - get - { - return m_EverKept; - } - } - - /// - /// Gets or sets the state. - /// - /// The state. - public IfState State - { - get - { - return m_State; - } - set - { - m_State = value; - } - } - - #endregion - } -} diff --git a/Prebuild/src/Core/Parse/Preprocessor.cs b/Prebuild/src/Core/Parse/Preprocessor.cs deleted file mode 100644 index b2306e4..0000000 --- a/Prebuild/src/Core/Parse/Preprocessor.cs +++ /dev/null @@ -1,663 +0,0 @@ -#region BSD License -/* -Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com) - -Redistribution and use in source and binary forms, with or without modification, are permitted -provided that the following conditions are met: - -* Redistributions of source code must retain the above copyright notice, this list of conditions - and the following disclaimer. -* Redistributions in binary form must reproduce the above copyright notice, this list of conditions - and the following disclaimer in the documentation and/or other materials provided with the - distribution. -* The name of the author may not be used to endorse or promote products derived from this software - without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, -BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY -OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING -IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ -#endregion - -using System; -using System.Collections; -using System.IO; -using System.Text.RegularExpressions; -using System.Xml; - -namespace Prebuild.Core.Parse -{ - /// - /// - /// - public enum OperatorSymbol - { - /// - /// - /// - None, - /// - /// - /// - Equal, - /// - /// - /// - NotEqual, - /// - /// - /// - LessThan, - /// - /// - /// - GreaterThan, - /// - /// - /// - LessThanEqual, - /// - /// - /// - GreaterThanEqual - } - - /// - /// - /// - public class Preprocessor - { - #region Constants - - /// - /// Includes the regex to look for file tags in the processing instruction. - /// - private static readonly Regex includeFileRegex = new Regex("file=\"(.+?)\""); - - #endregion - - #region Fields - - XmlDocument m_OutDoc; - Stack m_IfStack; - Hashtable m_Variables; - - #endregion - - #region Constructors - - /// - /// Initializes a new instance of the class. - /// - public Preprocessor() - { - m_OutDoc = new XmlDocument(); - m_IfStack = new Stack(); - m_Variables = new Hashtable(); - - RegisterVariable("OS", GetOS()); - RegisterVariable("RuntimeVersion", Environment.Version.Major); - RegisterVariable("RuntimeMajor", Environment.Version.Major); - RegisterVariable("RuntimeMinor", Environment.Version.Minor); - RegisterVariable("RuntimeRevision", Environment.Version.Revision); - } - - #endregion - - #region Properties - - /// - /// Gets the processed doc. - /// - /// The processed doc. - public XmlDocument ProcessedDoc - { - get - { - return m_OutDoc; - } - } - - #endregion - - #region Private Methods - - /// - /// Parts of this code were taken from NAnt and is subject to the GPL - /// as per NAnt's license. Thanks to the NAnt guys for this little gem. - /// - /// - public static string GetOS() - { - PlatformID platId = Environment.OSVersion.Platform; - if(platId == PlatformID.Win32NT || platId == PlatformID.Win32Windows) - { - return "Win32"; - } - - if (File.Exists("/System/Library/Frameworks/Cocoa.framework/Cocoa")) - { - return "MACOSX"; - } - - /* - * .NET 1.x, under Mono, the UNIX code is 128. Under - * .NET 2.x, Mono or MS, the UNIX code is 4 - */ - if(Environment.Version.Major == 1) - { - if((int)platId == 128) - { - return "UNIX"; - } - } - else if((int)platId == 4) - { - return "UNIX"; - } - - return "Unknown"; - } - - private static bool CompareNum(OperatorSymbol oper, int val1, int val2) - { - switch(oper) - { - case OperatorSymbol.Equal: - return (val1 == val2); - case OperatorSymbol.NotEqual: - return (val1 != val2); - case OperatorSymbol.LessThan: - return (val1 < val2); - case OperatorSymbol.LessThanEqual: - return (val1 <= val2); - case OperatorSymbol.GreaterThan: - return (val1 > val2); - case OperatorSymbol.GreaterThanEqual: - return (val1 >= val2); - } - - throw new WarningException("Unknown operator type"); - } - - private static bool CompareStr(OperatorSymbol oper, string val1, string val2) - { - switch(oper) - { - case OperatorSymbol.Equal: - return (val1 == val2); - case OperatorSymbol.NotEqual: - return (val1 != val2); - case OperatorSymbol.LessThan: - return (val1.CompareTo(val2) < 0); - case OperatorSymbol.LessThanEqual: - return (val1.CompareTo(val2) <= 0); - case OperatorSymbol.GreaterThan: - return (val1.CompareTo(val2) > 0); - case OperatorSymbol.GreaterThanEqual: - return (val1.CompareTo(val2) >= 0); - } - - throw new WarningException("Unknown operator type"); - } - - private static char NextChar(int idx, string str) - { - if((idx + 1) >= str.Length) - { - return Char.MaxValue; - } - - return str[idx + 1]; - } - // Very very simple expression parser. Can only match expressions of the form - // : - // OS = Windows - // OS != Linux - // RuntimeMinor > 0 - private bool ParseExpression(string exp) - { - if(exp == null) - { - throw new ArgumentException("Invalid expression, cannot be null"); - } - - exp = exp.Trim(); - if(exp.Length < 1) - { - throw new ArgumentException("Invalid expression, cannot be 0 length"); - } - - string id = ""; - string str = ""; - OperatorSymbol oper = OperatorSymbol.None; - bool inStr = false; - char c; - - for(int i = 0; i < exp.Length; i++) - { - c = exp[i]; - if(Char.IsWhiteSpace(c)) - { - continue; - } - - if(Char.IsLetterOrDigit(c) || c == '_') - { - if(inStr) - { - str += c; - } - else - { - id += c; - } - } - else if(c == '\"') - { - inStr = !inStr; - if(inStr) - { - str = ""; - } - } - else - { - if(inStr) - { - str += c; - } - else - { - switch(c) - { - case '=': - oper = OperatorSymbol.Equal; - break; - - case '!': - if(NextChar(i, exp) == '=') - { - oper = OperatorSymbol.NotEqual; - } - - break; - - case '<': - if(NextChar(i, exp) == '=') - { - oper = OperatorSymbol.LessThanEqual; - } - else - { - oper = OperatorSymbol.LessThan; - } - - break; - - case '>': - if(NextChar(i, exp) == '=') - { - oper = OperatorSymbol.GreaterThanEqual; - } - else - { - oper = OperatorSymbol.GreaterThan; - } - - break; - } - } - } - } - - - if(inStr) - { - throw new WarningException("Expected end of string in expression"); - } - - if(oper == OperatorSymbol.None) - { - throw new WarningException("Expected operator in expression"); - } - else if(id.Length < 1) - { - throw new WarningException("Expected identifier in expression"); - } - else if(str.Length < 1) - { - throw new WarningException("Expected value in expression"); - } - - bool ret = false; - try - { - object val = m_Variables[id.ToLower()]; - if(val == null) - { - throw new WarningException("Unknown identifier '{0}'", id); - } - - int numVal, numVal2; - string strVal, strVal2; - Type t = val.GetType(); - if(t.IsAssignableFrom(typeof(int))) - { - numVal = (int)val; - numVal2 = Int32.Parse(str); - ret = CompareNum(oper, numVal, numVal2); - } - else - { - strVal = val.ToString(); - strVal2 = str; - ret = CompareStr(oper, strVal, strVal2); - } - } - catch(ArgumentException ex) - { - ex.ToString(); - throw new WarningException("Invalid value type for system variable '{0}', expected int", id); - } - - return ret; - } - - #endregion - - #region Public Methods - - /// - /// - /// - /// - /// - public void RegisterVariable(string name, object variableValue) - { - if(name == null || variableValue == null) - { - return; - } - - m_Variables[name.ToLower()] = variableValue; - } - - /// - /// Performs validation on the xml source as well as evaluates conditional and flow expresions - /// - /// For invalid use of conditional expressions or for invalid XML syntax. If a XmlValidatingReader is passed, then will also throw exceptions for non-schema-conforming xml - /// - /// the output xml - public string Process(XmlReader initialReader) - { - if(initialReader == null) - { - throw new ArgumentException("Invalid XML reader to pre-process"); - } - - IfContext context = new IfContext(true, true, IfState.None); - StringWriter xmlText = new StringWriter(); - XmlTextWriter writer = new XmlTextWriter(xmlText); - writer.Formatting = Formatting.Indented; - - // Create a queue of XML readers and add the initial - // reader to it. Then we process until we run out of - // readers which lets the operation add more - // readers to generate a multi-file parser and not require - // XML fragments that a recursive version would use. - Stack readerStack = new Stack(); - readerStack.Push(initialReader); - - while(readerStack.Count > 0) - { - // Pop off the next reader. - XmlReader reader = (XmlReader) readerStack.Pop(); - - // Process through this XML reader until it is - // completed (or it is replaced by the include - // operation). - while(reader.Read()) - { - // The prebuild file has a series of processing - // instructions which allow for specific - // inclusions based on operating system or to - // include additional files. - if(reader.NodeType == XmlNodeType.ProcessingInstruction) - { - bool ignore = false; - - switch(reader.LocalName) - { - case "include": - // use regular expressions to parse out the attributes. - MatchCollection matches = includeFileRegex.Matches(reader.Value); - - // make sure there is only one file attribute. - if(matches.Count > 1) - { - throw new WarningException("An node was found, but it specified more than one file."); - } - - if(matches.Count == 0) - { - throw new WarningException("An node was found, but it did not specify the file attribute."); - } - - // Push current reader back onto the stack. - readerStack.Push(reader); - - // Pull the file out from the regex and make sure it is a valid file before using it. - string filename = matches[0].Groups[1].Value; - - filename = String.Join(Path.DirectorySeparatorChar.ToString(), filename.Split(new char[] { '/', '\\' })); - - if (!filename.Contains("*")) - { - FileInfo includeFile = new FileInfo(filename); - - if (!includeFile.Exists) - { - throw new WarningException("Cannot include file: " + includeFile.FullName); - } - - // Create a new reader object for this file, and push it onto the stack - XmlReader newReader = new XmlTextReader(includeFile.Open(FileMode.Open, FileAccess.Read, FileShare.Read)); - readerStack.Push(newReader); - } - else - { - WildCardInclude(readerStack, filename); - } - - // continue reading with whatever reader is on the top of the stack - reader = (XmlReader)readerStack.Pop(); - ignore = true; - - break; - - case "if": - m_IfStack.Push(context); - context = new IfContext(context.Keep & context.Active, ParseExpression(reader.Value), IfState.If); - ignore = true; - break; - - case "elseif": - if(m_IfStack.Count == 0) - { - throw new WarningException("Unexpected 'elseif' outside of 'if'"); - } - else if(context.State != IfState.If && context.State != IfState.ElseIf) - { - throw new WarningException("Unexpected 'elseif' outside of 'if'"); - } - - context.State = IfState.ElseIf; - if(!context.EverKept) - { - context.Keep = ParseExpression(reader.Value); - } - else - { - context.Keep = false; - } - - ignore = true; - break; - - case "else": - if(m_IfStack.Count == 0) - { - throw new WarningException("Unexpected 'else' outside of 'if'"); - } - else if(context.State != IfState.If && context.State != IfState.ElseIf) - { - throw new WarningException("Unexpected 'else' outside of 'if'"); - } - - context.State = IfState.Else; - context.Keep = !context.EverKept; - ignore = true; - break; - - case "endif": - if(m_IfStack.Count == 0) - { - throw new WarningException("Unexpected 'endif' outside of 'if'"); - } - - context = (IfContext)m_IfStack.Pop(); - ignore = true; - break; - } - - if(ignore) - { - continue; - } - }//end pre-proc instruction - - if(!context.Active || !context.Keep) - { - continue; - } - - switch(reader.NodeType) - { - case XmlNodeType.Element: - bool empty = reader.IsEmptyElement; - writer.WriteStartElement(reader.Name); - - while (reader.MoveToNextAttribute()) - { - writer.WriteAttributeString(reader.Name, reader.Value); - } - - if(empty) - { - writer.WriteEndElement(); - } - - break; - - case XmlNodeType.EndElement: - writer.WriteEndElement(); - break; - - case XmlNodeType.Text: - writer.WriteString(reader.Value); - break; - - case XmlNodeType.CDATA: - writer.WriteCData(reader.Value); - break; - - default: - break; - } - } - - if(m_IfStack.Count != 0) - { - throw new WarningException("Mismatched 'if', 'endif' pair"); - } - } - - return xmlText.ToString(); - } - - private static void WildCardInclude(Stack readerStack, string include) - { - if (!include.Contains("*")) - { - return; - } - -// Console.WriteLine("Processing {0}", include); - - // Break up the include into pre and post wildcard sections - string preWildcard = include.Substring(0, include.IndexOf("*")); - string postWildcard = include.Substring(include.IndexOf("*") + 2); - - // If preWildcard is a directory, recurse - if (Directory.Exists(preWildcard)) - { - string[] directories = Directory.GetDirectories(preWildcard); - Array.Sort(directories); - Array.Reverse(directories); - foreach (string dirPath in directories ) - { - Console.WriteLine("Scanning : {0}", dirPath); - - string includeFile = Path.Combine(dirPath, postWildcard); - if (includeFile.Contains("*")) - { - // postWildcard included another wildcard, recurse. - WildCardInclude(readerStack, includeFile); - } - else - { - FileInfo file = new FileInfo(includeFile); - if (file.Exists) - { - Console.WriteLine("Including File: {0}", includeFile); - XmlReader newReader = new XmlTextReader(file.Open(FileMode.Open, FileAccess.Read, FileShare.Read)); - readerStack.Push(newReader); - } - } - } - } - else - { - // preWildcard is not a path to a directory, so the wildcard is in the filename - string searchFilename = Path.GetFileName(preWildcard.Substring(preWildcard.IndexOf("/") + 1) + "*" + postWildcard); - // Console.WriteLine("searchFilename: {0}", searchFilename); - - string searchDirectory = Path.GetDirectoryName(preWildcard); - // Console.WriteLine("searchDirectory: {0}", searchDirectory); - - string[] files = Directory.GetFiles(searchDirectory, searchFilename); - Array.Sort(files); - Array.Reverse(files); - foreach (string includeFile in files) - { - FileInfo file = new FileInfo(includeFile); - if (file.Exists) - { - Console.WriteLine("Including File: {0}", includeFile); - XmlReader newReader = new XmlTextReader(file.Open(FileMode.Open, FileAccess.Read, FileShare.Read)); - readerStack.Push(newReader); - } - } - } - - } - - #endregion - } -} diff --git a/Prebuild/src/Core/Targets/AutotoolsTarget.cs b/Prebuild/src/Core/Targets/AutotoolsTarget.cs deleted file mode 100644 index 5dcbb38..0000000 --- a/Prebuild/src/Core/Targets/AutotoolsTarget.cs +++ /dev/null @@ -1,1782 +0,0 @@ -#region BSD License -/* - -Copyright (c) 2004 - 2008 -Matthew Holmes (matthew@wildfiregames.com), -Dan Moorehead (dan05a@gmail.com), -Dave Hudson (jendave@yahoo.com), -C.J. Adams-Collier (cjac@colliertech.org), - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - -* Redistributions of source code must retain the above copyright -notice, this list of conditions and the following disclaimer. - -* Redistributions in binary form must reproduce the above copyright -notice, this list of conditions and the following disclaimer in the -documentation and/or other materials provided with the distribution. - -* The name of the author may not be used to endorse or promote -products derived from this software without specific prior written -permission. - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR -IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, -INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, -STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING -IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -POSSIBILITY OF SUCH DAMAGE. - -*/ -#endregion - -#region MIT X11 license - -/* - Portions of this file authored by Lluis Sanchez Gual - - Copyright (C) 2006 Novell, Inc (http://www.novell.com) - - Permission is hereby granted, free of charge, to any person obtaining - a copy of this software and associated documentation files (the - "Software"), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - The above copyright notice and this permission notice shall be - included in all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE - LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION - OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION - WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -#endregion -using System; -using System.Collections; -using System.Collections.Generic; -using System.Collections.Specialized; -using System.IO; -using System.Reflection; -using System.Text; -using System.Text.RegularExpressions; -using System.Xml; -using System.Xml.Xsl; -using System.Net; -using System.Diagnostics; - -using Prebuild.Core.Attributes; -using Prebuild.Core.Interfaces; -using Prebuild.Core.Nodes; -using Prebuild.Core.Parse; -using Prebuild.Core.Utilities; - -namespace Prebuild.Core.Targets -{ - public enum ClrVersion - { - Default, - Net_1_1, - Net_2_0 - } - - public class SystemPackage - { - string name; - string version; - string description; - string[] assemblies; - bool isInternal; - ClrVersion targetVersion; - - public void Initialize(string name, - string version, - string description, - string[] assemblies, - ClrVersion targetVersion, - bool isInternal) - { - this.isInternal = isInternal; - this.name = name; - this.version = version; - this.assemblies = assemblies; - this.description = description; - this.targetVersion = targetVersion; - } - - public string Name - { - get { return name; } - } - - public string Version - { - get { return version; } - } - - public string Description - { - get { return description; } - } - - public ClrVersion TargetVersion - { - get { return targetVersion; } - } - - // The package is part of the mono SDK - public bool IsCorePackage - { - get { return name == "mono"; } - } - - // The package has been registered by an add-in, and is not installed - // in the system. - public bool IsInternalPackage - { - get { return isInternal; } - } - - public string[] Assemblies - { - get { return assemblies; } - } - - } - - - /// - /// - /// - [Target("autotools")] - public class AutotoolsTarget : ITarget - { - #region Fields - - Kernel m_Kernel; - XmlDocument autotoolsDoc; - XmlUrlResolver xr; - System.Security.Policy.Evidence e; - Hashtable assemblyPathToPackage = new Hashtable(); - Hashtable assemblyFullNameToPath = new Hashtable(); - Hashtable packagesHash = new Hashtable(); - readonly List packages = new List(); - - #endregion - - #region Private Methods - - private void mkdirDashP(string dirName) - { - DirectoryInfo di = new DirectoryInfo(dirName); - if (di.Exists) - return; - - string parentDirName = System.IO.Path.GetDirectoryName(dirName); - DirectoryInfo parentDi = new DirectoryInfo(parentDirName); - if (!parentDi.Exists) - mkdirDashP(parentDirName); - - di.Create(); - } - - private void chkMkDir(string dirName) - { - System.IO.DirectoryInfo di = - new System.IO.DirectoryInfo(dirName); - - if (!di.Exists) - di.Create(); - } - - private void transformToFile(string filename, XsltArgumentList argList, string nodeName) - { - // Create an XslTransform for this file - XslTransform templateTransformer = - new XslTransform(); - - // Load up the template - XmlNode templateNode = - autotoolsDoc.SelectSingleNode(nodeName + "/*"); - templateTransformer.Load(templateNode.CreateNavigator(), xr, e); - - // Create a writer for the transformed template - XmlTextWriter templateWriter = - new XmlTextWriter(filename, null); - - // Perform transformation, writing the file - templateTransformer.Transform - (m_Kernel.CurrentDoc, argList, templateWriter, xr); - } - - string NormalizeAsmName(string name) - { - int i = name.IndexOf(", PublicKeyToken=null"); - if (i != -1) - return name.Substring(0, i).Trim(); - else - return name; - } - - private void AddAssembly(string assemblyfile, SystemPackage package) - { - if (!File.Exists(assemblyfile)) - return; - - try - { - System.Reflection.AssemblyName an = System.Reflection.AssemblyName.GetAssemblyName(assemblyfile); - assemblyFullNameToPath[NormalizeAsmName(an.FullName)] = assemblyfile; - assemblyPathToPackage[assemblyfile] = package; - } - catch - { - } - } - - private List GetAssembliesWithLibInfo(string line, string file) - { - List references = new List(); - List libdirs = new List(); - List retval = new List(); - foreach (string piece in line.Split(' ')) - { - if (piece.ToLower().Trim().StartsWith("/r:") || piece.ToLower().Trim().StartsWith("-r:")) - { - references.Add(ProcessPiece(piece.Substring(3).Trim(), file)); - } - else if (piece.ToLower().Trim().StartsWith("/lib:") || piece.ToLower().Trim().StartsWith("-lib:")) - { - libdirs.Add(ProcessPiece(piece.Substring(5).Trim(), file)); - } - } - - foreach (string refrnc in references) - { - foreach (string libdir in libdirs) - { - if (File.Exists(libdir + Path.DirectorySeparatorChar + refrnc)) - { - retval.Add(libdir + Path.DirectorySeparatorChar + refrnc); - } - } - } - - return retval; - } - - private List GetAssembliesWithoutLibInfo(string line, string file) - { - List references = new List(); - foreach (string reference in line.Split(' ')) - { - if (reference.ToLower().Trim().StartsWith("/r:") || reference.ToLower().Trim().StartsWith("-r:")) - { - string final_ref = reference.Substring(3).Trim(); - references.Add(ProcessPiece(final_ref, file)); - } - } - return references; - } - - private string ProcessPiece(string piece, string pcfile) - { - int start = piece.IndexOf("${"); - if (start == -1) - return piece; - - int end = piece.IndexOf("}"); - if (end == -1) - return piece; - - string variable = piece.Substring(start + 2, end - start - 2); - string interp = GetVariableFromPkgConfig(variable, Path.GetFileNameWithoutExtension(pcfile)); - return ProcessPiece(piece.Replace("${" + variable + "}", interp), pcfile); - } - - private string GetVariableFromPkgConfig(string var, string pcfile) - { - ProcessStartInfo psi = new ProcessStartInfo("pkg-config"); - psi.RedirectStandardOutput = true; - psi.UseShellExecute = false; - psi.Arguments = String.Format("--variable={0} {1}", var, pcfile); - Process p = new Process(); - p.StartInfo = psi; - p.Start(); - string ret = p.StandardOutput.ReadToEnd().Trim(); - p.WaitForExit(); - if (String.IsNullOrEmpty(ret)) - return String.Empty; - return ret; - } - - private void ParsePCFile(string pcfile) - { - // Don't register the package twice - string pname = Path.GetFileNameWithoutExtension(pcfile); - if (packagesHash.Contains(pname)) - return; - - List fullassemblies = null; - string version = ""; - string desc = ""; - - SystemPackage package = new SystemPackage(); - - using (StreamReader reader = new StreamReader(pcfile)) - { - string line; - while ((line = reader.ReadLine()) != null) - { - string lowerLine = line.ToLower(); - if (lowerLine.StartsWith("libs:") && lowerLine.IndexOf(".dll") != -1) - { - string choppedLine = line.Substring(5).Trim(); - if (choppedLine.IndexOf("-lib:") != -1 || choppedLine.IndexOf("/lib:") != -1) - { - fullassemblies = GetAssembliesWithLibInfo(choppedLine, pcfile); - } - else - { - fullassemblies = GetAssembliesWithoutLibInfo(choppedLine, pcfile); - } - } - else if (lowerLine.StartsWith("version:")) - { - // "version:".Length == 8 - version = line.Substring(8).Trim(); - } - else if (lowerLine.StartsWith("description:")) - { - // "description:".Length == 12 - desc = line.Substring(12).Trim(); - } - } - } - - if (fullassemblies == null) - return; - - foreach (string assembly in fullassemblies) - { - AddAssembly(assembly, package); - } - - package.Initialize(pname, - version, - desc, - fullassemblies.ToArray(), - ClrVersion.Default, - false); - packages.Add(package); - packagesHash[pname] = package; - } - - void RegisterSystemAssemblies(string prefix, string version, ClrVersion ver) - { - SystemPackage package = new SystemPackage(); - List list = new List(); - - string dir = Path.Combine(prefix, version); - if (!Directory.Exists(dir)) - { - return; - } - - foreach (string assembly in Directory.GetFiles(dir, "*.dll")) - { - AddAssembly(assembly, package); - list.Add(assembly); - } - - package.Initialize("mono", - version, - "The Mono runtime", - list.ToArray(), - ver, - false); - packages.Add(package); - } - - void RunInitialization() - { - string versionDir; - - if (Environment.Version.Major == 1) - { - versionDir = "1.0"; - } - else - { - versionDir = "2.0"; - } - - //Pull up assemblies from the installed mono system. - string prefix = Path.GetDirectoryName(typeof(int).Assembly.Location); - - if (prefix.IndexOf(Path.Combine("mono", versionDir)) == -1) - prefix = Path.Combine(prefix, "mono"); - else - prefix = Path.GetDirectoryName(prefix); - - RegisterSystemAssemblies(prefix, "1.0", ClrVersion.Net_1_1); - RegisterSystemAssemblies(prefix, "2.0", ClrVersion.Net_2_0); - - string search_dirs = Environment.GetEnvironmentVariable("PKG_CONFIG_PATH"); - string libpath = Environment.GetEnvironmentVariable("PKG_CONFIG_LIBPATH"); - - if (String.IsNullOrEmpty(libpath)) - { - string path_dirs = Environment.GetEnvironmentVariable("PATH"); - foreach (string pathdir in path_dirs.Split(Path.PathSeparator)) - { - if (pathdir == null) - continue; - if (File.Exists(pathdir + Path.DirectorySeparatorChar + "pkg-config")) - { - libpath = Path.Combine(pathdir, ".."); - libpath = Path.Combine(libpath, "lib"); - libpath = Path.Combine(libpath, "pkgconfig"); - break; - } - } - } - search_dirs += Path.PathSeparator + libpath; - if (!string.IsNullOrEmpty(search_dirs)) - { - List scanDirs = new List(); - foreach (string potentialDir in search_dirs.Split(Path.PathSeparator)) - { - if (!scanDirs.Contains(potentialDir)) - scanDirs.Add(potentialDir); - } - foreach (string pcdir in scanDirs) - { - if (pcdir == null) - continue; - - if (Directory.Exists(pcdir)) - { - foreach (string pcfile in Directory.GetFiles(pcdir, "*.pc")) - { - ParsePCFile(pcfile); - } - } - } - } - } - - private void WriteCombine(SolutionNode solution) - { - #region "Create Solution directory if it doesn't exist" - string solutionDir = Path.Combine(solution.FullPath, - Path.Combine("autotools", - solution.Name)); - chkMkDir(solutionDir); - #endregion - - #region "Write Solution-level files" - XsltArgumentList argList = new XsltArgumentList(); - argList.AddParam("solutionName", "", solution.Name); - // $solutionDir is $rootDir/$solutionName/ - transformToFile(Path.Combine(solutionDir, "configure.ac"), - argList, "/Autotools/SolutionConfigureAc"); - transformToFile(Path.Combine(solutionDir, "Makefile.am"), - argList, "/Autotools/SolutionMakefileAm"); - transformToFile(Path.Combine(solutionDir, "autogen.sh"), - argList, "/Autotools/SolutionAutogenSh"); - #endregion - - foreach (ProjectNode project in solution.ProjectsTableOrder) - { - m_Kernel.Log.Write(String.Format("Writing project: {0}", - project.Name)); - WriteProject(solution, project); - } - } - private static string PrependPath(string path) - { - string tmpPath = Helper.NormalizePath(path, '/'); - Regex regex = new Regex(@"(\w):/(\w+)"); - Match match = regex.Match(tmpPath); - if (match.Success || tmpPath[0] == '.' || tmpPath[0] == '/') - { - tmpPath = Helper.NormalizePath(tmpPath); - } - else - { - tmpPath = Helper.NormalizePath("./" + tmpPath); - } - - return tmpPath; - } - - private static string BuildReference(SolutionNode solution, - ReferenceNode refr) - { - string ret = ""; - if (solution.ProjectsTable.ContainsKey(refr.Name)) - { - ProjectNode project = - (ProjectNode)solution.ProjectsTable[refr.Name]; - string fileRef = FindFileReference(refr.Name, project); - string finalPath = - Helper.NormalizePath(Helper.MakeFilePath(project.FullPath + - "/$(BUILD_DIR)/$(CONFIG)/", - refr.Name, "dll"), - '/'); - ret += finalPath; - return ret; - } - else - { - ProjectNode project = (ProjectNode)refr.Parent; - string fileRef = FindFileReference(refr.Name, project); - - if (refr.Path != null || fileRef != null) - { - string finalPath = ((refr.Path != null) ? - Helper.NormalizePath(refr.Path + "/" + - refr.Name + ".dll", - '/') : - fileRef - ); - ret += Path.Combine(project.Path, finalPath); - return ret; - } - - try - { - //Assembly assem = Assembly.Load(refr.Name); - //if (assem != null) - //{ - // int index = refr.Name.IndexOf(","); - // if ( index > 0) - // { - // ret += assem.Location; - // //Console.WriteLine("Location1: " + assem.Location); - // } - // else - // { - // ret += (refr.Name + ".dll"); - // //Console.WriteLine("Location2: " + assem.Location); - // } - //} - //else - //{ - int index = refr.Name.IndexOf(","); - if (index > 0) - { - ret += refr.Name.Substring(0, index) + ".dll"; - //Console.WriteLine("Location3: " + assem.Location); - } - else - { - ret += (refr.Name + ".dll"); - //Console.WriteLine("Location4: " + assem.Location); - } - //} - } - catch (System.NullReferenceException e) - { - e.ToString(); - int index = refr.Name.IndexOf(","); - if (index > 0) - { - ret += refr.Name.Substring(0, index) + ".dll"; - //Console.WriteLine("Location5: " + assem.Location); - } - else - { - ret += (refr.Name + ".dll"); - //Console.WriteLine("Location6: " + assem.Location); - } - } - } - return ret; - } - - private static string BuildReferencePath(SolutionNode solution, - ReferenceNode refr) - { - string ret = ""; - if (solution.ProjectsTable.ContainsKey(refr.Name)) - { - ProjectNode project = - (ProjectNode)solution.ProjectsTable[refr.Name]; - string finalPath = - Helper.NormalizePath(Helper.MakeReferencePath(project.FullPath + - "/${build.dir}/"), - '/'); - ret += finalPath; - return ret; - } - else - { - ProjectNode project = (ProjectNode)refr.Parent; - string fileRef = FindFileReference(refr.Name, project); - - if (refr.Path != null || fileRef != null) - { - string finalPath = ((refr.Path != null) ? - Helper.NormalizePath(refr.Path, '/') : - fileRef - ); - ret += finalPath; - return ret; - } - - try - { - Assembly assem = Assembly.Load(refr.Name); - if (assem != null) - { - ret += ""; - } - else - { - ret += ""; - } - } - catch (System.NullReferenceException e) - { - e.ToString(); - ret += ""; - } - } - return ret; - } - - private static string FindFileReference(string refName, - ProjectNode project) - { - foreach (ReferencePathNode refPath in project.ReferencePaths) - { - string fullPath = - Helper.MakeFilePath(refPath.Path, refName, "dll"); - - if (File.Exists(fullPath)) { - return fullPath; - } - } - - return null; - } - - /// - /// Gets the XML doc file. - /// - /// The project. - /// The conf. - /// - public static string GetXmlDocFile(ProjectNode project, ConfigurationNode conf) - { - if (conf == null) - { - throw new ArgumentNullException("conf"); - } - if (project == null) - { - throw new ArgumentNullException("project"); - } - string docFile = (string)conf.Options["XmlDocFile"]; - // if(docFile != null && docFile.Length == 0)//default to assembly name if not specified - // { - // return Path.GetFileNameWithoutExtension(project.AssemblyName) + ".xml"; - // } - return docFile; - } - - /// - /// Normalizes the path. - /// - /// The path. - /// - public static string NormalizePath(string path) - { - if (path == null) - { - return ""; - } - - StringBuilder tmpPath; - - if (Core.Parse.Preprocessor.GetOS() == "Win32") - { - tmpPath = new StringBuilder(path.Replace('\\', '/')); - tmpPath.Replace("/", @"\\"); - } - else - { - tmpPath = new StringBuilder(path.Replace('\\', '/')); - tmpPath = tmpPath.Replace('/', Path.DirectorySeparatorChar); - } - return tmpPath.ToString(); - } - - private void WriteProject(SolutionNode solution, ProjectNode project) - { - string solutionDir = Path.Combine(solution.FullPath, Path.Combine("autotools", solution.Name)); - string projectDir = Path.Combine(solutionDir, project.Name); - string projectVersion = project.Version; - bool hasAssemblyConfig = false; - chkMkDir(projectDir); - - List - compiledFiles = new List(), - contentFiles = new List(), - embeddedFiles = new List(), - - binaryLibs = new List(), - pkgLibs = new List(), - systemLibs = new List(), - runtimeLibs = new List(), - - extraDistFiles = new List(), - localCopyTargets = new List(); - - // If there exists a .config file for this assembly, copy - // it to the project folder - - // TODO: Support copying .config.osx files - // TODO: support processing the .config file for native library deps - string projectAssemblyName = project.Name; - if (project.AssemblyName != null) - projectAssemblyName = project.AssemblyName; - - if (File.Exists(Path.Combine(project.FullPath, projectAssemblyName) + ".dll.config")) - { - hasAssemblyConfig = true; - System.IO.File.Copy(Path.Combine(project.FullPath, projectAssemblyName + ".dll.config"), Path.Combine(projectDir, projectAssemblyName + ".dll.config"), true); - extraDistFiles.Add(project.AssemblyName + ".dll.config"); - } - - foreach (ConfigurationNode conf in project.Configurations) - { - if (conf.Options.KeyFile != string.Empty) - { - // Copy snk file into the project's directory - // Use the snk from the project directory directly - string source = Path.Combine(project.FullPath, conf.Options.KeyFile); - string keyFile = conf.Options.KeyFile; - Regex re = new Regex(".*/"); - keyFile = re.Replace(keyFile, ""); - - string dest = Path.Combine(projectDir, keyFile); - // Tell the user if there's a problem copying the file - try - { - mkdirDashP(System.IO.Path.GetDirectoryName(dest)); - System.IO.File.Copy(source, dest, true); - } - catch (System.IO.IOException e) - { - Console.WriteLine(e.Message); - } - } - } - - // Copy compiled, embedded and content files into the project's directory - foreach (string filename in project.Files) - { - string source = Path.Combine(project.FullPath, filename); - string dest = Path.Combine(projectDir, filename); - - if (filename.Contains("AssemblyInfo.cs")) - { - // If we've got an AssemblyInfo.cs, pull the version number from it - string[] sources = { source }; - string[] args = { "" }; - Microsoft.CSharp.CSharpCodeProvider cscp = - new Microsoft.CSharp.CSharpCodeProvider(); - - string tempAssemblyFile = Path.Combine(Path.GetTempPath(), project.Name + "-temp.dll"); - System.CodeDom.Compiler.CompilerParameters cparam = - new System.CodeDom.Compiler.CompilerParameters(args, tempAssemblyFile); - - System.CodeDom.Compiler.CompilerResults cr = - cscp.CompileAssemblyFromFile(cparam, sources); - - foreach (System.CodeDom.Compiler.CompilerError error in cr.Errors) - Console.WriteLine("Error! '{0}'", error.ErrorText); - - try { - string projectFullName = cr.CompiledAssembly.FullName; - Regex verRegex = new Regex("Version=([\\d\\.]+)"); - Match verMatch = verRegex.Match(projectFullName); - if (verMatch.Success) - projectVersion = verMatch.Groups[1].Value; - }catch{ - Console.WriteLine("Couldn't compile AssemblyInfo.cs"); - } - - // Clean up the temp file - try - { - if (File.Exists(tempAssemblyFile)) - File.Delete(tempAssemblyFile); - } - catch - { - Console.WriteLine("Error! '{0}'", e.ToString()); - } - - } - - // Tell the user if there's a problem copying the file - try - { - mkdirDashP(System.IO.Path.GetDirectoryName(dest)); - System.IO.File.Copy(source, dest, true); - } - catch (System.IO.IOException e) - { - Console.WriteLine(e.Message); - } - - switch (project.Files.GetBuildAction(filename)) - { - case BuildAction.Compile: - compiledFiles.Add(filename); - break; - case BuildAction.Content: - contentFiles.Add(filename); - extraDistFiles.Add(filename); - break; - case BuildAction.EmbeddedResource: - embeddedFiles.Add(filename); - break; - } - } - - // Set up references - for (int refNum = 0; refNum < project.References.Count; refNum++) - { - ReferenceNode refr = (ReferenceNode)project.References[refNum]; - Assembly refAssembly = Assembly.LoadWithPartialName(refr.Name); - - /* Determine which pkg-config (.pc) file refers to - this assembly */ - - SystemPackage package = null; - - if (packagesHash.Contains(refr.Name)){ - package = (SystemPackage)packagesHash[refr.Name]; - - }else{ - string assemblyFullName = string.Empty; - if (refAssembly != null) - assemblyFullName = refAssembly.FullName; - - string assemblyFileName = string.Empty; - if (assemblyFullName != string.Empty && - assemblyFullNameToPath.Contains(assemblyFullName) - ) - assemblyFileName = - (string)assemblyFullNameToPath[assemblyFullName]; - - if (assemblyFileName != string.Empty && - assemblyPathToPackage.Contains(assemblyFileName) - ) - package = (SystemPackage)assemblyPathToPackage[assemblyFileName]; - - } - - /* If we know the .pc file and it is not "mono" - (already in the path), add a -pkg: argument */ - - if (package != null && - package.Name != "mono" && - !pkgLibs.Contains(package.Name) - ) - pkgLibs.Add(package.Name); - - string fileRef = - FindFileReference(refr.Name, (ProjectNode)refr.Parent); - - if (refr.LocalCopy || - solution.ProjectsTable.ContainsKey(refr.Name) || - fileRef != null || - refr.Path != null - ) - { - - /* Attempt to copy the referenced lib to the - project's directory */ - - string filename = refr.Name + ".dll"; - string source = filename; - if (refr.Path != null) - source = Path.Combine(refr.Path, source); - source = Path.Combine(project.FullPath, source); - string dest = Path.Combine(projectDir, filename); - - /* Since we depend on this binary dll to build, we - * will add a compile- time dependency on the - * copied dll, and add the dll to the list of - * files distributed with this package - */ - - binaryLibs.Add(refr.Name + ".dll"); - extraDistFiles.Add(refr.Name + ".dll"); - - // TODO: Support copying .config.osx files - // TODO: Support for determining native dependencies - if (File.Exists(source + ".config")) - { - System.IO.File.Copy(source + ".config", Path.GetDirectoryName(dest), true); - extraDistFiles.Add(refr.Name + ".dll.config"); - } - - try - { - System.IO.File.Copy(source, dest, true); - } - catch (System.IO.IOException) - { - if (solution.ProjectsTable.ContainsKey(refr.Name)){ - - /* If an assembly is referenced, marked for - * local copy, in the list of projects for - * this solution, but does not exist, put a - * target into the Makefile.am to build the - * assembly and copy it to this project's - * directory - */ - - ProjectNode sourcePrj = - ((ProjectNode)(solution.ProjectsTable[refr.Name])); - - string target = - String.Format("{0}:\n" + - "\t$(MAKE) -C ../{1}\n" + - "\tln ../{2}/$@ $@\n", - filename, - sourcePrj.Name, - sourcePrj.Name ); - - localCopyTargets.Add(target); - } - } - } - else if( !pkgLibs.Contains(refr.Name) ) - { - // Else, let's assume it's in the GAC or the lib path - string assemName = string.Empty; - int index = refr.Name.IndexOf(","); - - if (index > 0) - assemName = refr.Name.Substring(0, index); - else - assemName = refr.Name; - - m_Kernel.Log.Write(String.Format( - "Warning: Couldn't find an appropriate assembly " + - "for reference:\n'{0}'", refr.Name - )); - systemLibs.Add(assemName); - } - } - - const string lineSep = " \\\n\t"; - string compiledFilesString = string.Empty; - if (compiledFiles.Count > 0) - compiledFilesString = - lineSep + string.Join(lineSep, compiledFiles.ToArray()); - - string embeddedFilesString = ""; - if (embeddedFiles.Count > 0) - embeddedFilesString = - lineSep + string.Join(lineSep, embeddedFiles.ToArray()); - - string contentFilesString = ""; - if (contentFiles.Count > 0) - contentFilesString = - lineSep + string.Join(lineSep, contentFiles.ToArray()); - - string extraDistFilesString = ""; - if (extraDistFiles.Count > 0) - extraDistFilesString = - lineSep + string.Join(lineSep, extraDistFiles.ToArray()); - - string pkgLibsString = ""; - if (pkgLibs.Count > 0) - pkgLibsString = - lineSep + string.Join(lineSep, pkgLibs.ToArray()); - - string binaryLibsString = ""; - if (binaryLibs.Count > 0) - binaryLibsString = - lineSep + string.Join(lineSep, binaryLibs.ToArray()); - - string systemLibsString = ""; - if (systemLibs.Count > 0) - systemLibsString = - lineSep + string.Join(lineSep, systemLibs.ToArray()); - - string localCopyTargetsString = ""; - if (localCopyTargets.Count > 0) - localCopyTargetsString = - string.Join("\n", localCopyTargets.ToArray()); - - string monoPath = ""; - foreach (string runtimeLib in runtimeLibs) - { - monoPath += ":`pkg-config --variable=libdir " + runtimeLib + "`"; - } - - // Add the project name to the list of transformation - // parameters - XsltArgumentList argList = new XsltArgumentList(); - argList.AddParam("projectName", "", project.Name); - argList.AddParam("solutionName", "", solution.Name); - argList.AddParam("assemblyName", "", projectAssemblyName); - argList.AddParam("compiledFiles", "", compiledFilesString); - argList.AddParam("embeddedFiles", "", embeddedFilesString); - argList.AddParam("contentFiles", "", contentFilesString); - argList.AddParam("extraDistFiles", "", extraDistFilesString); - argList.AddParam("pkgLibs", "", pkgLibsString); - argList.AddParam("binaryLibs", "", binaryLibsString); - argList.AddParam("systemLibs", "", systemLibsString); - argList.AddParam("monoPath", "", monoPath); - argList.AddParam("localCopyTargets", "", localCopyTargetsString); - argList.AddParam("projectVersion", "", projectVersion); - argList.AddParam("hasAssemblyConfig", "", hasAssemblyConfig ? "true" : ""); - - // Transform the templates - transformToFile(Path.Combine(projectDir, "configure.ac"), argList, "/Autotools/ProjectConfigureAc"); - transformToFile(Path.Combine(projectDir, "Makefile.am"), argList, "/Autotools/ProjectMakefileAm"); - transformToFile(Path.Combine(projectDir, "autogen.sh"), argList, "/Autotools/ProjectAutogenSh"); - - if (project.Type == Core.Nodes.ProjectType.Library) - transformToFile(Path.Combine(projectDir, project.Name + ".pc.in"), argList, "/Autotools/ProjectPcIn"); - if (project.Type == Core.Nodes.ProjectType.Exe || project.Type == Core.Nodes.ProjectType.WinExe) - transformToFile(Path.Combine(projectDir, project.Name.ToLower() + ".in"), argList, "/Autotools/ProjectWrapperScriptIn"); - } - - private void WriteProjectOld(SolutionNode solution, ProjectNode project) - { - string projFile = Helper.MakeFilePath(project.FullPath, "Include", "am"); - StreamWriter ss = new StreamWriter(projFile); - ss.NewLine = "\n"; - - m_Kernel.CurrentWorkingDirectory.Push(); - Helper.SetCurrentDir(Path.GetDirectoryName(projFile)); - - using (ss) - { - ss.WriteLine(Helper.AssemblyFullName(project.AssemblyName, project.Type) + ":"); - ss.WriteLine("\tmkdir -p " + Helper.MakePathRelativeTo(solution.FullPath, project.Path) + "/$(BUILD_DIR)/$(CONFIG)/"); - foreach (string file in project.Files) - { - if (project.Files.GetSubType(file) != SubType.Code && project.Files.GetSubType(file) != SubType.Settings) - { - ss.Write("\tresgen "); - ss.Write(Helper.NormalizePath(Path.Combine(project.Path, file.Substring(0, file.LastIndexOf('.')) + ".resx "), '/')); - if (project.Files.GetResourceName(file) != "") - { - ss.WriteLine(Helper.NormalizePath(Path.Combine(project.Path, project.RootNamespace + "." + project.Files.GetResourceName(file) + ".resources"), '/')); - } - else - { - ss.WriteLine(Helper.NormalizePath(Path.Combine(project.Path, project.RootNamespace + "." + file.Substring(0, file.LastIndexOf('.')) + ".resources"), '/')); - } - } - } - ss.WriteLine("\t$(CSC)\t/out:" + Helper.MakePathRelativeTo(solution.FullPath, project.Path) + "/$(BUILD_DIR)/$(CONFIG)/" + Helper.AssemblyFullName(project.AssemblyName, project.Type) + " \\"); - ss.WriteLine("\t\t/target:" + project.Type.ToString().ToLower() + " \\"); - if (project.References.Count > 0) - { - ss.Write("\t\t/reference:"); - bool firstref = true; - foreach (ReferenceNode refr in project.References) - { - if (firstref) - { - firstref = false; - } - else - { - ss.Write(","); - } - ss.Write("{0}", Helper.NormalizePath(Helper.MakePathRelativeTo(solution.FullPath, BuildReference(solution, refr)), '/')); - } - ss.WriteLine(" \\"); - } - //ss.WriteLine("\t\tProperties/AssemblyInfo.cs \\"); - - foreach (string file in project.Files) - { - switch (project.Files.GetBuildAction(file)) - { - case BuildAction.EmbeddedResource: - ss.Write("\t\t/resource:"); - ss.WriteLine(Helper.NormalizePath(Path.Combine(project.Path, file), '/') + " \\"); - break; - default: - if (project.Files.GetSubType(file) != SubType.Code && project.Files.GetSubType(file) != SubType.Settings) - { - ss.Write("\t\t/resource:"); - if (project.Files.GetResourceName(file) != "") - { - ss.WriteLine(Helper.NormalizePath(Path.Combine(project.Path, project.RootNamespace + "." + project.Files.GetResourceName(file) + ".resources"), '/') + "," + project.RootNamespace + "." + project.Files.GetResourceName(file) + ".resources" + " \\"); - } - else - { - ss.WriteLine(Helper.NormalizePath(Path.Combine(project.Path, project.RootNamespace + "." + file.Substring(0, file.LastIndexOf('.')) + ".resources"), '/') + "," + project.RootNamespace + "." + file.Substring(0, file.LastIndexOf('.')) + ".resources" + " \\"); - } - } - break; - } - } - - foreach (ConfigurationNode conf in project.Configurations) - { - if (conf.Options.KeyFile != "") - { - ss.WriteLine("\t\t/keyfile:" + Helper.NormalizePath(Path.Combine(project.Path, conf.Options.KeyFile), '/') + " \\"); - break; - } - } - foreach (ConfigurationNode conf in project.Configurations) - { - if (conf.Options.AllowUnsafe) - { - ss.WriteLine("\t\t/unsafe \\"); - break; - } - } - if (project.AppIcon != "") - { - ss.WriteLine("\t\t/win32icon:" + Helper.NormalizePath(Path.Combine(project.Path, project.AppIcon), '/') + " \\"); - } - - foreach (ConfigurationNode conf in project.Configurations) - { - ss.WriteLine("\t\t/define:{0}", conf.Options.CompilerDefines.Replace(';', ',') + " \\"); - break; - } - - foreach (ConfigurationNode conf in project.Configurations) - { - if (GetXmlDocFile(project, conf) != "") - { - ss.WriteLine("\t\t/doc:" + Helper.MakePathRelativeTo(solution.FullPath, project.Path) + "/$(BUILD_DIR)/$(CONFIG)/" + project.Name + ".xml \\"); - break; - } - } - foreach (string file in project.Files) - { - switch (project.Files.GetBuildAction(file)) - { - case BuildAction.Compile: - ss.WriteLine("\t\t\\"); - ss.Write("\t\t" + NormalizePath(Path.Combine(Helper.MakePathRelativeTo(solution.FullPath, project.Path), file))); - break; - default: - break; - } - } - ss.WriteLine(); - ss.WriteLine(); - - if (project.Type == ProjectType.Library) - { - ss.WriteLine("install-data-local:"); - ss.WriteLine(" echo \"$(GACUTIL) /i bin/Release/" + project.Name + ".dll /f $(GACUTIL_FLAGS)\"; \\"); - ss.WriteLine(" $(GACUTIL) /i bin/Release/" + project.Name + ".dll /f $(GACUTIL_FLAGS) || exit 1;"); - ss.WriteLine(); - ss.WriteLine("uninstall-local:"); - ss.WriteLine(" echo \"$(GACUTIL) /u " + project.Name + " $(GACUTIL_FLAGS)\"; \\"); - ss.WriteLine(" $(GACUTIL) /u " + project.Name + " $(GACUTIL_FLAGS) || exit 1;"); - ss.WriteLine(); - } - ss.WriteLine("CLEANFILES = $(BUILD_DIR)/$(CONFIG)/" + Helper.AssemblyFullName(project.AssemblyName, project.Type) + " $(BUILD_DIR)/$(CONFIG)/" + project.AssemblyName + ".mdb $(BUILD_DIR)/$(CONFIG)/" + project.AssemblyName + ".pdb " + project.AssemblyName + ".xml"); - ss.WriteLine("EXTRA_DIST = \\"); - ss.Write(" $(FILES)"); - foreach (ConfigurationNode conf in project.Configurations) - { - if (conf.Options.KeyFile != "") - { - ss.Write(" \\"); - ss.WriteLine("\t" + conf.Options.KeyFile); - } - break; - } - } - m_Kernel.CurrentWorkingDirectory.Pop(); - } - bool hasLibrary = false; - - private void WriteCombineOld(SolutionNode solution) - { - - /* TODO: These vars should be pulled from the prebuild.xml file */ - string releaseVersion = "2.0.0"; - string assemblyVersion = "2.1.0.0"; - string description = - "Tao Framework " + solution.Name + " Binding For .NET"; - - hasLibrary = false; - m_Kernel.Log.Write("Creating Autotools make files"); - foreach (ProjectNode project in solution.Projects) - { - if (m_Kernel.AllowProject(project.FilterGroups)) - { - m_Kernel.Log.Write("...Creating makefile: {0}", project.Name); - WriteProject(solution, project); - } - } - - m_Kernel.Log.Write(""); - string combFile = Helper.MakeFilePath(solution.FullPath, "Makefile", "am"); - StreamWriter ss = new StreamWriter(combFile); - ss.NewLine = "\n"; - - m_Kernel.CurrentWorkingDirectory.Push(); - Helper.SetCurrentDir(Path.GetDirectoryName(combFile)); - - using (ss) - { - foreach (ProjectNode project in solution.ProjectsTableOrder) - { - if (project.Type == ProjectType.Library) - { - hasLibrary = true; - break; - } - } - - if (hasLibrary) - { - ss.Write("pkgconfig_in_files = "); - foreach (ProjectNode project in solution.ProjectsTableOrder) - { - if (project.Type == ProjectType.Library) - { - string combFilepc = Helper.MakeFilePath(solution.FullPath, project.Name, "pc.in"); - ss.Write(" " + project.Name + ".pc.in "); - StreamWriter sspc = new StreamWriter(combFilepc); - sspc.NewLine = "\n"; - using (sspc) - { - sspc.WriteLine("prefix=@prefix@"); - sspc.WriteLine("exec_prefix=${prefix}"); - sspc.WriteLine("libdir=${exec_prefix}/lib"); - sspc.WriteLine(); - sspc.WriteLine("Name: @PACKAGE_NAME@"); - sspc.WriteLine("Description: @DESCRIPTION@"); - sspc.WriteLine("Version: @ASSEMBLY_VERSION@"); - sspc.WriteLine("Libs: -r:${libdir}/mono/gac/@PACKAGE_NAME@/@ASSEMBLY_VERSION@__@PUBKEY@/@PACKAGE_NAME@.dll"); - } - } - } - - ss.WriteLine(); - ss.WriteLine("pkgconfigdir=$(prefix)/lib/pkgconfig"); - ss.WriteLine("pkgconfig_DATA=$(pkgconfig_in_files:.pc.in=.pc)"); - } - ss.WriteLine(); - foreach (ProjectNode project in solution.ProjectsTableOrder) - { - string path = Helper.MakePathRelativeTo(solution.FullPath, project.FullPath); - ss.WriteLine("-include x {0}", - Helper.NormalizePath(Helper.MakeFilePath(path, "Include", "am"), '/')); - } - ss.WriteLine(); - ss.WriteLine("all: \\"); - ss.Write("\t"); - foreach (ProjectNode project in solution.ProjectsTableOrder) - { - string path = Helper.MakePathRelativeTo(solution.FullPath, project.FullPath); - ss.Write(Helper.AssemblyFullName(project.AssemblyName, project.Type) + " "); - - } - ss.WriteLine(); - if (hasLibrary) - { - ss.WriteLine("EXTRA_DIST = \\"); - ss.WriteLine("\t$(pkgconfig_in_files)"); - } - else - { - ss.WriteLine("EXTRA_DIST = "); - } - ss.WriteLine(); - ss.WriteLine("DISTCLEANFILES = \\"); - ss.WriteLine("\tconfigure \\"); - ss.WriteLine("\tMakefile.in \\"); - ss.WriteLine("\taclocal.m4"); - } - combFile = Helper.MakeFilePath(solution.FullPath, "configure", "ac"); - StreamWriter ts = new StreamWriter(combFile); - ts.NewLine = "\n"; - using (ts) - { - if (this.hasLibrary) - { - foreach (ProjectNode project in solution.ProjectsTableOrder) - { - if (project.Type == ProjectType.Library) - { - ts.WriteLine("AC_INIT(" + project.Name + ".pc.in)"); - break; - } - } - } - else - { - ts.WriteLine("AC_INIT(Makefile.am)"); - } - ts.WriteLine("AC_PREREQ(2.53)"); - ts.WriteLine("AC_CANONICAL_SYSTEM"); - - ts.WriteLine("PACKAGE_NAME={0}", solution.Name); - ts.WriteLine("PACKAGE_VERSION={0}", releaseVersion); - ts.WriteLine("DESCRIPTION=\"{0}\"", description); - ts.WriteLine("AC_SUBST(DESCRIPTION)"); - ts.WriteLine("AM_INIT_AUTOMAKE([$PACKAGE_NAME],[$PACKAGE_VERSION],[$DESCRIPTION])"); - - ts.WriteLine("ASSEMBLY_VERSION={0}", assemblyVersion); - ts.WriteLine("AC_SUBST(ASSEMBLY_VERSION)"); - - ts.WriteLine("PUBKEY=`sn -t $PACKAGE_NAME.snk | grep 'Public Key Token' | awk -F: '{print $2}' | sed -e 's/^ //'`"); - ts.WriteLine("AC_SUBST(PUBKEY)"); - - ts.WriteLine(); - ts.WriteLine("AM_MAINTAINER_MODE"); - ts.WriteLine(); - ts.WriteLine("dnl AC_PROG_INTLTOOL([0.25])"); - ts.WriteLine(); - ts.WriteLine("AC_PROG_INSTALL"); - ts.WriteLine(); - ts.WriteLine("MONO_REQUIRED_VERSION=1.1"); - ts.WriteLine(); - ts.WriteLine("AC_MSG_CHECKING([whether we're compiling from CVS])"); - ts.WriteLine("if test -f \"$srcdir/.cvs_version\" ; then"); - ts.WriteLine(" from_cvs=yes"); - ts.WriteLine("else"); - ts.WriteLine(" if test -f \"$srcdir/.svn\" ; then"); - ts.WriteLine(" from_cvs=yes"); - ts.WriteLine(" else"); - ts.WriteLine(" from_cvs=no"); - ts.WriteLine(" fi"); - ts.WriteLine("fi"); - ts.WriteLine(); - ts.WriteLine("AC_MSG_RESULT($from_cvs)"); - ts.WriteLine(); - ts.WriteLine("AC_PATH_PROG(MONO, mono)"); - ts.WriteLine("AC_PATH_PROG(GMCS, gmcs)"); - ts.WriteLine("AC_PATH_PROG(GACUTIL, gacutil)"); - ts.WriteLine(); - ts.WriteLine("AC_MSG_CHECKING([for mono])"); - ts.WriteLine("dnl if test \"x$MONO\" = \"x\" ; then"); - ts.WriteLine("dnl AC_MSG_ERROR([Can't find \"mono\" in your PATH])"); - ts.WriteLine("dnl else"); - ts.WriteLine(" AC_MSG_RESULT([found])"); - ts.WriteLine("dnl fi"); - ts.WriteLine(); - ts.WriteLine("AC_MSG_CHECKING([for gmcs])"); - ts.WriteLine("dnl if test \"x$GMCS\" = \"x\" ; then"); - ts.WriteLine("dnl AC_MSG_ERROR([Can't find \"gmcs\" in your PATH])"); - ts.WriteLine("dnl else"); - ts.WriteLine(" AC_MSG_RESULT([found])"); - ts.WriteLine("dnl fi"); - ts.WriteLine(); - //ts.WriteLine("AC_MSG_CHECKING([for gacutil])"); - //ts.WriteLine("if test \"x$GACUTIL\" = \"x\" ; then"); - //ts.WriteLine(" AC_MSG_ERROR([Can't find \"gacutil\" in your PATH])"); - //ts.WriteLine("else"); - //ts.WriteLine(" AC_MSG_RESULT([found])"); - //ts.WriteLine("fi"); - ts.WriteLine(); - ts.WriteLine("AC_SUBST(PATH)"); - ts.WriteLine("AC_SUBST(LD_LIBRARY_PATH)"); - ts.WriteLine(); - ts.WriteLine("dnl CSFLAGS=\"-debug -nowarn:1574\""); - ts.WriteLine("CSFLAGS=\"\""); - ts.WriteLine("AC_SUBST(CSFLAGS)"); - ts.WriteLine(); - // ts.WriteLine("AC_MSG_CHECKING(--disable-sdl argument)"); - // ts.WriteLine("AC_ARG_ENABLE(sdl,"); - // ts.WriteLine(" [ --disable-sdl Disable Sdl interface.],"); - // ts.WriteLine(" [disable_sdl=$disableval],"); - // ts.WriteLine(" [disable_sdl=\"no\"])"); - // ts.WriteLine("AC_MSG_RESULT($disable_sdl)"); - // ts.WriteLine("if test \"$disable_sdl\" = \"yes\"; then"); - // ts.WriteLine(" AC_DEFINE(FEAT_SDL)"); - // ts.WriteLine("fi"); - ts.WriteLine(); - ts.WriteLine("dnl Find pkg-config"); - ts.WriteLine("AC_PATH_PROG(PKGCONFIG, pkg-config, no)"); - ts.WriteLine("if test \"x$PKG_CONFIG\" = \"xno\"; then"); - ts.WriteLine(" AC_MSG_ERROR([You need to install pkg-config])"); - ts.WriteLine("fi"); - ts.WriteLine(); - ts.WriteLine("PKG_CHECK_MODULES(MONO_DEPENDENCY, mono >= $MONO_REQUIRED_VERSION, has_mono=true, has_mono=false)"); - ts.WriteLine("BUILD_DIR=\"bin\""); - ts.WriteLine("AC_SUBST(BUILD_DIR)"); - ts.WriteLine("CONFIG=\"Release\""); - ts.WriteLine("AC_SUBST(CONFIG)"); - ts.WriteLine(); - ts.WriteLine("if test \"x$has_mono\" = \"xtrue\"; then"); - ts.WriteLine(" AC_PATH_PROG(RUNTIME, mono, no)"); - ts.WriteLine(" AC_PATH_PROG(CSC, gmcs, no)"); - ts.WriteLine(" if test `uname -s` = \"Darwin\"; then"); - ts.WriteLine(" LIB_PREFIX="); - ts.WriteLine(" LIB_SUFFIX=.dylib"); - ts.WriteLine(" else"); - ts.WriteLine(" LIB_PREFIX=.so"); - ts.WriteLine(" LIB_SUFFIX="); - ts.WriteLine(" fi"); - ts.WriteLine("else"); - ts.WriteLine(" AC_PATH_PROG(CSC, csc.exe, no)"); - ts.WriteLine(" if test x$CSC = \"xno\"; then"); - ts.WriteLine(" AC_MSG_ERROR([You need to install either mono or .Net])"); - ts.WriteLine(" else"); - ts.WriteLine(" RUNTIME="); - ts.WriteLine(" LIB_PREFIX="); - ts.WriteLine(" LIB_SUFFIX=.dylib"); - ts.WriteLine(" fi"); - ts.WriteLine("fi"); - ts.WriteLine(); - ts.WriteLine("AC_SUBST(LIB_PREFIX)"); - ts.WriteLine("AC_SUBST(LIB_SUFFIX)"); - ts.WriteLine(); - ts.WriteLine("AC_SUBST(BASE_DEPENDENCIES_CFLAGS)"); - ts.WriteLine("AC_SUBST(BASE_DEPENDENCIES_LIBS)"); - ts.WriteLine(); - ts.WriteLine("dnl Find monodoc"); - ts.WriteLine("MONODOC_REQUIRED_VERSION=1.0"); - ts.WriteLine("AC_SUBST(MONODOC_REQUIRED_VERSION)"); - ts.WriteLine("PKG_CHECK_MODULES(MONODOC_DEPENDENCY, monodoc >= $MONODOC_REQUIRED_VERSION, enable_monodoc=yes, enable_monodoc=no)"); - ts.WriteLine(); - ts.WriteLine("if test \"x$enable_monodoc\" = \"xyes\"; then"); - ts.WriteLine(" AC_PATH_PROG(MONODOC, monodoc, no)"); - ts.WriteLine(" if test x$MONODOC = xno; then"); - ts.WriteLine(" enable_monodoc=no"); - ts.WriteLine(" fi"); - ts.WriteLine("else"); - ts.WriteLine(" MONODOC="); - ts.WriteLine("fi"); - ts.WriteLine(); - ts.WriteLine("AC_SUBST(MONODOC)"); - ts.WriteLine("AM_CONDITIONAL(ENABLE_MONODOC, test \"x$enable_monodoc\" = \"xyes\")"); - ts.WriteLine(); - ts.WriteLine("AC_PATH_PROG(GACUTIL, gacutil, no)"); - ts.WriteLine("if test \"x$GACUTIL\" = \"xno\" ; then"); - ts.WriteLine(" AC_MSG_ERROR([No gacutil tool found])"); - ts.WriteLine("fi"); - ts.WriteLine(); - // foreach(ProjectNode project in solution.ProjectsTableOrder) - // { - // if (project.Type == ProjectType.Library) - // { - // } - // } - ts.WriteLine("GACUTIL_FLAGS='/package $(PACKAGE_NAME) /gacdir $(DESTDIR)$(prefix)'"); - ts.WriteLine("AC_SUBST(GACUTIL_FLAGS)"); - ts.WriteLine(); - ts.WriteLine("winbuild=no"); - ts.WriteLine("case \"$host\" in"); - ts.WriteLine(" *-*-mingw*|*-*-cygwin*)"); - ts.WriteLine(" winbuild=yes"); - ts.WriteLine(" ;;"); - ts.WriteLine("esac"); - ts.WriteLine("AM_CONDITIONAL(WINBUILD, test x$winbuild = xyes)"); - ts.WriteLine(); - // ts.WriteLine("dnl Check for SDL"); - // ts.WriteLine(); - // ts.WriteLine("AC_PATH_PROG([SDL_CONFIG], [sdl-config])"); - // ts.WriteLine("have_sdl=no"); - // ts.WriteLine("if test -n \"${SDL_CONFIG}\"; then"); - // ts.WriteLine(" have_sdl=yes"); - // ts.WriteLine(" SDL_CFLAGS=`$SDL_CONFIG --cflags`"); - // ts.WriteLine(" SDL_LIBS=`$SDL_CONFIG --libs`"); - // ts.WriteLine(" #"); - // ts.WriteLine(" # sdl-config sometimes emits an rpath flag pointing at its library"); - // ts.WriteLine(" # installation directory. We don't want this, as it prevents users from"); - // ts.WriteLine(" # linking sdl-viewer against, for example, a locally compiled libGL when a"); - // ts.WriteLine(" # version of the library also exists in SDL's library installation"); - // ts.WriteLine(" # directory, typically /usr/lib."); - // ts.WriteLine(" #"); - // ts.WriteLine(" SDL_LIBS=`echo $SDL_LIBS | sed 's/-Wl,-rpath,[[^ ]]* //'`"); - // ts.WriteLine("fi"); - // ts.WriteLine("AC_SUBST([SDL_CFLAGS])"); - // ts.WriteLine("AC_SUBST([SDL_LIBS])"); - ts.WriteLine(); - ts.WriteLine("AC_OUTPUT(["); - ts.WriteLine("Makefile"); - // TODO: this does not work quite right. - //ts.WriteLine("Properties/AssemblyInfo.cs"); - foreach (ProjectNode project in solution.ProjectsTableOrder) - { - if (project.Type == ProjectType.Library) - { - ts.WriteLine(project.Name + ".pc"); - } - // string path = Helper.MakePathRelativeTo(solution.FullPath, project.FullPath); - // ts.WriteLine(Helper.NormalizePath(Helper.MakeFilePath(path, "Include"),'/')); - } - ts.WriteLine("])"); - ts.WriteLine(); - ts.WriteLine("#po/Makefile.in"); - ts.WriteLine(); - ts.WriteLine("echo \"---\""); - ts.WriteLine("echo \"Configuration summary\""); - ts.WriteLine("echo \"\""); - ts.WriteLine("echo \" * Installation prefix: $prefix\""); - ts.WriteLine("echo \" * compiler: $CSC\""); - ts.WriteLine("echo \" * Documentation: $enable_monodoc ($MONODOC)\""); - ts.WriteLine("echo \" * Package Name: $PACKAGE_NAME\""); - ts.WriteLine("echo \" * Version: $PACKAGE_VERSION\""); - ts.WriteLine("echo \" * Public Key: $PUBKEY\""); - ts.WriteLine("echo \"\""); - ts.WriteLine("echo \"---\""); - ts.WriteLine(); - } - - ts.NewLine = "\n"; - foreach (ProjectNode project in solution.ProjectsTableOrder) - { - if (project.GenerateAssemblyInfoFile) - { - GenerateAssemblyInfoFile(solution, combFile); - } - } - } - - private static void GenerateAssemblyInfoFile(SolutionNode solution, string combFile) - { - System.IO.Directory.CreateDirectory(Helper.MakePathRelativeTo(solution.FullPath, "Properties")); - combFile = Helper.MakeFilePath(solution.FullPath + "/Properties/", "AssemblyInfo.cs", "in"); - StreamWriter ai = new StreamWriter(combFile); - - using (ai) - { - ai.WriteLine("#region License"); - ai.WriteLine("/*"); - ai.WriteLine("MIT License"); - ai.WriteLine("Copyright (c)2003-2006 Tao Framework Team"); - ai.WriteLine("http://www.taoframework.com"); - ai.WriteLine("All rights reserved."); - ai.WriteLine(""); - ai.WriteLine("Permission is hereby granted, free of charge, to any person obtaining a copy"); - ai.WriteLine("of this software and associated documentation files (the \"Software\"), to deal"); - ai.WriteLine("in the Software without restriction, including without limitation the rights"); - ai.WriteLine("to use, copy, modify, merge, publish, distribute, sublicense, and/or sell"); - ai.WriteLine("copies of the Software, and to permit persons to whom the Software is"); - ai.WriteLine("furnished to do so, subject to the following conditions:"); - ai.WriteLine(""); - ai.WriteLine("The above copyright notice and this permission notice shall be included in all"); - ai.WriteLine("copies or substantial portions of the Software."); - ai.WriteLine(""); - ai.WriteLine("THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR"); - ai.WriteLine("IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,"); - ai.WriteLine("FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE"); - ai.WriteLine("AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER"); - ai.WriteLine("LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,"); - ai.WriteLine("OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE"); - ai.WriteLine("SOFTWARE."); - ai.WriteLine("*/"); - ai.WriteLine("#endregion License"); - ai.WriteLine(""); - ai.WriteLine("using System;"); - ai.WriteLine("using System.Reflection;"); - ai.WriteLine("using System.Runtime.InteropServices;"); - ai.WriteLine("using System.Security;"); - ai.WriteLine("using System.Security.Permissions;"); - ai.WriteLine(""); - ai.WriteLine("[assembly: AllowPartiallyTrustedCallers]"); - ai.WriteLine("[assembly: AssemblyCompany(\"Tao Framework -- http://www.taoframework.com\")]"); - ai.WriteLine("[assembly: AssemblyConfiguration(\"Retail\")]"); - ai.WriteLine("[assembly: AssemblyCopyright(\"Copyright (c)2003-2006 Tao Framework Team. All rights reserved.\")]"); - ai.WriteLine("[assembly: AssemblyCulture(\"\")]"); - ai.WriteLine("[assembly: AssemblyDefaultAlias(\"@PACKAGE_NAME@\")]"); - ai.WriteLine("[assembly: AssemblyDelaySign(false)]"); - ai.WriteLine("[assembly: AssemblyDescription(\"@DESCRIPTION@\")]"); - ai.WriteLine("[assembly: AssemblyFileVersion(\"@ASSEMBLY_VERSION@\")]"); - ai.WriteLine("[assembly: AssemblyInformationalVersion(\"@ASSEMBLY_VERSION@\")]"); - ai.WriteLine("[assembly: AssemblyKeyName(\"\")]"); - ai.WriteLine("[assembly: AssemblyProduct(\"@PACKAGE_NAME@.dll\")]"); - ai.WriteLine("[assembly: AssemblyTitle(\"@DESCRIPTION@\")]"); - ai.WriteLine("[assembly: AssemblyTrademark(\"Tao Framework -- http://www.taoframework.com\")]"); - ai.WriteLine("[assembly: AssemblyVersion(\"@ASSEMBLY_VERSION@\")]"); - ai.WriteLine("[assembly: CLSCompliant(true)]"); - ai.WriteLine("[assembly: ComVisible(false)]"); - ai.WriteLine("[assembly: SecurityPermission(SecurityAction.RequestMinimum, Flags = SecurityPermissionFlag.Execution)]"); - ai.WriteLine("[assembly: SecurityPermission(SecurityAction.RequestMinimum, Flags = SecurityPermissionFlag.SkipVerification)]"); - ai.WriteLine("[assembly: SecurityPermission(SecurityAction.RequestMinimum, Flags = SecurityPermissionFlag.UnmanagedCode)]"); - - } - //return combFile; - } - - private void CleanProject(ProjectNode project) - { - m_Kernel.Log.Write("...Cleaning project: {0}", project.Name); - string projectFile = Helper.MakeFilePath(project.FullPath, "Include", "am"); - Helper.DeleteIfExists(projectFile); - } - - private void CleanSolution(SolutionNode solution) - { - m_Kernel.Log.Write("Cleaning Autotools make files for", solution.Name); - - string slnFile = Helper.MakeFilePath(solution.FullPath, "Makefile", "am"); - Helper.DeleteIfExists(slnFile); - - slnFile = Helper.MakeFilePath(solution.FullPath, "Makefile", "in"); - Helper.DeleteIfExists(slnFile); - - slnFile = Helper.MakeFilePath(solution.FullPath, "configure", "ac"); - Helper.DeleteIfExists(slnFile); - - slnFile = Helper.MakeFilePath(solution.FullPath, "configure"); - Helper.DeleteIfExists(slnFile); - - slnFile = Helper.MakeFilePath(solution.FullPath, "Makefile"); - Helper.DeleteIfExists(slnFile); - - foreach (ProjectNode project in solution.Projects) - { - CleanProject(project); - } - - m_Kernel.Log.Write(""); - } - - #endregion - - #region ITarget Members - - /// - /// Writes the specified kern. - /// - /// The kern. - public void Write(Kernel kern) - { - if (kern == null) - { - throw new ArgumentNullException("kern"); - } - m_Kernel = kern; - m_Kernel.Log.Write("Parsing system pkg-config files"); - RunInitialization(); - - string streamName = "autotools.xml"; - string fqStreamName = String.Format("Prebuild.data.{0}", - streamName - ); - - // Retrieve stream for the autotools template XML - Stream autotoolsStream = Assembly.GetExecutingAssembly() - .GetManifestResourceStream(fqStreamName); - - if(autotoolsStream == null) { - - /* - * try without the default namespace prepended, in - * case prebuild.exe assembly was compiled with - * something other than Visual Studio .NET - */ - - autotoolsStream = Assembly.GetExecutingAssembly() - .GetManifestResourceStream(streamName); - if(autotoolsStream == null){ - string errStr = - String.Format("Could not find embedded resource file:\n" + - "'{0}' or '{1}'", - streamName, fqStreamName - ); - - m_Kernel.Log.Write(errStr); - - throw new System.Reflection.TargetException(errStr); - } - } - - // Create an XML URL Resolver with default credentials - xr = new System.Xml.XmlUrlResolver(); - xr.Credentials = CredentialCache.DefaultCredentials; - - // Create a default evidence - no need to limit access - e = new System.Security.Policy.Evidence(); - - // Load the autotools XML - autotoolsDoc = new XmlDocument(); - autotoolsDoc.Load(autotoolsStream); - - /* rootDir is the filesystem location where the Autotools - * build tree will be created - for now we'll make it - * $PWD/autotools - */ - - string pwd = Directory.GetCurrentDirectory(); - //string pwd = System.Environment.GetEnvironmentVariable("PWD"); - string rootDir = ""; - //if (pwd.Length != 0) - //{ - rootDir = Path.Combine(pwd, "autotools"); - //} - //else - //{ - // pwd = Assembly.GetExecutingAssembly() - //} - chkMkDir(rootDir); - - foreach (SolutionNode solution in kern.Solutions) - { - m_Kernel.Log.Write(String.Format("Writing solution: {0}", - solution.Name)); - WriteCombine(solution); - } - m_Kernel = null; - } - - /// - /// Cleans the specified kern. - /// - /// The kern. - public virtual void Clean(Kernel kern) - { - if (kern == null) - { - throw new ArgumentNullException("kern"); - } - m_Kernel = kern; - foreach (SolutionNode sol in kern.Solutions) - { - CleanSolution(sol); - } - m_Kernel = null; - } - - /// - /// Gets the name. - /// - /// The name. - public string Name - { - get - { - return "autotools"; - } - } - - #endregion - } -} diff --git a/Prebuild/src/Core/Targets/DebugTarget.cs b/Prebuild/src/Core/Targets/DebugTarget.cs deleted file mode 100644 index dc4e666..0000000 --- a/Prebuild/src/Core/Targets/DebugTarget.cs +++ /dev/null @@ -1,102 +0,0 @@ -#region BSD License -/* -Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com) - -Redistribution and use in source and binary forms, with or without modification, are permitted -provided that the following conditions are met: - -* Redistributions of source code must retain the above copyright notice, this list of conditions - and the following disclaimer. -* Redistributions in binary form must reproduce the above copyright notice, this list of conditions - and the following disclaimer in the documentation and/or other materials provided with the - distribution. -* The name of the author may not be used to endorse or promote products derived from this software - without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, -BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY -OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING -IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ -#endregion - -#region CVS Information -/* - * $Source$ - * $Author: jendave $ - * $Date: 2006-09-20 09:42:51 +0200 (on, 20 sep 2006) $ - * $Revision: 164 $ - */ -#endregion - -using System; - -using Prebuild.Core.Attributes; -using Prebuild.Core.Interfaces; -using Prebuild.Core.Nodes; - -#if (DEBUG && _DEBUG_TARGET) -namespace Prebuild.Core.Targets -{ - [Target("debug")] - public class DebugTarget : ITarget - { -#region Fields - - private Kernel m_Kernel = null; - -#endregion - -#region ITarget Members - - public void Write() - { - foreach(SolutionNode s in m_Kernel.Solutions) - { - Console.WriteLine("Solution [ {0}, {1} ]", s.Name, s.Path); - foreach(string file in s.Files) -{ - Console.WriteLine("\tFile [ {0} ]", file); -} - - foreach(ProjectNode proj in s.Projects) - { - Console.WriteLine("\tProject [ {0}, {1}. {2} ]", proj.Name, proj.Path, proj.Language); - foreach(string file in proj.Files) - Console.WriteLine("\t\tFile [ {0} ]", file); - } - } - } - - public void Clean() - { - Console.WriteLine("Not implemented"); - } - - public string Name - { - get - { - return "debug"; - } - } - - public Kernel Kernel - { - get - { - return m_Kernel; - } - set - { - m_Kernel = value; - } - } - -#endregion - } -} -#endif diff --git a/Prebuild/src/Core/Targets/MakefileTarget.cs b/Prebuild/src/Core/Targets/MakefileTarget.cs deleted file mode 100644 index 86676d0..0000000 --- a/Prebuild/src/Core/Targets/MakefileTarget.cs +++ /dev/null @@ -1,471 +0,0 @@ -#region BSD License -/* -Copyright (c) 2004 Crestez Leonard (cleonard@go.ro) - -Redistribution and use in source and binary forms, with or without modification, are permitted -provided that the following conditions are met: - -* Redistributions of source code must retain the above copyright notice, this list of conditions - and the following disclaimer. -* Redistributions in binary form must reproduce the above copyright notice, this list of conditions - and the following disclaimer in the documentation and/or other materials provided with the - distribution. -* The name of the author may not be used to endorse or promote products derived from this software - without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, -BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY -OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING -IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ -#endregion - -using System; -using System.Collections; -using System.Collections.Specialized; -using System.IO; -using System.Text.RegularExpressions; - -using Prebuild.Core.Attributes; -using Prebuild.Core.Interfaces; -using Prebuild.Core.Nodes; -using Prebuild.Core.Utilities; - -namespace Prebuild.Core.Targets -{ - [Target("makefile")] - public class MakefileTarget : ITarget - { - #region Fields - - private Kernel m_Kernel = null; - - #endregion - - #region Private Methods - - // This converts a path relative to the path of a project to - // a path relative to the solution path. - private string NicePath(ProjectNode proj, string path) - { - string res; - SolutionNode solution = (SolutionNode)proj.Parent; - res = Path.Combine(Helper.NormalizePath(proj.FullPath, '/'), Helper.NormalizePath(path, '/')); - res = Helper.NormalizePath(res, '/'); - res = res.Replace("/./", "/"); - while (res.IndexOf("/../") >= 0) - { - int a = res.IndexOf("/../"); - int b = res.LastIndexOf("/", a - 1); - res = res.Remove(b, a - b + 3); - } - res = Helper.MakePathRelativeTo(solution.FullPath, res); - if (res.StartsWith("./")) - res = res.Substring(2, res.Length - 2); - res = Helper.NormalizePath(res, '/'); - return res; - } - - private void WriteProjectFiles(StreamWriter f, SolutionNode solution, ProjectNode project) - { - // Write list of source code files - f.WriteLine("SOURCES_{0} = \\", project.Name); - foreach (string file in project.Files) - if (project.Files.GetBuildAction(file) == BuildAction.Compile) - f.WriteLine("\t{0} \\", NicePath(project, file)); - f.WriteLine(); - - // Write list of resource files - f.WriteLine("RESOURCES_{0} = \\", project.Name); - foreach (string file in project.Files) - if (project.Files.GetBuildAction(file) == BuildAction.EmbeddedResource) - { - string path = NicePath(project, file); - f.WriteLine("\t-resource:{0},{1} \\", path, Path.GetFileName(path)); - } - f.WriteLine(); - - // There's also Content and None in BuildAction. - // What am I supposed to do with that? - } - - private string FindFileReference(string refName, ProjectNode project) - { - foreach (ReferencePathNode refPath in project.ReferencePaths) - { - string fullPath = NicePath(project, Helper.MakeFilePath(refPath.Path, refName, "dll")); - if (File.Exists(fullPath)) - return fullPath; - } - return null; - } - - private void WriteProjectReferences(StreamWriter f, SolutionNode solution, ProjectNode project) - { - f.WriteLine("REFERENCES_{0} = \\", project.Name); - foreach (ReferenceNode refr in project.References) - { - string path; - // Project references change with configurations. - if (solution.ProjectsTable.Contains(refr.Name)) - continue; - path = FindFileReference(refr.Name, project); - if (path != null) - f.WriteLine("\t-r:{0} \\", path); - else - f.WriteLine("\t-r:{0} \\", refr.Name); - } - f.WriteLine(); - } - - private void WriteProjectDependencies(StreamWriter f, SolutionNode solution, ProjectNode project) - { - f.WriteLine("DEPENDENCIES_{0} = \\", project.Name); - f.WriteLine("\t$(SOURCES_{0}) \\", project.Name); - foreach (string file in project.Files) - if (project.Files.GetBuildAction(file) == BuildAction.EmbeddedResource) - f.WriteLine("\t{0} \\", NicePath(project, file)); - f.WriteLine(); - } - - private string ProjectTypeToExtension(ProjectType t) - { - if (t == ProjectType.Exe || t == ProjectType.WinExe) - { - return "exe"; - } - else if (t == ProjectType.Library) - { - return "dll"; - } - else - { - throw new FatalException("Bad ProjectType: {0}", t); - } - } - - private string ProjectTypeToTarget(ProjectType t) - { - if (t == ProjectType.Exe) - { - return "exe"; - } - else if (t == ProjectType.WinExe) - { - return "winexe"; - } - else if (t == ProjectType.Library) - { - return "library"; - } - else - { - throw new FatalException("Bad ProjectType: {0}", t); - } - } - - private string ProjectOutput(ProjectNode project, ConfigurationNode config) - { - string filepath; - filepath = Helper.MakeFilePath((string)config.Options["OutputPath"], - project.AssemblyName, ProjectTypeToExtension(project.Type)); - return NicePath(project, filepath); - } - - // Returns true if two configs in one project have the same output. - private bool ProjectClashes(ProjectNode project) - { - foreach (ConfigurationNode conf1 in project.Configurations) - foreach (ConfigurationNode conf2 in project.Configurations) - if (ProjectOutput(project, conf1) == ProjectOutput(project, conf2) && conf1 != conf2) - { - m_Kernel.Log.Write("Warning: Configurations {0} and {1} for project {2} output the same file", - conf1.Name, conf2.Name, project.Name); - m_Kernel.Log.Write("Warning: I'm going to use some timestamps(extra empty files)."); - return true; - } - return false; - } - - private void WriteProject(StreamWriter f, SolutionNode solution, ProjectNode project) - { - f.WriteLine("# This is for project {0}", project.Name); - f.WriteLine(); - - WriteProjectFiles(f, solution, project); - WriteProjectReferences(f, solution, project); - WriteProjectDependencies(f, solution, project); - - bool clash = ProjectClashes(project); - - foreach (ConfigurationNode conf in project.Configurations) - { - string outpath = ProjectOutput(project, conf); - string filesToClean = outpath; - - if (clash) - { - f.WriteLine("{0}-{1}: .{0}-{1}-timestamp", project.Name, conf.Name); - f.WriteLine(); - f.Write(".{0}-{1}-timestamp: $(DEPENDENCIES_{0})", project.Name, conf.Name); - } - else - { - f.WriteLine("{0}-{1}: {2}", project.Name, conf.Name, outpath); - f.WriteLine(); - f.Write("{2}: $(DEPENDENCIES_{0})", project.Name, conf.Name, outpath); - } - // Dependencies on other projects. - foreach (ReferenceNode refr in project.References) - if (solution.ProjectsTable.Contains(refr.Name)) - { - ProjectNode refProj = (ProjectNode)solution.ProjectsTable[refr.Name]; - if (ProjectClashes(refProj)) - f.Write(" .{0}-{1}-timestamp", refProj.Name, conf.Name); - else - f.Write(" {0}", ProjectOutput(refProj, conf)); - } - f.WriteLine(); - - // make directory for output. - if (Path.GetDirectoryName(outpath) != "") - { - f.WriteLine("\tmkdir -p {0}", Path.GetDirectoryName(outpath)); - } - // mcs command line. - f.Write("\tgmcs", project.Name); - f.Write(" -warn:{0}", conf.Options["WarningLevel"]); - if ((bool)conf.Options["DebugInformation"]) - f.Write(" -debug"); - if ((bool)conf.Options["AllowUnsafe"]) - f.Write(" -unsafe"); - if ((bool)conf.Options["CheckUnderflowOverflow"]) - f.Write(" -checked"); - if (project.StartupObject != "") - f.Write(" -main:{0}", project.StartupObject); - if ((string)conf.Options["CompilerDefines"] != "") - { - f.Write(" -define:\"{0}\"", conf.Options["CompilerDefines"]); - } - - f.Write(" -target:{0} -out:{1}", ProjectTypeToTarget(project.Type), outpath); - - // Build references to other projects. Now that sux. - // We have to reference the other project in the same conf. - foreach (ReferenceNode refr in project.References) - if (solution.ProjectsTable.Contains(refr.Name)) - { - ProjectNode refProj; - refProj = (ProjectNode)solution.ProjectsTable[refr.Name]; - f.Write(" -r:{0}", ProjectOutput(refProj, conf)); - } - - f.Write(" $(REFERENCES_{0})", project.Name); - f.Write(" $(RESOURCES_{0})", project.Name); - f.Write(" $(SOURCES_{0})", project.Name); - f.WriteLine(); - - // Copy references with localcopy. - foreach (ReferenceNode refr in project.References) - if (refr.LocalCopy) - { - string outPath, srcPath, destPath; - outPath = Helper.NormalizePath((string)conf.Options["OutputPath"]); - if (solution.ProjectsTable.Contains(refr.Name)) - { - ProjectNode refProj; - refProj = (ProjectNode)solution.ProjectsTable[refr.Name]; - srcPath = ProjectOutput(refProj, conf); - destPath = Path.Combine(outPath, Path.GetFileName(srcPath)); - destPath = NicePath(project, destPath); - if (srcPath != destPath) - { - f.WriteLine("\tcp -f {0} {1}", srcPath, destPath); - filesToClean += " " + destPath; - } - continue; - } - srcPath = FindFileReference(refr.Name, project); - if (srcPath != null) - { - destPath = Path.Combine(outPath, Path.GetFileName(srcPath)); - destPath = NicePath(project, destPath); - f.WriteLine("\tcp -f {0} {1}", srcPath, destPath); - filesToClean += " " + destPath; - } - } - - if (clash) - { - filesToClean += String.Format(" .{0}-{1}-timestamp", project.Name, conf.Name); - f.WriteLine("\ttouch .{0}-{1}-timestamp", project.Name, conf.Name); - f.Write("\trm -rf"); - foreach (ConfigurationNode otherConf in project.Configurations) - if (otherConf != conf) - f.WriteLine(" .{0}-{1}-timestamp", project.Name, otherConf.Name); - f.WriteLine(); - } - f.WriteLine(); - f.WriteLine("{0}-{1}-clean:", project.Name, conf.Name); - f.WriteLine("\trm -rf {0}", filesToClean); - f.WriteLine(); - } - } - - private void WriteIntro(StreamWriter f, SolutionNode solution) - { - f.WriteLine("# Makefile for {0} generated by Prebuild ( http://dnpb.sf.net )", solution.Name); - f.WriteLine("# Do not edit."); - f.WriteLine("#"); - - f.Write("# Configurations:"); - foreach (ConfigurationNode conf in solution.Configurations) - f.Write(" {0}", conf.Name); - f.WriteLine(); - - f.WriteLine("# Projects:"); - foreach (ProjectNode proj in solution.Projects) - f.WriteLine("#\t{0}", proj.Name); - - f.WriteLine("#"); - f.WriteLine("# Building:"); - f.WriteLine("#\t\"make\" to build everything under the default(first) configuration"); - f.WriteLine("#\t\"make CONF\" to build every project under configuration CONF"); - f.WriteLine("#\t\"make PROJ\" to build project PROJ under the default(first) configuration"); - f.WriteLine("#\t\"make PROJ-CONF\" to build project PROJ under configuration CONF"); - f.WriteLine("#"); - f.WriteLine("# Cleaning (removing results of build):"); - f.WriteLine("#\t\"make clean\" to clean everything, that's what you probably want"); - f.WriteLine("#\t\"make CONF\" to clean everything for a configuration"); - f.WriteLine("#\t\"make PROJ\" to clean everything for a project"); - f.WriteLine("#\t\"make PROJ-CONF\" to clea project PROJ under configuration CONF"); - f.WriteLine(); - } - - private void WritePhony(StreamWriter f, SolutionNode solution) - { - string defconf = ""; - foreach (ConfigurationNode conf in solution.Configurations) - { - defconf = conf.Name; - break; - } - - f.Write(".PHONY: all"); - foreach (ProjectNode proj in solution.Projects) - f.Write(" {0} {0}-clean", proj.Name); - foreach (ConfigurationNode conf in solution.Configurations) - f.Write(" {0} {0}-clean", conf.Name); - foreach (ProjectNode proj in solution.Projects) - foreach (ConfigurationNode conf in solution.Configurations) - f.Write(" {0}-{1} {0}-{1}-clean", proj.Name, conf.Name); - f.WriteLine(); - f.WriteLine(); - - f.WriteLine("all: {0}", defconf); - f.WriteLine(); - - f.Write("clean:"); - foreach (ConfigurationNode conf in solution.Configurations) - f.Write(" {0}-clean", conf.Name); - f.WriteLine(); - f.WriteLine(); - - foreach (ConfigurationNode conf in solution.Configurations) - { - f.Write("{0}: ", conf.Name); - foreach (ProjectNode proj in solution.Projects) - f.Write(" {0}-{1}", proj.Name, conf.Name); - f.WriteLine(); - f.WriteLine(); - - f.Write("{0}-clean: ", conf.Name); - foreach (ProjectNode proj in solution.Projects) - f.Write(" {0}-{1}-clean", proj.Name, conf.Name); - f.WriteLine(); - f.WriteLine(); - } - - foreach (ProjectNode proj in solution.Projects) - { - f.WriteLine("{0}: {0}-{1}", proj.Name, defconf); - f.WriteLine(); - - f.Write("{0}-clean:", proj.Name); - foreach (ConfigurationNode conf in proj.Configurations) - f.Write(" {0}-{1}-clean", proj.Name, conf.Name); - f.WriteLine(); - f.WriteLine(); - } - } - - private void WriteSolution(SolutionNode solution) - { - m_Kernel.Log.Write("Creating makefile for {0}", solution.Name); - m_Kernel.CurrentWorkingDirectory.Push(); - - string file = "Makefile";// Helper.MakeFilePath(solution.FullPath, solution.Name, "make"); - StreamWriter f = new StreamWriter(file); - - Helper.SetCurrentDir(Path.GetDirectoryName(file)); - - using (f) - { - WriteIntro(f, solution); - WritePhony(f, solution); - - foreach (ProjectNode project in solution.Projects) - { - m_Kernel.Log.Write("...Creating Project: {0}", project.Name); - WriteProject(f, solution, project); - } - } - - m_Kernel.Log.Write(""); - m_Kernel.CurrentWorkingDirectory.Pop(); - } - - private void CleanSolution(SolutionNode solution) - { - m_Kernel.Log.Write("Cleaning makefile for {0}", solution.Name); - - string file = Helper.MakeFilePath(solution.FullPath, solution.Name, "make"); - Helper.DeleteIfExists(file); - - m_Kernel.Log.Write(""); - } - - #endregion - - #region ITarget Members - - public void Write(Kernel kern) - { - m_Kernel = kern; - foreach (SolutionNode solution in kern.Solutions) - WriteSolution(solution); - m_Kernel = null; - } - - public virtual void Clean(Kernel kern) - { - m_Kernel = kern; - foreach (SolutionNode sol in kern.Solutions) - CleanSolution(sol); - m_Kernel = null; - } - - public string Name - { - get - { - return "makefile"; - } - } - - #endregion - } -} diff --git a/Prebuild/src/Core/Targets/MonoDevelopTarget.cs b/Prebuild/src/Core/Targets/MonoDevelopTarget.cs deleted file mode 100644 index c8401fd..0000000 --- a/Prebuild/src/Core/Targets/MonoDevelopTarget.cs +++ /dev/null @@ -1,464 +0,0 @@ -#region BSD License -/* -Copyright (c) 2004 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com) - -Redistribution and use in source and binary forms, with or without modification, are permitted -provided that the following conditions are met: - -* Redistributions of source code must retain the above copyright notice, this list of conditions - and the following disclaimer. -* Redistributions in binary form must reproduce the above copyright notice, this list of conditions - and the following disclaimer in the documentation and/or other materials provided with the - distribution. -* The name of the author may not be used to endorse or promote products derived from this software - without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, -BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY -OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING -IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ -#endregion - -using System; -using System.Collections; -using System.Collections.Specialized; -using System.IO; -using System.Reflection; -using System.Text.RegularExpressions; - -using Prebuild.Core.Attributes; -using Prebuild.Core.Interfaces; -using Prebuild.Core.Nodes; -using Prebuild.Core.Utilities; - -namespace Prebuild.Core.Targets -{ - /// - /// - /// - [Target("monodev")] - public class MonoDevelopTarget : ITarget - { - #region Fields - - private Kernel m_Kernel; - - #endregion - - #region Private Methods - - private static string PrependPath(string path) - { - string tmpPath = Helper.NormalizePath(path, '/'); - Regex regex = new Regex(@"(\w):/(\w+)"); - Match match = regex.Match(tmpPath); - if(match.Success || tmpPath[0] == '.' || tmpPath[0] == '/') - { - tmpPath = Helper.NormalizePath(tmpPath); - } - else - { - tmpPath = Helper.NormalizePath("./" + tmpPath); - } - - return tmpPath; - } - - private static string BuildReference(SolutionNode solution, ReferenceNode refr) - { - string ret = ""; - } - else - { - ProjectNode project = (ProjectNode)refr.Parent; - string fileRef = FindFileReference(refr.Name, project); - - if(refr.Path != null || fileRef != null) - { - ret += "Assembly\" refto=\""; - - string finalPath = (refr.Path != null) ? Helper.MakeFilePath(refr.Path, refr.Name, "dll") : fileRef; - - ret += finalPath; - ret += "\" localcopy=\"" + refr.LocalCopy.ToString() + "\" />"; - return ret; - } - - ret += "Gac\""; - ret += " localcopy=\"" + refr.LocalCopy.ToString() + "\""; - ret += " refto=\""; - try - { - /* - Day changed to 28 Mar 2007 - ... - 08:09 < cj> is there anything that replaces Assembly.LoadFromPartialName() ? - 08:09 < jonp> no - 08:10 < jonp> in their infinite wisdom [sic], microsoft decided that the - ability to load any assembly version by-name was an inherently - bad idea - 08:11 < cj> I'm thinking of a bunch of four-letter words right now... - 08:11 < cj> security through making it difficult for the developer!!! - 08:12 < jonp> just use the Obsolete API - 08:12 < jonp> it should still work - 08:12 < cj> alrighty. - 08:12 < jonp> you just get warnings when using it - */ - Assembly assem = Assembly.LoadWithPartialName(refr.Name); - ret += assem.FullName; - //ret += refr.Name; - } - catch (System.NullReferenceException e) - { - e.ToString(); - ret += refr.Name; - } - ret += "\" />"; - } - - return ret; - } - - private static string FindFileReference(string refName, ProjectNode project) - { - foreach(ReferencePathNode refPath in project.ReferencePaths) - { - string fullPath = Helper.MakeFilePath(refPath.Path, refName, "dll"); - - if(File.Exists(fullPath)) - { - return fullPath; - } - } - - return null; - } - - /// - /// Gets the XML doc file. - /// - /// The project. - /// The conf. - /// - public static string GenerateXmlDocFile(ProjectNode project, ConfigurationNode conf) - { - if( conf == null ) - { - throw new ArgumentNullException("conf"); - } - if( project == null ) - { - throw new ArgumentNullException("project"); - } - string docFile = (string)conf.Options["XmlDocFile"]; - if(docFile != null && docFile.Length == 0)//default to assembly name if not specified - { - return "False"; - } - return "True"; - } - - private void WriteProject(SolutionNode solution, ProjectNode project) - { - string csComp = "Mcs"; - string netRuntime = "Mono"; - if(project.Runtime == ClrRuntime.Microsoft) - { - csComp = "Csc"; - netRuntime = "MsNet"; - } - - string projFile = Helper.MakeFilePath(project.FullPath, project.Name, "mdp"); - StreamWriter ss = new StreamWriter(projFile); - - m_Kernel.CurrentWorkingDirectory.Push(); - Helper.SetCurrentDir(Path.GetDirectoryName(projFile)); - - using(ss) - { - ss.WriteLine( - "", - project.Name, - project.RootNamespace - ); - - int count = 0; - - ss.WriteLine(" ", solution.ActiveConfig); - - foreach(ConfigurationNode conf in project.Configurations) - { - ss.WriteLine(" ", conf.Name); - ss.Write(" "); - - ss.Write(" "); - - ss.Write(" "); - - ss.Write(" "); - ss.WriteLine(" "); - - count++; - } - ss.WriteLine(" "); - - ss.Write(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - - ss.WriteLine(" "); - foreach(string file in project.Files) - { - string buildAction = "Compile"; - switch(project.Files.GetBuildAction(file)) - { - case BuildAction.None: - buildAction = "Nothing"; - break; - - case BuildAction.Content: - buildAction = "Exclude"; - break; - - case BuildAction.EmbeddedResource: - buildAction = "EmbedAsResource"; - break; - - default: - buildAction = "Compile"; - break; - } - - // Sort of a hack, we try and resolve the path and make it relative, if we can. - string filePath = PrependPath(file); - ss.WriteLine(" ", filePath, buildAction); - } - ss.WriteLine(" "); - - ss.WriteLine(" "); - foreach(ReferenceNode refr in project.References) - { - ss.WriteLine(" {0}", BuildReference(solution, refr)); - } - ss.WriteLine(" "); - - - ss.WriteLine(""); - } - - m_Kernel.CurrentWorkingDirectory.Pop(); - } - - private void WriteCombine(SolutionNode solution) - { - m_Kernel.Log.Write("Creating MonoDevelop combine and project files"); - foreach(ProjectNode project in solution.Projects) - { - if(m_Kernel.AllowProject(project.FilterGroups)) - { - m_Kernel.Log.Write("...Creating project: {0}", project.Name); - WriteProject(solution, project); - } - } - - m_Kernel.Log.Write(""); - string combFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "mds"); - StreamWriter ss = new StreamWriter(combFile); - - m_Kernel.CurrentWorkingDirectory.Push(); - Helper.SetCurrentDir(Path.GetDirectoryName(combFile)); - - int count = 0; - - using(ss) - { - ss.WriteLine("", solution.Name); - - count = 0; - foreach(ConfigurationNode conf in solution.Configurations) - { - if(count == 0) - { - ss.WriteLine(" ", conf.Name); - } - - ss.WriteLine(" ", conf.Name); - foreach(ProjectNode project in solution.Projects) - { - ss.WriteLine(" ", project.Name, conf.Name); - } - ss.WriteLine(" "); - - count++; - } - ss.WriteLine(" "); - - count = 0; - - foreach(ProjectNode project in solution.Projects) - { - if(count == 0) - ss.WriteLine(" ", project.Name); - - ss.WriteLine(" ", project.Name); - count++; - } - ss.WriteLine(" "); - - ss.WriteLine(" "); - foreach(ProjectNode project in solution.Projects) - { - string path = Helper.MakePathRelativeTo(solution.FullPath, project.FullPath); - ss.WriteLine(" ", - Helper.MakeFilePath(path, project.Name, "mdp")); - } - ss.WriteLine(" "); - - ss.WriteLine(""); - } - - m_Kernel.CurrentWorkingDirectory.Pop(); - } - - private void CleanProject(ProjectNode project) - { - m_Kernel.Log.Write("...Cleaning project: {0}", project.Name); - string projectFile = Helper.MakeFilePath(project.FullPath, project.Name, "mdp"); - Helper.DeleteIfExists(projectFile); - } - - private void CleanSolution(SolutionNode solution) - { - m_Kernel.Log.Write("Cleaning MonoDevelop combine and project files for", solution.Name); - - string slnFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "mds"); - Helper.DeleteIfExists(slnFile); - - foreach(ProjectNode project in solution.Projects) - { - CleanProject(project); - } - - m_Kernel.Log.Write(""); - } - - #endregion - - #region ITarget Members - - /// - /// Writes the specified kern. - /// - /// The kern. - public void Write(Kernel kern) - { - if( kern == null ) - { - throw new ArgumentNullException("kern"); - } - m_Kernel = kern; - foreach(SolutionNode solution in kern.Solutions) - { - WriteCombine(solution); - } - m_Kernel = null; - } - - /// - /// Cleans the specified kern. - /// - /// The kern. - public virtual void Clean(Kernel kern) - { - if( kern == null ) - { - throw new ArgumentNullException("kern"); - } - m_Kernel = kern; - foreach(SolutionNode sol in kern.Solutions) - { - CleanSolution(sol); - } - m_Kernel = null; - } - - /// - /// Gets the name. - /// - /// The name. - public string Name - { - get - { - return "sharpdev"; - } - } - - #endregion - } -} diff --git a/Prebuild/src/Core/Targets/NAntTarget.cs b/Prebuild/src/Core/Targets/NAntTarget.cs deleted file mode 100644 index 9a6ee17..0000000 --- a/Prebuild/src/Core/Targets/NAntTarget.cs +++ /dev/null @@ -1,738 +0,0 @@ -#region BSD License -/* -Copyright (c) 2004 - 2008 -Matthew Holmes (matthew@wildfiregames.com), -Dan Moorehead (dan05a@gmail.com), -C.J. Adams-Collier (cjac@colliertech.org), - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - -* Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - -* Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - -* The name of the author may not be used to endorse or promote - products derived from this software without specific prior written - permission. - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR -IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, -INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, -STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING -IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -POSSIBILITY OF SUCH DAMAGE. -*/ - -#endregion - -using System; -using System.Collections; -using System.Collections.Specialized; -using System.IO; -using System.Reflection; -using System.Text.RegularExpressions; - -using Prebuild.Core.Attributes; -using Prebuild.Core.Interfaces; -using Prebuild.Core.Nodes; -using Prebuild.Core.Utilities; - -namespace Prebuild.Core.Targets -{ - /// - /// - /// - [Target("nant")] - public class NAntTarget : ITarget - { - #region Fields - - private Kernel m_Kernel; - - #endregion - - #region Private Methods - - private static string PrependPath(string path) - { - string tmpPath = Helper.NormalizePath(path, '/'); - Regex regex = new Regex(@"(\w):/(\w+)"); - Match match = regex.Match(tmpPath); - //if(match.Success || tmpPath[0] == '.' || tmpPath[0] == '/') - //{ - tmpPath = Helper.NormalizePath(tmpPath); - //} - // else - // { - // tmpPath = Helper.NormalizePath("./" + tmpPath); - // } - - return tmpPath; - } - - private static string BuildReference(SolutionNode solution, ProjectNode currentProject, ReferenceNode refr) - { - - if (!String.IsNullOrEmpty(refr.Path)) - { - return refr.Path; - } - - if (solution.ProjectsTable.ContainsKey(refr.Name)) - { - ProjectNode projectRef = (ProjectNode) solution.ProjectsTable[refr.Name]; - string finalPath = - Helper.NormalizePath(refr.Name + GetProjectExtension(projectRef), '/'); - return finalPath; - } - - ProjectNode project = (ProjectNode) refr.Parent; - - // Do we have an explicit file reference? - string fileRef = FindFileReference(refr.Name, project); - if (fileRef != null) - { - return fileRef; - } - - // Is there an explicit path in the project ref? - if (refr.Path != null) - { - return Helper.NormalizePath(refr.Path + "/" + refr.Name + GetProjectExtension(project), '/'); - } - - // No, it's an extensionless GAC ref, but nant needs the .dll extension anyway - return refr.Name + ".dll"; - } - - public static string GetRefFileName(string refName) - { - if (ExtensionSpecified(refName)) - { - return refName; - } - else - { - return refName + ".dll"; - } - } - - private static bool ExtensionSpecified(string refName) - { - return refName.EndsWith(".dll") || refName.EndsWith(".exe"); - } - - private static string GetProjectExtension(ProjectNode project) - { - string extension = ".dll"; - if (project.Type == ProjectType.Exe || project.Type == ProjectType.WinExe) - { - extension = ".exe"; - } - return extension; - } - - private static string FindFileReference(string refName, ProjectNode project) - { - foreach (ReferencePathNode refPath in project.ReferencePaths) - { - string fullPath = Helper.MakeFilePath(refPath.Path, refName); - - if (File.Exists(fullPath)) - { - return fullPath; - } - - fullPath = Helper.MakeFilePath(refPath.Path, refName, "dll"); - - if (File.Exists(fullPath)) - { - return fullPath; - } - - fullPath = Helper.MakeFilePath(refPath.Path, refName, "exe"); - - if (File.Exists(fullPath)) - { - return fullPath; - } - } - - return null; - } - - /// - /// Gets the XML doc file. - /// - /// The project. - /// The conf. - /// - public static string GetXmlDocFile(ProjectNode project, ConfigurationNode conf) - { - if (conf == null) - { - throw new ArgumentNullException("conf"); - } - if (project == null) - { - throw new ArgumentNullException("project"); - } - string docFile = (string)conf.Options["XmlDocFile"]; - // if(docFile != null && docFile.Length == 0)//default to assembly name if not specified - // { - // return Path.GetFileNameWithoutExtension(project.AssemblyName) + ".xml"; - // } - return docFile; - } - - private void WriteProject(SolutionNode solution, ProjectNode project) - { - string projFile = Helper.MakeFilePath(project.FullPath, project.Name + GetProjectExtension(project), "build"); - StreamWriter ss = new StreamWriter(projFile); - - m_Kernel.CurrentWorkingDirectory.Push(); - Helper.SetCurrentDir(Path.GetDirectoryName(projFile)); - bool hasDoc = false; - - using (ss) - { - ss.WriteLine(""); - ss.WriteLine("", project.Name); - ss.WriteLine(" ", "build"); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - foreach (ReferenceNode refr in project.References) - { - if (refr.LocalCopy) - { - ss.WriteLine(" ", '/')); - } - } - - ss.WriteLine(" "); - ss.WriteLine(" "); - if (project.ConfigFile != null && project.ConfigFile.Length!=0) - { - ss.Write(" "); - } - - // Add the content files to just be copied - ss.WriteLine(" {0}", ""); - ss.WriteLine(" {0}", ""); - - foreach (string file in project.Files) - { - // Ignore if we aren't content - if (project.Files.GetBuildAction(file) != BuildAction.Content) - continue; - - // Create a include tag - ss.WriteLine(" {0}", ""); - } - - ss.WriteLine(" {0}", ""); - ss.WriteLine(" {0}", ""); - - ss.Write(" "); - ss.WriteLine(" ", project.RootNamespace); - foreach (string file in project.Files) - { - switch (project.Files.GetBuildAction(file)) - { - case BuildAction.EmbeddedResource: - ss.WriteLine(" {0}", ""); - break; - default: - if (project.Files.GetSubType(file) != SubType.Code && project.Files.GetSubType(file) != SubType.Settings) - { - ss.WriteLine(" ", file.Substring(0, file.LastIndexOf('.')) + ".resx"); - } - break; - } - } - //if (project.Files.GetSubType(file).ToString() != "Code") - //{ - // ps.WriteLine(" ", file.Substring(0, file.LastIndexOf('.')) + ".resx"); - - ss.WriteLine(" "); - ss.WriteLine(" "); - foreach (string file in project.Files) - { - switch (project.Files.GetBuildAction(file)) - { - case BuildAction.Compile: - ss.WriteLine(" "); - break; - default: - break; - } - } - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - foreach(ReferencePathNode refPath in project.ReferencePaths) - { - ss.WriteLine(" "); - } - ss.WriteLine(" "); - foreach (ReferenceNode refr in project.References) - { - string path = Helper.NormalizePath(Helper.MakePathRelativeTo(project.FullPath, BuildReference(solution, project, refr)), '/'); - ss.WriteLine(" "); - } - ss.WriteLine(" "); - - ss.WriteLine(" "); - - foreach (ConfigurationNode conf in project.Configurations) - { - if (!String.IsNullOrEmpty(conf.Options.OutputPath)) - { - string targetDir = Helper.NormalizePath(conf.Options.OutputPath, '/'); - - ss.WriteLine(" "); - - ss.WriteLine(" "); - - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - break; - } - } - - ss.WriteLine(" "); - - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - - ss.WriteLine(" "); - if (hasDoc) - { - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.Write(" "); - } - else - { - ss.WriteLine(".exe\" />"); - } - - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - // foreach(ReferenceNode refr in project.References) - // { - // string path = Helper.NormalizePath(Helper.MakePathRelativeTo(project.FullPath, BuildReferencePath(solution, refr)), '/'); - // if (path != "") - // { - // ss.WriteLine(" ", path); - // } - // } - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - } - ss.WriteLine(" "); - ss.WriteLine(""); - } - m_Kernel.CurrentWorkingDirectory.Pop(); - } - - private void WriteCombine(SolutionNode solution) - { - m_Kernel.Log.Write("Creating NAnt build files"); - foreach (ProjectNode project in solution.Projects) - { - if (m_Kernel.AllowProject(project.FilterGroups)) - { - m_Kernel.Log.Write("...Creating project: {0}", project.Name); - WriteProject(solution, project); - } - } - - m_Kernel.Log.Write(""); - string combFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "build"); - StreamWriter ss = new StreamWriter(combFile); - - m_Kernel.CurrentWorkingDirectory.Push(); - Helper.SetCurrentDir(Path.GetDirectoryName(combFile)); - - using (ss) - { - ss.WriteLine(""); - ss.WriteLine("", solution.Name); - ss.WriteLine(" "); - ss.WriteLine(); - - //ss.WriteLine(" "); - //ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - - // actually use active config out of prebuild.xml - ss.WriteLine(" ", solution.ActiveConfig); - - foreach (ConfigurationNode conf in solution.Configurations) - { - ss.WriteLine(); - ss.WriteLine(" ", conf.Name); - ss.WriteLine(" ", conf.Name); - ss.WriteLine(" ", conf.Options["DebugInformation"].ToString().ToLower()); - ss.WriteLine(" "); - ss.WriteLine(); - } - - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(); - - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(); - - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(); - - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(); - - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(); - - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(); - - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(); - - - // sdague - ok, this is an ugly hack, but what it lets - // us do is native include of files into the nant - // created files from all .nant/*include files. This - // lets us keep using prebuild, but allows for - // extended nant targets to do build and the like. - - try - { - Regex re = new Regex(".include$"); - DirectoryInfo nantdir = new DirectoryInfo(".nant"); - foreach (FileSystemInfo item in nantdir.GetFileSystemInfos()) - { - if (item is DirectoryInfo) { } - else if (item is FileInfo) - { - if (re.Match(((FileInfo)item).FullName) != - System.Text.RegularExpressions.Match.Empty) - { - Console.WriteLine("Including file: " + ((FileInfo)item).FullName); - - using (FileStream fs = new FileStream(((FileInfo)item).FullName, - FileMode.Open, - FileAccess.Read, - FileShare.None)) - { - using (StreamReader sr = new StreamReader(fs)) - { - ss.WriteLine("", ((FileInfo)item).FullName); - while (sr.Peek() != -1) - { - ss.WriteLine(sr.ReadLine()); - } - ss.WriteLine(); - } - } - } - } - } - } - catch { } - // ss.WriteLine(" "); - // ss.WriteLine(" "); - // ss.WriteLine(" ", solution.Name, solution.Version); - // ss.WriteLine(" "); - - // ss.WriteLine(" "); - // // ss.WriteLine(" "); - // ss.WriteLine(" "); - // ss.WriteLine(" "); - // ss.WriteLine(" "); - // ss.WriteLine(" "); - ss.WriteLine(); - - - ss.WriteLine(" "); - ss.WriteLine(" "); - //ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - foreach (ProjectNode project in solution.Projects) - { - string path = Helper.MakePathRelativeTo(solution.FullPath, project.FullPath); - ss.Write(" "); - } - ss.WriteLine(" "); - ss.WriteLine(); - - ss.WriteLine(" "); - - foreach (ProjectNode project in solution.ProjectsTableOrder) - { - string path = Helper.MakePathRelativeTo(solution.FullPath, project.FullPath); - ss.Write(" "); - } - ss.WriteLine(" "); - ss.WriteLine(); - - ss.WriteLine(" "); - ss.WriteLine(); - ss.WriteLine(" "); - ss.WriteLine(); - //ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(); - - ss.WriteLine(" "); - ss.WriteLine(" "); - foreach (ProjectNode project in solution.Projects) - { - string path = Helper.MakePathRelativeTo(solution.FullPath, project.FullPath); - ss.Write(" "); - } - ss.WriteLine(" "); - ss.WriteLine(); - ss.WriteLine(""); - } - - m_Kernel.CurrentWorkingDirectory.Pop(); - } - - private void CleanProject(ProjectNode project) - { - m_Kernel.Log.Write("...Cleaning project: {0}", project.Name); - string projectFile = Helper.MakeFilePath(project.FullPath, project.Name + GetProjectExtension(project), "build"); - Helper.DeleteIfExists(projectFile); - } - - private void CleanSolution(SolutionNode solution) - { - m_Kernel.Log.Write("Cleaning NAnt build files for", solution.Name); - - string slnFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "build"); - Helper.DeleteIfExists(slnFile); - - foreach (ProjectNode project in solution.Projects) - { - CleanProject(project); - } - - m_Kernel.Log.Write(""); - } - - #endregion - - #region ITarget Members - - /// - /// Writes the specified kern. - /// - /// The kern. - public void Write(Kernel kern) - { - if (kern == null) - { - throw new ArgumentNullException("kern"); - } - m_Kernel = kern; - foreach (SolutionNode solution in kern.Solutions) - { - WriteCombine(solution); - } - m_Kernel = null; - } - - /// - /// Cleans the specified kern. - /// - /// The kern. - public virtual void Clean(Kernel kern) - { - if (kern == null) - { - throw new ArgumentNullException("kern"); - } - m_Kernel = kern; - foreach (SolutionNode sol in kern.Solutions) - { - CleanSolution(sol); - } - m_Kernel = null; - } - - /// - /// Gets the name. - /// - /// The name. - public string Name - { - get - { - return "nant"; - } - } - - #endregion - } -} diff --git a/Prebuild/src/Core/Targets/SharpDevelop2Target.cs b/Prebuild/src/Core/Targets/SharpDevelop2Target.cs deleted file mode 100644 index 66dd1bc..0000000 --- a/Prebuild/src/Core/Targets/SharpDevelop2Target.cs +++ /dev/null @@ -1,82 +0,0 @@ -#region BSD License -/* -Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com) - -Redistribution and use in source and binary forms, with or without modification, are permitted -provided that the following conditions are met: - -* Redistributions of source code must retain the above copyright notice, this list of conditions - and the following disclaimer. -* Redistributions in binary form must reproduce the above copyright notice, this list of conditions - and the following disclaimer in the documentation and/or other materials provided with the - distribution. -* The name of the author may not be used to endorse or promote products derived from this software - without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, -BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY -OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING -IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ -#endregion - -using System; - -using Prebuild.Core.Attributes; - -namespace Prebuild.Core.Targets -{ - /// - /// - /// - [Target("sharpdev2")] - public class SharpDevelop2Target : VS2005Target - { - #region Properties - public override string VersionName - { - get - { - return "SharpDevelop2"; - } - } - #endregion - - #region Public Methods - - /// - /// Writes the specified kern. - /// - /// The kern. - public override void Write(Kernel kern) - { - base.Write(kern); - } - - /// - /// Cleans the specified kern. - /// - /// The kern. - public override void Clean(Kernel kern) - { - base.Clean(kern); - } - - /// - /// Gets the name. - /// - /// The name. - public override string Name - { - get - { - return "sharpdev2"; - } - } - - #endregion - } -} diff --git a/Prebuild/src/Core/Targets/SharpDevelopTarget.cs b/Prebuild/src/Core/Targets/SharpDevelopTarget.cs deleted file mode 100644 index cf7ce02..0000000 --- a/Prebuild/src/Core/Targets/SharpDevelopTarget.cs +++ /dev/null @@ -1,428 +0,0 @@ -#region BSD License -/* -Copyright (c) 2004 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com) - -Redistribution and use in source and binary forms, with or without modification, are permitted -provided that the following conditions are met: - -* Redistributions of source code must retain the above copyright notice, this list of conditions - and the following disclaimer. -* Redistributions in binary form must reproduce the above copyright notice, this list of conditions - and the following disclaimer in the documentation and/or other materials provided with the - distribution. -* The name of the author may not be used to endorse or promote products derived from this software - without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, -BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY -OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING -IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ -#endregion - -using System; -using System.Collections; -using System.Collections.Specialized; -using System.IO; -using System.Text.RegularExpressions; -using System.Reflection; - -using Prebuild.Core.Attributes; -using Prebuild.Core.Interfaces; -using Prebuild.Core.Nodes; -using Prebuild.Core.Utilities; - -namespace Prebuild.Core.Targets -{ - /// - /// - /// - [Target("sharpdev")] - public class SharpDevelopTarget : ITarget - { - #region Fields - - private Kernel m_Kernel; - - #endregion - - #region Private Methods - - private static string PrependPath(string path) - { - string tmpPath = Helper.NormalizePath(path, '/'); - Regex regex = new Regex(@"(\w):/(\w+)"); - Match match = regex.Match(tmpPath); - if(match.Success || tmpPath[0] == '.' || tmpPath[0] == '/') - { - tmpPath = Helper.NormalizePath(tmpPath); - } - else - { - tmpPath = Helper.NormalizePath("./" + tmpPath); - } - - return tmpPath; - } - - private static string BuildReference(SolutionNode solution, ReferenceNode refr) - { - string ret = ""; - } - else - { - ProjectNode project = (ProjectNode)refr.Parent; - string fileRef = FindFileReference(refr.Name, project); - - if(refr.Path != null || fileRef != null) - { - ret += "Assembly\" refto=\""; - - string finalPath = (refr.Path != null) ? Helper.MakeFilePath(refr.Path, refr.Name, "dll") : fileRef; - - ret += finalPath; - ret += "\" localcopy=\"" + refr.LocalCopy.ToString() + "\" />"; - return ret; - } - - ret += "Gac\" refto=\""; - try - { - //Assembly assem = Assembly.Load(refr.Name); - ret += refr.Name;// assem.FullName; - } - catch (System.NullReferenceException e) - { - e.ToString(); - ret += refr.Name; - } - ret += "\" localcopy=\"" + refr.LocalCopy.ToString() + "\" />"; - } - - return ret; - } - - private static string FindFileReference(string refName, ProjectNode project) - { - foreach(ReferencePathNode refPath in project.ReferencePaths) - { - string fullPath = Helper.MakeFilePath(refPath.Path, refName, "dll"); - - if(File.Exists(fullPath)) - { - return fullPath; - } - } - - return null; - } - - /// - /// Gets the XML doc file. - /// - /// The project. - /// The conf. - /// - public static string GenerateXmlDocFile(ProjectNode project, ConfigurationNode conf) - { - if( conf == null ) - { - throw new ArgumentNullException("conf"); - } - if( project == null ) - { - throw new ArgumentNullException("project"); - } - string docFile = (string)conf.Options["XmlDocFile"]; - if(docFile != null && docFile.Length == 0)//default to assembly name if not specified - { - return "False"; - } - return "True"; - } - - private void WriteProject(SolutionNode solution, ProjectNode project) - { - string csComp = "Csc"; - string netRuntime = "MsNet"; - if(project.Runtime == ClrRuntime.Mono) - { - csComp = "Mcs"; - netRuntime = "Mono"; - } - - string projFile = Helper.MakeFilePath(project.FullPath, project.Name, "prjx"); - StreamWriter ss = new StreamWriter(projFile); - - m_Kernel.CurrentWorkingDirectory.Push(); - Helper.SetCurrentDir(Path.GetDirectoryName(projFile)); - - using(ss) - { - ss.WriteLine( - "", - project.Name, - project.RootNamespace - ); - - ss.WriteLine(" "); - foreach(string file in project.Files) - { - string buildAction = "Compile"; - switch(project.Files.GetBuildAction(file)) - { - case BuildAction.None: - buildAction = "Nothing"; - break; - - case BuildAction.Content: - buildAction = "Exclude"; - break; - - case BuildAction.EmbeddedResource: - buildAction = "EmbedAsResource"; - break; - - default: - buildAction = "Compile"; - break; - } - - // Sort of a hack, we try and resolve the path and make it relative, if we can. - string filePath = PrependPath(file); - ss.WriteLine(" ", filePath, buildAction); - } - ss.WriteLine(" "); - - ss.WriteLine(" "); - foreach(ReferenceNode refr in project.References) - { - ss.WriteLine(" {0}", BuildReference(solution, refr)); - } - ss.WriteLine(" "); - - ss.Write(" "); - - int count = 0; - - ss.WriteLine(" ", solution.ActiveConfig); - - foreach(ConfigurationNode conf in project.Configurations) - { - ss.Write(" "); - ss.Write(" "); - - ss.Write(" "); - - ss.Write(" "); - ss.WriteLine(" "); - - count++; - } - ss.WriteLine(" "); - ss.WriteLine(""); - } - - m_Kernel.CurrentWorkingDirectory.Pop(); - } - - private void WriteCombine(SolutionNode solution) - { - m_Kernel.Log.Write("Creating SharpDevelop combine and project files"); - foreach(ProjectNode project in solution.Projects) - { - if(m_Kernel.AllowProject(project.FilterGroups)) - { - m_Kernel.Log.Write("...Creating project: {0}", project.Name); - WriteProject(solution, project); - } - } - - m_Kernel.Log.Write(""); - string combFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "cmbx"); - StreamWriter ss = new StreamWriter(combFile); - - m_Kernel.CurrentWorkingDirectory.Push(); - Helper.SetCurrentDir(Path.GetDirectoryName(combFile)); - - using(ss) - { - ss.WriteLine("", solution.Name); - - int count = 0; - foreach(ProjectNode project in solution.Projects) - { - if(count == 0) - ss.WriteLine(" ", project.Name); - - ss.WriteLine(" ", project.Name); - count++; - } - ss.WriteLine(" "); - - ss.WriteLine(" "); - foreach(ProjectNode project in solution.Projects) - { - string path = Helper.MakePathRelativeTo(solution.FullPath, project.FullPath); - ss.WriteLine(" ", - Helper.MakeFilePath(path, project.Name, "prjx")); - } - ss.WriteLine(" "); - - count = 0; - foreach(ConfigurationNode conf in solution.Configurations) - { - if(count == 0) - { - ss.WriteLine(" ", conf.Name); - } - - ss.WriteLine(" ", conf.Name); - foreach(ProjectNode project in solution.Projects) - { - ss.WriteLine(" ", project.Name, conf.Name); - } - ss.WriteLine(" "); - - count++; - } - ss.WriteLine(" "); - ss.WriteLine(""); - } - - m_Kernel.CurrentWorkingDirectory.Pop(); - } - - private void CleanProject(ProjectNode project) - { - m_Kernel.Log.Write("...Cleaning project: {0}", project.Name); - string projectFile = Helper.MakeFilePath(project.FullPath, project.Name, "prjx"); - Helper.DeleteIfExists(projectFile); - } - - private void CleanSolution(SolutionNode solution) - { - m_Kernel.Log.Write("Cleaning SharpDevelop combine and project files for", solution.Name); - - string slnFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "cmbx"); - Helper.DeleteIfExists(slnFile); - - foreach(ProjectNode project in solution.Projects) - { - CleanProject(project); - } - - m_Kernel.Log.Write(""); - } - - #endregion - - #region ITarget Members - - /// - /// Writes the specified kern. - /// - /// The kern. - public void Write(Kernel kern) - { - if( kern == null ) - { - throw new ArgumentNullException("kern"); - } - m_Kernel = kern; - foreach(SolutionNode solution in kern.Solutions) - { - WriteCombine(solution); - } - m_Kernel = null; - } - - /// - /// Cleans the specified kern. - /// - /// The kern. - public virtual void Clean(Kernel kern) - { - if( kern == null ) - { - throw new ArgumentNullException("kern"); - } - m_Kernel = kern; - foreach(SolutionNode sol in kern.Solutions) - { - CleanSolution(sol); - } - m_Kernel = null; - } - - /// - /// Gets the name. - /// - /// The name. - public string Name - { - get - { - return "sharpdev"; - } - } - - #endregion - } -} diff --git a/Prebuild/src/Core/Targets/ToolInfo.cs b/Prebuild/src/Core/Targets/ToolInfo.cs deleted file mode 100644 index 935c674..0000000 --- a/Prebuild/src/Core/Targets/ToolInfo.cs +++ /dev/null @@ -1,197 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace Prebuild.Core.Targets -{ - /// - /// - /// - public struct ToolInfo - { - string name; - string guid; - string fileExtension; - string xmlTag; - string importProject; - - /// - /// Gets or sets the name. - /// - /// The name. - public string Name - { - get - { - return name; - } - set - { - name = value; - } - } - - /// - /// Gets or sets the GUID. - /// - /// The GUID. - public string Guid - { - get - { - return guid; - } - set - { - guid = value; - } - } - - /// - /// Gets or sets the file extension. - /// - /// The file extension. - public string FileExtension - { - get - { - return fileExtension; - } - set - { - fileExtension = value; - } - } - public string LanguageExtension - { - get - { - switch (this.Name) - { - case "C#": - return ".cs"; - case "VisualBasic": - return ".vb"; - case "Boo": - return ".boo"; - default: - return ".cs"; - } - } - } - /// - /// Gets or sets the XML tag. - /// - /// The XML tag. - public string XmlTag - { - get - { - return xmlTag; - } - set - { - xmlTag = value; - } - } - - /// - /// Gets or sets the import project property. - /// - /// The ImportProject tag. - public string ImportProject - { - get - { - return importProject; - } - set - { - importProject = value; - } - } - - /// - /// Initializes a new instance of the class. - /// - /// The name. - /// The GUID. - /// The file extension. - /// The XML. - /// The import project. - public ToolInfo(string name, string guid, string fileExtension, string xml, string importProject) - { - this.name = name; - this.guid = guid; - this.fileExtension = fileExtension; - this.xmlTag = xml; - this.importProject = importProject; - } - - /// - /// Initializes a new instance of the class. - /// - /// The name. - /// The GUID. - /// The file extension. - /// The XML. - public ToolInfo(string name, string guid, string fileExtension, string xml) - { - this.name = name; - this.guid = guid; - this.fileExtension = fileExtension; - this.xmlTag = xml; - this.importProject = "$(MSBuildBinPath)\\Microsoft." + xml + ".Targets"; - } - - /// - /// Equals operator - /// - /// ToolInfo to compare - /// true if toolInfos are equal - public override bool Equals(object obj) - { - if (obj == null) - { - throw new ArgumentNullException("obj"); - } - if (obj.GetType() != typeof(ToolInfo)) - return false; - - ToolInfo c = (ToolInfo)obj; - return ((this.name == c.name) && (this.guid == c.guid) && (this.fileExtension == c.fileExtension) && (this.importProject == c.importProject)); - } - - /// - /// Equals operator - /// - /// ToolInfo to compare - /// ToolInfo to compare - /// True if toolInfos are equal - public static bool operator ==(ToolInfo c1, ToolInfo c2) - { - return ((c1.name == c2.name) && (c1.guid == c2.guid) && (c1.fileExtension == c2.fileExtension) && (c1.importProject == c2.importProject) && (c1.xmlTag == c2.xmlTag)); - } - - /// - /// Not equals operator - /// - /// ToolInfo to compare - /// ToolInfo to compare - /// True if toolInfos are not equal - public static bool operator !=(ToolInfo c1, ToolInfo c2) - { - return !(c1 == c2); - } - - /// - /// Hash Code - /// - /// Hash code - public override int GetHashCode() - { - return name.GetHashCode() ^ guid.GetHashCode() ^ this.fileExtension.GetHashCode() ^ this.importProject.GetHashCode() ^ this.xmlTag.GetHashCode(); - - } - } -} diff --git a/Prebuild/src/Core/Targets/VS2002Target.cs b/Prebuild/src/Core/Targets/VS2002Target.cs deleted file mode 100644 index 2292624..0000000 --- a/Prebuild/src/Core/Targets/VS2002Target.cs +++ /dev/null @@ -1,87 +0,0 @@ -#region BSD License -/* -Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com) - -Redistribution and use in source and binary forms, with or without modification, are permitted -provided that the following conditions are met: - -* Redistributions of source code must retain the above copyright notice, this list of conditions - and the following disclaimer. -* Redistributions in binary form must reproduce the above copyright notice, this list of conditions - and the following disclaimer in the documentation and/or other materials provided with the - distribution. -* The name of the author may not be used to endorse or promote products derived from this software - without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, -BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY -OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING -IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ -#endregion - -using System; - -using Prebuild.Core.Attributes; - -namespace Prebuild.Core.Targets -{ - /// - /// - /// - [Target("vs2002")] - public class VS2002Target : VS2003Target - { - #region Private Methods - - private void SetVS2002() - { - this.SolutionVersion = "7.00"; - this.ProductVersion = "7.0.9254"; - this.SchemaVersion = "1.0"; - this.VersionName = "2002"; - this.Version = VSVersion.VS70; - } - - #endregion - - #region Public Methods - - /// - /// Writes the specified kern. - /// - /// The kern. - public override void Write(Kernel kern) - { - SetVS2002(); - base.Write(kern); - } - - /// - /// Cleans the specified kern. - /// - /// The kern. - public override void Clean(Kernel kern) - { - SetVS2002(); - base.Clean(kern); - } - - /// - /// Gets the name. - /// - /// The name. - public override string Name - { - get - { - return "vs2002"; - } - } - - #endregion - } -} diff --git a/Prebuild/src/Core/Targets/VS2003Target.cs b/Prebuild/src/Core/Targets/VS2003Target.cs deleted file mode 100644 index 1bcb7dc..0000000 --- a/Prebuild/src/Core/Targets/VS2003Target.cs +++ /dev/null @@ -1,602 +0,0 @@ -#region BSD License -/* -Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com) - -Redistribution and use in source and binary forms, with or without modification, are permitted -provided that the following conditions are met: - -* Redistributions of source code must retain the above copyright notice, this list of conditions - and the following disclaimer. -* Redistributions in binary form must reproduce the above copyright notice, this list of conditions - and the following disclaimer in the documentation and/or other materials provided with the - distribution. -* The name of the author may not be used to endorse or promote products derived from this software - without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, -BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY -OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING -IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ -#endregion - -using System; -using System.Collections; -using System.Collections.Specialized; -using System.IO; - -using Prebuild.Core.Attributes; -using Prebuild.Core.Interfaces; -using Prebuild.Core.Nodes; -using Prebuild.Core.Utilities; - -namespace Prebuild.Core.Targets -{ - [Target("vs2003")] - public class VS2003Target : ITarget - { - - #region Fields - - string solutionVersion = "8.00"; - string productVersion = "7.10.3077"; - string schemaVersion = "2.0"; - string versionName = "2003"; - VSVersion version = VSVersion.VS71; - - Hashtable m_Tools; - Kernel m_Kernel; - - /// - /// Gets or sets the solution version. - /// - /// The solution version. - protected string SolutionVersion - { - get - { - return this.solutionVersion; - } - set - { - this.solutionVersion = value; - } - } - /// - /// Gets or sets the product version. - /// - /// The product version. - protected string ProductVersion - { - get - { - return this.productVersion; - } - set - { - this.productVersion = value; - } - } - /// - /// Gets or sets the schema version. - /// - /// The schema version. - protected string SchemaVersion - { - get - { - return this.schemaVersion; - } - set - { - this.schemaVersion = value; - } - } - /// - /// Gets or sets the name of the version. - /// - /// The name of the version. - protected string VersionName - { - get - { - return this.versionName; - } - set - { - this.versionName = value; - } - } - /// - /// Gets or sets the version. - /// - /// The version. - protected VSVersion Version - { - get - { - return this.version; - } - set - { - this.version = value; - } - } - - #endregion - - #region Constructors - - /// - /// Initializes a new instance of the class. - /// - public VS2003Target() - { - m_Tools = new Hashtable(); - - m_Tools["C#"] = new ToolInfo("C#", "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}", "csproj", "CSHARP"); - m_Tools["VB.NET"] = new ToolInfo("VB.NET", "{F184B08F-C81C-45F6-A57F-5ABD9991F28F}", "vbproj", "VisualBasic"); - } - - #endregion - - #region Private Methods - - private string MakeRefPath(ProjectNode project) - { - string ret = ""; - foreach(ReferencePathNode node in project.ReferencePaths) - { - try - { - string fullPath = Helper.ResolvePath(node.Path); - if(ret.Length < 1) - { - ret = fullPath; - } - else - { - ret += ";" + fullPath; - } - } - catch(ArgumentException) - { - m_Kernel.Log.Write(LogType.Warning, "Could not resolve reference path: {0}", node.Path); - } - } - - return ret; - } - - private void WriteProject(SolutionNode solution, ProjectNode project) - { - if(!m_Tools.ContainsKey(project.Language)) - { - throw new UnknownLanguageException("Unknown .NET language: " + project.Language); - } - - ToolInfo toolInfo = (ToolInfo)m_Tools[project.Language]; - string projectFile = Helper.MakeFilePath(project.FullPath, project.Name, toolInfo.FileExtension); - StreamWriter ps = new StreamWriter(projectFile); - - m_Kernel.CurrentWorkingDirectory.Push(); - Helper.SetCurrentDir(Path.GetDirectoryName(projectFile)); - - IEnumerator enumerator; - //ConfigurationNode scripts; - - using(ps) - { - ps.WriteLine(""); - ps.WriteLine(" <{0}", toolInfo.XmlTag); - ps.WriteLine("\t\t\t\tProjectType = \"Local\""); - ps.WriteLine("\t\t\t\tProductVersion = \"{0}\"", this.ProductVersion); - ps.WriteLine("\t\t\t\tSchemaVersion = \"{0}\"", this.SchemaVersion); - ps.WriteLine("\t\t\t\tProjectGuid = \"{{{0}}}\"", project.Guid.ToString().ToUpper()); - ps.WriteLine("\t\t>"); - - ps.WriteLine("\t\t\t\t"); - ps.WriteLine(" "); - - foreach(ConfigurationNode conf in project.Configurations) - { - ps.WriteLine("\t\t\t\t "); - } - - ps.WriteLine(" "); - - ps.WriteLine(" "); - foreach(ReferenceNode refr in project.References) - { - ps.WriteLine(" "); - } - ps.WriteLine(" "); - - ps.WriteLine(" "); - ps.WriteLine(" "); - - ps.WriteLine(" "); - - foreach(string file in project.Files) - { - string fileName = file.Replace(".\\", ""); - ps.WriteLine(" "); - - if (project.Files.GetSubType(file) != SubType.Code && project.Files.GetSubType(file) != SubType.Settings) - { - ps.WriteLine(" "); - - } - } - ps.WriteLine(" "); - - ps.WriteLine(" "); - ps.WriteLine(" ", toolInfo.XmlTag); - ps.WriteLine(""); - } - - ps = new StreamWriter(projectFile + ".user"); - using(ps) - { - ps.WriteLine(""); - ps.WriteLine(" <{0}>", toolInfo.XmlTag); - ps.WriteLine(" "); - - ps.WriteLine(" ", MakeRefPath(project)); - foreach(ConfigurationNode conf in project.Configurations) - { - ps.WriteLine(" "); - } - ps.WriteLine(" "); - - ps.WriteLine(" "); - ps.WriteLine(" ", toolInfo.XmlTag); - ps.WriteLine(""); - } - - m_Kernel.CurrentWorkingDirectory.Pop(); - } - - /// - /// Gets the XML doc file. - /// - /// The project. - /// The conf. - /// - public static string GetXmlDocFile(ProjectNode project, ConfigurationNode conf) - { - if( conf == null ) - { - throw new ArgumentNullException("conf"); - } - if( project == null ) - { - throw new ArgumentNullException("project"); - } - // if(!(bool)conf.Options["GenerateXmlDocFile"]) //default to none, if the generate option is false - // { - // return string.Empty; - // } - - //default to "AssemblyName.xml" - //string defaultValue = Path.GetFileNameWithoutExtension(project.AssemblyName) + ".xml"; - //return (string)conf.Options["XmlDocFile", defaultValue]; - - //default to no XmlDocFile file - return (string)conf.Options["XmlDocFile", ""]; - } - - private void WriteSolution(SolutionNode solution) - { - m_Kernel.Log.Write("Creating Visual Studio {0} solution and project files", this.VersionName); - - foreach(ProjectNode project in solution.Projects) - { - if(m_Kernel.AllowProject(project.FilterGroups)) - { - m_Kernel.Log.Write("...Creating project: {0}", project.Name); - WriteProject(solution, project); - } - } - - m_Kernel.Log.Write(""); - string solutionFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "sln"); - StreamWriter ss = new StreamWriter(solutionFile); - - m_Kernel.CurrentWorkingDirectory.Push(); - Helper.SetCurrentDir(Path.GetDirectoryName(solutionFile)); - - using(ss) - { - ss.WriteLine("Microsoft Visual Studio Solution File, Format Version {0}", this.SolutionVersion); - foreach(ProjectNode project in solution.Projects) - { - if(!m_Tools.ContainsKey(project.Language)) - { - throw new UnknownLanguageException("Unknown .NET language: " + project.Language); - } - - ToolInfo toolInfo = (ToolInfo)m_Tools[project.Language]; - - string path = Helper.MakePathRelativeTo(solution.FullPath, project.FullPath); - ss.WriteLine("Project(\"{0}\") = \"{1}\", \"{2}\", \"{{{3}}}\"", - toolInfo.Guid, project.Name, Helper.MakeFilePath(path, project.Name, - toolInfo.FileExtension), project.Guid.ToString().ToUpper()); - - ss.WriteLine("\tProjectSection(ProjectDependencies) = postProject"); - ss.WriteLine("\tEndProjectSection"); - - ss.WriteLine("EndProject"); - } - - ss.WriteLine("Global"); - - ss.WriteLine("\tGlobalSection(SolutionConfiguration) = preSolution"); - foreach(ConfigurationNode conf in solution.Configurations) - { - ss.WriteLine("\t\t{0} = {0}", conf.Name); - } - ss.WriteLine("\tEndGlobalSection"); - - ss.WriteLine("\tGlobalSection(ProjectDependencies) = postSolution"); - foreach(ProjectNode project in solution.Projects) - { - for(int i = 0; i < project.References.Count; i++) - { - ReferenceNode refr = (ReferenceNode)project.References[i]; - if(solution.ProjectsTable.ContainsKey(refr.Name)) - { - ProjectNode refProject = (ProjectNode)solution.ProjectsTable[refr.Name]; - ss.WriteLine("\t\t({{{0}}}).{1} = ({{{2}}})", - project.Guid.ToString().ToUpper() - , i, - refProject.Guid.ToString().ToUpper() - ); - } - } - } - ss.WriteLine("\tEndGlobalSection"); - - ss.WriteLine("\tGlobalSection(ProjectConfiguration) = postSolution"); - foreach(ProjectNode project in solution.Projects) - { - foreach(ConfigurationNode conf in solution.Configurations) - { - ss.WriteLine("\t\t{{{0}}}.{1}.ActiveCfg = {1}|.NET", - project.Guid.ToString().ToUpper(), - conf.Name); - - ss.WriteLine("\t\t{{{0}}}.{1}.Build.0 = {1}|.NET", - project.Guid.ToString().ToUpper(), - conf.Name); - } - } - ss.WriteLine("\tEndGlobalSection"); - - if(solution.Files != null) - { - ss.WriteLine("\tGlobalSection(SolutionItems) = postSolution"); - foreach(string file in solution.Files) - { - ss.WriteLine("\t\t{0} = {0}", file); - } - ss.WriteLine("\tEndGlobalSection"); - } - - ss.WriteLine("\tGlobalSection(ExtensibilityGlobals) = postSolution"); - ss.WriteLine("\tEndGlobalSection"); - ss.WriteLine("\tGlobalSection(ExtensibilityAddIns) = postSolution"); - ss.WriteLine("\tEndGlobalSection"); - - ss.WriteLine("EndGlobal"); - } - - m_Kernel.CurrentWorkingDirectory.Pop(); - } - - private void CleanProject(ProjectNode project) - { - m_Kernel.Log.Write("...Cleaning project: {0}", project.Name); - - ToolInfo toolInfo = (ToolInfo)m_Tools[project.Language]; - string projectFile = Helper.MakeFilePath(project.FullPath, project.Name, toolInfo.FileExtension); - string userFile = projectFile + ".user"; - - Helper.DeleteIfExists(projectFile); - Helper.DeleteIfExists(userFile); - } - - private void CleanSolution(SolutionNode solution) - { - m_Kernel.Log.Write("Cleaning Visual Studio {0} solution and project files", this.VersionName, solution.Name); - - string slnFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "sln"); - string suoFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "suo"); - - Helper.DeleteIfExists(slnFile); - Helper.DeleteIfExists(suoFile); - - foreach(ProjectNode project in solution.Projects) - { - CleanProject(project); - } - - m_Kernel.Log.Write(""); - } - - #endregion - - #region ITarget Members - - /// - /// Writes the specified kern. - /// - /// The kern. - public virtual void Write(Kernel kern) - { - if( kern == null ) - { - throw new ArgumentNullException("kern"); - } - m_Kernel = kern; - foreach(SolutionNode sol in m_Kernel.Solutions) - { - WriteSolution(sol); - } - m_Kernel = null; - } - - /// - /// Cleans the specified kern. - /// - /// The kern. - public virtual void Clean(Kernel kern) - { - if( kern == null ) - { - throw new ArgumentNullException("kern"); - } - m_Kernel = kern; - foreach(SolutionNode sol in m_Kernel.Solutions) - { - CleanSolution(sol); - } - m_Kernel = null; - } - - /// - /// Gets the name. - /// - /// The name. - public virtual string Name - { - get - { - return "vs2003"; - } - } - - #endregion - } -} diff --git a/Prebuild/src/Core/Targets/VS2005Target.cs b/Prebuild/src/Core/Targets/VS2005Target.cs deleted file mode 100644 index 63461c9..0000000 --- a/Prebuild/src/Core/Targets/VS2005Target.cs +++ /dev/null @@ -1,149 +0,0 @@ -#region BSD License -/* -Copyright (c) 2004 Matthew Holmes (matthew@wildfiregames.com) - -Redistribution and use in source and binary forms, with or without modification, are permitted -provided that the following conditions are met: - -* Redistributions of source code must retain the above copyright notice, this list of conditions - and the following disclaimer. -* Redistributions in binary form must reproduce the above copyright notice, this list of conditions - and the following disclaimer in the documentation and/or other materials provided with the - distribution. -* The name of the author may not be used to endorse or promote products derived from this software - without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, -BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY -OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING -IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ -#endregion - -using System; -using System.Collections; -using System.Collections.Specialized; -using System.IO; -using System.Text; - -using Prebuild.Core.Attributes; -using Prebuild.Core.Interfaces; -using Prebuild.Core.Nodes; -using Prebuild.Core.Utilities; - -namespace Prebuild.Core.Targets -{ - /// - /// - /// - [Target("vs2005")] - public class VS2005Target : VSGenericTarget - { - #region Inner Classes - - #endregion - - #region Fields - - string solutionVersion = "9.00"; - string productVersion = "8.0.50727"; - string schemaVersion = "2.0"; - string versionName = "Visual C# 2005"; - string name = "vs2005"; - - VSVersion version = VSVersion.VS80; - - public override string SolutionTag - { - get { return "# Visual Studio 2005"; } - } - - protected override string GetToolsVersionXml(FrameworkVersion frameworkVersion) - { - return string.Empty; - } - /// - /// Gets or sets the solution version. - /// - /// The solution version. - public override string SolutionVersion - { - get - { - return solutionVersion; - } - } - /// - /// Gets or sets the product version. - /// - /// The product version. - public override string ProductVersion - { - get - { - return productVersion; - } - } - /// - /// Gets or sets the schema version. - /// - /// The schema version. - public override string SchemaVersion - { - get - { - return schemaVersion; - } - } - /// - /// Gets or sets the name of the version. - /// - /// The name of the version. - public override string VersionName - { - get - { - return versionName; - } - } - /// - /// Gets or sets the version. - /// - /// The version. - public override VSVersion Version - { - get - { - return version; - } - } - /// - /// Gets the name. - /// - /// The name. - public override string Name - { - get - { - return name; - } - } - - #endregion - - #region Constructors - - /// - /// Initializes a new instance of the class. - /// - public VS2005Target() - : base() - { - } - - #endregion - } -} diff --git a/Prebuild/src/Core/Targets/VS2008Target.cs b/Prebuild/src/Core/Targets/VS2008Target.cs deleted file mode 100644 index e685962..0000000 --- a/Prebuild/src/Core/Targets/VS2008Target.cs +++ /dev/null @@ -1,132 +0,0 @@ -using System; -using System.Collections; -using System.Collections.Specialized; -using System.IO; -using System.Text; - -using Prebuild.Core.Attributes; -using Prebuild.Core.Interfaces; -using Prebuild.Core.Nodes; -using Prebuild.Core.Utilities; -using System.CodeDom.Compiler; - -namespace Prebuild.Core.Targets -{ - - /// - /// - /// - [Target("vs2008")] - public class VS2008Target : VSGenericTarget - { - #region Fields - string solutionVersion = "10.00"; - string productVersion = "9.0.21022"; - string schemaVersion = "2.0"; - string versionName = "Visual Studio 2008"; - string name = "vs2008"; - VSVersion version = VSVersion.VS90; - - Hashtable tools; - Kernel kernel; - - /// - /// Gets or sets the solution version. - /// - /// The solution version. - public override string SolutionVersion - { - get - { - return solutionVersion; - } - } - /// - /// Gets or sets the product version. - /// - /// The product version. - public override string ProductVersion - { - get - { - return productVersion; - } - } - /// - /// Gets or sets the schema version. - /// - /// The schema version. - public override string SchemaVersion - { - get - { - return schemaVersion; - } - } - /// - /// Gets or sets the name of the version. - /// - /// The name of the version. - public override string VersionName - { - get - { - return versionName; - } - } - /// - /// Gets or sets the version. - /// - /// The version. - public override VSVersion Version - { - get - { - return version; - } - } - /// - /// Gets the name. - /// - /// The name. - public override string Name - { - get - { - return name; - } - } - - protected override string GetToolsVersionXml(FrameworkVersion frameworkVersion) - { - switch (frameworkVersion) - { - case FrameworkVersion.v3_5: - return "ToolsVersion=\"3.5\""; - case FrameworkVersion.v3_0: - return "ToolsVersion=\"3.0\""; - default: - return "ToolsVersion=\"2.0\""; - } - } - - public override string SolutionTag - { - get { return "# Visual Studio 2008"; } - } - - #endregion - - #region Constructors - - /// - /// Initializes a new instance of the class. - /// - public VS2008Target() - : base() - { - } - - #endregion - } -} diff --git a/Prebuild/src/Core/Targets/VS2010Target.cs b/Prebuild/src/Core/Targets/VS2010Target.cs deleted file mode 100644 index 8772d18..0000000 --- a/Prebuild/src/Core/Targets/VS2010Target.cs +++ /dev/null @@ -1,134 +0,0 @@ -using System; -using System.Collections; -using System.Collections.Specialized; -using System.IO; -using System.Text; - -using Prebuild.Core.Attributes; -using Prebuild.Core.Interfaces; -using Prebuild.Core.Nodes; -using Prebuild.Core.Utilities; -using System.CodeDom.Compiler; - -namespace Prebuild.Core.Targets -{ - - /// - /// - /// - [Target("vs2010")] - public class VS2010Target : VSGenericTarget - { - #region Fields - string solutionVersion = "11.00"; - string productVersion = "9.0.21022"; - string schemaVersion = "2.0"; - string versionName = "Visual Studio 2010"; - string name = "vs2008"; - VSVersion version = VSVersion.VS10; - - Hashtable tools; - Kernel kernel; - - /// - /// Gets or sets the solution version. - /// - /// The solution version. - public override string SolutionVersion - { - get - { - return solutionVersion; - } - } - /// - /// Gets or sets the product version. - /// - /// The product version. - public override string ProductVersion - { - get - { - return productVersion; - } - } - /// - /// Gets or sets the schema version. - /// - /// The schema version. - public override string SchemaVersion - { - get - { - return schemaVersion; - } - } - /// - /// Gets or sets the name of the version. - /// - /// The name of the version. - public override string VersionName - { - get - { - return versionName; - } - } - /// - /// Gets or sets the version. - /// - /// The version. - public override VSVersion Version - { - get - { - return version; - } - } - /// - /// Gets the name. - /// - /// The name. - public override string Name - { - get - { - return name; - } - } - - protected override string GetToolsVersionXml(FrameworkVersion frameworkVersion) - { - switch (frameworkVersion) - { - case FrameworkVersion.v4_0: - return "ToolsVersion=\"4.0\""; - case FrameworkVersion.v3_5: - return "ToolsVersion=\"3.5\""; - case FrameworkVersion.v3_0: - return "ToolsVersion=\"3.0\""; - default: - return "ToolsVersion=\"2.0\""; - } - } - - public override string SolutionTag - { - get { return "# Visual Studio 2010"; } - } - - #endregion - - #region Constructors - - /// - /// Initializes a new instance of the class. - /// - public VS2010Target() - : base() - { - } - - #endregion - } -} diff --git a/Prebuild/src/Core/Targets/VSGenericTarget.cs b/Prebuild/src/Core/Targets/VSGenericTarget.cs deleted file mode 100644 index fdcc2b9..0000000 --- a/Prebuild/src/Core/Targets/VSGenericTarget.cs +++ /dev/null @@ -1,887 +0,0 @@ -#region BSD License -/* -Copyright (c) 2008 Matthew Holmes (matthew@wildfiregames.com), John Anderson (sontek@gmail.com) - -Redistribution and use in source and binary forms, with or without modification, are permitted -provided that the following conditions are met: - -* Redistributions of source code must retain the above copyright notice, this list of conditions - and the following disclaimer. -* Redistributions in binary form must reproduce the above copyright notice, this list of conditions - and the following disclaimer in the documentation and/or other materials provided with the - distribution. -* The name of the author may not be used to endorse or promote products derived from this software - without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, -BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY -OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING -IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ -#endregion - -using System; -using System.Collections; -using System.Collections.Generic; -using System.Collections.Specialized; -using System.IO; -using System.Text; - -using Prebuild.Core.Attributes; -using Prebuild.Core.Interfaces; -using Prebuild.Core.Nodes; -using Prebuild.Core.Utilities; -using System.CodeDom.Compiler; - -namespace Prebuild.Core.Targets -{ - - /// - /// - /// - public abstract class VSGenericTarget : ITarget - { - #region Fields - - readonly Hashtable tools = new Hashtable(); - Kernel kernel; - #endregion - - #region Properties - /// - /// Gets or sets the solution version. - /// - /// The solution version. - public abstract string SolutionVersion { get; } - /// - /// Gets or sets the product version. - /// - /// The product version. - public abstract string ProductVersion { get; } - /// - /// Gets or sets the schema version. - /// - /// The schema version. - public abstract string SchemaVersion { get; } - /// - /// Gets or sets the name of the version. - /// - /// The name of the version. - public abstract string VersionName { get; } - /// - /// Gets or sets the version. - /// - /// The version. - public abstract VSVersion Version { get; } - /// - /// Gets the name. - /// - /// The name. - public abstract string Name { get; } - - protected abstract string GetToolsVersionXml(FrameworkVersion version); - public abstract string SolutionTag { get; } - - #endregion - - #region Constructors - - /// - /// Initializes a new instance of the class. - /// - protected VSGenericTarget() - { - this.tools["C#"] = new ToolInfo("C#", "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}", "csproj", "CSHARP", "$(MSBuildBinPath)\\Microsoft.CSHARP.Targets"); - this.tools["Database"] = new ToolInfo("Database", "{4F174C21-8C12-11D0-8340-0000F80270F8}", "dbp", "UNKNOWN"); - this.tools["Boo"] = new ToolInfo("Boo", "{45CEA7DC-C2ED-48A6-ACE0-E16144C02365}", "booproj", "Boo", "$(BooBinPath)\\Boo.Microsoft.Build.targets"); - this.tools["VisualBasic"] = new ToolInfo("VisualBasic", "{F184B08F-C81C-45F6-A57F-5ABD9991F28F}", "vbproj", "VisualBasic", "$(MSBuildBinPath)\\Microsoft.VisualBasic.Targets"); - this.tools["Folder"] = new ToolInfo("Folder", "{2150E333-8FDC-42A3-9474-1A3956D46DE8}", null, null); - } - - #endregion - - #region Private Methods - - private string MakeRefPath(ProjectNode project) - { - string ret = ""; - foreach (ReferencePathNode node in project.ReferencePaths) - { - try - { - string fullPath = Helper.ResolvePath(node.Path); - if (ret.Length < 1) - { - ret = fullPath; - } - else - { - ret += ";" + fullPath; - } - } - catch (ArgumentException) - { - this.kernel.Log.Write(LogType.Warning, "Could not resolve reference path: {0}", node.Path); - } - } - - return ret; - } - - private static ProjectNode FindProjectInSolution(string name, SolutionNode solution) - { - SolutionNode node = solution; - - while (node.Parent is SolutionNode) - node = node.Parent as SolutionNode; - - return FindProjectInSolutionRecursively(name, node); - } - - private static ProjectNode FindProjectInSolutionRecursively(string name, SolutionNode solution) - { - if (solution.ProjectsTable.ContainsKey(name)) - return (ProjectNode)solution.ProjectsTable[name]; - - foreach (SolutionNode child in solution.Solutions) - { - ProjectNode node = FindProjectInSolutionRecursively(name, child); - if (node != null) - return node; - } - - return null; - } - - private void WriteProject(SolutionNode solution, ProjectNode project) - { - if (!tools.ContainsKey(project.Language)) - { - throw new UnknownLanguageException("Unknown .NET language: " + project.Language); - } - - ToolInfo toolInfo = (ToolInfo)tools[project.Language]; - string projectFile = Helper.MakeFilePath(project.FullPath, project.Name, toolInfo.FileExtension); - StreamWriter ps = new StreamWriter(projectFile); - - kernel.CurrentWorkingDirectory.Push(); - Helper.SetCurrentDir(Path.GetDirectoryName(projectFile)); - - #region Project File - using (ps) - { - ps.WriteLine("", this.Version == VSVersion.VS10 ? "4.0" : "3.5"); - ps.WriteLine(" "); - ps.WriteLine(" Local"); - ps.WriteLine(" {0}", this.ProductVersion); - ps.WriteLine(" {0}", this.SchemaVersion); - ps.WriteLine(" {{{0}}}", project.Guid.ToString().ToUpper()); - - // Visual Studio has a hard coded guid for the project type - if (project.Type == ProjectType.Web) - ps.WriteLine(" {349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}"); - ps.WriteLine(" Debug"); - ps.WriteLine(" AnyCPU"); - ps.WriteLine(" {0}", project.AppIcon); - ps.WriteLine(" "); - ps.WriteLine(" "); - ps.WriteLine(" {0}", project.AssemblyName); - foreach (ConfigurationNode conf in project.Configurations) - { - if (conf.Options.KeyFile != "") - { - ps.WriteLine(" {0}", conf.Options.KeyFile); - ps.WriteLine(" true"); - break; - } - } - ps.WriteLine(" JScript"); - ps.WriteLine(" Grid"); - ps.WriteLine(" IE50"); - ps.WriteLine(" false"); - ps.WriteLine(" {0}", project.FrameworkVersion.ToString().Replace("_", ".")); - - ps.WriteLine(" {0}", project.Type == ProjectType.Web ? ProjectType.Library.ToString() : project.Type.ToString()); - ps.WriteLine(" {0}", project.DesignerFolder); - ps.WriteLine(" {0}", project.RootNamespace); - ps.WriteLine(" {0}", project.StartupObject); - if (string.IsNullOrEmpty(project.DebugStartParameters)) - { - ps.WriteLine(" {0}", project.DebugStartParameters); - } - ps.WriteLine(" "); - ps.WriteLine(" "); - - ps.WriteLine(" "); - - foreach (ConfigurationNode conf in project.Configurations) - { - ps.Write(" ", conf.Name); - ps.WriteLine(" {0}", conf.Options["AllowUnsafe"]); - ps.WriteLine(" {0}", conf.Options["BaseAddress"]); - ps.WriteLine(" {0}", conf.Options["CheckUnderflowOverflow"]); - ps.WriteLine(" "); - ps.WriteLine(" "); - ps.WriteLine(" {0}", conf.Options["CompilerDefines"]); - ps.WriteLine(" {0}", Helper.NormalizePath(conf.Options["XmlDocFile"].ToString())); - ps.WriteLine(" {0}", conf.Options["DebugInformation"]); - ps.WriteLine(" {0}", conf.Options["FileAlignment"]); - ps.WriteLine(" {0}", conf.Options["OptimizeCode"]); - if (project.Type != ProjectType.Web) - ps.WriteLine(" {0}", - Helper.EndPath(Helper.NormalizePath(conf.Options["OutputPath"].ToString()))); - else - ps.WriteLine(" {0}", - Helper.EndPath(Helper.NormalizePath("bin\\"))); - - ps.WriteLine(" {0}", conf.Options["RegisterComInterop"]); - ps.WriteLine(" {0}", conf.Options["RemoveIntegerChecks"]); - ps.WriteLine(" {0}", conf.Options["WarningsAsErrors"]); - ps.WriteLine(" {0}", conf.Options["WarningLevel"]); - ps.WriteLine(" {0}", conf.Options["NoStdLib"]); - ps.WriteLine(" {0}", conf.Options["SuppressWarnings"]); - ps.WriteLine(" "); - } - - //ps.WriteLine(" "); - - List projectReferences = new List(); - List otherReferences = new List(); - - foreach (ReferenceNode refr in project.References) - { - ProjectNode projectNode = FindProjectInSolution(refr.Name, solution); - - if (projectNode == null) - otherReferences.Add(refr); - else - projectReferences.Add(projectNode); - } - // Assembly References - ps.WriteLine(" "); - - foreach (ReferenceNode refr in otherReferences) - { - ps.Write(" "); - ps.Write(" "); - ps.Write(refr.Name); - ps.WriteLine(""); - // TODO: Allow reference to *.exe files - ps.WriteLine(" {0}", refr.LocalCopy); - ps.WriteLine(" "); - } - ps.WriteLine(" "); - - //Project References - ps.WriteLine(" "); - foreach (ProjectNode projectReference in projectReferences) - { - ToolInfo tool = (ToolInfo)tools[projectReference.Language]; - if (tools == null) - throw new UnknownLanguageException(); - - string path = - Helper.MakePathRelativeTo(project.FullPath, - Helper.MakeFilePath(projectReference.FullPath, projectReference.Name, tool.FileExtension)); - ps.WriteLine(" ", path); - - // TODO: Allow reference to visual basic projects - ps.WriteLine(" {0}", projectReference.Name); - ps.WriteLine(" {0}", projectReference.Guid.ToString("B").ToUpper()); - ps.WriteLine(" {0}", tool.Guid.ToUpper()); - - ps.WriteLine(" False" ); - - ps.WriteLine(" "); - } - ps.WriteLine(" "); - - // ps.WriteLine(" "); - ps.WriteLine(" "); - - // ps.WriteLine(" "); - List list = new List(); - - foreach (string path in project.Files) - { - string lower = path.ToLower(); - if (lower.EndsWith(".resx")) - { - string codebehind = String.Format("{0}.Designer{1}", path.Substring(0, path.LastIndexOf('.')), toolInfo.LanguageExtension); - if (!list.Contains(codebehind)) - list.Add(codebehind); - } - } - - foreach (string file in project.Files) - { - // if (file == "Properties\\Bind.Designer.cs") - // { - // Console.WriteLine("Wait a minute!"); - // Console.WriteLine(project.Files.GetSubType(file).ToString()); - // } - - SubType subType = project.Files.GetSubType(file); - - if (subType != SubType.Code && subType != SubType.Settings && subType != SubType.Designer - && subType != SubType.CodeBehind) - { - ps.WriteLine(" ", file.Substring(0, file.LastIndexOf('.')) + ".resx"); - ps.WriteLine(" {0}", Path.GetFileName(file)); - ps.WriteLine(" Designer"); - ps.WriteLine(" "); - // - } - - if (subType == SubType.Designer) - { - ps.WriteLine(" ", file); - ps.WriteLine(" " + subType + ""); - ps.WriteLine(" ResXFileCodeGenerator"); - - string autogen_name = file.Substring(0, file.LastIndexOf('.')) + ".Designer.cs"; - string dependent_name = file.Substring(0, file.LastIndexOf('.')) + ".cs"; - - ps.WriteLine(" {0}", autogen_name); - - // Check for a parent .cs file with the same name as this designer file - if (File.Exists(dependent_name)) - ps.WriteLine(" {0}", Path.GetFileName(dependent_name)); - - ps.WriteLine(" "); - if (File.Exists(autogen_name)) - { - ps.WriteLine(" ", autogen_name); - ps.WriteLine(" True"); - ps.WriteLine(" True"); - - // If a parent .cs file exists, link this autogen file to it. Otherwise link - // to the designer file - if (File.Exists(dependent_name)) - ps.WriteLine(" {0}", Path.GetFileName(dependent_name)); - else - ps.WriteLine(" {0}", Path.GetFileName(file)); - - ps.WriteLine(" "); - } - list.Add(autogen_name); - } - if (subType == SubType.Settings) - { - ps.Write(" <{0} ", project.Files.GetBuildAction(file)); - ps.WriteLine("Include=\"{0}\">", file); - string fileName = Path.GetFileName(file); - if (project.Files.GetBuildAction(file) == BuildAction.None) - { - ps.WriteLine(" SettingsSingleFileGenerator"); - ps.WriteLine(" {0}", fileName.Substring(0, fileName.LastIndexOf('.')) + ".Designer.cs"); - } - else - { - ps.WriteLine(" Code"); - ps.WriteLine(" True"); - ps.WriteLine(" True"); - string fileNameShort = fileName.Substring(0, fileName.LastIndexOf('.')); - string fileNameShorter = fileNameShort.Substring(0, fileNameShort.LastIndexOf('.')); - ps.WriteLine(" {0}", Path.GetFileName(fileNameShorter + ".settings")); - } - ps.WriteLine(" ", project.Files.GetBuildAction(file)); - } - else if (subType != SubType.Designer) - { - string path = Helper.NormalizePath(file); - string path_lower = path.ToLower(); - - if (!list.Contains(file)) - { - ps.Write(" <{0} ", project.Files.GetBuildAction(path)); - - int startPos = 0; - if (project.Files.GetPreservePath(file)) - { - while ((@"./\").IndexOf(file.Substring(startPos, 1)) != -1) - startPos++; - - } - else - { - startPos = file.LastIndexOf(Path.GetFileName(path)); - } - - ps.WriteLine("Include=\"{0}\">", path); - - int last_period_index = file.LastIndexOf('.'); - string short_file_name = file.Substring(0, last_period_index); - string extension = Path.GetExtension(path); - string designer_format = string.Format(".designer{0}", extension); - - if (path_lower.EndsWith(designer_format)) - { - int designer_index = path_lower.IndexOf(designer_format); - string file_name = path.Substring(0, designer_index); - - if (File.Exists(file_name)) - ps.WriteLine(" {0}", Path.GetFileName(file_name)); - else if (File.Exists(file_name + ".resx")) - ps.WriteLine(" {0}", Path.GetFileName(file_name + ".resx")); - } - else if (subType == SubType.CodeBehind) - { - ps.WriteLine(" {0}", Path.GetFileName(short_file_name)); - } - if (project.Files.GetIsLink(file)) - { - string alias = project.Files.GetLinkPath(file); - alias += file.Substring(startPos); - alias = Helper.NormalizePath(alias); - ps.WriteLine(" {0}", alias); - } - else if (project.Files.GetBuildAction(file) != BuildAction.None) - { - if (project.Files.GetBuildAction(file) != BuildAction.EmbeddedResource) - { - ps.WriteLine(" {0}", subType); - } - } - - if (project.Files.GetCopyToOutput(file) != CopyToOutput.Never) - { - ps.WriteLine(" {0}", project.Files.GetCopyToOutput(file)); - } - - ps.WriteLine(" ", project.Files.GetBuildAction(file)); - } - } - } - - ps.WriteLine(" "); - ps.WriteLine(" "); - ps.WriteLine(" "); - ps.WriteLine(" "); - ps.WriteLine(" "); - ps.WriteLine(" "); - ps.WriteLine(" "); - ps.WriteLine(" "); - ps.WriteLine(""); - } - #endregion - - #region User File - - ps = new StreamWriter(projectFile + ".user"); - using (ps) - { - ps.WriteLine(""); - //ps.WriteLine( "" ); - //ps.WriteLine(" <{0}>", toolInfo.XMLTag); - //ps.WriteLine(" "); - ps.WriteLine(" "); - //ps.WriteLine(" ", MakeRefPath(project)); - ps.WriteLine(" Debug"); - ps.WriteLine(" AnyCPU"); - ps.WriteLine(" {0}", MakeRefPath(project)); - ps.WriteLine(" {0}", this.ProductVersion); - ps.WriteLine(" ProjectFiles"); - ps.WriteLine(" 0"); - ps.WriteLine(" "); - foreach (ConfigurationNode conf in project.Configurations) - { - ps.Write(" "); - } - ps.WriteLine(""); - } - #endregion - - kernel.CurrentWorkingDirectory.Pop(); - } - - private void WriteSolution(SolutionNode solution, bool writeSolutionToDisk) - { - kernel.Log.Write("Creating {0} solution and project files", this.VersionName); - - foreach (SolutionNode child in solution.Solutions) - { - kernel.Log.Write("...Creating folder: {0}", child.Name); - WriteSolution(child, false); - } - - foreach (ProjectNode project in solution.Projects) - { - kernel.Log.Write("...Creating project: {0}", project.Name); - WriteProject(solution, project); - } - - foreach (DatabaseProjectNode project in solution.DatabaseProjects) - { - kernel.Log.Write("...Creating database project: {0}", project.Name); - WriteDatabaseProject(solution, project); - } - - if (writeSolutionToDisk) // only write main solution - { - kernel.Log.Write(""); - string solutionFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "sln"); - - using (StreamWriter ss = new StreamWriter(solutionFile)) - { - kernel.CurrentWorkingDirectory.Push(); - Helper.SetCurrentDir(Path.GetDirectoryName(solutionFile)); - - ss.WriteLine("Microsoft Visual Studio Solution File, Format Version {0}", this.SolutionVersion); - ss.WriteLine(SolutionTag); - - WriteProjectDeclarations(ss, solution, solution); - - ss.WriteLine("Global"); - - ss.WriteLine("\tGlobalSection(SolutionConfigurationPlatforms) = preSolution"); - foreach (ConfigurationNode conf in solution.Configurations) - { - ss.WriteLine("\t\t{0}|Any CPU = {0}|Any CPU", conf.Name); - } - ss.WriteLine("\tEndGlobalSection"); - - ss.WriteLine("\tGlobalSection(ProjectConfigurationPlatforms) = postSolution"); - WriteConfigurationLines(solution.Configurations, solution, ss); - ss.WriteLine("\tEndGlobalSection"); - - if (solution.Solutions.Count > 0) - { - ss.WriteLine("\tGlobalSection(NestedProjects) = preSolution"); - foreach (SolutionNode embeddedSolution in solution.Solutions) - { - WriteNestedProjectMap(ss, embeddedSolution); - } - ss.WriteLine("\tEndGlobalSection"); - } - - ss.WriteLine("EndGlobal"); - } - - kernel.CurrentWorkingDirectory.Pop(); - } - } - - private void WriteProjectDeclarations(StreamWriter writer, SolutionNode actualSolution, SolutionNode embeddedSolution) - { - foreach (SolutionNode childSolution in embeddedSolution.Solutions) - { - WriteEmbeddedSolution(writer, childSolution); - WriteProjectDeclarations(writer, actualSolution, childSolution); - } - - foreach (ProjectNode project in embeddedSolution.Projects) - { - WriteProject(actualSolution, writer, project); - } - - foreach (DatabaseProjectNode dbProject in embeddedSolution.DatabaseProjects) - { - WriteProject(actualSolution, writer, dbProject); - } - - if (actualSolution.Guid == embeddedSolution.Guid) - { - WriteSolutionFiles(actualSolution, writer); - } - } - - private static void WriteNestedProjectMap(StreamWriter writer, SolutionNode embeddedSolution) - { - foreach (ProjectNode project in embeddedSolution.Projects) - { - WriteNestedProject(writer, embeddedSolution, project.Guid); - } - - foreach (DatabaseProjectNode dbProject in embeddedSolution.DatabaseProjects) - { - WriteNestedProject(writer, embeddedSolution, dbProject.Guid); - } - - foreach (SolutionNode child in embeddedSolution.Solutions) - { - WriteNestedProject(writer, embeddedSolution, child.Guid); - WriteNestedProjectMap(writer, child); - } - } - - private static void WriteNestedProject(StreamWriter writer, SolutionNode solution, Guid projectGuid) - { - WriteNestedFolder(writer, solution.Guid, projectGuid); - } - - private static void WriteNestedFolder(StreamWriter writer, Guid parentGuid, Guid childGuid) - { - writer.WriteLine("\t\t{0} = {1}", - childGuid.ToString("B").ToUpper(), - parentGuid.ToString("B").ToUpper()); - } - - private static void WriteConfigurationLines(ICollection configurations, SolutionNode solution, StreamWriter ss) - { - foreach (ProjectNode project in solution.Projects) - { - foreach (ConfigurationNode conf in configurations) - { - ss.WriteLine("\t\t{0}.{1}|Any CPU.ActiveCfg = {1}|Any CPU", - project.Guid.ToString("B").ToUpper(), - conf.Name); - - ss.WriteLine("\t\t{0}.{1}|Any CPU.Build.0 = {1}|Any CPU", - project.Guid.ToString("B").ToUpper(), - conf.Name); - } - } - - foreach (SolutionNode child in solution.Solutions) - { - WriteConfigurationLines(configurations, child, ss); - } - } - - private void WriteSolutionFiles(SolutionNode solution, StreamWriter ss) - { - if (solution.Files != null && solution.Files.Count > 0) - { - WriteProject(ss, "Folder", solution.Guid, "Solution Files", "Solution Files", solution.Files); - } - } - - private void WriteEmbeddedSolution(StreamWriter writer, SolutionNode embeddedSolution) - { - WriteProject(writer, "Folder", embeddedSolution.Guid, embeddedSolution.Name, embeddedSolution.Name, embeddedSolution.Files); - } - - private void WriteProject(SolutionNode solution, StreamWriter ss, ProjectNode project) - { - WriteProject(ss, solution, project.Language, project.Guid, project.Name, project.FullPath); - } - - private void WriteProject(SolutionNode solution, StreamWriter ss, DatabaseProjectNode dbProject) - { - if (solution.Files != null && solution.Files.Count > 0) - WriteProject(ss, solution, "Database", dbProject.Guid, dbProject.Name, dbProject.FullPath); - } - - private static bool ExtensionSpecified(string refName) - { - return refName.EndsWith(".dll") || refName.EndsWith(".exe"); - } - - private static string GetProjectExtension(ProjectNode project) - { - string extension = ".dll"; - if (project.Type == ProjectType.Exe) - { - extension = ".exe"; - } - return extension; - } - - const string ProjectDeclarationBeginFormat = "Project(\"{0}\") = \"{1}\", \"{2}\", \"{3}\""; - const string ProjectDeclarationEndFormat = "EndProject"; - - private void WriteProject(StreamWriter ss, SolutionNode solution, string language, Guid guid, string name, string projectFullPath) - { - if (!tools.ContainsKey(language)) - throw new UnknownLanguageException("Unknown .NET language: " + language); - - ToolInfo toolInfo = (ToolInfo)tools[language]; - - string path = Helper.MakePathRelativeTo(solution.FullPath, projectFullPath); - - path = Helper.MakeFilePath(path, name, toolInfo.FileExtension); - - WriteProject(ss, language, guid, name, path); - } - - private void WriteProject(StreamWriter writer, string language, Guid projectGuid, string name, string location) - { - WriteProject(writer, language, projectGuid, name, location, null); - } - - private void WriteProject(StreamWriter writer, string language, Guid projectGuid, string name, string location, FilesNode files) - { - if (!tools.ContainsKey(language)) - throw new UnknownLanguageException("Unknown .NET language: " + language); - - ToolInfo toolInfo = (ToolInfo)tools[language]; - - writer.WriteLine(ProjectDeclarationBeginFormat, - toolInfo.Guid, - name, - location, - projectGuid.ToString("B").ToUpper()); - - if (files != null) - { - writer.WriteLine("\tProjectSection(SolutionItems) = preProject"); - - foreach (string file in files) - writer.WriteLine("\t\t{0} = {0}", file); - - writer.WriteLine("\tEndProjectSection"); - } - - writer.WriteLine(ProjectDeclarationEndFormat); - } - - private void WriteDatabaseProject(SolutionNode solution, DatabaseProjectNode project) - { - string projectFile = Helper.MakeFilePath(project.FullPath, project.Name, "dbp"); - IndentedTextWriter ps = new IndentedTextWriter(new StreamWriter(projectFile), " "); - - kernel.CurrentWorkingDirectory.Push(); - - Helper.SetCurrentDir(Path.GetDirectoryName(projectFile)); - - using (ps) - { - ps.WriteLine("# Microsoft Developer Studio Project File - Database Project"); - ps.WriteLine("Begin DataProject = \"{0}\"", project.Name); - ps.Indent++; - ps.WriteLine("MSDTVersion = \"80\""); - // TODO: Use the project.Files property - if (ContainsSqlFiles(Path.GetDirectoryName(projectFile))) - WriteDatabaseFoldersAndFiles(ps, Path.GetDirectoryName(projectFile)); - - ps.WriteLine("Begin DBRefFolder = \"Database References\""); - ps.Indent++; - foreach (DatabaseReferenceNode reference in project.References) - { - ps.WriteLine("Begin DBRefNode = \"{0}\"", reference.Name); - ps.Indent++; - ps.WriteLine("ConnectStr = \"{0}\"", reference.ConnectionString); - ps.WriteLine("Provider = \"{0}\"", reference.ProviderId.ToString("B").ToUpper()); - //ps.WriteLine("Colorizer = 5"); - ps.Indent--; - ps.WriteLine("End"); - } - ps.Indent--; - ps.WriteLine("End"); - ps.Indent--; - ps.WriteLine("End"); - - ps.Flush(); - } - - kernel.CurrentWorkingDirectory.Pop(); - } - - private bool ContainsSqlFiles(string folder) - { - foreach (string file in Directory.GetFiles(folder, "*.sql")) - { - return true; // if the folder contains 1 .sql file, that's good enough - } - - foreach (string child in Directory.GetDirectories(folder)) - { - if (ContainsSqlFiles(child)) - return true; // if 1 child folder contains a .sql file, still good enough - } - - return false; - } - - private void WriteDatabaseFoldersAndFiles(IndentedTextWriter writer, string folder) - { - foreach (string child in Directory.GetDirectories(folder)) - { - if (ContainsSqlFiles(child)) - { - writer.WriteLine("Begin Folder = \"{0}\"", Path.GetFileName(child)); - writer.Indent++; - WriteDatabaseFoldersAndFiles(writer, child); - writer.Indent--; - writer.WriteLine("End"); - } - } - foreach (string file in Directory.GetFiles(folder, "*.sql")) - { - writer.WriteLine("Script = \"{0}\"", Path.GetFileName(file)); - } - } - - private void CleanProject(ProjectNode project) - { - kernel.Log.Write("...Cleaning project: {0}", project.Name); - - ToolInfo toolInfo = (ToolInfo)tools[project.Language]; - string projectFile = Helper.MakeFilePath(project.FullPath, project.Name, toolInfo.FileExtension); - string userFile = projectFile + ".user"; - - Helper.DeleteIfExists(projectFile); - Helper.DeleteIfExists(userFile); - } - - private void CleanSolution(SolutionNode solution) - { - kernel.Log.Write("Cleaning {0} solution and project files", this.VersionName, solution.Name); - - string slnFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "sln"); - string suoFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "suo"); - - Helper.DeleteIfExists(slnFile); - Helper.DeleteIfExists(suoFile); - - foreach (ProjectNode project in solution.Projects) - { - CleanProject(project); - } - - kernel.Log.Write(""); - } - - #endregion - - #region ITarget Members - - /// - /// Writes the specified kern. - /// - /// The kern. - public virtual void Write(Kernel kern) - { - if (kern == null) - { - throw new ArgumentNullException("kern"); - } - kernel = kern; - foreach (SolutionNode sol in kernel.Solutions) - { - WriteSolution(sol, true); - } - kernel = null; - } - - /// - /// Cleans the specified kern. - /// - /// The kern. - public virtual void Clean(Kernel kern) - { - if (kern == null) - { - throw new ArgumentNullException("kern"); - } - kernel = kern; - foreach (SolutionNode sol in kernel.Solutions) - { - CleanSolution(sol); - } - kernel = null; - } - - #endregion - } -} diff --git a/Prebuild/src/Core/Targets/VSVersion.cs b/Prebuild/src/Core/Targets/VSVersion.cs deleted file mode 100644 index 59549b0..0000000 --- a/Prebuild/src/Core/Targets/VSVersion.cs +++ /dev/null @@ -1,54 +0,0 @@ -#region BSD License -/* -Copyright (c) 2008-2009 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com), John Anderson (sontek@gmail.com) - -Redistribution and use in source and binary forms, with or without modification, are permitted -provided that the following conditions are met: - -* Redistributions of source code must retain the above copyright notice, this list of conditions - and the following disclaimer. -* Redistributions in binary form must reproduce the above copyright notice, this list of conditions - and the following disclaimer in the documentation and/or other materials provided with the - distribution. -* The name of the author may not be used to endorse or promote products derived from this software - without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, -BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY -OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING -IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ -#endregion - -namespace Prebuild.Core.Targets -{ - /// - /// - /// - public enum VSVersion - { - /// - /// Visual Studio 2002 - /// - VS70, - /// - /// Visual Studio 2003 - /// - VS71, - /// - /// Visual Studio 2005 - /// - VS80, - /// - /// Visual Studio 2008 - /// - VS90, - /// - /// Visual Studio 2010 - /// - VS10 - } -} diff --git a/Prebuild/src/Core/Targets/XcodeTarget.cs b/Prebuild/src/Core/Targets/XcodeTarget.cs deleted file mode 100644 index d96f65b..0000000 --- a/Prebuild/src/Core/Targets/XcodeTarget.cs +++ /dev/null @@ -1,596 +0,0 @@ -#region BSD License -/* -Copyright (c) 2004 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com) - -Redistribution and use in source and binary forms, with or without modification, are permitted -provided that the following conditions are met: - -* Redistributions of source code must retain the above copyright notice, this list of conditions - and the following disclaimer. -* Redistributions in binary form must reproduce the above copyright notice, this list of conditions - and the following disclaimer in the documentation and/or other materials provided with the - distribution. -* The name of the author may not be used to endorse or promote products derived from this software - without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, -BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY -OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING -IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ -#endregion - -using System; -using System.Collections; -using System.Collections.Specialized; -using System.IO; -using System.Reflection; -using System.Text.RegularExpressions; - -using Prebuild.Core.Attributes; -using Prebuild.Core.Interfaces; -using Prebuild.Core.Nodes; -using Prebuild.Core.Utilities; - -namespace Prebuild.Core.Targets -{ - /// - /// - /// - [Target("xcode")] - public class XcodeTarget : ITarget - { - #region Fields - - private Kernel m_Kernel; - - #endregion - - #region Private Methods - - private static string PrependPath(string path) - { - string tmpPath = Helper.NormalizePath(path, '/'); - Regex regex = new Regex(@"(\w):/(\w+)"); - Match match = regex.Match(tmpPath); - //if(match.Success || tmpPath[0] == '.' || tmpPath[0] == '/') - //{ - tmpPath = Helper.NormalizePath(tmpPath); - //} - // else - // { - // tmpPath = Helper.NormalizePath("./" + tmpPath); - // } - - return tmpPath; - } - - private static string BuildReference(SolutionNode solution, ReferenceNode refr) - { - string ret = ""; - if (solution.ProjectsTable.ContainsKey(refr.Name)) - { - ProjectNode project = (ProjectNode)solution.ProjectsTable[refr.Name]; - string fileRef = FindFileReference(refr.Name, project); - string finalPath = Helper.NormalizePath(Helper.MakeFilePath(project.FullPath + "/${build.dir}/", refr.Name, "dll"), '/'); - ret += finalPath; - return ret; - } - else - { - ProjectNode project = (ProjectNode)refr.Parent; - string fileRef = FindFileReference(refr.Name, project); - - if (refr.Path != null || fileRef != null) - { - string finalPath = (refr.Path != null) ? Helper.NormalizePath(refr.Path + "/" + refr.Name + ".dll", '/') : fileRef; - ret += finalPath; - return ret; - } - - try - { - //Assembly assem = Assembly.Load(refr.Name); - //if (assem != null) - //{ - //ret += (refr.Name + ".dll"); - //} - //else - //{ - ret += (refr.Name + ".dll"); - //} - } - catch (System.NullReferenceException e) - { - e.ToString(); - ret += refr.Name + ".dll"; - } - } - return ret; - } - - private static string BuildReferencePath(SolutionNode solution, ReferenceNode refr) - { - string ret = ""; - if (solution.ProjectsTable.ContainsKey(refr.Name)) - { - ProjectNode project = (ProjectNode)solution.ProjectsTable[refr.Name]; - string fileRef = FindFileReference(refr.Name, project); - string finalPath = Helper.NormalizePath(Helper.MakeReferencePath(project.FullPath + "/${build.dir}/"), '/'); - ret += finalPath; - return ret; - } - else - { - ProjectNode project = (ProjectNode)refr.Parent; - string fileRef = FindFileReference(refr.Name, project); - - if (refr.Path != null || fileRef != null) - { - string finalPath = (refr.Path != null) ? Helper.NormalizePath(refr.Path, '/') : fileRef; - ret += finalPath; - return ret; - } - - try - { - Assembly assem = Assembly.Load(refr.Name); - if (assem != null) - { - ret += ""; - } - else - { - ret += ""; - } - } - catch (System.NullReferenceException e) - { - e.ToString(); - ret += ""; - } - } - return ret; - } - - private static string FindFileReference(string refName, ProjectNode project) - { - foreach (ReferencePathNode refPath in project.ReferencePaths) - { - string fullPath = Helper.MakeFilePath(refPath.Path, refName, "dll"); - - if (File.Exists(fullPath)) - { - return fullPath; - } - } - - return null; - } - - /// - /// Gets the XML doc file. - /// - /// The project. - /// The conf. - /// - public static string GetXmlDocFile(ProjectNode project, ConfigurationNode conf) - { - if (conf == null) - { - throw new ArgumentNullException("conf"); - } - if (project == null) - { - throw new ArgumentNullException("project"); - } - string docFile = (string)conf.Options["XmlDocFile"]; - // if(docFile != null && docFile.Length == 0)//default to assembly name if not specified - // { - // return Path.GetFileNameWithoutExtension(project.AssemblyName) + ".xml"; - // } - return docFile; - } - - private void WriteProject(SolutionNode solution, ProjectNode project) - { - string projFile = Helper.MakeFilePath(project.FullPath, project.Name + (project.Type == ProjectType.Library ? ".dll" : ".exe"), "build"); - StreamWriter ss = new StreamWriter(projFile); - - m_Kernel.CurrentWorkingDirectory.Push(); - Helper.SetCurrentDir(Path.GetDirectoryName(projFile)); - bool hasDoc = false; - - using (ss) - { - ss.WriteLine(""); - ss.WriteLine("", project.Name); - ss.WriteLine(" ", "build"); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - foreach (ReferenceNode refr in project.References) - { - if (refr.LocalCopy) - { - ss.WriteLine(" ", '/')); - } - } - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.Write(" "); - ss.WriteLine(" ", project.RootNamespace); - foreach (string file in project.Files) - { - switch (project.Files.GetBuildAction(file)) - { - case BuildAction.EmbeddedResource: - ss.WriteLine(" {0}", ""); - break; - default: - if (project.Files.GetSubType(file) != SubType.Code && project.Files.GetSubType(file) != SubType.Settings) - { - ss.WriteLine(" ", file.Substring(0, file.LastIndexOf('.')) + ".resx"); - } - break; - } - } - //if (project.Files.GetSubType(file).ToString() != "Code") - //{ - // ps.WriteLine(" ", file.Substring(0, file.LastIndexOf('.')) + ".resx"); - - ss.WriteLine(" "); - ss.WriteLine(" "); - foreach (string file in project.Files) - { - switch (project.Files.GetBuildAction(file)) - { - case BuildAction.Compile: - ss.WriteLine(" "); - break; - default: - break; - } - } - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - foreach (ReferenceNode refr in project.References) - { - ss.WriteLine(" ", '/')); - } - ss.WriteLine(" "); - - ss.WriteLine(" "); - ss.WriteLine(" "); - - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - - ss.WriteLine(" "); - if (hasDoc) - { - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.Write(" "); - } - else - { - ss.WriteLine(".exe\" />"); - } - - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - // foreach(ReferenceNode refr in project.References) - // { - // string path = Helper.NormalizePath(Helper.MakePathRelativeTo(project.FullPath, BuildReferencePath(solution, refr)), '/'); - // if (path != "") - // { - // ss.WriteLine(" ", path); - // } - // } - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - } - ss.WriteLine(" "); - ss.WriteLine(""); - } - m_Kernel.CurrentWorkingDirectory.Pop(); - } - - private void WriteCombine(SolutionNode solution) - { - m_Kernel.Log.Write("Creating Xcode build files"); - foreach (ProjectNode project in solution.Projects) - { - if (m_Kernel.AllowProject(project.FilterGroups)) - { - m_Kernel.Log.Write("...Creating project: {0}", project.Name); - WriteProject(solution, project); - } - } - - m_Kernel.Log.Write(""); - DirectoryInfo directoryInfo = new DirectoryInfo(Path.Combine(solution.FullPath, solution.Name + ".xcodeproj")); - if (!directoryInfo.Exists) - { - directoryInfo.Create(); - } - string combFile = Helper.MakeFilePath(Path.Combine(solution.FullPath, solution.Name + ".xcodeproj"), "project", "pbxproj"); - StreamWriter ss = new StreamWriter(combFile); - - m_Kernel.CurrentWorkingDirectory.Push(); - Helper.SetCurrentDir(Path.GetDirectoryName(combFile)); - - using (ss) - { - ss.WriteLine(""); - ss.WriteLine("", solution.Name); - ss.WriteLine(" "); - ss.WriteLine(); - - //ss.WriteLine(" "); - //ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - - foreach (ConfigurationNode conf in solution.Configurations) - { - // Set the project.config to a non-debug configuration - if (conf.Options["DebugInformation"].ToString().ToLower() != "true") - { - ss.WriteLine(" ", conf.Name); - } - ss.WriteLine(); - ss.WriteLine(" ", conf.Name); - ss.WriteLine(" ", conf.Name); - ss.WriteLine(" ", conf.Options["DebugInformation"].ToString().ToLower()); - ss.WriteLine(" "); - ss.WriteLine(); - } - - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(); - - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(); - - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(); - - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(); - - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(); - - ss.WriteLine(" "); - ss.WriteLine(" "); - //ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - //foreach(ProjectNode project in solution.Projects) - //{ - // string path = Helper.MakePathRelativeTo(solution.FullPath, project.FullPath); - // ss.Write(" "); - //} - ss.WriteLine(" "); - ss.WriteLine(); - - ss.WriteLine(" "); - - foreach (ProjectNode project in solution.ProjectsTableOrder) - { - string path = Helper.MakePathRelativeTo(solution.FullPath, project.FullPath); - ss.Write(" "); - } - ss.WriteLine(" "); - ss.WriteLine(); - - ss.WriteLine(" "); - ss.WriteLine(); - ss.WriteLine(" "); - ss.WriteLine(); - //ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(); - - ss.WriteLine(" "); - ss.WriteLine(" "); - foreach (ProjectNode project in solution.Projects) - { - string path = Helper.MakePathRelativeTo(solution.FullPath, project.FullPath); - ss.Write(" "); - } - ss.WriteLine(" "); - ss.WriteLine(); - ss.WriteLine(""); - } - - m_Kernel.CurrentWorkingDirectory.Pop(); - } - - private void CleanProject(ProjectNode project) - { - m_Kernel.Log.Write("...Cleaning project: {0}", project.Name); - string projectFile = Helper.MakeFilePath(project.FullPath, project.Name + (project.Type == ProjectType.Library ? ".dll" : ".exe"), "build"); - Helper.DeleteIfExists(projectFile); - } - - private void CleanSolution(SolutionNode solution) - { - m_Kernel.Log.Write("Cleaning Xcode build files for", solution.Name); - - string slnFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "build"); - Helper.DeleteIfExists(slnFile); - - foreach (ProjectNode project in solution.Projects) - { - CleanProject(project); - } - - m_Kernel.Log.Write(""); - } - - #endregion - - #region ITarget Members - - /// - /// Writes the specified kern. - /// - /// The kern. - public void Write(Kernel kern) - { - if (kern == null) - { - throw new ArgumentNullException("kern"); - } - m_Kernel = kern; - foreach (SolutionNode solution in kern.Solutions) - { - WriteCombine(solution); - } - m_Kernel = null; - } - - /// - /// Cleans the specified kern. - /// - /// The kern. - public virtual void Clean(Kernel kern) - { - if (kern == null) - { - throw new ArgumentNullException("kern"); - } - m_Kernel = kern; - foreach (SolutionNode sol in kern.Solutions) - { - CleanSolution(sol); - } - m_Kernel = null; - } - - /// - /// Gets the name. - /// - /// The name. - public string Name - { - get - { - return "xcode"; - } - } - - #endregion - } -} diff --git a/Prebuild/src/Core/UnknownLanguageException.cs b/Prebuild/src/Core/UnknownLanguageException.cs deleted file mode 100644 index 607b66c..0000000 --- a/Prebuild/src/Core/UnknownLanguageException.cs +++ /dev/null @@ -1,63 +0,0 @@ -/* - * $RCSfile$ - * Copyright (C) 2004, 2005 David Hudson (jendave@yahoo.com) - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -using System; -using System.Runtime.Serialization; - -namespace Prebuild.Core -{ - /// - /// - [Serializable()] - public class UnknownLanguageException : Exception - { - /// - /// Basic exception. - /// - public UnknownLanguageException() - { - } - - /// - /// Exception with specified string - /// - /// Exception message - public UnknownLanguageException(string message): base(message) - { - } - - /// - /// - /// - /// - /// - public UnknownLanguageException(string message, Exception exception) : base(message, exception) - { - } - - /// - /// - /// - /// - /// - protected UnknownLanguageException(SerializationInfo info, StreamingContext context) : base( info, context ) - { - } - } -} diff --git a/Prebuild/src/Core/Utilities/CommandLineCollection.cs b/Prebuild/src/Core/Utilities/CommandLineCollection.cs deleted file mode 100644 index 22752aa..0000000 --- a/Prebuild/src/Core/Utilities/CommandLineCollection.cs +++ /dev/null @@ -1,153 +0,0 @@ -#region BSD License -/* -Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com) - -Redistribution and use in source and binary forms, with or without modification, are permitted -provided that the following conditions are met: - -* Redistributions of source code must retain the above copyright notice, this list of conditions - and the following disclaimer. -* Redistributions in binary form must reproduce the above copyright notice, this list of conditions - and the following disclaimer in the documentation and/or other materials provided with the - distribution. -* The name of the author may not be used to endorse or promote products derived from this software - without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, -BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY -OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING -IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ -#endregion - -using System; -using System.Collections; -using System.Collections.Specialized; -using System.Diagnostics; - -namespace Prebuild.Core.Utilities -{ - /// - /// The CommandLine class parses and interprets the command-line arguments passed to - /// prebuild. - /// - public class CommandLineCollection - { - #region Fields - - // The raw OS arguments - private string[] m_RawArgs; - - // Command-line argument storage - private Hashtable m_Arguments; - - #endregion - - #region Constructors - - /// - /// Create a new CommandLine instance and set some internal variables. - /// - public CommandLineCollection(string[] args) - { - m_RawArgs = args; - m_Arguments = new Hashtable(); - - Parse(); - } - - #endregion - - #region Private Methods - - private void Parse() - { - if(m_RawArgs.Length < 1) - return; - - int idx = 0; - string arg = null, lastArg = null; - - while(idx 2 && arg[0] == '/') - { - arg = arg.Substring(1); - lastArg = arg; - m_Arguments[arg] = ""; - } - else - { - if(lastArg != null) - { - m_Arguments[lastArg] = arg; - lastArg = null; - } - } - - idx++; - } - } - - #endregion - - #region Public Methods - - /// - /// Wases the passed. - /// - /// The arg. - /// - public bool WasPassed(string arg) - { - return (m_Arguments.ContainsKey(arg)); - } - - #endregion - - #region Properties - - /// - /// Gets the parameter associated with the command line option - /// - /// Returns null if option was not specified, - /// null string if no parameter was specified, and the value if a parameter was specified - public string this[string index] - { - get - { - if(m_Arguments.ContainsKey(index)) - { - return (string)(m_Arguments[index]); - } - else - { - return null; - } - } - } - - #endregion - - #region IEnumerable Members - - /// - /// Returns an enumerator that can iterate through a collection. - /// - /// - /// An - /// that can be used to iterate through the collection. - /// - public IDictionaryEnumerator GetEnumerator() - { - return m_Arguments.GetEnumerator(); - } - - #endregion - } -} diff --git a/Prebuild/src/Core/Utilities/CurrentDirectory.cs b/Prebuild/src/Core/Utilities/CurrentDirectory.cs deleted file mode 100644 index 5fabdf0..0000000 --- a/Prebuild/src/Core/Utilities/CurrentDirectory.cs +++ /dev/null @@ -1,80 +0,0 @@ -#region BSD License -/* -Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com) - -Redistribution and use in source and binary forms, with or without modification, are permitted -provided that the following conditions are met: - -* Redistributions of source code must retain the above copyright notice, this list of conditions - and the following disclaimer. -* Redistributions in binary form must reproduce the above copyright notice, this list of conditions - and the following disclaimer in the documentation and/or other materials provided with the - distribution. -* The name of the author may not be used to endorse or promote products derived from this software - without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, -BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY -OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING -IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ -#endregion - -using System; -using System.Collections; - -namespace Prebuild.Core.Utilities -{ - /// - /// - /// - public class CurrentDirectory - { - #region Fields - - private Stack m_Stack; - - #endregion - - #region Constructors - - /// - /// Initializes a new instance of the class. - /// - public CurrentDirectory() - { - m_Stack = new Stack(); - } - - #endregion - - #region Public Methods - - /// - /// Pushes this instance. - /// - public void Push() - { - m_Stack.Push(Environment.CurrentDirectory); - } - - /// - /// Pops this instance. - /// - public void Pop() - { - if(m_Stack.Count < 1) - { - return; - } - - string cwd = (string)m_Stack.Pop(); - Helper.SetCurrentDir(cwd); - } - - #endregion - } -} diff --git a/Prebuild/src/Core/Utilities/Helper.cs b/Prebuild/src/Core/Utilities/Helper.cs deleted file mode 100644 index 9a0d131..0000000 --- a/Prebuild/src/Core/Utilities/Helper.cs +++ /dev/null @@ -1,654 +0,0 @@ -#region BSD License -/* -Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com) - -Redistribution and use in source and binary forms, with or without modification, are permitted -provided that the following conditions are met: - -* Redistributions of source code must retain the above copyright notice, this list of conditions - and the following disclaimer. -* Redistributions in binary form must reproduce the above copyright notice, this list of conditions - and the following disclaimer in the documentation and/or other materials provided with the - distribution. -* The name of the author may not be used to endorse or promote products derived from this software - without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, -BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY -OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING -IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ -#endregion - -using System; -using System.Collections; -using System.Diagnostics; -using System.IO; -using System.Runtime.InteropServices; -using System.Text.RegularExpressions; -using System.Collections.Specialized; -using System.Xml; -using Prebuild.Core.Nodes; - -namespace Prebuild.Core.Utilities -{ - /// - /// - /// - public class Helper - { - #region Fields - - private static Stack dirStack; - private static Regex varRegex; - static bool checkForOSVariables; - - /// - /// - /// - public static bool CheckForOSVariables - { - get - { - return checkForOSVariables; - } - set - { - checkForOSVariables = value; - } - } - - #endregion - - #region Constructors - - /// - /// Initializes the class. - /// - static Helper() - { - dirStack = new Stack(); - //m_VarRegex = new Regex(@"\${(?[\w|_]+)}"); - } - - #endregion - - #region Properties - - /// - /// - /// - public static Stack DirStack - { - get - { - return dirStack; - } - } - - /// - /// - /// - public static Regex VarRegex - { - get - { - return varRegex; - } - set - { - varRegex = value; - } - } - - #endregion - - #region Public Methods - - #region String Parsing - #region Inner Classes and Delegates - /// - /// - /// - public delegate string StringLookup(string key); - - #endregion - - /// - /// Gets a collection of StringLocationPair objects that represent the matches - /// - /// The target. - /// The before group. - /// The after group. - /// if set to true [include delimiters in substrings]. - /// - public static StringCollection FindGroups(string target, string beforeGroup, string afterGroup, bool includeDelimitersInSubstrings) - { - if( beforeGroup == null ) - { - throw new ArgumentNullException("beforeGroup"); - } - if( afterGroup == null ) - { - throw new ArgumentNullException("afterGroup"); - } - StringCollection results = new StringCollection(); - if(target == null || target.Length == 0) - { - return results; - } - - int beforeMod = 0; - int afterMod = 0; - if(includeDelimitersInSubstrings) - { - //be sure to not exlude the delims - beforeMod = beforeGroup.Length; - afterMod = afterGroup.Length; - } - int startIndex = 0; - while((startIndex = target.IndexOf(beforeGroup,startIndex)) != -1) { - int endIndex = target.IndexOf(afterGroup,startIndex);//the index of the char after it - if(endIndex == -1) - { - break; - } - int length = endIndex - startIndex - beforeGroup.Length;//move to the first char in the string - string substring = substring = target.Substring(startIndex + beforeGroup.Length - beforeMod, - length - afterMod); - - results.Add(substring); - //results.Add(new StringLocationPair(substring,startIndex)); - startIndex = endIndex + 1; - //the Interpolate*() methods will not work if expressions are expandded inside expression due to an optimization - //so start after endIndex - - } - return results; - } - - /// - /// Replaces the groups. - /// - /// The target. - /// The before group. - /// The after group. - /// The lookup. - /// - public static string ReplaceGroups(string target, string beforeGroup, string afterGroup, StringLookup lookup) { - if( target == null ) - { - throw new ArgumentNullException("target"); - } - //int targetLength = target.Length; - StringCollection strings = FindGroups(target,beforeGroup,afterGroup,false); - if( lookup == null ) - { - throw new ArgumentNullException("lookup"); - } - foreach(string substring in strings) - { - target = target.Replace(beforeGroup + substring + afterGroup, lookup(substring) ); - } - return target; - } - - /// - /// Replaces ${var} statements in a string with the corresonding values as detirmined by the lookup delegate - /// - /// The target. - /// The lookup. - /// - public static string InterpolateForVariables(string target, StringLookup lookup) - { - return ReplaceGroups(target, "${" , "}" , lookup); - } - - /// - /// Replaces ${var} statements in a string with the corresonding environment variable with name var - /// - /// - /// - public static string InterpolateForEnvironmentVariables(string target) - { - return InterpolateForVariables(target, new StringLookup(Environment.GetEnvironmentVariable)); - } - - #endregion - - /// - /// Translates the value. - /// - /// Type of the translate. - /// The translation item. - /// - public static object TranslateValue(Type translateType, string translationItem) - { - if(translationItem == null) - { - return null; - } - - try - { - string lowerVal = translationItem.ToLower(); - if(translateType == typeof(bool)) - { - return (lowerVal == "true" || lowerVal == "1" || lowerVal == "y" || lowerVal == "yes" || lowerVal == "on"); - } - else if(translateType == typeof(int)) - { - return (Int32.Parse(translationItem)); - } - else - { - return translationItem; - } - } - catch(FormatException) - { - return null; - } - } - - /// - /// Deletes if exists. - /// - /// The file. - /// - public static bool DeleteIfExists(string file) - { - string resFile = null; - try - { - resFile = ResolvePath(file); - } - catch(ArgumentException) - { - return false; - } - - if(!File.Exists(resFile)) - { - return false; - } - - File.Delete(resFile); - return true; - } - - static readonly char seperator = Path.DirectorySeparatorChar; - - // This little gem was taken from the NeL source, thanks guys! - /// - /// Makes a relative path - /// - /// Path to start from - /// Path to end at - /// Path that will get from startPath to endPath - public static string MakePathRelativeTo(string startPath, string endPath) - { - string tmp = NormalizePath(startPath, seperator); - string src = NormalizePath(endPath, seperator); - string prefix = ""; - - while(true) - { - if((String.Compare(tmp, 0, src, 0, tmp.Length) == 0)) - { - string ret; - int size = tmp.Length; - if(size == src.Length) - { - return "./"; - } - if((src.Length > tmp.Length) && src[tmp.Length - 1] != seperator) - { - } - else - { - ret = prefix + endPath.Substring(size, endPath.Length - size); - ret = ret.Trim(); - if(ret[0] == seperator) - { - ret = "." + ret; - } - - return NormalizePath(ret); - } - - } - - if(tmp.Length < 2) - { - break; - } - - int lastPos = tmp.LastIndexOf(seperator, tmp.Length - 2); - int prevPos = tmp.IndexOf(seperator); - - if((lastPos == prevPos) || (lastPos == -1)) - { - break; - } - - tmp = tmp.Substring(0, lastPos + 1); - prefix += ".." + seperator.ToString(); - } - - return endPath; - } - - /// - /// Resolves the path. - /// - /// The path. - /// - public static string ResolvePath(string path) - { - string tmpPath = NormalizePath(path); - if(tmpPath.Length < 1) - { - tmpPath = "."; - } - - tmpPath = Path.GetFullPath(tmpPath); - if(!File.Exists(tmpPath) && !Directory.Exists(tmpPath)) - { - throw new ArgumentException("Path could not be resolved: " + tmpPath); - } - - return tmpPath; - } - - /// - /// Normalizes the path. - /// - /// The path. - /// The separator character. - /// - public static string NormalizePath(string path, char separatorCharacter) - { - if(path == null || path == "" || path.Length < 1) - { - return ""; - } - - string tmpPath = path.Replace('\\', '/'); - tmpPath = tmpPath.Replace('/', separatorCharacter); - return tmpPath; - } - - /// - /// Normalizes the path. - /// - /// The path. - /// - public static string NormalizePath(string path) - { - return NormalizePath(path, Path.DirectorySeparatorChar); - } - - /// - /// Ends the path. - /// - /// The path. - /// The separator character. - /// - public static string EndPath(string path, char separatorCharacter) - { - if(path == null || path == "" || path.Length < 1) - { - return ""; - } - - if(!path.EndsWith(separatorCharacter.ToString())) - { - return (path + separatorCharacter); - } - - return path; - } - - /// - /// Ends the path. - /// - /// The path. - /// - public static string EndPath(string path) - { - return EndPath(path, Path.DirectorySeparatorChar); - } - - /// - /// Makes the file path. - /// - /// The path. - /// The name. - /// The ext. - /// - public static string MakeFilePath(string path, string name, string ext) - { - string ret = EndPath(NormalizePath(path)); - - if( name == null ) - { - throw new ArgumentNullException("name"); - } - - ret += name; - if(!name.EndsWith("." + ext)) - { - ret += "." + ext; - } - - //foreach(char c in Path.GetInvalidPathChars()) - //{ - // ret = ret.Replace(c, '_'); - //} - - return ret; - } - - /// - /// Makes the file path. - /// - /// The path. - /// The name. - /// - public static string MakeFilePath(string path, string name) - { - string ret = EndPath(NormalizePath(path)); - - if( name == null ) - { - throw new ArgumentNullException("name"); - } - - ret += name; - - //foreach (char c in Path.GetInvalidPathChars()) - //{ - // ret = ret.Replace(c, '_'); - //} - - return ret; - } - - /// - /// - /// - /// - /// - public static string MakeReferencePath(string path) - { - string ret = EndPath(NormalizePath(path)); - - //foreach (char c in Path.GetInvalidPathChars()) - //{ - // ret = ret.Replace(c, '_'); - //} - - return ret; - } - - /// - /// Sets the current dir. - /// - /// The path. - public static void SetCurrentDir(string path) - { - if( path == null ) - { - throw new ArgumentNullException("path"); - } - if(path.Length < 1) - { - return; - } - - Environment.CurrentDirectory = path; - } - - /// - /// Checks the type. - /// - /// The type to check. - /// The attr. - /// The inter. - /// - public static object CheckType(Type typeToCheck, Type attr, Type inter) - { - if(typeToCheck == null || attr == null) - { - return null; - } - - object[] attrs = typeToCheck.GetCustomAttributes(attr, false); - if(attrs == null || attrs.Length < 1) - { - return null; - } - if( inter == null ) - { - throw new ArgumentNullException("inter"); - } - - if(typeToCheck.GetInterface(inter.FullName) == null) - { - return null; - } - - return attrs[0]; - } - - /* A bit of overhead for simple group parsing, there are problems with Regex in Mono - public static string ParseValue(string val) - { - if(val == null || val.Length < 1 || !CheckForOSVariables) - return val; - - string tmp = val; - Match m = m_VarRegex.Match(val); - while(m.Success) - { - if(m.Groups["var"] == null) - continue; - - Capture c = m.Groups["var"].Captures[0]; - if(c == null) - continue; - - string var = c.Value; - string envVal = Environment.GetEnvironmentVariable(var); - if(envVal == null) - envVal = ""; - - tmp = tmp.Replace("${" + var + "}", envVal); - m = m.NextMatch(); - } - - return tmp; - }*/ - - /// - /// Attributes the value. - /// - /// The node. - /// The attr. - /// The def. - /// - public static string AttributeValue(XmlNode node, string attr, string def) - { - if( node == null ) - { - throw new ArgumentNullException("node"); - } - if(node.Attributes[attr] == null) - { - return def; - } - string val = node.Attributes[attr].Value; - if(!CheckForOSVariables) - { - return val; - } - - return InterpolateForEnvironmentVariables(val); - } - - /// - /// Parses the boolean. - /// - /// The node. - /// The attr. - /// if set to true [default value]. - /// - public static bool ParseBoolean(XmlNode node, string attr, bool defaultValue) - { - if( node == null ) - { - throw new ArgumentNullException("node"); - } - if(node.Attributes[attr] == null) - { - return defaultValue; - } - return bool.Parse(node.Attributes[attr].Value); - } - - /// - /// Enums the attribute value. - /// - /// The node. - /// The attr. - /// Type of the enum. - /// The def. - /// - public static object EnumAttributeValue(XmlNode node, string attr, Type enumType, object def) - { - if( def == null ) - { - throw new ArgumentNullException("def"); - } - string val = AttributeValue(node, attr, def.ToString()); - return Enum.Parse(enumType, val, true); - } - - /// - /// - /// - /// - /// - /// - public static string AssemblyFullName(string assemblyName, ProjectType projectType) - { - return assemblyName + (projectType == ProjectType.Library ? ".dll" : ".exe"); - } - - #endregion - } -} diff --git a/Prebuild/src/Core/Utilities/Log.cs b/Prebuild/src/Core/Utilities/Log.cs deleted file mode 100644 index 548e987..0000000 --- a/Prebuild/src/Core/Utilities/Log.cs +++ /dev/null @@ -1,270 +0,0 @@ -#region BSD License -/* -Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com) - -Redistribution and use in source and binary forms, with or without modification, are permitted -provided that the following conditions are met: - -* Redistributions of source code must retain the above copyright notice, this list of conditions - and the following disclaimer. -* Redistributions in binary form must reproduce the above copyright notice, this list of conditions - and the following disclaimer in the documentation and/or other materials provided with the - distribution. -* The name of the author may not be used to endorse or promote products derived from this software - without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, -BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY -OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING -IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ -#endregion - -using System; -using System.IO; - -namespace Prebuild.Core.Utilities -{ - /// - /// - /// - public enum LogType - { - /// - /// - /// - None, - /// - /// - /// - Info, - /// - /// - /// - Warning, - /// - /// - /// - Error - } - - /// - /// - /// - [Flags] - public enum LogTargets - { - /// - /// - /// - None = 0, - /// - /// - /// - Null = 1, - /// - /// - /// - File = 2, - /// - /// - /// - Console = 4 - } - - /// - /// Summary description for Log. - /// - public class Log : IDisposable - { - #region Fields - - private StreamWriter m_Writer; - private LogTargets m_Target = LogTargets.Null; - bool disposed; - - #endregion - - #region Constructors - - /// - /// Initializes a new instance of the class. - /// - /// The target. - /// Name of the file. - public Log(LogTargets target, string fileName) - { - m_Target = target; - - if((m_Target & LogTargets.File) != 0) - { - m_Writer = new StreamWriter(fileName, false); - } - } - - #endregion - - #region Public Methods - - /// - /// Writes this instance. - /// - public void Write() - { - Write(string.Empty); - } - - /// - /// Writes the specified MSG. - /// - /// The MSG. - public void Write(string msg) - { - if((m_Target & LogTargets.Null) != 0) - { - return; - } - - if((m_Target & LogTargets.Console) != 0) - { - Console.WriteLine(msg); - } - if((m_Target & LogTargets.File) != 0 && m_Writer != null) - { - m_Writer.WriteLine(msg); - } - } - - /// - /// Writes the specified format. - /// - /// The format. - /// The args. - public void Write(string format, params object[] args) - { - Write(string.Format(format,args)); - } - - /// - /// Writes the specified type. - /// - /// The type. - /// The format. - /// The args. - public void Write(LogType type, string format, params object[] args) - { - if((m_Target & LogTargets.Null) != 0) - { - return; - } - - string str = ""; - switch(type) - { - case LogType.Info: - str = "[I] "; - break; - case LogType.Warning: - str = "[!] "; - break; - case LogType.Error: - str = "[X] "; - break; - } - - Write(str + format,args); - } - - /// - /// Writes the exception. - /// - /// The type. - /// The ex. - public void WriteException(LogType type, Exception ex) - { - if(ex != null) - { - Write(type, ex.Message); - //#if DEBUG - m_Writer.WriteLine("Exception @{0} stack trace [[", ex.TargetSite.Name); - m_Writer.WriteLine(ex.StackTrace); - m_Writer.WriteLine("]]"); - //#endif - } - } - - /// - /// Flushes this instance. - /// - public void Flush() - { - if(m_Writer != null) - { - m_Writer.Flush(); - } - } - - #endregion - - #region IDisposable Members - - /// - /// Performs application-defined tasks associated with freeing, releasing, or - /// resetting unmanaged resources. - /// - public void Dispose() - { - Dispose(true); - GC.SuppressFinalize(this); - } - - /// - /// Dispose objects - /// - /// - /// If true, it will dispose close the handle - /// - /// - /// Will dispose managed and unmanaged resources. - /// - protected virtual void Dispose(bool disposing) - { - if (!this.disposed) - { - if (disposing) - { - if (m_Writer != null) - { - m_Writer.Close(); - m_Writer = null; - } - } - } - this.disposed = true; - } - - /// - /// - /// - ~Log() - { - this.Dispose(false); - } - - /// - /// Closes and destroys this object - /// - /// - /// Same as Dispose(true) - /// - public void Close() - { - Dispose(); - } - - #endregion - } -} diff --git a/Prebuild/src/Core/WarningException.cs b/Prebuild/src/Core/WarningException.cs deleted file mode 100644 index df90dc8..0000000 --- a/Prebuild/src/Core/WarningException.cs +++ /dev/null @@ -1,84 +0,0 @@ -#region BSD License -/* -Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com) - -Redistribution and use in source and binary forms, with or without modification, are permitted -provided that the following conditions are met: - -* Redistributions of source code must retain the above copyright notice, this list of conditions - and the following disclaimer. -* Redistributions in binary form must reproduce the above copyright notice, this list of conditions - and the following disclaimer in the documentation and/or other materials provided with the - distribution. -* The name of the author may not be used to endorse or promote products derived from this software - without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, -BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY -OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING -IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ -#endregion - -using System; -using System.Runtime.Serialization; - -namespace Prebuild.Core -{ - /// - /// - /// - [Serializable()] - public class WarningException : Exception - { - #region Constructors - - /// - /// - /// - public WarningException() - { - } - - /// - /// - /// - /// - /// - public WarningException(string format, params object[] args) - : base(String.Format(format, args)) - { - } - - /// - /// Exception with specified string - /// - /// Exception message - public WarningException(string message): base(message) - { - } - - /// - /// - /// - /// - /// - public WarningException(string message, Exception exception) : base(message, exception) - { - } - - /// - /// - /// - /// - /// - protected WarningException(SerializationInfo info, StreamingContext context) : base( info, context ) - { - } - - #endregion - } -} diff --git a/Prebuild/src/Prebuild.cs b/Prebuild/src/Prebuild.cs deleted file mode 100644 index 2d12b53..0000000 --- a/Prebuild/src/Prebuild.cs +++ /dev/null @@ -1,165 +0,0 @@ -#region BSD License -/* -Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com) - -Redistribution and use in source and binary forms, with or without modification, are permitted -provided that the following conditions are met: - -* Redistributions of source code must retain the above copyright notice, this list of conditions - and the following disclaimer. -* Redistributions in binary form must reproduce the above copyright notice, this list of conditions - and the following disclaimer in the documentation and/or other materials provided with the - distribution. -* The name of the author may not be used to endorse or promote products derived from this software - without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, -BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY -OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING -IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ -#endregion - -#region CVS Information -/* - * $Source$ - * $Author: jendave $ - * $Date: 2006-09-26 23:43:35 +0200 (ti, 26 sep 2006) $ - * $Revision: 168 $ - */ -#endregion - -using System; -using System.Collections.Specialized; -using System.IO; -using System.Reflection; -using System.Runtime.InteropServices; -using System.EnterpriseServices.Internal; - -using Prebuild.Core; -using Prebuild.Core.Utilities; - -namespace Prebuild -{ - /// - /// - /// - class Prebuild - { - #region Main - - [STAThread] - static void Main(string[] args) - { - Kernel kernel = null; - try - { - kernel = Kernel.Instance; - kernel.Initialize(LogTargets.File | LogTargets.Console, args); - bool exit = false; - - if(kernel.CommandLine.WasPassed("usage")) - { - exit = true; - OutputUsage(); - } - if(kernel.CommandLine.WasPassed("showtargets")) - { - exit = true; - OutputTargets(kernel); - } - if(kernel.CommandLine.WasPassed("install")) - { - exit = true; - InstallAssembly(kernel); - } - if(kernel.CommandLine.WasPassed("remove")) - { - exit = true; - RemoveAssembly(kernel); - } - - if(!exit) - { - kernel.Process(); - } - } - catch(Exception ex) - { - Console.WriteLine("Unhandled error: {0}", ex.Message); - //#if DEBUG - Console.WriteLine("{0}", ex.StackTrace); - //#endif - } - finally - { - if(kernel.PauseAfterFinish) - { - Console.WriteLine("\nPress enter to continue..."); - Console.ReadLine(); - } - } - } - - #endregion - - #region Private Methods - - private static void InstallAssembly(Kernel kernel) - { - Publish publish = new Publish(); - string file = kernel.CommandLine["install"]; - //Console.WriteLine(".."+file+".."); - publish.GacInstall(file); - } - - private static void RemoveAssembly(Kernel kernel) - { - Publish publish = new Publish(); - string file = kernel.CommandLine["remove"]; - publish.GacRemove(file); - } - - private static void OutputUsage() - { - Console.WriteLine("Usage: prebuild /target [options]"); - Console.WriteLine("Available command-line switches:"); - Console.WriteLine(); - Console.WriteLine("/target Target for Prebuild"); - Console.WriteLine("/clean Clean the build files for the given target"); - Console.WriteLine("/file XML file to process"); - Console.WriteLine("/log Log file to write to"); - Console.WriteLine("/ppo Pre-process the file, but perform no other processing"); - Console.WriteLine("/pause Pauses the application after execution to view the output"); - Console.WriteLine("/yes Default to yes to any questions asked"); - Console.WriteLine("/install Install assembly into the GAC"); - Console.WriteLine("/remove Remove assembly from the GAC"); - Console.WriteLine(); - Console.WriteLine("See 'prebuild /showtargets for a list of available targets"); - Console.WriteLine("See readme.txt or check out http://dnpb.sourceforge.net for more information"); - Console.WriteLine(); - } - - private static void OutputTargets(Kernel kern) - { - Console.WriteLine("Targets available in Prebuild:"); - Console.WriteLine(""); - if(kern.Targets.Keys.Count > 0) - { - string[] targs = new string[kern.Targets.Keys.Count]; - kern.Targets.Keys.CopyTo(targs, 0); - Array.Sort(targs); - foreach(string target in targs) - { - Console.WriteLine(target); - } - } - Console.WriteLine(""); - } - - #endregion - } -} diff --git a/Prebuild/src/Prebuild.snk b/Prebuild/src/Prebuild.snk deleted file mode 100644 index f9dce05..0000000 Binary files a/Prebuild/src/Prebuild.snk and /dev/null differ diff --git a/Prebuild/src/Properties/AssemblyInfo.cs b/Prebuild/src/Properties/AssemblyInfo.cs deleted file mode 100644 index 65c8736..0000000 --- a/Prebuild/src/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,112 +0,0 @@ -#region BSD License -/* - -Copyright (c) 2004 - 2008 -Matthew Holmes (matthew@wildfiregames.com), -Dan Moorehead (dan05a@gmail.com), -Dave Hudson (jendave@yahoo.com), -Rob Loach (http://www.robloach.net), -C.J. Adams-Collier (cjac@colliertech.org), - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - -* Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - -* Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - -* The name of the author may not be used to endorse or promote - products derived from this software without specific prior written - permission. - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR -IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, -INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, -STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING -IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -POSSIBILITY OF SUCH DAMAGE. - -*/ -#endregion - -using System; -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; -using System.Security.Permissions; -using System.Resources; - - -// FxCop recommended attributes -[assembly: ComVisible(false)] -[assembly: FileIOPermission(SecurityAction.RequestMinimum, Unrestricted=true)] -[assembly: CLSCompliant(true)] - -// -// 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(".NET Prebuild")] -[assembly: AssemblyDescription("A .NET project file build tool")] -[assembly: AssemblyConfiguration(".NET CLR")] -[assembly: AssemblyCompany("The Prebuild Project")] -[assembly: AssemblyProduct("")] -[assembly: AssemblyCopyright("Copyright 2004-2008 " + - "Matthew Holmes, " + - "Dan Moorehead, " + - "C.J. Adams-Collier, " + - "Rob Loach, " + - "David Hudson,")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] -[assembly: NeutralResourcesLanguageAttribute("en-US")] -[assembly: AssemblyVersion("2.0.4.*")] - -// -// 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 Revision and Build Numbers -// by using the '*' as shown below: - -// -// In order to sign your assembly you must specify a key to use. Refer to the -// Microsoft .NET Framework documentation for more information on assembly signing. -// -// Use the attributes below to control which key is used for signing. -// -// Notes: -// (*) If no key is specified, the assembly is not signed. -// (*) KeyName refers to a key that has been installed in the Crypto Service -// Provider (CSP) on your machine. KeyFile refers to a file which contains -// a key. -// (*) If the KeyFile and the KeyName values are both specified, the -// following processing occurs: -// (1) If the KeyName can be found in the CSP, that key is used. -// (2) If the KeyName does not exist and the KeyFile does exist, the key -// in the KeyFile is installed into the CSP and used. -// (*) In order to create a KeyFile, you can use the sn.exe (Strong Name) utility. -// When specifying the KeyFile, the location of the KeyFile should be -// relative to the project output directory which is -// %Project Directory%\obj\. For example, if your KeyFile is -// located in the project directory, you would specify the AssemblyKeyFile -// attribute as [assembly: AssemblyKeyFile("..\\..\\mykey.snk")] -// (*) Delay Signing is an advanced option - see the Microsoft .NET Framework -// documentation for more information on this. -// -[assembly: AssemblyDelaySign(false)] -[assembly: AssemblyKeyName("")] diff --git a/Prebuild/src/data/autotools.xml b/Prebuild/src/data/autotools.xml deleted file mode 100644 index ee4b064..0000000 --- a/Prebuild/src/data/autotools.xml +++ /dev/null @@ -1,790 +0,0 @@ - - - - - #!/bin/sh -# Run this to generate all the initial makefiles, etc. -# Ripped off from Mono, which ripped off from GNOME macros version - -DIE=0 - -srcdir=`dirname $0` -test -z "$srcdir" && srcdir=. - -if [ -n "$MONO_PATH" ]; then - # from -> /mono/lib:/another/mono/lib - # to -> /mono /another/mono - for i in `echo ${MONO_PATH} | tr ":" " "`; do - i=`dirname ${i}` - if [ -n "{i}" -a -d "${i}/share/aclocal" ]; then - ACLOCAL_FLAGS="-I ${i}/share/aclocal $ACLOCAL_FLAGS" - fi - if [ -n "{i}" -a -d "${i}/bin" ]; then - PATH="${i}/bin:$PATH" - fi - done - export PATH -fi - -(autoconf --version) < /dev/null > /dev/null 2>&1 || { - echo - echo "**Error**: You must have \`autoconf' installed to compile Mono." - echo "Download the appropriate package for your distribution," - echo "or get the source tarball at ftp://ftp.gnu.org/pub/gnu/" - DIE=1 -} - -if [ -z "$LIBTOOL" ]; then - LIBTOOL=`which glibtool 2>/dev/null` - if [ ! -x "$LIBTOOL" ]; then - LIBTOOL=`which libtool` - fi -fi - -(grep "^AM_PROG_LIBTOOL" $srcdir/configure.ac >/dev/null) && { - ($LIBTOOL --version) < /dev/null > /dev/null 2>&1 || { - echo - echo "**Error**: You must have \`libtool' installed to compile Mono." - echo "Get ftp://ftp.gnu.org/pub/gnu/libtool-1.2d.tar.gz" - echo "(or a newer version if it is available)" - DIE=1 - } -} - -grep "^AM_GNU_GETTEXT" $srcdir/configure.ac >/dev/null && { - grep "sed.*POTFILES" $srcdir/configure.ac >/dev/null || \ - (gettext --version) < /dev/null > /dev/null 2>&1 || { - echo - echo "**Error**: You must have \`gettext' installed to compile Mono." - echo "Get ftp://alpha.gnu.org/gnu/gettext-0.10.35.tar.gz" - echo "(or a newer version if it is available)" - DIE=1 - } -} - -(automake --version) < /dev/null > /dev/null 2>&1 || { - echo - echo "**Error**: You must have \`automake' installed to compile Mono." - echo "Get ftp://ftp.gnu.org/pub/gnu/automake-1.3.tar.gz" - echo "(or a newer version if it is available)" - DIE=1 - NO_AUTOMAKE=yes -} - -# if no automake, don't bother testing for aclocal -test -n "$NO_AUTOMAKE" || (aclocal --version) < /dev/null > /dev/null 2>&1 || { - echo - echo "**Error**: Missing \`aclocal'. The version of \`automake'" - echo "installed doesn't appear recent enough." - echo "Get ftp://ftp.gnu.org/pub/gnu/automake-1.3.tar.gz" - echo "(or a newer version if it is available)" - DIE=1 -} - -if test "$DIE" -eq 1; then - exit 1 -fi - -if test -z "$NOCONFIGURE"; then - -if test -z "$*"; then - echo "**Warning**: I am going to run \`configure' with no arguments." - echo "If you wish to pass any to it, please specify them on the" - echo \`$0\'" command line." - echo -fi - -fi - -case $CC in -xlc ) - am_opt=--include-deps;; -esac - - -if grep "^AM_PROG_LIBTOOL" configure.ac >/dev/null; then - if test -z "$NO_LIBTOOLIZE" ; then - echo "Running libtoolize..." - ${LIBTOOL}ize --force --copy - fi -fi - -echo "Running aclocal $ACLOCAL_FLAGS ..." -aclocal $ACLOCAL_FLAGS || { - echo - echo "**Error**: aclocal failed. This may mean that you have not" - echo "installed all of the packages you need, or you may need to" - echo "set ACLOCAL_FLAGS to include \"-I \$prefix/share/aclocal\"" - echo "for the prefix where you installed the packages whose" - echo "macros were not found" - exit 1 -} - -if grep "^AM_CONFIG_HEADER" configure.ac >/dev/null; then - echo "Running autoheader..." - autoheader || { echo "**Error**: autoheader failed."; exit 1; } -fi - -echo "Running automake --gnu $am_opt ..." -automake --add-missing --gnu $am_opt || - { echo "**Error**: automake failed."; exit 1; } -echo "Running autoconf ..." -autoconf || { echo "**Error**: autoconf failed."; exit 1; } - -conf_flags="--enable-maintainer-mode --enable-compile-warnings" #--enable-iso-c - -if test x$NOCONFIGURE = x; then - echo Running $srcdir/configure $conf_flags "$@" ... - $srcdir/configure $conf_flags "$@" \ - && echo Now type \`make\' to compile $PKG_NAME || exit 1 -else - echo Skipping configure process. -fi - - - - - - - - - - - - - - - - AC_INIT([],[]) - -AC_PREREQ(2.60) -AC_CANONICAL_SYSTEM -AC_CONFIG_AUX_DIR(.) -AM_INIT_AUTOMAKE([1.9 tar-ustar foreign]) -AM_MAINTAINER_MODE -dnl AC_PROG_INTLTOOL([0.25]) -AC_PROG_INSTALL - -ASSEMBLY_NAME= -PROJECT_NAME= -PROJECT_VERSION=$VERSION -PROJECT_DESCRIPTION="" -PROJECT_TYPE="" - -AC_SUBST(ASSEMBLY_NAME) -AC_SUBST(PROJECT_NAME) -AC_SUBST(PROJECT_VERSION) -AC_SUBST(DESCRIPTION) - -AC_MSG_CHECKING([assembly type]) -case $PROJECT_TYPE in - *Exe) - ASSEMBLY_EXTENSION=exe - ;; - *Library) - ASSEMBLY_EXTENSION=dll - ;; - *) - AC_MSG_ERROR([*** Please add support for project type $PROJECT_TYPE to configure.ac checks!]) - ;; -esac -AC_MSG_RESULT([$PROJECT_TYPE]) - -AC_SUBST(ASSEMBLY_EXTENSION) - -AC_MSG_CHECKING([whether we're compiling from an RCS]) -if test -f "$srcdir/.cvs_version" ; then - from_rcs=cvs -else - if test -f "$srcdir/.svn/entries" ; then - from_rcs=svn - else - from_rcs=no - fi -fi - -AC_MSG_RESULT($from_rcs) - -MONO_REQUIRED_VERSION=1.1 - -PKG_CHECK_MODULES(MONO_DEPENDENCY, mono >= $MONO_REQUIRED_VERSION, has_mono=true, has_mono=false) - -if test "x$has_mono" = "xtrue"; then - AC_PATH_PROG(RUNTIME, mono, no) - AC_PATH_PROG(CSC, gmcs, no) - AC_PATH_PROG(RESGEN, resgen2, no) - if test `uname -s` = "Darwin"; then - LIB_PREFIX= - LIB_SUFFIX=.dylib - else - LIB_PREFIX=.so - LIB_SUFFIX= - fi -else - AC_PATH_PROG(CSC, csc.exe, no) - if test x$CSC = "xno"; then - AC_MSG_ERROR([You need to install either mono or .Net]) - else - RUNTIME= - LIB_PREFIX= - LIB_SUFFIX= - fi -fi - -AC_PATH_PROG(GACUTIL, gacutil) -if test "x$GACUTIL" = "xno" ; then - AC_MSG_ERROR([No gacutil tool found]) -fi - -GACUTIL_FLAGS='/package /gacdir $(DESTDIR)$(prefix)/lib' -AC_SUBST(GACUTIL_FLAGS) - -AC_SUBST(PATH) -AC_SUBST(LD_LIBRARY_PATH) - -AC_SUBST(LIB_PREFIX) -AC_SUBST(LIB_SUFFIX) -AC_SUBST(RUNTIME) -AC_SUBST(CSC) -AC_SUBST(RESGEN) -AC_SUBST(GACUTIL) - -AC_SUBST(BASE_DEPENDENCIES_CFLAGS) -AC_SUBST(BASE_DEPENDENCIES_LIBS) - -dnl Find monodoc -MONODOC_REQUIRED_VERSION=1.0 -AC_SUBST(MONODOC_REQUIRED_VERSION) - -PKG_CHECK_MODULES(MONODOC_DEPENDENCY, monodoc >= $MONODOC_REQUIRED_VERSION, enable_monodoc=yes, enable_monodoc=no) - -if test "x$enable_monodoc" = "xyes"; then - AC_PATH_PROG(MONODOC, monodoc, no) - if test x$MONODOC = xno; then - enable_monodoc=no - fi -else - MONODOC= -fi - -AC_SUBST(MONODOC) -AM_CONDITIONAL(ENABLE_MONODOC, test "x$enable_monodoc" = "xyes") - -winbuild=no -case "$host" in - *-*-mingw*|*-*-cygwin*) - winbuild=yes - ;; -esac -AM_CONDITIONAL(WINBUILD, test x$winbuild = xyes) - -AC_CONFIG_FILES() -AC_CONFIG_FILES(.pc) - -AC_CONFIG_FILES(Makefile) -AC_OUTPUT - -echo "===" -echo "" -echo "Project configuration summary" -echo "" -echo " * Installation prefix: $prefix" -echo " * compiler: $CSC" -echo " * Documentation: $enable_monodoc ($MONODOC)" -echo " * Project Name: $PROJECT_NAME" -echo " * Version: $PROJECT_VERSION" -echo "" -echo "===" - - - - - - - - - - - - - - - - - - - - - - - - - - -ASSEMBLY=$(ASSEMBLY_NAME).$(ASSEMBLY_EXTENSION) - - -dir = $(prefix)/lib/ -_DATA = $(ASSEMBLY) $(ASSEMBLY).config - -bin_SCRIPTS= - -pkgconfigdir = $(prefix)/lib/pkgconfig -pkgconfig_DATA = .pc - -dir = $(prefix)/lib/mono/ -_DATA = $(ASSEMBLY).config - -noinst_DATA = $(ASSEMBLY) - - -PACKAGES = -BINARY_LIBS = -SYSTEM_LIBS = -RESOURCES_SRC = -RESOURCES = $(RESOURCES_SRC:.resx=.resources) -SOURCES = - -EXTRA_DIST=$(SOURCES) $(BINARY_LIBS) $(RESOURCES_SRC) install-sh missing - -CLEANFILES=$(ASSEMBLY) - - - - - - - -/$(ASSEMBLY): $(srcdir)/$(ASSEMBLY).response $(RESOURCES) $(SOURCES) $(BINARY_LIBS) - mkdir -p doc && mkdir -p && $(CSC) /out:$@ \ - /target: \ - $(addprefix /resource:$(srcdir)/, $(RESOURCES)) \ - $(addprefix /pkg:, $(PACKAGES)) \ - $(addprefix /r:, $(SYSTEM_LIBS)) \ - $(addprefix /r:$(srcdir)/, $(BINARY_LIBS)) \ - @$(srcdir)/$(ASSEMBLY).response \ - /doc:doc/ \ - /keyfile:$(srcdir)/ \ - /unsafe \ - && rm -f $(ASSEMBLY) \ - && ln $@ $(ASSEMBLY) - -CLEANFILES+=/$(ASSEMBLY) - - -EXTRA_DIST+= - -: /$(ASSEMBLY) - rm -f $(ASSEMBLY) \ - && ln /$(ASSEMBLY) $(ASSEMBLY) - - - - - -_install-data-local: /$(ASSEMBLY) - echo "$(GACUTIL) /i $(ASSEMBLY) /f $(GACUTIL_FLAGS)"; \ - $(GACUTIL) /i $(ASSEMBLY) /f $(GACUTIL_FLAGS) || exit 1; - -_uninstall-local: - if [`gacutil -l | grep "Number" | awk -F= '{print $$2}'` -gt "0" ] ; \ - then \ - echo "$(GACUTIL) /u $(ASSEMBLY_NAME) $(GACUTIL_FLAGS)"; \ - $(GACUTIL) /u $(ASSEMBLY_NAME) $(GACUTIL_FLAGS) || exit 1; \ - fi - - - -noinst__dir = $(prefix)/lib/mono/ -noinst___DATA = /$(ASSEMBLY) - - - - - - -$(ASSEMBLY): - - -$(srcdir)/$(ASSEMBLY).response: $(srcdir)/Makefile - echo "$(addprefix $(srcdir)/, $(SOURCES))" > $@ - - -all: $(ASSEMBLY) - -# rule to compile .resx files to .resources -%.resources: %.resx - $(RESGEN) /useSourcePath /compile $(@:.resources=.resx) - - - - - -install-data-local: _install-data-local - -uninstall-local: _uninstall-local - - - -#dir+=$(noinst__dir) -#_DATA+=$(noinst___DATA) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -prefix=@prefix@ -exec_prefix=${prefix} -libdir=${exec_prefix}/lib/mono/@PROJECT_NAME@ - -Name: -Description: -Version: @PROJECT_VERSION@ -Requires: -Libs: -r:${libdir}/@PROJECT_NAME@.dll - - - - - - - - - - - #!/bin/sh -# Run this to generate all the initial makefiles, etc. -# Ripped off from Mono, which ripped off from GNOME macros version - -DIE=0 - -srcdir=`dirname $0` -test -z "$srcdir" && srcdir=. - -if [ -n "$MONO_PATH" ]; then - # from -> /mono/lib:/another/mono/lib - # to -> /mono /another/mono - for i in `echo ${MONO_PATH} | tr ":" " "`; do - i=`dirname ${i}` - if [ -n "{i}" -a -d "${i}/share/aclocal" ]; then - ACLOCAL_FLAGS="-I ${i}/share/aclocal $ACLOCAL_FLAGS" - fi - if [ -n "{i}" -a -d "${i}/bin" ]; then - PATH="${i}/bin:$PATH" - fi - done - export PATH -fi - -(autoconf --version) < /dev/null > /dev/null 2>&1 || { - echo - echo "**Error**: You must have \`autoconf' installed to compile Mono." - echo "Download the appropriate package for your distribution," - echo "or get the source tarball at ftp://ftp.gnu.org/pub/gnu/" - DIE=1 -} - -if [ -z "$LIBTOOL" ]; then - LIBTOOL=`which glibtool 2>/dev/null` - if [ ! -x "$LIBTOOL" ]; then - LIBTOOL=`which libtool` - fi -fi - -(grep "^AM_PROG_LIBTOOL" $srcdir/configure.ac >/dev/null) && { - ($LIBTOOL --version) < /dev/null > /dev/null 2>&1 || { - echo - echo "**Error**: You must have \`libtool' installed to compile Mono." - echo "Get ftp://ftp.gnu.org/pub/gnu/libtool-1.2d.tar.gz" - echo "(or a newer version if it is available)" - DIE=1 - } -} - -grep "^AM_GNU_GETTEXT" $srcdir/configure.ac >/dev/null && { - grep "sed.*POTFILES" $srcdir/configure.ac >/dev/null || \ - (gettext --version) < /dev/null > /dev/null 2>&1 || { - echo - echo "**Error**: You must have \`gettext' installed to compile Mono." - echo "Get ftp://alpha.gnu.org/gnu/gettext-0.10.35.tar.gz" - echo "(or a newer version if it is available)" - DIE=1 - } -} - -(automake --version) < /dev/null > /dev/null 2>&1 || { - echo - echo "**Error**: You must have \`automake' installed to compile Mono." - echo "Get ftp://ftp.gnu.org/pub/gnu/automake-1.3.tar.gz" - echo "(or a newer version if it is available)" - DIE=1 - NO_AUTOMAKE=yes -} - - -# if no automake, don't bother testing for aclocal -test -n "$NO_AUTOMAKE" || (aclocal --version) < /dev/null > /dev/null 2>&1 || { - echo - echo "**Error**: Missing \`aclocal'. The version of \`automake'" - echo "installed doesn't appear recent enough." - echo "Get ftp://ftp.gnu.org/pub/gnu/automake-1.3.tar.gz" - echo "(or a newer version if it is available)" - DIE=1 -} - -if test "$DIE" -eq 1; then - exit 1 -fi - -if test -z "$*"; then - echo "**Warning**: I am going to run \`configure' with no arguments." - echo "If you wish to pass any to it, please specify them on the" - echo \`$0\'" command line." - echo -fi - -case $CC in -xlc ) - am_opt=--include-deps;; -esac - - -if grep "^AM_PROG_LIBTOOL" configure.ac >/dev/null; then - if test -z "$NO_LIBTOOLIZE" ; then - echo "Running libtoolize..." - ${LIBTOOL}ize --force --copy - fi -fi - -echo "Running aclocal $ACLOCAL_FLAGS ..." -aclocal $ACLOCAL_FLAGS || { - echo - echo "**Error**: aclocal failed. This may mean that you have not" - echo "installed all of the packages you need, or you may need to" - echo "set ACLOCAL_FLAGS to include \"-I \$prefix/share/aclocal\"" - echo "for the prefix where you installed the packages whose" - echo "macros were not found" - exit 1 -} - -if grep "^AM_CONFIG_HEADER" configure.ac >/dev/null; then - echo "Running autoheader..." - autoheader || { echo "**Error**: autoheader failed."; exit 1; } -fi - -echo "Running automake --gnu $am_opt ..." -automake --add-missing --gnu $am_opt || - { echo "**Error**: automake failed."; exit 1; } -echo "Running autoconf ..." -autoconf || { echo "**Error**: autoconf failed."; exit 1; } - - -echo Running /autogen.sh ... -(cd $srcdir/ ; NOCONFIGURE=1 /bin/sh ./autogen.sh "$@") -echo Done running /autogen.sh ... - - -conf_flags="--enable-maintainer-mode --enable-compile-warnings" #--enable-iso-c - -if test x$NOCONFIGURE = x; then - echo Running $srcdir/configure $conf_flags "$@" ... - $srcdir/configure $conf_flags "$@" \ - && echo Now type \`make\' to compile $PKG_NAME || exit 1 -else - echo Skipping configure process. -fi - - - - - - - - - - -AC_INIT([]-solution,[]) -AC_CONFIG_AUX_DIR(.) -AM_INIT_AUTOMAKE([1.9 tar-ustar foreign]) -EXTRA_DIST="install-sh missing" -SOLUTION_NAME= -SOLUTION_VERSION=$VERSION -SOLUTION_DESCRIPTION="" -AC_SUBST(DESCRIPTION) - -AM_MAINTAINER_MODE - -dnl AC_PROG_INTLTOOL([0.25]) - -AC_PROG_INSTALL - -AC_MSG_CHECKING([whether we're building from an RCS]) -if test -f "$srcdir/.cvs_version" ; then - from_rcs=cvs -else - if test -f "$srcdir/.svn/entries" ; then - from_rcs=svn - else - from_rcs=no - fi -fi - -AC_MSG_RESULT($from_rcs) - -CONFIG="Release" -AC_SUBST(CONFIG) - -AC_CONFIG_SUBDIRS( -) - - -AC_OUTPUT([ -Makefile -]) - -echo "===" -echo "" -echo "Solution configuration summary" -echo "" -echo " * Solution Name: $SOLUTION_NAME" -echo " * Version: $SOLUTION_VERSION" -echo " * Packages:" -echo " - " -echo "" -echo "===" - - - - - - - - - SUBDIRS = - - - - - - - - - - - - -#! /bin/sh - -PACKAGE= -prefix=@prefix@ -exec_prefix=@exec_prefix@ - -# %%$@%$# why oh why isn't it $sharedir/ -# Day changed to 30 Mar 2007 -# ... -# 07:50 < cj> why are we installing .exe assemblies to $prefix/lib/$package/ and -# not $prefix/share/$package ? -# 07:50 < jonp> momentum. -# 07:50 < jonp> and it's hard to say that a .exe isn't platform specific -# 07:50 < jonp> as it can still contain DllImport's which make platform -# assumptions - -packagedir=$prefix/lib/ -export MONO_PATH=$MONO_PATH - -exec @RUNTIME@ $packagedir/$PACKAGE.exe "$@" - - - - - diff --git a/Prebuild/src/data/dnpb-1.0.xsd b/Prebuild/src/data/dnpb-1.0.xsd deleted file mode 100644 index b9e0e4e..0000000 --- a/Prebuild/src/data/dnpb-1.0.xsd +++ /dev/null @@ -1,183 +0,0 @@ - - - - - Copyright (c) 2004 Matthew Holmes (kerion@houston.rr.com) - - Redistribution and use in source and binary forms, with or without modification, are permitted - provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, this list of conditions - and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, this list of conditions - and the following disclaimer in the documentation and/or other materials provided with the - distribution. - * The name of the author may not be used to endorse or promote products derived from this software - without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, - BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY - OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING - IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/Prebuild/src/data/dnpb-1.1.xsd b/Prebuild/src/data/dnpb-1.1.xsd deleted file mode 100644 index 2c065a3..0000000 --- a/Prebuild/src/data/dnpb-1.1.xsd +++ /dev/null @@ -1,184 +0,0 @@ - - - - - Copyright (c) 2004 Matthew Holmes (kerion@houston.rr.com) - - Redistribution and use in source and binary forms, with or without modification, are permitted - provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, this list of conditions - and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, this list of conditions - and the following disclaimer in the documentation and/or other materials provided with the - distribution. - * The name of the author may not be used to endorse or promote products derived from this software - without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, - BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY - OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING - IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/Prebuild/src/data/dnpb-1.2.xsd b/Prebuild/src/data/dnpb-1.2.xsd deleted file mode 100644 index d694ab4..0000000 --- a/Prebuild/src/data/dnpb-1.2.xsd +++ /dev/null @@ -1,198 +0,0 @@ - - - - - Copyright (c) 2004 Matthew Holmes (calefaction _at_ houston _._ rr _._ com) - - Redistribution and use in source and binary forms, with or without modification, are permitted - provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, this list of conditions - and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, this list of conditions - and the following disclaimer in the documentation and/or other materials provided with the - distribution. - * The name of the author may not be used to endorse or promote products derived from this software - without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, - BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY - OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING - IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/Prebuild/src/data/dnpb-1.3.xsd b/Prebuild/src/data/dnpb-1.3.xsd deleted file mode 100644 index 8f31a54..0000000 --- a/Prebuild/src/data/dnpb-1.3.xsd +++ /dev/null @@ -1,206 +0,0 @@ - - - - - Copyright (c) 2004-2005 Matthew Holmes (calefaction at houston . rr . com), Dan Moorehead (dan05a at gmail . com) - - .NET Pre-Build is an XML-driven pre-build tool allowing developers to - easily generate project or make files for major IDE's and .NET - development tools including: Visual Studio 2003, Visual Studio 2002, - SharpDevelop, MonoDevelop, and NAnt. - - BSD License: - - Redistribution and use in source and binary forms, with or without modification, are permitted - provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, this list of conditions - and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, this list of conditions - and the following disclaimer in the documentation and/or other materials provided with the - distribution. - * The name of the author may not be used to endorse or promote products derived from this software - without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR 'AS IS' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, - BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY - OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING - IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/Prebuild/src/data/dnpb-1.4.xsd b/Prebuild/src/data/dnpb-1.4.xsd deleted file mode 100644 index 1da50fc..0000000 --- a/Prebuild/src/data/dnpb-1.4.xsd +++ /dev/null @@ -1,212 +0,0 @@ - - - - - Copyright (c) 2004-2005 Matthew Holmes (calefaction at houston . rr . com), Dan Moorehead (dan05a at gmail . com) - - .NET Prebuild is a cross-platform XML-driven pre-build tool which - allows developers to easily generate project or make files for major - IDE's and .NET development tools including: Visual Studio .NET 2002 and - 2003, SharpDevelop, MonoDevelop, and NAnt. - - BSD License: - - Redistribution and use in source and binary forms, with or without modification, are permitted - provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, this list of conditions - and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, this list of conditions - and the following disclaimer in the documentation and/or other materials provided with the - distribution. - * The name of the author may not be used to endorse or promote products derived from this software - without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR 'AS IS' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, - BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY - OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING - IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Prebuild/src/data/dnpb-1.5.xsd b/Prebuild/src/data/dnpb-1.5.xsd deleted file mode 100644 index e2b21f0..0000000 --- a/Prebuild/src/data/dnpb-1.5.xsd +++ /dev/null @@ -1,215 +0,0 @@ - - - - - Copyright (c) 2004-2005 Matthew Holmes (calefaction at houston . rr . com), Dan Moorehead (dan05a at gmail . com) - - .NET Prebuild is a cross-platform XML-driven pre-build tool which - allows developers to easily generate project or make files for major - IDE's and .NET development tools including: Visual Studio .NET 2002 and - 2003, SharpDevelop, MonoDevelop, and NAnt. - - BSD License: - - Redistribution and use in source and binary forms, with or without modification, are permitted - provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, this list of conditions - and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, this list of conditions - and the following disclaimer in the documentation and/or other materials provided with the - distribution. - * The name of the author may not be used to endorse or promote products derived from this software - without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR 'AS IS' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, - BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY - OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING - IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Prebuild/src/data/prebuild-1.6.xsd b/Prebuild/src/data/prebuild-1.6.xsd deleted file mode 100644 index 57ebd2e..0000000 --- a/Prebuild/src/data/prebuild-1.6.xsd +++ /dev/null @@ -1,231 +0,0 @@ - - - - - Copyright (c) 2004-2005 Matthew Holmes (calefaction at houston . rr . com), Dan Moorehead (dan05a at gmail . com) - - .NET Prebuild is a cross-platform XML-driven pre-build tool which - allows developers to easily generate project or make files for major - IDE's and .NET development tools including: Visual Studio .NET 2002 and - 2003, SharpDevelop, MonoDevelop, and NAnt. - - BSD License: - - Redistribution and use in source and binary forms, with or without modification, are permitted - provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, this list of conditions - and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, this list of conditions - and the following disclaimer in the documentation and/or other materials provided with the - distribution. - * The name of the author may not be used to endorse or promote products derived from this software - without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR 'AS IS' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, - BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY - OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING - IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Prebuild/src/data/prebuild-1.7.xsd b/Prebuild/src/data/prebuild-1.7.xsd deleted file mode 100644 index c3f8d6b..0000000 --- a/Prebuild/src/data/prebuild-1.7.xsd +++ /dev/null @@ -1,331 +0,0 @@ - - - - - Copyright (c) 2004-2007 - Matthew Holmes (calefaction at houston . rr . com), - Dan Moorehead (dan05a at gmail . com), - David Hudson (jendave at yahoo dot com), - C.J. Adams-Collier (cjac at colliertech dot com) - - .NET Prebuild is a cross-platform XML-driven pre-build tool which - allows developers to easily generate project or make files for major - IDE's and .NET development tools including: Visual Studio .NET 2002, - 2003, and 2005, SharpDevelop, MonoDevelop, NAnt, Xcode and the GNU Autotools. - - BSD License: - - Redistribution and use in source and binary forms, with or without modification, are permitted - provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, this list of conditions - and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, this list of conditions - and the following disclaimer in the documentation and/or other materials provided with the - distribution. - * The name of the author may not be used to endorse or promote products derived from this software - without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR 'AS IS' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, - BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY - OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING - IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Prebuild/tests/Makefile b/Prebuild/tests/Makefile deleted file mode 100644 index 4a8ddf4..0000000 --- a/Prebuild/tests/Makefile +++ /dev/null @@ -1,24 +0,0 @@ -# -# Executable -# - -# Executables -PREBUILD = mono ../src/bin/Release/prebuild.exe /target makefile - -# Files -PREBUILDS = $(wildcard *.prebuild) -RESULTS = $(PREBUILDS:prebuild=results) -TESTS = $(PREBUILDS:prebuild=test) - -all: $(TESTS) - -clean: - rm -f *~ *.log - rm -f $(RESULTS) - -%.test: %.prebuild - $(PREBUILD) /log $*.log /file $*.prebuild /ppi $*.results >& /dev/null - if ! cmp $*.expected $*.results; then \ - echo $*.prebuild failed; \ - false; \ - fi diff --git a/Prebuild/tests/README.txt b/Prebuild/tests/README.txt deleted file mode 100644 index 2c2de3b..0000000 --- a/Prebuild/tests/README.txt +++ /dev/null @@ -1,5 +0,0 @@ -There are some tests that are run via a Makfile in this -directory. They haven't been included in any form of unit tests, but -they are there to help test the functionality in some what. Simply -build prebuild (so there is a src/bin/Release/prebuild.exe) and type -`make` in this directory. Everything should pass without errors. diff --git a/Prebuild/tests/include-001.expected b/Prebuild/tests/include-001.expected deleted file mode 100644 index 26374b5..0000000 --- a/Prebuild/tests/include-001.expected +++ /dev/null @@ -1,46 +0,0 @@ - - - - - DEBUG;TRACE - false - bin/Debug - true - - - - - TRACE - bin/Release - true - false - - - - - - DEBUG;TRACE - false - bin/Debug - true - Prebuild.snk - 1595 - - - - - TRACE - bin/Release - true - false - Prebuild.snk - 1595 - - - - - - - - - diff --git a/Prebuild/tests/include-001.include b/Prebuild/tests/include-001.include deleted file mode 100644 index 7f75962..0000000 --- a/Prebuild/tests/include-001.include +++ /dev/null @@ -1,33 +0,0 @@ - - - - DEBUG;TRACE - false - bin/Debug - true - Prebuild.snk - 1595 - - - - - TRACE - bin/Release - true - false - Prebuild.snk - 1595 - - - - - - - diff --git a/Prebuild/tests/include-001.prebuild b/Prebuild/tests/include-001.prebuild deleted file mode 100644 index 8047008..0000000 --- a/Prebuild/tests/include-001.prebuild +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - DEBUG;TRACE - false - bin/Debug - true - - - - - TRACE - bin/Release - true - false - - - - - diff --git a/Prebuild/tests/include-002-2.include b/Prebuild/tests/include-002-2.include deleted file mode 100644 index 661b7f3..0000000 --- a/Prebuild/tests/include-002-2.include +++ /dev/null @@ -1,8 +0,0 @@ - - - DEBUG;TRACE - false - bin/Debug - true - - diff --git a/Prebuild/tests/include-002.expected b/Prebuild/tests/include-002.expected deleted file mode 100644 index 9849658..0000000 --- a/Prebuild/tests/include-002.expected +++ /dev/null @@ -1,26 +0,0 @@ - - - - - DEBUG;TRACE - false - bin/Debug - true - - - - - - DEBUG;TRACE - false - bin/Debug - true - - - - - - - - - diff --git a/Prebuild/tests/include-002.include b/Prebuild/tests/include-002.include deleted file mode 100644 index 64f4058..0000000 --- a/Prebuild/tests/include-002.include +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - diff --git a/Prebuild/tests/include-002.prebuild b/Prebuild/tests/include-002.prebuild deleted file mode 100644 index 9e85f20..0000000 --- a/Prebuild/tests/include-002.prebuild +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/bin/Prebuild.exe b/bin/Prebuild.exe index eb4c224..ad84b98 100755 Binary files a/bin/Prebuild.exe and b/bin/Prebuild.exe differ diff --git a/prebuild.xml b/prebuild.xml index fdd024a..7dec8ba 100644 --- a/prebuild.xml +++ b/prebuild.xml @@ -1,6 +1,6 @@ - - - + + + TRACE;DEBUG @@ -9,7 +9,7 @@ false 4 false - + bin true true @@ -24,7 +24,7 @@ false 4 false - + bin false true @@ -71,23 +71,23 @@ - - - - - + + + + + - + - - - - - - + + + + + + @@ -108,10 +108,10 @@ - - + + - + @@ -158,17 +158,17 @@ - - - - - + + + + + - - - - + + + + @@ -190,9 +190,9 @@ ../../../bin/ - - - + + + @@ -216,9 +216,9 @@ ../../../bin/ - - - + + + @@ -242,16 +242,16 @@ - - - + + + - - + + - + @@ -270,8 +270,8 @@ ../../../../bin/ - - + + @@ -295,13 +295,13 @@ ../../../../bin/ - - + + - + @@ -324,9 +324,9 @@ - - - + + + @@ -347,12 +347,12 @@ ../../../../bin/ - - + + - - + + @@ -373,11 +373,11 @@ ../../../../bin/ - - + + - + @@ -403,11 +403,11 @@ - - - - - + + + + + @@ -429,13 +429,13 @@ ../../../../bin/ - - + + - - - + + + @@ -457,8 +457,8 @@ ../../../../bin/ - - + + @@ -480,8 +480,8 @@ ../../../../bin/ - - + + @@ -503,12 +503,12 @@ ../../../../bin/ - - - + + + - + @@ -529,13 +529,13 @@ ../../../../bin/ - - + + - - + + @@ -558,14 +558,14 @@ ../../../../bin/ - - + + - - - + + + @@ -587,14 +587,14 @@ ../../../../bin/ - - - - + + + + - + @@ -615,14 +615,14 @@ ../../../../bin/ - - + + - - - + + + @@ -643,14 +643,14 @@ ../../../bin/ - - - + + + - - + + @@ -679,16 +679,16 @@ - + - - + + - + @@ -710,26 +710,26 @@ - + - - + + - - - - + + + + - + @@ -752,14 +752,14 @@ - - - + + + - + @@ -767,16 +767,16 @@ - + - - - - + + + + - + @@ -802,13 +802,13 @@ - - + + - - + + @@ -829,13 +829,13 @@ ../../../bin/ - - + + - - + + @@ -857,16 +857,16 @@ ../../../bin/ - - + + - - + + @@ -888,16 +888,16 @@ ../../../bin/ - - + + - - + + @@ -918,11 +918,12 @@ ../../../bin/ + - - - + + + @@ -930,10 +931,10 @@ - - - - + + + + @@ -954,8 +955,8 @@ ../../../bin/ - - + + @@ -963,8 +964,8 @@ - - + + @@ -985,8 +986,8 @@ ../../../bin/ - - + + @@ -994,8 +995,8 @@ - - + + @@ -1016,8 +1017,8 @@ ../../../bin/ - - + + @@ -1025,8 +1026,8 @@ - - + + @@ -1047,8 +1048,8 @@ ../../../bin/ - - + + @@ -1056,8 +1057,8 @@ - - + + @@ -1079,8 +1080,8 @@ ../../../bin/ - - + + @@ -1089,8 +1090,8 @@ - - + + @@ -1111,8 +1112,8 @@ ../../../bin/ - - + + @@ -1120,8 +1121,8 @@ - - + + @@ -1142,8 +1143,8 @@ ../../../bin/ - - + + @@ -1151,8 +1152,8 @@ - - + + @@ -1174,8 +1175,8 @@ ../../../bin/ - - + + @@ -1184,8 +1185,8 @@ - - + + @@ -1215,11 +1216,11 @@ - - - - - + + + + + @@ -1241,8 +1242,8 @@ ../../../bin/ - - + + @@ -1251,8 +1252,8 @@ - - + + @@ -1276,23 +1277,23 @@ - - - + + + - + - - - - + + + + - + @@ -1313,20 +1314,20 @@ ../../bin/ - - - + + + - - + + - + @@ -1346,19 +1347,19 @@ ../../bin/ - - - + + + - - + + - + @@ -1381,21 +1382,21 @@ - - - - - + + + + + - - - - - - - + + + + + + + @@ -1403,24 +1404,24 @@ - + - + - - - + + + - + - + - + - + @@ -1441,40 +1442,40 @@ - - - - + + + + - - - + + + - - - - - - + + + + + + - + - - - + + + - + - + @@ -1493,26 +1494,26 @@ ../../../bin/ - - + + - - - + + + - - - + + + - + - - + + @@ -1531,7 +1532,7 @@ ../../../bin/ - + @@ -1542,9 +1543,9 @@ - - - + + + @@ -1568,9 +1569,9 @@ - - - + + + @@ -1581,12 +1582,12 @@ - - - - - - + + + + + + @@ -1610,11 +1611,11 @@ - + - + @@ -1637,10 +1638,10 @@ ../../../bin/ - - - - + + + + @@ -1652,9 +1653,9 @@ - - - + + + @@ -1674,11 +1675,11 @@ ../../../bin/ - + - - + + @@ -1688,11 +1689,11 @@ - + - + @@ -1709,8 +1710,8 @@ ../../../bin/ - - + + @@ -1718,11 +1719,11 @@ - + - + @@ -1739,14 +1740,14 @@ ../../../bin/ - + - - - - - + + + + + @@ -1757,17 +1758,16 @@ - + - + - + ../../../bin/ @@ -1780,12 +1780,12 @@ ../../../bin/ - + - - - + + + @@ -1795,15 +1795,14 @@ - + - + ../../../../bin/ @@ -1816,12 +1815,12 @@ ../../../../bin/ - + - - - + + + @@ -1832,16 +1831,15 @@ - + - + - + ../../../../bin/ @@ -1854,14 +1852,14 @@ ../../../../bin/ - + - - - - + + + + @@ -1873,11 +1871,11 @@ - + - + @@ -1910,11 +1908,11 @@ - - - - - + + + + + @@ -1934,13 +1932,13 @@ ../../../../bin/ - - + + - - + + @@ -1962,17 +1960,17 @@ ../../../bin/ - - + + - - + + - + @@ -1994,8 +1992,8 @@ ../../../bin/ - - + + @@ -2004,9 +2002,9 @@ - - - + + + @@ -2026,8 +2024,8 @@ ../../../bin/ - - + + @@ -2036,8 +2034,8 @@ - - + + @@ -2057,26 +2055,26 @@ ../../../bin/ - - + + - - + + - + - + - + @@ -2102,21 +2100,21 @@ - - - + + + - - + + - - + + - - - + + + @@ -2141,16 +2139,16 @@ - - - - + + + + - - - + + + @@ -2170,25 +2168,25 @@ - + - - + + - - + + - - + + - - - + + + @@ -2213,20 +2211,20 @@ - - - + + + - - + + - - + + - - - + + + @@ -2249,18 +2247,18 @@ - - + + - - + + - - - - + + + + @@ -2287,18 +2285,18 @@ - - + + - - + + - - - - + + + + @@ -2322,17 +2320,17 @@ - - + + - + - - - - + + + + @@ -2356,22 +2354,22 @@ - - - + + + - - - + + + - - - - + + + + @@ -2392,20 +2390,20 @@ ../../../../../bin/ - - + + - - - - - - + + + + + + - + @@ -2427,22 +2425,22 @@ - - + + - - + + - - - - + + + + @@ -2466,27 +2464,27 @@ - - - + + + - - + + - - - + + + - + - + @@ -2511,13 +2509,13 @@ - - - + + + - - - + + + @@ -2528,15 +2526,15 @@ - + - - - + + + - + @@ -2557,12 +2555,12 @@ ../../../bin/ - - + + - - + + @@ -2583,13 +2581,13 @@ ../../../bin/ - - + + - - + + @@ -2611,8 +2609,8 @@ ../../../bin/ - - + + @@ -2634,13 +2632,13 @@ ../../bin/ - - + + - - + + @@ -2662,13 +2660,13 @@ ../../../../bin/ - - + + - - - - + + + + @@ -2689,13 +2687,13 @@ ../../../../bin/ - - + + - - - - + + + + @@ -2716,13 +2714,13 @@ ../../../../bin/ - - + + - - - - + + + + @@ -2748,11 +2746,11 @@ - - - - - + + + + + @@ -2784,9 +2782,9 @@ ../../bin/ - - - + + + @@ -2810,27 +2808,27 @@ - - + + - - - - + + + + - - + + - + @@ -2851,16 +2849,16 @@ - - - - + + + + - - + + @@ -2880,16 +2878,16 @@ ../../../../bin/ - - - + + + - - + + @@ -2917,9 +2915,9 @@ - - - + + + @@ -2944,8 +2942,8 @@ - - + + @@ -2961,15 +2959,15 @@ - - + + - + - - - + + + - - - - - - - - + + + + + + + + @@ -3007,8 +3005,8 @@ - - + + @@ -3024,15 +3022,15 @@ - - + + - + - - - + + + - + @@ -3062,11 +3060,11 @@ ../../../../../bin/ - - - - - + + + + + @@ -3103,12 +3101,12 @@ - - - + + + - + - - - + + + @@ -3143,14 +3141,14 @@ ../../../../bin/ - - + + - - - + + + @@ -3161,58 +3159,4 @@ - - - - - DEBUG;TRACE - false - bin/Debug - true - 1595 - - - - - TRACE - bin/Release - true - false - 1595 - - - - - - - DEBUG;TRACE - false - ..\..\bin\ - true - Prebuild.snk - 1595 - - - - - TRACE - ..\..\bin\ - true - false - Prebuild.snk - 1595 - - - ../../bin/ - - - - - - - - - - - diff --git a/runprebuild.sh b/runprebuild.sh index 3e1417a..b3b5c9d 100755 --- a/runprebuild.sh +++ b/runprebuild.sh @@ -1,7 +1,4 @@ #!/bin/sh mono bin/Prebuild.exe /target nant -# needed until we break up OpenSim.exe -perl -pi -e 's{OpenSim.dll}{OpenSim.exe}' OpenSim/ApplicationPlugins/LoadRegions/OpenSim.ApplicationPlugins.LoadRegions.dll.build -mono bin/Prebuild.exe /target monodev mono bin/Prebuild.exe /target vs2008 -- cgit v1.1 From f7b28dd32155eac2d55ccf0757b059794d6b5f67 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 7 Sep 2010 03:41:29 +0100 Subject: If a scene object part UUID is changed (only possible when not in a scene), then adjust the inventory items to point to the new uuid as well --- OpenSim/Framework/TaskInventoryItem.cs | 10 +++++----- .../Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs | 2 +- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 10 ++++++++-- OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs | 3 +++ 4 files changed, 17 insertions(+), 8 deletions(-) diff --git a/OpenSim/Framework/TaskInventoryItem.cs b/OpenSim/Framework/TaskInventoryItem.cs index 2cb7895..df5b936 100644 --- a/OpenSim/Framework/TaskInventoryItem.cs +++ b/OpenSim/Framework/TaskInventoryItem.cs @@ -348,15 +348,15 @@ namespace OpenSim.Framework /// The new part ID to which this item belongs public void ResetIDs(UUID partID) { - _oldID = _itemID; - _itemID = UUID.Random(); - _parentPartID = partID; - _parentID = partID; + OldItemID = ItemID; + ItemID = UUID.Random(); + ParentPartID = partID; + ParentID = partID; } public TaskInventoryItem() { - _creationDate = (uint)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds; + CreationDate = (uint)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds; } } } diff --git a/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs b/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs index 58698ee..32b3724 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs @@ -215,7 +215,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests public void TestLoadOarV0_2() { TestHelper.InMethod(); - //log4net.Config.XmlConfigurator.Configure(); +// log4net.Config.XmlConfigurator.Configure(); MemoryStream archiveWriteStream = new MemoryStream(); TarArchiveWriter tar = new TarArchiveWriter(archiveWriteStream); diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 3ed74e1..3753dcb 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -494,7 +494,14 @@ namespace OpenSim.Region.Framework.Scenes public UUID UUID { get { return m_uuid; } - set { m_uuid = value; } + set + { + m_uuid = value; + + // This is necessary so that TaskInventoryItem parent ids correctly reference the new uuid of this part + if (Inventory != null) + Inventory.ResetInventoryIDs(); + } } public uint LocalId @@ -2756,7 +2763,6 @@ namespace OpenSim.Region.Framework.Scenes UUID = UUID.Random(); LinkNum = linkNum; LocalId = 0; - Inventory.ResetInventoryIDs(); } /// diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs index ca089a1..87c4860 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs @@ -119,6 +119,9 @@ namespace OpenSim.Region.Framework.Scenes /// Link number for the part public void ResetInventoryIDs() { + if (null == m_part || null == m_part.ParentGroup) + return; + lock (m_items) { if (0 == m_items.Count) -- cgit v1.1 From 910aa48df3efcb5c1baa6429b65dcfd05796e2ec Mon Sep 17 00:00:00 2001 From: John Hurliman Date: Tue, 7 Sep 2010 11:13:37 -0700 Subject: Corrected SimianGrid.ini and HyperSimianGrid.ini configs to specify services in the way the ROBUST loader expects them (hopefully!) --- bin/config-include/HyperSimianGrid.ini | 12 ++++++------ bin/config-include/SimianGrid.ini | 16 ++++++++-------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/bin/config-include/HyperSimianGrid.ini b/bin/config-include/HyperSimianGrid.ini index 87ffe69..49ba2ca 100644 --- a/bin/config-include/HyperSimianGrid.ini +++ b/bin/config-include/HyperSimianGrid.ini @@ -21,13 +21,13 @@ Include-Common = "config-include/GridCommon.ini" [Modules] - GridServices = "OpenSim.Services.Connectors.dll:SimianGridServiceConnector" - PresenceServices = "OpenSim.Services.Connectors.dll:SimianPresenceServiceConnector" - UserAccountServices = "OpenSim.Services.Connectors.dll:SimianUserAccountServiceConnector" - AuthenticationServices = "OpenSim.Services.Connectors.dll:SimianAuthenticationServiceConnector" + GridServices = "SimianGridServiceConnector" + PresenceServices = "SimianPresenceServiceConnector" + UserAccountServices = "SimianUserAccountServiceConnector" + AuthenticationServices = "SimianAuthenticationServiceConnector" AssetServices = "HGAssetBroker" InventoryServices = "HGInventoryBroker" - AvatarServices = "OpenSim.Services.Connectors.dll:SimianAvatarServiceConnector" + AvatarServices = "SimianAvatarServiceConnector" NeighbourServices = "RemoteNeighbourServicesConnector" SimulationServices = "RemoteSimulationConnectorModule" @@ -74,4 +74,4 @@ ServicesConnectorModule = SimianGroupsServicesConnector [Profiles] - Module = SimianProfiles + Module = "SimianProfiles" diff --git a/bin/config-include/SimianGrid.ini b/bin/config-include/SimianGrid.ini index 65d4ea6..9b27cc7 100644 --- a/bin/config-include/SimianGrid.ini +++ b/bin/config-include/SimianGrid.ini @@ -21,13 +21,13 @@ Include-Common = "config-include/GridCommon.ini" [Modules] - GridServices = "OpenSim.Services.Connectors.dll:SimianGridServiceConnector" - PresenceServices = "OpenSim.Services.Connectors.dll:SimianPresenceServiceConnector" - UserAccountServices = "OpenSim.Services.Connectors.dll:SimianUserAccountServiceConnector" - AuthenticationServices = "OpenSim.Services.Connectors.dll:SimianAuthenticationServiceConnector" - AssetServices = "OpenSim.Services.Connectors.dll:SimianAssetServiceConnector" - InventoryServices = "OpenSim.Services.Connectors.dll:SimianInventoryServiceConnector" - AvatarServices = "OpenSim.Services.Connectors.dll:SimianAvatarServiceConnector" + GridServices = "SimianGridServiceConnector" + PresenceServices = "SimianPresenceServiceConnector" + UserAccountServices = "SimianUserAccountServiceConnector" + AuthenticationServices = "SimianAuthenticationServiceConnector" + AssetServices = "SimianAssetServiceConnector" + InventoryServices = "SimianInventoryServiceConnector" + AvatarServices = "SimianAvatarServiceConnector" NeighbourServices = "RemoteNeighbourServicesConnector" SimulationServices = "RemoteSimulationConnectorModule" @@ -67,4 +67,4 @@ ServicesConnectorModule = SimianGroupsServicesConnector [Profiles] - Module = SimianProfiles + Module = "SimianProfiles" -- cgit v1.1 From 5ca4c238e0e5aec6d3de74a7155324dddf34cc2d Mon Sep 17 00:00:00 2001 From: John Hurliman Date: Tue, 7 Sep 2010 11:33:46 -0700 Subject: SimianUserAccountServiceConnector was not initializing the user cache --- .../Connectors/SimianGrid/SimianUserAccountServiceConnector.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianUserAccountServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianUserAccountServiceConnector.cs index deb8695..991c0f3 100644 --- a/OpenSim/Services/Connectors/SimianGrid/SimianUserAccountServiceConnector.cs +++ b/OpenSim/Services/Connectors/SimianGrid/SimianUserAccountServiceConnector.cs @@ -54,8 +54,8 @@ namespace OpenSim.Services.Connectors.SimianGrid MethodBase.GetCurrentMethod().DeclaringType); private string m_serverUrl = String.Empty; - private ExpiringCache m_accountCache; - private bool m_Enabled = false; + private ExpiringCache m_accountCache = new ExpiringCache(); + private bool m_Enabled; #region ISharedRegionModule -- cgit v1.1 From b28d1b6ccd3e8728e429528ea87714680e6ac643 Mon Sep 17 00:00:00 2001 From: Melanie Date: Tue, 7 Sep 2010 20:19:52 +0100 Subject: Fix Simian regression --- .../SimianGrid/SimianAssetServiceConnector.cs | 37 +++++++++-------- .../SimianAuthenticationServiceConnector.cs | 35 ++++++++-------- .../SimianGrid/SimianAvatarServiceConnector.cs | 35 ++++++++-------- .../SimianGrid/SimianGridServiceConnector.cs | 35 ++++++++-------- .../SimianGrid/SimianInventoryServiceConnector.cs | 47 ++++++++++++---------- .../SimianGrid/SimianPresenceServiceConnector.cs | 35 ++++++++-------- .../SimianUserAccountServiceConnector.cs | 35 ++++++++-------- 7 files changed, 140 insertions(+), 119 deletions(-) diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianAssetServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianAssetServiceConnector.cs index 99e6983..6d5b30e 100644 --- a/OpenSim/Services/Connectors/SimianGrid/SimianAssetServiceConnector.cs +++ b/OpenSim/Services/Connectors/SimianGrid/SimianAssetServiceConnector.cs @@ -81,7 +81,7 @@ namespace OpenSim.Services.Connectors.SimianGrid public SimianAssetServiceConnector(IConfigSource source) { - Initialise(source); + CommonInit(source); } public void Initialise(IConfigSource source) @@ -91,25 +91,28 @@ namespace OpenSim.Services.Connectors.SimianGrid { string name = moduleConfig.GetString("AssetServices", ""); if (name == Name) - { - IConfig gridConfig = source.Configs["AssetService"]; - if (gridConfig != null) - { - string serviceUrl = gridConfig.GetString("AssetServerURI"); - if (!String.IsNullOrEmpty(serviceUrl)) - { - if (!serviceUrl.EndsWith("/") && !serviceUrl.EndsWith("=")) - serviceUrl = serviceUrl + '/'; - m_serverUrl = serviceUrl; - } - } + CommonInit(source); + } + } - if (String.IsNullOrEmpty(m_serverUrl)) - m_log.Info("[SIMIAN ASSET CONNECTOR]: No AssetServerURI specified, disabling connector"); - else - m_Enabled = true; + private void CommonInit(IConfigSource source) + { + IConfig gridConfig = source.Configs["AssetService"]; + if (gridConfig != null) + { + string serviceUrl = gridConfig.GetString("AssetServerURI"); + if (!String.IsNullOrEmpty(serviceUrl)) + { + if (!serviceUrl.EndsWith("/") && !serviceUrl.EndsWith("=")) + serviceUrl = serviceUrl + '/'; + m_serverUrl = serviceUrl; } } + + if (String.IsNullOrEmpty(m_serverUrl)) + m_log.Info("[SIMIAN ASSET CONNECTOR]: No AssetServerURI specified, disabling connector"); + else + m_Enabled = true; } #region IAssetService diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianAuthenticationServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianAuthenticationServiceConnector.cs index 68f73ee..51a09f8 100644 --- a/OpenSim/Services/Connectors/SimianGrid/SimianAuthenticationServiceConnector.cs +++ b/OpenSim/Services/Connectors/SimianGrid/SimianAuthenticationServiceConnector.cs @@ -69,7 +69,7 @@ namespace OpenSim.Services.Connectors.SimianGrid public SimianAuthenticationServiceConnector(IConfigSource source) { - Initialise(source); + CommonInit(source); } public void Initialise(IConfigSource source) @@ -79,24 +79,27 @@ namespace OpenSim.Services.Connectors.SimianGrid { string name = moduleConfig.GetString("AuthenticationServices", ""); if (name == Name) - { - IConfig gridConfig = source.Configs["AuthenticationService"]; - if (gridConfig != null) - { - string serviceUrl = gridConfig.GetString("AuthenticationServerURI"); - if (!String.IsNullOrEmpty(serviceUrl)) - { - if (!serviceUrl.EndsWith("/") && !serviceUrl.EndsWith("=")) - serviceUrl = serviceUrl + '/'; - m_serverUrl = serviceUrl; - m_Enabled = true; - } - } + CommonInit(source); + } + } - if (String.IsNullOrEmpty(m_serverUrl)) - m_log.Info("[SIMIAN AUTH CONNECTOR]: No AuthenticationServerURI specified, disabling connector"); + private void CommonInit(IConfigSource source) + { + IConfig gridConfig = source.Configs["AuthenticationService"]; + if (gridConfig != null) + { + string serviceUrl = gridConfig.GetString("AuthenticationServerURI"); + if (!String.IsNullOrEmpty(serviceUrl)) + { + if (!serviceUrl.EndsWith("/") && !serviceUrl.EndsWith("=")) + serviceUrl = serviceUrl + '/'; + m_serverUrl = serviceUrl; + m_Enabled = true; } } + + if (String.IsNullOrEmpty(m_serverUrl)) + m_log.Info("[SIMIAN AUTH CONNECTOR]: No AuthenticationServerURI specified, disabling connector"); } public string Authenticate(UUID principalID, string password, int lifetime) diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianAvatarServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianAvatarServiceConnector.cs index 7e56bd1..3505c64 100644 --- a/OpenSim/Services/Connectors/SimianGrid/SimianAvatarServiceConnector.cs +++ b/OpenSim/Services/Connectors/SimianGrid/SimianAvatarServiceConnector.cs @@ -74,7 +74,7 @@ namespace OpenSim.Services.Connectors.SimianGrid public SimianAvatarServiceConnector(IConfigSource source) { - Initialise(source); + CommonInit(source); } public void Initialise(IConfigSource source) @@ -84,24 +84,27 @@ namespace OpenSim.Services.Connectors.SimianGrid { string name = moduleConfig.GetString("AvatarServices", ""); if (name == Name) - { - IConfig gridConfig = source.Configs["AvatarService"]; - if (gridConfig != null) - { - string serviceUrl = gridConfig.GetString("AvatarServerURI"); - if (!String.IsNullOrEmpty(serviceUrl)) - { - if (!serviceUrl.EndsWith("/") && !serviceUrl.EndsWith("=")) - serviceUrl = serviceUrl + '/'; - m_serverUrl = serviceUrl; - m_Enabled = true; - } - } + CommonInit(source); + } + } - if (String.IsNullOrEmpty(m_serverUrl)) - m_log.Info("[SIMIAN AVATAR CONNECTOR]: No AvatarServerURI specified, disabling connector"); + private void CommonInit(IConfigSource source) + { + IConfig gridConfig = source.Configs["AvatarService"]; + if (gridConfig != null) + { + string serviceUrl = gridConfig.GetString("AvatarServerURI"); + if (!String.IsNullOrEmpty(serviceUrl)) + { + if (!serviceUrl.EndsWith("/") && !serviceUrl.EndsWith("=")) + serviceUrl = serviceUrl + '/'; + m_serverUrl = serviceUrl; + m_Enabled = true; } } + + if (String.IsNullOrEmpty(m_serverUrl)) + m_log.Info("[SIMIAN AVATAR CONNECTOR]: No AvatarServerURI specified, disabling connector"); } #region IAvatarService diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs index a94620b..4409d5c 100644 --- a/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs +++ b/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs @@ -98,7 +98,7 @@ namespace OpenSim.Services.Connectors.SimianGrid public SimianGridServiceConnector(IConfigSource source) { - Initialise(source); + CommonInit(source); } public void Initialise(IConfigSource source) @@ -108,24 +108,27 @@ namespace OpenSim.Services.Connectors.SimianGrid { string name = moduleConfig.GetString("GridServices", ""); if (name == Name) - { - IConfig gridConfig = source.Configs["GridService"]; - if (gridConfig != null) - { - string serviceUrl = gridConfig.GetString("GridServerURI"); - if (!String.IsNullOrEmpty(serviceUrl)) - { - if (!serviceUrl.EndsWith("/") && !serviceUrl.EndsWith("=")) - serviceUrl = serviceUrl + '/'; - m_serverUrl = serviceUrl; - m_Enabled = true; - } - } + CommonInit(source); + } + } - if (String.IsNullOrEmpty(m_serverUrl)) - m_log.Info("[SIMIAN GRID CONNECTOR]: No GridServerURI specified, disabling connector"); + private void CommonInit(IConfigSource source) + { + IConfig gridConfig = source.Configs["GridService"]; + if (gridConfig != null) + { + string serviceUrl = gridConfig.GetString("GridServerURI"); + if (!String.IsNullOrEmpty(serviceUrl)) + { + if (!serviceUrl.EndsWith("/") && !serviceUrl.EndsWith("=")) + serviceUrl = serviceUrl + '/'; + m_serverUrl = serviceUrl; + m_Enabled = true; } } + + if (String.IsNullOrEmpty(m_serverUrl)) + m_log.Info("[SIMIAN GRID CONNECTOR]: No GridServerURI specified, disabling connector"); } #region IGridService diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianInventoryServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianInventoryServiceConnector.cs index eb118ae..470eccd 100644 --- a/OpenSim/Services/Connectors/SimianGrid/SimianInventoryServiceConnector.cs +++ b/OpenSim/Services/Connectors/SimianGrid/SimianInventoryServiceConnector.cs @@ -88,7 +88,7 @@ namespace OpenSim.Services.Connectors.SimianGrid public SimianInventoryServiceConnector(IConfigSource source) { - Initialise(source); + CommonInit(source); } public void Initialise(IConfigSource source) @@ -98,36 +98,39 @@ namespace OpenSim.Services.Connectors.SimianGrid { string name = moduleConfig.GetString("InventoryServices", ""); if (name == Name) + CommonInit(source); + } + } + + private void CommonInit(IConfigSource source) + { + IConfig gridConfig = source.Configs["InventoryService"]; + if (gridConfig != null) + { + string serviceUrl = gridConfig.GetString("InventoryServerURI"); + if (!String.IsNullOrEmpty(serviceUrl)) { - IConfig gridConfig = source.Configs["InventoryService"]; + if (!serviceUrl.EndsWith("/") && !serviceUrl.EndsWith("=")) + serviceUrl = serviceUrl + '/'; + m_serverUrl = serviceUrl; + + gridConfig = source.Configs["UserAccountService"]; if (gridConfig != null) { - string serviceUrl = gridConfig.GetString("InventoryServerURI"); + serviceUrl = gridConfig.GetString("UserAccountServerURI"); if (!String.IsNullOrEmpty(serviceUrl)) { - if (!serviceUrl.EndsWith("/") && !serviceUrl.EndsWith("=")) - serviceUrl = serviceUrl + '/'; - m_serverUrl = serviceUrl; - - gridConfig = source.Configs["UserAccountService"]; - if (gridConfig != null) - { - serviceUrl = gridConfig.GetString("UserAccountServerURI"); - if (!String.IsNullOrEmpty(serviceUrl)) - { - m_userServerUrl = serviceUrl; - m_Enabled = true; - } - } + m_userServerUrl = serviceUrl; + m_Enabled = true; } } - - if (String.IsNullOrEmpty(m_serverUrl)) - m_log.Info("[SIMIAN INVENTORY CONNECTOR]: No InventoryServerURI specified, disabling connector"); - else if (String.IsNullOrEmpty(m_userServerUrl)) - m_log.Info("[SIMIAN INVENTORY CONNECTOR]: No UserAccountServerURI specified, disabling connector"); } } + + if (String.IsNullOrEmpty(m_serverUrl)) + m_log.Info("[SIMIAN INVENTORY CONNECTOR]: No InventoryServerURI specified, disabling connector"); + else if (String.IsNullOrEmpty(m_userServerUrl)) + m_log.Info("[SIMIAN INVENTORY CONNECTOR]: No UserAccountServerURI specified, disabling connector"); } /// diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianPresenceServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianPresenceServiceConnector.cs index 074c80f..077be3c 100644 --- a/OpenSim/Services/Connectors/SimianGrid/SimianPresenceServiceConnector.cs +++ b/OpenSim/Services/Connectors/SimianGrid/SimianPresenceServiceConnector.cs @@ -99,7 +99,7 @@ namespace OpenSim.Services.Connectors.SimianGrid public SimianPresenceServiceConnector(IConfigSource source) { - Initialise(source); + CommonInit(source); } public void Initialise(IConfigSource source) @@ -109,24 +109,27 @@ namespace OpenSim.Services.Connectors.SimianGrid { string name = moduleConfig.GetString("PresenceServices", ""); if (name == Name) + CommonInit(source); + } + } + + private void CommonInit(IConfigSource source) + { + IConfig gridConfig = source.Configs["PresenceService"]; + if (gridConfig != null) + { + string serviceUrl = gridConfig.GetString("PresenceServerURI"); + if (!String.IsNullOrEmpty(serviceUrl)) { - IConfig gridConfig = source.Configs["PresenceService"]; - if (gridConfig != null) - { - string serviceUrl = gridConfig.GetString("PresenceServerURI"); - if (!String.IsNullOrEmpty(serviceUrl)) - { - if (!serviceUrl.EndsWith("/") && !serviceUrl.EndsWith("=")) - serviceUrl = serviceUrl + '/'; - m_serverUrl = serviceUrl; - m_Enabled = true; - } - } - - if (String.IsNullOrEmpty(m_serverUrl)) - m_log.Info("[SIMIAN PRESENCE CONNECTOR]: No PresenceServerURI specified, disabling connector"); + if (!serviceUrl.EndsWith("/") && !serviceUrl.EndsWith("=")) + serviceUrl = serviceUrl + '/'; + m_serverUrl = serviceUrl; + m_Enabled = true; } } + + if (String.IsNullOrEmpty(m_serverUrl)) + m_log.Info("[SIMIAN PRESENCE CONNECTOR]: No PresenceServerURI specified, disabling connector"); } #region IPresenceService diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianUserAccountServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianUserAccountServiceConnector.cs index 991c0f3..446ac71 100644 --- a/OpenSim/Services/Connectors/SimianGrid/SimianUserAccountServiceConnector.cs +++ b/OpenSim/Services/Connectors/SimianGrid/SimianUserAccountServiceConnector.cs @@ -73,7 +73,7 @@ namespace OpenSim.Services.Connectors.SimianGrid public SimianUserAccountServiceConnector(IConfigSource source) { - Initialise(source); + CommonInit(source); } public void Initialise(IConfigSource source) @@ -83,24 +83,27 @@ namespace OpenSim.Services.Connectors.SimianGrid { string name = moduleConfig.GetString("UserAccountServices", ""); if (name == Name) - { - IConfig gridConfig = source.Configs["UserAccountService"]; - if (gridConfig != null) - { - string serviceUrl = gridConfig.GetString("UserAccountServerURI"); - if (!String.IsNullOrEmpty(serviceUrl)) - { - if (!serviceUrl.EndsWith("/") && !serviceUrl.EndsWith("=")) - serviceUrl = serviceUrl + '/'; - m_serverUrl = serviceUrl; - m_Enabled = true; - } - } + CommonInit(source); + } + } - if (String.IsNullOrEmpty(m_serverUrl)) - m_log.Info("[SIMIAN ACCOUNT CONNECTOR]: No UserAccountServerURI specified, disabling connector"); + private void CommonInit(IConfigSource source) + { + IConfig gridConfig = source.Configs["UserAccountService"]; + if (gridConfig != null) + { + string serviceUrl = gridConfig.GetString("UserAccountServerURI"); + if (!String.IsNullOrEmpty(serviceUrl)) + { + if (!serviceUrl.EndsWith("/") && !serviceUrl.EndsWith("=")) + serviceUrl = serviceUrl + '/'; + m_serverUrl = serviceUrl; + m_Enabled = true; } } + + if (String.IsNullOrEmpty(m_serverUrl)) + m_log.Info("[SIMIAN ACCOUNT CONNECTOR]: No UserAccountServerURI specified, disabling connector"); } public UserAccount GetUserAccount(UUID scopeID, string firstName, string lastName) -- cgit v1.1 From 029c9548040e0206640f41151f4a4643540bfeff Mon Sep 17 00:00:00 2001 From: John Hurliman Date: Tue, 7 Sep 2010 13:43:36 -0700 Subject: * Added sanity checks to the SimianAssetServiceConnector so it will throw a sensible error message when it is misconfigured instead of a mysterious "Uri is empty" error --- .../SimianGrid/SimianAssetServiceConnector.cs | 30 ++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianAssetServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianAssetServiceConnector.cs index 99e6983..caeabb7 100644 --- a/OpenSim/Services/Connectors/SimianGrid/SimianAssetServiceConnector.cs +++ b/OpenSim/Services/Connectors/SimianGrid/SimianAssetServiceConnector.cs @@ -116,6 +116,12 @@ namespace OpenSim.Services.Connectors.SimianGrid public AssetBase Get(string id) { + if (String.IsNullOrEmpty(m_serverUrl)) + { + m_log.Error("[SIMIAN ASSET CONNECTOR]: No AssetServerURI configured"); + throw new InvalidOperationException(); + } + // Cache fetch if (m_cache != null) { @@ -142,6 +148,12 @@ namespace OpenSim.Services.Connectors.SimianGrid /// public AssetMetadata GetMetadata(string id) { + if (String.IsNullOrEmpty(m_serverUrl)) + { + m_log.Error("[SIMIAN ASSET CONNECTOR]: No AssetServerURI configured"); + throw new InvalidOperationException(); + } + AssetMetadata metadata = null; // Cache fetch @@ -213,6 +225,12 @@ namespace OpenSim.Services.Connectors.SimianGrid /// True if the id was parseable, false otherwise public bool Get(string id, Object sender, AssetRetrieved handler) { + if (String.IsNullOrEmpty(m_serverUrl)) + { + m_log.Error("[SIMIAN ASSET CONNECTOR]: No AssetServerURI configured"); + throw new InvalidOperationException(); + } + // Cache fetch if (m_cache != null) { @@ -243,6 +261,12 @@ namespace OpenSim.Services.Connectors.SimianGrid /// public string Store(AssetBase asset) { + if (String.IsNullOrEmpty(m_serverUrl)) + { + m_log.Error("[SIMIAN ASSET CONNECTOR]: No AssetServerURI configured"); + throw new InvalidOperationException(); + } + bool storedInCache = false; string errorMessage = null; @@ -375,6 +399,12 @@ namespace OpenSim.Services.Connectors.SimianGrid /// public bool Delete(string id) { + if (String.IsNullOrEmpty(m_serverUrl)) + { + m_log.Error("[SIMIAN ASSET CONNECTOR]: No AssetServerURI configured"); + throw new InvalidOperationException(); + } + //string errorMessage = String.Empty; string url = m_serverUrl + id; -- cgit v1.1 From 9be1c0ff448d4ea650ca921937905653b4017d61 Mon Sep 17 00:00:00 2001 From: John Hurliman Date: Tue, 7 Sep 2010 14:41:13 -0700 Subject: * Cache null account responses in the SimianUserAccountServiceConnector to avoid repeated requests for missing avatar IDs * Updated to OpenMetaverse r3442 to fix a timezone issue with ExpiringCache --- OpenSim/Framework/SLUtil.cs | 10 ++++------ .../Region/ClientStack/LindenUDP/LLClientView.cs | 6 +++--- .../LindenUDP/UnackedPacketCollection.cs | 4 ++-- .../Region/CoreModules/Asset/FlotsamAssetCache.cs | 2 +- .../UserAccounts/UserAccountCache.cs | 6 ++++-- .../World/Archiver/Tests/ArchiverTests.cs | 5 ++++- .../Framework/Scenes/Tests/TaskInventoryTests.cs | 4 +++- .../SimianUserAccountServiceConnector.cs | 16 +++++++++++++--- bin/OpenMetaverse.StructuredData.dll | Bin 102400 -> 102400 bytes bin/OpenMetaverse.dll | Bin 1691648 -> 1716224 bytes bin/OpenMetaverseTypes.dll | Bin 106496 -> 114688 bytes 11 files changed, 34 insertions(+), 19 deletions(-) diff --git a/OpenSim/Framework/SLUtil.cs b/OpenSim/Framework/SLUtil.cs index a489806..9941a7f 100644 --- a/OpenSim/Framework/SLUtil.cs +++ b/OpenSim/Framework/SLUtil.cs @@ -46,7 +46,7 @@ namespace OpenSim.Framework case AssetType.Texture: return "image/x-j2c"; case AssetType.Sound: - return "application/ogg"; + return "audio/ogg"; case AssetType.CallingCard: return "application/vnd.ll.callingcard"; case AssetType.Landmark: @@ -98,8 +98,6 @@ namespace OpenSim.Framework return "application/vnd.ll.outfitfolder"; case AssetType.MyOutfitsFolder: return "application/vnd.ll.myoutfitsfolder"; - case AssetType.InboxFolder: - return "application/vnd.ll.inboxfolder"; case AssetType.Unknown: default: return "application/octet-stream"; @@ -128,7 +126,7 @@ namespace OpenSim.Framework case InventoryType.Object: return "application/vnd.ll.primitive"; case InventoryType.Sound: - return "application/ogg"; + return "audio/ogg"; case InventoryType.Snapshot: case InventoryType.Texture: return "image/x-j2c"; @@ -147,6 +145,7 @@ namespace OpenSim.Framework case "image/jp2": return (sbyte)AssetType.Texture; case "application/ogg": + case "audio/ogg": return (sbyte)AssetType.Sound; case "application/vnd.ll.callingcard": case "application/x-metaverse-callingcard": @@ -209,8 +208,6 @@ namespace OpenSim.Framework return (sbyte)AssetType.OutfitFolder; case "application/vnd.ll.myoutfitsfolder": return (sbyte)AssetType.MyOutfitsFolder; - case "application/vnd.ll.inboxfolder": - return (sbyte)AssetType.InboxFolder; case "application/octet-stream": default: return (sbyte)AssetType.Unknown; @@ -227,6 +224,7 @@ namespace OpenSim.Framework case "image/jpeg": return (sbyte)InventoryType.Texture; case "application/ogg": + case "audio/ogg": case "audio/x-wav": return (sbyte)InventoryType.Sound; case "application/vnd.ll.callingcard": diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index 9cdc80b..0925222 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs @@ -3529,9 +3529,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP private void ProcessEntityUpdates(int maxUpdates) { - Lazy> objectUpdateBlocks = new Lazy>(); - Lazy> compressedUpdateBlocks = new Lazy>(); - Lazy> terseUpdateBlocks = new Lazy>(); + OpenMetaverse.Lazy> objectUpdateBlocks = new OpenMetaverse.Lazy>(); + OpenMetaverse.Lazy> compressedUpdateBlocks = new OpenMetaverse.Lazy>(); + OpenMetaverse.Lazy> terseUpdateBlocks = new OpenMetaverse.Lazy>(); if (maxUpdates <= 0) maxUpdates = Int32.MaxValue; int updatesThisCall = 0; diff --git a/OpenSim/Region/ClientStack/LindenUDP/UnackedPacketCollection.cs b/OpenSim/Region/ClientStack/LindenUDP/UnackedPacketCollection.cs index e43f7cf..194c064 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/UnackedPacketCollection.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/UnackedPacketCollection.cs @@ -140,13 +140,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP { // Process all the pending adds OutgoingPacket pendingAdd; - while (m_pendingAdds.Dequeue(out pendingAdd)) + while (m_pendingAdds.TryDequeue(out pendingAdd)) m_packets[pendingAdd.SequenceNumber] = pendingAdd; // Process all the pending removes, including updating statistics and round-trip times PendingAck pendingRemove; OutgoingPacket ackedPacket; - while (m_pendingRemoves.Dequeue(out pendingRemove)) + while (m_pendingRemoves.TryDequeue(out pendingRemove)) { if (m_packets.TryGetValue(pendingRemove.SequenceNumber, out ackedPacket)) { diff --git a/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs b/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs index 9eaa758..5255d30 100644 --- a/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs +++ b/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs @@ -252,7 +252,7 @@ namespace Flotsam.RegionModules.AssetCache } else { - m_MemoryCache.AddOrUpdate(key, asset, DateTime.MaxValue); + m_MemoryCache.AddOrUpdate(key, asset, Double.MaxValue); } } } diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/UserAccountCache.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/UserAccountCache.cs index e1bc243..e7cfda1 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/UserAccountCache.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/UserAccountCache.cs @@ -36,6 +36,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.UserAccounts { public class UserAccountCache { + private const double CACHE_EXPIRATION_SECONDS = 120.0; + private static readonly ILog m_log = LogManager.GetLogger( MethodBase.GetCurrentMethod().DeclaringType); @@ -51,9 +53,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.UserAccounts public void Cache(UUID userID, UserAccount account) { // Cache even null accounts - m_UUIDCache.AddOrUpdate(userID, account, DateTime.Now + TimeSpan.FromMinutes(2.0d)); + m_UUIDCache.AddOrUpdate(userID, account, CACHE_EXPIRATION_SECONDS); if (account != null) - m_NameCache.AddOrUpdate(account.Name, account.PrincipalID, DateTime.Now + TimeSpan.FromMinutes(2.0d)); + m_NameCache.AddOrUpdate(account.Name, account.PrincipalID, CACHE_EXPIRATION_SECONDS); m_log.DebugFormat("[USER CACHE]: cached user {0}", userID); } diff --git a/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs b/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs index 58698ee..0f08408 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs @@ -48,6 +48,7 @@ using OpenSim.Tests.Common.Setup; using ArchiveConstants = OpenSim.Framework.Serialization.ArchiveConstants; using TarArchiveReader = OpenSim.Framework.Serialization.TarArchiveReader; using TarArchiveWriter = OpenSim.Framework.Serialization.TarArchiveWriter; +using RegionSettings = OpenSim.Framework.RegionSettings; namespace OpenSim.Region.CoreModules.World.Archiver.Tests { @@ -135,7 +136,9 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests SceneObjectPart part2 = CreateSceneObjectPart2(); - AssetNotecard nc = new AssetNotecard("Hello World!"); + AssetNotecard nc = new AssetNotecard(); + nc.BodyText = "Hello World!"; + nc.Encode(); UUID ncAssetUuid = new UUID("00000000-0000-0000-1000-000000000000"); UUID ncItemUuid = new UUID("00000000-0000-0000-1100-000000000000"); AssetBase ncAsset diff --git a/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs b/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs index da8199d..5e491c2 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs @@ -75,7 +75,9 @@ namespace OpenSim.Region.Framework.Tests protected TaskInventoryItem CreateSOItem1(Scene scene, SceneObjectPart part) { - AssetNotecard nc = new AssetNotecard("Hello World!"); + AssetNotecard nc = new AssetNotecard(); + nc.BodyText = "Hello World!"; + nc.Encode(); UUID ncAssetUuid = new UUID("00000000-0000-0000-1000-000000000000"); UUID ncItemUuid = new UUID("00000000-0000-0000-1100-000000000000"); AssetBase ncAsset diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianUserAccountServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianUserAccountServiceConnector.cs index 446ac71..23f2b10 100644 --- a/OpenSim/Services/Connectors/SimianGrid/SimianUserAccountServiceConnector.cs +++ b/OpenSim/Services/Connectors/SimianGrid/SimianUserAccountServiceConnector.cs @@ -49,6 +49,8 @@ namespace OpenSim.Services.Connectors.SimianGrid [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] public class SimianUserAccountServiceConnector : IUserAccountService, ISharedRegionModule { + private const double CACHE_EXPIRATION_SECONDS = 120.0; + private static readonly ILog m_log = LogManager.GetLogger( MethodBase.GetCurrentMethod().DeclaringType); @@ -141,7 +143,15 @@ namespace OpenSim.Services.Connectors.SimianGrid { "UserID", userID.ToString() } }; - return GetUser(requestArgs); + account = GetUser(requestArgs); + + if (account == null) + { + // Store null responses too, to avoid repeated lookups for missing accounts + m_accountCache.AddOrUpdate(userID, null, CACHE_EXPIRATION_SECONDS); + } + + return account; } public List GetUserAccounts(UUID scopeID, string query) @@ -216,7 +226,7 @@ namespace OpenSim.Services.Connectors.SimianGrid if (success) { // Cache the user account info - m_accountCache.AddOrUpdate(data.PrincipalID, data, DateTime.Now + TimeSpan.FromMinutes(2.0d)); + m_accountCache.AddOrUpdate(data.PrincipalID, data, CACHE_EXPIRATION_SECONDS); } else { @@ -281,7 +291,7 @@ namespace OpenSim.Services.Connectors.SimianGrid GetFirstLastName(response["Name"].AsString(), out account.FirstName, out account.LastName); // Cache the user account info - m_accountCache.AddOrUpdate(account.PrincipalID, account, DateTime.Now + TimeSpan.FromMinutes(2.0d)); + m_accountCache.AddOrUpdate(account.PrincipalID, account, CACHE_EXPIRATION_SECONDS); return account; } diff --git a/bin/OpenMetaverse.StructuredData.dll b/bin/OpenMetaverse.StructuredData.dll index 54681e4..7909076 100644 Binary files a/bin/OpenMetaverse.StructuredData.dll and b/bin/OpenMetaverse.StructuredData.dll differ diff --git a/bin/OpenMetaverse.dll b/bin/OpenMetaverse.dll index 59e39bb..12a2940 100644 Binary files a/bin/OpenMetaverse.dll and b/bin/OpenMetaverse.dll differ diff --git a/bin/OpenMetaverseTypes.dll b/bin/OpenMetaverseTypes.dll index 01dc3d8..1329aa7 100644 Binary files a/bin/OpenMetaverseTypes.dll and b/bin/OpenMetaverseTypes.dll differ -- cgit v1.1 From 0bebe94231c3b5aeaa24a0eeb38272a08b73473b Mon Sep 17 00:00:00 2001 From: John Hurliman Date: Tue, 7 Sep 2010 15:45:33 -0700 Subject: Rolling back the recent libomv update but keeping the ExpiringCache cleanups (as much as is possible). There was a report of non-finite avatar positions after the update --- .../Region/ClientStack/LindenUDP/LLClientView.cs | 6 +++--- .../LindenUDP/UnackedPacketCollection.cs | 4 ++-- .../Region/CoreModules/Asset/FlotsamAssetCache.cs | 2 +- .../UserAccounts/UserAccountCache.cs | 4 ++-- .../SimianUserAccountServiceConnector.cs | 6 +++--- bin/OpenMetaverse.StructuredData.dll | Bin 102400 -> 102400 bytes bin/OpenMetaverse.dll | Bin 1716224 -> 1691648 bytes bin/OpenMetaverseTypes.dll | Bin 114688 -> 106496 bytes 8 files changed, 11 insertions(+), 11 deletions(-) diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index 0925222..cdf8cb1 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs @@ -3529,9 +3529,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP private void ProcessEntityUpdates(int maxUpdates) { - OpenMetaverse.Lazy> objectUpdateBlocks = new OpenMetaverse.Lazy>(); - OpenMetaverse.Lazy> compressedUpdateBlocks = new OpenMetaverse.Lazy>(); - OpenMetaverse.Lazy> terseUpdateBlocks = new OpenMetaverse.Lazy>(); + OpenSim.Framework.Lazy> objectUpdateBlocks = new OpenSim.Framework.Lazy>(); + OpenSim.Framework.Lazy> compressedUpdateBlocks = new OpenSim.Framework.Lazy>(); + OpenSim.Framework.Lazy> terseUpdateBlocks = new OpenSim.Framework.Lazy>(); if (maxUpdates <= 0) maxUpdates = Int32.MaxValue; int updatesThisCall = 0; diff --git a/OpenSim/Region/ClientStack/LindenUDP/UnackedPacketCollection.cs b/OpenSim/Region/ClientStack/LindenUDP/UnackedPacketCollection.cs index 194c064..e43f7cf 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/UnackedPacketCollection.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/UnackedPacketCollection.cs @@ -140,13 +140,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP { // Process all the pending adds OutgoingPacket pendingAdd; - while (m_pendingAdds.TryDequeue(out pendingAdd)) + while (m_pendingAdds.Dequeue(out pendingAdd)) m_packets[pendingAdd.SequenceNumber] = pendingAdd; // Process all the pending removes, including updating statistics and round-trip times PendingAck pendingRemove; OutgoingPacket ackedPacket; - while (m_pendingRemoves.TryDequeue(out pendingRemove)) + while (m_pendingRemoves.Dequeue(out pendingRemove)) { if (m_packets.TryGetValue(pendingRemove.SequenceNumber, out ackedPacket)) { diff --git a/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs b/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs index 5255d30..9eaa758 100644 --- a/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs +++ b/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs @@ -252,7 +252,7 @@ namespace Flotsam.RegionModules.AssetCache } else { - m_MemoryCache.AddOrUpdate(key, asset, Double.MaxValue); + m_MemoryCache.AddOrUpdate(key, asset, DateTime.MaxValue); } } } diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/UserAccountCache.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/UserAccountCache.cs index e7cfda1..7c12b8c 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/UserAccountCache.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/UserAccountCache.cs @@ -53,9 +53,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.UserAccounts public void Cache(UUID userID, UserAccount account) { // Cache even null accounts - m_UUIDCache.AddOrUpdate(userID, account, CACHE_EXPIRATION_SECONDS); + m_UUIDCache.AddOrUpdate(userID, account, DateTime.Now + TimeSpan.FromSeconds(CACHE_EXPIRATION_SECONDS)); if (account != null) - m_NameCache.AddOrUpdate(account.Name, account.PrincipalID, CACHE_EXPIRATION_SECONDS); + m_NameCache.AddOrUpdate(account.Name, account.PrincipalID, DateTime.Now + TimeSpan.FromSeconds(CACHE_EXPIRATION_SECONDS)); m_log.DebugFormat("[USER CACHE]: cached user {0}", userID); } diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianUserAccountServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianUserAccountServiceConnector.cs index 23f2b10..1ac9882 100644 --- a/OpenSim/Services/Connectors/SimianGrid/SimianUserAccountServiceConnector.cs +++ b/OpenSim/Services/Connectors/SimianGrid/SimianUserAccountServiceConnector.cs @@ -148,7 +148,7 @@ namespace OpenSim.Services.Connectors.SimianGrid if (account == null) { // Store null responses too, to avoid repeated lookups for missing accounts - m_accountCache.AddOrUpdate(userID, null, CACHE_EXPIRATION_SECONDS); + m_accountCache.AddOrUpdate(userID, null, DateTime.Now + TimeSpan.FromSeconds(CACHE_EXPIRATION_SECONDS)); } return account; @@ -226,7 +226,7 @@ namespace OpenSim.Services.Connectors.SimianGrid if (success) { // Cache the user account info - m_accountCache.AddOrUpdate(data.PrincipalID, data, CACHE_EXPIRATION_SECONDS); + m_accountCache.AddOrUpdate(data.PrincipalID, data, DateTime.Now + TimeSpan.FromSeconds(CACHE_EXPIRATION_SECONDS)); } else { @@ -291,7 +291,7 @@ namespace OpenSim.Services.Connectors.SimianGrid GetFirstLastName(response["Name"].AsString(), out account.FirstName, out account.LastName); // Cache the user account info - m_accountCache.AddOrUpdate(account.PrincipalID, account, CACHE_EXPIRATION_SECONDS); + m_accountCache.AddOrUpdate(account.PrincipalID, account, DateTime.Now + TimeSpan.FromSeconds(CACHE_EXPIRATION_SECONDS)); return account; } diff --git a/bin/OpenMetaverse.StructuredData.dll b/bin/OpenMetaverse.StructuredData.dll index 7909076..54681e4 100644 Binary files a/bin/OpenMetaverse.StructuredData.dll and b/bin/OpenMetaverse.StructuredData.dll differ diff --git a/bin/OpenMetaverse.dll b/bin/OpenMetaverse.dll index 12a2940..59e39bb 100644 Binary files a/bin/OpenMetaverse.dll and b/bin/OpenMetaverse.dll differ diff --git a/bin/OpenMetaverseTypes.dll b/bin/OpenMetaverseTypes.dll index 1329aa7..01dc3d8 100644 Binary files a/bin/OpenMetaverseTypes.dll and b/bin/OpenMetaverseTypes.dll differ -- cgit v1.1 From 904d6b787a7fc399544145ae023162d6fa43fb63 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Wed, 8 Sep 2010 09:53:57 -0700 Subject: First version of the Hypergrid HELO service that will enable different backends to interoperate. --- .../Handlers/Hypergrid/HeloServerConnector.cs | 85 ++++++++++++++++++++++ .../Connectors/Hypergrid/HeloServiceConnector.cs | 75 +++++++++++++++++++ 2 files changed, 160 insertions(+) create mode 100644 OpenSim/Server/Handlers/Hypergrid/HeloServerConnector.cs create mode 100644 OpenSim/Services/Connectors/Hypergrid/HeloServiceConnector.cs diff --git a/OpenSim/Server/Handlers/Hypergrid/HeloServerConnector.cs b/OpenSim/Server/Handlers/Hypergrid/HeloServerConnector.cs new file mode 100644 index 0000000..3b25a52 --- /dev/null +++ b/OpenSim/Server/Handlers/Hypergrid/HeloServerConnector.cs @@ -0,0 +1,85 @@ +/* + * Copyright (c) Contributors, http://opensimulator.org/ + * See CONTRIBUTORS.TXT for a full list of copyright holders. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the OpenSimulator Project nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +using System; +using System.Collections.Generic; +using System.IO; +using System.Net; +using System.Reflection; +using Nini.Config; +using log4net; +using OpenSim.Server.Base; +using OpenSim.Services.Interfaces; +using OpenSim.Framework.Servers.HttpServer; +using OpenSim.Server.Handlers.Base; + +namespace OpenSim.Server.Handlers.Hypergrid +{ + public class HeloServiceConnector : ServiceConnector + { + private string m_ConfigName = "HeloService"; + + public HeloServiceConnector(IConfigSource config, IHttpServer server, string configName) : + base(config, server, configName) + { + IConfig serverConfig = config.Configs[m_ConfigName]; + if (serverConfig == null) + throw new Exception(String.Format("No section {0} in config file", m_ConfigName)); + + string handlers = serverConfig.GetString("Handlers", "opensim-robust"); + server.AddStreamHandler(new HeloServerGetHandler(handlers)); + } + } + + public class HeloServerGetHandler : BaseStreamHandler + { + private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + + private string m_HandlersType; + + public HeloServerGetHandler(string handlersType) : + base("GET", "/helo") + { + m_HandlersType = handlersType; + } + + public override byte[] Handle(string path, Stream requestData, + OSHttpRequest httpRequest, OSHttpResponse httpResponse) + { + return OKResponse(httpResponse); + } + + private byte[] OKResponse(OSHttpResponse httpResponse) + { + httpResponse.AddHeader("X-Handlers-Provided", m_HandlersType); + httpResponse.StatusCode = (int)HttpStatusCode.OK; + httpResponse.StatusDescription = "OK"; + return new byte[0]; + } + + } +} diff --git a/OpenSim/Services/Connectors/Hypergrid/HeloServiceConnector.cs b/OpenSim/Services/Connectors/Hypergrid/HeloServiceConnector.cs new file mode 100644 index 0000000..7b166c1 --- /dev/null +++ b/OpenSim/Services/Connectors/Hypergrid/HeloServiceConnector.cs @@ -0,0 +1,75 @@ +/* + * Copyright (c) Contributors, http://opensimulator.org/ + * See CONTRIBUTORS.TXT for a full list of copyright holders. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the OpenSimulator Project nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +using log4net; +using System; +using System.Net; +using System.Reflection; +using Nini.Config; + +namespace OpenSim.Services.Connectors +{ + public class HeloServicesConnector + { + private static readonly ILog m_log = + LogManager.GetLogger( + MethodBase.GetCurrentMethod().DeclaringType); + + private string m_ServerURI = String.Empty; + + public HeloServicesConnector() + { + } + + public HeloServicesConnector(string serverURI) + { + m_ServerURI = serverURI.TrimEnd('/'); + } + + + public virtual string Helo() + { + HttpWebRequest req = (HttpWebRequest)HttpWebRequest.Create(m_ServerURI + "/helo"); + + try + { + WebResponse response = req.GetResponse(); + if (response.Headers.Get("X-Handlers-Provided") == null) // just in case this ever returns a null + return string.Empty; + return response.Headers.Get("X-Handlers-Provided"); + } + catch (Exception e) + { + m_log.DebugFormat("[HELO SERVICE]: Unable to perform HELO request to {0}: {1}", m_ServerURI, e.Message); + } + + // fail + return string.Empty; + } + + } +} -- cgit v1.1 From 3fb4a17f1044f5bd995f703233f656f72ebe5269 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Wed, 8 Sep 2010 11:30:38 -0700 Subject: No need for a config var for the HELO message on the server-side. It's robust. --- OpenSim/Server/Handlers/Hypergrid/HeloServerConnector.cs | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/OpenSim/Server/Handlers/Hypergrid/HeloServerConnector.cs b/OpenSim/Server/Handlers/Hypergrid/HeloServerConnector.cs index 3b25a52..6c83aff 100644 --- a/OpenSim/Server/Handlers/Hypergrid/HeloServerConnector.cs +++ b/OpenSim/Server/Handlers/Hypergrid/HeloServerConnector.cs @@ -41,17 +41,10 @@ namespace OpenSim.Server.Handlers.Hypergrid { public class HeloServiceConnector : ServiceConnector { - private string m_ConfigName = "HeloService"; - public HeloServiceConnector(IConfigSource config, IHttpServer server, string configName) : base(config, server, configName) { - IConfig serverConfig = config.Configs[m_ConfigName]; - if (serverConfig == null) - throw new Exception(String.Format("No section {0} in config file", m_ConfigName)); - - string handlers = serverConfig.GetString("Handlers", "opensim-robust"); - server.AddStreamHandler(new HeloServerGetHandler(handlers)); + server.AddStreamHandler(new HeloServerGetHandler("opensim-robust")); } } -- cgit v1.1 From 8cc3d60e59b631951618d6b89c8ba54a72061bc4 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Wed, 8 Sep 2010 14:09:43 -0700 Subject: Added constructor that takes an URL to asset and inventory simian connectors. --- .../Services/Connectors/SimianGrid/SimianAssetServiceConnector.cs | 5 +++++ .../Connectors/SimianGrid/SimianInventoryServiceConnector.cs | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianAssetServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianAssetServiceConnector.cs index 8f601e8..30d3147 100644 --- a/OpenSim/Services/Connectors/SimianGrid/SimianAssetServiceConnector.cs +++ b/OpenSim/Services/Connectors/SimianGrid/SimianAssetServiceConnector.cs @@ -84,6 +84,11 @@ namespace OpenSim.Services.Connectors.SimianGrid CommonInit(source); } + public SimianAssetServiceConnector(string url) + { + m_serverUrl = url; + } + public void Initialise(IConfigSource source) { IConfig moduleConfig = source.Configs["Modules"]; diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianInventoryServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianInventoryServiceConnector.cs index 470eccd..3953369 100644 --- a/OpenSim/Services/Connectors/SimianGrid/SimianInventoryServiceConnector.cs +++ b/OpenSim/Services/Connectors/SimianGrid/SimianInventoryServiceConnector.cs @@ -91,6 +91,11 @@ namespace OpenSim.Services.Connectors.SimianGrid CommonInit(source); } + public SimianInventoryServiceConnector(string url) + { + m_serverUrl = url; + } + public void Initialise(IConfigSource source) { IConfig moduleConfig = source.Configs["Modules"]; -- cgit v1.1 From d301f3fd6ad65e3eb39cfaff65cd3fbb896fa5c1 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Wed, 8 Sep 2010 14:12:01 -0700 Subject: Renamed the Helo server connector to a consistent name. Added this in connector to both Robust.HG.ini.example and HypergridServiceInConnectorModule. --- .../Hypergrid/HypergridServiceInConnectorModule.cs | 1 + OpenSim/Server/Handlers/Hypergrid/HeloServerConnector.cs | 5 +++-- bin/Robust.HG.ini.example | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsIn/Hypergrid/HypergridServiceInConnectorModule.cs b/OpenSim/Region/CoreModules/ServiceConnectorsIn/Hypergrid/HypergridServiceInConnectorModule.cs index 235914a..2f96bcb 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsIn/Hypergrid/HypergridServiceInConnectorModule.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsIn/Hypergrid/HypergridServiceInConnectorModule.cs @@ -115,6 +115,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsIn.Hypergrid m_HypergridHandler = new GatekeeperServiceInConnector(m_Config, MainServer.Instance, simService); new UserAgentServerConnector(m_Config, MainServer.Instance); + new HeloServiceInConnector(m_Config, MainServer.Instance, "HeloService"); } scene.RegisterModuleInterface(m_HypergridHandler.GateKeeper); } diff --git a/OpenSim/Server/Handlers/Hypergrid/HeloServerConnector.cs b/OpenSim/Server/Handlers/Hypergrid/HeloServerConnector.cs index 6c83aff..39baa32 100644 --- a/OpenSim/Server/Handlers/Hypergrid/HeloServerConnector.cs +++ b/OpenSim/Server/Handlers/Hypergrid/HeloServerConnector.cs @@ -39,9 +39,9 @@ using OpenSim.Server.Handlers.Base; namespace OpenSim.Server.Handlers.Hypergrid { - public class HeloServiceConnector : ServiceConnector + public class HeloServiceInConnector : ServiceConnector { - public HeloServiceConnector(IConfigSource config, IHttpServer server, string configName) : + public HeloServiceInConnector(IConfigSource config, IHttpServer server, string configName) : base(config, server, configName) { server.AddStreamHandler(new HeloServerGetHandler("opensim-robust")); @@ -68,6 +68,7 @@ namespace OpenSim.Server.Handlers.Hypergrid private byte[] OKResponse(OSHttpResponse httpResponse) { + m_log.Debug("[HELO]: hi, I was called"); httpResponse.AddHeader("X-Handlers-Provided", m_HandlersType); httpResponse.StatusCode = (int)HttpStatusCode.OK; httpResponse.StatusDescription = "OK"; diff --git a/bin/Robust.HG.ini.example b/bin/Robust.HG.ini.example index dae7a19..deceb86 100644 --- a/bin/Robust.HG.ini.example +++ b/bin/Robust.HG.ini.example @@ -21,7 +21,7 @@ ; * [[@]/][:] ; * [Startup] -ServiceConnectors = "8003/OpenSim.Server.Handlers.dll:AssetServiceConnector,8003/OpenSim.Server.Handlers.dll:XInventoryInConnector,8002/OpenSim.Server.Handlers.dll:FreeswitchServerConnector,8003/OpenSim.Server.Handlers.dll:GridServiceConnector,8002/OpenSim.Server.Handlers.dll:GridInfoServerInConnector,8003/OpenSim.Server.Handlers.dll:AuthenticationServiceConnector,8002/OpenSim.Server.Handlers.dll:OpenIdServerConnector,8003/OpenSim.Server.Handlers.dll:AvatarServiceConnector,8002/OpenSim.Server.Handlers.dll:LLLoginServiceInConnector,8003/OpenSim.Server.Handlers.dll:PresenceServiceConnector,8003/OpenSim.Server.Handlers.dll:UserAccountServiceConnector,8003/OpenSim.Server.Handlers.dll:GridUserServiceConnector,8003/OpenSim.Server.Handlers.dll:FriendsServiceConnector,8002/OpenSim.Server.Handlers.dll:GatekeeperServiceInConnector,8002/OpenSim.Server.Handlers.dll:UserAgentServerConnector,HGInventoryService@8002/OpenSim.Server.Handlers.dll:XInventoryInConnector,8002/OpenSim.Server.Handlers.dll:AssetServiceConnector" +ServiceConnectors = "8003/OpenSim.Server.Handlers.dll:AssetServiceConnector,8003/OpenSim.Server.Handlers.dll:XInventoryInConnector,8002/OpenSim.Server.Handlers.dll:FreeswitchServerConnector,8003/OpenSim.Server.Handlers.dll:GridServiceConnector,8002/OpenSim.Server.Handlers.dll:GridInfoServerInConnector,8003/OpenSim.Server.Handlers.dll:AuthenticationServiceConnector,8002/OpenSim.Server.Handlers.dll:OpenIdServerConnector,8003/OpenSim.Server.Handlers.dll:AvatarServiceConnector,8002/OpenSim.Server.Handlers.dll:LLLoginServiceInConnector,8003/OpenSim.Server.Handlers.dll:PresenceServiceConnector,8003/OpenSim.Server.Handlers.dll:UserAccountServiceConnector,8003/OpenSim.Server.Handlers.dll:GridUserServiceConnector,8003/OpenSim.Server.Handlers.dll:FriendsServiceConnector,8002/OpenSim.Server.Handlers.dll:GatekeeperServiceInConnector,8002/OpenSim.Server.Handlers.dll:UserAgentServerConnector,HGInventoryService@8002/OpenSim.Server.Handlers.dll:XInventoryInConnector,8002/OpenSim.Server.Handlers.dll:AssetServiceConnector,8002/OpenSim.Server.Handlers.dll:HeloServiceInConnector" ; * This is common for all services, it's the network setup for the entire ; * server instance, if none if specified above -- cgit v1.1 From ae6682036df0268b47a27756915c72367663efec Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Wed, 8 Sep 2010 14:13:01 -0700 Subject: Made the HG asset and inventory brokers use the Helo service in order to instantiate the right network connectors. Tested on Robust only. --- .../Inventory/HGInventoryBroker.cs | 15 ++++++++------ .../Connectors/Asset/HGAssetServiceConnector.cs | 23 ++++++++++++++-------- 2 files changed, 24 insertions(+), 14 deletions(-) diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs index 5b4fecb..39410b5 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs @@ -37,6 +37,7 @@ using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; using OpenSim.Services.Interfaces; using OpenSim.Services.Connectors; +using OpenSim.Services.Connectors.SimianGrid; using OpenMetaverse; namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory @@ -538,12 +539,14 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory } else { - // We're instantiating this class explicitly, but this won't - // work in general, because the remote grid may be running - // an inventory server that has a different protocol. - // Eventually we will want a piece of protocol asking - // the remote server about its kind. Definitely cool thing to do! - connector = new RemoteXInventoryServicesConnector(url); + // Still not as flexible as I would like this to be, + // but good enough for now + string connectorType = new HeloServicesConnector(url).Helo(); + m_log.DebugFormat("[HG INVENTORY SERVICE]: HELO returned {0}", connectorType); + if (connectorType == "opensim-simian") + connector = new SimianInventoryServiceConnector(url); + else + connector = new RemoteXInventoryServicesConnector(url); m_connectors.Add(url, connector); } } diff --git a/OpenSim/Services/Connectors/Asset/HGAssetServiceConnector.cs b/OpenSim/Services/Connectors/Asset/HGAssetServiceConnector.cs index 34df54a..5c31639 100644 --- a/OpenSim/Services/Connectors/Asset/HGAssetServiceConnector.cs +++ b/OpenSim/Services/Connectors/Asset/HGAssetServiceConnector.cs @@ -32,6 +32,8 @@ using System.Collections.Generic; using System.Reflection; using OpenSim.Framework; using OpenSim.Services.Interfaces; +using OpenSim.Services.Connectors.Hypergrid; +using OpenSim.Services.Connectors.SimianGrid; namespace OpenSim.Services.Connectors { @@ -41,7 +43,7 @@ namespace OpenSim.Services.Connectors LogManager.GetLogger( MethodBase.GetCurrentMethod().DeclaringType); - private Dictionary m_connectors = new Dictionary(); + private Dictionary m_connectors = new Dictionary(); public HGAssetServiceConnector(IConfigSource source) { @@ -81,7 +83,7 @@ namespace OpenSim.Services.Connectors private IAssetService GetConnector(string url) { - AssetServicesConnector connector = null; + IAssetService connector = null; lock (m_connectors) { if (m_connectors.ContainsKey(url)) @@ -90,12 +92,17 @@ namespace OpenSim.Services.Connectors } else { - // We're instantiating this class explicitly, but this won't - // work in general, because the remote grid may be running - // an asset server that has a different protocol. - // Eventually we will want a piece of protocol asking - // the remote server about its kind. Definitely cool thing to do! - connector = new AssetServicesConnector(url); + // Still not as flexible as I would like this to be, + // but good enough for now + string connectorType = new HeloServicesConnector(url).Helo(); + m_log.DebugFormat("[HG ASSET SERVICE]: HELO returned {0}", connectorType); + if (connectorType == "opensim-simian") + { + connector = new SimianAssetServiceConnector(url); + } + else + connector = new AssetServicesConnector(url); + m_connectors.Add(url, connector); } } -- cgit v1.1 From 5dc9ea2f2487804d788b4b80d40d91bd792de4c2 Mon Sep 17 00:00:00 2001 From: John Hurliman Date: Wed, 8 Sep 2010 15:08:49 -0700 Subject: * Changed 11 calls for session info to the more optimized API method --- .../CoreModules/Avatar/Friends/FriendsModule.cs | 100 +++++++-------------- .../Avatar/InstantMessage/MessageTransferModule.cs | 4 +- .../Shared/Api/Implementation/LSL_Api.cs | 10 +-- .../Connectors/SimianGrid/SimianProfiles.cs | 4 +- 4 files changed, 37 insertions(+), 81 deletions(-) diff --git a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs index 6f044cb..1c1ba2d 100644 --- a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs @@ -348,10 +348,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends UserAccount account = m_Scenes[0].UserAccountService.GetUserAccount(client.Scene.RegionInfo.ScopeID, new UUID(im.fromAgentID)); im.fromAgentName = account.FirstName + " " + account.LastName; - PresenceInfo presence = null; - PresenceInfo[] presences = PresenceService.GetAgents(new string[] { fid }); - if (presences != null && presences.Length > 0) - presence = presences[0]; + PresenceInfo presence = PresenceService.GetAgent(new UUID(im.fromAgentID)); if (presence != null) im.offline = 0; @@ -470,26 +467,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends return; // The friend is not here [as root]. Let's forward. - PresenceInfo[] friendSessions = PresenceService.GetAgents(new string[] { friendID.ToString() }); - if (friendSessions != null && friendSessions.Length > 0) + PresenceInfo friendSession = PresenceService.GetAgent(friendID); + if (friendSession != null && friendSession.RegionID != UUID.Zero) // let's guard against sessions-gone-bad with the RegionID check { - PresenceInfo friendSession = null; - foreach (PresenceInfo pinfo in friendSessions) - if (pinfo.RegionID != UUID.Zero) // let's guard against sessions-gone-bad - { - friendSession = pinfo; - break; - } - - if (friendSession != null) - { - GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID); - //m_log.DebugFormat("[FRIENDS]: Remote Notify to region {0}", region.RegionName); - m_FriendsSimConnector.StatusNotify(region, userID, friendID, online); - } + GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID); + //m_log.DebugFormat("[FRIENDS]: Remote Notify to region {0}", region.RegionName); + m_FriendsSimConnector.StatusNotify(region, userID, friendID, online); } - - // Friend is not online. Ignore. } else m_log.WarnFormat("[FRIENDS]: Error parsing friend ID {0}", friend.Friend); @@ -528,15 +512,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends return; // The prospective friend is not here [as root]. Let's forward. - PresenceInfo[] friendSessions = PresenceService.GetAgents(new string[] { friendID.ToString() }); - if (friendSessions != null && friendSessions.Length > 0) + PresenceInfo friendSession = PresenceService.GetAgent(friendID); + if (friendSession != null) { - PresenceInfo friendSession = friendSessions[0]; - if (friendSession != null) - { - GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID); - m_FriendsSimConnector.FriendshipOffered(region, agentID, friendID, im.message); - } + GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID); + m_FriendsSimConnector.FriendshipOffered(region, agentID, friendID, im.message); } // If the prospective friend is not online, he'll get the message upon login. } @@ -563,16 +543,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends } // The friend is not here - PresenceInfo[] friendSessions = PresenceService.GetAgents(new string[] { friendID.ToString() }); - if (friendSessions != null && friendSessions.Length > 0) + PresenceInfo friendSession = PresenceService.GetAgent(friendID); + if (friendSession != null) { - PresenceInfo friendSession = friendSessions[0]; - if (friendSession != null) - { - GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID); - m_FriendsSimConnector.FriendshipApproved(region, agentID, client.Name, friendID); - client.SendAgentOnline(new UUID[] { friendID }); - } + GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID); + m_FriendsSimConnector.FriendshipApproved(region, agentID, client.Name, friendID); + client.SendAgentOnline(new UUID[] { friendID }); } } @@ -591,18 +567,14 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends if (LocalFriendshipDenied(agentID, client.Name, friendID)) return; - PresenceInfo[] friendSessions = PresenceService.GetAgents(new string[] { friendID.ToString() }); - if (friendSessions != null && friendSessions.Length > 0) + PresenceInfo friendSession = PresenceService.GetAgent(friendID); + if (friendSession != null) { - PresenceInfo friendSession = friendSessions[0]; - if (friendSession != null) - { - GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID); - if (region != null) - m_FriendsSimConnector.FriendshipDenied(region, agentID, client.Name, friendID); - else - m_log.WarnFormat("[FRIENDS]: Could not find region {0} in locating {1}", friendSession.RegionID, friendID); - } + GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID); + if (region != null) + m_FriendsSimConnector.FriendshipDenied(region, agentID, client.Name, friendID); + else + m_log.WarnFormat("[FRIENDS]: Could not find region {0} in locating {1}", friendSession.RegionID, friendID); } } @@ -624,15 +596,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends if (LocalFriendshipTerminated(exfriendID)) return; - PresenceInfo[] friendSessions = PresenceService.GetAgents(new string[] { exfriendID.ToString() }); - if (friendSessions != null && friendSessions.Length > 0) + PresenceInfo friendSession = PresenceService.GetAgent(exfriendID); + if (friendSession != null) { - PresenceInfo friendSession = friendSessions[0]; - if (friendSession != null) - { - GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID); - m_FriendsSimConnector.FriendshipTerminated(region, agentID, exfriendID); - } + GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID); + m_FriendsSimConnector.FriendshipTerminated(region, agentID, exfriendID); } } @@ -669,17 +637,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends if (LocalGrantRights(requester, target, myFlags, rights)) return; - PresenceInfo[] friendSessions = PresenceService.GetAgents(new string[] { target.ToString() }); - if (friendSessions != null && friendSessions.Length > 0) + PresenceInfo friendSession = PresenceService.GetAgent(target); + if (friendSession != null) { - PresenceInfo friendSession = friendSessions[0]; - if (friendSession != null) - { - GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID); - // TODO: You might want to send the delta to save the lookup - // on the other end!! - m_FriendsSimConnector.GrantRights(region, requester, target, myFlags, rights); - } + GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID); + // TODO: You might want to send the delta to save the lookup + // on the other end!! + m_FriendsSimConnector.GrantRights(region, requester, target, myFlags, rights); } } } diff --git a/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs b/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs index 730cc77..13bae2e 100644 --- a/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs @@ -498,9 +498,7 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage if (lookupAgent) { // Non-cached user agent lookup. - PresenceInfo[] presences = PresenceService.GetAgents(new string[] { toAgentID.ToString() }); - if (presences != null && presences.Length > 0) - upd = presences[0]; + upd = PresenceService.GetAgent(toAgentID); if (upd != null) { diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index b51b410..a9c5d10 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -3971,9 +3971,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } - PresenceInfo[] pinfos = World.PresenceService.GetAgents(new string[] { uuid.ToString() }); - if (pinfos != null && pinfos.Length > 0) - pinfo = pinfos[0]; + pinfo = World.PresenceService.GetAgent(uuid); ce = new UserInfoCacheEntry(); ce.time = Util.EnvironmentTickCount(); @@ -3991,11 +3989,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (Util.EnvironmentTickCount() < ce.time || (Util.EnvironmentTickCount() - ce.time) >= 20000) { - PresenceInfo[] pinfos = World.PresenceService.GetAgents(new string[] { uuid.ToString() }); - if (pinfos != null && pinfos.Length > 0) - pinfo = pinfos[0]; - else - pinfo = null; + pinfo = World.PresenceService.GetAgent(uuid); ce.time = Util.EnvironmentTickCount(); ce.pinfo = pinfo; diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianProfiles.cs b/OpenSim/Services/Connectors/SimianGrid/SimianProfiles.cs index 0ef4974..b7e8538 100644 --- a/OpenSim/Services/Connectors/SimianGrid/SimianProfiles.cs +++ b/OpenSim/Services/Connectors/SimianGrid/SimianProfiles.cs @@ -291,8 +291,8 @@ namespace OpenSim.Services.Connectors.SimianGrid // Check if the user is online if (client.Scene is Scene) { - OpenSim.Services.Interfaces.PresenceInfo[] presences = ((Scene)client.Scene).PresenceService.GetAgents(new string[] { avatarID.ToString() }); - if (presences != null && presences.Length > 0) + OpenSim.Services.Interfaces.PresenceInfo presence = ((Scene)client.Scene).PresenceService.GetAgent(avatarID); + if (presence != null) flags |= ProfileFlags.Online; } -- cgit v1.1 From 8415b988063234ab7686b873520708891bca50a6 Mon Sep 17 00:00:00 2001 From: John Hurliman Date: Thu, 9 Sep 2010 14:45:10 -0700 Subject: Over a dozen thread safety fixes in FriendsModule --- .../CoreModules/Avatar/Friends/FriendsModule.cs | 330 ++++++++++----------- 1 file changed, 163 insertions(+), 167 deletions(-) diff --git a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs index 1c1ba2d..4e4eee9 100644 --- a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs @@ -54,7 +54,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends public UUID PrincipalID; public FriendInfo[] Friends; public int Refcount; - public UUID RegionID; public bool IsFriend(string friend) { @@ -67,7 +66,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends return false; } } - + + private static readonly FriendInfo[] EMPTY_FRIENDS = new FriendInfo[0]; private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); protected List m_Scenes = new List(); @@ -79,7 +79,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends protected Dictionary m_Friends = new Dictionary(); - protected List m_NeedsListOfFriends = new List(); + protected HashSet m_NeedsListOfFriends = new HashSet(); protected IPresenceService PresenceService { @@ -146,7 +146,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends // Instantiate the request handler IHttpServer server = MainServer.GetHttpServer((uint)mPort); server.AddStreamHandler(new FriendsRequestHandler(this)); - } if (m_FriendsService == null) @@ -173,7 +172,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends scene.EventManager.OnNewClient += OnNewClient; scene.EventManager.OnClientClosed += OnClientClosed; scene.EventManager.OnMakeRootAgent += OnMakeRootAgent; - scene.EventManager.OnMakeChildAgent += OnMakeChildAgent; scene.EventManager.OnClientLogin += OnClientLogin; } @@ -198,16 +196,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends public uint GetFriendPerms(UUID principalID, UUID friendID) { - if (!m_Friends.ContainsKey(principalID)) - return 0; - - UserFriendData data = m_Friends[principalID]; - - foreach (FriendInfo fi in data.Friends) + FriendInfo[] friends = GetFriends(principalID); + foreach (FriendInfo fi in friends) { if (fi.Friend == friendID.ToString()) return (uint)fi.TheirFlags; } + return 0; } @@ -217,73 +212,59 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends client.OnApproveFriendRequest += OnApproveFriendRequest; client.OnDenyFriendRequest += OnDenyFriendRequest; client.OnTerminateFriendship += OnTerminateFriendship; - client.OnGrantUserRights += OnGrantUserRights; - lock (m_Friends) - { - if (m_Friends.ContainsKey(client.AgentId)) + // Asynchronously fetch the friends list or increment the refcount for the existing + // friends list + Util.FireAndForget( + delegate(object o) { - m_Friends[client.AgentId].Refcount++; - return; - } - - UserFriendData newFriends = new UserFriendData(); - - newFriends.PrincipalID = client.AgentId; - newFriends.Friends = m_FriendsService.GetFriends(client.AgentId); - newFriends.Refcount = 1; - newFriends.RegionID = UUID.Zero; + lock (m_Friends) + { + UserFriendData friendsData; + if (m_Friends.TryGetValue(client.AgentId, out friendsData)) + { + friendsData.Refcount++; + } + else + { + friendsData = new UserFriendData(); + friendsData.PrincipalID = client.AgentId; + friendsData.Friends = FriendsService.GetFriends(client.AgentId); + friendsData.Refcount = 1; - m_Friends.Add(client.AgentId, newFriends); - } - + m_Friends[client.AgentId] = friendsData; + } + } + } + ); } private void OnClientClosed(UUID agentID, Scene scene) { ScenePresence sp = scene.GetScenePresence(agentID); if (sp != null && !sp.IsChildAgent) + { // do this for root agents closing out StatusChange(agentID, false); + } lock (m_Friends) - if (m_Friends.ContainsKey(agentID)) + { + UserFriendData friendsData; + if (m_Friends.TryGetValue(agentID, out friendsData)) { - if (m_Friends[agentID].Refcount == 1) + friendsData.Refcount--; + if (friendsData.Refcount <= 0) m_Friends.Remove(agentID); - else - m_Friends[agentID].Refcount--; } - } - - private void OnMakeRootAgent(ScenePresence sp) - { - UUID agentID = sp.ControllingClient.AgentId; - - if (m_Friends.ContainsKey(agentID)) - { - // This is probably an overkill, but just - // to make sure we have the latest and greatest - // friends list -- always pull OnMakeRoot - m_Friends[agentID].Friends = - m_FriendsService.GetFriends(agentID); - - m_Friends[agentID].RegionID = - sp.ControllingClient.Scene.RegionInfo.RegionID; } } - - private void OnMakeChildAgent(ScenePresence sp) + private void OnMakeRootAgent(ScenePresence sp) { UUID agentID = sp.ControllingClient.AgentId; - - if (m_Friends.ContainsKey(agentID)) - { - if (m_Friends[agentID].RegionID == sp.ControllingClient.Scene.RegionInfo.RegionID) - m_Friends[agentID].RegionID = UUID.Zero; - } + UpdateFriendsCache(agentID); } private void OnClientLogin(IClientAPI client) @@ -295,72 +276,56 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends // Register that we need to send the list of online friends to this user lock (m_NeedsListOfFriends) - if (!m_NeedsListOfFriends.Contains(agentID)) - { - m_NeedsListOfFriends.Add(agentID); - } + m_NeedsListOfFriends.Add(agentID); } public void SendFriendsOnlineIfNeeded(IClientAPI client) { UUID agentID = client.AgentId; - if (m_NeedsListOfFriends.Contains(agentID)) + + // Check if the online friends list is needed + lock (m_NeedsListOfFriends) { - if (!m_Friends.ContainsKey(agentID)) - { - m_log.DebugFormat("[FRIENDS MODULE]: agent {0} not found in local cache", agentID); + if (!m_NeedsListOfFriends.Remove(agentID)) return; - } - - // - // Send the friends online - // - List online = GetOnlineFriends(agentID); - if (online.Count > 0) - { - m_log.DebugFormat("[FRIENDS MODULE]: User {0} in region {1} has {2} friends online", client.AgentId, client.Scene.RegionInfo.RegionName, online.Count); - client.SendAgentOnline(online.ToArray()); - } - - // - // Send outstanding friendship offers - // - if (m_Friends.ContainsKey(agentID)) - { - List outstanding = new List(); + } - foreach (FriendInfo fi in m_Friends[agentID].Friends) - if (fi.TheirFlags == -1) - outstanding.Add(fi.Friend); + // Send the friends online + List online = GetOnlineFriends(agentID); + if (online.Count > 0) + { + m_log.DebugFormat("[FRIENDS MODULE]: User {0} in region {1} has {2} friends online", client.AgentId, client.Scene.RegionInfo.RegionName, online.Count); + client.SendAgentOnline(online.ToArray()); + } - GridInstantMessage im = new GridInstantMessage(client.Scene, UUID.Zero, "", agentID, (byte)InstantMessageDialog.FriendshipOffered, "Will you be my friend?", true, Vector3.Zero); - foreach (string fid in outstanding) - { - try - { - im.fromAgentID = new Guid(fid); - } - catch - { - continue; - } + // Send outstanding friendship offers + List outstanding = new List(); + FriendInfo[] friends = GetFriends(agentID); + foreach (FriendInfo fi in friends) + { + if (fi.TheirFlags == -1) + outstanding.Add(fi.Friend); + } - UserAccount account = m_Scenes[0].UserAccountService.GetUserAccount(client.Scene.RegionInfo.ScopeID, new UUID(im.fromAgentID)); - im.fromAgentName = account.FirstName + " " + account.LastName; + GridInstantMessage im = new GridInstantMessage(client.Scene, UUID.Zero, String.Empty, agentID, (byte)InstantMessageDialog.FriendshipOffered, + "Will you be my friend?", true, Vector3.Zero); - PresenceInfo presence = PresenceService.GetAgent(new UUID(im.fromAgentID)); - if (presence != null) - im.offline = 0; + foreach (string fid in outstanding) + { + UUID fromAgentID; + if (!UUID.TryParse(fid, out fromAgentID)) + continue; - im.imSessionID = im.fromAgentID; + UserAccount account = m_Scenes[0].UserAccountService.GetUserAccount(client.Scene.RegionInfo.ScopeID, fromAgentID); + PresenceInfo presence = PresenceService.GetAgent(fromAgentID); - // Finally - LocalFriendshipOffered(agentID, im); - } - } + im.fromAgentID = fromAgentID.Guid; + im.fromAgentName = account.FirstName + " " + account.LastName; + im.offline = (byte)((presence == null) ? 1 : 0); + im.imSessionID = im.fromAgentID; - lock (m_NeedsListOfFriends) - m_NeedsListOfFriends.Remove(agentID); + // Finally + LocalFriendshipOffered(agentID, im); } } @@ -369,44 +334,46 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends List friendList = new List(); List online = new List(); - foreach (FriendInfo fi in m_Friends[userID].Friends) + FriendInfo[] friends = GetFriends(userID); + foreach (FriendInfo fi in friends) { if (((fi.TheirFlags & 1) != 0) && (fi.TheirFlags != -1)) friendList.Add(fi.Friend); } - if (friendList.Count == 0) - // no friends whatsoever - return online; - - PresenceInfo[] presence = PresenceService.GetAgents(friendList.ToArray()); - - foreach (PresenceInfo pi in presence) - online.Add(new UUID(pi.UserID)); - //m_log.DebugFormat("[XXX] {0} friend online {1}", userID, pi.UserID); + if (friendList.Count > 0) + { + PresenceInfo[] presence = PresenceService.GetAgents(friendList.ToArray()); + foreach (PresenceInfo pi in presence) + { + UUID presenceID; + if (UUID.TryParse(pi.UserID, out presenceID)) + online.Add(presenceID); + } + } return online; } - // - // Find the client for a ID - // + /// + /// Find the client for a ID + /// public IClientAPI LocateClientObject(UUID agentID) { Scene scene = GetClientScene(agentID); - if (scene == null) - return null; - - ScenePresence presence = scene.GetScenePresence(agentID); - if (presence == null) - return null; + if (scene != null) + { + ScenePresence presence = scene.GetScenePresence(agentID); + if (presence != null) + return presence.ControllingClient; + } - return presence.ControllingClient; + return null; } - // - // Find the scene for an agent - // + /// + /// Find the scene for an agent + /// private Scene GetClientScene(UUID agentId) { lock (m_Scenes) @@ -414,13 +381,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends foreach (Scene scene in m_Scenes) { ScenePresence presence = scene.GetScenePresence(agentId); - if (presence != null) - { - if (!presence.IsChildAgent) - return scene; - } + if (presence != null && !presence.IsChildAgent) + return scene; } } + return null; } @@ -431,35 +396,33 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends /// private void StatusChange(UUID agentID, bool online) { - //m_log.DebugFormat("[FRIENDS]: StatusChange {0}", online); - if (m_Friends.ContainsKey(agentID)) + FriendInfo[] friends = GetFriends(agentID); + if (friends.Length > 0) { - //m_log.DebugFormat("[FRIENDS]: # of friends: {0}", m_Friends[agentID].Friends.Length); List friendList = new List(); - foreach (FriendInfo fi in m_Friends[agentID].Friends) + foreach (FriendInfo fi in friends) { if (((fi.MyFlags & 1) != 0) && (fi.TheirFlags != -1)) friendList.Add(fi); } - Util.FireAndForget(delegate - { - foreach (FriendInfo fi in friendList) + Util.FireAndForget( + delegate { - //m_log.DebugFormat("[FRIENDS]: Notifying {0}", fi.PrincipalID); - // Notify about this user status - StatusNotify(fi, agentID, online); + foreach (FriendInfo fi in friendList) + { + //m_log.DebugFormat("[FRIENDS]: Notifying {0}", fi.PrincipalID); + // Notify about this user status + StatusNotify(fi, agentID, online); + } } - }); + ); } - else - m_log.WarnFormat("[FRIENDS]: {0} not found in cache", agentID); } private void StatusNotify(FriendInfo friend, UUID userID, bool online) { - UUID friendID = UUID.Zero; - + UUID friendID; if (UUID.TryParse(friend.Friend, out friendID)) { // Try local @@ -476,12 +439,14 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends } } else + { m_log.WarnFormat("[FRIENDS]: Error parsing friend ID {0}", friend.Friend); + } } private void OnInstantMessage(IClientAPI client, GridInstantMessage im) { - if (im.dialog == (byte)OpenMetaverse.InstantMessageDialog.FriendshipOffered) + if ((InstantMessageDialog)im.dialog == InstantMessageDialog.FriendshipOffered) { // we got a friendship offer UUID principalID = new UUID(im.fromAgentID); @@ -527,9 +492,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends FriendsService.StoreFriend(agentID, friendID.ToString(), 1); FriendsService.StoreFriend(friendID, agentID.ToString(), 1); - // update the local cache - m_Friends[agentID].Friends = FriendsService.GetFriends(agentID); + // Update the local cache + UpdateFriendsCache(agentID); // // Notify the friend @@ -584,7 +549,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends FriendsService.Delete(exfriendID, agentID.ToString()); // Update local cache - m_Friends[agentID].Friends = FriendsService.GetFriends(agentID); + UpdateFriendsCache(agentID); client.SendTerminateFriend(exfriendID); @@ -606,16 +571,18 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends private void OnGrantUserRights(IClientAPI remoteClient, UUID requester, UUID target, int rights) { - if (!m_Friends.ContainsKey(remoteClient.AgentId)) + FriendInfo[] friends = GetFriends(remoteClient.AgentId); + if (friends.Length == 0) return; m_log.DebugFormat("[FRIENDS MODULE]: User {0} changing rights to {1} for friend {2}", requester, rights, target); // Let's find the friend in this user's friend list - UserFriendData fd = m_Friends[remoteClient.AgentId]; FriendInfo friend = null; - foreach (FriendInfo fi in fd.Friends) + foreach (FriendInfo fi in friends) + { if (fi.Friend == target.ToString()) friend = fi; + } if (friend != null) // Found it { @@ -672,8 +639,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends GridInstantMessage im = new GridInstantMessage(Scene, userID, userName, friendID, (byte)OpenMetaverse.InstantMessageDialog.FriendshipAccepted, userID.ToString(), false, Vector3.Zero); friendClient.SendInstantMessage(im); - // update the local cache - m_Friends[friendID].Friends = FriendsService.GetFriends(friendID); + + // Update the local cache + UpdateFriendsCache(friendID); + // we're done return true; } @@ -687,7 +656,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends if (friendClient != null) { // the prospective friend in this sim as root agent - GridInstantMessage im = new GridInstantMessage(Scene, userID, userName, friendID, (byte)OpenMetaverse.InstantMessageDialog.FriendshipDeclined, userID.ToString(), false, Vector3.Zero); friendClient.SendInstantMessage(im); @@ -706,7 +674,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends // the friend in this sim as root agent friendClient.SendTerminateFriend(exfriendID); // update local cache - m_Friends[exfriendID].Friends = FriendsService.GetFriends(exfriendID); + UpdateFriendsCache(exfriendID); // we're done return true; } @@ -735,11 +703,16 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends } - // update local cache - //m_Friends[friendID].Friends = m_FriendsService.GetFriends(friendID); - foreach (FriendInfo finfo in m_Friends[friendID].Friends) - if (finfo.Friend == userID.ToString()) - finfo.TheirFlags = rights; + // Update local cache + lock (m_Friends) + { + FriendInfo[] friends = GetFriends(friendID); + foreach (FriendInfo finfo in friends) + { + if (finfo.Friend == userID.ToString()) + finfo.TheirFlags = rights; + } + } return true; } @@ -765,7 +738,30 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends return false; } + #endregion + private FriendInfo[] GetFriends(UUID agentID) + { + UserFriendData friendsData; + + lock (m_Friends) + { + if (m_Friends.TryGetValue(agentID, out friendsData)) + return friendsData.Friends; + } + + return EMPTY_FRIENDS; + } + + private void UpdateFriendsCache(UUID agentID) + { + lock (m_Friends) + { + UserFriendData friendsData; + if (m_Friends.TryGetValue(agentID, out friendsData)) + friendsData.Friends = FriendsService.GetFriends(agentID); + } + } } } -- cgit v1.1 From 9609faa8eb330dc85dfb2efec1e7e5652f01d6f2 Mon Sep 17 00:00:00 2001 From: John Hurliman Date: Thu, 9 Sep 2010 15:05:22 -0700 Subject: * Run SimianGrid session updates asynchronously instead of from the main heartbeat thread * Minor dead code cleanup --- .../SimianGrid/SimianActivityDetector.cs | 8 ++-- .../SimianGrid/SimianAvatarServiceConnector.cs | 3 -- .../SimianGrid/SimianFriendsServiceConnector.cs | 3 -- .../SimianGrid/SimianInventoryServiceConnector.cs | 1 - .../SimianGrid/SimianPresenceServiceConnector.cs | 55 ---------------------- .../SimianUserAccountServiceConnector.cs | 1 - 6 files changed, 5 insertions(+), 66 deletions(-) diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianActivityDetector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianActivityDetector.cs index a871d07..67b73f3 100644 --- a/OpenSim/Services/Connectors/SimianGrid/SimianActivityDetector.cs +++ b/OpenSim/Services/Connectors/SimianGrid/SimianActivityDetector.cs @@ -26,11 +26,9 @@ */ using System; -using System.Collections.Generic; using System.Reflection; using OpenSim.Framework; using OpenSim.Region.Framework.Scenes; -using OpenSim.Services.Interfaces; using OpenMetaverse; using log4net; @@ -107,7 +105,11 @@ namespace OpenSim.Services.Connectors.SimianGrid void OnEnteringNewParcel(ScenePresence sp, int localLandID, UUID regionID) { - m_GridUserService.SetLastPosition(sp.UUID.ToString(), sp.ControllingClient.SessionId, sp.Scene.RegionInfo.RegionID, sp.AbsolutePosition, sp.Lookat); + // Asynchronously update the position stored in the session table for this agent + Util.FireAndForget(delegate(object o) + { + m_GridUserService.SetLastPosition(sp.UUID.ToString(), sp.ControllingClient.SessionId, sp.Scene.RegionInfo.RegionID, sp.AbsolutePosition, sp.Lookat); + }); } } } diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianAvatarServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianAvatarServiceConnector.cs index 3505c64..4d0d53e 100644 --- a/OpenSim/Services/Connectors/SimianGrid/SimianAvatarServiceConnector.cs +++ b/OpenSim/Services/Connectors/SimianGrid/SimianAvatarServiceConnector.cs @@ -28,8 +28,6 @@ using System; using System.Collections.Generic; using System.Collections.Specialized; -using System.IO; -using System.Net; using System.Reflection; using log4net; using Mono.Addins; @@ -37,7 +35,6 @@ using Nini.Config; using OpenSim.Framework; using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; -using OpenSim.Server.Base; using OpenSim.Services.Interfaces; using OpenMetaverse; using OpenMetaverse.StructuredData; diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianFriendsServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianFriendsServiceConnector.cs index 5b18aef..6f2d735 100644 --- a/OpenSim/Services/Connectors/SimianGrid/SimianFriendsServiceConnector.cs +++ b/OpenSim/Services/Connectors/SimianGrid/SimianFriendsServiceConnector.cs @@ -30,13 +30,10 @@ using System.Collections.Generic; using System.Collections.Specialized; using System.Reflection; using log4net; -using Mono.Addins; using Nini.Config; using OpenMetaverse; using OpenMetaverse.StructuredData; using OpenSim.Framework; -using OpenSim.Region.Framework.Interfaces; -using OpenSim.Region.Framework.Scenes; using OpenSim.Services.Interfaces; using FriendInfo = OpenSim.Services.Interfaces.FriendInfo; diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianInventoryServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianInventoryServiceConnector.cs index 3953369..21ad4ab 100644 --- a/OpenSim/Services/Connectors/SimianGrid/SimianInventoryServiceConnector.cs +++ b/OpenSim/Services/Connectors/SimianGrid/SimianInventoryServiceConnector.cs @@ -37,7 +37,6 @@ using OpenMetaverse.StructuredData; using OpenSim.Framework; using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; -using OpenSim.Server.Base; using OpenSim.Services.Interfaces; namespace OpenSim.Services.Connectors.SimianGrid diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianPresenceServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianPresenceServiceConnector.cs index 077be3c..a344594 100644 --- a/OpenSim/Services/Connectors/SimianGrid/SimianPresenceServiceConnector.cs +++ b/OpenSim/Services/Connectors/SimianGrid/SimianPresenceServiceConnector.cs @@ -28,17 +28,14 @@ using System; using System.Collections.Generic; using System.Collections.Specialized; -using System.Net; using System.Reflection; using log4net; using Mono.Addins; using Nini.Config; using OpenSim.Framework; -using OpenSim.Framework.Servers.HttpServer; using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; using OpenSim.Services.Interfaces; -using OpenSim.Server.Base; using OpenMetaverse; using OpenMetaverse.StructuredData; @@ -358,25 +355,6 @@ namespace OpenSim.Services.Connectors.SimianGrid return null; } -// private OSDMap GetSessionData(UUID sessionID) -// { -// m_log.DebugFormat("[SIMIAN PRESENCE CONNECTOR]: Requesting session data for session " + sessionID); -// -// NameValueCollection requestArgs = new NameValueCollection -// { -// { "RequestMethod", "GetSession" }, -// { "SessionID", sessionID.ToString() } -// }; -// -// OSDMap response = WebUtil.PostToService(m_serverUrl, requestArgs); -// if (response["Success"].AsBoolean()) -// return response; -// else -// m_log.Warn("[SIMIAN PRESENCE CONNECTOR]: Failed to retrieve session data for session " + sessionID); -// -// return null; -// } - private List GetSessions(UUID userID) { List presences = new List(1); @@ -429,39 +407,6 @@ namespace OpenSim.Services.Connectors.SimianGrid return success; } - ///// - ///// Fetch the last known avatar location with GetSession and persist it - ///// as user data with AddUserData - ///// - //private bool SetLastLocation(UUID sessionID) - //{ - // NameValueCollection requestArgs = new NameValueCollection - // { - // { "RequestMethod", "GetSession" }, - // { "SessionID", sessionID.ToString() } - // }; - - // OSDMap response = WebUtil.PostToService(m_serverUrl, requestArgs); - // bool success = response["Success"].AsBoolean(); - - // if (success) - // { - // UUID userID = response["UserID"].AsUUID(); - // UUID sceneID = response["SceneID"].AsUUID(); - // Vector3 position = response["ScenePosition"].AsVector3(); - // Vector3 lookAt = response["SceneLookAt"].AsVector3(); - - // return SetLastLocation(userID, sceneID, position, lookAt); - // } - // else - // { - // m_log.Warn("[SIMIAN PRESENCE CONNECTOR]: Failed to retrieve presence information for session " + sessionID + - // " while saving last location: " + response["Message"].AsString()); - // } - - // return success; - //} - private PresenceInfo ResponseToPresenceInfo(OSDMap sessionResponse, OSDMap userResponse) { if (sessionResponse == null) diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianUserAccountServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianUserAccountServiceConnector.cs index 1ac9882..ddd2322 100644 --- a/OpenSim/Services/Connectors/SimianGrid/SimianUserAccountServiceConnector.cs +++ b/OpenSim/Services/Connectors/SimianGrid/SimianUserAccountServiceConnector.cs @@ -28,7 +28,6 @@ using System; using System.Collections.Generic; using System.Collections.Specialized; -using System.IO; using System.Reflection; using OpenSim.Framework; using OpenSim.Region.Framework.Interfaces; -- cgit v1.1 From dd277a0d02f1aa79f4fcb5d108cbc696e90500c2 Mon Sep 17 00:00:00 2001 From: John Hurliman Date: Fri, 10 Sep 2010 12:04:12 -0700 Subject: First pass at cleaning up thread safety in EntityManager and SceneGraph --- OpenSim/Data/IAssetData.cs | 11 - OpenSim/Data/IInventoryData.cs | 11 - .../Avatar/Attachments/AttachmentsModule.cs | 2 +- .../Archiver/ArchiveWriteRequestPreparation.cs | 2 +- .../CoreModules/World/Land/LandManagementModule.cs | 3 +- .../World/Serialiser/SerialiseObjects.cs | 2 +- .../World/Serialiser/SerialiserModule.cs | 4 +- .../CoreModules/World/WorldMap/MapImageModule.cs | 2 +- OpenSim/Region/DataSnapshot/ObjectSnapshot.cs | 3 +- .../Interfaces/IRegionSerialiserModule.cs | 4 +- OpenSim/Region/Framework/Scenes/EntityManager.cs | 210 ++++------------ OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | 3 +- .../Framework/Scenes/Scene.PacketHandlers.cs | 16 +- OpenSim/Region/Framework/Scenes/Scene.cs | 45 ++-- OpenSim/Region/Framework/Scenes/SceneGraph.cs | 263 ++++++++++----------- OpenSim/Region/Framework/Scenes/SceneViewer.cs | 3 +- .../Scenes/Serialization/SceneXmlLoader.cs | 23 +- .../Server/IRCClientView.cs | 10 +- .../ContentManagementSystem/CMEntityCollection.cs | 2 +- .../ContentManagementEntity.cs | 2 +- .../Scripting/Minimodule/ObjectAccessor.cs | 4 +- .../OptionalModules/Scripting/Minimodule/World.cs | 6 +- .../World/TreePopulator/TreePopulatorModule.cs | 3 +- .../Api/Implementation/Plugins/SensorRepeat.cs | 2 +- .../SimianGrid/SimianActivityDetector.cs | 5 +- 25 files changed, 249 insertions(+), 392 deletions(-) diff --git a/OpenSim/Data/IAssetData.cs b/OpenSim/Data/IAssetData.cs index 90d5eeb..f31b215c 100644 --- a/OpenSim/Data/IAssetData.cs +++ b/OpenSim/Data/IAssetData.cs @@ -40,15 +40,4 @@ namespace OpenSim.Data void Initialise(string connect); bool Delete(string id); } - - public class AssetDataInitialiser : PluginInitialiserBase - { - private string connect; - public AssetDataInitialiser (string s) { connect = s; } - public override void Initialise (IPlugin plugin) - { - IAssetDataPlugin p = plugin as IAssetDataPlugin; - p.Initialise (connect); - } - } } diff --git a/OpenSim/Data/IInventoryData.cs b/OpenSim/Data/IInventoryData.cs index 90f74b7..74d5d37 100644 --- a/OpenSim/Data/IInventoryData.cs +++ b/OpenSim/Data/IInventoryData.cs @@ -155,15 +155,4 @@ namespace OpenSim.Data /// List fetchActiveGestures(UUID avatarID); } - - public class InventoryDataInitialiser : PluginInitialiserBase - { - private string connect; - public InventoryDataInitialiser (string s) { connect = s; } - public override void Initialise (IPlugin plugin) - { - IInventoryDataPlugin p = plugin as IInventoryDataPlugin; - p.Initialise (connect); - } - } } diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs index dd7d831..7270304 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs @@ -436,7 +436,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments // We can NOT use the dictionries here, as we are looking // for an entity by the fromAssetID, which is NOT the prim UUID - List detachEntities = m_scene.GetEntities(); + EntityBase[] detachEntities = m_scene.GetEntities(); SceneObjectGroup group; foreach (EntityBase entity in detachEntities) diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs index b25636f..283b33b 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs @@ -102,7 +102,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver { Dictionary assetUuids = new Dictionary(); - List entities = m_scene.GetEntities(); + EntityBase[] entities = m_scene.GetEntities(); List sceneObjects = new List(); /* diff --git a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs index da7a284..ea71fd9 100644 --- a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs +++ b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs @@ -794,7 +794,8 @@ namespace OpenSim.Region.CoreModules.World.Land public void EventManagerOnParcelPrimCountUpdate() { ResetAllLandPrimCounts(); - foreach (EntityBase obj in m_scene.Entities) + EntityBase[] entities = m_scene.Entities.GetEntities(); + foreach (EntityBase obj in entities) { if (obj != null) { diff --git a/OpenSim/Region/CoreModules/World/Serialiser/SerialiseObjects.cs b/OpenSim/Region/CoreModules/World/Serialiser/SerialiseObjects.cs index bef7fe4..5067ebd 100644 --- a/OpenSim/Region/CoreModules/World/Serialiser/SerialiseObjects.cs +++ b/OpenSim/Region/CoreModules/World/Serialiser/SerialiseObjects.cs @@ -80,7 +80,7 @@ namespace OpenSim.Region.CoreModules.World.Serialiser { string xmlstream = ""; - List EntityList = scene.GetEntities(); + EntityBase[] EntityList = scene.GetEntities(); List EntityXml = new List(); foreach (EntityBase ent in EntityList) diff --git a/OpenSim/Region/CoreModules/World/Serialiser/SerialiserModule.cs b/OpenSim/Region/CoreModules/World/Serialiser/SerialiserModule.cs index 58e4261..98fe493 100644 --- a/OpenSim/Region/CoreModules/World/Serialiser/SerialiserModule.cs +++ b/OpenSim/Region/CoreModules/World/Serialiser/SerialiserModule.cs @@ -165,12 +165,12 @@ namespace OpenSim.Region.CoreModules.World.Serialiser return SceneXmlLoader.SaveGroupToXml2(grp); } - public void SavePrimListToXml2(List entityList, string fileName) + public void SavePrimListToXml2(EntityBase[] entityList, string fileName) { SceneXmlLoader.SavePrimListToXml2(entityList, fileName); } - public void SavePrimListToXml2(List entityList, TextWriter stream, Vector3 min, Vector3 max) + public void SavePrimListToXml2(EntityBase[] entityList, TextWriter stream, Vector3 min, Vector3 max) { SceneXmlLoader.SavePrimListToXml2(entityList, stream, min, max); } diff --git a/OpenSim/Region/CoreModules/World/WorldMap/MapImageModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/MapImageModule.cs index 57eff8a..1d9c2bd 100644 --- a/OpenSim/Region/CoreModules/World/WorldMap/MapImageModule.cs +++ b/OpenSim/Region/CoreModules/World/WorldMap/MapImageModule.cs @@ -212,7 +212,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap double[,] hm = whichScene.Heightmap.GetDoubles(); tc = Environment.TickCount; m_log.Info("[MAPTILE]: Generating Maptile Step 2: Object Volume Profile"); - List objs = whichScene.GetEntities(); + EntityBase[] objs = whichScene.GetEntities(); Dictionary z_sort = new Dictionary(); //SortedList z_sort = new SortedList(); List z_sortheights = new List(); diff --git a/OpenSim/Region/DataSnapshot/ObjectSnapshot.cs b/OpenSim/Region/DataSnapshot/ObjectSnapshot.cs index 3c39f9e..5e75cae 100644 --- a/OpenSim/Region/DataSnapshot/ObjectSnapshot.cs +++ b/OpenSim/Region/DataSnapshot/ObjectSnapshot.cs @@ -101,7 +101,8 @@ namespace OpenSim.Region.DataSnapshot.Providers XmlNode parent = nodeFactory.CreateNode(XmlNodeType.Element, "objectdata", ""); XmlNode node; - foreach (EntityBase entity in m_scene.Entities) + EntityBase[] entities = m_scene.Entities.GetEntities(); + foreach (EntityBase entity in entities) { // only objects, not avatars if (entity is SceneObjectGroup) diff --git a/OpenSim/Region/Framework/Interfaces/IRegionSerialiserModule.cs b/OpenSim/Region/Framework/Interfaces/IRegionSerialiserModule.cs index e7562a5..18758c8 100644 --- a/OpenSim/Region/Framework/Interfaces/IRegionSerialiserModule.cs +++ b/OpenSim/Region/Framework/Interfaces/IRegionSerialiserModule.cs @@ -90,7 +90,7 @@ namespace OpenSim.Region.Framework.Interfaces /// /// /// - void SavePrimListToXml2(List entityList, string fileName); + void SavePrimListToXml2(EntityBase[] entityList, string fileName); /// /// Save a set of prims in the xml2 format, optionally specifying a bounding box for which @@ -101,7 +101,7 @@ namespace OpenSim.Region.Framework.Interfaces /// /// /// - void SavePrimListToXml2(List entityList, TextWriter stream, Vector3 min, Vector3 max); + void SavePrimListToXml2(EntityBase[] entityList, TextWriter stream, Vector3 min, Vector3 max); void SaveNamedPrimsToXml2(Scene scene, string primName, string fileName); diff --git a/OpenSim/Region/Framework/Scenes/EntityManager.cs b/OpenSim/Region/Framework/Scenes/EntityManager.cs index 099fcce..85d0a4f 100644 --- a/OpenSim/Region/Framework/Scenes/EntityManager.cs +++ b/OpenSim/Region/Framework/Scenes/EntityManager.cs @@ -34,187 +34,89 @@ using OpenMetaverse; namespace OpenSim.Region.Framework.Scenes { - public class EntityManager : IEnumerable + public class EntityManager //: IEnumerable { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - private readonly Dictionary m_eb_uuid = new Dictionary(); - private readonly Dictionary m_eb_localID = new Dictionary(); - //private readonly Dictionary m_pres_uuid = new Dictionary(); - private readonly Object m_lock = new Object(); + private readonly DoubleDictionary m_entities = new DoubleDictionary(); - [Obsolete("Use Add() instead.")] - public void Add(UUID id, EntityBase eb) + public int Count { - Add(eb); + get { return m_entities.Count; } } public void Add(EntityBase entity) { - lock (m_lock) - { - try - { - m_eb_uuid.Add(entity.UUID, entity); - m_eb_localID.Add(entity.LocalId, entity); - } - catch(Exception e) - { - m_log.ErrorFormat("Add Entity failed: {0}", e.Message); - } - } - } - - public void InsertOrReplace(EntityBase entity) - { - lock (m_lock) - { - try - { - m_eb_uuid[entity.UUID] = entity; - m_eb_localID[entity.LocalId] = entity; - } - catch(Exception e) - { - m_log.ErrorFormat("Insert or Replace Entity failed: {0}", e.Message); - } - } + m_entities.Add(entity.UUID, entity.LocalId, entity); } public void Clear() { - lock (m_lock) - { - m_eb_uuid.Clear(); - m_eb_localID.Clear(); - } - } - - public int Count - { - get - { - return m_eb_uuid.Count; - } + m_entities.Clear(); } public bool ContainsKey(UUID id) { - try - { - return m_eb_uuid.ContainsKey(id); - } - catch - { - return false; - } + return m_entities.ContainsKey(id); } public bool ContainsKey(uint localID) { - try - { - return m_eb_localID.ContainsKey(localID); - } - catch - { - return false; - } + return m_entities.ContainsKey(localID); } public bool Remove(uint localID) { - lock (m_lock) - { - try - { - bool a = false; - EntityBase entity; - if (m_eb_localID.TryGetValue(localID, out entity)) - a = m_eb_uuid.Remove(entity.UUID); - - bool b = m_eb_localID.Remove(localID); - return a && b; - } - catch (Exception e) - { - m_log.ErrorFormat("Remove Entity failed for {0}", localID, e); - return false; - } - } + return m_entities.Remove(localID); } public bool Remove(UUID id) { - lock (m_lock) - { - try - { - bool a = false; - EntityBase entity; - if (m_eb_uuid.TryGetValue(id, out entity)) - a = m_eb_localID.Remove(entity.LocalId); - - bool b = m_eb_uuid.Remove(id); - return a && b; - } - catch (Exception e) - { - m_log.ErrorFormat("Remove Entity failed for {0}", id, e); - return false; - } - } + return m_entities.Remove(id); } - public List GetAllByType() + public EntityBase[] GetAllByType() { List tmp = new List(); - lock (m_lock) - { - try + m_entities.ForEach( + delegate(EntityBase entity) { - foreach (KeyValuePair pair in m_eb_uuid) - { - if (pair.Value is T) - { - tmp.Add(pair.Value); - } - } + if (entity is T) + tmp.Add(entity); } - catch (Exception e) - { - m_log.ErrorFormat("GetAllByType failed for {0}", e); - tmp = null; - } - } + ); - return tmp; + return tmp.ToArray(); } - public List GetEntities() + public EntityBase[] GetEntities() { - lock (m_lock) - { - return new List(m_eb_uuid.Values); - } + List tmp = new List(m_entities.Count); + m_entities.ForEach(delegate(EntityBase entity) { tmp.Add(entity); }); + return tmp.ToArray(); + } + + public void ForEach(Action action) + { + m_entities.ForEach(action); + } + + public EntityBase Find(Predicate predicate) + { + return m_entities.FindValue(predicate); } public EntityBase this[UUID id] { get { - lock (m_lock) - { - EntityBase entity; - if (m_eb_uuid.TryGetValue(id, out entity)) - return entity; - else - return null; - } + EntityBase entity; + m_entities.TryGetValue(id, out entity); + return entity; } set { - InsertOrReplace(value); + Add(value); } } @@ -222,50 +124,38 @@ namespace OpenSim.Region.Framework.Scenes { get { - lock (m_lock) - { - EntityBase entity; - if (m_eb_localID.TryGetValue(localID, out entity)) - return entity; - else - return null; - } + EntityBase entity; + m_entities.TryGetValue(localID, out entity); + return entity; } set { - InsertOrReplace(value); + Add(value); } } public bool TryGetValue(UUID key, out EntityBase obj) { - lock (m_lock) - { - return m_eb_uuid.TryGetValue(key, out obj); - } + return m_entities.TryGetValue(key, out obj); } public bool TryGetValue(uint key, out EntityBase obj) { - lock (m_lock) - { - return m_eb_localID.TryGetValue(key, out obj); - } + return m_entities.TryGetValue(key, out obj); } /// /// This could be optimised to work on the list 'live' rather than making a safe copy and iterating that. /// /// - public IEnumerator GetEnumerator() - { - return GetEntities().GetEnumerator(); - } - - IEnumerator IEnumerable.GetEnumerator() - { - return GetEnumerator(); - } - + //public IEnumerator GetEnumerator() + //{ + // return GetEntities().GetEnumerator(); + //} + + //IEnumerator IEnumerable.GetEnumerator() + //{ + // return GetEnumerator(); + //} } } diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index c49386a..a439eb9 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs @@ -58,7 +58,8 @@ namespace OpenSim.Region.Framework.Scenes { m_log.Info("[PRIM INVENTORY]: Starting scripts in scene"); - foreach (EntityBase group in Entities) + EntityBase[] entities = Entities.GetEntities(); + foreach (EntityBase group in entities) { if (group is SceneObjectGroup) { diff --git a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs index c511774..2f69476 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs @@ -116,9 +116,8 @@ namespace OpenSim.Region.Framework.Scenes /// public void RequestPrim(uint primLocalID, IClientAPI remoteClient) { - List EntityList = GetEntities(); - - foreach (EntityBase ent in EntityList) + EntityBase[] entityList = GetEntities(); + foreach (EntityBase ent in entityList) { if (ent is SceneObjectGroup) { @@ -138,9 +137,8 @@ namespace OpenSim.Region.Framework.Scenes /// public void SelectPrim(uint primLocalID, IClientAPI remoteClient) { - List EntityList = GetEntities(); - - foreach (EntityBase ent in EntityList) + EntityBase[] entityList = GetEntities(); + foreach (EntityBase ent in entityList) { if (ent is SceneObjectGroup) { @@ -259,7 +257,7 @@ namespace OpenSim.Region.Framework.Scenes public virtual void ProcessObjectGrab(uint localID, Vector3 offsetPos, IClientAPI remoteClient, List surfaceArgs) { - List EntityList = GetEntities(); + EntityBase[] EntityList = GetEntities(); SurfaceTouchEventArgs surfaceArg = null; if (surfaceArgs != null && surfaceArgs.Count > 0) @@ -303,7 +301,7 @@ namespace OpenSim.Region.Framework.Scenes public virtual void ProcessObjectGrabUpdate(UUID objectID, Vector3 offset, Vector3 pos, IClientAPI remoteClient, List surfaceArgs) { - List EntityList = GetEntities(); + EntityBase[] EntityList = GetEntities(); SurfaceTouchEventArgs surfaceArg = null; if (surfaceArgs != null && surfaceArgs.Count > 0) @@ -343,7 +341,7 @@ namespace OpenSim.Region.Framework.Scenes public virtual void ProcessObjectDeGrab(uint localID, IClientAPI remoteClient, List surfaceArgs) { - List EntityList = GetEntities(); + EntityBase[] EntityList = GetEntities(); SurfaceTouchEventArgs surfaceArg = null; if (surfaceArgs != null && surfaceArgs.Count > 0) diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 82e7d76..7ce95a7 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -1029,29 +1029,30 @@ namespace OpenSim.Region.Framework.Scenes if (ScriptEngine) { m_log.Info("Stopping all Scripts in Scene"); - foreach (EntityBase ent in Entities) + + EntityBase[] entities = Entities.GetEntities(); + foreach (EntityBase ent in entities) { if (ent is SceneObjectGroup) - { - ((SceneObjectGroup) ent).RemoveScriptInstances(false); - } + ((SceneObjectGroup)ent).RemoveScriptInstances(false); } } else { m_log.Info("Starting all Scripts in Scene"); - lock (Entities) + + EntityBase[] entities = Entities.GetEntities(); + foreach (EntityBase ent in entities) { - foreach (EntityBase ent in Entities) + if (ent is SceneObjectGroup) { - if (ent is SceneObjectGroup) - { - ((SceneObjectGroup)ent).CreateScriptInstances(0, false, DefaultScriptEngine, 0); - ((SceneObjectGroup)ent).ResumeScripts(); - } + SceneObjectGroup sog = (SceneObjectGroup)ent; + sog.CreateScriptInstances(0, false, DefaultScriptEngine, 0); + sog.ResumeScripts(); } } } + m_scripts_enabled = !ScriptEngine; m_log.Info("[TOTEDD]: Here is the method to trigger disabling of the scripting engine"); } @@ -1098,7 +1099,7 @@ namespace OpenSim.Region.Framework.Scenes shuttingdown = true; m_log.Debug("[SCENE]: Persisting changed objects"); - List entities = GetEntities(); + EntityBase[] entities = GetEntities(); foreach (EntityBase entity in entities) { if (!entity.IsDeleted && entity is SceneObjectGroup && ((SceneObjectGroup)entity).HasGroupChanged) @@ -2037,8 +2038,7 @@ namespace OpenSim.Region.Framework.Scenes { lock (Entities) { - ICollection entities = new List(Entities); - + EntityBase[] entities = Entities.GetEntities(); foreach (EntityBase e in entities) { if (e is SceneObjectGroup) @@ -3977,9 +3977,8 @@ namespace OpenSim.Region.Framework.Scenes /// public void ForceClientUpdate() { - List EntityList = GetEntities(); - - foreach (EntityBase ent in EntityList) + EntityBase[] entityList = GetEntities(); + foreach (EntityBase ent in entityList) { if (ent is SceneObjectGroup) { @@ -3997,9 +3996,8 @@ namespace OpenSim.Region.Framework.Scenes { m_log.Debug("Searching for Primitive: '" + cmdparams[2] + "'"); - List EntityList = GetEntities(); - - foreach (EntityBase ent in EntityList) + EntityBase[] entityList = GetEntities(); + foreach (EntityBase ent in entityList) { if (ent is SceneObjectGroup) { @@ -4368,7 +4366,7 @@ namespace OpenSim.Region.Framework.Scenes /// will not affect the original list of objects in the scene. /// /// - public List GetEntities() + public EntityBase[] GetEntities() { return m_sceneGraph.GetEntities(); } @@ -4402,9 +4400,8 @@ namespace OpenSim.Region.Framework.Scenes public void CleanTempObjects() { - List objs = GetEntities(); - - foreach (EntityBase obj in objs) + EntityBase[] entities = GetEntities(); + foreach (EntityBase obj in entities) { if (obj is SceneObjectGroup) { diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs index dfb26b9..3d3e822 100644 --- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs +++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs @@ -348,68 +348,57 @@ namespace OpenSim.Region.Framework.Scenes if (sceneObject == null || sceneObject.RootPart == null || sceneObject.RootPart.UUID == UUID.Zero) return false; - lock (sceneObject) - { - if (Entities.ContainsKey(sceneObject.UUID)) - { -// m_log.WarnFormat( -// "[SCENE GRAPH]: Scene object {0} {1} was already in region {2} on add request", -// sceneObject.Name, sceneObject.UUID, m_parentScene.RegionInfo.RegionName); - return false; - } - -// m_log.DebugFormat( -// "[SCENE GRAPH]: Adding object {0} {1} to region {2}", -// sceneObject.Name, sceneObject.UUID, m_parentScene.RegionInfo.RegionName); - - lock (sceneObject.Children) + if (Entities.ContainsKey(sceneObject.UUID)) + return false; + + // Clamp child prim sizes and add child prims to the m_numPrim count + lock (sceneObject.Children) + { + if (m_parentScene.m_clampPrimSize) { - if (m_parentScene.m_clampPrimSize) + foreach (SceneObjectPart part in sceneObject.Children.Values) { - foreach (SceneObjectPart part in sceneObject.Children.Values) - { - Vector3 scale = part.Shape.Scale; - - if (scale.X > m_parentScene.m_maxNonphys) - scale.X = m_parentScene.m_maxNonphys; - if (scale.Y > m_parentScene.m_maxNonphys) - scale.Y = m_parentScene.m_maxNonphys; - if (scale.Z > m_parentScene.m_maxNonphys) - scale.Z = m_parentScene.m_maxNonphys; - - part.Shape.Scale = scale; - } + Vector3 scale = part.Shape.Scale; + + if (scale.X > m_parentScene.m_maxNonphys) + scale.X = m_parentScene.m_maxNonphys; + if (scale.Y > m_parentScene.m_maxNonphys) + scale.Y = m_parentScene.m_maxNonphys; + if (scale.Z > m_parentScene.m_maxNonphys) + scale.Z = m_parentScene.m_maxNonphys; + + part.Shape.Scale = scale; } - - m_numPrim += sceneObject.Children.Count; } - - sceneObject.AttachToScene(m_parentScene); - if (sendClientUpdates) - sceneObject.ScheduleGroupForFullUpdate(); - - Entities.Add(sceneObject); + m_numPrim += sceneObject.Children.Count; + } - if (attachToBackup) - sceneObject.AttachToBackup(); + sceneObject.AttachToScene(m_parentScene); - if (OnObjectCreate != null) - OnObjectCreate(sceneObject); - - lock (SceneObjectGroupsByFullID) - { - SceneObjectGroupsByFullID[sceneObject.UUID] = sceneObject; - foreach (SceneObjectPart part in sceneObject.Children.Values) - SceneObjectGroupsByFullID[part.UUID] = sceneObject; - } - - lock (SceneObjectGroupsByLocalID) - { - SceneObjectGroupsByLocalID[sceneObject.LocalId] = sceneObject; - foreach (SceneObjectPart part in sceneObject.Children.Values) - SceneObjectGroupsByLocalID[part.LocalId] = sceneObject; - } + if (sendClientUpdates) + sceneObject.ScheduleGroupForFullUpdate(); + + Entities.Add(sceneObject); + + if (attachToBackup) + sceneObject.AttachToBackup(); + + if (OnObjectCreate != null) + OnObjectCreate(sceneObject); + + lock (SceneObjectGroupsByFullID) + { + SceneObjectGroupsByFullID[sceneObject.UUID] = sceneObject; + foreach (SceneObjectPart part in sceneObject.Children.Values) + SceneObjectGroupsByFullID[part.UUID] = sceneObject; + } + + lock (SceneObjectGroupsByLocalID) + { + SceneObjectGroupsByLocalID[sceneObject.LocalId] = sceneObject; + foreach (SceneObjectPart part in sceneObject.Children.Values) + SceneObjectGroupsByLocalID[part.LocalId] = sceneObject; } return true; @@ -421,42 +410,38 @@ namespace OpenSim.Region.Framework.Scenes /// true if the object was deleted, false if there was no object to delete public bool DeleteSceneObject(UUID uuid, bool resultOfObjectLinked) { - if (Entities.ContainsKey(uuid)) - { - SceneObjectGroup grp = (SceneObjectGroup)Entities[uuid]; + EntityBase entity; + if (!Entities.TryGetValue(uuid, out entity) && entity is SceneObjectGroup) + return false; - if (!resultOfObjectLinked) - { - m_numPrim -= grp.PrimCount; + SceneObjectGroup grp = (SceneObjectGroup)entity; - if ((grp.RootPart.Flags & PrimFlags.Physics) == PrimFlags.Physics) - RemovePhysicalPrim(grp.PrimCount); - } + if (!resultOfObjectLinked) + { + m_numPrim -= grp.PrimCount; - if (OnObjectRemove != null) - OnObjectRemove(Entities[uuid]); + if ((grp.RootPart.Flags & PrimFlags.Physics) == PrimFlags.Physics) + RemovePhysicalPrim(grp.PrimCount); + } - lock (SceneObjectGroupsByFullID) - { - foreach (SceneObjectPart part in grp.Children.Values) - SceneObjectGroupsByFullID.Remove(part.UUID); - SceneObjectGroupsByFullID.Remove(grp.RootPart.UUID); - } - lock (SceneObjectGroupsByLocalID) - { - foreach (SceneObjectPart part in grp.Children.Values) - SceneObjectGroupsByLocalID.Remove(part.LocalId); - SceneObjectGroupsByLocalID.Remove(grp.RootPart.LocalId); - } + if (OnObjectRemove != null) + OnObjectRemove(Entities[uuid]); - Entities.Remove(uuid); - //SceneObjectGroup part; - //((part.RootPart.Flags & PrimFlags.Physics) == PrimFlags.Physics) + lock (SceneObjectGroupsByFullID) + { + foreach (SceneObjectPart part in grp.Children.Values) + SceneObjectGroupsByFullID.Remove(part.UUID); + SceneObjectGroupsByFullID.Remove(grp.RootPart.UUID); + } - return true; + lock (SceneObjectGroupsByLocalID) + { + foreach (SceneObjectPart part in grp.Children.Values) + SceneObjectGroupsByLocalID.Remove(part.LocalId); + SceneObjectGroupsByLocalID.Remove(grp.RootPart.LocalId); } - return false; + return Entities.Remove(uuid); } /// @@ -468,9 +453,7 @@ namespace OpenSim.Region.Framework.Scenes protected internal void AddToUpdateList(SceneObjectGroup obj) { lock (m_updateList) - { m_updateList[obj.UUID] = obj; - } } /// @@ -480,34 +463,39 @@ namespace OpenSim.Region.Framework.Scenes { if (!Monitor.TryEnter(m_updateLock)) return; - - List updates; - - // Some updates add more updates to the updateList. - // Get the current list of updates and clear the list before iterating - lock (m_updateList) - { - updates = new List(m_updateList.Values); - m_updateList.Clear(); - } - - // Go through all updates - for (int i = 0; i < updates.Count; i++) + try { - SceneObjectGroup sog = updates[i]; + List updates; - // Don't abort the whole update if one entity happens to give us an exception. - try + // Some updates add more updates to the updateList. + // Get the current list of updates and clear the list before iterating + lock (m_updateList) { - sog.Update(); + updates = new List(m_updateList.Values); + m_updateList.Clear(); } - catch (Exception e) + + // Go through all updates + for (int i = 0; i < updates.Count; i++) { - m_log.ErrorFormat( - "[INNER SCENE]: Failed to update {0}, {1} - {2}", sog.Name, sog.UUID, e); + SceneObjectGroup sog = updates[i]; + + // Don't abort the whole update if one entity happens to give us an exception. + try + { + sog.Update(); + } + catch (Exception e) + { + m_log.ErrorFormat( + "[INNER SCENE]: Failed to update {0}, {1} - {2}", sog.Name, sog.UUID, e); + } } } - Monitor.Exit(m_updateLock); + finally + { + Monitor.Exit(m_updateLock); + } } protected internal void AddPhysicalPrim(int number) @@ -864,8 +852,9 @@ namespace OpenSim.Region.Framework.Scenes /// null if no scene object group containing that prim is found public SceneObjectGroup GetGroupByPrim(uint localID) { - if (Entities.ContainsKey(localID)) - return Entities[localID] as SceneObjectGroup; + EntityBase entity; + if (Entities.TryGetValue(localID, out entity)) + return entity as SceneObjectGroup; //m_log.DebugFormat("Entered GetGroupByPrim with localID {0}", localID); SceneObjectGroup sog; @@ -879,23 +868,22 @@ namespace OpenSim.Region.Framework.Scenes } } - List EntityList = GetEntities(); - foreach (EntityBase ent in EntityList) + EntityBase[] entityList = GetEntities(); + foreach (EntityBase ent in entityList) { //m_log.DebugFormat("Looking at entity {0}", ent.UUID); if (ent is SceneObjectGroup) { - if (((SceneObjectGroup)ent).HasChildPrim(localID)) + sog = (SceneObjectGroup)ent; + if (sog.HasChildPrim(localID)) { - sog = (SceneObjectGroup)ent; lock (SceneObjectGroupsByLocalID) - { SceneObjectGroupsByLocalID[localID] = sog; - } return sog; } } } + return null; } @@ -921,23 +909,21 @@ namespace OpenSim.Region.Framework.Scenes } } - List EntityList = GetEntities(); - - foreach (EntityBase ent in EntityList) + EntityBase[] entityList = GetEntities(); + foreach (EntityBase ent in entityList) { if (ent is SceneObjectGroup) { - if (((SceneObjectGroup)ent).HasChildPrim(fullID)) + sog = (SceneObjectGroup)ent; + if (sog.HasChildPrim(fullID)) { - sog = (SceneObjectGroup)ent; lock (SceneObjectGroupsByFullID) - { SceneObjectGroupsByFullID[fullID] = sog; - } return sog; } } } + return null; } @@ -946,7 +932,7 @@ namespace OpenSim.Region.Framework.Scenes // Primitive Ray Tracing float closestDistance = 280f; EntityIntersection result = new EntityIntersection(); - List EntityList = GetEntities(); + EntityBase[] EntityList = GetEntities(); foreach (EntityBase ent in EntityList) { if (ent is SceneObjectGroup) @@ -984,23 +970,28 @@ namespace OpenSim.Region.Framework.Scenes /// null if the part was not found protected internal SceneObjectPart GetSceneObjectPart(string name) { - List EntityList = GetEntities(); + SceneObjectPart sop = null; - // FIXME: use a dictionary here - foreach (EntityBase ent in EntityList) - { - if (ent is SceneObjectGroup) + Entities.Find( + delegate(EntityBase entity) { - foreach (SceneObjectPart p in ((SceneObjectGroup) ent).GetParts()) + if (entity is SceneObjectGroup) { - if (p.Name == name) + foreach (SceneObjectPart p in ((SceneObjectGroup)entity).GetParts()) { - return p; + if (p.Name == name) + { + sop = p; + return true; + } } } + + return false; } - } - return null; + ); + + return sop; } /// @@ -1021,7 +1012,7 @@ namespace OpenSim.Region.Framework.Scenes /// it /// /// - protected internal List GetEntities() + protected internal EntityBase[] GetEntities() { return Entities.GetEntities(); } @@ -1030,7 +1021,7 @@ namespace OpenSim.Region.Framework.Scenes { Dictionary topScripts = new Dictionary(); - List EntityList = GetEntities(); + EntityBase[] EntityList = GetEntities(); int limit = 0; foreach (EntityBase ent in EntityList) { @@ -1726,8 +1717,8 @@ namespace OpenSim.Region.Framework.Scenes UUID objid = UUID.Zero; SceneObjectPart obj = null; - List EntityList = GetEntities(); - foreach (EntityBase ent in EntityList) + EntityBase[] entityList = GetEntities(); + foreach (EntityBase ent in entityList) { if (ent is SceneObjectGroup) { diff --git a/OpenSim/Region/Framework/Scenes/SceneViewer.cs b/OpenSim/Region/Framework/Scenes/SceneViewer.cs index f478a4a..7aa5a93 100644 --- a/OpenSim/Region/Framework/Scenes/SceneViewer.cs +++ b/OpenSim/Region/Framework/Scenes/SceneViewer.cs @@ -75,7 +75,8 @@ namespace OpenSim.Region.Framework.Scenes lock(m_pendingObjects) { - foreach (EntityBase e in m_presence.Scene.Entities) + EntityBase[] entities = m_presence.Scene.Entities.GetEntities(); + foreach (EntityBase e in entities) { if (e != null && e is SceneObjectGroup) m_pendingObjects.Enqueue((SceneObjectGroup)e); diff --git a/OpenSim/Region/Framework/Scenes/Serialization/SceneXmlLoader.cs b/OpenSim/Region/Framework/Scenes/Serialization/SceneXmlLoader.cs index b6677f0..5494549 100644 --- a/OpenSim/Region/Framework/Scenes/Serialization/SceneXmlLoader.cs +++ b/OpenSim/Region/Framework/Scenes/Serialization/SceneXmlLoader.cs @@ -84,9 +84,8 @@ namespace OpenSim.Region.Framework.Scenes.Serialization int primCount = 0; stream.WriteLine("\n"); - List EntityList = scene.GetEntities(); - - foreach (EntityBase ent in EntityList) + EntityBase[] entityList = scene.GetEntities(); + foreach (EntityBase ent in entityList) { if (ent is SceneObjectGroup) { @@ -204,16 +203,14 @@ namespace OpenSim.Region.Framework.Scenes.Serialization public static void SavePrimsToXml2(Scene scene, string fileName) { - List EntityList = scene.GetEntities(); - - SavePrimListToXml2(EntityList, fileName); + EntityBase[] entityList = scene.GetEntities(); + SavePrimListToXml2(entityList, fileName); } public static void SavePrimsToXml2(Scene scene, TextWriter stream, Vector3 min, Vector3 max) { - List EntityList = scene.GetEntities(); - - SavePrimListToXml2(EntityList, stream, min, max); + EntityBase[] entityList = scene.GetEntities(); + SavePrimListToXml2(entityList, stream, min, max); } public static void SaveNamedPrimsToXml2(Scene scene, string primName, string fileName) @@ -222,7 +219,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization "[SERIALISER]: Saving prims with name {0} in xml2 format for region {1} to {2}", primName, scene.RegionInfo.RegionName, fileName); - List entityList = scene.GetEntities(); + EntityBase[] entityList = scene.GetEntities(); List primList = new List(); foreach (EntityBase ent in entityList) @@ -236,10 +233,10 @@ namespace OpenSim.Region.Framework.Scenes.Serialization } } - SavePrimListToXml2(primList, fileName); + SavePrimListToXml2(primList.ToArray(), fileName); } - public static void SavePrimListToXml2(List entityList, string fileName) + public static void SavePrimListToXml2(EntityBase[] entityList, string fileName) { FileStream file = new FileStream(fileName, FileMode.Create); try @@ -260,7 +257,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization } } - public static void SavePrimListToXml2(List entityList, TextWriter stream, Vector3 min, Vector3 max) + public static void SavePrimListToXml2(EntityBase[] entityList, TextWriter stream, Vector3 min, Vector3 max) { int primCount = 0; stream.WriteLine("\n"); diff --git a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs index 6793ef6..159af79 100644 --- a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs +++ b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs @@ -375,8 +375,7 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server private void IRC_SendNamesReply() { - List users = m_scene.Entities.GetAllByType(); - + EntityBase[] users = m_scene.Entities.GetAllByType(); foreach (EntityBase user in users) { SendServerCommand("353 " + m_nick + " = " + IrcRegionName + " :" + user.Name.Replace(" ", "")); @@ -386,8 +385,7 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server private void IRC_SendWhoReply() { - List users = m_scene.Entities.GetAllByType(); - + EntityBase[] users = m_scene.Entities.GetAllByType(); foreach (EntityBase user in users) { /*SendServerCommand(String.Format("352 {0} {1} {2} {3} {4} {5} :0 {6}", IrcRegionName, @@ -415,11 +413,11 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server private void IRC_SendReplyUsers() { - List users = m_scene.Entities.GetAllByType(); + EntityBase[] users = m_scene.Entities.GetAllByType(); SendServerCommand("392 :UserID Terminal Host"); - if (users.Count == 0) + if (users.Length == 0) { SendServerCommand("395 :Nobody logged in"); return; diff --git a/OpenSim/Region/OptionalModules/ContentManagementSystem/CMEntityCollection.cs b/OpenSim/Region/OptionalModules/ContentManagementSystem/CMEntityCollection.cs index de1e01c..d21b652 100644 --- a/OpenSim/Region/OptionalModules/ContentManagementSystem/CMEntityCollection.cs +++ b/OpenSim/Region/OptionalModules/ContentManagementSystem/CMEntityCollection.cs @@ -111,7 +111,7 @@ namespace OpenSim.Region.OptionalModules.ContentManagement } // Check if there are SceneObjectGroups in the list that do not have corresponding ContentManagementGroups in the CMEntityHash - public System.Collections.ArrayList CheckForMissingEntities(System.Collections.Generic.List currList) + public System.Collections.ArrayList CheckForMissingEntities(EntityBase[] currList) { System.Collections.ArrayList missingList = new System.Collections.ArrayList(); SceneObjectGroup temp = null; diff --git a/OpenSim/Region/OptionalModules/ContentManagementSystem/ContentManagementEntity.cs b/OpenSim/Region/OptionalModules/ContentManagementSystem/ContentManagementEntity.cs index 2730eee..49d20e1 100644 --- a/OpenSim/Region/OptionalModules/ContentManagementSystem/ContentManagementEntity.cs +++ b/OpenSim/Region/OptionalModules/ContentManagementSystem/ContentManagementEntity.cs @@ -127,7 +127,7 @@ namespace OpenSim.Region.OptionalModules.ContentManagement /// public void FindDifferences() { - System.Collections.Generic.List sceneEntityList = m_Entity.Scene.GetEntities(); + List sceneEntityList = new List(m_Entity.Scene.GetEntities()); DiffersFromSceneGroup = false; // if group is not contained in scene's list if (!ContainsKey(sceneEntityList, m_UnchangedEntity.UUID)) diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/ObjectAccessor.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/ObjectAccessor.cs index 6ba5ccf..140264b 100644 --- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/ObjectAccessor.cs +++ b/OpenSim/Region/OptionalModules/Scripting/Minimodule/ObjectAccessor.cs @@ -41,12 +41,14 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule private readonly Scene m_scene; private readonly IEnumerator m_sogEnum; private readonly ISecurityCredential m_security; + private readonly List m_entities; public IObjEnum(Scene scene, ISecurityCredential security) { m_scene = scene; m_security = security; - m_sogEnum = m_scene.Entities.GetAllByType().GetEnumerator(); + m_entities = new List(m_scene.Entities.GetEntities()); + m_sogEnum = m_entities.GetEnumerator(); } public void Dispose() diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/World.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/World.cs index 45bb005..f2324d2 100644 --- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/World.cs +++ b/OpenSim/Region/OptionalModules/Scripting/Minimodule/World.cs @@ -205,10 +205,10 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule { get { - List ents = m_internalScene.Entities.GetAllByType(); - IAvatar[] rets = new IAvatar[ents.Count]; + EntityBase[] ents = m_internalScene.Entities.GetAllByType(); + IAvatar[] rets = new IAvatar[ents.Length]; - for (int i = 0; i < ents.Count; i++) + for (int i = 0; i < ents.Length; i++) { EntityBase ent = ents[i]; rets[i] = new SPAvatar(m_internalScene, ent.UUID, m_security); diff --git a/OpenSim/Region/OptionalModules/World/TreePopulator/TreePopulatorModule.cs b/OpenSim/Region/OptionalModules/World/TreePopulator/TreePopulatorModule.cs index 3ed338b..421da36 100644 --- a/OpenSim/Region/OptionalModules/World/TreePopulator/TreePopulatorModule.cs +++ b/OpenSim/Region/OptionalModules/World/TreePopulator/TreePopulatorModule.cs @@ -568,8 +568,7 @@ namespace OpenSim.Region.OptionalModules.World.TreePopulator { m_copse = new List(); - List objs = m_scene.GetEntities(); - + EntityBase[] objs = m_scene.GetEntities(); foreach (EntityBase obj in objs) { if (obj is SceneObjectGroup) diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs index 5c2abd5..2b67e84 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs @@ -286,7 +286,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins } else { - Entities = m_CmdManager.m_ScriptEngine.World.GetEntities(); + Entities = new List(m_CmdManager.m_ScriptEngine.World.GetEntities()); } SceneObjectPart SensePoint = ts.host; diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianActivityDetector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianActivityDetector.cs index 67b73f3..67a06f3 100644 --- a/OpenSim/Services/Connectors/SimianGrid/SimianActivityDetector.cs +++ b/OpenSim/Services/Connectors/SimianGrid/SimianActivityDetector.cs @@ -69,7 +69,10 @@ namespace OpenSim.Services.Connectors.SimianGrid public void OnMakeRootAgent(ScenePresence sp) { m_log.DebugFormat("[SIMIAN ACTIVITY DETECTOR]: Detected root presence {0} in {1}", sp.UUID, sp.Scene.RegionInfo.RegionName); - m_GridUserService.SetLastPosition(sp.UUID.ToString(), sp.ControllingClient.SessionId, sp.Scene.RegionInfo.RegionID, sp.AbsolutePosition, sp.Lookat); + Util.FireAndForget(delegate(object o) + { + m_GridUserService.SetLastPosition(sp.UUID.ToString(), sp.ControllingClient.SessionId, sp.Scene.RegionInfo.RegionID, sp.AbsolutePosition, sp.Lookat); + }); } public void OnNewClient(IClientAPI client) -- cgit v1.1 From b597a295c489cef217b9dca6bd22df1340ca39ce Mon Sep 17 00:00:00 2001 From: John Hurliman Date: Fri, 10 Sep 2010 12:41:36 -0700 Subject: Second pass at cleaning up thread safety in EntityManager and SceneGraph --- OpenSim/Region/Framework/Scenes/EntityManager.cs | 16 +----- OpenSim/Region/Framework/Scenes/SceneGraph.cs | 66 +++++++++++----------- .../Region/Framework/Scenes/SceneObjectGroup.cs | 11 +--- 3 files changed, 35 insertions(+), 58 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/EntityManager.cs b/OpenSim/Region/Framework/Scenes/EntityManager.cs index 85d0a4f..0defa93 100644 --- a/OpenSim/Region/Framework/Scenes/EntityManager.cs +++ b/OpenSim/Region/Framework/Scenes/EntityManager.cs @@ -34,7 +34,7 @@ using OpenMetaverse; namespace OpenSim.Region.Framework.Scenes { - public class EntityManager //: IEnumerable + public class EntityManager { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private readonly DoubleDictionary m_entities = new DoubleDictionary(); @@ -143,19 +143,5 @@ namespace OpenSim.Region.Framework.Scenes { return m_entities.TryGetValue(key, out obj); } - - /// - /// This could be optimised to work on the list 'live' rather than making a safe copy and iterating that. - /// - /// - //public IEnumerator GetEnumerator() - //{ - // return GetEntities().GetEnumerator(); - //} - - //IEnumerator IEnumerable.GetEnumerator() - //{ - // return GetEnumerator(); - //} } } diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs index 3d3e822..f779a6d 100644 --- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs +++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs @@ -72,10 +72,7 @@ namespace OpenSim.Region.Framework.Scenes protected Dictionary m_scenePresenceMap = new Dictionary(); protected List m_scenePresenceArray = new List(); - // SceneObjects is not currently populated or used. - //public Dictionary SceneObjects; protected internal EntityManager Entities = new EntityManager(); -// protected internal Dictionary Entities = new Dictionary(); protected internal Dictionary RestorePresences = new Dictionary(); protected RegionInfo m_regInfo; @@ -351,28 +348,28 @@ namespace OpenSim.Region.Framework.Scenes if (Entities.ContainsKey(sceneObject.UUID)) return false; - // Clamp child prim sizes and add child prims to the m_numPrim count + List children; lock (sceneObject.Children) + children = new List(sceneObject.Children.Values); + + // Clamp child prim sizes and add child prims to the m_numPrim count + if (m_parentScene.m_clampPrimSize) { - if (m_parentScene.m_clampPrimSize) + foreach (SceneObjectPart part in children) { - foreach (SceneObjectPart part in sceneObject.Children.Values) - { - Vector3 scale = part.Shape.Scale; + Vector3 scale = part.Shape.Scale; - if (scale.X > m_parentScene.m_maxNonphys) - scale.X = m_parentScene.m_maxNonphys; - if (scale.Y > m_parentScene.m_maxNonphys) - scale.Y = m_parentScene.m_maxNonphys; - if (scale.Z > m_parentScene.m_maxNonphys) - scale.Z = m_parentScene.m_maxNonphys; + if (scale.X > m_parentScene.m_maxNonphys) + scale.X = m_parentScene.m_maxNonphys; + if (scale.Y > m_parentScene.m_maxNonphys) + scale.Y = m_parentScene.m_maxNonphys; + if (scale.Z > m_parentScene.m_maxNonphys) + scale.Z = m_parentScene.m_maxNonphys; - part.Shape.Scale = scale; - } + part.Shape.Scale = scale; } - - m_numPrim += sceneObject.Children.Count; } + m_numPrim += children.Count; sceneObject.AttachToScene(m_parentScene); @@ -390,14 +387,14 @@ namespace OpenSim.Region.Framework.Scenes lock (SceneObjectGroupsByFullID) { SceneObjectGroupsByFullID[sceneObject.UUID] = sceneObject; - foreach (SceneObjectPart part in sceneObject.Children.Values) + foreach (SceneObjectPart part in children) SceneObjectGroupsByFullID[part.UUID] = sceneObject; } lock (SceneObjectGroupsByLocalID) { SceneObjectGroupsByLocalID[sceneObject.LocalId] = sceneObject; - foreach (SceneObjectPart part in sceneObject.Children.Values) + foreach (SceneObjectPart part in children) SceneObjectGroupsByLocalID[part.LocalId] = sceneObject; } @@ -859,13 +856,13 @@ namespace OpenSim.Region.Framework.Scenes //m_log.DebugFormat("Entered GetGroupByPrim with localID {0}", localID); SceneObjectGroup sog; lock (SceneObjectGroupsByLocalID) + SceneObjectGroupsByLocalID.TryGetValue(localID, out sog); + + if (sog != null) { - if (SceneObjectGroupsByLocalID.TryGetValue(localID, out sog)) - { - if (sog.HasChildPrim(localID)) - return sog; - SceneObjectGroupsByLocalID.Remove(localID); - } + if (sog.HasChildPrim(localID)) + return sog; + SceneObjectGroupsByLocalID.Remove(localID); } EntityBase[] entityList = GetEntities(); @@ -896,17 +893,18 @@ namespace OpenSim.Region.Framework.Scenes { SceneObjectGroup sog; lock (SceneObjectGroupsByFullID) + SceneObjectGroupsByFullID.TryGetValue(fullID, out sog); + + if (sog != null) { - if (SceneObjectGroupsByFullID.TryGetValue(fullID, out sog)) + lock (sog.Children) { - lock (sog.Children) - { - if (sog.Children.ContainsKey(fullID)) - return sog; - } - - SceneObjectGroupsByFullID.Remove(fullID); + if (sog.Children.ContainsKey(fullID)) + return sog; } + + lock (SceneObjectGroupsByFullID) + SceneObjectGroupsByFullID.Remove(fullID); } EntityBase[] entityList = GetEntities(); diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 09e3e0e..ba5e33c 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -2091,16 +2091,9 @@ namespace OpenSim.Region.Framework.Scenes /// null if a child part with the primID was not found public SceneObjectPart GetChildPart(UUID primID) { - SceneObjectPart childPart = null; - + SceneObjectPart childPart; lock (m_parts) - { - if (m_parts.ContainsKey(primID)) - { - childPart = m_parts[primID]; - } - } - + m_parts.TryGetValue(primID, out childPart); return childPart; } -- cgit v1.1 From a7f4e10f425cef4b85810486ba31c59b3ba206fc Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 10 Sep 2010 21:50:40 +0100 Subject: Remove parenthesis around the release flavour to get the version string back under 27 chars Can't quite remember why this has to be <=27 chars, maybe something to do with the space available for the version string in a typical client --- OpenSim/Framework/Servers/VersionInfo.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OpenSim/Framework/Servers/VersionInfo.cs b/OpenSim/Framework/Servers/VersionInfo.cs index 100bf1f..c88e0d1 100644 --- a/OpenSim/Framework/Servers/VersionInfo.cs +++ b/OpenSim/Framework/Servers/VersionInfo.cs @@ -49,7 +49,7 @@ namespace OpenSim public static string GetVersionString(string versionNumber, Flavour flavour) { - string versionString = "OpenSim " + versionNumber + " (" + flavour + ")"; + string versionString = "OpenSim " + versionNumber + " " + flavour; return versionString.PadRight(VERSIONINFO_VERSION_LENGTH); } -- cgit v1.1 From 30306a775af74e1fe080590998a71a4c7e64ad12 Mon Sep 17 00:00:00 2001 From: randomhuman Date: Sun, 5 Sep 2010 21:44:46 +0100 Subject: Made it impossible to create a user with names containing spaces and prevented passwords from being echoed after enter is pressed. --- OpenSim/Framework/Console/ConsoleBase.cs | 51 ++++++++++++++++++++++ OpenSim/Framework/Console/LocalConsole.cs | 5 ++- OpenSim/Region/Framework/Scenes/Scene.cs | 5 ++- .../UserAccountService/UserAccountService.cs | 6 ++- 4 files changed, 61 insertions(+), 6 deletions(-) diff --git a/OpenSim/Framework/Console/ConsoleBase.cs b/OpenSim/Framework/Console/ConsoleBase.cs index aab920b..22ce880 100755 --- a/OpenSim/Framework/Console/ConsoleBase.cs +++ b/OpenSim/Framework/Console/ConsoleBase.cs @@ -89,6 +89,57 @@ namespace OpenSim.Framework.Console return ret; } + + public string CmdPrompt(string p, List excludedCharacters) + { + bool itisdone = false; + string ret = String.Empty; + while (!itisdone) + { + itisdone = true; + ret = CmdPrompt(p); + + foreach (char c in excludedCharacters) + { + if (ret.Contains(c.ToString())) + { + System.Console.WriteLine("The character \"" + c.ToString() + "\" is not permitted."); + itisdone = false; + } + } + } + + return ret; + } + + public string CmdPrompt(string p, string def, List excludedCharacters) + { + bool itisdone = false; + string ret = String.Empty; + while (!itisdone) + { + itisdone = true; + ret = CmdPrompt(p, def); + + if (ret == String.Empty) + { + ret = def; + } + else + { + foreach (char c in excludedCharacters) + { + if (ret.Contains(c.ToString())) + { + System.Console.WriteLine("The character \"" + c.ToString() + "\" is not permitted."); + itisdone = false; + } + } + } + } + + return ret; + } // Displays a command prompt and returns a default value, user may only enter 1 of 2 options public string CmdPrompt(string prompt, string defaultresponse, List options) diff --git a/OpenSim/Framework/Console/LocalConsole.cs b/OpenSim/Framework/Console/LocalConsole.cs index a3036d0..c968031 100644 --- a/OpenSim/Framework/Console/LocalConsole.cs +++ b/OpenSim/Framework/Console/LocalConsole.cs @@ -461,7 +461,8 @@ namespace OpenSim.Framework.Console SetCursorLeft(0); y = SetCursorTop(y); - System.Console.WriteLine("{0}{1}", prompt, cmdline); + System.Console.WriteLine(); + //Show(); lock (cmdline) { @@ -486,7 +487,7 @@ namespace OpenSim.Framework.Console } } - AddToHistory(cmdline.ToString()); + //AddToHistory(cmdline.ToString()); return cmdline.ToString(); default: break; diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 7ce95a7..6fa78e0 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -1159,8 +1159,9 @@ namespace OpenSim.Region.Framework.Scenes while (m_regInfo.EstateSettings.EstateOwner == UUID.Zero && MainConsole.Instance != null) { MainConsole.Instance.Output("The current estate has no owner set."); - string first = MainConsole.Instance.CmdPrompt("Estate owner first name", "Test"); - string last = MainConsole.Instance.CmdPrompt("Estate owner last name", "User"); + List excluded = new List(new char[1]{' '}); + string first = MainConsole.Instance.CmdPrompt("Estate owner first name", "Test", excluded); + string last = MainConsole.Instance.CmdPrompt("Estate owner last name", "User", excluded); UserAccount account = UserAccountService.GetUserAccount(m_regInfo.ScopeID, first, last); diff --git a/OpenSim/Services/UserAccountService/UserAccountService.cs b/OpenSim/Services/UserAccountService/UserAccountService.cs index 326e502..65c247f 100644 --- a/OpenSim/Services/UserAccountService/UserAccountService.cs +++ b/OpenSim/Services/UserAccountService/UserAccountService.cs @@ -296,13 +296,15 @@ namespace OpenSim.Services.UserAccountService string lastName; string password; string email; + + List excluded = new List(new char[]{' '}); if (cmdparams.Length < 3) - firstName = MainConsole.Instance.CmdPrompt("First name", "Default"); + firstName = MainConsole.Instance.CmdPrompt("First name", "Default", excluded); else firstName = cmdparams[2]; if (cmdparams.Length < 4) - lastName = MainConsole.Instance.CmdPrompt("Last name", "User"); + lastName = MainConsole.Instance.CmdPrompt("Last name", "User", excluded); else lastName = cmdparams[3]; if (cmdparams.Length < 5) -- cgit v1.1 From 220f82a0f0e05ab7d01c9028675c5c779cb6f5fc Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Sat, 11 Sep 2010 00:27:52 +0100 Subject: Make it clear that the "create region" command will reference ini files in the regions directory (usually Regions/) Also convert some tabs into spaces. --- OpenSim/Region/Application/OpenSim.cs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/OpenSim/Region/Application/OpenSim.cs b/OpenSim/Region/Application/OpenSim.cs index 3c2575d..4f2d223 100644 --- a/OpenSim/Region/Application/OpenSim.cs +++ b/OpenSim/Region/Application/OpenSim.cs @@ -316,7 +316,7 @@ namespace OpenSim m_console.Commands.AddCommand("region", false, "create region", "create region [\"region name\"] ", "Create a new region.", - "The settings for \"region name\" are read from ." + "The settings for \"region name\" are read from in your Regions directory." + " If \"region name\" does not exist in , it will be added." + Environment.NewLine + "Without \"region name\", the first region found in will be created." + Environment.NewLine + "If does not exist, it will be created.", @@ -552,17 +552,18 @@ namespace OpenSim regionFile = Path.Combine(regionsDir, regionFile); } - RegionInfo regInfo; + RegionInfo regInfo; if (isXml) { - regInfo = new RegionInfo(regionName, regionFile, false, ConfigSource.Source); + regInfo = new RegionInfo(regionName, regionFile, false, ConfigSource.Source); } else { - regInfo = new RegionInfo(regionName, regionFile, false, ConfigSource.Source, regionName); + regInfo = new RegionInfo(regionName, regionFile, false, ConfigSource.Source, regionName); } + IScene scene; - PopulateRegionEstateInfo(regInfo); + PopulateRegionEstateInfo(regInfo); CreateRegion(regInfo, true, out scene); regInfo.EstateSettings.Save(); } -- cgit v1.1 From 7e65590a55ba575d0086bdfc25addaf1051d799b Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Sat, 11 Sep 2010 01:13:08 +0100 Subject: Update Prebuild.exe with Prebuild r323 + an existing OpenSim specific nant hack to correctly clean up chosen OpenSim exes and dlls in bin/ on a "nant clean" Source code is included for reference. This can go away again once Prebuild is updated with a more general mechanism for cleaning up files. The Prebuild source code here can be built with nant, or regnerated for other tools using the prebuild at {root}/bin/Prebuild.exe --- Prebuild/AUTHORS | 10 + Prebuild/COPYING | 65 ++ Prebuild/ChangeLog | 461 +++++++++ Prebuild/INSTALL | 236 +++++ Prebuild/NEWS | 200 ++++ Prebuild/README | 274 +++++ Prebuild/THANKS | 18 + Prebuild/TODO | 43 + Prebuild/clean.bat | 1 + Prebuild/clean.sh | 1 + Prebuild/doc/.svn/all-wcprops | 35 + Prebuild/doc/.svn/dir-prop-base | 5 + Prebuild/doc/.svn/entries | 198 ++++ .../.svn/prop-base/prebuild-example1.xml.svn-base | 9 + .../.svn/prop-base/prebuild-example2.xml.svn-base | 9 + .../.svn/prop-base/prebuild-example3.xml.svn-base | 9 + .../.svn/prop-base/prebuild-example4.xml.svn-base | 9 + .../.svn/text-base/prebuild-example1.xml.svn-base | 300 ++++++ .../.svn/text-base/prebuild-example2.xml.svn-base | 72 ++ .../.svn/text-base/prebuild-example3.xml.svn-base | 113 +++ .../.svn/text-base/prebuild-example4.xml.svn-base | 715 +++++++++++++ .../.svn/text-base/prebuild-example5.xml.svn-base | 187 ++++ Prebuild/doc/prebuild-example1.xml | 300 ++++++ Prebuild/doc/prebuild-example2.xml | 72 ++ Prebuild/doc/prebuild-example3.xml | 113 +++ Prebuild/doc/prebuild-example4.xml | 715 +++++++++++++ Prebuild/doc/prebuild-example5.xml | 187 ++++ Prebuild/prebuild | 2 + Prebuild/prebuild.xml | 73 ++ Prebuild/scripts/.svn/all-wcprops | 125 +++ Prebuild/scripts/.svn/dir-prop-base | 6 + Prebuild/scripts/.svn/entries | 708 +++++++++++++ Prebuild/scripts/.svn/prop-base/Clean.bat.svn-base | 13 + Prebuild/scripts/.svn/prop-base/Clean.sh.svn-base | 9 + Prebuild/scripts/.svn/prop-base/Help.bat.svn-base | 13 + .../scripts/.svn/prop-base/MonoDevelop.sh.svn-base | 13 + .../scripts/.svn/prop-base/Prebuild.nsi.svn-base | 9 + .../.svn/prop-base/SharpDevelop.bat.svn-base | 13 + .../.svn/prop-base/SharpDevelop2.bat.svn-base | 5 + .../scripts/.svn/prop-base/VS2002.bat.svn-base | 13 + .../scripts/.svn/prop-base/VS2003.bat.svn-base | 13 + .../scripts/.svn/prop-base/VS2005.bat.svn-base | 13 + .../scripts/.svn/prop-base/VS2008.bat.svn-base | 5 + .../scripts/.svn/prop-base/autotools.bat.svn-base | 5 + .../scripts/.svn/prop-base/autotools.sh.svn-base | 5 + .../scripts/.svn/prop-base/makefile.bat.svn-base | 9 + .../scripts/.svn/prop-base/makefile.sh.svn-base | 9 + Prebuild/scripts/.svn/prop-base/nant.bat.svn-base | 13 + Prebuild/scripts/.svn/prop-base/nant.sh.svn-base | 13 + Prebuild/scripts/.svn/prop-base/xcode.bat.svn-base | 9 + Prebuild/scripts/.svn/prop-base/xcode.sh.svn-base | 9 + Prebuild/scripts/.svn/text-base/Clean.bat.svn-base | 2 + Prebuild/scripts/.svn/text-base/Clean.sh.svn-base | 4 + Prebuild/scripts/.svn/text-base/Help.bat.svn-base | 2 + .../scripts/.svn/text-base/MonoDevelop.sh.svn-base | 2 + .../scripts/.svn/text-base/Prebuild.nsi.svn-base | 231 +++++ .../.svn/text-base/SharpDevelop.bat.svn-base | 4 + .../.svn/text-base/SharpDevelop2.bat.svn-base | 4 + .../scripts/.svn/text-base/VS2002.bat.svn-base | 4 + .../scripts/.svn/text-base/VS2003.bat.svn-base | 4 + .../scripts/.svn/text-base/VS2005.bat.svn-base | 4 + .../scripts/.svn/text-base/VS2008.bat.svn-base | 4 + .../scripts/.svn/text-base/VS2010.bat.svn-base | 4 + .../scripts/.svn/text-base/autotools.bat.svn-base | 4 + .../scripts/.svn/text-base/autotools.sh.svn-base | 5 + .../scripts/.svn/text-base/makefile.bat.svn-base | 4 + .../scripts/.svn/text-base/makefile.sh.svn-base | 10 + Prebuild/scripts/.svn/text-base/nant.bat.svn-base | 4 + Prebuild/scripts/.svn/text-base/nant.sh.svn-base | 2 + Prebuild/scripts/.svn/text-base/xcode.bat.svn-base | 4 + Prebuild/scripts/.svn/text-base/xcode.sh.svn-base | 2 + Prebuild/scripts/Clean.bat | 2 + Prebuild/scripts/Clean.sh | 4 + Prebuild/scripts/Help.bat | 2 + Prebuild/scripts/MonoDevelop.sh | 2 + Prebuild/scripts/Prebuild.nsi | 231 +++++ Prebuild/scripts/SharpDevelop.bat | 4 + Prebuild/scripts/SharpDevelop2.bat | 4 + Prebuild/scripts/VS2002.bat | 4 + Prebuild/scripts/VS2003.bat | 4 + Prebuild/scripts/VS2005.bat | 4 + Prebuild/scripts/VS2008.bat | 4 + Prebuild/scripts/VS2010.bat | 4 + Prebuild/scripts/autotools.bat | 4 + Prebuild/scripts/autotools.sh | 5 + Prebuild/scripts/makefile.bat | 4 + Prebuild/scripts/makefile.sh | 10 + Prebuild/scripts/nant.bat | 4 + Prebuild/scripts/nant.sh | 2 + Prebuild/scripts/xcode.bat | 4 + Prebuild/scripts/xcode.sh | 2 + Prebuild/src/.svn/all-wcprops | 23 + Prebuild/src/.svn/dir-prop-base | 16 + Prebuild/src/.svn/entries | 139 +++ Prebuild/src/.svn/prop-base/App.ico.svn-base | 5 + Prebuild/src/.svn/prop-base/Prebuild.cs.svn-base | 9 + Prebuild/src/.svn/prop-base/Prebuild.snk.svn-base | 5 + Prebuild/src/.svn/text-base/App.ico.svn-base | Bin 0 -> 4286 bytes Prebuild/src/.svn/text-base/Prebuild.cs.svn-base | 165 +++ Prebuild/src/.svn/text-base/Prebuild.snk.svn-base | Bin 0 -> 596 bytes Prebuild/src/App.ico | Bin 0 -> 4286 bytes Prebuild/src/Core/.svn/all-wcprops | 29 + Prebuild/src/Core/.svn/dir-prop-base | 5 + Prebuild/src/Core/.svn/entries | 182 ++++ .../Core/.svn/prop-base/FatalException.cs.svn-base | 9 + .../src/Core/.svn/prop-base/Kernel.cs.svn-base | 9 + .../prop-base/UnknownLanguageException.cs.svn-base | 9 + .../.svn/prop-base/WarningException.cs.svn-base | 9 + .../Core/.svn/text-base/FatalException.cs.svn-base | 85 ++ .../src/Core/.svn/text-base/Kernel.cs.svn-base | 832 +++++++++++++++ .../text-base/UnknownLanguageException.cs.svn-base | 63 ++ .../.svn/text-base/WarningException.cs.svn-base | 84 ++ Prebuild/src/Core/Attributes/.svn/all-wcprops | 23 + Prebuild/src/Core/Attributes/.svn/dir-prop-base | 5 + Prebuild/src/Core/Attributes/.svn/entries | 130 +++ .../.svn/prop-base/DataNodeAttribute.cs.svn-base | 9 + .../.svn/prop-base/OptionNodeAttribute.cs.svn-base | 9 + .../.svn/prop-base/TargetAttribute.cs.svn-base | 9 + .../.svn/text-base/DataNodeAttribute.cs.svn-base | 72 ++ .../.svn/text-base/OptionNodeAttribute.cs.svn-base | 71 ++ .../.svn/text-base/TargetAttribute.cs.svn-base | 71 ++ Prebuild/src/Core/Attributes/DataNodeAttribute.cs | 72 ++ .../src/Core/Attributes/OptionNodeAttribute.cs | 71 ++ Prebuild/src/Core/Attributes/TargetAttribute.cs | 71 ++ Prebuild/src/Core/FatalException.cs | 85 ++ Prebuild/src/Core/Interfaces/.svn/all-wcprops | 17 + Prebuild/src/Core/Interfaces/.svn/dir-prop-base | 5 + Prebuild/src/Core/Interfaces/.svn/entries | 96 ++ .../.svn/prop-base/IDataNode.cs.svn-base | 9 + .../Interfaces/.svn/prop-base/ITarget.cs.svn-base | 9 + .../.svn/text-base/IDataNode.cs.svn-base | 47 + .../Interfaces/.svn/text-base/ITarget.cs.svn-base | 51 + Prebuild/src/Core/Interfaces/IDataNode.cs | 47 + Prebuild/src/Core/Interfaces/ITarget.cs | 51 + Prebuild/src/Core/Kernel.cs | 832 +++++++++++++++ Prebuild/src/Core/Nodes/.svn/all-wcprops | 119 +++ Prebuild/src/Core/Nodes/.svn/dir-prop-base | 5 + Prebuild/src/Core/Nodes/.svn/entries | 674 ++++++++++++ .../.svn/prop-base/ConfigurationNode.cs.svn-base | 9 + .../Core/Nodes/.svn/prop-base/DataNode.cs.svn-base | 9 + .../Nodes/.svn/prop-base/ExcludeNode.cs.svn-base | 9 + .../Core/Nodes/.svn/prop-base/FileNode.cs.svn-base | 9 + .../Nodes/.svn/prop-base/FilesNode.cs.svn-base | 9 + .../Nodes/.svn/prop-base/MatchNode.cs.svn-base | 9 + .../Nodes/.svn/prop-base/OptionsNode.cs.svn-base | 9 + .../Nodes/.svn/prop-base/ProcessNode.cs.svn-base | 9 + .../Nodes/.svn/prop-base/ProjectNode.cs.svn-base | 9 + .../Nodes/.svn/prop-base/ReferenceNode.cs.svn-base | 9 + .../.svn/prop-base/ReferencePathNode.cs.svn-base | 9 + .../Nodes/.svn/prop-base/SolutionNode.cs.svn-base | 9 + .../Nodes/.svn/text-base/AuthorNode.cs.svn-base | 87 ++ .../.svn/text-base/CleanFilesNode.cs.svn-base | 80 ++ .../Nodes/.svn/text-base/CleanupNode.cs.svn-base | 85 ++ .../.svn/text-base/ConfigurationNode.cs.svn-base | 225 ++++ .../ConfigurationNodeCollection.cs.svn-base | 71 ++ .../Core/Nodes/.svn/text-base/DataNode.cs.svn-base | 117 +++ .../.svn/text-base/DatabaseProjectNode.cs.svn-base | 93 ++ .../text-base/DatabaseReferenceNode.cs.svn-base | 63 ++ .../.svn/text-base/DescriptionNode.cs.svn-base | 87 ++ .../Nodes/.svn/text-base/ExcludeNode.cs.svn-base | 89 ++ .../Core/Nodes/.svn/text-base/FileNode.cs.svn-base | 285 ++++++ .../Nodes/.svn/text-base/FilesNode.cs.svn-base | 204 ++++ .../Nodes/.svn/text-base/MatchNode.cs.svn-base | 367 +++++++ .../Nodes/.svn/text-base/OptionsNode.cs.svn-base | 634 ++++++++++++ .../Nodes/.svn/text-base/ProcessNode.cs.svn-base | 108 ++ .../Nodes/.svn/text-base/ProjectNode.cs.svn-base | 579 +++++++++++ .../Nodes/.svn/text-base/ReferenceNode.cs.svn-base | 144 +++ .../.svn/text-base/ReferencePathNode.cs.svn-base | 97 ++ .../Nodes/.svn/text-base/SolutionNode.cs.svn-base | 382 +++++++ Prebuild/src/Core/Nodes/AuthorNode.cs | 87 ++ Prebuild/src/Core/Nodes/CleanFilesNode.cs | 80 ++ Prebuild/src/Core/Nodes/CleanupNode.cs | 85 ++ Prebuild/src/Core/Nodes/ConfigurationNode.cs | 225 ++++ .../src/Core/Nodes/ConfigurationNodeCollection.cs | 71 ++ Prebuild/src/Core/Nodes/DataNode.cs | 117 +++ Prebuild/src/Core/Nodes/DatabaseProjectNode.cs | 93 ++ Prebuild/src/Core/Nodes/DatabaseReferenceNode.cs | 63 ++ Prebuild/src/Core/Nodes/DescriptionNode.cs | 87 ++ Prebuild/src/Core/Nodes/ExcludeNode.cs | 89 ++ Prebuild/src/Core/Nodes/FileNode.cs | 285 ++++++ Prebuild/src/Core/Nodes/FilesNode.cs | 204 ++++ Prebuild/src/Core/Nodes/MatchNode.cs | 367 +++++++ Prebuild/src/Core/Nodes/OptionsNode.cs | 634 ++++++++++++ Prebuild/src/Core/Nodes/ProcessNode.cs | 108 ++ Prebuild/src/Core/Nodes/ProjectNode.cs | 579 +++++++++++ Prebuild/src/Core/Nodes/ReferenceNode.cs | 144 +++ Prebuild/src/Core/Nodes/ReferencePathNode.cs | 97 ++ Prebuild/src/Core/Nodes/SolutionNode.cs | 382 +++++++ Prebuild/src/Core/Parse/.svn/all-wcprops | 17 + Prebuild/src/Core/Parse/.svn/dir-prop-base | 5 + Prebuild/src/Core/Parse/.svn/entries | 96 ++ .../Parse/.svn/prop-base/IfContext.cs.svn-base | 9 + .../Parse/.svn/prop-base/Preprocessor.cs.svn-base | 9 + .../Parse/.svn/text-base/IfContext.cs.svn-base | 154 +++ .../Parse/.svn/text-base/Preprocessor.cs.svn-base | 652 ++++++++++++ Prebuild/src/Core/Parse/IfContext.cs | 154 +++ Prebuild/src/Core/Parse/Preprocessor.cs | 652 ++++++++++++ Prebuild/src/Core/Targets/.NAntTarget.cs.swp | Bin 0 -> 49152 bytes Prebuild/src/Core/Targets/.svn/all-wcprops | 101 ++ Prebuild/src/Core/Targets/.svn/dir-prop-base | 5 + Prebuild/src/Core/Targets/.svn/entries | 572 +++++++++++ .../Targets/.svn/prop-base/DebugTarget.cs.svn-base | 9 + .../.svn/prop-base/MakefileTarget.cs.svn-base | 9 + .../.svn/prop-base/MonoDevelopTarget.cs.svn-base | 9 + .../Targets/.svn/prop-base/NAntTarget.cs.svn-base | 9 + .../.svn/prop-base/SharpDevelopTarget.cs.svn-base | 9 + .../.svn/prop-base/VS2002Target.cs.svn-base | 9 + .../.svn/prop-base/VS2003Target.cs.svn-base | 9 + .../.svn/prop-base/VS2005Target.cs.svn-base | 9 + .../Targets/.svn/prop-base/XcodeTarget.cs.svn-base | 9 + .../.svn/text-base/AutotoolsTarget.cs.svn-base | 1070 ++++++++++++++++++++ .../Targets/.svn/text-base/DebugTarget.cs.svn-base | 102 ++ .../.svn/text-base/MakefileTarget.cs.svn-base | 469 +++++++++ .../.svn/text-base/MonoDevelopTarget.cs.svn-base | 515 ++++++++++ .../Targets/.svn/text-base/NAntTarget.cs.svn-base | 776 ++++++++++++++ .../.svn/text-base/SharpDevelop2Target.cs.svn-base | 82 ++ .../.svn/text-base/SharpDevelopTarget.cs.svn-base | 425 ++++++++ .../Targets/.svn/text-base/ToolInfo.cs.svn-base | 197 ++++ .../.svn/text-base/VS2002Target.cs.svn-base | 87 ++ .../.svn/text-base/VS2003Target.cs.svn-base | 593 +++++++++++ .../.svn/text-base/VS2005Target.cs.svn-base | 147 +++ .../.svn/text-base/VS2008Target.cs.svn-base | 127 +++ .../.svn/text-base/VS2010Target.cs.svn-base | 138 +++ .../.svn/text-base/VSGenericTarget.cs.svn-base | 922 +++++++++++++++++ .../Targets/.svn/text-base/VSVersion.cs.svn-base | 54 + .../Targets/.svn/text-base/XcodeTarget.cs.svn-base | 594 +++++++++++ Prebuild/src/Core/Targets/AutotoolsTarget.cs | 1070 ++++++++++++++++++++ Prebuild/src/Core/Targets/DebugTarget.cs | 102 ++ Prebuild/src/Core/Targets/MakefileTarget.cs | 469 +++++++++ Prebuild/src/Core/Targets/MonoDevelopTarget.cs | 515 ++++++++++ Prebuild/src/Core/Targets/NAntTarget.cs | 792 +++++++++++++++ Prebuild/src/Core/Targets/SharpDevelop2Target.cs | 82 ++ Prebuild/src/Core/Targets/SharpDevelopTarget.cs | 425 ++++++++ Prebuild/src/Core/Targets/ToolInfo.cs | 197 ++++ Prebuild/src/Core/Targets/VS2002Target.cs | 87 ++ Prebuild/src/Core/Targets/VS2003Target.cs | 593 +++++++++++ Prebuild/src/Core/Targets/VS2005Target.cs | 147 +++ Prebuild/src/Core/Targets/VS2008Target.cs | 127 +++ Prebuild/src/Core/Targets/VS2010Target.cs | 138 +++ Prebuild/src/Core/Targets/VSGenericTarget.cs | 922 +++++++++++++++++ Prebuild/src/Core/Targets/VSVersion.cs | 54 + Prebuild/src/Core/Targets/XcodeTarget.cs | 594 +++++++++++ Prebuild/src/Core/UnknownLanguageException.cs | 63 ++ Prebuild/src/Core/Utilities/.svn/all-wcprops | 29 + Prebuild/src/Core/Utilities/.svn/dir-prop-base | 5 + Prebuild/src/Core/Utilities/.svn/entries | 164 +++ .../prop-base/CommandLineCollection.cs.svn-base | 9 + .../.svn/prop-base/CurrentDirectory.cs.svn-base | 9 + .../Utilities/.svn/prop-base/Helper.cs.svn-base | 9 + .../Core/Utilities/.svn/prop-base/Log.cs.svn-base | 9 + .../text-base/CommandLineCollection.cs.svn-base | 152 +++ .../.svn/text-base/CurrentDirectory.cs.svn-base | 68 ++ .../Utilities/.svn/text-base/Helper.cs.svn-base | 575 +++++++++++ .../Core/Utilities/.svn/text-base/Log.cs.svn-base | 276 +++++ .../src/Core/Utilities/CommandLineCollection.cs | 152 +++ Prebuild/src/Core/Utilities/CurrentDirectory.cs | 68 ++ Prebuild/src/Core/Utilities/Helper.cs | 575 +++++++++++ Prebuild/src/Core/Utilities/Log.cs | 276 +++++ Prebuild/src/Core/WarningException.cs | 84 ++ Prebuild/src/Prebuild.cs | 165 +++ Prebuild/src/Prebuild.snk | Bin 0 -> 596 bytes Prebuild/src/Properties/.svn/all-wcprops | 11 + Prebuild/src/Properties/.svn/entries | 62 ++ .../.svn/prop-base/AssemblyInfo.cs.svn-base | 9 + .../.svn/text-base/AssemblyInfo.cs.svn-base | 113 +++ Prebuild/src/Properties/AssemblyInfo.cs | 113 +++ Prebuild/src/data/.svn/all-wcprops | 71 ++ Prebuild/src/data/.svn/dir-prop-base | 6 + Prebuild/src/data/.svn/entries | 402 ++++++++ .../src/data/.svn/prop-base/dnpb-1.0.xsd.svn-base | 9 + .../src/data/.svn/prop-base/dnpb-1.1.xsd.svn-base | 9 + .../src/data/.svn/prop-base/dnpb-1.2.xsd.svn-base | 9 + .../src/data/.svn/prop-base/dnpb-1.3.xsd.svn-base | 9 + .../src/data/.svn/prop-base/dnpb-1.4.xsd.svn-base | 9 + .../src/data/.svn/prop-base/dnpb-1.5.xsd.svn-base | 9 + .../data/.svn/prop-base/prebuild-1.6.xsd.svn-base | 9 + .../src/data/.svn/text-base/autotools.xml.svn-base | 790 +++++++++++++++ .../src/data/.svn/text-base/dnpb-1.0.xsd.svn-base | 183 ++++ .../src/data/.svn/text-base/dnpb-1.1.xsd.svn-base | 184 ++++ .../src/data/.svn/text-base/dnpb-1.2.xsd.svn-base | 198 ++++ .../src/data/.svn/text-base/dnpb-1.3.xsd.svn-base | 206 ++++ .../src/data/.svn/text-base/dnpb-1.4.xsd.svn-base | 212 ++++ .../src/data/.svn/text-base/dnpb-1.5.xsd.svn-base | 215 ++++ .../data/.svn/text-base/prebuild-1.6.xsd.svn-base | 231 +++++ .../data/.svn/text-base/prebuild-1.7.xsd.svn-base | 350 +++++++ .../data/.svn/text-base/prebuild-1.8.xsd.svn-base | 331 ++++++ .../data/.svn/text-base/prebuild-1.9.xsd.svn-base | 336 ++++++ Prebuild/src/data/autotools.xml | 790 +++++++++++++++ Prebuild/src/data/dnpb-1.0.xsd | 183 ++++ Prebuild/src/data/dnpb-1.1.xsd | 184 ++++ Prebuild/src/data/dnpb-1.2.xsd | 198 ++++ Prebuild/src/data/dnpb-1.3.xsd | 206 ++++ Prebuild/src/data/dnpb-1.4.xsd | 212 ++++ Prebuild/src/data/dnpb-1.5.xsd | 215 ++++ Prebuild/src/data/prebuild-1.6.xsd | 231 +++++ Prebuild/src/data/prebuild-1.7.xsd | 350 +++++++ Prebuild/src/data/prebuild-1.8.xsd | 331 ++++++ Prebuild/src/data/prebuild-1.9.xsd | 336 ++++++ Prebuild/tests/.svn/all-wcprops | 59 ++ Prebuild/tests/.svn/entries | 334 ++++++ Prebuild/tests/.svn/text-base/Makefile.svn-base | 24 + Prebuild/tests/.svn/text-base/README.txt.svn-base | 5 + .../.svn/text-base/include-001.expected.svn-base | 46 + .../.svn/text-base/include-001.include.svn-base | 33 + .../.svn/text-base/include-001.prebuild.svn-base | 22 + .../.svn/text-base/include-002-2.include.svn-base | 8 + .../.svn/text-base/include-002.expected.svn-base | 26 + .../.svn/text-base/include-002.include.svn-base | 14 + .../.svn/text-base/include-002.prebuild.svn-base | 7 + Prebuild/tests/Makefile | 24 + Prebuild/tests/README.txt | 5 + Prebuild/tests/include-001.expected | 46 + Prebuild/tests/include-001.include | 33 + Prebuild/tests/include-001.prebuild | 22 + Prebuild/tests/include-002-2.include | 8 + Prebuild/tests/include-002.expected | 26 + Prebuild/tests/include-002.include | 14 + Prebuild/tests/include-002.prebuild | 7 + bin/Prebuild.exe | Bin 227840 -> 228352 bytes 319 files changed, 44002 insertions(+) create mode 100644 Prebuild/AUTHORS create mode 100644 Prebuild/COPYING create mode 100644 Prebuild/ChangeLog create mode 100644 Prebuild/INSTALL create mode 100644 Prebuild/NEWS create mode 100644 Prebuild/README create mode 100644 Prebuild/THANKS create mode 100644 Prebuild/TODO create mode 100755 Prebuild/clean.bat create mode 100755 Prebuild/clean.sh create mode 100644 Prebuild/doc/.svn/all-wcprops create mode 100644 Prebuild/doc/.svn/dir-prop-base create mode 100644 Prebuild/doc/.svn/entries create mode 100644 Prebuild/doc/.svn/prop-base/prebuild-example1.xml.svn-base create mode 100644 Prebuild/doc/.svn/prop-base/prebuild-example2.xml.svn-base create mode 100644 Prebuild/doc/.svn/prop-base/prebuild-example3.xml.svn-base create mode 100644 Prebuild/doc/.svn/prop-base/prebuild-example4.xml.svn-base create mode 100644 Prebuild/doc/.svn/text-base/prebuild-example1.xml.svn-base create mode 100644 Prebuild/doc/.svn/text-base/prebuild-example2.xml.svn-base create mode 100644 Prebuild/doc/.svn/text-base/prebuild-example3.xml.svn-base create mode 100644 Prebuild/doc/.svn/text-base/prebuild-example4.xml.svn-base create mode 100644 Prebuild/doc/.svn/text-base/prebuild-example5.xml.svn-base create mode 100644 Prebuild/doc/prebuild-example1.xml create mode 100644 Prebuild/doc/prebuild-example2.xml create mode 100644 Prebuild/doc/prebuild-example3.xml create mode 100644 Prebuild/doc/prebuild-example4.xml create mode 100644 Prebuild/doc/prebuild-example5.xml create mode 100755 Prebuild/prebuild create mode 100644 Prebuild/prebuild.xml create mode 100644 Prebuild/scripts/.svn/all-wcprops create mode 100644 Prebuild/scripts/.svn/dir-prop-base create mode 100644 Prebuild/scripts/.svn/entries create mode 100644 Prebuild/scripts/.svn/prop-base/Clean.bat.svn-base create mode 100644 Prebuild/scripts/.svn/prop-base/Clean.sh.svn-base create mode 100644 Prebuild/scripts/.svn/prop-base/Help.bat.svn-base create mode 100644 Prebuild/scripts/.svn/prop-base/MonoDevelop.sh.svn-base create mode 100644 Prebuild/scripts/.svn/prop-base/Prebuild.nsi.svn-base create mode 100644 Prebuild/scripts/.svn/prop-base/SharpDevelop.bat.svn-base create mode 100644 Prebuild/scripts/.svn/prop-base/SharpDevelop2.bat.svn-base create mode 100644 Prebuild/scripts/.svn/prop-base/VS2002.bat.svn-base create mode 100644 Prebuild/scripts/.svn/prop-base/VS2003.bat.svn-base create mode 100644 Prebuild/scripts/.svn/prop-base/VS2005.bat.svn-base create mode 100644 Prebuild/scripts/.svn/prop-base/VS2008.bat.svn-base create mode 100644 Prebuild/scripts/.svn/prop-base/autotools.bat.svn-base create mode 100644 Prebuild/scripts/.svn/prop-base/autotools.sh.svn-base create mode 100644 Prebuild/scripts/.svn/prop-base/makefile.bat.svn-base create mode 100644 Prebuild/scripts/.svn/prop-base/makefile.sh.svn-base create mode 100644 Prebuild/scripts/.svn/prop-base/nant.bat.svn-base create mode 100644 Prebuild/scripts/.svn/prop-base/nant.sh.svn-base create mode 100644 Prebuild/scripts/.svn/prop-base/xcode.bat.svn-base create mode 100644 Prebuild/scripts/.svn/prop-base/xcode.sh.svn-base create mode 100644 Prebuild/scripts/.svn/text-base/Clean.bat.svn-base create mode 100644 Prebuild/scripts/.svn/text-base/Clean.sh.svn-base create mode 100644 Prebuild/scripts/.svn/text-base/Help.bat.svn-base create mode 100644 Prebuild/scripts/.svn/text-base/MonoDevelop.sh.svn-base create mode 100644 Prebuild/scripts/.svn/text-base/Prebuild.nsi.svn-base create mode 100644 Prebuild/scripts/.svn/text-base/SharpDevelop.bat.svn-base create mode 100644 Prebuild/scripts/.svn/text-base/SharpDevelop2.bat.svn-base create mode 100644 Prebuild/scripts/.svn/text-base/VS2002.bat.svn-base create mode 100644 Prebuild/scripts/.svn/text-base/VS2003.bat.svn-base create mode 100644 Prebuild/scripts/.svn/text-base/VS2005.bat.svn-base create mode 100644 Prebuild/scripts/.svn/text-base/VS2008.bat.svn-base create mode 100644 Prebuild/scripts/.svn/text-base/VS2010.bat.svn-base create mode 100644 Prebuild/scripts/.svn/text-base/autotools.bat.svn-base create mode 100644 Prebuild/scripts/.svn/text-base/autotools.sh.svn-base create mode 100644 Prebuild/scripts/.svn/text-base/makefile.bat.svn-base create mode 100644 Prebuild/scripts/.svn/text-base/makefile.sh.svn-base create mode 100644 Prebuild/scripts/.svn/text-base/nant.bat.svn-base create mode 100644 Prebuild/scripts/.svn/text-base/nant.sh.svn-base create mode 100644 Prebuild/scripts/.svn/text-base/xcode.bat.svn-base create mode 100644 Prebuild/scripts/.svn/text-base/xcode.sh.svn-base create mode 100755 Prebuild/scripts/Clean.bat create mode 100755 Prebuild/scripts/Clean.sh create mode 100755 Prebuild/scripts/Help.bat create mode 100755 Prebuild/scripts/MonoDevelop.sh create mode 100644 Prebuild/scripts/Prebuild.nsi create mode 100755 Prebuild/scripts/SharpDevelop.bat create mode 100755 Prebuild/scripts/SharpDevelop2.bat create mode 100755 Prebuild/scripts/VS2002.bat create mode 100755 Prebuild/scripts/VS2003.bat create mode 100755 Prebuild/scripts/VS2005.bat create mode 100755 Prebuild/scripts/VS2008.bat create mode 100644 Prebuild/scripts/VS2010.bat create mode 100755 Prebuild/scripts/autotools.bat create mode 100755 Prebuild/scripts/autotools.sh create mode 100755 Prebuild/scripts/makefile.bat create mode 100755 Prebuild/scripts/makefile.sh create mode 100755 Prebuild/scripts/nant.bat create mode 100755 Prebuild/scripts/nant.sh create mode 100755 Prebuild/scripts/xcode.bat create mode 100755 Prebuild/scripts/xcode.sh create mode 100644 Prebuild/src/.svn/all-wcprops create mode 100644 Prebuild/src/.svn/dir-prop-base create mode 100644 Prebuild/src/.svn/entries create mode 100644 Prebuild/src/.svn/prop-base/App.ico.svn-base create mode 100644 Prebuild/src/.svn/prop-base/Prebuild.cs.svn-base create mode 100644 Prebuild/src/.svn/prop-base/Prebuild.snk.svn-base create mode 100644 Prebuild/src/.svn/text-base/App.ico.svn-base create mode 100644 Prebuild/src/.svn/text-base/Prebuild.cs.svn-base create mode 100644 Prebuild/src/.svn/text-base/Prebuild.snk.svn-base create mode 100644 Prebuild/src/App.ico create mode 100644 Prebuild/src/Core/.svn/all-wcprops create mode 100644 Prebuild/src/Core/.svn/dir-prop-base create mode 100644 Prebuild/src/Core/.svn/entries create mode 100644 Prebuild/src/Core/.svn/prop-base/FatalException.cs.svn-base create mode 100644 Prebuild/src/Core/.svn/prop-base/Kernel.cs.svn-base create mode 100644 Prebuild/src/Core/.svn/prop-base/UnknownLanguageException.cs.svn-base create mode 100644 Prebuild/src/Core/.svn/prop-base/WarningException.cs.svn-base create mode 100644 Prebuild/src/Core/.svn/text-base/FatalException.cs.svn-base create mode 100644 Prebuild/src/Core/.svn/text-base/Kernel.cs.svn-base create mode 100644 Prebuild/src/Core/.svn/text-base/UnknownLanguageException.cs.svn-base create mode 100644 Prebuild/src/Core/.svn/text-base/WarningException.cs.svn-base create mode 100644 Prebuild/src/Core/Attributes/.svn/all-wcprops create mode 100644 Prebuild/src/Core/Attributes/.svn/dir-prop-base create mode 100644 Prebuild/src/Core/Attributes/.svn/entries create mode 100644 Prebuild/src/Core/Attributes/.svn/prop-base/DataNodeAttribute.cs.svn-base create mode 100644 Prebuild/src/Core/Attributes/.svn/prop-base/OptionNodeAttribute.cs.svn-base create mode 100644 Prebuild/src/Core/Attributes/.svn/prop-base/TargetAttribute.cs.svn-base create mode 100644 Prebuild/src/Core/Attributes/.svn/text-base/DataNodeAttribute.cs.svn-base create mode 100644 Prebuild/src/Core/Attributes/.svn/text-base/OptionNodeAttribute.cs.svn-base create mode 100644 Prebuild/src/Core/Attributes/.svn/text-base/TargetAttribute.cs.svn-base create mode 100644 Prebuild/src/Core/Attributes/DataNodeAttribute.cs create mode 100644 Prebuild/src/Core/Attributes/OptionNodeAttribute.cs create mode 100644 Prebuild/src/Core/Attributes/TargetAttribute.cs create mode 100644 Prebuild/src/Core/FatalException.cs create mode 100644 Prebuild/src/Core/Interfaces/.svn/all-wcprops create mode 100644 Prebuild/src/Core/Interfaces/.svn/dir-prop-base create mode 100644 Prebuild/src/Core/Interfaces/.svn/entries create mode 100644 Prebuild/src/Core/Interfaces/.svn/prop-base/IDataNode.cs.svn-base create mode 100644 Prebuild/src/Core/Interfaces/.svn/prop-base/ITarget.cs.svn-base create mode 100644 Prebuild/src/Core/Interfaces/.svn/text-base/IDataNode.cs.svn-base create mode 100644 Prebuild/src/Core/Interfaces/.svn/text-base/ITarget.cs.svn-base create mode 100644 Prebuild/src/Core/Interfaces/IDataNode.cs create mode 100644 Prebuild/src/Core/Interfaces/ITarget.cs create mode 100644 Prebuild/src/Core/Kernel.cs create mode 100644 Prebuild/src/Core/Nodes/.svn/all-wcprops create mode 100644 Prebuild/src/Core/Nodes/.svn/dir-prop-base create mode 100644 Prebuild/src/Core/Nodes/.svn/entries create mode 100644 Prebuild/src/Core/Nodes/.svn/prop-base/ConfigurationNode.cs.svn-base create mode 100644 Prebuild/src/Core/Nodes/.svn/prop-base/DataNode.cs.svn-base create mode 100644 Prebuild/src/Core/Nodes/.svn/prop-base/ExcludeNode.cs.svn-base create mode 100644 Prebuild/src/Core/Nodes/.svn/prop-base/FileNode.cs.svn-base create mode 100644 Prebuild/src/Core/Nodes/.svn/prop-base/FilesNode.cs.svn-base create mode 100644 Prebuild/src/Core/Nodes/.svn/prop-base/MatchNode.cs.svn-base create mode 100644 Prebuild/src/Core/Nodes/.svn/prop-base/OptionsNode.cs.svn-base create mode 100644 Prebuild/src/Core/Nodes/.svn/prop-base/ProcessNode.cs.svn-base create mode 100644 Prebuild/src/Core/Nodes/.svn/prop-base/ProjectNode.cs.svn-base create mode 100644 Prebuild/src/Core/Nodes/.svn/prop-base/ReferenceNode.cs.svn-base create mode 100644 Prebuild/src/Core/Nodes/.svn/prop-base/ReferencePathNode.cs.svn-base create mode 100644 Prebuild/src/Core/Nodes/.svn/prop-base/SolutionNode.cs.svn-base create mode 100644 Prebuild/src/Core/Nodes/.svn/text-base/AuthorNode.cs.svn-base create mode 100644 Prebuild/src/Core/Nodes/.svn/text-base/CleanFilesNode.cs.svn-base create mode 100644 Prebuild/src/Core/Nodes/.svn/text-base/CleanupNode.cs.svn-base create mode 100644 Prebuild/src/Core/Nodes/.svn/text-base/ConfigurationNode.cs.svn-base create mode 100644 Prebuild/src/Core/Nodes/.svn/text-base/ConfigurationNodeCollection.cs.svn-base create mode 100644 Prebuild/src/Core/Nodes/.svn/text-base/DataNode.cs.svn-base create mode 100644 Prebuild/src/Core/Nodes/.svn/text-base/DatabaseProjectNode.cs.svn-base create mode 100644 Prebuild/src/Core/Nodes/.svn/text-base/DatabaseReferenceNode.cs.svn-base create mode 100644 Prebuild/src/Core/Nodes/.svn/text-base/DescriptionNode.cs.svn-base create mode 100644 Prebuild/src/Core/Nodes/.svn/text-base/ExcludeNode.cs.svn-base create mode 100644 Prebuild/src/Core/Nodes/.svn/text-base/FileNode.cs.svn-base create mode 100644 Prebuild/src/Core/Nodes/.svn/text-base/FilesNode.cs.svn-base create mode 100644 Prebuild/src/Core/Nodes/.svn/text-base/MatchNode.cs.svn-base create mode 100644 Prebuild/src/Core/Nodes/.svn/text-base/OptionsNode.cs.svn-base create mode 100644 Prebuild/src/Core/Nodes/.svn/text-base/ProcessNode.cs.svn-base create mode 100644 Prebuild/src/Core/Nodes/.svn/text-base/ProjectNode.cs.svn-base create mode 100644 Prebuild/src/Core/Nodes/.svn/text-base/ReferenceNode.cs.svn-base create mode 100644 Prebuild/src/Core/Nodes/.svn/text-base/ReferencePathNode.cs.svn-base create mode 100644 Prebuild/src/Core/Nodes/.svn/text-base/SolutionNode.cs.svn-base create mode 100644 Prebuild/src/Core/Nodes/AuthorNode.cs create mode 100644 Prebuild/src/Core/Nodes/CleanFilesNode.cs create mode 100644 Prebuild/src/Core/Nodes/CleanupNode.cs create mode 100644 Prebuild/src/Core/Nodes/ConfigurationNode.cs create mode 100644 Prebuild/src/Core/Nodes/ConfigurationNodeCollection.cs create mode 100644 Prebuild/src/Core/Nodes/DataNode.cs create mode 100644 Prebuild/src/Core/Nodes/DatabaseProjectNode.cs create mode 100644 Prebuild/src/Core/Nodes/DatabaseReferenceNode.cs create mode 100644 Prebuild/src/Core/Nodes/DescriptionNode.cs create mode 100644 Prebuild/src/Core/Nodes/ExcludeNode.cs create mode 100644 Prebuild/src/Core/Nodes/FileNode.cs create mode 100644 Prebuild/src/Core/Nodes/FilesNode.cs create mode 100644 Prebuild/src/Core/Nodes/MatchNode.cs create mode 100644 Prebuild/src/Core/Nodes/OptionsNode.cs create mode 100644 Prebuild/src/Core/Nodes/ProcessNode.cs create mode 100644 Prebuild/src/Core/Nodes/ProjectNode.cs create mode 100644 Prebuild/src/Core/Nodes/ReferenceNode.cs create mode 100644 Prebuild/src/Core/Nodes/ReferencePathNode.cs create mode 100644 Prebuild/src/Core/Nodes/SolutionNode.cs create mode 100644 Prebuild/src/Core/Parse/.svn/all-wcprops create mode 100644 Prebuild/src/Core/Parse/.svn/dir-prop-base create mode 100644 Prebuild/src/Core/Parse/.svn/entries create mode 100644 Prebuild/src/Core/Parse/.svn/prop-base/IfContext.cs.svn-base create mode 100644 Prebuild/src/Core/Parse/.svn/prop-base/Preprocessor.cs.svn-base create mode 100644 Prebuild/src/Core/Parse/.svn/text-base/IfContext.cs.svn-base create mode 100644 Prebuild/src/Core/Parse/.svn/text-base/Preprocessor.cs.svn-base create mode 100644 Prebuild/src/Core/Parse/IfContext.cs create mode 100644 Prebuild/src/Core/Parse/Preprocessor.cs create mode 100644 Prebuild/src/Core/Targets/.NAntTarget.cs.swp create mode 100644 Prebuild/src/Core/Targets/.svn/all-wcprops create mode 100644 Prebuild/src/Core/Targets/.svn/dir-prop-base create mode 100644 Prebuild/src/Core/Targets/.svn/entries create mode 100644 Prebuild/src/Core/Targets/.svn/prop-base/DebugTarget.cs.svn-base create mode 100644 Prebuild/src/Core/Targets/.svn/prop-base/MakefileTarget.cs.svn-base create mode 100644 Prebuild/src/Core/Targets/.svn/prop-base/MonoDevelopTarget.cs.svn-base create mode 100644 Prebuild/src/Core/Targets/.svn/prop-base/NAntTarget.cs.svn-base create mode 100644 Prebuild/src/Core/Targets/.svn/prop-base/SharpDevelopTarget.cs.svn-base create mode 100644 Prebuild/src/Core/Targets/.svn/prop-base/VS2002Target.cs.svn-base create mode 100644 Prebuild/src/Core/Targets/.svn/prop-base/VS2003Target.cs.svn-base create mode 100644 Prebuild/src/Core/Targets/.svn/prop-base/VS2005Target.cs.svn-base create mode 100644 Prebuild/src/Core/Targets/.svn/prop-base/XcodeTarget.cs.svn-base create mode 100644 Prebuild/src/Core/Targets/.svn/text-base/AutotoolsTarget.cs.svn-base create mode 100644 Prebuild/src/Core/Targets/.svn/text-base/DebugTarget.cs.svn-base create mode 100644 Prebuild/src/Core/Targets/.svn/text-base/MakefileTarget.cs.svn-base create mode 100644 Prebuild/src/Core/Targets/.svn/text-base/MonoDevelopTarget.cs.svn-base create mode 100644 Prebuild/src/Core/Targets/.svn/text-base/NAntTarget.cs.svn-base create mode 100644 Prebuild/src/Core/Targets/.svn/text-base/SharpDevelop2Target.cs.svn-base create mode 100644 Prebuild/src/Core/Targets/.svn/text-base/SharpDevelopTarget.cs.svn-base create mode 100644 Prebuild/src/Core/Targets/.svn/text-base/ToolInfo.cs.svn-base create mode 100644 Prebuild/src/Core/Targets/.svn/text-base/VS2002Target.cs.svn-base create mode 100644 Prebuild/src/Core/Targets/.svn/text-base/VS2003Target.cs.svn-base create mode 100644 Prebuild/src/Core/Targets/.svn/text-base/VS2005Target.cs.svn-base create mode 100644 Prebuild/src/Core/Targets/.svn/text-base/VS2008Target.cs.svn-base create mode 100644 Prebuild/src/Core/Targets/.svn/text-base/VS2010Target.cs.svn-base create mode 100644 Prebuild/src/Core/Targets/.svn/text-base/VSGenericTarget.cs.svn-base create mode 100644 Prebuild/src/Core/Targets/.svn/text-base/VSVersion.cs.svn-base create mode 100644 Prebuild/src/Core/Targets/.svn/text-base/XcodeTarget.cs.svn-base create mode 100644 Prebuild/src/Core/Targets/AutotoolsTarget.cs create mode 100644 Prebuild/src/Core/Targets/DebugTarget.cs create mode 100644 Prebuild/src/Core/Targets/MakefileTarget.cs create mode 100644 Prebuild/src/Core/Targets/MonoDevelopTarget.cs create mode 100644 Prebuild/src/Core/Targets/NAntTarget.cs create mode 100644 Prebuild/src/Core/Targets/SharpDevelop2Target.cs create mode 100644 Prebuild/src/Core/Targets/SharpDevelopTarget.cs create mode 100644 Prebuild/src/Core/Targets/ToolInfo.cs create mode 100644 Prebuild/src/Core/Targets/VS2002Target.cs create mode 100644 Prebuild/src/Core/Targets/VS2003Target.cs create mode 100644 Prebuild/src/Core/Targets/VS2005Target.cs create mode 100644 Prebuild/src/Core/Targets/VS2008Target.cs create mode 100644 Prebuild/src/Core/Targets/VS2010Target.cs create mode 100644 Prebuild/src/Core/Targets/VSGenericTarget.cs create mode 100644 Prebuild/src/Core/Targets/VSVersion.cs create mode 100644 Prebuild/src/Core/Targets/XcodeTarget.cs create mode 100644 Prebuild/src/Core/UnknownLanguageException.cs create mode 100644 Prebuild/src/Core/Utilities/.svn/all-wcprops create mode 100644 Prebuild/src/Core/Utilities/.svn/dir-prop-base create mode 100644 Prebuild/src/Core/Utilities/.svn/entries create mode 100644 Prebuild/src/Core/Utilities/.svn/prop-base/CommandLineCollection.cs.svn-base create mode 100644 Prebuild/src/Core/Utilities/.svn/prop-base/CurrentDirectory.cs.svn-base create mode 100644 Prebuild/src/Core/Utilities/.svn/prop-base/Helper.cs.svn-base create mode 100644 Prebuild/src/Core/Utilities/.svn/prop-base/Log.cs.svn-base create mode 100644 Prebuild/src/Core/Utilities/.svn/text-base/CommandLineCollection.cs.svn-base create mode 100644 Prebuild/src/Core/Utilities/.svn/text-base/CurrentDirectory.cs.svn-base create mode 100644 Prebuild/src/Core/Utilities/.svn/text-base/Helper.cs.svn-base create mode 100644 Prebuild/src/Core/Utilities/.svn/text-base/Log.cs.svn-base create mode 100644 Prebuild/src/Core/Utilities/CommandLineCollection.cs create mode 100644 Prebuild/src/Core/Utilities/CurrentDirectory.cs create mode 100644 Prebuild/src/Core/Utilities/Helper.cs create mode 100644 Prebuild/src/Core/Utilities/Log.cs create mode 100644 Prebuild/src/Core/WarningException.cs create mode 100644 Prebuild/src/Prebuild.cs create mode 100644 Prebuild/src/Prebuild.snk create mode 100644 Prebuild/src/Properties/.svn/all-wcprops create mode 100644 Prebuild/src/Properties/.svn/entries create mode 100644 Prebuild/src/Properties/.svn/prop-base/AssemblyInfo.cs.svn-base create mode 100644 Prebuild/src/Properties/.svn/text-base/AssemblyInfo.cs.svn-base create mode 100644 Prebuild/src/Properties/AssemblyInfo.cs create mode 100644 Prebuild/src/data/.svn/all-wcprops create mode 100644 Prebuild/src/data/.svn/dir-prop-base create mode 100644 Prebuild/src/data/.svn/entries create mode 100644 Prebuild/src/data/.svn/prop-base/dnpb-1.0.xsd.svn-base create mode 100644 Prebuild/src/data/.svn/prop-base/dnpb-1.1.xsd.svn-base create mode 100644 Prebuild/src/data/.svn/prop-base/dnpb-1.2.xsd.svn-base create mode 100644 Prebuild/src/data/.svn/prop-base/dnpb-1.3.xsd.svn-base create mode 100644 Prebuild/src/data/.svn/prop-base/dnpb-1.4.xsd.svn-base create mode 100644 Prebuild/src/data/.svn/prop-base/dnpb-1.5.xsd.svn-base create mode 100644 Prebuild/src/data/.svn/prop-base/prebuild-1.6.xsd.svn-base create mode 100644 Prebuild/src/data/.svn/text-base/autotools.xml.svn-base create mode 100644 Prebuild/src/data/.svn/text-base/dnpb-1.0.xsd.svn-base create mode 100644 Prebuild/src/data/.svn/text-base/dnpb-1.1.xsd.svn-base create mode 100644 Prebuild/src/data/.svn/text-base/dnpb-1.2.xsd.svn-base create mode 100644 Prebuild/src/data/.svn/text-base/dnpb-1.3.xsd.svn-base create mode 100644 Prebuild/src/data/.svn/text-base/dnpb-1.4.xsd.svn-base create mode 100644 Prebuild/src/data/.svn/text-base/dnpb-1.5.xsd.svn-base create mode 100644 Prebuild/src/data/.svn/text-base/prebuild-1.6.xsd.svn-base create mode 100644 Prebuild/src/data/.svn/text-base/prebuild-1.7.xsd.svn-base create mode 100644 Prebuild/src/data/.svn/text-base/prebuild-1.8.xsd.svn-base create mode 100644 Prebuild/src/data/.svn/text-base/prebuild-1.9.xsd.svn-base create mode 100644 Prebuild/src/data/autotools.xml create mode 100644 Prebuild/src/data/dnpb-1.0.xsd create mode 100644 Prebuild/src/data/dnpb-1.1.xsd create mode 100644 Prebuild/src/data/dnpb-1.2.xsd create mode 100644 Prebuild/src/data/dnpb-1.3.xsd create mode 100644 Prebuild/src/data/dnpb-1.4.xsd create mode 100644 Prebuild/src/data/dnpb-1.5.xsd create mode 100644 Prebuild/src/data/prebuild-1.6.xsd create mode 100644 Prebuild/src/data/prebuild-1.7.xsd create mode 100644 Prebuild/src/data/prebuild-1.8.xsd create mode 100644 Prebuild/src/data/prebuild-1.9.xsd create mode 100644 Prebuild/tests/.svn/all-wcprops create mode 100644 Prebuild/tests/.svn/entries create mode 100644 Prebuild/tests/.svn/text-base/Makefile.svn-base create mode 100644 Prebuild/tests/.svn/text-base/README.txt.svn-base create mode 100644 Prebuild/tests/.svn/text-base/include-001.expected.svn-base create mode 100644 Prebuild/tests/.svn/text-base/include-001.include.svn-base create mode 100644 Prebuild/tests/.svn/text-base/include-001.prebuild.svn-base create mode 100644 Prebuild/tests/.svn/text-base/include-002-2.include.svn-base create mode 100644 Prebuild/tests/.svn/text-base/include-002.expected.svn-base create mode 100644 Prebuild/tests/.svn/text-base/include-002.include.svn-base create mode 100644 Prebuild/tests/.svn/text-base/include-002.prebuild.svn-base create mode 100644 Prebuild/tests/Makefile create mode 100644 Prebuild/tests/README.txt create mode 100644 Prebuild/tests/include-001.expected create mode 100644 Prebuild/tests/include-001.include create mode 100644 Prebuild/tests/include-001.prebuild create mode 100644 Prebuild/tests/include-002-2.include create mode 100644 Prebuild/tests/include-002.expected create mode 100644 Prebuild/tests/include-002.include create mode 100644 Prebuild/tests/include-002.prebuild diff --git a/Prebuild/AUTHORS b/Prebuild/AUTHORS new file mode 100644 index 0000000..9e86ac0 --- /dev/null +++ b/Prebuild/AUTHORS @@ -0,0 +1,10 @@ +Dave Hudson (jendave@yahoo.com), +Matthew Holmes (matthew@wildfiregames.com) +Dan Moorehead (dan05a@gmail.com) +Rob Loach (http://www.robloach.net) +C.J. Adams-Collier (cjac@colliertech.org) + +Patch Contributers +lbsa71 +chi11ken +sdague diff --git a/Prebuild/COPYING b/Prebuild/COPYING new file mode 100644 index 0000000..d3cdf7e --- /dev/null +++ b/Prebuild/COPYING @@ -0,0 +1,65 @@ +BSD License +Copyright (c)2004-2008 + +See AUTHORS file for list of copyright holders + +Dave Hudson (jendave@yahoo.com), +Matthew Holmes (matthew@wildfiregames.com) +Dan Moorehead (dan05a@gmail.com) +Rob Loach (http://www.robloach.net) +C.J. Adams-Collier (cjac@colliertech.org) + +http://dnpb.sourceforge.net +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + +1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior written + permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + +--- + +Portions of src/Core/Targets/AutotoolsTarget.cs +// Copyright (C) 2006 Novell, Inc (http://www.novell.com) +// +// Permission is hereby granted, free of charge, to any person obtaining +// a copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to +// permit persons to whom the Software is furnished to do so, subject to +// the following conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/Prebuild/ChangeLog b/Prebuild/ChangeLog new file mode 100644 index 0000000..bb8e7b0 --- /dev/null +++ b/Prebuild/ChangeLog @@ -0,0 +1,461 @@ +2008-12-09T02:15 D. Moonfire + * src/Core/Kernel.cs + - Added a /ppi target to get the results of processing but before + processing the actual results. + * src/Core/Preprocessor.cs + - Applied the patch from kanato with formatting changes. + - Uses the format. + * tests/ + - Added some lightweight tests to test the functionality of the + include patch. + +2008-06-19T09:37 John Anderson + * src/Core/Kernel.cs + - Only Loop through targets that are not abstract. + * src/Core/Targets/VSGenericTarget.cs + - Marked abstract and removed the Target attribute. + +2008-06-16T17:37 John Anderson + * src/Core/Nodes/ProjectNode.cs,data/prebuild-1.7.xsd + - Added the ability to hardcode guid's in the projects + +2008-05-21T0737 C.J. Adams-Collier + * src/Core/Targets/AutotoolsTarget.cs + - catch exception when unable to compile AssemblyInfo.cs + +2008-05-07T17:29 John Anderson + * src/Core/Targets/VSGenericTarget.cs + - Generate asp.net output in bin\ folder (asp.net requires it there) + +2008-04-30T17:29 John Anderson + * src/Core/Nodes/DatabaseReferenceNode.cs, + src/Core/Nodes/Datanode.cs, + src/Core/Nodes/FileNode.cs, + src/Core/Nodes/FileNodes.cs, + src/Core/Nodes/MatchNode.cs, + src/Core/Targets/VS2008Target.cs, + src/data/prebuild-1.7.xsd + - Refactored the project generation code to handle web projects and more + logically handle embedded resources and designer files. + +2008-04-30T17:29 Joseph Lombrozo + * src/Core/Nodes/SolutionNode.cs + - Had solutions inherit Configurations in the same way that Projects do. + +2008-04-29T06:35 Joseph Lombrozo + * src/Core/Targets/VS2008Target.cs, + src/Core/Nodes/DatabaseProjectNode.cs, + src/Core/Nodes/DatabaseReferenceNode.cs, + src/data/prebuild-1.7.xsd + - Added database references to database projects. + - Prevented nested solutions from being written to disk. + +2008-04-29T05:43 Joseph Lombrozo + * src/Core/Targets/VS2008Target.cs + - Enabled embedded solutions to contain Files. + +2008-04-29T04:13 Joseph Lombrozo + * src/Core/VSVersion.cs + - Fixed spelling mistake in enum comment. + * src/Core/Attributes/DataNodeAttribute.cs + - Allowed the DataNodeAttribute to be attached to a single class + more than once, allowing one class to be used to parse more than + one node at a time. + * src/Core/Kernel.cs + - Changed CacheNodeTypes() to allow for multiple DataNodeAttribute + instances in one class. Refactored ProcessFile(...) to return Solutions, + rather than adding them to the Kernel. + * src/Core/Nodes/SolutionNode.cs + - Added Guid (for embedded folders) + - Added DatabaseProjects, Solutions and Processes to the SolutionNode + when parsing. + * src/Core/Nodes/ProjectNode.cs + - Added FrameworkVersion property to allow for 2.0/3.0/3.5 differentiation. + * src/Core/Targets/VS2008Target.cs, src/data/prebuild-1.7.xsd + - Added ability to have embedded solutions, and externally referenced + prebuild scripts. + +2008-04-24T04:33 John M. Anderson + * src/Core/Targets/VS2003Target.cs, src/Core/Targets/VSVersion.cs + - Moved the VSVersion enum into its own file. + * src/Core/Targets/VS2008Target.cs + - added support for VS2008 + * src/Core/Nodes/ProjectNode.cs + - Added initial support for ASP.NET projects + * src/Core/Nodes/DatabaseProjectNode.cs + - Added support for Visual Studio database projects + +2008-02-19T07:08 C.J. Adams-Collier + * TODO + - added some tasks from Sam Hocevar + * src/Core/Targets/AutotoolsTarget.cs + - added a missing end paren + * COPYING + - Removed Randy Ridge's name from the copyright. Looks to me like + his name was present only because the file was nabbed from Tao + +2008-02-09T20:29 C.J. Adams-Collier + * COPYING + - added MIT/X11 license due to inclusion of code from Monodevelop + * THANKS + - added Lluis Sanchez Gual and Todd Berman - I yoinked code from + their pkg-config .pc file parser to build AutotoolsTarget.cs. + Sorry it took me so long to remember to add mention of you guys! + * src/Core/Targets/AutotoolsTarget.cs + - added MIT/X11 license. see above. + +2008-02-07T08:27 C.J. Adams-Collier + * AUTHORS + - consolidated names and contact info found laying around the + source + * src/Core/Kernel.cs + - updated copyright date + - re-formatted license for 80-column editor + - updated log banner to indicate new date, new authors + * src/Core/Targets/AutotoolsTarget.cs + - clarified reasoning behind use of constants in + AutotoolsTarget.ParsePCFile + - reduced length of some long lines using newline/indent + - added log messages for parsing .pc files, emitting solutions, + projects + - robustified the inter-package dependency resolution target + - log warning when we can't find assembly for + - clarified code for case of inability to find embedded + autotools.xml + * src/data/autotools.xml + - adding system lookup of resgen2 to configure.ac + - fixed .resource -> .resources typo + - added a rule to create .response file containing all sources + - using @.response on $(CSC) command line instead of listing + all source files + * src/Properties/AssemblyInfo.cs + - re-formatted license for an 80-column editor + - added more authors to the AssemblyCopyright attribute + - bumped version to 2.0.3 + * prebuild.xml + - bumped version to 2.0.3 + * scripts/autotools.sh + - if 'mono' is in the path, run Prebuild.exe with it + - using dirname to capture correct path to prebuild.xml &c + +2008-02-06T17:18 C.J. Adams-Collier + * src/Core/Targets/NAntTarget.cs + - re-formatted the license for an 80-column editor + - added myself to the copyright + - added a fix submitted by Gryc Ueusp + * src/Core/Targets/AutotoolsTarget.cs + - updated copyright to include 2008 + * THANKS + - created file, added Gryc Ueusp + +2008-01-01T14:50 C.J. Adams-Collier + * src/data/autotools.xml + - fixed .resx -> .resource compilation + - fixed failing edge case where Project is an unsigned Library + - added $(RESOURCE_SRC) to list of extra dist files + * src/Core/Targets/AutotoolsTarget.cs + - removed embeddedResources from extraDistFiles list + +2007-04-18T07:49 C.J. Adams-Collier + * src/data/prebuild-1.7.xsd + - removed default version from references + +2007-04-06T12:42 C.J. Adams-Collier + * src/data/autotools.xml + - added support for /doc: output when XmlDocFile is not empty + - not printing \t \\n on lines that have no content + - gacutil now installs the root assembly instead of the one under + bin/Debug or whatever + +2007-04-04T22:12 C.J. Adams-Collier + * src/Core/Targets/AutotoolsTarget.cs + - removed debugging Console.WriteLine() + * src/data/autotools.xml + - ensuring that install-sh and missing get distributed + - explicitly stating that the sources, snk, resources and binary + references live under $(srcdir) + - corrected uninstall target + - verified distcheck completes successfully + +2007-04-03T21:56 C.J. Adams-Collier + * src/Core/Targets/AutotoolsTarget.cs + - added a using for System.Diagnostics + - added enum ClrVersion for use with the pkg-config parser + - added class SystemPackage for use with the pkg-config parser + - removed explicit "private" property of members since it is implied + - flushing the stream-writer before it's closed + - removed excess braces around an if statement + ! NormalizeAsmName(), AddAssembly(), GetAssembliesWithLibInfo(), + GetAssembliesWithoutLibInfo(), ProcessPiece(), + GetVariableFromPkgConfig(), ParsePCFile(), + RegisterSystemAssemblies(), RunInitialization() + - pulled the above from MonoDevelop to parse the system pkgconfig + files and determine /pkg: arguments. Original sources are here: + http://svn.myrealbox.com/source/trunk/monodevelop/Core/src/MonoDevelop.Core/MonoDevelop.Core/SystemAssemblyService.cs + http://svn.myrealbox.com/source/trunk/monodevelop/Core/src/MonoDevelop.Core/MonoDevelop.Core/ClrVersion.cs + ! WriteProject() + - now gathering project version from AssemblyInfo.cs if it is part + of the project + - changed the declaration of the ArrayList's in the method + - now copying assembly .config files to the project, distributing, + installing + - making sure all needed files live under the Project directory + - copying strongname keys to project directory + - parsing AssemblyInfo.cs to determine assembly version + - removing all references to ".." + - removed superfluous if(project.References.Count > 0) around + for(int refNum = 0; refNum < project.References.Count; refNum++) + - removed use of runtimeLibs + - adding hook to copy sibling project's generated assemblies to + this project during Make time + - added extra dist target to ensure all files required to build + get distributed during "make dist" + - added new xslt processing args: + -- assemblyName + -- extraDistFiles + -- pkgLibs (/pkg:foo) + -- localCopyTargets (to copy sibling assemblies at Make time) + -- projectVersion (if determined from AssemblyInfo.cs) + -- hasAssemblyConfig (if there's a assembly.exe.config present) + ! Write() + - calling RunInitialization() to gather pkg-config data + * src/data/autotools.xml + - accepting new args passed from AutotoolsTarget.cs + - modernized configure.ac a bit + - using a version of tar that allows >99-char filenames + - added ASSEMBLY_NAME variable + - using assembly name rather than project name for gac installation + - generated assembly is now assembly name and not project name + - accepting /pkg: flags gathered from AutotoolsTarget.cs + - adding Makefile targets to copy sibling project assemblies to . + - fixed Debug, Release targets + - adding support for strongname key signing + - adding /unsafe support + - adding a clean make target + - only running gacutil /u if the assembly being uninstalled is in gac + - added some templates to determine each Configuration's .snk + - added explanation as to why .exe assemblies live in $prefix/lib + * src/Properties/AssemblyInfo.cs + - bumped assembly version + * prebuild.xml + - bumped assembly version + +2007-03-29T18:03 C.J. Adams-Collier + * src/Core/Targets/AutotoolsTarget.cs + ! WriteProject() + - re-named incorrectly-named variable gacLibs to systemLibs + - added another reference list, runtimeLibs which contains the + libs we will need at runtime. we use this to build a MONO_PATH + - added monoPath to the xslt args list + * src/data/autotools.xml + ! + - renamed gacLibs to systemLibs + - added the sources to the dist list + - added logic to install libs that aren't strongnamed + ! + - accepting a param to update the MONO_PATH + +2007-03-28T19:46 C.J. Adams-Collier + * src/Core/Targets/MonoDevelopTarget.cs + ! CleanProject() + - using Assembly.LoadWithPartialName to locate the assembly + * src/Core/Targets/AutotoolsTarget.cs + ! WriteCombine() + - no longer using $PWD to determine a project's source dir; this + doesn't work with elements + - passing the solution name to all templates - fixes + multi-solution prebuild systems + ! WriteProject() + - no longer using $PWD to determine a project's source dir; this + doesn't work with elements + - passing the solution name to all templates - fixes + multi-solution prebuild systems + - copying strongname key to the autotools directory + - using Assembly.LoadWithPartialName to locate assemblies + * src/data/autotools.xml + ! + - fixed the .pc AC_CONFIG_FILES macro + ! + - added solution name param + - wrapping if type=exe check around script install macro + - added type=lib check and .pc file install macro + - added support for Configuration-specific builds (Debug, Release, etc) + - added strongname keyfile code + - TODO: support non-strongnamed library installation + ! + - added space preservation attribute to stylesheet element + - added a lower-case project name variable + - added solution name param + - made for-each template more specific + ! + - added solution name param + ! + - added solution name param + ! + - added solution name param + ! + - added solution name param + +2007-03-27T09:33 C.J. Adams-Collier + * src/Core/Targets/AutotoolsTarget.cs + - now processing the wrapper script if type is "Exe" or "WinExe" + * src/data/autotools.xml + ! + - being more exact about where text escaping is used + - using the correct variable name for the GACUTIL_FLAGS template + - using correct test="" for the AC_CONFIG_FILES macros + ! + - uncommented the bin_SCRIPTS section now that the script is being + generated correctly + ! + - fixed whitespace at beginning of file, before #! + - using lower-case packageName to indicate installation location + +2007-03-27T09:33 C.J. Adams-Collier + * src/data/autotools.xml + ! + * added a lcProjectName which is $projectName lower-cased + * moved autoconf template specifier near AC_OUTPUT + * AC_OUTPUT with args is deprecated. now using AC_CONFIG_FILES + * placed AC_CONFIG_FILES() calls for wrapper script or pkg-config + file in xslt project type checks + ! + * commented out bin_SCRIPTS + * added a lcProjectName which is $projectName lower-cased + * using $lcProjectName instead of the longer version + +2007-03-27T08:39 C.J. Adams-Collier + * src/data/autotools.xml + ! + - added whitespace-preservation + - added the missing projectName param + - replaced bin_SCRIPTS with something that worked + +2007-03-27T07:56 C.J. Adams-Collier + * src/data/autotools.xml + ! + - cleaned up duplicate checks + - placed initialization macros above system check macros + - added some more messages about what's going on + - added GACUTIL_FLAGS variable including /package option + ! + - added an incomplete bin_SCRIPTS + - RCS check says "building" instead of "compiling" + ! + - removed macros that are useful only for projects + ! + - created this element on this revision + - this is a wrapper shell script that lives in the $PATH and runs + the CIL assembly + +2007-03-26T20:18 C.J. Adams-Collier + * src/Core/Targets/AutotoolsTarget.cs + - creating new template arguments to contain the list of libs to + reference: source, binary & GAC + - source libs are included as part of this solution (untested) + - binary libs are distributed with the source (untested) + - GAC libs are assumed to be in the GAC or other lib path (tested) + * src/data/autotools.xml + - created new params through which to accept reference info + - created a working $(CSC) line + - added a TODO item for ordering project dependency for + AC_CONFIG_SUBDIRS code + +2007-03-26T08:41 C.J. Adams-Collier + * src/Core/Targets/AutotoolsTarget.cs + - now creating list of source files in managed code and passing + them to the template via s + * src/data/prebuild-1.7.xsd + - updated the header comment to 2007 + * src/data/autotools.xml + ! + - copied checks from Solution-level configure.ac + - copied solution-level config status + ! + - added elements for file list to be passed through + - made a temporary target for the assembly we're building + - added this target to the deps of "all:" + ! + - changed status header/footer from "- - -" to "===" + +2007-03-23T08:33 C.J. Adams-Collier + Added version attribute handling code for Property element + Added description element handling code + * prebuild.xml + - added /Prebuild/Solution/Property/@version attribute + - added /Prebuild/Solution/Property/Description element + * src/Core/Nodes/ProjectNode.cs + - added some docs where they were missing and obvious + - added code to handle @version + * src/Core/Nodes/DescriptionNode.cs + - new file. Used to handle /Prebuild/Solution/Property/Description + * src/Core/Targets/AutotoolsTarget.cs + - added mkdirDashP(), a recursive directory creation method + - WriteProject() now copies the files to autotools/ + * src/data/prebuild-1.7.xsd + - added /Prebuild/Solution/Property/Description element + - added /Prebuild/Solution/Property/@version attribute + * src/data/autotools.xml + - removed excess + - explicitly using dnpb: prefix + +2007-03-23T04:31 C.J. Adams-Collier + Merged code from my stripped-down test + Adding support for the /Prebuild/Solution/Project/Author element + * prebuild.xml + - added Author elements + - cleaned up the really long Project element + * src/Core/Nodes/ProjectNode.cs + - added Author tag processing code + * src/Core/Nodes/AuthorNode.cs + - Created to process Author elements + - based off of ReferencePathNode.cs + * src/Core/Targets/AutotoolsTarget.cs + - merged code from https://svn.colliertech.org/mono/dnpbAutotools/dnpbAutotools/test.cs + - renamed old WriteCombine to WriteCombineOld + - renamed old WriteProject to WriteProjectOld + * src/data/prebuild-1.7.xsd + - added Author element to Project + * src/data/autotools.xml + - lower-cased utf + + +2007-03-22T13:58 C.J. Adams-Collier + Exposing an XmlDocument that represents the prebuild.xml file + passed to the program + + * src/Core/Kernel.cs + - created an object member called XmlDocument m_CurrentDoc + - created a property to access its value + - using m_CurrentDoc to load up the prebuild.xml file rather than + a local variable called "doc" + +2007-03-22 C.J. Adams-Collier + * prebuild.xml + - added autotools.xml created at https://svn.colliertech.org/mono/dnpbAutotools/dnpbAutotools/autotools.xml + * src/data/autotools.xml + - the same + * src/Core/Targets/MonoDevelopTarget.cs + - fixed bug introduced in r206 + +2007-03-07 C.J. Adams-Collier + * src/data/prebuild-1.7.xsd + - added version attribute to Solution and Project elements + +2006-11-04T00:38 C.J. Adams-Collier + * placing AssemblyInfo.cs into Properties/ + * Fixed double-mention of the package name + +2006-11-03T15:23 C.J. Adams-Collier + * corrected a problem in the Include.am generation code + * created the new .exe + * copied it to the root of the build + +2006-11-03T14:57 C.J. Adams-Collier + * Updated the .exe file + +2006-11-03 C.J. Adams-Collier + * Added a TODO file + * Added a ChangeLog file + * applied some fixes for autotools gac and pkg-config installation + problems diff --git a/Prebuild/INSTALL b/Prebuild/INSTALL new file mode 100644 index 0000000..23e5f25 --- /dev/null +++ b/Prebuild/INSTALL @@ -0,0 +1,236 @@ +Installation Instructions +************************* + +Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005 Free +Software Foundation, Inc. + +This file is free documentation; the Free Software Foundation gives +unlimited permission to copy, distribute and modify it. + +Basic Installation +================== + +These are generic installation instructions. + + The `configure' shell script attempts to guess correct values for +various system-dependent variables used during compilation. It uses +those values to create a `Makefile' in each directory of the package. +It may also create one or more `.h' files containing system-dependent +definitions. Finally, it creates a shell script `config.status' that +you can run in the future to recreate the current configuration, and a +file `config.log' containing compiler output (useful mainly for +debugging `configure'). + + It can also use an optional file (typically called `config.cache' +and enabled with `--cache-file=config.cache' or simply `-C') that saves +the results of its tests to speed up reconfiguring. (Caching is +disabled by default to prevent problems with accidental use of stale +cache files.) + + If you need to do unusual things to compile the package, please try +to figure out how `configure' could check whether to do them, and mail +diffs or instructions to the address given in the `README' so they can +be considered for the next release. If you are using the cache, and at +some point `config.cache' contains results you don't want to keep, you +may remove or edit it. + + The file `configure.ac' (or `configure.in') is used to create +`configure' by a program called `autoconf'. You only need +`configure.ac' if you want to change it or regenerate `configure' using +a newer version of `autoconf'. + +The simplest way to compile this package is: + + 1. `cd' to the directory containing the package's source code and type + `./configure' to configure the package for your system. If you're + using `csh' on an old version of System V, you might need to type + `sh ./configure' instead to prevent `csh' from trying to execute + `configure' itself. + + Running `configure' takes awhile. While running, it prints some + messages telling which features it is checking for. + + 2. Type `make' to compile the package. + + 3. Optionally, type `make check' to run any self-tests that come with + the package. + + 4. Type `make install' to install the programs and any data files and + documentation. + + 5. You can remove the program binaries and object files from the + source code directory by typing `make clean'. To also remove the + files that `configure' created (so you can compile the package for + a different kind of computer), type `make distclean'. There is + also a `make maintainer-clean' target, but that is intended mainly + for the package's developers. If you use it, you may have to get + all sorts of other programs in order to regenerate files that came + with the distribution. + +Compilers and Options +===================== + +Some systems require unusual options for compilation or linking that the +`configure' script does not know about. Run `./configure --help' for +details on some of the pertinent environment variables. + + You can give `configure' initial values for configuration parameters +by setting variables in the command line or in the environment. Here +is an example: + + ./configure CC=c89 CFLAGS=-O2 LIBS=-lposix + + *Note Defining Variables::, for more details. + +Compiling For Multiple Architectures +==================================== + +You can compile the package for more than one kind of computer at the +same time, by placing the object files for each architecture in their +own directory. To do this, you must use a version of `make' that +supports the `VPATH' variable, such as GNU `make'. `cd' to the +directory where you want the object files and executables to go and run +the `configure' script. `configure' automatically checks for the +source code in the directory that `configure' is in and in `..'. + + If you have to use a `make' that does not support the `VPATH' +variable, you have to compile the package for one architecture at a +time in the source code directory. After you have installed the +package for one architecture, use `make distclean' before reconfiguring +for another architecture. + +Installation Names +================== + +By default, `make install' installs the package's commands under +`/usr/local/bin', include files under `/usr/local/include', etc. You +can specify an installation prefix other than `/usr/local' by giving +`configure' the option `--prefix=PREFIX'. + + You can specify separate installation prefixes for +architecture-specific files and architecture-independent files. If you +pass the option `--exec-prefix=PREFIX' to `configure', the package uses +PREFIX as the prefix for installing programs and libraries. +Documentation and other data files still use the regular prefix. + + In addition, if you use an unusual directory layout you can give +options like `--bindir=DIR' to specify different values for particular +kinds of files. Run `configure --help' for a list of the directories +you can set and what kinds of files go in them. + + If the package supports it, you can cause programs to be installed +with an extra prefix or suffix on their names by giving `configure' the +option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. + +Optional Features +================= + +Some packages pay attention to `--enable-FEATURE' options to +`configure', where FEATURE indicates an optional part of the package. +They may also pay attention to `--with-PACKAGE' options, where PACKAGE +is something like `gnu-as' or `x' (for the X Window System). The +`README' should mention any `--enable-' and `--with-' options that the +package recognizes. + + For packages that use the X Window System, `configure' can usually +find the X include and library files automatically, but if it doesn't, +you can use the `configure' options `--x-includes=DIR' and +`--x-libraries=DIR' to specify their locations. + +Specifying the System Type +========================== + +There may be some features `configure' cannot figure out automatically, +but needs to determine by the type of machine the package will run on. +Usually, assuming the package is built to be run on the _same_ +architectures, `configure' can figure that out, but if it prints a +message saying it cannot guess the machine type, give it the +`--build=TYPE' option. TYPE can either be a short name for the system +type, such as `sun4', or a canonical name which has the form: + + CPU-COMPANY-SYSTEM + +where SYSTEM can have one of these forms: + + OS KERNEL-OS + + See the file `config.sub' for the possible values of each field. If +`config.sub' isn't included in this package, then this package doesn't +need to know the machine type. + + If you are _building_ compiler tools for cross-compiling, you should +use the option `--target=TYPE' to select the type of system they will +produce code for. + + If you want to _use_ a cross compiler, that generates code for a +platform different from the build platform, you should specify the +"host" platform (i.e., that on which the generated programs will +eventually be run) with `--host=TYPE'. + +Sharing Defaults +================ + +If you want to set default values for `configure' scripts to share, you +can create a site shell script called `config.site' that gives default +values for variables like `CC', `cache_file', and `prefix'. +`configure' looks for `PREFIX/share/config.site' if it exists, then +`PREFIX/etc/config.site' if it exists. Or, you can set the +`CONFIG_SITE' environment variable to the location of the site script. +A warning: not all `configure' scripts look for a site script. + +Defining Variables +================== + +Variables not defined in a site shell script can be set in the +environment passed to `configure'. However, some packages may run +configure again during the build, and the customized values of these +variables may be lost. In order to avoid this problem, you should set +them in the `configure' command line, using `VAR=value'. For example: + + ./configure CC=/usr/local2/bin/gcc + +causes the specified `gcc' to be used as the C compiler (unless it is +overridden in the site shell script). Here is a another example: + + /bin/bash ./configure CONFIG_SHELL=/bin/bash + +Here the `CONFIG_SHELL=/bin/bash' operand causes subsequent +configuration-related scripts to be executed by `/bin/bash'. + +`configure' Invocation +====================== + +`configure' recognizes the following options to control how it operates. + +`--help' +`-h' + Print a summary of the options to `configure', and exit. + +`--version' +`-V' + Print the version of Autoconf used to generate the `configure' + script, and exit. + +`--cache-file=FILE' + Enable the cache: use and save the results of the tests in FILE, + traditionally `config.cache'. FILE defaults to `/dev/null' to + disable caching. + +`--config-cache' +`-C' + Alias for `--cache-file=config.cache'. + +`--quiet' +`--silent' +`-q' + Do not print messages saying which checks are being made. To + suppress all normal output, redirect it to `/dev/null' (any error + messages will still be shown). + +`--srcdir=DIR' + Look for the package's source code in directory DIR. Usually + `configure' can determine that directory automatically. + +`configure' also accepts some other, not widely useful, options. Run +`configure --help' for more details. + diff --git a/Prebuild/NEWS b/Prebuild/NEWS new file mode 100644 index 0000000..bea28da --- /dev/null +++ b/Prebuild/NEWS @@ -0,0 +1,200 @@ +Prebuild is an XML-driven pre-build tool allowing developers to easily generate project or make files for major IDE's and .NET development tools including: Visual Studio 2005, Visual Studio 2003, Visual Studio 2002, SharpDevelop, MonoDevelop, and NAnt. + +Documentation and downloads are available at http://dnpb.sourceforge.net. + +Prebuild is licensed under the BSD license. + +[ XXXXXXX XX, XXX - 1.3.2 ] + + Added Keyfile signing to NAnt target and VS2005 target + + Updated XSD file to 1.7 + + Boo and VisualBasic Language support in VS2005 target + + Added basic Autotools target. It creates a non-recursive Autotools system. + ! Multiple files can be excluded from the Match node + ! VS2005 now handles .resx files correctly. + ! NAnt and Autotools now handle defines + ! NAnt and Autotools now handle resources + + Conditional XML variables can be passed through the command line. + + Added /install and /remove command line flags to install and remove assemblies from the GAC + + Many fixes to VS2005 target + +[ July 21, 2006 - 1.3.1 ] + ! VS2005 fixes from Rob Loach + ! NAnt fixes from Rob Loach and David Hudson + ! XML doc fixes from Rob Loach + + Added SharpDevelop2 target (really just uses VS2005 target) + ! Fixed bug with BuildEvents in Monodevelop target + + Passing /yes will default to answering yes to any warnings + +[ February 28, 2006 - 1.3 ] + + Added MonoDevelop target. + + Added NAnt target. + + Lots of fixes to all targets. + * Cleaned up the code using FXCop. + * Updated schema to 1.6 to fix a typo and add a new parameter. + * jendave is now the maintainer of the project. RobLoach has been added as a developer. + * Removed references to 'dnpb'. + + Added rudimentary support for pre- and post- build scripts + * Updated examples. + +[ August 5, 2004 - 1.2 ] + + Added Visual Studio Express (vs2005express) target contributed by Borrillis and modified for use with different languages + + Added the allowedgroups command line option followed by a pipe-delimited list of project group filter flags (eg. Group1|Group2) allow optional filtering of all projects that dont have at least one of these flags + + Added the filterGroups XML attribute to the project node and updated the scheme to v1.5 for this addition, it is used to specified the delimited list of filter groups to which a project belongs + * Modified the removedir command line option to allow for a pipe-delimited list of directory names + ! Modified the resource loading code to search for resourced without the prepended namespace (as Visual Studio .NET does it) to allow for it to be compiled with SharpDevelop as well + + Added the GenerateXmlDocFile boolean option to the Options XML element + * Changed the behavior of the XmlDocFile option so that if not specified it uses the assemblyName (without file extension) + .xml for the file name instead of just not generating the file since the new GenerateXmlDocFile takes care of this + +[ January 3, 2004 - 1.1 ] + ! Replaced regex use for more efficient manual parsing to allow use on non-windows platforms with Mono which has Regex problems + + Added the checkOsVars attribute to the root element for enabling interpolation for Enviroment variables in the form ${var}, otherwise no checking is performed for efficiency-sake + * Make the version attribute on the root element optional as it isn't used and not needed since the schema url contains the version + +[ December 30, 2004 - 1.1 ] + ! Applied Leed's fix for SharpDevelop references + + Rewrote much of the processing for better validation and without the use of a temp file + + Added support for configurations at the project level which are named All. They now apply changes to all Solution level defined configs + * Changed all spaces into tabs + + Added support for the None build action + * Replaced all sequence's in the XML schema for all's because the order doesn't matter since the xml file is loaded into an XmlDocument + +[ December 25, 2004 - 1.0 ] + + Added the /removedir option for cleaning directories like obj before file releases + + Changed WriteTempXml() and the new DeleteTempXml() methods to be compiled only in DEBUG builds + * Made path optional for Match elements (defaults to current directory) and updates schema for it + ! Fixed XML example in the readme.txt + + Added example xml files to docs directory + * Updated license.txt to add Dan Moorehead and update copyright years + + Updated prebuild.xml to take advantage of the default path attribute for match elements + + Updated Clean to delete the obj directories + +[ December 25, 2004 - 0.13 ] + + Added dnpb.exe so that it can be used to generate the project files + + Added dnpb.ico + * Added parameterless Write statement to Log for writing a single line + * Changed scehema to version 1.3 for support of icon attribute + * Added support for All configuration name under a Project node signifying common settings for all configurations + ! Fixed the SupressWarnings by adding the corresponding field to OptionsNode + * Wrote documentation in docs/readme.txt + * Added Dan Moorehead to copyrights and extended date from 2004 to 2004-2005 + * Updated prebuild.xml + * Optimized Log class + * Updated OutputUsage() + * /clean targets all by default + * No log file is used by default, /log without value specified uses default file name + + Added support for the /pause which pauses the utility after execution to observe output + + +[ September 27, 2004 - 0.12.2a ] + ! Fixed a nasty bug when trying to delete our temp file for pre-processing. + +[ September 15, 2004 - 0.12.2 ] + + Expanded platform identification, thanks to the NAnt guys for shedding some + light on how to properly check for UNIX platforms! Thanks guys! + * POSIX OS identifier changed to UNIX. Valid OS names are now "Win32", "UNIX", + and "Unknown". + ! Fixed SharpDevelop target to properly use the 'rootNamespace' attribute of + the Project tag. + + New command-line switch, /ppo, forces DNPB to pre-process the file and write + the pre-processed file. This allows you to test/debug your pre-processor + macros. No other processing will be done. You can specify a target file as + a paramter for the /ppo switch, or DNPB will write the file 'preprocessed.xml' + if you do not specify a file. + + The Match tag now has a 'buildAction' attribute which functions exactly like + the attribute of the same name for the File tag. + +[ August 5, 2004 - 0.12.1 ] + + Added environment variable expansion for all values. Environment variables + should be listed in the form ${VAR}. + +[ July 30, 2004 - 0.12.0 ] + + Added preprocessing via XML processing information tags. Available tags + are: ?>, ?>, and . The + current expression parser is very basic, but will be replaced with a more + capable parser over time. Current operators available are: =, !=, <, >, + <=, >=. Current test variables available: OS, RuntimeVersion, RuntimeMajor, + RuntimeMinor, RuntimeRevision. + +[ July 27, 2004 - 0.11.4 ] + + Added 'useRegex' attribute to the Match tag. Matches can now use regular + expressions to match filenames. + + Added the 'assemblyName' attribute to the Project tag. Projects can now + set their output assembly name. + ! Fixed several bugs in the way that Project tags inheirt their parent + Solutions configuration options. This operation should now work fully as + intended. + ! Due to some wierdness, Project Guid's are now stored as part of the Project + node and created at parse time. + +[ May 11, 2004 - 0.11.3 ] + ! Fixed a bug where I was writing the wrong property name for a projects root + namespace. + ! Removed a DEBUG statement I had left in the code in 0.11.2. + ! Fixed a bug in the VS2002 writer which caused the version variables to not + be overriden correctly. + + Added the rootNamespace property to the element, allowing you to + specify the root namespace. + * /target and /clean are now mutually exclusive command line switches, and + they both now take the all option. In the case of /target all, all build + file for all targets will be created. In the case of /clean all, the user + will be prompted to make sure they want to do it, and if so, will clean + all build files for all targets. + +[ April 22, 2004 - 0.11.2 ] + ! Fixed a bug with the /file command-line operator. Was using the unresolved + file path rather then the resolved one, was making the attempt to open the + dnpb file fail. + ! Fixed a bug in the schema that required at least 1 solution and 1 reference + path. We can do just fine with 0 of either of these. Some files may be all + statements and not have any tags. + ! Fixed a bug that caused the project references not to be written with the + SharpDevelop target. + * Changed the schema to version 1.2, allowing for Configuration nodes to exist + under project nodes. The inheritance of values is hierarchical. Meaning, if + you define a configuration named Debug at the Soltion level, and one by the + same name at the Project level, the one at the Project level will first + inherit the options of the Solution level configuration, then set it's own + options. If you define a configuration at the Project level and it does not + exist at the Solution level, it will be created at the Solution level. + * Project references should now work correctly across the board. Note that due + to a restriction in Visual Studio, you can only reference projects in the same + solution. + +[ April 21, 2004 - 0.11.1 ] + ! Fixed a problem with resolving paths in various targets. Was not properly + setting the CWD. + * Schema updated to 1.1, moving the ReferencePath element from the Options + element to the Project element. This makes more logical sense, given that + reference paths are resolved relative to the project path. Any prebuild.xml + file referecning verison 1.0 will fail! Please update to the 1.1 schema. + +[ April 19, 2004 - 0.11.0 ] + * Added several attributes across the code to make FxCop happy + ! Fixed bugs in reference paths being written in the VS targets. + ! Fixed a bug in ProjectNode which was doing two CWDStack.Push() calls instead of + a Push/Pop pair. Was wreaking havoc with tags. + ! Fixed some bugs in the path tracking, both the Project and Solution nodes now + have a FullPath property, which is the full path to the file resolved at load + time. This should fix all path relativity problems. + + Added new /clean switch, allowing the target to clean up any files it generated. + in accordance, the ITarget interface has been updated to support a new Clean() + method. + + Completed addition of the tag, to allow the referencing of external + prebuild.xml files. + + Added the runtime attribute to the Project element. This allows the developer + to specify which runtime a project should target (Mono or Microsoft). This is + of course ignored in certain targets like the Visual Studio targets. + + Added the SharpDevelop target. + +[ April 13, 2004 - 0.10.1a ] + + Added the buildAction attribute to the File node. This is needed for dnpb + to even be able to bootstrap itself (dnpb-1.0.xsd must be an embedded resource) + +[ April 13, 2004 - 0.10.1 ] + * First Release + +[ Key ] +* = Change or information ++ = Addition +! = Bug Fix + diff --git a/Prebuild/README b/Prebuild/README new file mode 100644 index 0000000..2b05fb5 --- /dev/null +++ b/Prebuild/README @@ -0,0 +1,274 @@ +Prebuild Instructions + +Prebuild is an XML-driven pre-build tool allowing developers to easily generate project or make files for major IDE's and .NET development tools including: Visual Studio 2005, Visual Studio 2003, Visual Studio 2002, SharpDevelop, SharpDevelop2, MonoDevelop, and NAnt. + +_______________________________________________________________________________ +Overview + +Prebuild can be either be run from the command line to generate the +project and make files or you can execute the included batch (*.bat) +and Unix Shell script (*.sh) files. + +_______________________________________________________________________________ +The currently supported developement tools and their associated batch +and shell script files. + +Visual Studio .NET 2005 (VS2005.bat) +Visual Studio .NET 2003 (VS2003.bat) +Visual Studio .NET 2002 (VS2002.bat) +SharpDevelop (SharpDevelop.bat) - http://www.icsharpcode.net/OpenSource/SD/ +SharpDevelop2 (SharpDevelop.bat) - http://www.icsharpcode.net/OpenSource/SD/ +MonoDevelop (MonoDevelop.sh) - http://www.monodevelop.com/ +NAnt (nant.sh and nant.bat) - http://nant.sourceforge.net/ +Autotools (autotools.bat and autotools.sh) - http://en.wikipedia.org/wiki/GNU_build_system + +Notes: + +A Unix Shell script is provided for MonoDevelop, as it does not run on +Windows at this time. + +Visual Studio .NET 2005 and the Visual Express IDE's can import +solutions from older versions of Visual Studio .NET. + +Makefiles are not currently supported. + +_______________________________________________________________________________ +Command Line Syntax: + +Example: +> Prebuild /target vs2003 + +This will generate the project files for Visual Studio.NET 2003 and +place the redirect the log to a file named PrebuildLog.txt in the +parent directory + + +The syntax structure is as below, where commandParameter is optional +depending on the command and you can provide several option-value +pairs. + +Note: The '> ' signifies the command prompt, do not enter this literally + +> Prebuild /"); + } + #endregion + + #region User File + + ps = new StreamWriter(projectFile + ".user"); + using (ps) + { + // Get the first configuration from the project. + ConfigurationNode firstConfiguration = null; + + if (project.Configurations.Count > 0) + { + firstConfiguration = project.Configurations[0]; + } + + ps.WriteLine(""); + //ps.WriteLine( "" ); + //ps.WriteLine(" <{0}>", toolInfo.XMLTag); + //ps.WriteLine(" "); + ps.WriteLine(" "); + //ps.WriteLine(" ", MakeRefPath(project)); + + if (firstConfiguration != null) + { + ps.WriteLine(" {0}", firstConfiguration.Name); + ps.WriteLine(" {0}", firstConfiguration.Platform); + } + + ps.WriteLine(" {0}", MakeRefPath(project)); + ps.WriteLine(" {0}", ProductVersion); + ps.WriteLine(" ProjectFiles"); + ps.WriteLine(" 0"); + ps.WriteLine(" "); + foreach (ConfigurationNode conf in project.Configurations) + { + ps.Write(" "); + } + ps.WriteLine(""); + } + #endregion + + kernel.CurrentWorkingDirectory.Pop(); + } + + private void WriteSolution(SolutionNode solution, bool writeSolutionToDisk) + { + kernel.Log.Write("Creating {0} solution and project files", VersionName); + + foreach (SolutionNode child in solution.Solutions) + { + kernel.Log.Write("...Creating folder: {0}", child.Name); + WriteSolution(child, false); + } + + foreach (ProjectNode project in solution.Projects) + { + kernel.Log.Write("...Creating project: {0}", project.Name); + WriteProject(solution, project); + } + + foreach (DatabaseProjectNode project in solution.DatabaseProjects) + { + kernel.Log.Write("...Creating database project: {0}", project.Name); + WriteDatabaseProject(solution, project); + } + + if (writeSolutionToDisk) // only write main solution + { + kernel.Log.Write(""); + string solutionFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "sln"); + + using (StreamWriter ss = new StreamWriter(solutionFile)) + { + kernel.CurrentWorkingDirectory.Push(); + Helper.SetCurrentDir(Path.GetDirectoryName(solutionFile)); + + ss.WriteLine("Microsoft Visual Studio Solution File, Format Version {0}", SolutionVersion); + ss.WriteLine(SolutionTag); + + WriteProjectDeclarations(ss, solution, solution); + + ss.WriteLine("Global"); + + ss.WriteLine("\tGlobalSection(SolutionConfigurationPlatforms) = preSolution"); + foreach (ConfigurationNode conf in solution.Configurations) + { + ss.WriteLine("\t\t{0} = {0}", conf.NameAndPlatform); + } + ss.WriteLine("\tEndGlobalSection"); + + ss.WriteLine("\tGlobalSection(ProjectConfigurationPlatforms) = postSolution"); + WriteConfigurationLines(solution.Configurations, solution, ss); + ss.WriteLine("\tEndGlobalSection"); + + if (solution.Solutions.Count > 0) + { + ss.WriteLine("\tGlobalSection(NestedProjects) = preSolution"); + foreach (SolutionNode embeddedSolution in solution.Solutions) + { + WriteNestedProjectMap(ss, embeddedSolution); + } + ss.WriteLine("\tEndGlobalSection"); + } + + ss.WriteLine("EndGlobal"); + } + + kernel.CurrentWorkingDirectory.Pop(); + } + } + + private void WriteProjectDeclarations(TextWriter writer, SolutionNode actualSolution, SolutionNode embeddedSolution) + { + foreach (SolutionNode childSolution in embeddedSolution.Solutions) + { + WriteEmbeddedSolution(writer, childSolution); + WriteProjectDeclarations(writer, actualSolution, childSolution); + } + + foreach (ProjectNode project in embeddedSolution.Projects) + { + WriteProject(actualSolution, writer, project); + } + + foreach (DatabaseProjectNode dbProject in embeddedSolution.DatabaseProjects) + { + WriteProject(actualSolution, writer, dbProject); + } + + if (actualSolution.Guid == embeddedSolution.Guid) + { + WriteSolutionFiles(actualSolution, writer); + } + } + + private static void WriteNestedProjectMap(TextWriter writer, SolutionNode embeddedSolution) + { + foreach (ProjectNode project in embeddedSolution.Projects) + { + WriteNestedProject(writer, embeddedSolution, project.Guid); + } + + foreach (DatabaseProjectNode dbProject in embeddedSolution.DatabaseProjects) + { + WriteNestedProject(writer, embeddedSolution, dbProject.Guid); + } + + foreach (SolutionNode child in embeddedSolution.Solutions) + { + WriteNestedProject(writer, embeddedSolution, child.Guid); + WriteNestedProjectMap(writer, child); + } + } + + private static void WriteNestedProject(TextWriter writer, SolutionNode solution, Guid projectGuid) + { + WriteNestedFolder(writer, solution.Guid, projectGuid); + } + + private static void WriteNestedFolder(TextWriter writer, Guid parentGuid, Guid childGuid) + { + writer.WriteLine("\t\t{0} = {1}", + childGuid.ToString("B").ToUpper(), + parentGuid.ToString("B").ToUpper()); + } + + private static void WriteConfigurationLines(IEnumerable configurations, SolutionNode solution, TextWriter ss) + { + foreach (ProjectNode project in solution.Projects) + { + foreach (ConfigurationNode conf in configurations) + { + ss.WriteLine("\t\t{0}.{1}.ActiveCfg = {1}", + project.Guid.ToString("B").ToUpper(), + conf.NameAndPlatform); + + ss.WriteLine("\t\t{0}.{1}.Build.0 = {1}", + project.Guid.ToString("B").ToUpper(), + conf.NameAndPlatform); + } + } + + foreach (SolutionNode child in solution.Solutions) + { + WriteConfigurationLines(configurations, child, ss); + } + } + + private void WriteSolutionFiles(SolutionNode solution, TextWriter ss) + { + if(solution.Files != null && solution.Files.Count > 0) + WriteProject(ss, "Folder", solution.Guid, "Solution Files", "Solution Files", solution.Files); + } + + private void WriteEmbeddedSolution(TextWriter writer, SolutionNode embeddedSolution) + { + WriteProject(writer, "Folder", embeddedSolution.Guid, embeddedSolution.Name, embeddedSolution.Name, embeddedSolution.Files); + } + + private void WriteProject(SolutionNode solution, TextWriter ss, ProjectNode project) + { + WriteProject(ss, solution, project.Language, project.Guid, project.Name, project.FullPath); + } + + private void WriteProject(SolutionNode solution, TextWriter ss, DatabaseProjectNode dbProject) + { + if (solution.Files != null && solution.Files.Count > 0) + WriteProject(ss, solution, "Database", dbProject.Guid, dbProject.Name, dbProject.FullPath); + } + + const string ProjectDeclarationBeginFormat = "Project(\"{0}\") = \"{1}\", \"{2}\", \"{3}\""; + const string ProjectDeclarationEndFormat = "EndProject"; + + private void WriteProject(TextWriter ss, SolutionNode solution, string language, Guid guid, string name, string projectFullPath) + { + if (!tools.ContainsKey(language)) + throw new UnknownLanguageException("Unknown .NET language: " + language); + + ToolInfo toolInfo = tools[language]; + + string path = Helper.MakePathRelativeTo(solution.FullPath, projectFullPath); + + path = Helper.MakeFilePath(path, name, toolInfo.FileExtension); + + WriteProject(ss, language, guid, name, path); + } + + private void WriteProject(TextWriter writer, string language, Guid projectGuid, string name, string location) + { + WriteProject(writer, language, projectGuid, name, location, null); + } + + private void WriteProject(TextWriter writer, string language, Guid projectGuid, string name, string location, FilesNode files) + { + if (!tools.ContainsKey(language)) + throw new UnknownLanguageException("Unknown .NET language: " + language); + + ToolInfo toolInfo = tools[language]; + + writer.WriteLine(ProjectDeclarationBeginFormat, + toolInfo.Guid, + name, + location, + projectGuid.ToString("B").ToUpper()); + + if (files != null) + { + writer.WriteLine("\tProjectSection(SolutionItems) = preProject"); + + foreach (string file in files) + writer.WriteLine("\t\t{0} = {0}", file); + + writer.WriteLine("\tEndProjectSection"); + } + + writer.WriteLine(ProjectDeclarationEndFormat); + } + + private void WriteDatabaseProject(SolutionNode solution, DatabaseProjectNode project) + { + string projectFile = Helper.MakeFilePath(project.FullPath, project.Name, "dbp"); + IndentedTextWriter ps = new IndentedTextWriter(new StreamWriter(projectFile), " "); + + kernel.CurrentWorkingDirectory.Push(); + + Helper.SetCurrentDir(Path.GetDirectoryName(projectFile)); + + using (ps) + { + ps.WriteLine("# Microsoft Developer Studio Project File - Database Project"); + ps.WriteLine("Begin DataProject = \"{0}\"", project.Name); + ps.Indent++; + ps.WriteLine("MSDTVersion = \"80\""); + // TODO: Use the project.Files property + if (ContainsSqlFiles(Path.GetDirectoryName(projectFile))) + WriteDatabaseFoldersAndFiles(ps, Path.GetDirectoryName(projectFile)); + + ps.WriteLine("Begin DBRefFolder = \"Database References\""); + ps.Indent++; + foreach (DatabaseReferenceNode reference in project.References) + { + ps.WriteLine("Begin DBRefNode = \"{0}\"", reference.Name); + ps.Indent++; + ps.WriteLine("ConnectStr = \"{0}\"", reference.ConnectionString); + ps.WriteLine("Provider = \"{0}\"", reference.ProviderId.ToString("B").ToUpper()); + //ps.WriteLine("Colorizer = 5"); + ps.Indent--; + ps.WriteLine("End"); + } + ps.Indent--; + ps.WriteLine("End"); + ps.Indent--; + ps.WriteLine("End"); + + ps.Flush(); + } + + kernel.CurrentWorkingDirectory.Pop(); + } + + private static bool ContainsSqlFiles(string folder) + { + if(Directory.GetFiles(folder, "*.sql").Length > 0) + return true; // if the folder contains 1 .sql file, that's good enough + + foreach (string child in Directory.GetDirectories(folder)) + { + if (ContainsSqlFiles(child)) + return true; // if 1 child folder contains a .sql file, still good enough + } + + return false; + } + + private static void WriteDatabaseFoldersAndFiles(IndentedTextWriter writer, string folder) + { + foreach (string child in Directory.GetDirectories(folder)) + { + if (ContainsSqlFiles(child)) + { + writer.WriteLine("Begin Folder = \"{0}\"", Path.GetFileName(child)); + writer.Indent++; + WriteDatabaseFoldersAndFiles(writer, child); + writer.Indent--; + writer.WriteLine("End"); + } + } + foreach (string file in Directory.GetFiles(folder, "*.sql")) + { + writer.WriteLine("Script = \"{0}\"", Path.GetFileName(file)); + } + } + + private void CleanProject(ProjectNode project) + { + kernel.Log.Write("...Cleaning project: {0}", project.Name); + + ToolInfo toolInfo = tools[project.Language]; + string projectFile = Helper.MakeFilePath(project.FullPath, project.Name, toolInfo.FileExtension); + string userFile = projectFile + ".user"; + + Helper.DeleteIfExists(projectFile); + Helper.DeleteIfExists(userFile); + } + + private void CleanSolution(SolutionNode solution) + { + kernel.Log.Write("Cleaning {0} solution and project files", VersionName, solution.Name); + + string slnFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "sln"); + string suoFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "suo"); + + Helper.DeleteIfExists(slnFile); + Helper.DeleteIfExists(suoFile); + + foreach (ProjectNode project in solution.Projects) + { + CleanProject(project); + } + + kernel.Log.Write(""); + } + + #endregion + + #region ITarget Members + + /// + /// Writes the specified kern. + /// + /// The kern. + public virtual void Write(Kernel kern) + { + if (kern == null) + { + throw new ArgumentNullException("kern"); + } + kernel = kern; + foreach (SolutionNode sol in kernel.Solutions) + { + WriteSolution(sol, true); + } + kernel = null; + } + + /// + /// Cleans the specified kern. + /// + /// The kern. + public virtual void Clean(Kernel kern) + { + if (kern == null) + { + throw new ArgumentNullException("kern"); + } + kernel = kern; + foreach (SolutionNode sol in kernel.Solutions) + { + CleanSolution(sol); + } + kernel = null; + } + + #endregion + } +} diff --git a/Prebuild/src/Core/Targets/.svn/text-base/VSVersion.cs.svn-base b/Prebuild/src/Core/Targets/.svn/text-base/VSVersion.cs.svn-base new file mode 100644 index 0000000..699b5ca --- /dev/null +++ b/Prebuild/src/Core/Targets/.svn/text-base/VSVersion.cs.svn-base @@ -0,0 +1,54 @@ +#region BSD License +/* +Copyright (c) 2008-2009 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com), John Anderson (sontek@gmail.com) + +Redistribution and use in source and binary forms, with or without modification, are permitted +provided that the following conditions are met: + +* Redistributions of source code must retain the above copyright notice, this list of conditions + and the following disclaimer. +* Redistributions in binary form must reproduce the above copyright notice, this list of conditions + and the following disclaimer in the documentation and/or other materials provided with the + distribution. +* The name of the author may not be used to endorse or promote products derived from this software + without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, +BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING +IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ +#endregion + +namespace Prebuild.Core.Targets +{ + /// + /// + /// + public enum VSVersion + { + /// + /// Visual Studio 2002 + /// + VS70, + /// + /// Visual Studio 2003 + /// + VS71, + /// + /// Visual Studio 2005 + /// + VS80, + /// + /// Visual Studio 2008 + /// + VS90, + /// + /// Visual Studio 2010 + /// + VS10 + } +} diff --git a/Prebuild/src/Core/Targets/.svn/text-base/XcodeTarget.cs.svn-base b/Prebuild/src/Core/Targets/.svn/text-base/XcodeTarget.cs.svn-base new file mode 100644 index 0000000..5393cec --- /dev/null +++ b/Prebuild/src/Core/Targets/.svn/text-base/XcodeTarget.cs.svn-base @@ -0,0 +1,594 @@ +#region BSD License +/* +Copyright (c) 2004 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com) + +Redistribution and use in source and binary forms, with or without modification, are permitted +provided that the following conditions are met: + +* Redistributions of source code must retain the above copyright notice, this list of conditions + and the following disclaimer. +* Redistributions in binary form must reproduce the above copyright notice, this list of conditions + and the following disclaimer in the documentation and/or other materials provided with the + distribution. +* The name of the author may not be used to endorse or promote products derived from this software + without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, +BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING +IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ +#endregion + +using System; +using System.IO; +using System.Reflection; +using System.Text.RegularExpressions; + +using Prebuild.Core.Attributes; +using Prebuild.Core.Interfaces; +using Prebuild.Core.Nodes; +using Prebuild.Core.Utilities; + +namespace Prebuild.Core.Targets +{ + /// + /// + /// + [Target("xcode")] + public class XcodeTarget : ITarget + { + #region Fields + + private Kernel m_Kernel; + + #endregion + + #region Private Methods + + private static string PrependPath(string path) + { + string tmpPath = Helper.NormalizePath(path, '/'); + Regex regex = new Regex(@"(\w):/(\w+)"); + Match match = regex.Match(tmpPath); + //if(match.Success || tmpPath[0] == '.' || tmpPath[0] == '/') + //{ + tmpPath = Helper.NormalizePath(tmpPath); + //} + // else + // { + // tmpPath = Helper.NormalizePath("./" + tmpPath); + // } + + return tmpPath; + } + + private static string BuildReference(SolutionNode solution, ReferenceNode refr) + { + string ret = ""; + if (solution.ProjectsTable.ContainsKey(refr.Name)) + { + ProjectNode project = (ProjectNode)solution.ProjectsTable[refr.Name]; + string fileRef = FindFileReference(refr.Name, project); + string finalPath = Helper.NormalizePath(Helper.MakeFilePath(project.FullPath + "/${build.dir}/", refr.Name, "dll"), '/'); + ret += finalPath; + return ret; + } + else + { + ProjectNode project = (ProjectNode)refr.Parent; + string fileRef = FindFileReference(refr.Name, project); + + if (refr.Path != null || fileRef != null) + { + string finalPath = (refr.Path != null) ? Helper.NormalizePath(refr.Path + "/" + refr.Name + ".dll", '/') : fileRef; + ret += finalPath; + return ret; + } + + try + { + //Assembly assem = Assembly.Load(refr.Name); + //if (assem != null) + //{ + //ret += (refr.Name + ".dll"); + //} + //else + //{ + ret += (refr.Name + ".dll"); + //} + } + catch (System.NullReferenceException e) + { + e.ToString(); + ret += refr.Name + ".dll"; + } + } + return ret; + } + + private static string BuildReferencePath(SolutionNode solution, ReferenceNode refr) + { + string ret = ""; + if (solution.ProjectsTable.ContainsKey(refr.Name)) + { + ProjectNode project = (ProjectNode)solution.ProjectsTable[refr.Name]; + string fileRef = FindFileReference(refr.Name, project); + string finalPath = Helper.NormalizePath(Helper.MakeReferencePath(project.FullPath + "/${build.dir}/"), '/'); + ret += finalPath; + return ret; + } + else + { + ProjectNode project = (ProjectNode)refr.Parent; + string fileRef = FindFileReference(refr.Name, project); + + if (refr.Path != null || fileRef != null) + { + string finalPath = (refr.Path != null) ? Helper.NormalizePath(refr.Path, '/') : fileRef; + ret += finalPath; + return ret; + } + + try + { + Assembly assem = Assembly.Load(refr.Name); + if (assem != null) + { + ret += ""; + } + else + { + ret += ""; + } + } + catch (System.NullReferenceException e) + { + e.ToString(); + ret += ""; + } + } + return ret; + } + + private static string FindFileReference(string refName, ProjectNode project) + { + foreach (ReferencePathNode refPath in project.ReferencePaths) + { + string fullPath = Helper.MakeFilePath(refPath.Path, refName, "dll"); + + if (File.Exists(fullPath)) + { + return fullPath; + } + } + + return null; + } + + /// + /// Gets the XML doc file. + /// + /// The project. + /// The conf. + /// + public static string GetXmlDocFile(ProjectNode project, ConfigurationNode conf) + { + if (conf == null) + { + throw new ArgumentNullException("conf"); + } + if (project == null) + { + throw new ArgumentNullException("project"); + } + string docFile = (string)conf.Options["XmlDocFile"]; + // if(docFile != null && docFile.Length == 0)//default to assembly name if not specified + // { + // return Path.GetFileNameWithoutExtension(project.AssemblyName) + ".xml"; + // } + return docFile; + } + + private void WriteProject(SolutionNode solution, ProjectNode project) + { + string projFile = Helper.MakeFilePath(project.FullPath, project.Name + (project.Type == ProjectType.Library ? ".dll" : ".exe"), "build"); + StreamWriter ss = new StreamWriter(projFile); + + m_Kernel.CurrentWorkingDirectory.Push(); + Helper.SetCurrentDir(Path.GetDirectoryName(projFile)); + bool hasDoc = false; + + using (ss) + { + ss.WriteLine(""); + ss.WriteLine("", project.Name); + ss.WriteLine(" ", "build"); + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(" "); + foreach (ReferenceNode refr in project.References) + { + if (refr.LocalCopy) + { + ss.WriteLine(" ", '/')); + } + } + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.Write(" "); + ss.WriteLine(" ", project.RootNamespace); + foreach (string file in project.Files) + { + switch (project.Files.GetBuildAction(file)) + { + case BuildAction.EmbeddedResource: + ss.WriteLine(" {0}", ""); + break; + default: + if (project.Files.GetSubType(file) != SubType.Code && project.Files.GetSubType(file) != SubType.Settings) + { + ss.WriteLine(" ", file.Substring(0, file.LastIndexOf('.')) + ".resx"); + } + break; + } + } + //if (project.Files.GetSubType(file).ToString() != "Code") + //{ + // ps.WriteLine(" ", file.Substring(0, file.LastIndexOf('.')) + ".resx"); + + ss.WriteLine(" "); + ss.WriteLine(" "); + foreach (string file in project.Files) + { + switch (project.Files.GetBuildAction(file)) + { + case BuildAction.Compile: + ss.WriteLine(" "); + break; + default: + break; + } + } + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(" "); + foreach (ReferenceNode refr in project.References) + { + ss.WriteLine(" ", '/')); + } + ss.WriteLine(" "); + + ss.WriteLine(" "); + ss.WriteLine(" "); + + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(" "); + + ss.WriteLine(" "); + if (hasDoc) + { + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.Write(" "); + } + else + { + ss.WriteLine(".exe\" />"); + } + + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(" "); + // foreach(ReferenceNode refr in project.References) + // { + // string path = Helper.NormalizePath(Helper.MakePathRelativeTo(project.FullPath, BuildReferencePath(solution, refr)), '/'); + // if (path != "") + // { + // ss.WriteLine(" ", path); + // } + // } + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(" "); + } + ss.WriteLine(" "); + ss.WriteLine(""); + } + m_Kernel.CurrentWorkingDirectory.Pop(); + } + + private void WriteCombine(SolutionNode solution) + { + m_Kernel.Log.Write("Creating Xcode build files"); + foreach (ProjectNode project in solution.Projects) + { + if (m_Kernel.AllowProject(project.FilterGroups)) + { + m_Kernel.Log.Write("...Creating project: {0}", project.Name); + WriteProject(solution, project); + } + } + + m_Kernel.Log.Write(""); + DirectoryInfo directoryInfo = new DirectoryInfo(Path.Combine(solution.FullPath, solution.Name + ".xcodeproj")); + if (!directoryInfo.Exists) + { + directoryInfo.Create(); + } + string combFile = Helper.MakeFilePath(Path.Combine(solution.FullPath, solution.Name + ".xcodeproj"), "project", "pbxproj"); + StreamWriter ss = new StreamWriter(combFile); + + m_Kernel.CurrentWorkingDirectory.Push(); + Helper.SetCurrentDir(Path.GetDirectoryName(combFile)); + + using (ss) + { + ss.WriteLine(""); + ss.WriteLine("", solution.Name); + ss.WriteLine(" "); + ss.WriteLine(); + + //ss.WriteLine(" "); + //ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(" "); + + foreach (ConfigurationNode conf in solution.Configurations) + { + // Set the project.config to a non-debug configuration + if (conf.Options["DebugInformation"].ToString().ToLower() != "true") + { + ss.WriteLine(" ", conf.Name); + } + ss.WriteLine(); + ss.WriteLine(" ", conf.Name); + ss.WriteLine(" ", conf.Name); + ss.WriteLine(" ", conf.Options["DebugInformation"].ToString().ToLower()); + ss.WriteLine(" "); + ss.WriteLine(); + } + + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(); + + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(); + + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(); + + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(); + + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(); + + ss.WriteLine(" "); + ss.WriteLine(" "); + //ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(" "); + //foreach(ProjectNode project in solution.Projects) + //{ + // string path = Helper.MakePathRelativeTo(solution.FullPath, project.FullPath); + // ss.Write(" "); + //} + ss.WriteLine(" "); + ss.WriteLine(); + + ss.WriteLine(" "); + + foreach (ProjectNode project in solution.ProjectsTableOrder) + { + string path = Helper.MakePathRelativeTo(solution.FullPath, project.FullPath); + ss.Write(" "); + } + ss.WriteLine(" "); + ss.WriteLine(); + + ss.WriteLine(" "); + ss.WriteLine(); + ss.WriteLine(" "); + ss.WriteLine(); + //ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(); + + ss.WriteLine(" "); + ss.WriteLine(" "); + foreach (ProjectNode project in solution.Projects) + { + string path = Helper.MakePathRelativeTo(solution.FullPath, project.FullPath); + ss.Write(" "); + } + ss.WriteLine(" "); + ss.WriteLine(); + ss.WriteLine(""); + } + + m_Kernel.CurrentWorkingDirectory.Pop(); + } + + private void CleanProject(ProjectNode project) + { + m_Kernel.Log.Write("...Cleaning project: {0}", project.Name); + string projectFile = Helper.MakeFilePath(project.FullPath, project.Name + (project.Type == ProjectType.Library ? ".dll" : ".exe"), "build"); + Helper.DeleteIfExists(projectFile); + } + + private void CleanSolution(SolutionNode solution) + { + m_Kernel.Log.Write("Cleaning Xcode build files for", solution.Name); + + string slnFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "build"); + Helper.DeleteIfExists(slnFile); + + foreach (ProjectNode project in solution.Projects) + { + CleanProject(project); + } + + m_Kernel.Log.Write(""); + } + + #endregion + + #region ITarget Members + + /// + /// Writes the specified kern. + /// + /// The kern. + public void Write(Kernel kern) + { + if (kern == null) + { + throw new ArgumentNullException("kern"); + } + m_Kernel = kern; + foreach (SolutionNode solution in kern.Solutions) + { + WriteCombine(solution); + } + m_Kernel = null; + } + + /// + /// Cleans the specified kern. + /// + /// The kern. + public virtual void Clean(Kernel kern) + { + if (kern == null) + { + throw new ArgumentNullException("kern"); + } + m_Kernel = kern; + foreach (SolutionNode sol in kern.Solutions) + { + CleanSolution(sol); + } + m_Kernel = null; + } + + /// + /// Gets the name. + /// + /// The name. + public string Name + { + get + { + return "xcode"; + } + } + + #endregion + } +} diff --git a/Prebuild/src/Core/Targets/AutotoolsTarget.cs b/Prebuild/src/Core/Targets/AutotoolsTarget.cs new file mode 100644 index 0000000..e46b5a5 --- /dev/null +++ b/Prebuild/src/Core/Targets/AutotoolsTarget.cs @@ -0,0 +1,1070 @@ +#region BSD License +/* + +Copyright (c) 2004 - 2008 +Matthew Holmes (matthew@wildfiregames.com), +Dan Moorehead (dan05a@gmail.com), +Dave Hudson (jendave@yahoo.com), +C.J. Adams-Collier (cjac@colliertech.org), + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + +* Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + +* Redistributions in binary form must reproduce the above copyright +notice, this list of conditions and the following disclaimer in the +documentation and/or other materials provided with the distribution. + +* The name of the author may not be used to endorse or promote +products derived from this software without specific prior written +permission. + +THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, +INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, +STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING +IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +POSSIBILITY OF SUCH DAMAGE. + +*/ +#endregion + +#region MIT X11 license + +/* + Portions of this file authored by Lluis Sanchez Gual + + Copyright (C) 2006 Novell, Inc (http://www.novell.com) + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + "Software"), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE + LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION + OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +#endregion +using System; +using System.Collections.Generic; +using System.IO; +using System.Reflection; +using System.Text; +using System.Text.RegularExpressions; +using System.Xml; +using System.Xml.Xsl; +using System.Net; +using System.Diagnostics; + +using Prebuild.Core.Attributes; +using Prebuild.Core.Interfaces; +using Prebuild.Core.Nodes; +using Prebuild.Core.Utilities; + +namespace Prebuild.Core.Targets +{ + public enum ClrVersion + { + Default, + Net_1_1, + Net_2_0 + } + + public class SystemPackage + { + string name; + string version; + string description; + string[] assemblies; + bool isInternal; + ClrVersion targetVersion; + + public void Initialize(string name, + string version, + string description, + string[] assemblies, + ClrVersion targetVersion, + bool isInternal) + { + this.isInternal = isInternal; + this.name = name; + this.version = version; + this.assemblies = assemblies; + this.description = description; + this.targetVersion = targetVersion; + } + + public string Name + { + get { return name; } + } + + public string Version + { + get { return version; } + } + + public string Description + { + get { return description; } + } + + public ClrVersion TargetVersion + { + get { return targetVersion; } + } + + // The package is part of the mono SDK + public bool IsCorePackage + { + get { return name == "mono"; } + } + + // The package has been registered by an add-in, and is not installed + // in the system. + public bool IsInternalPackage + { + get { return isInternal; } + } + + public string[] Assemblies + { + get { return assemblies; } + } + + } + + + /// + /// + /// + [Target("autotools")] + public class AutotoolsTarget : ITarget + { + #region Fields + + Kernel m_Kernel; + XmlDocument autotoolsDoc; + XmlUrlResolver xr; + System.Security.Policy.Evidence e; + readonly Dictionary assemblyPathToPackage = new Dictionary(); + readonly Dictionary assemblyFullNameToPath = new Dictionary(); + readonly Dictionary packagesHash = new Dictionary(); + readonly List packages = new List(); + + #endregion + + #region Private Methods + + private static void mkdirDashP(string dirName) + { + DirectoryInfo di = new DirectoryInfo(dirName); + if (di.Exists) + return; + + string parentDirName = System.IO.Path.GetDirectoryName(dirName); + DirectoryInfo parentDi = new DirectoryInfo(parentDirName); + if (!parentDi.Exists) + mkdirDashP(parentDirName); + + di.Create(); + } + + private static void chkMkDir(string dirName) + { + System.IO.DirectoryInfo di = + new System.IO.DirectoryInfo(dirName); + + if (!di.Exists) + di.Create(); + } + + private void transformToFile(string filename, XsltArgumentList argList, string nodeName) + { + // Create an XslTransform for this file + XslTransform templateTransformer = + new XslTransform(); + + // Load up the template + XmlNode templateNode = + autotoolsDoc.SelectSingleNode(nodeName + "/*"); + templateTransformer.Load(templateNode.CreateNavigator(), xr, e); + + // Create a writer for the transformed template + XmlTextWriter templateWriter = + new XmlTextWriter(filename, null); + + // Perform transformation, writing the file + templateTransformer.Transform + (m_Kernel.CurrentDoc, argList, templateWriter, xr); + } + + static string NormalizeAsmName(string name) + { + int i = name.IndexOf(", PublicKeyToken=null"); + if (i != -1) + return name.Substring(0, i).Trim(); + return name; + } + + private void AddAssembly(string assemblyfile, SystemPackage package) + { + if (!File.Exists(assemblyfile)) + return; + + try + { + System.Reflection.AssemblyName an = System.Reflection.AssemblyName.GetAssemblyName(assemblyfile); + assemblyFullNameToPath[NormalizeAsmName(an.FullName)] = assemblyfile; + assemblyPathToPackage[assemblyfile] = package; + } + catch + { + } + } + + private static List GetAssembliesWithLibInfo(string line, string file) + { + List references = new List(); + List libdirs = new List(); + List retval = new List(); + foreach (string piece in line.Split(' ')) + { + if (piece.ToLower().Trim().StartsWith("/r:") || piece.ToLower().Trim().StartsWith("-r:")) + { + references.Add(ProcessPiece(piece.Substring(3).Trim(), file)); + } + else if (piece.ToLower().Trim().StartsWith("/lib:") || piece.ToLower().Trim().StartsWith("-lib:")) + { + libdirs.Add(ProcessPiece(piece.Substring(5).Trim(), file)); + } + } + + foreach (string refrnc in references) + { + foreach (string libdir in libdirs) + { + if (File.Exists(libdir + Path.DirectorySeparatorChar + refrnc)) + { + retval.Add(libdir + Path.DirectorySeparatorChar + refrnc); + } + } + } + + return retval; + } + + private static List GetAssembliesWithoutLibInfo(string line, string file) + { + List references = new List(); + foreach (string reference in line.Split(' ')) + { + if (reference.ToLower().Trim().StartsWith("/r:") || reference.ToLower().Trim().StartsWith("-r:")) + { + string final_ref = reference.Substring(3).Trim(); + references.Add(ProcessPiece(final_ref, file)); + } + } + return references; + } + + private static string ProcessPiece(string piece, string pcfile) + { + int start = piece.IndexOf("${"); + if (start == -1) + return piece; + + int end = piece.IndexOf("}"); + if (end == -1) + return piece; + + string variable = piece.Substring(start + 2, end - start - 2); + string interp = GetVariableFromPkgConfig(variable, Path.GetFileNameWithoutExtension(pcfile)); + return ProcessPiece(piece.Replace("${" + variable + "}", interp), pcfile); + } + + private static string GetVariableFromPkgConfig(string var, string pcfile) + { + ProcessStartInfo psi = new ProcessStartInfo("pkg-config"); + psi.RedirectStandardOutput = true; + psi.UseShellExecute = false; + psi.Arguments = String.Format("--variable={0} {1}", var, pcfile); + Process p = new Process(); + p.StartInfo = psi; + p.Start(); + string ret = p.StandardOutput.ReadToEnd().Trim(); + p.WaitForExit(); + if (String.IsNullOrEmpty(ret)) + return String.Empty; + return ret; + } + + private void ParsePCFile(string pcfile) + { + // Don't register the package twice + string pname = Path.GetFileNameWithoutExtension(pcfile); + if (packagesHash.ContainsKey(pname)) + return; + + List fullassemblies = null; + string version = ""; + string desc = ""; + + SystemPackage package = new SystemPackage(); + + using (StreamReader reader = new StreamReader(pcfile)) + { + string line; + while ((line = reader.ReadLine()) != null) + { + string lowerLine = line.ToLower(); + if (lowerLine.StartsWith("libs:") && lowerLine.IndexOf(".dll") != -1) + { + string choppedLine = line.Substring(5).Trim(); + if (choppedLine.IndexOf("-lib:") != -1 || choppedLine.IndexOf("/lib:") != -1) + { + fullassemblies = GetAssembliesWithLibInfo(choppedLine, pcfile); + } + else + { + fullassemblies = GetAssembliesWithoutLibInfo(choppedLine, pcfile); + } + } + else if (lowerLine.StartsWith("version:")) + { + // "version:".Length == 8 + version = line.Substring(8).Trim(); + } + else if (lowerLine.StartsWith("description:")) + { + // "description:".Length == 12 + desc = line.Substring(12).Trim(); + } + } + } + + if (fullassemblies == null) + return; + + foreach (string assembly in fullassemblies) + { + AddAssembly(assembly, package); + } + + package.Initialize(pname, + version, + desc, + fullassemblies.ToArray(), + ClrVersion.Default, + false); + packages.Add(package); + packagesHash[pname] = package; + } + + void RegisterSystemAssemblies(string prefix, string version, ClrVersion ver) + { + SystemPackage package = new SystemPackage(); + List list = new List(); + + string dir = Path.Combine(prefix, version); + if (!Directory.Exists(dir)) + { + return; + } + + foreach (string assembly in Directory.GetFiles(dir, "*.dll")) + { + AddAssembly(assembly, package); + list.Add(assembly); + } + + package.Initialize("mono", + version, + "The Mono runtime", + list.ToArray(), + ver, + false); + packages.Add(package); + } + + void RunInitialization() + { + string versionDir; + + if (Environment.Version.Major == 1) + { + versionDir = "1.0"; + } + else + { + versionDir = "2.0"; + } + + //Pull up assemblies from the installed mono system. + string prefix = Path.GetDirectoryName(typeof(int).Assembly.Location); + + if (prefix.IndexOf(Path.Combine("mono", versionDir)) == -1) + prefix = Path.Combine(prefix, "mono"); + else + prefix = Path.GetDirectoryName(prefix); + + RegisterSystemAssemblies(prefix, "1.0", ClrVersion.Net_1_1); + RegisterSystemAssemblies(prefix, "2.0", ClrVersion.Net_2_0); + + string search_dirs = Environment.GetEnvironmentVariable("PKG_CONFIG_PATH"); + string libpath = Environment.GetEnvironmentVariable("PKG_CONFIG_LIBPATH"); + + if (String.IsNullOrEmpty(libpath)) + { + string path_dirs = Environment.GetEnvironmentVariable("PATH"); + foreach (string pathdir in path_dirs.Split(Path.PathSeparator)) + { + if (pathdir == null) + continue; + if (File.Exists(pathdir + Path.DirectorySeparatorChar + "pkg-config")) + { + libpath = Path.Combine(pathdir, ".."); + libpath = Path.Combine(libpath, "lib"); + libpath = Path.Combine(libpath, "pkgconfig"); + break; + } + } + } + search_dirs += Path.PathSeparator + libpath; + if (!string.IsNullOrEmpty(search_dirs)) + { + List scanDirs = new List(); + foreach (string potentialDir in search_dirs.Split(Path.PathSeparator)) + { + if (!scanDirs.Contains(potentialDir)) + scanDirs.Add(potentialDir); + } + foreach (string pcdir in scanDirs) + { + if (pcdir == null) + continue; + + if (Directory.Exists(pcdir)) + { + foreach (string pcfile in Directory.GetFiles(pcdir, "*.pc")) + { + ParsePCFile(pcfile); + } + } + } + } + } + + private void WriteCombine(SolutionNode solution) + { + #region "Create Solution directory if it doesn't exist" + string solutionDir = Path.Combine(solution.FullPath, + Path.Combine("autotools", + solution.Name)); + chkMkDir(solutionDir); + #endregion + + #region "Write Solution-level files" + XsltArgumentList argList = new XsltArgumentList(); + argList.AddParam("solutionName", "", solution.Name); + // $solutionDir is $rootDir/$solutionName/ + transformToFile(Path.Combine(solutionDir, "configure.ac"), + argList, "/Autotools/SolutionConfigureAc"); + transformToFile(Path.Combine(solutionDir, "Makefile.am"), + argList, "/Autotools/SolutionMakefileAm"); + transformToFile(Path.Combine(solutionDir, "autogen.sh"), + argList, "/Autotools/SolutionAutogenSh"); + #endregion + + foreach (ProjectNode project in solution.ProjectsTableOrder) + { + m_Kernel.Log.Write(String.Format("Writing project: {0}", + project.Name)); + WriteProject(solution, project); + } + } + + private static string FindFileReference(string refName, + ProjectNode project) + { + foreach (ReferencePathNode refPath in project.ReferencePaths) + { + string fullPath = + Helper.MakeFilePath(refPath.Path, refName, "dll"); + + if (File.Exists(fullPath)) { + return fullPath; + } + } + + return null; + } + + /// + /// Gets the XML doc file. + /// + /// The project. + /// The conf. + /// + public static string GetXmlDocFile(ProjectNode project, ConfigurationNode conf) + { + if (conf == null) + { + throw new ArgumentNullException("conf"); + } + if (project == null) + { + throw new ArgumentNullException("project"); + } + string docFile = (string)conf.Options["XmlDocFile"]; + // if(docFile != null && docFile.Length == 0)//default to assembly name if not specified + // { + // return Path.GetFileNameWithoutExtension(project.AssemblyName) + ".xml"; + // } + return docFile; + } + + /// + /// Normalizes the path. + /// + /// The path. + /// + public static string NormalizePath(string path) + { + if (path == null) + { + return ""; + } + + StringBuilder tmpPath; + + if (Core.Parse.Preprocessor.GetOS() == "Win32") + { + tmpPath = new StringBuilder(path.Replace('\\', '/')); + tmpPath.Replace("/", @"\\"); + } + else + { + tmpPath = new StringBuilder(path.Replace('\\', '/')); + tmpPath = tmpPath.Replace('/', Path.DirectorySeparatorChar); + } + return tmpPath.ToString(); + } + + private void WriteProject(SolutionNode solution, ProjectNode project) + { + string solutionDir = Path.Combine(solution.FullPath, Path.Combine("autotools", solution.Name)); + string projectDir = Path.Combine(solutionDir, project.Name); + string projectVersion = project.Version; + bool hasAssemblyConfig = false; + chkMkDir(projectDir); + + List + compiledFiles = new List(), + contentFiles = new List(), + embeddedFiles = new List(), + + binaryLibs = new List(), + pkgLibs = new List(), + systemLibs = new List(), + runtimeLibs = new List(), + + extraDistFiles = new List(), + localCopyTargets = new List(); + + // If there exists a .config file for this assembly, copy + // it to the project folder + + // TODO: Support copying .config.osx files + // TODO: support processing the .config file for native library deps + string projectAssemblyName = project.Name; + if (project.AssemblyName != null) + projectAssemblyName = project.AssemblyName; + + if (File.Exists(Path.Combine(project.FullPath, projectAssemblyName) + ".dll.config")) + { + hasAssemblyConfig = true; + System.IO.File.Copy(Path.Combine(project.FullPath, projectAssemblyName + ".dll.config"), Path.Combine(projectDir, projectAssemblyName + ".dll.config"), true); + extraDistFiles.Add(project.AssemblyName + ".dll.config"); + } + + foreach (ConfigurationNode conf in project.Configurations) + { + if (conf.Options.KeyFile != string.Empty) + { + // Copy snk file into the project's directory + // Use the snk from the project directory directly + string source = Path.Combine(project.FullPath, conf.Options.KeyFile); + string keyFile = conf.Options.KeyFile; + Regex re = new Regex(".*/"); + keyFile = re.Replace(keyFile, ""); + + string dest = Path.Combine(projectDir, keyFile); + // Tell the user if there's a problem copying the file + try + { + mkdirDashP(System.IO.Path.GetDirectoryName(dest)); + System.IO.File.Copy(source, dest, true); + } + catch (System.IO.IOException e) + { + Console.WriteLine(e.Message); + } + } + } + + // Copy compiled, embedded and content files into the project's directory + foreach (string filename in project.Files) + { + string source = Path.Combine(project.FullPath, filename); + string dest = Path.Combine(projectDir, filename); + + if (filename.Contains("AssemblyInfo.cs")) + { + // If we've got an AssemblyInfo.cs, pull the version number from it + string[] sources = { source }; + string[] args = { "" }; + Microsoft.CSharp.CSharpCodeProvider cscp = + new Microsoft.CSharp.CSharpCodeProvider(); + + string tempAssemblyFile = Path.Combine(Path.GetTempPath(), project.Name + "-temp.dll"); + System.CodeDom.Compiler.CompilerParameters cparam = + new System.CodeDom.Compiler.CompilerParameters(args, tempAssemblyFile); + + System.CodeDom.Compiler.CompilerResults cr = + cscp.CompileAssemblyFromFile(cparam, sources); + + foreach (System.CodeDom.Compiler.CompilerError error in cr.Errors) + Console.WriteLine("Error! '{0}'", error.ErrorText); + + try { + string projectFullName = cr.CompiledAssembly.FullName; + Regex verRegex = new Regex("Version=([\\d\\.]+)"); + Match verMatch = verRegex.Match(projectFullName); + if (verMatch.Success) + projectVersion = verMatch.Groups[1].Value; + }catch{ + Console.WriteLine("Couldn't compile AssemblyInfo.cs"); + } + + // Clean up the temp file + try + { + if (File.Exists(tempAssemblyFile)) + File.Delete(tempAssemblyFile); + } + catch + { + Console.WriteLine("Error! '{0}'", e); + } + + } + + // Tell the user if there's a problem copying the file + try + { + mkdirDashP(System.IO.Path.GetDirectoryName(dest)); + System.IO.File.Copy(source, dest, true); + } + catch (System.IO.IOException e) + { + Console.WriteLine(e.Message); + } + + switch (project.Files.GetBuildAction(filename)) + { + case BuildAction.Compile: + compiledFiles.Add(filename); + break; + case BuildAction.Content: + contentFiles.Add(filename); + extraDistFiles.Add(filename); + break; + case BuildAction.EmbeddedResource: + embeddedFiles.Add(filename); + break; + } + } + + // Set up references + for (int refNum = 0; refNum < project.References.Count; refNum++) + { + ReferenceNode refr = project.References[refNum]; + Assembly refAssembly = Assembly.LoadWithPartialName(refr.Name); + + /* Determine which pkg-config (.pc) file refers to + this assembly */ + + SystemPackage package = null; + + if (packagesHash.ContainsKey(refr.Name)) + { + package = packagesHash[refr.Name]; + + } + else + { + string assemblyFullName = string.Empty; + if (refAssembly != null) + assemblyFullName = refAssembly.FullName; + + string assemblyFileName = string.Empty; + if (assemblyFullName != string.Empty && + assemblyFullNameToPath.ContainsKey(assemblyFullName) + ) + assemblyFileName = + assemblyFullNameToPath[assemblyFullName]; + + if (assemblyFileName != string.Empty && + assemblyPathToPackage.ContainsKey(assemblyFileName) + ) + package = assemblyPathToPackage[assemblyFileName]; + + } + + /* If we know the .pc file and it is not "mono" + (already in the path), add a -pkg: argument */ + + if (package != null && + package.Name != "mono" && + !pkgLibs.Contains(package.Name) + ) + pkgLibs.Add(package.Name); + + string fileRef = + FindFileReference(refr.Name, (ProjectNode)refr.Parent); + + if (refr.LocalCopy || + solution.ProjectsTable.ContainsKey(refr.Name) || + fileRef != null || + refr.Path != null + ) + { + + /* Attempt to copy the referenced lib to the + project's directory */ + + string filename = refr.Name + ".dll"; + string source = filename; + if (refr.Path != null) + source = Path.Combine(refr.Path, source); + source = Path.Combine(project.FullPath, source); + string dest = Path.Combine(projectDir, filename); + + /* Since we depend on this binary dll to build, we + * will add a compile- time dependency on the + * copied dll, and add the dll to the list of + * files distributed with this package + */ + + binaryLibs.Add(refr.Name + ".dll"); + extraDistFiles.Add(refr.Name + ".dll"); + + // TODO: Support copying .config.osx files + // TODO: Support for determining native dependencies + if (File.Exists(source + ".config")) + { + System.IO.File.Copy(source + ".config", Path.GetDirectoryName(dest), true); + extraDistFiles.Add(refr.Name + ".dll.config"); + } + + try + { + System.IO.File.Copy(source, dest, true); + } + catch (System.IO.IOException) + { + if (solution.ProjectsTable.ContainsKey(refr.Name)){ + + /* If an assembly is referenced, marked for + * local copy, in the list of projects for + * this solution, but does not exist, put a + * target into the Makefile.am to build the + * assembly and copy it to this project's + * directory + */ + + ProjectNode sourcePrj = + ((solution.ProjectsTable[refr.Name])); + + string target = + String.Format("{0}:\n" + + "\t$(MAKE) -C ../{1}\n" + + "\tln ../{2}/$@ $@\n", + filename, + sourcePrj.Name, + sourcePrj.Name ); + + localCopyTargets.Add(target); + } + } + } + else if( !pkgLibs.Contains(refr.Name) ) + { + // Else, let's assume it's in the GAC or the lib path + string assemName = string.Empty; + int index = refr.Name.IndexOf(","); + + if (index > 0) + assemName = refr.Name.Substring(0, index); + else + assemName = refr.Name; + + m_Kernel.Log.Write(String.Format( + "Warning: Couldn't find an appropriate assembly " + + "for reference:\n'{0}'", refr.Name + )); + systemLibs.Add(assemName); + } + } + + const string lineSep = " \\\n\t"; + string compiledFilesString = string.Empty; + if (compiledFiles.Count > 0) + compiledFilesString = + lineSep + string.Join(lineSep, compiledFiles.ToArray()); + + string embeddedFilesString = ""; + if (embeddedFiles.Count > 0) + embeddedFilesString = + lineSep + string.Join(lineSep, embeddedFiles.ToArray()); + + string contentFilesString = ""; + if (contentFiles.Count > 0) + contentFilesString = + lineSep + string.Join(lineSep, contentFiles.ToArray()); + + string extraDistFilesString = ""; + if (extraDistFiles.Count > 0) + extraDistFilesString = + lineSep + string.Join(lineSep, extraDistFiles.ToArray()); + + string pkgLibsString = ""; + if (pkgLibs.Count > 0) + pkgLibsString = + lineSep + string.Join(lineSep, pkgLibs.ToArray()); + + string binaryLibsString = ""; + if (binaryLibs.Count > 0) + binaryLibsString = + lineSep + string.Join(lineSep, binaryLibs.ToArray()); + + string systemLibsString = ""; + if (systemLibs.Count > 0) + systemLibsString = + lineSep + string.Join(lineSep, systemLibs.ToArray()); + + string localCopyTargetsString = ""; + if (localCopyTargets.Count > 0) + localCopyTargetsString = + string.Join("\n", localCopyTargets.ToArray()); + + string monoPath = ""; + foreach (string runtimeLib in runtimeLibs) + { + monoPath += ":`pkg-config --variable=libdir " + runtimeLib + "`"; + } + + // Add the project name to the list of transformation + // parameters + XsltArgumentList argList = new XsltArgumentList(); + argList.AddParam("projectName", "", project.Name); + argList.AddParam("solutionName", "", solution.Name); + argList.AddParam("assemblyName", "", projectAssemblyName); + argList.AddParam("compiledFiles", "", compiledFilesString); + argList.AddParam("embeddedFiles", "", embeddedFilesString); + argList.AddParam("contentFiles", "", contentFilesString); + argList.AddParam("extraDistFiles", "", extraDistFilesString); + argList.AddParam("pkgLibs", "", pkgLibsString); + argList.AddParam("binaryLibs", "", binaryLibsString); + argList.AddParam("systemLibs", "", systemLibsString); + argList.AddParam("monoPath", "", monoPath); + argList.AddParam("localCopyTargets", "", localCopyTargetsString); + argList.AddParam("projectVersion", "", projectVersion); + argList.AddParam("hasAssemblyConfig", "", hasAssemblyConfig ? "true" : ""); + + // Transform the templates + transformToFile(Path.Combine(projectDir, "configure.ac"), argList, "/Autotools/ProjectConfigureAc"); + transformToFile(Path.Combine(projectDir, "Makefile.am"), argList, "/Autotools/ProjectMakefileAm"); + transformToFile(Path.Combine(projectDir, "autogen.sh"), argList, "/Autotools/ProjectAutogenSh"); + + if (project.Type == Core.Nodes.ProjectType.Library) + transformToFile(Path.Combine(projectDir, project.Name + ".pc.in"), argList, "/Autotools/ProjectPcIn"); + if (project.Type == Core.Nodes.ProjectType.Exe || project.Type == Core.Nodes.ProjectType.WinExe) + transformToFile(Path.Combine(projectDir, project.Name.ToLower() + ".in"), argList, "/Autotools/ProjectWrapperScriptIn"); + } + + private void CleanProject(ProjectNode project) + { + m_Kernel.Log.Write("...Cleaning project: {0}", project.Name); + string projectFile = Helper.MakeFilePath(project.FullPath, "Include", "am"); + Helper.DeleteIfExists(projectFile); + } + + private void CleanSolution(SolutionNode solution) + { + m_Kernel.Log.Write("Cleaning Autotools make files for", solution.Name); + + string slnFile = Helper.MakeFilePath(solution.FullPath, "Makefile", "am"); + Helper.DeleteIfExists(slnFile); + + slnFile = Helper.MakeFilePath(solution.FullPath, "Makefile", "in"); + Helper.DeleteIfExists(slnFile); + + slnFile = Helper.MakeFilePath(solution.FullPath, "configure", "ac"); + Helper.DeleteIfExists(slnFile); + + slnFile = Helper.MakeFilePath(solution.FullPath, "configure"); + Helper.DeleteIfExists(slnFile); + + slnFile = Helper.MakeFilePath(solution.FullPath, "Makefile"); + Helper.DeleteIfExists(slnFile); + + foreach (ProjectNode project in solution.Projects) + { + CleanProject(project); + } + + m_Kernel.Log.Write(""); + } + + #endregion + + #region ITarget Members + + /// + /// Writes the specified kern. + /// + /// The kern. + public void Write(Kernel kern) + { + if (kern == null) + { + throw new ArgumentNullException("kern"); + } + m_Kernel = kern; + m_Kernel.Log.Write("Parsing system pkg-config files"); + RunInitialization(); + + const string streamName = "autotools.xml"; + string fqStreamName = String.Format("Prebuild.data.{0}", + streamName + ); + + // Retrieve stream for the autotools template XML + Stream autotoolsStream = Assembly.GetExecutingAssembly() + .GetManifestResourceStream(fqStreamName); + + if(autotoolsStream == null) { + + /* + * try without the default namespace prepended, in + * case prebuild.exe assembly was compiled with + * something other than Visual Studio .NET + */ + + autotoolsStream = Assembly.GetExecutingAssembly() + .GetManifestResourceStream(streamName); + if(autotoolsStream == null){ + string errStr = + String.Format("Could not find embedded resource file:\n" + + "'{0}' or '{1}'", + streamName, fqStreamName + ); + + m_Kernel.Log.Write(errStr); + + throw new System.Reflection.TargetException(errStr); + } + } + + // Create an XML URL Resolver with default credentials + xr = new System.Xml.XmlUrlResolver(); + xr.Credentials = CredentialCache.DefaultCredentials; + + // Create a default evidence - no need to limit access + e = new System.Security.Policy.Evidence(); + + // Load the autotools XML + autotoolsDoc = new XmlDocument(); + autotoolsDoc.Load(autotoolsStream); + + /* rootDir is the filesystem location where the Autotools + * build tree will be created - for now we'll make it + * $PWD/autotools + */ + + string pwd = Directory.GetCurrentDirectory(); + //string pwd = System.Environment.GetEnvironmentVariable("PWD"); + //if (pwd.Length != 0) + //{ + string rootDir = Path.Combine(pwd, "autotools"); + //} + //else + //{ + // pwd = Assembly.GetExecutingAssembly() + //} + chkMkDir(rootDir); + + foreach (SolutionNode solution in kern.Solutions) + { + m_Kernel.Log.Write(String.Format("Writing solution: {0}", + solution.Name)); + WriteCombine(solution); + } + m_Kernel = null; + } + + /// + /// Cleans the specified kern. + /// + /// The kern. + public virtual void Clean(Kernel kern) + { + if (kern == null) + { + throw new ArgumentNullException("kern"); + } + m_Kernel = kern; + foreach (SolutionNode sol in kern.Solutions) + { + CleanSolution(sol); + } + m_Kernel = null; + } + + /// + /// Gets the name. + /// + /// The name. + public string Name + { + get + { + return "autotools"; + } + } + + #endregion + } +} diff --git a/Prebuild/src/Core/Targets/DebugTarget.cs b/Prebuild/src/Core/Targets/DebugTarget.cs new file mode 100644 index 0000000..650007e --- /dev/null +++ b/Prebuild/src/Core/Targets/DebugTarget.cs @@ -0,0 +1,102 @@ +#region BSD License +/* +Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com) + +Redistribution and use in source and binary forms, with or without modification, are permitted +provided that the following conditions are met: + +* Redistributions of source code must retain the above copyright notice, this list of conditions + and the following disclaimer. +* Redistributions in binary form must reproduce the above copyright notice, this list of conditions + and the following disclaimer in the documentation and/or other materials provided with the + distribution. +* The name of the author may not be used to endorse or promote products derived from this software + without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, +BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING +IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ +#endregion + +#region CVS Information +/* + * $Source$ + * $Author: jendave $ + * $Date: 2006-09-20 08:42:51 +0100 (Wed, 20 Sep 2006) $ + * $Revision: 164 $ + */ +#endregion + +using System; + +using Prebuild.Core.Attributes; +using Prebuild.Core.Interfaces; +using Prebuild.Core.Nodes; + +#if (DEBUG && _DEBUG_TARGET) +namespace Prebuild.Core.Targets +{ + [Target("debug")] + public class DebugTarget : ITarget + { +#region Fields + + private Kernel m_Kernel = null; + +#endregion + +#region ITarget Members + + public void Write() + { + foreach(SolutionNode s in m_Kernel.Solutions) + { + Console.WriteLine("Solution [ {0}, {1} ]", s.Name, s.Path); + foreach(string file in s.Files) +{ + Console.WriteLine("\tFile [ {0} ]", file); +} + + foreach(ProjectNode proj in s.Projects) + { + Console.WriteLine("\tProject [ {0}, {1}. {2} ]", proj.Name, proj.Path, proj.Language); + foreach(string file in proj.Files) + Console.WriteLine("\t\tFile [ {0} ]", file); + } + } + } + + public void Clean() + { + Console.WriteLine("Not implemented"); + } + + public string Name + { + get + { + return "debug"; + } + } + + public Kernel Kernel + { + get + { + return m_Kernel; + } + set + { + m_Kernel = value; + } + } + +#endregion + } +} +#endif diff --git a/Prebuild/src/Core/Targets/MakefileTarget.cs b/Prebuild/src/Core/Targets/MakefileTarget.cs new file mode 100644 index 0000000..54046dd --- /dev/null +++ b/Prebuild/src/Core/Targets/MakefileTarget.cs @@ -0,0 +1,469 @@ +#region BSD License +/* +Copyright (c) 2004 Crestez Leonard (cleonard@go.ro) + +Redistribution and use in source and binary forms, with or without modification, are permitted +provided that the following conditions are met: + +* Redistributions of source code must retain the above copyright notice, this list of conditions + and the following disclaimer. +* Redistributions in binary form must reproduce the above copyright notice, this list of conditions + and the following disclaimer in the documentation and/or other materials provided with the + distribution. +* The name of the author may not be used to endorse or promote products derived from this software + without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, +BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING +IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ +#endregion + +using System; +using System.IO; +using System.Text.RegularExpressions; + +using Prebuild.Core.Attributes; +using Prebuild.Core.Interfaces; +using Prebuild.Core.Nodes; +using Prebuild.Core.Utilities; + +namespace Prebuild.Core.Targets +{ + [Target("makefile")] + public class MakefileTarget : ITarget + { + #region Fields + + private Kernel m_Kernel = null; + + #endregion + + #region Private Methods + + // This converts a path relative to the path of a project to + // a path relative to the solution path. + private string NicePath(ProjectNode proj, string path) + { + string res; + SolutionNode solution = (SolutionNode)proj.Parent; + res = Path.Combine(Helper.NormalizePath(proj.FullPath, '/'), Helper.NormalizePath(path, '/')); + res = Helper.NormalizePath(res, '/'); + res = res.Replace("/./", "/"); + while (res.IndexOf("/../") >= 0) + { + int a = res.IndexOf("/../"); + int b = res.LastIndexOf("/", a - 1); + res = res.Remove(b, a - b + 3); + } + res = Helper.MakePathRelativeTo(solution.FullPath, res); + if (res.StartsWith("./")) + res = res.Substring(2, res.Length - 2); + res = Helper.NormalizePath(res, '/'); + return res; + } + + private void WriteProjectFiles(StreamWriter f, SolutionNode solution, ProjectNode project) + { + // Write list of source code files + f.WriteLine("SOURCES_{0} = \\", project.Name); + foreach (string file in project.Files) + if (project.Files.GetBuildAction(file) == BuildAction.Compile) + f.WriteLine("\t{0} \\", NicePath(project, file)); + f.WriteLine(); + + // Write list of resource files + f.WriteLine("RESOURCES_{0} = \\", project.Name); + foreach (string file in project.Files) + if (project.Files.GetBuildAction(file) == BuildAction.EmbeddedResource) + { + string path = NicePath(project, file); + f.WriteLine("\t-resource:{0},{1} \\", path, Path.GetFileName(path)); + } + f.WriteLine(); + + // There's also Content and None in BuildAction. + // What am I supposed to do with that? + } + + private string FindFileReference(string refName, ProjectNode project) + { + foreach (ReferencePathNode refPath in project.ReferencePaths) + { + string fullPath = NicePath(project, Helper.MakeFilePath(refPath.Path, refName, "dll")); + if (File.Exists(fullPath)) + return fullPath; + } + return null; + } + + private void WriteProjectReferences(StreamWriter f, SolutionNode solution, ProjectNode project) + { + f.WriteLine("REFERENCES_{0} = \\", project.Name); + foreach (ReferenceNode refr in project.References) + { + string path; + // Project references change with configurations. + if (solution.ProjectsTable.ContainsKey(refr.Name)) + continue; + path = FindFileReference(refr.Name, project); + if (path != null) + f.WriteLine("\t-r:{0} \\", path); + else + f.WriteLine("\t-r:{0} \\", refr.Name); + } + f.WriteLine(); + } + + private void WriteProjectDependencies(StreamWriter f, SolutionNode solution, ProjectNode project) + { + f.WriteLine("DEPENDENCIES_{0} = \\", project.Name); + f.WriteLine("\t$(SOURCES_{0}) \\", project.Name); + foreach (string file in project.Files) + if (project.Files.GetBuildAction(file) == BuildAction.EmbeddedResource) + f.WriteLine("\t{0} \\", NicePath(project, file)); + f.WriteLine(); + } + + private string ProjectTypeToExtension(ProjectType t) + { + if (t == ProjectType.Exe || t == ProjectType.WinExe) + { + return "exe"; + } + else if (t == ProjectType.Library) + { + return "dll"; + } + else + { + throw new FatalException("Bad ProjectType: {0}", t); + } + } + + private string ProjectTypeToTarget(ProjectType t) + { + if (t == ProjectType.Exe) + { + return "exe"; + } + else if (t == ProjectType.WinExe) + { + return "winexe"; + } + else if (t == ProjectType.Library) + { + return "library"; + } + else + { + throw new FatalException("Bad ProjectType: {0}", t); + } + } + + private string ProjectOutput(ProjectNode project, ConfigurationNode config) + { + string filepath; + filepath = Helper.MakeFilePath((string)config.Options["OutputPath"], + project.AssemblyName, ProjectTypeToExtension(project.Type)); + return NicePath(project, filepath); + } + + // Returns true if two configs in one project have the same output. + private bool ProjectClashes(ProjectNode project) + { + foreach (ConfigurationNode conf1 in project.Configurations) + foreach (ConfigurationNode conf2 in project.Configurations) + if (ProjectOutput(project, conf1) == ProjectOutput(project, conf2) && conf1 != conf2) + { + m_Kernel.Log.Write("Warning: Configurations {0} and {1} for project {2} output the same file", + conf1.Name, conf2.Name, project.Name); + m_Kernel.Log.Write("Warning: I'm going to use some timestamps(extra empty files)."); + return true; + } + return false; + } + + private void WriteProject(StreamWriter f, SolutionNode solution, ProjectNode project) + { + f.WriteLine("# This is for project {0}", project.Name); + f.WriteLine(); + + WriteProjectFiles(f, solution, project); + WriteProjectReferences(f, solution, project); + WriteProjectDependencies(f, solution, project); + + bool clash = ProjectClashes(project); + + foreach (ConfigurationNode conf in project.Configurations) + { + string outpath = ProjectOutput(project, conf); + string filesToClean = outpath; + + if (clash) + { + f.WriteLine("{0}-{1}: .{0}-{1}-timestamp", project.Name, conf.Name); + f.WriteLine(); + f.Write(".{0}-{1}-timestamp: $(DEPENDENCIES_{0})", project.Name, conf.Name); + } + else + { + f.WriteLine("{0}-{1}: {2}", project.Name, conf.Name, outpath); + f.WriteLine(); + f.Write("{2}: $(DEPENDENCIES_{0})", project.Name, conf.Name, outpath); + } + // Dependencies on other projects. + foreach (ReferenceNode refr in project.References) + if (solution.ProjectsTable.ContainsKey(refr.Name)) + { + ProjectNode refProj = (ProjectNode)solution.ProjectsTable[refr.Name]; + if (ProjectClashes(refProj)) + f.Write(" .{0}-{1}-timestamp", refProj.Name, conf.Name); + else + f.Write(" {0}", ProjectOutput(refProj, conf)); + } + f.WriteLine(); + + // make directory for output. + if (Path.GetDirectoryName(outpath) != "") + { + f.WriteLine("\tmkdir -p {0}", Path.GetDirectoryName(outpath)); + } + // mcs command line. + f.Write("\tgmcs", project.Name); + f.Write(" -warn:{0}", conf.Options["WarningLevel"]); + if ((bool)conf.Options["DebugInformation"]) + f.Write(" -debug"); + if ((bool)conf.Options["AllowUnsafe"]) + f.Write(" -unsafe"); + if ((bool)conf.Options["CheckUnderflowOverflow"]) + f.Write(" -checked"); + if (project.StartupObject != "") + f.Write(" -main:{0}", project.StartupObject); + if ((string)conf.Options["CompilerDefines"] != "") + { + f.Write(" -define:\"{0}\"", conf.Options["CompilerDefines"]); + } + + f.Write(" -target:{0} -out:{1}", ProjectTypeToTarget(project.Type), outpath); + + // Build references to other projects. Now that sux. + // We have to reference the other project in the same conf. + foreach (ReferenceNode refr in project.References) + if (solution.ProjectsTable.ContainsKey(refr.Name)) + { + ProjectNode refProj; + refProj = (ProjectNode)solution.ProjectsTable[refr.Name]; + f.Write(" -r:{0}", ProjectOutput(refProj, conf)); + } + + f.Write(" $(REFERENCES_{0})", project.Name); + f.Write(" $(RESOURCES_{0})", project.Name); + f.Write(" $(SOURCES_{0})", project.Name); + f.WriteLine(); + + // Copy references with localcopy. + foreach (ReferenceNode refr in project.References) + if (refr.LocalCopy) + { + string outPath, srcPath, destPath; + outPath = Helper.NormalizePath((string)conf.Options["OutputPath"]); + if (solution.ProjectsTable.ContainsKey(refr.Name)) + { + ProjectNode refProj; + refProj = (ProjectNode)solution.ProjectsTable[refr.Name]; + srcPath = ProjectOutput(refProj, conf); + destPath = Path.Combine(outPath, Path.GetFileName(srcPath)); + destPath = NicePath(project, destPath); + if (srcPath != destPath) + { + f.WriteLine("\tcp -f {0} {1}", srcPath, destPath); + filesToClean += " " + destPath; + } + continue; + } + srcPath = FindFileReference(refr.Name, project); + if (srcPath != null) + { + destPath = Path.Combine(outPath, Path.GetFileName(srcPath)); + destPath = NicePath(project, destPath); + f.WriteLine("\tcp -f {0} {1}", srcPath, destPath); + filesToClean += " " + destPath; + } + } + + if (clash) + { + filesToClean += String.Format(" .{0}-{1}-timestamp", project.Name, conf.Name); + f.WriteLine("\ttouch .{0}-{1}-timestamp", project.Name, conf.Name); + f.Write("\trm -rf"); + foreach (ConfigurationNode otherConf in project.Configurations) + if (otherConf != conf) + f.WriteLine(" .{0}-{1}-timestamp", project.Name, otherConf.Name); + f.WriteLine(); + } + f.WriteLine(); + f.WriteLine("{0}-{1}-clean:", project.Name, conf.Name); + f.WriteLine("\trm -rf {0}", filesToClean); + f.WriteLine(); + } + } + + private void WriteIntro(StreamWriter f, SolutionNode solution) + { + f.WriteLine("# Makefile for {0} generated by Prebuild ( http://dnpb.sf.net )", solution.Name); + f.WriteLine("# Do not edit."); + f.WriteLine("#"); + + f.Write("# Configurations:"); + foreach (ConfigurationNode conf in solution.Configurations) + f.Write(" {0}", conf.Name); + f.WriteLine(); + + f.WriteLine("# Projects:"); + foreach (ProjectNode proj in solution.Projects) + f.WriteLine("#\t{0}", proj.Name); + + f.WriteLine("#"); + f.WriteLine("# Building:"); + f.WriteLine("#\t\"make\" to build everything under the default(first) configuration"); + f.WriteLine("#\t\"make CONF\" to build every project under configuration CONF"); + f.WriteLine("#\t\"make PROJ\" to build project PROJ under the default(first) configuration"); + f.WriteLine("#\t\"make PROJ-CONF\" to build project PROJ under configuration CONF"); + f.WriteLine("#"); + f.WriteLine("# Cleaning (removing results of build):"); + f.WriteLine("#\t\"make clean\" to clean everything, that's what you probably want"); + f.WriteLine("#\t\"make CONF\" to clean everything for a configuration"); + f.WriteLine("#\t\"make PROJ\" to clean everything for a project"); + f.WriteLine("#\t\"make PROJ-CONF\" to clea project PROJ under configuration CONF"); + f.WriteLine(); + } + + private void WritePhony(StreamWriter f, SolutionNode solution) + { + string defconf = ""; + foreach (ConfigurationNode conf in solution.Configurations) + { + defconf = conf.Name; + break; + } + + f.Write(".PHONY: all"); + foreach (ProjectNode proj in solution.Projects) + f.Write(" {0} {0}-clean", proj.Name); + foreach (ConfigurationNode conf in solution.Configurations) + f.Write(" {0} {0}-clean", conf.Name); + foreach (ProjectNode proj in solution.Projects) + foreach (ConfigurationNode conf in solution.Configurations) + f.Write(" {0}-{1} {0}-{1}-clean", proj.Name, conf.Name); + f.WriteLine(); + f.WriteLine(); + + f.WriteLine("all: {0}", defconf); + f.WriteLine(); + + f.Write("clean:"); + foreach (ConfigurationNode conf in solution.Configurations) + f.Write(" {0}-clean", conf.Name); + f.WriteLine(); + f.WriteLine(); + + foreach (ConfigurationNode conf in solution.Configurations) + { + f.Write("{0}: ", conf.Name); + foreach (ProjectNode proj in solution.Projects) + f.Write(" {0}-{1}", proj.Name, conf.Name); + f.WriteLine(); + f.WriteLine(); + + f.Write("{0}-clean: ", conf.Name); + foreach (ProjectNode proj in solution.Projects) + f.Write(" {0}-{1}-clean", proj.Name, conf.Name); + f.WriteLine(); + f.WriteLine(); + } + + foreach (ProjectNode proj in solution.Projects) + { + f.WriteLine("{0}: {0}-{1}", proj.Name, defconf); + f.WriteLine(); + + f.Write("{0}-clean:", proj.Name); + foreach (ConfigurationNode conf in proj.Configurations) + f.Write(" {0}-{1}-clean", proj.Name, conf.Name); + f.WriteLine(); + f.WriteLine(); + } + } + + private void WriteSolution(SolutionNode solution) + { + m_Kernel.Log.Write("Creating makefile for {0}", solution.Name); + m_Kernel.CurrentWorkingDirectory.Push(); + + string file = "Makefile";// Helper.MakeFilePath(solution.FullPath, solution.Name, "make"); + StreamWriter f = new StreamWriter(file); + + Helper.SetCurrentDir(Path.GetDirectoryName(file)); + + using (f) + { + WriteIntro(f, solution); + WritePhony(f, solution); + + foreach (ProjectNode project in solution.Projects) + { + m_Kernel.Log.Write("...Creating Project: {0}", project.Name); + WriteProject(f, solution, project); + } + } + + m_Kernel.Log.Write(""); + m_Kernel.CurrentWorkingDirectory.Pop(); + } + + private void CleanSolution(SolutionNode solution) + { + m_Kernel.Log.Write("Cleaning makefile for {0}", solution.Name); + + string file = Helper.MakeFilePath(solution.FullPath, solution.Name, "make"); + Helper.DeleteIfExists(file); + + m_Kernel.Log.Write(""); + } + + #endregion + + #region ITarget Members + + public void Write(Kernel kern) + { + m_Kernel = kern; + foreach (SolutionNode solution in kern.Solutions) + WriteSolution(solution); + m_Kernel = null; + } + + public virtual void Clean(Kernel kern) + { + m_Kernel = kern; + foreach (SolutionNode sol in kern.Solutions) + CleanSolution(sol); + m_Kernel = null; + } + + public string Name + { + get + { + return "makefile"; + } + } + + #endregion + } +} diff --git a/Prebuild/src/Core/Targets/MonoDevelopTarget.cs b/Prebuild/src/Core/Targets/MonoDevelopTarget.cs new file mode 100644 index 0000000..ea6d2c2 --- /dev/null +++ b/Prebuild/src/Core/Targets/MonoDevelopTarget.cs @@ -0,0 +1,515 @@ +#region BSD License +/* +Copyright (c) 2004 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com) + +Redistribution and use in source and binary forms, with or without modification, are permitted +provided that the following conditions are met: + +* Redistributions of source code must retain the above copyright notice, this list of conditions + and the following disclaimer. +* Redistributions in binary form must reproduce the above copyright notice, this list of conditions + and the following disclaimer in the documentation and/or other materials provided with the + distribution. +* The name of the author may not be used to endorse or promote products derived from this software + without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, +BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING +IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ +#endregion + +using System; +using System.IO; +using System.Reflection; +using System.Text.RegularExpressions; + +using Prebuild.Core.Attributes; +using Prebuild.Core.Interfaces; +using Prebuild.Core.Nodes; +using Prebuild.Core.Utilities; + +namespace Prebuild.Core.Targets +{ + /// + /// + /// + [Target("monodev")] + public class MonoDevelopTarget : ITarget + { + #region Fields + + private Kernel m_Kernel; + + #endregion + + #region Private Methods + + private static string PrependPath(string path) + { + string tmpPath = Helper.NormalizePath(path, '/'); + Regex regex = new Regex(@"(\w):/(\w+)"); + Match match = regex.Match(tmpPath); + if(match.Success || tmpPath[0] == '.' || tmpPath[0] == '/') + { + tmpPath = Helper.NormalizePath(tmpPath); + } + else + { + tmpPath = Helper.NormalizePath("./" + tmpPath); + } + + return tmpPath; + } + + private static string BuildReference(SolutionNode solution, ReferenceNode refr) + { + string ret = ""; + } + else + { + ProjectNode project = (ProjectNode)refr.Parent; + string fileRef = FindFileReference(refr.Name, project); + + if(refr.Path != null || fileRef != null) + { + ret += "Assembly\" refto=\""; + + string finalPath = (refr.Path != null) ? Helper.MakeFilePath(refr.Path, refr.Name, "dll") : fileRef; + + ret += finalPath; + ret += "\" localcopy=\"" + refr.LocalCopy.ToString() + "\" />"; + return ret; + } + + ret += "Gac\""; + ret += " localcopy=\"" + refr.LocalCopy.ToString() + "\""; + ret += " refto=\""; + try + { + /* + Day changed to 28 Mar 2007 + ... + 08:09 < cj> is there anything that replaces Assembly.LoadFromPartialName() ? + 08:09 < jonp> no + 08:10 < jonp> in their infinite wisdom [sic], microsoft decided that the + ability to load any assembly version by-name was an inherently + bad idea + 08:11 < cj> I'm thinking of a bunch of four-letter words right now... + 08:11 < cj> security through making it difficult for the developer!!! + 08:12 < jonp> just use the Obsolete API + 08:12 < jonp> it should still work + 08:12 < cj> alrighty. + 08:12 < jonp> you just get warnings when using it + */ + Assembly assem = Assembly.LoadWithPartialName(refr.Name); + ret += assem.FullName; + //ret += refr.Name; + } + catch (System.NullReferenceException e) + { + e.ToString(); + ret += refr.Name; + } + ret += "\" />"; + } + + return ret; + } + + private static string FindFileReference(string refName, ProjectNode project) + { + foreach(ReferencePathNode refPath in project.ReferencePaths) + { + string fullPath = Helper.MakeFilePath(refPath.Path, refName, "dll"); + + if(File.Exists(fullPath)) + { + return fullPath; + } + } + + return null; + } + + /// + /// Gets the XML doc file. + /// + /// The project. + /// The conf. + /// + public static string GenerateXmlDocFile(ProjectNode project, ConfigurationNode conf) + { + if( conf == null ) + { + throw new ArgumentNullException("conf"); + } + if( project == null ) + { + throw new ArgumentNullException("project"); + } + string docFile = (string)conf.Options["XmlDocFile"]; + if(docFile != null && docFile.Length == 0)//default to assembly name if not specified + { + return "False"; + } + return "True"; + } + + private void WriteProject(SolutionNode solution, ProjectNode project) + { + string csComp = "Mcs"; + string netRuntime = "Mono"; + if(project.Runtime == ClrRuntime.Microsoft) + { + csComp = "Csc"; + netRuntime = "MsNet"; + } + + string projFile = Helper.MakeFilePath(project.FullPath, project.Name, "mdp"); + StreamWriter ss = new StreamWriter(projFile); + + m_Kernel.CurrentWorkingDirectory.Push(); + Helper.SetCurrentDir(Path.GetDirectoryName(projFile)); + + using(ss) + { + ss.WriteLine( + "", + project.Name, + project.RootNamespace + ); + + int count = 0; + + ss.WriteLine(" ", solution.ActiveConfig); + + foreach(ConfigurationNode conf in project.Configurations) + { + ss.WriteLine(" ", conf.Name); + ss.Write(" "); + + ss.Write(" "); + + ss.Write(" "); + + ss.Write(" "); + ss.WriteLine(" "); + + count++; + } + ss.WriteLine(" "); + + ss.Write(" "); + ss.WriteLine(" "); + ss.WriteLine(" "); + + ss.WriteLine(" "); + foreach(string file in project.Files) + { + string buildAction; + string dependson = ""; + string resource_id = ""; + string copyToOutput = ""; + + switch(project.Files.GetBuildAction(file)) + { + case BuildAction.None: + buildAction = "Nothing"; + break; + + case BuildAction.Content: + buildAction = "Exclude"; + break; + + case BuildAction.EmbeddedResource: + buildAction = "EmbedAsResource"; + break; + + default: + buildAction = "Compile"; + break; + } + + if (project.Files.GetCopyToOutput(file) != CopyToOutput.Never) + buildAction = "FileCopy"; + + // Sort of a hack, we try and resolve the path and make it relative, if we can. + string extension = Path.GetExtension(file); + string designer_format = string.Format(".Designer{0}", extension); + + if (file.EndsWith(designer_format)) + { + string basename = file.Substring(0, file.LastIndexOf(designer_format)); + string[] extensions = new string[] { ".cs", ".resx", ".settings" }; + + foreach(string ext in extensions) + { + if (project.Files.Contains(basename + ext)) + { + dependson = string.Format(" dependson=\"{0}{1}\"", basename, ext); + break; + } + } + } + if (extension == ".resx") + { + buildAction = "EmbedAsResource"; + string basename = file.Substring(0, file.LastIndexOf(".resx")); + + // Visual Studio type resx + form dependency + if (project.Files.Contains(basename + ".cs")) + { + dependson = string.Format(" dependson=\"{0}{1}\"", basename, ".cs"); + } + + // We need to specify a resources file name to avoid MissingManifestResourceExceptions + // in libraries that are built. + resource_id = string.Format(" resource_id=\"{0}.{1}.resources\"", + project.AssemblyName, basename.Replace("/", ".")); + } + + switch(project.Files.GetCopyToOutput(file)) + { + case CopyToOutput.Always: + copyToOutput = string.Format(" copyToOutputDirectory=\"Always\""); + break; + case CopyToOutput.PreserveNewest: + copyToOutput = string.Format(" copyToOutputDirectory=\"PreserveNewest\""); + break; + } + + // Sort of a hack, we try and resolve the path and make it relative, if we can. + string filePath = PrependPath(file); + ss.WriteLine(" ", + filePath, buildAction, dependson, resource_id, copyToOutput); + } + ss.WriteLine(" "); + + ss.WriteLine(" "); + foreach(ReferenceNode refr in project.References) + { + ss.WriteLine(" {0}", BuildReference(solution, refr)); + } + ss.WriteLine(" "); + + + ss.WriteLine(""); + } + + m_Kernel.CurrentWorkingDirectory.Pop(); + } + + private void WriteCombine(SolutionNode solution) + { + m_Kernel.Log.Write("Creating MonoDevelop combine and project files"); + foreach(ProjectNode project in solution.Projects) + { + if(m_Kernel.AllowProject(project.FilterGroups)) + { + m_Kernel.Log.Write("...Creating project: {0}", project.Name); + WriteProject(solution, project); + } + } + + m_Kernel.Log.Write(""); + string combFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "mds"); + StreamWriter ss = new StreamWriter(combFile); + + m_Kernel.CurrentWorkingDirectory.Push(); + Helper.SetCurrentDir(Path.GetDirectoryName(combFile)); + + int count = 0; + + using(ss) + { + ss.WriteLine("", solution.Name); + + count = 0; + foreach(ConfigurationNode conf in solution.Configurations) + { + if(count == 0) + { + ss.WriteLine(" ", conf.Name); + } + + ss.WriteLine(" ", conf.Name); + foreach(ProjectNode project in solution.Projects) + { + ss.WriteLine(" ", project.Name, conf.Name); + } + ss.WriteLine(" "); + + count++; + } + ss.WriteLine(" "); + + count = 0; + + foreach(ProjectNode project in solution.Projects) + { + if(count == 0) + ss.WriteLine(" ", project.Name); + + ss.WriteLine(" ", project.Name); + count++; + } + ss.WriteLine(" "); + + ss.WriteLine(" "); + foreach(ProjectNode project in solution.Projects) + { + string path = Helper.MakePathRelativeTo(solution.FullPath, project.FullPath); + ss.WriteLine(" ", + Helper.MakeFilePath(path, project.Name, "mdp")); + } + ss.WriteLine(" "); + + ss.WriteLine(""); + } + + m_Kernel.CurrentWorkingDirectory.Pop(); + } + + private void CleanProject(ProjectNode project) + { + m_Kernel.Log.Write("...Cleaning project: {0}", project.Name); + string projectFile = Helper.MakeFilePath(project.FullPath, project.Name, "mdp"); + Helper.DeleteIfExists(projectFile); + } + + private void CleanSolution(SolutionNode solution) + { + m_Kernel.Log.Write("Cleaning MonoDevelop combine and project files for", solution.Name); + + string slnFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "mds"); + Helper.DeleteIfExists(slnFile); + + foreach(ProjectNode project in solution.Projects) + { + CleanProject(project); + } + + m_Kernel.Log.Write(""); + } + + #endregion + + #region ITarget Members + + /// + /// Writes the specified kern. + /// + /// The kern. + public void Write(Kernel kern) + { + if( kern == null ) + { + throw new ArgumentNullException("kern"); + } + m_Kernel = kern; + foreach(SolutionNode solution in kern.Solutions) + { + WriteCombine(solution); + } + m_Kernel = null; + } + + /// + /// Cleans the specified kern. + /// + /// The kern. + public virtual void Clean(Kernel kern) + { + if( kern == null ) + { + throw new ArgumentNullException("kern"); + } + m_Kernel = kern; + foreach(SolutionNode sol in kern.Solutions) + { + CleanSolution(sol); + } + m_Kernel = null; + } + + /// + /// Gets the name. + /// + /// The name. + public string Name + { + get + { + return "sharpdev"; + } + } + + #endregion + } +} diff --git a/Prebuild/src/Core/Targets/NAntTarget.cs b/Prebuild/src/Core/Targets/NAntTarget.cs new file mode 100644 index 0000000..d4a33f8 --- /dev/null +++ b/Prebuild/src/Core/Targets/NAntTarget.cs @@ -0,0 +1,792 @@ +#region BSD License +/* +Copyright (c) 2004 - 2008 +Matthew Holmes (matthew@wildfiregames.com), +Dan Moorehead (dan05a@gmail.com), +C.J. Adams-Collier (cjac@colliertech.org), + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + +* Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + +* Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + +* The name of the author may not be used to endorse or promote + products derived from this software without specific prior written + permission. + +THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, +INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, +STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING +IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +POSSIBILITY OF SUCH DAMAGE. +*/ + +#endregion + +using System; +using System.Collections.Generic; +using System.IO; +using System.Text.RegularExpressions; + +using Prebuild.Core.Attributes; +using Prebuild.Core.Interfaces; +using Prebuild.Core.Nodes; +using Prebuild.Core.Utilities; + +namespace Prebuild.Core.Targets +{ + /// + /// + /// + [Target("nant")] + public class NAntTarget : ITarget + { + #region Fields + + private Kernel m_Kernel; + + #endregion + + #region Private Methods + + private static string PrependPath(string path) + { + string tmpPath = Helper.NormalizePath(path, '/'); + Regex regex = new Regex(@"(\w):/(\w+)"); + Match match = regex.Match(tmpPath); + //if(match.Success || tmpPath[0] == '.' || tmpPath[0] == '/') + //{ + tmpPath = Helper.NormalizePath(tmpPath); + //} + // else + // { + // tmpPath = Helper.NormalizePath("./" + tmpPath); + // } + + return tmpPath; + } + + private static string BuildReference(SolutionNode solution, ProjectNode currentProject, ReferenceNode refr) + { + + if (!String.IsNullOrEmpty(refr.Path)) + { + return refr.Path; + } + + if (solution.ProjectsTable.ContainsKey(refr.Name)) + { + ProjectNode projectRef = (ProjectNode) solution.ProjectsTable[refr.Name]; + string finalPath = + Helper.NormalizePath(refr.Name + GetProjectExtension(projectRef), '/'); + return finalPath; + } + + ProjectNode project = (ProjectNode) refr.Parent; + + // Do we have an explicit file reference? + string fileRef = FindFileReference(refr.Name, project); + if (fileRef != null) + { + return fileRef; + } + + // Is there an explicit path in the project ref? + if (refr.Path != null) + { + return Helper.NormalizePath(refr.Path + "/" + refr.Name + GetProjectExtension(project), '/'); + } + + // No, it's an extensionless GAC ref, but nant needs the .dll extension anyway + return refr.Name + ".dll"; + } + + public static string GetRefFileName(string refName) + { + if (ExtensionSpecified(refName)) + { + return refName; + } + else + { + return refName + ".dll"; + } + } + + private static bool ExtensionSpecified(string refName) + { + return refName.EndsWith(".dll") || refName.EndsWith(".exe"); + } + + private static string GetProjectExtension(ProjectNode project) + { + string extension = ".dll"; + if (project.Type == ProjectType.Exe || project.Type == ProjectType.WinExe) + { + extension = ".exe"; + } + return extension; + } + + private static string FindFileReference(string refName, ProjectNode project) + { + foreach (ReferencePathNode refPath in project.ReferencePaths) + { + string fullPath = Helper.MakeFilePath(refPath.Path, refName); + + if (File.Exists(fullPath)) + { + return fullPath; + } + + fullPath = Helper.MakeFilePath(refPath.Path, refName, "dll"); + + if (File.Exists(fullPath)) + { + return fullPath; + } + + fullPath = Helper.MakeFilePath(refPath.Path, refName, "exe"); + + if (File.Exists(fullPath)) + { + return fullPath; + } + } + + return null; + } + + /// + /// Gets the XML doc file. + /// + /// The project. + /// The conf. + /// + public static string GetXmlDocFile(ProjectNode project, ConfigurationNode conf) + { + if (conf == null) + { + throw new ArgumentNullException("conf"); + } + if (project == null) + { + throw new ArgumentNullException("project"); + } + string docFile = (string)conf.Options["XmlDocFile"]; + // if(docFile != null && docFile.Length == 0)//default to assembly name if not specified + // { + // return Path.GetFileNameWithoutExtension(project.AssemblyName) + ".xml"; + // } + return docFile; + } + + private void WriteProject(SolutionNode solution, ProjectNode project) + { + string projFile = Helper.MakeFilePath(project.FullPath, project.Name + GetProjectExtension(project), "build"); + StreamWriter ss = new StreamWriter(projFile); + + m_Kernel.CurrentWorkingDirectory.Push(); + Helper.SetCurrentDir(Path.GetDirectoryName(projFile)); + bool hasDoc = false; + + using (ss) + { + ss.WriteLine(""); + ss.WriteLine("", project.Name); + ss.WriteLine(" ", "build"); + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(" "); + foreach (ReferenceNode refr in project.References) + { + if (refr.LocalCopy) + { + ss.WriteLine(" ", '/')); + } + } + + ss.WriteLine(" "); + ss.WriteLine(" "); + if (project.ConfigFile != null && project.ConfigFile.Length!=0) + { + ss.Write(" "); + } + + // Add the content files to just be copied + ss.WriteLine(" {0}", ""); + ss.WriteLine(" {0}", ""); + + foreach (string file in project.Files) + { + // Ignore if we aren't content + if (project.Files.GetBuildAction(file) != BuildAction.Content) + continue; + + // Create a include tag + ss.WriteLine(" {0}", ""); + } + + ss.WriteLine(" {0}", ""); + ss.WriteLine(" {0}", ""); + + ss.Write(" "); + ss.WriteLine(" ", project.RootNamespace); + foreach (string file in project.Files) + { + switch (project.Files.GetBuildAction(file)) + { + case BuildAction.EmbeddedResource: + ss.WriteLine(" {0}", ""); + break; + default: + if (project.Files.GetSubType(file) != SubType.Code && project.Files.GetSubType(file) != SubType.Settings) + { + ss.WriteLine(" ", file.Substring(0, file.LastIndexOf('.')) + ".resx"); + } + break; + } + } + //if (project.Files.GetSubType(file).ToString() != "Code") + //{ + // ps.WriteLine(" ", file.Substring(0, file.LastIndexOf('.')) + ".resx"); + + ss.WriteLine(" "); + ss.WriteLine(" "); + foreach (string file in project.Files) + { + switch (project.Files.GetBuildAction(file)) + { + case BuildAction.Compile: + ss.WriteLine(" "); + break; + default: + break; + } + } + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(" "); + foreach(ReferencePathNode refPath in project.ReferencePaths) + { + ss.WriteLine(" "); + } + ss.WriteLine(" "); + foreach (ReferenceNode refr in project.References) + { + string path = Helper.NormalizePath(Helper.MakePathRelativeTo(project.FullPath, BuildReference(solution, project, refr)), '/'); + if (refr.Path != null) { + if (ExtensionSpecified(refr.Name)) + { + ss.WriteLine (" "); + } + else + { + ss.WriteLine (" "); + } + } + else + { + ss.WriteLine (" "); + } + } + ss.WriteLine(" "); + + ss.WriteLine(" "); + + foreach (ConfigurationNode conf in project.Configurations) + { + if (!String.IsNullOrEmpty(conf.Options.OutputPath)) + { + string targetDir = Helper.NormalizePath(conf.Options.OutputPath, '/'); + + ss.WriteLine(" "); + + ss.WriteLine(" "); + + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(" "); + break; + } + } + + ss.WriteLine(" "); + + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(" "); + + ss.WriteLine(" "); + if (hasDoc) + { + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.Write(" "); + } + else + { + ss.WriteLine(".exe\" />"); + } + + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(" "); + // foreach(ReferenceNode refr in project.References) + // { + // string path = Helper.NormalizePath(Helper.MakePathRelativeTo(project.FullPath, BuildReferencePath(solution, refr)), '/'); + // if (path != "") + // { + // ss.WriteLine(" ", path); + // } + // } + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(" "); + } + ss.WriteLine(" "); + ss.WriteLine(""); + } + m_Kernel.CurrentWorkingDirectory.Pop(); + } + + private void WriteCombine(SolutionNode solution) + { + m_Kernel.Log.Write("Creating NAnt build files"); + foreach (ProjectNode project in solution.Projects) + { + if (m_Kernel.AllowProject(project.FilterGroups)) + { + m_Kernel.Log.Write("...Creating project: {0}", project.Name); + WriteProject(solution, project); + } + } + + m_Kernel.Log.Write(""); + string combFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "build"); + StreamWriter ss = new StreamWriter(combFile); + + m_Kernel.CurrentWorkingDirectory.Push(); + Helper.SetCurrentDir(Path.GetDirectoryName(combFile)); + + using (ss) + { + ss.WriteLine(""); + ss.WriteLine("", solution.Name); + ss.WriteLine(" "); + ss.WriteLine(); + + //ss.WriteLine(" "); + //ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(" "); + + // Use the active configuration, which is the first configuration name in the prebuild file. + Dictionary emittedConfigurations = new Dictionary(); + + ss.WriteLine(" ", solution.ActiveConfig); + ss.WriteLine(); + + foreach (ConfigurationNode conf in solution.Configurations) + { + // If the name isn't in the emitted configurations, we give a high level target to the + // platform specific on. This lets "Debug" point to "Debug-AnyCPU". + if (!emittedConfigurations.ContainsKey(conf.Name)) + { + // Add it to the dictionary so we only emit one. + emittedConfigurations.Add(conf.Name, conf.Platform); + + // Write out the target block. + ss.WriteLine(" ", conf.Name, conf.Platform); + ss.WriteLine(" "); + ss.WriteLine(); + } + + // Write out the target for the configuration. + ss.WriteLine(" ", conf.Name, conf.Platform); + ss.WriteLine(" ", conf.Name); + ss.WriteLine(" ", conf.Options["DebugInformation"].ToString().ToLower()); + ss.WriteLine("\t\t ", conf.Platform); + ss.WriteLine(" "); + ss.WriteLine(); + } + + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(); + + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(); + + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(); + + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(); + + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(); + + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(); + + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(); + + + // sdague - ok, this is an ugly hack, but what it lets + // us do is native include of files into the nant + // created files from all .nant/*include files. This + // lets us keep using prebuild, but allows for + // extended nant targets to do build and the like. + + try + { + Regex re = new Regex(".include$"); + DirectoryInfo nantdir = new DirectoryInfo(".nant"); + foreach (FileSystemInfo item in nantdir.GetFileSystemInfos()) + { + if (item is DirectoryInfo) { } + else if (item is FileInfo) + { + if (re.Match(item.FullName) != + System.Text.RegularExpressions.Match.Empty) + { + Console.WriteLine("Including file: " + item.FullName); + + using (FileStream fs = new FileStream(item.FullName, + FileMode.Open, + FileAccess.Read, + FileShare.None)) + { + using (StreamReader sr = new StreamReader(fs)) + { + ss.WriteLine("", (item).FullName); + while (sr.Peek() != -1) + { + ss.WriteLine(sr.ReadLine()); + } + ss.WriteLine(); + } + } + } + } + } + } + catch { } + // ss.WriteLine(" "); + // ss.WriteLine(" "); + // ss.WriteLine(" ", solution.Name, solution.Version); + // ss.WriteLine(" "); + + // ss.WriteLine(" "); + // // ss.WriteLine(" "); + // ss.WriteLine(" "); + // ss.WriteLine(" "); + // ss.WriteLine(" "); + // ss.WriteLine(" "); + ss.WriteLine(); + + + ss.WriteLine(" "); + ss.WriteLine(" "); + //ss.WriteLine(" "); + + // justincc: FIXME FIXME FIXME - A temporary OpenSim hack to clean up files when "nant clean" is executed. + // Should be replaced with extreme prejudice once anybody finds out if the CleanFiles stuff works or there is + // another working mechanism for specifying this stuff + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(" "); + + if (solution.Cleanup != null && solution.Cleanup.CleanFiles.Count > 0) + { + foreach (CleanFilesNode cleanFile in solution.Cleanup.CleanFiles) + { + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(" ", cleanFile.Pattern); + ss.WriteLine(" ", cleanFile.Pattern); + ss.WriteLine(" "); + ss.WriteLine(" "); + } + } + + ss.WriteLine(" "); + foreach (ProjectNode project in solution.Projects) + { + string path = Helper.MakePathRelativeTo(solution.FullPath, project.FullPath); + ss.Write(" "); + } + ss.WriteLine(" "); + ss.WriteLine(); + + ss.WriteLine(" "); + + foreach (ProjectNode project in solution.ProjectsTableOrder) + { + string path = Helper.MakePathRelativeTo(solution.FullPath, project.FullPath); + ss.Write(" "); + } + ss.WriteLine(" "); + ss.WriteLine(); + + ss.WriteLine(" "); + ss.WriteLine(); + ss.WriteLine(" "); + ss.WriteLine(); + //ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(); + + ss.WriteLine(" "); + ss.WriteLine(" "); + foreach (ProjectNode project in solution.Projects) + { + string path = Helper.MakePathRelativeTo(solution.FullPath, project.FullPath); + ss.Write(" "); + } + ss.WriteLine(" "); + ss.WriteLine(); + ss.WriteLine(""); + } + + m_Kernel.CurrentWorkingDirectory.Pop(); + } + + private void CleanProject(ProjectNode project) + { + m_Kernel.Log.Write("...Cleaning project: {0}", project.Name); + string projectFile = Helper.MakeFilePath(project.FullPath, project.Name + GetProjectExtension(project), "build"); + Helper.DeleteIfExists(projectFile); + } + + private void CleanSolution(SolutionNode solution) + { + m_Kernel.Log.Write("Cleaning NAnt build files for", solution.Name); + + string slnFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "build"); + Helper.DeleteIfExists(slnFile); + + foreach (ProjectNode project in solution.Projects) + { + CleanProject(project); + } + + m_Kernel.Log.Write(""); + } + + #endregion + + #region ITarget Members + + /// + /// Writes the specified kern. + /// + /// The kern. + public void Write(Kernel kern) + { + if (kern == null) + { + throw new ArgumentNullException("kern"); + } + m_Kernel = kern; + foreach (SolutionNode solution in kern.Solutions) + { + WriteCombine(solution); + } + m_Kernel = null; + } + + /// + /// Cleans the specified kern. + /// + /// The kern. + public virtual void Clean(Kernel kern) + { + if (kern == null) + { + throw new ArgumentNullException("kern"); + } + m_Kernel = kern; + foreach (SolutionNode sol in kern.Solutions) + { + CleanSolution(sol); + } + m_Kernel = null; + } + + /// + /// Gets the name. + /// + /// The name. + public string Name + { + get + { + return "nant"; + } + } + + #endregion + } +} diff --git a/Prebuild/src/Core/Targets/SharpDevelop2Target.cs b/Prebuild/src/Core/Targets/SharpDevelop2Target.cs new file mode 100644 index 0000000..66dd1bc --- /dev/null +++ b/Prebuild/src/Core/Targets/SharpDevelop2Target.cs @@ -0,0 +1,82 @@ +#region BSD License +/* +Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com) + +Redistribution and use in source and binary forms, with or without modification, are permitted +provided that the following conditions are met: + +* Redistributions of source code must retain the above copyright notice, this list of conditions + and the following disclaimer. +* Redistributions in binary form must reproduce the above copyright notice, this list of conditions + and the following disclaimer in the documentation and/or other materials provided with the + distribution. +* The name of the author may not be used to endorse or promote products derived from this software + without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, +BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING +IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ +#endregion + +using System; + +using Prebuild.Core.Attributes; + +namespace Prebuild.Core.Targets +{ + /// + /// + /// + [Target("sharpdev2")] + public class SharpDevelop2Target : VS2005Target + { + #region Properties + public override string VersionName + { + get + { + return "SharpDevelop2"; + } + } + #endregion + + #region Public Methods + + /// + /// Writes the specified kern. + /// + /// The kern. + public override void Write(Kernel kern) + { + base.Write(kern); + } + + /// + /// Cleans the specified kern. + /// + /// The kern. + public override void Clean(Kernel kern) + { + base.Clean(kern); + } + + /// + /// Gets the name. + /// + /// The name. + public override string Name + { + get + { + return "sharpdev2"; + } + } + + #endregion + } +} diff --git a/Prebuild/src/Core/Targets/SharpDevelopTarget.cs b/Prebuild/src/Core/Targets/SharpDevelopTarget.cs new file mode 100644 index 0000000..8e32050 --- /dev/null +++ b/Prebuild/src/Core/Targets/SharpDevelopTarget.cs @@ -0,0 +1,425 @@ +#region BSD License +/* +Copyright (c) 2004 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com) + +Redistribution and use in source and binary forms, with or without modification, are permitted +provided that the following conditions are met: + +* Redistributions of source code must retain the above copyright notice, this list of conditions + and the following disclaimer. +* Redistributions in binary form must reproduce the above copyright notice, this list of conditions + and the following disclaimer in the documentation and/or other materials provided with the + distribution. +* The name of the author may not be used to endorse or promote products derived from this software + without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, +BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING +IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ +#endregion + +using System; +using System.IO; +using System.Text.RegularExpressions; + +using Prebuild.Core.Attributes; +using Prebuild.Core.Interfaces; +using Prebuild.Core.Nodes; +using Prebuild.Core.Utilities; + +namespace Prebuild.Core.Targets +{ + /// + /// + /// + [Target("sharpdev")] + public class SharpDevelopTarget : ITarget + { + #region Fields + + private Kernel m_Kernel; + + #endregion + + #region Private Methods + + private static string PrependPath(string path) + { + string tmpPath = Helper.NormalizePath(path, '/'); + Regex regex = new Regex(@"(\w):/(\w+)"); + Match match = regex.Match(tmpPath); + if(match.Success || tmpPath[0] == '.' || tmpPath[0] == '/') + { + tmpPath = Helper.NormalizePath(tmpPath); + } + else + { + tmpPath = Helper.NormalizePath("./" + tmpPath); + } + + return tmpPath; + } + + private static string BuildReference(SolutionNode solution, ReferenceNode refr) + { + string ret = ""; + } + else + { + ProjectNode project = (ProjectNode)refr.Parent; + string fileRef = FindFileReference(refr.Name, project); + + if(refr.Path != null || fileRef != null) + { + ret += "Assembly\" refto=\""; + + string finalPath = (refr.Path != null) ? Helper.MakeFilePath(refr.Path, refr.Name, "dll") : fileRef; + + ret += finalPath; + ret += "\" localcopy=\"" + refr.LocalCopy.ToString() + "\" />"; + return ret; + } + + ret += "Gac\" refto=\""; + try + { + //Assembly assem = Assembly.Load(refr.Name); + ret += refr.Name;// assem.FullName; + } + catch (System.NullReferenceException e) + { + e.ToString(); + ret += refr.Name; + } + ret += "\" localcopy=\"" + refr.LocalCopy.ToString() + "\" />"; + } + + return ret; + } + + private static string FindFileReference(string refName, ProjectNode project) + { + foreach(ReferencePathNode refPath in project.ReferencePaths) + { + string fullPath = Helper.MakeFilePath(refPath.Path, refName, "dll"); + + if(File.Exists(fullPath)) + { + return fullPath; + } + } + + return null; + } + + /// + /// Gets the XML doc file. + /// + /// The project. + /// The conf. + /// + public static string GenerateXmlDocFile(ProjectNode project, ConfigurationNode conf) + { + if( conf == null ) + { + throw new ArgumentNullException("conf"); + } + if( project == null ) + { + throw new ArgumentNullException("project"); + } + string docFile = (string)conf.Options["XmlDocFile"]; + if(docFile != null && docFile.Length == 0)//default to assembly name if not specified + { + return "False"; + } + return "True"; + } + + private void WriteProject(SolutionNode solution, ProjectNode project) + { + string csComp = "Csc"; + string netRuntime = "MsNet"; + if(project.Runtime == ClrRuntime.Mono) + { + csComp = "Mcs"; + netRuntime = "Mono"; + } + + string projFile = Helper.MakeFilePath(project.FullPath, project.Name, "prjx"); + StreamWriter ss = new StreamWriter(projFile); + + m_Kernel.CurrentWorkingDirectory.Push(); + Helper.SetCurrentDir(Path.GetDirectoryName(projFile)); + + using(ss) + { + ss.WriteLine( + "", + project.Name, + project.RootNamespace + ); + + ss.WriteLine(" "); + foreach(string file in project.Files) + { + string buildAction = "Compile"; + switch(project.Files.GetBuildAction(file)) + { + case BuildAction.None: + buildAction = "Nothing"; + break; + + case BuildAction.Content: + buildAction = "Exclude"; + break; + + case BuildAction.EmbeddedResource: + buildAction = "EmbedAsResource"; + break; + + default: + buildAction = "Compile"; + break; + } + + // Sort of a hack, we try and resolve the path and make it relative, if we can. + string filePath = PrependPath(file); + ss.WriteLine(" ", filePath, buildAction); + } + ss.WriteLine(" "); + + ss.WriteLine(" "); + foreach(ReferenceNode refr in project.References) + { + ss.WriteLine(" {0}", BuildReference(solution, refr)); + } + ss.WriteLine(" "); + + ss.Write(" "); + + int count = 0; + + ss.WriteLine(" ", solution.ActiveConfig); + + foreach(ConfigurationNode conf in project.Configurations) + { + ss.Write(" "); + ss.Write(" "); + + ss.Write(" "); + + ss.Write(" "); + ss.WriteLine(" "); + + count++; + } + ss.WriteLine(" "); + ss.WriteLine(""); + } + + m_Kernel.CurrentWorkingDirectory.Pop(); + } + + private void WriteCombine(SolutionNode solution) + { + m_Kernel.Log.Write("Creating SharpDevelop combine and project files"); + foreach(ProjectNode project in solution.Projects) + { + if(m_Kernel.AllowProject(project.FilterGroups)) + { + m_Kernel.Log.Write("...Creating project: {0}", project.Name); + WriteProject(solution, project); + } + } + + m_Kernel.Log.Write(""); + string combFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "cmbx"); + StreamWriter ss = new StreamWriter(combFile); + + m_Kernel.CurrentWorkingDirectory.Push(); + Helper.SetCurrentDir(Path.GetDirectoryName(combFile)); + + using(ss) + { + ss.WriteLine("", solution.Name); + + int count = 0; + foreach(ProjectNode project in solution.Projects) + { + if(count == 0) + ss.WriteLine(" ", project.Name); + + ss.WriteLine(" ", project.Name); + count++; + } + ss.WriteLine(" "); + + ss.WriteLine(" "); + foreach(ProjectNode project in solution.Projects) + { + string path = Helper.MakePathRelativeTo(solution.FullPath, project.FullPath); + ss.WriteLine(" ", + Helper.MakeFilePath(path, project.Name, "prjx")); + } + ss.WriteLine(" "); + + count = 0; + foreach(ConfigurationNode conf in solution.Configurations) + { + if(count == 0) + { + ss.WriteLine(" ", conf.Name); + } + + ss.WriteLine(" ", conf.Name); + foreach(ProjectNode project in solution.Projects) + { + ss.WriteLine(" ", project.Name, conf.Name); + } + ss.WriteLine(" "); + + count++; + } + ss.WriteLine(" "); + ss.WriteLine(""); + } + + m_Kernel.CurrentWorkingDirectory.Pop(); + } + + private void CleanProject(ProjectNode project) + { + m_Kernel.Log.Write("...Cleaning project: {0}", project.Name); + string projectFile = Helper.MakeFilePath(project.FullPath, project.Name, "prjx"); + Helper.DeleteIfExists(projectFile); + } + + private void CleanSolution(SolutionNode solution) + { + m_Kernel.Log.Write("Cleaning SharpDevelop combine and project files for", solution.Name); + + string slnFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "cmbx"); + Helper.DeleteIfExists(slnFile); + + foreach(ProjectNode project in solution.Projects) + { + CleanProject(project); + } + + m_Kernel.Log.Write(""); + } + + #endregion + + #region ITarget Members + + /// + /// Writes the specified kern. + /// + /// The kern. + public void Write(Kernel kern) + { + if( kern == null ) + { + throw new ArgumentNullException("kern"); + } + m_Kernel = kern; + foreach(SolutionNode solution in kern.Solutions) + { + WriteCombine(solution); + } + m_Kernel = null; + } + + /// + /// Cleans the specified kern. + /// + /// The kern. + public virtual void Clean(Kernel kern) + { + if( kern == null ) + { + throw new ArgumentNullException("kern"); + } + m_Kernel = kern; + foreach(SolutionNode sol in kern.Solutions) + { + CleanSolution(sol); + } + m_Kernel = null; + } + + /// + /// Gets the name. + /// + /// The name. + public string Name + { + get + { + return "sharpdev"; + } + } + + #endregion + } +} diff --git a/Prebuild/src/Core/Targets/ToolInfo.cs b/Prebuild/src/Core/Targets/ToolInfo.cs new file mode 100644 index 0000000..935c674 --- /dev/null +++ b/Prebuild/src/Core/Targets/ToolInfo.cs @@ -0,0 +1,197 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace Prebuild.Core.Targets +{ + /// + /// + /// + public struct ToolInfo + { + string name; + string guid; + string fileExtension; + string xmlTag; + string importProject; + + /// + /// Gets or sets the name. + /// + /// The name. + public string Name + { + get + { + return name; + } + set + { + name = value; + } + } + + /// + /// Gets or sets the GUID. + /// + /// The GUID. + public string Guid + { + get + { + return guid; + } + set + { + guid = value; + } + } + + /// + /// Gets or sets the file extension. + /// + /// The file extension. + public string FileExtension + { + get + { + return fileExtension; + } + set + { + fileExtension = value; + } + } + public string LanguageExtension + { + get + { + switch (this.Name) + { + case "C#": + return ".cs"; + case "VisualBasic": + return ".vb"; + case "Boo": + return ".boo"; + default: + return ".cs"; + } + } + } + /// + /// Gets or sets the XML tag. + /// + /// The XML tag. + public string XmlTag + { + get + { + return xmlTag; + } + set + { + xmlTag = value; + } + } + + /// + /// Gets or sets the import project property. + /// + /// The ImportProject tag. + public string ImportProject + { + get + { + return importProject; + } + set + { + importProject = value; + } + } + + /// + /// Initializes a new instance of the class. + /// + /// The name. + /// The GUID. + /// The file extension. + /// The XML. + /// The import project. + public ToolInfo(string name, string guid, string fileExtension, string xml, string importProject) + { + this.name = name; + this.guid = guid; + this.fileExtension = fileExtension; + this.xmlTag = xml; + this.importProject = importProject; + } + + /// + /// Initializes a new instance of the class. + /// + /// The name. + /// The GUID. + /// The file extension. + /// The XML. + public ToolInfo(string name, string guid, string fileExtension, string xml) + { + this.name = name; + this.guid = guid; + this.fileExtension = fileExtension; + this.xmlTag = xml; + this.importProject = "$(MSBuildBinPath)\\Microsoft." + xml + ".Targets"; + } + + /// + /// Equals operator + /// + /// ToolInfo to compare + /// true if toolInfos are equal + public override bool Equals(object obj) + { + if (obj == null) + { + throw new ArgumentNullException("obj"); + } + if (obj.GetType() != typeof(ToolInfo)) + return false; + + ToolInfo c = (ToolInfo)obj; + return ((this.name == c.name) && (this.guid == c.guid) && (this.fileExtension == c.fileExtension) && (this.importProject == c.importProject)); + } + + /// + /// Equals operator + /// + /// ToolInfo to compare + /// ToolInfo to compare + /// True if toolInfos are equal + public static bool operator ==(ToolInfo c1, ToolInfo c2) + { + return ((c1.name == c2.name) && (c1.guid == c2.guid) && (c1.fileExtension == c2.fileExtension) && (c1.importProject == c2.importProject) && (c1.xmlTag == c2.xmlTag)); + } + + /// + /// Not equals operator + /// + /// ToolInfo to compare + /// ToolInfo to compare + /// True if toolInfos are not equal + public static bool operator !=(ToolInfo c1, ToolInfo c2) + { + return !(c1 == c2); + } + + /// + /// Hash Code + /// + /// Hash code + public override int GetHashCode() + { + return name.GetHashCode() ^ guid.GetHashCode() ^ this.fileExtension.GetHashCode() ^ this.importProject.GetHashCode() ^ this.xmlTag.GetHashCode(); + + } + } +} diff --git a/Prebuild/src/Core/Targets/VS2002Target.cs b/Prebuild/src/Core/Targets/VS2002Target.cs new file mode 100644 index 0000000..2292624 --- /dev/null +++ b/Prebuild/src/Core/Targets/VS2002Target.cs @@ -0,0 +1,87 @@ +#region BSD License +/* +Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com) + +Redistribution and use in source and binary forms, with or without modification, are permitted +provided that the following conditions are met: + +* Redistributions of source code must retain the above copyright notice, this list of conditions + and the following disclaimer. +* Redistributions in binary form must reproduce the above copyright notice, this list of conditions + and the following disclaimer in the documentation and/or other materials provided with the + distribution. +* The name of the author may not be used to endorse or promote products derived from this software + without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, +BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING +IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ +#endregion + +using System; + +using Prebuild.Core.Attributes; + +namespace Prebuild.Core.Targets +{ + /// + /// + /// + [Target("vs2002")] + public class VS2002Target : VS2003Target + { + #region Private Methods + + private void SetVS2002() + { + this.SolutionVersion = "7.00"; + this.ProductVersion = "7.0.9254"; + this.SchemaVersion = "1.0"; + this.VersionName = "2002"; + this.Version = VSVersion.VS70; + } + + #endregion + + #region Public Methods + + /// + /// Writes the specified kern. + /// + /// The kern. + public override void Write(Kernel kern) + { + SetVS2002(); + base.Write(kern); + } + + /// + /// Cleans the specified kern. + /// + /// The kern. + public override void Clean(Kernel kern) + { + SetVS2002(); + base.Clean(kern); + } + + /// + /// Gets the name. + /// + /// The name. + public override string Name + { + get + { + return "vs2002"; + } + } + + #endregion + } +} diff --git a/Prebuild/src/Core/Targets/VS2003Target.cs b/Prebuild/src/Core/Targets/VS2003Target.cs new file mode 100644 index 0000000..10e2dc4 --- /dev/null +++ b/Prebuild/src/Core/Targets/VS2003Target.cs @@ -0,0 +1,593 @@ +#region BSD License +/* +Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com) + +Redistribution and use in source and binary forms, with or without modification, are permitted +provided that the following conditions are met: + +* Redistributions of source code must retain the above copyright notice, this list of conditions + and the following disclaimer. +* Redistributions in binary form must reproduce the above copyright notice, this list of conditions + and the following disclaimer in the documentation and/or other materials provided with the + distribution. +* The name of the author may not be used to endorse or promote products derived from this software + without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, +BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING +IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ +#endregion + +using System; +using System.Collections.Generic; +using System.IO; + +using Prebuild.Core.Attributes; +using Prebuild.Core.Interfaces; +using Prebuild.Core.Nodes; +using Prebuild.Core.Utilities; + +namespace Prebuild.Core.Targets +{ + [Target("vs2003")] + public class VS2003Target : ITarget + { + + #region Fields + + string solutionVersion = "8.00"; + string productVersion = "7.10.3077"; + string schemaVersion = "2.0"; + string versionName = "2003"; + VSVersion version = VSVersion.VS71; + + readonly Dictionary m_Tools = new Dictionary(); + Kernel m_Kernel; + + /// + /// Gets or sets the solution version. + /// + /// The solution version. + protected string SolutionVersion + { + get + { + return solutionVersion; + } + set + { + solutionVersion = value; + } + } + /// + /// Gets or sets the product version. + /// + /// The product version. + protected string ProductVersion + { + get + { + return productVersion; + } + set + { + productVersion = value; + } + } + /// + /// Gets or sets the schema version. + /// + /// The schema version. + protected string SchemaVersion + { + get + { + return schemaVersion; + } + set + { + schemaVersion = value; + } + } + /// + /// Gets or sets the name of the version. + /// + /// The name of the version. + protected string VersionName + { + get + { + return versionName; + } + set + { + versionName = value; + } + } + /// + /// Gets or sets the version. + /// + /// The version. + protected VSVersion Version + { + get + { + return version; + } + set + { + version = value; + } + } + + #endregion + + #region Constructors + + /// + /// Initializes a new instance of the class. + /// + public VS2003Target() + { + m_Tools["C#"] = new ToolInfo("C#", "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}", "csproj", "CSHARP"); + m_Tools["VB.NET"] = new ToolInfo("VB.NET", "{F184B08F-C81C-45F6-A57F-5ABD9991F28F}", "vbproj", "VisualBasic"); + } + + #endregion + + #region Private Methods + + private string MakeRefPath(ProjectNode project) + { + string ret = ""; + foreach(ReferencePathNode node in project.ReferencePaths) + { + try + { + string fullPath = Helper.ResolvePath(node.Path); + if(ret.Length < 1) + { + ret = fullPath; + } + else + { + ret += ";" + fullPath; + } + } + catch(ArgumentException) + { + m_Kernel.Log.Write(LogType.Warning, "Could not resolve reference path: {0}", node.Path); + } + } + + return ret; + } + + private void WriteProject(SolutionNode solution, ProjectNode project) + { + if(!m_Tools.ContainsKey(project.Language)) + { + throw new UnknownLanguageException("Unknown .NET language: " + project.Language); + } + + ToolInfo toolInfo = m_Tools[project.Language]; + string projectFile = Helper.MakeFilePath(project.FullPath, project.Name, toolInfo.FileExtension); + StreamWriter ps = new StreamWriter(projectFile); + + m_Kernel.CurrentWorkingDirectory.Push(); + Helper.SetCurrentDir(Path.GetDirectoryName(projectFile)); + + using(ps) + { + ps.WriteLine(""); + ps.WriteLine(" <{0}", toolInfo.XmlTag); + ps.WriteLine("\t\t\t\tProjectType = \"Local\""); + ps.WriteLine("\t\t\t\tProductVersion = \"{0}\"", ProductVersion); + ps.WriteLine("\t\t\t\tSchemaVersion = \"{0}\"", SchemaVersion); + ps.WriteLine("\t\t\t\tProjectGuid = \"{{{0}}}\"", project.Guid.ToString().ToUpper()); + ps.WriteLine("\t\t>"); + + ps.WriteLine("\t\t\t\t"); + ps.WriteLine(" "); + + foreach(ConfigurationNode conf in project.Configurations) + { + ps.WriteLine("\t\t\t\t "); + } + + ps.WriteLine(" "); + + ps.WriteLine(" "); + foreach(ReferenceNode refr in project.References) + { + ps.WriteLine(" "); + } + ps.WriteLine(" "); + + ps.WriteLine(" "); + ps.WriteLine(" "); + + ps.WriteLine(" "); + + foreach(string file in project.Files) + { + string fileName = file.Replace(".\\", ""); + ps.WriteLine(" "); + + if (project.Files.GetSubType(file) != SubType.Code && project.Files.GetSubType(file) != SubType.Settings) + { + ps.WriteLine(" "); + + } + } + ps.WriteLine(" "); + + ps.WriteLine(" "); + ps.WriteLine(" ", toolInfo.XmlTag); + ps.WriteLine(""); + } + + ps = new StreamWriter(projectFile + ".user"); + using(ps) + { + ps.WriteLine(""); + ps.WriteLine(" <{0}>", toolInfo.XmlTag); + ps.WriteLine(" "); + + ps.WriteLine(" ", MakeRefPath(project)); + foreach(ConfigurationNode conf in project.Configurations) + { + ps.WriteLine(" "); + } + ps.WriteLine(" "); + + ps.WriteLine(" "); + ps.WriteLine(" ", toolInfo.XmlTag); + ps.WriteLine(""); + } + + m_Kernel.CurrentWorkingDirectory.Pop(); + } + + /// + /// Gets the XML doc file. + /// + /// The project. + /// The conf. + /// + public static string GetXmlDocFile(ProjectNode project, ConfigurationNode conf) + { + if( conf == null ) + { + throw new ArgumentNullException("conf"); + } + if( project == null ) + { + throw new ArgumentNullException("project"); + } + // if(!(bool)conf.Options["GenerateXmlDocFile"]) //default to none, if the generate option is false + // { + // return string.Empty; + // } + + //default to "AssemblyName.xml" + //string defaultValue = Path.GetFileNameWithoutExtension(project.AssemblyName) + ".xml"; + //return (string)conf.Options["XmlDocFile", defaultValue]; + + //default to no XmlDocFile file + return (string)conf.Options["XmlDocFile", ""]; + } + + private void WriteSolution(SolutionNode solution) + { + m_Kernel.Log.Write("Creating Visual Studio {0} solution and project files", VersionName); + + foreach(ProjectNode project in solution.Projects) + { + if(m_Kernel.AllowProject(project.FilterGroups)) + { + m_Kernel.Log.Write("...Creating project: {0}", project.Name); + WriteProject(solution, project); + } + } + + m_Kernel.Log.Write(""); + string solutionFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "sln"); + StreamWriter ss = new StreamWriter(solutionFile); + + m_Kernel.CurrentWorkingDirectory.Push(); + Helper.SetCurrentDir(Path.GetDirectoryName(solutionFile)); + + using(ss) + { + ss.WriteLine("Microsoft Visual Studio Solution File, Format Version {0}", SolutionVersion); + foreach(ProjectNode project in solution.Projects) + { + if(!m_Tools.ContainsKey(project.Language)) + { + throw new UnknownLanguageException("Unknown .NET language: " + project.Language); + } + + ToolInfo toolInfo = m_Tools[project.Language]; + + string path = Helper.MakePathRelativeTo(solution.FullPath, project.FullPath); + ss.WriteLine("Project(\"{0}\") = \"{1}\", \"{2}\", \"{{{3}}}\"", + toolInfo.Guid, project.Name, Helper.MakeFilePath(path, project.Name, + toolInfo.FileExtension), project.Guid.ToString().ToUpper()); + + ss.WriteLine("\tProjectSection(ProjectDependencies) = postProject"); + ss.WriteLine("\tEndProjectSection"); + + ss.WriteLine("EndProject"); + } + + ss.WriteLine("Global"); + + ss.WriteLine("\tGlobalSection(SolutionConfiguration) = preSolution"); + foreach(ConfigurationNode conf in solution.Configurations) + { + ss.WriteLine("\t\t{0} = {0}", conf.Name); + } + ss.WriteLine("\tEndGlobalSection"); + + ss.WriteLine("\tGlobalSection(ProjectDependencies) = postSolution"); + foreach(ProjectNode project in solution.Projects) + { + for(int i = 0; i < project.References.Count; i++) + { + ReferenceNode refr = project.References[i]; + if(solution.ProjectsTable.ContainsKey(refr.Name)) + { + ProjectNode refProject = solution.ProjectsTable[refr.Name]; + ss.WriteLine("\t\t({{{0}}}).{1} = ({{{2}}})", + project.Guid.ToString().ToUpper() + , i, + refProject.Guid.ToString().ToUpper() + ); + } + } + } + ss.WriteLine("\tEndGlobalSection"); + + ss.WriteLine("\tGlobalSection(ProjectConfiguration) = postSolution"); + foreach(ProjectNode project in solution.Projects) + { + foreach(ConfigurationNode conf in solution.Configurations) + { + ss.WriteLine("\t\t{{{0}}}.{1}.ActiveCfg = {1}|.NET", + project.Guid.ToString().ToUpper(), + conf.Name); + + ss.WriteLine("\t\t{{{0}}}.{1}.Build.0 = {1}|.NET", + project.Guid.ToString().ToUpper(), + conf.Name); + } + } + ss.WriteLine("\tEndGlobalSection"); + + if(solution.Files != null) + { + ss.WriteLine("\tGlobalSection(SolutionItems) = postSolution"); + foreach(string file in solution.Files) + { + ss.WriteLine("\t\t{0} = {0}", file); + } + ss.WriteLine("\tEndGlobalSection"); + } + + ss.WriteLine("\tGlobalSection(ExtensibilityGlobals) = postSolution"); + ss.WriteLine("\tEndGlobalSection"); + ss.WriteLine("\tGlobalSection(ExtensibilityAddIns) = postSolution"); + ss.WriteLine("\tEndGlobalSection"); + + ss.WriteLine("EndGlobal"); + } + + m_Kernel.CurrentWorkingDirectory.Pop(); + } + + private void CleanProject(ProjectNode project) + { + m_Kernel.Log.Write("...Cleaning project: {0}", project.Name); + + ToolInfo toolInfo = m_Tools[project.Language]; + string projectFile = Helper.MakeFilePath(project.FullPath, project.Name, toolInfo.FileExtension); + string userFile = projectFile + ".user"; + + Helper.DeleteIfExists(projectFile); + Helper.DeleteIfExists(userFile); + } + + private void CleanSolution(SolutionNode solution) + { + m_Kernel.Log.Write("Cleaning Visual Studio {0} solution and project files", VersionName, solution.Name); + + string slnFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "sln"); + string suoFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "suo"); + + Helper.DeleteIfExists(slnFile); + Helper.DeleteIfExists(suoFile); + + foreach(ProjectNode project in solution.Projects) + { + CleanProject(project); + } + + m_Kernel.Log.Write(""); + } + + #endregion + + #region ITarget Members + + /// + /// Writes the specified kern. + /// + /// The kern. + public virtual void Write(Kernel kern) + { + if( kern == null ) + { + throw new ArgumentNullException("kern"); + } + m_Kernel = kern; + foreach(SolutionNode sol in m_Kernel.Solutions) + { + WriteSolution(sol); + } + m_Kernel = null; + } + + /// + /// Cleans the specified kern. + /// + /// The kern. + public virtual void Clean(Kernel kern) + { + if( kern == null ) + { + throw new ArgumentNullException("kern"); + } + m_Kernel = kern; + foreach(SolutionNode sol in m_Kernel.Solutions) + { + CleanSolution(sol); + } + m_Kernel = null; + } + + /// + /// Gets the name. + /// + /// The name. + public virtual string Name + { + get + { + return "vs2003"; + } + } + + #endregion + } +} diff --git a/Prebuild/src/Core/Targets/VS2005Target.cs b/Prebuild/src/Core/Targets/VS2005Target.cs new file mode 100644 index 0000000..9c70e26 --- /dev/null +++ b/Prebuild/src/Core/Targets/VS2005Target.cs @@ -0,0 +1,147 @@ +#region BSD License +/* +Copyright (c) 2004 Matthew Holmes (matthew@wildfiregames.com) + +Redistribution and use in source and binary forms, with or without modification, are permitted +provided that the following conditions are met: + +* Redistributions of source code must retain the above copyright notice, this list of conditions + and the following disclaimer. +* Redistributions in binary form must reproduce the above copyright notice, this list of conditions + and the following disclaimer in the documentation and/or other materials provided with the + distribution. +* The name of the author may not be used to endorse or promote products derived from this software + without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, +BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING +IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ +#endregion + +using System; +using System.IO; +using System.Text; + +using Prebuild.Core.Attributes; +using Prebuild.Core.Interfaces; +using Prebuild.Core.Nodes; +using Prebuild.Core.Utilities; + +namespace Prebuild.Core.Targets +{ + /// + /// + /// + [Target("vs2005")] + public class VS2005Target : VSGenericTarget + { + #region Inner Classes + + #endregion + + #region Fields + + string solutionVersion = "9.00"; + string productVersion = "8.0.50727"; + string schemaVersion = "2.0"; + string versionName = "Visual C# 2005"; + string name = "vs2005"; + + VSVersion version = VSVersion.VS80; + + public override string SolutionTag + { + get { return "# Visual Studio 2005"; } + } + + protected override string GetToolsVersionXml(FrameworkVersion frameworkVersion) + { + return string.Empty; + } + /// + /// Gets or sets the solution version. + /// + /// The solution version. + public override string SolutionVersion + { + get + { + return solutionVersion; + } + } + /// + /// Gets or sets the product version. + /// + /// The product version. + public override string ProductVersion + { + get + { + return productVersion; + } + } + /// + /// Gets or sets the schema version. + /// + /// The schema version. + public override string SchemaVersion + { + get + { + return schemaVersion; + } + } + /// + /// Gets or sets the name of the version. + /// + /// The name of the version. + public override string VersionName + { + get + { + return versionName; + } + } + /// + /// Gets or sets the version. + /// + /// The version. + public override VSVersion Version + { + get + { + return version; + } + } + /// + /// Gets the name. + /// + /// The name. + public override string Name + { + get + { + return name; + } + } + + #endregion + + #region Constructors + + /// + /// Initializes a new instance of the class. + /// + public VS2005Target() + : base() + { + } + + #endregion + } +} diff --git a/Prebuild/src/Core/Targets/VS2008Target.cs b/Prebuild/src/Core/Targets/VS2008Target.cs new file mode 100644 index 0000000..fee4f7f --- /dev/null +++ b/Prebuild/src/Core/Targets/VS2008Target.cs @@ -0,0 +1,127 @@ +using System; +using System.IO; +using System.Text; + +using Prebuild.Core.Attributes; +using Prebuild.Core.Interfaces; +using Prebuild.Core.Nodes; +using Prebuild.Core.Utilities; +using System.CodeDom.Compiler; + +namespace Prebuild.Core.Targets +{ + + /// + /// + /// + [Target("vs2008")] + public class VS2008Target : VSGenericTarget + { + #region Fields + string solutionVersion = "10.00"; + string productVersion = "9.0.21022"; + string schemaVersion = "2.0"; + string versionName = "Visual Studio 2008"; + string name = "vs2008"; + VSVersion version = VSVersion.VS90; + + /// + /// Gets or sets the solution version. + /// + /// The solution version. + public override string SolutionVersion + { + get + { + return solutionVersion; + } + } + /// + /// Gets or sets the product version. + /// + /// The product version. + public override string ProductVersion + { + get + { + return productVersion; + } + } + /// + /// Gets or sets the schema version. + /// + /// The schema version. + public override string SchemaVersion + { + get + { + return schemaVersion; + } + } + /// + /// Gets or sets the name of the version. + /// + /// The name of the version. + public override string VersionName + { + get + { + return versionName; + } + } + /// + /// Gets or sets the version. + /// + /// The version. + public override VSVersion Version + { + get + { + return version; + } + } + /// + /// Gets the name. + /// + /// The name. + public override string Name + { + get + { + return name; + } + } + + protected override string GetToolsVersionXml(FrameworkVersion frameworkVersion) + { + switch (frameworkVersion) + { + case FrameworkVersion.v3_5: + return "ToolsVersion=\"3.5\""; + case FrameworkVersion.v3_0: + return "ToolsVersion=\"3.0\""; + default: + return "ToolsVersion=\"2.0\""; + } + } + + public override string SolutionTag + { + get { return "# Visual Studio 2008"; } + } + + #endregion + + #region Constructors + + /// + /// Initializes a new instance of the class. + /// + public VS2008Target() + : base() + { + } + + #endregion + } +} diff --git a/Prebuild/src/Core/Targets/VS2010Target.cs b/Prebuild/src/Core/Targets/VS2010Target.cs new file mode 100644 index 0000000..ea9f736 --- /dev/null +++ b/Prebuild/src/Core/Targets/VS2010Target.cs @@ -0,0 +1,138 @@ +using System; +using System.IO; +using System.Text; + +using Prebuild.Core.Attributes; +using Prebuild.Core.Interfaces; +using Prebuild.Core.Nodes; +using Prebuild.Core.Utilities; +using System.CodeDom.Compiler; + +namespace Prebuild.Core.Targets +{ + + /// + /// + /// + [Target("vs2010")] + public class VS2010Target : VSGenericTarget + { + #region Fields + + string solutionVersion = "11.00"; + string productVersion = "9.0.30729"; + string schemaVersion = "2.0"; + string versionName = "Visual Studio 2010"; + string name = "vs2010"; + VSVersion version = VSVersion.VS10; + + #endregion + + #region Properties + + /// + /// Gets or sets the solution version. + /// + /// The solution version. + public override string SolutionVersion + { + get + { + return solutionVersion; + } + } + + /// + /// Gets or sets the product version. + /// + /// The product version. + public override string ProductVersion + { + get + { + return productVersion; + } + } + + /// + /// Gets or sets the schema version. + /// + /// The schema version. + public override string SchemaVersion + { + get + { + return schemaVersion; + } + } + + /// + /// Gets or sets the name of the version. + /// + /// The name of the version. + public override string VersionName + { + get + { + return versionName; + } + } + + /// + /// Gets or sets the version. + /// + /// The version. + public override VSVersion Version + { + get + { + return version; + } + } + + /// + /// Gets the name. + /// + /// The name. + public override string Name + { + get + { + return name; + } + } + + protected override string GetToolsVersionXml(FrameworkVersion frameworkVersion) + { + switch (frameworkVersion) + { + case FrameworkVersion.v4_0: + case FrameworkVersion.v3_5: + return "ToolsVersion=\"4.0\""; + case FrameworkVersion.v3_0: + return "ToolsVersion=\"3.0\""; + default: + return "ToolsVersion=\"2.0\""; + } + } + + public override string SolutionTag + { + get { return "# Visual Studio 2010"; } + } + + #endregion + + #region Constructors + + /// + /// Initializes a new instance of the class. + /// + public VS2010Target() + : base() + { + } + + #endregion + } +} diff --git a/Prebuild/src/Core/Targets/VSGenericTarget.cs b/Prebuild/src/Core/Targets/VSGenericTarget.cs new file mode 100644 index 0000000..6969dd7 --- /dev/null +++ b/Prebuild/src/Core/Targets/VSGenericTarget.cs @@ -0,0 +1,922 @@ +#region BSD License +/* +Copyright (c) 2008 Matthew Holmes (matthew@wildfiregames.com), John Anderson (sontek@gmail.com) + +Redistribution and use in source and binary forms, with or without modification, are permitted +provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this list of conditions + and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, this list of conditions + and the following disclaimer in the documentation and/or other materials provided with the + distribution. + * The name of the author may not be used to endorse or promote products derived from this software + without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, +BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING +IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +#endregion + +using System; +using System.Collections.Generic; +using System.IO; +using Prebuild.Core.Interfaces; +using Prebuild.Core.Nodes; +using Prebuild.Core.Utilities; +using System.CodeDom.Compiler; + +namespace Prebuild.Core.Targets +{ + + /// + /// + /// + public abstract class VSGenericTarget : ITarget + { + #region Fields + + readonly Dictionary tools = new Dictionary(); + Kernel kernel; + #endregion + + #region Properties + /// + /// Gets or sets the solution version. + /// + /// The solution version. + public abstract string SolutionVersion { get; } + /// + /// Gets or sets the product version. + /// + /// The product version. + public abstract string ProductVersion { get; } + /// + /// Gets or sets the schema version. + /// + /// The schema version. + public abstract string SchemaVersion { get; } + /// + /// Gets or sets the name of the version. + /// + /// The name of the version. + public abstract string VersionName { get; } + /// + /// Gets or sets the version. + /// + /// The version. + public abstract VSVersion Version { get; } + /// + /// Gets the name. + /// + /// The name. + public abstract string Name { get; } + + protected abstract string GetToolsVersionXml(FrameworkVersion version); + public abstract string SolutionTag { get; } + + #endregion + + #region Constructors + + /// + /// Initializes a new instance of the class. + /// + protected VSGenericTarget() + { + tools["C#"] = new ToolInfo("C#", "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}", "csproj", "CSHARP", "$(MSBuildBinPath)\\Microsoft.CSHARP.Targets"); + tools["Database"] = new ToolInfo("Database", "{4F174C21-8C12-11D0-8340-0000F80270F8}", "dbp", "UNKNOWN"); + tools["Boo"] = new ToolInfo("Boo", "{45CEA7DC-C2ED-48A6-ACE0-E16144C02365}", "booproj", "Boo", "$(BooBinPath)\\Boo.Microsoft.Build.targets"); + tools["VisualBasic"] = new ToolInfo("VisualBasic", "{F184B08F-C81C-45F6-A57F-5ABD9991F28F}", "vbproj", "VisualBasic", "$(MSBuildBinPath)\\Microsoft.VisualBasic.Targets"); + tools["Folder"] = new ToolInfo("Folder", "{2150E333-8FDC-42A3-9474-1A3956D46DE8}", null, null); + } + + #endregion + + #region Private Methods + + private string MakeRefPath(ProjectNode project) + { + string ret = ""; + foreach (ReferencePathNode node in project.ReferencePaths) + { + try + { + string fullPath = Helper.ResolvePath(node.Path); + if (ret.Length < 1) + { + ret = fullPath; + } + else + { + ret += ";" + fullPath; + } + } + catch (ArgumentException) + { + kernel.Log.Write(LogType.Warning, "Could not resolve reference path: {0}", node.Path); + } + } + + return ret; + } + + private static ProjectNode FindProjectInSolution(string name, SolutionNode solution) + { + SolutionNode node = solution; + + while (node.Parent is SolutionNode) + node = node.Parent as SolutionNode; + + return FindProjectInSolutionRecursively(name, node); + } + + private static ProjectNode FindProjectInSolutionRecursively(string name, SolutionNode solution) + { + if (solution.ProjectsTable.ContainsKey(name)) + return solution.ProjectsTable[name]; + + foreach (SolutionNode child in solution.Solutions) + { + ProjectNode node = FindProjectInSolutionRecursively(name, child); + if (node != null) + return node; + } + + return null; + } + + private void WriteProject(SolutionNode solution, ProjectNode project) + { + if (!tools.ContainsKey(project.Language)) + { + throw new UnknownLanguageException("Unknown .NET language: " + project.Language); + } + + ToolInfo toolInfo = tools[project.Language]; + string projectFile = Helper.MakeFilePath(project.FullPath, project.Name, toolInfo.FileExtension); + StreamWriter ps = new StreamWriter(projectFile); + + kernel.CurrentWorkingDirectory.Push(); + Helper.SetCurrentDir(Path.GetDirectoryName(projectFile)); + + #region Project File + using (ps) + { + ps.WriteLine("", GetToolsVersionXml(project.FrameworkVersion)); + ps.WriteLine(" "); + ps.WriteLine(" Local"); + ps.WriteLine(" {0}", ProductVersion); + ps.WriteLine(" {0}", SchemaVersion); + ps.WriteLine(" {{{0}}}", project.Guid.ToString().ToUpper()); + + // Visual Studio has a hard coded guid for the project type + if (project.Type == ProjectType.Web) + ps.WriteLine(" {349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}"); + ps.WriteLine(" Debug"); + ps.WriteLine(" {0}", project.AppIcon); + ps.WriteLine(" "); + ps.WriteLine(" "); + ps.WriteLine(" {0}", project.AssemblyName); + foreach (ConfigurationNode conf in project.Configurations) + { + if (conf.Options.KeyFile != "") + { + ps.WriteLine(" {0}", conf.Options.KeyFile); + ps.WriteLine(" true"); + break; + } + } + ps.WriteLine(" JScript"); + ps.WriteLine(" Grid"); + ps.WriteLine(" IE50"); + ps.WriteLine(" false"); + ps.WriteLine(" {0}", project.FrameworkVersion.ToString().Replace("_", ".")); + + ps.WriteLine(" {0}", project.Type == ProjectType.Web ? ProjectType.Library.ToString() : project.Type.ToString()); + ps.WriteLine(" {0}", project.DesignerFolder); + ps.WriteLine(" {0}", project.RootNamespace); + ps.WriteLine(" {0}", project.StartupObject); + if (string.IsNullOrEmpty(project.DebugStartParameters)) + { + ps.WriteLine(" {0}", project.DebugStartParameters); + } + ps.WriteLine(" "); + ps.WriteLine(" "); + + ps.WriteLine(" "); + + foreach (ConfigurationNode conf in project.Configurations) + { + ps.Write(" ", conf.Name, conf.Platform); + ps.WriteLine(" {0}", conf.Options["AllowUnsafe"]); + ps.WriteLine(" {0}", conf.Options["BaseAddress"]); + ps.WriteLine(" {0}", conf.Options["CheckUnderflowOverflow"]); + ps.WriteLine(" "); + ps.WriteLine(" "); + ps.WriteLine(" {0}", conf.Options["CompilerDefines"]); + ps.WriteLine(" {0}", Helper.NormalizePath(conf.Options["XmlDocFile"].ToString())); + ps.WriteLine(" {0}", conf.Options["DebugInformation"]); + ps.WriteLine(" {0}", conf.Options["FileAlignment"]); + ps.WriteLine(" {0}", conf.Options["OptimizeCode"]); + if (project.Type != ProjectType.Web) + ps.WriteLine(" {0}", + Helper.EndPath(Helper.NormalizePath(conf.Options["OutputPath"].ToString()))); + else + ps.WriteLine(" {0}", + Helper.EndPath(Helper.NormalizePath("bin\\"))); + + ps.WriteLine(" {0}", conf.Options["RegisterComInterop"]); + ps.WriteLine(" {0}", conf.Options["RemoveIntegerChecks"]); + ps.WriteLine(" {0}", conf.Options["WarningsAsErrors"]); + ps.WriteLine(" {0}", conf.Options["WarningLevel"]); + ps.WriteLine(" {0}", conf.Options["NoStdLib"]); + ps.WriteLine(" {0}", conf.Options["SuppressWarnings"]); + ps.WriteLine(" {0}", conf.Platform); + ps.WriteLine(" "); + } + + //ps.WriteLine(" "); + + Dictionary projectReferences = new Dictionary(); + List otherReferences = new List(); + + foreach (ReferenceNode refr in project.References) + { + ProjectNode projectNode = FindProjectInSolution(refr.Name, solution); + + if (projectNode == null) + otherReferences.Add(refr); + else + projectReferences.Add(refr, projectNode); + } + // Assembly References + ps.WriteLine(" "); + + foreach (ReferenceNode refr in otherReferences) + { + ps.Write(" "); + ps.Write(" "); + ps.Write(refr.Name); + ps.WriteLine(""); + + if(!String.IsNullOrEmpty(refr.Path)) + { + // Use absolute path to assembly (for determining assembly type) + string absolutePath = Path.Combine(project.FullPath, refr.Path); + if(File.Exists(Helper.MakeFilePath(absolutePath, refr.Name, "exe"))) { + // Assembly is an executable (exe) + ps.WriteLine(" {0}", Helper.MakeFilePath(refr.Path, refr.Name, "exe")); + } else if(File.Exists(Helper.MakeFilePath(absolutePath, refr.Name, "dll"))) { + // Assembly is an library (dll) + ps.WriteLine(" {0}", Helper.MakeFilePath(refr.Path, refr.Name, "dll")); + } else { + string referencePath = Helper.MakeFilePath(refr.Path, refr.Name, "dll"); + kernel.Log.Write(LogType.Warning, "Reference \"{0}\": The specified file doesn't exist.", referencePath); + ps.WriteLine(" {0}", Helper.MakeFilePath(refr.Path, refr.Name, "dll")); + } + } + + ps.WriteLine(" {0}", refr.LocalCopy); + ps.WriteLine(" "); + } + ps.WriteLine(" "); + + //Project References + ps.WriteLine(" "); + foreach (KeyValuePair pair in projectReferences) + { + ToolInfo tool = tools[pair.Value.Language]; + if (tools == null) + throw new UnknownLanguageException(); + + string path = + Helper.MakePathRelativeTo(project.FullPath, + Helper.MakeFilePath(pair.Value.FullPath, pair.Value.Name, tool.FileExtension)); + ps.WriteLine(" ", path); + + // TODO: Allow reference to visual basic projects + ps.WriteLine(" {0}", pair.Value.Name); + ps.WriteLine(" {0}", pair.Value.Guid.ToString("B").ToUpper()); + ps.WriteLine(" {0}", tool.Guid.ToUpper()); + + //This is the Copy Local flag in VS + ps.WriteLine(" {0}", pair.Key.LocalCopy); + + ps.WriteLine(" "); + } + ps.WriteLine(" "); + + // ps.WriteLine(" "); + ps.WriteLine(" "); + + // ps.WriteLine(" "); + List list = new List(); + + foreach (string path in project.Files) + { + string lower = path.ToLower(); + if (lower.EndsWith(".resx")) + { + string codebehind = String.Format("{0}.Designer{1}", path.Substring(0, path.LastIndexOf('.')), toolInfo.LanguageExtension); + if (!list.Contains(codebehind)) + list.Add(codebehind); + } + + } + + foreach (string filePath in project.Files) + { + // if (file == "Properties\\Bind.Designer.cs") + // { + // Console.WriteLine("Wait a minute!"); + // Console.WriteLine(project.Files.GetSubType(file).ToString()); + // } + SubType subType = project.Files.GetSubType(filePath); + + // Visual Studio chokes on file names if forward slash is used as a path separator + // instead of backslash. So we must make sure that all file paths written to the + // project file use \ as a path separator. + string file = filePath.Replace(@"/", @"\"); + + if (subType != SubType.Code && subType != SubType.Settings && subType != SubType.Designer + && subType != SubType.CodeBehind) + { + ps.WriteLine(" ", file.Substring(0, file.LastIndexOf('.')) + ".resx"); + ps.WriteLine(" {0}", Path.GetFileName(file)); + ps.WriteLine(" Designer"); + ps.WriteLine(" "); + // + } + + if (subType == SubType.Designer) + { + ps.WriteLine(" ", file); + + string autogen_name = file.Substring(0, file.LastIndexOf('.')) + ".Designer.cs"; + string dependent_name = filePath.Substring(0, file.LastIndexOf('.')) + ".cs"; + + // Check for a parent .cs file with the same name as this designer file + if (File.Exists(Helper.NormalizePath(dependent_name))) + { + ps.WriteLine(" {0}", Path.GetFileName(dependent_name)); + } + else + { + ps.WriteLine(" ResXFileCodeGenerator"); + ps.WriteLine(" {0}", Path.GetFileName(autogen_name)); + ps.WriteLine(" " + subType + ""); + } + + ps.WriteLine(" "); + if (File.Exists(Helper.NormalizePath(autogen_name))) + { + ps.WriteLine(" ", autogen_name); + //ps.WriteLine(" True"); + + // If a parent .cs file exists, link this autogen file to it. Otherwise link + // to the designer file + if (File.Exists(dependent_name)) + { + ps.WriteLine(" {0}", Path.GetFileName(dependent_name)); + } + else + { + ps.WriteLine(" True"); + ps.WriteLine(" {0}", Path.GetFileName(filePath)); + } + + ps.WriteLine(" "); + } + list.Add(autogen_name); + } + if (subType == SubType.Settings) + { + ps.Write(" <{0} ", project.Files.GetBuildAction(filePath)); + ps.WriteLine("Include=\"{0}\">", file); + string fileName = Path.GetFileName(filePath); + if (project.Files.GetBuildAction(filePath) == BuildAction.None) + { + ps.WriteLine(" SettingsSingleFileGenerator"); + ps.WriteLine(" {0}", fileName.Substring(0, fileName.LastIndexOf('.')) + ".Designer.cs"); + } + else + { + ps.WriteLine(" Code"); + ps.WriteLine(" True"); + ps.WriteLine(" True"); + string fileNameShort = fileName.Substring(0, fileName.LastIndexOf('.')); + string fileNameShorter = fileNameShort.Substring(0, fileNameShort.LastIndexOf('.')); + ps.WriteLine(" {0}", Path.GetFileName(fileNameShorter + ".settings")); + } + ps.WriteLine(" ", project.Files.GetBuildAction(filePath)); + } + else if (subType != SubType.Designer) + { + string path = Helper.NormalizePath(file); + string path_lower = path.ToLower(); + + if (!list.Contains(filePath)) + { + ps.Write(" <{0} ", project.Files.GetBuildAction(filePath)); + + int startPos = 0; + if (project.Files.GetPreservePath(filePath)) + { + while ((@"./\").IndexOf(file.Substring(startPos, 1)) != -1) + startPos++; + + } + else + { + startPos = file.LastIndexOf(Path.GetFileName(path)); + } + + // be sure to write out the path with backslashes so VS recognizes + // the file properly. + ps.WriteLine("Include=\"{0}\">", file); + + int last_period_index = file.LastIndexOf('.'); + string short_file_name = file.Substring(0, last_period_index); + string extension = Path.GetExtension(path); + // make this upper case, so that when File.Exists tests for the + // existence of a designer file on a case-sensitive platform, + // it is correctly identified. + string designer_format = string.Format(".Designer{0}", extension); + + if (path_lower.EndsWith(designer_format.ToLowerInvariant())) + { + int designer_index = path.IndexOf(designer_format); + string file_name = path.Substring(0, designer_index); + + // There are two corrections to the next lines: + // 1. Fix the connection between a designer file and a form + // or usercontrol that don't have an associated resx file. + // 2. Connect settings files to associated designer files. + if (File.Exists(file_name + extension)) + ps.WriteLine(" {0}", Path.GetFileName(file_name + extension)); + else if (File.Exists(file_name + ".resx")) + ps.WriteLine(" {0}", Path.GetFileName(file_name + ".resx")); + else if (File.Exists(file_name + ".settings")) + { + ps.WriteLine(" {0}", Path.GetFileName(file_name + ".settings")); + ps.WriteLine(" True"); + ps.WriteLine(" True"); + } + } + else if (subType == SubType.CodeBehind) + { + ps.WriteLine(" {0}", Path.GetFileName(short_file_name)); + } + if (project.Files.GetIsLink(filePath)) + { + string alias = project.Files.GetLinkPath(filePath); + alias += file.Substring(startPos); + alias = Helper.NormalizePath(alias); + ps.WriteLine(" {0}", alias); + } + else if (project.Files.GetBuildAction(filePath) != BuildAction.None) + { + if (project.Files.GetBuildAction(filePath) != BuildAction.EmbeddedResource) + { + ps.WriteLine(" {0}", subType); + } + } + + if (project.Files.GetCopyToOutput(filePath) != CopyToOutput.Never) + { + ps.WriteLine(" {0}", project.Files.GetCopyToOutput(filePath)); + } + + ps.WriteLine(" ", project.Files.GetBuildAction(filePath)); + } + } + } + + ps.WriteLine(" "); + ps.WriteLine(" "); + ps.WriteLine(" "); + ps.WriteLine(" "); + ps.WriteLine(" "); + ps.WriteLine(" "); + ps.WriteLine(" "); + ps.WriteLine(" "); + ps.WriteLine(""); + } + #endregion + + #region User File + + ps = new StreamWriter(projectFile + ".user"); + using (ps) + { + // Get the first configuration from the project. + ConfigurationNode firstConfiguration = null; + + if (project.Configurations.Count > 0) + { + firstConfiguration = project.Configurations[0]; + } + + ps.WriteLine(""); + //ps.WriteLine( "" ); + //ps.WriteLine(" <{0}>", toolInfo.XMLTag); + //ps.WriteLine(" "); + ps.WriteLine(" "); + //ps.WriteLine(" ", MakeRefPath(project)); + + if (firstConfiguration != null) + { + ps.WriteLine(" {0}", firstConfiguration.Name); + ps.WriteLine(" {0}", firstConfiguration.Platform); + } + + ps.WriteLine(" {0}", MakeRefPath(project)); + ps.WriteLine(" {0}", ProductVersion); + ps.WriteLine(" ProjectFiles"); + ps.WriteLine(" 0"); + ps.WriteLine(" "); + foreach (ConfigurationNode conf in project.Configurations) + { + ps.Write(" "); + } + ps.WriteLine(""); + } + #endregion + + kernel.CurrentWorkingDirectory.Pop(); + } + + private void WriteSolution(SolutionNode solution, bool writeSolutionToDisk) + { + kernel.Log.Write("Creating {0} solution and project files", VersionName); + + foreach (SolutionNode child in solution.Solutions) + { + kernel.Log.Write("...Creating folder: {0}", child.Name); + WriteSolution(child, false); + } + + foreach (ProjectNode project in solution.Projects) + { + kernel.Log.Write("...Creating project: {0}", project.Name); + WriteProject(solution, project); + } + + foreach (DatabaseProjectNode project in solution.DatabaseProjects) + { + kernel.Log.Write("...Creating database project: {0}", project.Name); + WriteDatabaseProject(solution, project); + } + + if (writeSolutionToDisk) // only write main solution + { + kernel.Log.Write(""); + string solutionFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "sln"); + + using (StreamWriter ss = new StreamWriter(solutionFile)) + { + kernel.CurrentWorkingDirectory.Push(); + Helper.SetCurrentDir(Path.GetDirectoryName(solutionFile)); + + ss.WriteLine("Microsoft Visual Studio Solution File, Format Version {0}", SolutionVersion); + ss.WriteLine(SolutionTag); + + WriteProjectDeclarations(ss, solution, solution); + + ss.WriteLine("Global"); + + ss.WriteLine("\tGlobalSection(SolutionConfigurationPlatforms) = preSolution"); + foreach (ConfigurationNode conf in solution.Configurations) + { + ss.WriteLine("\t\t{0} = {0}", conf.NameAndPlatform); + } + ss.WriteLine("\tEndGlobalSection"); + + ss.WriteLine("\tGlobalSection(ProjectConfigurationPlatforms) = postSolution"); + WriteConfigurationLines(solution.Configurations, solution, ss); + ss.WriteLine("\tEndGlobalSection"); + + if (solution.Solutions.Count > 0) + { + ss.WriteLine("\tGlobalSection(NestedProjects) = preSolution"); + foreach (SolutionNode embeddedSolution in solution.Solutions) + { + WriteNestedProjectMap(ss, embeddedSolution); + } + ss.WriteLine("\tEndGlobalSection"); + } + + ss.WriteLine("EndGlobal"); + } + + kernel.CurrentWorkingDirectory.Pop(); + } + } + + private void WriteProjectDeclarations(TextWriter writer, SolutionNode actualSolution, SolutionNode embeddedSolution) + { + foreach (SolutionNode childSolution in embeddedSolution.Solutions) + { + WriteEmbeddedSolution(writer, childSolution); + WriteProjectDeclarations(writer, actualSolution, childSolution); + } + + foreach (ProjectNode project in embeddedSolution.Projects) + { + WriteProject(actualSolution, writer, project); + } + + foreach (DatabaseProjectNode dbProject in embeddedSolution.DatabaseProjects) + { + WriteProject(actualSolution, writer, dbProject); + } + + if (actualSolution.Guid == embeddedSolution.Guid) + { + WriteSolutionFiles(actualSolution, writer); + } + } + + private static void WriteNestedProjectMap(TextWriter writer, SolutionNode embeddedSolution) + { + foreach (ProjectNode project in embeddedSolution.Projects) + { + WriteNestedProject(writer, embeddedSolution, project.Guid); + } + + foreach (DatabaseProjectNode dbProject in embeddedSolution.DatabaseProjects) + { + WriteNestedProject(writer, embeddedSolution, dbProject.Guid); + } + + foreach (SolutionNode child in embeddedSolution.Solutions) + { + WriteNestedProject(writer, embeddedSolution, child.Guid); + WriteNestedProjectMap(writer, child); + } + } + + private static void WriteNestedProject(TextWriter writer, SolutionNode solution, Guid projectGuid) + { + WriteNestedFolder(writer, solution.Guid, projectGuid); + } + + private static void WriteNestedFolder(TextWriter writer, Guid parentGuid, Guid childGuid) + { + writer.WriteLine("\t\t{0} = {1}", + childGuid.ToString("B").ToUpper(), + parentGuid.ToString("B").ToUpper()); + } + + private static void WriteConfigurationLines(IEnumerable configurations, SolutionNode solution, TextWriter ss) + { + foreach (ProjectNode project in solution.Projects) + { + foreach (ConfigurationNode conf in configurations) + { + ss.WriteLine("\t\t{0}.{1}.ActiveCfg = {1}", + project.Guid.ToString("B").ToUpper(), + conf.NameAndPlatform); + + ss.WriteLine("\t\t{0}.{1}.Build.0 = {1}", + project.Guid.ToString("B").ToUpper(), + conf.NameAndPlatform); + } + } + + foreach (SolutionNode child in solution.Solutions) + { + WriteConfigurationLines(configurations, child, ss); + } + } + + private void WriteSolutionFiles(SolutionNode solution, TextWriter ss) + { + if(solution.Files != null && solution.Files.Count > 0) + WriteProject(ss, "Folder", solution.Guid, "Solution Files", "Solution Files", solution.Files); + } + + private void WriteEmbeddedSolution(TextWriter writer, SolutionNode embeddedSolution) + { + WriteProject(writer, "Folder", embeddedSolution.Guid, embeddedSolution.Name, embeddedSolution.Name, embeddedSolution.Files); + } + + private void WriteProject(SolutionNode solution, TextWriter ss, ProjectNode project) + { + WriteProject(ss, solution, project.Language, project.Guid, project.Name, project.FullPath); + } + + private void WriteProject(SolutionNode solution, TextWriter ss, DatabaseProjectNode dbProject) + { + if (solution.Files != null && solution.Files.Count > 0) + WriteProject(ss, solution, "Database", dbProject.Guid, dbProject.Name, dbProject.FullPath); + } + + const string ProjectDeclarationBeginFormat = "Project(\"{0}\") = \"{1}\", \"{2}\", \"{3}\""; + const string ProjectDeclarationEndFormat = "EndProject"; + + private void WriteProject(TextWriter ss, SolutionNode solution, string language, Guid guid, string name, string projectFullPath) + { + if (!tools.ContainsKey(language)) + throw new UnknownLanguageException("Unknown .NET language: " + language); + + ToolInfo toolInfo = tools[language]; + + string path = Helper.MakePathRelativeTo(solution.FullPath, projectFullPath); + + path = Helper.MakeFilePath(path, name, toolInfo.FileExtension); + + WriteProject(ss, language, guid, name, path); + } + + private void WriteProject(TextWriter writer, string language, Guid projectGuid, string name, string location) + { + WriteProject(writer, language, projectGuid, name, location, null); + } + + private void WriteProject(TextWriter writer, string language, Guid projectGuid, string name, string location, FilesNode files) + { + if (!tools.ContainsKey(language)) + throw new UnknownLanguageException("Unknown .NET language: " + language); + + ToolInfo toolInfo = tools[language]; + + writer.WriteLine(ProjectDeclarationBeginFormat, + toolInfo.Guid, + name, + location, + projectGuid.ToString("B").ToUpper()); + + if (files != null) + { + writer.WriteLine("\tProjectSection(SolutionItems) = preProject"); + + foreach (string file in files) + writer.WriteLine("\t\t{0} = {0}", file); + + writer.WriteLine("\tEndProjectSection"); + } + + writer.WriteLine(ProjectDeclarationEndFormat); + } + + private void WriteDatabaseProject(SolutionNode solution, DatabaseProjectNode project) + { + string projectFile = Helper.MakeFilePath(project.FullPath, project.Name, "dbp"); + IndentedTextWriter ps = new IndentedTextWriter(new StreamWriter(projectFile), " "); + + kernel.CurrentWorkingDirectory.Push(); + + Helper.SetCurrentDir(Path.GetDirectoryName(projectFile)); + + using (ps) + { + ps.WriteLine("# Microsoft Developer Studio Project File - Database Project"); + ps.WriteLine("Begin DataProject = \"{0}\"", project.Name); + ps.Indent++; + ps.WriteLine("MSDTVersion = \"80\""); + // TODO: Use the project.Files property + if (ContainsSqlFiles(Path.GetDirectoryName(projectFile))) + WriteDatabaseFoldersAndFiles(ps, Path.GetDirectoryName(projectFile)); + + ps.WriteLine("Begin DBRefFolder = \"Database References\""); + ps.Indent++; + foreach (DatabaseReferenceNode reference in project.References) + { + ps.WriteLine("Begin DBRefNode = \"{0}\"", reference.Name); + ps.Indent++; + ps.WriteLine("ConnectStr = \"{0}\"", reference.ConnectionString); + ps.WriteLine("Provider = \"{0}\"", reference.ProviderId.ToString("B").ToUpper()); + //ps.WriteLine("Colorizer = 5"); + ps.Indent--; + ps.WriteLine("End"); + } + ps.Indent--; + ps.WriteLine("End"); + ps.Indent--; + ps.WriteLine("End"); + + ps.Flush(); + } + + kernel.CurrentWorkingDirectory.Pop(); + } + + private static bool ContainsSqlFiles(string folder) + { + if(Directory.GetFiles(folder, "*.sql").Length > 0) + return true; // if the folder contains 1 .sql file, that's good enough + + foreach (string child in Directory.GetDirectories(folder)) + { + if (ContainsSqlFiles(child)) + return true; // if 1 child folder contains a .sql file, still good enough + } + + return false; + } + + private static void WriteDatabaseFoldersAndFiles(IndentedTextWriter writer, string folder) + { + foreach (string child in Directory.GetDirectories(folder)) + { + if (ContainsSqlFiles(child)) + { + writer.WriteLine("Begin Folder = \"{0}\"", Path.GetFileName(child)); + writer.Indent++; + WriteDatabaseFoldersAndFiles(writer, child); + writer.Indent--; + writer.WriteLine("End"); + } + } + foreach (string file in Directory.GetFiles(folder, "*.sql")) + { + writer.WriteLine("Script = \"{0}\"", Path.GetFileName(file)); + } + } + + private void CleanProject(ProjectNode project) + { + kernel.Log.Write("...Cleaning project: {0}", project.Name); + + ToolInfo toolInfo = tools[project.Language]; + string projectFile = Helper.MakeFilePath(project.FullPath, project.Name, toolInfo.FileExtension); + string userFile = projectFile + ".user"; + + Helper.DeleteIfExists(projectFile); + Helper.DeleteIfExists(userFile); + } + + private void CleanSolution(SolutionNode solution) + { + kernel.Log.Write("Cleaning {0} solution and project files", VersionName, solution.Name); + + string slnFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "sln"); + string suoFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "suo"); + + Helper.DeleteIfExists(slnFile); + Helper.DeleteIfExists(suoFile); + + foreach (ProjectNode project in solution.Projects) + { + CleanProject(project); + } + + kernel.Log.Write(""); + } + + #endregion + + #region ITarget Members + + /// + /// Writes the specified kern. + /// + /// The kern. + public virtual void Write(Kernel kern) + { + if (kern == null) + { + throw new ArgumentNullException("kern"); + } + kernel = kern; + foreach (SolutionNode sol in kernel.Solutions) + { + WriteSolution(sol, true); + } + kernel = null; + } + + /// + /// Cleans the specified kern. + /// + /// The kern. + public virtual void Clean(Kernel kern) + { + if (kern == null) + { + throw new ArgumentNullException("kern"); + } + kernel = kern; + foreach (SolutionNode sol in kernel.Solutions) + { + CleanSolution(sol); + } + kernel = null; + } + + #endregion + } +} diff --git a/Prebuild/src/Core/Targets/VSVersion.cs b/Prebuild/src/Core/Targets/VSVersion.cs new file mode 100644 index 0000000..699b5ca --- /dev/null +++ b/Prebuild/src/Core/Targets/VSVersion.cs @@ -0,0 +1,54 @@ +#region BSD License +/* +Copyright (c) 2008-2009 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com), John Anderson (sontek@gmail.com) + +Redistribution and use in source and binary forms, with or without modification, are permitted +provided that the following conditions are met: + +* Redistributions of source code must retain the above copyright notice, this list of conditions + and the following disclaimer. +* Redistributions in binary form must reproduce the above copyright notice, this list of conditions + and the following disclaimer in the documentation and/or other materials provided with the + distribution. +* The name of the author may not be used to endorse or promote products derived from this software + without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, +BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING +IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ +#endregion + +namespace Prebuild.Core.Targets +{ + /// + /// + /// + public enum VSVersion + { + /// + /// Visual Studio 2002 + /// + VS70, + /// + /// Visual Studio 2003 + /// + VS71, + /// + /// Visual Studio 2005 + /// + VS80, + /// + /// Visual Studio 2008 + /// + VS90, + /// + /// Visual Studio 2010 + /// + VS10 + } +} diff --git a/Prebuild/src/Core/Targets/XcodeTarget.cs b/Prebuild/src/Core/Targets/XcodeTarget.cs new file mode 100644 index 0000000..5393cec --- /dev/null +++ b/Prebuild/src/Core/Targets/XcodeTarget.cs @@ -0,0 +1,594 @@ +#region BSD License +/* +Copyright (c) 2004 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com) + +Redistribution and use in source and binary forms, with or without modification, are permitted +provided that the following conditions are met: + +* Redistributions of source code must retain the above copyright notice, this list of conditions + and the following disclaimer. +* Redistributions in binary form must reproduce the above copyright notice, this list of conditions + and the following disclaimer in the documentation and/or other materials provided with the + distribution. +* The name of the author may not be used to endorse or promote products derived from this software + without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, +BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING +IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ +#endregion + +using System; +using System.IO; +using System.Reflection; +using System.Text.RegularExpressions; + +using Prebuild.Core.Attributes; +using Prebuild.Core.Interfaces; +using Prebuild.Core.Nodes; +using Prebuild.Core.Utilities; + +namespace Prebuild.Core.Targets +{ + /// + /// + /// + [Target("xcode")] + public class XcodeTarget : ITarget + { + #region Fields + + private Kernel m_Kernel; + + #endregion + + #region Private Methods + + private static string PrependPath(string path) + { + string tmpPath = Helper.NormalizePath(path, '/'); + Regex regex = new Regex(@"(\w):/(\w+)"); + Match match = regex.Match(tmpPath); + //if(match.Success || tmpPath[0] == '.' || tmpPath[0] == '/') + //{ + tmpPath = Helper.NormalizePath(tmpPath); + //} + // else + // { + // tmpPath = Helper.NormalizePath("./" + tmpPath); + // } + + return tmpPath; + } + + private static string BuildReference(SolutionNode solution, ReferenceNode refr) + { + string ret = ""; + if (solution.ProjectsTable.ContainsKey(refr.Name)) + { + ProjectNode project = (ProjectNode)solution.ProjectsTable[refr.Name]; + string fileRef = FindFileReference(refr.Name, project); + string finalPath = Helper.NormalizePath(Helper.MakeFilePath(project.FullPath + "/${build.dir}/", refr.Name, "dll"), '/'); + ret += finalPath; + return ret; + } + else + { + ProjectNode project = (ProjectNode)refr.Parent; + string fileRef = FindFileReference(refr.Name, project); + + if (refr.Path != null || fileRef != null) + { + string finalPath = (refr.Path != null) ? Helper.NormalizePath(refr.Path + "/" + refr.Name + ".dll", '/') : fileRef; + ret += finalPath; + return ret; + } + + try + { + //Assembly assem = Assembly.Load(refr.Name); + //if (assem != null) + //{ + //ret += (refr.Name + ".dll"); + //} + //else + //{ + ret += (refr.Name + ".dll"); + //} + } + catch (System.NullReferenceException e) + { + e.ToString(); + ret += refr.Name + ".dll"; + } + } + return ret; + } + + private static string BuildReferencePath(SolutionNode solution, ReferenceNode refr) + { + string ret = ""; + if (solution.ProjectsTable.ContainsKey(refr.Name)) + { + ProjectNode project = (ProjectNode)solution.ProjectsTable[refr.Name]; + string fileRef = FindFileReference(refr.Name, project); + string finalPath = Helper.NormalizePath(Helper.MakeReferencePath(project.FullPath + "/${build.dir}/"), '/'); + ret += finalPath; + return ret; + } + else + { + ProjectNode project = (ProjectNode)refr.Parent; + string fileRef = FindFileReference(refr.Name, project); + + if (refr.Path != null || fileRef != null) + { + string finalPath = (refr.Path != null) ? Helper.NormalizePath(refr.Path, '/') : fileRef; + ret += finalPath; + return ret; + } + + try + { + Assembly assem = Assembly.Load(refr.Name); + if (assem != null) + { + ret += ""; + } + else + { + ret += ""; + } + } + catch (System.NullReferenceException e) + { + e.ToString(); + ret += ""; + } + } + return ret; + } + + private static string FindFileReference(string refName, ProjectNode project) + { + foreach (ReferencePathNode refPath in project.ReferencePaths) + { + string fullPath = Helper.MakeFilePath(refPath.Path, refName, "dll"); + + if (File.Exists(fullPath)) + { + return fullPath; + } + } + + return null; + } + + /// + /// Gets the XML doc file. + /// + /// The project. + /// The conf. + /// + public static string GetXmlDocFile(ProjectNode project, ConfigurationNode conf) + { + if (conf == null) + { + throw new ArgumentNullException("conf"); + } + if (project == null) + { + throw new ArgumentNullException("project"); + } + string docFile = (string)conf.Options["XmlDocFile"]; + // if(docFile != null && docFile.Length == 0)//default to assembly name if not specified + // { + // return Path.GetFileNameWithoutExtension(project.AssemblyName) + ".xml"; + // } + return docFile; + } + + private void WriteProject(SolutionNode solution, ProjectNode project) + { + string projFile = Helper.MakeFilePath(project.FullPath, project.Name + (project.Type == ProjectType.Library ? ".dll" : ".exe"), "build"); + StreamWriter ss = new StreamWriter(projFile); + + m_Kernel.CurrentWorkingDirectory.Push(); + Helper.SetCurrentDir(Path.GetDirectoryName(projFile)); + bool hasDoc = false; + + using (ss) + { + ss.WriteLine(""); + ss.WriteLine("", project.Name); + ss.WriteLine(" ", "build"); + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(" "); + foreach (ReferenceNode refr in project.References) + { + if (refr.LocalCopy) + { + ss.WriteLine(" ", '/')); + } + } + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.Write(" "); + ss.WriteLine(" ", project.RootNamespace); + foreach (string file in project.Files) + { + switch (project.Files.GetBuildAction(file)) + { + case BuildAction.EmbeddedResource: + ss.WriteLine(" {0}", ""); + break; + default: + if (project.Files.GetSubType(file) != SubType.Code && project.Files.GetSubType(file) != SubType.Settings) + { + ss.WriteLine(" ", file.Substring(0, file.LastIndexOf('.')) + ".resx"); + } + break; + } + } + //if (project.Files.GetSubType(file).ToString() != "Code") + //{ + // ps.WriteLine(" ", file.Substring(0, file.LastIndexOf('.')) + ".resx"); + + ss.WriteLine(" "); + ss.WriteLine(" "); + foreach (string file in project.Files) + { + switch (project.Files.GetBuildAction(file)) + { + case BuildAction.Compile: + ss.WriteLine(" "); + break; + default: + break; + } + } + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(" "); + foreach (ReferenceNode refr in project.References) + { + ss.WriteLine(" ", '/')); + } + ss.WriteLine(" "); + + ss.WriteLine(" "); + ss.WriteLine(" "); + + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(" "); + + ss.WriteLine(" "); + if (hasDoc) + { + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.Write(" "); + } + else + { + ss.WriteLine(".exe\" />"); + } + + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(" "); + // foreach(ReferenceNode refr in project.References) + // { + // string path = Helper.NormalizePath(Helper.MakePathRelativeTo(project.FullPath, BuildReferencePath(solution, refr)), '/'); + // if (path != "") + // { + // ss.WriteLine(" ", path); + // } + // } + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(" "); + } + ss.WriteLine(" "); + ss.WriteLine(""); + } + m_Kernel.CurrentWorkingDirectory.Pop(); + } + + private void WriteCombine(SolutionNode solution) + { + m_Kernel.Log.Write("Creating Xcode build files"); + foreach (ProjectNode project in solution.Projects) + { + if (m_Kernel.AllowProject(project.FilterGroups)) + { + m_Kernel.Log.Write("...Creating project: {0}", project.Name); + WriteProject(solution, project); + } + } + + m_Kernel.Log.Write(""); + DirectoryInfo directoryInfo = new DirectoryInfo(Path.Combine(solution.FullPath, solution.Name + ".xcodeproj")); + if (!directoryInfo.Exists) + { + directoryInfo.Create(); + } + string combFile = Helper.MakeFilePath(Path.Combine(solution.FullPath, solution.Name + ".xcodeproj"), "project", "pbxproj"); + StreamWriter ss = new StreamWriter(combFile); + + m_Kernel.CurrentWorkingDirectory.Push(); + Helper.SetCurrentDir(Path.GetDirectoryName(combFile)); + + using (ss) + { + ss.WriteLine(""); + ss.WriteLine("", solution.Name); + ss.WriteLine(" "); + ss.WriteLine(); + + //ss.WriteLine(" "); + //ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(" "); + + foreach (ConfigurationNode conf in solution.Configurations) + { + // Set the project.config to a non-debug configuration + if (conf.Options["DebugInformation"].ToString().ToLower() != "true") + { + ss.WriteLine(" ", conf.Name); + } + ss.WriteLine(); + ss.WriteLine(" ", conf.Name); + ss.WriteLine(" ", conf.Name); + ss.WriteLine(" ", conf.Options["DebugInformation"].ToString().ToLower()); + ss.WriteLine(" "); + ss.WriteLine(); + } + + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(); + + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(); + + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(); + + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(); + + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(); + + ss.WriteLine(" "); + ss.WriteLine(" "); + //ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(" "); + //foreach(ProjectNode project in solution.Projects) + //{ + // string path = Helper.MakePathRelativeTo(solution.FullPath, project.FullPath); + // ss.Write(" "); + //} + ss.WriteLine(" "); + ss.WriteLine(); + + ss.WriteLine(" "); + + foreach (ProjectNode project in solution.ProjectsTableOrder) + { + string path = Helper.MakePathRelativeTo(solution.FullPath, project.FullPath); + ss.Write(" "); + } + ss.WriteLine(" "); + ss.WriteLine(); + + ss.WriteLine(" "); + ss.WriteLine(); + ss.WriteLine(" "); + ss.WriteLine(); + //ss.WriteLine(" "); + ss.WriteLine(" "); + ss.WriteLine(); + + ss.WriteLine(" "); + ss.WriteLine(" "); + foreach (ProjectNode project in solution.Projects) + { + string path = Helper.MakePathRelativeTo(solution.FullPath, project.FullPath); + ss.Write(" "); + } + ss.WriteLine(" "); + ss.WriteLine(); + ss.WriteLine(""); + } + + m_Kernel.CurrentWorkingDirectory.Pop(); + } + + private void CleanProject(ProjectNode project) + { + m_Kernel.Log.Write("...Cleaning project: {0}", project.Name); + string projectFile = Helper.MakeFilePath(project.FullPath, project.Name + (project.Type == ProjectType.Library ? ".dll" : ".exe"), "build"); + Helper.DeleteIfExists(projectFile); + } + + private void CleanSolution(SolutionNode solution) + { + m_Kernel.Log.Write("Cleaning Xcode build files for", solution.Name); + + string slnFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "build"); + Helper.DeleteIfExists(slnFile); + + foreach (ProjectNode project in solution.Projects) + { + CleanProject(project); + } + + m_Kernel.Log.Write(""); + } + + #endregion + + #region ITarget Members + + /// + /// Writes the specified kern. + /// + /// The kern. + public void Write(Kernel kern) + { + if (kern == null) + { + throw new ArgumentNullException("kern"); + } + m_Kernel = kern; + foreach (SolutionNode solution in kern.Solutions) + { + WriteCombine(solution); + } + m_Kernel = null; + } + + /// + /// Cleans the specified kern. + /// + /// The kern. + public virtual void Clean(Kernel kern) + { + if (kern == null) + { + throw new ArgumentNullException("kern"); + } + m_Kernel = kern; + foreach (SolutionNode sol in kern.Solutions) + { + CleanSolution(sol); + } + m_Kernel = null; + } + + /// + /// Gets the name. + /// + /// The name. + public string Name + { + get + { + return "xcode"; + } + } + + #endregion + } +} diff --git a/Prebuild/src/Core/UnknownLanguageException.cs b/Prebuild/src/Core/UnknownLanguageException.cs new file mode 100644 index 0000000..607b66c --- /dev/null +++ b/Prebuild/src/Core/UnknownLanguageException.cs @@ -0,0 +1,63 @@ +/* + * $RCSfile$ + * Copyright (C) 2004, 2005 David Hudson (jendave@yahoo.com) + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +using System; +using System.Runtime.Serialization; + +namespace Prebuild.Core +{ + /// + /// + [Serializable()] + public class UnknownLanguageException : Exception + { + /// + /// Basic exception. + /// + public UnknownLanguageException() + { + } + + /// + /// Exception with specified string + /// + /// Exception message + public UnknownLanguageException(string message): base(message) + { + } + + /// + /// + /// + /// + /// + public UnknownLanguageException(string message, Exception exception) : base(message, exception) + { + } + + /// + /// + /// + /// + /// + protected UnknownLanguageException(SerializationInfo info, StreamingContext context) : base( info, context ) + { + } + } +} diff --git a/Prebuild/src/Core/Utilities/.svn/all-wcprops b/Prebuild/src/Core/Utilities/.svn/all-wcprops new file mode 100644 index 0000000..7418c29 --- /dev/null +++ b/Prebuild/src/Core/Utilities/.svn/all-wcprops @@ -0,0 +1,29 @@ +K 25 +svn:wc:ra_dav:version-url +V 60 +/svnroot/dnpb/!svn/ver/309/trunk/Prebuild/src/Core/Utilities +END +Helper.cs +K 25 +svn:wc:ra_dav:version-url +V 70 +/svnroot/dnpb/!svn/ver/307/trunk/Prebuild/src/Core/Utilities/Helper.cs +END +Log.cs +K 25 +svn:wc:ra_dav:version-url +V 67 +/svnroot/dnpb/!svn/ver/309/trunk/Prebuild/src/Core/Utilities/Log.cs +END +CommandLineCollection.cs +K 25 +svn:wc:ra_dav:version-url +V 85 +/svnroot/dnpb/!svn/ver/307/trunk/Prebuild/src/Core/Utilities/CommandLineCollection.cs +END +CurrentDirectory.cs +K 25 +svn:wc:ra_dav:version-url +V 80 +/svnroot/dnpb/!svn/ver/307/trunk/Prebuild/src/Core/Utilities/CurrentDirectory.cs +END diff --git a/Prebuild/src/Core/Utilities/.svn/dir-prop-base b/Prebuild/src/Core/Utilities/.svn/dir-prop-base new file mode 100644 index 0000000..a1989a0 --- /dev/null +++ b/Prebuild/src/Core/Utilities/.svn/dir-prop-base @@ -0,0 +1,5 @@ +K 10 +svn:ignore +V 5 +*.swp +END diff --git a/Prebuild/src/Core/Utilities/.svn/entries b/Prebuild/src/Core/Utilities/.svn/entries new file mode 100644 index 0000000..cc148d7 --- /dev/null +++ b/Prebuild/src/Core/Utilities/.svn/entries @@ -0,0 +1,164 @@ +10 + +dir +323 +https://dnpb.svn.sourceforge.net/svnroot/dnpb/trunk/Prebuild/src/Core/Utilities +https://dnpb.svn.sourceforge.net/svnroot/dnpb + + + +2009-04-15T01:40:10.014568Z +309 +kunnis +has-props + + + + + + + + + + + + + +3355ff64-970d-0410-bbe8-d0fbd18be4fb + +Helper.cs +file + + + + +2010-09-10T22:51:44.000000Z +7a0749dec0ce5453fc73dd11f89ce613 +2009-04-15T01:28:16.827957Z +307 +kunnis +has-props + + + + + + + + + + + + + + + + + + + + +14966 + +Log.cs +file + + + + +2010-09-10T22:51:44.000000Z +d91804d20a90778d74744cd14bb2fa4c +2009-04-15T01:40:10.014568Z +309 +kunnis +has-props + + + + + + + + + + + + + + + + + + + + +6100 + +CommandLineCollection.cs +file + + + + +2010-09-10T22:51:44.000000Z +2a00bed45ea425e5e8a21a5ff6a68d69 +2009-04-15T01:28:16.827957Z +307 +kunnis +has-props + + + + + + + + + + + + + + + + + + + + +4032 + +CurrentDirectory.cs +file + + + + +2010-09-10T22:51:44.000000Z +e710723e685cc628a3761209001c8767 +2009-04-15T01:28:16.827957Z +307 +kunnis +has-props + + + + + + + + + + + + + + + + + + + + +2124 + diff --git a/Prebuild/src/Core/Utilities/.svn/prop-base/CommandLineCollection.cs.svn-base b/Prebuild/src/Core/Utilities/.svn/prop-base/CommandLineCollection.cs.svn-base new file mode 100644 index 0000000..7b57b30 --- /dev/null +++ b/Prebuild/src/Core/Utilities/.svn/prop-base/CommandLineCollection.cs.svn-base @@ -0,0 +1,9 @@ +K 13 +svn:eol-style +V 6 +native +K 12 +svn:keywords +V 23 +Author Date Id Revision +END diff --git a/Prebuild/src/Core/Utilities/.svn/prop-base/CurrentDirectory.cs.svn-base b/Prebuild/src/Core/Utilities/.svn/prop-base/CurrentDirectory.cs.svn-base new file mode 100644 index 0000000..7b57b30 --- /dev/null +++ b/Prebuild/src/Core/Utilities/.svn/prop-base/CurrentDirectory.cs.svn-base @@ -0,0 +1,9 @@ +K 13 +svn:eol-style +V 6 +native +K 12 +svn:keywords +V 23 +Author Date Id Revision +END diff --git a/Prebuild/src/Core/Utilities/.svn/prop-base/Helper.cs.svn-base b/Prebuild/src/Core/Utilities/.svn/prop-base/Helper.cs.svn-base new file mode 100644 index 0000000..7b57b30 --- /dev/null +++ b/Prebuild/src/Core/Utilities/.svn/prop-base/Helper.cs.svn-base @@ -0,0 +1,9 @@ +K 13 +svn:eol-style +V 6 +native +K 12 +svn:keywords +V 23 +Author Date Id Revision +END diff --git a/Prebuild/src/Core/Utilities/.svn/prop-base/Log.cs.svn-base b/Prebuild/src/Core/Utilities/.svn/prop-base/Log.cs.svn-base new file mode 100644 index 0000000..7b57b30 --- /dev/null +++ b/Prebuild/src/Core/Utilities/.svn/prop-base/Log.cs.svn-base @@ -0,0 +1,9 @@ +K 13 +svn:eol-style +V 6 +native +K 12 +svn:keywords +V 23 +Author Date Id Revision +END diff --git a/Prebuild/src/Core/Utilities/.svn/text-base/CommandLineCollection.cs.svn-base b/Prebuild/src/Core/Utilities/.svn/text-base/CommandLineCollection.cs.svn-base new file mode 100644 index 0000000..786fa1e --- /dev/null +++ b/Prebuild/src/Core/Utilities/.svn/text-base/CommandLineCollection.cs.svn-base @@ -0,0 +1,152 @@ +#region BSD License +/* +Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com) + +Redistribution and use in source and binary forms, with or without modification, are permitted +provided that the following conditions are met: + +* Redistributions of source code must retain the above copyright notice, this list of conditions + and the following disclaimer. +* Redistributions in binary form must reproduce the above copyright notice, this list of conditions + and the following disclaimer in the documentation and/or other materials provided with the + distribution. +* The name of the author may not be used to endorse or promote products derived from this software + without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, +BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING +IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ +#endregion + +using System.Collections; +using System.Collections.Generic; + +namespace Prebuild.Core.Utilities +{ + /// + /// The CommandLine class parses and interprets the command-line arguments passed to + /// prebuild. + /// + public class CommandLineCollection : IEnumerable> + { + #region Fields + + // The raw OS arguments + private readonly string[] m_RawArgs; + + // Command-line argument storage + private readonly Dictionary m_Arguments = new Dictionary(); + + #endregion + + #region Constructors + + /// + /// Create a new CommandLine instance and set some internal variables. + /// + public CommandLineCollection(string[] args) + { + m_RawArgs = args; + + Parse(); + } + + #endregion + + #region Private Methods + + private void Parse() + { + if(m_RawArgs.Length < 1) + return; + + int idx = 0; + string lastArg = null; + + while(idx 2 && arg[0] == '/') + { + arg = arg.Substring(1); + lastArg = arg; + m_Arguments[arg] = ""; + } + else + { + if(lastArg != null) + { + m_Arguments[lastArg] = arg; + lastArg = null; + } + } + + idx++; + } + } + + #endregion + + #region Public Methods + + /// + /// Wases the passed. + /// + /// The arg. + /// + public bool WasPassed(string arg) + { + return (m_Arguments.ContainsKey(arg)); + } + + #endregion + + #region Properties + + /// + /// Gets the parameter associated with the command line option + /// + /// Returns null if option was not specified, + /// null string if no parameter was specified, and the value if a parameter was specified + public string this[string index] + { + get + { + if(m_Arguments.ContainsKey(index)) + { + return (m_Arguments[index]); + } + return null; + } + } + + #endregion + + #region IEnumerable Members + + /// + /// Returns an enumerator that can iterate through a collection. + /// + /// + /// An + /// that can be used to iterate through the collection. + /// + public IEnumerator> GetEnumerator() + { + return m_Arguments.GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetEnumerator(); + } + + #endregion + } +} diff --git a/Prebuild/src/Core/Utilities/.svn/text-base/CurrentDirectory.cs.svn-base b/Prebuild/src/Core/Utilities/.svn/text-base/CurrentDirectory.cs.svn-base new file mode 100644 index 0000000..9624c35 --- /dev/null +++ b/Prebuild/src/Core/Utilities/.svn/text-base/CurrentDirectory.cs.svn-base @@ -0,0 +1,68 @@ +#region BSD License +/* +Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com) + +Redistribution and use in source and binary forms, with or without modification, are permitted +provided that the following conditions are met: + +* Redistributions of source code must retain the above copyright notice, this list of conditions + and the following disclaimer. +* Redistributions in binary form must reproduce the above copyright notice, this list of conditions + and the following disclaimer in the documentation and/or other materials provided with the + distribution. +* The name of the author may not be used to endorse or promote products derived from this software + without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, +BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING +IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ +#endregion + +using System; +using System.Collections.Generic; + +namespace Prebuild.Core.Utilities +{ + /// + /// + /// + public class CurrentDirectory + { + #region Fields + + private readonly Stack m_Stack = new Stack(); + + #endregion + + #region Public Methods + + /// + /// Pushes this instance. + /// + public void Push() + { + m_Stack.Push(Environment.CurrentDirectory); + } + + /// + /// Pops this instance. + /// + public void Pop() + { + if(m_Stack.Count < 1) + { + return; + } + + string cwd = m_Stack.Pop(); + Helper.SetCurrentDir(cwd); + } + + #endregion + } +} diff --git a/Prebuild/src/Core/Utilities/.svn/text-base/Helper.cs.svn-base b/Prebuild/src/Core/Utilities/.svn/text-base/Helper.cs.svn-base new file mode 100644 index 0000000..8c3e968 --- /dev/null +++ b/Prebuild/src/Core/Utilities/.svn/text-base/Helper.cs.svn-base @@ -0,0 +1,575 @@ +#region BSD License +/* +Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com) + +Redistribution and use in source and binary forms, with or without modification, are permitted +provided that the following conditions are met: + +* Redistributions of source code must retain the above copyright notice, this list of conditions + and the following disclaimer. +* Redistributions in binary form must reproduce the above copyright notice, this list of conditions + and the following disclaimer in the documentation and/or other materials provided with the + distribution. +* The name of the author may not be used to endorse or promote products derived from this software + without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, +BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING +IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ +#endregion + +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.IO; +using System.Runtime.InteropServices; +using System.Text.RegularExpressions; +using System.Collections.Specialized; +using System.Xml; +using Prebuild.Core.Nodes; + +namespace Prebuild.Core.Utilities +{ + /// + /// + /// + public class Helper + { + #region Fields + + static bool checkForOSVariables; + + /// + /// + /// + public static bool CheckForOSVariables + { + get + { + return checkForOSVariables; + } + set + { + checkForOSVariables = value; + } + } + + #endregion + + #region Public Methods + + #region String Parsing + + public delegate string StringLookup(string key); + + /// + /// Gets a collection of StringLocationPair objects that represent the matches + /// + /// The target. + /// The before group. + /// The after group. + /// if set to true [include delimiters in substrings]. + /// + public static StringCollection FindGroups(string target, string beforeGroup, string afterGroup, bool includeDelimitersInSubstrings) + { + if( beforeGroup == null ) + { + throw new ArgumentNullException("beforeGroup"); + } + if( afterGroup == null ) + { + throw new ArgumentNullException("afterGroup"); + } + StringCollection results = new StringCollection(); + if(target == null || target.Length == 0) + { + return results; + } + + int beforeMod = 0; + int afterMod = 0; + if(includeDelimitersInSubstrings) + { + //be sure to not exlude the delims + beforeMod = beforeGroup.Length; + afterMod = afterGroup.Length; + } + int startIndex = 0; + while((startIndex = target.IndexOf(beforeGroup,startIndex)) != -1) { + int endIndex = target.IndexOf(afterGroup,startIndex);//the index of the char after it + if(endIndex == -1) + { + break; + } + int length = endIndex - startIndex - beforeGroup.Length;//move to the first char in the string + string substring = substring = target.Substring(startIndex + beforeGroup.Length - beforeMod, + length - afterMod); + + results.Add(substring); + //results.Add(new StringLocationPair(substring,startIndex)); + startIndex = endIndex + 1; + //the Interpolate*() methods will not work if expressions are expandded inside expression due to an optimization + //so start after endIndex + + } + return results; + } + + /// + /// Replaces the groups. + /// + /// The target. + /// The before group. + /// The after group. + /// The lookup. + /// + public static string ReplaceGroups(string target, string beforeGroup, string afterGroup, StringLookup lookup) { + if( target == null ) + { + throw new ArgumentNullException("target"); + } + //int targetLength = target.Length; + StringCollection strings = FindGroups(target,beforeGroup,afterGroup,false); + if( lookup == null ) + { + throw new ArgumentNullException("lookup"); + } + foreach(string substring in strings) + { + target = target.Replace(beforeGroup + substring + afterGroup, lookup(substring) ); + } + return target; + } + + /// + /// Replaces ${var} statements in a string with the corresonding values as detirmined by the lookup delegate + /// + /// The target. + /// The lookup. + /// + public static string InterpolateForVariables(string target, StringLookup lookup) + { + return ReplaceGroups(target, "${" , "}" , lookup); + } + + /// + /// Replaces ${var} statements in a string with the corresonding environment variable with name var + /// + /// + /// + public static string InterpolateForEnvironmentVariables(string target) + { + return InterpolateForVariables(target, new StringLookup(Environment.GetEnvironmentVariable)); + } + + #endregion + + /// + /// Translates the value. + /// + /// Type of the translate. + /// The translation item. + /// + public static object TranslateValue(Type translateType, string translationItem) + { + if(translationItem == null) + { + return null; + } + + try + { + string lowerVal = translationItem.ToLower(); + if(translateType == typeof(bool)) + { + return (lowerVal == "true" || lowerVal == "1" || lowerVal == "y" || lowerVal == "yes" || lowerVal == "on"); + } + else if(translateType == typeof(int)) + { + return (Int32.Parse(translationItem)); + } + else + { + return translationItem; + } + } + catch(FormatException) + { + return null; + } + } + + /// + /// Deletes if exists. + /// + /// The file. + /// + public static bool DeleteIfExists(string file) + { + string resFile = null; + try + { + resFile = ResolvePath(file); + } + catch(ArgumentException) + { + return false; + } + + if(!File.Exists(resFile)) + { + return false; + } + + File.Delete(resFile); + return true; + } + + static readonly char seperator = Path.DirectorySeparatorChar; + + // This little gem was taken from the NeL source, thanks guys! + /// + /// Makes a relative path + /// + /// Path to start from + /// Path to end at + /// Path that will get from startPath to endPath + public static string MakePathRelativeTo(string startPath, string endPath) + { + string tmp = NormalizePath(startPath, seperator); + string src = NormalizePath(endPath, seperator); + string prefix = ""; + + while(true) + { + if((String.Compare(tmp, 0, src, 0, tmp.Length) == 0)) + { + string ret; + int size = tmp.Length; + if(size == src.Length) + { + return "./"; + } + if((src.Length > tmp.Length) && src[tmp.Length - 1] != seperator) + { + } + else + { + ret = prefix + endPath.Substring(size, endPath.Length - size); + ret = ret.Trim(); + if(ret[0] == seperator) + { + ret = "." + ret; + } + + return NormalizePath(ret); + } + + } + + if(tmp.Length < 2) + { + break; + } + + int lastPos = tmp.LastIndexOf(seperator, tmp.Length - 2); + int prevPos = tmp.IndexOf(seperator); + + if((lastPos == prevPos) || (lastPos == -1)) + { + break; + } + + tmp = tmp.Substring(0, lastPos + 1); + prefix += ".." + seperator.ToString(); + } + + return endPath; + } + + /// + /// Resolves the path. + /// + /// The path. + /// + public static string ResolvePath(string path) + { + string tmpPath = NormalizePath(path); + if(tmpPath.Length < 1) + { + tmpPath = "."; + } + + tmpPath = Path.GetFullPath(tmpPath); + if(!File.Exists(tmpPath) && !Directory.Exists(tmpPath)) + { + throw new ArgumentException("Path could not be resolved: " + tmpPath); + } + + return tmpPath; + } + + /// + /// Normalizes the path. + /// + /// The path. + /// The separator character. + /// + public static string NormalizePath(string path, char separatorCharacter) + { + if(path == null || path == "" || path.Length < 1) + { + return ""; + } + + string tmpPath = path.Replace('\\', '/'); + tmpPath = tmpPath.Replace('/', separatorCharacter); + return tmpPath; + } + + /// + /// Normalizes the path. + /// + /// The path. + /// + public static string NormalizePath(string path) + { + return NormalizePath(path, Path.DirectorySeparatorChar); + } + + /// + /// Ends the path. + /// + /// The path. + /// The separator character. + /// + public static string EndPath(string path, char separatorCharacter) + { + if(path == null || path == "" || path.Length < 1) + { + return ""; + } + + if(!path.EndsWith(separatorCharacter.ToString())) + { + return (path + separatorCharacter); + } + + return path; + } + + /// + /// Ends the path. + /// + /// The path. + /// + public static string EndPath(string path) + { + return EndPath(path, Path.DirectorySeparatorChar); + } + + /// + /// Makes the file path. + /// + /// The path. + /// The name. + /// The ext. + /// + public static string MakeFilePath(string path, string name, string ext) + { + string ret = EndPath(NormalizePath(path)); + + if( name == null ) + { + throw new ArgumentNullException("name"); + } + + ret += name; + if(!name.EndsWith("." + ext)) + { + ret += "." + ext; + } + + //foreach(char c in Path.GetInvalidPathChars()) + //{ + // ret = ret.Replace(c, '_'); + //} + + return ret; + } + + /// + /// Makes the file path. + /// + /// The path. + /// The name. + /// + public static string MakeFilePath(string path, string name) + { + string ret = EndPath(NormalizePath(path)); + + if( name == null ) + { + throw new ArgumentNullException("name"); + } + + ret += name; + + //foreach (char c in Path.GetInvalidPathChars()) + //{ + // ret = ret.Replace(c, '_'); + //} + + return ret; + } + + /// + /// + /// + /// + /// + public static string MakeReferencePath(string path) + { + string ret = EndPath(NormalizePath(path)); + + //foreach (char c in Path.GetInvalidPathChars()) + //{ + // ret = ret.Replace(c, '_'); + //} + + return ret; + } + + /// + /// Sets the current dir. + /// + /// The path. + public static void SetCurrentDir(string path) + { + if( path == null ) + { + throw new ArgumentNullException("path"); + } + if(path.Length < 1) + { + return; + } + + Environment.CurrentDirectory = path; + } + + /// + /// Checks the type. + /// + /// The type to check. + /// The attr. + /// The inter. + /// + public static object CheckType(Type typeToCheck, Type attr, Type inter) + { + if(typeToCheck == null || attr == null) + { + return null; + } + + object[] attrs = typeToCheck.GetCustomAttributes(attr, false); + if(attrs == null || attrs.Length < 1) + { + return null; + } + if( inter == null ) + { + throw new ArgumentNullException("inter"); + } + + if(typeToCheck.GetInterface(inter.FullName) == null) + { + return null; + } + + return attrs[0]; + } + + /// + /// Attributes the value. + /// + /// The node. + /// The attr. + /// The def. + /// + public static string AttributeValue(XmlNode node, string attr, string def) + { + if( node == null ) + { + throw new ArgumentNullException("node"); + } + if(node.Attributes[attr] == null) + { + return def; + } + string val = node.Attributes[attr].Value; + if(!CheckForOSVariables) + { + return val; + } + + return InterpolateForEnvironmentVariables(val); + } + + /// + /// Parses the boolean. + /// + /// The node. + /// The attr. + /// if set to true [default value]. + /// + public static bool ParseBoolean(XmlNode node, string attr, bool defaultValue) + { + if( node == null ) + { + throw new ArgumentNullException("node"); + } + if(node.Attributes[attr] == null) + { + return defaultValue; + } + return bool.Parse(node.Attributes[attr].Value); + } + + /// + /// Enums the attribute value. + /// + /// The node. + /// The attr. + /// Type of the enum. + /// The def. + /// + public static object EnumAttributeValue(XmlNode node, string attr, Type enumType, object def) + { + if( def == null ) + { + throw new ArgumentNullException("def"); + } + string val = AttributeValue(node, attr, def.ToString()); + return Enum.Parse(enumType, val, true); + } + + /// + /// + /// + /// + /// + /// + public static string AssemblyFullName(string assemblyName, ProjectType projectType) + { + return assemblyName + (projectType == ProjectType.Library ? ".dll" : ".exe"); + } + + #endregion + } +} diff --git a/Prebuild/src/Core/Utilities/.svn/text-base/Log.cs.svn-base b/Prebuild/src/Core/Utilities/.svn/text-base/Log.cs.svn-base new file mode 100644 index 0000000..4df3def --- /dev/null +++ b/Prebuild/src/Core/Utilities/.svn/text-base/Log.cs.svn-base @@ -0,0 +1,276 @@ +#region BSD License +/* +Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com) + +Redistribution and use in source and binary forms, with or without modification, are permitted +provided that the following conditions are met: + +* Redistributions of source code must retain the above copyright notice, this list of conditions + and the following disclaimer. +* Redistributions in binary form must reproduce the above copyright notice, this list of conditions + and the following disclaimer in the documentation and/or other materials provided with the + distribution. +* The name of the author may not be used to endorse or promote products derived from this software + without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, +BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING +IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ +#endregion + +using System; +using System.IO; + +namespace Prebuild.Core.Utilities +{ + /// + /// + /// + public enum LogType + { + /// + /// + /// + None, + /// + /// + /// + Info, + /// + /// + /// + Warning, + /// + /// + /// + Error + } + + /// + /// + /// + [Flags] + public enum LogTargets + { + /// + /// + /// + None = 0, + /// + /// + /// + Null = 1, + /// + /// + /// + File = 2, + /// + /// + /// + Console = 4 + } + + /// + /// Summary description for Log. + /// + public class Log : IDisposable + { + #region Fields + + private TextWriter m_Writer; + private LogTargets m_Target = LogTargets.Null; + bool disposed; + + #endregion + + #region Constructors + + /// + /// Initializes a new instance of the class. + /// + /// The target. + /// Name of the file. + public Log(LogTargets target, string fileName) + { + m_Target = target; + + if ((m_Target & LogTargets.File) != 0) + { + m_Writer = new StreamWriter(fileName, false); + } + else if ((m_Target & LogTargets.Console) != 0) + { + // Prevents null reference exceptions when outputing to the log file. + // This seems to only happen when running on a network drive. + m_Writer = Console.Out; + } + } + + #endregion + + #region Public Methods + + /// + /// Writes this instance. + /// + public void Write() + { + Write(string.Empty); + } + + /// + /// Writes the specified MSG. + /// + /// The MSG. + public void Write(string msg) + { + if((m_Target & LogTargets.Null) != 0) + { + return; + } + + if((m_Target & LogTargets.Console) != 0) + { + Console.WriteLine(msg); + } + if((m_Target & LogTargets.File) != 0 && m_Writer != null) + { + m_Writer.WriteLine(msg); + } + } + + /// + /// Writes the specified format. + /// + /// The format. + /// The args. + public void Write(string format, params object[] args) + { + Write(string.Format(format,args)); + } + + /// + /// Writes the specified type. + /// + /// The type. + /// The format. + /// The args. + public void Write(LogType type, string format, params object[] args) + { + if((m_Target & LogTargets.Null) != 0) + { + return; + } + + string str = ""; + switch(type) + { + case LogType.Info: + str = "[I] "; + break; + case LogType.Warning: + str = "[!] "; + break; + case LogType.Error: + str = "[X] "; + break; + } + + Write(str + format,args); + } + + /// + /// Writes the exception. + /// + /// The type. + /// The ex. + public void WriteException(LogType type, Exception ex) + { + if(ex != null) + { + Write(type, ex.Message); + //#if DEBUG + m_Writer.WriteLine("Exception @{0} stack trace [[", ex.TargetSite.Name); + m_Writer.WriteLine(ex.StackTrace); + m_Writer.WriteLine("]]"); + //#endif + } + } + + /// + /// Flushes this instance. + /// + public void Flush() + { + if(m_Writer != null) + { + m_Writer.Flush(); + } + } + + #endregion + + #region IDisposable Members + + /// + /// Performs application-defined tasks associated with freeing, releasing, or + /// resetting unmanaged resources. + /// + public void Dispose() + { + Dispose(true); + GC.SuppressFinalize(this); + } + + /// + /// Dispose objects + /// + /// + /// If true, it will dispose close the handle + /// + /// + /// Will dispose managed and unmanaged resources. + /// + protected virtual void Dispose(bool disposing) + { + if (!this.disposed) + { + if (disposing) + { + if (m_Writer != null) + { + m_Writer.Close(); + m_Writer = null; + } + } + } + this.disposed = true; + } + + /// + /// + /// + ~Log() + { + this.Dispose(false); + } + + /// + /// Closes and destroys this object + /// + /// + /// Same as Dispose(true) + /// + public void Close() + { + Dispose(); + } + + #endregion + } +} diff --git a/Prebuild/src/Core/Utilities/CommandLineCollection.cs b/Prebuild/src/Core/Utilities/CommandLineCollection.cs new file mode 100644 index 0000000..786fa1e --- /dev/null +++ b/Prebuild/src/Core/Utilities/CommandLineCollection.cs @@ -0,0 +1,152 @@ +#region BSD License +/* +Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com) + +Redistribution and use in source and binary forms, with or without modification, are permitted +provided that the following conditions are met: + +* Redistributions of source code must retain the above copyright notice, this list of conditions + and the following disclaimer. +* Redistributions in binary form must reproduce the above copyright notice, this list of conditions + and the following disclaimer in the documentation and/or other materials provided with the + distribution. +* The name of the author may not be used to endorse or promote products derived from this software + without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, +BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING +IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ +#endregion + +using System.Collections; +using System.Collections.Generic; + +namespace Prebuild.Core.Utilities +{ + /// + /// The CommandLine class parses and interprets the command-line arguments passed to + /// prebuild. + /// + public class CommandLineCollection : IEnumerable> + { + #region Fields + + // The raw OS arguments + private readonly string[] m_RawArgs; + + // Command-line argument storage + private readonly Dictionary m_Arguments = new Dictionary(); + + #endregion + + #region Constructors + + /// + /// Create a new CommandLine instance and set some internal variables. + /// + public CommandLineCollection(string[] args) + { + m_RawArgs = args; + + Parse(); + } + + #endregion + + #region Private Methods + + private void Parse() + { + if(m_RawArgs.Length < 1) + return; + + int idx = 0; + string lastArg = null; + + while(idx 2 && arg[0] == '/') + { + arg = arg.Substring(1); + lastArg = arg; + m_Arguments[arg] = ""; + } + else + { + if(lastArg != null) + { + m_Arguments[lastArg] = arg; + lastArg = null; + } + } + + idx++; + } + } + + #endregion + + #region Public Methods + + /// + /// Wases the passed. + /// + /// The arg. + /// + public bool WasPassed(string arg) + { + return (m_Arguments.ContainsKey(arg)); + } + + #endregion + + #region Properties + + /// + /// Gets the parameter associated with the command line option + /// + /// Returns null if option was not specified, + /// null string if no parameter was specified, and the value if a parameter was specified + public string this[string index] + { + get + { + if(m_Arguments.ContainsKey(index)) + { + return (m_Arguments[index]); + } + return null; + } + } + + #endregion + + #region IEnumerable Members + + /// + /// Returns an enumerator that can iterate through a collection. + /// + /// + /// An + /// that can be used to iterate through the collection. + /// + public IEnumerator> GetEnumerator() + { + return m_Arguments.GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetEnumerator(); + } + + #endregion + } +} diff --git a/Prebuild/src/Core/Utilities/CurrentDirectory.cs b/Prebuild/src/Core/Utilities/CurrentDirectory.cs new file mode 100644 index 0000000..9624c35 --- /dev/null +++ b/Prebuild/src/Core/Utilities/CurrentDirectory.cs @@ -0,0 +1,68 @@ +#region BSD License +/* +Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com) + +Redistribution and use in source and binary forms, with or without modification, are permitted +provided that the following conditions are met: + +* Redistributions of source code must retain the above copyright notice, this list of conditions + and the following disclaimer. +* Redistributions in binary form must reproduce the above copyright notice, this list of conditions + and the following disclaimer in the documentation and/or other materials provided with the + distribution. +* The name of the author may not be used to endorse or promote products derived from this software + without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, +BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING +IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ +#endregion + +using System; +using System.Collections.Generic; + +namespace Prebuild.Core.Utilities +{ + /// + /// + /// + public class CurrentDirectory + { + #region Fields + + private readonly Stack m_Stack = new Stack(); + + #endregion + + #region Public Methods + + /// + /// Pushes this instance. + /// + public void Push() + { + m_Stack.Push(Environment.CurrentDirectory); + } + + /// + /// Pops this instance. + /// + public void Pop() + { + if(m_Stack.Count < 1) + { + return; + } + + string cwd = m_Stack.Pop(); + Helper.SetCurrentDir(cwd); + } + + #endregion + } +} diff --git a/Prebuild/src/Core/Utilities/Helper.cs b/Prebuild/src/Core/Utilities/Helper.cs new file mode 100644 index 0000000..8c3e968 --- /dev/null +++ b/Prebuild/src/Core/Utilities/Helper.cs @@ -0,0 +1,575 @@ +#region BSD License +/* +Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com) + +Redistribution and use in source and binary forms, with or without modification, are permitted +provided that the following conditions are met: + +* Redistributions of source code must retain the above copyright notice, this list of conditions + and the following disclaimer. +* Redistributions in binary form must reproduce the above copyright notice, this list of conditions + and the following disclaimer in the documentation and/or other materials provided with the + distribution. +* The name of the author may not be used to endorse or promote products derived from this software + without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, +BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING +IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ +#endregion + +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.IO; +using System.Runtime.InteropServices; +using System.Text.RegularExpressions; +using System.Collections.Specialized; +using System.Xml; +using Prebuild.Core.Nodes; + +namespace Prebuild.Core.Utilities +{ + /// + /// + /// + public class Helper + { + #region Fields + + static bool checkForOSVariables; + + /// + /// + /// + public static bool CheckForOSVariables + { + get + { + return checkForOSVariables; + } + set + { + checkForOSVariables = value; + } + } + + #endregion + + #region Public Methods + + #region String Parsing + + public delegate string StringLookup(string key); + + /// + /// Gets a collection of StringLocationPair objects that represent the matches + /// + /// The target. + /// The before group. + /// The after group. + /// if set to true [include delimiters in substrings]. + /// + public static StringCollection FindGroups(string target, string beforeGroup, string afterGroup, bool includeDelimitersInSubstrings) + { + if( beforeGroup == null ) + { + throw new ArgumentNullException("beforeGroup"); + } + if( afterGroup == null ) + { + throw new ArgumentNullException("afterGroup"); + } + StringCollection results = new StringCollection(); + if(target == null || target.Length == 0) + { + return results; + } + + int beforeMod = 0; + int afterMod = 0; + if(includeDelimitersInSubstrings) + { + //be sure to not exlude the delims + beforeMod = beforeGroup.Length; + afterMod = afterGroup.Length; + } + int startIndex = 0; + while((startIndex = target.IndexOf(beforeGroup,startIndex)) != -1) { + int endIndex = target.IndexOf(afterGroup,startIndex);//the index of the char after it + if(endIndex == -1) + { + break; + } + int length = endIndex - startIndex - beforeGroup.Length;//move to the first char in the string + string substring = substring = target.Substring(startIndex + beforeGroup.Length - beforeMod, + length - afterMod); + + results.Add(substring); + //results.Add(new StringLocationPair(substring,startIndex)); + startIndex = endIndex + 1; + //the Interpolate*() methods will not work if expressions are expandded inside expression due to an optimization + //so start after endIndex + + } + return results; + } + + /// + /// Replaces the groups. + /// + /// The target. + /// The before group. + /// The after group. + /// The lookup. + /// + public static string ReplaceGroups(string target, string beforeGroup, string afterGroup, StringLookup lookup) { + if( target == null ) + { + throw new ArgumentNullException("target"); + } + //int targetLength = target.Length; + StringCollection strings = FindGroups(target,beforeGroup,afterGroup,false); + if( lookup == null ) + { + throw new ArgumentNullException("lookup"); + } + foreach(string substring in strings) + { + target = target.Replace(beforeGroup + substring + afterGroup, lookup(substring) ); + } + return target; + } + + /// + /// Replaces ${var} statements in a string with the corresonding values as detirmined by the lookup delegate + /// + /// The target. + /// The lookup. + /// + public static string InterpolateForVariables(string target, StringLookup lookup) + { + return ReplaceGroups(target, "${" , "}" , lookup); + } + + /// + /// Replaces ${var} statements in a string with the corresonding environment variable with name var + /// + /// + /// + public static string InterpolateForEnvironmentVariables(string target) + { + return InterpolateForVariables(target, new StringLookup(Environment.GetEnvironmentVariable)); + } + + #endregion + + /// + /// Translates the value. + /// + /// Type of the translate. + /// The translation item. + /// + public static object TranslateValue(Type translateType, string translationItem) + { + if(translationItem == null) + { + return null; + } + + try + { + string lowerVal = translationItem.ToLower(); + if(translateType == typeof(bool)) + { + return (lowerVal == "true" || lowerVal == "1" || lowerVal == "y" || lowerVal == "yes" || lowerVal == "on"); + } + else if(translateType == typeof(int)) + { + return (Int32.Parse(translationItem)); + } + else + { + return translationItem; + } + } + catch(FormatException) + { + return null; + } + } + + /// + /// Deletes if exists. + /// + /// The file. + /// + public static bool DeleteIfExists(string file) + { + string resFile = null; + try + { + resFile = ResolvePath(file); + } + catch(ArgumentException) + { + return false; + } + + if(!File.Exists(resFile)) + { + return false; + } + + File.Delete(resFile); + return true; + } + + static readonly char seperator = Path.DirectorySeparatorChar; + + // This little gem was taken from the NeL source, thanks guys! + /// + /// Makes a relative path + /// + /// Path to start from + /// Path to end at + /// Path that will get from startPath to endPath + public static string MakePathRelativeTo(string startPath, string endPath) + { + string tmp = NormalizePath(startPath, seperator); + string src = NormalizePath(endPath, seperator); + string prefix = ""; + + while(true) + { + if((String.Compare(tmp, 0, src, 0, tmp.Length) == 0)) + { + string ret; + int size = tmp.Length; + if(size == src.Length) + { + return "./"; + } + if((src.Length > tmp.Length) && src[tmp.Length - 1] != seperator) + { + } + else + { + ret = prefix + endPath.Substring(size, endPath.Length - size); + ret = ret.Trim(); + if(ret[0] == seperator) + { + ret = "." + ret; + } + + return NormalizePath(ret); + } + + } + + if(tmp.Length < 2) + { + break; + } + + int lastPos = tmp.LastIndexOf(seperator, tmp.Length - 2); + int prevPos = tmp.IndexOf(seperator); + + if((lastPos == prevPos) || (lastPos == -1)) + { + break; + } + + tmp = tmp.Substring(0, lastPos + 1); + prefix += ".." + seperator.ToString(); + } + + return endPath; + } + + /// + /// Resolves the path. + /// + /// The path. + /// + public static string ResolvePath(string path) + { + string tmpPath = NormalizePath(path); + if(tmpPath.Length < 1) + { + tmpPath = "."; + } + + tmpPath = Path.GetFullPath(tmpPath); + if(!File.Exists(tmpPath) && !Directory.Exists(tmpPath)) + { + throw new ArgumentException("Path could not be resolved: " + tmpPath); + } + + return tmpPath; + } + + /// + /// Normalizes the path. + /// + /// The path. + /// The separator character. + /// + public static string NormalizePath(string path, char separatorCharacter) + { + if(path == null || path == "" || path.Length < 1) + { + return ""; + } + + string tmpPath = path.Replace('\\', '/'); + tmpPath = tmpPath.Replace('/', separatorCharacter); + return tmpPath; + } + + /// + /// Normalizes the path. + /// + /// The path. + /// + public static string NormalizePath(string path) + { + return NormalizePath(path, Path.DirectorySeparatorChar); + } + + /// + /// Ends the path. + /// + /// The path. + /// The separator character. + /// + public static string EndPath(string path, char separatorCharacter) + { + if(path == null || path == "" || path.Length < 1) + { + return ""; + } + + if(!path.EndsWith(separatorCharacter.ToString())) + { + return (path + separatorCharacter); + } + + return path; + } + + /// + /// Ends the path. + /// + /// The path. + /// + public static string EndPath(string path) + { + return EndPath(path, Path.DirectorySeparatorChar); + } + + /// + /// Makes the file path. + /// + /// The path. + /// The name. + /// The ext. + /// + public static string MakeFilePath(string path, string name, string ext) + { + string ret = EndPath(NormalizePath(path)); + + if( name == null ) + { + throw new ArgumentNullException("name"); + } + + ret += name; + if(!name.EndsWith("." + ext)) + { + ret += "." + ext; + } + + //foreach(char c in Path.GetInvalidPathChars()) + //{ + // ret = ret.Replace(c, '_'); + //} + + return ret; + } + + /// + /// Makes the file path. + /// + /// The path. + /// The name. + /// + public static string MakeFilePath(string path, string name) + { + string ret = EndPath(NormalizePath(path)); + + if( name == null ) + { + throw new ArgumentNullException("name"); + } + + ret += name; + + //foreach (char c in Path.GetInvalidPathChars()) + //{ + // ret = ret.Replace(c, '_'); + //} + + return ret; + } + + /// + /// + /// + /// + /// + public static string MakeReferencePath(string path) + { + string ret = EndPath(NormalizePath(path)); + + //foreach (char c in Path.GetInvalidPathChars()) + //{ + // ret = ret.Replace(c, '_'); + //} + + return ret; + } + + /// + /// Sets the current dir. + /// + /// The path. + public static void SetCurrentDir(string path) + { + if( path == null ) + { + throw new ArgumentNullException("path"); + } + if(path.Length < 1) + { + return; + } + + Environment.CurrentDirectory = path; + } + + /// + /// Checks the type. + /// + /// The type to check. + /// The attr. + /// The inter. + /// + public static object CheckType(Type typeToCheck, Type attr, Type inter) + { + if(typeToCheck == null || attr == null) + { + return null; + } + + object[] attrs = typeToCheck.GetCustomAttributes(attr, false); + if(attrs == null || attrs.Length < 1) + { + return null; + } + if( inter == null ) + { + throw new ArgumentNullException("inter"); + } + + if(typeToCheck.GetInterface(inter.FullName) == null) + { + return null; + } + + return attrs[0]; + } + + /// + /// Attributes the value. + /// + /// The node. + /// The attr. + /// The def. + /// + public static string AttributeValue(XmlNode node, string attr, string def) + { + if( node == null ) + { + throw new ArgumentNullException("node"); + } + if(node.Attributes[attr] == null) + { + return def; + } + string val = node.Attributes[attr].Value; + if(!CheckForOSVariables) + { + return val; + } + + return InterpolateForEnvironmentVariables(val); + } + + /// + /// Parses the boolean. + /// + /// The node. + /// The attr. + /// if set to true [default value]. + /// + public static bool ParseBoolean(XmlNode node, string attr, bool defaultValue) + { + if( node == null ) + { + throw new ArgumentNullException("node"); + } + if(node.Attributes[attr] == null) + { + return defaultValue; + } + return bool.Parse(node.Attributes[attr].Value); + } + + /// + /// Enums the attribute value. + /// + /// The node. + /// The attr. + /// Type of the enum. + /// The def. + /// + public static object EnumAttributeValue(XmlNode node, string attr, Type enumType, object def) + { + if( def == null ) + { + throw new ArgumentNullException("def"); + } + string val = AttributeValue(node, attr, def.ToString()); + return Enum.Parse(enumType, val, true); + } + + /// + /// + /// + /// + /// + /// + public static string AssemblyFullName(string assemblyName, ProjectType projectType) + { + return assemblyName + (projectType == ProjectType.Library ? ".dll" : ".exe"); + } + + #endregion + } +} diff --git a/Prebuild/src/Core/Utilities/Log.cs b/Prebuild/src/Core/Utilities/Log.cs new file mode 100644 index 0000000..4df3def --- /dev/null +++ b/Prebuild/src/Core/Utilities/Log.cs @@ -0,0 +1,276 @@ +#region BSD License +/* +Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com) + +Redistribution and use in source and binary forms, with or without modification, are permitted +provided that the following conditions are met: + +* Redistributions of source code must retain the above copyright notice, this list of conditions + and the following disclaimer. +* Redistributions in binary form must reproduce the above copyright notice, this list of conditions + and the following disclaimer in the documentation and/or other materials provided with the + distribution. +* The name of the author may not be used to endorse or promote products derived from this software + without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, +BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING +IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ +#endregion + +using System; +using System.IO; + +namespace Prebuild.Core.Utilities +{ + /// + /// + /// + public enum LogType + { + /// + /// + /// + None, + /// + /// + /// + Info, + /// + /// + /// + Warning, + /// + /// + /// + Error + } + + /// + /// + /// + [Flags] + public enum LogTargets + { + /// + /// + /// + None = 0, + /// + /// + /// + Null = 1, + /// + /// + /// + File = 2, + /// + /// + /// + Console = 4 + } + + /// + /// Summary description for Log. + /// + public class Log : IDisposable + { + #region Fields + + private TextWriter m_Writer; + private LogTargets m_Target = LogTargets.Null; + bool disposed; + + #endregion + + #region Constructors + + /// + /// Initializes a new instance of the class. + /// + /// The target. + /// Name of the file. + public Log(LogTargets target, string fileName) + { + m_Target = target; + + if ((m_Target & LogTargets.File) != 0) + { + m_Writer = new StreamWriter(fileName, false); + } + else if ((m_Target & LogTargets.Console) != 0) + { + // Prevents null reference exceptions when outputing to the log file. + // This seems to only happen when running on a network drive. + m_Writer = Console.Out; + } + } + + #endregion + + #region Public Methods + + /// + /// Writes this instance. + /// + public void Write() + { + Write(string.Empty); + } + + /// + /// Writes the specified MSG. + /// + /// The MSG. + public void Write(string msg) + { + if((m_Target & LogTargets.Null) != 0) + { + return; + } + + if((m_Target & LogTargets.Console) != 0) + { + Console.WriteLine(msg); + } + if((m_Target & LogTargets.File) != 0 && m_Writer != null) + { + m_Writer.WriteLine(msg); + } + } + + /// + /// Writes the specified format. + /// + /// The format. + /// The args. + public void Write(string format, params object[] args) + { + Write(string.Format(format,args)); + } + + /// + /// Writes the specified type. + /// + /// The type. + /// The format. + /// The args. + public void Write(LogType type, string format, params object[] args) + { + if((m_Target & LogTargets.Null) != 0) + { + return; + } + + string str = ""; + switch(type) + { + case LogType.Info: + str = "[I] "; + break; + case LogType.Warning: + str = "[!] "; + break; + case LogType.Error: + str = "[X] "; + break; + } + + Write(str + format,args); + } + + /// + /// Writes the exception. + /// + /// The type. + /// The ex. + public void WriteException(LogType type, Exception ex) + { + if(ex != null) + { + Write(type, ex.Message); + //#if DEBUG + m_Writer.WriteLine("Exception @{0} stack trace [[", ex.TargetSite.Name); + m_Writer.WriteLine(ex.StackTrace); + m_Writer.WriteLine("]]"); + //#endif + } + } + + /// + /// Flushes this instance. + /// + public void Flush() + { + if(m_Writer != null) + { + m_Writer.Flush(); + } + } + + #endregion + + #region IDisposable Members + + /// + /// Performs application-defined tasks associated with freeing, releasing, or + /// resetting unmanaged resources. + /// + public void Dispose() + { + Dispose(true); + GC.SuppressFinalize(this); + } + + /// + /// Dispose objects + /// + /// + /// If true, it will dispose close the handle + /// + /// + /// Will dispose managed and unmanaged resources. + /// + protected virtual void Dispose(bool disposing) + { + if (!this.disposed) + { + if (disposing) + { + if (m_Writer != null) + { + m_Writer.Close(); + m_Writer = null; + } + } + } + this.disposed = true; + } + + /// + /// + /// + ~Log() + { + this.Dispose(false); + } + + /// + /// Closes and destroys this object + /// + /// + /// Same as Dispose(true) + /// + public void Close() + { + Dispose(); + } + + #endregion + } +} diff --git a/Prebuild/src/Core/WarningException.cs b/Prebuild/src/Core/WarningException.cs new file mode 100644 index 0000000..b7c3668 --- /dev/null +++ b/Prebuild/src/Core/WarningException.cs @@ -0,0 +1,84 @@ +#region BSD License +/* +Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com) + +Redistribution and use in source and binary forms, with or without modification, are permitted +provided that the following conditions are met: + +* Redistributions of source code must retain the above copyright notice, this list of conditions + and the following disclaimer. +* Redistributions in binary form must reproduce the above copyright notice, this list of conditions + and the following disclaimer in the documentation and/or other materials provided with the + distribution. +* The name of the author may not be used to endorse or promote products derived from this software + without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, +BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING +IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ +#endregion + +using System; +using System.Runtime.Serialization; + +namespace Prebuild.Core +{ + /// + /// + /// + [Serializable] + public class WarningException : Exception + { + #region Constructors + + /// + /// + /// + public WarningException() + { + } + + /// + /// + /// + /// + /// + public WarningException(string format, params object[] args) + : base(String.Format(format, args)) + { + } + + /// + /// Exception with specified string + /// + /// Exception message + public WarningException(string message): base(message) + { + } + + /// + /// + /// + /// + /// + public WarningException(string message, Exception exception) : base(message, exception) + { + } + + /// + /// + /// + /// + /// + protected WarningException(SerializationInfo info, StreamingContext context) : base( info, context ) + { + } + + #endregion + } +} diff --git a/Prebuild/src/Prebuild.cs b/Prebuild/src/Prebuild.cs new file mode 100644 index 0000000..081c89c --- /dev/null +++ b/Prebuild/src/Prebuild.cs @@ -0,0 +1,165 @@ +#region BSD License +/* +Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com) + +Redistribution and use in source and binary forms, with or without modification, are permitted +provided that the following conditions are met: + +* Redistributions of source code must retain the above copyright notice, this list of conditions + and the following disclaimer. +* Redistributions in binary form must reproduce the above copyright notice, this list of conditions + and the following disclaimer in the documentation and/or other materials provided with the + distribution. +* The name of the author may not be used to endorse or promote products derived from this software + without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, +BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING +IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ +#endregion + +#region CVS Information +/* + * $Source$ + * $Author: kunnis $ + * $Date: 2009-04-15 02:33:14 +0100 (Wed, 15 Apr 2009) $ + * $Revision: 308 $ + */ +#endregion + +using System; +using System.Collections.Specialized; +using System.IO; +using System.Reflection; +using System.Runtime.InteropServices; +using System.EnterpriseServices.Internal; + +using Prebuild.Core; +using Prebuild.Core.Utilities; + +namespace Prebuild +{ + /// + /// + /// + class Prebuild + { + #region Main + + [STAThread] + static void Main(string[] args) + { + Kernel kernel = null; + try + { + kernel = Kernel.Instance; + kernel.Initialize(LogTargets.File | LogTargets.Console, args); + bool exit = false; + + if(kernel.CommandLine.WasPassed("usage")) + { + exit = true; + OutputUsage(); + } + if(kernel.CommandLine.WasPassed("showtargets")) + { + exit = true; + OutputTargets(kernel); + } + if(kernel.CommandLine.WasPassed("install")) + { + exit = true; + InstallAssembly(kernel); + } + if(kernel.CommandLine.WasPassed("remove")) + { + exit = true; + RemoveAssembly(kernel); + } + + if(!exit) + { + kernel.Process(); + } + } +#if !DEBUG + catch (Exception ex) + { + Console.WriteLine("Unhandled error: {0}", ex.Message); + Console.WriteLine("{0}", ex.StackTrace); + } +#endif + finally + { + if(kernel != null && kernel.PauseAfterFinish) + { + Console.WriteLine("\nPress enter to continue..."); + Console.ReadLine(); + } + } + } + + #endregion + + #region Private Methods + + private static void InstallAssembly(Kernel kernel) + { + Publish publish = new Publish(); + string file = kernel.CommandLine["install"]; + //Console.WriteLine(".."+file+".."); + publish.GacInstall(file); + } + + private static void RemoveAssembly(Kernel kernel) + { + Publish publish = new Publish(); + string file = kernel.CommandLine["remove"]; + publish.GacRemove(file); + } + + private static void OutputUsage() + { + Console.WriteLine("Usage: prebuild /target [options]"); + Console.WriteLine("Available command-line switches:"); + Console.WriteLine(); + Console.WriteLine("/target Target for Prebuild"); + Console.WriteLine("/clean Clean the build files for the given target"); + Console.WriteLine("/file XML file to process"); + Console.WriteLine("/log Log file to write to"); + Console.WriteLine("/ppo Pre-process the file, but perform no other processing"); + Console.WriteLine("/pause Pauses the application after execution to view the output"); + Console.WriteLine("/yes Default to yes to any questions asked"); + Console.WriteLine("/install Install assembly into the GAC"); + Console.WriteLine("/remove Remove assembly from the GAC"); + Console.WriteLine(); + Console.WriteLine("See 'prebuild /showtargets for a list of available targets"); + Console.WriteLine("See readme.txt or check out http://dnpb.sourceforge.net for more information"); + Console.WriteLine(); + } + + private static void OutputTargets(Kernel kern) + { + Console.WriteLine("Targets available in Prebuild:"); + Console.WriteLine(""); + if(kern.Targets.Keys.Count > 0) + { + string[] targs = new string[kern.Targets.Keys.Count]; + kern.Targets.Keys.CopyTo(targs, 0); + Array.Sort(targs); + foreach(string target in targs) + { + Console.WriteLine(target); + } + } + Console.WriteLine(""); + } + + #endregion + } +} diff --git a/Prebuild/src/Prebuild.snk b/Prebuild/src/Prebuild.snk new file mode 100644 index 0000000..f9dce05 Binary files /dev/null and b/Prebuild/src/Prebuild.snk differ diff --git a/Prebuild/src/Properties/.svn/all-wcprops b/Prebuild/src/Properties/.svn/all-wcprops new file mode 100644 index 0000000..0fdb604 --- /dev/null +++ b/Prebuild/src/Properties/.svn/all-wcprops @@ -0,0 +1,11 @@ +K 25 +svn:wc:ra_dav:version-url +V 56 +/svnroot/dnpb/!svn/ver/323/trunk/Prebuild/src/Properties +END +AssemblyInfo.cs +K 25 +svn:wc:ra_dav:version-url +V 72 +/svnroot/dnpb/!svn/ver/323/trunk/Prebuild/src/Properties/AssemblyInfo.cs +END diff --git a/Prebuild/src/Properties/.svn/entries b/Prebuild/src/Properties/.svn/entries new file mode 100644 index 0000000..0a81c5c --- /dev/null +++ b/Prebuild/src/Properties/.svn/entries @@ -0,0 +1,62 @@ +10 + +dir +323 +https://dnpb.svn.sourceforge.net/svnroot/dnpb/trunk/Prebuild/src/Properties +https://dnpb.svn.sourceforge.net/svnroot/dnpb + + + +2010-09-10T17:51:36.189738Z +323 +jhurliman + + + + + + + + + + + + + + +3355ff64-970d-0410-bbe8-d0fbd18be4fb + +AssemblyInfo.cs +file + + + + +2010-09-10T22:51:45.000000Z +91e38b76ed4b8de4873bd78e0c587989 +2010-09-10T17:51:36.189738Z +323 +jhurliman +has-props + + + + + + + + + + + + + + + + + + + + +4691 + diff --git a/Prebuild/src/Properties/.svn/prop-base/AssemblyInfo.cs.svn-base b/Prebuild/src/Properties/.svn/prop-base/AssemblyInfo.cs.svn-base new file mode 100644 index 0000000..7b57b30 --- /dev/null +++ b/Prebuild/src/Properties/.svn/prop-base/AssemblyInfo.cs.svn-base @@ -0,0 +1,9 @@ +K 13 +svn:eol-style +V 6 +native +K 12 +svn:keywords +V 23 +Author Date Id Revision +END diff --git a/Prebuild/src/Properties/.svn/text-base/AssemblyInfo.cs.svn-base b/Prebuild/src/Properties/.svn/text-base/AssemblyInfo.cs.svn-base new file mode 100644 index 0000000..f3ac30f --- /dev/null +++ b/Prebuild/src/Properties/.svn/text-base/AssemblyInfo.cs.svn-base @@ -0,0 +1,113 @@ +#region BSD License +/* + +Copyright (c) 2004 - 2008 +Matthew Holmes (matthew@wildfiregames.com), +Dan Moorehead (dan05a@gmail.com), +Dave Hudson (jendave@yahoo.com), +Rob Loach (http://www.robloach.net), +C.J. Adams-Collier (cjac@colliertech.org), + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + +* Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + +* Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + +* The name of the author may not be used to endorse or promote + products derived from this software without specific prior written + permission. + +THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, +INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, +STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING +IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +POSSIBILITY OF SUCH DAMAGE. + +*/ +#endregion + +using System; +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using System.Security.Permissions; +using System.Resources; + + +// FxCop recommended attributes +[assembly: ComVisible(false)] +[assembly: FileIOPermission(SecurityAction.RequestMinimum, Unrestricted=true)] +[assembly: CLSCompliant(true)] + +// +// 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(".NET Prebuild")] +[assembly: AssemblyDescription("A .NET project file build tool")] +[assembly: AssemblyConfiguration(".NET CLR")] +[assembly: AssemblyCompany("The Prebuild Project")] +[assembly: AssemblyProduct("")] +[assembly: AssemblyCopyright("Copyright 2004-2010 " + + "Matthew Holmes, " + + "Dan Moorehead, " + + "C.J. Adams-Collier, " + + "Rob Loach, " + + "David Hudson," + + "John Hurliman")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] +[assembly: NeutralResourcesLanguageAttribute("en-US")] +[assembly: AssemblyVersion("2.0.5.*")] + +// +// 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 Revision and Build Numbers +// by using the '*' as shown below: + +// +// In order to sign your assembly you must specify a key to use. Refer to the +// Microsoft .NET Framework documentation for more information on assembly signing. +// +// Use the attributes below to control which key is used for signing. +// +// Notes: +// (*) If no key is specified, the assembly is not signed. +// (*) KeyName refers to a key that has been installed in the Crypto Service +// Provider (CSP) on your machine. KeyFile refers to a file which contains +// a key. +// (*) If the KeyFile and the KeyName values are both specified, the +// following processing occurs: +// (1) If the KeyName can be found in the CSP, that key is used. +// (2) If the KeyName does not exist and the KeyFile does exist, the key +// in the KeyFile is installed into the CSP and used. +// (*) In order to create a KeyFile, you can use the sn.exe (Strong Name) utility. +// When specifying the KeyFile, the location of the KeyFile should be +// relative to the project output directory which is +// %Project Directory%\obj\. For example, if your KeyFile is +// located in the project directory, you would specify the AssemblyKeyFile +// attribute as [assembly: AssemblyKeyFile("..\\..\\mykey.snk")] +// (*) Delay Signing is an advanced option - see the Microsoft .NET Framework +// documentation for more information on this. +// +[assembly: AssemblyDelaySign(false)] +[assembly: AssemblyKeyName("")] diff --git a/Prebuild/src/Properties/AssemblyInfo.cs b/Prebuild/src/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..f3ac30f --- /dev/null +++ b/Prebuild/src/Properties/AssemblyInfo.cs @@ -0,0 +1,113 @@ +#region BSD License +/* + +Copyright (c) 2004 - 2008 +Matthew Holmes (matthew@wildfiregames.com), +Dan Moorehead (dan05a@gmail.com), +Dave Hudson (jendave@yahoo.com), +Rob Loach (http://www.robloach.net), +C.J. Adams-Collier (cjac@colliertech.org), + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + +* Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + +* Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + +* The name of the author may not be used to endorse or promote + products derived from this software without specific prior written + permission. + +THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, +INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, +STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING +IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +POSSIBILITY OF SUCH DAMAGE. + +*/ +#endregion + +using System; +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using System.Security.Permissions; +using System.Resources; + + +// FxCop recommended attributes +[assembly: ComVisible(false)] +[assembly: FileIOPermission(SecurityAction.RequestMinimum, Unrestricted=true)] +[assembly: CLSCompliant(true)] + +// +// 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(".NET Prebuild")] +[assembly: AssemblyDescription("A .NET project file build tool")] +[assembly: AssemblyConfiguration(".NET CLR")] +[assembly: AssemblyCompany("The Prebuild Project")] +[assembly: AssemblyProduct("")] +[assembly: AssemblyCopyright("Copyright 2004-2010 " + + "Matthew Holmes, " + + "Dan Moorehead, " + + "C.J. Adams-Collier, " + + "Rob Loach, " + + "David Hudson," + + "John Hurliman")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] +[assembly: NeutralResourcesLanguageAttribute("en-US")] +[assembly: AssemblyVersion("2.0.5.*")] + +// +// 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 Revision and Build Numbers +// by using the '*' as shown below: + +// +// In order to sign your assembly you must specify a key to use. Refer to the +// Microsoft .NET Framework documentation for more information on assembly signing. +// +// Use the attributes below to control which key is used for signing. +// +// Notes: +// (*) If no key is specified, the assembly is not signed. +// (*) KeyName refers to a key that has been installed in the Crypto Service +// Provider (CSP) on your machine. KeyFile refers to a file which contains +// a key. +// (*) If the KeyFile and the KeyName values are both specified, the +// following processing occurs: +// (1) If the KeyName can be found in the CSP, that key is used. +// (2) If the KeyName does not exist and the KeyFile does exist, the key +// in the KeyFile is installed into the CSP and used. +// (*) In order to create a KeyFile, you can use the sn.exe (Strong Name) utility. +// When specifying the KeyFile, the location of the KeyFile should be +// relative to the project output directory which is +// %Project Directory%\obj\. For example, if your KeyFile is +// located in the project directory, you would specify the AssemblyKeyFile +// attribute as [assembly: AssemblyKeyFile("..\\..\\mykey.snk")] +// (*) Delay Signing is an advanced option - see the Microsoft .NET Framework +// documentation for more information on this. +// +[assembly: AssemblyDelaySign(false)] +[assembly: AssemblyKeyName("")] diff --git a/Prebuild/src/data/.svn/all-wcprops b/Prebuild/src/data/.svn/all-wcprops new file mode 100644 index 0000000..3af3c24 --- /dev/null +++ b/Prebuild/src/data/.svn/all-wcprops @@ -0,0 +1,71 @@ +K 25 +svn:wc:ra_dav:version-url +V 50 +/svnroot/dnpb/!svn/ver/316/trunk/Prebuild/src/data +END +dnpb-1.3.xsd +K 25 +svn:wc:ra_dav:version-url +V 62 +/svnroot/dnpb/!svn/ver/96/trunk/Prebuild/src/data/dnpb-1.3.xsd +END +dnpb-1.4.xsd +K 25 +svn:wc:ra_dav:version-url +V 62 +/svnroot/dnpb/!svn/ver/96/trunk/Prebuild/src/data/dnpb-1.4.xsd +END +dnpb-1.5.xsd +K 25 +svn:wc:ra_dav:version-url +V 62 +/svnroot/dnpb/!svn/ver/96/trunk/Prebuild/src/data/dnpb-1.5.xsd +END +prebuild-1.6.xsd +K 25 +svn:wc:ra_dav:version-url +V 66 +/svnroot/dnpb/!svn/ver/96/trunk/Prebuild/src/data/prebuild-1.6.xsd +END +prebuild-1.7.xsd +K 25 +svn:wc:ra_dav:version-url +V 67 +/svnroot/dnpb/!svn/ver/299/trunk/Prebuild/src/data/prebuild-1.7.xsd +END +prebuild-1.8.xsd +K 25 +svn:wc:ra_dav:version-url +V 67 +/svnroot/dnpb/!svn/ver/314/trunk/Prebuild/src/data/prebuild-1.8.xsd +END +autotools.xml +K 25 +svn:wc:ra_dav:version-url +V 64 +/svnroot/dnpb/!svn/ver/256/trunk/Prebuild/src/data/autotools.xml +END +prebuild-1.9.xsd +K 25 +svn:wc:ra_dav:version-url +V 67 +/svnroot/dnpb/!svn/ver/316/trunk/Prebuild/src/data/prebuild-1.9.xsd +END +dnpb-1.0.xsd +K 25 +svn:wc:ra_dav:version-url +V 62 +/svnroot/dnpb/!svn/ver/96/trunk/Prebuild/src/data/dnpb-1.0.xsd +END +dnpb-1.1.xsd +K 25 +svn:wc:ra_dav:version-url +V 62 +/svnroot/dnpb/!svn/ver/96/trunk/Prebuild/src/data/dnpb-1.1.xsd +END +dnpb-1.2.xsd +K 25 +svn:wc:ra_dav:version-url +V 62 +/svnroot/dnpb/!svn/ver/96/trunk/Prebuild/src/data/dnpb-1.2.xsd +END diff --git a/Prebuild/src/data/.svn/dir-prop-base b/Prebuild/src/data/.svn/dir-prop-base new file mode 100644 index 0000000..29ffe33 --- /dev/null +++ b/Prebuild/src/data/.svn/dir-prop-base @@ -0,0 +1,6 @@ +K 10 +svn:ignore +V 11 +*.swp +*.xsx +END diff --git a/Prebuild/src/data/.svn/entries b/Prebuild/src/data/.svn/entries new file mode 100644 index 0000000..935b447 --- /dev/null +++ b/Prebuild/src/data/.svn/entries @@ -0,0 +1,402 @@ +10 + +dir +323 +https://dnpb.svn.sourceforge.net/svnroot/dnpb/trunk/Prebuild/src/data +https://dnpb.svn.sourceforge.net/svnroot/dnpb + + + +2010-05-08T05:43:01.449559Z +316 +jhurliman +has-props + + + + + + + + + + + + + +3355ff64-970d-0410-bbe8-d0fbd18be4fb + +dnpb-1.3.xsd +file + + + + +2010-09-10T22:51:45.000000Z +636ed9edea90e5104ad1879c96552b91 +2004-12-29T02:08:06.000000Z +35 +xeonx +has-props + + + + + + + + + + + + + + + + + + + + +7995 + +dnpb-1.4.xsd +file + + + + +2010-09-10T22:51:45.000000Z +3e883fc616c786e3835ba3386ede4269 +2005-12-23T06:05:38.000000Z +39 +jendave +has-props + + + + + + + + + + + + + + + + + + + + +8197 + +dnpb-1.5.xsd +file + + + + +2010-09-10T22:51:45.000000Z +c692bbcd63f10ca4c93da1c19f5b107e +2006-01-23T23:19:16.000000Z +55 +jendave +has-props + + + + + + + + + + + + + + + + + + + + +8420 + +prebuild-1.6.xsd +file + + + + +2010-09-10T22:51:45.000000Z +61f6e6f13f64ae842b1324cf145934ad +2006-02-28T18:13:10.884431Z +95 +jendave +has-props + + + + + + + + + + + + + + + + + + + + +9770 + +prebuild-1.7.xsd +file + + + + +2010-09-10T22:51:45.000000Z +edf1193fad8922061845cf48cc8eb851 +2009-02-21T05:36:29.327384Z +299 +kunnis + + + + + + + + + + + + + + + + + + + + + +16083 + +prebuild-1.8.xsd +file + + + + +2010-09-10T22:51:45.000000Z +6eb078509319faa7ae4cdc55af184ac1 +2009-06-06T19:43:44.493200Z +314 +dmoonfire + + + + + + + + + + + + + + + + + + + + + +15296 + +autotools.xml +file + + + + +2010-09-10T22:51:45.000000Z +e119a174539f100e18d2ee73c5660318 +2008-02-07T16:31:29.630257Z +256 +cjcollier + + + + + + + + + + + + + + + + + + + + + +27653 + +prebuild-1.9.xsd +file + + + + +2010-09-10T22:51:45.000000Z +8988b0f7fc4462d76183a4c0b72121e9 +2010-05-08T05:43:01.449559Z +316 +jhurliman + + + + + + + + + + + + + + + + + + + + + +14622 + +dnpb-1.0.xsd +file + + + + +2010-09-10T22:51:45.000000Z +080c1e8ce73ec5aff528c2a62b355c38 +2004-04-19T07:06:45.000000Z +17 +calefaction +has-props + + + + + + + + + + + + + + + + + + + + +6878 + +dnpb-1.1.xsd +file + + + + +2010-09-10T22:51:45.000000Z +b00a1d973849b76554afb17f8a21978c +2004-04-22T00:51:14.000000Z +18 +calefaction +has-props + + + + + + + + + + + + + + + + + + + + +6883 + +dnpb-1.2.xsd +file + + + + +2010-09-10T22:51:45.000000Z +7ebd6286a2df12ef5e21e835342b1daa +2004-09-15T19:40:37.000000Z +29 +calefaction +has-props + + + + + + + + + + + + + + + + + + + + +7639 + diff --git a/Prebuild/src/data/.svn/prop-base/dnpb-1.0.xsd.svn-base b/Prebuild/src/data/.svn/prop-base/dnpb-1.0.xsd.svn-base new file mode 100644 index 0000000..7b57b30 --- /dev/null +++ b/Prebuild/src/data/.svn/prop-base/dnpb-1.0.xsd.svn-base @@ -0,0 +1,9 @@ +K 13 +svn:eol-style +V 6 +native +K 12 +svn:keywords +V 23 +Author Date Id Revision +END diff --git a/Prebuild/src/data/.svn/prop-base/dnpb-1.1.xsd.svn-base b/Prebuild/src/data/.svn/prop-base/dnpb-1.1.xsd.svn-base new file mode 100644 index 0000000..7b57b30 --- /dev/null +++ b/Prebuild/src/data/.svn/prop-base/dnpb-1.1.xsd.svn-base @@ -0,0 +1,9 @@ +K 13 +svn:eol-style +V 6 +native +K 12 +svn:keywords +V 23 +Author Date Id Revision +END diff --git a/Prebuild/src/data/.svn/prop-base/dnpb-1.2.xsd.svn-base b/Prebuild/src/data/.svn/prop-base/dnpb-1.2.xsd.svn-base new file mode 100644 index 0000000..7b57b30 --- /dev/null +++ b/Prebuild/src/data/.svn/prop-base/dnpb-1.2.xsd.svn-base @@ -0,0 +1,9 @@ +K 13 +svn:eol-style +V 6 +native +K 12 +svn:keywords +V 23 +Author Date Id Revision +END diff --git a/Prebuild/src/data/.svn/prop-base/dnpb-1.3.xsd.svn-base b/Prebuild/src/data/.svn/prop-base/dnpb-1.3.xsd.svn-base new file mode 100644 index 0000000..7b57b30 --- /dev/null +++ b/Prebuild/src/data/.svn/prop-base/dnpb-1.3.xsd.svn-base @@ -0,0 +1,9 @@ +K 13 +svn:eol-style +V 6 +native +K 12 +svn:keywords +V 23 +Author Date Id Revision +END diff --git a/Prebuild/src/data/.svn/prop-base/dnpb-1.4.xsd.svn-base b/Prebuild/src/data/.svn/prop-base/dnpb-1.4.xsd.svn-base new file mode 100644 index 0000000..7b57b30 --- /dev/null +++ b/Prebuild/src/data/.svn/prop-base/dnpb-1.4.xsd.svn-base @@ -0,0 +1,9 @@ +K 13 +svn:eol-style +V 6 +native +K 12 +svn:keywords +V 23 +Author Date Id Revision +END diff --git a/Prebuild/src/data/.svn/prop-base/dnpb-1.5.xsd.svn-base b/Prebuild/src/data/.svn/prop-base/dnpb-1.5.xsd.svn-base new file mode 100644 index 0000000..7b57b30 --- /dev/null +++ b/Prebuild/src/data/.svn/prop-base/dnpb-1.5.xsd.svn-base @@ -0,0 +1,9 @@ +K 13 +svn:eol-style +V 6 +native +K 12 +svn:keywords +V 23 +Author Date Id Revision +END diff --git a/Prebuild/src/data/.svn/prop-base/prebuild-1.6.xsd.svn-base b/Prebuild/src/data/.svn/prop-base/prebuild-1.6.xsd.svn-base new file mode 100644 index 0000000..7b57b30 --- /dev/null +++ b/Prebuild/src/data/.svn/prop-base/prebuild-1.6.xsd.svn-base @@ -0,0 +1,9 @@ +K 13 +svn:eol-style +V 6 +native +K 12 +svn:keywords +V 23 +Author Date Id Revision +END diff --git a/Prebuild/src/data/.svn/text-base/autotools.xml.svn-base b/Prebuild/src/data/.svn/text-base/autotools.xml.svn-base new file mode 100644 index 0000000..ee4b064 --- /dev/null +++ b/Prebuild/src/data/.svn/text-base/autotools.xml.svn-base @@ -0,0 +1,790 @@ + + + + + #!/bin/sh +# Run this to generate all the initial makefiles, etc. +# Ripped off from Mono, which ripped off from GNOME macros version + +DIE=0 + +srcdir=`dirname $0` +test -z "$srcdir" && srcdir=. + +if [ -n "$MONO_PATH" ]; then + # from -> /mono/lib:/another/mono/lib + # to -> /mono /another/mono + for i in `echo ${MONO_PATH} | tr ":" " "`; do + i=`dirname ${i}` + if [ -n "{i}" -a -d "${i}/share/aclocal" ]; then + ACLOCAL_FLAGS="-I ${i}/share/aclocal $ACLOCAL_FLAGS" + fi + if [ -n "{i}" -a -d "${i}/bin" ]; then + PATH="${i}/bin:$PATH" + fi + done + export PATH +fi + +(autoconf --version) < /dev/null > /dev/null 2>&1 || { + echo + echo "**Error**: You must have \`autoconf' installed to compile Mono." + echo "Download the appropriate package for your distribution," + echo "or get the source tarball at ftp://ftp.gnu.org/pub/gnu/" + DIE=1 +} + +if [ -z "$LIBTOOL" ]; then + LIBTOOL=`which glibtool 2>/dev/null` + if [ ! -x "$LIBTOOL" ]; then + LIBTOOL=`which libtool` + fi +fi + +(grep "^AM_PROG_LIBTOOL" $srcdir/configure.ac >/dev/null) && { + ($LIBTOOL --version) < /dev/null > /dev/null 2>&1 || { + echo + echo "**Error**: You must have \`libtool' installed to compile Mono." + echo "Get ftp://ftp.gnu.org/pub/gnu/libtool-1.2d.tar.gz" + echo "(or a newer version if it is available)" + DIE=1 + } +} + +grep "^AM_GNU_GETTEXT" $srcdir/configure.ac >/dev/null && { + grep "sed.*POTFILES" $srcdir/configure.ac >/dev/null || \ + (gettext --version) < /dev/null > /dev/null 2>&1 || { + echo + echo "**Error**: You must have \`gettext' installed to compile Mono." + echo "Get ftp://alpha.gnu.org/gnu/gettext-0.10.35.tar.gz" + echo "(or a newer version if it is available)" + DIE=1 + } +} + +(automake --version) < /dev/null > /dev/null 2>&1 || { + echo + echo "**Error**: You must have \`automake' installed to compile Mono." + echo "Get ftp://ftp.gnu.org/pub/gnu/automake-1.3.tar.gz" + echo "(or a newer version if it is available)" + DIE=1 + NO_AUTOMAKE=yes +} + +# if no automake, don't bother testing for aclocal +test -n "$NO_AUTOMAKE" || (aclocal --version) < /dev/null > /dev/null 2>&1 || { + echo + echo "**Error**: Missing \`aclocal'. The version of \`automake'" + echo "installed doesn't appear recent enough." + echo "Get ftp://ftp.gnu.org/pub/gnu/automake-1.3.tar.gz" + echo "(or a newer version if it is available)" + DIE=1 +} + +if test "$DIE" -eq 1; then + exit 1 +fi + +if test -z "$NOCONFIGURE"; then + +if test -z "$*"; then + echo "**Warning**: I am going to run \`configure' with no arguments." + echo "If you wish to pass any to it, please specify them on the" + echo \`$0\'" command line." + echo +fi + +fi + +case $CC in +xlc ) + am_opt=--include-deps;; +esac + + +if grep "^AM_PROG_LIBTOOL" configure.ac >/dev/null; then + if test -z "$NO_LIBTOOLIZE" ; then + echo "Running libtoolize..." + ${LIBTOOL}ize --force --copy + fi +fi + +echo "Running aclocal $ACLOCAL_FLAGS ..." +aclocal $ACLOCAL_FLAGS || { + echo + echo "**Error**: aclocal failed. This may mean that you have not" + echo "installed all of the packages you need, or you may need to" + echo "set ACLOCAL_FLAGS to include \"-I \$prefix/share/aclocal\"" + echo "for the prefix where you installed the packages whose" + echo "macros were not found" + exit 1 +} + +if grep "^AM_CONFIG_HEADER" configure.ac >/dev/null; then + echo "Running autoheader..." + autoheader || { echo "**Error**: autoheader failed."; exit 1; } +fi + +echo "Running automake --gnu $am_opt ..." +automake --add-missing --gnu $am_opt || + { echo "**Error**: automake failed."; exit 1; } +echo "Running autoconf ..." +autoconf || { echo "**Error**: autoconf failed."; exit 1; } + +conf_flags="--enable-maintainer-mode --enable-compile-warnings" #--enable-iso-c + +if test x$NOCONFIGURE = x; then + echo Running $srcdir/configure $conf_flags "$@" ... + $srcdir/configure $conf_flags "$@" \ + && echo Now type \`make\' to compile $PKG_NAME || exit 1 +else + echo Skipping configure process. +fi + + + + + + + + + + + + + + + + AC_INIT([],[]) + +AC_PREREQ(2.60) +AC_CANONICAL_SYSTEM +AC_CONFIG_AUX_DIR(.) +AM_INIT_AUTOMAKE([1.9 tar-ustar foreign]) +AM_MAINTAINER_MODE +dnl AC_PROG_INTLTOOL([0.25]) +AC_PROG_INSTALL + +ASSEMBLY_NAME= +PROJECT_NAME= +PROJECT_VERSION=$VERSION +PROJECT_DESCRIPTION="" +PROJECT_TYPE="" + +AC_SUBST(ASSEMBLY_NAME) +AC_SUBST(PROJECT_NAME) +AC_SUBST(PROJECT_VERSION) +AC_SUBST(DESCRIPTION) + +AC_MSG_CHECKING([assembly type]) +case $PROJECT_TYPE in + *Exe) + ASSEMBLY_EXTENSION=exe + ;; + *Library) + ASSEMBLY_EXTENSION=dll + ;; + *) + AC_MSG_ERROR([*** Please add support for project type $PROJECT_TYPE to configure.ac checks!]) + ;; +esac +AC_MSG_RESULT([$PROJECT_TYPE]) + +AC_SUBST(ASSEMBLY_EXTENSION) + +AC_MSG_CHECKING([whether we're compiling from an RCS]) +if test -f "$srcdir/.cvs_version" ; then + from_rcs=cvs +else + if test -f "$srcdir/.svn/entries" ; then + from_rcs=svn + else + from_rcs=no + fi +fi + +AC_MSG_RESULT($from_rcs) + +MONO_REQUIRED_VERSION=1.1 + +PKG_CHECK_MODULES(MONO_DEPENDENCY, mono >= $MONO_REQUIRED_VERSION, has_mono=true, has_mono=false) + +if test "x$has_mono" = "xtrue"; then + AC_PATH_PROG(RUNTIME, mono, no) + AC_PATH_PROG(CSC, gmcs, no) + AC_PATH_PROG(RESGEN, resgen2, no) + if test `uname -s` = "Darwin"; then + LIB_PREFIX= + LIB_SUFFIX=.dylib + else + LIB_PREFIX=.so + LIB_SUFFIX= + fi +else + AC_PATH_PROG(CSC, csc.exe, no) + if test x$CSC = "xno"; then + AC_MSG_ERROR([You need to install either mono or .Net]) + else + RUNTIME= + LIB_PREFIX= + LIB_SUFFIX= + fi +fi + +AC_PATH_PROG(GACUTIL, gacutil) +if test "x$GACUTIL" = "xno" ; then + AC_MSG_ERROR([No gacutil tool found]) +fi + +GACUTIL_FLAGS='/package /gacdir $(DESTDIR)$(prefix)/lib' +AC_SUBST(GACUTIL_FLAGS) + +AC_SUBST(PATH) +AC_SUBST(LD_LIBRARY_PATH) + +AC_SUBST(LIB_PREFIX) +AC_SUBST(LIB_SUFFIX) +AC_SUBST(RUNTIME) +AC_SUBST(CSC) +AC_SUBST(RESGEN) +AC_SUBST(GACUTIL) + +AC_SUBST(BASE_DEPENDENCIES_CFLAGS) +AC_SUBST(BASE_DEPENDENCIES_LIBS) + +dnl Find monodoc +MONODOC_REQUIRED_VERSION=1.0 +AC_SUBST(MONODOC_REQUIRED_VERSION) + +PKG_CHECK_MODULES(MONODOC_DEPENDENCY, monodoc >= $MONODOC_REQUIRED_VERSION, enable_monodoc=yes, enable_monodoc=no) + +if test "x$enable_monodoc" = "xyes"; then + AC_PATH_PROG(MONODOC, monodoc, no) + if test x$MONODOC = xno; then + enable_monodoc=no + fi +else + MONODOC= +fi + +AC_SUBST(MONODOC) +AM_CONDITIONAL(ENABLE_MONODOC, test "x$enable_monodoc" = "xyes") + +winbuild=no +case "$host" in + *-*-mingw*|*-*-cygwin*) + winbuild=yes + ;; +esac +AM_CONDITIONAL(WINBUILD, test x$winbuild = xyes) + +AC_CONFIG_FILES() +AC_CONFIG_FILES(.pc) + +AC_CONFIG_FILES(Makefile) +AC_OUTPUT + +echo "===" +echo "" +echo "Project configuration summary" +echo "" +echo " * Installation prefix: $prefix" +echo " * compiler: $CSC" +echo " * Documentation: $enable_monodoc ($MONODOC)" +echo " * Project Name: $PROJECT_NAME" +echo " * Version: $PROJECT_VERSION" +echo "" +echo "===" + + + + + + + + + + + + + + + + + + + + + + + + + + +ASSEMBLY=$(ASSEMBLY_NAME).$(ASSEMBLY_EXTENSION) + + +dir = $(prefix)/lib/ +_DATA = $(ASSEMBLY) $(ASSEMBLY).config + +bin_SCRIPTS= + +pkgconfigdir = $(prefix)/lib/pkgconfig +pkgconfig_DATA = .pc + +dir = $(prefix)/lib/mono/ +_DATA = $(ASSEMBLY).config + +noinst_DATA = $(ASSEMBLY) + + +PACKAGES = +BINARY_LIBS = +SYSTEM_LIBS = +RESOURCES_SRC = +RESOURCES = $(RESOURCES_SRC:.resx=.resources) +SOURCES = + +EXTRA_DIST=$(SOURCES) $(BINARY_LIBS) $(RESOURCES_SRC) install-sh missing + +CLEANFILES=$(ASSEMBLY) + + + + + + + +/$(ASSEMBLY): $(srcdir)/$(ASSEMBLY).response $(RESOURCES) $(SOURCES) $(BINARY_LIBS) + mkdir -p doc && mkdir -p && $(CSC) /out:$@ \ + /target: \ + $(addprefix /resource:$(srcdir)/, $(RESOURCES)) \ + $(addprefix /pkg:, $(PACKAGES)) \ + $(addprefix /r:, $(SYSTEM_LIBS)) \ + $(addprefix /r:$(srcdir)/, $(BINARY_LIBS)) \ + @$(srcdir)/$(ASSEMBLY).response \ + /doc:doc/ \ + /keyfile:$(srcdir)/ \ + /unsafe \ + && rm -f $(ASSEMBLY) \ + && ln $@ $(ASSEMBLY) + +CLEANFILES+=/$(ASSEMBLY) + + +EXTRA_DIST+= + +: /$(ASSEMBLY) + rm -f $(ASSEMBLY) \ + && ln /$(ASSEMBLY) $(ASSEMBLY) + + + + + +_install-data-local: /$(ASSEMBLY) + echo "$(GACUTIL) /i $(ASSEMBLY) /f $(GACUTIL_FLAGS)"; \ + $(GACUTIL) /i $(ASSEMBLY) /f $(GACUTIL_FLAGS) || exit 1; + +_uninstall-local: + if [`gacutil -l | grep "Number" | awk -F= '{print $$2}'` -gt "0" ] ; \ + then \ + echo "$(GACUTIL) /u $(ASSEMBLY_NAME) $(GACUTIL_FLAGS)"; \ + $(GACUTIL) /u $(ASSEMBLY_NAME) $(GACUTIL_FLAGS) || exit 1; \ + fi + + + +noinst__dir = $(prefix)/lib/mono/ +noinst___DATA = /$(ASSEMBLY) + + + + + + +$(ASSEMBLY): + + +$(srcdir)/$(ASSEMBLY).response: $(srcdir)/Makefile + echo "$(addprefix $(srcdir)/, $(SOURCES))" > $@ + + +all: $(ASSEMBLY) + +# rule to compile .resx files to .resources +%.resources: %.resx + $(RESGEN) /useSourcePath /compile $(@:.resources=.resx) + + + + + +install-data-local: _install-data-local + +uninstall-local: _uninstall-local + + + +#dir+=$(noinst__dir) +#_DATA+=$(noinst___DATA) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +prefix=@prefix@ +exec_prefix=${prefix} +libdir=${exec_prefix}/lib/mono/@PROJECT_NAME@ + +Name: +Description: +Version: @PROJECT_VERSION@ +Requires: +Libs: -r:${libdir}/@PROJECT_NAME@.dll + + + + + + + + + + + #!/bin/sh +# Run this to generate all the initial makefiles, etc. +# Ripped off from Mono, which ripped off from GNOME macros version + +DIE=0 + +srcdir=`dirname $0` +test -z "$srcdir" && srcdir=. + +if [ -n "$MONO_PATH" ]; then + # from -> /mono/lib:/another/mono/lib + # to -> /mono /another/mono + for i in `echo ${MONO_PATH} | tr ":" " "`; do + i=`dirname ${i}` + if [ -n "{i}" -a -d "${i}/share/aclocal" ]; then + ACLOCAL_FLAGS="-I ${i}/share/aclocal $ACLOCAL_FLAGS" + fi + if [ -n "{i}" -a -d "${i}/bin" ]; then + PATH="${i}/bin:$PATH" + fi + done + export PATH +fi + +(autoconf --version) < /dev/null > /dev/null 2>&1 || { + echo + echo "**Error**: You must have \`autoconf' installed to compile Mono." + echo "Download the appropriate package for your distribution," + echo "or get the source tarball at ftp://ftp.gnu.org/pub/gnu/" + DIE=1 +} + +if [ -z "$LIBTOOL" ]; then + LIBTOOL=`which glibtool 2>/dev/null` + if [ ! -x "$LIBTOOL" ]; then + LIBTOOL=`which libtool` + fi +fi + +(grep "^AM_PROG_LIBTOOL" $srcdir/configure.ac >/dev/null) && { + ($LIBTOOL --version) < /dev/null > /dev/null 2>&1 || { + echo + echo "**Error**: You must have \`libtool' installed to compile Mono." + echo "Get ftp://ftp.gnu.org/pub/gnu/libtool-1.2d.tar.gz" + echo "(or a newer version if it is available)" + DIE=1 + } +} + +grep "^AM_GNU_GETTEXT" $srcdir/configure.ac >/dev/null && { + grep "sed.*POTFILES" $srcdir/configure.ac >/dev/null || \ + (gettext --version) < /dev/null > /dev/null 2>&1 || { + echo + echo "**Error**: You must have \`gettext' installed to compile Mono." + echo "Get ftp://alpha.gnu.org/gnu/gettext-0.10.35.tar.gz" + echo "(or a newer version if it is available)" + DIE=1 + } +} + +(automake --version) < /dev/null > /dev/null 2>&1 || { + echo + echo "**Error**: You must have \`automake' installed to compile Mono." + echo "Get ftp://ftp.gnu.org/pub/gnu/automake-1.3.tar.gz" + echo "(or a newer version if it is available)" + DIE=1 + NO_AUTOMAKE=yes +} + + +# if no automake, don't bother testing for aclocal +test -n "$NO_AUTOMAKE" || (aclocal --version) < /dev/null > /dev/null 2>&1 || { + echo + echo "**Error**: Missing \`aclocal'. The version of \`automake'" + echo "installed doesn't appear recent enough." + echo "Get ftp://ftp.gnu.org/pub/gnu/automake-1.3.tar.gz" + echo "(or a newer version if it is available)" + DIE=1 +} + +if test "$DIE" -eq 1; then + exit 1 +fi + +if test -z "$*"; then + echo "**Warning**: I am going to run \`configure' with no arguments." + echo "If you wish to pass any to it, please specify them on the" + echo \`$0\'" command line." + echo +fi + +case $CC in +xlc ) + am_opt=--include-deps;; +esac + + +if grep "^AM_PROG_LIBTOOL" configure.ac >/dev/null; then + if test -z "$NO_LIBTOOLIZE" ; then + echo "Running libtoolize..." + ${LIBTOOL}ize --force --copy + fi +fi + +echo "Running aclocal $ACLOCAL_FLAGS ..." +aclocal $ACLOCAL_FLAGS || { + echo + echo "**Error**: aclocal failed. This may mean that you have not" + echo "installed all of the packages you need, or you may need to" + echo "set ACLOCAL_FLAGS to include \"-I \$prefix/share/aclocal\"" + echo "for the prefix where you installed the packages whose" + echo "macros were not found" + exit 1 +} + +if grep "^AM_CONFIG_HEADER" configure.ac >/dev/null; then + echo "Running autoheader..." + autoheader || { echo "**Error**: autoheader failed."; exit 1; } +fi + +echo "Running automake --gnu $am_opt ..." +automake --add-missing --gnu $am_opt || + { echo "**Error**: automake failed."; exit 1; } +echo "Running autoconf ..." +autoconf || { echo "**Error**: autoconf failed."; exit 1; } + + +echo Running /autogen.sh ... +(cd $srcdir/ ; NOCONFIGURE=1 /bin/sh ./autogen.sh "$@") +echo Done running /autogen.sh ... + + +conf_flags="--enable-maintainer-mode --enable-compile-warnings" #--enable-iso-c + +if test x$NOCONFIGURE = x; then + echo Running $srcdir/configure $conf_flags "$@" ... + $srcdir/configure $conf_flags "$@" \ + && echo Now type \`make\' to compile $PKG_NAME || exit 1 +else + echo Skipping configure process. +fi + + + + + + + + + + +AC_INIT([]-solution,[]) +AC_CONFIG_AUX_DIR(.) +AM_INIT_AUTOMAKE([1.9 tar-ustar foreign]) +EXTRA_DIST="install-sh missing" +SOLUTION_NAME= +SOLUTION_VERSION=$VERSION +SOLUTION_DESCRIPTION="" +AC_SUBST(DESCRIPTION) + +AM_MAINTAINER_MODE + +dnl AC_PROG_INTLTOOL([0.25]) + +AC_PROG_INSTALL + +AC_MSG_CHECKING([whether we're building from an RCS]) +if test -f "$srcdir/.cvs_version" ; then + from_rcs=cvs +else + if test -f "$srcdir/.svn/entries" ; then + from_rcs=svn + else + from_rcs=no + fi +fi + +AC_MSG_RESULT($from_rcs) + +CONFIG="Release" +AC_SUBST(CONFIG) + +AC_CONFIG_SUBDIRS( +) + + +AC_OUTPUT([ +Makefile +]) + +echo "===" +echo "" +echo "Solution configuration summary" +echo "" +echo " * Solution Name: $SOLUTION_NAME" +echo " * Version: $SOLUTION_VERSION" +echo " * Packages:" +echo " - " +echo "" +echo "===" + + + + + + + + + SUBDIRS = + + + + + + + + + + + + +#! /bin/sh + +PACKAGE= +prefix=@prefix@ +exec_prefix=@exec_prefix@ + +# %%$@%$# why oh why isn't it $sharedir/ +# Day changed to 30 Mar 2007 +# ... +# 07:50 < cj> why are we installing .exe assemblies to $prefix/lib/$package/ and +# not $prefix/share/$package ? +# 07:50 < jonp> momentum. +# 07:50 < jonp> and it's hard to say that a .exe isn't platform specific +# 07:50 < jonp> as it can still contain DllImport's which make platform +# assumptions + +packagedir=$prefix/lib/ +export MONO_PATH=$MONO_PATH + +exec @RUNTIME@ $packagedir/$PACKAGE.exe "$@" + + + + + diff --git a/Prebuild/src/data/.svn/text-base/dnpb-1.0.xsd.svn-base b/Prebuild/src/data/.svn/text-base/dnpb-1.0.xsd.svn-base new file mode 100644 index 0000000..b9e0e4e --- /dev/null +++ b/Prebuild/src/data/.svn/text-base/dnpb-1.0.xsd.svn-base @@ -0,0 +1,183 @@ + + + + + Copyright (c) 2004 Matthew Holmes (kerion@houston.rr.com) + + Redistribution and use in source and binary forms, with or without modification, are permitted + provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this list of conditions + and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, this list of conditions + and the following disclaimer in the documentation and/or other materials provided with the + distribution. + * The name of the author may not be used to endorse or promote products derived from this software + without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, + BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Prebuild/src/data/.svn/text-base/dnpb-1.1.xsd.svn-base b/Prebuild/src/data/.svn/text-base/dnpb-1.1.xsd.svn-base new file mode 100644 index 0000000..2c065a3 --- /dev/null +++ b/Prebuild/src/data/.svn/text-base/dnpb-1.1.xsd.svn-base @@ -0,0 +1,184 @@ + + + + + Copyright (c) 2004 Matthew Holmes (kerion@houston.rr.com) + + Redistribution and use in source and binary forms, with or without modification, are permitted + provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this list of conditions + and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, this list of conditions + and the following disclaimer in the documentation and/or other materials provided with the + distribution. + * The name of the author may not be used to endorse or promote products derived from this software + without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, + BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Prebuild/src/data/.svn/text-base/dnpb-1.2.xsd.svn-base b/Prebuild/src/data/.svn/text-base/dnpb-1.2.xsd.svn-base new file mode 100644 index 0000000..d694ab4 --- /dev/null +++ b/Prebuild/src/data/.svn/text-base/dnpb-1.2.xsd.svn-base @@ -0,0 +1,198 @@ + + + + + Copyright (c) 2004 Matthew Holmes (calefaction _at_ houston _._ rr _._ com) + + Redistribution and use in source and binary forms, with or without modification, are permitted + provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this list of conditions + and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, this list of conditions + and the following disclaimer in the documentation and/or other materials provided with the + distribution. + * The name of the author may not be used to endorse or promote products derived from this software + without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, + BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Prebuild/src/data/.svn/text-base/dnpb-1.3.xsd.svn-base b/Prebuild/src/data/.svn/text-base/dnpb-1.3.xsd.svn-base new file mode 100644 index 0000000..8f31a54 --- /dev/null +++ b/Prebuild/src/data/.svn/text-base/dnpb-1.3.xsd.svn-base @@ -0,0 +1,206 @@ + + + + + Copyright (c) 2004-2005 Matthew Holmes (calefaction at houston . rr . com), Dan Moorehead (dan05a at gmail . com) + + .NET Pre-Build is an XML-driven pre-build tool allowing developers to + easily generate project or make files for major IDE's and .NET + development tools including: Visual Studio 2003, Visual Studio 2002, + SharpDevelop, MonoDevelop, and NAnt. + + BSD License: + + Redistribution and use in source and binary forms, with or without modification, are permitted + provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this list of conditions + and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, this list of conditions + and the following disclaimer in the documentation and/or other materials provided with the + distribution. + * The name of the author may not be used to endorse or promote products derived from this software + without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHOR 'AS IS' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, + BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Prebuild/src/data/.svn/text-base/dnpb-1.4.xsd.svn-base b/Prebuild/src/data/.svn/text-base/dnpb-1.4.xsd.svn-base new file mode 100644 index 0000000..1da50fc --- /dev/null +++ b/Prebuild/src/data/.svn/text-base/dnpb-1.4.xsd.svn-base @@ -0,0 +1,212 @@ + + + + + Copyright (c) 2004-2005 Matthew Holmes (calefaction at houston . rr . com), Dan Moorehead (dan05a at gmail . com) + + .NET Prebuild is a cross-platform XML-driven pre-build tool which + allows developers to easily generate project or make files for major + IDE's and .NET development tools including: Visual Studio .NET 2002 and + 2003, SharpDevelop, MonoDevelop, and NAnt. + + BSD License: + + Redistribution and use in source and binary forms, with or without modification, are permitted + provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this list of conditions + and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, this list of conditions + and the following disclaimer in the documentation and/or other materials provided with the + distribution. + * The name of the author may not be used to endorse or promote products derived from this software + without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHOR 'AS IS' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, + BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Prebuild/src/data/.svn/text-base/dnpb-1.5.xsd.svn-base b/Prebuild/src/data/.svn/text-base/dnpb-1.5.xsd.svn-base new file mode 100644 index 0000000..e2b21f0 --- /dev/null +++ b/Prebuild/src/data/.svn/text-base/dnpb-1.5.xsd.svn-base @@ -0,0 +1,215 @@ + + + + + Copyright (c) 2004-2005 Matthew Holmes (calefaction at houston . rr . com), Dan Moorehead (dan05a at gmail . com) + + .NET Prebuild is a cross-platform XML-driven pre-build tool which + allows developers to easily generate project or make files for major + IDE's and .NET development tools including: Visual Studio .NET 2002 and + 2003, SharpDevelop, MonoDevelop, and NAnt. + + BSD License: + + Redistribution and use in source and binary forms, with or without modification, are permitted + provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this list of conditions + and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, this list of conditions + and the following disclaimer in the documentation and/or other materials provided with the + distribution. + * The name of the author may not be used to endorse or promote products derived from this software + without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHOR 'AS IS' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, + BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Prebuild/src/data/.svn/text-base/prebuild-1.6.xsd.svn-base b/Prebuild/src/data/.svn/text-base/prebuild-1.6.xsd.svn-base new file mode 100644 index 0000000..57ebd2e --- /dev/null +++ b/Prebuild/src/data/.svn/text-base/prebuild-1.6.xsd.svn-base @@ -0,0 +1,231 @@ + + + + + Copyright (c) 2004-2005 Matthew Holmes (calefaction at houston . rr . com), Dan Moorehead (dan05a at gmail . com) + + .NET Prebuild is a cross-platform XML-driven pre-build tool which + allows developers to easily generate project or make files for major + IDE's and .NET development tools including: Visual Studio .NET 2002 and + 2003, SharpDevelop, MonoDevelop, and NAnt. + + BSD License: + + Redistribution and use in source and binary forms, with or without modification, are permitted + provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this list of conditions + and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, this list of conditions + and the following disclaimer in the documentation and/or other materials provided with the + distribution. + * The name of the author may not be used to endorse or promote products derived from this software + without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHOR 'AS IS' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, + BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Prebuild/src/data/.svn/text-base/prebuild-1.7.xsd.svn-base b/Prebuild/src/data/.svn/text-base/prebuild-1.7.xsd.svn-base new file mode 100644 index 0000000..a7f5c88 --- /dev/null +++ b/Prebuild/src/data/.svn/text-base/prebuild-1.7.xsd.svn-base @@ -0,0 +1,350 @@ + + + + + Copyright (c) 2004-2007 + Matthew Holmes (calefaction at houston . rr . com), + Dan Moorehead (dan05a at gmail . com), + David Hudson (jendave at yahoo dot com), + C.J. Adams-Collier (cjac at colliertech dot com) + + .NET Prebuild is a cross-platform XML-driven pre-build tool which + allows developers to easily generate project or make files for major + IDE's and .NET development tools including: Visual Studio .NET 2002, + 2003, and 2005, SharpDevelop, MonoDevelop, NAnt, Xcode and the GNU Autotools. + + BSD License: + + Redistribution and use in source and binary forms, with or without modification, are permitted + provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this list of conditions + and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, this list of conditions + and the following disclaimer in the documentation and/or other materials provided with the + distribution. + * The name of the author may not be used to endorse or promote products derived from this software + without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHOR 'AS IS' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, + BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Prebuild/src/data/.svn/text-base/prebuild-1.8.xsd.svn-base b/Prebuild/src/data/.svn/text-base/prebuild-1.8.xsd.svn-base new file mode 100644 index 0000000..8f5c1a4 --- /dev/null +++ b/Prebuild/src/data/.svn/text-base/prebuild-1.8.xsd.svn-base @@ -0,0 +1,331 @@ + + + + + Copyright (c) 2004-2007 + Matthew Holmes (calefaction at houston . rr . com), + Dan Moorehead (dan05a at gmail . com), + David Hudson (jendave at yahoo dot com), + C.J. Adams-Collier (cjac at colliertech dot com) + + .NET Prebuild is a cross-platform XML-driven pre-build tool which + allows developers to easily generate project or make files for major + IDE's and .NET development tools including: Visual Studio .NET 2002, + 2003, and 2005, SharpDevelop, MonoDevelop, NAnt, Xcode and the GNU Autotools. + + BSD License: + + Redistribution and use in source and binary forms, with or without modification, are permitted + provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this list of conditions + and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, this list of conditions + and the following disclaimer in the documentation and/or other materials provided with the + distribution. + * The name of the author may not be used to endorse or promote products derived from this software + without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHOR 'AS IS' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, + BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Prebuild/src/data/.svn/text-base/prebuild-1.9.xsd.svn-base b/Prebuild/src/data/.svn/text-base/prebuild-1.9.xsd.svn-base new file mode 100644 index 0000000..d647e08 --- /dev/null +++ b/Prebuild/src/data/.svn/text-base/prebuild-1.9.xsd.svn-base @@ -0,0 +1,336 @@ + + + + + Copyright (c) 2004-2007 + Matthew Holmes (calefaction at houston . rr . com), + Dan Moorehead (dan05a at gmail . com), + David Hudson (jendave at yahoo dot com), + C.J. Adams-Collier (cjac at colliertech dot com) + + .NET Prebuild is a cross-platform XML-driven pre-build tool which + allows developers to easily generate project or make files for major + IDE's and .NET development tools including: Visual Studio .NET 2002, + 2003, and 2005, SharpDevelop, MonoDevelop, NAnt, Xcode and the GNU Autotools. + + BSD License: + + Redistribution and use in source and binary forms, with or without modification, are permitted + provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this list of conditions + and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, this list of conditions + and the following disclaimer in the documentation and/or other materials provided with the + distribution. + * The name of the author may not be used to endorse or promote products derived from this software + without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHOR 'AS IS' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, + BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Prebuild/src/data/autotools.xml b/Prebuild/src/data/autotools.xml new file mode 100644 index 0000000..ee4b064 --- /dev/null +++ b/Prebuild/src/data/autotools.xml @@ -0,0 +1,790 @@ + + + + + #!/bin/sh +# Run this to generate all the initial makefiles, etc. +# Ripped off from Mono, which ripped off from GNOME macros version + +DIE=0 + +srcdir=`dirname $0` +test -z "$srcdir" && srcdir=. + +if [ -n "$MONO_PATH" ]; then + # from -> /mono/lib:/another/mono/lib + # to -> /mono /another/mono + for i in `echo ${MONO_PATH} | tr ":" " "`; do + i=`dirname ${i}` + if [ -n "{i}" -a -d "${i}/share/aclocal" ]; then + ACLOCAL_FLAGS="-I ${i}/share/aclocal $ACLOCAL_FLAGS" + fi + if [ -n "{i}" -a -d "${i}/bin" ]; then + PATH="${i}/bin:$PATH" + fi + done + export PATH +fi + +(autoconf --version) < /dev/null > /dev/null 2>&1 || { + echo + echo "**Error**: You must have \`autoconf' installed to compile Mono." + echo "Download the appropriate package for your distribution," + echo "or get the source tarball at ftp://ftp.gnu.org/pub/gnu/" + DIE=1 +} + +if [ -z "$LIBTOOL" ]; then + LIBTOOL=`which glibtool 2>/dev/null` + if [ ! -x "$LIBTOOL" ]; then + LIBTOOL=`which libtool` + fi +fi + +(grep "^AM_PROG_LIBTOOL" $srcdir/configure.ac >/dev/null) && { + ($LIBTOOL --version) < /dev/null > /dev/null 2>&1 || { + echo + echo "**Error**: You must have \`libtool' installed to compile Mono." + echo "Get ftp://ftp.gnu.org/pub/gnu/libtool-1.2d.tar.gz" + echo "(or a newer version if it is available)" + DIE=1 + } +} + +grep "^AM_GNU_GETTEXT" $srcdir/configure.ac >/dev/null && { + grep "sed.*POTFILES" $srcdir/configure.ac >/dev/null || \ + (gettext --version) < /dev/null > /dev/null 2>&1 || { + echo + echo "**Error**: You must have \`gettext' installed to compile Mono." + echo "Get ftp://alpha.gnu.org/gnu/gettext-0.10.35.tar.gz" + echo "(or a newer version if it is available)" + DIE=1 + } +} + +(automake --version) < /dev/null > /dev/null 2>&1 || { + echo + echo "**Error**: You must have \`automake' installed to compile Mono." + echo "Get ftp://ftp.gnu.org/pub/gnu/automake-1.3.tar.gz" + echo "(or a newer version if it is available)" + DIE=1 + NO_AUTOMAKE=yes +} + +# if no automake, don't bother testing for aclocal +test -n "$NO_AUTOMAKE" || (aclocal --version) < /dev/null > /dev/null 2>&1 || { + echo + echo "**Error**: Missing \`aclocal'. The version of \`automake'" + echo "installed doesn't appear recent enough." + echo "Get ftp://ftp.gnu.org/pub/gnu/automake-1.3.tar.gz" + echo "(or a newer version if it is available)" + DIE=1 +} + +if test "$DIE" -eq 1; then + exit 1 +fi + +if test -z "$NOCONFIGURE"; then + +if test -z "$*"; then + echo "**Warning**: I am going to run \`configure' with no arguments." + echo "If you wish to pass any to it, please specify them on the" + echo \`$0\'" command line." + echo +fi + +fi + +case $CC in +xlc ) + am_opt=--include-deps;; +esac + + +if grep "^AM_PROG_LIBTOOL" configure.ac >/dev/null; then + if test -z "$NO_LIBTOOLIZE" ; then + echo "Running libtoolize..." + ${LIBTOOL}ize --force --copy + fi +fi + +echo "Running aclocal $ACLOCAL_FLAGS ..." +aclocal $ACLOCAL_FLAGS || { + echo + echo "**Error**: aclocal failed. This may mean that you have not" + echo "installed all of the packages you need, or you may need to" + echo "set ACLOCAL_FLAGS to include \"-I \$prefix/share/aclocal\"" + echo "for the prefix where you installed the packages whose" + echo "macros were not found" + exit 1 +} + +if grep "^AM_CONFIG_HEADER" configure.ac >/dev/null; then + echo "Running autoheader..." + autoheader || { echo "**Error**: autoheader failed."; exit 1; } +fi + +echo "Running automake --gnu $am_opt ..." +automake --add-missing --gnu $am_opt || + { echo "**Error**: automake failed."; exit 1; } +echo "Running autoconf ..." +autoconf || { echo "**Error**: autoconf failed."; exit 1; } + +conf_flags="--enable-maintainer-mode --enable-compile-warnings" #--enable-iso-c + +if test x$NOCONFIGURE = x; then + echo Running $srcdir/configure $conf_flags "$@" ... + $srcdir/configure $conf_flags "$@" \ + && echo Now type \`make\' to compile $PKG_NAME || exit 1 +else + echo Skipping configure process. +fi + + + + + + + + + + + + + + + + AC_INIT([],[]) + +AC_PREREQ(2.60) +AC_CANONICAL_SYSTEM +AC_CONFIG_AUX_DIR(.) +AM_INIT_AUTOMAKE([1.9 tar-ustar foreign]) +AM_MAINTAINER_MODE +dnl AC_PROG_INTLTOOL([0.25]) +AC_PROG_INSTALL + +ASSEMBLY_NAME= +PROJECT_NAME= +PROJECT_VERSION=$VERSION +PROJECT_DESCRIPTION="" +PROJECT_TYPE="" + +AC_SUBST(ASSEMBLY_NAME) +AC_SUBST(PROJECT_NAME) +AC_SUBST(PROJECT_VERSION) +AC_SUBST(DESCRIPTION) + +AC_MSG_CHECKING([assembly type]) +case $PROJECT_TYPE in + *Exe) + ASSEMBLY_EXTENSION=exe + ;; + *Library) + ASSEMBLY_EXTENSION=dll + ;; + *) + AC_MSG_ERROR([*** Please add support for project type $PROJECT_TYPE to configure.ac checks!]) + ;; +esac +AC_MSG_RESULT([$PROJECT_TYPE]) + +AC_SUBST(ASSEMBLY_EXTENSION) + +AC_MSG_CHECKING([whether we're compiling from an RCS]) +if test -f "$srcdir/.cvs_version" ; then + from_rcs=cvs +else + if test -f "$srcdir/.svn/entries" ; then + from_rcs=svn + else + from_rcs=no + fi +fi + +AC_MSG_RESULT($from_rcs) + +MONO_REQUIRED_VERSION=1.1 + +PKG_CHECK_MODULES(MONO_DEPENDENCY, mono >= $MONO_REQUIRED_VERSION, has_mono=true, has_mono=false) + +if test "x$has_mono" = "xtrue"; then + AC_PATH_PROG(RUNTIME, mono, no) + AC_PATH_PROG(CSC, gmcs, no) + AC_PATH_PROG(RESGEN, resgen2, no) + if test `uname -s` = "Darwin"; then + LIB_PREFIX= + LIB_SUFFIX=.dylib + else + LIB_PREFIX=.so + LIB_SUFFIX= + fi +else + AC_PATH_PROG(CSC, csc.exe, no) + if test x$CSC = "xno"; then + AC_MSG_ERROR([You need to install either mono or .Net]) + else + RUNTIME= + LIB_PREFIX= + LIB_SUFFIX= + fi +fi + +AC_PATH_PROG(GACUTIL, gacutil) +if test "x$GACUTIL" = "xno" ; then + AC_MSG_ERROR([No gacutil tool found]) +fi + +GACUTIL_FLAGS='/package /gacdir $(DESTDIR)$(prefix)/lib' +AC_SUBST(GACUTIL_FLAGS) + +AC_SUBST(PATH) +AC_SUBST(LD_LIBRARY_PATH) + +AC_SUBST(LIB_PREFIX) +AC_SUBST(LIB_SUFFIX) +AC_SUBST(RUNTIME) +AC_SUBST(CSC) +AC_SUBST(RESGEN) +AC_SUBST(GACUTIL) + +AC_SUBST(BASE_DEPENDENCIES_CFLAGS) +AC_SUBST(BASE_DEPENDENCIES_LIBS) + +dnl Find monodoc +MONODOC_REQUIRED_VERSION=1.0 +AC_SUBST(MONODOC_REQUIRED_VERSION) + +PKG_CHECK_MODULES(MONODOC_DEPENDENCY, monodoc >= $MONODOC_REQUIRED_VERSION, enable_monodoc=yes, enable_monodoc=no) + +if test "x$enable_monodoc" = "xyes"; then + AC_PATH_PROG(MONODOC, monodoc, no) + if test x$MONODOC = xno; then + enable_monodoc=no + fi +else + MONODOC= +fi + +AC_SUBST(MONODOC) +AM_CONDITIONAL(ENABLE_MONODOC, test "x$enable_monodoc" = "xyes") + +winbuild=no +case "$host" in + *-*-mingw*|*-*-cygwin*) + winbuild=yes + ;; +esac +AM_CONDITIONAL(WINBUILD, test x$winbuild = xyes) + +AC_CONFIG_FILES() +AC_CONFIG_FILES(.pc) + +AC_CONFIG_FILES(Makefile) +AC_OUTPUT + +echo "===" +echo "" +echo "Project configuration summary" +echo "" +echo " * Installation prefix: $prefix" +echo " * compiler: $CSC" +echo " * Documentation: $enable_monodoc ($MONODOC)" +echo " * Project Name: $PROJECT_NAME" +echo " * Version: $PROJECT_VERSION" +echo "" +echo "===" + + + + + + + + + + + + + + + + + + + + + + + + + + +ASSEMBLY=$(ASSEMBLY_NAME).$(ASSEMBLY_EXTENSION) + + +dir = $(prefix)/lib/ +_DATA = $(ASSEMBLY) $(ASSEMBLY).config + +bin_SCRIPTS= + +pkgconfigdir = $(prefix)/lib/pkgconfig +pkgconfig_DATA = .pc + +dir = $(prefix)/lib/mono/ +_DATA = $(ASSEMBLY).config + +noinst_DATA = $(ASSEMBLY) + + +PACKAGES = +BINARY_LIBS = +SYSTEM_LIBS = +RESOURCES_SRC = +RESOURCES = $(RESOURCES_SRC:.resx=.resources) +SOURCES = + +EXTRA_DIST=$(SOURCES) $(BINARY_LIBS) $(RESOURCES_SRC) install-sh missing + +CLEANFILES=$(ASSEMBLY) + + + + + + + +/$(ASSEMBLY): $(srcdir)/$(ASSEMBLY).response $(RESOURCES) $(SOURCES) $(BINARY_LIBS) + mkdir -p doc && mkdir -p && $(CSC) /out:$@ \ + /target: \ + $(addprefix /resource:$(srcdir)/, $(RESOURCES)) \ + $(addprefix /pkg:, $(PACKAGES)) \ + $(addprefix /r:, $(SYSTEM_LIBS)) \ + $(addprefix /r:$(srcdir)/, $(BINARY_LIBS)) \ + @$(srcdir)/$(ASSEMBLY).response \ + /doc:doc/ \ + /keyfile:$(srcdir)/ \ + /unsafe \ + && rm -f $(ASSEMBLY) \ + && ln $@ $(ASSEMBLY) + +CLEANFILES+=/$(ASSEMBLY) + + +EXTRA_DIST+= + +: /$(ASSEMBLY) + rm -f $(ASSEMBLY) \ + && ln /$(ASSEMBLY) $(ASSEMBLY) + + + + + +_install-data-local: /$(ASSEMBLY) + echo "$(GACUTIL) /i $(ASSEMBLY) /f $(GACUTIL_FLAGS)"; \ + $(GACUTIL) /i $(ASSEMBLY) /f $(GACUTIL_FLAGS) || exit 1; + +_uninstall-local: + if [`gacutil -l | grep "Number" | awk -F= '{print $$2}'` -gt "0" ] ; \ + then \ + echo "$(GACUTIL) /u $(ASSEMBLY_NAME) $(GACUTIL_FLAGS)"; \ + $(GACUTIL) /u $(ASSEMBLY_NAME) $(GACUTIL_FLAGS) || exit 1; \ + fi + + + +noinst__dir = $(prefix)/lib/mono/ +noinst___DATA = /$(ASSEMBLY) + + + + + + +$(ASSEMBLY): + + +$(srcdir)/$(ASSEMBLY).response: $(srcdir)/Makefile + echo "$(addprefix $(srcdir)/, $(SOURCES))" > $@ + + +all: $(ASSEMBLY) + +# rule to compile .resx files to .resources +%.resources: %.resx + $(RESGEN) /useSourcePath /compile $(@:.resources=.resx) + + + + + +install-data-local: _install-data-local + +uninstall-local: _uninstall-local + + + +#dir+=$(noinst__dir) +#_DATA+=$(noinst___DATA) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +prefix=@prefix@ +exec_prefix=${prefix} +libdir=${exec_prefix}/lib/mono/@PROJECT_NAME@ + +Name: +Description: +Version: @PROJECT_VERSION@ +Requires: +Libs: -r:${libdir}/@PROJECT_NAME@.dll + + + + + + + + + + + #!/bin/sh +# Run this to generate all the initial makefiles, etc. +# Ripped off from Mono, which ripped off from GNOME macros version + +DIE=0 + +srcdir=`dirname $0` +test -z "$srcdir" && srcdir=. + +if [ -n "$MONO_PATH" ]; then + # from -> /mono/lib:/another/mono/lib + # to -> /mono /another/mono + for i in `echo ${MONO_PATH} | tr ":" " "`; do + i=`dirname ${i}` + if [ -n "{i}" -a -d "${i}/share/aclocal" ]; then + ACLOCAL_FLAGS="-I ${i}/share/aclocal $ACLOCAL_FLAGS" + fi + if [ -n "{i}" -a -d "${i}/bin" ]; then + PATH="${i}/bin:$PATH" + fi + done + export PATH +fi + +(autoconf --version) < /dev/null > /dev/null 2>&1 || { + echo + echo "**Error**: You must have \`autoconf' installed to compile Mono." + echo "Download the appropriate package for your distribution," + echo "or get the source tarball at ftp://ftp.gnu.org/pub/gnu/" + DIE=1 +} + +if [ -z "$LIBTOOL" ]; then + LIBTOOL=`which glibtool 2>/dev/null` + if [ ! -x "$LIBTOOL" ]; then + LIBTOOL=`which libtool` + fi +fi + +(grep "^AM_PROG_LIBTOOL" $srcdir/configure.ac >/dev/null) && { + ($LIBTOOL --version) < /dev/null > /dev/null 2>&1 || { + echo + echo "**Error**: You must have \`libtool' installed to compile Mono." + echo "Get ftp://ftp.gnu.org/pub/gnu/libtool-1.2d.tar.gz" + echo "(or a newer version if it is available)" + DIE=1 + } +} + +grep "^AM_GNU_GETTEXT" $srcdir/configure.ac >/dev/null && { + grep "sed.*POTFILES" $srcdir/configure.ac >/dev/null || \ + (gettext --version) < /dev/null > /dev/null 2>&1 || { + echo + echo "**Error**: You must have \`gettext' installed to compile Mono." + echo "Get ftp://alpha.gnu.org/gnu/gettext-0.10.35.tar.gz" + echo "(or a newer version if it is available)" + DIE=1 + } +} + +(automake --version) < /dev/null > /dev/null 2>&1 || { + echo + echo "**Error**: You must have \`automake' installed to compile Mono." + echo "Get ftp://ftp.gnu.org/pub/gnu/automake-1.3.tar.gz" + echo "(or a newer version if it is available)" + DIE=1 + NO_AUTOMAKE=yes +} + + +# if no automake, don't bother testing for aclocal +test -n "$NO_AUTOMAKE" || (aclocal --version) < /dev/null > /dev/null 2>&1 || { + echo + echo "**Error**: Missing \`aclocal'. The version of \`automake'" + echo "installed doesn't appear recent enough." + echo "Get ftp://ftp.gnu.org/pub/gnu/automake-1.3.tar.gz" + echo "(or a newer version if it is available)" + DIE=1 +} + +if test "$DIE" -eq 1; then + exit 1 +fi + +if test -z "$*"; then + echo "**Warning**: I am going to run \`configure' with no arguments." + echo "If you wish to pass any to it, please specify them on the" + echo \`$0\'" command line." + echo +fi + +case $CC in +xlc ) + am_opt=--include-deps;; +esac + + +if grep "^AM_PROG_LIBTOOL" configure.ac >/dev/null; then + if test -z "$NO_LIBTOOLIZE" ; then + echo "Running libtoolize..." + ${LIBTOOL}ize --force --copy + fi +fi + +echo "Running aclocal $ACLOCAL_FLAGS ..." +aclocal $ACLOCAL_FLAGS || { + echo + echo "**Error**: aclocal failed. This may mean that you have not" + echo "installed all of the packages you need, or you may need to" + echo "set ACLOCAL_FLAGS to include \"-I \$prefix/share/aclocal\"" + echo "for the prefix where you installed the packages whose" + echo "macros were not found" + exit 1 +} + +if grep "^AM_CONFIG_HEADER" configure.ac >/dev/null; then + echo "Running autoheader..." + autoheader || { echo "**Error**: autoheader failed."; exit 1; } +fi + +echo "Running automake --gnu $am_opt ..." +automake --add-missing --gnu $am_opt || + { echo "**Error**: automake failed."; exit 1; } +echo "Running autoconf ..." +autoconf || { echo "**Error**: autoconf failed."; exit 1; } + + +echo Running /autogen.sh ... +(cd $srcdir/ ; NOCONFIGURE=1 /bin/sh ./autogen.sh "$@") +echo Done running /autogen.sh ... + + +conf_flags="--enable-maintainer-mode --enable-compile-warnings" #--enable-iso-c + +if test x$NOCONFIGURE = x; then + echo Running $srcdir/configure $conf_flags "$@" ... + $srcdir/configure $conf_flags "$@" \ + && echo Now type \`make\' to compile $PKG_NAME || exit 1 +else + echo Skipping configure process. +fi + + + + + + + + + + +AC_INIT([]-solution,[]) +AC_CONFIG_AUX_DIR(.) +AM_INIT_AUTOMAKE([1.9 tar-ustar foreign]) +EXTRA_DIST="install-sh missing" +SOLUTION_NAME= +SOLUTION_VERSION=$VERSION +SOLUTION_DESCRIPTION="" +AC_SUBST(DESCRIPTION) + +AM_MAINTAINER_MODE + +dnl AC_PROG_INTLTOOL([0.25]) + +AC_PROG_INSTALL + +AC_MSG_CHECKING([whether we're building from an RCS]) +if test -f "$srcdir/.cvs_version" ; then + from_rcs=cvs +else + if test -f "$srcdir/.svn/entries" ; then + from_rcs=svn + else + from_rcs=no + fi +fi + +AC_MSG_RESULT($from_rcs) + +CONFIG="Release" +AC_SUBST(CONFIG) + +AC_CONFIG_SUBDIRS( +) + + +AC_OUTPUT([ +Makefile +]) + +echo "===" +echo "" +echo "Solution configuration summary" +echo "" +echo " * Solution Name: $SOLUTION_NAME" +echo " * Version: $SOLUTION_VERSION" +echo " * Packages:" +echo " - " +echo "" +echo "===" + + + + + + + + + SUBDIRS = + + + + + + + + + + + + +#! /bin/sh + +PACKAGE= +prefix=@prefix@ +exec_prefix=@exec_prefix@ + +# %%$@%$# why oh why isn't it $sharedir/ +# Day changed to 30 Mar 2007 +# ... +# 07:50 < cj> why are we installing .exe assemblies to $prefix/lib/$package/ and +# not $prefix/share/$package ? +# 07:50 < jonp> momentum. +# 07:50 < jonp> and it's hard to say that a .exe isn't platform specific +# 07:50 < jonp> as it can still contain DllImport's which make platform +# assumptions + +packagedir=$prefix/lib/ +export MONO_PATH=$MONO_PATH + +exec @RUNTIME@ $packagedir/$PACKAGE.exe "$@" + + + + + diff --git a/Prebuild/src/data/dnpb-1.0.xsd b/Prebuild/src/data/dnpb-1.0.xsd new file mode 100644 index 0000000..b9e0e4e --- /dev/null +++ b/Prebuild/src/data/dnpb-1.0.xsd @@ -0,0 +1,183 @@ + + + + + Copyright (c) 2004 Matthew Holmes (kerion@houston.rr.com) + + Redistribution and use in source and binary forms, with or without modification, are permitted + provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this list of conditions + and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, this list of conditions + and the following disclaimer in the documentation and/or other materials provided with the + distribution. + * The name of the author may not be used to endorse or promote products derived from this software + without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, + BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Prebuild/src/data/dnpb-1.1.xsd b/Prebuild/src/data/dnpb-1.1.xsd new file mode 100644 index 0000000..2c065a3 --- /dev/null +++ b/Prebuild/src/data/dnpb-1.1.xsd @@ -0,0 +1,184 @@ + + + + + Copyright (c) 2004 Matthew Holmes (kerion@houston.rr.com) + + Redistribution and use in source and binary forms, with or without modification, are permitted + provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this list of conditions + and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, this list of conditions + and the following disclaimer in the documentation and/or other materials provided with the + distribution. + * The name of the author may not be used to endorse or promote products derived from this software + without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, + BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Prebuild/src/data/dnpb-1.2.xsd b/Prebuild/src/data/dnpb-1.2.xsd new file mode 100644 index 0000000..d694ab4 --- /dev/null +++ b/Prebuild/src/data/dnpb-1.2.xsd @@ -0,0 +1,198 @@ + + + + + Copyright (c) 2004 Matthew Holmes (calefaction _at_ houston _._ rr _._ com) + + Redistribution and use in source and binary forms, with or without modification, are permitted + provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this list of conditions + and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, this list of conditions + and the following disclaimer in the documentation and/or other materials provided with the + distribution. + * The name of the author may not be used to endorse or promote products derived from this software + without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, + BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Prebuild/src/data/dnpb-1.3.xsd b/Prebuild/src/data/dnpb-1.3.xsd new file mode 100644 index 0000000..8f31a54 --- /dev/null +++ b/Prebuild/src/data/dnpb-1.3.xsd @@ -0,0 +1,206 @@ + + + + + Copyright (c) 2004-2005 Matthew Holmes (calefaction at houston . rr . com), Dan Moorehead (dan05a at gmail . com) + + .NET Pre-Build is an XML-driven pre-build tool allowing developers to + easily generate project or make files for major IDE's and .NET + development tools including: Visual Studio 2003, Visual Studio 2002, + SharpDevelop, MonoDevelop, and NAnt. + + BSD License: + + Redistribution and use in source and binary forms, with or without modification, are permitted + provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this list of conditions + and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, this list of conditions + and the following disclaimer in the documentation and/or other materials provided with the + distribution. + * The name of the author may not be used to endorse or promote products derived from this software + without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHOR 'AS IS' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, + BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Prebuild/src/data/dnpb-1.4.xsd b/Prebuild/src/data/dnpb-1.4.xsd new file mode 100644 index 0000000..1da50fc --- /dev/null +++ b/Prebuild/src/data/dnpb-1.4.xsd @@ -0,0 +1,212 @@ + + + + + Copyright (c) 2004-2005 Matthew Holmes (calefaction at houston . rr . com), Dan Moorehead (dan05a at gmail . com) + + .NET Prebuild is a cross-platform XML-driven pre-build tool which + allows developers to easily generate project or make files for major + IDE's and .NET development tools including: Visual Studio .NET 2002 and + 2003, SharpDevelop, MonoDevelop, and NAnt. + + BSD License: + + Redistribution and use in source and binary forms, with or without modification, are permitted + provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this list of conditions + and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, this list of conditions + and the following disclaimer in the documentation and/or other materials provided with the + distribution. + * The name of the author may not be used to endorse or promote products derived from this software + without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHOR 'AS IS' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, + BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Prebuild/src/data/dnpb-1.5.xsd b/Prebuild/src/data/dnpb-1.5.xsd new file mode 100644 index 0000000..e2b21f0 --- /dev/null +++ b/Prebuild/src/data/dnpb-1.5.xsd @@ -0,0 +1,215 @@ + + + + + Copyright (c) 2004-2005 Matthew Holmes (calefaction at houston . rr . com), Dan Moorehead (dan05a at gmail . com) + + .NET Prebuild is a cross-platform XML-driven pre-build tool which + allows developers to easily generate project or make files for major + IDE's and .NET development tools including: Visual Studio .NET 2002 and + 2003, SharpDevelop, MonoDevelop, and NAnt. + + BSD License: + + Redistribution and use in source and binary forms, with or without modification, are permitted + provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this list of conditions + and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, this list of conditions + and the following disclaimer in the documentation and/or other materials provided with the + distribution. + * The name of the author may not be used to endorse or promote products derived from this software + without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHOR 'AS IS' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, + BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Prebuild/src/data/prebuild-1.6.xsd b/Prebuild/src/data/prebuild-1.6.xsd new file mode 100644 index 0000000..57ebd2e --- /dev/null +++ b/Prebuild/src/data/prebuild-1.6.xsd @@ -0,0 +1,231 @@ + + + + + Copyright (c) 2004-2005 Matthew Holmes (calefaction at houston . rr . com), Dan Moorehead (dan05a at gmail . com) + + .NET Prebuild is a cross-platform XML-driven pre-build tool which + allows developers to easily generate project or make files for major + IDE's and .NET development tools including: Visual Studio .NET 2002 and + 2003, SharpDevelop, MonoDevelop, and NAnt. + + BSD License: + + Redistribution and use in source and binary forms, with or without modification, are permitted + provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this list of conditions + and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, this list of conditions + and the following disclaimer in the documentation and/or other materials provided with the + distribution. + * The name of the author may not be used to endorse or promote products derived from this software + without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHOR 'AS IS' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, + BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Prebuild/src/data/prebuild-1.7.xsd b/Prebuild/src/data/prebuild-1.7.xsd new file mode 100644 index 0000000..a7f5c88 --- /dev/null +++ b/Prebuild/src/data/prebuild-1.7.xsd @@ -0,0 +1,350 @@ + + + + + Copyright (c) 2004-2007 + Matthew Holmes (calefaction at houston . rr . com), + Dan Moorehead (dan05a at gmail . com), + David Hudson (jendave at yahoo dot com), + C.J. Adams-Collier (cjac at colliertech dot com) + + .NET Prebuild is a cross-platform XML-driven pre-build tool which + allows developers to easily generate project or make files for major + IDE's and .NET development tools including: Visual Studio .NET 2002, + 2003, and 2005, SharpDevelop, MonoDevelop, NAnt, Xcode and the GNU Autotools. + + BSD License: + + Redistribution and use in source and binary forms, with or without modification, are permitted + provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this list of conditions + and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, this list of conditions + and the following disclaimer in the documentation and/or other materials provided with the + distribution. + * The name of the author may not be used to endorse or promote products derived from this software + without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHOR 'AS IS' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, + BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Prebuild/src/data/prebuild-1.8.xsd b/Prebuild/src/data/prebuild-1.8.xsd new file mode 100644 index 0000000..8f5c1a4 --- /dev/null +++ b/Prebuild/src/data/prebuild-1.8.xsd @@ -0,0 +1,331 @@ + + + + + Copyright (c) 2004-2007 + Matthew Holmes (calefaction at houston . rr . com), + Dan Moorehead (dan05a at gmail . com), + David Hudson (jendave at yahoo dot com), + C.J. Adams-Collier (cjac at colliertech dot com) + + .NET Prebuild is a cross-platform XML-driven pre-build tool which + allows developers to easily generate project or make files for major + IDE's and .NET development tools including: Visual Studio .NET 2002, + 2003, and 2005, SharpDevelop, MonoDevelop, NAnt, Xcode and the GNU Autotools. + + BSD License: + + Redistribution and use in source and binary forms, with or without modification, are permitted + provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this list of conditions + and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, this list of conditions + and the following disclaimer in the documentation and/or other materials provided with the + distribution. + * The name of the author may not be used to endorse or promote products derived from this software + without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHOR 'AS IS' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, + BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Prebuild/src/data/prebuild-1.9.xsd b/Prebuild/src/data/prebuild-1.9.xsd new file mode 100644 index 0000000..d647e08 --- /dev/null +++ b/Prebuild/src/data/prebuild-1.9.xsd @@ -0,0 +1,336 @@ + + + + + Copyright (c) 2004-2007 + Matthew Holmes (calefaction at houston . rr . com), + Dan Moorehead (dan05a at gmail . com), + David Hudson (jendave at yahoo dot com), + C.J. Adams-Collier (cjac at colliertech dot com) + + .NET Prebuild is a cross-platform XML-driven pre-build tool which + allows developers to easily generate project or make files for major + IDE's and .NET development tools including: Visual Studio .NET 2002, + 2003, and 2005, SharpDevelop, MonoDevelop, NAnt, Xcode and the GNU Autotools. + + BSD License: + + Redistribution and use in source and binary forms, with or without modification, are permitted + provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this list of conditions + and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, this list of conditions + and the following disclaimer in the documentation and/or other materials provided with the + distribution. + * The name of the author may not be used to endorse or promote products derived from this software + without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHOR 'AS IS' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, + BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Prebuild/tests/.svn/all-wcprops b/Prebuild/tests/.svn/all-wcprops new file mode 100644 index 0000000..0668acb --- /dev/null +++ b/Prebuild/tests/.svn/all-wcprops @@ -0,0 +1,59 @@ +K 25 +svn:wc:ra_dav:version-url +V 47 +/svnroot/dnpb/!svn/ver/280/trunk/Prebuild/tests +END +include-001.expected +K 25 +svn:wc:ra_dav:version-url +V 68 +/svnroot/dnpb/!svn/ver/279/trunk/Prebuild/tests/include-001.expected +END +include-002.expected +K 25 +svn:wc:ra_dav:version-url +V 68 +/svnroot/dnpb/!svn/ver/280/trunk/Prebuild/tests/include-002.expected +END +include-001.include +K 25 +svn:wc:ra_dav:version-url +V 67 +/svnroot/dnpb/!svn/ver/279/trunk/Prebuild/tests/include-001.include +END +include-002-2.include +K 25 +svn:wc:ra_dav:version-url +V 69 +/svnroot/dnpb/!svn/ver/280/trunk/Prebuild/tests/include-002-2.include +END +include-002.include +K 25 +svn:wc:ra_dav:version-url +V 67 +/svnroot/dnpb/!svn/ver/280/trunk/Prebuild/tests/include-002.include +END +include-001.prebuild +K 25 +svn:wc:ra_dav:version-url +V 68 +/svnroot/dnpb/!svn/ver/279/trunk/Prebuild/tests/include-001.prebuild +END +include-002.prebuild +K 25 +svn:wc:ra_dav:version-url +V 68 +/svnroot/dnpb/!svn/ver/280/trunk/Prebuild/tests/include-002.prebuild +END +README.txt +K 25 +svn:wc:ra_dav:version-url +V 58 +/svnroot/dnpb/!svn/ver/279/trunk/Prebuild/tests/README.txt +END +Makefile +K 25 +svn:wc:ra_dav:version-url +V 56 +/svnroot/dnpb/!svn/ver/279/trunk/Prebuild/tests/Makefile +END diff --git a/Prebuild/tests/.svn/entries b/Prebuild/tests/.svn/entries new file mode 100644 index 0000000..2a70cf9 --- /dev/null +++ b/Prebuild/tests/.svn/entries @@ -0,0 +1,334 @@ +10 + +dir +323 +https://dnpb.svn.sourceforge.net/svnroot/dnpb/trunk/Prebuild/tests +https://dnpb.svn.sourceforge.net/svnroot/dnpb + + + +2008-12-10T02:26:03.443834Z +280 +dmoonfire + + + + + + + + + + + + + + +3355ff64-970d-0410-bbe8-d0fbd18be4fb + +include-001.expected +file + + + + +2010-09-10T22:51:45.000000Z +d65010a81975867917d4468950ec7ccc +2008-12-10T02:04:22.474237Z +279 +dmoonfire + + + + + + + + + + + + + + + + + + + + + +1784 + +include-002.expected +file + + + + +2010-09-10T22:51:45.000000Z +dcef68172b57f9e1b2228f1dba535934 +2008-12-10T02:26:03.443834Z +280 +dmoonfire + + + + + + + + + + + + + + + + + + + + + +1150 + +include-001.include +file + + + + +2010-09-10T22:51:45.000000Z +92601282deffe7c461f80b407525446d +2008-12-10T02:04:22.474237Z +279 +dmoonfire + + + + + + + + + + + + + + + + + + + + + +983 + +include-002-2.include +file + + + + +2010-09-10T22:51:45.000000Z +d9f24dc85d95d7310516187910433c8c +2008-12-10T02:26:03.443834Z +280 +dmoonfire + + + + + + + + + + + + + + + + + + + + + +307 + +include-002.include +file + + + + +2010-09-10T22:51:45.000000Z +44815ffa6c2dc32d4df9977b5fe49ca4 +2008-12-10T02:26:03.443834Z +280 +dmoonfire + + + + + + + + + + + + + + + + + + + + + +332 + +include-001.prebuild +file + + + + +2010-09-10T22:51:45.000000Z +d01a5391189ada3dcd7d3becf254f151 +2008-12-10T02:04:22.474237Z +279 +dmoonfire + + + + + + + + + + + + + + + + + + + + + +742 + +include-002.prebuild +file + + + + +2010-09-10T22:51:45.000000Z +22ad11b07dd489b41ec998e03c83a397 +2008-12-10T02:26:03.443834Z +280 +dmoonfire + + + + + + + + + + + + + + + + + + + + + +289 + +README.txt +file + + + + +2010-09-10T22:51:45.000000Z +6b111c08a76e929cb94b77c99774ef78 +2008-12-10T02:04:22.474237Z +279 +dmoonfire + + + + + + + + + + + + + + + + + + + + + +326 + +Makefile +file + + + + +2010-09-10T22:51:45.000000Z +eed6712c3f5e4478d92137f6657aba56 +2008-12-10T02:04:22.474237Z +279 +dmoonfire + + + + + + + + + + + + + + + + + + + + + +456 + diff --git a/Prebuild/tests/.svn/text-base/Makefile.svn-base b/Prebuild/tests/.svn/text-base/Makefile.svn-base new file mode 100644 index 0000000..4a8ddf4 --- /dev/null +++ b/Prebuild/tests/.svn/text-base/Makefile.svn-base @@ -0,0 +1,24 @@ +# +# Executable +# + +# Executables +PREBUILD = mono ../src/bin/Release/prebuild.exe /target makefile + +# Files +PREBUILDS = $(wildcard *.prebuild) +RESULTS = $(PREBUILDS:prebuild=results) +TESTS = $(PREBUILDS:prebuild=test) + +all: $(TESTS) + +clean: + rm -f *~ *.log + rm -f $(RESULTS) + +%.test: %.prebuild + $(PREBUILD) /log $*.log /file $*.prebuild /ppi $*.results >& /dev/null + if ! cmp $*.expected $*.results; then \ + echo $*.prebuild failed; \ + false; \ + fi diff --git a/Prebuild/tests/.svn/text-base/README.txt.svn-base b/Prebuild/tests/.svn/text-base/README.txt.svn-base new file mode 100644 index 0000000..2c2de3b --- /dev/null +++ b/Prebuild/tests/.svn/text-base/README.txt.svn-base @@ -0,0 +1,5 @@ +There are some tests that are run via a Makfile in this +directory. They haven't been included in any form of unit tests, but +they are there to help test the functionality in some what. Simply +build prebuild (so there is a src/bin/Release/prebuild.exe) and type +`make` in this directory. Everything should pass without errors. diff --git a/Prebuild/tests/.svn/text-base/include-001.expected.svn-base b/Prebuild/tests/.svn/text-base/include-001.expected.svn-base new file mode 100644 index 0000000..26374b5 --- /dev/null +++ b/Prebuild/tests/.svn/text-base/include-001.expected.svn-base @@ -0,0 +1,46 @@ + + + + + DEBUG;TRACE + false + bin/Debug + true + + + + + TRACE + bin/Release + true + false + + + + + + DEBUG;TRACE + false + bin/Debug + true + Prebuild.snk + 1595 + + + + + TRACE + bin/Release + true + false + Prebuild.snk + 1595 + + + + + + + + + diff --git a/Prebuild/tests/.svn/text-base/include-001.include.svn-base b/Prebuild/tests/.svn/text-base/include-001.include.svn-base new file mode 100644 index 0000000..7f75962 --- /dev/null +++ b/Prebuild/tests/.svn/text-base/include-001.include.svn-base @@ -0,0 +1,33 @@ + + + + DEBUG;TRACE + false + bin/Debug + true + Prebuild.snk + 1595 + + + + + TRACE + bin/Release + true + false + Prebuild.snk + 1595 + + + + + + + diff --git a/Prebuild/tests/.svn/text-base/include-001.prebuild.svn-base b/Prebuild/tests/.svn/text-base/include-001.prebuild.svn-base new file mode 100644 index 0000000..8047008 --- /dev/null +++ b/Prebuild/tests/.svn/text-base/include-001.prebuild.svn-base @@ -0,0 +1,22 @@ + + + + + + DEBUG;TRACE + false + bin/Debug + true + + + + + TRACE + bin/Release + true + false + + + + + diff --git a/Prebuild/tests/.svn/text-base/include-002-2.include.svn-base b/Prebuild/tests/.svn/text-base/include-002-2.include.svn-base new file mode 100644 index 0000000..661b7f3 --- /dev/null +++ b/Prebuild/tests/.svn/text-base/include-002-2.include.svn-base @@ -0,0 +1,8 @@ + + + DEBUG;TRACE + false + bin/Debug + true + + diff --git a/Prebuild/tests/.svn/text-base/include-002.expected.svn-base b/Prebuild/tests/.svn/text-base/include-002.expected.svn-base new file mode 100644 index 0000000..9849658 --- /dev/null +++ b/Prebuild/tests/.svn/text-base/include-002.expected.svn-base @@ -0,0 +1,26 @@ + + + + + DEBUG;TRACE + false + bin/Debug + true + + + + + + DEBUG;TRACE + false + bin/Debug + true + + + + + + + + + diff --git a/Prebuild/tests/.svn/text-base/include-002.include.svn-base b/Prebuild/tests/.svn/text-base/include-002.include.svn-base new file mode 100644 index 0000000..64f4058 --- /dev/null +++ b/Prebuild/tests/.svn/text-base/include-002.include.svn-base @@ -0,0 +1,14 @@ + + + + + + + diff --git a/Prebuild/tests/.svn/text-base/include-002.prebuild.svn-base b/Prebuild/tests/.svn/text-base/include-002.prebuild.svn-base new file mode 100644 index 0000000..9e85f20 --- /dev/null +++ b/Prebuild/tests/.svn/text-base/include-002.prebuild.svn-base @@ -0,0 +1,7 @@ + + + + + + + diff --git a/Prebuild/tests/Makefile b/Prebuild/tests/Makefile new file mode 100644 index 0000000..4a8ddf4 --- /dev/null +++ b/Prebuild/tests/Makefile @@ -0,0 +1,24 @@ +# +# Executable +# + +# Executables +PREBUILD = mono ../src/bin/Release/prebuild.exe /target makefile + +# Files +PREBUILDS = $(wildcard *.prebuild) +RESULTS = $(PREBUILDS:prebuild=results) +TESTS = $(PREBUILDS:prebuild=test) + +all: $(TESTS) + +clean: + rm -f *~ *.log + rm -f $(RESULTS) + +%.test: %.prebuild + $(PREBUILD) /log $*.log /file $*.prebuild /ppi $*.results >& /dev/null + if ! cmp $*.expected $*.results; then \ + echo $*.prebuild failed; \ + false; \ + fi diff --git a/Prebuild/tests/README.txt b/Prebuild/tests/README.txt new file mode 100644 index 0000000..2c2de3b --- /dev/null +++ b/Prebuild/tests/README.txt @@ -0,0 +1,5 @@ +There are some tests that are run via a Makfile in this +directory. They haven't been included in any form of unit tests, but +they are there to help test the functionality in some what. Simply +build prebuild (so there is a src/bin/Release/prebuild.exe) and type +`make` in this directory. Everything should pass without errors. diff --git a/Prebuild/tests/include-001.expected b/Prebuild/tests/include-001.expected new file mode 100644 index 0000000..26374b5 --- /dev/null +++ b/Prebuild/tests/include-001.expected @@ -0,0 +1,46 @@ + + + + + DEBUG;TRACE + false + bin/Debug + true + + + + + TRACE + bin/Release + true + false + + + + + + DEBUG;TRACE + false + bin/Debug + true + Prebuild.snk + 1595 + + + + + TRACE + bin/Release + true + false + Prebuild.snk + 1595 + + + + + + + + + diff --git a/Prebuild/tests/include-001.include b/Prebuild/tests/include-001.include new file mode 100644 index 0000000..7f75962 --- /dev/null +++ b/Prebuild/tests/include-001.include @@ -0,0 +1,33 @@ + + + + DEBUG;TRACE + false + bin/Debug + true + Prebuild.snk + 1595 + + + + + TRACE + bin/Release + true + false + Prebuild.snk + 1595 + + + + + + + diff --git a/Prebuild/tests/include-001.prebuild b/Prebuild/tests/include-001.prebuild new file mode 100644 index 0000000..8047008 --- /dev/null +++ b/Prebuild/tests/include-001.prebuild @@ -0,0 +1,22 @@ + + + + + + DEBUG;TRACE + false + bin/Debug + true + + + + + TRACE + bin/Release + true + false + + + + + diff --git a/Prebuild/tests/include-002-2.include b/Prebuild/tests/include-002-2.include new file mode 100644 index 0000000..661b7f3 --- /dev/null +++ b/Prebuild/tests/include-002-2.include @@ -0,0 +1,8 @@ + + + DEBUG;TRACE + false + bin/Debug + true + + diff --git a/Prebuild/tests/include-002.expected b/Prebuild/tests/include-002.expected new file mode 100644 index 0000000..9849658 --- /dev/null +++ b/Prebuild/tests/include-002.expected @@ -0,0 +1,26 @@ + + + + + DEBUG;TRACE + false + bin/Debug + true + + + + + + DEBUG;TRACE + false + bin/Debug + true + + + + + + + + + diff --git a/Prebuild/tests/include-002.include b/Prebuild/tests/include-002.include new file mode 100644 index 0000000..64f4058 --- /dev/null +++ b/Prebuild/tests/include-002.include @@ -0,0 +1,14 @@ + + + + + + + diff --git a/Prebuild/tests/include-002.prebuild b/Prebuild/tests/include-002.prebuild new file mode 100644 index 0000000..9e85f20 --- /dev/null +++ b/Prebuild/tests/include-002.prebuild @@ -0,0 +1,7 @@ + + + + + + + diff --git a/bin/Prebuild.exe b/bin/Prebuild.exe index ad84b98..d79227c 100755 Binary files a/bin/Prebuild.exe and b/bin/Prebuild.exe differ -- cgit v1.1 From 51a5af93d0be85dcd0cbfeeaab6f898b9507b37d Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Fri, 10 Sep 2010 18:48:32 -0700 Subject: White space junk. --- .../data/.svn/text-base/prebuild-1.7.xsd.svn-base | 700 ++++++++++----------- .../data/.svn/text-base/prebuild-1.9.xsd.svn-base | 672 ++++++++++---------- Prebuild/src/data/prebuild-1.7.xsd | 700 ++++++++++----------- Prebuild/src/data/prebuild-1.9.xsd | 672 ++++++++++---------- 4 files changed, 1372 insertions(+), 1372 deletions(-) diff --git a/Prebuild/src/data/.svn/text-base/prebuild-1.7.xsd.svn-base b/Prebuild/src/data/.svn/text-base/prebuild-1.7.xsd.svn-base index a7f5c88..3675503 100644 --- a/Prebuild/src/data/.svn/text-base/prebuild-1.7.xsd.svn-base +++ b/Prebuild/src/data/.svn/text-base/prebuild-1.7.xsd.svn-base @@ -1,350 +1,350 @@ - - - - - Copyright (c) 2004-2007 - Matthew Holmes (calefaction at houston . rr . com), - Dan Moorehead (dan05a at gmail . com), - David Hudson (jendave at yahoo dot com), - C.J. Adams-Collier (cjac at colliertech dot com) - - .NET Prebuild is a cross-platform XML-driven pre-build tool which - allows developers to easily generate project or make files for major - IDE's and .NET development tools including: Visual Studio .NET 2002, - 2003, and 2005, SharpDevelop, MonoDevelop, NAnt, Xcode and the GNU Autotools. - - BSD License: - - Redistribution and use in source and binary forms, with or without modification, are permitted - provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, this list of conditions - and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, this list of conditions - and the following disclaimer in the documentation and/or other materials provided with the - distribution. - * The name of the author may not be used to endorse or promote products derived from this software - without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR 'AS IS' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, - BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY - OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING - IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + Copyright (c) 2004-2007 + Matthew Holmes (calefaction at houston . rr . com), + Dan Moorehead (dan05a at gmail . com), + David Hudson (jendave at yahoo dot com), + C.J. Adams-Collier (cjac at colliertech dot com) + + .NET Prebuild is a cross-platform XML-driven pre-build tool which + allows developers to easily generate project or make files for major + IDE's and .NET development tools including: Visual Studio .NET 2002, + 2003, and 2005, SharpDevelop, MonoDevelop, NAnt, Xcode and the GNU Autotools. + + BSD License: + + Redistribution and use in source and binary forms, with or without modification, are permitted + provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this list of conditions + and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, this list of conditions + and the following disclaimer in the documentation and/or other materials provided with the + distribution. + * The name of the author may not be used to endorse or promote products derived from this software + without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHOR 'AS IS' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, + BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Prebuild/src/data/.svn/text-base/prebuild-1.9.xsd.svn-base b/Prebuild/src/data/.svn/text-base/prebuild-1.9.xsd.svn-base index d647e08..fbca556 100644 --- a/Prebuild/src/data/.svn/text-base/prebuild-1.9.xsd.svn-base +++ b/Prebuild/src/data/.svn/text-base/prebuild-1.9.xsd.svn-base @@ -1,336 +1,336 @@ - - - - - Copyright (c) 2004-2007 - Matthew Holmes (calefaction at houston . rr . com), - Dan Moorehead (dan05a at gmail . com), - David Hudson (jendave at yahoo dot com), - C.J. Adams-Collier (cjac at colliertech dot com) - - .NET Prebuild is a cross-platform XML-driven pre-build tool which - allows developers to easily generate project or make files for major - IDE's and .NET development tools including: Visual Studio .NET 2002, - 2003, and 2005, SharpDevelop, MonoDevelop, NAnt, Xcode and the GNU Autotools. - - BSD License: - - Redistribution and use in source and binary forms, with or without modification, are permitted - provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, this list of conditions - and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, this list of conditions - and the following disclaimer in the documentation and/or other materials provided with the - distribution. - * The name of the author may not be used to endorse or promote products derived from this software - without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR 'AS IS' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, - BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY - OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING - IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + Copyright (c) 2004-2007 + Matthew Holmes (calefaction at houston . rr . com), + Dan Moorehead (dan05a at gmail . com), + David Hudson (jendave at yahoo dot com), + C.J. Adams-Collier (cjac at colliertech dot com) + + .NET Prebuild is a cross-platform XML-driven pre-build tool which + allows developers to easily generate project or make files for major + IDE's and .NET development tools including: Visual Studio .NET 2002, + 2003, and 2005, SharpDevelop, MonoDevelop, NAnt, Xcode and the GNU Autotools. + + BSD License: + + Redistribution and use in source and binary forms, with or without modification, are permitted + provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this list of conditions + and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, this list of conditions + and the following disclaimer in the documentation and/or other materials provided with the + distribution. + * The name of the author may not be used to endorse or promote products derived from this software + without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHOR 'AS IS' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, + BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Prebuild/src/data/prebuild-1.7.xsd b/Prebuild/src/data/prebuild-1.7.xsd index a7f5c88..3675503 100644 --- a/Prebuild/src/data/prebuild-1.7.xsd +++ b/Prebuild/src/data/prebuild-1.7.xsd @@ -1,350 +1,350 @@ - - - - - Copyright (c) 2004-2007 - Matthew Holmes (calefaction at houston . rr . com), - Dan Moorehead (dan05a at gmail . com), - David Hudson (jendave at yahoo dot com), - C.J. Adams-Collier (cjac at colliertech dot com) - - .NET Prebuild is a cross-platform XML-driven pre-build tool which - allows developers to easily generate project or make files for major - IDE's and .NET development tools including: Visual Studio .NET 2002, - 2003, and 2005, SharpDevelop, MonoDevelop, NAnt, Xcode and the GNU Autotools. - - BSD License: - - Redistribution and use in source and binary forms, with or without modification, are permitted - provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, this list of conditions - and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, this list of conditions - and the following disclaimer in the documentation and/or other materials provided with the - distribution. - * The name of the author may not be used to endorse or promote products derived from this software - without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR 'AS IS' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, - BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY - OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING - IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + Copyright (c) 2004-2007 + Matthew Holmes (calefaction at houston . rr . com), + Dan Moorehead (dan05a at gmail . com), + David Hudson (jendave at yahoo dot com), + C.J. Adams-Collier (cjac at colliertech dot com) + + .NET Prebuild is a cross-platform XML-driven pre-build tool which + allows developers to easily generate project or make files for major + IDE's and .NET development tools including: Visual Studio .NET 2002, + 2003, and 2005, SharpDevelop, MonoDevelop, NAnt, Xcode and the GNU Autotools. + + BSD License: + + Redistribution and use in source and binary forms, with or without modification, are permitted + provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this list of conditions + and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, this list of conditions + and the following disclaimer in the documentation and/or other materials provided with the + distribution. + * The name of the author may not be used to endorse or promote products derived from this software + without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHOR 'AS IS' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, + BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Prebuild/src/data/prebuild-1.9.xsd b/Prebuild/src/data/prebuild-1.9.xsd index d647e08..fbca556 100644 --- a/Prebuild/src/data/prebuild-1.9.xsd +++ b/Prebuild/src/data/prebuild-1.9.xsd @@ -1,336 +1,336 @@ - - - - - Copyright (c) 2004-2007 - Matthew Holmes (calefaction at houston . rr . com), - Dan Moorehead (dan05a at gmail . com), - David Hudson (jendave at yahoo dot com), - C.J. Adams-Collier (cjac at colliertech dot com) - - .NET Prebuild is a cross-platform XML-driven pre-build tool which - allows developers to easily generate project or make files for major - IDE's and .NET development tools including: Visual Studio .NET 2002, - 2003, and 2005, SharpDevelop, MonoDevelop, NAnt, Xcode and the GNU Autotools. - - BSD License: - - Redistribution and use in source and binary forms, with or without modification, are permitted - provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, this list of conditions - and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, this list of conditions - and the following disclaimer in the documentation and/or other materials provided with the - distribution. - * The name of the author may not be used to endorse or promote products derived from this software - without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR 'AS IS' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, - BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY - OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING - IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + Copyright (c) 2004-2007 + Matthew Holmes (calefaction at houston . rr . com), + Dan Moorehead (dan05a at gmail . com), + David Hudson (jendave at yahoo dot com), + C.J. Adams-Collier (cjac at colliertech dot com) + + .NET Prebuild is a cross-platform XML-driven pre-build tool which + allows developers to easily generate project or make files for major + IDE's and .NET development tools including: Visual Studio .NET 2002, + 2003, and 2005, SharpDevelop, MonoDevelop, NAnt, Xcode and the GNU Autotools. + + BSD License: + + Redistribution and use in source and binary forms, with or without modification, are permitted + provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this list of conditions + and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, this list of conditions + and the following disclaimer in the documentation and/or other materials provided with the + distribution. + * The name of the author may not be used to endorse or promote products derived from this software + without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHOR 'AS IS' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, + BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + -- cgit v1.1 From d5c7a8d28c9cdfba62f7832fddedbb4523df84ef Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Fri, 10 Sep 2010 21:18:23 -0700 Subject: All these files want to be committed. All white space junk. grr. --- Prebuild/COPYING | 130 +- Prebuild/NEWS | 400 ++-- Prebuild/README | 548 ++--- .../.svn/text-base/SharpDevelop2.bat.svn-base | 8 +- .../scripts/.svn/text-base/VS2008.bat.svn-base | 8 +- .../scripts/.svn/text-base/VS2010.bat.svn-base | 8 +- .../scripts/.svn/text-base/autotools.bat.svn-base | 8 +- Prebuild/scripts/SharpDevelop2.bat | 8 +- Prebuild/scripts/VS2008.bat | 8 +- Prebuild/scripts/VS2010.bat | 8 +- Prebuild/scripts/autotools.bat | 8 +- .../.svn/text-base/CleanFilesNode.cs.svn-base | 158 +- .../Nodes/.svn/text-base/CleanupNode.cs.svn-base | 168 +- .../ConfigurationNodeCollection.cs.svn-base | 142 +- .../.svn/text-base/DatabaseProjectNode.cs.svn-base | 186 +- .../text-base/DatabaseReferenceNode.cs.svn-base | 126 +- Prebuild/src/Core/Nodes/CleanFilesNode.cs | 158 +- Prebuild/src/Core/Nodes/CleanupNode.cs | 168 +- .../src/Core/Nodes/ConfigurationNodeCollection.cs | 142 +- Prebuild/src/Core/Nodes/DatabaseProjectNode.cs | 186 +- Prebuild/src/Core/Nodes/DatabaseReferenceNode.cs | 126 +- .../.svn/text-base/AutotoolsTarget.cs.svn-base | 2140 ++++++++++---------- .../.svn/text-base/VS2010Target.cs.svn-base | 276 +-- .../.svn/text-base/VSGenericTarget.cs.svn-base | 1844 ++++++++--------- Prebuild/src/Core/Targets/AutotoolsTarget.cs | 2140 ++++++++++---------- Prebuild/src/Core/Targets/VS2010Target.cs | 276 +-- Prebuild/src/Core/Targets/VSGenericTarget.cs | 1844 ++++++++--------- 27 files changed, 5611 insertions(+), 5611 deletions(-) diff --git a/Prebuild/COPYING b/Prebuild/COPYING index d3cdf7e..c57c080 100644 --- a/Prebuild/COPYING +++ b/Prebuild/COPYING @@ -1,65 +1,65 @@ -BSD License -Copyright (c)2004-2008 - -See AUTHORS file for list of copyright holders - -Dave Hudson (jendave@yahoo.com), -Matthew Holmes (matthew@wildfiregames.com) -Dan Moorehead (dan05a@gmail.com) -Rob Loach (http://www.robloach.net) -C.J. Adams-Collier (cjac@colliertech.org) - -http://dnpb.sourceforge.net -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions -are met: - -1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - -2. Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - -3. The names of the authors may not be used to endorse or promote - products derived from this software without specific prior written - permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN - ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. - ---- - -Portions of src/Core/Targets/AutotoolsTarget.cs -// Copyright (C) 2006 Novell, Inc (http://www.novell.com) -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +BSD License +Copyright (c)2004-2008 + +See AUTHORS file for list of copyright holders + +Dave Hudson (jendave@yahoo.com), +Matthew Holmes (matthew@wildfiregames.com) +Dan Moorehead (dan05a@gmail.com) +Rob Loach (http://www.robloach.net) +C.J. Adams-Collier (cjac@colliertech.org) + +http://dnpb.sourceforge.net +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + +1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +3. The names of the authors may not be used to endorse or promote + products derived from this software without specific prior written + permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + +--- + +Portions of src/Core/Targets/AutotoolsTarget.cs +// Copyright (C) 2006 Novell, Inc (http://www.novell.com) +// +// Permission is hereby granted, free of charge, to any person obtaining +// a copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to +// permit persons to whom the Software is furnished to do so, subject to +// the following conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/Prebuild/NEWS b/Prebuild/NEWS index bea28da..3ab3108 100644 --- a/Prebuild/NEWS +++ b/Prebuild/NEWS @@ -1,200 +1,200 @@ -Prebuild is an XML-driven pre-build tool allowing developers to easily generate project or make files for major IDE's and .NET development tools including: Visual Studio 2005, Visual Studio 2003, Visual Studio 2002, SharpDevelop, MonoDevelop, and NAnt. - -Documentation and downloads are available at http://dnpb.sourceforge.net. - -Prebuild is licensed under the BSD license. - -[ XXXXXXX XX, XXX - 1.3.2 ] - + Added Keyfile signing to NAnt target and VS2005 target - + Updated XSD file to 1.7 - + Boo and VisualBasic Language support in VS2005 target - + Added basic Autotools target. It creates a non-recursive Autotools system. - ! Multiple files can be excluded from the Match node - ! VS2005 now handles .resx files correctly. - ! NAnt and Autotools now handle defines - ! NAnt and Autotools now handle resources - + Conditional XML variables can be passed through the command line. - + Added /install and /remove command line flags to install and remove assemblies from the GAC - + Many fixes to VS2005 target - -[ July 21, 2006 - 1.3.1 ] - ! VS2005 fixes from Rob Loach - ! NAnt fixes from Rob Loach and David Hudson - ! XML doc fixes from Rob Loach - + Added SharpDevelop2 target (really just uses VS2005 target) - ! Fixed bug with BuildEvents in Monodevelop target - + Passing /yes will default to answering yes to any warnings - -[ February 28, 2006 - 1.3 ] - + Added MonoDevelop target. - + Added NAnt target. - + Lots of fixes to all targets. - * Cleaned up the code using FXCop. - * Updated schema to 1.6 to fix a typo and add a new parameter. - * jendave is now the maintainer of the project. RobLoach has been added as a developer. - * Removed references to 'dnpb'. - + Added rudimentary support for pre- and post- build scripts - * Updated examples. - -[ August 5, 2004 - 1.2 ] - + Added Visual Studio Express (vs2005express) target contributed by Borrillis and modified for use with different languages - + Added the allowedgroups command line option followed by a pipe-delimited list of project group filter flags (eg. Group1|Group2) allow optional filtering of all projects that dont have at least one of these flags - + Added the filterGroups XML attribute to the project node and updated the scheme to v1.5 for this addition, it is used to specified the delimited list of filter groups to which a project belongs - * Modified the removedir command line option to allow for a pipe-delimited list of directory names - ! Modified the resource loading code to search for resourced without the prepended namespace (as Visual Studio .NET does it) to allow for it to be compiled with SharpDevelop as well - + Added the GenerateXmlDocFile boolean option to the Options XML element - * Changed the behavior of the XmlDocFile option so that if not specified it uses the assemblyName (without file extension) + .xml for the file name instead of just not generating the file since the new GenerateXmlDocFile takes care of this - -[ January 3, 2004 - 1.1 ] - ! Replaced regex use for more efficient manual parsing to allow use on non-windows platforms with Mono which has Regex problems - + Added the checkOsVars attribute to the root element for enabling interpolation for Enviroment variables in the form ${var}, otherwise no checking is performed for efficiency-sake - * Make the version attribute on the root element optional as it isn't used and not needed since the schema url contains the version - -[ December 30, 2004 - 1.1 ] - ! Applied Leed's fix for SharpDevelop references - + Rewrote much of the processing for better validation and without the use of a temp file - + Added support for configurations at the project level which are named All. They now apply changes to all Solution level defined configs - * Changed all spaces into tabs - + Added support for the None build action - * Replaced all sequence's in the XML schema for all's because the order doesn't matter since the xml file is loaded into an XmlDocument - -[ December 25, 2004 - 1.0 ] - + Added the /removedir option for cleaning directories like obj before file releases - + Changed WriteTempXml() and the new DeleteTempXml() methods to be compiled only in DEBUG builds - * Made path optional for Match elements (defaults to current directory) and updates schema for it - ! Fixed XML example in the readme.txt - + Added example xml files to docs directory - * Updated license.txt to add Dan Moorehead and update copyright years - + Updated prebuild.xml to take advantage of the default path attribute for match elements - + Updated Clean to delete the obj directories - -[ December 25, 2004 - 0.13 ] - + Added dnpb.exe so that it can be used to generate the project files - + Added dnpb.ico - * Added parameterless Write statement to Log for writing a single line - * Changed scehema to version 1.3 for support of icon attribute - * Added support for All configuration name under a Project node signifying common settings for all configurations - ! Fixed the SupressWarnings by adding the corresponding field to OptionsNode - * Wrote documentation in docs/readme.txt - * Added Dan Moorehead to copyrights and extended date from 2004 to 2004-2005 - * Updated prebuild.xml - * Optimized Log class - * Updated OutputUsage() - * /clean targets all by default - * No log file is used by default, /log without value specified uses default file name - + Added support for the /pause which pauses the utility after execution to observe output - - -[ September 27, 2004 - 0.12.2a ] - ! Fixed a nasty bug when trying to delete our temp file for pre-processing. - -[ September 15, 2004 - 0.12.2 ] - + Expanded platform identification, thanks to the NAnt guys for shedding some - light on how to properly check for UNIX platforms! Thanks guys! - * POSIX OS identifier changed to UNIX. Valid OS names are now "Win32", "UNIX", - and "Unknown". - ! Fixed SharpDevelop target to properly use the 'rootNamespace' attribute of - the Project tag. - + New command-line switch, /ppo, forces DNPB to pre-process the file and write - the pre-processed file. This allows you to test/debug your pre-processor - macros. No other processing will be done. You can specify a target file as - a paramter for the /ppo switch, or DNPB will write the file 'preprocessed.xml' - if you do not specify a file. - + The Match tag now has a 'buildAction' attribute which functions exactly like - the attribute of the same name for the File tag. - -[ August 5, 2004 - 0.12.1 ] - + Added environment variable expansion for all values. Environment variables - should be listed in the form ${VAR}. - -[ July 30, 2004 - 0.12.0 ] - + Added preprocessing via XML processing information tags. Available tags - are: ?>, ?>, and . The - current expression parser is very basic, but will be replaced with a more - capable parser over time. Current operators available are: =, !=, <, >, - <=, >=. Current test variables available: OS, RuntimeVersion, RuntimeMajor, - RuntimeMinor, RuntimeRevision. - -[ July 27, 2004 - 0.11.4 ] - + Added 'useRegex' attribute to the Match tag. Matches can now use regular - expressions to match filenames. - + Added the 'assemblyName' attribute to the Project tag. Projects can now - set their output assembly name. - ! Fixed several bugs in the way that Project tags inheirt their parent - Solutions configuration options. This operation should now work fully as - intended. - ! Due to some wierdness, Project Guid's are now stored as part of the Project - node and created at parse time. - -[ May 11, 2004 - 0.11.3 ] - ! Fixed a bug where I was writing the wrong property name for a projects root - namespace. - ! Removed a DEBUG statement I had left in the code in 0.11.2. - ! Fixed a bug in the VS2002 writer which caused the version variables to not - be overriden correctly. - + Added the rootNamespace property to the element, allowing you to - specify the root namespace. - * /target and /clean are now mutually exclusive command line switches, and - they both now take the all option. In the case of /target all, all build - file for all targets will be created. In the case of /clean all, the user - will be prompted to make sure they want to do it, and if so, will clean - all build files for all targets. - -[ April 22, 2004 - 0.11.2 ] - ! Fixed a bug with the /file command-line operator. Was using the unresolved - file path rather then the resolved one, was making the attempt to open the - dnpb file fail. - ! Fixed a bug in the schema that required at least 1 solution and 1 reference - path. We can do just fine with 0 of either of these. Some files may be all - statements and not have any tags. - ! Fixed a bug that caused the project references not to be written with the - SharpDevelop target. - * Changed the schema to version 1.2, allowing for Configuration nodes to exist - under project nodes. The inheritance of values is hierarchical. Meaning, if - you define a configuration named Debug at the Soltion level, and one by the - same name at the Project level, the one at the Project level will first - inherit the options of the Solution level configuration, then set it's own - options. If you define a configuration at the Project level and it does not - exist at the Solution level, it will be created at the Solution level. - * Project references should now work correctly across the board. Note that due - to a restriction in Visual Studio, you can only reference projects in the same - solution. - -[ April 21, 2004 - 0.11.1 ] - ! Fixed a problem with resolving paths in various targets. Was not properly - setting the CWD. - * Schema updated to 1.1, moving the ReferencePath element from the Options - element to the Project element. This makes more logical sense, given that - reference paths are resolved relative to the project path. Any prebuild.xml - file referecning verison 1.0 will fail! Please update to the 1.1 schema. - -[ April 19, 2004 - 0.11.0 ] - * Added several attributes across the code to make FxCop happy - ! Fixed bugs in reference paths being written in the VS targets. - ! Fixed a bug in ProjectNode which was doing two CWDStack.Push() calls instead of - a Push/Pop pair. Was wreaking havoc with tags. - ! Fixed some bugs in the path tracking, both the Project and Solution nodes now - have a FullPath property, which is the full path to the file resolved at load - time. This should fix all path relativity problems. - + Added new /clean switch, allowing the target to clean up any files it generated. - in accordance, the ITarget interface has been updated to support a new Clean() - method. - + Completed addition of the tag, to allow the referencing of external - prebuild.xml files. - + Added the runtime attribute to the Project element. This allows the developer - to specify which runtime a project should target (Mono or Microsoft). This is - of course ignored in certain targets like the Visual Studio targets. - + Added the SharpDevelop target. - -[ April 13, 2004 - 0.10.1a ] - + Added the buildAction attribute to the File node. This is needed for dnpb - to even be able to bootstrap itself (dnpb-1.0.xsd must be an embedded resource) - -[ April 13, 2004 - 0.10.1 ] - * First Release - -[ Key ] -* = Change or information -+ = Addition -! = Bug Fix - +Prebuild is an XML-driven pre-build tool allowing developers to easily generate project or make files for major IDE's and .NET development tools including: Visual Studio 2005, Visual Studio 2003, Visual Studio 2002, SharpDevelop, MonoDevelop, and NAnt. + +Documentation and downloads are available at http://dnpb.sourceforge.net. + +Prebuild is licensed under the BSD license. + +[ XXXXXXX XX, XXX - 1.3.2 ] + + Added Keyfile signing to NAnt target and VS2005 target + + Updated XSD file to 1.7 + + Boo and VisualBasic Language support in VS2005 target + + Added basic Autotools target. It creates a non-recursive Autotools system. + ! Multiple files can be excluded from the Match node + ! VS2005 now handles .resx files correctly. + ! NAnt and Autotools now handle defines + ! NAnt and Autotools now handle resources + + Conditional XML variables can be passed through the command line. + + Added /install and /remove command line flags to install and remove assemblies from the GAC + + Many fixes to VS2005 target + +[ July 21, 2006 - 1.3.1 ] + ! VS2005 fixes from Rob Loach + ! NAnt fixes from Rob Loach and David Hudson + ! XML doc fixes from Rob Loach + + Added SharpDevelop2 target (really just uses VS2005 target) + ! Fixed bug with BuildEvents in Monodevelop target + + Passing /yes will default to answering yes to any warnings + +[ February 28, 2006 - 1.3 ] + + Added MonoDevelop target. + + Added NAnt target. + + Lots of fixes to all targets. + * Cleaned up the code using FXCop. + * Updated schema to 1.6 to fix a typo and add a new parameter. + * jendave is now the maintainer of the project. RobLoach has been added as a developer. + * Removed references to 'dnpb'. + + Added rudimentary support for pre- and post- build scripts + * Updated examples. + +[ August 5, 2004 - 1.2 ] + + Added Visual Studio Express (vs2005express) target contributed by Borrillis and modified for use with different languages + + Added the allowedgroups command line option followed by a pipe-delimited list of project group filter flags (eg. Group1|Group2) allow optional filtering of all projects that dont have at least one of these flags + + Added the filterGroups XML attribute to the project node and updated the scheme to v1.5 for this addition, it is used to specified the delimited list of filter groups to which a project belongs + * Modified the removedir command line option to allow for a pipe-delimited list of directory names + ! Modified the resource loading code to search for resourced without the prepended namespace (as Visual Studio .NET does it) to allow for it to be compiled with SharpDevelop as well + + Added the GenerateXmlDocFile boolean option to the Options XML element + * Changed the behavior of the XmlDocFile option so that if not specified it uses the assemblyName (without file extension) + .xml for the file name instead of just not generating the file since the new GenerateXmlDocFile takes care of this + +[ January 3, 2004 - 1.1 ] + ! Replaced regex use for more efficient manual parsing to allow use on non-windows platforms with Mono which has Regex problems + + Added the checkOsVars attribute to the root element for enabling interpolation for Enviroment variables in the form ${var}, otherwise no checking is performed for efficiency-sake + * Make the version attribute on the root element optional as it isn't used and not needed since the schema url contains the version + +[ December 30, 2004 - 1.1 ] + ! Applied Leed's fix for SharpDevelop references + + Rewrote much of the processing for better validation and without the use of a temp file + + Added support for configurations at the project level which are named All. They now apply changes to all Solution level defined configs + * Changed all spaces into tabs + + Added support for the None build action + * Replaced all sequence's in the XML schema for all's because the order doesn't matter since the xml file is loaded into an XmlDocument + +[ December 25, 2004 - 1.0 ] + + Added the /removedir option for cleaning directories like obj before file releases + + Changed WriteTempXml() and the new DeleteTempXml() methods to be compiled only in DEBUG builds + * Made path optional for Match elements (defaults to current directory) and updates schema for it + ! Fixed XML example in the readme.txt + + Added example xml files to docs directory + * Updated license.txt to add Dan Moorehead and update copyright years + + Updated prebuild.xml to take advantage of the default path attribute for match elements + + Updated Clean to delete the obj directories + +[ December 25, 2004 - 0.13 ] + + Added dnpb.exe so that it can be used to generate the project files + + Added dnpb.ico + * Added parameterless Write statement to Log for writing a single line + * Changed scehema to version 1.3 for support of icon attribute + * Added support for All configuration name under a Project node signifying common settings for all configurations + ! Fixed the SupressWarnings by adding the corresponding field to OptionsNode + * Wrote documentation in docs/readme.txt + * Added Dan Moorehead to copyrights and extended date from 2004 to 2004-2005 + * Updated prebuild.xml + * Optimized Log class + * Updated OutputUsage() + * /clean targets all by default + * No log file is used by default, /log without value specified uses default file name + + Added support for the /pause which pauses the utility after execution to observe output + + +[ September 27, 2004 - 0.12.2a ] + ! Fixed a nasty bug when trying to delete our temp file for pre-processing. + +[ September 15, 2004 - 0.12.2 ] + + Expanded platform identification, thanks to the NAnt guys for shedding some + light on how to properly check for UNIX platforms! Thanks guys! + * POSIX OS identifier changed to UNIX. Valid OS names are now "Win32", "UNIX", + and "Unknown". + ! Fixed SharpDevelop target to properly use the 'rootNamespace' attribute of + the Project tag. + + New command-line switch, /ppo, forces DNPB to pre-process the file and write + the pre-processed file. This allows you to test/debug your pre-processor + macros. No other processing will be done. You can specify a target file as + a paramter for the /ppo switch, or DNPB will write the file 'preprocessed.xml' + if you do not specify a file. + + The Match tag now has a 'buildAction' attribute which functions exactly like + the attribute of the same name for the File tag. + +[ August 5, 2004 - 0.12.1 ] + + Added environment variable expansion for all values. Environment variables + should be listed in the form ${VAR}. + +[ July 30, 2004 - 0.12.0 ] + + Added preprocessing via XML processing information tags. Available tags + are: ?>, ?>, and . The + current expression parser is very basic, but will be replaced with a more + capable parser over time. Current operators available are: =, !=, <, >, + <=, >=. Current test variables available: OS, RuntimeVersion, RuntimeMajor, + RuntimeMinor, RuntimeRevision. + +[ July 27, 2004 - 0.11.4 ] + + Added 'useRegex' attribute to the Match tag. Matches can now use regular + expressions to match filenames. + + Added the 'assemblyName' attribute to the Project tag. Projects can now + set their output assembly name. + ! Fixed several bugs in the way that Project tags inheirt their parent + Solutions configuration options. This operation should now work fully as + intended. + ! Due to some wierdness, Project Guid's are now stored as part of the Project + node and created at parse time. + +[ May 11, 2004 - 0.11.3 ] + ! Fixed a bug where I was writing the wrong property name for a projects root + namespace. + ! Removed a DEBUG statement I had left in the code in 0.11.2. + ! Fixed a bug in the VS2002 writer which caused the version variables to not + be overriden correctly. + + Added the rootNamespace property to the element, allowing you to + specify the root namespace. + * /target and /clean are now mutually exclusive command line switches, and + they both now take the all option. In the case of /target all, all build + file for all targets will be created. In the case of /clean all, the user + will be prompted to make sure they want to do it, and if so, will clean + all build files for all targets. + +[ April 22, 2004 - 0.11.2 ] + ! Fixed a bug with the /file command-line operator. Was using the unresolved + file path rather then the resolved one, was making the attempt to open the + dnpb file fail. + ! Fixed a bug in the schema that required at least 1 solution and 1 reference + path. We can do just fine with 0 of either of these. Some files may be all + statements and not have any tags. + ! Fixed a bug that caused the project references not to be written with the + SharpDevelop target. + * Changed the schema to version 1.2, allowing for Configuration nodes to exist + under project nodes. The inheritance of values is hierarchical. Meaning, if + you define a configuration named Debug at the Soltion level, and one by the + same name at the Project level, the one at the Project level will first + inherit the options of the Solution level configuration, then set it's own + options. If you define a configuration at the Project level and it does not + exist at the Solution level, it will be created at the Solution level. + * Project references should now work correctly across the board. Note that due + to a restriction in Visual Studio, you can only reference projects in the same + solution. + +[ April 21, 2004 - 0.11.1 ] + ! Fixed a problem with resolving paths in various targets. Was not properly + setting the CWD. + * Schema updated to 1.1, moving the ReferencePath element from the Options + element to the Project element. This makes more logical sense, given that + reference paths are resolved relative to the project path. Any prebuild.xml + file referecning verison 1.0 will fail! Please update to the 1.1 schema. + +[ April 19, 2004 - 0.11.0 ] + * Added several attributes across the code to make FxCop happy + ! Fixed bugs in reference paths being written in the VS targets. + ! Fixed a bug in ProjectNode which was doing two CWDStack.Push() calls instead of + a Push/Pop pair. Was wreaking havoc with tags. + ! Fixed some bugs in the path tracking, both the Project and Solution nodes now + have a FullPath property, which is the full path to the file resolved at load + time. This should fix all path relativity problems. + + Added new /clean switch, allowing the target to clean up any files it generated. + in accordance, the ITarget interface has been updated to support a new Clean() + method. + + Completed addition of the tag, to allow the referencing of external + prebuild.xml files. + + Added the runtime attribute to the Project element. This allows the developer + to specify which runtime a project should target (Mono or Microsoft). This is + of course ignored in certain targets like the Visual Studio targets. + + Added the SharpDevelop target. + +[ April 13, 2004 - 0.10.1a ] + + Added the buildAction attribute to the File node. This is needed for dnpb + to even be able to bootstrap itself (dnpb-1.0.xsd must be an embedded resource) + +[ April 13, 2004 - 0.10.1 ] + * First Release + +[ Key ] +* = Change or information ++ = Addition +! = Bug Fix + diff --git a/Prebuild/README b/Prebuild/README index 2b05fb5..e8a2d69 100644 --- a/Prebuild/README +++ b/Prebuild/README @@ -1,274 +1,274 @@ -Prebuild Instructions - -Prebuild is an XML-driven pre-build tool allowing developers to easily generate project or make files for major IDE's and .NET development tools including: Visual Studio 2005, Visual Studio 2003, Visual Studio 2002, SharpDevelop, SharpDevelop2, MonoDevelop, and NAnt. - -_______________________________________________________________________________ -Overview - -Prebuild can be either be run from the command line to generate the -project and make files or you can execute the included batch (*.bat) -and Unix Shell script (*.sh) files. - -_______________________________________________________________________________ -The currently supported developement tools and their associated batch -and shell script files. - -Visual Studio .NET 2005 (VS2005.bat) -Visual Studio .NET 2003 (VS2003.bat) -Visual Studio .NET 2002 (VS2002.bat) -SharpDevelop (SharpDevelop.bat) - http://www.icsharpcode.net/OpenSource/SD/ -SharpDevelop2 (SharpDevelop.bat) - http://www.icsharpcode.net/OpenSource/SD/ -MonoDevelop (MonoDevelop.sh) - http://www.monodevelop.com/ -NAnt (nant.sh and nant.bat) - http://nant.sourceforge.net/ -Autotools (autotools.bat and autotools.sh) - http://en.wikipedia.org/wiki/GNU_build_system - -Notes: - -A Unix Shell script is provided for MonoDevelop, as it does not run on -Windows at this time. - -Visual Studio .NET 2005 and the Visual Express IDE's can import -solutions from older versions of Visual Studio .NET. - -Makefiles are not currently supported. - -_______________________________________________________________________________ -Command Line Syntax: - -Example: -> Prebuild /target vs2003 - -This will generate the project files for Visual Studio.NET 2003 and -place the redirect the log to a file named PrebuildLog.txt in the -parent directory - - -The syntax structure is as below, where commandParameter is optional -depending on the command and you can provide several option-value -pairs. - -Note: The '> ' signifies the command prompt, do not enter this literally - -> Prebuild /"); - } - ps.WriteLine(" "); - - //Project References - ps.WriteLine(" "); - foreach (KeyValuePair pair in projectReferences) - { - ToolInfo tool = tools[pair.Value.Language]; - if (tools == null) - throw new UnknownLanguageException(); - - string path = - Helper.MakePathRelativeTo(project.FullPath, - Helper.MakeFilePath(pair.Value.FullPath, pair.Value.Name, tool.FileExtension)); - ps.WriteLine(" ", path); - - // TODO: Allow reference to visual basic projects - ps.WriteLine(" {0}", pair.Value.Name); - ps.WriteLine(" {0}", pair.Value.Guid.ToString("B").ToUpper()); - ps.WriteLine(" {0}", tool.Guid.ToUpper()); - - //This is the Copy Local flag in VS - ps.WriteLine(" {0}", pair.Key.LocalCopy); - - ps.WriteLine(" "); - } - ps.WriteLine(" "); - - // ps.WriteLine(" "); - ps.WriteLine(" "); - - // ps.WriteLine(" "); - List list = new List(); - - foreach (string path in project.Files) - { - string lower = path.ToLower(); - if (lower.EndsWith(".resx")) - { - string codebehind = String.Format("{0}.Designer{1}", path.Substring(0, path.LastIndexOf('.')), toolInfo.LanguageExtension); - if (!list.Contains(codebehind)) - list.Add(codebehind); - } - - } - - foreach (string filePath in project.Files) - { - // if (file == "Properties\\Bind.Designer.cs") - // { - // Console.WriteLine("Wait a minute!"); - // Console.WriteLine(project.Files.GetSubType(file).ToString()); - // } - SubType subType = project.Files.GetSubType(filePath); - - // Visual Studio chokes on file names if forward slash is used as a path separator - // instead of backslash. So we must make sure that all file paths written to the - // project file use \ as a path separator. - string file = filePath.Replace(@"/", @"\"); - - if (subType != SubType.Code && subType != SubType.Settings && subType != SubType.Designer - && subType != SubType.CodeBehind) - { - ps.WriteLine(" ", file.Substring(0, file.LastIndexOf('.')) + ".resx"); - ps.WriteLine(" {0}", Path.GetFileName(file)); - ps.WriteLine(" Designer"); - ps.WriteLine(" "); - // - } - - if (subType == SubType.Designer) - { - ps.WriteLine(" ", file); - - string autogen_name = file.Substring(0, file.LastIndexOf('.')) + ".Designer.cs"; - string dependent_name = filePath.Substring(0, file.LastIndexOf('.')) + ".cs"; - - // Check for a parent .cs file with the same name as this designer file - if (File.Exists(Helper.NormalizePath(dependent_name))) - { - ps.WriteLine(" {0}", Path.GetFileName(dependent_name)); - } - else - { - ps.WriteLine(" ResXFileCodeGenerator"); - ps.WriteLine(" {0}", Path.GetFileName(autogen_name)); - ps.WriteLine(" " + subType + ""); - } - - ps.WriteLine(" "); - if (File.Exists(Helper.NormalizePath(autogen_name))) - { - ps.WriteLine(" ", autogen_name); - //ps.WriteLine(" True"); - - // If a parent .cs file exists, link this autogen file to it. Otherwise link - // to the designer file - if (File.Exists(dependent_name)) - { - ps.WriteLine(" {0}", Path.GetFileName(dependent_name)); - } - else - { - ps.WriteLine(" True"); - ps.WriteLine(" {0}", Path.GetFileName(filePath)); - } - - ps.WriteLine(" "); - } - list.Add(autogen_name); - } - if (subType == SubType.Settings) - { - ps.Write(" <{0} ", project.Files.GetBuildAction(filePath)); - ps.WriteLine("Include=\"{0}\">", file); - string fileName = Path.GetFileName(filePath); - if (project.Files.GetBuildAction(filePath) == BuildAction.None) - { - ps.WriteLine(" SettingsSingleFileGenerator"); - ps.WriteLine(" {0}", fileName.Substring(0, fileName.LastIndexOf('.')) + ".Designer.cs"); - } - else - { - ps.WriteLine(" Code"); - ps.WriteLine(" True"); - ps.WriteLine(" True"); - string fileNameShort = fileName.Substring(0, fileName.LastIndexOf('.')); - string fileNameShorter = fileNameShort.Substring(0, fileNameShort.LastIndexOf('.')); - ps.WriteLine(" {0}", Path.GetFileName(fileNameShorter + ".settings")); - } - ps.WriteLine(" ", project.Files.GetBuildAction(filePath)); - } - else if (subType != SubType.Designer) - { - string path = Helper.NormalizePath(file); - string path_lower = path.ToLower(); - - if (!list.Contains(filePath)) - { - ps.Write(" <{0} ", project.Files.GetBuildAction(filePath)); - - int startPos = 0; - if (project.Files.GetPreservePath(filePath)) - { - while ((@"./\").IndexOf(file.Substring(startPos, 1)) != -1) - startPos++; - - } - else - { - startPos = file.LastIndexOf(Path.GetFileName(path)); - } - - // be sure to write out the path with backslashes so VS recognizes - // the file properly. - ps.WriteLine("Include=\"{0}\">", file); - - int last_period_index = file.LastIndexOf('.'); - string short_file_name = file.Substring(0, last_period_index); - string extension = Path.GetExtension(path); - // make this upper case, so that when File.Exists tests for the - // existence of a designer file on a case-sensitive platform, - // it is correctly identified. - string designer_format = string.Format(".Designer{0}", extension); - - if (path_lower.EndsWith(designer_format.ToLowerInvariant())) - { - int designer_index = path.IndexOf(designer_format); - string file_name = path.Substring(0, designer_index); - - // There are two corrections to the next lines: - // 1. Fix the connection between a designer file and a form - // or usercontrol that don't have an associated resx file. - // 2. Connect settings files to associated designer files. - if (File.Exists(file_name + extension)) - ps.WriteLine(" {0}", Path.GetFileName(file_name + extension)); - else if (File.Exists(file_name + ".resx")) - ps.WriteLine(" {0}", Path.GetFileName(file_name + ".resx")); - else if (File.Exists(file_name + ".settings")) - { - ps.WriteLine(" {0}", Path.GetFileName(file_name + ".settings")); - ps.WriteLine(" True"); - ps.WriteLine(" True"); - } - } - else if (subType == SubType.CodeBehind) - { - ps.WriteLine(" {0}", Path.GetFileName(short_file_name)); - } - if (project.Files.GetIsLink(filePath)) - { - string alias = project.Files.GetLinkPath(filePath); - alias += file.Substring(startPos); - alias = Helper.NormalizePath(alias); - ps.WriteLine(" {0}", alias); - } - else if (project.Files.GetBuildAction(filePath) != BuildAction.None) - { - if (project.Files.GetBuildAction(filePath) != BuildAction.EmbeddedResource) - { - ps.WriteLine(" {0}", subType); - } - } - - if (project.Files.GetCopyToOutput(filePath) != CopyToOutput.Never) - { - ps.WriteLine(" {0}", project.Files.GetCopyToOutput(filePath)); - } - - ps.WriteLine(" ", project.Files.GetBuildAction(filePath)); - } - } - } - - ps.WriteLine(" "); - ps.WriteLine(" "); - ps.WriteLine(" "); - ps.WriteLine(" "); - ps.WriteLine(" "); - ps.WriteLine(" "); - ps.WriteLine(" "); - ps.WriteLine(" "); - ps.WriteLine(""); - } - #endregion - - #region User File - - ps = new StreamWriter(projectFile + ".user"); - using (ps) - { - // Get the first configuration from the project. - ConfigurationNode firstConfiguration = null; - - if (project.Configurations.Count > 0) - { - firstConfiguration = project.Configurations[0]; - } - - ps.WriteLine(""); - //ps.WriteLine( "" ); - //ps.WriteLine(" <{0}>", toolInfo.XMLTag); - //ps.WriteLine(" "); - ps.WriteLine(" "); - //ps.WriteLine(" ", MakeRefPath(project)); - - if (firstConfiguration != null) - { - ps.WriteLine(" {0}", firstConfiguration.Name); - ps.WriteLine(" {0}", firstConfiguration.Platform); - } - - ps.WriteLine(" {0}", MakeRefPath(project)); - ps.WriteLine(" {0}", ProductVersion); - ps.WriteLine(" ProjectFiles"); - ps.WriteLine(" 0"); - ps.WriteLine(" "); - foreach (ConfigurationNode conf in project.Configurations) - { - ps.Write(" "); - } - ps.WriteLine(""); - } - #endregion - - kernel.CurrentWorkingDirectory.Pop(); - } - - private void WriteSolution(SolutionNode solution, bool writeSolutionToDisk) - { - kernel.Log.Write("Creating {0} solution and project files", VersionName); - - foreach (SolutionNode child in solution.Solutions) - { - kernel.Log.Write("...Creating folder: {0}", child.Name); - WriteSolution(child, false); - } - - foreach (ProjectNode project in solution.Projects) - { - kernel.Log.Write("...Creating project: {0}", project.Name); - WriteProject(solution, project); - } - - foreach (DatabaseProjectNode project in solution.DatabaseProjects) - { - kernel.Log.Write("...Creating database project: {0}", project.Name); - WriteDatabaseProject(solution, project); - } - - if (writeSolutionToDisk) // only write main solution - { - kernel.Log.Write(""); - string solutionFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "sln"); - - using (StreamWriter ss = new StreamWriter(solutionFile)) - { - kernel.CurrentWorkingDirectory.Push(); - Helper.SetCurrentDir(Path.GetDirectoryName(solutionFile)); - - ss.WriteLine("Microsoft Visual Studio Solution File, Format Version {0}", SolutionVersion); - ss.WriteLine(SolutionTag); - - WriteProjectDeclarations(ss, solution, solution); - - ss.WriteLine("Global"); - - ss.WriteLine("\tGlobalSection(SolutionConfigurationPlatforms) = preSolution"); - foreach (ConfigurationNode conf in solution.Configurations) - { - ss.WriteLine("\t\t{0} = {0}", conf.NameAndPlatform); - } - ss.WriteLine("\tEndGlobalSection"); - - ss.WriteLine("\tGlobalSection(ProjectConfigurationPlatforms) = postSolution"); - WriteConfigurationLines(solution.Configurations, solution, ss); - ss.WriteLine("\tEndGlobalSection"); - - if (solution.Solutions.Count > 0) - { - ss.WriteLine("\tGlobalSection(NestedProjects) = preSolution"); - foreach (SolutionNode embeddedSolution in solution.Solutions) - { - WriteNestedProjectMap(ss, embeddedSolution); - } - ss.WriteLine("\tEndGlobalSection"); - } - - ss.WriteLine("EndGlobal"); - } - - kernel.CurrentWorkingDirectory.Pop(); - } - } - - private void WriteProjectDeclarations(TextWriter writer, SolutionNode actualSolution, SolutionNode embeddedSolution) - { - foreach (SolutionNode childSolution in embeddedSolution.Solutions) - { - WriteEmbeddedSolution(writer, childSolution); - WriteProjectDeclarations(writer, actualSolution, childSolution); - } - - foreach (ProjectNode project in embeddedSolution.Projects) - { - WriteProject(actualSolution, writer, project); - } - - foreach (DatabaseProjectNode dbProject in embeddedSolution.DatabaseProjects) - { - WriteProject(actualSolution, writer, dbProject); - } - - if (actualSolution.Guid == embeddedSolution.Guid) - { - WriteSolutionFiles(actualSolution, writer); - } - } - - private static void WriteNestedProjectMap(TextWriter writer, SolutionNode embeddedSolution) - { - foreach (ProjectNode project in embeddedSolution.Projects) - { - WriteNestedProject(writer, embeddedSolution, project.Guid); - } - - foreach (DatabaseProjectNode dbProject in embeddedSolution.DatabaseProjects) - { - WriteNestedProject(writer, embeddedSolution, dbProject.Guid); - } - - foreach (SolutionNode child in embeddedSolution.Solutions) - { - WriteNestedProject(writer, embeddedSolution, child.Guid); - WriteNestedProjectMap(writer, child); - } - } - - private static void WriteNestedProject(TextWriter writer, SolutionNode solution, Guid projectGuid) - { - WriteNestedFolder(writer, solution.Guid, projectGuid); - } - - private static void WriteNestedFolder(TextWriter writer, Guid parentGuid, Guid childGuid) - { - writer.WriteLine("\t\t{0} = {1}", - childGuid.ToString("B").ToUpper(), - parentGuid.ToString("B").ToUpper()); - } - - private static void WriteConfigurationLines(IEnumerable configurations, SolutionNode solution, TextWriter ss) - { - foreach (ProjectNode project in solution.Projects) - { - foreach (ConfigurationNode conf in configurations) - { - ss.WriteLine("\t\t{0}.{1}.ActiveCfg = {1}", - project.Guid.ToString("B").ToUpper(), - conf.NameAndPlatform); - - ss.WriteLine("\t\t{0}.{1}.Build.0 = {1}", - project.Guid.ToString("B").ToUpper(), - conf.NameAndPlatform); - } - } - - foreach (SolutionNode child in solution.Solutions) - { - WriteConfigurationLines(configurations, child, ss); - } - } - - private void WriteSolutionFiles(SolutionNode solution, TextWriter ss) - { - if(solution.Files != null && solution.Files.Count > 0) - WriteProject(ss, "Folder", solution.Guid, "Solution Files", "Solution Files", solution.Files); - } - - private void WriteEmbeddedSolution(TextWriter writer, SolutionNode embeddedSolution) - { - WriteProject(writer, "Folder", embeddedSolution.Guid, embeddedSolution.Name, embeddedSolution.Name, embeddedSolution.Files); - } - - private void WriteProject(SolutionNode solution, TextWriter ss, ProjectNode project) - { - WriteProject(ss, solution, project.Language, project.Guid, project.Name, project.FullPath); - } - - private void WriteProject(SolutionNode solution, TextWriter ss, DatabaseProjectNode dbProject) - { - if (solution.Files != null && solution.Files.Count > 0) - WriteProject(ss, solution, "Database", dbProject.Guid, dbProject.Name, dbProject.FullPath); - } - - const string ProjectDeclarationBeginFormat = "Project(\"{0}\") = \"{1}\", \"{2}\", \"{3}\""; - const string ProjectDeclarationEndFormat = "EndProject"; - - private void WriteProject(TextWriter ss, SolutionNode solution, string language, Guid guid, string name, string projectFullPath) - { - if (!tools.ContainsKey(language)) - throw new UnknownLanguageException("Unknown .NET language: " + language); - - ToolInfo toolInfo = tools[language]; - - string path = Helper.MakePathRelativeTo(solution.FullPath, projectFullPath); - - path = Helper.MakeFilePath(path, name, toolInfo.FileExtension); - - WriteProject(ss, language, guid, name, path); - } - - private void WriteProject(TextWriter writer, string language, Guid projectGuid, string name, string location) - { - WriteProject(writer, language, projectGuid, name, location, null); - } - - private void WriteProject(TextWriter writer, string language, Guid projectGuid, string name, string location, FilesNode files) - { - if (!tools.ContainsKey(language)) - throw new UnknownLanguageException("Unknown .NET language: " + language); - - ToolInfo toolInfo = tools[language]; - - writer.WriteLine(ProjectDeclarationBeginFormat, - toolInfo.Guid, - name, - location, - projectGuid.ToString("B").ToUpper()); - - if (files != null) - { - writer.WriteLine("\tProjectSection(SolutionItems) = preProject"); - - foreach (string file in files) - writer.WriteLine("\t\t{0} = {0}", file); - - writer.WriteLine("\tEndProjectSection"); - } - - writer.WriteLine(ProjectDeclarationEndFormat); - } - - private void WriteDatabaseProject(SolutionNode solution, DatabaseProjectNode project) - { - string projectFile = Helper.MakeFilePath(project.FullPath, project.Name, "dbp"); - IndentedTextWriter ps = new IndentedTextWriter(new StreamWriter(projectFile), " "); - - kernel.CurrentWorkingDirectory.Push(); - - Helper.SetCurrentDir(Path.GetDirectoryName(projectFile)); - - using (ps) - { - ps.WriteLine("# Microsoft Developer Studio Project File - Database Project"); - ps.WriteLine("Begin DataProject = \"{0}\"", project.Name); - ps.Indent++; - ps.WriteLine("MSDTVersion = \"80\""); - // TODO: Use the project.Files property - if (ContainsSqlFiles(Path.GetDirectoryName(projectFile))) - WriteDatabaseFoldersAndFiles(ps, Path.GetDirectoryName(projectFile)); - - ps.WriteLine("Begin DBRefFolder = \"Database References\""); - ps.Indent++; - foreach (DatabaseReferenceNode reference in project.References) - { - ps.WriteLine("Begin DBRefNode = \"{0}\"", reference.Name); - ps.Indent++; - ps.WriteLine("ConnectStr = \"{0}\"", reference.ConnectionString); - ps.WriteLine("Provider = \"{0}\"", reference.ProviderId.ToString("B").ToUpper()); - //ps.WriteLine("Colorizer = 5"); - ps.Indent--; - ps.WriteLine("End"); - } - ps.Indent--; - ps.WriteLine("End"); - ps.Indent--; - ps.WriteLine("End"); - - ps.Flush(); - } - - kernel.CurrentWorkingDirectory.Pop(); - } - - private static bool ContainsSqlFiles(string folder) - { - if(Directory.GetFiles(folder, "*.sql").Length > 0) - return true; // if the folder contains 1 .sql file, that's good enough - - foreach (string child in Directory.GetDirectories(folder)) - { - if (ContainsSqlFiles(child)) - return true; // if 1 child folder contains a .sql file, still good enough - } - - return false; - } - - private static void WriteDatabaseFoldersAndFiles(IndentedTextWriter writer, string folder) - { - foreach (string child in Directory.GetDirectories(folder)) - { - if (ContainsSqlFiles(child)) - { - writer.WriteLine("Begin Folder = \"{0}\"", Path.GetFileName(child)); - writer.Indent++; - WriteDatabaseFoldersAndFiles(writer, child); - writer.Indent--; - writer.WriteLine("End"); - } - } - foreach (string file in Directory.GetFiles(folder, "*.sql")) - { - writer.WriteLine("Script = \"{0}\"", Path.GetFileName(file)); - } - } - - private void CleanProject(ProjectNode project) - { - kernel.Log.Write("...Cleaning project: {0}", project.Name); - - ToolInfo toolInfo = tools[project.Language]; - string projectFile = Helper.MakeFilePath(project.FullPath, project.Name, toolInfo.FileExtension); - string userFile = projectFile + ".user"; - - Helper.DeleteIfExists(projectFile); - Helper.DeleteIfExists(userFile); - } - - private void CleanSolution(SolutionNode solution) - { - kernel.Log.Write("Cleaning {0} solution and project files", VersionName, solution.Name); - - string slnFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "sln"); - string suoFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "suo"); - - Helper.DeleteIfExists(slnFile); - Helper.DeleteIfExists(suoFile); - - foreach (ProjectNode project in solution.Projects) - { - CleanProject(project); - } - - kernel.Log.Write(""); - } - - #endregion - - #region ITarget Members - - /// - /// Writes the specified kern. - /// - /// The kern. - public virtual void Write(Kernel kern) - { - if (kern == null) - { - throw new ArgumentNullException("kern"); - } - kernel = kern; - foreach (SolutionNode sol in kernel.Solutions) - { - WriteSolution(sol, true); - } - kernel = null; - } - - /// - /// Cleans the specified kern. - /// - /// The kern. - public virtual void Clean(Kernel kern) - { - if (kern == null) - { - throw new ArgumentNullException("kern"); - } - kernel = kern; - foreach (SolutionNode sol in kernel.Solutions) - { - CleanSolution(sol); - } - kernel = null; - } - - #endregion - } -} +#region BSD License +/* +Copyright (c) 2008 Matthew Holmes (matthew@wildfiregames.com), John Anderson (sontek@gmail.com) + +Redistribution and use in source and binary forms, with or without modification, are permitted +provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this list of conditions + and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, this list of conditions + and the following disclaimer in the documentation and/or other materials provided with the + distribution. + * The name of the author may not be used to endorse or promote products derived from this software + without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, +BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING +IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +#endregion + +using System; +using System.Collections.Generic; +using System.IO; +using Prebuild.Core.Interfaces; +using Prebuild.Core.Nodes; +using Prebuild.Core.Utilities; +using System.CodeDom.Compiler; + +namespace Prebuild.Core.Targets +{ + + /// + /// + /// + public abstract class VSGenericTarget : ITarget + { + #region Fields + + readonly Dictionary tools = new Dictionary(); + Kernel kernel; + #endregion + + #region Properties + /// + /// Gets or sets the solution version. + /// + /// The solution version. + public abstract string SolutionVersion { get; } + /// + /// Gets or sets the product version. + /// + /// The product version. + public abstract string ProductVersion { get; } + /// + /// Gets or sets the schema version. + /// + /// The schema version. + public abstract string SchemaVersion { get; } + /// + /// Gets or sets the name of the version. + /// + /// The name of the version. + public abstract string VersionName { get; } + /// + /// Gets or sets the version. + /// + /// The version. + public abstract VSVersion Version { get; } + /// + /// Gets the name. + /// + /// The name. + public abstract string Name { get; } + + protected abstract string GetToolsVersionXml(FrameworkVersion version); + public abstract string SolutionTag { get; } + + #endregion + + #region Constructors + + /// + /// Initializes a new instance of the class. + /// + protected VSGenericTarget() + { + tools["C#"] = new ToolInfo("C#", "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}", "csproj", "CSHARP", "$(MSBuildBinPath)\\Microsoft.CSHARP.Targets"); + tools["Database"] = new ToolInfo("Database", "{4F174C21-8C12-11D0-8340-0000F80270F8}", "dbp", "UNKNOWN"); + tools["Boo"] = new ToolInfo("Boo", "{45CEA7DC-C2ED-48A6-ACE0-E16144C02365}", "booproj", "Boo", "$(BooBinPath)\\Boo.Microsoft.Build.targets"); + tools["VisualBasic"] = new ToolInfo("VisualBasic", "{F184B08F-C81C-45F6-A57F-5ABD9991F28F}", "vbproj", "VisualBasic", "$(MSBuildBinPath)\\Microsoft.VisualBasic.Targets"); + tools["Folder"] = new ToolInfo("Folder", "{2150E333-8FDC-42A3-9474-1A3956D46DE8}", null, null); + } + + #endregion + + #region Private Methods + + private string MakeRefPath(ProjectNode project) + { + string ret = ""; + foreach (ReferencePathNode node in project.ReferencePaths) + { + try + { + string fullPath = Helper.ResolvePath(node.Path); + if (ret.Length < 1) + { + ret = fullPath; + } + else + { + ret += ";" + fullPath; + } + } + catch (ArgumentException) + { + kernel.Log.Write(LogType.Warning, "Could not resolve reference path: {0}", node.Path); + } + } + + return ret; + } + + private static ProjectNode FindProjectInSolution(string name, SolutionNode solution) + { + SolutionNode node = solution; + + while (node.Parent is SolutionNode) + node = node.Parent as SolutionNode; + + return FindProjectInSolutionRecursively(name, node); + } + + private static ProjectNode FindProjectInSolutionRecursively(string name, SolutionNode solution) + { + if (solution.ProjectsTable.ContainsKey(name)) + return solution.ProjectsTable[name]; + + foreach (SolutionNode child in solution.Solutions) + { + ProjectNode node = FindProjectInSolutionRecursively(name, child); + if (node != null) + return node; + } + + return null; + } + + private void WriteProject(SolutionNode solution, ProjectNode project) + { + if (!tools.ContainsKey(project.Language)) + { + throw new UnknownLanguageException("Unknown .NET language: " + project.Language); + } + + ToolInfo toolInfo = tools[project.Language]; + string projectFile = Helper.MakeFilePath(project.FullPath, project.Name, toolInfo.FileExtension); + StreamWriter ps = new StreamWriter(projectFile); + + kernel.CurrentWorkingDirectory.Push(); + Helper.SetCurrentDir(Path.GetDirectoryName(projectFile)); + + #region Project File + using (ps) + { + ps.WriteLine("", GetToolsVersionXml(project.FrameworkVersion)); + ps.WriteLine(" "); + ps.WriteLine(" Local"); + ps.WriteLine(" {0}", ProductVersion); + ps.WriteLine(" {0}", SchemaVersion); + ps.WriteLine(" {{{0}}}", project.Guid.ToString().ToUpper()); + + // Visual Studio has a hard coded guid for the project type + if (project.Type == ProjectType.Web) + ps.WriteLine(" {349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}"); + ps.WriteLine(" Debug"); + ps.WriteLine(" {0}", project.AppIcon); + ps.WriteLine(" "); + ps.WriteLine(" "); + ps.WriteLine(" {0}", project.AssemblyName); + foreach (ConfigurationNode conf in project.Configurations) + { + if (conf.Options.KeyFile != "") + { + ps.WriteLine(" {0}", conf.Options.KeyFile); + ps.WriteLine(" true"); + break; + } + } + ps.WriteLine(" JScript"); + ps.WriteLine(" Grid"); + ps.WriteLine(" IE50"); + ps.WriteLine(" false"); + ps.WriteLine(" {0}", project.FrameworkVersion.ToString().Replace("_", ".")); + + ps.WriteLine(" {0}", project.Type == ProjectType.Web ? ProjectType.Library.ToString() : project.Type.ToString()); + ps.WriteLine(" {0}", project.DesignerFolder); + ps.WriteLine(" {0}", project.RootNamespace); + ps.WriteLine(" {0}", project.StartupObject); + if (string.IsNullOrEmpty(project.DebugStartParameters)) + { + ps.WriteLine(" {0}", project.DebugStartParameters); + } + ps.WriteLine(" "); + ps.WriteLine(" "); + + ps.WriteLine(" "); + + foreach (ConfigurationNode conf in project.Configurations) + { + ps.Write(" ", conf.Name, conf.Platform); + ps.WriteLine(" {0}", conf.Options["AllowUnsafe"]); + ps.WriteLine(" {0}", conf.Options["BaseAddress"]); + ps.WriteLine(" {0}", conf.Options["CheckUnderflowOverflow"]); + ps.WriteLine(" "); + ps.WriteLine(" "); + ps.WriteLine(" {0}", conf.Options["CompilerDefines"]); + ps.WriteLine(" {0}", Helper.NormalizePath(conf.Options["XmlDocFile"].ToString())); + ps.WriteLine(" {0}", conf.Options["DebugInformation"]); + ps.WriteLine(" {0}", conf.Options["FileAlignment"]); + ps.WriteLine(" {0}", conf.Options["OptimizeCode"]); + if (project.Type != ProjectType.Web) + ps.WriteLine(" {0}", + Helper.EndPath(Helper.NormalizePath(conf.Options["OutputPath"].ToString()))); + else + ps.WriteLine(" {0}", + Helper.EndPath(Helper.NormalizePath("bin\\"))); + + ps.WriteLine(" {0}", conf.Options["RegisterComInterop"]); + ps.WriteLine(" {0}", conf.Options["RemoveIntegerChecks"]); + ps.WriteLine(" {0}", conf.Options["WarningsAsErrors"]); + ps.WriteLine(" {0}", conf.Options["WarningLevel"]); + ps.WriteLine(" {0}", conf.Options["NoStdLib"]); + ps.WriteLine(" {0}", conf.Options["SuppressWarnings"]); + ps.WriteLine(" {0}", conf.Platform); + ps.WriteLine(" "); + } + + //ps.WriteLine(" "); + + Dictionary projectReferences = new Dictionary(); + List otherReferences = new List(); + + foreach (ReferenceNode refr in project.References) + { + ProjectNode projectNode = FindProjectInSolution(refr.Name, solution); + + if (projectNode == null) + otherReferences.Add(refr); + else + projectReferences.Add(refr, projectNode); + } + // Assembly References + ps.WriteLine(" "); + + foreach (ReferenceNode refr in otherReferences) + { + ps.Write(" "); + ps.Write(" "); + ps.Write(refr.Name); + ps.WriteLine(""); + + if(!String.IsNullOrEmpty(refr.Path)) + { + // Use absolute path to assembly (for determining assembly type) + string absolutePath = Path.Combine(project.FullPath, refr.Path); + if(File.Exists(Helper.MakeFilePath(absolutePath, refr.Name, "exe"))) { + // Assembly is an executable (exe) + ps.WriteLine(" {0}", Helper.MakeFilePath(refr.Path, refr.Name, "exe")); + } else if(File.Exists(Helper.MakeFilePath(absolutePath, refr.Name, "dll"))) { + // Assembly is an library (dll) + ps.WriteLine(" {0}", Helper.MakeFilePath(refr.Path, refr.Name, "dll")); + } else { + string referencePath = Helper.MakeFilePath(refr.Path, refr.Name, "dll"); + kernel.Log.Write(LogType.Warning, "Reference \"{0}\": The specified file doesn't exist.", referencePath); + ps.WriteLine(" {0}", Helper.MakeFilePath(refr.Path, refr.Name, "dll")); + } + } + + ps.WriteLine(" {0}", refr.LocalCopy); + ps.WriteLine(" "); + } + ps.WriteLine(" "); + + //Project References + ps.WriteLine(" "); + foreach (KeyValuePair pair in projectReferences) + { + ToolInfo tool = tools[pair.Value.Language]; + if (tools == null) + throw new UnknownLanguageException(); + + string path = + Helper.MakePathRelativeTo(project.FullPath, + Helper.MakeFilePath(pair.Value.FullPath, pair.Value.Name, tool.FileExtension)); + ps.WriteLine(" ", path); + + // TODO: Allow reference to visual basic projects + ps.WriteLine(" {0}", pair.Value.Name); + ps.WriteLine(" {0}", pair.Value.Guid.ToString("B").ToUpper()); + ps.WriteLine(" {0}", tool.Guid.ToUpper()); + + //This is the Copy Local flag in VS + ps.WriteLine(" {0}", pair.Key.LocalCopy); + + ps.WriteLine(" "); + } + ps.WriteLine(" "); + + // ps.WriteLine(" "); + ps.WriteLine(" "); + + // ps.WriteLine(" "); + List list = new List(); + + foreach (string path in project.Files) + { + string lower = path.ToLower(); + if (lower.EndsWith(".resx")) + { + string codebehind = String.Format("{0}.Designer{1}", path.Substring(0, path.LastIndexOf('.')), toolInfo.LanguageExtension); + if (!list.Contains(codebehind)) + list.Add(codebehind); + } + + } + + foreach (string filePath in project.Files) + { + // if (file == "Properties\\Bind.Designer.cs") + // { + // Console.WriteLine("Wait a minute!"); + // Console.WriteLine(project.Files.GetSubType(file).ToString()); + // } + SubType subType = project.Files.GetSubType(filePath); + + // Visual Studio chokes on file names if forward slash is used as a path separator + // instead of backslash. So we must make sure that all file paths written to the + // project file use \ as a path separator. + string file = filePath.Replace(@"/", @"\"); + + if (subType != SubType.Code && subType != SubType.Settings && subType != SubType.Designer + && subType != SubType.CodeBehind) + { + ps.WriteLine(" ", file.Substring(0, file.LastIndexOf('.')) + ".resx"); + ps.WriteLine(" {0}", Path.GetFileName(file)); + ps.WriteLine(" Designer"); + ps.WriteLine(" "); + // + } + + if (subType == SubType.Designer) + { + ps.WriteLine(" ", file); + + string autogen_name = file.Substring(0, file.LastIndexOf('.')) + ".Designer.cs"; + string dependent_name = filePath.Substring(0, file.LastIndexOf('.')) + ".cs"; + + // Check for a parent .cs file with the same name as this designer file + if (File.Exists(Helper.NormalizePath(dependent_name))) + { + ps.WriteLine(" {0}", Path.GetFileName(dependent_name)); + } + else + { + ps.WriteLine(" ResXFileCodeGenerator"); + ps.WriteLine(" {0}", Path.GetFileName(autogen_name)); + ps.WriteLine(" " + subType + ""); + } + + ps.WriteLine(" "); + if (File.Exists(Helper.NormalizePath(autogen_name))) + { + ps.WriteLine(" ", autogen_name); + //ps.WriteLine(" True"); + + // If a parent .cs file exists, link this autogen file to it. Otherwise link + // to the designer file + if (File.Exists(dependent_name)) + { + ps.WriteLine(" {0}", Path.GetFileName(dependent_name)); + } + else + { + ps.WriteLine(" True"); + ps.WriteLine(" {0}", Path.GetFileName(filePath)); + } + + ps.WriteLine(" "); + } + list.Add(autogen_name); + } + if (subType == SubType.Settings) + { + ps.Write(" <{0} ", project.Files.GetBuildAction(filePath)); + ps.WriteLine("Include=\"{0}\">", file); + string fileName = Path.GetFileName(filePath); + if (project.Files.GetBuildAction(filePath) == BuildAction.None) + { + ps.WriteLine(" SettingsSingleFileGenerator"); + ps.WriteLine(" {0}", fileName.Substring(0, fileName.LastIndexOf('.')) + ".Designer.cs"); + } + else + { + ps.WriteLine(" Code"); + ps.WriteLine(" True"); + ps.WriteLine(" True"); + string fileNameShort = fileName.Substring(0, fileName.LastIndexOf('.')); + string fileNameShorter = fileNameShort.Substring(0, fileNameShort.LastIndexOf('.')); + ps.WriteLine(" {0}", Path.GetFileName(fileNameShorter + ".settings")); + } + ps.WriteLine(" ", project.Files.GetBuildAction(filePath)); + } + else if (subType != SubType.Designer) + { + string path = Helper.NormalizePath(file); + string path_lower = path.ToLower(); + + if (!list.Contains(filePath)) + { + ps.Write(" <{0} ", project.Files.GetBuildAction(filePath)); + + int startPos = 0; + if (project.Files.GetPreservePath(filePath)) + { + while ((@"./\").IndexOf(file.Substring(startPos, 1)) != -1) + startPos++; + + } + else + { + startPos = file.LastIndexOf(Path.GetFileName(path)); + } + + // be sure to write out the path with backslashes so VS recognizes + // the file properly. + ps.WriteLine("Include=\"{0}\">", file); + + int last_period_index = file.LastIndexOf('.'); + string short_file_name = file.Substring(0, last_period_index); + string extension = Path.GetExtension(path); + // make this upper case, so that when File.Exists tests for the + // existence of a designer file on a case-sensitive platform, + // it is correctly identified. + string designer_format = string.Format(".Designer{0}", extension); + + if (path_lower.EndsWith(designer_format.ToLowerInvariant())) + { + int designer_index = path.IndexOf(designer_format); + string file_name = path.Substring(0, designer_index); + + // There are two corrections to the next lines: + // 1. Fix the connection between a designer file and a form + // or usercontrol that don't have an associated resx file. + // 2. Connect settings files to associated designer files. + if (File.Exists(file_name + extension)) + ps.WriteLine(" {0}", Path.GetFileName(file_name + extension)); + else if (File.Exists(file_name + ".resx")) + ps.WriteLine(" {0}", Path.GetFileName(file_name + ".resx")); + else if (File.Exists(file_name + ".settings")) + { + ps.WriteLine(" {0}", Path.GetFileName(file_name + ".settings")); + ps.WriteLine(" True"); + ps.WriteLine(" True"); + } + } + else if (subType == SubType.CodeBehind) + { + ps.WriteLine(" {0}", Path.GetFileName(short_file_name)); + } + if (project.Files.GetIsLink(filePath)) + { + string alias = project.Files.GetLinkPath(filePath); + alias += file.Substring(startPos); + alias = Helper.NormalizePath(alias); + ps.WriteLine(" {0}", alias); + } + else if (project.Files.GetBuildAction(filePath) != BuildAction.None) + { + if (project.Files.GetBuildAction(filePath) != BuildAction.EmbeddedResource) + { + ps.WriteLine(" {0}", subType); + } + } + + if (project.Files.GetCopyToOutput(filePath) != CopyToOutput.Never) + { + ps.WriteLine(" {0}", project.Files.GetCopyToOutput(filePath)); + } + + ps.WriteLine(" ", project.Files.GetBuildAction(filePath)); + } + } + } + + ps.WriteLine(" "); + ps.WriteLine(" "); + ps.WriteLine(" "); + ps.WriteLine(" "); + ps.WriteLine(" "); + ps.WriteLine(" "); + ps.WriteLine(" "); + ps.WriteLine(" "); + ps.WriteLine(""); + } + #endregion + + #region User File + + ps = new StreamWriter(projectFile + ".user"); + using (ps) + { + // Get the first configuration from the project. + ConfigurationNode firstConfiguration = null; + + if (project.Configurations.Count > 0) + { + firstConfiguration = project.Configurations[0]; + } + + ps.WriteLine(""); + //ps.WriteLine( "" ); + //ps.WriteLine(" <{0}>", toolInfo.XMLTag); + //ps.WriteLine(" "); + ps.WriteLine(" "); + //ps.WriteLine(" ", MakeRefPath(project)); + + if (firstConfiguration != null) + { + ps.WriteLine(" {0}", firstConfiguration.Name); + ps.WriteLine(" {0}", firstConfiguration.Platform); + } + + ps.WriteLine(" {0}", MakeRefPath(project)); + ps.WriteLine(" {0}", ProductVersion); + ps.WriteLine(" ProjectFiles"); + ps.WriteLine(" 0"); + ps.WriteLine(" "); + foreach (ConfigurationNode conf in project.Configurations) + { + ps.Write(" "); + } + ps.WriteLine(""); + } + #endregion + + kernel.CurrentWorkingDirectory.Pop(); + } + + private void WriteSolution(SolutionNode solution, bool writeSolutionToDisk) + { + kernel.Log.Write("Creating {0} solution and project files", VersionName); + + foreach (SolutionNode child in solution.Solutions) + { + kernel.Log.Write("...Creating folder: {0}", child.Name); + WriteSolution(child, false); + } + + foreach (ProjectNode project in solution.Projects) + { + kernel.Log.Write("...Creating project: {0}", project.Name); + WriteProject(solution, project); + } + + foreach (DatabaseProjectNode project in solution.DatabaseProjects) + { + kernel.Log.Write("...Creating database project: {0}", project.Name); + WriteDatabaseProject(solution, project); + } + + if (writeSolutionToDisk) // only write main solution + { + kernel.Log.Write(""); + string solutionFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "sln"); + + using (StreamWriter ss = new StreamWriter(solutionFile)) + { + kernel.CurrentWorkingDirectory.Push(); + Helper.SetCurrentDir(Path.GetDirectoryName(solutionFile)); + + ss.WriteLine("Microsoft Visual Studio Solution File, Format Version {0}", SolutionVersion); + ss.WriteLine(SolutionTag); + + WriteProjectDeclarations(ss, solution, solution); + + ss.WriteLine("Global"); + + ss.WriteLine("\tGlobalSection(SolutionConfigurationPlatforms) = preSolution"); + foreach (ConfigurationNode conf in solution.Configurations) + { + ss.WriteLine("\t\t{0} = {0}", conf.NameAndPlatform); + } + ss.WriteLine("\tEndGlobalSection"); + + ss.WriteLine("\tGlobalSection(ProjectConfigurationPlatforms) = postSolution"); + WriteConfigurationLines(solution.Configurations, solution, ss); + ss.WriteLine("\tEndGlobalSection"); + + if (solution.Solutions.Count > 0) + { + ss.WriteLine("\tGlobalSection(NestedProjects) = preSolution"); + foreach (SolutionNode embeddedSolution in solution.Solutions) + { + WriteNestedProjectMap(ss, embeddedSolution); + } + ss.WriteLine("\tEndGlobalSection"); + } + + ss.WriteLine("EndGlobal"); + } + + kernel.CurrentWorkingDirectory.Pop(); + } + } + + private void WriteProjectDeclarations(TextWriter writer, SolutionNode actualSolution, SolutionNode embeddedSolution) + { + foreach (SolutionNode childSolution in embeddedSolution.Solutions) + { + WriteEmbeddedSolution(writer, childSolution); + WriteProjectDeclarations(writer, actualSolution, childSolution); + } + + foreach (ProjectNode project in embeddedSolution.Projects) + { + WriteProject(actualSolution, writer, project); + } + + foreach (DatabaseProjectNode dbProject in embeddedSolution.DatabaseProjects) + { + WriteProject(actualSolution, writer, dbProject); + } + + if (actualSolution.Guid == embeddedSolution.Guid) + { + WriteSolutionFiles(actualSolution, writer); + } + } + + private static void WriteNestedProjectMap(TextWriter writer, SolutionNode embeddedSolution) + { + foreach (ProjectNode project in embeddedSolution.Projects) + { + WriteNestedProject(writer, embeddedSolution, project.Guid); + } + + foreach (DatabaseProjectNode dbProject in embeddedSolution.DatabaseProjects) + { + WriteNestedProject(writer, embeddedSolution, dbProject.Guid); + } + + foreach (SolutionNode child in embeddedSolution.Solutions) + { + WriteNestedProject(writer, embeddedSolution, child.Guid); + WriteNestedProjectMap(writer, child); + } + } + + private static void WriteNestedProject(TextWriter writer, SolutionNode solution, Guid projectGuid) + { + WriteNestedFolder(writer, solution.Guid, projectGuid); + } + + private static void WriteNestedFolder(TextWriter writer, Guid parentGuid, Guid childGuid) + { + writer.WriteLine("\t\t{0} = {1}", + childGuid.ToString("B").ToUpper(), + parentGuid.ToString("B").ToUpper()); + } + + private static void WriteConfigurationLines(IEnumerable configurations, SolutionNode solution, TextWriter ss) + { + foreach (ProjectNode project in solution.Projects) + { + foreach (ConfigurationNode conf in configurations) + { + ss.WriteLine("\t\t{0}.{1}.ActiveCfg = {1}", + project.Guid.ToString("B").ToUpper(), + conf.NameAndPlatform); + + ss.WriteLine("\t\t{0}.{1}.Build.0 = {1}", + project.Guid.ToString("B").ToUpper(), + conf.NameAndPlatform); + } + } + + foreach (SolutionNode child in solution.Solutions) + { + WriteConfigurationLines(configurations, child, ss); + } + } + + private void WriteSolutionFiles(SolutionNode solution, TextWriter ss) + { + if(solution.Files != null && solution.Files.Count > 0) + WriteProject(ss, "Folder", solution.Guid, "Solution Files", "Solution Files", solution.Files); + } + + private void WriteEmbeddedSolution(TextWriter writer, SolutionNode embeddedSolution) + { + WriteProject(writer, "Folder", embeddedSolution.Guid, embeddedSolution.Name, embeddedSolution.Name, embeddedSolution.Files); + } + + private void WriteProject(SolutionNode solution, TextWriter ss, ProjectNode project) + { + WriteProject(ss, solution, project.Language, project.Guid, project.Name, project.FullPath); + } + + private void WriteProject(SolutionNode solution, TextWriter ss, DatabaseProjectNode dbProject) + { + if (solution.Files != null && solution.Files.Count > 0) + WriteProject(ss, solution, "Database", dbProject.Guid, dbProject.Name, dbProject.FullPath); + } + + const string ProjectDeclarationBeginFormat = "Project(\"{0}\") = \"{1}\", \"{2}\", \"{3}\""; + const string ProjectDeclarationEndFormat = "EndProject"; + + private void WriteProject(TextWriter ss, SolutionNode solution, string language, Guid guid, string name, string projectFullPath) + { + if (!tools.ContainsKey(language)) + throw new UnknownLanguageException("Unknown .NET language: " + language); + + ToolInfo toolInfo = tools[language]; + + string path = Helper.MakePathRelativeTo(solution.FullPath, projectFullPath); + + path = Helper.MakeFilePath(path, name, toolInfo.FileExtension); + + WriteProject(ss, language, guid, name, path); + } + + private void WriteProject(TextWriter writer, string language, Guid projectGuid, string name, string location) + { + WriteProject(writer, language, projectGuid, name, location, null); + } + + private void WriteProject(TextWriter writer, string language, Guid projectGuid, string name, string location, FilesNode files) + { + if (!tools.ContainsKey(language)) + throw new UnknownLanguageException("Unknown .NET language: " + language); + + ToolInfo toolInfo = tools[language]; + + writer.WriteLine(ProjectDeclarationBeginFormat, + toolInfo.Guid, + name, + location, + projectGuid.ToString("B").ToUpper()); + + if (files != null) + { + writer.WriteLine("\tProjectSection(SolutionItems) = preProject"); + + foreach (string file in files) + writer.WriteLine("\t\t{0} = {0}", file); + + writer.WriteLine("\tEndProjectSection"); + } + + writer.WriteLine(ProjectDeclarationEndFormat); + } + + private void WriteDatabaseProject(SolutionNode solution, DatabaseProjectNode project) + { + string projectFile = Helper.MakeFilePath(project.FullPath, project.Name, "dbp"); + IndentedTextWriter ps = new IndentedTextWriter(new StreamWriter(projectFile), " "); + + kernel.CurrentWorkingDirectory.Push(); + + Helper.SetCurrentDir(Path.GetDirectoryName(projectFile)); + + using (ps) + { + ps.WriteLine("# Microsoft Developer Studio Project File - Database Project"); + ps.WriteLine("Begin DataProject = \"{0}\"", project.Name); + ps.Indent++; + ps.WriteLine("MSDTVersion = \"80\""); + // TODO: Use the project.Files property + if (ContainsSqlFiles(Path.GetDirectoryName(projectFile))) + WriteDatabaseFoldersAndFiles(ps, Path.GetDirectoryName(projectFile)); + + ps.WriteLine("Begin DBRefFolder = \"Database References\""); + ps.Indent++; + foreach (DatabaseReferenceNode reference in project.References) + { + ps.WriteLine("Begin DBRefNode = \"{0}\"", reference.Name); + ps.Indent++; + ps.WriteLine("ConnectStr = \"{0}\"", reference.ConnectionString); + ps.WriteLine("Provider = \"{0}\"", reference.ProviderId.ToString("B").ToUpper()); + //ps.WriteLine("Colorizer = 5"); + ps.Indent--; + ps.WriteLine("End"); + } + ps.Indent--; + ps.WriteLine("End"); + ps.Indent--; + ps.WriteLine("End"); + + ps.Flush(); + } + + kernel.CurrentWorkingDirectory.Pop(); + } + + private static bool ContainsSqlFiles(string folder) + { + if(Directory.GetFiles(folder, "*.sql").Length > 0) + return true; // if the folder contains 1 .sql file, that's good enough + + foreach (string child in Directory.GetDirectories(folder)) + { + if (ContainsSqlFiles(child)) + return true; // if 1 child folder contains a .sql file, still good enough + } + + return false; + } + + private static void WriteDatabaseFoldersAndFiles(IndentedTextWriter writer, string folder) + { + foreach (string child in Directory.GetDirectories(folder)) + { + if (ContainsSqlFiles(child)) + { + writer.WriteLine("Begin Folder = \"{0}\"", Path.GetFileName(child)); + writer.Indent++; + WriteDatabaseFoldersAndFiles(writer, child); + writer.Indent--; + writer.WriteLine("End"); + } + } + foreach (string file in Directory.GetFiles(folder, "*.sql")) + { + writer.WriteLine("Script = \"{0}\"", Path.GetFileName(file)); + } + } + + private void CleanProject(ProjectNode project) + { + kernel.Log.Write("...Cleaning project: {0}", project.Name); + + ToolInfo toolInfo = tools[project.Language]; + string projectFile = Helper.MakeFilePath(project.FullPath, project.Name, toolInfo.FileExtension); + string userFile = projectFile + ".user"; + + Helper.DeleteIfExists(projectFile); + Helper.DeleteIfExists(userFile); + } + + private void CleanSolution(SolutionNode solution) + { + kernel.Log.Write("Cleaning {0} solution and project files", VersionName, solution.Name); + + string slnFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "sln"); + string suoFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "suo"); + + Helper.DeleteIfExists(slnFile); + Helper.DeleteIfExists(suoFile); + + foreach (ProjectNode project in solution.Projects) + { + CleanProject(project); + } + + kernel.Log.Write(""); + } + + #endregion + + #region ITarget Members + + /// + /// Writes the specified kern. + /// + /// The kern. + public virtual void Write(Kernel kern) + { + if (kern == null) + { + throw new ArgumentNullException("kern"); + } + kernel = kern; + foreach (SolutionNode sol in kernel.Solutions) + { + WriteSolution(sol, true); + } + kernel = null; + } + + /// + /// Cleans the specified kern. + /// + /// The kern. + public virtual void Clean(Kernel kern) + { + if (kern == null) + { + throw new ArgumentNullException("kern"); + } + kernel = kern; + foreach (SolutionNode sol in kernel.Solutions) + { + CleanSolution(sol); + } + kernel = null; + } + + #endregion + } +} diff --git a/Prebuild/src/Core/Targets/AutotoolsTarget.cs b/Prebuild/src/Core/Targets/AutotoolsTarget.cs index e46b5a5..485e4dd 100644 --- a/Prebuild/src/Core/Targets/AutotoolsTarget.cs +++ b/Prebuild/src/Core/Targets/AutotoolsTarget.cs @@ -1,1070 +1,1070 @@ -#region BSD License -/* - -Copyright (c) 2004 - 2008 -Matthew Holmes (matthew@wildfiregames.com), -Dan Moorehead (dan05a@gmail.com), -Dave Hudson (jendave@yahoo.com), -C.J. Adams-Collier (cjac@colliertech.org), - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - -* Redistributions of source code must retain the above copyright -notice, this list of conditions and the following disclaimer. - -* Redistributions in binary form must reproduce the above copyright -notice, this list of conditions and the following disclaimer in the -documentation and/or other materials provided with the distribution. - -* The name of the author may not be used to endorse or promote -products derived from this software without specific prior written -permission. - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR -IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, -INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, -STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING -IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -POSSIBILITY OF SUCH DAMAGE. - -*/ -#endregion - -#region MIT X11 license - -/* - Portions of this file authored by Lluis Sanchez Gual - - Copyright (C) 2006 Novell, Inc (http://www.novell.com) - - Permission is hereby granted, free of charge, to any person obtaining - a copy of this software and associated documentation files (the - "Software"), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - The above copyright notice and this permission notice shall be - included in all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE - LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION - OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION - WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -#endregion -using System; -using System.Collections.Generic; -using System.IO; -using System.Reflection; -using System.Text; -using System.Text.RegularExpressions; -using System.Xml; -using System.Xml.Xsl; -using System.Net; -using System.Diagnostics; - -using Prebuild.Core.Attributes; -using Prebuild.Core.Interfaces; -using Prebuild.Core.Nodes; -using Prebuild.Core.Utilities; - -namespace Prebuild.Core.Targets -{ - public enum ClrVersion - { - Default, - Net_1_1, - Net_2_0 - } - - public class SystemPackage - { - string name; - string version; - string description; - string[] assemblies; - bool isInternal; - ClrVersion targetVersion; - - public void Initialize(string name, - string version, - string description, - string[] assemblies, - ClrVersion targetVersion, - bool isInternal) - { - this.isInternal = isInternal; - this.name = name; - this.version = version; - this.assemblies = assemblies; - this.description = description; - this.targetVersion = targetVersion; - } - - public string Name - { - get { return name; } - } - - public string Version - { - get { return version; } - } - - public string Description - { - get { return description; } - } - - public ClrVersion TargetVersion - { - get { return targetVersion; } - } - - // The package is part of the mono SDK - public bool IsCorePackage - { - get { return name == "mono"; } - } - - // The package has been registered by an add-in, and is not installed - // in the system. - public bool IsInternalPackage - { - get { return isInternal; } - } - - public string[] Assemblies - { - get { return assemblies; } - } - - } - - - /// - /// - /// - [Target("autotools")] - public class AutotoolsTarget : ITarget - { - #region Fields - - Kernel m_Kernel; - XmlDocument autotoolsDoc; - XmlUrlResolver xr; - System.Security.Policy.Evidence e; - readonly Dictionary assemblyPathToPackage = new Dictionary(); - readonly Dictionary assemblyFullNameToPath = new Dictionary(); - readonly Dictionary packagesHash = new Dictionary(); - readonly List packages = new List(); - - #endregion - - #region Private Methods - - private static void mkdirDashP(string dirName) - { - DirectoryInfo di = new DirectoryInfo(dirName); - if (di.Exists) - return; - - string parentDirName = System.IO.Path.GetDirectoryName(dirName); - DirectoryInfo parentDi = new DirectoryInfo(parentDirName); - if (!parentDi.Exists) - mkdirDashP(parentDirName); - - di.Create(); - } - - private static void chkMkDir(string dirName) - { - System.IO.DirectoryInfo di = - new System.IO.DirectoryInfo(dirName); - - if (!di.Exists) - di.Create(); - } - - private void transformToFile(string filename, XsltArgumentList argList, string nodeName) - { - // Create an XslTransform for this file - XslTransform templateTransformer = - new XslTransform(); - - // Load up the template - XmlNode templateNode = - autotoolsDoc.SelectSingleNode(nodeName + "/*"); - templateTransformer.Load(templateNode.CreateNavigator(), xr, e); - - // Create a writer for the transformed template - XmlTextWriter templateWriter = - new XmlTextWriter(filename, null); - - // Perform transformation, writing the file - templateTransformer.Transform - (m_Kernel.CurrentDoc, argList, templateWriter, xr); - } - - static string NormalizeAsmName(string name) - { - int i = name.IndexOf(", PublicKeyToken=null"); - if (i != -1) - return name.Substring(0, i).Trim(); - return name; - } - - private void AddAssembly(string assemblyfile, SystemPackage package) - { - if (!File.Exists(assemblyfile)) - return; - - try - { - System.Reflection.AssemblyName an = System.Reflection.AssemblyName.GetAssemblyName(assemblyfile); - assemblyFullNameToPath[NormalizeAsmName(an.FullName)] = assemblyfile; - assemblyPathToPackage[assemblyfile] = package; - } - catch - { - } - } - - private static List GetAssembliesWithLibInfo(string line, string file) - { - List references = new List(); - List libdirs = new List(); - List retval = new List(); - foreach (string piece in line.Split(' ')) - { - if (piece.ToLower().Trim().StartsWith("/r:") || piece.ToLower().Trim().StartsWith("-r:")) - { - references.Add(ProcessPiece(piece.Substring(3).Trim(), file)); - } - else if (piece.ToLower().Trim().StartsWith("/lib:") || piece.ToLower().Trim().StartsWith("-lib:")) - { - libdirs.Add(ProcessPiece(piece.Substring(5).Trim(), file)); - } - } - - foreach (string refrnc in references) - { - foreach (string libdir in libdirs) - { - if (File.Exists(libdir + Path.DirectorySeparatorChar + refrnc)) - { - retval.Add(libdir + Path.DirectorySeparatorChar + refrnc); - } - } - } - - return retval; - } - - private static List GetAssembliesWithoutLibInfo(string line, string file) - { - List references = new List(); - foreach (string reference in line.Split(' ')) - { - if (reference.ToLower().Trim().StartsWith("/r:") || reference.ToLower().Trim().StartsWith("-r:")) - { - string final_ref = reference.Substring(3).Trim(); - references.Add(ProcessPiece(final_ref, file)); - } - } - return references; - } - - private static string ProcessPiece(string piece, string pcfile) - { - int start = piece.IndexOf("${"); - if (start == -1) - return piece; - - int end = piece.IndexOf("}"); - if (end == -1) - return piece; - - string variable = piece.Substring(start + 2, end - start - 2); - string interp = GetVariableFromPkgConfig(variable, Path.GetFileNameWithoutExtension(pcfile)); - return ProcessPiece(piece.Replace("${" + variable + "}", interp), pcfile); - } - - private static string GetVariableFromPkgConfig(string var, string pcfile) - { - ProcessStartInfo psi = new ProcessStartInfo("pkg-config"); - psi.RedirectStandardOutput = true; - psi.UseShellExecute = false; - psi.Arguments = String.Format("--variable={0} {1}", var, pcfile); - Process p = new Process(); - p.StartInfo = psi; - p.Start(); - string ret = p.StandardOutput.ReadToEnd().Trim(); - p.WaitForExit(); - if (String.IsNullOrEmpty(ret)) - return String.Empty; - return ret; - } - - private void ParsePCFile(string pcfile) - { - // Don't register the package twice - string pname = Path.GetFileNameWithoutExtension(pcfile); - if (packagesHash.ContainsKey(pname)) - return; - - List fullassemblies = null; - string version = ""; - string desc = ""; - - SystemPackage package = new SystemPackage(); - - using (StreamReader reader = new StreamReader(pcfile)) - { - string line; - while ((line = reader.ReadLine()) != null) - { - string lowerLine = line.ToLower(); - if (lowerLine.StartsWith("libs:") && lowerLine.IndexOf(".dll") != -1) - { - string choppedLine = line.Substring(5).Trim(); - if (choppedLine.IndexOf("-lib:") != -1 || choppedLine.IndexOf("/lib:") != -1) - { - fullassemblies = GetAssembliesWithLibInfo(choppedLine, pcfile); - } - else - { - fullassemblies = GetAssembliesWithoutLibInfo(choppedLine, pcfile); - } - } - else if (lowerLine.StartsWith("version:")) - { - // "version:".Length == 8 - version = line.Substring(8).Trim(); - } - else if (lowerLine.StartsWith("description:")) - { - // "description:".Length == 12 - desc = line.Substring(12).Trim(); - } - } - } - - if (fullassemblies == null) - return; - - foreach (string assembly in fullassemblies) - { - AddAssembly(assembly, package); - } - - package.Initialize(pname, - version, - desc, - fullassemblies.ToArray(), - ClrVersion.Default, - false); - packages.Add(package); - packagesHash[pname] = package; - } - - void RegisterSystemAssemblies(string prefix, string version, ClrVersion ver) - { - SystemPackage package = new SystemPackage(); - List list = new List(); - - string dir = Path.Combine(prefix, version); - if (!Directory.Exists(dir)) - { - return; - } - - foreach (string assembly in Directory.GetFiles(dir, "*.dll")) - { - AddAssembly(assembly, package); - list.Add(assembly); - } - - package.Initialize("mono", - version, - "The Mono runtime", - list.ToArray(), - ver, - false); - packages.Add(package); - } - - void RunInitialization() - { - string versionDir; - - if (Environment.Version.Major == 1) - { - versionDir = "1.0"; - } - else - { - versionDir = "2.0"; - } - - //Pull up assemblies from the installed mono system. - string prefix = Path.GetDirectoryName(typeof(int).Assembly.Location); - - if (prefix.IndexOf(Path.Combine("mono", versionDir)) == -1) - prefix = Path.Combine(prefix, "mono"); - else - prefix = Path.GetDirectoryName(prefix); - - RegisterSystemAssemblies(prefix, "1.0", ClrVersion.Net_1_1); - RegisterSystemAssemblies(prefix, "2.0", ClrVersion.Net_2_0); - - string search_dirs = Environment.GetEnvironmentVariable("PKG_CONFIG_PATH"); - string libpath = Environment.GetEnvironmentVariable("PKG_CONFIG_LIBPATH"); - - if (String.IsNullOrEmpty(libpath)) - { - string path_dirs = Environment.GetEnvironmentVariable("PATH"); - foreach (string pathdir in path_dirs.Split(Path.PathSeparator)) - { - if (pathdir == null) - continue; - if (File.Exists(pathdir + Path.DirectorySeparatorChar + "pkg-config")) - { - libpath = Path.Combine(pathdir, ".."); - libpath = Path.Combine(libpath, "lib"); - libpath = Path.Combine(libpath, "pkgconfig"); - break; - } - } - } - search_dirs += Path.PathSeparator + libpath; - if (!string.IsNullOrEmpty(search_dirs)) - { - List scanDirs = new List(); - foreach (string potentialDir in search_dirs.Split(Path.PathSeparator)) - { - if (!scanDirs.Contains(potentialDir)) - scanDirs.Add(potentialDir); - } - foreach (string pcdir in scanDirs) - { - if (pcdir == null) - continue; - - if (Directory.Exists(pcdir)) - { - foreach (string pcfile in Directory.GetFiles(pcdir, "*.pc")) - { - ParsePCFile(pcfile); - } - } - } - } - } - - private void WriteCombine(SolutionNode solution) - { - #region "Create Solution directory if it doesn't exist" - string solutionDir = Path.Combine(solution.FullPath, - Path.Combine("autotools", - solution.Name)); - chkMkDir(solutionDir); - #endregion - - #region "Write Solution-level files" - XsltArgumentList argList = new XsltArgumentList(); - argList.AddParam("solutionName", "", solution.Name); - // $solutionDir is $rootDir/$solutionName/ - transformToFile(Path.Combine(solutionDir, "configure.ac"), - argList, "/Autotools/SolutionConfigureAc"); - transformToFile(Path.Combine(solutionDir, "Makefile.am"), - argList, "/Autotools/SolutionMakefileAm"); - transformToFile(Path.Combine(solutionDir, "autogen.sh"), - argList, "/Autotools/SolutionAutogenSh"); - #endregion - - foreach (ProjectNode project in solution.ProjectsTableOrder) - { - m_Kernel.Log.Write(String.Format("Writing project: {0}", - project.Name)); - WriteProject(solution, project); - } - } - - private static string FindFileReference(string refName, - ProjectNode project) - { - foreach (ReferencePathNode refPath in project.ReferencePaths) - { - string fullPath = - Helper.MakeFilePath(refPath.Path, refName, "dll"); - - if (File.Exists(fullPath)) { - return fullPath; - } - } - - return null; - } - - /// - /// Gets the XML doc file. - /// - /// The project. - /// The conf. - /// - public static string GetXmlDocFile(ProjectNode project, ConfigurationNode conf) - { - if (conf == null) - { - throw new ArgumentNullException("conf"); - } - if (project == null) - { - throw new ArgumentNullException("project"); - } - string docFile = (string)conf.Options["XmlDocFile"]; - // if(docFile != null && docFile.Length == 0)//default to assembly name if not specified - // { - // return Path.GetFileNameWithoutExtension(project.AssemblyName) + ".xml"; - // } - return docFile; - } - - /// - /// Normalizes the path. - /// - /// The path. - /// - public static string NormalizePath(string path) - { - if (path == null) - { - return ""; - } - - StringBuilder tmpPath; - - if (Core.Parse.Preprocessor.GetOS() == "Win32") - { - tmpPath = new StringBuilder(path.Replace('\\', '/')); - tmpPath.Replace("/", @"\\"); - } - else - { - tmpPath = new StringBuilder(path.Replace('\\', '/')); - tmpPath = tmpPath.Replace('/', Path.DirectorySeparatorChar); - } - return tmpPath.ToString(); - } - - private void WriteProject(SolutionNode solution, ProjectNode project) - { - string solutionDir = Path.Combine(solution.FullPath, Path.Combine("autotools", solution.Name)); - string projectDir = Path.Combine(solutionDir, project.Name); - string projectVersion = project.Version; - bool hasAssemblyConfig = false; - chkMkDir(projectDir); - - List - compiledFiles = new List(), - contentFiles = new List(), - embeddedFiles = new List(), - - binaryLibs = new List(), - pkgLibs = new List(), - systemLibs = new List(), - runtimeLibs = new List(), - - extraDistFiles = new List(), - localCopyTargets = new List(); - - // If there exists a .config file for this assembly, copy - // it to the project folder - - // TODO: Support copying .config.osx files - // TODO: support processing the .config file for native library deps - string projectAssemblyName = project.Name; - if (project.AssemblyName != null) - projectAssemblyName = project.AssemblyName; - - if (File.Exists(Path.Combine(project.FullPath, projectAssemblyName) + ".dll.config")) - { - hasAssemblyConfig = true; - System.IO.File.Copy(Path.Combine(project.FullPath, projectAssemblyName + ".dll.config"), Path.Combine(projectDir, projectAssemblyName + ".dll.config"), true); - extraDistFiles.Add(project.AssemblyName + ".dll.config"); - } - - foreach (ConfigurationNode conf in project.Configurations) - { - if (conf.Options.KeyFile != string.Empty) - { - // Copy snk file into the project's directory - // Use the snk from the project directory directly - string source = Path.Combine(project.FullPath, conf.Options.KeyFile); - string keyFile = conf.Options.KeyFile; - Regex re = new Regex(".*/"); - keyFile = re.Replace(keyFile, ""); - - string dest = Path.Combine(projectDir, keyFile); - // Tell the user if there's a problem copying the file - try - { - mkdirDashP(System.IO.Path.GetDirectoryName(dest)); - System.IO.File.Copy(source, dest, true); - } - catch (System.IO.IOException e) - { - Console.WriteLine(e.Message); - } - } - } - - // Copy compiled, embedded and content files into the project's directory - foreach (string filename in project.Files) - { - string source = Path.Combine(project.FullPath, filename); - string dest = Path.Combine(projectDir, filename); - - if (filename.Contains("AssemblyInfo.cs")) - { - // If we've got an AssemblyInfo.cs, pull the version number from it - string[] sources = { source }; - string[] args = { "" }; - Microsoft.CSharp.CSharpCodeProvider cscp = - new Microsoft.CSharp.CSharpCodeProvider(); - - string tempAssemblyFile = Path.Combine(Path.GetTempPath(), project.Name + "-temp.dll"); - System.CodeDom.Compiler.CompilerParameters cparam = - new System.CodeDom.Compiler.CompilerParameters(args, tempAssemblyFile); - - System.CodeDom.Compiler.CompilerResults cr = - cscp.CompileAssemblyFromFile(cparam, sources); - - foreach (System.CodeDom.Compiler.CompilerError error in cr.Errors) - Console.WriteLine("Error! '{0}'", error.ErrorText); - - try { - string projectFullName = cr.CompiledAssembly.FullName; - Regex verRegex = new Regex("Version=([\\d\\.]+)"); - Match verMatch = verRegex.Match(projectFullName); - if (verMatch.Success) - projectVersion = verMatch.Groups[1].Value; - }catch{ - Console.WriteLine("Couldn't compile AssemblyInfo.cs"); - } - - // Clean up the temp file - try - { - if (File.Exists(tempAssemblyFile)) - File.Delete(tempAssemblyFile); - } - catch - { - Console.WriteLine("Error! '{0}'", e); - } - - } - - // Tell the user if there's a problem copying the file - try - { - mkdirDashP(System.IO.Path.GetDirectoryName(dest)); - System.IO.File.Copy(source, dest, true); - } - catch (System.IO.IOException e) - { - Console.WriteLine(e.Message); - } - - switch (project.Files.GetBuildAction(filename)) - { - case BuildAction.Compile: - compiledFiles.Add(filename); - break; - case BuildAction.Content: - contentFiles.Add(filename); - extraDistFiles.Add(filename); - break; - case BuildAction.EmbeddedResource: - embeddedFiles.Add(filename); - break; - } - } - - // Set up references - for (int refNum = 0; refNum < project.References.Count; refNum++) - { - ReferenceNode refr = project.References[refNum]; - Assembly refAssembly = Assembly.LoadWithPartialName(refr.Name); - - /* Determine which pkg-config (.pc) file refers to - this assembly */ - - SystemPackage package = null; - - if (packagesHash.ContainsKey(refr.Name)) - { - package = packagesHash[refr.Name]; - - } - else - { - string assemblyFullName = string.Empty; - if (refAssembly != null) - assemblyFullName = refAssembly.FullName; - - string assemblyFileName = string.Empty; - if (assemblyFullName != string.Empty && - assemblyFullNameToPath.ContainsKey(assemblyFullName) - ) - assemblyFileName = - assemblyFullNameToPath[assemblyFullName]; - - if (assemblyFileName != string.Empty && - assemblyPathToPackage.ContainsKey(assemblyFileName) - ) - package = assemblyPathToPackage[assemblyFileName]; - - } - - /* If we know the .pc file and it is not "mono" - (already in the path), add a -pkg: argument */ - - if (package != null && - package.Name != "mono" && - !pkgLibs.Contains(package.Name) - ) - pkgLibs.Add(package.Name); - - string fileRef = - FindFileReference(refr.Name, (ProjectNode)refr.Parent); - - if (refr.LocalCopy || - solution.ProjectsTable.ContainsKey(refr.Name) || - fileRef != null || - refr.Path != null - ) - { - - /* Attempt to copy the referenced lib to the - project's directory */ - - string filename = refr.Name + ".dll"; - string source = filename; - if (refr.Path != null) - source = Path.Combine(refr.Path, source); - source = Path.Combine(project.FullPath, source); - string dest = Path.Combine(projectDir, filename); - - /* Since we depend on this binary dll to build, we - * will add a compile- time dependency on the - * copied dll, and add the dll to the list of - * files distributed with this package - */ - - binaryLibs.Add(refr.Name + ".dll"); - extraDistFiles.Add(refr.Name + ".dll"); - - // TODO: Support copying .config.osx files - // TODO: Support for determining native dependencies - if (File.Exists(source + ".config")) - { - System.IO.File.Copy(source + ".config", Path.GetDirectoryName(dest), true); - extraDistFiles.Add(refr.Name + ".dll.config"); - } - - try - { - System.IO.File.Copy(source, dest, true); - } - catch (System.IO.IOException) - { - if (solution.ProjectsTable.ContainsKey(refr.Name)){ - - /* If an assembly is referenced, marked for - * local copy, in the list of projects for - * this solution, but does not exist, put a - * target into the Makefile.am to build the - * assembly and copy it to this project's - * directory - */ - - ProjectNode sourcePrj = - ((solution.ProjectsTable[refr.Name])); - - string target = - String.Format("{0}:\n" + - "\t$(MAKE) -C ../{1}\n" + - "\tln ../{2}/$@ $@\n", - filename, - sourcePrj.Name, - sourcePrj.Name ); - - localCopyTargets.Add(target); - } - } - } - else if( !pkgLibs.Contains(refr.Name) ) - { - // Else, let's assume it's in the GAC or the lib path - string assemName = string.Empty; - int index = refr.Name.IndexOf(","); - - if (index > 0) - assemName = refr.Name.Substring(0, index); - else - assemName = refr.Name; - - m_Kernel.Log.Write(String.Format( - "Warning: Couldn't find an appropriate assembly " + - "for reference:\n'{0}'", refr.Name - )); - systemLibs.Add(assemName); - } - } - - const string lineSep = " \\\n\t"; - string compiledFilesString = string.Empty; - if (compiledFiles.Count > 0) - compiledFilesString = - lineSep + string.Join(lineSep, compiledFiles.ToArray()); - - string embeddedFilesString = ""; - if (embeddedFiles.Count > 0) - embeddedFilesString = - lineSep + string.Join(lineSep, embeddedFiles.ToArray()); - - string contentFilesString = ""; - if (contentFiles.Count > 0) - contentFilesString = - lineSep + string.Join(lineSep, contentFiles.ToArray()); - - string extraDistFilesString = ""; - if (extraDistFiles.Count > 0) - extraDistFilesString = - lineSep + string.Join(lineSep, extraDistFiles.ToArray()); - - string pkgLibsString = ""; - if (pkgLibs.Count > 0) - pkgLibsString = - lineSep + string.Join(lineSep, pkgLibs.ToArray()); - - string binaryLibsString = ""; - if (binaryLibs.Count > 0) - binaryLibsString = - lineSep + string.Join(lineSep, binaryLibs.ToArray()); - - string systemLibsString = ""; - if (systemLibs.Count > 0) - systemLibsString = - lineSep + string.Join(lineSep, systemLibs.ToArray()); - - string localCopyTargetsString = ""; - if (localCopyTargets.Count > 0) - localCopyTargetsString = - string.Join("\n", localCopyTargets.ToArray()); - - string monoPath = ""; - foreach (string runtimeLib in runtimeLibs) - { - monoPath += ":`pkg-config --variable=libdir " + runtimeLib + "`"; - } - - // Add the project name to the list of transformation - // parameters - XsltArgumentList argList = new XsltArgumentList(); - argList.AddParam("projectName", "", project.Name); - argList.AddParam("solutionName", "", solution.Name); - argList.AddParam("assemblyName", "", projectAssemblyName); - argList.AddParam("compiledFiles", "", compiledFilesString); - argList.AddParam("embeddedFiles", "", embeddedFilesString); - argList.AddParam("contentFiles", "", contentFilesString); - argList.AddParam("extraDistFiles", "", extraDistFilesString); - argList.AddParam("pkgLibs", "", pkgLibsString); - argList.AddParam("binaryLibs", "", binaryLibsString); - argList.AddParam("systemLibs", "", systemLibsString); - argList.AddParam("monoPath", "", monoPath); - argList.AddParam("localCopyTargets", "", localCopyTargetsString); - argList.AddParam("projectVersion", "", projectVersion); - argList.AddParam("hasAssemblyConfig", "", hasAssemblyConfig ? "true" : ""); - - // Transform the templates - transformToFile(Path.Combine(projectDir, "configure.ac"), argList, "/Autotools/ProjectConfigureAc"); - transformToFile(Path.Combine(projectDir, "Makefile.am"), argList, "/Autotools/ProjectMakefileAm"); - transformToFile(Path.Combine(projectDir, "autogen.sh"), argList, "/Autotools/ProjectAutogenSh"); - - if (project.Type == Core.Nodes.ProjectType.Library) - transformToFile(Path.Combine(projectDir, project.Name + ".pc.in"), argList, "/Autotools/ProjectPcIn"); - if (project.Type == Core.Nodes.ProjectType.Exe || project.Type == Core.Nodes.ProjectType.WinExe) - transformToFile(Path.Combine(projectDir, project.Name.ToLower() + ".in"), argList, "/Autotools/ProjectWrapperScriptIn"); - } - - private void CleanProject(ProjectNode project) - { - m_Kernel.Log.Write("...Cleaning project: {0}", project.Name); - string projectFile = Helper.MakeFilePath(project.FullPath, "Include", "am"); - Helper.DeleteIfExists(projectFile); - } - - private void CleanSolution(SolutionNode solution) - { - m_Kernel.Log.Write("Cleaning Autotools make files for", solution.Name); - - string slnFile = Helper.MakeFilePath(solution.FullPath, "Makefile", "am"); - Helper.DeleteIfExists(slnFile); - - slnFile = Helper.MakeFilePath(solution.FullPath, "Makefile", "in"); - Helper.DeleteIfExists(slnFile); - - slnFile = Helper.MakeFilePath(solution.FullPath, "configure", "ac"); - Helper.DeleteIfExists(slnFile); - - slnFile = Helper.MakeFilePath(solution.FullPath, "configure"); - Helper.DeleteIfExists(slnFile); - - slnFile = Helper.MakeFilePath(solution.FullPath, "Makefile"); - Helper.DeleteIfExists(slnFile); - - foreach (ProjectNode project in solution.Projects) - { - CleanProject(project); - } - - m_Kernel.Log.Write(""); - } - - #endregion - - #region ITarget Members - - /// - /// Writes the specified kern. - /// - /// The kern. - public void Write(Kernel kern) - { - if (kern == null) - { - throw new ArgumentNullException("kern"); - } - m_Kernel = kern; - m_Kernel.Log.Write("Parsing system pkg-config files"); - RunInitialization(); - - const string streamName = "autotools.xml"; - string fqStreamName = String.Format("Prebuild.data.{0}", - streamName - ); - - // Retrieve stream for the autotools template XML - Stream autotoolsStream = Assembly.GetExecutingAssembly() - .GetManifestResourceStream(fqStreamName); - - if(autotoolsStream == null) { - - /* - * try without the default namespace prepended, in - * case prebuild.exe assembly was compiled with - * something other than Visual Studio .NET - */ - - autotoolsStream = Assembly.GetExecutingAssembly() - .GetManifestResourceStream(streamName); - if(autotoolsStream == null){ - string errStr = - String.Format("Could not find embedded resource file:\n" + - "'{0}' or '{1}'", - streamName, fqStreamName - ); - - m_Kernel.Log.Write(errStr); - - throw new System.Reflection.TargetException(errStr); - } - } - - // Create an XML URL Resolver with default credentials - xr = new System.Xml.XmlUrlResolver(); - xr.Credentials = CredentialCache.DefaultCredentials; - - // Create a default evidence - no need to limit access - e = new System.Security.Policy.Evidence(); - - // Load the autotools XML - autotoolsDoc = new XmlDocument(); - autotoolsDoc.Load(autotoolsStream); - - /* rootDir is the filesystem location where the Autotools - * build tree will be created - for now we'll make it - * $PWD/autotools - */ - - string pwd = Directory.GetCurrentDirectory(); - //string pwd = System.Environment.GetEnvironmentVariable("PWD"); - //if (pwd.Length != 0) - //{ - string rootDir = Path.Combine(pwd, "autotools"); - //} - //else - //{ - // pwd = Assembly.GetExecutingAssembly() - //} - chkMkDir(rootDir); - - foreach (SolutionNode solution in kern.Solutions) - { - m_Kernel.Log.Write(String.Format("Writing solution: {0}", - solution.Name)); - WriteCombine(solution); - } - m_Kernel = null; - } - - /// - /// Cleans the specified kern. - /// - /// The kern. - public virtual void Clean(Kernel kern) - { - if (kern == null) - { - throw new ArgumentNullException("kern"); - } - m_Kernel = kern; - foreach (SolutionNode sol in kern.Solutions) - { - CleanSolution(sol); - } - m_Kernel = null; - } - - /// - /// Gets the name. - /// - /// The name. - public string Name - { - get - { - return "autotools"; - } - } - - #endregion - } -} +#region BSD License +/* + +Copyright (c) 2004 - 2008 +Matthew Holmes (matthew@wildfiregames.com), +Dan Moorehead (dan05a@gmail.com), +Dave Hudson (jendave@yahoo.com), +C.J. Adams-Collier (cjac@colliertech.org), + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + +* Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + +* Redistributions in binary form must reproduce the above copyright +notice, this list of conditions and the following disclaimer in the +documentation and/or other materials provided with the distribution. + +* The name of the author may not be used to endorse or promote +products derived from this software without specific prior written +permission. + +THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, +INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, +STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING +IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +POSSIBILITY OF SUCH DAMAGE. + +*/ +#endregion + +#region MIT X11 license + +/* + Portions of this file authored by Lluis Sanchez Gual + + Copyright (C) 2006 Novell, Inc (http://www.novell.com) + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + "Software"), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE + LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION + OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +#endregion +using System; +using System.Collections.Generic; +using System.IO; +using System.Reflection; +using System.Text; +using System.Text.RegularExpressions; +using System.Xml; +using System.Xml.Xsl; +using System.Net; +using System.Diagnostics; + +using Prebuild.Core.Attributes; +using Prebuild.Core.Interfaces; +using Prebuild.Core.Nodes; +using Prebuild.Core.Utilities; + +namespace Prebuild.Core.Targets +{ + public enum ClrVersion + { + Default, + Net_1_1, + Net_2_0 + } + + public class SystemPackage + { + string name; + string version; + string description; + string[] assemblies; + bool isInternal; + ClrVersion targetVersion; + + public void Initialize(string name, + string version, + string description, + string[] assemblies, + ClrVersion targetVersion, + bool isInternal) + { + this.isInternal = isInternal; + this.name = name; + this.version = version; + this.assemblies = assemblies; + this.description = description; + this.targetVersion = targetVersion; + } + + public string Name + { + get { return name; } + } + + public string Version + { + get { return version; } + } + + public string Description + { + get { return description; } + } + + public ClrVersion TargetVersion + { + get { return targetVersion; } + } + + // The package is part of the mono SDK + public bool IsCorePackage + { + get { return name == "mono"; } + } + + // The package has been registered by an add-in, and is not installed + // in the system. + public bool IsInternalPackage + { + get { return isInternal; } + } + + public string[] Assemblies + { + get { return assemblies; } + } + + } + + + /// + /// + /// + [Target("autotools")] + public class AutotoolsTarget : ITarget + { + #region Fields + + Kernel m_Kernel; + XmlDocument autotoolsDoc; + XmlUrlResolver xr; + System.Security.Policy.Evidence e; + readonly Dictionary assemblyPathToPackage = new Dictionary(); + readonly Dictionary assemblyFullNameToPath = new Dictionary(); + readonly Dictionary packagesHash = new Dictionary(); + readonly List packages = new List(); + + #endregion + + #region Private Methods + + private static void mkdirDashP(string dirName) + { + DirectoryInfo di = new DirectoryInfo(dirName); + if (di.Exists) + return; + + string parentDirName = System.IO.Path.GetDirectoryName(dirName); + DirectoryInfo parentDi = new DirectoryInfo(parentDirName); + if (!parentDi.Exists) + mkdirDashP(parentDirName); + + di.Create(); + } + + private static void chkMkDir(string dirName) + { + System.IO.DirectoryInfo di = + new System.IO.DirectoryInfo(dirName); + + if (!di.Exists) + di.Create(); + } + + private void transformToFile(string filename, XsltArgumentList argList, string nodeName) + { + // Create an XslTransform for this file + XslTransform templateTransformer = + new XslTransform(); + + // Load up the template + XmlNode templateNode = + autotoolsDoc.SelectSingleNode(nodeName + "/*"); + templateTransformer.Load(templateNode.CreateNavigator(), xr, e); + + // Create a writer for the transformed template + XmlTextWriter templateWriter = + new XmlTextWriter(filename, null); + + // Perform transformation, writing the file + templateTransformer.Transform + (m_Kernel.CurrentDoc, argList, templateWriter, xr); + } + + static string NormalizeAsmName(string name) + { + int i = name.IndexOf(", PublicKeyToken=null"); + if (i != -1) + return name.Substring(0, i).Trim(); + return name; + } + + private void AddAssembly(string assemblyfile, SystemPackage package) + { + if (!File.Exists(assemblyfile)) + return; + + try + { + System.Reflection.AssemblyName an = System.Reflection.AssemblyName.GetAssemblyName(assemblyfile); + assemblyFullNameToPath[NormalizeAsmName(an.FullName)] = assemblyfile; + assemblyPathToPackage[assemblyfile] = package; + } + catch + { + } + } + + private static List GetAssembliesWithLibInfo(string line, string file) + { + List references = new List(); + List libdirs = new List(); + List retval = new List(); + foreach (string piece in line.Split(' ')) + { + if (piece.ToLower().Trim().StartsWith("/r:") || piece.ToLower().Trim().StartsWith("-r:")) + { + references.Add(ProcessPiece(piece.Substring(3).Trim(), file)); + } + else if (piece.ToLower().Trim().StartsWith("/lib:") || piece.ToLower().Trim().StartsWith("-lib:")) + { + libdirs.Add(ProcessPiece(piece.Substring(5).Trim(), file)); + } + } + + foreach (string refrnc in references) + { + foreach (string libdir in libdirs) + { + if (File.Exists(libdir + Path.DirectorySeparatorChar + refrnc)) + { + retval.Add(libdir + Path.DirectorySeparatorChar + refrnc); + } + } + } + + return retval; + } + + private static List GetAssembliesWithoutLibInfo(string line, string file) + { + List references = new List(); + foreach (string reference in line.Split(' ')) + { + if (reference.ToLower().Trim().StartsWith("/r:") || reference.ToLower().Trim().StartsWith("-r:")) + { + string final_ref = reference.Substring(3).Trim(); + references.Add(ProcessPiece(final_ref, file)); + } + } + return references; + } + + private static string ProcessPiece(string piece, string pcfile) + { + int start = piece.IndexOf("${"); + if (start == -1) + return piece; + + int end = piece.IndexOf("}"); + if (end == -1) + return piece; + + string variable = piece.Substring(start + 2, end - start - 2); + string interp = GetVariableFromPkgConfig(variable, Path.GetFileNameWithoutExtension(pcfile)); + return ProcessPiece(piece.Replace("${" + variable + "}", interp), pcfile); + } + + private static string GetVariableFromPkgConfig(string var, string pcfile) + { + ProcessStartInfo psi = new ProcessStartInfo("pkg-config"); + psi.RedirectStandardOutput = true; + psi.UseShellExecute = false; + psi.Arguments = String.Format("--variable={0} {1}", var, pcfile); + Process p = new Process(); + p.StartInfo = psi; + p.Start(); + string ret = p.StandardOutput.ReadToEnd().Trim(); + p.WaitForExit(); + if (String.IsNullOrEmpty(ret)) + return String.Empty; + return ret; + } + + private void ParsePCFile(string pcfile) + { + // Don't register the package twice + string pname = Path.GetFileNameWithoutExtension(pcfile); + if (packagesHash.ContainsKey(pname)) + return; + + List fullassemblies = null; + string version = ""; + string desc = ""; + + SystemPackage package = new SystemPackage(); + + using (StreamReader reader = new StreamReader(pcfile)) + { + string line; + while ((line = reader.ReadLine()) != null) + { + string lowerLine = line.ToLower(); + if (lowerLine.StartsWith("libs:") && lowerLine.IndexOf(".dll") != -1) + { + string choppedLine = line.Substring(5).Trim(); + if (choppedLine.IndexOf("-lib:") != -1 || choppedLine.IndexOf("/lib:") != -1) + { + fullassemblies = GetAssembliesWithLibInfo(choppedLine, pcfile); + } + else + { + fullassemblies = GetAssembliesWithoutLibInfo(choppedLine, pcfile); + } + } + else if (lowerLine.StartsWith("version:")) + { + // "version:".Length == 8 + version = line.Substring(8).Trim(); + } + else if (lowerLine.StartsWith("description:")) + { + // "description:".Length == 12 + desc = line.Substring(12).Trim(); + } + } + } + + if (fullassemblies == null) + return; + + foreach (string assembly in fullassemblies) + { + AddAssembly(assembly, package); + } + + package.Initialize(pname, + version, + desc, + fullassemblies.ToArray(), + ClrVersion.Default, + false); + packages.Add(package); + packagesHash[pname] = package; + } + + void RegisterSystemAssemblies(string prefix, string version, ClrVersion ver) + { + SystemPackage package = new SystemPackage(); + List list = new List(); + + string dir = Path.Combine(prefix, version); + if (!Directory.Exists(dir)) + { + return; + } + + foreach (string assembly in Directory.GetFiles(dir, "*.dll")) + { + AddAssembly(assembly, package); + list.Add(assembly); + } + + package.Initialize("mono", + version, + "The Mono runtime", + list.ToArray(), + ver, + false); + packages.Add(package); + } + + void RunInitialization() + { + string versionDir; + + if (Environment.Version.Major == 1) + { + versionDir = "1.0"; + } + else + { + versionDir = "2.0"; + } + + //Pull up assemblies from the installed mono system. + string prefix = Path.GetDirectoryName(typeof(int).Assembly.Location); + + if (prefix.IndexOf(Path.Combine("mono", versionDir)) == -1) + prefix = Path.Combine(prefix, "mono"); + else + prefix = Path.GetDirectoryName(prefix); + + RegisterSystemAssemblies(prefix, "1.0", ClrVersion.Net_1_1); + RegisterSystemAssemblies(prefix, "2.0", ClrVersion.Net_2_0); + + string search_dirs = Environment.GetEnvironmentVariable("PKG_CONFIG_PATH"); + string libpath = Environment.GetEnvironmentVariable("PKG_CONFIG_LIBPATH"); + + if (String.IsNullOrEmpty(libpath)) + { + string path_dirs = Environment.GetEnvironmentVariable("PATH"); + foreach (string pathdir in path_dirs.Split(Path.PathSeparator)) + { + if (pathdir == null) + continue; + if (File.Exists(pathdir + Path.DirectorySeparatorChar + "pkg-config")) + { + libpath = Path.Combine(pathdir, ".."); + libpath = Path.Combine(libpath, "lib"); + libpath = Path.Combine(libpath, "pkgconfig"); + break; + } + } + } + search_dirs += Path.PathSeparator + libpath; + if (!string.IsNullOrEmpty(search_dirs)) + { + List scanDirs = new List(); + foreach (string potentialDir in search_dirs.Split(Path.PathSeparator)) + { + if (!scanDirs.Contains(potentialDir)) + scanDirs.Add(potentialDir); + } + foreach (string pcdir in scanDirs) + { + if (pcdir == null) + continue; + + if (Directory.Exists(pcdir)) + { + foreach (string pcfile in Directory.GetFiles(pcdir, "*.pc")) + { + ParsePCFile(pcfile); + } + } + } + } + } + + private void WriteCombine(SolutionNode solution) + { + #region "Create Solution directory if it doesn't exist" + string solutionDir = Path.Combine(solution.FullPath, + Path.Combine("autotools", + solution.Name)); + chkMkDir(solutionDir); + #endregion + + #region "Write Solution-level files" + XsltArgumentList argList = new XsltArgumentList(); + argList.AddParam("solutionName", "", solution.Name); + // $solutionDir is $rootDir/$solutionName/ + transformToFile(Path.Combine(solutionDir, "configure.ac"), + argList, "/Autotools/SolutionConfigureAc"); + transformToFile(Path.Combine(solutionDir, "Makefile.am"), + argList, "/Autotools/SolutionMakefileAm"); + transformToFile(Path.Combine(solutionDir, "autogen.sh"), + argList, "/Autotools/SolutionAutogenSh"); + #endregion + + foreach (ProjectNode project in solution.ProjectsTableOrder) + { + m_Kernel.Log.Write(String.Format("Writing project: {0}", + project.Name)); + WriteProject(solution, project); + } + } + + private static string FindFileReference(string refName, + ProjectNode project) + { + foreach (ReferencePathNode refPath in project.ReferencePaths) + { + string fullPath = + Helper.MakeFilePath(refPath.Path, refName, "dll"); + + if (File.Exists(fullPath)) { + return fullPath; + } + } + + return null; + } + + /// + /// Gets the XML doc file. + /// + /// The project. + /// The conf. + /// + public static string GetXmlDocFile(ProjectNode project, ConfigurationNode conf) + { + if (conf == null) + { + throw new ArgumentNullException("conf"); + } + if (project == null) + { + throw new ArgumentNullException("project"); + } + string docFile = (string)conf.Options["XmlDocFile"]; + // if(docFile != null && docFile.Length == 0)//default to assembly name if not specified + // { + // return Path.GetFileNameWithoutExtension(project.AssemblyName) + ".xml"; + // } + return docFile; + } + + /// + /// Normalizes the path. + /// + /// The path. + /// + public static string NormalizePath(string path) + { + if (path == null) + { + return ""; + } + + StringBuilder tmpPath; + + if (Core.Parse.Preprocessor.GetOS() == "Win32") + { + tmpPath = new StringBuilder(path.Replace('\\', '/')); + tmpPath.Replace("/", @"\\"); + } + else + { + tmpPath = new StringBuilder(path.Replace('\\', '/')); + tmpPath = tmpPath.Replace('/', Path.DirectorySeparatorChar); + } + return tmpPath.ToString(); + } + + private void WriteProject(SolutionNode solution, ProjectNode project) + { + string solutionDir = Path.Combine(solution.FullPath, Path.Combine("autotools", solution.Name)); + string projectDir = Path.Combine(solutionDir, project.Name); + string projectVersion = project.Version; + bool hasAssemblyConfig = false; + chkMkDir(projectDir); + + List + compiledFiles = new List(), + contentFiles = new List(), + embeddedFiles = new List(), + + binaryLibs = new List(), + pkgLibs = new List(), + systemLibs = new List(), + runtimeLibs = new List(), + + extraDistFiles = new List(), + localCopyTargets = new List(); + + // If there exists a .config file for this assembly, copy + // it to the project folder + + // TODO: Support copying .config.osx files + // TODO: support processing the .config file for native library deps + string projectAssemblyName = project.Name; + if (project.AssemblyName != null) + projectAssemblyName = project.AssemblyName; + + if (File.Exists(Path.Combine(project.FullPath, projectAssemblyName) + ".dll.config")) + { + hasAssemblyConfig = true; + System.IO.File.Copy(Path.Combine(project.FullPath, projectAssemblyName + ".dll.config"), Path.Combine(projectDir, projectAssemblyName + ".dll.config"), true); + extraDistFiles.Add(project.AssemblyName + ".dll.config"); + } + + foreach (ConfigurationNode conf in project.Configurations) + { + if (conf.Options.KeyFile != string.Empty) + { + // Copy snk file into the project's directory + // Use the snk from the project directory directly + string source = Path.Combine(project.FullPath, conf.Options.KeyFile); + string keyFile = conf.Options.KeyFile; + Regex re = new Regex(".*/"); + keyFile = re.Replace(keyFile, ""); + + string dest = Path.Combine(projectDir, keyFile); + // Tell the user if there's a problem copying the file + try + { + mkdirDashP(System.IO.Path.GetDirectoryName(dest)); + System.IO.File.Copy(source, dest, true); + } + catch (System.IO.IOException e) + { + Console.WriteLine(e.Message); + } + } + } + + // Copy compiled, embedded and content files into the project's directory + foreach (string filename in project.Files) + { + string source = Path.Combine(project.FullPath, filename); + string dest = Path.Combine(projectDir, filename); + + if (filename.Contains("AssemblyInfo.cs")) + { + // If we've got an AssemblyInfo.cs, pull the version number from it + string[] sources = { source }; + string[] args = { "" }; + Microsoft.CSharp.CSharpCodeProvider cscp = + new Microsoft.CSharp.CSharpCodeProvider(); + + string tempAssemblyFile = Path.Combine(Path.GetTempPath(), project.Name + "-temp.dll"); + System.CodeDom.Compiler.CompilerParameters cparam = + new System.CodeDom.Compiler.CompilerParameters(args, tempAssemblyFile); + + System.CodeDom.Compiler.CompilerResults cr = + cscp.CompileAssemblyFromFile(cparam, sources); + + foreach (System.CodeDom.Compiler.CompilerError error in cr.Errors) + Console.WriteLine("Error! '{0}'", error.ErrorText); + + try { + string projectFullName = cr.CompiledAssembly.FullName; + Regex verRegex = new Regex("Version=([\\d\\.]+)"); + Match verMatch = verRegex.Match(projectFullName); + if (verMatch.Success) + projectVersion = verMatch.Groups[1].Value; + }catch{ + Console.WriteLine("Couldn't compile AssemblyInfo.cs"); + } + + // Clean up the temp file + try + { + if (File.Exists(tempAssemblyFile)) + File.Delete(tempAssemblyFile); + } + catch + { + Console.WriteLine("Error! '{0}'", e); + } + + } + + // Tell the user if there's a problem copying the file + try + { + mkdirDashP(System.IO.Path.GetDirectoryName(dest)); + System.IO.File.Copy(source, dest, true); + } + catch (System.IO.IOException e) + { + Console.WriteLine(e.Message); + } + + switch (project.Files.GetBuildAction(filename)) + { + case BuildAction.Compile: + compiledFiles.Add(filename); + break; + case BuildAction.Content: + contentFiles.Add(filename); + extraDistFiles.Add(filename); + break; + case BuildAction.EmbeddedResource: + embeddedFiles.Add(filename); + break; + } + } + + // Set up references + for (int refNum = 0; refNum < project.References.Count; refNum++) + { + ReferenceNode refr = project.References[refNum]; + Assembly refAssembly = Assembly.LoadWithPartialName(refr.Name); + + /* Determine which pkg-config (.pc) file refers to + this assembly */ + + SystemPackage package = null; + + if (packagesHash.ContainsKey(refr.Name)) + { + package = packagesHash[refr.Name]; + + } + else + { + string assemblyFullName = string.Empty; + if (refAssembly != null) + assemblyFullName = refAssembly.FullName; + + string assemblyFileName = string.Empty; + if (assemblyFullName != string.Empty && + assemblyFullNameToPath.ContainsKey(assemblyFullName) + ) + assemblyFileName = + assemblyFullNameToPath[assemblyFullName]; + + if (assemblyFileName != string.Empty && + assemblyPathToPackage.ContainsKey(assemblyFileName) + ) + package = assemblyPathToPackage[assemblyFileName]; + + } + + /* If we know the .pc file and it is not "mono" + (already in the path), add a -pkg: argument */ + + if (package != null && + package.Name != "mono" && + !pkgLibs.Contains(package.Name) + ) + pkgLibs.Add(package.Name); + + string fileRef = + FindFileReference(refr.Name, (ProjectNode)refr.Parent); + + if (refr.LocalCopy || + solution.ProjectsTable.ContainsKey(refr.Name) || + fileRef != null || + refr.Path != null + ) + { + + /* Attempt to copy the referenced lib to the + project's directory */ + + string filename = refr.Name + ".dll"; + string source = filename; + if (refr.Path != null) + source = Path.Combine(refr.Path, source); + source = Path.Combine(project.FullPath, source); + string dest = Path.Combine(projectDir, filename); + + /* Since we depend on this binary dll to build, we + * will add a compile- time dependency on the + * copied dll, and add the dll to the list of + * files distributed with this package + */ + + binaryLibs.Add(refr.Name + ".dll"); + extraDistFiles.Add(refr.Name + ".dll"); + + // TODO: Support copying .config.osx files + // TODO: Support for determining native dependencies + if (File.Exists(source + ".config")) + { + System.IO.File.Copy(source + ".config", Path.GetDirectoryName(dest), true); + extraDistFiles.Add(refr.Name + ".dll.config"); + } + + try + { + System.IO.File.Copy(source, dest, true); + } + catch (System.IO.IOException) + { + if (solution.ProjectsTable.ContainsKey(refr.Name)){ + + /* If an assembly is referenced, marked for + * local copy, in the list of projects for + * this solution, but does not exist, put a + * target into the Makefile.am to build the + * assembly and copy it to this project's + * directory + */ + + ProjectNode sourcePrj = + ((solution.ProjectsTable[refr.Name])); + + string target = + String.Format("{0}:\n" + + "\t$(MAKE) -C ../{1}\n" + + "\tln ../{2}/$@ $@\n", + filename, + sourcePrj.Name, + sourcePrj.Name ); + + localCopyTargets.Add(target); + } + } + } + else if( !pkgLibs.Contains(refr.Name) ) + { + // Else, let's assume it's in the GAC or the lib path + string assemName = string.Empty; + int index = refr.Name.IndexOf(","); + + if (index > 0) + assemName = refr.Name.Substring(0, index); + else + assemName = refr.Name; + + m_Kernel.Log.Write(String.Format( + "Warning: Couldn't find an appropriate assembly " + + "for reference:\n'{0}'", refr.Name + )); + systemLibs.Add(assemName); + } + } + + const string lineSep = " \\\n\t"; + string compiledFilesString = string.Empty; + if (compiledFiles.Count > 0) + compiledFilesString = + lineSep + string.Join(lineSep, compiledFiles.ToArray()); + + string embeddedFilesString = ""; + if (embeddedFiles.Count > 0) + embeddedFilesString = + lineSep + string.Join(lineSep, embeddedFiles.ToArray()); + + string contentFilesString = ""; + if (contentFiles.Count > 0) + contentFilesString = + lineSep + string.Join(lineSep, contentFiles.ToArray()); + + string extraDistFilesString = ""; + if (extraDistFiles.Count > 0) + extraDistFilesString = + lineSep + string.Join(lineSep, extraDistFiles.ToArray()); + + string pkgLibsString = ""; + if (pkgLibs.Count > 0) + pkgLibsString = + lineSep + string.Join(lineSep, pkgLibs.ToArray()); + + string binaryLibsString = ""; + if (binaryLibs.Count > 0) + binaryLibsString = + lineSep + string.Join(lineSep, binaryLibs.ToArray()); + + string systemLibsString = ""; + if (systemLibs.Count > 0) + systemLibsString = + lineSep + string.Join(lineSep, systemLibs.ToArray()); + + string localCopyTargetsString = ""; + if (localCopyTargets.Count > 0) + localCopyTargetsString = + string.Join("\n", localCopyTargets.ToArray()); + + string monoPath = ""; + foreach (string runtimeLib in runtimeLibs) + { + monoPath += ":`pkg-config --variable=libdir " + runtimeLib + "`"; + } + + // Add the project name to the list of transformation + // parameters + XsltArgumentList argList = new XsltArgumentList(); + argList.AddParam("projectName", "", project.Name); + argList.AddParam("solutionName", "", solution.Name); + argList.AddParam("assemblyName", "", projectAssemblyName); + argList.AddParam("compiledFiles", "", compiledFilesString); + argList.AddParam("embeddedFiles", "", embeddedFilesString); + argList.AddParam("contentFiles", "", contentFilesString); + argList.AddParam("extraDistFiles", "", extraDistFilesString); + argList.AddParam("pkgLibs", "", pkgLibsString); + argList.AddParam("binaryLibs", "", binaryLibsString); + argList.AddParam("systemLibs", "", systemLibsString); + argList.AddParam("monoPath", "", monoPath); + argList.AddParam("localCopyTargets", "", localCopyTargetsString); + argList.AddParam("projectVersion", "", projectVersion); + argList.AddParam("hasAssemblyConfig", "", hasAssemblyConfig ? "true" : ""); + + // Transform the templates + transformToFile(Path.Combine(projectDir, "configure.ac"), argList, "/Autotools/ProjectConfigureAc"); + transformToFile(Path.Combine(projectDir, "Makefile.am"), argList, "/Autotools/ProjectMakefileAm"); + transformToFile(Path.Combine(projectDir, "autogen.sh"), argList, "/Autotools/ProjectAutogenSh"); + + if (project.Type == Core.Nodes.ProjectType.Library) + transformToFile(Path.Combine(projectDir, project.Name + ".pc.in"), argList, "/Autotools/ProjectPcIn"); + if (project.Type == Core.Nodes.ProjectType.Exe || project.Type == Core.Nodes.ProjectType.WinExe) + transformToFile(Path.Combine(projectDir, project.Name.ToLower() + ".in"), argList, "/Autotools/ProjectWrapperScriptIn"); + } + + private void CleanProject(ProjectNode project) + { + m_Kernel.Log.Write("...Cleaning project: {0}", project.Name); + string projectFile = Helper.MakeFilePath(project.FullPath, "Include", "am"); + Helper.DeleteIfExists(projectFile); + } + + private void CleanSolution(SolutionNode solution) + { + m_Kernel.Log.Write("Cleaning Autotools make files for", solution.Name); + + string slnFile = Helper.MakeFilePath(solution.FullPath, "Makefile", "am"); + Helper.DeleteIfExists(slnFile); + + slnFile = Helper.MakeFilePath(solution.FullPath, "Makefile", "in"); + Helper.DeleteIfExists(slnFile); + + slnFile = Helper.MakeFilePath(solution.FullPath, "configure", "ac"); + Helper.DeleteIfExists(slnFile); + + slnFile = Helper.MakeFilePath(solution.FullPath, "configure"); + Helper.DeleteIfExists(slnFile); + + slnFile = Helper.MakeFilePath(solution.FullPath, "Makefile"); + Helper.DeleteIfExists(slnFile); + + foreach (ProjectNode project in solution.Projects) + { + CleanProject(project); + } + + m_Kernel.Log.Write(""); + } + + #endregion + + #region ITarget Members + + /// + /// Writes the specified kern. + /// + /// The kern. + public void Write(Kernel kern) + { + if (kern == null) + { + throw new ArgumentNullException("kern"); + } + m_Kernel = kern; + m_Kernel.Log.Write("Parsing system pkg-config files"); + RunInitialization(); + + const string streamName = "autotools.xml"; + string fqStreamName = String.Format("Prebuild.data.{0}", + streamName + ); + + // Retrieve stream for the autotools template XML + Stream autotoolsStream = Assembly.GetExecutingAssembly() + .GetManifestResourceStream(fqStreamName); + + if(autotoolsStream == null) { + + /* + * try without the default namespace prepended, in + * case prebuild.exe assembly was compiled with + * something other than Visual Studio .NET + */ + + autotoolsStream = Assembly.GetExecutingAssembly() + .GetManifestResourceStream(streamName); + if(autotoolsStream == null){ + string errStr = + String.Format("Could not find embedded resource file:\n" + + "'{0}' or '{1}'", + streamName, fqStreamName + ); + + m_Kernel.Log.Write(errStr); + + throw new System.Reflection.TargetException(errStr); + } + } + + // Create an XML URL Resolver with default credentials + xr = new System.Xml.XmlUrlResolver(); + xr.Credentials = CredentialCache.DefaultCredentials; + + // Create a default evidence - no need to limit access + e = new System.Security.Policy.Evidence(); + + // Load the autotools XML + autotoolsDoc = new XmlDocument(); + autotoolsDoc.Load(autotoolsStream); + + /* rootDir is the filesystem location where the Autotools + * build tree will be created - for now we'll make it + * $PWD/autotools + */ + + string pwd = Directory.GetCurrentDirectory(); + //string pwd = System.Environment.GetEnvironmentVariable("PWD"); + //if (pwd.Length != 0) + //{ + string rootDir = Path.Combine(pwd, "autotools"); + //} + //else + //{ + // pwd = Assembly.GetExecutingAssembly() + //} + chkMkDir(rootDir); + + foreach (SolutionNode solution in kern.Solutions) + { + m_Kernel.Log.Write(String.Format("Writing solution: {0}", + solution.Name)); + WriteCombine(solution); + } + m_Kernel = null; + } + + /// + /// Cleans the specified kern. + /// + /// The kern. + public virtual void Clean(Kernel kern) + { + if (kern == null) + { + throw new ArgumentNullException("kern"); + } + m_Kernel = kern; + foreach (SolutionNode sol in kern.Solutions) + { + CleanSolution(sol); + } + m_Kernel = null; + } + + /// + /// Gets the name. + /// + /// The name. + public string Name + { + get + { + return "autotools"; + } + } + + #endregion + } +} diff --git a/Prebuild/src/Core/Targets/VS2010Target.cs b/Prebuild/src/Core/Targets/VS2010Target.cs index ea9f736..b16120c 100644 --- a/Prebuild/src/Core/Targets/VS2010Target.cs +++ b/Prebuild/src/Core/Targets/VS2010Target.cs @@ -1,138 +1,138 @@ -using System; -using System.IO; -using System.Text; - -using Prebuild.Core.Attributes; -using Prebuild.Core.Interfaces; -using Prebuild.Core.Nodes; -using Prebuild.Core.Utilities; -using System.CodeDom.Compiler; - -namespace Prebuild.Core.Targets -{ - - /// - /// - /// - [Target("vs2010")] - public class VS2010Target : VSGenericTarget - { - #region Fields - - string solutionVersion = "11.00"; - string productVersion = "9.0.30729"; - string schemaVersion = "2.0"; - string versionName = "Visual Studio 2010"; - string name = "vs2010"; - VSVersion version = VSVersion.VS10; - - #endregion - - #region Properties - - /// - /// Gets or sets the solution version. - /// - /// The solution version. - public override string SolutionVersion - { - get - { - return solutionVersion; - } - } - - /// - /// Gets or sets the product version. - /// - /// The product version. - public override string ProductVersion - { - get - { - return productVersion; - } - } - - /// - /// Gets or sets the schema version. - /// - /// The schema version. - public override string SchemaVersion - { - get - { - return schemaVersion; - } - } - - /// - /// Gets or sets the name of the version. - /// - /// The name of the version. - public override string VersionName - { - get - { - return versionName; - } - } - - /// - /// Gets or sets the version. - /// - /// The version. - public override VSVersion Version - { - get - { - return version; - } - } - - /// - /// Gets the name. - /// - /// The name. - public override string Name - { - get - { - return name; - } - } - - protected override string GetToolsVersionXml(FrameworkVersion frameworkVersion) - { - switch (frameworkVersion) - { - case FrameworkVersion.v4_0: - case FrameworkVersion.v3_5: - return "ToolsVersion=\"4.0\""; - case FrameworkVersion.v3_0: - return "ToolsVersion=\"3.0\""; - default: - return "ToolsVersion=\"2.0\""; - } - } - - public override string SolutionTag - { - get { return "# Visual Studio 2010"; } - } - - #endregion - - #region Constructors - - /// - /// Initializes a new instance of the class. - /// - public VS2010Target() - : base() - { - } - - #endregion - } -} +using System; +using System.IO; +using System.Text; + +using Prebuild.Core.Attributes; +using Prebuild.Core.Interfaces; +using Prebuild.Core.Nodes; +using Prebuild.Core.Utilities; +using System.CodeDom.Compiler; + +namespace Prebuild.Core.Targets +{ + + /// + /// + /// + [Target("vs2010")] + public class VS2010Target : VSGenericTarget + { + #region Fields + + string solutionVersion = "11.00"; + string productVersion = "9.0.30729"; + string schemaVersion = "2.0"; + string versionName = "Visual Studio 2010"; + string name = "vs2010"; + VSVersion version = VSVersion.VS10; + + #endregion + + #region Properties + + /// + /// Gets or sets the solution version. + /// + /// The solution version. + public override string SolutionVersion + { + get + { + return solutionVersion; + } + } + + /// + /// Gets or sets the product version. + /// + /// The product version. + public override string ProductVersion + { + get + { + return productVersion; + } + } + + /// + /// Gets or sets the schema version. + /// + /// The schema version. + public override string SchemaVersion + { + get + { + return schemaVersion; + } + } + + /// + /// Gets or sets the name of the version. + /// + /// The name of the version. + public override string VersionName + { + get + { + return versionName; + } + } + + /// + /// Gets or sets the version. + /// + /// The version. + public override VSVersion Version + { + get + { + return version; + } + } + + /// + /// Gets the name. + /// + /// The name. + public override string Name + { + get + { + return name; + } + } + + protected override string GetToolsVersionXml(FrameworkVersion frameworkVersion) + { + switch (frameworkVersion) + { + case FrameworkVersion.v4_0: + case FrameworkVersion.v3_5: + return "ToolsVersion=\"4.0\""; + case FrameworkVersion.v3_0: + return "ToolsVersion=\"3.0\""; + default: + return "ToolsVersion=\"2.0\""; + } + } + + public override string SolutionTag + { + get { return "# Visual Studio 2010"; } + } + + #endregion + + #region Constructors + + /// + /// Initializes a new instance of the class. + /// + public VS2010Target() + : base() + { + } + + #endregion + } +} diff --git a/Prebuild/src/Core/Targets/VSGenericTarget.cs b/Prebuild/src/Core/Targets/VSGenericTarget.cs index 6969dd7..cd3f5bb 100644 --- a/Prebuild/src/Core/Targets/VSGenericTarget.cs +++ b/Prebuild/src/Core/Targets/VSGenericTarget.cs @@ -1,922 +1,922 @@ -#region BSD License -/* -Copyright (c) 2008 Matthew Holmes (matthew@wildfiregames.com), John Anderson (sontek@gmail.com) - -Redistribution and use in source and binary forms, with or without modification, are permitted -provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, this list of conditions - and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, this list of conditions - and the following disclaimer in the documentation and/or other materials provided with the - distribution. - * The name of the author may not be used to endorse or promote products derived from this software - without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, -BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY -OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING -IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -#endregion - -using System; -using System.Collections.Generic; -using System.IO; -using Prebuild.Core.Interfaces; -using Prebuild.Core.Nodes; -using Prebuild.Core.Utilities; -using System.CodeDom.Compiler; - -namespace Prebuild.Core.Targets -{ - - /// - /// - /// - public abstract class VSGenericTarget : ITarget - { - #region Fields - - readonly Dictionary tools = new Dictionary(); - Kernel kernel; - #endregion - - #region Properties - /// - /// Gets or sets the solution version. - /// - /// The solution version. - public abstract string SolutionVersion { get; } - /// - /// Gets or sets the product version. - /// - /// The product version. - public abstract string ProductVersion { get; } - /// - /// Gets or sets the schema version. - /// - /// The schema version. - public abstract string SchemaVersion { get; } - /// - /// Gets or sets the name of the version. - /// - /// The name of the version. - public abstract string VersionName { get; } - /// - /// Gets or sets the version. - /// - /// The version. - public abstract VSVersion Version { get; } - /// - /// Gets the name. - /// - /// The name. - public abstract string Name { get; } - - protected abstract string GetToolsVersionXml(FrameworkVersion version); - public abstract string SolutionTag { get; } - - #endregion - - #region Constructors - - /// - /// Initializes a new instance of the class. - /// - protected VSGenericTarget() - { - tools["C#"] = new ToolInfo("C#", "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}", "csproj", "CSHARP", "$(MSBuildBinPath)\\Microsoft.CSHARP.Targets"); - tools["Database"] = new ToolInfo("Database", "{4F174C21-8C12-11D0-8340-0000F80270F8}", "dbp", "UNKNOWN"); - tools["Boo"] = new ToolInfo("Boo", "{45CEA7DC-C2ED-48A6-ACE0-E16144C02365}", "booproj", "Boo", "$(BooBinPath)\\Boo.Microsoft.Build.targets"); - tools["VisualBasic"] = new ToolInfo("VisualBasic", "{F184B08F-C81C-45F6-A57F-5ABD9991F28F}", "vbproj", "VisualBasic", "$(MSBuildBinPath)\\Microsoft.VisualBasic.Targets"); - tools["Folder"] = new ToolInfo("Folder", "{2150E333-8FDC-42A3-9474-1A3956D46DE8}", null, null); - } - - #endregion - - #region Private Methods - - private string MakeRefPath(ProjectNode project) - { - string ret = ""; - foreach (ReferencePathNode node in project.ReferencePaths) - { - try - { - string fullPath = Helper.ResolvePath(node.Path); - if (ret.Length < 1) - { - ret = fullPath; - } - else - { - ret += ";" + fullPath; - } - } - catch (ArgumentException) - { - kernel.Log.Write(LogType.Warning, "Could not resolve reference path: {0}", node.Path); - } - } - - return ret; - } - - private static ProjectNode FindProjectInSolution(string name, SolutionNode solution) - { - SolutionNode node = solution; - - while (node.Parent is SolutionNode) - node = node.Parent as SolutionNode; - - return FindProjectInSolutionRecursively(name, node); - } - - private static ProjectNode FindProjectInSolutionRecursively(string name, SolutionNode solution) - { - if (solution.ProjectsTable.ContainsKey(name)) - return solution.ProjectsTable[name]; - - foreach (SolutionNode child in solution.Solutions) - { - ProjectNode node = FindProjectInSolutionRecursively(name, child); - if (node != null) - return node; - } - - return null; - } - - private void WriteProject(SolutionNode solution, ProjectNode project) - { - if (!tools.ContainsKey(project.Language)) - { - throw new UnknownLanguageException("Unknown .NET language: " + project.Language); - } - - ToolInfo toolInfo = tools[project.Language]; - string projectFile = Helper.MakeFilePath(project.FullPath, project.Name, toolInfo.FileExtension); - StreamWriter ps = new StreamWriter(projectFile); - - kernel.CurrentWorkingDirectory.Push(); - Helper.SetCurrentDir(Path.GetDirectoryName(projectFile)); - - #region Project File - using (ps) - { - ps.WriteLine("", GetToolsVersionXml(project.FrameworkVersion)); - ps.WriteLine(" "); - ps.WriteLine(" Local"); - ps.WriteLine(" {0}", ProductVersion); - ps.WriteLine(" {0}", SchemaVersion); - ps.WriteLine(" {{{0}}}", project.Guid.ToString().ToUpper()); - - // Visual Studio has a hard coded guid for the project type - if (project.Type == ProjectType.Web) - ps.WriteLine(" {349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}"); - ps.WriteLine(" Debug"); - ps.WriteLine(" {0}", project.AppIcon); - ps.WriteLine(" "); - ps.WriteLine(" "); - ps.WriteLine(" {0}", project.AssemblyName); - foreach (ConfigurationNode conf in project.Configurations) - { - if (conf.Options.KeyFile != "") - { - ps.WriteLine(" {0}", conf.Options.KeyFile); - ps.WriteLine(" true"); - break; - } - } - ps.WriteLine(" JScript"); - ps.WriteLine(" Grid"); - ps.WriteLine(" IE50"); - ps.WriteLine(" false"); - ps.WriteLine(" {0}", project.FrameworkVersion.ToString().Replace("_", ".")); - - ps.WriteLine(" {0}", project.Type == ProjectType.Web ? ProjectType.Library.ToString() : project.Type.ToString()); - ps.WriteLine(" {0}", project.DesignerFolder); - ps.WriteLine(" {0}", project.RootNamespace); - ps.WriteLine(" {0}", project.StartupObject); - if (string.IsNullOrEmpty(project.DebugStartParameters)) - { - ps.WriteLine(" {0}", project.DebugStartParameters); - } - ps.WriteLine(" "); - ps.WriteLine(" "); - - ps.WriteLine(" "); - - foreach (ConfigurationNode conf in project.Configurations) - { - ps.Write(" ", conf.Name, conf.Platform); - ps.WriteLine(" {0}", conf.Options["AllowUnsafe"]); - ps.WriteLine(" {0}", conf.Options["BaseAddress"]); - ps.WriteLine(" {0}", conf.Options["CheckUnderflowOverflow"]); - ps.WriteLine(" "); - ps.WriteLine(" "); - ps.WriteLine(" {0}", conf.Options["CompilerDefines"]); - ps.WriteLine(" {0}", Helper.NormalizePath(conf.Options["XmlDocFile"].ToString())); - ps.WriteLine(" {0}", conf.Options["DebugInformation"]); - ps.WriteLine(" {0}", conf.Options["FileAlignment"]); - ps.WriteLine(" {0}", conf.Options["OptimizeCode"]); - if (project.Type != ProjectType.Web) - ps.WriteLine(" {0}", - Helper.EndPath(Helper.NormalizePath(conf.Options["OutputPath"].ToString()))); - else - ps.WriteLine(" {0}", - Helper.EndPath(Helper.NormalizePath("bin\\"))); - - ps.WriteLine(" {0}", conf.Options["RegisterComInterop"]); - ps.WriteLine(" {0}", conf.Options["RemoveIntegerChecks"]); - ps.WriteLine(" {0}", conf.Options["WarningsAsErrors"]); - ps.WriteLine(" {0}", conf.Options["WarningLevel"]); - ps.WriteLine(" {0}", conf.Options["NoStdLib"]); - ps.WriteLine(" {0}", conf.Options["SuppressWarnings"]); - ps.WriteLine(" {0}", conf.Platform); - ps.WriteLine(" "); - } - - //ps.WriteLine(" "); - - Dictionary projectReferences = new Dictionary(); - List otherReferences = new List(); - - foreach (ReferenceNode refr in project.References) - { - ProjectNode projectNode = FindProjectInSolution(refr.Name, solution); - - if (projectNode == null) - otherReferences.Add(refr); - else - projectReferences.Add(refr, projectNode); - } - // Assembly References - ps.WriteLine(" "); - - foreach (ReferenceNode refr in otherReferences) - { - ps.Write(" "); - ps.Write(" "); - ps.Write(refr.Name); - ps.WriteLine(""); - - if(!String.IsNullOrEmpty(refr.Path)) - { - // Use absolute path to assembly (for determining assembly type) - string absolutePath = Path.Combine(project.FullPath, refr.Path); - if(File.Exists(Helper.MakeFilePath(absolutePath, refr.Name, "exe"))) { - // Assembly is an executable (exe) - ps.WriteLine(" {0}", Helper.MakeFilePath(refr.Path, refr.Name, "exe")); - } else if(File.Exists(Helper.MakeFilePath(absolutePath, refr.Name, "dll"))) { - // Assembly is an library (dll) - ps.WriteLine(" {0}", Helper.MakeFilePath(refr.Path, refr.Name, "dll")); - } else { - string referencePath = Helper.MakeFilePath(refr.Path, refr.Name, "dll"); - kernel.Log.Write(LogType.Warning, "Reference \"{0}\": The specified file doesn't exist.", referencePath); - ps.WriteLine(" {0}", Helper.MakeFilePath(refr.Path, refr.Name, "dll")); - } - } - - ps.WriteLine(" {0}", refr.LocalCopy); - ps.WriteLine(" "); - } - ps.WriteLine(" "); - - //Project References - ps.WriteLine(" "); - foreach (KeyValuePair pair in projectReferences) - { - ToolInfo tool = tools[pair.Value.Language]; - if (tools == null) - throw new UnknownLanguageException(); - - string path = - Helper.MakePathRelativeTo(project.FullPath, - Helper.MakeFilePath(pair.Value.FullPath, pair.Value.Name, tool.FileExtension)); - ps.WriteLine(" ", path); - - // TODO: Allow reference to visual basic projects - ps.WriteLine(" {0}", pair.Value.Name); - ps.WriteLine(" {0}", pair.Value.Guid.ToString("B").ToUpper()); - ps.WriteLine(" {0}", tool.Guid.ToUpper()); - - //This is the Copy Local flag in VS - ps.WriteLine(" {0}", pair.Key.LocalCopy); - - ps.WriteLine(" "); - } - ps.WriteLine(" "); - - // ps.WriteLine(" "); - ps.WriteLine(" "); - - // ps.WriteLine(" "); - List list = new List(); - - foreach (string path in project.Files) - { - string lower = path.ToLower(); - if (lower.EndsWith(".resx")) - { - string codebehind = String.Format("{0}.Designer{1}", path.Substring(0, path.LastIndexOf('.')), toolInfo.LanguageExtension); - if (!list.Contains(codebehind)) - list.Add(codebehind); - } - - } - - foreach (string filePath in project.Files) - { - // if (file == "Properties\\Bind.Designer.cs") - // { - // Console.WriteLine("Wait a minute!"); - // Console.WriteLine(project.Files.GetSubType(file).ToString()); - // } - SubType subType = project.Files.GetSubType(filePath); - - // Visual Studio chokes on file names if forward slash is used as a path separator - // instead of backslash. So we must make sure that all file paths written to the - // project file use \ as a path separator. - string file = filePath.Replace(@"/", @"\"); - - if (subType != SubType.Code && subType != SubType.Settings && subType != SubType.Designer - && subType != SubType.CodeBehind) - { - ps.WriteLine(" ", file.Substring(0, file.LastIndexOf('.')) + ".resx"); - ps.WriteLine(" {0}", Path.GetFileName(file)); - ps.WriteLine(" Designer"); - ps.WriteLine(" "); - // - } - - if (subType == SubType.Designer) - { - ps.WriteLine(" ", file); - - string autogen_name = file.Substring(0, file.LastIndexOf('.')) + ".Designer.cs"; - string dependent_name = filePath.Substring(0, file.LastIndexOf('.')) + ".cs"; - - // Check for a parent .cs file with the same name as this designer file - if (File.Exists(Helper.NormalizePath(dependent_name))) - { - ps.WriteLine(" {0}", Path.GetFileName(dependent_name)); - } - else - { - ps.WriteLine(" ResXFileCodeGenerator"); - ps.WriteLine(" {0}", Path.GetFileName(autogen_name)); - ps.WriteLine(" " + subType + ""); - } - - ps.WriteLine(" "); - if (File.Exists(Helper.NormalizePath(autogen_name))) - { - ps.WriteLine(" ", autogen_name); - //ps.WriteLine(" True"); - - // If a parent .cs file exists, link this autogen file to it. Otherwise link - // to the designer file - if (File.Exists(dependent_name)) - { - ps.WriteLine(" {0}", Path.GetFileName(dependent_name)); - } - else - { - ps.WriteLine(" True"); - ps.WriteLine(" {0}", Path.GetFileName(filePath)); - } - - ps.WriteLine(" "); - } - list.Add(autogen_name); - } - if (subType == SubType.Settings) - { - ps.Write(" <{0} ", project.Files.GetBuildAction(filePath)); - ps.WriteLine("Include=\"{0}\">", file); - string fileName = Path.GetFileName(filePath); - if (project.Files.GetBuildAction(filePath) == BuildAction.None) - { - ps.WriteLine(" SettingsSingleFileGenerator"); - ps.WriteLine(" {0}", fileName.Substring(0, fileName.LastIndexOf('.')) + ".Designer.cs"); - } - else - { - ps.WriteLine(" Code"); - ps.WriteLine(" True"); - ps.WriteLine(" True"); - string fileNameShort = fileName.Substring(0, fileName.LastIndexOf('.')); - string fileNameShorter = fileNameShort.Substring(0, fileNameShort.LastIndexOf('.')); - ps.WriteLine(" {0}", Path.GetFileName(fileNameShorter + ".settings")); - } - ps.WriteLine(" ", project.Files.GetBuildAction(filePath)); - } - else if (subType != SubType.Designer) - { - string path = Helper.NormalizePath(file); - string path_lower = path.ToLower(); - - if (!list.Contains(filePath)) - { - ps.Write(" <{0} ", project.Files.GetBuildAction(filePath)); - - int startPos = 0; - if (project.Files.GetPreservePath(filePath)) - { - while ((@"./\").IndexOf(file.Substring(startPos, 1)) != -1) - startPos++; - - } - else - { - startPos = file.LastIndexOf(Path.GetFileName(path)); - } - - // be sure to write out the path with backslashes so VS recognizes - // the file properly. - ps.WriteLine("Include=\"{0}\">", file); - - int last_period_index = file.LastIndexOf('.'); - string short_file_name = file.Substring(0, last_period_index); - string extension = Path.GetExtension(path); - // make this upper case, so that when File.Exists tests for the - // existence of a designer file on a case-sensitive platform, - // it is correctly identified. - string designer_format = string.Format(".Designer{0}", extension); - - if (path_lower.EndsWith(designer_format.ToLowerInvariant())) - { - int designer_index = path.IndexOf(designer_format); - string file_name = path.Substring(0, designer_index); - - // There are two corrections to the next lines: - // 1. Fix the connection between a designer file and a form - // or usercontrol that don't have an associated resx file. - // 2. Connect settings files to associated designer files. - if (File.Exists(file_name + extension)) - ps.WriteLine(" {0}", Path.GetFileName(file_name + extension)); - else if (File.Exists(file_name + ".resx")) - ps.WriteLine(" {0}", Path.GetFileName(file_name + ".resx")); - else if (File.Exists(file_name + ".settings")) - { - ps.WriteLine(" {0}", Path.GetFileName(file_name + ".settings")); - ps.WriteLine(" True"); - ps.WriteLine(" True"); - } - } - else if (subType == SubType.CodeBehind) - { - ps.WriteLine(" {0}", Path.GetFileName(short_file_name)); - } - if (project.Files.GetIsLink(filePath)) - { - string alias = project.Files.GetLinkPath(filePath); - alias += file.Substring(startPos); - alias = Helper.NormalizePath(alias); - ps.WriteLine(" {0}", alias); - } - else if (project.Files.GetBuildAction(filePath) != BuildAction.None) - { - if (project.Files.GetBuildAction(filePath) != BuildAction.EmbeddedResource) - { - ps.WriteLine(" {0}", subType); - } - } - - if (project.Files.GetCopyToOutput(filePath) != CopyToOutput.Never) - { - ps.WriteLine(" {0}", project.Files.GetCopyToOutput(filePath)); - } - - ps.WriteLine(" ", project.Files.GetBuildAction(filePath)); - } - } - } - - ps.WriteLine(" "); - ps.WriteLine(" "); - ps.WriteLine(" "); - ps.WriteLine(" "); - ps.WriteLine(" "); - ps.WriteLine(" "); - ps.WriteLine(" "); - ps.WriteLine(" "); - ps.WriteLine(""); - } - #endregion - - #region User File - - ps = new StreamWriter(projectFile + ".user"); - using (ps) - { - // Get the first configuration from the project. - ConfigurationNode firstConfiguration = null; - - if (project.Configurations.Count > 0) - { - firstConfiguration = project.Configurations[0]; - } - - ps.WriteLine(""); - //ps.WriteLine( "" ); - //ps.WriteLine(" <{0}>", toolInfo.XMLTag); - //ps.WriteLine(" "); - ps.WriteLine(" "); - //ps.WriteLine(" ", MakeRefPath(project)); - - if (firstConfiguration != null) - { - ps.WriteLine(" {0}", firstConfiguration.Name); - ps.WriteLine(" {0}", firstConfiguration.Platform); - } - - ps.WriteLine(" {0}", MakeRefPath(project)); - ps.WriteLine(" {0}", ProductVersion); - ps.WriteLine(" ProjectFiles"); - ps.WriteLine(" 0"); - ps.WriteLine(" "); - foreach (ConfigurationNode conf in project.Configurations) - { - ps.Write(" "); - } - ps.WriteLine(""); - } - #endregion - - kernel.CurrentWorkingDirectory.Pop(); - } - - private void WriteSolution(SolutionNode solution, bool writeSolutionToDisk) - { - kernel.Log.Write("Creating {0} solution and project files", VersionName); - - foreach (SolutionNode child in solution.Solutions) - { - kernel.Log.Write("...Creating folder: {0}", child.Name); - WriteSolution(child, false); - } - - foreach (ProjectNode project in solution.Projects) - { - kernel.Log.Write("...Creating project: {0}", project.Name); - WriteProject(solution, project); - } - - foreach (DatabaseProjectNode project in solution.DatabaseProjects) - { - kernel.Log.Write("...Creating database project: {0}", project.Name); - WriteDatabaseProject(solution, project); - } - - if (writeSolutionToDisk) // only write main solution - { - kernel.Log.Write(""); - string solutionFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "sln"); - - using (StreamWriter ss = new StreamWriter(solutionFile)) - { - kernel.CurrentWorkingDirectory.Push(); - Helper.SetCurrentDir(Path.GetDirectoryName(solutionFile)); - - ss.WriteLine("Microsoft Visual Studio Solution File, Format Version {0}", SolutionVersion); - ss.WriteLine(SolutionTag); - - WriteProjectDeclarations(ss, solution, solution); - - ss.WriteLine("Global"); - - ss.WriteLine("\tGlobalSection(SolutionConfigurationPlatforms) = preSolution"); - foreach (ConfigurationNode conf in solution.Configurations) - { - ss.WriteLine("\t\t{0} = {0}", conf.NameAndPlatform); - } - ss.WriteLine("\tEndGlobalSection"); - - ss.WriteLine("\tGlobalSection(ProjectConfigurationPlatforms) = postSolution"); - WriteConfigurationLines(solution.Configurations, solution, ss); - ss.WriteLine("\tEndGlobalSection"); - - if (solution.Solutions.Count > 0) - { - ss.WriteLine("\tGlobalSection(NestedProjects) = preSolution"); - foreach (SolutionNode embeddedSolution in solution.Solutions) - { - WriteNestedProjectMap(ss, embeddedSolution); - } - ss.WriteLine("\tEndGlobalSection"); - } - - ss.WriteLine("EndGlobal"); - } - - kernel.CurrentWorkingDirectory.Pop(); - } - } - - private void WriteProjectDeclarations(TextWriter writer, SolutionNode actualSolution, SolutionNode embeddedSolution) - { - foreach (SolutionNode childSolution in embeddedSolution.Solutions) - { - WriteEmbeddedSolution(writer, childSolution); - WriteProjectDeclarations(writer, actualSolution, childSolution); - } - - foreach (ProjectNode project in embeddedSolution.Projects) - { - WriteProject(actualSolution, writer, project); - } - - foreach (DatabaseProjectNode dbProject in embeddedSolution.DatabaseProjects) - { - WriteProject(actualSolution, writer, dbProject); - } - - if (actualSolution.Guid == embeddedSolution.Guid) - { - WriteSolutionFiles(actualSolution, writer); - } - } - - private static void WriteNestedProjectMap(TextWriter writer, SolutionNode embeddedSolution) - { - foreach (ProjectNode project in embeddedSolution.Projects) - { - WriteNestedProject(writer, embeddedSolution, project.Guid); - } - - foreach (DatabaseProjectNode dbProject in embeddedSolution.DatabaseProjects) - { - WriteNestedProject(writer, embeddedSolution, dbProject.Guid); - } - - foreach (SolutionNode child in embeddedSolution.Solutions) - { - WriteNestedProject(writer, embeddedSolution, child.Guid); - WriteNestedProjectMap(writer, child); - } - } - - private static void WriteNestedProject(TextWriter writer, SolutionNode solution, Guid projectGuid) - { - WriteNestedFolder(writer, solution.Guid, projectGuid); - } - - private static void WriteNestedFolder(TextWriter writer, Guid parentGuid, Guid childGuid) - { - writer.WriteLine("\t\t{0} = {1}", - childGuid.ToString("B").ToUpper(), - parentGuid.ToString("B").ToUpper()); - } - - private static void WriteConfigurationLines(IEnumerable configurations, SolutionNode solution, TextWriter ss) - { - foreach (ProjectNode project in solution.Projects) - { - foreach (ConfigurationNode conf in configurations) - { - ss.WriteLine("\t\t{0}.{1}.ActiveCfg = {1}", - project.Guid.ToString("B").ToUpper(), - conf.NameAndPlatform); - - ss.WriteLine("\t\t{0}.{1}.Build.0 = {1}", - project.Guid.ToString("B").ToUpper(), - conf.NameAndPlatform); - } - } - - foreach (SolutionNode child in solution.Solutions) - { - WriteConfigurationLines(configurations, child, ss); - } - } - - private void WriteSolutionFiles(SolutionNode solution, TextWriter ss) - { - if(solution.Files != null && solution.Files.Count > 0) - WriteProject(ss, "Folder", solution.Guid, "Solution Files", "Solution Files", solution.Files); - } - - private void WriteEmbeddedSolution(TextWriter writer, SolutionNode embeddedSolution) - { - WriteProject(writer, "Folder", embeddedSolution.Guid, embeddedSolution.Name, embeddedSolution.Name, embeddedSolution.Files); - } - - private void WriteProject(SolutionNode solution, TextWriter ss, ProjectNode project) - { - WriteProject(ss, solution, project.Language, project.Guid, project.Name, project.FullPath); - } - - private void WriteProject(SolutionNode solution, TextWriter ss, DatabaseProjectNode dbProject) - { - if (solution.Files != null && solution.Files.Count > 0) - WriteProject(ss, solution, "Database", dbProject.Guid, dbProject.Name, dbProject.FullPath); - } - - const string ProjectDeclarationBeginFormat = "Project(\"{0}\") = \"{1}\", \"{2}\", \"{3}\""; - const string ProjectDeclarationEndFormat = "EndProject"; - - private void WriteProject(TextWriter ss, SolutionNode solution, string language, Guid guid, string name, string projectFullPath) - { - if (!tools.ContainsKey(language)) - throw new UnknownLanguageException("Unknown .NET language: " + language); - - ToolInfo toolInfo = tools[language]; - - string path = Helper.MakePathRelativeTo(solution.FullPath, projectFullPath); - - path = Helper.MakeFilePath(path, name, toolInfo.FileExtension); - - WriteProject(ss, language, guid, name, path); - } - - private void WriteProject(TextWriter writer, string language, Guid projectGuid, string name, string location) - { - WriteProject(writer, language, projectGuid, name, location, null); - } - - private void WriteProject(TextWriter writer, string language, Guid projectGuid, string name, string location, FilesNode files) - { - if (!tools.ContainsKey(language)) - throw new UnknownLanguageException("Unknown .NET language: " + language); - - ToolInfo toolInfo = tools[language]; - - writer.WriteLine(ProjectDeclarationBeginFormat, - toolInfo.Guid, - name, - location, - projectGuid.ToString("B").ToUpper()); - - if (files != null) - { - writer.WriteLine("\tProjectSection(SolutionItems) = preProject"); - - foreach (string file in files) - writer.WriteLine("\t\t{0} = {0}", file); - - writer.WriteLine("\tEndProjectSection"); - } - - writer.WriteLine(ProjectDeclarationEndFormat); - } - - private void WriteDatabaseProject(SolutionNode solution, DatabaseProjectNode project) - { - string projectFile = Helper.MakeFilePath(project.FullPath, project.Name, "dbp"); - IndentedTextWriter ps = new IndentedTextWriter(new StreamWriter(projectFile), " "); - - kernel.CurrentWorkingDirectory.Push(); - - Helper.SetCurrentDir(Path.GetDirectoryName(projectFile)); - - using (ps) - { - ps.WriteLine("# Microsoft Developer Studio Project File - Database Project"); - ps.WriteLine("Begin DataProject = \"{0}\"", project.Name); - ps.Indent++; - ps.WriteLine("MSDTVersion = \"80\""); - // TODO: Use the project.Files property - if (ContainsSqlFiles(Path.GetDirectoryName(projectFile))) - WriteDatabaseFoldersAndFiles(ps, Path.GetDirectoryName(projectFile)); - - ps.WriteLine("Begin DBRefFolder = \"Database References\""); - ps.Indent++; - foreach (DatabaseReferenceNode reference in project.References) - { - ps.WriteLine("Begin DBRefNode = \"{0}\"", reference.Name); - ps.Indent++; - ps.WriteLine("ConnectStr = \"{0}\"", reference.ConnectionString); - ps.WriteLine("Provider = \"{0}\"", reference.ProviderId.ToString("B").ToUpper()); - //ps.WriteLine("Colorizer = 5"); - ps.Indent--; - ps.WriteLine("End"); - } - ps.Indent--; - ps.WriteLine("End"); - ps.Indent--; - ps.WriteLine("End"); - - ps.Flush(); - } - - kernel.CurrentWorkingDirectory.Pop(); - } - - private static bool ContainsSqlFiles(string folder) - { - if(Directory.GetFiles(folder, "*.sql").Length > 0) - return true; // if the folder contains 1 .sql file, that's good enough - - foreach (string child in Directory.GetDirectories(folder)) - { - if (ContainsSqlFiles(child)) - return true; // if 1 child folder contains a .sql file, still good enough - } - - return false; - } - - private static void WriteDatabaseFoldersAndFiles(IndentedTextWriter writer, string folder) - { - foreach (string child in Directory.GetDirectories(folder)) - { - if (ContainsSqlFiles(child)) - { - writer.WriteLine("Begin Folder = \"{0}\"", Path.GetFileName(child)); - writer.Indent++; - WriteDatabaseFoldersAndFiles(writer, child); - writer.Indent--; - writer.WriteLine("End"); - } - } - foreach (string file in Directory.GetFiles(folder, "*.sql")) - { - writer.WriteLine("Script = \"{0}\"", Path.GetFileName(file)); - } - } - - private void CleanProject(ProjectNode project) - { - kernel.Log.Write("...Cleaning project: {0}", project.Name); - - ToolInfo toolInfo = tools[project.Language]; - string projectFile = Helper.MakeFilePath(project.FullPath, project.Name, toolInfo.FileExtension); - string userFile = projectFile + ".user"; - - Helper.DeleteIfExists(projectFile); - Helper.DeleteIfExists(userFile); - } - - private void CleanSolution(SolutionNode solution) - { - kernel.Log.Write("Cleaning {0} solution and project files", VersionName, solution.Name); - - string slnFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "sln"); - string suoFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "suo"); - - Helper.DeleteIfExists(slnFile); - Helper.DeleteIfExists(suoFile); - - foreach (ProjectNode project in solution.Projects) - { - CleanProject(project); - } - - kernel.Log.Write(""); - } - - #endregion - - #region ITarget Members - - /// - /// Writes the specified kern. - /// - /// The kern. - public virtual void Write(Kernel kern) - { - if (kern == null) - { - throw new ArgumentNullException("kern"); - } - kernel = kern; - foreach (SolutionNode sol in kernel.Solutions) - { - WriteSolution(sol, true); - } - kernel = null; - } - - /// - /// Cleans the specified kern. - /// - /// The kern. - public virtual void Clean(Kernel kern) - { - if (kern == null) - { - throw new ArgumentNullException("kern"); - } - kernel = kern; - foreach (SolutionNode sol in kernel.Solutions) - { - CleanSolution(sol); - } - kernel = null; - } - - #endregion - } -} +#region BSD License +/* +Copyright (c) 2008 Matthew Holmes (matthew@wildfiregames.com), John Anderson (sontek@gmail.com) + +Redistribution and use in source and binary forms, with or without modification, are permitted +provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this list of conditions + and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, this list of conditions + and the following disclaimer in the documentation and/or other materials provided with the + distribution. + * The name of the author may not be used to endorse or promote products derived from this software + without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, +BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING +IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +#endregion + +using System; +using System.Collections.Generic; +using System.IO; +using Prebuild.Core.Interfaces; +using Prebuild.Core.Nodes; +using Prebuild.Core.Utilities; +using System.CodeDom.Compiler; + +namespace Prebuild.Core.Targets +{ + + /// + /// + /// + public abstract class VSGenericTarget : ITarget + { + #region Fields + + readonly Dictionary tools = new Dictionary(); + Kernel kernel; + #endregion + + #region Properties + /// + /// Gets or sets the solution version. + /// + /// The solution version. + public abstract string SolutionVersion { get; } + /// + /// Gets or sets the product version. + /// + /// The product version. + public abstract string ProductVersion { get; } + /// + /// Gets or sets the schema version. + /// + /// The schema version. + public abstract string SchemaVersion { get; } + /// + /// Gets or sets the name of the version. + /// + /// The name of the version. + public abstract string VersionName { get; } + /// + /// Gets or sets the version. + /// + /// The version. + public abstract VSVersion Version { get; } + /// + /// Gets the name. + /// + /// The name. + public abstract string Name { get; } + + protected abstract string GetToolsVersionXml(FrameworkVersion version); + public abstract string SolutionTag { get; } + + #endregion + + #region Constructors + + /// + /// Initializes a new instance of the class. + /// + protected VSGenericTarget() + { + tools["C#"] = new ToolInfo("C#", "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}", "csproj", "CSHARP", "$(MSBuildBinPath)\\Microsoft.CSHARP.Targets"); + tools["Database"] = new ToolInfo("Database", "{4F174C21-8C12-11D0-8340-0000F80270F8}", "dbp", "UNKNOWN"); + tools["Boo"] = new ToolInfo("Boo", "{45CEA7DC-C2ED-48A6-ACE0-E16144C02365}", "booproj", "Boo", "$(BooBinPath)\\Boo.Microsoft.Build.targets"); + tools["VisualBasic"] = new ToolInfo("VisualBasic", "{F184B08F-C81C-45F6-A57F-5ABD9991F28F}", "vbproj", "VisualBasic", "$(MSBuildBinPath)\\Microsoft.VisualBasic.Targets"); + tools["Folder"] = new ToolInfo("Folder", "{2150E333-8FDC-42A3-9474-1A3956D46DE8}", null, null); + } + + #endregion + + #region Private Methods + + private string MakeRefPath(ProjectNode project) + { + string ret = ""; + foreach (ReferencePathNode node in project.ReferencePaths) + { + try + { + string fullPath = Helper.ResolvePath(node.Path); + if (ret.Length < 1) + { + ret = fullPath; + } + else + { + ret += ";" + fullPath; + } + } + catch (ArgumentException) + { + kernel.Log.Write(LogType.Warning, "Could not resolve reference path: {0}", node.Path); + } + } + + return ret; + } + + private static ProjectNode FindProjectInSolution(string name, SolutionNode solution) + { + SolutionNode node = solution; + + while (node.Parent is SolutionNode) + node = node.Parent as SolutionNode; + + return FindProjectInSolutionRecursively(name, node); + } + + private static ProjectNode FindProjectInSolutionRecursively(string name, SolutionNode solution) + { + if (solution.ProjectsTable.ContainsKey(name)) + return solution.ProjectsTable[name]; + + foreach (SolutionNode child in solution.Solutions) + { + ProjectNode node = FindProjectInSolutionRecursively(name, child); + if (node != null) + return node; + } + + return null; + } + + private void WriteProject(SolutionNode solution, ProjectNode project) + { + if (!tools.ContainsKey(project.Language)) + { + throw new UnknownLanguageException("Unknown .NET language: " + project.Language); + } + + ToolInfo toolInfo = tools[project.Language]; + string projectFile = Helper.MakeFilePath(project.FullPath, project.Name, toolInfo.FileExtension); + StreamWriter ps = new StreamWriter(projectFile); + + kernel.CurrentWorkingDirectory.Push(); + Helper.SetCurrentDir(Path.GetDirectoryName(projectFile)); + + #region Project File + using (ps) + { + ps.WriteLine("", GetToolsVersionXml(project.FrameworkVersion)); + ps.WriteLine(" "); + ps.WriteLine(" Local"); + ps.WriteLine(" {0}", ProductVersion); + ps.WriteLine(" {0}", SchemaVersion); + ps.WriteLine(" {{{0}}}", project.Guid.ToString().ToUpper()); + + // Visual Studio has a hard coded guid for the project type + if (project.Type == ProjectType.Web) + ps.WriteLine(" {349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}"); + ps.WriteLine(" Debug"); + ps.WriteLine(" {0}", project.AppIcon); + ps.WriteLine(" "); + ps.WriteLine(" "); + ps.WriteLine(" {0}", project.AssemblyName); + foreach (ConfigurationNode conf in project.Configurations) + { + if (conf.Options.KeyFile != "") + { + ps.WriteLine(" {0}", conf.Options.KeyFile); + ps.WriteLine(" true"); + break; + } + } + ps.WriteLine(" JScript"); + ps.WriteLine(" Grid"); + ps.WriteLine(" IE50"); + ps.WriteLine(" false"); + ps.WriteLine(" {0}", project.FrameworkVersion.ToString().Replace("_", ".")); + + ps.WriteLine(" {0}", project.Type == ProjectType.Web ? ProjectType.Library.ToString() : project.Type.ToString()); + ps.WriteLine(" {0}", project.DesignerFolder); + ps.WriteLine(" {0}", project.RootNamespace); + ps.WriteLine(" {0}", project.StartupObject); + if (string.IsNullOrEmpty(project.DebugStartParameters)) + { + ps.WriteLine(" {0}", project.DebugStartParameters); + } + ps.WriteLine(" "); + ps.WriteLine(" "); + + ps.WriteLine(" "); + + foreach (ConfigurationNode conf in project.Configurations) + { + ps.Write(" ", conf.Name, conf.Platform); + ps.WriteLine(" {0}", conf.Options["AllowUnsafe"]); + ps.WriteLine(" {0}", conf.Options["BaseAddress"]); + ps.WriteLine(" {0}", conf.Options["CheckUnderflowOverflow"]); + ps.WriteLine(" "); + ps.WriteLine(" "); + ps.WriteLine(" {0}", conf.Options["CompilerDefines"]); + ps.WriteLine(" {0}", Helper.NormalizePath(conf.Options["XmlDocFile"].ToString())); + ps.WriteLine(" {0}", conf.Options["DebugInformation"]); + ps.WriteLine(" {0}", conf.Options["FileAlignment"]); + ps.WriteLine(" {0}", conf.Options["OptimizeCode"]); + if (project.Type != ProjectType.Web) + ps.WriteLine(" {0}", + Helper.EndPath(Helper.NormalizePath(conf.Options["OutputPath"].ToString()))); + else + ps.WriteLine(" {0}", + Helper.EndPath(Helper.NormalizePath("bin\\"))); + + ps.WriteLine(" {0}", conf.Options["RegisterComInterop"]); + ps.WriteLine(" {0}", conf.Options["RemoveIntegerChecks"]); + ps.WriteLine(" {0}", conf.Options["WarningsAsErrors"]); + ps.WriteLine(" {0}", conf.Options["WarningLevel"]); + ps.WriteLine(" {0}", conf.Options["NoStdLib"]); + ps.WriteLine(" {0}", conf.Options["SuppressWarnings"]); + ps.WriteLine(" {0}", conf.Platform); + ps.WriteLine(" "); + } + + //ps.WriteLine(" "); + + Dictionary projectReferences = new Dictionary(); + List otherReferences = new List(); + + foreach (ReferenceNode refr in project.References) + { + ProjectNode projectNode = FindProjectInSolution(refr.Name, solution); + + if (projectNode == null) + otherReferences.Add(refr); + else + projectReferences.Add(refr, projectNode); + } + // Assembly References + ps.WriteLine(" "); + + foreach (ReferenceNode refr in otherReferences) + { + ps.Write(" "); + ps.Write(" "); + ps.Write(refr.Name); + ps.WriteLine(""); + + if(!String.IsNullOrEmpty(refr.Path)) + { + // Use absolute path to assembly (for determining assembly type) + string absolutePath = Path.Combine(project.FullPath, refr.Path); + if(File.Exists(Helper.MakeFilePath(absolutePath, refr.Name, "exe"))) { + // Assembly is an executable (exe) + ps.WriteLine(" {0}", Helper.MakeFilePath(refr.Path, refr.Name, "exe")); + } else if(File.Exists(Helper.MakeFilePath(absolutePath, refr.Name, "dll"))) { + // Assembly is an library (dll) + ps.WriteLine(" {0}", Helper.MakeFilePath(refr.Path, refr.Name, "dll")); + } else { + string referencePath = Helper.MakeFilePath(refr.Path, refr.Name, "dll"); + kernel.Log.Write(LogType.Warning, "Reference \"{0}\": The specified file doesn't exist.", referencePath); + ps.WriteLine(" {0}", Helper.MakeFilePath(refr.Path, refr.Name, "dll")); + } + } + + ps.WriteLine(" {0}", refr.LocalCopy); + ps.WriteLine(" "); + } + ps.WriteLine(" "); + + //Project References + ps.WriteLine(" "); + foreach (KeyValuePair pair in projectReferences) + { + ToolInfo tool = tools[pair.Value.Language]; + if (tools == null) + throw new UnknownLanguageException(); + + string path = + Helper.MakePathRelativeTo(project.FullPath, + Helper.MakeFilePath(pair.Value.FullPath, pair.Value.Name, tool.FileExtension)); + ps.WriteLine(" ", path); + + // TODO: Allow reference to visual basic projects + ps.WriteLine(" {0}", pair.Value.Name); + ps.WriteLine(" {0}", pair.Value.Guid.ToString("B").ToUpper()); + ps.WriteLine(" {0}", tool.Guid.ToUpper()); + + //This is the Copy Local flag in VS + ps.WriteLine(" {0}", pair.Key.LocalCopy); + + ps.WriteLine(" "); + } + ps.WriteLine(" "); + + // ps.WriteLine(" "); + ps.WriteLine(" "); + + // ps.WriteLine(" "); + List list = new List(); + + foreach (string path in project.Files) + { + string lower = path.ToLower(); + if (lower.EndsWith(".resx")) + { + string codebehind = String.Format("{0}.Designer{1}", path.Substring(0, path.LastIndexOf('.')), toolInfo.LanguageExtension); + if (!list.Contains(codebehind)) + list.Add(codebehind); + } + + } + + foreach (string filePath in project.Files) + { + // if (file == "Properties\\Bind.Designer.cs") + // { + // Console.WriteLine("Wait a minute!"); + // Console.WriteLine(project.Files.GetSubType(file).ToString()); + // } + SubType subType = project.Files.GetSubType(filePath); + + // Visual Studio chokes on file names if forward slash is used as a path separator + // instead of backslash. So we must make sure that all file paths written to the + // project file use \ as a path separator. + string file = filePath.Replace(@"/", @"\"); + + if (subType != SubType.Code && subType != SubType.Settings && subType != SubType.Designer + && subType != SubType.CodeBehind) + { + ps.WriteLine(" ", file.Substring(0, file.LastIndexOf('.')) + ".resx"); + ps.WriteLine(" {0}", Path.GetFileName(file)); + ps.WriteLine(" Designer"); + ps.WriteLine(" "); + // + } + + if (subType == SubType.Designer) + { + ps.WriteLine(" ", file); + + string autogen_name = file.Substring(0, file.LastIndexOf('.')) + ".Designer.cs"; + string dependent_name = filePath.Substring(0, file.LastIndexOf('.')) + ".cs"; + + // Check for a parent .cs file with the same name as this designer file + if (File.Exists(Helper.NormalizePath(dependent_name))) + { + ps.WriteLine(" {0}", Path.GetFileName(dependent_name)); + } + else + { + ps.WriteLine(" ResXFileCodeGenerator"); + ps.WriteLine(" {0}", Path.GetFileName(autogen_name)); + ps.WriteLine(" " + subType + ""); + } + + ps.WriteLine(" "); + if (File.Exists(Helper.NormalizePath(autogen_name))) + { + ps.WriteLine(" ", autogen_name); + //ps.WriteLine(" True"); + + // If a parent .cs file exists, link this autogen file to it. Otherwise link + // to the designer file + if (File.Exists(dependent_name)) + { + ps.WriteLine(" {0}", Path.GetFileName(dependent_name)); + } + else + { + ps.WriteLine(" True"); + ps.WriteLine(" {0}", Path.GetFileName(filePath)); + } + + ps.WriteLine(" "); + } + list.Add(autogen_name); + } + if (subType == SubType.Settings) + { + ps.Write(" <{0} ", project.Files.GetBuildAction(filePath)); + ps.WriteLine("Include=\"{0}\">", file); + string fileName = Path.GetFileName(filePath); + if (project.Files.GetBuildAction(filePath) == BuildAction.None) + { + ps.WriteLine(" SettingsSingleFileGenerator"); + ps.WriteLine(" {0}", fileName.Substring(0, fileName.LastIndexOf('.')) + ".Designer.cs"); + } + else + { + ps.WriteLine(" Code"); + ps.WriteLine(" True"); + ps.WriteLine(" True"); + string fileNameShort = fileName.Substring(0, fileName.LastIndexOf('.')); + string fileNameShorter = fileNameShort.Substring(0, fileNameShort.LastIndexOf('.')); + ps.WriteLine(" {0}", Path.GetFileName(fileNameShorter + ".settings")); + } + ps.WriteLine(" ", project.Files.GetBuildAction(filePath)); + } + else if (subType != SubType.Designer) + { + string path = Helper.NormalizePath(file); + string path_lower = path.ToLower(); + + if (!list.Contains(filePath)) + { + ps.Write(" <{0} ", project.Files.GetBuildAction(filePath)); + + int startPos = 0; + if (project.Files.GetPreservePath(filePath)) + { + while ((@"./\").IndexOf(file.Substring(startPos, 1)) != -1) + startPos++; + + } + else + { + startPos = file.LastIndexOf(Path.GetFileName(path)); + } + + // be sure to write out the path with backslashes so VS recognizes + // the file properly. + ps.WriteLine("Include=\"{0}\">", file); + + int last_period_index = file.LastIndexOf('.'); + string short_file_name = file.Substring(0, last_period_index); + string extension = Path.GetExtension(path); + // make this upper case, so that when File.Exists tests for the + // existence of a designer file on a case-sensitive platform, + // it is correctly identified. + string designer_format = string.Format(".Designer{0}", extension); + + if (path_lower.EndsWith(designer_format.ToLowerInvariant())) + { + int designer_index = path.IndexOf(designer_format); + string file_name = path.Substring(0, designer_index); + + // There are two corrections to the next lines: + // 1. Fix the connection between a designer file and a form + // or usercontrol that don't have an associated resx file. + // 2. Connect settings files to associated designer files. + if (File.Exists(file_name + extension)) + ps.WriteLine(" {0}", Path.GetFileName(file_name + extension)); + else if (File.Exists(file_name + ".resx")) + ps.WriteLine(" {0}", Path.GetFileName(file_name + ".resx")); + else if (File.Exists(file_name + ".settings")) + { + ps.WriteLine(" {0}", Path.GetFileName(file_name + ".settings")); + ps.WriteLine(" True"); + ps.WriteLine(" True"); + } + } + else if (subType == SubType.CodeBehind) + { + ps.WriteLine(" {0}", Path.GetFileName(short_file_name)); + } + if (project.Files.GetIsLink(filePath)) + { + string alias = project.Files.GetLinkPath(filePath); + alias += file.Substring(startPos); + alias = Helper.NormalizePath(alias); + ps.WriteLine(" {0}", alias); + } + else if (project.Files.GetBuildAction(filePath) != BuildAction.None) + { + if (project.Files.GetBuildAction(filePath) != BuildAction.EmbeddedResource) + { + ps.WriteLine(" {0}", subType); + } + } + + if (project.Files.GetCopyToOutput(filePath) != CopyToOutput.Never) + { + ps.WriteLine(" {0}", project.Files.GetCopyToOutput(filePath)); + } + + ps.WriteLine(" ", project.Files.GetBuildAction(filePath)); + } + } + } + + ps.WriteLine(" "); + ps.WriteLine(" "); + ps.WriteLine(" "); + ps.WriteLine(" "); + ps.WriteLine(" "); + ps.WriteLine(" "); + ps.WriteLine(" "); + ps.WriteLine(" "); + ps.WriteLine(""); + } + #endregion + + #region User File + + ps = new StreamWriter(projectFile + ".user"); + using (ps) + { + // Get the first configuration from the project. + ConfigurationNode firstConfiguration = null; + + if (project.Configurations.Count > 0) + { + firstConfiguration = project.Configurations[0]; + } + + ps.WriteLine(""); + //ps.WriteLine( "" ); + //ps.WriteLine(" <{0}>", toolInfo.XMLTag); + //ps.WriteLine(" "); + ps.WriteLine(" "); + //ps.WriteLine(" ", MakeRefPath(project)); + + if (firstConfiguration != null) + { + ps.WriteLine(" {0}", firstConfiguration.Name); + ps.WriteLine(" {0}", firstConfiguration.Platform); + } + + ps.WriteLine(" {0}", MakeRefPath(project)); + ps.WriteLine(" {0}", ProductVersion); + ps.WriteLine(" ProjectFiles"); + ps.WriteLine(" 0"); + ps.WriteLine(" "); + foreach (ConfigurationNode conf in project.Configurations) + { + ps.Write(" "); + } + ps.WriteLine(""); + } + #endregion + + kernel.CurrentWorkingDirectory.Pop(); + } + + private void WriteSolution(SolutionNode solution, bool writeSolutionToDisk) + { + kernel.Log.Write("Creating {0} solution and project files", VersionName); + + foreach (SolutionNode child in solution.Solutions) + { + kernel.Log.Write("...Creating folder: {0}", child.Name); + WriteSolution(child, false); + } + + foreach (ProjectNode project in solution.Projects) + { + kernel.Log.Write("...Creating project: {0}", project.Name); + WriteProject(solution, project); + } + + foreach (DatabaseProjectNode project in solution.DatabaseProjects) + { + kernel.Log.Write("...Creating database project: {0}", project.Name); + WriteDatabaseProject(solution, project); + } + + if (writeSolutionToDisk) // only write main solution + { + kernel.Log.Write(""); + string solutionFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "sln"); + + using (StreamWriter ss = new StreamWriter(solutionFile)) + { + kernel.CurrentWorkingDirectory.Push(); + Helper.SetCurrentDir(Path.GetDirectoryName(solutionFile)); + + ss.WriteLine("Microsoft Visual Studio Solution File, Format Version {0}", SolutionVersion); + ss.WriteLine(SolutionTag); + + WriteProjectDeclarations(ss, solution, solution); + + ss.WriteLine("Global"); + + ss.WriteLine("\tGlobalSection(SolutionConfigurationPlatforms) = preSolution"); + foreach (ConfigurationNode conf in solution.Configurations) + { + ss.WriteLine("\t\t{0} = {0}", conf.NameAndPlatform); + } + ss.WriteLine("\tEndGlobalSection"); + + ss.WriteLine("\tGlobalSection(ProjectConfigurationPlatforms) = postSolution"); + WriteConfigurationLines(solution.Configurations, solution, ss); + ss.WriteLine("\tEndGlobalSection"); + + if (solution.Solutions.Count > 0) + { + ss.WriteLine("\tGlobalSection(NestedProjects) = preSolution"); + foreach (SolutionNode embeddedSolution in solution.Solutions) + { + WriteNestedProjectMap(ss, embeddedSolution); + } + ss.WriteLine("\tEndGlobalSection"); + } + + ss.WriteLine("EndGlobal"); + } + + kernel.CurrentWorkingDirectory.Pop(); + } + } + + private void WriteProjectDeclarations(TextWriter writer, SolutionNode actualSolution, SolutionNode embeddedSolution) + { + foreach (SolutionNode childSolution in embeddedSolution.Solutions) + { + WriteEmbeddedSolution(writer, childSolution); + WriteProjectDeclarations(writer, actualSolution, childSolution); + } + + foreach (ProjectNode project in embeddedSolution.Projects) + { + WriteProject(actualSolution, writer, project); + } + + foreach (DatabaseProjectNode dbProject in embeddedSolution.DatabaseProjects) + { + WriteProject(actualSolution, writer, dbProject); + } + + if (actualSolution.Guid == embeddedSolution.Guid) + { + WriteSolutionFiles(actualSolution, writer); + } + } + + private static void WriteNestedProjectMap(TextWriter writer, SolutionNode embeddedSolution) + { + foreach (ProjectNode project in embeddedSolution.Projects) + { + WriteNestedProject(writer, embeddedSolution, project.Guid); + } + + foreach (DatabaseProjectNode dbProject in embeddedSolution.DatabaseProjects) + { + WriteNestedProject(writer, embeddedSolution, dbProject.Guid); + } + + foreach (SolutionNode child in embeddedSolution.Solutions) + { + WriteNestedProject(writer, embeddedSolution, child.Guid); + WriteNestedProjectMap(writer, child); + } + } + + private static void WriteNestedProject(TextWriter writer, SolutionNode solution, Guid projectGuid) + { + WriteNestedFolder(writer, solution.Guid, projectGuid); + } + + private static void WriteNestedFolder(TextWriter writer, Guid parentGuid, Guid childGuid) + { + writer.WriteLine("\t\t{0} = {1}", + childGuid.ToString("B").ToUpper(), + parentGuid.ToString("B").ToUpper()); + } + + private static void WriteConfigurationLines(IEnumerable configurations, SolutionNode solution, TextWriter ss) + { + foreach (ProjectNode project in solution.Projects) + { + foreach (ConfigurationNode conf in configurations) + { + ss.WriteLine("\t\t{0}.{1}.ActiveCfg = {1}", + project.Guid.ToString("B").ToUpper(), + conf.NameAndPlatform); + + ss.WriteLine("\t\t{0}.{1}.Build.0 = {1}", + project.Guid.ToString("B").ToUpper(), + conf.NameAndPlatform); + } + } + + foreach (SolutionNode child in solution.Solutions) + { + WriteConfigurationLines(configurations, child, ss); + } + } + + private void WriteSolutionFiles(SolutionNode solution, TextWriter ss) + { + if(solution.Files != null && solution.Files.Count > 0) + WriteProject(ss, "Folder", solution.Guid, "Solution Files", "Solution Files", solution.Files); + } + + private void WriteEmbeddedSolution(TextWriter writer, SolutionNode embeddedSolution) + { + WriteProject(writer, "Folder", embeddedSolution.Guid, embeddedSolution.Name, embeddedSolution.Name, embeddedSolution.Files); + } + + private void WriteProject(SolutionNode solution, TextWriter ss, ProjectNode project) + { + WriteProject(ss, solution, project.Language, project.Guid, project.Name, project.FullPath); + } + + private void WriteProject(SolutionNode solution, TextWriter ss, DatabaseProjectNode dbProject) + { + if (solution.Files != null && solution.Files.Count > 0) + WriteProject(ss, solution, "Database", dbProject.Guid, dbProject.Name, dbProject.FullPath); + } + + const string ProjectDeclarationBeginFormat = "Project(\"{0}\") = \"{1}\", \"{2}\", \"{3}\""; + const string ProjectDeclarationEndFormat = "EndProject"; + + private void WriteProject(TextWriter ss, SolutionNode solution, string language, Guid guid, string name, string projectFullPath) + { + if (!tools.ContainsKey(language)) + throw new UnknownLanguageException("Unknown .NET language: " + language); + + ToolInfo toolInfo = tools[language]; + + string path = Helper.MakePathRelativeTo(solution.FullPath, projectFullPath); + + path = Helper.MakeFilePath(path, name, toolInfo.FileExtension); + + WriteProject(ss, language, guid, name, path); + } + + private void WriteProject(TextWriter writer, string language, Guid projectGuid, string name, string location) + { + WriteProject(writer, language, projectGuid, name, location, null); + } + + private void WriteProject(TextWriter writer, string language, Guid projectGuid, string name, string location, FilesNode files) + { + if (!tools.ContainsKey(language)) + throw new UnknownLanguageException("Unknown .NET language: " + language); + + ToolInfo toolInfo = tools[language]; + + writer.WriteLine(ProjectDeclarationBeginFormat, + toolInfo.Guid, + name, + location, + projectGuid.ToString("B").ToUpper()); + + if (files != null) + { + writer.WriteLine("\tProjectSection(SolutionItems) = preProject"); + + foreach (string file in files) + writer.WriteLine("\t\t{0} = {0}", file); + + writer.WriteLine("\tEndProjectSection"); + } + + writer.WriteLine(ProjectDeclarationEndFormat); + } + + private void WriteDatabaseProject(SolutionNode solution, DatabaseProjectNode project) + { + string projectFile = Helper.MakeFilePath(project.FullPath, project.Name, "dbp"); + IndentedTextWriter ps = new IndentedTextWriter(new StreamWriter(projectFile), " "); + + kernel.CurrentWorkingDirectory.Push(); + + Helper.SetCurrentDir(Path.GetDirectoryName(projectFile)); + + using (ps) + { + ps.WriteLine("# Microsoft Developer Studio Project File - Database Project"); + ps.WriteLine("Begin DataProject = \"{0}\"", project.Name); + ps.Indent++; + ps.WriteLine("MSDTVersion = \"80\""); + // TODO: Use the project.Files property + if (ContainsSqlFiles(Path.GetDirectoryName(projectFile))) + WriteDatabaseFoldersAndFiles(ps, Path.GetDirectoryName(projectFile)); + + ps.WriteLine("Begin DBRefFolder = \"Database References\""); + ps.Indent++; + foreach (DatabaseReferenceNode reference in project.References) + { + ps.WriteLine("Begin DBRefNode = \"{0}\"", reference.Name); + ps.Indent++; + ps.WriteLine("ConnectStr = \"{0}\"", reference.ConnectionString); + ps.WriteLine("Provider = \"{0}\"", reference.ProviderId.ToString("B").ToUpper()); + //ps.WriteLine("Colorizer = 5"); + ps.Indent--; + ps.WriteLine("End"); + } + ps.Indent--; + ps.WriteLine("End"); + ps.Indent--; + ps.WriteLine("End"); + + ps.Flush(); + } + + kernel.CurrentWorkingDirectory.Pop(); + } + + private static bool ContainsSqlFiles(string folder) + { + if(Directory.GetFiles(folder, "*.sql").Length > 0) + return true; // if the folder contains 1 .sql file, that's good enough + + foreach (string child in Directory.GetDirectories(folder)) + { + if (ContainsSqlFiles(child)) + return true; // if 1 child folder contains a .sql file, still good enough + } + + return false; + } + + private static void WriteDatabaseFoldersAndFiles(IndentedTextWriter writer, string folder) + { + foreach (string child in Directory.GetDirectories(folder)) + { + if (ContainsSqlFiles(child)) + { + writer.WriteLine("Begin Folder = \"{0}\"", Path.GetFileName(child)); + writer.Indent++; + WriteDatabaseFoldersAndFiles(writer, child); + writer.Indent--; + writer.WriteLine("End"); + } + } + foreach (string file in Directory.GetFiles(folder, "*.sql")) + { + writer.WriteLine("Script = \"{0}\"", Path.GetFileName(file)); + } + } + + private void CleanProject(ProjectNode project) + { + kernel.Log.Write("...Cleaning project: {0}", project.Name); + + ToolInfo toolInfo = tools[project.Language]; + string projectFile = Helper.MakeFilePath(project.FullPath, project.Name, toolInfo.FileExtension); + string userFile = projectFile + ".user"; + + Helper.DeleteIfExists(projectFile); + Helper.DeleteIfExists(userFile); + } + + private void CleanSolution(SolutionNode solution) + { + kernel.Log.Write("Cleaning {0} solution and project files", VersionName, solution.Name); + + string slnFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "sln"); + string suoFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "suo"); + + Helper.DeleteIfExists(slnFile); + Helper.DeleteIfExists(suoFile); + + foreach (ProjectNode project in solution.Projects) + { + CleanProject(project); + } + + kernel.Log.Write(""); + } + + #endregion + + #region ITarget Members + + /// + /// Writes the specified kern. + /// + /// The kern. + public virtual void Write(Kernel kern) + { + if (kern == null) + { + throw new ArgumentNullException("kern"); + } + kernel = kern; + foreach (SolutionNode sol in kernel.Solutions) + { + WriteSolution(sol, true); + } + kernel = null; + } + + /// + /// Cleans the specified kern. + /// + /// The kern. + public virtual void Clean(Kernel kern) + { + if (kern == null) + { + throw new ArgumentNullException("kern"); + } + kernel = kern; + foreach (SolutionNode sol in kernel.Solutions) + { + CleanSolution(sol); + } + kernel = null; + } + + #endregion + } +} -- cgit v1.1 From 47a5e2633c4a5cb5e0e89e4b8ffc42bf5996c4e6 Mon Sep 17 00:00:00 2001 From: Melanie Date: Sat, 11 Sep 2010 20:22:10 +0100 Subject: Prevent child agents from being blacklisted in the kill record. --- OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index cdf8cb1..a6315a9 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs @@ -1519,10 +1519,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP kill.Header.Reliable = true; kill.Header.Zerocoded = true; - lock (m_entityUpdates.SyncRoot) + if (m_scene.GetScenePresence(localID) == null) { - m_killRecord.Add(localID); - OutPacket(kill, ThrottleOutPacketType.State); + lock (m_entityUpdates.SyncRoot) + { + m_killRecord.Add(localID); + OutPacket(kill, ThrottleOutPacketType.State); + } } } -- cgit v1.1 From a9acc6730d4dc33b81da567778cac32517b2068c Mon Sep 17 00:00:00 2001 From: John Hurliman Date: Sat, 11 Sep 2010 18:26:59 -0700 Subject: Removing .svn directories under Prebuild/ from source control --- Prebuild/doc/.svn/all-wcprops | 35 - Prebuild/doc/.svn/dir-prop-base | 5 - Prebuild/doc/.svn/entries | 198 ---- .../.svn/prop-base/prebuild-example1.xml.svn-base | 9 - .../.svn/prop-base/prebuild-example2.xml.svn-base | 9 - .../.svn/prop-base/prebuild-example3.xml.svn-base | 9 - .../.svn/prop-base/prebuild-example4.xml.svn-base | 9 - .../.svn/text-base/prebuild-example1.xml.svn-base | 300 ------ .../.svn/text-base/prebuild-example2.xml.svn-base | 72 -- .../.svn/text-base/prebuild-example3.xml.svn-base | 113 --- .../.svn/text-base/prebuild-example4.xml.svn-base | 715 ------------- .../.svn/text-base/prebuild-example5.xml.svn-base | 187 ---- Prebuild/scripts/.svn/all-wcprops | 125 --- Prebuild/scripts/.svn/dir-prop-base | 6 - Prebuild/scripts/.svn/entries | 708 ------------- Prebuild/scripts/.svn/prop-base/Clean.bat.svn-base | 13 - Prebuild/scripts/.svn/prop-base/Clean.sh.svn-base | 9 - Prebuild/scripts/.svn/prop-base/Help.bat.svn-base | 13 - .../scripts/.svn/prop-base/MonoDevelop.sh.svn-base | 13 - .../scripts/.svn/prop-base/Prebuild.nsi.svn-base | 9 - .../.svn/prop-base/SharpDevelop.bat.svn-base | 13 - .../.svn/prop-base/SharpDevelop2.bat.svn-base | 5 - .../scripts/.svn/prop-base/VS2002.bat.svn-base | 13 - .../scripts/.svn/prop-base/VS2003.bat.svn-base | 13 - .../scripts/.svn/prop-base/VS2005.bat.svn-base | 13 - .../scripts/.svn/prop-base/VS2008.bat.svn-base | 5 - .../scripts/.svn/prop-base/autotools.bat.svn-base | 5 - .../scripts/.svn/prop-base/autotools.sh.svn-base | 5 - .../scripts/.svn/prop-base/makefile.bat.svn-base | 9 - .../scripts/.svn/prop-base/makefile.sh.svn-base | 9 - Prebuild/scripts/.svn/prop-base/nant.bat.svn-base | 13 - Prebuild/scripts/.svn/prop-base/nant.sh.svn-base | 13 - Prebuild/scripts/.svn/prop-base/xcode.bat.svn-base | 9 - Prebuild/scripts/.svn/prop-base/xcode.sh.svn-base | 9 - Prebuild/scripts/.svn/text-base/Clean.bat.svn-base | 2 - Prebuild/scripts/.svn/text-base/Clean.sh.svn-base | 4 - Prebuild/scripts/.svn/text-base/Help.bat.svn-base | 2 - .../scripts/.svn/text-base/MonoDevelop.sh.svn-base | 2 - .../scripts/.svn/text-base/Prebuild.nsi.svn-base | 231 ----- .../.svn/text-base/SharpDevelop.bat.svn-base | 4 - .../.svn/text-base/SharpDevelop2.bat.svn-base | 4 - .../scripts/.svn/text-base/VS2002.bat.svn-base | 4 - .../scripts/.svn/text-base/VS2003.bat.svn-base | 4 - .../scripts/.svn/text-base/VS2005.bat.svn-base | 4 - .../scripts/.svn/text-base/VS2008.bat.svn-base | 4 - .../scripts/.svn/text-base/VS2010.bat.svn-base | 4 - .../scripts/.svn/text-base/autotools.bat.svn-base | 4 - .../scripts/.svn/text-base/autotools.sh.svn-base | 5 - .../scripts/.svn/text-base/makefile.bat.svn-base | 4 - .../scripts/.svn/text-base/makefile.sh.svn-base | 10 - Prebuild/scripts/.svn/text-base/nant.bat.svn-base | 4 - Prebuild/scripts/.svn/text-base/nant.sh.svn-base | 2 - Prebuild/scripts/.svn/text-base/xcode.bat.svn-base | 4 - Prebuild/scripts/.svn/text-base/xcode.sh.svn-base | 2 - Prebuild/src/.svn/all-wcprops | 23 - Prebuild/src/.svn/dir-prop-base | 16 - Prebuild/src/.svn/entries | 139 --- Prebuild/src/.svn/prop-base/App.ico.svn-base | 5 - Prebuild/src/.svn/prop-base/Prebuild.cs.svn-base | 9 - Prebuild/src/.svn/prop-base/Prebuild.snk.svn-base | 5 - Prebuild/src/.svn/text-base/App.ico.svn-base | Bin 4286 -> 0 bytes Prebuild/src/.svn/text-base/Prebuild.cs.svn-base | 165 --- Prebuild/src/.svn/text-base/Prebuild.snk.svn-base | Bin 596 -> 0 bytes Prebuild/src/Core/.svn/all-wcprops | 29 - Prebuild/src/Core/.svn/dir-prop-base | 5 - Prebuild/src/Core/.svn/entries | 182 ---- .../Core/.svn/prop-base/FatalException.cs.svn-base | 9 - .../src/Core/.svn/prop-base/Kernel.cs.svn-base | 9 - .../prop-base/UnknownLanguageException.cs.svn-base | 9 - .../.svn/prop-base/WarningException.cs.svn-base | 9 - .../Core/.svn/text-base/FatalException.cs.svn-base | 85 -- .../src/Core/.svn/text-base/Kernel.cs.svn-base | 832 --------------- .../text-base/UnknownLanguageException.cs.svn-base | 63 -- .../.svn/text-base/WarningException.cs.svn-base | 84 -- Prebuild/src/Core/Attributes/.svn/all-wcprops | 23 - Prebuild/src/Core/Attributes/.svn/dir-prop-base | 5 - Prebuild/src/Core/Attributes/.svn/entries | 130 --- .../.svn/prop-base/DataNodeAttribute.cs.svn-base | 9 - .../.svn/prop-base/OptionNodeAttribute.cs.svn-base | 9 - .../.svn/prop-base/TargetAttribute.cs.svn-base | 9 - .../.svn/text-base/DataNodeAttribute.cs.svn-base | 72 -- .../.svn/text-base/OptionNodeAttribute.cs.svn-base | 71 -- .../.svn/text-base/TargetAttribute.cs.svn-base | 71 -- Prebuild/src/Core/Interfaces/.svn/all-wcprops | 17 - Prebuild/src/Core/Interfaces/.svn/dir-prop-base | 5 - Prebuild/src/Core/Interfaces/.svn/entries | 96 -- .../.svn/prop-base/IDataNode.cs.svn-base | 9 - .../Interfaces/.svn/prop-base/ITarget.cs.svn-base | 9 - .../.svn/text-base/IDataNode.cs.svn-base | 47 - .../Interfaces/.svn/text-base/ITarget.cs.svn-base | 51 - Prebuild/src/Core/Nodes/.svn/all-wcprops | 119 --- Prebuild/src/Core/Nodes/.svn/dir-prop-base | 5 - Prebuild/src/Core/Nodes/.svn/entries | 674 ------------ .../.svn/prop-base/ConfigurationNode.cs.svn-base | 9 - .../Core/Nodes/.svn/prop-base/DataNode.cs.svn-base | 9 - .../Nodes/.svn/prop-base/ExcludeNode.cs.svn-base | 9 - .../Core/Nodes/.svn/prop-base/FileNode.cs.svn-base | 9 - .../Nodes/.svn/prop-base/FilesNode.cs.svn-base | 9 - .../Nodes/.svn/prop-base/MatchNode.cs.svn-base | 9 - .../Nodes/.svn/prop-base/OptionsNode.cs.svn-base | 9 - .../Nodes/.svn/prop-base/ProcessNode.cs.svn-base | 9 - .../Nodes/.svn/prop-base/ProjectNode.cs.svn-base | 9 - .../Nodes/.svn/prop-base/ReferenceNode.cs.svn-base | 9 - .../.svn/prop-base/ReferencePathNode.cs.svn-base | 9 - .../Nodes/.svn/prop-base/SolutionNode.cs.svn-base | 9 - .../Nodes/.svn/text-base/AuthorNode.cs.svn-base | 87 -- .../.svn/text-base/CleanFilesNode.cs.svn-base | 80 -- .../Nodes/.svn/text-base/CleanupNode.cs.svn-base | 85 -- .../.svn/text-base/ConfigurationNode.cs.svn-base | 225 ---- .../ConfigurationNodeCollection.cs.svn-base | 71 -- .../Core/Nodes/.svn/text-base/DataNode.cs.svn-base | 117 --- .../.svn/text-base/DatabaseProjectNode.cs.svn-base | 93 -- .../text-base/DatabaseReferenceNode.cs.svn-base | 63 -- .../.svn/text-base/DescriptionNode.cs.svn-base | 87 -- .../Nodes/.svn/text-base/ExcludeNode.cs.svn-base | 89 -- .../Core/Nodes/.svn/text-base/FileNode.cs.svn-base | 285 ------ .../Nodes/.svn/text-base/FilesNode.cs.svn-base | 204 ---- .../Nodes/.svn/text-base/MatchNode.cs.svn-base | 367 ------- .../Nodes/.svn/text-base/OptionsNode.cs.svn-base | 634 ------------ .../Nodes/.svn/text-base/ProcessNode.cs.svn-base | 108 -- .../Nodes/.svn/text-base/ProjectNode.cs.svn-base | 579 ----------- .../Nodes/.svn/text-base/ReferenceNode.cs.svn-base | 144 --- .../.svn/text-base/ReferencePathNode.cs.svn-base | 97 -- .../Nodes/.svn/text-base/SolutionNode.cs.svn-base | 382 ------- Prebuild/src/Core/Parse/.svn/all-wcprops | 17 - Prebuild/src/Core/Parse/.svn/dir-prop-base | 5 - Prebuild/src/Core/Parse/.svn/entries | 96 -- .../Parse/.svn/prop-base/IfContext.cs.svn-base | 9 - .../Parse/.svn/prop-base/Preprocessor.cs.svn-base | 9 - .../Parse/.svn/text-base/IfContext.cs.svn-base | 154 --- .../Parse/.svn/text-base/Preprocessor.cs.svn-base | 652 ------------ Prebuild/src/Core/Targets/.svn/all-wcprops | 101 -- Prebuild/src/Core/Targets/.svn/dir-prop-base | 5 - Prebuild/src/Core/Targets/.svn/entries | 572 ----------- .../Targets/.svn/prop-base/DebugTarget.cs.svn-base | 9 - .../.svn/prop-base/MakefileTarget.cs.svn-base | 9 - .../.svn/prop-base/MonoDevelopTarget.cs.svn-base | 9 - .../Targets/.svn/prop-base/NAntTarget.cs.svn-base | 9 - .../.svn/prop-base/SharpDevelopTarget.cs.svn-base | 9 - .../.svn/prop-base/VS2002Target.cs.svn-base | 9 - .../.svn/prop-base/VS2003Target.cs.svn-base | 9 - .../.svn/prop-base/VS2005Target.cs.svn-base | 9 - .../Targets/.svn/prop-base/XcodeTarget.cs.svn-base | 9 - .../.svn/text-base/AutotoolsTarget.cs.svn-base | 1070 -------------------- .../Targets/.svn/text-base/DebugTarget.cs.svn-base | 102 -- .../.svn/text-base/MakefileTarget.cs.svn-base | 469 --------- .../.svn/text-base/MonoDevelopTarget.cs.svn-base | 515 ---------- .../Targets/.svn/text-base/NAntTarget.cs.svn-base | 776 -------------- .../.svn/text-base/SharpDevelop2Target.cs.svn-base | 82 -- .../.svn/text-base/SharpDevelopTarget.cs.svn-base | 425 -------- .../Targets/.svn/text-base/ToolInfo.cs.svn-base | 197 ---- .../.svn/text-base/VS2002Target.cs.svn-base | 87 -- .../.svn/text-base/VS2003Target.cs.svn-base | 593 ----------- .../.svn/text-base/VS2005Target.cs.svn-base | 147 --- .../.svn/text-base/VS2008Target.cs.svn-base | 127 --- .../.svn/text-base/VS2010Target.cs.svn-base | 138 --- .../.svn/text-base/VSGenericTarget.cs.svn-base | 922 ----------------- .../Targets/.svn/text-base/VSVersion.cs.svn-base | 54 - .../Targets/.svn/text-base/XcodeTarget.cs.svn-base | 594 ----------- Prebuild/src/Core/Utilities/.svn/all-wcprops | 29 - Prebuild/src/Core/Utilities/.svn/dir-prop-base | 5 - Prebuild/src/Core/Utilities/.svn/entries | 164 --- .../prop-base/CommandLineCollection.cs.svn-base | 9 - .../.svn/prop-base/CurrentDirectory.cs.svn-base | 9 - .../Utilities/.svn/prop-base/Helper.cs.svn-base | 9 - .../Core/Utilities/.svn/prop-base/Log.cs.svn-base | 9 - .../text-base/CommandLineCollection.cs.svn-base | 152 --- .../.svn/text-base/CurrentDirectory.cs.svn-base | 68 -- .../Utilities/.svn/text-base/Helper.cs.svn-base | 575 ----------- .../Core/Utilities/.svn/text-base/Log.cs.svn-base | 276 ----- Prebuild/src/Properties/.svn/all-wcprops | 11 - Prebuild/src/Properties/.svn/entries | 62 -- .../.svn/prop-base/AssemblyInfo.cs.svn-base | 9 - .../.svn/text-base/AssemblyInfo.cs.svn-base | 113 --- Prebuild/src/data/.svn/all-wcprops | 71 -- Prebuild/src/data/.svn/dir-prop-base | 6 - Prebuild/src/data/.svn/entries | 402 -------- .../src/data/.svn/prop-base/dnpb-1.0.xsd.svn-base | 9 - .../src/data/.svn/prop-base/dnpb-1.1.xsd.svn-base | 9 - .../src/data/.svn/prop-base/dnpb-1.2.xsd.svn-base | 9 - .../src/data/.svn/prop-base/dnpb-1.3.xsd.svn-base | 9 - .../src/data/.svn/prop-base/dnpb-1.4.xsd.svn-base | 9 - .../src/data/.svn/prop-base/dnpb-1.5.xsd.svn-base | 9 - .../data/.svn/prop-base/prebuild-1.6.xsd.svn-base | 9 - .../src/data/.svn/text-base/autotools.xml.svn-base | 790 --------------- .../src/data/.svn/text-base/dnpb-1.0.xsd.svn-base | 183 ---- .../src/data/.svn/text-base/dnpb-1.1.xsd.svn-base | 184 ---- .../src/data/.svn/text-base/dnpb-1.2.xsd.svn-base | 198 ---- .../src/data/.svn/text-base/dnpb-1.3.xsd.svn-base | 206 ---- .../src/data/.svn/text-base/dnpb-1.4.xsd.svn-base | 212 ---- .../src/data/.svn/text-base/dnpb-1.5.xsd.svn-base | 215 ---- .../data/.svn/text-base/prebuild-1.6.xsd.svn-base | 231 ----- .../data/.svn/text-base/prebuild-1.7.xsd.svn-base | 350 ------- .../data/.svn/text-base/prebuild-1.8.xsd.svn-base | 331 ------ .../data/.svn/text-base/prebuild-1.9.xsd.svn-base | 336 ------ Prebuild/tests/.svn/all-wcprops | 59 -- Prebuild/tests/.svn/entries | 334 ------ Prebuild/tests/.svn/text-base/Makefile.svn-base | 24 - Prebuild/tests/.svn/text-base/README.txt.svn-base | 5 - .../.svn/text-base/include-001.expected.svn-base | 46 - .../.svn/text-base/include-001.include.svn-base | 33 - .../.svn/text-base/include-001.prebuild.svn-base | 22 - .../.svn/text-base/include-002-2.include.svn-base | 8 - .../.svn/text-base/include-002.expected.svn-base | 26 - .../.svn/text-base/include-002.include.svn-base | 14 - .../.svn/text-base/include-002.prebuild.svn-base | 7 - 206 files changed, 23864 deletions(-) delete mode 100644 Prebuild/doc/.svn/all-wcprops delete mode 100644 Prebuild/doc/.svn/dir-prop-base delete mode 100644 Prebuild/doc/.svn/entries delete mode 100644 Prebuild/doc/.svn/prop-base/prebuild-example1.xml.svn-base delete mode 100644 Prebuild/doc/.svn/prop-base/prebuild-example2.xml.svn-base delete mode 100644 Prebuild/doc/.svn/prop-base/prebuild-example3.xml.svn-base delete mode 100644 Prebuild/doc/.svn/prop-base/prebuild-example4.xml.svn-base delete mode 100644 Prebuild/doc/.svn/text-base/prebuild-example1.xml.svn-base delete mode 100644 Prebuild/doc/.svn/text-base/prebuild-example2.xml.svn-base delete mode 100644 Prebuild/doc/.svn/text-base/prebuild-example3.xml.svn-base delete mode 100644 Prebuild/doc/.svn/text-base/prebuild-example4.xml.svn-base delete mode 100644 Prebuild/doc/.svn/text-base/prebuild-example5.xml.svn-base delete mode 100644 Prebuild/scripts/.svn/all-wcprops delete mode 100644 Prebuild/scripts/.svn/dir-prop-base delete mode 100644 Prebuild/scripts/.svn/entries delete mode 100644 Prebuild/scripts/.svn/prop-base/Clean.bat.svn-base delete mode 100644 Prebuild/scripts/.svn/prop-base/Clean.sh.svn-base delete mode 100644 Prebuild/scripts/.svn/prop-base/Help.bat.svn-base delete mode 100644 Prebuild/scripts/.svn/prop-base/MonoDevelop.sh.svn-base delete mode 100644 Prebuild/scripts/.svn/prop-base/Prebuild.nsi.svn-base delete mode 100644 Prebuild/scripts/.svn/prop-base/SharpDevelop.bat.svn-base delete mode 100644 Prebuild/scripts/.svn/prop-base/SharpDevelop2.bat.svn-base delete mode 100644 Prebuild/scripts/.svn/prop-base/VS2002.bat.svn-base delete mode 100644 Prebuild/scripts/.svn/prop-base/VS2003.bat.svn-base delete mode 100644 Prebuild/scripts/.svn/prop-base/VS2005.bat.svn-base delete mode 100644 Prebuild/scripts/.svn/prop-base/VS2008.bat.svn-base delete mode 100644 Prebuild/scripts/.svn/prop-base/autotools.bat.svn-base delete mode 100644 Prebuild/scripts/.svn/prop-base/autotools.sh.svn-base delete mode 100644 Prebuild/scripts/.svn/prop-base/makefile.bat.svn-base delete mode 100644 Prebuild/scripts/.svn/prop-base/makefile.sh.svn-base delete mode 100644 Prebuild/scripts/.svn/prop-base/nant.bat.svn-base delete mode 100644 Prebuild/scripts/.svn/prop-base/nant.sh.svn-base delete mode 100644 Prebuild/scripts/.svn/prop-base/xcode.bat.svn-base delete mode 100644 Prebuild/scripts/.svn/prop-base/xcode.sh.svn-base delete mode 100644 Prebuild/scripts/.svn/text-base/Clean.bat.svn-base delete mode 100644 Prebuild/scripts/.svn/text-base/Clean.sh.svn-base delete mode 100644 Prebuild/scripts/.svn/text-base/Help.bat.svn-base delete mode 100644 Prebuild/scripts/.svn/text-base/MonoDevelop.sh.svn-base delete mode 100644 Prebuild/scripts/.svn/text-base/Prebuild.nsi.svn-base delete mode 100644 Prebuild/scripts/.svn/text-base/SharpDevelop.bat.svn-base delete mode 100644 Prebuild/scripts/.svn/text-base/SharpDevelop2.bat.svn-base delete mode 100644 Prebuild/scripts/.svn/text-base/VS2002.bat.svn-base delete mode 100644 Prebuild/scripts/.svn/text-base/VS2003.bat.svn-base delete mode 100644 Prebuild/scripts/.svn/text-base/VS2005.bat.svn-base delete mode 100644 Prebuild/scripts/.svn/text-base/VS2008.bat.svn-base delete mode 100644 Prebuild/scripts/.svn/text-base/VS2010.bat.svn-base delete mode 100644 Prebuild/scripts/.svn/text-base/autotools.bat.svn-base delete mode 100644 Prebuild/scripts/.svn/text-base/autotools.sh.svn-base delete mode 100644 Prebuild/scripts/.svn/text-base/makefile.bat.svn-base delete mode 100644 Prebuild/scripts/.svn/text-base/makefile.sh.svn-base delete mode 100644 Prebuild/scripts/.svn/text-base/nant.bat.svn-base delete mode 100644 Prebuild/scripts/.svn/text-base/nant.sh.svn-base delete mode 100644 Prebuild/scripts/.svn/text-base/xcode.bat.svn-base delete mode 100644 Prebuild/scripts/.svn/text-base/xcode.sh.svn-base delete mode 100644 Prebuild/src/.svn/all-wcprops delete mode 100644 Prebuild/src/.svn/dir-prop-base delete mode 100644 Prebuild/src/.svn/entries delete mode 100644 Prebuild/src/.svn/prop-base/App.ico.svn-base delete mode 100644 Prebuild/src/.svn/prop-base/Prebuild.cs.svn-base delete mode 100644 Prebuild/src/.svn/prop-base/Prebuild.snk.svn-base delete mode 100644 Prebuild/src/.svn/text-base/App.ico.svn-base delete mode 100644 Prebuild/src/.svn/text-base/Prebuild.cs.svn-base delete mode 100644 Prebuild/src/.svn/text-base/Prebuild.snk.svn-base delete mode 100644 Prebuild/src/Core/.svn/all-wcprops delete mode 100644 Prebuild/src/Core/.svn/dir-prop-base delete mode 100644 Prebuild/src/Core/.svn/entries delete mode 100644 Prebuild/src/Core/.svn/prop-base/FatalException.cs.svn-base delete mode 100644 Prebuild/src/Core/.svn/prop-base/Kernel.cs.svn-base delete mode 100644 Prebuild/src/Core/.svn/prop-base/UnknownLanguageException.cs.svn-base delete mode 100644 Prebuild/src/Core/.svn/prop-base/WarningException.cs.svn-base delete mode 100644 Prebuild/src/Core/.svn/text-base/FatalException.cs.svn-base delete mode 100644 Prebuild/src/Core/.svn/text-base/Kernel.cs.svn-base delete mode 100644 Prebuild/src/Core/.svn/text-base/UnknownLanguageException.cs.svn-base delete mode 100644 Prebuild/src/Core/.svn/text-base/WarningException.cs.svn-base delete mode 100644 Prebuild/src/Core/Attributes/.svn/all-wcprops delete mode 100644 Prebuild/src/Core/Attributes/.svn/dir-prop-base delete mode 100644 Prebuild/src/Core/Attributes/.svn/entries delete mode 100644 Prebuild/src/Core/Attributes/.svn/prop-base/DataNodeAttribute.cs.svn-base delete mode 100644 Prebuild/src/Core/Attributes/.svn/prop-base/OptionNodeAttribute.cs.svn-base delete mode 100644 Prebuild/src/Core/Attributes/.svn/prop-base/TargetAttribute.cs.svn-base delete mode 100644 Prebuild/src/Core/Attributes/.svn/text-base/DataNodeAttribute.cs.svn-base delete mode 100644 Prebuild/src/Core/Attributes/.svn/text-base/OptionNodeAttribute.cs.svn-base delete mode 100644 Prebuild/src/Core/Attributes/.svn/text-base/TargetAttribute.cs.svn-base delete mode 100644 Prebuild/src/Core/Interfaces/.svn/all-wcprops delete mode 100644 Prebuild/src/Core/Interfaces/.svn/dir-prop-base delete mode 100644 Prebuild/src/Core/Interfaces/.svn/entries delete mode 100644 Prebuild/src/Core/Interfaces/.svn/prop-base/IDataNode.cs.svn-base delete mode 100644 Prebuild/src/Core/Interfaces/.svn/prop-base/ITarget.cs.svn-base delete mode 100644 Prebuild/src/Core/Interfaces/.svn/text-base/IDataNode.cs.svn-base delete mode 100644 Prebuild/src/Core/Interfaces/.svn/text-base/ITarget.cs.svn-base delete mode 100644 Prebuild/src/Core/Nodes/.svn/all-wcprops delete mode 100644 Prebuild/src/Core/Nodes/.svn/dir-prop-base delete mode 100644 Prebuild/src/Core/Nodes/.svn/entries delete mode 100644 Prebuild/src/Core/Nodes/.svn/prop-base/ConfigurationNode.cs.svn-base delete mode 100644 Prebuild/src/Core/Nodes/.svn/prop-base/DataNode.cs.svn-base delete mode 100644 Prebuild/src/Core/Nodes/.svn/prop-base/ExcludeNode.cs.svn-base delete mode 100644 Prebuild/src/Core/Nodes/.svn/prop-base/FileNode.cs.svn-base delete mode 100644 Prebuild/src/Core/Nodes/.svn/prop-base/FilesNode.cs.svn-base delete mode 100644 Prebuild/src/Core/Nodes/.svn/prop-base/MatchNode.cs.svn-base delete mode 100644 Prebuild/src/Core/Nodes/.svn/prop-base/OptionsNode.cs.svn-base delete mode 100644 Prebuild/src/Core/Nodes/.svn/prop-base/ProcessNode.cs.svn-base delete mode 100644 Prebuild/src/Core/Nodes/.svn/prop-base/ProjectNode.cs.svn-base delete mode 100644 Prebuild/src/Core/Nodes/.svn/prop-base/ReferenceNode.cs.svn-base delete mode 100644 Prebuild/src/Core/Nodes/.svn/prop-base/ReferencePathNode.cs.svn-base delete mode 100644 Prebuild/src/Core/Nodes/.svn/prop-base/SolutionNode.cs.svn-base delete mode 100644 Prebuild/src/Core/Nodes/.svn/text-base/AuthorNode.cs.svn-base delete mode 100644 Prebuild/src/Core/Nodes/.svn/text-base/CleanFilesNode.cs.svn-base delete mode 100644 Prebuild/src/Core/Nodes/.svn/text-base/CleanupNode.cs.svn-base delete mode 100644 Prebuild/src/Core/Nodes/.svn/text-base/ConfigurationNode.cs.svn-base delete mode 100644 Prebuild/src/Core/Nodes/.svn/text-base/ConfigurationNodeCollection.cs.svn-base delete mode 100644 Prebuild/src/Core/Nodes/.svn/text-base/DataNode.cs.svn-base delete mode 100644 Prebuild/src/Core/Nodes/.svn/text-base/DatabaseProjectNode.cs.svn-base delete mode 100644 Prebuild/src/Core/Nodes/.svn/text-base/DatabaseReferenceNode.cs.svn-base delete mode 100644 Prebuild/src/Core/Nodes/.svn/text-base/DescriptionNode.cs.svn-base delete mode 100644 Prebuild/src/Core/Nodes/.svn/text-base/ExcludeNode.cs.svn-base delete mode 100644 Prebuild/src/Core/Nodes/.svn/text-base/FileNode.cs.svn-base delete mode 100644 Prebuild/src/Core/Nodes/.svn/text-base/FilesNode.cs.svn-base delete mode 100644 Prebuild/src/Core/Nodes/.svn/text-base/MatchNode.cs.svn-base delete mode 100644 Prebuild/src/Core/Nodes/.svn/text-base/OptionsNode.cs.svn-base delete mode 100644 Prebuild/src/Core/Nodes/.svn/text-base/ProcessNode.cs.svn-base delete mode 100644 Prebuild/src/Core/Nodes/.svn/text-base/ProjectNode.cs.svn-base delete mode 100644 Prebuild/src/Core/Nodes/.svn/text-base/ReferenceNode.cs.svn-base delete mode 100644 Prebuild/src/Core/Nodes/.svn/text-base/ReferencePathNode.cs.svn-base delete mode 100644 Prebuild/src/Core/Nodes/.svn/text-base/SolutionNode.cs.svn-base delete mode 100644 Prebuild/src/Core/Parse/.svn/all-wcprops delete mode 100644 Prebuild/src/Core/Parse/.svn/dir-prop-base delete mode 100644 Prebuild/src/Core/Parse/.svn/entries delete mode 100644 Prebuild/src/Core/Parse/.svn/prop-base/IfContext.cs.svn-base delete mode 100644 Prebuild/src/Core/Parse/.svn/prop-base/Preprocessor.cs.svn-base delete mode 100644 Prebuild/src/Core/Parse/.svn/text-base/IfContext.cs.svn-base delete mode 100644 Prebuild/src/Core/Parse/.svn/text-base/Preprocessor.cs.svn-base delete mode 100644 Prebuild/src/Core/Targets/.svn/all-wcprops delete mode 100644 Prebuild/src/Core/Targets/.svn/dir-prop-base delete mode 100644 Prebuild/src/Core/Targets/.svn/entries delete mode 100644 Prebuild/src/Core/Targets/.svn/prop-base/DebugTarget.cs.svn-base delete mode 100644 Prebuild/src/Core/Targets/.svn/prop-base/MakefileTarget.cs.svn-base delete mode 100644 Prebuild/src/Core/Targets/.svn/prop-base/MonoDevelopTarget.cs.svn-base delete mode 100644 Prebuild/src/Core/Targets/.svn/prop-base/NAntTarget.cs.svn-base delete mode 100644 Prebuild/src/Core/Targets/.svn/prop-base/SharpDevelopTarget.cs.svn-base delete mode 100644 Prebuild/src/Core/Targets/.svn/prop-base/VS2002Target.cs.svn-base delete mode 100644 Prebuild/src/Core/Targets/.svn/prop-base/VS2003Target.cs.svn-base delete mode 100644 Prebuild/src/Core/Targets/.svn/prop-base/VS2005Target.cs.svn-base delete mode 100644 Prebuild/src/Core/Targets/.svn/prop-base/XcodeTarget.cs.svn-base delete mode 100644 Prebuild/src/Core/Targets/.svn/text-base/AutotoolsTarget.cs.svn-base delete mode 100644 Prebuild/src/Core/Targets/.svn/text-base/DebugTarget.cs.svn-base delete mode 100644 Prebuild/src/Core/Targets/.svn/text-base/MakefileTarget.cs.svn-base delete mode 100644 Prebuild/src/Core/Targets/.svn/text-base/MonoDevelopTarget.cs.svn-base delete mode 100644 Prebuild/src/Core/Targets/.svn/text-base/NAntTarget.cs.svn-base delete mode 100644 Prebuild/src/Core/Targets/.svn/text-base/SharpDevelop2Target.cs.svn-base delete mode 100644 Prebuild/src/Core/Targets/.svn/text-base/SharpDevelopTarget.cs.svn-base delete mode 100644 Prebuild/src/Core/Targets/.svn/text-base/ToolInfo.cs.svn-base delete mode 100644 Prebuild/src/Core/Targets/.svn/text-base/VS2002Target.cs.svn-base delete mode 100644 Prebuild/src/Core/Targets/.svn/text-base/VS2003Target.cs.svn-base delete mode 100644 Prebuild/src/Core/Targets/.svn/text-base/VS2005Target.cs.svn-base delete mode 100644 Prebuild/src/Core/Targets/.svn/text-base/VS2008Target.cs.svn-base delete mode 100644 Prebuild/src/Core/Targets/.svn/text-base/VS2010Target.cs.svn-base delete mode 100644 Prebuild/src/Core/Targets/.svn/text-base/VSGenericTarget.cs.svn-base delete mode 100644 Prebuild/src/Core/Targets/.svn/text-base/VSVersion.cs.svn-base delete mode 100644 Prebuild/src/Core/Targets/.svn/text-base/XcodeTarget.cs.svn-base delete mode 100644 Prebuild/src/Core/Utilities/.svn/all-wcprops delete mode 100644 Prebuild/src/Core/Utilities/.svn/dir-prop-base delete mode 100644 Prebuild/src/Core/Utilities/.svn/entries delete mode 100644 Prebuild/src/Core/Utilities/.svn/prop-base/CommandLineCollection.cs.svn-base delete mode 100644 Prebuild/src/Core/Utilities/.svn/prop-base/CurrentDirectory.cs.svn-base delete mode 100644 Prebuild/src/Core/Utilities/.svn/prop-base/Helper.cs.svn-base delete mode 100644 Prebuild/src/Core/Utilities/.svn/prop-base/Log.cs.svn-base delete mode 100644 Prebuild/src/Core/Utilities/.svn/text-base/CommandLineCollection.cs.svn-base delete mode 100644 Prebuild/src/Core/Utilities/.svn/text-base/CurrentDirectory.cs.svn-base delete mode 100644 Prebuild/src/Core/Utilities/.svn/text-base/Helper.cs.svn-base delete mode 100644 Prebuild/src/Core/Utilities/.svn/text-base/Log.cs.svn-base delete mode 100644 Prebuild/src/Properties/.svn/all-wcprops delete mode 100644 Prebuild/src/Properties/.svn/entries delete mode 100644 Prebuild/src/Properties/.svn/prop-base/AssemblyInfo.cs.svn-base delete mode 100644 Prebuild/src/Properties/.svn/text-base/AssemblyInfo.cs.svn-base delete mode 100644 Prebuild/src/data/.svn/all-wcprops delete mode 100644 Prebuild/src/data/.svn/dir-prop-base delete mode 100644 Prebuild/src/data/.svn/entries delete mode 100644 Prebuild/src/data/.svn/prop-base/dnpb-1.0.xsd.svn-base delete mode 100644 Prebuild/src/data/.svn/prop-base/dnpb-1.1.xsd.svn-base delete mode 100644 Prebuild/src/data/.svn/prop-base/dnpb-1.2.xsd.svn-base delete mode 100644 Prebuild/src/data/.svn/prop-base/dnpb-1.3.xsd.svn-base delete mode 100644 Prebuild/src/data/.svn/prop-base/dnpb-1.4.xsd.svn-base delete mode 100644 Prebuild/src/data/.svn/prop-base/dnpb-1.5.xsd.svn-base delete mode 100644 Prebuild/src/data/.svn/prop-base/prebuild-1.6.xsd.svn-base delete mode 100644 Prebuild/src/data/.svn/text-base/autotools.xml.svn-base delete mode 100644 Prebuild/src/data/.svn/text-base/dnpb-1.0.xsd.svn-base delete mode 100644 Prebuild/src/data/.svn/text-base/dnpb-1.1.xsd.svn-base delete mode 100644 Prebuild/src/data/.svn/text-base/dnpb-1.2.xsd.svn-base delete mode 100644 Prebuild/src/data/.svn/text-base/dnpb-1.3.xsd.svn-base delete mode 100644 Prebuild/src/data/.svn/text-base/dnpb-1.4.xsd.svn-base delete mode 100644 Prebuild/src/data/.svn/text-base/dnpb-1.5.xsd.svn-base delete mode 100644 Prebuild/src/data/.svn/text-base/prebuild-1.6.xsd.svn-base delete mode 100644 Prebuild/src/data/.svn/text-base/prebuild-1.7.xsd.svn-base delete mode 100644 Prebuild/src/data/.svn/text-base/prebuild-1.8.xsd.svn-base delete mode 100644 Prebuild/src/data/.svn/text-base/prebuild-1.9.xsd.svn-base delete mode 100644 Prebuild/tests/.svn/all-wcprops delete mode 100644 Prebuild/tests/.svn/entries delete mode 100644 Prebuild/tests/.svn/text-base/Makefile.svn-base delete mode 100644 Prebuild/tests/.svn/text-base/README.txt.svn-base delete mode 100644 Prebuild/tests/.svn/text-base/include-001.expected.svn-base delete mode 100644 Prebuild/tests/.svn/text-base/include-001.include.svn-base delete mode 100644 Prebuild/tests/.svn/text-base/include-001.prebuild.svn-base delete mode 100644 Prebuild/tests/.svn/text-base/include-002-2.include.svn-base delete mode 100644 Prebuild/tests/.svn/text-base/include-002.expected.svn-base delete mode 100644 Prebuild/tests/.svn/text-base/include-002.include.svn-base delete mode 100644 Prebuild/tests/.svn/text-base/include-002.prebuild.svn-base diff --git a/Prebuild/doc/.svn/all-wcprops b/Prebuild/doc/.svn/all-wcprops deleted file mode 100644 index c9ded3c..0000000 --- a/Prebuild/doc/.svn/all-wcprops +++ /dev/null @@ -1,35 +0,0 @@ -K 25 -svn:wc:ra_dav:version-url -V 45 -/svnroot/dnpb/!svn/ver/153/trunk/Prebuild/doc -END -prebuild-example1.xml -K 25 -svn:wc:ra_dav:version-url -V 67 -/svnroot/dnpb/!svn/ver/100/trunk/Prebuild/doc/prebuild-example1.xml -END -prebuild-example2.xml -K 25 -svn:wc:ra_dav:version-url -V 66 -/svnroot/dnpb/!svn/ver/97/trunk/Prebuild/doc/prebuild-example2.xml -END -prebuild-example3.xml -K 25 -svn:wc:ra_dav:version-url -V 67 -/svnroot/dnpb/!svn/ver/100/trunk/Prebuild/doc/prebuild-example3.xml -END -prebuild-example4.xml -K 25 -svn:wc:ra_dav:version-url -V 66 -/svnroot/dnpb/!svn/ver/97/trunk/Prebuild/doc/prebuild-example4.xml -END -prebuild-example5.xml -K 25 -svn:wc:ra_dav:version-url -V 66 -/svnroot/dnpb/!svn/ver/99/trunk/Prebuild/doc/prebuild-example5.xml -END diff --git a/Prebuild/doc/.svn/dir-prop-base b/Prebuild/doc/.svn/dir-prop-base deleted file mode 100644 index a1989a0..0000000 --- a/Prebuild/doc/.svn/dir-prop-base +++ /dev/null @@ -1,5 +0,0 @@ -K 10 -svn:ignore -V 5 -*.swp -END diff --git a/Prebuild/doc/.svn/entries b/Prebuild/doc/.svn/entries deleted file mode 100644 index d03fd5f..0000000 --- a/Prebuild/doc/.svn/entries +++ /dev/null @@ -1,198 +0,0 @@ -10 - -dir -323 -https://dnpb.svn.sourceforge.net/svnroot/dnpb/trunk/Prebuild/doc -https://dnpb.svn.sourceforge.net/svnroot/dnpb - - - -2006-09-08T16:00:28.737339Z -153 -jendave -has-props - - - - - - - - - - - - - -3355ff64-970d-0410-bbe8-d0fbd18be4fb - -prebuild-example1.xml -file - - - - -2010-09-10T22:51:45.000000Z -269ac712fc217a7089e20814b745f795 -2006-02-28T23:34:17.574397Z -100 -jendave -has-props - - - - - - - - - - - - - - - - - - - - -11393 - -prebuild-example2.xml -file - - - - -2010-09-10T22:51:45.000000Z -6c1661ff5b85340a3b46029f9db227dd -2006-02-28T18:35:03.849682Z -97 -jendave -has-props - - - - - - - - - - - - - - - - - - - - -2478 - -prebuild-example3.xml -file - - - - -2010-09-10T22:51:45.000000Z -c0110f3960385a9ab2bc42d8a0e896dd -2006-02-28T23:34:17.574397Z -100 -jendave -has-props - - - - - - - - - - - - - - - - - - - - -6557 - -prebuild-example4.xml -file - - - - -2010-09-10T22:51:45.000000Z -19099aca218b707397307e59eccccf94 -2006-02-28T18:35:03.849682Z -97 -jendave -has-props - - - - - - - - - - - - - - - - - - - - -29159 - -prebuild-example5.xml -file - - - - -2010-09-10T22:51:45.000000Z -b55f1c716d581bb711ae1ea0f8f3a239 -2006-02-28T23:25:30.475451Z -99 -jendave - - - - - - - - - - - - - - - - - - - - - -6482 - diff --git a/Prebuild/doc/.svn/prop-base/prebuild-example1.xml.svn-base b/Prebuild/doc/.svn/prop-base/prebuild-example1.xml.svn-base deleted file mode 100644 index 7b57b30..0000000 --- a/Prebuild/doc/.svn/prop-base/prebuild-example1.xml.svn-base +++ /dev/null @@ -1,9 +0,0 @@ -K 13 -svn:eol-style -V 6 -native -K 12 -svn:keywords -V 23 -Author Date Id Revision -END diff --git a/Prebuild/doc/.svn/prop-base/prebuild-example2.xml.svn-base b/Prebuild/doc/.svn/prop-base/prebuild-example2.xml.svn-base deleted file mode 100644 index 7b57b30..0000000 --- a/Prebuild/doc/.svn/prop-base/prebuild-example2.xml.svn-base +++ /dev/null @@ -1,9 +0,0 @@ -K 13 -svn:eol-style -V 6 -native -K 12 -svn:keywords -V 23 -Author Date Id Revision -END diff --git a/Prebuild/doc/.svn/prop-base/prebuild-example3.xml.svn-base b/Prebuild/doc/.svn/prop-base/prebuild-example3.xml.svn-base deleted file mode 100644 index 7b57b30..0000000 --- a/Prebuild/doc/.svn/prop-base/prebuild-example3.xml.svn-base +++ /dev/null @@ -1,9 +0,0 @@ -K 13 -svn:eol-style -V 6 -native -K 12 -svn:keywords -V 23 -Author Date Id Revision -END diff --git a/Prebuild/doc/.svn/prop-base/prebuild-example4.xml.svn-base b/Prebuild/doc/.svn/prop-base/prebuild-example4.xml.svn-base deleted file mode 100644 index 7b57b30..0000000 --- a/Prebuild/doc/.svn/prop-base/prebuild-example4.xml.svn-base +++ /dev/null @@ -1,9 +0,0 @@ -K 13 -svn:eol-style -V 6 -native -K 12 -svn:keywords -V 23 -Author Date Id Revision -END diff --git a/Prebuild/doc/.svn/text-base/prebuild-example1.xml.svn-base b/Prebuild/doc/.svn/text-base/prebuild-example1.xml.svn-base deleted file mode 100644 index a2cee42..0000000 --- a/Prebuild/doc/.svn/text-base/prebuild-example1.xml.svn-base +++ /dev/null @@ -1,300 +0,0 @@ - - - - - - TRACE;DEBUG - false - false - false - 4 - false - 1591;219;1573;1572;168 - ..\bin - true - false - true - 285212672 - 4096 - false - Docs.xml - - - - - TRACE - true - false - false - 4 - false - 1591;219;1573;1572;168 - ..\bin - false - false - true - 285212672 - 4096 - false - Docs.xml - - - - - - - ..\bin\lib\Utility - RealmForge.Utility.xml - - - - - ..\bin\lib\Utility - RealmForge.Utility.xml - - - ../bin - - - - - - - - - - - - - - - ..\bin\lib\Framework - RealmForge.Framework.xml - - - - - ..\bin\lib\Framework - RealmForge.Framework.xml - - - ../bin - - - - - - - - - - - - - - - - - - - - - ..\bin\lib\Genres - RealmForge.Genres.xml - - - - - ..\bin\lib\Genres - RealmForge.Genres.xml - - - ../bin - - - - - - - - - - - - - - - - - ..\bin\lib\Forms - RealmForge.UI.Forms.xml - true - - - - - ..\bin\lib\Forms - RealmForge.UI.Forms.xml - true - - - ../bin - - - - - - - - - - - - IDE\Resources\ImagesCaptionIDE.bmp - IDE\Resources\ImagesCaptionPlain.bmp - IDE\Resources\ImagesMenuControl.bmp - IDE\Resources\ImagesPopupMenu.bmp - IDE\Resources\ImagesTabbedGroups.bmp - IDE\Resources\ImagesTabControl.bmp - IDE\Resources\LibraryIcon.ico - IDE\Resources\TabbedInvalid.cur - IDE\Resources\TabbedValid.cur - IDE\Resources\WizardPicture.bmp - Controls\Trees\tv_minus.bmp - Controls\Trees\tv_plus.bmp - Controls\Trees\treeview.bmp - Controls\Trees\listview.bmp - IDE\Menus\MenuControl.bmp - IDE\Controls\InertButton.bmp - IDE\Controls\TabbedGroups.bmp - IDE\Controls\TabCOntrol.bmp - IDE\Controls\WizardControl.bmp - Forms\IDETest.resx - Forms\IDEWindow.resx - Forms\Launcher.resx - Forms\MainRenderFrame.resx - - - - - - - - ..\bin\lib\RAGE - RealmForge.RAGE.xml - - - - - ..\bin\lib\RAGE - RealmForge.RAGE.xml - - - ../bin - ../bin - - - - - - - - - - - - - - - - - - - - - - - - - - - ..\bin\ScriptLibrary - RealmForge.ScriptLibrary.xml - - - - - ..\bin\ScriptLibrary - RealmForge.ScriptLibrary.xml - - - ../bin - - - - - - - - - - - - - - - - - - - - ..\bin\lib\Updater - Updater.xml - - - - - ..\bin\lib\Updater - Updater.xml - - - ../bin - - - - - - - - - - - - - - ..\bin - DemoGame.xml - - - - - ..\bin - DemoGame.xml - - - ../bin - - - - - - - - - - - - - - - diff --git a/Prebuild/doc/.svn/text-base/prebuild-example2.xml.svn-base b/Prebuild/doc/.svn/text-base/prebuild-example2.xml.svn-base deleted file mode 100644 index bd23c4f..0000000 --- a/Prebuild/doc/.svn/text-base/prebuild-example2.xml.svn-base +++ /dev/null @@ -1,72 +0,0 @@ - - - - - - - DEBUG;TRACE;WIN32;NET - - DEBUG;TRACE;POSIX - - false - bin\Debug - true - 1595 - - - - - - TRACE;WIN32;NET - - TRACE;POSIX - - bin\Release - true - false - 1595 - - - - prebuild.xml - - - - - - - DEBUG;TRACE;WIN32;NET - - DEBUG;TRACE;POSIX - - false - bin\Debug - true - Prebuild.xml - 1595 - - - - - - TRACE;WIN32;NET - - TRACE;POSIX - - bin\Release - true - false - Prebuild.xml - 1595 - - - - - - - - - - - - diff --git a/Prebuild/doc/.svn/text-base/prebuild-example3.xml.svn-base b/Prebuild/doc/.svn/text-base/prebuild-example3.xml.svn-base deleted file mode 100644 index 0111562..0000000 --- a/Prebuild/doc/.svn/text-base/prebuild-example3.xml.svn-base +++ /dev/null @@ -1,113 +0,0 @@ - - - - - - - - - - DEBUG;TRACE;WIN32 - - DEBUG;TRACE;POSIX - - false - false - false - 4 - - - false - 1591;219;1573;1572;168 - - - ..\bin - true - false - true - 285212672 - 4096 - false - Docs.xml - - - - - TRACE - true - false - false - 4 - false - 1591;219;1573;1572;168 - ..\bin - false - false - true - 285212672 - 4096 - false - Docs.xml - - - - - - - - ..\bin\lib\Utility - RealmForge.Utility.xml - - - - - ..\bin\lib\Utility - RealmForge.Utility.xml - - - ../bin - - - - - - - - - - - - - - - - - - - ..\bin - DemoGame.xml - - - - - ..\bin - DemoGame.xml - - - ../bin - - - - - - - - - - - - - - - - diff --git a/Prebuild/doc/.svn/text-base/prebuild-example4.xml.svn-base b/Prebuild/doc/.svn/text-base/prebuild-example4.xml.svn-base deleted file mode 100644 index e5861b8..0000000 --- a/Prebuild/doc/.svn/text-base/prebuild-example4.xml.svn-base +++ /dev/null @@ -1,715 +0,0 @@ - - - - - - DEBUG;TRACE - false - false - bin\Debug - true - 4 - 1595 - - - - - TRACE - true - false - bin\Release - false - 1 - 1595 - - - - SdlDotNet.build - prebuild.xml - - - - - DEBUG;TRACE - false - false - bin\Debug - true - SdlDotNet.xml - 4 - 1595 - - - - - TRACE - true - false - bin\Release - SdlDotNet.xml - false - 1 - 1595 - - - - - - - - - - - - - - - - - - DEBUG;TRACE - false - false - bin\Debug - true - Rectangles.xml - 4 - 1595 - - - - - TRACE - true - false - bin\Release - false - Rectangles.xml - 1 - 1595 - - - - - - - App.ico - - - - - - - DEBUG;TRACE - false - false - bin\Debug - true - Gears.xml - 4 - 1595 - - - - - TRACE - true - false - bin\Release - false - Gears.xml - 1 - 1595 - - - - - - - - App.ico - - - - - - - DEBUG;TRACE - false - false - bin\Debug - true - CDPlayer.xml - 4 - 1595 - - - - - TRACE - true - false - bin\Release - false - CDPlayer.xml - 1 - 1595 - - - - - - - - App.ico - CDPlayer.cs - - - - - - - - - DEBUG;TRACE - false - false - bin\Debug - true - MoviePlayer.xml - 4 - 1595 - - - - - TRACE - true - false - bin\Release - false - MoviePlayer.xml - 1 - 1595 - - - - - - - App.ico - - - - - - - DEBUG;TRACE - false - false - bin\Debug - true - SimpleGame.xml - 4 - 1595 - - - - - TRACE - true - false - bin\Release - false - SimpleGame.xml - 1 - 1595 - - - - - - - App.ico - - - - - - - DEBUG;TRACE - false - false - bin\Debug - true - BombRun.xml - 4 - 1595 - - - - - TRACE - true - false - bin\Release - false - BombRun.xml - 1 - 1595 - - - - - - - App.ico - - - - - - - DEBUG;TRACE - false - false - bin\Debug - true - SnowDemo.xml - 4 - 1595 - - - - - TRACE - true - false - bin\Release - false - SnowDemo.xml - 1 - 1595 - - - - - - - App.ico - - - - - - - DEBUG;TRACE - false - false - bin\Debug - true - BounceSprites.xml - 4 - 1595 - - - - - TRACE - true - false - bin\Release - false - BounceSprites.xml - 1 - 1595 - - - - - - - App.ico - - - - - - - DEBUG;TRACE - false - false - bin\Debug - true - Triad.xml - 4 - 1595 - - - - - TRACE - true - false - bin\Release - false - Triad.xml - 1 - 1595 - - - - - - - - App.ico - - - - - - - DEBUG;TRACE - false - false - bin\Debug - true - GuiExample.xml - 4 - 1595 - - - - - TRACE - true - false - bin\Release - false - GuiExample.xml - 1 - 1595 - - - - - - - - - - - - - DEBUG;TRACE - false - false - bin\Debug - true - SpriteGuiDemos.xml - 4 - 1595 - - - - - TRACE - true - false - bin\Release - false - SpriteGuiDemos.xml - 1 - 1595 - - - - - - - - App.ico - - - - - - - DEBUG;TRACE - false - false - bin\Debug - true - SdlDotNet.Tests.xml - 4 - 1595 - - - - - TRACE - true - false - bin\Release - false - SdlDotNet.Tests.xml - 1 - 1595 - - - - - - - - - - - - - - - - DEBUG;TRACE - false - false - bin\Debug - true - AudioExample.xml - 4 - 1595 - - - - - TRACE - true - false - bin\Release - false - AudioExample.xml - 1 - 1595 - - - - - - - App.ico - - - - - - - DEBUG;TRACE - false - false - bin\Debug - true - SdlDotNet.Particles.xml - 4 - 1595 - - - - - TRACE - true - false - bin\Release - false - SdlDotNet.Particles.xml - 1 - 1595 - - - - - - - - - - - - - DEBUG;TRACE - false - false - bin\Debug - true - ParticlesExample.xml - 4 - 1595 - - - - - TRACE - true - false - bin\Release - false - ParticlesExample.xml - 1 - 1595 - - - - - - - - App.ico - - - - - - - - DEBUG;TRACE - false - false - bin\Debug - true - NeHe.xml - 4 - 1595 - - - - - TRACE - true - false - bin\Release - false - NeHe.xml - 1 - 1595 - - - - - - - - - - - App.ico - NeHe.cs - - - - - - - - - DEBUG;TRACE - false - false - bin\Debug - true - RedBook.xml - 4 - 1595 - - - - - TRACE - true - false - bin\Release - false - RedBook.xml - 1 - 1595 - - - - - - - - - - - App.ico - RedBook.cs - - - - - - - - - DEBUG;TRACE - false - false - bin\Debug - true - PhysFsTest.xml - 4 - 1595 - - - - - TRACE - true - false - bin\Release - false - PhysFsTest.xml - 1 - 1595 - - - - - - - - App.ico - - - - - diff --git a/Prebuild/doc/.svn/text-base/prebuild-example5.xml.svn-base b/Prebuild/doc/.svn/text-base/prebuild-example5.xml.svn-base deleted file mode 100644 index 5221547..0000000 --- a/Prebuild/doc/.svn/text-base/prebuild-example5.xml.svn-base +++ /dev/null @@ -1,187 +0,0 @@ - - - - - - DEBUG;TRACE;WIN32 - false - true - bin\Debug - Tao.Sdl.xml - true - - - - - TRACE;WIN32 - true - true - bin\Release - Tao.Sdl.xml - false - - - - Tao.Sdl.License.txt - Tao.Sdl.Readme.txt - Tao.Sdl.snk - Tao.Sdl.dll.config - - - - - AssemblyInfo.cs - Sdl.cs - SdlImage.cs - SdlMixer.cs - SdlTtf.cs - SdlNet.cs - SdlGfx.cs - Smpeg.cs - DelegateCallingConventionCdeclAttribute.cs - - - - - - DEBUG;TRACE;WIN32 - false - false - bin\Debug - Tao.Sdl.Tests.xml - true - - - - - TRACE;WIN32 - true - false - bin\Release - Tao.Sdl.Tests.xml - false - - - - - - - AssemblyInfo.cs - SdlTest.cs - SdlTestVideo.cs - SdlTestImage.cs - SdlTestTtf.cs - SdlTestMixer.cs - SdlTestGfx.cs - SmpegTest.cs - - - - - - DEBUG;TRACE;WIN32 - false - false - bin\Debug - true - - - - - TRACE;WIN32 - true - false - bin\Release - false - - - - - - AssemblyInfo.cs - Rectangles.cs - - - - - - DEBUG;TRACE;WIN32 - false - false - bin\Debug - true - - - - - TRACE;WIN32 - true - false - bin\Release - false - - - - - - AssemblyInfo.cs - SmpegPlayer.cs - - - - - - DEBUG;TRACE;WIN32 - false - false - bin\Debug - true - - - - - TRACE;WIN32 - true - false - bin\Release - false - - - - - - AssemblyInfo.cs - GfxPrimitives.cs - - - - - - DEBUG;TRACE;WIN32 - false - false - bin\Debug - true - - - - - TRACE;WIN32 - true - false - bin\Release - false - - - - - AssemblyInfo.cs - AppMain.cs - BuildProcessor.cs - Options.cs - ReleaseBuildProcessor.cs - UsageHelp.cs - - - - diff --git a/Prebuild/scripts/.svn/all-wcprops b/Prebuild/scripts/.svn/all-wcprops deleted file mode 100644 index b59b6a2..0000000 --- a/Prebuild/scripts/.svn/all-wcprops +++ /dev/null @@ -1,125 +0,0 @@ -K 25 -svn:wc:ra_dav:version-url -V 49 -/svnroot/dnpb/!svn/ver/316/trunk/Prebuild/scripts -END -makefile.bat -K 25 -svn:wc:ra_dav:version-url -V 62 -/svnroot/dnpb/!svn/ver/240/trunk/Prebuild/scripts/makefile.bat -END -SharpDevelop2.bat -K 25 -svn:wc:ra_dav:version-url -V 67 -/svnroot/dnpb/!svn/ver/205/trunk/Prebuild/scripts/SharpDevelop2.bat -END -makefile.sh -K 25 -svn:wc:ra_dav:version-url -V 61 -/svnroot/dnpb/!svn/ver/240/trunk/Prebuild/scripts/makefile.sh -END -Clean.bat -K 25 -svn:wc:ra_dav:version-url -V 59 -/svnroot/dnpb/!svn/ver/205/trunk/Prebuild/scripts/Clean.bat -END -Clean.sh -K 25 -svn:wc:ra_dav:version-url -V 58 -/svnroot/dnpb/!svn/ver/240/trunk/Prebuild/scripts/Clean.sh -END -Help.bat -K 25 -svn:wc:ra_dav:version-url -V 58 -/svnroot/dnpb/!svn/ver/205/trunk/Prebuild/scripts/Help.bat -END -autotools.bat -K 25 -svn:wc:ra_dav:version-url -V 63 -/svnroot/dnpb/!svn/ver/205/trunk/Prebuild/scripts/autotools.bat -END -Prebuild.nsi -K 25 -svn:wc:ra_dav:version-url -V 62 -/svnroot/dnpb/!svn/ver/116/trunk/Prebuild/scripts/Prebuild.nsi -END -VS2010.bat -K 25 -svn:wc:ra_dav:version-url -V 60 -/svnroot/dnpb/!svn/ver/316/trunk/Prebuild/scripts/VS2010.bat -END -MonoDevelop.sh -K 25 -svn:wc:ra_dav:version-url -V 64 -/svnroot/dnpb/!svn/ver/205/trunk/Prebuild/scripts/MonoDevelop.sh -END -VS2002.bat -K 25 -svn:wc:ra_dav:version-url -V 60 -/svnroot/dnpb/!svn/ver/205/trunk/Prebuild/scripts/VS2002.bat -END -SharpDevelop.bat -K 25 -svn:wc:ra_dav:version-url -V 66 -/svnroot/dnpb/!svn/ver/205/trunk/Prebuild/scripts/SharpDevelop.bat -END -autotools.sh -K 25 -svn:wc:ra_dav:version-url -V 62 -/svnroot/dnpb/!svn/ver/256/trunk/Prebuild/scripts/autotools.sh -END -VS2003.bat -K 25 -svn:wc:ra_dav:version-url -V 60 -/svnroot/dnpb/!svn/ver/196/trunk/Prebuild/scripts/VS2003.bat -END -VS2005.bat -K 25 -svn:wc:ra_dav:version-url -V 60 -/svnroot/dnpb/!svn/ver/205/trunk/Prebuild/scripts/VS2005.bat -END -nant.bat -K 25 -svn:wc:ra_dav:version-url -V 58 -/svnroot/dnpb/!svn/ver/205/trunk/Prebuild/scripts/nant.bat -END -VS2008.bat -K 25 -svn:wc:ra_dav:version-url -V 60 -/svnroot/dnpb/!svn/ver/288/trunk/Prebuild/scripts/VS2008.bat -END -xcode.bat -K 25 -svn:wc:ra_dav:version-url -V 59 -/svnroot/dnpb/!svn/ver/240/trunk/Prebuild/scripts/xcode.bat -END -nant.sh -K 25 -svn:wc:ra_dav:version-url -V 57 -/svnroot/dnpb/!svn/ver/205/trunk/Prebuild/scripts/nant.sh -END -xcode.sh -K 25 -svn:wc:ra_dav:version-url -V 58 -/svnroot/dnpb/!svn/ver/240/trunk/Prebuild/scripts/xcode.sh -END diff --git a/Prebuild/scripts/.svn/dir-prop-base b/Prebuild/scripts/.svn/dir-prop-base deleted file mode 100644 index 48246b7..0000000 --- a/Prebuild/scripts/.svn/dir-prop-base +++ /dev/null @@ -1,6 +0,0 @@ -K 10 -svn:ignore -V 12 -*.cmbx -*.swp -END diff --git a/Prebuild/scripts/.svn/entries b/Prebuild/scripts/.svn/entries deleted file mode 100644 index ee476a5..0000000 --- a/Prebuild/scripts/.svn/entries +++ /dev/null @@ -1,708 +0,0 @@ -10 - -dir -323 -https://dnpb.svn.sourceforge.net/svnroot/dnpb/trunk/Prebuild/scripts -https://dnpb.svn.sourceforge.net/svnroot/dnpb - - - -2010-05-08T05:43:01.449559Z -316 -jhurliman -has-props - - - - - - - - - - - - - -3355ff64-970d-0410-bbe8-d0fbd18be4fb - -makefile.bat -file - - - - -2010-09-10T22:51:44.000000Z -f6d151aad764b5bdb4113a119c9f3750 -2007-05-08T15:42:58.740059Z -240 -jendave -has-props - - - - - - - - - - - - - - - - - - - - -102 - -SharpDevelop2.bat -file - - - - -2010-09-10T22:51:44.000000Z -432bf7063141f24bcc4e4a13ede3b6cf -2007-02-13T20:58:03.716560Z -205 -jendave -has-props - - - - - - - - - - - - - - - - - - - - -210 - -makefile.sh -file - - - - -2010-09-10T22:51:44.000000Z -70db5cccbafa4f0019d3d9e0fbb6d884 -2007-05-08T15:42:58.740059Z -240 -jendave -has-props - - - - - - - - - - - - - - - - - - - - -155 - -Clean.bat -file - - - - -2010-09-10T22:51:44.000000Z -f33b6d088290350f0d7cbc44e6c26854 -2007-02-13T20:58:03.716560Z -205 -jendave -has-props - - - - - - - - - - - - - - - - - - - - -87 - -Clean.sh -file - - - - -2010-09-10T22:51:44.000000Z -0d402c1dc3ba5fa92a22721ee7faf47c -2007-05-08T15:42:58.740059Z -240 -jendave -has-props - - - - - - - - - - - - - - - - - - - - -92 - -Help.bat -file - - - - -2010-09-10T22:51:44.000000Z -237f9b0bc08ef577209cf7119efbd456 -2007-02-13T20:58:03.716560Z -205 -jendave -has-props - - - - - - - - - - - - - - - - - - - - -32 - -autotools.bat -file - - - - -2010-09-10T22:51:44.000000Z -3604bb1d38df33793e62c25e08362f59 -2007-02-13T20:58:03.716560Z -205 -jendave -has-props - - - - - - - - - - - - - - - - - - - - -112 - -Prebuild.nsi -file - - - - -2010-09-10T22:51:44.000000Z -572ab49b75b83aece148667c55cb800b -2006-06-28T00:12:05.085067Z -116 -jendave -has-props - - - - - - - - - - - - - - - - - - - - -6208 - -VS2010.bat -file - - - - -2010-09-10T22:51:44.000000Z -f6f61e3b45a19c4c011c9143da1ab274 -2010-05-08T05:43:01.449559Z -316 -jhurliman - - - - - - - - - - - - - - - - - - - - - -192 - -MonoDevelop.sh -file - - - - -2010-09-10T22:51:44.000000Z -1499f30edeaae42e200fa27a7c605fba -2007-02-13T20:58:03.716560Z -205 -jendave -has-props - - - - - - - - - - - - - - - - - - - - -79 - -VS2002.bat -file - - - - -2010-09-10T22:51:44.000000Z -3ebbd6c68560aaf1ec9089cdd64f5fcd -2007-02-13T20:58:03.716560Z -205 -jendave -has-props - - - - - - - - - - - - - - - - - - - - -189 - -SharpDevelop.bat -file - - - - -2010-09-10T22:51:44.000000Z -68ebe8c542c03966bf15bfae465c6616 -2007-02-13T20:58:03.716560Z -205 -jendave -has-props - - - - - - - - - - - - - - - - - - - - -220 - -autotools.sh -file - - - - -2010-09-10T22:51:44.000000Z -3e82233011b4b61378fdfafec75105c3 -2008-02-07T16:31:29.630257Z -256 -cjcollier -has-props - - - - - - - - - - - - - - - - - - - - -163 - -VS2003.bat -file - - - - -2010-09-10T22:51:44.000000Z -d98909ce1a987763796c2d51bd51e861 -2006-12-30T09:17:33.472696Z -196 -jendave -has-props - - - - - - - - - - - - - - - - - - - - -189 - -VS2005.bat -file - - - - -2010-09-10T22:51:44.000000Z -3a9c76a2bc4a7b72dacb5f9080b212a4 -2007-02-13T20:58:03.716560Z -205 -jendave -has-props - - - - - - - - - - - - - - - - - - - - -203 - -nant.bat -file - - - - -2010-09-10T22:51:44.000000Z -b42b576139291f54b283c4e557f02140 -2007-02-13T20:58:03.716560Z -205 -jendave -has-props - - - - - - - - - - - - - - - - - - - - -103 - -VS2008.bat -file - - - - -2010-09-10T22:51:44.000000Z -b239b3d67274fdac817fa0b41864bb01 -2009-02-09T18:52:49.114435Z -288 -diakopter -has-props - - - - - - - - - - - - - - - - - - - - -192 - -xcode.bat -file - - - - -2010-09-10T22:51:44.000000Z -adbdd25e0777620fafc9d087142d0747 -2007-05-08T15:42:58.740059Z -240 -jendave -has-props - - - - - - - - - - - - - - - - - - - - -103 - -nant.sh -file - - - - -2010-09-10T22:51:44.000000Z -94a22105b89b89938829d63f70a628dc -2007-02-13T20:58:03.716560Z -205 -jendave -has-props - - - - - - - - - - - - - - - - - - - - -61 - -xcode.sh -file - - - - -2010-09-10T22:51:44.000000Z -7f7b529278d58af6d9313e2a93f7f296 -2007-05-08T15:42:58.740059Z -240 -jendave -has-props - - - - - - - - - - - - - - - - - - - - -62 - diff --git a/Prebuild/scripts/.svn/prop-base/Clean.bat.svn-base b/Prebuild/scripts/.svn/prop-base/Clean.bat.svn-base deleted file mode 100644 index 5336d10..0000000 --- a/Prebuild/scripts/.svn/prop-base/Clean.bat.svn-base +++ /dev/null @@ -1,13 +0,0 @@ -K 13 -svn:eol-style -V 6 -native -K 14 -svn:executable -V 1 -* -K 12 -svn:keywords -V 23 -Author Date Id Revision -END diff --git a/Prebuild/scripts/.svn/prop-base/Clean.sh.svn-base b/Prebuild/scripts/.svn/prop-base/Clean.sh.svn-base deleted file mode 100644 index 03b5bfa..0000000 --- a/Prebuild/scripts/.svn/prop-base/Clean.sh.svn-base +++ /dev/null @@ -1,9 +0,0 @@ -K 13 -svn:eol-style -V 6 -native -K 14 -svn:executable -V 1 -* -END diff --git a/Prebuild/scripts/.svn/prop-base/Help.bat.svn-base b/Prebuild/scripts/.svn/prop-base/Help.bat.svn-base deleted file mode 100644 index 5336d10..0000000 --- a/Prebuild/scripts/.svn/prop-base/Help.bat.svn-base +++ /dev/null @@ -1,13 +0,0 @@ -K 13 -svn:eol-style -V 6 -native -K 14 -svn:executable -V 1 -* -K 12 -svn:keywords -V 23 -Author Date Id Revision -END diff --git a/Prebuild/scripts/.svn/prop-base/MonoDevelop.sh.svn-base b/Prebuild/scripts/.svn/prop-base/MonoDevelop.sh.svn-base deleted file mode 100644 index 5336d10..0000000 --- a/Prebuild/scripts/.svn/prop-base/MonoDevelop.sh.svn-base +++ /dev/null @@ -1,13 +0,0 @@ -K 13 -svn:eol-style -V 6 -native -K 14 -svn:executable -V 1 -* -K 12 -svn:keywords -V 23 -Author Date Id Revision -END diff --git a/Prebuild/scripts/.svn/prop-base/Prebuild.nsi.svn-base b/Prebuild/scripts/.svn/prop-base/Prebuild.nsi.svn-base deleted file mode 100644 index 7b57b30..0000000 --- a/Prebuild/scripts/.svn/prop-base/Prebuild.nsi.svn-base +++ /dev/null @@ -1,9 +0,0 @@ -K 13 -svn:eol-style -V 6 -native -K 12 -svn:keywords -V 23 -Author Date Id Revision -END diff --git a/Prebuild/scripts/.svn/prop-base/SharpDevelop.bat.svn-base b/Prebuild/scripts/.svn/prop-base/SharpDevelop.bat.svn-base deleted file mode 100644 index 5336d10..0000000 --- a/Prebuild/scripts/.svn/prop-base/SharpDevelop.bat.svn-base +++ /dev/null @@ -1,13 +0,0 @@ -K 13 -svn:eol-style -V 6 -native -K 14 -svn:executable -V 1 -* -K 12 -svn:keywords -V 23 -Author Date Id Revision -END diff --git a/Prebuild/scripts/.svn/prop-base/SharpDevelop2.bat.svn-base b/Prebuild/scripts/.svn/prop-base/SharpDevelop2.bat.svn-base deleted file mode 100644 index 869ac71..0000000 --- a/Prebuild/scripts/.svn/prop-base/SharpDevelop2.bat.svn-base +++ /dev/null @@ -1,5 +0,0 @@ -K 14 -svn:executable -V 1 -* -END diff --git a/Prebuild/scripts/.svn/prop-base/VS2002.bat.svn-base b/Prebuild/scripts/.svn/prop-base/VS2002.bat.svn-base deleted file mode 100644 index 5336d10..0000000 --- a/Prebuild/scripts/.svn/prop-base/VS2002.bat.svn-base +++ /dev/null @@ -1,13 +0,0 @@ -K 13 -svn:eol-style -V 6 -native -K 14 -svn:executable -V 1 -* -K 12 -svn:keywords -V 23 -Author Date Id Revision -END diff --git a/Prebuild/scripts/.svn/prop-base/VS2003.bat.svn-base b/Prebuild/scripts/.svn/prop-base/VS2003.bat.svn-base deleted file mode 100644 index 5336d10..0000000 --- a/Prebuild/scripts/.svn/prop-base/VS2003.bat.svn-base +++ /dev/null @@ -1,13 +0,0 @@ -K 13 -svn:eol-style -V 6 -native -K 14 -svn:executable -V 1 -* -K 12 -svn:keywords -V 23 -Author Date Id Revision -END diff --git a/Prebuild/scripts/.svn/prop-base/VS2005.bat.svn-base b/Prebuild/scripts/.svn/prop-base/VS2005.bat.svn-base deleted file mode 100644 index 5336d10..0000000 --- a/Prebuild/scripts/.svn/prop-base/VS2005.bat.svn-base +++ /dev/null @@ -1,13 +0,0 @@ -K 13 -svn:eol-style -V 6 -native -K 14 -svn:executable -V 1 -* -K 12 -svn:keywords -V 23 -Author Date Id Revision -END diff --git a/Prebuild/scripts/.svn/prop-base/VS2008.bat.svn-base b/Prebuild/scripts/.svn/prop-base/VS2008.bat.svn-base deleted file mode 100644 index 869ac71..0000000 --- a/Prebuild/scripts/.svn/prop-base/VS2008.bat.svn-base +++ /dev/null @@ -1,5 +0,0 @@ -K 14 -svn:executable -V 1 -* -END diff --git a/Prebuild/scripts/.svn/prop-base/autotools.bat.svn-base b/Prebuild/scripts/.svn/prop-base/autotools.bat.svn-base deleted file mode 100644 index 869ac71..0000000 --- a/Prebuild/scripts/.svn/prop-base/autotools.bat.svn-base +++ /dev/null @@ -1,5 +0,0 @@ -K 14 -svn:executable -V 1 -* -END diff --git a/Prebuild/scripts/.svn/prop-base/autotools.sh.svn-base b/Prebuild/scripts/.svn/prop-base/autotools.sh.svn-base deleted file mode 100644 index 869ac71..0000000 --- a/Prebuild/scripts/.svn/prop-base/autotools.sh.svn-base +++ /dev/null @@ -1,5 +0,0 @@ -K 14 -svn:executable -V 1 -* -END diff --git a/Prebuild/scripts/.svn/prop-base/makefile.bat.svn-base b/Prebuild/scripts/.svn/prop-base/makefile.bat.svn-base deleted file mode 100644 index 03b5bfa..0000000 --- a/Prebuild/scripts/.svn/prop-base/makefile.bat.svn-base +++ /dev/null @@ -1,9 +0,0 @@ -K 13 -svn:eol-style -V 6 -native -K 14 -svn:executable -V 1 -* -END diff --git a/Prebuild/scripts/.svn/prop-base/makefile.sh.svn-base b/Prebuild/scripts/.svn/prop-base/makefile.sh.svn-base deleted file mode 100644 index 03b5bfa..0000000 --- a/Prebuild/scripts/.svn/prop-base/makefile.sh.svn-base +++ /dev/null @@ -1,9 +0,0 @@ -K 13 -svn:eol-style -V 6 -native -K 14 -svn:executable -V 1 -* -END diff --git a/Prebuild/scripts/.svn/prop-base/nant.bat.svn-base b/Prebuild/scripts/.svn/prop-base/nant.bat.svn-base deleted file mode 100644 index 5336d10..0000000 --- a/Prebuild/scripts/.svn/prop-base/nant.bat.svn-base +++ /dev/null @@ -1,13 +0,0 @@ -K 13 -svn:eol-style -V 6 -native -K 14 -svn:executable -V 1 -* -K 12 -svn:keywords -V 23 -Author Date Id Revision -END diff --git a/Prebuild/scripts/.svn/prop-base/nant.sh.svn-base b/Prebuild/scripts/.svn/prop-base/nant.sh.svn-base deleted file mode 100644 index 5336d10..0000000 --- a/Prebuild/scripts/.svn/prop-base/nant.sh.svn-base +++ /dev/null @@ -1,13 +0,0 @@ -K 13 -svn:eol-style -V 6 -native -K 14 -svn:executable -V 1 -* -K 12 -svn:keywords -V 23 -Author Date Id Revision -END diff --git a/Prebuild/scripts/.svn/prop-base/xcode.bat.svn-base b/Prebuild/scripts/.svn/prop-base/xcode.bat.svn-base deleted file mode 100644 index 03b5bfa..0000000 --- a/Prebuild/scripts/.svn/prop-base/xcode.bat.svn-base +++ /dev/null @@ -1,9 +0,0 @@ -K 13 -svn:eol-style -V 6 -native -K 14 -svn:executable -V 1 -* -END diff --git a/Prebuild/scripts/.svn/prop-base/xcode.sh.svn-base b/Prebuild/scripts/.svn/prop-base/xcode.sh.svn-base deleted file mode 100644 index 03b5bfa..0000000 --- a/Prebuild/scripts/.svn/prop-base/xcode.sh.svn-base +++ /dev/null @@ -1,9 +0,0 @@ -K 13 -svn:eol-style -V 6 -native -K 14 -svn:executable -V 1 -* -END diff --git a/Prebuild/scripts/.svn/text-base/Clean.bat.svn-base b/Prebuild/scripts/.svn/text-base/Clean.bat.svn-base deleted file mode 100644 index 806bbe8..0000000 --- a/Prebuild/scripts/.svn/text-base/Clean.bat.svn-base +++ /dev/null @@ -1,2 +0,0 @@ -cd .. -Prebuild.exe /clean /yes /removedir obj /file prebuild.xml /build NET_2_0 /pause diff --git a/Prebuild/scripts/.svn/text-base/Clean.sh.svn-base b/Prebuild/scripts/.svn/text-base/Clean.sh.svn-base deleted file mode 100644 index b0a6530..0000000 --- a/Prebuild/scripts/.svn/text-base/Clean.sh.svn-base +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/sh - -./prebuild /clean /removedir obj /file ../prebuild.xml /pause -rm -rf ../Makefile diff --git a/Prebuild/scripts/.svn/text-base/Help.bat.svn-base b/Prebuild/scripts/.svn/text-base/Help.bat.svn-base deleted file mode 100644 index 7c843c4..0000000 --- a/Prebuild/scripts/.svn/text-base/Help.bat.svn-base +++ /dev/null @@ -1,2 +0,0 @@ -cd .. -Prebuild.exe /usage /pause \ No newline at end of file diff --git a/Prebuild/scripts/.svn/text-base/MonoDevelop.sh.svn-base b/Prebuild/scripts/.svn/text-base/MonoDevelop.sh.svn-base deleted file mode 100644 index fbd7669..0000000 --- a/Prebuild/scripts/.svn/text-base/MonoDevelop.sh.svn-base +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -prebuild /target monodev /file ../prebuild.xml /build NET_1_1 /pause diff --git a/Prebuild/scripts/.svn/text-base/Prebuild.nsi.svn-base b/Prebuild/scripts/.svn/text-base/Prebuild.nsi.svn-base deleted file mode 100644 index 8f9854e..0000000 --- a/Prebuild/scripts/.svn/text-base/Prebuild.nsi.svn-base +++ /dev/null @@ -1,231 +0,0 @@ -!verbose 3 - -!define PRODUCT_NAME "Prebuild" -!define PRODUCT_VERSION "1.3.1" -!define PRODUCT_PUBLISHER "Prebuild" -!define PRODUCT_PACKAGE "prebuild" -!define PRODUCT_WEB_SITE "http://dnpb.sourceforge.net" -!define PRODUCT_DIR_REGKEY "Software\Microsoft\Windows\CurrentVersion\App Paths\Prebuild" -!define PRODUCT_UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\Prebuild" -!define PRODUCT_UNINST_ROOT_KEY "HKLM" -!define PRODUCT_PATH ".." - -;!define MUI_WELCOMEFINISHPAGE_BITMAP "PrebuildLogo.bmp" -;!define MUI_WELCOMEFINISHPAGE_BITMAP_NOSTRETCH -;!define MUI_UNWELCOMEFINISHPAGE_BITMAP "PrebuildLogo.bmp" -;!define MUI_UNWELCOMEFINISHPAGE_BITMAP_NOSTRETCH - -BrandingText "© 2003-2006 David Hudson, http://dnpb.sourceforge.net/" -SetCompressor lzma -CRCCheck on - -; File Association defines -;!include "fileassoc.nsh" - -; MUI 1.67 compatible ------ -!include "MUI.nsh" - -; MUI Settings -!define MUI_ABORTWARNING -!define MUI_ICON "${NSISDIR}\Contrib\Graphics\Icons\modern-install.ico" -!define MUI_UNICON "${NSISDIR}\Contrib\Graphics\Icons\modern-uninstall.ico" - -;-------------------------------- -;Variables - -;-------------------------------- -;Installer Pages - -; Welcome page -!insertmacro MUI_PAGE_WELCOME -; License page -!insertmacro MUI_PAGE_LICENSE "..\doc\license.txt" -; Directory page -!insertmacro MUI_PAGE_DIRECTORY - -; Instfiles page -!insertmacro MUI_PAGE_INSTFILES - -; Finish page -!insertmacro MUI_PAGE_FINISH - -;------------------------------------ -; Uninstaller pages -!insertmacro MUI_UNPAGE_CONFIRM -!insertmacro MUI_UNPAGE_INSTFILES -!insertmacro MUI_UNPAGE_FINISH -;------------------------------------ - -; Language files -!insertmacro MUI_LANGUAGE "English" - -; Reserve files -!insertmacro MUI_RESERVEFILE_INSTALLOPTIONS - -; MUI end ------ - -Name "${PRODUCT_NAME} ${PRODUCT_VERSION}" -OutFile "..\${PRODUCT_PACKAGE}-${PRODUCT_VERSION}-setup.exe" -InstallDir "$PROGRAMFILES\Prebuild" -InstallDirRegKey HKLM "${PRODUCT_DIR_REGKEY}" "" -ShowInstDetails show -ShowUnInstDetails show - -; .NET Framework check -; http://msdn.microsoft.com/netframework/default.aspx?pull=/library/en-us/dnnetdep/html/redistdeploy1_1.asp -; Section "Detecting that the .NET Framework 1.1 is installed" -Function .onInit - ReadRegDWORD $R0 HKLM "SOFTWARE\Microsoft\NET Framework Setup\NDP\v1.1.4322" Install - StrCmp $R0 "" 0 CheckPreviousVersion - MessageBox MB_OK "Microsoft .NET Framework 1.1 was not found on this system.$\r$\n$\r$\nUnable to continue this installation." - Abort - - CheckPreviousVersion: - ReadRegStr $R0 ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayName" - StrCmp $R0 "" CheckOSVersion 0 - MessageBox MB_OK "An old version of Prebuild is installed on this computer, please uninstall first.$\r$\n$\r$\nUnable to continue this installation." - Abort - - CheckOSVersion: - Call IsSupportedWindowsVersion - Pop $R0 - StrCmp $R0 "False" NoAbort 0 - MessageBox MB_OK "The operating system you are using is not supported by Prebuild (95/98/ME/NT3.x/NT4.x)." - Abort - - NoAbort: -FunctionEnd - -Section "Source" SecSource - SetOverwrite ifnewer - SetOutPath "$INSTDIR\src" - File /r /x *.swp /x .svn /x *.xml /x *.csproj /x *.user /x *.build /x *.prjx /x *.mdp /x bin /x obj /x *.nsi ${PRODUCT_PATH}\src\*.* - - ;Store installation folder - WriteRegStr HKCU "Software\Prebuild" "" $INSTDIR - -SectionEnd - -Section "Runtime" SecRuntime - SetOverwrite ifnewer - SetOutPath "$INSTDIR" - File /r /x *.swp /x .svn /x *.nsi /x src /x *.sln /x *.cmbx /x *.mds ${PRODUCT_PATH}\Prebuild.exe ${PRODUCT_PATH}\prebuild.xml - - ;Store installation folder - WriteRegStr HKCU "Software\Prebuild" "" $INSTDIR - -SectionEnd - -Section "Documentation" SecDocs - SetOverwrite ifnewer - SetOutPath "$INSTDIR\doc" - File /r /x *.swp /x .svn /x *.exe ${PRODUCT_PATH}\doc\*.* - - ;Store installation folder - WriteRegStr HKCU "Software\Prebuild" "" $INSTDIR -SectionEnd - -Section "Scripts" SecScripts - SetOverwrite ifnewer - SetOutPath "$INSTDIR\scripts" - File /r /x *.swp /x .svn /x *.nsi /x *.exe ${PRODUCT_PATH}\scripts\*.* - - ;Store installation folder - WriteRegStr HKCU "Software\Prebuild" "" $INSTDIR -SectionEnd - -;Language strings - -Section -AdditionalIcons - WriteIniStr "$INSTDIR\${PRODUCT_NAME}.url" "InternetShortcut" "URL" "${PRODUCT_WEB_SITE}" -SectionEnd - -Section -Post - WriteUninstaller "$INSTDIR\uninst.exe" - WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayName" "$(^Name)" - WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "UninstallString" "$INSTDIR\uninst.exe" - WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayVersion" "${PRODUCT_VERSION}" - WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "URLInfoAbout" "${PRODUCT_WEB_SITE}" - WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "Publisher" "${PRODUCT_PUBLISHER}" -SectionEnd - -Section Uninstall - - DeleteRegKey ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" - DeleteRegKey HKLM "${PRODUCT_DIR_REGKEY}" - RMDir /r "$INSTDIR" - -SectionEnd - -; GetWindowsVersion, taken from NSIS help, modified for our purposes -Function IsSupportedWindowsVersion - - Push $R0 - Push $R1 - - ReadRegStr $R0 HKLM \ - "SOFTWARE\Microsoft\Windows NT\CurrentVersion" CurrentVersion - - IfErrors 0 lbl_winnt - - ; we are not NT - ReadRegStr $R0 HKLM \ - "SOFTWARE\Microsoft\Windows\CurrentVersion" VersionNumber - - StrCpy $R1 $R0 1 - StrCmp $R1 '4' 0 lbl_error - - StrCpy $R1 $R0 3 - - StrCmp $R1 '4.0' lbl_win32_95 - StrCmp $R1 '4.9' lbl_win32_ME lbl_win32_98 - - lbl_win32_95: - StrCpy $R0 'False' - Goto lbl_done - - lbl_win32_98: - StrCpy $R0 'False' - Goto lbl_done - - lbl_win32_ME: - StrCpy $R0 'False' - Goto lbl_done - - lbl_winnt: - - StrCpy $R1 $R0 1 - - StrCmp $R1 '3' lbl_winnt_x - StrCmp $R1 '4' lbl_winnt_x - - StrCpy $R1 $R0 3 - - StrCmp $R1 '5.0' lbl_winnt_2000 - StrCmp $R1 '5.1' lbl_winnt_XP - StrCmp $R1 '5.2' lbl_winnt_2003 lbl_error - - lbl_winnt_x: - StrCpy $R0 'False' - Goto lbl_done - - lbl_winnt_2000: - Strcpy $R0 'True' - Goto lbl_done - - lbl_winnt_XP: - Strcpy $R0 'True' - Goto lbl_done - - lbl_winnt_2003: - Strcpy $R0 'True' - Goto lbl_done - - lbl_error: - Strcpy $R0 'False' - lbl_done: - - Pop $R1 - Exch $R0 - -FunctionEnd diff --git a/Prebuild/scripts/.svn/text-base/SharpDevelop.bat.svn-base b/Prebuild/scripts/.svn/text-base/SharpDevelop.bat.svn-base deleted file mode 100644 index 08fea0b..0000000 --- a/Prebuild/scripts/.svn/text-base/SharpDevelop.bat.svn-base +++ /dev/null @@ -1,4 +0,0 @@ -@rem Generates a combine (.cmbx) and a set of project files (.prjx) -@rem for SharpDevelop (http://icsharpcode.net/OpenSource/SD/Default.aspx) -cd .. -Prebuild.exe /target sharpdev /file prebuild.xml /build NET_1_1 /pause diff --git a/Prebuild/scripts/.svn/text-base/SharpDevelop2.bat.svn-base b/Prebuild/scripts/.svn/text-base/SharpDevelop2.bat.svn-base deleted file mode 100644 index 49120ab..0000000 --- a/Prebuild/scripts/.svn/text-base/SharpDevelop2.bat.svn-base +++ /dev/null @@ -1,4 +0,0 @@ -@rem Generates a combine (.cmbx) and a set of project files (.prjx) -@rem for SharpDevelop (http://icsharpcode.net/OpenSource/SD/Default.aspx) -cd .. -Prebuild.exe /target sharpdev2 /file prebuild.xml /pause diff --git a/Prebuild/scripts/.svn/text-base/VS2002.bat.svn-base b/Prebuild/scripts/.svn/text-base/VS2002.bat.svn-base deleted file mode 100644 index dc5b6a7..0000000 --- a/Prebuild/scripts/.svn/text-base/VS2002.bat.svn-base +++ /dev/null @@ -1,4 +0,0 @@ -@rem Generates a solution (.sln) and a set of project files (.csproj) -@rem for Microsoft Visual Studio .NET 2002 -cd .. -Prebuild.exe /target vs2002 /file prebuild.xml /build NET_1_1 /pause diff --git a/Prebuild/scripts/.svn/text-base/VS2003.bat.svn-base b/Prebuild/scripts/.svn/text-base/VS2003.bat.svn-base deleted file mode 100644 index 929a480..0000000 --- a/Prebuild/scripts/.svn/text-base/VS2003.bat.svn-base +++ /dev/null @@ -1,4 +0,0 @@ -@rem Generates a solution (.sln) and a set of project files (.csproj) -@rem for Microsoft Visual Studio .NET 2002 -cd .. -Prebuild.exe /target vs2003 /file prebuild.xml /build NET_1_1 /pause diff --git a/Prebuild/scripts/.svn/text-base/VS2005.bat.svn-base b/Prebuild/scripts/.svn/text-base/VS2005.bat.svn-base deleted file mode 100644 index 7a7af1d..0000000 --- a/Prebuild/scripts/.svn/text-base/VS2005.bat.svn-base +++ /dev/null @@ -1,4 +0,0 @@ -@rem Generates a solution (.sln) and a set of project files (.csproj, .vbproj, etc.) -@rem for Microsoft Visual Studio .NET 2005 -cd .. -Prebuild.exe /target vs2005 /file prebuild.xml /build NET_2_0 /pause diff --git a/Prebuild/scripts/.svn/text-base/VS2008.bat.svn-base b/Prebuild/scripts/.svn/text-base/VS2008.bat.svn-base deleted file mode 100644 index eb51a82..0000000 --- a/Prebuild/scripts/.svn/text-base/VS2008.bat.svn-base +++ /dev/null @@ -1,4 +0,0 @@ -@rem Generates a solution (.sln) and a set of project files (.csproj, .vbproj, etc.) -@rem for Microsoft Visual Studio .NET 2008 -cd .. -Prebuild.exe /target vs2008 /file prebuild.xml /pause diff --git a/Prebuild/scripts/.svn/text-base/VS2010.bat.svn-base b/Prebuild/scripts/.svn/text-base/VS2010.bat.svn-base deleted file mode 100644 index 1b98818..0000000 --- a/Prebuild/scripts/.svn/text-base/VS2010.bat.svn-base +++ /dev/null @@ -1,4 +0,0 @@ -@rem Generates a solution (.sln) and a set of project files (.csproj, .vbproj, etc.) -@rem for Microsoft Visual Studio .NET 2010 -cd .. -Prebuild.exe /target vs2010 /file prebuild.xml /pause diff --git a/Prebuild/scripts/.svn/text-base/autotools.bat.svn-base b/Prebuild/scripts/.svn/text-base/autotools.bat.svn-base deleted file mode 100644 index 43f9a74..0000000 --- a/Prebuild/scripts/.svn/text-base/autotools.bat.svn-base +++ /dev/null @@ -1,4 +0,0 @@ -@rem Generates Makefiles -@rem for autotools -cd .. -Prebuild.exe /target autotools /file prebuild.xml /pause diff --git a/Prebuild/scripts/.svn/text-base/autotools.sh.svn-base b/Prebuild/scripts/.svn/text-base/autotools.sh.svn-base deleted file mode 100644 index 4d140ce..0000000 --- a/Prebuild/scripts/.svn/text-base/autotools.sh.svn-base +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/sh -RUNTIME=`which mono` - -SCRIPTDIR=`dirname $0` -${RUNTIME} ${SCRIPTDIR}/../Prebuild.exe /target autotools /file ${SCRIPTDIR}/../prebuild.xml /build NET_2_0 diff --git a/Prebuild/scripts/.svn/text-base/makefile.bat.svn-base b/Prebuild/scripts/.svn/text-base/makefile.bat.svn-base deleted file mode 100644 index eef9a69..0000000 --- a/Prebuild/scripts/.svn/text-base/makefile.bat.svn-base +++ /dev/null @@ -1,4 +0,0 @@ -@rem Generates makefiles -@rem for make -cd .. -Prebuild.exe /target makefile /file prebuild.xml /pause diff --git a/Prebuild/scripts/.svn/text-base/makefile.sh.svn-base b/Prebuild/scripts/.svn/text-base/makefile.sh.svn-base deleted file mode 100644 index 2e656cb..0000000 --- a/Prebuild/scripts/.svn/text-base/makefile.sh.svn-base +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/sh - -./prebuild /target makefile /file ../prebuild.xml /pause - -if [ -f ../Makefile ] -then - rm -rf ../Makefile -fi - -mv ../Prebuild.make ../Makefile diff --git a/Prebuild/scripts/.svn/text-base/nant.bat.svn-base b/Prebuild/scripts/.svn/text-base/nant.bat.svn-base deleted file mode 100644 index 925467d..0000000 --- a/Prebuild/scripts/.svn/text-base/nant.bat.svn-base +++ /dev/null @@ -1,4 +0,0 @@ -@rem Generates a .build files -@rem for NAnt -cd .. -Prebuild.exe /target nant /file prebuild.xml /pause diff --git a/Prebuild/scripts/.svn/text-base/nant.sh.svn-base b/Prebuild/scripts/.svn/text-base/nant.sh.svn-base deleted file mode 100644 index 0311971..0000000 --- a/Prebuild/scripts/.svn/text-base/nant.sh.svn-base +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -prebuild /target nant /file ../prebuild.xml /pause diff --git a/Prebuild/scripts/.svn/text-base/xcode.bat.svn-base b/Prebuild/scripts/.svn/text-base/xcode.bat.svn-base deleted file mode 100644 index 9883edf..0000000 --- a/Prebuild/scripts/.svn/text-base/xcode.bat.svn-base +++ /dev/null @@ -1,4 +0,0 @@ -@rem Generates a Xcode files -@rem for NAnt -cd .. -Prebuild.exe /target xcode /file prebuild.xml /pause diff --git a/Prebuild/scripts/.svn/text-base/xcode.sh.svn-base b/Prebuild/scripts/.svn/text-base/xcode.sh.svn-base deleted file mode 100644 index e9b58f9..0000000 --- a/Prebuild/scripts/.svn/text-base/xcode.sh.svn-base +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -prebuild /target xcode /file ../prebuild.xml /pause diff --git a/Prebuild/src/.svn/all-wcprops b/Prebuild/src/.svn/all-wcprops deleted file mode 100644 index bafaca9..0000000 --- a/Prebuild/src/.svn/all-wcprops +++ /dev/null @@ -1,23 +0,0 @@ -K 25 -svn:wc:ra_dav:version-url -V 45 -/svnroot/dnpb/!svn/ver/323/trunk/Prebuild/src -END -Prebuild.snk -K 25 -svn:wc:ra_dav:version-url -V 57 -/svnroot/dnpb/!svn/ver/96/trunk/Prebuild/src/Prebuild.snk -END -App.ico -K 25 -svn:wc:ra_dav:version-url -V 52 -/svnroot/dnpb/!svn/ver/96/trunk/Prebuild/src/App.ico -END -Prebuild.cs -K 25 -svn:wc:ra_dav:version-url -V 57 -/svnroot/dnpb/!svn/ver/308/trunk/Prebuild/src/Prebuild.cs -END diff --git a/Prebuild/src/.svn/dir-prop-base b/Prebuild/src/.svn/dir-prop-base deleted file mode 100644 index 68e5483..0000000 --- a/Prebuild/src/.svn/dir-prop-base +++ /dev/null @@ -1,16 +0,0 @@ -K 10 -svn:ignore -V 121 -*.mdp -*.mds -*.pidb -bin -obj -Include.am -Prebuild.csproj -Prebuild.csproj.user -Prebuild.exe.build -Prebuild.prjx -Prebuild.xml - -END diff --git a/Prebuild/src/.svn/entries b/Prebuild/src/.svn/entries deleted file mode 100644 index 8284966..0000000 --- a/Prebuild/src/.svn/entries +++ /dev/null @@ -1,139 +0,0 @@ -10 - -dir -323 -https://dnpb.svn.sourceforge.net/svnroot/dnpb/trunk/Prebuild/src -https://dnpb.svn.sourceforge.net/svnroot/dnpb - - - -2010-09-10T17:51:36.189738Z -323 -jhurliman -has-props - - - - - - - - - - - - - -3355ff64-970d-0410-bbe8-d0fbd18be4fb - -Prebuild.snk -file - - - - -2010-09-10T22:51:45.000000Z -89097ad015e09b35fc896e2128dea94d -2006-01-19T19:45:13.000000Z -45 -jendave -has-props - - - - - - - - - - - - - - - - - - - - -596 - -Core -dir - -data -dir - -App.ico -file - - - - -2010-09-10T22:51:45.000000Z -4ee5c8b292635af0bf1247d425ba2c0d -2006-01-27T21:30:44.000000Z -68 -jendave -has-props - - - - - - - - - - - - - - - - - - - - -4286 - -Prebuild.cs -file - - - - -2010-09-10T22:51:45.000000Z -55ae2c874ce7e9ab7f33cd6f75926733 -2009-04-15T01:33:14.373570Z -308 -kunnis -has-props - - - - - - - - - - - - - - - - - - - - -5040 - -Properties -dir - diff --git a/Prebuild/src/.svn/prop-base/App.ico.svn-base b/Prebuild/src/.svn/prop-base/App.ico.svn-base deleted file mode 100644 index 5e9587e..0000000 --- a/Prebuild/src/.svn/prop-base/App.ico.svn-base +++ /dev/null @@ -1,5 +0,0 @@ -K 13 -svn:mime-type -V 24 -application/octet-stream -END diff --git a/Prebuild/src/.svn/prop-base/Prebuild.cs.svn-base b/Prebuild/src/.svn/prop-base/Prebuild.cs.svn-base deleted file mode 100644 index 7b57b30..0000000 --- a/Prebuild/src/.svn/prop-base/Prebuild.cs.svn-base +++ /dev/null @@ -1,9 +0,0 @@ -K 13 -svn:eol-style -V 6 -native -K 12 -svn:keywords -V 23 -Author Date Id Revision -END diff --git a/Prebuild/src/.svn/prop-base/Prebuild.snk.svn-base b/Prebuild/src/.svn/prop-base/Prebuild.snk.svn-base deleted file mode 100644 index 5e9587e..0000000 --- a/Prebuild/src/.svn/prop-base/Prebuild.snk.svn-base +++ /dev/null @@ -1,5 +0,0 @@ -K 13 -svn:mime-type -V 24 -application/octet-stream -END diff --git a/Prebuild/src/.svn/text-base/App.ico.svn-base b/Prebuild/src/.svn/text-base/App.ico.svn-base deleted file mode 100644 index ac4ea6f..0000000 Binary files a/Prebuild/src/.svn/text-base/App.ico.svn-base and /dev/null differ diff --git a/Prebuild/src/.svn/text-base/Prebuild.cs.svn-base b/Prebuild/src/.svn/text-base/Prebuild.cs.svn-base deleted file mode 100644 index c485665..0000000 --- a/Prebuild/src/.svn/text-base/Prebuild.cs.svn-base +++ /dev/null @@ -1,165 +0,0 @@ -#region BSD License -/* -Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com) - -Redistribution and use in source and binary forms, with or without modification, are permitted -provided that the following conditions are met: - -* Redistributions of source code must retain the above copyright notice, this list of conditions - and the following disclaimer. -* Redistributions in binary form must reproduce the above copyright notice, this list of conditions - and the following disclaimer in the documentation and/or other materials provided with the - distribution. -* The name of the author may not be used to endorse or promote products derived from this software - without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, -BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY -OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING -IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ -#endregion - -#region CVS Information -/* - * $Source$ - * $Author$ - * $Date$ - * $Revision$ - */ -#endregion - -using System; -using System.Collections.Specialized; -using System.IO; -using System.Reflection; -using System.Runtime.InteropServices; -using System.EnterpriseServices.Internal; - -using Prebuild.Core; -using Prebuild.Core.Utilities; - -namespace Prebuild -{ - /// - /// - /// - class Prebuild - { - #region Main - - [STAThread] - static void Main(string[] args) - { - Kernel kernel = null; - try - { - kernel = Kernel.Instance; - kernel.Initialize(LogTargets.File | LogTargets.Console, args); - bool exit = false; - - if(kernel.CommandLine.WasPassed("usage")) - { - exit = true; - OutputUsage(); - } - if(kernel.CommandLine.WasPassed("showtargets")) - { - exit = true; - OutputTargets(kernel); - } - if(kernel.CommandLine.WasPassed("install")) - { - exit = true; - InstallAssembly(kernel); - } - if(kernel.CommandLine.WasPassed("remove")) - { - exit = true; - RemoveAssembly(kernel); - } - - if(!exit) - { - kernel.Process(); - } - } -#if !DEBUG - catch (Exception ex) - { - Console.WriteLine("Unhandled error: {0}", ex.Message); - Console.WriteLine("{0}", ex.StackTrace); - } -#endif - finally - { - if(kernel != null && kernel.PauseAfterFinish) - { - Console.WriteLine("\nPress enter to continue..."); - Console.ReadLine(); - } - } - } - - #endregion - - #region Private Methods - - private static void InstallAssembly(Kernel kernel) - { - Publish publish = new Publish(); - string file = kernel.CommandLine["install"]; - //Console.WriteLine(".."+file+".."); - publish.GacInstall(file); - } - - private static void RemoveAssembly(Kernel kernel) - { - Publish publish = new Publish(); - string file = kernel.CommandLine["remove"]; - publish.GacRemove(file); - } - - private static void OutputUsage() - { - Console.WriteLine("Usage: prebuild /target [options]"); - Console.WriteLine("Available command-line switches:"); - Console.WriteLine(); - Console.WriteLine("/target Target for Prebuild"); - Console.WriteLine("/clean Clean the build files for the given target"); - Console.WriteLine("/file XML file to process"); - Console.WriteLine("/log Log file to write to"); - Console.WriteLine("/ppo Pre-process the file, but perform no other processing"); - Console.WriteLine("/pause Pauses the application after execution to view the output"); - Console.WriteLine("/yes Default to yes to any questions asked"); - Console.WriteLine("/install Install assembly into the GAC"); - Console.WriteLine("/remove Remove assembly from the GAC"); - Console.WriteLine(); - Console.WriteLine("See 'prebuild /showtargets for a list of available targets"); - Console.WriteLine("See readme.txt or check out http://dnpb.sourceforge.net for more information"); - Console.WriteLine(); - } - - private static void OutputTargets(Kernel kern) - { - Console.WriteLine("Targets available in Prebuild:"); - Console.WriteLine(""); - if(kern.Targets.Keys.Count > 0) - { - string[] targs = new string[kern.Targets.Keys.Count]; - kern.Targets.Keys.CopyTo(targs, 0); - Array.Sort(targs); - foreach(string target in targs) - { - Console.WriteLine(target); - } - } - Console.WriteLine(""); - } - - #endregion - } -} diff --git a/Prebuild/src/.svn/text-base/Prebuild.snk.svn-base b/Prebuild/src/.svn/text-base/Prebuild.snk.svn-base deleted file mode 100644 index f9dce05..0000000 Binary files a/Prebuild/src/.svn/text-base/Prebuild.snk.svn-base and /dev/null differ diff --git a/Prebuild/src/Core/.svn/all-wcprops b/Prebuild/src/Core/.svn/all-wcprops deleted file mode 100644 index 5da53cf..0000000 --- a/Prebuild/src/Core/.svn/all-wcprops +++ /dev/null @@ -1,29 +0,0 @@ -K 25 -svn:wc:ra_dav:version-url -V 50 -/svnroot/dnpb/!svn/ver/323/trunk/Prebuild/src/Core -END -Kernel.cs -K 25 -svn:wc:ra_dav:version-url -V 60 -/svnroot/dnpb/!svn/ver/323/trunk/Prebuild/src/Core/Kernel.cs -END -UnknownLanguageException.cs -K 25 -svn:wc:ra_dav:version-url -V 77 -/svnroot/dnpb/!svn/ver/96/trunk/Prebuild/src/Core/UnknownLanguageException.cs -END -WarningException.cs -K 25 -svn:wc:ra_dav:version-url -V 70 -/svnroot/dnpb/!svn/ver/298/trunk/Prebuild/src/Core/WarningException.cs -END -FatalException.cs -K 25 -svn:wc:ra_dav:version-url -V 68 -/svnroot/dnpb/!svn/ver/295/trunk/Prebuild/src/Core/FatalException.cs -END diff --git a/Prebuild/src/Core/.svn/dir-prop-base b/Prebuild/src/Core/.svn/dir-prop-base deleted file mode 100644 index a1989a0..0000000 --- a/Prebuild/src/Core/.svn/dir-prop-base +++ /dev/null @@ -1,5 +0,0 @@ -K 10 -svn:ignore -V 5 -*.swp -END diff --git a/Prebuild/src/Core/.svn/entries b/Prebuild/src/Core/.svn/entries deleted file mode 100644 index 8497de9..0000000 --- a/Prebuild/src/Core/.svn/entries +++ /dev/null @@ -1,182 +0,0 @@ -10 - -dir -323 -https://dnpb.svn.sourceforge.net/svnroot/dnpb/trunk/Prebuild/src/Core -https://dnpb.svn.sourceforge.net/svnroot/dnpb - - - -2010-09-10T17:51:36.189738Z -323 -jhurliman -has-props - - - - - - - - - - - - - -3355ff64-970d-0410-bbe8-d0fbd18be4fb - -Interfaces -dir - -Kernel.cs -file - - - - -2010-09-10T22:51:44.000000Z -0fc816c335568995dd3f89bd47452727 -2010-09-10T17:51:36.189738Z -323 -jhurliman -has-props - - - - - - - - - - - - - - - - - - - - -20883 - -Attributes -dir - -UnknownLanguageException.cs -file - - - - -2010-09-10T22:51:44.000000Z -5ecd3d9972f0d59ad6c2b37b81c9aa6d -2006-01-28T00:49:58.000000Z -71 -jendave -has-props - - - - - - - - - - - - - - - - - - - - -1764 - -Nodes -dir - -WarningException.cs -file - - - - -2010-09-10T22:51:44.000000Z -316bb4928be4041587e4f12a29f7ccd6 -2009-02-20T02:15:45.530129Z -298 -kunnis -has-props - - - - - - - - - - - - - - - - - - - - -2625 - -Targets -dir - -Parse -dir - -FatalException.cs -file - - - - -2010-09-10T22:51:44.000000Z -1a328443d0e4a2705efc142c1161959b -2009-02-19T06:47:52.218324Z -295 -kunnis -has-props - - - - - - - - - - - - - - - - - - - - -2776 - -Utilities -dir - diff --git a/Prebuild/src/Core/.svn/prop-base/FatalException.cs.svn-base b/Prebuild/src/Core/.svn/prop-base/FatalException.cs.svn-base deleted file mode 100644 index 7b57b30..0000000 --- a/Prebuild/src/Core/.svn/prop-base/FatalException.cs.svn-base +++ /dev/null @@ -1,9 +0,0 @@ -K 13 -svn:eol-style -V 6 -native -K 12 -svn:keywords -V 23 -Author Date Id Revision -END diff --git a/Prebuild/src/Core/.svn/prop-base/Kernel.cs.svn-base b/Prebuild/src/Core/.svn/prop-base/Kernel.cs.svn-base deleted file mode 100644 index 7b57b30..0000000 --- a/Prebuild/src/Core/.svn/prop-base/Kernel.cs.svn-base +++ /dev/null @@ -1,9 +0,0 @@ -K 13 -svn:eol-style -V 6 -native -K 12 -svn:keywords -V 23 -Author Date Id Revision -END diff --git a/Prebuild/src/Core/.svn/prop-base/UnknownLanguageException.cs.svn-base b/Prebuild/src/Core/.svn/prop-base/UnknownLanguageException.cs.svn-base deleted file mode 100644 index 7b57b30..0000000 --- a/Prebuild/src/Core/.svn/prop-base/UnknownLanguageException.cs.svn-base +++ /dev/null @@ -1,9 +0,0 @@ -K 13 -svn:eol-style -V 6 -native -K 12 -svn:keywords -V 23 -Author Date Id Revision -END diff --git a/Prebuild/src/Core/.svn/prop-base/WarningException.cs.svn-base b/Prebuild/src/Core/.svn/prop-base/WarningException.cs.svn-base deleted file mode 100644 index 7b57b30..0000000 --- a/Prebuild/src/Core/.svn/prop-base/WarningException.cs.svn-base +++ /dev/null @@ -1,9 +0,0 @@ -K 13 -svn:eol-style -V 6 -native -K 12 -svn:keywords -V 23 -Author Date Id Revision -END diff --git a/Prebuild/src/Core/.svn/text-base/FatalException.cs.svn-base b/Prebuild/src/Core/.svn/text-base/FatalException.cs.svn-base deleted file mode 100644 index 3487905..0000000 --- a/Prebuild/src/Core/.svn/text-base/FatalException.cs.svn-base +++ /dev/null @@ -1,85 +0,0 @@ -#region BSD License -/* -Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com) - -Redistribution and use in source and binary forms, with or without modification, are permitted -provided that the following conditions are met: - -* Redistributions of source code must retain the above copyright notice, this list of conditions - and the following disclaimer. -* Redistributions in binary form must reproduce the above copyright notice, this list of conditions - and the following disclaimer in the documentation and/or other materials provided with the - distribution. -* The name of the author may not be used to endorse or promote products derived from this software - without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, -BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY -OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING -IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ -#endregion - -using System; -using System.Runtime.Serialization; - -namespace Prebuild.Core -{ - /// - /// - /// - [Serializable()] - public class FatalException : Exception - { - #region Constructors - - - /// - /// Initializes a new instance of the class. - /// - public FatalException() - { - } - - /// - /// Initializes a new instance of the class. - /// - /// The format. - /// The args. - public FatalException(string format, params object[] args) - : base(String.Format(format, args)) - { - } - - /// - /// Exception with specified string - /// - /// Exception message - public FatalException(string message): base(message) - { - } - - /// - /// - /// - /// - /// - public FatalException(string message, Exception exception) : base(message, exception) - { - } - - /// - /// - /// - /// - /// - protected FatalException(SerializationInfo info, StreamingContext context) : base( info, context ) - { - } - - #endregion - } -} diff --git a/Prebuild/src/Core/.svn/text-base/Kernel.cs.svn-base b/Prebuild/src/Core/.svn/text-base/Kernel.cs.svn-base deleted file mode 100644 index 67051d5..0000000 --- a/Prebuild/src/Core/.svn/text-base/Kernel.cs.svn-base +++ /dev/null @@ -1,832 +0,0 @@ -#region BSD License -/* -Copyright (c) 2004-2008 -Matthew Holmes (matthew@wildfiregames.com), -Dan Moorehead (dan05a@gmail.com), -Rob Loach (http://www.robloach.net), -C.J. Adams-Collier (cjac@colliertech.org) - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - -* Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - -* Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - -* The name of the author may not be used to endorse or promote - products derived from this software without specific prior written - permission. - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR -IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, -INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, -STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING -IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -POSSIBILITY OF SUCH DAMAGE. - -*/ -#endregion - -#define NO_VALIDATE - -using System; -using System.Collections.Generic; -using System.IO; -using System.Reflection; -using System.Xml; -using System.Xml.Schema; -using Prebuild.Core.Attributes; -using Prebuild.Core.Interfaces; -using Prebuild.Core.Nodes; -using Prebuild.Core.Utilities; - -namespace Prebuild.Core -{ - /// - /// - /// - public class Kernel : IDisposable - { - #region Inner Classes - - private struct NodeEntry - { - public Type Type; - public DataNodeAttribute Attribute; - } - - #endregion - - #region Fields - - private static readonly Kernel m_Instance = new Kernel(); - - /// - /// This must match the version of the schema that is embeeded - /// - private const string m_SchemaVersion = "1.9"; - private const string m_Schema = "prebuild-" + m_SchemaVersion + ".xsd"; - private const string m_SchemaURI = "http://dnpb.sourceforge.net/schemas/" + m_Schema; - bool disposed; - private Version m_Version; - private const string m_Revision = ""; - private CommandLineCollection m_CommandLine; - private Log m_Log; - private CurrentDirectory m_CurrentWorkingDirectory; - private XmlSchemaCollection m_Schemas; - - private readonly Dictionary m_Targets = new Dictionary(); - private readonly Dictionary m_Nodes = new Dictionary(); - - readonly List m_Solutions = new List(); - string m_Target; - string m_Clean; - string[] m_RemoveDirectories; - XmlDocument m_CurrentDoc; - bool m_PauseAfterFinish; - string[] m_ProjectGroups; - - #endregion - - #region Constructors - - private Kernel() - { - } - - #endregion - - #region Properties - - /// - /// Gets a value indicating whether [pause after finish]. - /// - /// true if [pause after finish]; otherwise, false. - public bool PauseAfterFinish - { - get - { - return m_PauseAfterFinish; - } - } - - /// - /// Gets the instance. - /// - /// The instance. - public static Kernel Instance - { - get - { - return m_Instance; - } - } - - /// - /// Gets the version. - /// - /// The version. - public string Version - { - get - { - return String.Format("{0}.{1}.{2}{3}", m_Version.Major, m_Version.Minor, m_Version.Build, m_Revision); - } - } - - /// - /// Gets the command line. - /// - /// The command line. - public CommandLineCollection CommandLine - { - get - { - return m_CommandLine; - } - } - - /// - /// Gets the targets. - /// - /// The targets. - public Dictionary Targets - { - get - { - return m_Targets; - } - } - - /// - /// Gets the log. - /// - /// The log. - public Log Log - { - get - { - return m_Log; - } - } - - /// - /// Gets the current working directory. - /// - /// The current working directory. - public CurrentDirectory CurrentWorkingDirectory - { - get - { - return m_CurrentWorkingDirectory; - } - } - - /// - /// Gets the solutions. - /// - /// The solutions. - public List Solutions - { - get - { - return m_Solutions; - } - } - - /// - /// Gets the XmlDocument object representing the prebuild.xml - /// being processed - /// - /// The XmlDocument object - public XmlDocument CurrentDoc - { - get - { - return m_CurrentDoc; - } - } - - #endregion - - #region Private Methods - - private static void RemoveDirectories(string rootDir, string[] dirNames) - { - foreach(string dir in Directory.GetDirectories(rootDir)) - { - string simpleName = Path.GetFileName(dir); - - if(Array.IndexOf(dirNames, simpleName) != -1) - { - //delete if the name matches one of the directory names to delete - string fullDirPath = Path.GetFullPath(dir); - Directory.Delete(fullDirPath,true); - } - else//not a match, so check children - { - RemoveDirectories(dir,dirNames); - //recurse, checking children for them - } - } - } - -// private void RemoveDirectoryMatches(string rootDir, string dirPattern) -// { -// foreach(string dir in Directory.GetDirectories(rootDir)) -// { -// foreach(string match in Directory.GetDirectories(dir)) -// {//delete all child directories that match -// Directory.Delete(Path.GetFullPath(match),true); -// } -// //recure through the rest checking for nested matches to delete -// RemoveDirectoryMatches(dir,dirPattern); -// } -// } - - private void LoadSchema() - { - Assembly assembly = GetType().Assembly; - Stream stream = assembly.GetManifestResourceStream("Prebuild.data." + m_Schema); - if(stream == null) - { - //try without the default namespace prepending to it in case was compiled with SharpDevelop or MonoDevelop instead of Visual Studio .NET - stream = assembly.GetManifestResourceStream(m_Schema); - if(stream == null) - { - throw new System.Reflection.TargetException(string.Format("Could not find the scheme embedded resource file '{0}'.", m_Schema)); - } - } - XmlReader schema = new XmlTextReader(stream); - - m_Schemas = new XmlSchemaCollection(); - m_Schemas.Add(m_SchemaURI, schema); - } - - private void CacheVersion() - { - m_Version = Assembly.GetEntryAssembly().GetName().Version; - } - - private void CacheTargets(Assembly assm) - { - foreach(Type t in assm.GetTypes()) - { - TargetAttribute ta = (TargetAttribute)Helper.CheckType(t, typeof(TargetAttribute), typeof(ITarget)); - - if(ta == null) - continue; - - if (t.IsAbstract) - continue; - - ITarget target = (ITarget)assm.CreateInstance(t.FullName); - if (target == null) - { - throw new MissingMethodException("Could not create ITarget instance"); - } - - m_Targets[ta.Name] = target; - } - } - - private void CacheNodeTypes(Assembly assm) - { - foreach(Type t in assm.GetTypes()) - { - foreach (DataNodeAttribute dna in t.GetCustomAttributes(typeof(DataNodeAttribute), true)) - { - NodeEntry ne = new NodeEntry(); - ne.Type = t; - ne.Attribute = dna; - m_Nodes[dna.Name] = ne; - } - } - } - - private void LogBanner() - { - m_Log.Write("Prebuild v" + Version); - m_Log.Write("Copyright (c) 2004-2010"); - m_Log.Write("Matthew Holmes (matthew@wildfiregames.com),"); - m_Log.Write("Dan Moorehead (dan05a@gmail.com),"); - m_Log.Write("David Hudson (jendave@yahoo.com),"); - m_Log.Write("Rob Loach (http://www.robloach.net),"); - m_Log.Write("C.J. Adams-Collier (cjac@colliertech.org),"); - m_Log.Write("John Hurliman (john.hurliman@intel.com),"); - - m_Log.Write("See 'prebuild /usage' for help"); - m_Log.Write(); - } - - - - private void ProcessFile(string file) - { - ProcessFile(file, m_Solutions); - } - - public void ProcessFile(ProcessNode node, SolutionNode parent) - { - if (node.IsValid) - { - List list = new List(); - ProcessFile(node.Path, list); - - foreach (SolutionNode solution in list) - parent.SolutionsTable[solution.Name] = solution; - } - } - - /// - /// - /// - /// - /// - /// - public void ProcessFile(string file, IList solutions) - { - m_CurrentWorkingDirectory.Push(); - - string path = file; - try - { - try - { - path = Helper.ResolvePath(path); - } - catch(ArgumentException) - { - m_Log.Write("Could not open Prebuild file: " + path); - m_CurrentWorkingDirectory.Pop(); - return; - } - - Helper.SetCurrentDir(Path.GetDirectoryName(path)); - - XmlTextReader reader = new XmlTextReader(path); - - Core.Parse.Preprocessor pre = new Core.Parse.Preprocessor(); - - //register command line arguments as XML variables - IEnumerator> dict = m_CommandLine.GetEnumerator(); - while (dict.MoveNext()) - { - string name = dict.Current.Key.Trim(); - if (name.Length > 0) - pre.RegisterVariable(name, dict.Current.Value); - } - - string xml = pre.Process(reader);//remove script and evaulate pre-proccessing to get schema-conforming XML - - // See if the user put into a pseudo target of "prebuild:preprocessed-input" to indicate they want to see the - // output before the system processes it. - if (m_CommandLine.WasPassed("ppi")) - { - // Get the filename if there is one, otherwise use a default. - string ppiFile = m_CommandLine["ppi"]; - if (ppiFile == null || ppiFile.Trim().Length == 0) - { - ppiFile = "preprocessed-input.xml"; - } - - // Write out the string to the given stream. - try - { - using (StreamWriter ppiWriter = new StreamWriter(ppiFile)) - { - ppiWriter.WriteLine(xml); - } - } - catch(IOException ex) - { - Console.WriteLine("Could not write PPI file '{0}': {1}", ppiFile, ex.Message); - } - - // Finish processing this special tag. - return; - } - - m_CurrentDoc = new XmlDocument(); - try - { -#if NO_VALIDATE - XmlReader validator = XmlReader.Create(new StringReader(xml)); - m_CurrentDoc.Load(validator); -#else - XmlValidatingReader validator = new XmlValidatingReader(new XmlTextReader(new StringReader(xml))); - - //validate while reading from string into XmlDocument DOM structure in memory - foreach(XmlSchema schema in m_Schemas) - { - validator.Schemas.Add(schema); - } - m_CurrentDoc.Load(validator); -#endif - } - catch(XmlException e) - { - throw new XmlException(e.ToString()); - } - - //is there a purpose to writing it? An syntax/schema problem would have been found during pre.Process() and reported with details - if(m_CommandLine.WasPassed("ppo")) - { - string ppoFile = m_CommandLine["ppo"]; - if(ppoFile == null || ppoFile.Trim().Length < 1) - { - ppoFile = "preprocessed.xml"; - } - - StreamWriter writer = null; - try - { - writer = new StreamWriter(ppoFile); - writer.Write(xml); - } - catch(IOException ex) - { - Console.WriteLine("Could not write PPO file '{0}': {1}", ppoFile, ex.Message); - } - finally - { - if(writer != null) - { - writer.Close(); - } - } - return; - } - //start reading the xml config file - XmlElement rootNode = m_CurrentDoc.DocumentElement; - //string suggestedVersion = Helper.AttributeValue(rootNode,"version","1.0"); - Helper.CheckForOSVariables = Helper.ParseBoolean(rootNode,"checkOsVars",false); - - foreach(XmlNode node in rootNode.ChildNodes)//solutions or if pre-proc instructions - { - IDataNode dataNode = ParseNode(node, null); - if(dataNode is ProcessNode) - { - ProcessNode proc = (ProcessNode)dataNode; - if(proc.IsValid) - { - ProcessFile(proc.Path); - } - } - else if(dataNode is SolutionNode) - { - solutions.Add((SolutionNode)dataNode); - } - } - } - catch(XmlSchemaException xse) - { - m_Log.Write("XML validation error at line {0} in {1}:\n\n{2}", - xse.LineNumber, path, xse.Message); - } - finally - { - m_CurrentWorkingDirectory.Pop(); - } - } - - #endregion - - #region Public Methods - - /// - /// Allows the project. - /// - /// The project groups flags. - /// - public bool AllowProject(string projectGroupsFlags) - { - if(m_ProjectGroups != null && m_ProjectGroups.Length > 0) - { - if(projectGroupsFlags != null && projectGroupsFlags.Length == 0) - { - foreach(string group in projectGroupsFlags.Split('|')) - { - if(Array.IndexOf(m_ProjectGroups, group) != -1) //if included in the filter list - { - return true; - } - } - } - return false;//not included in the list or no groups specified for the project - } - return true;//no filter specified in the command line args - } - - /// - /// Gets the type of the node. - /// - /// The node. - /// - public Type GetNodeType(XmlNode node) - { - if( node == null ) - { - throw new ArgumentNullException("node"); - } - if(!m_Nodes.ContainsKey(node.Name)) - { - return null; - } - - NodeEntry ne = m_Nodes[node.Name]; - return ne.Type; - } - - /// - /// - /// - /// - /// - /// - public IDataNode ParseNode(XmlNode node, IDataNode parent) - { - return ParseNode(node, parent, null); - } - - //Create an instance of the data node type that is mapped to the name of the xml DOM node - /// - /// Parses the node. - /// - /// The node. - /// The parent. - /// The pre node. - /// - public IDataNode ParseNode(XmlNode node, IDataNode parent, IDataNode preNode) - { - IDataNode dataNode; - - try - { - if( node == null ) - { - throw new ArgumentNullException("node"); - } - if(preNode == null) - { - if(!m_Nodes.ContainsKey(node.Name)) - { - Console.WriteLine("WARNING: Unknown XML node: " + node.Name); - return null; - } - - NodeEntry ne = m_Nodes[node.Name]; - Type type = ne.Type; - //DataNodeAttribute dna = ne.Attribute; - - dataNode = (IDataNode)type.Assembly.CreateInstance(type.FullName); - if(dataNode == null) - { - throw new System.Reflection.TargetException("Could not create new parser instance: " + type.FullName); - } - } - else - dataNode = preNode; - - dataNode.Parent = parent; - dataNode.Parse(node); - } - catch(WarningException wex) - { - m_Log.Write(LogType.Warning, wex.Message); - return null; - } - catch(FatalException fex) - { - m_Log.WriteException(LogType.Error, fex); - throw; - } - catch(Exception ex) - { - m_Log.WriteException(LogType.Error, ex); - throw; - } - - return dataNode; - } - - /// - /// Initializes the specified target. - /// - /// The target. - /// The args. - public void Initialize(LogTargets target, string[] args) - { - CacheTargets(GetType().Assembly); - CacheNodeTypes(GetType().Assembly); - CacheVersion(); - - m_CommandLine = new CommandLineCollection(args); - - string logFile = null; - if(m_CommandLine.WasPassed("log")) - { - logFile = m_CommandLine["log"]; - - if(logFile != null && logFile.Length == 0) - { - logFile = "Prebuild.log"; - } - } - else - { - target = target & ~LogTargets.File; //dont output to a file - } - - m_Log = new Log(target, logFile); - LogBanner(); - - m_CurrentWorkingDirectory = new CurrentDirectory(); - - m_Target = m_CommandLine["target"]; - m_Clean = m_CommandLine["clean"]; - string removeDirs = m_CommandLine["removedir"]; - if(removeDirs != null && removeDirs.Length == 0) - { - m_RemoveDirectories = removeDirs.Split('|'); - } - - string flags = m_CommandLine["allowedgroups"];//allows filtering by specifying a pipe-delimited list of groups to include - if(flags != null && flags.Length == 0) - { - m_ProjectGroups = flags.Split('|'); - } - m_PauseAfterFinish = m_CommandLine.WasPassed("pause"); - - LoadSchema(); - } - - /// - /// Processes this instance. - /// - public void Process() - { - bool perfomedOtherTask = false; - if(m_RemoveDirectories != null && m_RemoveDirectories.Length > 0) - { - try - { - RemoveDirectories(".",m_RemoveDirectories); - } - catch(IOException e) - { - m_Log.Write("Failed to remove directories named {0}",m_RemoveDirectories); - m_Log.WriteException(LogType.Error,e); - } - catch(UnauthorizedAccessException e) - { - m_Log.Write("Failed to remove directories named {0}",m_RemoveDirectories); - m_Log.WriteException(LogType.Error,e); - } - perfomedOtherTask = true; - } - - if(m_Target != null && m_Clean != null) - { - m_Log.Write(LogType.Error, "The options /target and /clean cannot be passed together"); - return; - } - - if(m_Target == null && m_Clean == null) - { - if(perfomedOtherTask) //finished - { - return; - } - m_Log.Write(LogType.Error, "Must pass either /target or /clean to process a Prebuild file"); - return; - } - - string file = "./prebuild.xml"; - if(m_CommandLine.WasPassed("file")) - { - file = m_CommandLine["file"]; - } - - ProcessFile(file); - - string target = (m_Target != null ? m_Target.ToLower() : m_Clean.ToLower()); - bool clean = (m_Target == null); - if(clean && target != null && target.Length == 0) - { - target = "all"; - } - if(clean && target == "all")//default to all if no target was specified for clean - { - //check if they passed yes - if (!m_CommandLine.WasPassed("yes")) - { - Console.WriteLine("WARNING: This operation will clean ALL project files for all targets, are you sure? (y/n):"); - string ret = Console.ReadLine(); - if(ret == null) - { - return; - } - ret = ret.Trim().ToLower(); - if((ret.ToLower() != "y" && ret.ToLower() != "yes")) - { - return; - } - } - //clean all targets (just cleaning vs2002 target didn't clean nant) - foreach(ITarget targ in m_Targets.Values) - { - targ.Clean(this); - } - } - else - { - if (!m_Targets.ContainsKey(target)) { - m_Log.Write(LogType.Error, "Unknown Target \"{0}\"", target); - return; - } - ITarget targ = m_Targets[target]; - - if(clean) - { - targ.Clean(this); - } - else - { - targ.Write(this); - } - } - - m_Log.Flush(); - } - - #endregion - - #region IDisposable Members - - /// - /// - /// - public void Dispose() - { - Dispose(true); - GC.SuppressFinalize(this); - } - - /// - /// Dispose objects - /// - /// - /// If true, it will dispose close the handle - /// - /// - /// Will dispose managed and unmanaged resources. - /// - protected virtual void Dispose(bool disposing) - { - if (!disposed) - { - if (disposing) - { - GC.SuppressFinalize(this); - if (m_Log != null) - { - m_Log.Close(); - m_Log = null; - } - } - } - disposed = true; - } - - /// - /// - /// - ~Kernel() - { - Dispose(false); - } - - /// - /// Closes and destroys this object - /// - /// - /// Same as Dispose(true) - /// - public void Close() - { - Dispose(); - } - - #endregion - } -} diff --git a/Prebuild/src/Core/.svn/text-base/UnknownLanguageException.cs.svn-base b/Prebuild/src/Core/.svn/text-base/UnknownLanguageException.cs.svn-base deleted file mode 100644 index 607b66c..0000000 --- a/Prebuild/src/Core/.svn/text-base/UnknownLanguageException.cs.svn-base +++ /dev/null @@ -1,63 +0,0 @@ -/* - * $RCSfile$ - * Copyright (C) 2004, 2005 David Hudson (jendave@yahoo.com) - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -using System; -using System.Runtime.Serialization; - -namespace Prebuild.Core -{ - /// - /// - [Serializable()] - public class UnknownLanguageException : Exception - { - /// - /// Basic exception. - /// - public UnknownLanguageException() - { - } - - /// - /// Exception with specified string - /// - /// Exception message - public UnknownLanguageException(string message): base(message) - { - } - - /// - /// - /// - /// - /// - public UnknownLanguageException(string message, Exception exception) : base(message, exception) - { - } - - /// - /// - /// - /// - /// - protected UnknownLanguageException(SerializationInfo info, StreamingContext context) : base( info, context ) - { - } - } -} diff --git a/Prebuild/src/Core/.svn/text-base/WarningException.cs.svn-base b/Prebuild/src/Core/.svn/text-base/WarningException.cs.svn-base deleted file mode 100644 index b7c3668..0000000 --- a/Prebuild/src/Core/.svn/text-base/WarningException.cs.svn-base +++ /dev/null @@ -1,84 +0,0 @@ -#region BSD License -/* -Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com) - -Redistribution and use in source and binary forms, with or without modification, are permitted -provided that the following conditions are met: - -* Redistributions of source code must retain the above copyright notice, this list of conditions - and the following disclaimer. -* Redistributions in binary form must reproduce the above copyright notice, this list of conditions - and the following disclaimer in the documentation and/or other materials provided with the - distribution. -* The name of the author may not be used to endorse or promote products derived from this software - without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, -BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY -OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING -IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ -#endregion - -using System; -using System.Runtime.Serialization; - -namespace Prebuild.Core -{ - /// - /// - /// - [Serializable] - public class WarningException : Exception - { - #region Constructors - - /// - /// - /// - public WarningException() - { - } - - /// - /// - /// - /// - /// - public WarningException(string format, params object[] args) - : base(String.Format(format, args)) - { - } - - /// - /// Exception with specified string - /// - /// Exception message - public WarningException(string message): base(message) - { - } - - /// - /// - /// - /// - /// - public WarningException(string message, Exception exception) : base(message, exception) - { - } - - /// - /// - /// - /// - /// - protected WarningException(SerializationInfo info, StreamingContext context) : base( info, context ) - { - } - - #endregion - } -} diff --git a/Prebuild/src/Core/Attributes/.svn/all-wcprops b/Prebuild/src/Core/Attributes/.svn/all-wcprops deleted file mode 100644 index bb28016..0000000 --- a/Prebuild/src/Core/Attributes/.svn/all-wcprops +++ /dev/null @@ -1,23 +0,0 @@ -K 25 -svn:wc:ra_dav:version-url -V 61 -/svnroot/dnpb/!svn/ver/295/trunk/Prebuild/src/Core/Attributes -END -OptionNodeAttribute.cs -K 25 -svn:wc:ra_dav:version-url -V 84 -/svnroot/dnpb/!svn/ver/295/trunk/Prebuild/src/Core/Attributes/OptionNodeAttribute.cs -END -DataNodeAttribute.cs -K 25 -svn:wc:ra_dav:version-url -V 82 -/svnroot/dnpb/!svn/ver/295/trunk/Prebuild/src/Core/Attributes/DataNodeAttribute.cs -END -TargetAttribute.cs -K 25 -svn:wc:ra_dav:version-url -V 80 -/svnroot/dnpb/!svn/ver/295/trunk/Prebuild/src/Core/Attributes/TargetAttribute.cs -END diff --git a/Prebuild/src/Core/Attributes/.svn/dir-prop-base b/Prebuild/src/Core/Attributes/.svn/dir-prop-base deleted file mode 100644 index a1989a0..0000000 --- a/Prebuild/src/Core/Attributes/.svn/dir-prop-base +++ /dev/null @@ -1,5 +0,0 @@ -K 10 -svn:ignore -V 5 -*.swp -END diff --git a/Prebuild/src/Core/Attributes/.svn/entries b/Prebuild/src/Core/Attributes/.svn/entries deleted file mode 100644 index 1ce535e..0000000 --- a/Prebuild/src/Core/Attributes/.svn/entries +++ /dev/null @@ -1,130 +0,0 @@ -10 - -dir -323 -https://dnpb.svn.sourceforge.net/svnroot/dnpb/trunk/Prebuild/src/Core/Attributes -https://dnpb.svn.sourceforge.net/svnroot/dnpb - - - -2009-02-19T06:47:52.218324Z -295 -kunnis -has-props - - - - - - - - - - - - - -3355ff64-970d-0410-bbe8-d0fbd18be4fb - -OptionNodeAttribute.cs -file - - - - -2010-09-10T22:51:44.000000Z -fe1b8740374f76dcb84f73de54376d48 -2009-02-19T06:47:52.218324Z -295 -kunnis -has-props - - - - - - - - - - - - - - - - - - - - -2240 - -DataNodeAttribute.cs -file - - - - -2010-09-10T22:51:44.000000Z -7988716ebc1c723842814e3eec197831 -2009-02-19T06:47:52.218324Z -295 -kunnis -has-props - - - - - - - - - - - - - - - - - - - - -2270 - -TargetAttribute.cs -file - - - - -2010-09-10T22:51:44.000000Z -766d4782c2b50f82a7c98e1eb968f42d -2009-02-19T06:47:52.218324Z -295 -kunnis -has-props - - - - - - - - - - - - - - - - - - - - -2194 - diff --git a/Prebuild/src/Core/Attributes/.svn/prop-base/DataNodeAttribute.cs.svn-base b/Prebuild/src/Core/Attributes/.svn/prop-base/DataNodeAttribute.cs.svn-base deleted file mode 100644 index 7b57b30..0000000 --- a/Prebuild/src/Core/Attributes/.svn/prop-base/DataNodeAttribute.cs.svn-base +++ /dev/null @@ -1,9 +0,0 @@ -K 13 -svn:eol-style -V 6 -native -K 12 -svn:keywords -V 23 -Author Date Id Revision -END diff --git a/Prebuild/src/Core/Attributes/.svn/prop-base/OptionNodeAttribute.cs.svn-base b/Prebuild/src/Core/Attributes/.svn/prop-base/OptionNodeAttribute.cs.svn-base deleted file mode 100644 index 7b57b30..0000000 --- a/Prebuild/src/Core/Attributes/.svn/prop-base/OptionNodeAttribute.cs.svn-base +++ /dev/null @@ -1,9 +0,0 @@ -K 13 -svn:eol-style -V 6 -native -K 12 -svn:keywords -V 23 -Author Date Id Revision -END diff --git a/Prebuild/src/Core/Attributes/.svn/prop-base/TargetAttribute.cs.svn-base b/Prebuild/src/Core/Attributes/.svn/prop-base/TargetAttribute.cs.svn-base deleted file mode 100644 index 7b57b30..0000000 --- a/Prebuild/src/Core/Attributes/.svn/prop-base/TargetAttribute.cs.svn-base +++ /dev/null @@ -1,9 +0,0 @@ -K 13 -svn:eol-style -V 6 -native -K 12 -svn:keywords -V 23 -Author Date Id Revision -END diff --git a/Prebuild/src/Core/Attributes/.svn/text-base/DataNodeAttribute.cs.svn-base b/Prebuild/src/Core/Attributes/.svn/text-base/DataNodeAttribute.cs.svn-base deleted file mode 100644 index f1938a2..0000000 --- a/Prebuild/src/Core/Attributes/.svn/text-base/DataNodeAttribute.cs.svn-base +++ /dev/null @@ -1,72 +0,0 @@ -#region BSD License -/* -Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com) - -Redistribution and use in source and binary forms, with or without modification, are permitted -provided that the following conditions are met: - -* Redistributions of source code must retain the above copyright notice, this list of conditions - and the following disclaimer. -* Redistributions in binary form must reproduce the above copyright notice, this list of conditions - and the following disclaimer in the documentation and/or other materials provided with the - distribution. -* The name of the author may not be used to endorse or promote products derived from this software - without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, -BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY -OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING -IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ -#endregion - -using System; -using System.Collections.Specialized; - -namespace Prebuild.Core.Attributes -{ - /// - /// - /// - [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct, AllowMultiple=true)] - public sealed class DataNodeAttribute : Attribute - { - #region Fields - - private string m_Name = "unknown"; - - #endregion - - #region Constructors - - /// - /// Initializes a new instance of the class. - /// - /// The name. - public DataNodeAttribute(string name) - { - m_Name = name; - } - - #endregion - - #region Properties - - /// - /// Gets the name. - /// - /// The name. - public string Name - { - get - { - return m_Name; - } - } - - #endregion - } -} diff --git a/Prebuild/src/Core/Attributes/.svn/text-base/OptionNodeAttribute.cs.svn-base b/Prebuild/src/Core/Attributes/.svn/text-base/OptionNodeAttribute.cs.svn-base deleted file mode 100644 index 2d6a6a7..0000000 --- a/Prebuild/src/Core/Attributes/.svn/text-base/OptionNodeAttribute.cs.svn-base +++ /dev/null @@ -1,71 +0,0 @@ -#region BSD License -/* -Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com) - -Redistribution and use in source and binary forms, with or without modification, are permitted -provided that the following conditions are met: - -* Redistributions of source code must retain the above copyright notice, this list of conditions - and the following disclaimer. -* Redistributions in binary form must reproduce the above copyright notice, this list of conditions - and the following disclaimer in the documentation and/or other materials provided with the - distribution. -* The name of the author may not be used to endorse or promote products derived from this software - without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, -BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY -OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING -IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ -#endregion - -using System; - -namespace Prebuild.Core.Attributes -{ - /// - /// - /// - [AttributeUsage(AttributeTargets.Field)] - public sealed class OptionNodeAttribute : Attribute - { - #region Fields - - private string m_NodeName; - - #endregion - - #region Constructors - - /// - /// Initializes a new instance of the class. - /// - /// Name of the node. - public OptionNodeAttribute(string nodeName) - { - m_NodeName = nodeName; - } - - #endregion - - #region Properties - - /// - /// Gets the name of the node. - /// - /// The name of the node. - public string NodeName - { - get - { - return m_NodeName; - } - } - - #endregion - } -} diff --git a/Prebuild/src/Core/Attributes/.svn/text-base/TargetAttribute.cs.svn-base b/Prebuild/src/Core/Attributes/.svn/text-base/TargetAttribute.cs.svn-base deleted file mode 100644 index 5ad62ee..0000000 --- a/Prebuild/src/Core/Attributes/.svn/text-base/TargetAttribute.cs.svn-base +++ /dev/null @@ -1,71 +0,0 @@ -#region BSD License -/* -Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com) - -Redistribution and use in source and binary forms, with or without modification, are permitted -provided that the following conditions are met: - -* Redistributions of source code must retain the above copyright notice, this list of conditions - and the following disclaimer. -* Redistributions in binary form must reproduce the above copyright notice, this list of conditions - and the following disclaimer in the documentation and/or other materials provided with the - distribution. -* The name of the author may not be used to endorse or promote products derived from this software - without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, -BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY -OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING -IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ -#endregion - -using System; - -namespace Prebuild.Core.Attributes -{ - /// - /// - /// - [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct)] - public sealed class TargetAttribute : Attribute - { - #region Fields - - private string m_Name; - - #endregion - - #region Constructors - - /// - /// Initializes a new instance of the class. - /// - /// The name. - public TargetAttribute(string name) - { - m_Name = name; - } - - #endregion - - #region Properties - - /// - /// Gets the name. - /// - /// The name. - public string Name - { - get - { - return m_Name; - } - } - - #endregion - } -} diff --git a/Prebuild/src/Core/Interfaces/.svn/all-wcprops b/Prebuild/src/Core/Interfaces/.svn/all-wcprops deleted file mode 100644 index 0359de2..0000000 --- a/Prebuild/src/Core/Interfaces/.svn/all-wcprops +++ /dev/null @@ -1,17 +0,0 @@ -K 25 -svn:wc:ra_dav:version-url -V 61 -/svnroot/dnpb/!svn/ver/295/trunk/Prebuild/src/Core/Interfaces -END -ITarget.cs -K 25 -svn:wc:ra_dav:version-url -V 72 -/svnroot/dnpb/!svn/ver/295/trunk/Prebuild/src/Core/Interfaces/ITarget.cs -END -IDataNode.cs -K 25 -svn:wc:ra_dav:version-url -V 74 -/svnroot/dnpb/!svn/ver/295/trunk/Prebuild/src/Core/Interfaces/IDataNode.cs -END diff --git a/Prebuild/src/Core/Interfaces/.svn/dir-prop-base b/Prebuild/src/Core/Interfaces/.svn/dir-prop-base deleted file mode 100644 index a1989a0..0000000 --- a/Prebuild/src/Core/Interfaces/.svn/dir-prop-base +++ /dev/null @@ -1,5 +0,0 @@ -K 10 -svn:ignore -V 5 -*.swp -END diff --git a/Prebuild/src/Core/Interfaces/.svn/entries b/Prebuild/src/Core/Interfaces/.svn/entries deleted file mode 100644 index 0ff8913..0000000 --- a/Prebuild/src/Core/Interfaces/.svn/entries +++ /dev/null @@ -1,96 +0,0 @@ -10 - -dir -323 -https://dnpb.svn.sourceforge.net/svnroot/dnpb/trunk/Prebuild/src/Core/Interfaces -https://dnpb.svn.sourceforge.net/svnroot/dnpb - - - -2009-02-19T06:47:52.218324Z -295 -kunnis -has-props - - - - - - - - - - - - - -3355ff64-970d-0410-bbe8-d0fbd18be4fb - -ITarget.cs -file - - - - -2010-09-10T22:51:44.000000Z -52c732d42919f00330b2c4ed8b6360f8 -2009-02-19T06:47:52.218324Z -295 -kunnis -has-props - - - - - - - - - - - - - - - - - - - - -1984 - -IDataNode.cs -file - - - - -2010-09-10T22:51:44.000000Z -0ff6737b55b9bc4c63f9143c367a7e62 -2009-02-19T06:47:52.218324Z -295 -kunnis -has-props - - - - - - - - - - - - - - - - - - - - -1900 - diff --git a/Prebuild/src/Core/Interfaces/.svn/prop-base/IDataNode.cs.svn-base b/Prebuild/src/Core/Interfaces/.svn/prop-base/IDataNode.cs.svn-base deleted file mode 100644 index 7b57b30..0000000 --- a/Prebuild/src/Core/Interfaces/.svn/prop-base/IDataNode.cs.svn-base +++ /dev/null @@ -1,9 +0,0 @@ -K 13 -svn:eol-style -V 6 -native -K 12 -svn:keywords -V 23 -Author Date Id Revision -END diff --git a/Prebuild/src/Core/Interfaces/.svn/prop-base/ITarget.cs.svn-base b/Prebuild/src/Core/Interfaces/.svn/prop-base/ITarget.cs.svn-base deleted file mode 100644 index 7b57b30..0000000 --- a/Prebuild/src/Core/Interfaces/.svn/prop-base/ITarget.cs.svn-base +++ /dev/null @@ -1,9 +0,0 @@ -K 13 -svn:eol-style -V 6 -native -K 12 -svn:keywords -V 23 -Author Date Id Revision -END diff --git a/Prebuild/src/Core/Interfaces/.svn/text-base/IDataNode.cs.svn-base b/Prebuild/src/Core/Interfaces/.svn/text-base/IDataNode.cs.svn-base deleted file mode 100644 index 986dd2d..0000000 --- a/Prebuild/src/Core/Interfaces/.svn/text-base/IDataNode.cs.svn-base +++ /dev/null @@ -1,47 +0,0 @@ -#region BSD License -/* -Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com) - -Redistribution and use in source and binary forms, with or without modification, are permitted -provided that the following conditions are met: - -* Redistributions of source code must retain the above copyright notice, this list of conditions - and the following disclaimer. -* Redistributions in binary form must reproduce the above copyright notice, this list of conditions - and the following disclaimer in the documentation and/or other materials provided with the - distribution. -* The name of the author may not be used to endorse or promote products derived from this software - without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, -BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY -OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING -IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ -#endregion - -using System; -using System.Xml; - -namespace Prebuild.Core.Interfaces -{ - /// - /// - /// - public interface IDataNode - { - /// - /// Gets or sets the parent. - /// - /// The parent. - IDataNode Parent { get; set; } - /// - /// Parses the specified node. - /// - /// The node. - void Parse(XmlNode node); - } -} diff --git a/Prebuild/src/Core/Interfaces/.svn/text-base/ITarget.cs.svn-base b/Prebuild/src/Core/Interfaces/.svn/text-base/ITarget.cs.svn-base deleted file mode 100644 index 47115c6..0000000 --- a/Prebuild/src/Core/Interfaces/.svn/text-base/ITarget.cs.svn-base +++ /dev/null @@ -1,51 +0,0 @@ -#region BSD License -/* -Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com) - -Redistribution and use in source and binary forms, with or without modification, are permitted -provided that the following conditions are met: - -* Redistributions of source code must retain the above copyright notice, this list of conditions - and the following disclaimer. -* Redistributions in binary form must reproduce the above copyright notice, this list of conditions - and the following disclaimer in the documentation and/or other materials provided with the - distribution. -* The name of the author may not be used to endorse or promote products derived from this software - without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, -BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY -OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING -IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ -#endregion - -using System; - -namespace Prebuild.Core.Interfaces -{ - /// - /// - /// - public interface ITarget - { - /// - /// Writes the specified kern. - /// - /// The kern. - void Write(Kernel kern); - /// - /// Cleans the specified kern. - /// - /// The kern. - void Clean(Kernel kern); - /// - /// Gets the name. - /// - /// The name. - string Name { get; } - } -} \ No newline at end of file diff --git a/Prebuild/src/Core/Nodes/.svn/all-wcprops b/Prebuild/src/Core/Nodes/.svn/all-wcprops deleted file mode 100644 index 6565f05..0000000 --- a/Prebuild/src/Core/Nodes/.svn/all-wcprops +++ /dev/null @@ -1,119 +0,0 @@ -K 25 -svn:wc:ra_dav:version-url -V 56 -/svnroot/dnpb/!svn/ver/321/trunk/Prebuild/src/Core/Nodes -END -CleanFilesNode.cs -K 25 -svn:wc:ra_dav:version-url -V 74 -/svnroot/dnpb/!svn/ver/307/trunk/Prebuild/src/Core/Nodes/CleanFilesNode.cs -END -ProjectNode.cs -K 25 -svn:wc:ra_dav:version-url -V 71 -/svnroot/dnpb/!svn/ver/319/trunk/Prebuild/src/Core/Nodes/ProjectNode.cs -END -ConfigurationNode.cs -K 25 -svn:wc:ra_dav:version-url -V 77 -/svnroot/dnpb/!svn/ver/316/trunk/Prebuild/src/Core/Nodes/ConfigurationNode.cs -END -DataNode.cs -K 25 -svn:wc:ra_dav:version-url -V 68 -/svnroot/dnpb/!svn/ver/321/trunk/Prebuild/src/Core/Nodes/DataNode.cs -END -ReferencePathNode.cs -K 25 -svn:wc:ra_dav:version-url -V 77 -/svnroot/dnpb/!svn/ver/307/trunk/Prebuild/src/Core/Nodes/ReferencePathNode.cs -END -SolutionNode.cs -K 25 -svn:wc:ra_dav:version-url -V 72 -/svnroot/dnpb/!svn/ver/315/trunk/Prebuild/src/Core/Nodes/SolutionNode.cs -END -ProcessNode.cs -K 25 -svn:wc:ra_dav:version-url -V 71 -/svnroot/dnpb/!svn/ver/307/trunk/Prebuild/src/Core/Nodes/ProcessNode.cs -END -FileNode.cs -K 25 -svn:wc:ra_dav:version-url -V 68 -/svnroot/dnpb/!svn/ver/316/trunk/Prebuild/src/Core/Nodes/FileNode.cs -END -DescriptionNode.cs -K 25 -svn:wc:ra_dav:version-url -V 75 -/svnroot/dnpb/!svn/ver/307/trunk/Prebuild/src/Core/Nodes/DescriptionNode.cs -END -DatabaseReferenceNode.cs -K 25 -svn:wc:ra_dav:version-url -V 81 -/svnroot/dnpb/!svn/ver/295/trunk/Prebuild/src/Core/Nodes/DatabaseReferenceNode.cs -END -ConfigurationNodeCollection.cs -K 25 -svn:wc:ra_dav:version-url -V 87 -/svnroot/dnpb/!svn/ver/315/trunk/Prebuild/src/Core/Nodes/ConfigurationNodeCollection.cs -END -CleanupNode.cs -K 25 -svn:wc:ra_dav:version-url -V 71 -/svnroot/dnpb/!svn/ver/307/trunk/Prebuild/src/Core/Nodes/CleanupNode.cs -END -ExcludeNode.cs -K 25 -svn:wc:ra_dav:version-url -V 71 -/svnroot/dnpb/!svn/ver/295/trunk/Prebuild/src/Core/Nodes/ExcludeNode.cs -END -OptionsNode.cs -K 25 -svn:wc:ra_dav:version-url -V 71 -/svnroot/dnpb/!svn/ver/315/trunk/Prebuild/src/Core/Nodes/OptionsNode.cs -END -DatabaseProjectNode.cs -K 25 -svn:wc:ra_dav:version-url -V 79 -/svnroot/dnpb/!svn/ver/307/trunk/Prebuild/src/Core/Nodes/DatabaseProjectNode.cs -END -MatchNode.cs -K 25 -svn:wc:ra_dav:version-url -V 69 -/svnroot/dnpb/!svn/ver/318/trunk/Prebuild/src/Core/Nodes/MatchNode.cs -END -ReferenceNode.cs -K 25 -svn:wc:ra_dav:version-url -V 73 -/svnroot/dnpb/!svn/ver/295/trunk/Prebuild/src/Core/Nodes/ReferenceNode.cs -END -FilesNode.cs -K 25 -svn:wc:ra_dav:version-url -V 69 -/svnroot/dnpb/!svn/ver/307/trunk/Prebuild/src/Core/Nodes/FilesNode.cs -END -AuthorNode.cs -K 25 -svn:wc:ra_dav:version-url -V 70 -/svnroot/dnpb/!svn/ver/307/trunk/Prebuild/src/Core/Nodes/AuthorNode.cs -END diff --git a/Prebuild/src/Core/Nodes/.svn/dir-prop-base b/Prebuild/src/Core/Nodes/.svn/dir-prop-base deleted file mode 100644 index a1989a0..0000000 --- a/Prebuild/src/Core/Nodes/.svn/dir-prop-base +++ /dev/null @@ -1,5 +0,0 @@ -K 10 -svn:ignore -V 5 -*.swp -END diff --git a/Prebuild/src/Core/Nodes/.svn/entries b/Prebuild/src/Core/Nodes/.svn/entries deleted file mode 100644 index b60f190..0000000 --- a/Prebuild/src/Core/Nodes/.svn/entries +++ /dev/null @@ -1,674 +0,0 @@ -10 - -dir -323 -https://dnpb.svn.sourceforge.net/svnroot/dnpb/trunk/Prebuild/src/Core/Nodes -https://dnpb.svn.sourceforge.net/svnroot/dnpb - - - -2010-08-12T16:58:08.825470Z -321 -jhurliman -has-props - - - - - - - - - - - - - -3355ff64-970d-0410-bbe8-d0fbd18be4fb - -CleanFilesNode.cs -file - - - - -2010-09-10T22:51:44.000000Z -c798b3c4167ec1a3815ddae93a552427 -2009-04-15T01:28:16.827957Z -307 -kunnis - - - - - - - - - - - - - - - - - - - - - -2666 - -ProjectNode.cs -file - - - - -2010-09-10T22:51:44.000000Z -be9ade7048917117783a06508fa4d378 -2010-05-09T23:19:49.063286Z -319 -jhurliman -has-props - - - - - - - - - - - - - - - - - - - - -13444 - -ConfigurationNode.cs -file - - - - -2010-09-10T22:51:44.000000Z -e42a548bfaba22cf94dbb203b2b28352 -2010-05-08T05:43:01.449559Z -316 -jhurliman -has-props - - - - - - - - - - - - - - - - - - - - -5222 - -DataNode.cs -file - - - - -2010-09-10T22:51:44.000000Z -39b1d83bff018fce9f616ae2e6f1be82 -2010-08-12T16:58:08.825470Z -321 -jhurliman -has-props - - - - - - - - - - - - - - - - - - - - -3294 - -ReferencePathNode.cs -file - - - - -2010-09-10T22:51:44.000000Z -409c91bafff2572218a6cdefcc6ec48c -2009-04-15T01:28:16.827957Z -307 -kunnis -has-props - - - - - - - - - - - - - - - - - - - - -2677 - -SolutionNode.cs -file - - - - -2010-09-10T22:51:44.000000Z -79bdf34c92682dc5ba8b5db15aaa95d6 -2009-06-06T19:47:31.451428Z -315 -dmoonfire -has-props - - - - - - - - - - - - - - - - - - - - -9720 - -ProcessNode.cs -file - - - - -2010-09-10T22:51:44.000000Z -1816314797ef66235c58938b33ea2b3b -2009-04-15T01:28:16.827957Z -307 -kunnis -has-props - - - - - - - - - - - - - - - - - - - - -2900 - -FileNode.cs -file - - - - -2010-09-10T22:51:44.000000Z -43f98599da19618be6c6ed74f36fceae -2010-05-08T05:43:01.449559Z -316 -jhurliman -has-props - - - - - - - - - - - - - - - - - - - - -6043 - -DescriptionNode.cs -file - - - - -2010-09-10T22:51:44.000000Z -3f8a8b8cc4b3a94b94109276ad2222d3 -2009-04-15T01:28:16.827957Z -307 -kunnis - - - - - - - - - - - - - - - - - - - - - -2493 - -DatabaseReferenceNode.cs -file - - - - -2010-09-10T22:51:44.000000Z -4104ed953ae9105ac6498ce7882ed8ee -2009-02-19T06:47:52.218324Z -295 -kunnis - - - - - - - - - - - - - - - - - - - - - -2390 - -ConfigurationNodeCollection.cs -file - - - - -2010-09-10T22:51:44.000000Z -8620885fc85bdc06288acf6b8f58b3ff -2009-06-06T19:47:31.451428Z -315 -dmoonfire - - - - - - - - - - - - - - - - - - - - - -2406 - -CleanupNode.cs -file - - - - -2010-09-10T22:51:44.000000Z -198fb1e15cd545655978686277e39d96 -2009-04-15T01:28:16.827957Z -307 -kunnis - - - - - - - - - - - - - - - - - - - - - -2689 - -ExcludeNode.cs -file - - - - -2010-09-10T22:51:44.000000Z -810fc73f537028052471239c72f41c11 -2009-02-19T06:47:52.218324Z -295 -kunnis -has-props - - - - - - - - - - - - - - - - - - - - -2608 - -OptionsNode.cs -file - - - - -2010-09-10T22:51:44.000000Z -691dd5f7e7ce2a06814cdcae611fc40e -2009-06-06T19:47:31.451428Z -315 -dmoonfire -has-props - - - - - - - - - - - - - - - - - - - - -10949 - -DatabaseProjectNode.cs -file - - - - -2010-09-10T22:51:44.000000Z -18995e6577e6bb3622fe41f5bfe01b48 -2009-04-15T01:28:16.827957Z -307 -kunnis - - - - - - - - - - - - - - - - - - - - - -2476 - -MatchNode.cs -file - - - - -2010-09-10T22:51:44.000000Z -3344ef3bdb7db2006eb987a80128cd06 -2010-05-09T08:21:52.307305Z -318 -jhurliman -has-props - - - - - - - - - - - - - - - - - - - - -10846 - -ReferenceNode.cs -file - - - - -2010-09-10T22:51:44.000000Z -18d76c27d53a4d54f16f57a855a21916 -2009-02-19T06:47:52.218324Z -295 -kunnis -has-props - - - - - - - - - - - - - - - - - - - - -3705 - -FilesNode.cs -file - - - - -2010-09-10T22:51:44.000000Z -e6ddefd5fff49958f77b5ef96f06c09e -2009-04-15T01:28:16.827957Z -307 -kunnis -has-props - - - - - - - - - - - - - - - - - - - - -6036 - -AuthorNode.cs -file - - - - -2010-09-10T22:51:44.000000Z -07607d8988fc1236ab8bef5fc12f8cd5 -2009-04-15T01:28:16.827957Z -307 -kunnis - - - - - - - - - - - - - - - - - - - - - -2425 - diff --git a/Prebuild/src/Core/Nodes/.svn/prop-base/ConfigurationNode.cs.svn-base b/Prebuild/src/Core/Nodes/.svn/prop-base/ConfigurationNode.cs.svn-base deleted file mode 100644 index 7b57b30..0000000 --- a/Prebuild/src/Core/Nodes/.svn/prop-base/ConfigurationNode.cs.svn-base +++ /dev/null @@ -1,9 +0,0 @@ -K 13 -svn:eol-style -V 6 -native -K 12 -svn:keywords -V 23 -Author Date Id Revision -END diff --git a/Prebuild/src/Core/Nodes/.svn/prop-base/DataNode.cs.svn-base b/Prebuild/src/Core/Nodes/.svn/prop-base/DataNode.cs.svn-base deleted file mode 100644 index 7b57b30..0000000 --- a/Prebuild/src/Core/Nodes/.svn/prop-base/DataNode.cs.svn-base +++ /dev/null @@ -1,9 +0,0 @@ -K 13 -svn:eol-style -V 6 -native -K 12 -svn:keywords -V 23 -Author Date Id Revision -END diff --git a/Prebuild/src/Core/Nodes/.svn/prop-base/ExcludeNode.cs.svn-base b/Prebuild/src/Core/Nodes/.svn/prop-base/ExcludeNode.cs.svn-base deleted file mode 100644 index 7b57b30..0000000 --- a/Prebuild/src/Core/Nodes/.svn/prop-base/ExcludeNode.cs.svn-base +++ /dev/null @@ -1,9 +0,0 @@ -K 13 -svn:eol-style -V 6 -native -K 12 -svn:keywords -V 23 -Author Date Id Revision -END diff --git a/Prebuild/src/Core/Nodes/.svn/prop-base/FileNode.cs.svn-base b/Prebuild/src/Core/Nodes/.svn/prop-base/FileNode.cs.svn-base deleted file mode 100644 index 7b57b30..0000000 --- a/Prebuild/src/Core/Nodes/.svn/prop-base/FileNode.cs.svn-base +++ /dev/null @@ -1,9 +0,0 @@ -K 13 -svn:eol-style -V 6 -native -K 12 -svn:keywords -V 23 -Author Date Id Revision -END diff --git a/Prebuild/src/Core/Nodes/.svn/prop-base/FilesNode.cs.svn-base b/Prebuild/src/Core/Nodes/.svn/prop-base/FilesNode.cs.svn-base deleted file mode 100644 index 7b57b30..0000000 --- a/Prebuild/src/Core/Nodes/.svn/prop-base/FilesNode.cs.svn-base +++ /dev/null @@ -1,9 +0,0 @@ -K 13 -svn:eol-style -V 6 -native -K 12 -svn:keywords -V 23 -Author Date Id Revision -END diff --git a/Prebuild/src/Core/Nodes/.svn/prop-base/MatchNode.cs.svn-base b/Prebuild/src/Core/Nodes/.svn/prop-base/MatchNode.cs.svn-base deleted file mode 100644 index 7b57b30..0000000 --- a/Prebuild/src/Core/Nodes/.svn/prop-base/MatchNode.cs.svn-base +++ /dev/null @@ -1,9 +0,0 @@ -K 13 -svn:eol-style -V 6 -native -K 12 -svn:keywords -V 23 -Author Date Id Revision -END diff --git a/Prebuild/src/Core/Nodes/.svn/prop-base/OptionsNode.cs.svn-base b/Prebuild/src/Core/Nodes/.svn/prop-base/OptionsNode.cs.svn-base deleted file mode 100644 index 7b57b30..0000000 --- a/Prebuild/src/Core/Nodes/.svn/prop-base/OptionsNode.cs.svn-base +++ /dev/null @@ -1,9 +0,0 @@ -K 13 -svn:eol-style -V 6 -native -K 12 -svn:keywords -V 23 -Author Date Id Revision -END diff --git a/Prebuild/src/Core/Nodes/.svn/prop-base/ProcessNode.cs.svn-base b/Prebuild/src/Core/Nodes/.svn/prop-base/ProcessNode.cs.svn-base deleted file mode 100644 index 7b57b30..0000000 --- a/Prebuild/src/Core/Nodes/.svn/prop-base/ProcessNode.cs.svn-base +++ /dev/null @@ -1,9 +0,0 @@ -K 13 -svn:eol-style -V 6 -native -K 12 -svn:keywords -V 23 -Author Date Id Revision -END diff --git a/Prebuild/src/Core/Nodes/.svn/prop-base/ProjectNode.cs.svn-base b/Prebuild/src/Core/Nodes/.svn/prop-base/ProjectNode.cs.svn-base deleted file mode 100644 index 7b57b30..0000000 --- a/Prebuild/src/Core/Nodes/.svn/prop-base/ProjectNode.cs.svn-base +++ /dev/null @@ -1,9 +0,0 @@ -K 13 -svn:eol-style -V 6 -native -K 12 -svn:keywords -V 23 -Author Date Id Revision -END diff --git a/Prebuild/src/Core/Nodes/.svn/prop-base/ReferenceNode.cs.svn-base b/Prebuild/src/Core/Nodes/.svn/prop-base/ReferenceNode.cs.svn-base deleted file mode 100644 index 7b57b30..0000000 --- a/Prebuild/src/Core/Nodes/.svn/prop-base/ReferenceNode.cs.svn-base +++ /dev/null @@ -1,9 +0,0 @@ -K 13 -svn:eol-style -V 6 -native -K 12 -svn:keywords -V 23 -Author Date Id Revision -END diff --git a/Prebuild/src/Core/Nodes/.svn/prop-base/ReferencePathNode.cs.svn-base b/Prebuild/src/Core/Nodes/.svn/prop-base/ReferencePathNode.cs.svn-base deleted file mode 100644 index 7b57b30..0000000 --- a/Prebuild/src/Core/Nodes/.svn/prop-base/ReferencePathNode.cs.svn-base +++ /dev/null @@ -1,9 +0,0 @@ -K 13 -svn:eol-style -V 6 -native -K 12 -svn:keywords -V 23 -Author Date Id Revision -END diff --git a/Prebuild/src/Core/Nodes/.svn/prop-base/SolutionNode.cs.svn-base b/Prebuild/src/Core/Nodes/.svn/prop-base/SolutionNode.cs.svn-base deleted file mode 100644 index 7b57b30..0000000 --- a/Prebuild/src/Core/Nodes/.svn/prop-base/SolutionNode.cs.svn-base +++ /dev/null @@ -1,9 +0,0 @@ -K 13 -svn:eol-style -V 6 -native -K 12 -svn:keywords -V 23 -Author Date Id Revision -END diff --git a/Prebuild/src/Core/Nodes/.svn/text-base/AuthorNode.cs.svn-base b/Prebuild/src/Core/Nodes/.svn/text-base/AuthorNode.cs.svn-base deleted file mode 100644 index 4c415bb..0000000 --- a/Prebuild/src/Core/Nodes/.svn/text-base/AuthorNode.cs.svn-base +++ /dev/null @@ -1,87 +0,0 @@ -#region BSD License -/* -Copyright (c) 2007 C.J. Adams-Collier (cjac@colliertech.org) - -Redistribution and use in source and binary forms, with or without modification, are permitted -provided that the following conditions are met: - -* Redistributions of source code must retain the above copyright notice, this list of conditions - and the following disclaimer. -* Redistributions in binary form must reproduce the above copyright notice, this list of conditions - and the following disclaimer in the documentation and/or other materials provided with the - distribution. -* The name of the author may not be used to endorse or promote products derived from this software - without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, -BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY -OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING -IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ -#endregion - -using System; -using System.Xml; - -using Prebuild.Core.Attributes; -using Prebuild.Core.Interfaces; -using Prebuild.Core.Utilities; - -namespace Prebuild.Core.Nodes -{ - /// - /// - /// - [DataNode("Author")] - public class AuthorNode : DataNode - { - #region Fields - - private string m_Signature; - - #endregion - - #region Properties - - /// - /// Gets the signature. - /// - /// The signature. - public string Signature - { - get - { - return m_Signature; - } - } - - #endregion - - #region Public Methods - - /// - /// Parses the specified node. - /// - /// The node. - public override void Parse(XmlNode node) - { - if( node == null ) - { - throw new ArgumentNullException("node"); - } - - m_Signature = Helper.InterpolateForEnvironmentVariables(node.InnerText); - if(m_Signature == null) - { - m_Signature = ""; - } - - m_Signature = m_Signature.Trim(); - } - - #endregion - } -} diff --git a/Prebuild/src/Core/Nodes/.svn/text-base/CleanFilesNode.cs.svn-base b/Prebuild/src/Core/Nodes/.svn/text-base/CleanFilesNode.cs.svn-base deleted file mode 100644 index 71405f9..0000000 --- a/Prebuild/src/Core/Nodes/.svn/text-base/CleanFilesNode.cs.svn-base +++ /dev/null @@ -1,80 +0,0 @@ -#region BSD License -/* -Copyright (c) 2007 C.J. Adams-Collier (cjac@colliertech.org) - -Redistribution and use in source and binary forms, with or without modification, are permitted -provided that the following conditions are met: - -* Redistributions of source code must retain the above copyright notice, this list of conditions - and the following disclaimer. -* Redistributions in binary form must reproduce the above copyright notice, this list of conditions - and the following disclaimer in the documentation and/or other materials provided with the - distribution. -* The name of the author may not be used to endorse or promote products derived from this software - without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, -BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY -OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING -IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ -#endregion - -using System; -using System.Collections.Generic; -using System.Xml; - -using Prebuild.Core.Attributes; -using Prebuild.Core.Interfaces; -using Prebuild.Core.Utilities; - -namespace Prebuild.Core.Nodes -{ - [DataNode("CleanFiles")] - public class CleanFilesNode : DataNode - { - #region Fields - - private string m_Pattern; - - #endregion - - #region Properties - - /// - /// Gets the signature. - /// - /// The signature. - public string Pattern - { - get - { - return m_Pattern; - } - } - - #endregion - - #region Public Methods - - /// - /// Parses the specified node. - /// - /// The node. - public override void Parse(XmlNode node) - { - if (node == null) - { - throw new ArgumentNullException("node"); - } - - m_Pattern = Helper.AttributeValue(node, "pattern", String.Empty); ; - m_Pattern = m_Pattern.Trim(); - } - - #endregion - } -} \ No newline at end of file diff --git a/Prebuild/src/Core/Nodes/.svn/text-base/CleanupNode.cs.svn-base b/Prebuild/src/Core/Nodes/.svn/text-base/CleanupNode.cs.svn-base deleted file mode 100644 index b8131b0..0000000 --- a/Prebuild/src/Core/Nodes/.svn/text-base/CleanupNode.cs.svn-base +++ /dev/null @@ -1,85 +0,0 @@ -#region BSD License -/* -Copyright (c) 2007 C.J. Adams-Collier (cjac@colliertech.org) - -Redistribution and use in source and binary forms, with or without modification, are permitted -provided that the following conditions are met: - -* Redistributions of source code must retain the above copyright notice, this list of conditions - and the following disclaimer. -* Redistributions in binary form must reproduce the above copyright notice, this list of conditions - and the following disclaimer in the documentation and/or other materials provided with the - distribution. -* The name of the author may not be used to endorse or promote products derived from this software - without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, -BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY -OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING -IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ -#endregion - -using System; -using System.Collections.Generic; -using System.Xml; - -using Prebuild.Core.Attributes; -using Prebuild.Core.Interfaces; - -namespace Prebuild.Core.Nodes -{ - [DataNode("Cleanup")] - public class CleanupNode : DataNode - { - #region Fields - - private List m_CleanFiles = new List(); - - #endregion - - #region Properties - - /// - /// Gets the signature. - /// - /// The signature. - public List CleanFiles - { - get - { - return m_CleanFiles; - } - } - - #endregion - - #region Public Methods - - /// - /// Parses the specified node. - /// - /// The node. - public override void Parse(XmlNode node) - { - if( node == null ) - { - throw new ArgumentNullException("node"); - } - - foreach (XmlNode child in node.ChildNodes) - { - IDataNode dataNode = Kernel.Instance.ParseNode(child, this); - if (dataNode is CleanFilesNode) - { - m_CleanFiles.Add((CleanFilesNode)dataNode); - } - } - } - - #endregion - } -} \ No newline at end of file diff --git a/Prebuild/src/Core/Nodes/.svn/text-base/ConfigurationNode.cs.svn-base b/Prebuild/src/Core/Nodes/.svn/text-base/ConfigurationNode.cs.svn-base deleted file mode 100644 index cd2f740..0000000 --- a/Prebuild/src/Core/Nodes/.svn/text-base/ConfigurationNode.cs.svn-base +++ /dev/null @@ -1,225 +0,0 @@ -#region BSD License -/* -Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com) - -Redistribution and use in source and binary forms, with or without modification, are permitted -provided that the following conditions are met: - -* Redistributions of source code must retain the above copyright notice, this list of conditions - and the following disclaimer. -* Redistributions in binary form must reproduce the above copyright notice, this list of conditions - and the following disclaimer in the documentation and/or other materials provided with the - distribution. -* The name of the author may not be used to endorse or promote products derived from this software - without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, -BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY -OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING -IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ -#endregion - -using System; -using System.Xml; - -using Prebuild.Core.Attributes; -using Prebuild.Core.Interfaces; -using Prebuild.Core.Utilities; - -namespace Prebuild.Core.Nodes -{ - /// - /// - /// - [DataNode("Configuration")] - public class ConfigurationNode : DataNode, ICloneable, IComparable - { - #region Fields - - private string m_Name = "unknown"; - private string m_Platform = "AnyCPU"; - private OptionsNode m_Options; - - #endregion - - #region Constructors - - /// - /// Initializes a new instance of the class. - /// - public ConfigurationNode() - { - m_Options = new OptionsNode(); - } - - #endregion - - #region Properties - - /// - /// Gets or sets the parent. - /// - /// The parent. - public override IDataNode Parent - { - get - { - return base.Parent; - } - set - { - base.Parent = value; - if(base.Parent is SolutionNode) - { - SolutionNode node = (SolutionNode)base.Parent; - if(node != null && node.Options != null) - { - node.Options.CopyTo(m_Options); - } - } - } - } - - /// - /// Identifies the platform for this specific configuration. - /// - public string Platform - { - get - { - return m_Platform; - } - set - { - switch ((value + "").ToLower()) - { - case "x86": - case "x64": - m_Platform = value; - break; - case "itanium": - m_Platform = "Itanium"; - break; - default: - m_Platform = "AnyCPU"; - break; - } - } - } - - /// - /// Gets the name. - /// - /// The name. - public string Name - { - get - { - return m_Name; - } - } - - /// - /// Gets the name and platform for the configuration. - /// - /// The name and platform. - public string NameAndPlatform - { - get - { - string platform = m_Platform; - if (platform == "AnyCPU") - platform = "Any CPU"; - - return String.Format("{0}|{1}", m_Name, platform); - } - } - - /// - /// Gets or sets the options. - /// - /// The options. - public OptionsNode Options - { - get - { - return m_Options; - } - set - { - m_Options = value; - } - } - - #endregion - - #region Public Methods - - /// - /// Parses the specified node. - /// - /// The node. - public override void Parse(XmlNode node) - { - m_Name = Helper.AttributeValue(node, "name", m_Name); - Platform = Helper.AttributeValue(node, "platform", m_Platform); - - if (node == null) - { - throw new ArgumentNullException("node"); - } - foreach(XmlNode child in node.ChildNodes) - { - IDataNode dataNode = Kernel.Instance.ParseNode(child, this); - if(dataNode is OptionsNode) - { - ((OptionsNode)dataNode).CopyTo(m_Options); - } - } - } - - /// - /// Copies to. - /// - /// The conf. - public void CopyTo(ConfigurationNode conf) - { - m_Options.CopyTo(conf.m_Options); - } - - #endregion - - #region ICloneable Members - - /// - /// Creates a new object that is a copy of the current instance. - /// - /// - /// A new object that is a copy of this instance. - /// - public object Clone() - { - ConfigurationNode ret = new ConfigurationNode(); - ret.m_Name = m_Name; - ret.m_Platform = m_Platform; - m_Options.CopyTo(ret.m_Options); - return ret; - } - - #endregion - - #region IComparable Members - - public int CompareTo(object obj) - { - ConfigurationNode that = (ConfigurationNode) obj; - return this.m_Name.CompareTo(that.m_Name); - } - - #endregion - } -} diff --git a/Prebuild/src/Core/Nodes/.svn/text-base/ConfigurationNodeCollection.cs.svn-base b/Prebuild/src/Core/Nodes/.svn/text-base/ConfigurationNodeCollection.cs.svn-base deleted file mode 100644 index 1c38d9e..0000000 --- a/Prebuild/src/Core/Nodes/.svn/text-base/ConfigurationNodeCollection.cs.svn-base +++ /dev/null @@ -1,71 +0,0 @@ -#region BSD License -/* -Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com) - -Redistribution and use in source and binary forms, with or without modification, are permitted -provided that the following conditions are met: - -* Redistributions of source code must retain the above copyright notice, this list of conditions - and the following disclaimer. -* Redistributions in binary form must reproduce the above copyright notice, this list of conditions - and the following disclaimer in the documentation and/or other materials provided with the - distribution. -* The name of the author may not be used to endorse or promote products derived from this software - without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, -BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY -OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING -IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ -#endregion - -using System.Collections.Generic; - -namespace Prebuild.Core.Nodes -{ - /// - /// Implements a specialized list of configuration nodes which allows for lookup via - /// configuration name and platform. - /// - public class ConfigurationNodeCollection : List - { - #region Properties - - public ConfigurationNode this[string nameAndPlatform] - { - get - { - foreach (ConfigurationNode configurationNode in this) - { - if (configurationNode.NameAndPlatform == nameAndPlatform) - { - return configurationNode; - } - } - - return null; - } - - set - { - // See if the node - ConfigurationNode configurationNode = this[nameAndPlatform]; - - if (configurationNode != null) - { - this[IndexOf(configurationNode)] = value; - } - else - { - Add(value); - } - } - } - - #endregion - } -} diff --git a/Prebuild/src/Core/Nodes/.svn/text-base/DataNode.cs.svn-base b/Prebuild/src/Core/Nodes/.svn/text-base/DataNode.cs.svn-base deleted file mode 100644 index 318b13c..0000000 --- a/Prebuild/src/Core/Nodes/.svn/text-base/DataNode.cs.svn-base +++ /dev/null @@ -1,117 +0,0 @@ -#region BSD License -/* -Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com) - -Redistribution and use in source and binary forms, with or without modification, are permitted -provided that the following conditions are met: - -* Redistributions of source code must retain the above copyright notice, this list of conditions - and the following disclaimer. -* Redistributions in binary form must reproduce the above copyright notice, this list of conditions - and the following disclaimer in the documentation and/or other materials provided with the - distribution. -* The name of the author may not be used to endorse or promote products derived from this software - without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, -BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY -OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING -IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ -#endregion - -using System; -using System.Xml; - -using Prebuild.Core.Attributes; -using Prebuild.Core.Interfaces; -using System.IO; - -namespace Prebuild.Core.Nodes -{ - /// - /// - /// - public abstract class DataNode : IDataNode - { - #region Fields - - private IDataNode parent; - string[] m_WebTypes = new string[] { "aspx", "ascx", "master", "ashx", "asmx" }; - - #endregion - - #region IDataNode Members - - /// - /// Gets or sets the parent. - /// - /// The parent. - public virtual IDataNode Parent - { - get - { - return parent; - } - set - { - parent = value; - } - } - public string[] WebTypes - { - get { return m_WebTypes; } - } - /// - /// Parses the specified node. - /// - /// The node. - public virtual void Parse(XmlNode node) - { - } - public BuildAction GetBuildActionByFileName(string fileName) - { - string extension = Path.GetExtension(fileName).ToLower(); - foreach (string type in WebTypes) - { - if (extension == type) - return BuildAction.Content; - } - return BuildAction.Compile; - } - /// - /// Parses the file type to figure out what type it is - /// - /// - public SubType GetSubTypeByFileName(string fileName) - { - string extension = System.IO.Path.GetExtension(fileName).ToLower(); - string designer = String.Format(".designer{0}", extension); - string path = fileName.ToLower(); - if (extension == ".resx") - { - return SubType.Designer; - } - else if (path.EndsWith(".settings")) - { - return SubType.Settings; - } - else - { - - foreach (string type in WebTypes) - { - if (path.EndsWith(type)) - { - return SubType.CodeBehind; - } - } - } - return SubType.Code; - } - #endregion - } -} diff --git a/Prebuild/src/Core/Nodes/.svn/text-base/DatabaseProjectNode.cs.svn-base b/Prebuild/src/Core/Nodes/.svn/text-base/DatabaseProjectNode.cs.svn-base deleted file mode 100644 index 278ecd8..0000000 --- a/Prebuild/src/Core/Nodes/.svn/text-base/DatabaseProjectNode.cs.svn-base +++ /dev/null @@ -1,93 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Xml; - -using Prebuild.Core.Attributes; -using Prebuild.Core.Interfaces; -using Prebuild.Core.Utilities; - -namespace Prebuild.Core.Nodes -{ - [DataNode("DatabaseProject")] - public class DatabaseProjectNode : DataNode - { - string name; - string path; - string fullpath; - Guid guid = Guid.NewGuid(); - readonly List authors = new List(); - readonly List references = new List(); - - public Guid Guid - { - get { return guid; } - } - - public string Name - { - get { return name; } - } - - public string Path - { - get { return path; } - } - - public string FullPath - { - get { return fullpath; } - } - - public IEnumerable References - { - get { return references; } - } - - public override void Parse(XmlNode node) - { - name = Helper.AttributeValue(node, "name", name); - path = Helper.AttributeValue(node, "path", name); - - try - { - fullpath = Helper.ResolvePath(path); - } - catch - { - throw new WarningException("Could not resolve Solution path: {0}", path); - } - - Kernel.Instance.CurrentWorkingDirectory.Push(); - - try - { - Helper.SetCurrentDir(fullpath); - - if (node == null) - { - throw new ArgumentNullException("node"); - } - - foreach (XmlNode child in node.ChildNodes) - { - IDataNode dataNode = Kernel.Instance.ParseNode(child, this); - - if (dataNode == null) - continue; - - if (dataNode is AuthorNode) - authors.Add((AuthorNode)dataNode); - else if (dataNode is DatabaseReferenceNode) - references.Add((DatabaseReferenceNode)dataNode); - } - } - finally - { - Kernel.Instance.CurrentWorkingDirectory.Pop(); - } - - base.Parse(node); - } - } -} diff --git a/Prebuild/src/Core/Nodes/.svn/text-base/DatabaseReferenceNode.cs.svn-base b/Prebuild/src/Core/Nodes/.svn/text-base/DatabaseReferenceNode.cs.svn-base deleted file mode 100644 index 845db24..0000000 --- a/Prebuild/src/Core/Nodes/.svn/text-base/DatabaseReferenceNode.cs.svn-base +++ /dev/null @@ -1,63 +0,0 @@ -using System; -using Prebuild.Core.Attributes; -using Prebuild.Core.Utilities; - -namespace Prebuild.Core.Nodes -{ - [DataNode("DatabaseReference")] - public class DatabaseReferenceNode : DataNode - { - string name; - Guid providerId; - string connectionString; - - public string Name - { - get { return name; } - } - - public Guid ProviderId - { - get { return providerId; } - } - - public string ConnectionString - { - get { return connectionString; } - } - - public override void Parse(System.Xml.XmlNode node) - { - name = Helper.AttributeValue(node, "name", name); - - string providerName = Helper.AttributeValue(node, "providerName", string.Empty); - if (providerName != null) - { - switch (providerName) - { - // digitaljeebus: pulled from HKLM\SOFTWARE\Microsoft\VisualStudio\9.0\DataProviders\* - // Not sure if these will help other operating systems, or if there's a better way. - case "Microsoft.SqlServerCe.Client.3.5": - providerId = new Guid("7C602B5B-ACCB-4acd-9DC0-CA66388C1533"); break; - case "System.Data.OleDb": - providerId = new Guid("7F041D59-D76A-44ed-9AA2-FBF6B0548B80"); break; - case "System.Data.OracleClient": - providerId = new Guid("8F5C5018-AE09-42cf-B2CC-2CCCC7CFC2BB"); break; - case "System.Data.SqlClient": - providerId = new Guid("91510608-8809-4020-8897-FBA057E22D54"); break; - case "System.Data.Odbc": - providerId = new Guid("C3D4F4CE-2C48-4381-B4D6-34FA50C51C86"); break; - - default: - throw new ArgumentOutOfRangeException("providerName", providerName, "Could not provider name to an id."); - } - } - else - providerId = new Guid(Helper.AttributeValue(node, "providerId", Guid.Empty.ToString("B"))); - - connectionString = Helper.AttributeValue(node, "connectionString", connectionString); - - base.Parse(node); - } - } -} diff --git a/Prebuild/src/Core/Nodes/.svn/text-base/DescriptionNode.cs.svn-base b/Prebuild/src/Core/Nodes/.svn/text-base/DescriptionNode.cs.svn-base deleted file mode 100644 index d1293a0..0000000 --- a/Prebuild/src/Core/Nodes/.svn/text-base/DescriptionNode.cs.svn-base +++ /dev/null @@ -1,87 +0,0 @@ -#region BSD License -/* -Copyright (c) 2007 C.J. Adams-Collier (cjac@colliertech.org) - -Redistribution and use in source and binary forms, with or without modification, are permitted -provided that the following conditions are met: - -* Redistributions of source code must retain the above copyright notice, this list of conditions - and the following disclaimer. -* Redistributions in binary form must reproduce the above copyright notice, this list of conditions - and the following disclaimer in the documentation and/or other materials provided with the - distribution. -* The name of the author may not be used to endorse or promote products derived from this software - without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, -BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY -OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING -IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ -#endregion - -using System; -using System.Xml; - -using Prebuild.Core.Attributes; -using Prebuild.Core.Interfaces; -using Prebuild.Core.Utilities; - -namespace Prebuild.Core.Nodes -{ - /// - /// The object representing the /Prebuild/Solution/Project/Description element - /// - [DataNode("Description")] - public class DescriptionNode : DataNode - { - #region Fields - - private string m_Value; - - #endregion - - #region Properties - - /// - /// Gets the description Value. - /// - /// The description Value. - public string Value - { - get - { - return m_Value; - } - } - - #endregion - - #region Public Methods - - /// - /// Parses the specified node. - /// - /// The node. - public override void Parse(XmlNode node) - { - if( node == null ) - { - throw new ArgumentNullException("node"); - } - - m_Value = Helper.InterpolateForEnvironmentVariables(node.InnerText); - if(m_Value == null) - { - m_Value = ""; - } - - m_Value = m_Value.Trim(); - } - - #endregion - } -} diff --git a/Prebuild/src/Core/Nodes/.svn/text-base/ExcludeNode.cs.svn-base b/Prebuild/src/Core/Nodes/.svn/text-base/ExcludeNode.cs.svn-base deleted file mode 100644 index 7f04cba..0000000 --- a/Prebuild/src/Core/Nodes/.svn/text-base/ExcludeNode.cs.svn-base +++ /dev/null @@ -1,89 +0,0 @@ -#region BSD License -/* -Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com) - -Redistribution and use in source and binary forms, with or without modification, are permitted -provided that the following conditions are met: - -* Redistributions of source code must retain the above copyright notice, this list of conditions - and the following disclaimer. -* Redistributions in binary form must reproduce the above copyright notice, this list of conditions - and the following disclaimer in the documentation and/or other materials provided with the - distribution. -* The name of the author may not be used to endorse or promote products derived from this software - without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, -BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY -OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING -IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ -#endregion - -using System; -using System.Xml; - -using Prebuild.Core.Attributes; -using Prebuild.Core.Interfaces; -using Prebuild.Core.Utilities; - -namespace Prebuild.Core.Nodes -{ - /// - /// - /// - [DataNode("Exclude")] - public class ExcludeNode : DataNode - { - #region Fields - - private string m_Pattern = ""; - - #endregion - - #region Properties - - /// - /// Gets the name. - /// - /// The name. - public string Name - { - get - { - return m_Pattern; - } - } - - /// - /// Gets the pattern. - /// - /// The pattern. - public string Pattern - { - get - { - return m_Pattern; - } - } - - #endregion - - #region Public Methods - - /// - /// Parses the specified node. - /// - /// The node. - public override void Parse(XmlNode node) - { - m_Pattern = Helper.AttributeValue( node, "name", m_Pattern ); - m_Pattern = Helper.AttributeValue(node, "pattern", m_Pattern ); - } - - #endregion - } -} diff --git a/Prebuild/src/Core/Nodes/.svn/text-base/FileNode.cs.svn-base b/Prebuild/src/Core/Nodes/.svn/text-base/FileNode.cs.svn-base deleted file mode 100644 index 01cea1e..0000000 --- a/Prebuild/src/Core/Nodes/.svn/text-base/FileNode.cs.svn-base +++ /dev/null @@ -1,285 +0,0 @@ -#region BSD License -/* -Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com) - -Redistribution and use in source and binary forms, with or without modification, are permitted -provided that the following conditions are met: - -* Redistributions of source code must retain the above copyright notice, this list of conditions - and the following disclaimer. -* Redistributions in binary form must reproduce the above copyright notice, this list of conditions - and the following disclaimer in the documentation and/or other materials provided with the - distribution. -* The name of the author may not be used to endorse or promote products derived from this software - without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, -BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY -OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING -IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ -#endregion - -using System; -using System.IO; -using System.Xml; - -using Prebuild.Core.Attributes; -using Prebuild.Core.Interfaces; -using Prebuild.Core.Utilities; -using Prebuild.Core.Targets; - -namespace Prebuild.Core.Nodes -{ - /// - /// - /// - public enum BuildAction - { - /// - /// - /// - None, - /// - /// - /// - Compile, - /// - /// - /// - Content, - /// - /// - /// - EmbeddedResource, - /// - /// - /// - ApplicationDefinition, - /// - /// - /// - Page - } - - /// - /// - /// - public enum SubType - { - /// - /// - /// - Code, - /// - /// - /// - Component, - /// - /// - /// - Designer, - /// - /// - /// - Form, - /// - /// - /// - Settings, - /// - /// - /// - UserControl, - /// - /// - /// - CodeBehind, - } - - public enum CopyToOutput - { - Never, - Always, - PreserveNewest - } - - /// - /// - /// - [DataNode("File")] - public class FileNode : DataNode - { - #region Fields - - private string m_Path; - private string m_ResourceName = ""; - private BuildAction? m_BuildAction; - private bool m_Valid; - private SubType? m_SubType; - private CopyToOutput m_CopyToOutput = CopyToOutput.Never; - private bool m_Link = false; - private string m_LinkPath = string.Empty; - private bool m_PreservePath = false; - - - #endregion - - #region Properties - - /// - /// - /// - public string Path - { - get - { - return m_Path; - } - } - - /// - /// - /// - public string ResourceName - { - get - { - return m_ResourceName; - } - } - - /// - /// - /// - public BuildAction BuildAction - { - get - { - if (m_BuildAction != null) - return m_BuildAction.Value; - else - return GetBuildActionByFileName(this.Path); - - } - } - - public CopyToOutput CopyToOutput - { - get - { - return this.m_CopyToOutput; - } - } - - public bool IsLink - { - get - { - return this.m_Link; - } - } - - public string LinkPath - { - get - { - return this.m_LinkPath; - } - } - /// - /// - /// - public SubType SubType - { - get - { - if (m_SubType != null) - return m_SubType.Value; - else - return GetSubTypeByFileName(this.Path); - } - } - - /// - /// - /// - public bool IsValid - { - get - { - return m_Valid; - } - } - - /// - /// - /// - /// - /// - public bool PreservePath - { - get - { - return m_PreservePath; - } - } - - #endregion - - #region Public Methods - - /// - /// - /// - /// - public override void Parse(XmlNode node) - { - string buildAction = Helper.AttributeValue(node, "buildAction", String.Empty); - if (buildAction != string.Empty) - m_BuildAction = (BuildAction)Enum.Parse(typeof(BuildAction), buildAction); - string subType = Helper.AttributeValue(node, "subType", string.Empty); - if (subType != String.Empty) - m_SubType = (SubType)Enum.Parse(typeof(SubType), subType); - - m_ResourceName = Helper.AttributeValue(node, "resourceName", m_ResourceName.ToString()); - this.m_Link = bool.Parse(Helper.AttributeValue(node, "link", bool.FalseString)); - if ( this.m_Link == true ) - { - this.m_LinkPath = Helper.AttributeValue( node, "linkPath", string.Empty ); - } - this.m_CopyToOutput = (CopyToOutput) Enum.Parse(typeof(CopyToOutput), Helper.AttributeValue(node, "copyToOutput", this.m_CopyToOutput.ToString())); - this.m_PreservePath = bool.Parse( Helper.AttributeValue( node, "preservePath", bool.FalseString ) ); - - if( node == null ) - { - throw new ArgumentNullException("node"); - } - - m_Path = Helper.InterpolateForEnvironmentVariables(node.InnerText); - if(m_Path == null) - { - m_Path = ""; - } - - m_Path = m_Path.Trim(); - m_Valid = true; - if(!File.Exists(m_Path)) - { - m_Valid = false; - Kernel.Instance.Log.Write(LogType.Warning, "File does not exist: {0}", m_Path); - } - - if (System.IO.Path.GetExtension(m_Path) == ".settings") - { - m_SubType = SubType.Settings; - m_BuildAction = BuildAction.None; - } - } - - #endregion - } -} diff --git a/Prebuild/src/Core/Nodes/.svn/text-base/FilesNode.cs.svn-base b/Prebuild/src/Core/Nodes/.svn/text-base/FilesNode.cs.svn-base deleted file mode 100644 index 23a716c..0000000 --- a/Prebuild/src/Core/Nodes/.svn/text-base/FilesNode.cs.svn-base +++ /dev/null @@ -1,204 +0,0 @@ -#region BSD License -/* -Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com) - -Redistribution and use in source and binary forms, with or without modification, are permitted -provided that the following conditions are met: - -* Redistributions of source code must retain the above copyright notice, this list of conditions - and the following disclaimer. -* Redistributions in binary form must reproduce the above copyright notice, this list of conditions - and the following disclaimer in the documentation and/or other materials provided with the - distribution. -* The name of the author may not be used to endorse or promote products derived from this software - without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, -BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY -OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING -IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ -#endregion - -using System; -using System.Collections.Generic; -using System.Xml; - -using Prebuild.Core.Attributes; -using Prebuild.Core.Interfaces; -using System.IO; - -namespace Prebuild.Core.Nodes -{ - /// - /// - /// - [DataNode("Files")] - public class FilesNode : DataNode - { - #region Fields - - private readonly List m_Files = new List(); - private readonly Dictionary m_BuildActions = new Dictionary(); - private readonly Dictionary m_SubTypes = new Dictionary(); - private readonly Dictionary m_ResourceNames = new Dictionary(); - private readonly Dictionary m_CopyToOutputs = new Dictionary(); - private readonly Dictionary m_Links = new Dictionary(); - private readonly Dictionary m_LinkPaths = new Dictionary(); - private readonly Dictionary m_PreservePaths = new Dictionary(); - - #endregion - - #region Properties - - public int Count - { - get - { - return m_Files.Count; - } - } - - #endregion - - #region Public Methods - - public BuildAction GetBuildAction(string file) - { - if(!m_BuildActions.ContainsKey(file)) - { - return BuildAction.Compile; - } - - return m_BuildActions[file]; - } - - public CopyToOutput GetCopyToOutput(string file) - { - if (!m_CopyToOutputs.ContainsKey(file)) - { - return CopyToOutput.Never; - } - return m_CopyToOutputs[file]; - } - - public bool GetIsLink(string file) - { - if (!m_Links.ContainsKey(file)) - { - return false; - } - return m_Links[file]; - } - - public bool Contains(string file) - { - return m_Files.Contains(file); - } - - public string GetLinkPath( string file ) - { - if ( !m_LinkPaths.ContainsKey( file ) ) - { - return string.Empty; - } - return m_LinkPaths[ file ]; - } - - public SubType GetSubType(string file) - { - if(!m_SubTypes.ContainsKey(file)) - { - return SubType.Code; - } - - return m_SubTypes[file]; - } - - public string GetResourceName(string file) - { - if(!m_ResourceNames.ContainsKey(file)) - { - return string.Empty; - } - - return m_ResourceNames[file]; - } - - public bool GetPreservePath( string file ) - { - if ( !m_PreservePaths.ContainsKey( file ) ) - { - return false; - } - - return m_PreservePaths[ file ]; - } - - public override void Parse(XmlNode node) - { - if( node == null ) - { - throw new ArgumentNullException("node"); - } - foreach(XmlNode child in node.ChildNodes) - { - IDataNode dataNode = Kernel.Instance.ParseNode(child, this); - if(dataNode is FileNode) - { - FileNode fileNode = (FileNode)dataNode; - if(fileNode.IsValid) - { - if (!m_Files.Contains(fileNode.Path)) - { - m_Files.Add(fileNode.Path); - m_BuildActions[fileNode.Path] = fileNode.BuildAction; - m_SubTypes[fileNode.Path] = fileNode.SubType; - m_ResourceNames[fileNode.Path] = fileNode.ResourceName; - m_PreservePaths[ fileNode.Path ] = fileNode.PreservePath; - m_Links[ fileNode.Path ] = fileNode.IsLink; - m_LinkPaths[ fileNode.Path ] = fileNode.LinkPath; - m_CopyToOutputs[ fileNode.Path ] = fileNode.CopyToOutput; - - } - } - } - else if(dataNode is MatchNode) - { - foreach(string file in ((MatchNode)dataNode).Files) - { - MatchNode matchNode = (MatchNode)dataNode; - if (!m_Files.Contains(file)) - { - m_Files.Add(file); - if (matchNode.BuildAction == null) - m_BuildActions[file] = GetBuildActionByFileName(file); - else - m_BuildActions[file] = matchNode.BuildAction.Value; - m_SubTypes[file] = matchNode.SubType == null ? GetSubTypeByFileName(file) : matchNode.SubType.Value; - m_ResourceNames[ file ] = matchNode.ResourceName; - m_PreservePaths[ file ] = matchNode.PreservePath; - m_Links[ file ] = matchNode.IsLink; - m_LinkPaths[ file ] = matchNode.LinkPath; - m_CopyToOutputs[ file ] = matchNode.CopyToOutput; - - } - } - } - } - } - - // TODO: Check in to why StringCollection's enumerator doesn't implement - // IEnumerator? - public IEnumerator GetEnumerator() - { - return m_Files.GetEnumerator(); - } - - #endregion - - } -} diff --git a/Prebuild/src/Core/Nodes/.svn/text-base/MatchNode.cs.svn-base b/Prebuild/src/Core/Nodes/.svn/text-base/MatchNode.cs.svn-base deleted file mode 100644 index 9735265..0000000 --- a/Prebuild/src/Core/Nodes/.svn/text-base/MatchNode.cs.svn-base +++ /dev/null @@ -1,367 +0,0 @@ -#region BSD License -/* -Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com) - -Redistribution and use in source and binary forms, with or without modification, are permitted -provided that the following conditions are met: - -* Redistributions of source code must retain the above copyright notice, this list of conditions - and the following disclaimer. -* Redistributions in binary form must reproduce the above copyright notice, this list of conditions - and the following disclaimer in the documentation and/or other materials provided with the - distribution. -* The name of the author may not be used to endorse or promote products derived from this software - without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, -BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY -OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING -IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ -#endregion - -using System; -using System.Collections.Generic; -using System.IO; -using System.Text.RegularExpressions; -using System.Xml; - -using Prebuild.Core.Attributes; -using Prebuild.Core.Interfaces; -using Prebuild.Core.Utilities; - -namespace Prebuild.Core.Nodes -{ - /// - /// - /// - [DataNode("Match")] - public class MatchNode : DataNode - { - #region Fields - - private readonly List m_Files = new List(); - private Regex m_Regex; - private BuildAction? m_BuildAction; - private SubType? m_SubType; - string m_ResourceName = ""; - private CopyToOutput m_CopyToOutput; - private bool m_Link; - private string m_LinkPath; - private bool m_PreservePath; - private readonly List m_Exclusions = new List(); - - #endregion - - #region Properties - - /// - /// - /// - public IEnumerable Files - { - get - { - return m_Files; - } - } - - /// - /// - /// - public BuildAction? BuildAction - { - get - { - return m_BuildAction; - } - } - - /// - /// - /// - public SubType? SubType - { - get - { - return m_SubType; - } - } - - public CopyToOutput CopyToOutput - { - get - { - return m_CopyToOutput; - } - } - - public bool IsLink - { - get - { - return m_Link; - } - } - - public string LinkPath - { - get - { - return m_LinkPath; - } - } - /// - /// - /// - public string ResourceName - { - get - { - return m_ResourceName; - } - } - - public bool PreservePath - { - get - { - return m_PreservePath; - } - } - - #endregion - - #region Private Methods - - /// - /// Recurses the directories. - /// - /// The path. - /// The pattern. - /// if set to true [recurse]. - /// if set to true [use regex]. - private void RecurseDirectories(string path, string pattern, bool recurse, bool useRegex, List exclusions) - { - Match match; - try - { - string[] files; - - Boolean excludeFile; - if(!useRegex) - { - try - { - files = Directory.GetFiles(path, pattern); - } - catch (IOException) - { - // swallow weird IOException error when running in a virtual box - // guest OS on a network share when the host OS is not Windows. - // This seems to happen on network shares - // when no files match, and may be related to this report: - // http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=254546 - - files = null; - } - - if(files != null) - { - foreach (string file in files) - { - excludeFile = false; - string fileTemp; - if (file.Substring(0,2) == "./" || file.Substring(0,2) == ".\\") - { - fileTemp = file.Substring(2); - } - else - { - fileTemp = file; - } - - // Check all excludions and set flag if there are any hits. - foreach ( ExcludeNode exclude in exclusions ) - { - Regex exRegEx = new Regex( exclude.Pattern ); - match = exRegEx.Match( file ); - excludeFile |= match.Success; - } - - if ( !excludeFile ) - { - m_Files.Add( fileTemp ); - } - - } - } - - // don't call return here, because we may need to recursively search directories below - // this one, even if no matches were found in this directory. - } - else - { - try - { - files = Directory.GetFiles(path); - } - catch (IOException) - { - // swallow weird IOException error when running in a virtual box - // guest OS on a network share. - files = null; - } - - if (files != null) - { - foreach (string file in files) - { - excludeFile = false; - - match = m_Regex.Match(file); - if (match.Success) - { - // Check all excludions and set flag if there are any hits. - foreach (ExcludeNode exclude in exclusions) - { - Regex exRegEx = new Regex(exclude.Pattern); - match = exRegEx.Match(file); - excludeFile |= !match.Success; - } - - if (!excludeFile) - { - m_Files.Add(file); - } - } - } - } - } - - if(recurse) - { - string[] dirs = Directory.GetDirectories(path); - if(dirs != null && dirs.Length > 0) - { - foreach (string str in dirs) - { - // hack to skip subversion folders. Not having this can cause - // a significant performance hit when running on a network drive. - if (str.EndsWith(".svn")) - continue; - - RecurseDirectories(Helper.NormalizePath(str), pattern, recurse, useRegex, exclusions); - } - } - } - } - catch(DirectoryNotFoundException) - { - return; - } - catch(ArgumentException) - { - return; - } - } - - #endregion - - #region Public Methods - - /// - /// - /// - /// - public override void Parse(XmlNode node) - { - if( node == null ) - { - throw new ArgumentNullException("node"); - } - string path = Helper.AttributeValue(node, "path", "."); - string pattern = Helper.AttributeValue(node, "pattern", "*"); - bool recurse = (bool)Helper.TranslateValue(typeof(bool), Helper.AttributeValue(node, "recurse", "false")); - bool useRegex = (bool)Helper.TranslateValue(typeof(bool), Helper.AttributeValue(node, "useRegex", "false")); - string buildAction = Helper.AttributeValue(node, "buildAction", String.Empty); - if (buildAction != string.Empty) - m_BuildAction = (BuildAction)Enum.Parse(typeof(BuildAction), buildAction); - - //TODO: Figure out where the subtype node is being assigned - //string subType = Helper.AttributeValue(node, "subType", string.Empty); - //if (subType != String.Empty) - // m_SubType = (SubType)Enum.Parse(typeof(SubType), subType); - m_ResourceName = Helper.AttributeValue(node, "resourceName", m_ResourceName); - m_CopyToOutput = (CopyToOutput) Enum.Parse(typeof(CopyToOutput), Helper.AttributeValue(node, "copyToOutput", m_CopyToOutput.ToString())); - m_Link = bool.Parse(Helper.AttributeValue(node, "link", bool.FalseString)); - if ( m_Link ) - { - m_LinkPath = Helper.AttributeValue( node, "linkPath", string.Empty ); - } - m_PreservePath = bool.Parse( Helper.AttributeValue( node, "preservePath", bool.FalseString ) ); - - - if(path != null && path.Length == 0) - { - path = ".";//use current directory - } - //throw new WarningException("Match must have a 'path' attribute"); - - if(pattern == null) - { - throw new WarningException("Match must have a 'pattern' attribute"); - } - - path = Helper.NormalizePath(path); - if(!Directory.Exists(path)) - { - throw new WarningException("Match path does not exist: {0}", path); - } - - try - { - if(useRegex) - { - m_Regex = new Regex(pattern); - } - } - catch(ArgumentException ex) - { - throw new WarningException("Could not compile regex pattern: {0}", ex.Message); - } - - - foreach(XmlNode child in node.ChildNodes) - { - IDataNode dataNode = Kernel.Instance.ParseNode(child, this); - if(dataNode is ExcludeNode) - { - ExcludeNode excludeNode = (ExcludeNode)dataNode; - m_Exclusions.Add( excludeNode ); - } - } - - RecurseDirectories( path, pattern, recurse, useRegex, m_Exclusions ); - - if (m_Files.Count < 1) - { - // Include the project name when the match node returns no matches to provide extra - // debug info. - ProjectNode project = Parent.Parent as ProjectNode; - string projectName = ""; - - if (project != null) - projectName = " in project " + project.AssemblyName; - - throw new WarningException("Match" + projectName + " returned no files: {0}{1}", Helper.EndPath(path), pattern); - } - m_Regex = null; - } - - #endregion - } -} diff --git a/Prebuild/src/Core/Nodes/.svn/text-base/OptionsNode.cs.svn-base b/Prebuild/src/Core/Nodes/.svn/text-base/OptionsNode.cs.svn-base deleted file mode 100644 index 577de71..0000000 --- a/Prebuild/src/Core/Nodes/.svn/text-base/OptionsNode.cs.svn-base +++ /dev/null @@ -1,634 +0,0 @@ -#region BSD License -/* -Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com) - -Redistribution and use in source and binary forms, with or without modification, are permitted -provided that the following conditions are met: - -* Redistributions of source code must retain the above copyright notice, this list of conditions - and the following disclaimer. -* Redistributions in binary form must reproduce the above copyright notice, this list of conditions - and the following disclaimer in the documentation and/or other materials provided with the - distribution. -* The name of the author may not be used to endorse or promote products derived from this software - without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, -BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY -OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING -IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ -#endregion - -using System; -using System.Collections.Generic; -using System.Reflection; -using System.Xml; - -using Prebuild.Core.Attributes; -using Prebuild.Core.Interfaces; -using Prebuild.Core.Utilities; - -namespace Prebuild.Core.Nodes -{ - /// - /// - /// - [DataNode("Options")] - public class OptionsNode : DataNode - { - #region Fields - - private static readonly Dictionary m_OptionFields = new Dictionary(); - - [OptionNode("CompilerDefines")] - private string m_CompilerDefines = ""; - - /// - /// - /// - public string CompilerDefines - { - get - { - return m_CompilerDefines; - } - set - { - m_CompilerDefines = value; - } - } - - [OptionNode("OptimizeCode")] - private bool m_OptimizeCode; - - /// - /// - /// - public bool OptimizeCode - { - get - { - return m_OptimizeCode; - } - set - { - m_OptimizeCode = value; - } - } - - [OptionNode("CheckUnderflowOverflow")] - private bool m_CheckUnderflowOverflow; - - /// - /// - /// - public bool CheckUnderflowOverflow - { - get - { - return m_CheckUnderflowOverflow; - } - set - { - m_CheckUnderflowOverflow = value; - } - } - - [OptionNode("AllowUnsafe")] - private bool m_AllowUnsafe; - - /// - /// - /// - public bool AllowUnsafe - { - get - { - return m_AllowUnsafe; - } - set - { - m_AllowUnsafe = value; - } - } - - [OptionNode("PreBuildEvent")] - private string m_PreBuildEvent; - - /// - /// - /// - public string PreBuildEvent - { - get - { - return m_PreBuildEvent; - } - set - { - m_PreBuildEvent = value; - } - } - - [OptionNode("PostBuildEvent")] - private string m_PostBuildEvent; - - /// - /// - /// - public string PostBuildEvent - { - get - { - return m_PostBuildEvent; - } - set - { - m_PostBuildEvent = value; - } - } - - [OptionNode("PreBuildEventArgs")] - private string m_PreBuildEventArgs; - - /// - /// - /// - public string PreBuildEventArgs - { - get - { - return m_PreBuildEventArgs; - } - set - { - m_PreBuildEventArgs = value; - } - } - - [OptionNode("PostBuildEventArgs")] - private string m_PostBuildEventArgs; - - /// - /// - /// - public string PostBuildEventArgs - { - get - { - return m_PostBuildEventArgs; - } - set - { - m_PostBuildEventArgs = value; - } - } - - [OptionNode("RunPostBuildEvent")] - private string m_RunPostBuildEvent; - - /// - /// - /// - public string RunPostBuildEvent - { - get - { - return m_RunPostBuildEvent; - } - set - { - m_RunPostBuildEvent = value; - } - } - - [OptionNode("RunScript")] - private string m_RunScript; - - /// - /// - /// - public string RunScript - { - get - { - return m_RunScript; - } - set - { - m_RunScript = value; - } - } - - [OptionNode("WarningLevel")] - private int m_WarningLevel = 4; - - /// - /// - /// - public int WarningLevel - { - get - { - return m_WarningLevel; - } - set - { - m_WarningLevel = value; - } - } - - [OptionNode("WarningsAsErrors")] - private bool m_WarningsAsErrors; - - /// - /// - /// - public bool WarningsAsErrors - { - get - { - return m_WarningsAsErrors; - } - set - { - m_WarningsAsErrors = value; - } - } - - [OptionNode("SuppressWarnings")] - private string m_SuppressWarnings = ""; - - /// - /// - /// - public string SuppressWarnings - { - get - { - return m_SuppressWarnings; - } - set - { - m_SuppressWarnings = value; - } - } - - [OptionNode("OutputPath")] - private string m_OutputPath = "bin/"; - - /// - /// - /// - public string OutputPath - { - get - { - return m_OutputPath; - } - set - { - m_OutputPath = value; - } - } - - [OptionNode("GenerateDocumentation")] - private bool m_GenerateDocumentation; - - /// - /// - /// - public bool GenerateDocumentation - { - get - { - return m_GenerateDocumentation; - } - set - { - m_GenerateDocumentation = value; - } - } - - [OptionNode("GenerateXmlDocFile")] - private bool m_GenerateXmlDocFile; - - /// - /// - /// - public bool GenerateXmlDocFile - { - get - { - return m_GenerateXmlDocFile; - } - set - { - m_GenerateXmlDocFile = value; - } - } - - [OptionNode("XmlDocFile")] - private string m_XmlDocFile = ""; - - /// - /// - /// - public string XmlDocFile - { - get - { - return m_XmlDocFile; - } - set - { - m_XmlDocFile = value; - } - } - - [OptionNode("KeyFile")] - private string m_KeyFile = ""; - - /// - /// - /// - public string KeyFile - { - get - { - return m_KeyFile; - } - set - { - m_KeyFile = value; - } - } - - [OptionNode("DebugInformation")] - private bool m_DebugInformation; - - /// - /// - /// - public bool DebugInformation - { - get - { - return m_DebugInformation; - } - set - { - m_DebugInformation = value; - } - } - - [OptionNode("RegisterComInterop")] - private bool m_RegisterComInterop; - - /// - /// - /// - public bool RegisterComInterop - { - get - { - return m_RegisterComInterop; - } - set - { - m_RegisterComInterop = value; - } - } - - [OptionNode("RemoveIntegerChecks")] - private bool m_RemoveIntegerChecks; - - /// - /// - /// - public bool RemoveIntegerChecks - { - get - { - return m_RemoveIntegerChecks; - } - set - { - m_RemoveIntegerChecks = value; - } - } - - [OptionNode("IncrementalBuild")] - private bool m_IncrementalBuild; - - /// - /// - /// - public bool IncrementalBuild - { - get - { - return m_IncrementalBuild; - } - set - { - m_IncrementalBuild = value; - } - } - - [OptionNode("BaseAddress")] - private string m_BaseAddress = "285212672"; - - /// - /// - /// - public string BaseAddress - { - get - { - return m_BaseAddress; - } - set - { - m_BaseAddress = value; - } - } - - [OptionNode("FileAlignment")] - private int m_FileAlignment = 4096; - - /// - /// - /// - public int FileAlignment - { - get - { - return m_FileAlignment; - } - set - { - m_FileAlignment = value; - } - } - - [OptionNode("NoStdLib")] - private bool m_NoStdLib; - - /// - /// - /// - public bool NoStdLib - { - get - { - return m_NoStdLib; - } - set - { - m_NoStdLib = value; - } - } - - private readonly List m_FieldsDefined = new List(); - - #endregion - - #region Constructors - - /// - /// Initializes the class. - /// - static OptionsNode() - { - Type t = typeof(OptionsNode); - - foreach(FieldInfo f in t.GetFields(BindingFlags.NonPublic | BindingFlags.Instance)) - { - object[] attrs = f.GetCustomAttributes(typeof(OptionNodeAttribute), false); - if(attrs == null || attrs.Length < 1) - { - continue; - } - - OptionNodeAttribute ona = (OptionNodeAttribute)attrs[0]; - m_OptionFields[ona.NodeName] = f; - } - } - - #endregion - - #region Properties - - /// - /// Gets the at the specified index. - /// - /// - public object this[string index] - { - get - { - if(!m_OptionFields.ContainsKey(index)) - { - return null; - } - - FieldInfo f = m_OptionFields[index]; - return f.GetValue(this); - } - } - - /// - /// Gets the at the specified index. - /// - /// - public object this[string index, object defaultValue] - { - get - { - object valueObject = this[index]; - if(valueObject != null && valueObject is string && ((string)valueObject).Length == 0) - { - return defaultValue; - } - return valueObject; - } - } - - - #endregion - - #region Private Methods - - private void FlagDefined(string name) - { - if(!m_FieldsDefined.Contains(name)) - { - m_FieldsDefined.Add(name); - } - } - - private void SetOption(string nodeName, string val) - { - lock(m_OptionFields) - { - if(!m_OptionFields.ContainsKey(nodeName)) - { - return; - } - - FieldInfo f = m_OptionFields[nodeName]; - f.SetValue(this, Helper.TranslateValue(f.FieldType, val)); - FlagDefined(f.Name); - } - } - - #endregion - - #region Public Methods - - /// - /// Parses the specified node. - /// - /// The node. - public override void Parse(XmlNode node) - { - if( node == null ) - { - throw new ArgumentNullException("node"); - } - - foreach(XmlNode child in node.ChildNodes) - { - SetOption(child.Name, Helper.InterpolateForEnvironmentVariables(child.InnerText)); - } - } - - /// - /// Copies to. - /// - /// The opt. - public void CopyTo(OptionsNode opt) - { - if(opt == null) - { - return; - } - - foreach(FieldInfo f in m_OptionFields.Values) - { - if(m_FieldsDefined.Contains(f.Name)) - { - f.SetValue(opt, f.GetValue(this)); - opt.m_FieldsDefined.Add(f.Name); - } - } - } - - #endregion - } -} diff --git a/Prebuild/src/Core/Nodes/.svn/text-base/ProcessNode.cs.svn-base b/Prebuild/src/Core/Nodes/.svn/text-base/ProcessNode.cs.svn-base deleted file mode 100644 index 8ca8e49..0000000 --- a/Prebuild/src/Core/Nodes/.svn/text-base/ProcessNode.cs.svn-base +++ /dev/null @@ -1,108 +0,0 @@ -#region BSD License -/* -Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com) - -Redistribution and use in source and binary forms, with or without modification, are permitted -provided that the following conditions are met: - -* Redistributions of source code must retain the above copyright notice, this list of conditions - and the following disclaimer. -* Redistributions in binary form must reproduce the above copyright notice, this list of conditions - and the following disclaimer in the documentation and/or other materials provided with the - distribution. -* The name of the author may not be used to endorse or promote products derived from this software - without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, -BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY -OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING -IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ -#endregion - -using System; -using System.Xml; - -using Prebuild.Core.Attributes; -using Prebuild.Core.Interfaces; -using Prebuild.Core.Utilities; - -namespace Prebuild.Core.Nodes -{ - /// - /// - /// - [DataNode("Process")] - public class ProcessNode : DataNode - { - #region Fields - - private string m_Path; - private bool m_IsValid = true; - - #endregion - - #region Properties - - /// - /// Gets the path. - /// - /// The path. - public string Path - { - get - { - return m_Path; - } - } - - /// - /// Gets a value indicating whether this instance is valid. - /// - /// true if this instance is valid; otherwise, false. - public bool IsValid - { - get - { - return m_IsValid; - } - } - - #endregion - - #region Public Methods - - /// - /// Parses the specified node. - /// - /// The node. - public override void Parse(XmlNode node) - { - if( node == null ) - { - throw new ArgumentNullException("node"); - } - - m_Path = Helper.InterpolateForEnvironmentVariables(node.InnerText); - if(m_Path == null) - { - m_Path = ""; - } - - try - { - m_Path = Helper.ResolvePath(m_Path); - } - catch(ArgumentException) - { - Kernel.Instance.Log.Write(LogType.Warning, "Could not find prebuild file for processing: {0}", m_Path); - m_IsValid = false; - } - } - - #endregion - } -} diff --git a/Prebuild/src/Core/Nodes/.svn/text-base/ProjectNode.cs.svn-base b/Prebuild/src/Core/Nodes/.svn/text-base/ProjectNode.cs.svn-base deleted file mode 100644 index fb92b32..0000000 --- a/Prebuild/src/Core/Nodes/.svn/text-base/ProjectNode.cs.svn-base +++ /dev/null @@ -1,579 +0,0 @@ -#region BSD License -/* -Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com) - -Redistribution and use in source and binary forms, with or without modification, are permitted -provided that the following conditions are met: - -* Redistributions of source code must retain the above copyright notice, this list of conditions - and the following disclaimer. -* Redistributions in binary form must reproduce the above copyright notice, this list of conditions - and the following disclaimer in the documentation and/or other materials provided with the - distribution. -* The name of the author may not be used to endorse or promote products derived from this software - without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, -BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY -OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING -IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ -#endregion - -using System; -using System.Collections.Generic; -using System.IO; -using System.Xml; - -using Prebuild.Core.Attributes; -using Prebuild.Core.Interfaces; -using Prebuild.Core.Utilities; - -namespace Prebuild.Core.Nodes -{ - /// - /// A set of values that the Project's type can be - /// - public enum ProjectType - { - /// - /// The project is a console executable - /// - Exe, - /// - /// The project is a windows executable - /// - WinExe, - /// - /// The project is a library - /// - Library, - /// - /// The project is a website - /// - Web, - } - - /// - /// - /// - public enum ClrRuntime - { - /// - /// - /// - Microsoft, - /// - /// - /// - Mono - } - /// - /// The version of the .NET framework to use (Required for VS2008) - /// We don't need .NET 1.1 in here, it'll default when using vs2003. - /// - public enum FrameworkVersion - { - /// - /// .NET 2.0 - /// - v2_0, - /// - /// .NET 3.0 - /// - v3_0, - /// - /// .NET 3.5 - /// - v3_5, - /// - /// .NET 4.0 - /// - v4_0, - } - /// - /// The Node object representing /Prebuild/Solution/Project elements - /// - [DataNode("Project")] - public class ProjectNode : DataNode, IComparable - { - #region Fields - - private string m_Name = "unknown"; - private string m_Path = ""; - private string m_FullPath = ""; - private string m_AssemblyName; - private string m_AppIcon = ""; - private string m_ConfigFile = ""; - private string m_DesignerFolder = ""; - private string m_Language = "C#"; - private ProjectType m_Type = ProjectType.Exe; - private ClrRuntime m_Runtime = ClrRuntime.Microsoft; - private FrameworkVersion m_Framework = FrameworkVersion.v2_0; - private string m_StartupObject = ""; - private string m_RootNamespace; - private string m_FilterGroups = ""; - private string m_Version = ""; - private Guid m_Guid; - private string m_DebugStartParameters; - - private readonly Dictionary m_Configurations = new Dictionary(); - private readonly List m_ReferencePaths = new List(); - private readonly List m_References = new List(); - private readonly List m_Authors = new List(); - private FilesNode m_Files; - - #endregion - - #region Properties - - /// - /// Gets the name. - /// - /// The name. - public string Name - { - get - { - return m_Name; - } - } - /// - /// The version of the .NET Framework to compile under - /// - public FrameworkVersion FrameworkVersion - { - get - { - return m_Framework; - } - } - /// - /// Gets the path. - /// - /// The path. - public string Path - { - get - { - return m_Path; - } - } - - /// - /// Gets the filter groups. - /// - /// The filter groups. - public string FilterGroups - { - get - { - return m_FilterGroups; - } - } - - /// - /// Gets the project's version - /// - /// The project's version. - public string Version - { - get - { - return m_Version; - } - } - - /// - /// Gets the full path. - /// - /// The full path. - public string FullPath - { - get - { - return m_FullPath; - } - } - - /// - /// Gets the name of the assembly. - /// - /// The name of the assembly. - public string AssemblyName - { - get - { - return m_AssemblyName; - } - } - - /// - /// Gets the app icon. - /// - /// The app icon. - public string AppIcon - { - get - { - return m_AppIcon; - } - } - - /// - /// Gets the app icon. - /// - /// The app icon. - public string ConfigFile - { - get - { - return m_ConfigFile; - } - } - - /// - /// - /// - public string DesignerFolder - { - get - { - return m_DesignerFolder; - } - } - - /// - /// Gets the language. - /// - /// The language. - public string Language - { - get - { - return m_Language; - } - } - - /// - /// Gets the type. - /// - /// The type. - public ProjectType Type - { - get - { - return m_Type; - } - } - - /// - /// Gets the runtime. - /// - /// The runtime. - public ClrRuntime Runtime - { - get - { - return m_Runtime; - } - } - - private bool m_GenerateAssemblyInfoFile; - - /// - /// - /// - public bool GenerateAssemblyInfoFile - { - get - { - return m_GenerateAssemblyInfoFile; - } - set - { - m_GenerateAssemblyInfoFile = value; - } - } - - /// - /// Gets the startup object. - /// - /// The startup object. - public string StartupObject - { - get - { - return m_StartupObject; - } - } - - /// - /// Gets the root namespace. - /// - /// The root namespace. - public string RootNamespace - { - get - { - return m_RootNamespace; - } - } - - /// - /// Gets the configurations. - /// - /// The configurations. - public List Configurations - { - get - { - List tmp = new List(ConfigurationsTable.Values); - tmp.Sort(); - return tmp; - } - } - - /// - /// Gets the configurations table. - /// - /// The configurations table. - public Dictionary ConfigurationsTable - { - get - { - return m_Configurations; - } - } - - /// - /// Gets the reference paths. - /// - /// The reference paths. - public List ReferencePaths - { - get - { - List tmp = new List(m_ReferencePaths); - tmp.Sort(); - return tmp; - } - } - - /// - /// Gets the references. - /// - /// The references. - public List References - { - get - { - List tmp = new List(m_References); - tmp.Sort(); - return tmp; - } - } - - /// - /// Gets the Authors list. - /// - /// The list of the project's authors. - public List Authors - { - get - { - return m_Authors; - } - } - - /// - /// Gets the files. - /// - /// The files. - public FilesNode Files - { - get - { - return m_Files; - } - } - - /// - /// Gets or sets the parent. - /// - /// The parent. - public override IDataNode Parent - { - get - { - return base.Parent; - } - set - { - base.Parent = value; - if(base.Parent is SolutionNode && m_Configurations.Count < 1) - { - SolutionNode parent = (SolutionNode)base.Parent; - foreach(ConfigurationNode conf in parent.Configurations) - { - m_Configurations[conf.NameAndPlatform] = (ConfigurationNode) conf.Clone(); - } - } - } - } - - /// - /// Gets the GUID. - /// - /// The GUID. - public Guid Guid - { - get - { - return m_Guid; - } - } - - public string DebugStartParameters - { - get - { - return m_DebugStartParameters; - } - } - - #endregion - - #region Private Methods - - private void HandleConfiguration(ConfigurationNode conf) - { - if(String.Compare(conf.Name, "all", true) == 0) //apply changes to all, this may not always be applied first, - //so it *may* override changes to the same properties for configurations defines at the project level - { - foreach(ConfigurationNode confNode in m_Configurations.Values) - { - conf.CopyTo(confNode);//update the config templates defines at the project level with the overrides - } - } - if(m_Configurations.ContainsKey(conf.NameAndPlatform)) - { - ConfigurationNode parentConf = m_Configurations[conf.NameAndPlatform]; - conf.CopyTo(parentConf);//update the config templates defines at the project level with the overrides - } - else - { - m_Configurations[conf.NameAndPlatform] = conf; - } - } - - #endregion - - #region Public Methods - - /// - /// Parses the specified node. - /// - /// The node. - public override void Parse(XmlNode node) - { - m_Name = Helper.AttributeValue(node, "name", m_Name); - m_Path = Helper.AttributeValue(node, "path", m_Path); - m_FilterGroups = Helper.AttributeValue(node, "filterGroups", m_FilterGroups); - m_Version = Helper.AttributeValue(node, "version", m_Version); - m_AppIcon = Helper.AttributeValue(node, "icon", m_AppIcon); - m_ConfigFile = Helper.AttributeValue(node, "configFile", m_ConfigFile); - m_DesignerFolder = Helper.AttributeValue(node, "designerFolder", m_DesignerFolder); - m_AssemblyName = Helper.AttributeValue(node, "assemblyName", m_AssemblyName); - m_Language = Helper.AttributeValue(node, "language", m_Language); - m_Type = (ProjectType)Helper.EnumAttributeValue(node, "type", typeof(ProjectType), m_Type); - m_Runtime = (ClrRuntime)Helper.EnumAttributeValue(node, "runtime", typeof(ClrRuntime), m_Runtime); - m_Framework = (FrameworkVersion)Helper.EnumAttributeValue(node, "frameworkVersion", typeof(FrameworkVersion), m_Framework); - m_StartupObject = Helper.AttributeValue(node, "startupObject", m_StartupObject); - m_RootNamespace = Helper.AttributeValue(node, "rootNamespace", m_RootNamespace); - - int hash = m_Name.GetHashCode(); - Guid guidByHash = new Guid(hash, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); - string guid = Helper.AttributeValue(node, "guid", guidByHash.ToString()); - m_Guid = new Guid(guid); - - m_GenerateAssemblyInfoFile = Helper.ParseBoolean(node, "generateAssemblyInfoFile", false); - m_DebugStartParameters = Helper.AttributeValue(node, "debugStartParameters", string.Empty); - - if(string.IsNullOrEmpty(m_AssemblyName)) - { - m_AssemblyName = m_Name; - } - - if(string.IsNullOrEmpty(m_RootNamespace)) - { - m_RootNamespace = m_Name; - } - - m_FullPath = m_Path; - try - { - m_FullPath = Helper.ResolvePath(m_FullPath); - } - catch - { - throw new WarningException("Could not resolve Solution path: {0}", m_Path); - } - - Kernel.Instance.CurrentWorkingDirectory.Push(); - try - { - Helper.SetCurrentDir(m_FullPath); - - if( node == null ) - { - throw new ArgumentNullException("node"); - } - - foreach(XmlNode child in node.ChildNodes) - { - IDataNode dataNode = Kernel.Instance.ParseNode(child, this); - if(dataNode is ConfigurationNode) - { - HandleConfiguration((ConfigurationNode)dataNode); - } - else if(dataNode is ReferencePathNode) - { - m_ReferencePaths.Add((ReferencePathNode)dataNode); - } - else if(dataNode is ReferenceNode) - { - m_References.Add((ReferenceNode)dataNode); - } - else if(dataNode is AuthorNode) - { - m_Authors.Add((AuthorNode)dataNode); - } - else if(dataNode is FilesNode) - { - m_Files = (FilesNode)dataNode; - } - } - } - finally - { - Kernel.Instance.CurrentWorkingDirectory.Pop(); - } - } - - #endregion - - #region IComparable Members - - public int CompareTo(object obj) - { - ProjectNode that = (ProjectNode)obj; - return m_Name.CompareTo(that.m_Name); - } - - #endregion - } -} diff --git a/Prebuild/src/Core/Nodes/.svn/text-base/ReferenceNode.cs.svn-base b/Prebuild/src/Core/Nodes/.svn/text-base/ReferenceNode.cs.svn-base deleted file mode 100644 index 9c5d1a3..0000000 --- a/Prebuild/src/Core/Nodes/.svn/text-base/ReferenceNode.cs.svn-base +++ /dev/null @@ -1,144 +0,0 @@ -#region BSD License -/* -Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com) - -Redistribution and use in source and binary forms, with or without modification, are permitted -provided that the following conditions are met: - -* Redistributions of source code must retain the above copyright notice, this list of conditions - and the following disclaimer. -* Redistributions in binary form must reproduce the above copyright notice, this list of conditions - and the following disclaimer in the documentation and/or other materials provided with the - distribution. -* The name of the author may not be used to endorse or promote products derived from this software - without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, -BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY -OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING -IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ -#endregion - -using System; -using System.Xml; - -using Prebuild.Core.Attributes; -using Prebuild.Core.Interfaces; -using Prebuild.Core.Utilities; - -namespace Prebuild.Core.Nodes -{ - /// - /// - /// - [DataNode("Reference")] - public class ReferenceNode : DataNode, IComparable - { - #region Fields - - private string m_Name = "unknown"; - private string m_Path; - private string m_LocalCopy; - private string m_Version; - - #endregion - - #region Properties - - /// - /// Gets the name. - /// - /// The name. - public string Name - { - get - { - return m_Name; - } - } - - /// - /// Gets the path. - /// - /// The path. - public string Path - { - get - { - return m_Path; - } - } - - /// - /// Gets a value indicating whether [local copy specified]. - /// - /// true if [local copy specified]; otherwise, false. - public bool LocalCopySpecified - { - get - { - return ( m_LocalCopy != null && m_LocalCopy.Length == 0); - } - } - - /// - /// Gets a value indicating whether [local copy]. - /// - /// true if [local copy]; otherwise, false. - public bool LocalCopy - { - get - { - if( m_LocalCopy == null) - { - return false; - } - return bool.Parse(m_LocalCopy); - } - } - - /// - /// Gets the version. - /// - /// The version. - public string Version - { - get - { - return m_Version; - } - } - - #endregion - - #region Public Methods - - /// - /// Parses the specified node. - /// - /// The node. - public override void Parse(XmlNode node) - { - m_Name = Helper.AttributeValue(node, "name", m_Name); - m_Path = Helper.AttributeValue(node, "path", m_Path); - m_LocalCopy = Helper.AttributeValue(node, "localCopy", m_LocalCopy); - m_Version = Helper.AttributeValue(node, "version", m_Version); - } - - #endregion - - #region IComparable Members - - public int CompareTo(object obj) - { - ReferenceNode that = (ReferenceNode)obj; - return this.m_Name.CompareTo(that.m_Name); - } - - #endregion - } -} diff --git a/Prebuild/src/Core/Nodes/.svn/text-base/ReferencePathNode.cs.svn-base b/Prebuild/src/Core/Nodes/.svn/text-base/ReferencePathNode.cs.svn-base deleted file mode 100644 index 7331cd7..0000000 --- a/Prebuild/src/Core/Nodes/.svn/text-base/ReferencePathNode.cs.svn-base +++ /dev/null @@ -1,97 +0,0 @@ -#region BSD License -/* -Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com) - -Redistribution and use in source and binary forms, with or without modification, are permitted -provided that the following conditions are met: - -* Redistributions of source code must retain the above copyright notice, this list of conditions - and the following disclaimer. -* Redistributions in binary form must reproduce the above copyright notice, this list of conditions - and the following disclaimer in the documentation and/or other materials provided with the - distribution. -* The name of the author may not be used to endorse or promote products derived from this software - without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, -BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY -OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING -IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ -#endregion - -using System; -using System.Xml; - -using Prebuild.Core.Attributes; -using Prebuild.Core.Interfaces; -using Prebuild.Core.Utilities; - -namespace Prebuild.Core.Nodes -{ - /// - /// - /// - [DataNode("ReferencePath")] - public class ReferencePathNode : DataNode, IComparable - { - #region Fields - - private string m_Path; - - #endregion - - #region Properties - - /// - /// Gets the path. - /// - /// The path. - public string Path - { - get - { - return m_Path; - } - } - - #endregion - - #region Public Methods - - /// - /// Parses the specified node. - /// - /// The node. - public override void Parse(XmlNode node) - { - if( node == null ) - { - throw new ArgumentNullException("node"); - } - - m_Path = Helper.InterpolateForEnvironmentVariables(node.InnerText); - if(m_Path == null) - { - m_Path = ""; - } - - m_Path = m_Path.Trim(); - } - - #endregion - - #region IComparable Members - - public int CompareTo(object obj) - { - ReferencePathNode that = (ReferencePathNode)obj; - return this.m_Path.CompareTo(that.m_Path); - } - - #endregion - } -} diff --git a/Prebuild/src/Core/Nodes/.svn/text-base/SolutionNode.cs.svn-base b/Prebuild/src/Core/Nodes/.svn/text-base/SolutionNode.cs.svn-base deleted file mode 100644 index 10c0223..0000000 --- a/Prebuild/src/Core/Nodes/.svn/text-base/SolutionNode.cs.svn-base +++ /dev/null @@ -1,382 +0,0 @@ -#region BSD License -/* -Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com) - -Redistribution and use in source and binary forms, with or without modification, are permitted -provided that the following conditions are met: - -* Redistributions of source code must retain the above copyright notice, this list of conditions - and the following disclaimer. -* Redistributions in binary form must reproduce the above copyright notice, this list of conditions - and the following disclaimer in the documentation and/or other materials provided with the - distribution. -* The name of the author may not be used to endorse or promote products derived from this software - without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, -BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY -OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING -IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ -#endregion - -using System; -using System.Collections.Generic; -using System.Diagnostics; -using System.Xml; - -using Prebuild.Core.Attributes; -using Prebuild.Core.Interfaces; -using Prebuild.Core.Utilities; - -namespace Prebuild.Core.Nodes -{ - /// - /// - /// - [DataNode("Solution")] - [DataNode("EmbeddedSolution")] - [DebuggerDisplay("{Name}")] - public class SolutionNode : DataNode - { - #region Fields - - private Guid m_Guid = Guid.NewGuid(); - private string m_Name = "unknown"; - private string m_Path = ""; - private string m_FullPath = ""; - private string m_ActiveConfig; - private string m_Version = "1.0.0"; - - private OptionsNode m_Options; - private FilesNode m_Files; - private readonly ConfigurationNodeCollection m_Configurations = new ConfigurationNodeCollection(); - private readonly Dictionary m_Projects = new Dictionary(); - private readonly Dictionary m_DatabaseProjects = new Dictionary(); - private readonly List m_ProjectsOrder = new List(); - private readonly Dictionary m_Solutions = new Dictionary(); - private CleanupNode m_Cleanup; - - #endregion - - #region Properties - public override IDataNode Parent - { - get - { - return base.Parent; - } - set - { - if (value is SolutionNode) - { - SolutionNode solution = (SolutionNode)value; - foreach (ConfigurationNode conf in solution.Configurations) - { - m_Configurations[conf.Name] = (ConfigurationNode) conf.Clone(); - } - } - - base.Parent = value; - } - } - - public CleanupNode Cleanup - { - get - { - return m_Cleanup; - } - set - { - m_Cleanup = value; - } - } - - public Guid Guid - { - get - { - return m_Guid; - } - set - { - m_Guid = value; - } - } - /// - /// Gets or sets the active config. - /// - /// The active config. - public string ActiveConfig - { - get - { - return m_ActiveConfig; - } - set - { - m_ActiveConfig = value; - } - } - - /// - /// Gets the name. - /// - /// The name. - public string Name - { - get - { - return m_Name; - } - } - - /// - /// Gets the path. - /// - /// The path. - public string Path - { - get - { - return m_Path; - } - } - - /// - /// Gets the full path. - /// - /// The full path. - public string FullPath - { - get - { - return m_FullPath; - } - } - - /// - /// Gets the version. - /// - /// The version. - public string Version - { - get - { - return m_Version; - } - } - - /// - /// Gets the options. - /// - /// The options. - public OptionsNode Options - { - get - { - return m_Options; - } - } - - /// - /// Gets the files. - /// - /// The files. - public FilesNode Files - { - get - { - return m_Files; - } - } - - /// - /// Gets the configurations. - /// - /// The configurations. - public ConfigurationNodeCollection Configurations - { - get - { - ConfigurationNodeCollection tmp = new ConfigurationNodeCollection(); - tmp.AddRange(ConfigurationsTable); - return tmp; - } - } - - /// - /// Gets the configurations table. - /// - /// The configurations table. - public ConfigurationNodeCollection ConfigurationsTable - { - get - { - return m_Configurations; - } - } - /// - /// Gets the database projects. - /// - public ICollection DatabaseProjects - { - get - { - return m_DatabaseProjects.Values; - } - } - /// - /// Gets the nested solutions. - /// - public ICollection Solutions - { - get - { - return m_Solutions.Values; - } - } - /// - /// Gets the nested solutions hash table. - /// - public Dictionary SolutionsTable - { - get - { - return m_Solutions; - } - } - /// - /// Gets the projects. - /// - /// The projects. - public ICollection Projects - { - get - { - List tmp = new List(m_Projects.Values); - tmp.Sort(); - return tmp; - } - } - - /// - /// Gets the projects table. - /// - /// The projects table. - public Dictionary ProjectsTable - { - get - { - return m_Projects; - } - } - - /// - /// Gets the projects table. - /// - /// The projects table. - public List ProjectsTableOrder - { - get - { - return m_ProjectsOrder; - } - } - - #endregion - - #region Public Methods - - /// - /// Parses the specified node. - /// - /// The node. - public override void Parse(XmlNode node) - { - m_Name = Helper.AttributeValue(node, "name", m_Name); - m_ActiveConfig = Helper.AttributeValue(node, "activeConfig", m_ActiveConfig); - m_Path = Helper.AttributeValue(node, "path", m_Path); - m_Version = Helper.AttributeValue(node, "version", m_Version); - - m_FullPath = m_Path; - try - { - m_FullPath = Helper.ResolvePath(m_FullPath); - } - catch - { - throw new WarningException("Could not resolve solution path: {0}", m_Path); - } - - Kernel.Instance.CurrentWorkingDirectory.Push(); - try - { - Helper.SetCurrentDir(m_FullPath); - - if( node == null ) - { - throw new ArgumentNullException("node"); - } - - foreach(XmlNode child in node.ChildNodes) - { - IDataNode dataNode = Kernel.Instance.ParseNode(child, this); - if(dataNode is OptionsNode) - { - m_Options = (OptionsNode)dataNode; - } - else if(dataNode is FilesNode) - { - m_Files = (FilesNode)dataNode; - } - else if(dataNode is ConfigurationNode) - { - ConfigurationNode configurationNode = (ConfigurationNode) dataNode; - m_Configurations[configurationNode.NameAndPlatform] = configurationNode; - - // If the active configuration is null, then we populate it. - if (ActiveConfig == null) - { - ActiveConfig = configurationNode.Name; - } - } - else if(dataNode is ProjectNode) - { - m_Projects[((ProjectNode)dataNode).Name] = (ProjectNode) dataNode; - m_ProjectsOrder.Add((ProjectNode)dataNode); - } - else if(dataNode is SolutionNode) - { - m_Solutions[((SolutionNode)dataNode).Name] = (SolutionNode) dataNode; - } - else if (dataNode is ProcessNode) - { - ProcessNode p = (ProcessNode)dataNode; - Kernel.Instance.ProcessFile(p, this); - } - else if (dataNode is DatabaseProjectNode) - { - m_DatabaseProjects[((DatabaseProjectNode)dataNode).Name] = (DatabaseProjectNode) dataNode; - } - else if(dataNode is CleanupNode) - { - if(m_Cleanup != null) - throw new WarningException("There can only be one Cleanup node."); - m_Cleanup = (CleanupNode)dataNode; - } - } - } - finally - { - Kernel.Instance.CurrentWorkingDirectory.Pop(); - } - } - - #endregion - } -} diff --git a/Prebuild/src/Core/Parse/.svn/all-wcprops b/Prebuild/src/Core/Parse/.svn/all-wcprops deleted file mode 100644 index c77d416..0000000 --- a/Prebuild/src/Core/Parse/.svn/all-wcprops +++ /dev/null @@ -1,17 +0,0 @@ -K 25 -svn:wc:ra_dav:version-url -V 56 -/svnroot/dnpb/!svn/ver/323/trunk/Prebuild/src/Core/Parse -END -IfContext.cs -K 25 -svn:wc:ra_dav:version-url -V 69 -/svnroot/dnpb/!svn/ver/295/trunk/Prebuild/src/Core/Parse/IfContext.cs -END -Preprocessor.cs -K 25 -svn:wc:ra_dav:version-url -V 72 -/svnroot/dnpb/!svn/ver/323/trunk/Prebuild/src/Core/Parse/Preprocessor.cs -END diff --git a/Prebuild/src/Core/Parse/.svn/dir-prop-base b/Prebuild/src/Core/Parse/.svn/dir-prop-base deleted file mode 100644 index a1989a0..0000000 --- a/Prebuild/src/Core/Parse/.svn/dir-prop-base +++ /dev/null @@ -1,5 +0,0 @@ -K 10 -svn:ignore -V 5 -*.swp -END diff --git a/Prebuild/src/Core/Parse/.svn/entries b/Prebuild/src/Core/Parse/.svn/entries deleted file mode 100644 index 2aae711..0000000 --- a/Prebuild/src/Core/Parse/.svn/entries +++ /dev/null @@ -1,96 +0,0 @@ -10 - -dir -323 -https://dnpb.svn.sourceforge.net/svnroot/dnpb/trunk/Prebuild/src/Core/Parse -https://dnpb.svn.sourceforge.net/svnroot/dnpb - - - -2010-09-10T17:51:36.189738Z -323 -jhurliman -has-props - - - - - - - - - - - - - -3355ff64-970d-0410-bbe8-d0fbd18be4fb - -IfContext.cs -file - - - - -2010-09-10T22:51:44.000000Z -859fca08c6a39a48f179d5ffe3d19bd0 -2009-02-19T06:47:52.218324Z -295 -kunnis -has-props - - - - - - - - - - - - - - - - - - - - -3653 - -Preprocessor.cs -file - - - - -2010-09-10T22:51:44.000000Z -6ef27f33f41caca9d4ab6c82ead76902 -2010-09-10T17:51:36.189738Z -323 -jhurliman -has-props - - - - - - - - - - - - - - - - - - - - -18590 - diff --git a/Prebuild/src/Core/Parse/.svn/prop-base/IfContext.cs.svn-base b/Prebuild/src/Core/Parse/.svn/prop-base/IfContext.cs.svn-base deleted file mode 100644 index 7b57b30..0000000 --- a/Prebuild/src/Core/Parse/.svn/prop-base/IfContext.cs.svn-base +++ /dev/null @@ -1,9 +0,0 @@ -K 13 -svn:eol-style -V 6 -native -K 12 -svn:keywords -V 23 -Author Date Id Revision -END diff --git a/Prebuild/src/Core/Parse/.svn/prop-base/Preprocessor.cs.svn-base b/Prebuild/src/Core/Parse/.svn/prop-base/Preprocessor.cs.svn-base deleted file mode 100644 index 7b57b30..0000000 --- a/Prebuild/src/Core/Parse/.svn/prop-base/Preprocessor.cs.svn-base +++ /dev/null @@ -1,9 +0,0 @@ -K 13 -svn:eol-style -V 6 -native -K 12 -svn:keywords -V 23 -Author Date Id Revision -END diff --git a/Prebuild/src/Core/Parse/.svn/text-base/IfContext.cs.svn-base b/Prebuild/src/Core/Parse/.svn/text-base/IfContext.cs.svn-base deleted file mode 100644 index 3c79d38..0000000 --- a/Prebuild/src/Core/Parse/.svn/text-base/IfContext.cs.svn-base +++ /dev/null @@ -1,154 +0,0 @@ -#region BSD License -/* -Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com) - -Redistribution and use in source and binary forms, with or without modification, are permitted -provided that the following conditions are met: - -* Redistributions of source code must retain the above copyright notice, this list of conditions - and the following disclaimer. -* Redistributions in binary form must reproduce the above copyright notice, this list of conditions - and the following disclaimer in the documentation and/or other materials provided with the - distribution. -* The name of the author may not be used to endorse or promote products derived from this software - without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, -BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY -OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING -IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ -#endregion - -using System; - -namespace Prebuild.Core.Parse -{ - /// - /// - /// - public enum IfState - { - /// - /// - /// - None, - /// - /// - /// - If, - /// - /// - /// - ElseIf, - /// - /// - /// - Else - } - - /// - /// Summary description for IfContext. - /// - // Inspired by the equivalent WiX class (see www.sourceforge.net/projects/wix/) - public class IfContext - { - #region Properties - - bool m_Active; - bool m_Keep; - bool m_EverKept; - IfState m_State = IfState.None; - - #endregion - - #region Constructors - - /// - /// Initializes a new instance of the class. - /// - /// if set to true [active]. - /// if set to true [keep]. - /// The state. - public IfContext(bool active, bool keep, IfState state) - { - m_Active = active; - m_Keep = keep; - m_EverKept = keep; - m_State = state; - } - - #endregion - - #region Properties - - /// - /// Gets or sets a value indicating whether this is active. - /// - /// true if active; otherwise, false. - public bool Active - { - get - { - return m_Active; - } - set - { - m_Active = value; - } - } - - /// - /// Gets or sets a value indicating whether this is keep. - /// - /// true if keep; otherwise, false. - public bool Keep - { - get - { - return m_Keep; - } - set - { - m_Keep = value; - if(m_Keep) - { - m_EverKept = true; - } - } - } - - /// - /// Gets a value indicating whether [ever kept]. - /// - /// true if [ever kept]; otherwise, false. - public bool EverKept - { - get - { - return m_EverKept; - } - } - - /// - /// Gets or sets the state. - /// - /// The state. - public IfState State - { - get - { - return m_State; - } - set - { - m_State = value; - } - } - - #endregion - } -} diff --git a/Prebuild/src/Core/Parse/.svn/text-base/Preprocessor.cs.svn-base b/Prebuild/src/Core/Parse/.svn/text-base/Preprocessor.cs.svn-base deleted file mode 100644 index 0648fad..0000000 --- a/Prebuild/src/Core/Parse/.svn/text-base/Preprocessor.cs.svn-base +++ /dev/null @@ -1,652 +0,0 @@ -#region BSD License -/* -Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com) - -Redistribution and use in source and binary forms, with or without modification, are permitted -provided that the following conditions are met: - -* Redistributions of source code must retain the above copyright notice, this list of conditions - and the following disclaimer. -* Redistributions in binary form must reproduce the above copyright notice, this list of conditions - and the following disclaimer in the documentation and/or other materials provided with the - distribution. -* The name of the author may not be used to endorse or promote products derived from this software - without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, -BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY -OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING -IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ -#endregion - -using System; -using System.Collections.Generic; -using System.IO; -using System.Text.RegularExpressions; -using System.Xml; - -namespace Prebuild.Core.Parse -{ - /// - /// - /// - public enum OperatorSymbol - { - /// - /// - /// - None, - /// - /// - /// - Equal, - /// - /// - /// - NotEqual, - /// - /// - /// - LessThan, - /// - /// - /// - GreaterThan, - /// - /// - /// - LessThanEqual, - /// - /// - /// - GreaterThanEqual - } - - /// - /// - /// - public class Preprocessor - { - #region Constants - - /// - /// Includes the regex to look for file tags in the processing instruction. - /// - private static readonly Regex includeFileRegex = new Regex("file=\"(.+?)\""); - - #endregion - - #region Fields - - readonly XmlDocument m_OutDoc = new XmlDocument(); - readonly Stack m_IfStack = new Stack(); - readonly Dictionary m_Variables = new Dictionary(); - - #endregion - - #region Constructors - - /// - /// Initializes a new instance of the class. - /// - public Preprocessor() - { - RegisterVariable("OS", GetOS()); - RegisterVariable("RuntimeVersion", Environment.Version.Major); - RegisterVariable("RuntimeMajor", Environment.Version.Major); - RegisterVariable("RuntimeMinor", Environment.Version.Minor); - RegisterVariable("RuntimeRevision", Environment.Version.Revision); - } - - #endregion - - #region Properties - - /// - /// Gets the processed doc. - /// - /// The processed doc. - public XmlDocument ProcessedDoc - { - get - { - return m_OutDoc; - } - } - - #endregion - - #region Private Methods - - /// - /// Parts of this code were taken from NAnt and is subject to the GPL - /// as per NAnt's license. Thanks to the NAnt guys for this little gem. - /// - /// - public static string GetOS() - { - PlatformID platId = Environment.OSVersion.Platform; - if(platId == PlatformID.Win32NT || platId == PlatformID.Win32Windows) - { - return "Win32"; - } - - if (File.Exists("/System/Library/Frameworks/Cocoa.framework/Cocoa")) - { - return "MACOSX"; - } - - /* - * .NET 1.x, under Mono, the UNIX code is 128. Under - * .NET 2.x, Mono or MS, the UNIX code is 4 - */ - if(Environment.Version.Major == 1) - { - if((int)platId == 128) - { - return "UNIX"; - } - } - else if((int)platId == 4) - { - return "UNIX"; - } - - return "Unknown"; - } - - private static bool CompareNum(OperatorSymbol oper, int val1, int val2) - { - switch(oper) - { - case OperatorSymbol.Equal: - return (val1 == val2); - case OperatorSymbol.NotEqual: - return (val1 != val2); - case OperatorSymbol.LessThan: - return (val1 < val2); - case OperatorSymbol.LessThanEqual: - return (val1 <= val2); - case OperatorSymbol.GreaterThan: - return (val1 > val2); - case OperatorSymbol.GreaterThanEqual: - return (val1 >= val2); - } - - throw new WarningException("Unknown operator type"); - } - - private static bool CompareStr(OperatorSymbol oper, string val1, string val2) - { - switch(oper) - { - case OperatorSymbol.Equal: - return (val1 == val2); - case OperatorSymbol.NotEqual: - return (val1 != val2); - case OperatorSymbol.LessThan: - return (val1.CompareTo(val2) < 0); - case OperatorSymbol.LessThanEqual: - return (val1.CompareTo(val2) <= 0); - case OperatorSymbol.GreaterThan: - return (val1.CompareTo(val2) > 0); - case OperatorSymbol.GreaterThanEqual: - return (val1.CompareTo(val2) >= 0); - } - - throw new WarningException("Unknown operator type"); - } - - private static char NextChar(int idx, string str) - { - if((idx + 1) >= str.Length) - { - return Char.MaxValue; - } - - return str[idx + 1]; - } - // Very very simple expression parser. Can only match expressions of the form - // : - // OS = Windows - // OS != Linux - // RuntimeMinor > 0 - private bool ParseExpression(string exp) - { - if(exp == null) - { - throw new ArgumentException("Invalid expression, cannot be null"); - } - - exp = exp.Trim(); - if(exp.Length < 1) - { - throw new ArgumentException("Invalid expression, cannot be 0 length"); - } - - string id = ""; - string str = ""; - OperatorSymbol oper = OperatorSymbol.None; - bool inStr = false; - - for(int i = 0; i < exp.Length; i++) - { - char c = exp[i]; - if(Char.IsWhiteSpace(c)) - { - continue; - } - - if(Char.IsLetterOrDigit(c) || c == '_') - { - if(inStr) - { - str += c; - } - else - { - id += c; - } - } - else if(c == '\"') - { - inStr = !inStr; - if(inStr) - { - str = ""; - } - } - else - { - if(inStr) - { - str += c; - } - else - { - switch(c) - { - case '=': - oper = OperatorSymbol.Equal; - break; - - case '!': - if(NextChar(i, exp) == '=') - { - oper = OperatorSymbol.NotEqual; - } - - break; - - case '<': - if(NextChar(i, exp) == '=') - { - oper = OperatorSymbol.LessThanEqual; - } - else - { - oper = OperatorSymbol.LessThan; - } - - break; - - case '>': - if(NextChar(i, exp) == '=') - { - oper = OperatorSymbol.GreaterThanEqual; - } - else - { - oper = OperatorSymbol.GreaterThan; - } - - break; - } - } - } - } - - - if(inStr) - { - throw new WarningException("Expected end of string in expression"); - } - - if(oper == OperatorSymbol.None) - { - throw new WarningException("Expected operator in expression"); - } - if(id.Length < 1) - { - throw new WarningException("Expected identifier in expression"); - } - if(str.Length < 1) - { - throw new WarningException("Expected value in expression"); - } - - bool ret; - try - { - object val = m_Variables[id.ToLower()]; - if(val == null) - { - throw new WarningException("Unknown identifier '{0}'", id); - } - - Type t = val.GetType(); - if(t.IsAssignableFrom(typeof(int))) - { - int numVal = (int)val; - int numVal2 = Int32.Parse(str); - ret = CompareNum(oper, numVal, numVal2); - } - else - { - string strVal = val.ToString(); - string strVal2 = str; - ret = CompareStr(oper, strVal, strVal2); - } - } - catch(ArgumentException ex) - { - ex.ToString(); - throw new WarningException("Invalid value type for system variable '{0}', expected int", id); - } - - return ret; - } - - /// - /// Taken from current Prebuild included in OpenSim 0.7.x - /// - /// - /// A - /// - /// - /// A - /// - private static void WildCardInclude (Stack readerStack, string include) - { - if (!include.Contains ("*")) { - return; - } - - // Console.WriteLine("Processing {0}", include); - - // Break up the include into pre and post wildcard sections - string preWildcard = include.Substring (0, include.IndexOf ("*")); - string postWildcard = include.Substring (include.IndexOf ("*") + 2); - - // If preWildcard is a directory, recurse - if (Directory.Exists (preWildcard)) { - string[] directories = Directory.GetDirectories (preWildcard); - Array.Sort (directories); - Array.Reverse (directories); - foreach (string dirPath in directories) { - //Console.WriteLine ("Scanning : {0}", dirPath); - - string includeFile = Path.Combine (dirPath, postWildcard); - if (includeFile.Contains ("*")) { - // postWildcard included another wildcard, recurse. - WildCardInclude (readerStack, includeFile); - } else { - FileInfo file = new FileInfo (includeFile); - if (file.Exists) { - //Console.WriteLine ("Including File: {0}", includeFile); - XmlReader newReader = new XmlTextReader (file.Open (FileMode.Open, FileAccess.Read, FileShare.Read)); - readerStack.Push (newReader); - } - } - } - } else { - // preWildcard is not a path to a directory, so the wildcard is in the filename - string searchFilename = Path.GetFileName (preWildcard.Substring (preWildcard.IndexOf ("/") + 1) + "*" + postWildcard); - Console.WriteLine ("searchFilename: {0}", searchFilename); - - string searchDirectory = Path.GetDirectoryName (preWildcard); - Console.WriteLine ("searchDirectory: {0}", searchDirectory); - - string[] files = Directory.GetFiles (searchDirectory, searchFilename); - Array.Sort (files); - Array.Reverse (files); - foreach (string includeFile in files) { - FileInfo file = new FileInfo (includeFile); - if (file.Exists) { - // Console.WriteLine ("Including File: {0}", includeFile); - XmlReader newReader = new XmlTextReader (file.Open (FileMode.Open, FileAccess.Read, FileShare.Read)); - readerStack.Push (newReader); - } - } - } - } - - #endregion - - #region Public Methods - - /// - /// - /// - /// - /// - public void RegisterVariable(string name, object variableValue) - { - if(name == null || variableValue == null) - { - return; - } - - m_Variables[name.ToLower()] = variableValue; - } - - /// - /// Performs validation on the xml source as well as evaluates conditional and flow expresions - /// - /// For invalid use of conditional expressions or for invalid XML syntax. If a XmlValidatingReader is passed, then will also throw exceptions for non-schema-conforming xml - /// - /// the output xml - public string Process(XmlReader initialReader) - { - if(initialReader == null) - { - throw new ArgumentException("Invalid XML reader to pre-process"); - } - - IfContext context = new IfContext(true, true, IfState.None); - StringWriter xmlText = new StringWriter(); - XmlTextWriter writer = new XmlTextWriter(xmlText); - writer.Formatting = Formatting.Indented; - - // Create a queue of XML readers and add the initial - // reader to it. Then we process until we run out of - // readers which lets the operation add more - // readers to generate a multi-file parser and not require - // XML fragments that a recursive version would use. - Stack readerStack = new Stack(); - readerStack.Push(initialReader); - - while(readerStack.Count > 0) - { - // Pop off the next reader. - XmlReader reader = readerStack.Pop(); - - // Process through this XML reader until it is - // completed (or it is replaced by the include - // operation). - while(reader.Read()) - { - // The prebuild file has a series of processing - // instructions which allow for specific - // inclusions based on operating system or to - // include additional files. - if(reader.NodeType == XmlNodeType.ProcessingInstruction) - { - bool ignore = false; - - switch(reader.LocalName) - { - case "include": - // use regular expressions to parse out the attributes. - MatchCollection matches = includeFileRegex.Matches(reader.Value); - - // make sure there is only one file attribute. - if(matches.Count > 1) - { - throw new WarningException("An node was found, but it specified more than one file."); - } - - if(matches.Count == 0) - { - throw new WarningException("An node was found, but it did not specify the file attribute."); - } - - // ***** Adding for wildcard handling - // Push current reader back onto the stack. - readerStack.Push (reader); - - // Pull the file out from the regex and make sure it is a valid file before using it. - string filename = matches[0].Groups[1].Value; - - filename = String.Join (Path.DirectorySeparatorChar.ToString (), filename.Split (new char[] { '/', '\\' })); - - if (!filename.Contains ("*")) { - - FileInfo includeFile = new FileInfo (filename); - if (!includeFile.Exists) { - throw new WarningException ("Cannot include file: " + includeFile.FullName); - } - - // Create a new reader object for this file. Then put the old reader back on the stack and start - // processing using this new XML reader. - - XmlReader newReader = new XmlTextReader (includeFile.Open (FileMode.Open, FileAccess.Read, FileShare.Read)); - reader = newReader; - readerStack.Push (reader); - - } else { - WildCardInclude (readerStack, filename); - } - - reader = (XmlReader)readerStack.Pop (); - ignore = true; - break; - - case "if": - m_IfStack.Push(context); - context = new IfContext(context.Keep & context.Active, ParseExpression(reader.Value), IfState.If); - ignore = true; - break; - - case "elseif": - if(m_IfStack.Count == 0) - { - throw new WarningException("Unexpected 'elseif' outside of 'if'"); - } - if(context.State != IfState.If && context.State != IfState.ElseIf) - { - throw new WarningException("Unexpected 'elseif' outside of 'if'"); - } - - context.State = IfState.ElseIf; - if(!context.EverKept) - { - context.Keep = ParseExpression(reader.Value); - } - else - { - context.Keep = false; - } - - ignore = true; - break; - - case "else": - if(m_IfStack.Count == 0) - { - throw new WarningException("Unexpected 'else' outside of 'if'"); - } - if(context.State != IfState.If && context.State != IfState.ElseIf) - { - throw new WarningException("Unexpected 'else' outside of 'if'"); - } - - context.State = IfState.Else; - context.Keep = !context.EverKept; - ignore = true; - break; - - case "endif": - if(m_IfStack.Count == 0) - { - throw new WarningException("Unexpected 'endif' outside of 'if'"); - } - - context = m_IfStack.Pop(); - ignore = true; - break; - } - - if(ignore) - { - continue; - } - }//end pre-proc instruction - - if(!context.Active || !context.Keep) - { - continue; - } - - switch(reader.NodeType) - { - case XmlNodeType.Element: - bool empty = reader.IsEmptyElement; - writer.WriteStartElement(reader.Name); - - while (reader.MoveToNextAttribute()) - { - writer.WriteAttributeString(reader.Name, reader.Value); - } - - if(empty) - { - writer.WriteEndElement(); - } - - break; - - case XmlNodeType.EndElement: - writer.WriteEndElement(); - break; - - case XmlNodeType.Text: - writer.WriteString(reader.Value); - break; - - case XmlNodeType.CDATA: - writer.WriteCData(reader.Value); - break; - - default: - break; - } - } - - if(m_IfStack.Count != 0) - { - throw new WarningException("Mismatched 'if', 'endif' pair"); - } - } - - return xmlText.ToString(); - } - - #endregion - } -} diff --git a/Prebuild/src/Core/Targets/.svn/all-wcprops b/Prebuild/src/Core/Targets/.svn/all-wcprops deleted file mode 100644 index 91d6694..0000000 --- a/Prebuild/src/Core/Targets/.svn/all-wcprops +++ /dev/null @@ -1,101 +0,0 @@ -K 25 -svn:wc:ra_dav:version-url -V 58 -/svnroot/dnpb/!svn/ver/323/trunk/Prebuild/src/Core/Targets -END -MakefileTarget.cs -K 25 -svn:wc:ra_dav:version-url -V 76 -/svnroot/dnpb/!svn/ver/307/trunk/Prebuild/src/Core/Targets/MakefileTarget.cs -END -SharpDevelop2Target.cs -K 25 -svn:wc:ra_dav:version-url -V 81 -/svnroot/dnpb/!svn/ver/295/trunk/Prebuild/src/Core/Targets/SharpDevelop2Target.cs -END -ToolInfo.cs -K 25 -svn:wc:ra_dav:version-url -V 70 -/svnroot/dnpb/!svn/ver/290/trunk/Prebuild/src/Core/Targets/ToolInfo.cs -END -VSGenericTarget.cs -K 25 -svn:wc:ra_dav:version-url -V 77 -/svnroot/dnpb/!svn/ver/316/trunk/Prebuild/src/Core/Targets/VSGenericTarget.cs -END -DebugTarget.cs -K 25 -svn:wc:ra_dav:version-url -V 73 -/svnroot/dnpb/!svn/ver/164/trunk/Prebuild/src/Core/Targets/DebugTarget.cs -END -VSVersion.cs -K 25 -svn:wc:ra_dav:version-url -V 71 -/svnroot/dnpb/!svn/ver/316/trunk/Prebuild/src/Core/Targets/VSVersion.cs -END -MonoDevelopTarget.cs -K 25 -svn:wc:ra_dav:version-url -V 79 -/svnroot/dnpb/!svn/ver/307/trunk/Prebuild/src/Core/Targets/MonoDevelopTarget.cs -END -AutotoolsTarget.cs -K 25 -svn:wc:ra_dav:version-url -V 77 -/svnroot/dnpb/!svn/ver/298/trunk/Prebuild/src/Core/Targets/AutotoolsTarget.cs -END -VS2010Target.cs -K 25 -svn:wc:ra_dav:version-url -V 74 -/svnroot/dnpb/!svn/ver/317/trunk/Prebuild/src/Core/Targets/VS2010Target.cs -END -VS2002Target.cs -K 25 -svn:wc:ra_dav:version-url -V 74 -/svnroot/dnpb/!svn/ver/295/trunk/Prebuild/src/Core/Targets/VS2002Target.cs -END -SharpDevelopTarget.cs -K 25 -svn:wc:ra_dav:version-url -V 80 -/svnroot/dnpb/!svn/ver/307/trunk/Prebuild/src/Core/Targets/SharpDevelopTarget.cs -END -VS2003Target.cs -K 25 -svn:wc:ra_dav:version-url -V 74 -/svnroot/dnpb/!svn/ver/307/trunk/Prebuild/src/Core/Targets/VS2003Target.cs -END -VS2005Target.cs -K 25 -svn:wc:ra_dav:version-url -V 74 -/svnroot/dnpb/!svn/ver/307/trunk/Prebuild/src/Core/Targets/VS2005Target.cs -END -NAntTarget.cs -K 25 -svn:wc:ra_dav:version-url -V 72 -/svnroot/dnpb/!svn/ver/323/trunk/Prebuild/src/Core/Targets/NAntTarget.cs -END -XcodeTarget.cs -K 25 -svn:wc:ra_dav:version-url -V 73 -/svnroot/dnpb/!svn/ver/307/trunk/Prebuild/src/Core/Targets/XcodeTarget.cs -END -VS2008Target.cs -K 25 -svn:wc:ra_dav:version-url -V 74 -/svnroot/dnpb/!svn/ver/307/trunk/Prebuild/src/Core/Targets/VS2008Target.cs -END diff --git a/Prebuild/src/Core/Targets/.svn/dir-prop-base b/Prebuild/src/Core/Targets/.svn/dir-prop-base deleted file mode 100644 index a1989a0..0000000 --- a/Prebuild/src/Core/Targets/.svn/dir-prop-base +++ /dev/null @@ -1,5 +0,0 @@ -K 10 -svn:ignore -V 5 -*.swp -END diff --git a/Prebuild/src/Core/Targets/.svn/entries b/Prebuild/src/Core/Targets/.svn/entries deleted file mode 100644 index c6daa49..0000000 --- a/Prebuild/src/Core/Targets/.svn/entries +++ /dev/null @@ -1,572 +0,0 @@ -10 - -dir -323 -https://dnpb.svn.sourceforge.net/svnroot/dnpb/trunk/Prebuild/src/Core/Targets -https://dnpb.svn.sourceforge.net/svnroot/dnpb - - - -2010-09-10T17:51:36.189738Z -323 -jhurliman -has-props - - - - - - - - - - - - - -3355ff64-970d-0410-bbe8-d0fbd18be4fb - -MakefileTarget.cs -file - - - - -2010-09-10T22:51:44.000000Z -9f1538adc7e579b57d104dc7f313946b -2009-04-15T01:28:16.827957Z -307 -kunnis -has-props - - - - - - - - - - - - - - - - - - - - -19043 - -SharpDevelop2Target.cs -file - - - - -2010-09-10T22:51:44.000000Z -f6e8e9d8f335a5a264babb4a8f05a2a5 -2009-02-19T06:47:52.218324Z -295 -kunnis - - - - - - - - - - - - - - - - - - - - - -2442 - -ToolInfo.cs -file - - - - -2010-09-10T22:51:44.000000Z -20e6cf8e0ad0b0744b6189534bfd049a -2009-02-18T05:47:43.979044Z -290 -kunnis - - - - - - - - - - - - - - - - - - - - - -4315 - -VSGenericTarget.cs -file - - - - -2010-09-10T22:51:44.000000Z -6956b93fe770e1f5786cc44872c31d06 -2010-05-08T05:43:01.449559Z -316 -jhurliman - - - - - - - - - - - - - - - - - - - - - -34542 - -DebugTarget.cs -file - - - - -2010-09-10T22:51:44.000000Z -7346beba16e30e642f272e7bcf3924bb -2006-09-20T07:42:51.680045Z -164 -jendave -has-props - - - - - - - - - - - - - - - - - - - - -2703 - -VSVersion.cs -file - - - - -2010-09-10T22:51:44.000000Z -78ab7ae5edbe12dfb34c9fbd3dba9c23 -2010-05-08T05:43:01.449559Z -316 -jhurliman - - - - - - - - - - - - - - - - - - - - - -1950 - -MonoDevelopTarget.cs -file - - - - -2010-09-10T22:51:44.000000Z -d8b264553d4c2d66a19f9610be56f4b4 -2009-04-15T01:28:16.827957Z -307 -kunnis -has-props - - - - - - - - - - - - - - - - - - - - -15976 - -AutotoolsTarget.cs -file - - - - -2010-09-10T22:51:44.000000Z -bc5383cb56dd751ac946386a51852a77 -2009-02-20T02:15:45.530129Z -298 -kunnis - - - - - - - - - - - - - - - - - - - - - -41145 - -VS2010Target.cs -file - - - - -2010-09-10T22:51:44.000000Z -7d9c7f130f06ead33e747f0920b989c4 -2010-05-09T07:39:45.137959Z -317 -jhurliman - - - - - - - - - - - - - - - - - - - - - -2745 - -VS2002Target.cs -file - - - - -2010-09-10T22:51:44.000000Z -912769a89b935429b3801db96c467de7 -2009-02-19T06:47:52.218324Z -295 -kunnis -has-props - - - - - - - - - - - - - - - - - - - - -2507 - -SharpDevelopTarget.cs -file - - - - -2010-09-10T22:51:44.000000Z -f9017c8dd94137dee4b673bee40c8e6e -2009-04-15T01:28:16.827957Z -307 -kunnis -has-props - - - - - - - - - - - - - - - - - - - - -12773 - -VS2003Target.cs -file - - - - -2010-09-10T22:51:44.000000Z -c8e60070e9d7343d50c297d3dff12ac4 -2009-04-15T01:28:16.827957Z -307 -kunnis -has-props - - - - - - - - - - - - - - - - - - - - -18912 - -VS2005Target.cs -file - - - - -2010-09-10T22:51:44.000000Z -812092c2b5b068e087806088d80fe635 -2009-04-15T01:28:16.827957Z -307 -kunnis -has-props - - - - - - - - - - - - - - - - - - - - -4291 - -NAntTarget.cs -file - - - - -2010-09-10T22:51:44.000000Z -b635fc47efdd3eed660017693b9073c4 -2010-09-10T17:51:36.189738Z -323 -jhurliman -has-props - - - - - - - - - - - - - - - - - - - - -32065 - -VS2008Target.cs -file - - - - -2010-09-10T22:51:44.000000Z -154f10d6947ee7bf4d5caf10fad8c43d -2009-04-15T01:28:16.827957Z -307 -kunnis - - - - - - - - - - - - - - - - - - - - - -2514 - -XcodeTarget.cs -file - - - - -2010-09-10T22:51:44.000000Z -7ec0bbdd62020f03a725d8f99258769d -2009-04-15T01:28:16.827957Z -307 -kunnis -has-props - - - - - - - - - - - - - - - - - - - - -28408 - diff --git a/Prebuild/src/Core/Targets/.svn/prop-base/DebugTarget.cs.svn-base b/Prebuild/src/Core/Targets/.svn/prop-base/DebugTarget.cs.svn-base deleted file mode 100644 index 7b57b30..0000000 --- a/Prebuild/src/Core/Targets/.svn/prop-base/DebugTarget.cs.svn-base +++ /dev/null @@ -1,9 +0,0 @@ -K 13 -svn:eol-style -V 6 -native -K 12 -svn:keywords -V 23 -Author Date Id Revision -END diff --git a/Prebuild/src/Core/Targets/.svn/prop-base/MakefileTarget.cs.svn-base b/Prebuild/src/Core/Targets/.svn/prop-base/MakefileTarget.cs.svn-base deleted file mode 100644 index 05f6c06..0000000 --- a/Prebuild/src/Core/Targets/.svn/prop-base/MakefileTarget.cs.svn-base +++ /dev/null @@ -1,9 +0,0 @@ -K 13 -svn:eol-style -V 6 -native -K 13 -svn:mime-type -V 13 -text/x-csharp -END diff --git a/Prebuild/src/Core/Targets/.svn/prop-base/MonoDevelopTarget.cs.svn-base b/Prebuild/src/Core/Targets/.svn/prop-base/MonoDevelopTarget.cs.svn-base deleted file mode 100644 index 7b57b30..0000000 --- a/Prebuild/src/Core/Targets/.svn/prop-base/MonoDevelopTarget.cs.svn-base +++ /dev/null @@ -1,9 +0,0 @@ -K 13 -svn:eol-style -V 6 -native -K 12 -svn:keywords -V 23 -Author Date Id Revision -END diff --git a/Prebuild/src/Core/Targets/.svn/prop-base/NAntTarget.cs.svn-base b/Prebuild/src/Core/Targets/.svn/prop-base/NAntTarget.cs.svn-base deleted file mode 100644 index 7b57b30..0000000 --- a/Prebuild/src/Core/Targets/.svn/prop-base/NAntTarget.cs.svn-base +++ /dev/null @@ -1,9 +0,0 @@ -K 13 -svn:eol-style -V 6 -native -K 12 -svn:keywords -V 23 -Author Date Id Revision -END diff --git a/Prebuild/src/Core/Targets/.svn/prop-base/SharpDevelopTarget.cs.svn-base b/Prebuild/src/Core/Targets/.svn/prop-base/SharpDevelopTarget.cs.svn-base deleted file mode 100644 index 7b57b30..0000000 --- a/Prebuild/src/Core/Targets/.svn/prop-base/SharpDevelopTarget.cs.svn-base +++ /dev/null @@ -1,9 +0,0 @@ -K 13 -svn:eol-style -V 6 -native -K 12 -svn:keywords -V 23 -Author Date Id Revision -END diff --git a/Prebuild/src/Core/Targets/.svn/prop-base/VS2002Target.cs.svn-base b/Prebuild/src/Core/Targets/.svn/prop-base/VS2002Target.cs.svn-base deleted file mode 100644 index 7b57b30..0000000 --- a/Prebuild/src/Core/Targets/.svn/prop-base/VS2002Target.cs.svn-base +++ /dev/null @@ -1,9 +0,0 @@ -K 13 -svn:eol-style -V 6 -native -K 12 -svn:keywords -V 23 -Author Date Id Revision -END diff --git a/Prebuild/src/Core/Targets/.svn/prop-base/VS2003Target.cs.svn-base b/Prebuild/src/Core/Targets/.svn/prop-base/VS2003Target.cs.svn-base deleted file mode 100644 index 7b57b30..0000000 --- a/Prebuild/src/Core/Targets/.svn/prop-base/VS2003Target.cs.svn-base +++ /dev/null @@ -1,9 +0,0 @@ -K 13 -svn:eol-style -V 6 -native -K 12 -svn:keywords -V 23 -Author Date Id Revision -END diff --git a/Prebuild/src/Core/Targets/.svn/prop-base/VS2005Target.cs.svn-base b/Prebuild/src/Core/Targets/.svn/prop-base/VS2005Target.cs.svn-base deleted file mode 100644 index 7b57b30..0000000 --- a/Prebuild/src/Core/Targets/.svn/prop-base/VS2005Target.cs.svn-base +++ /dev/null @@ -1,9 +0,0 @@ -K 13 -svn:eol-style -V 6 -native -K 12 -svn:keywords -V 23 -Author Date Id Revision -END diff --git a/Prebuild/src/Core/Targets/.svn/prop-base/XcodeTarget.cs.svn-base b/Prebuild/src/Core/Targets/.svn/prop-base/XcodeTarget.cs.svn-base deleted file mode 100644 index 05f6c06..0000000 --- a/Prebuild/src/Core/Targets/.svn/prop-base/XcodeTarget.cs.svn-base +++ /dev/null @@ -1,9 +0,0 @@ -K 13 -svn:eol-style -V 6 -native -K 13 -svn:mime-type -V 13 -text/x-csharp -END diff --git a/Prebuild/src/Core/Targets/.svn/text-base/AutotoolsTarget.cs.svn-base b/Prebuild/src/Core/Targets/.svn/text-base/AutotoolsTarget.cs.svn-base deleted file mode 100644 index 485e4dd..0000000 --- a/Prebuild/src/Core/Targets/.svn/text-base/AutotoolsTarget.cs.svn-base +++ /dev/null @@ -1,1070 +0,0 @@ -#region BSD License -/* - -Copyright (c) 2004 - 2008 -Matthew Holmes (matthew@wildfiregames.com), -Dan Moorehead (dan05a@gmail.com), -Dave Hudson (jendave@yahoo.com), -C.J. Adams-Collier (cjac@colliertech.org), - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - -* Redistributions of source code must retain the above copyright -notice, this list of conditions and the following disclaimer. - -* Redistributions in binary form must reproduce the above copyright -notice, this list of conditions and the following disclaimer in the -documentation and/or other materials provided with the distribution. - -* The name of the author may not be used to endorse or promote -products derived from this software without specific prior written -permission. - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR -IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, -INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, -STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING -IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -POSSIBILITY OF SUCH DAMAGE. - -*/ -#endregion - -#region MIT X11 license - -/* - Portions of this file authored by Lluis Sanchez Gual - - Copyright (C) 2006 Novell, Inc (http://www.novell.com) - - Permission is hereby granted, free of charge, to any person obtaining - a copy of this software and associated documentation files (the - "Software"), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - The above copyright notice and this permission notice shall be - included in all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE - LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION - OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION - WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -#endregion -using System; -using System.Collections.Generic; -using System.IO; -using System.Reflection; -using System.Text; -using System.Text.RegularExpressions; -using System.Xml; -using System.Xml.Xsl; -using System.Net; -using System.Diagnostics; - -using Prebuild.Core.Attributes; -using Prebuild.Core.Interfaces; -using Prebuild.Core.Nodes; -using Prebuild.Core.Utilities; - -namespace Prebuild.Core.Targets -{ - public enum ClrVersion - { - Default, - Net_1_1, - Net_2_0 - } - - public class SystemPackage - { - string name; - string version; - string description; - string[] assemblies; - bool isInternal; - ClrVersion targetVersion; - - public void Initialize(string name, - string version, - string description, - string[] assemblies, - ClrVersion targetVersion, - bool isInternal) - { - this.isInternal = isInternal; - this.name = name; - this.version = version; - this.assemblies = assemblies; - this.description = description; - this.targetVersion = targetVersion; - } - - public string Name - { - get { return name; } - } - - public string Version - { - get { return version; } - } - - public string Description - { - get { return description; } - } - - public ClrVersion TargetVersion - { - get { return targetVersion; } - } - - // The package is part of the mono SDK - public bool IsCorePackage - { - get { return name == "mono"; } - } - - // The package has been registered by an add-in, and is not installed - // in the system. - public bool IsInternalPackage - { - get { return isInternal; } - } - - public string[] Assemblies - { - get { return assemblies; } - } - - } - - - /// - /// - /// - [Target("autotools")] - public class AutotoolsTarget : ITarget - { - #region Fields - - Kernel m_Kernel; - XmlDocument autotoolsDoc; - XmlUrlResolver xr; - System.Security.Policy.Evidence e; - readonly Dictionary assemblyPathToPackage = new Dictionary(); - readonly Dictionary assemblyFullNameToPath = new Dictionary(); - readonly Dictionary packagesHash = new Dictionary(); - readonly List packages = new List(); - - #endregion - - #region Private Methods - - private static void mkdirDashP(string dirName) - { - DirectoryInfo di = new DirectoryInfo(dirName); - if (di.Exists) - return; - - string parentDirName = System.IO.Path.GetDirectoryName(dirName); - DirectoryInfo parentDi = new DirectoryInfo(parentDirName); - if (!parentDi.Exists) - mkdirDashP(parentDirName); - - di.Create(); - } - - private static void chkMkDir(string dirName) - { - System.IO.DirectoryInfo di = - new System.IO.DirectoryInfo(dirName); - - if (!di.Exists) - di.Create(); - } - - private void transformToFile(string filename, XsltArgumentList argList, string nodeName) - { - // Create an XslTransform for this file - XslTransform templateTransformer = - new XslTransform(); - - // Load up the template - XmlNode templateNode = - autotoolsDoc.SelectSingleNode(nodeName + "/*"); - templateTransformer.Load(templateNode.CreateNavigator(), xr, e); - - // Create a writer for the transformed template - XmlTextWriter templateWriter = - new XmlTextWriter(filename, null); - - // Perform transformation, writing the file - templateTransformer.Transform - (m_Kernel.CurrentDoc, argList, templateWriter, xr); - } - - static string NormalizeAsmName(string name) - { - int i = name.IndexOf(", PublicKeyToken=null"); - if (i != -1) - return name.Substring(0, i).Trim(); - return name; - } - - private void AddAssembly(string assemblyfile, SystemPackage package) - { - if (!File.Exists(assemblyfile)) - return; - - try - { - System.Reflection.AssemblyName an = System.Reflection.AssemblyName.GetAssemblyName(assemblyfile); - assemblyFullNameToPath[NormalizeAsmName(an.FullName)] = assemblyfile; - assemblyPathToPackage[assemblyfile] = package; - } - catch - { - } - } - - private static List GetAssembliesWithLibInfo(string line, string file) - { - List references = new List(); - List libdirs = new List(); - List retval = new List(); - foreach (string piece in line.Split(' ')) - { - if (piece.ToLower().Trim().StartsWith("/r:") || piece.ToLower().Trim().StartsWith("-r:")) - { - references.Add(ProcessPiece(piece.Substring(3).Trim(), file)); - } - else if (piece.ToLower().Trim().StartsWith("/lib:") || piece.ToLower().Trim().StartsWith("-lib:")) - { - libdirs.Add(ProcessPiece(piece.Substring(5).Trim(), file)); - } - } - - foreach (string refrnc in references) - { - foreach (string libdir in libdirs) - { - if (File.Exists(libdir + Path.DirectorySeparatorChar + refrnc)) - { - retval.Add(libdir + Path.DirectorySeparatorChar + refrnc); - } - } - } - - return retval; - } - - private static List GetAssembliesWithoutLibInfo(string line, string file) - { - List references = new List(); - foreach (string reference in line.Split(' ')) - { - if (reference.ToLower().Trim().StartsWith("/r:") || reference.ToLower().Trim().StartsWith("-r:")) - { - string final_ref = reference.Substring(3).Trim(); - references.Add(ProcessPiece(final_ref, file)); - } - } - return references; - } - - private static string ProcessPiece(string piece, string pcfile) - { - int start = piece.IndexOf("${"); - if (start == -1) - return piece; - - int end = piece.IndexOf("}"); - if (end == -1) - return piece; - - string variable = piece.Substring(start + 2, end - start - 2); - string interp = GetVariableFromPkgConfig(variable, Path.GetFileNameWithoutExtension(pcfile)); - return ProcessPiece(piece.Replace("${" + variable + "}", interp), pcfile); - } - - private static string GetVariableFromPkgConfig(string var, string pcfile) - { - ProcessStartInfo psi = new ProcessStartInfo("pkg-config"); - psi.RedirectStandardOutput = true; - psi.UseShellExecute = false; - psi.Arguments = String.Format("--variable={0} {1}", var, pcfile); - Process p = new Process(); - p.StartInfo = psi; - p.Start(); - string ret = p.StandardOutput.ReadToEnd().Trim(); - p.WaitForExit(); - if (String.IsNullOrEmpty(ret)) - return String.Empty; - return ret; - } - - private void ParsePCFile(string pcfile) - { - // Don't register the package twice - string pname = Path.GetFileNameWithoutExtension(pcfile); - if (packagesHash.ContainsKey(pname)) - return; - - List fullassemblies = null; - string version = ""; - string desc = ""; - - SystemPackage package = new SystemPackage(); - - using (StreamReader reader = new StreamReader(pcfile)) - { - string line; - while ((line = reader.ReadLine()) != null) - { - string lowerLine = line.ToLower(); - if (lowerLine.StartsWith("libs:") && lowerLine.IndexOf(".dll") != -1) - { - string choppedLine = line.Substring(5).Trim(); - if (choppedLine.IndexOf("-lib:") != -1 || choppedLine.IndexOf("/lib:") != -1) - { - fullassemblies = GetAssembliesWithLibInfo(choppedLine, pcfile); - } - else - { - fullassemblies = GetAssembliesWithoutLibInfo(choppedLine, pcfile); - } - } - else if (lowerLine.StartsWith("version:")) - { - // "version:".Length == 8 - version = line.Substring(8).Trim(); - } - else if (lowerLine.StartsWith("description:")) - { - // "description:".Length == 12 - desc = line.Substring(12).Trim(); - } - } - } - - if (fullassemblies == null) - return; - - foreach (string assembly in fullassemblies) - { - AddAssembly(assembly, package); - } - - package.Initialize(pname, - version, - desc, - fullassemblies.ToArray(), - ClrVersion.Default, - false); - packages.Add(package); - packagesHash[pname] = package; - } - - void RegisterSystemAssemblies(string prefix, string version, ClrVersion ver) - { - SystemPackage package = new SystemPackage(); - List list = new List(); - - string dir = Path.Combine(prefix, version); - if (!Directory.Exists(dir)) - { - return; - } - - foreach (string assembly in Directory.GetFiles(dir, "*.dll")) - { - AddAssembly(assembly, package); - list.Add(assembly); - } - - package.Initialize("mono", - version, - "The Mono runtime", - list.ToArray(), - ver, - false); - packages.Add(package); - } - - void RunInitialization() - { - string versionDir; - - if (Environment.Version.Major == 1) - { - versionDir = "1.0"; - } - else - { - versionDir = "2.0"; - } - - //Pull up assemblies from the installed mono system. - string prefix = Path.GetDirectoryName(typeof(int).Assembly.Location); - - if (prefix.IndexOf(Path.Combine("mono", versionDir)) == -1) - prefix = Path.Combine(prefix, "mono"); - else - prefix = Path.GetDirectoryName(prefix); - - RegisterSystemAssemblies(prefix, "1.0", ClrVersion.Net_1_1); - RegisterSystemAssemblies(prefix, "2.0", ClrVersion.Net_2_0); - - string search_dirs = Environment.GetEnvironmentVariable("PKG_CONFIG_PATH"); - string libpath = Environment.GetEnvironmentVariable("PKG_CONFIG_LIBPATH"); - - if (String.IsNullOrEmpty(libpath)) - { - string path_dirs = Environment.GetEnvironmentVariable("PATH"); - foreach (string pathdir in path_dirs.Split(Path.PathSeparator)) - { - if (pathdir == null) - continue; - if (File.Exists(pathdir + Path.DirectorySeparatorChar + "pkg-config")) - { - libpath = Path.Combine(pathdir, ".."); - libpath = Path.Combine(libpath, "lib"); - libpath = Path.Combine(libpath, "pkgconfig"); - break; - } - } - } - search_dirs += Path.PathSeparator + libpath; - if (!string.IsNullOrEmpty(search_dirs)) - { - List scanDirs = new List(); - foreach (string potentialDir in search_dirs.Split(Path.PathSeparator)) - { - if (!scanDirs.Contains(potentialDir)) - scanDirs.Add(potentialDir); - } - foreach (string pcdir in scanDirs) - { - if (pcdir == null) - continue; - - if (Directory.Exists(pcdir)) - { - foreach (string pcfile in Directory.GetFiles(pcdir, "*.pc")) - { - ParsePCFile(pcfile); - } - } - } - } - } - - private void WriteCombine(SolutionNode solution) - { - #region "Create Solution directory if it doesn't exist" - string solutionDir = Path.Combine(solution.FullPath, - Path.Combine("autotools", - solution.Name)); - chkMkDir(solutionDir); - #endregion - - #region "Write Solution-level files" - XsltArgumentList argList = new XsltArgumentList(); - argList.AddParam("solutionName", "", solution.Name); - // $solutionDir is $rootDir/$solutionName/ - transformToFile(Path.Combine(solutionDir, "configure.ac"), - argList, "/Autotools/SolutionConfigureAc"); - transformToFile(Path.Combine(solutionDir, "Makefile.am"), - argList, "/Autotools/SolutionMakefileAm"); - transformToFile(Path.Combine(solutionDir, "autogen.sh"), - argList, "/Autotools/SolutionAutogenSh"); - #endregion - - foreach (ProjectNode project in solution.ProjectsTableOrder) - { - m_Kernel.Log.Write(String.Format("Writing project: {0}", - project.Name)); - WriteProject(solution, project); - } - } - - private static string FindFileReference(string refName, - ProjectNode project) - { - foreach (ReferencePathNode refPath in project.ReferencePaths) - { - string fullPath = - Helper.MakeFilePath(refPath.Path, refName, "dll"); - - if (File.Exists(fullPath)) { - return fullPath; - } - } - - return null; - } - - /// - /// Gets the XML doc file. - /// - /// The project. - /// The conf. - /// - public static string GetXmlDocFile(ProjectNode project, ConfigurationNode conf) - { - if (conf == null) - { - throw new ArgumentNullException("conf"); - } - if (project == null) - { - throw new ArgumentNullException("project"); - } - string docFile = (string)conf.Options["XmlDocFile"]; - // if(docFile != null && docFile.Length == 0)//default to assembly name if not specified - // { - // return Path.GetFileNameWithoutExtension(project.AssemblyName) + ".xml"; - // } - return docFile; - } - - /// - /// Normalizes the path. - /// - /// The path. - /// - public static string NormalizePath(string path) - { - if (path == null) - { - return ""; - } - - StringBuilder tmpPath; - - if (Core.Parse.Preprocessor.GetOS() == "Win32") - { - tmpPath = new StringBuilder(path.Replace('\\', '/')); - tmpPath.Replace("/", @"\\"); - } - else - { - tmpPath = new StringBuilder(path.Replace('\\', '/')); - tmpPath = tmpPath.Replace('/', Path.DirectorySeparatorChar); - } - return tmpPath.ToString(); - } - - private void WriteProject(SolutionNode solution, ProjectNode project) - { - string solutionDir = Path.Combine(solution.FullPath, Path.Combine("autotools", solution.Name)); - string projectDir = Path.Combine(solutionDir, project.Name); - string projectVersion = project.Version; - bool hasAssemblyConfig = false; - chkMkDir(projectDir); - - List - compiledFiles = new List(), - contentFiles = new List(), - embeddedFiles = new List(), - - binaryLibs = new List(), - pkgLibs = new List(), - systemLibs = new List(), - runtimeLibs = new List(), - - extraDistFiles = new List(), - localCopyTargets = new List(); - - // If there exists a .config file for this assembly, copy - // it to the project folder - - // TODO: Support copying .config.osx files - // TODO: support processing the .config file for native library deps - string projectAssemblyName = project.Name; - if (project.AssemblyName != null) - projectAssemblyName = project.AssemblyName; - - if (File.Exists(Path.Combine(project.FullPath, projectAssemblyName) + ".dll.config")) - { - hasAssemblyConfig = true; - System.IO.File.Copy(Path.Combine(project.FullPath, projectAssemblyName + ".dll.config"), Path.Combine(projectDir, projectAssemblyName + ".dll.config"), true); - extraDistFiles.Add(project.AssemblyName + ".dll.config"); - } - - foreach (ConfigurationNode conf in project.Configurations) - { - if (conf.Options.KeyFile != string.Empty) - { - // Copy snk file into the project's directory - // Use the snk from the project directory directly - string source = Path.Combine(project.FullPath, conf.Options.KeyFile); - string keyFile = conf.Options.KeyFile; - Regex re = new Regex(".*/"); - keyFile = re.Replace(keyFile, ""); - - string dest = Path.Combine(projectDir, keyFile); - // Tell the user if there's a problem copying the file - try - { - mkdirDashP(System.IO.Path.GetDirectoryName(dest)); - System.IO.File.Copy(source, dest, true); - } - catch (System.IO.IOException e) - { - Console.WriteLine(e.Message); - } - } - } - - // Copy compiled, embedded and content files into the project's directory - foreach (string filename in project.Files) - { - string source = Path.Combine(project.FullPath, filename); - string dest = Path.Combine(projectDir, filename); - - if (filename.Contains("AssemblyInfo.cs")) - { - // If we've got an AssemblyInfo.cs, pull the version number from it - string[] sources = { source }; - string[] args = { "" }; - Microsoft.CSharp.CSharpCodeProvider cscp = - new Microsoft.CSharp.CSharpCodeProvider(); - - string tempAssemblyFile = Path.Combine(Path.GetTempPath(), project.Name + "-temp.dll"); - System.CodeDom.Compiler.CompilerParameters cparam = - new System.CodeDom.Compiler.CompilerParameters(args, tempAssemblyFile); - - System.CodeDom.Compiler.CompilerResults cr = - cscp.CompileAssemblyFromFile(cparam, sources); - - foreach (System.CodeDom.Compiler.CompilerError error in cr.Errors) - Console.WriteLine("Error! '{0}'", error.ErrorText); - - try { - string projectFullName = cr.CompiledAssembly.FullName; - Regex verRegex = new Regex("Version=([\\d\\.]+)"); - Match verMatch = verRegex.Match(projectFullName); - if (verMatch.Success) - projectVersion = verMatch.Groups[1].Value; - }catch{ - Console.WriteLine("Couldn't compile AssemblyInfo.cs"); - } - - // Clean up the temp file - try - { - if (File.Exists(tempAssemblyFile)) - File.Delete(tempAssemblyFile); - } - catch - { - Console.WriteLine("Error! '{0}'", e); - } - - } - - // Tell the user if there's a problem copying the file - try - { - mkdirDashP(System.IO.Path.GetDirectoryName(dest)); - System.IO.File.Copy(source, dest, true); - } - catch (System.IO.IOException e) - { - Console.WriteLine(e.Message); - } - - switch (project.Files.GetBuildAction(filename)) - { - case BuildAction.Compile: - compiledFiles.Add(filename); - break; - case BuildAction.Content: - contentFiles.Add(filename); - extraDistFiles.Add(filename); - break; - case BuildAction.EmbeddedResource: - embeddedFiles.Add(filename); - break; - } - } - - // Set up references - for (int refNum = 0; refNum < project.References.Count; refNum++) - { - ReferenceNode refr = project.References[refNum]; - Assembly refAssembly = Assembly.LoadWithPartialName(refr.Name); - - /* Determine which pkg-config (.pc) file refers to - this assembly */ - - SystemPackage package = null; - - if (packagesHash.ContainsKey(refr.Name)) - { - package = packagesHash[refr.Name]; - - } - else - { - string assemblyFullName = string.Empty; - if (refAssembly != null) - assemblyFullName = refAssembly.FullName; - - string assemblyFileName = string.Empty; - if (assemblyFullName != string.Empty && - assemblyFullNameToPath.ContainsKey(assemblyFullName) - ) - assemblyFileName = - assemblyFullNameToPath[assemblyFullName]; - - if (assemblyFileName != string.Empty && - assemblyPathToPackage.ContainsKey(assemblyFileName) - ) - package = assemblyPathToPackage[assemblyFileName]; - - } - - /* If we know the .pc file and it is not "mono" - (already in the path), add a -pkg: argument */ - - if (package != null && - package.Name != "mono" && - !pkgLibs.Contains(package.Name) - ) - pkgLibs.Add(package.Name); - - string fileRef = - FindFileReference(refr.Name, (ProjectNode)refr.Parent); - - if (refr.LocalCopy || - solution.ProjectsTable.ContainsKey(refr.Name) || - fileRef != null || - refr.Path != null - ) - { - - /* Attempt to copy the referenced lib to the - project's directory */ - - string filename = refr.Name + ".dll"; - string source = filename; - if (refr.Path != null) - source = Path.Combine(refr.Path, source); - source = Path.Combine(project.FullPath, source); - string dest = Path.Combine(projectDir, filename); - - /* Since we depend on this binary dll to build, we - * will add a compile- time dependency on the - * copied dll, and add the dll to the list of - * files distributed with this package - */ - - binaryLibs.Add(refr.Name + ".dll"); - extraDistFiles.Add(refr.Name + ".dll"); - - // TODO: Support copying .config.osx files - // TODO: Support for determining native dependencies - if (File.Exists(source + ".config")) - { - System.IO.File.Copy(source + ".config", Path.GetDirectoryName(dest), true); - extraDistFiles.Add(refr.Name + ".dll.config"); - } - - try - { - System.IO.File.Copy(source, dest, true); - } - catch (System.IO.IOException) - { - if (solution.ProjectsTable.ContainsKey(refr.Name)){ - - /* If an assembly is referenced, marked for - * local copy, in the list of projects for - * this solution, but does not exist, put a - * target into the Makefile.am to build the - * assembly and copy it to this project's - * directory - */ - - ProjectNode sourcePrj = - ((solution.ProjectsTable[refr.Name])); - - string target = - String.Format("{0}:\n" + - "\t$(MAKE) -C ../{1}\n" + - "\tln ../{2}/$@ $@\n", - filename, - sourcePrj.Name, - sourcePrj.Name ); - - localCopyTargets.Add(target); - } - } - } - else if( !pkgLibs.Contains(refr.Name) ) - { - // Else, let's assume it's in the GAC or the lib path - string assemName = string.Empty; - int index = refr.Name.IndexOf(","); - - if (index > 0) - assemName = refr.Name.Substring(0, index); - else - assemName = refr.Name; - - m_Kernel.Log.Write(String.Format( - "Warning: Couldn't find an appropriate assembly " + - "for reference:\n'{0}'", refr.Name - )); - systemLibs.Add(assemName); - } - } - - const string lineSep = " \\\n\t"; - string compiledFilesString = string.Empty; - if (compiledFiles.Count > 0) - compiledFilesString = - lineSep + string.Join(lineSep, compiledFiles.ToArray()); - - string embeddedFilesString = ""; - if (embeddedFiles.Count > 0) - embeddedFilesString = - lineSep + string.Join(lineSep, embeddedFiles.ToArray()); - - string contentFilesString = ""; - if (contentFiles.Count > 0) - contentFilesString = - lineSep + string.Join(lineSep, contentFiles.ToArray()); - - string extraDistFilesString = ""; - if (extraDistFiles.Count > 0) - extraDistFilesString = - lineSep + string.Join(lineSep, extraDistFiles.ToArray()); - - string pkgLibsString = ""; - if (pkgLibs.Count > 0) - pkgLibsString = - lineSep + string.Join(lineSep, pkgLibs.ToArray()); - - string binaryLibsString = ""; - if (binaryLibs.Count > 0) - binaryLibsString = - lineSep + string.Join(lineSep, binaryLibs.ToArray()); - - string systemLibsString = ""; - if (systemLibs.Count > 0) - systemLibsString = - lineSep + string.Join(lineSep, systemLibs.ToArray()); - - string localCopyTargetsString = ""; - if (localCopyTargets.Count > 0) - localCopyTargetsString = - string.Join("\n", localCopyTargets.ToArray()); - - string monoPath = ""; - foreach (string runtimeLib in runtimeLibs) - { - monoPath += ":`pkg-config --variable=libdir " + runtimeLib + "`"; - } - - // Add the project name to the list of transformation - // parameters - XsltArgumentList argList = new XsltArgumentList(); - argList.AddParam("projectName", "", project.Name); - argList.AddParam("solutionName", "", solution.Name); - argList.AddParam("assemblyName", "", projectAssemblyName); - argList.AddParam("compiledFiles", "", compiledFilesString); - argList.AddParam("embeddedFiles", "", embeddedFilesString); - argList.AddParam("contentFiles", "", contentFilesString); - argList.AddParam("extraDistFiles", "", extraDistFilesString); - argList.AddParam("pkgLibs", "", pkgLibsString); - argList.AddParam("binaryLibs", "", binaryLibsString); - argList.AddParam("systemLibs", "", systemLibsString); - argList.AddParam("monoPath", "", monoPath); - argList.AddParam("localCopyTargets", "", localCopyTargetsString); - argList.AddParam("projectVersion", "", projectVersion); - argList.AddParam("hasAssemblyConfig", "", hasAssemblyConfig ? "true" : ""); - - // Transform the templates - transformToFile(Path.Combine(projectDir, "configure.ac"), argList, "/Autotools/ProjectConfigureAc"); - transformToFile(Path.Combine(projectDir, "Makefile.am"), argList, "/Autotools/ProjectMakefileAm"); - transformToFile(Path.Combine(projectDir, "autogen.sh"), argList, "/Autotools/ProjectAutogenSh"); - - if (project.Type == Core.Nodes.ProjectType.Library) - transformToFile(Path.Combine(projectDir, project.Name + ".pc.in"), argList, "/Autotools/ProjectPcIn"); - if (project.Type == Core.Nodes.ProjectType.Exe || project.Type == Core.Nodes.ProjectType.WinExe) - transformToFile(Path.Combine(projectDir, project.Name.ToLower() + ".in"), argList, "/Autotools/ProjectWrapperScriptIn"); - } - - private void CleanProject(ProjectNode project) - { - m_Kernel.Log.Write("...Cleaning project: {0}", project.Name); - string projectFile = Helper.MakeFilePath(project.FullPath, "Include", "am"); - Helper.DeleteIfExists(projectFile); - } - - private void CleanSolution(SolutionNode solution) - { - m_Kernel.Log.Write("Cleaning Autotools make files for", solution.Name); - - string slnFile = Helper.MakeFilePath(solution.FullPath, "Makefile", "am"); - Helper.DeleteIfExists(slnFile); - - slnFile = Helper.MakeFilePath(solution.FullPath, "Makefile", "in"); - Helper.DeleteIfExists(slnFile); - - slnFile = Helper.MakeFilePath(solution.FullPath, "configure", "ac"); - Helper.DeleteIfExists(slnFile); - - slnFile = Helper.MakeFilePath(solution.FullPath, "configure"); - Helper.DeleteIfExists(slnFile); - - slnFile = Helper.MakeFilePath(solution.FullPath, "Makefile"); - Helper.DeleteIfExists(slnFile); - - foreach (ProjectNode project in solution.Projects) - { - CleanProject(project); - } - - m_Kernel.Log.Write(""); - } - - #endregion - - #region ITarget Members - - /// - /// Writes the specified kern. - /// - /// The kern. - public void Write(Kernel kern) - { - if (kern == null) - { - throw new ArgumentNullException("kern"); - } - m_Kernel = kern; - m_Kernel.Log.Write("Parsing system pkg-config files"); - RunInitialization(); - - const string streamName = "autotools.xml"; - string fqStreamName = String.Format("Prebuild.data.{0}", - streamName - ); - - // Retrieve stream for the autotools template XML - Stream autotoolsStream = Assembly.GetExecutingAssembly() - .GetManifestResourceStream(fqStreamName); - - if(autotoolsStream == null) { - - /* - * try without the default namespace prepended, in - * case prebuild.exe assembly was compiled with - * something other than Visual Studio .NET - */ - - autotoolsStream = Assembly.GetExecutingAssembly() - .GetManifestResourceStream(streamName); - if(autotoolsStream == null){ - string errStr = - String.Format("Could not find embedded resource file:\n" + - "'{0}' or '{1}'", - streamName, fqStreamName - ); - - m_Kernel.Log.Write(errStr); - - throw new System.Reflection.TargetException(errStr); - } - } - - // Create an XML URL Resolver with default credentials - xr = new System.Xml.XmlUrlResolver(); - xr.Credentials = CredentialCache.DefaultCredentials; - - // Create a default evidence - no need to limit access - e = new System.Security.Policy.Evidence(); - - // Load the autotools XML - autotoolsDoc = new XmlDocument(); - autotoolsDoc.Load(autotoolsStream); - - /* rootDir is the filesystem location where the Autotools - * build tree will be created - for now we'll make it - * $PWD/autotools - */ - - string pwd = Directory.GetCurrentDirectory(); - //string pwd = System.Environment.GetEnvironmentVariable("PWD"); - //if (pwd.Length != 0) - //{ - string rootDir = Path.Combine(pwd, "autotools"); - //} - //else - //{ - // pwd = Assembly.GetExecutingAssembly() - //} - chkMkDir(rootDir); - - foreach (SolutionNode solution in kern.Solutions) - { - m_Kernel.Log.Write(String.Format("Writing solution: {0}", - solution.Name)); - WriteCombine(solution); - } - m_Kernel = null; - } - - /// - /// Cleans the specified kern. - /// - /// The kern. - public virtual void Clean(Kernel kern) - { - if (kern == null) - { - throw new ArgumentNullException("kern"); - } - m_Kernel = kern; - foreach (SolutionNode sol in kern.Solutions) - { - CleanSolution(sol); - } - m_Kernel = null; - } - - /// - /// Gets the name. - /// - /// The name. - public string Name - { - get - { - return "autotools"; - } - } - - #endregion - } -} diff --git a/Prebuild/src/Core/Targets/.svn/text-base/DebugTarget.cs.svn-base b/Prebuild/src/Core/Targets/.svn/text-base/DebugTarget.cs.svn-base deleted file mode 100644 index 3494c30..0000000 --- a/Prebuild/src/Core/Targets/.svn/text-base/DebugTarget.cs.svn-base +++ /dev/null @@ -1,102 +0,0 @@ -#region BSD License -/* -Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com) - -Redistribution and use in source and binary forms, with or without modification, are permitted -provided that the following conditions are met: - -* Redistributions of source code must retain the above copyright notice, this list of conditions - and the following disclaimer. -* Redistributions in binary form must reproduce the above copyright notice, this list of conditions - and the following disclaimer in the documentation and/or other materials provided with the - distribution. -* The name of the author may not be used to endorse or promote products derived from this software - without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, -BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY -OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING -IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ -#endregion - -#region CVS Information -/* - * $Source$ - * $Author$ - * $Date$ - * $Revision$ - */ -#endregion - -using System; - -using Prebuild.Core.Attributes; -using Prebuild.Core.Interfaces; -using Prebuild.Core.Nodes; - -#if (DEBUG && _DEBUG_TARGET) -namespace Prebuild.Core.Targets -{ - [Target("debug")] - public class DebugTarget : ITarget - { -#region Fields - - private Kernel m_Kernel = null; - -#endregion - -#region ITarget Members - - public void Write() - { - foreach(SolutionNode s in m_Kernel.Solutions) - { - Console.WriteLine("Solution [ {0}, {1} ]", s.Name, s.Path); - foreach(string file in s.Files) -{ - Console.WriteLine("\tFile [ {0} ]", file); -} - - foreach(ProjectNode proj in s.Projects) - { - Console.WriteLine("\tProject [ {0}, {1}. {2} ]", proj.Name, proj.Path, proj.Language); - foreach(string file in proj.Files) - Console.WriteLine("\t\tFile [ {0} ]", file); - } - } - } - - public void Clean() - { - Console.WriteLine("Not implemented"); - } - - public string Name - { - get - { - return "debug"; - } - } - - public Kernel Kernel - { - get - { - return m_Kernel; - } - set - { - m_Kernel = value; - } - } - -#endregion - } -} -#endif diff --git a/Prebuild/src/Core/Targets/.svn/text-base/MakefileTarget.cs.svn-base b/Prebuild/src/Core/Targets/.svn/text-base/MakefileTarget.cs.svn-base deleted file mode 100644 index 54046dd..0000000 --- a/Prebuild/src/Core/Targets/.svn/text-base/MakefileTarget.cs.svn-base +++ /dev/null @@ -1,469 +0,0 @@ -#region BSD License -/* -Copyright (c) 2004 Crestez Leonard (cleonard@go.ro) - -Redistribution and use in source and binary forms, with or without modification, are permitted -provided that the following conditions are met: - -* Redistributions of source code must retain the above copyright notice, this list of conditions - and the following disclaimer. -* Redistributions in binary form must reproduce the above copyright notice, this list of conditions - and the following disclaimer in the documentation and/or other materials provided with the - distribution. -* The name of the author may not be used to endorse or promote products derived from this software - without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, -BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY -OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING -IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ -#endregion - -using System; -using System.IO; -using System.Text.RegularExpressions; - -using Prebuild.Core.Attributes; -using Prebuild.Core.Interfaces; -using Prebuild.Core.Nodes; -using Prebuild.Core.Utilities; - -namespace Prebuild.Core.Targets -{ - [Target("makefile")] - public class MakefileTarget : ITarget - { - #region Fields - - private Kernel m_Kernel = null; - - #endregion - - #region Private Methods - - // This converts a path relative to the path of a project to - // a path relative to the solution path. - private string NicePath(ProjectNode proj, string path) - { - string res; - SolutionNode solution = (SolutionNode)proj.Parent; - res = Path.Combine(Helper.NormalizePath(proj.FullPath, '/'), Helper.NormalizePath(path, '/')); - res = Helper.NormalizePath(res, '/'); - res = res.Replace("/./", "/"); - while (res.IndexOf("/../") >= 0) - { - int a = res.IndexOf("/../"); - int b = res.LastIndexOf("/", a - 1); - res = res.Remove(b, a - b + 3); - } - res = Helper.MakePathRelativeTo(solution.FullPath, res); - if (res.StartsWith("./")) - res = res.Substring(2, res.Length - 2); - res = Helper.NormalizePath(res, '/'); - return res; - } - - private void WriteProjectFiles(StreamWriter f, SolutionNode solution, ProjectNode project) - { - // Write list of source code files - f.WriteLine("SOURCES_{0} = \\", project.Name); - foreach (string file in project.Files) - if (project.Files.GetBuildAction(file) == BuildAction.Compile) - f.WriteLine("\t{0} \\", NicePath(project, file)); - f.WriteLine(); - - // Write list of resource files - f.WriteLine("RESOURCES_{0} = \\", project.Name); - foreach (string file in project.Files) - if (project.Files.GetBuildAction(file) == BuildAction.EmbeddedResource) - { - string path = NicePath(project, file); - f.WriteLine("\t-resource:{0},{1} \\", path, Path.GetFileName(path)); - } - f.WriteLine(); - - // There's also Content and None in BuildAction. - // What am I supposed to do with that? - } - - private string FindFileReference(string refName, ProjectNode project) - { - foreach (ReferencePathNode refPath in project.ReferencePaths) - { - string fullPath = NicePath(project, Helper.MakeFilePath(refPath.Path, refName, "dll")); - if (File.Exists(fullPath)) - return fullPath; - } - return null; - } - - private void WriteProjectReferences(StreamWriter f, SolutionNode solution, ProjectNode project) - { - f.WriteLine("REFERENCES_{0} = \\", project.Name); - foreach (ReferenceNode refr in project.References) - { - string path; - // Project references change with configurations. - if (solution.ProjectsTable.ContainsKey(refr.Name)) - continue; - path = FindFileReference(refr.Name, project); - if (path != null) - f.WriteLine("\t-r:{0} \\", path); - else - f.WriteLine("\t-r:{0} \\", refr.Name); - } - f.WriteLine(); - } - - private void WriteProjectDependencies(StreamWriter f, SolutionNode solution, ProjectNode project) - { - f.WriteLine("DEPENDENCIES_{0} = \\", project.Name); - f.WriteLine("\t$(SOURCES_{0}) \\", project.Name); - foreach (string file in project.Files) - if (project.Files.GetBuildAction(file) == BuildAction.EmbeddedResource) - f.WriteLine("\t{0} \\", NicePath(project, file)); - f.WriteLine(); - } - - private string ProjectTypeToExtension(ProjectType t) - { - if (t == ProjectType.Exe || t == ProjectType.WinExe) - { - return "exe"; - } - else if (t == ProjectType.Library) - { - return "dll"; - } - else - { - throw new FatalException("Bad ProjectType: {0}", t); - } - } - - private string ProjectTypeToTarget(ProjectType t) - { - if (t == ProjectType.Exe) - { - return "exe"; - } - else if (t == ProjectType.WinExe) - { - return "winexe"; - } - else if (t == ProjectType.Library) - { - return "library"; - } - else - { - throw new FatalException("Bad ProjectType: {0}", t); - } - } - - private string ProjectOutput(ProjectNode project, ConfigurationNode config) - { - string filepath; - filepath = Helper.MakeFilePath((string)config.Options["OutputPath"], - project.AssemblyName, ProjectTypeToExtension(project.Type)); - return NicePath(project, filepath); - } - - // Returns true if two configs in one project have the same output. - private bool ProjectClashes(ProjectNode project) - { - foreach (ConfigurationNode conf1 in project.Configurations) - foreach (ConfigurationNode conf2 in project.Configurations) - if (ProjectOutput(project, conf1) == ProjectOutput(project, conf2) && conf1 != conf2) - { - m_Kernel.Log.Write("Warning: Configurations {0} and {1} for project {2} output the same file", - conf1.Name, conf2.Name, project.Name); - m_Kernel.Log.Write("Warning: I'm going to use some timestamps(extra empty files)."); - return true; - } - return false; - } - - private void WriteProject(StreamWriter f, SolutionNode solution, ProjectNode project) - { - f.WriteLine("# This is for project {0}", project.Name); - f.WriteLine(); - - WriteProjectFiles(f, solution, project); - WriteProjectReferences(f, solution, project); - WriteProjectDependencies(f, solution, project); - - bool clash = ProjectClashes(project); - - foreach (ConfigurationNode conf in project.Configurations) - { - string outpath = ProjectOutput(project, conf); - string filesToClean = outpath; - - if (clash) - { - f.WriteLine("{0}-{1}: .{0}-{1}-timestamp", project.Name, conf.Name); - f.WriteLine(); - f.Write(".{0}-{1}-timestamp: $(DEPENDENCIES_{0})", project.Name, conf.Name); - } - else - { - f.WriteLine("{0}-{1}: {2}", project.Name, conf.Name, outpath); - f.WriteLine(); - f.Write("{2}: $(DEPENDENCIES_{0})", project.Name, conf.Name, outpath); - } - // Dependencies on other projects. - foreach (ReferenceNode refr in project.References) - if (solution.ProjectsTable.ContainsKey(refr.Name)) - { - ProjectNode refProj = (ProjectNode)solution.ProjectsTable[refr.Name]; - if (ProjectClashes(refProj)) - f.Write(" .{0}-{1}-timestamp", refProj.Name, conf.Name); - else - f.Write(" {0}", ProjectOutput(refProj, conf)); - } - f.WriteLine(); - - // make directory for output. - if (Path.GetDirectoryName(outpath) != "") - { - f.WriteLine("\tmkdir -p {0}", Path.GetDirectoryName(outpath)); - } - // mcs command line. - f.Write("\tgmcs", project.Name); - f.Write(" -warn:{0}", conf.Options["WarningLevel"]); - if ((bool)conf.Options["DebugInformation"]) - f.Write(" -debug"); - if ((bool)conf.Options["AllowUnsafe"]) - f.Write(" -unsafe"); - if ((bool)conf.Options["CheckUnderflowOverflow"]) - f.Write(" -checked"); - if (project.StartupObject != "") - f.Write(" -main:{0}", project.StartupObject); - if ((string)conf.Options["CompilerDefines"] != "") - { - f.Write(" -define:\"{0}\"", conf.Options["CompilerDefines"]); - } - - f.Write(" -target:{0} -out:{1}", ProjectTypeToTarget(project.Type), outpath); - - // Build references to other projects. Now that sux. - // We have to reference the other project in the same conf. - foreach (ReferenceNode refr in project.References) - if (solution.ProjectsTable.ContainsKey(refr.Name)) - { - ProjectNode refProj; - refProj = (ProjectNode)solution.ProjectsTable[refr.Name]; - f.Write(" -r:{0}", ProjectOutput(refProj, conf)); - } - - f.Write(" $(REFERENCES_{0})", project.Name); - f.Write(" $(RESOURCES_{0})", project.Name); - f.Write(" $(SOURCES_{0})", project.Name); - f.WriteLine(); - - // Copy references with localcopy. - foreach (ReferenceNode refr in project.References) - if (refr.LocalCopy) - { - string outPath, srcPath, destPath; - outPath = Helper.NormalizePath((string)conf.Options["OutputPath"]); - if (solution.ProjectsTable.ContainsKey(refr.Name)) - { - ProjectNode refProj; - refProj = (ProjectNode)solution.ProjectsTable[refr.Name]; - srcPath = ProjectOutput(refProj, conf); - destPath = Path.Combine(outPath, Path.GetFileName(srcPath)); - destPath = NicePath(project, destPath); - if (srcPath != destPath) - { - f.WriteLine("\tcp -f {0} {1}", srcPath, destPath); - filesToClean += " " + destPath; - } - continue; - } - srcPath = FindFileReference(refr.Name, project); - if (srcPath != null) - { - destPath = Path.Combine(outPath, Path.GetFileName(srcPath)); - destPath = NicePath(project, destPath); - f.WriteLine("\tcp -f {0} {1}", srcPath, destPath); - filesToClean += " " + destPath; - } - } - - if (clash) - { - filesToClean += String.Format(" .{0}-{1}-timestamp", project.Name, conf.Name); - f.WriteLine("\ttouch .{0}-{1}-timestamp", project.Name, conf.Name); - f.Write("\trm -rf"); - foreach (ConfigurationNode otherConf in project.Configurations) - if (otherConf != conf) - f.WriteLine(" .{0}-{1}-timestamp", project.Name, otherConf.Name); - f.WriteLine(); - } - f.WriteLine(); - f.WriteLine("{0}-{1}-clean:", project.Name, conf.Name); - f.WriteLine("\trm -rf {0}", filesToClean); - f.WriteLine(); - } - } - - private void WriteIntro(StreamWriter f, SolutionNode solution) - { - f.WriteLine("# Makefile for {0} generated by Prebuild ( http://dnpb.sf.net )", solution.Name); - f.WriteLine("# Do not edit."); - f.WriteLine("#"); - - f.Write("# Configurations:"); - foreach (ConfigurationNode conf in solution.Configurations) - f.Write(" {0}", conf.Name); - f.WriteLine(); - - f.WriteLine("# Projects:"); - foreach (ProjectNode proj in solution.Projects) - f.WriteLine("#\t{0}", proj.Name); - - f.WriteLine("#"); - f.WriteLine("# Building:"); - f.WriteLine("#\t\"make\" to build everything under the default(first) configuration"); - f.WriteLine("#\t\"make CONF\" to build every project under configuration CONF"); - f.WriteLine("#\t\"make PROJ\" to build project PROJ under the default(first) configuration"); - f.WriteLine("#\t\"make PROJ-CONF\" to build project PROJ under configuration CONF"); - f.WriteLine("#"); - f.WriteLine("# Cleaning (removing results of build):"); - f.WriteLine("#\t\"make clean\" to clean everything, that's what you probably want"); - f.WriteLine("#\t\"make CONF\" to clean everything for a configuration"); - f.WriteLine("#\t\"make PROJ\" to clean everything for a project"); - f.WriteLine("#\t\"make PROJ-CONF\" to clea project PROJ under configuration CONF"); - f.WriteLine(); - } - - private void WritePhony(StreamWriter f, SolutionNode solution) - { - string defconf = ""; - foreach (ConfigurationNode conf in solution.Configurations) - { - defconf = conf.Name; - break; - } - - f.Write(".PHONY: all"); - foreach (ProjectNode proj in solution.Projects) - f.Write(" {0} {0}-clean", proj.Name); - foreach (ConfigurationNode conf in solution.Configurations) - f.Write(" {0} {0}-clean", conf.Name); - foreach (ProjectNode proj in solution.Projects) - foreach (ConfigurationNode conf in solution.Configurations) - f.Write(" {0}-{1} {0}-{1}-clean", proj.Name, conf.Name); - f.WriteLine(); - f.WriteLine(); - - f.WriteLine("all: {0}", defconf); - f.WriteLine(); - - f.Write("clean:"); - foreach (ConfigurationNode conf in solution.Configurations) - f.Write(" {0}-clean", conf.Name); - f.WriteLine(); - f.WriteLine(); - - foreach (ConfigurationNode conf in solution.Configurations) - { - f.Write("{0}: ", conf.Name); - foreach (ProjectNode proj in solution.Projects) - f.Write(" {0}-{1}", proj.Name, conf.Name); - f.WriteLine(); - f.WriteLine(); - - f.Write("{0}-clean: ", conf.Name); - foreach (ProjectNode proj in solution.Projects) - f.Write(" {0}-{1}-clean", proj.Name, conf.Name); - f.WriteLine(); - f.WriteLine(); - } - - foreach (ProjectNode proj in solution.Projects) - { - f.WriteLine("{0}: {0}-{1}", proj.Name, defconf); - f.WriteLine(); - - f.Write("{0}-clean:", proj.Name); - foreach (ConfigurationNode conf in proj.Configurations) - f.Write(" {0}-{1}-clean", proj.Name, conf.Name); - f.WriteLine(); - f.WriteLine(); - } - } - - private void WriteSolution(SolutionNode solution) - { - m_Kernel.Log.Write("Creating makefile for {0}", solution.Name); - m_Kernel.CurrentWorkingDirectory.Push(); - - string file = "Makefile";// Helper.MakeFilePath(solution.FullPath, solution.Name, "make"); - StreamWriter f = new StreamWriter(file); - - Helper.SetCurrentDir(Path.GetDirectoryName(file)); - - using (f) - { - WriteIntro(f, solution); - WritePhony(f, solution); - - foreach (ProjectNode project in solution.Projects) - { - m_Kernel.Log.Write("...Creating Project: {0}", project.Name); - WriteProject(f, solution, project); - } - } - - m_Kernel.Log.Write(""); - m_Kernel.CurrentWorkingDirectory.Pop(); - } - - private void CleanSolution(SolutionNode solution) - { - m_Kernel.Log.Write("Cleaning makefile for {0}", solution.Name); - - string file = Helper.MakeFilePath(solution.FullPath, solution.Name, "make"); - Helper.DeleteIfExists(file); - - m_Kernel.Log.Write(""); - } - - #endregion - - #region ITarget Members - - public void Write(Kernel kern) - { - m_Kernel = kern; - foreach (SolutionNode solution in kern.Solutions) - WriteSolution(solution); - m_Kernel = null; - } - - public virtual void Clean(Kernel kern) - { - m_Kernel = kern; - foreach (SolutionNode sol in kern.Solutions) - CleanSolution(sol); - m_Kernel = null; - } - - public string Name - { - get - { - return "makefile"; - } - } - - #endregion - } -} diff --git a/Prebuild/src/Core/Targets/.svn/text-base/MonoDevelopTarget.cs.svn-base b/Prebuild/src/Core/Targets/.svn/text-base/MonoDevelopTarget.cs.svn-base deleted file mode 100644 index ea6d2c2..0000000 --- a/Prebuild/src/Core/Targets/.svn/text-base/MonoDevelopTarget.cs.svn-base +++ /dev/null @@ -1,515 +0,0 @@ -#region BSD License -/* -Copyright (c) 2004 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com) - -Redistribution and use in source and binary forms, with or without modification, are permitted -provided that the following conditions are met: - -* Redistributions of source code must retain the above copyright notice, this list of conditions - and the following disclaimer. -* Redistributions in binary form must reproduce the above copyright notice, this list of conditions - and the following disclaimer in the documentation and/or other materials provided with the - distribution. -* The name of the author may not be used to endorse or promote products derived from this software - without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, -BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY -OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING -IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ -#endregion - -using System; -using System.IO; -using System.Reflection; -using System.Text.RegularExpressions; - -using Prebuild.Core.Attributes; -using Prebuild.Core.Interfaces; -using Prebuild.Core.Nodes; -using Prebuild.Core.Utilities; - -namespace Prebuild.Core.Targets -{ - /// - /// - /// - [Target("monodev")] - public class MonoDevelopTarget : ITarget - { - #region Fields - - private Kernel m_Kernel; - - #endregion - - #region Private Methods - - private static string PrependPath(string path) - { - string tmpPath = Helper.NormalizePath(path, '/'); - Regex regex = new Regex(@"(\w):/(\w+)"); - Match match = regex.Match(tmpPath); - if(match.Success || tmpPath[0] == '.' || tmpPath[0] == '/') - { - tmpPath = Helper.NormalizePath(tmpPath); - } - else - { - tmpPath = Helper.NormalizePath("./" + tmpPath); - } - - return tmpPath; - } - - private static string BuildReference(SolutionNode solution, ReferenceNode refr) - { - string ret = ""; - } - else - { - ProjectNode project = (ProjectNode)refr.Parent; - string fileRef = FindFileReference(refr.Name, project); - - if(refr.Path != null || fileRef != null) - { - ret += "Assembly\" refto=\""; - - string finalPath = (refr.Path != null) ? Helper.MakeFilePath(refr.Path, refr.Name, "dll") : fileRef; - - ret += finalPath; - ret += "\" localcopy=\"" + refr.LocalCopy.ToString() + "\" />"; - return ret; - } - - ret += "Gac\""; - ret += " localcopy=\"" + refr.LocalCopy.ToString() + "\""; - ret += " refto=\""; - try - { - /* - Day changed to 28 Mar 2007 - ... - 08:09 < cj> is there anything that replaces Assembly.LoadFromPartialName() ? - 08:09 < jonp> no - 08:10 < jonp> in their infinite wisdom [sic], microsoft decided that the - ability to load any assembly version by-name was an inherently - bad idea - 08:11 < cj> I'm thinking of a bunch of four-letter words right now... - 08:11 < cj> security through making it difficult for the developer!!! - 08:12 < jonp> just use the Obsolete API - 08:12 < jonp> it should still work - 08:12 < cj> alrighty. - 08:12 < jonp> you just get warnings when using it - */ - Assembly assem = Assembly.LoadWithPartialName(refr.Name); - ret += assem.FullName; - //ret += refr.Name; - } - catch (System.NullReferenceException e) - { - e.ToString(); - ret += refr.Name; - } - ret += "\" />"; - } - - return ret; - } - - private static string FindFileReference(string refName, ProjectNode project) - { - foreach(ReferencePathNode refPath in project.ReferencePaths) - { - string fullPath = Helper.MakeFilePath(refPath.Path, refName, "dll"); - - if(File.Exists(fullPath)) - { - return fullPath; - } - } - - return null; - } - - /// - /// Gets the XML doc file. - /// - /// The project. - /// The conf. - /// - public static string GenerateXmlDocFile(ProjectNode project, ConfigurationNode conf) - { - if( conf == null ) - { - throw new ArgumentNullException("conf"); - } - if( project == null ) - { - throw new ArgumentNullException("project"); - } - string docFile = (string)conf.Options["XmlDocFile"]; - if(docFile != null && docFile.Length == 0)//default to assembly name if not specified - { - return "False"; - } - return "True"; - } - - private void WriteProject(SolutionNode solution, ProjectNode project) - { - string csComp = "Mcs"; - string netRuntime = "Mono"; - if(project.Runtime == ClrRuntime.Microsoft) - { - csComp = "Csc"; - netRuntime = "MsNet"; - } - - string projFile = Helper.MakeFilePath(project.FullPath, project.Name, "mdp"); - StreamWriter ss = new StreamWriter(projFile); - - m_Kernel.CurrentWorkingDirectory.Push(); - Helper.SetCurrentDir(Path.GetDirectoryName(projFile)); - - using(ss) - { - ss.WriteLine( - "", - project.Name, - project.RootNamespace - ); - - int count = 0; - - ss.WriteLine(" ", solution.ActiveConfig); - - foreach(ConfigurationNode conf in project.Configurations) - { - ss.WriteLine(" ", conf.Name); - ss.Write(" "); - - ss.Write(" "); - - ss.Write(" "); - - ss.Write(" "); - ss.WriteLine(" "); - - count++; - } - ss.WriteLine(" "); - - ss.Write(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - - ss.WriteLine(" "); - foreach(string file in project.Files) - { - string buildAction; - string dependson = ""; - string resource_id = ""; - string copyToOutput = ""; - - switch(project.Files.GetBuildAction(file)) - { - case BuildAction.None: - buildAction = "Nothing"; - break; - - case BuildAction.Content: - buildAction = "Exclude"; - break; - - case BuildAction.EmbeddedResource: - buildAction = "EmbedAsResource"; - break; - - default: - buildAction = "Compile"; - break; - } - - if (project.Files.GetCopyToOutput(file) != CopyToOutput.Never) - buildAction = "FileCopy"; - - // Sort of a hack, we try and resolve the path and make it relative, if we can. - string extension = Path.GetExtension(file); - string designer_format = string.Format(".Designer{0}", extension); - - if (file.EndsWith(designer_format)) - { - string basename = file.Substring(0, file.LastIndexOf(designer_format)); - string[] extensions = new string[] { ".cs", ".resx", ".settings" }; - - foreach(string ext in extensions) - { - if (project.Files.Contains(basename + ext)) - { - dependson = string.Format(" dependson=\"{0}{1}\"", basename, ext); - break; - } - } - } - if (extension == ".resx") - { - buildAction = "EmbedAsResource"; - string basename = file.Substring(0, file.LastIndexOf(".resx")); - - // Visual Studio type resx + form dependency - if (project.Files.Contains(basename + ".cs")) - { - dependson = string.Format(" dependson=\"{0}{1}\"", basename, ".cs"); - } - - // We need to specify a resources file name to avoid MissingManifestResourceExceptions - // in libraries that are built. - resource_id = string.Format(" resource_id=\"{0}.{1}.resources\"", - project.AssemblyName, basename.Replace("/", ".")); - } - - switch(project.Files.GetCopyToOutput(file)) - { - case CopyToOutput.Always: - copyToOutput = string.Format(" copyToOutputDirectory=\"Always\""); - break; - case CopyToOutput.PreserveNewest: - copyToOutput = string.Format(" copyToOutputDirectory=\"PreserveNewest\""); - break; - } - - // Sort of a hack, we try and resolve the path and make it relative, if we can. - string filePath = PrependPath(file); - ss.WriteLine(" ", - filePath, buildAction, dependson, resource_id, copyToOutput); - } - ss.WriteLine(" "); - - ss.WriteLine(" "); - foreach(ReferenceNode refr in project.References) - { - ss.WriteLine(" {0}", BuildReference(solution, refr)); - } - ss.WriteLine(" "); - - - ss.WriteLine(""); - } - - m_Kernel.CurrentWorkingDirectory.Pop(); - } - - private void WriteCombine(SolutionNode solution) - { - m_Kernel.Log.Write("Creating MonoDevelop combine and project files"); - foreach(ProjectNode project in solution.Projects) - { - if(m_Kernel.AllowProject(project.FilterGroups)) - { - m_Kernel.Log.Write("...Creating project: {0}", project.Name); - WriteProject(solution, project); - } - } - - m_Kernel.Log.Write(""); - string combFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "mds"); - StreamWriter ss = new StreamWriter(combFile); - - m_Kernel.CurrentWorkingDirectory.Push(); - Helper.SetCurrentDir(Path.GetDirectoryName(combFile)); - - int count = 0; - - using(ss) - { - ss.WriteLine("", solution.Name); - - count = 0; - foreach(ConfigurationNode conf in solution.Configurations) - { - if(count == 0) - { - ss.WriteLine(" ", conf.Name); - } - - ss.WriteLine(" ", conf.Name); - foreach(ProjectNode project in solution.Projects) - { - ss.WriteLine(" ", project.Name, conf.Name); - } - ss.WriteLine(" "); - - count++; - } - ss.WriteLine(" "); - - count = 0; - - foreach(ProjectNode project in solution.Projects) - { - if(count == 0) - ss.WriteLine(" ", project.Name); - - ss.WriteLine(" ", project.Name); - count++; - } - ss.WriteLine(" "); - - ss.WriteLine(" "); - foreach(ProjectNode project in solution.Projects) - { - string path = Helper.MakePathRelativeTo(solution.FullPath, project.FullPath); - ss.WriteLine(" ", - Helper.MakeFilePath(path, project.Name, "mdp")); - } - ss.WriteLine(" "); - - ss.WriteLine(""); - } - - m_Kernel.CurrentWorkingDirectory.Pop(); - } - - private void CleanProject(ProjectNode project) - { - m_Kernel.Log.Write("...Cleaning project: {0}", project.Name); - string projectFile = Helper.MakeFilePath(project.FullPath, project.Name, "mdp"); - Helper.DeleteIfExists(projectFile); - } - - private void CleanSolution(SolutionNode solution) - { - m_Kernel.Log.Write("Cleaning MonoDevelop combine and project files for", solution.Name); - - string slnFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "mds"); - Helper.DeleteIfExists(slnFile); - - foreach(ProjectNode project in solution.Projects) - { - CleanProject(project); - } - - m_Kernel.Log.Write(""); - } - - #endregion - - #region ITarget Members - - /// - /// Writes the specified kern. - /// - /// The kern. - public void Write(Kernel kern) - { - if( kern == null ) - { - throw new ArgumentNullException("kern"); - } - m_Kernel = kern; - foreach(SolutionNode solution in kern.Solutions) - { - WriteCombine(solution); - } - m_Kernel = null; - } - - /// - /// Cleans the specified kern. - /// - /// The kern. - public virtual void Clean(Kernel kern) - { - if( kern == null ) - { - throw new ArgumentNullException("kern"); - } - m_Kernel = kern; - foreach(SolutionNode sol in kern.Solutions) - { - CleanSolution(sol); - } - m_Kernel = null; - } - - /// - /// Gets the name. - /// - /// The name. - public string Name - { - get - { - return "sharpdev"; - } - } - - #endregion - } -} diff --git a/Prebuild/src/Core/Targets/.svn/text-base/NAntTarget.cs.svn-base b/Prebuild/src/Core/Targets/.svn/text-base/NAntTarget.cs.svn-base deleted file mode 100644 index 1efc16d..0000000 --- a/Prebuild/src/Core/Targets/.svn/text-base/NAntTarget.cs.svn-base +++ /dev/null @@ -1,776 +0,0 @@ -#region BSD License -/* -Copyright (c) 2004 - 2008 -Matthew Holmes (matthew@wildfiregames.com), -Dan Moorehead (dan05a@gmail.com), -C.J. Adams-Collier (cjac@colliertech.org), - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - -* Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - -* Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - -* The name of the author may not be used to endorse or promote - products derived from this software without specific prior written - permission. - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR -IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, -INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, -STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING -IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -POSSIBILITY OF SUCH DAMAGE. -*/ - -#endregion - -using System; -using System.Collections.Generic; -using System.IO; -using System.Text.RegularExpressions; - -using Prebuild.Core.Attributes; -using Prebuild.Core.Interfaces; -using Prebuild.Core.Nodes; -using Prebuild.Core.Utilities; - -namespace Prebuild.Core.Targets -{ - /// - /// - /// - [Target("nant")] - public class NAntTarget : ITarget - { - #region Fields - - private Kernel m_Kernel; - - #endregion - - #region Private Methods - - private static string PrependPath(string path) - { - string tmpPath = Helper.NormalizePath(path, '/'); - Regex regex = new Regex(@"(\w):/(\w+)"); - Match match = regex.Match(tmpPath); - //if(match.Success || tmpPath[0] == '.' || tmpPath[0] == '/') - //{ - tmpPath = Helper.NormalizePath(tmpPath); - //} - // else - // { - // tmpPath = Helper.NormalizePath("./" + tmpPath); - // } - - return tmpPath; - } - - private static string BuildReference(SolutionNode solution, ProjectNode currentProject, ReferenceNode refr) - { - - if (!String.IsNullOrEmpty(refr.Path)) - { - return refr.Path; - } - - if (solution.ProjectsTable.ContainsKey(refr.Name)) - { - ProjectNode projectRef = (ProjectNode) solution.ProjectsTable[refr.Name]; - string finalPath = - Helper.NormalizePath(refr.Name + GetProjectExtension(projectRef), '/'); - return finalPath; - } - - ProjectNode project = (ProjectNode) refr.Parent; - - // Do we have an explicit file reference? - string fileRef = FindFileReference(refr.Name, project); - if (fileRef != null) - { - return fileRef; - } - - // Is there an explicit path in the project ref? - if (refr.Path != null) - { - return Helper.NormalizePath(refr.Path + "/" + refr.Name + GetProjectExtension(project), '/'); - } - - // No, it's an extensionless GAC ref, but nant needs the .dll extension anyway - return refr.Name + ".dll"; - } - - public static string GetRefFileName(string refName) - { - if (ExtensionSpecified(refName)) - { - return refName; - } - else - { - return refName + ".dll"; - } - } - - private static bool ExtensionSpecified(string refName) - { - return refName.EndsWith(".dll") || refName.EndsWith(".exe"); - } - - private static string GetProjectExtension(ProjectNode project) - { - string extension = ".dll"; - if (project.Type == ProjectType.Exe || project.Type == ProjectType.WinExe) - { - extension = ".exe"; - } - return extension; - } - - private static string FindFileReference(string refName, ProjectNode project) - { - foreach (ReferencePathNode refPath in project.ReferencePaths) - { - string fullPath = Helper.MakeFilePath(refPath.Path, refName); - - if (File.Exists(fullPath)) - { - return fullPath; - } - - fullPath = Helper.MakeFilePath(refPath.Path, refName, "dll"); - - if (File.Exists(fullPath)) - { - return fullPath; - } - - fullPath = Helper.MakeFilePath(refPath.Path, refName, "exe"); - - if (File.Exists(fullPath)) - { - return fullPath; - } - } - - return null; - } - - /// - /// Gets the XML doc file. - /// - /// The project. - /// The conf. - /// - public static string GetXmlDocFile(ProjectNode project, ConfigurationNode conf) - { - if (conf == null) - { - throw new ArgumentNullException("conf"); - } - if (project == null) - { - throw new ArgumentNullException("project"); - } - string docFile = (string)conf.Options["XmlDocFile"]; - // if(docFile != null && docFile.Length == 0)//default to assembly name if not specified - // { - // return Path.GetFileNameWithoutExtension(project.AssemblyName) + ".xml"; - // } - return docFile; - } - - private void WriteProject(SolutionNode solution, ProjectNode project) - { - string projFile = Helper.MakeFilePath(project.FullPath, project.Name + GetProjectExtension(project), "build"); - StreamWriter ss = new StreamWriter(projFile); - - m_Kernel.CurrentWorkingDirectory.Push(); - Helper.SetCurrentDir(Path.GetDirectoryName(projFile)); - bool hasDoc = false; - - using (ss) - { - ss.WriteLine(""); - ss.WriteLine("", project.Name); - ss.WriteLine(" ", "build"); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - foreach (ReferenceNode refr in project.References) - { - if (refr.LocalCopy) - { - ss.WriteLine(" ", '/')); - } - } - - ss.WriteLine(" "); - ss.WriteLine(" "); - if (project.ConfigFile != null && project.ConfigFile.Length!=0) - { - ss.Write(" "); - } - - // Add the content files to just be copied - ss.WriteLine(" {0}", ""); - ss.WriteLine(" {0}", ""); - - foreach (string file in project.Files) - { - // Ignore if we aren't content - if (project.Files.GetBuildAction(file) != BuildAction.Content) - continue; - - // Create a include tag - ss.WriteLine(" {0}", ""); - } - - ss.WriteLine(" {0}", ""); - ss.WriteLine(" {0}", ""); - - ss.Write(" "); - ss.WriteLine(" ", project.RootNamespace); - foreach (string file in project.Files) - { - switch (project.Files.GetBuildAction(file)) - { - case BuildAction.EmbeddedResource: - ss.WriteLine(" {0}", ""); - break; - default: - if (project.Files.GetSubType(file) != SubType.Code && project.Files.GetSubType(file) != SubType.Settings) - { - ss.WriteLine(" ", file.Substring(0, file.LastIndexOf('.')) + ".resx"); - } - break; - } - } - //if (project.Files.GetSubType(file).ToString() != "Code") - //{ - // ps.WriteLine(" ", file.Substring(0, file.LastIndexOf('.')) + ".resx"); - - ss.WriteLine(" "); - ss.WriteLine(" "); - foreach (string file in project.Files) - { - switch (project.Files.GetBuildAction(file)) - { - case BuildAction.Compile: - ss.WriteLine(" "); - break; - default: - break; - } - } - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - foreach(ReferencePathNode refPath in project.ReferencePaths) - { - ss.WriteLine(" "); - } - ss.WriteLine(" "); - foreach (ReferenceNode refr in project.References) - { - string path = Helper.NormalizePath(Helper.MakePathRelativeTo(project.FullPath, BuildReference(solution, project, refr)), '/'); - if (refr.Path != null) { - if (ExtensionSpecified(refr.Name)) - { - ss.WriteLine (" "); - } - else - { - ss.WriteLine (" "); - } - } - else - { - ss.WriteLine (" "); - } - } - ss.WriteLine(" "); - - ss.WriteLine(" "); - - foreach (ConfigurationNode conf in project.Configurations) - { - if (!String.IsNullOrEmpty(conf.Options.OutputPath)) - { - string targetDir = Helper.NormalizePath(conf.Options.OutputPath, '/'); - - ss.WriteLine(" "); - - ss.WriteLine(" "); - - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - break; - } - } - - ss.WriteLine(" "); - - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - - ss.WriteLine(" "); - if (hasDoc) - { - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.Write(" "); - } - else - { - ss.WriteLine(".exe\" />"); - } - - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - // foreach(ReferenceNode refr in project.References) - // { - // string path = Helper.NormalizePath(Helper.MakePathRelativeTo(project.FullPath, BuildReferencePath(solution, refr)), '/'); - // if (path != "") - // { - // ss.WriteLine(" ", path); - // } - // } - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - } - ss.WriteLine(" "); - ss.WriteLine(""); - } - m_Kernel.CurrentWorkingDirectory.Pop(); - } - - private void WriteCombine(SolutionNode solution) - { - m_Kernel.Log.Write("Creating NAnt build files"); - foreach (ProjectNode project in solution.Projects) - { - if (m_Kernel.AllowProject(project.FilterGroups)) - { - m_Kernel.Log.Write("...Creating project: {0}", project.Name); - WriteProject(solution, project); - } - } - - m_Kernel.Log.Write(""); - string combFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "build"); - StreamWriter ss = new StreamWriter(combFile); - - m_Kernel.CurrentWorkingDirectory.Push(); - Helper.SetCurrentDir(Path.GetDirectoryName(combFile)); - - using (ss) - { - ss.WriteLine(""); - ss.WriteLine("", solution.Name); - ss.WriteLine(" "); - ss.WriteLine(); - - //ss.WriteLine(" "); - //ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - - // Use the active configuration, which is the first configuration name in the prebuild file. - Dictionary emittedConfigurations = new Dictionary(); - - ss.WriteLine(" ", solution.ActiveConfig); - ss.WriteLine(); - - foreach (ConfigurationNode conf in solution.Configurations) - { - // If the name isn't in the emitted configurations, we give a high level target to the - // platform specific on. This lets "Debug" point to "Debug-AnyCPU". - if (!emittedConfigurations.ContainsKey(conf.Name)) - { - // Add it to the dictionary so we only emit one. - emittedConfigurations.Add(conf.Name, conf.Platform); - - // Write out the target block. - ss.WriteLine(" ", conf.Name, conf.Platform); - ss.WriteLine(" "); - ss.WriteLine(); - } - - // Write out the target for the configuration. - ss.WriteLine(" ", conf.Name, conf.Platform); - ss.WriteLine(" ", conf.Name); - ss.WriteLine(" ", conf.Options["DebugInformation"].ToString().ToLower()); - ss.WriteLine("\t\t ", conf.Platform); - ss.WriteLine(" "); - ss.WriteLine(); - } - - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(); - - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(); - - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(); - - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(); - - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(); - - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(); - - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(); - - - // sdague - ok, this is an ugly hack, but what it lets - // us do is native include of files into the nant - // created files from all .nant/*include files. This - // lets us keep using prebuild, but allows for - // extended nant targets to do build and the like. - - try - { - Regex re = new Regex(".include$"); - DirectoryInfo nantdir = new DirectoryInfo(".nant"); - foreach (FileSystemInfo item in nantdir.GetFileSystemInfos()) - { - if (item is DirectoryInfo) { } - else if (item is FileInfo) - { - if (re.Match(item.FullName) != - System.Text.RegularExpressions.Match.Empty) - { - Console.WriteLine("Including file: " + item.FullName); - - using (FileStream fs = new FileStream(item.FullName, - FileMode.Open, - FileAccess.Read, - FileShare.None)) - { - using (StreamReader sr = new StreamReader(fs)) - { - ss.WriteLine("", (item).FullName); - while (sr.Peek() != -1) - { - ss.WriteLine(sr.ReadLine()); - } - ss.WriteLine(); - } - } - } - } - } - } - catch { } - // ss.WriteLine(" "); - // ss.WriteLine(" "); - // ss.WriteLine(" ", solution.Name, solution.Version); - // ss.WriteLine(" "); - - // ss.WriteLine(" "); - // // ss.WriteLine(" "); - // ss.WriteLine(" "); - // ss.WriteLine(" "); - // ss.WriteLine(" "); - // ss.WriteLine(" "); - ss.WriteLine(); - - - ss.WriteLine(" "); - ss.WriteLine(" "); - //ss.WriteLine(" "); - if (solution.Cleanup != null && solution.Cleanup.CleanFiles.Count > 0) - { - foreach (CleanFilesNode cleanFile in solution.Cleanup.CleanFiles) - { - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" ", cleanFile.Pattern); - ss.WriteLine(" ", cleanFile.Pattern); - ss.WriteLine(" "); - ss.WriteLine(" "); - } - } - ss.WriteLine(" "); - foreach (ProjectNode project in solution.Projects) - { - string path = Helper.MakePathRelativeTo(solution.FullPath, project.FullPath); - ss.Write(" "); - } - ss.WriteLine(" "); - ss.WriteLine(); - - ss.WriteLine(" "); - - foreach (ProjectNode project in solution.ProjectsTableOrder) - { - string path = Helper.MakePathRelativeTo(solution.FullPath, project.FullPath); - ss.Write(" "); - } - ss.WriteLine(" "); - ss.WriteLine(); - - ss.WriteLine(" "); - ss.WriteLine(); - ss.WriteLine(" "); - ss.WriteLine(); - //ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(); - - ss.WriteLine(" "); - ss.WriteLine(" "); - foreach (ProjectNode project in solution.Projects) - { - string path = Helper.MakePathRelativeTo(solution.FullPath, project.FullPath); - ss.Write(" "); - } - ss.WriteLine(" "); - ss.WriteLine(); - ss.WriteLine(""); - } - - m_Kernel.CurrentWorkingDirectory.Pop(); - } - - private void CleanProject(ProjectNode project) - { - m_Kernel.Log.Write("...Cleaning project: {0}", project.Name); - string projectFile = Helper.MakeFilePath(project.FullPath, project.Name + GetProjectExtension(project), "build"); - Helper.DeleteIfExists(projectFile); - } - - private void CleanSolution(SolutionNode solution) - { - m_Kernel.Log.Write("Cleaning NAnt build files for", solution.Name); - - string slnFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "build"); - Helper.DeleteIfExists(slnFile); - - foreach (ProjectNode project in solution.Projects) - { - CleanProject(project); - } - - m_Kernel.Log.Write(""); - } - - #endregion - - #region ITarget Members - - /// - /// Writes the specified kern. - /// - /// The kern. - public void Write(Kernel kern) - { - if (kern == null) - { - throw new ArgumentNullException("kern"); - } - m_Kernel = kern; - foreach (SolutionNode solution in kern.Solutions) - { - WriteCombine(solution); - } - m_Kernel = null; - } - - /// - /// Cleans the specified kern. - /// - /// The kern. - public virtual void Clean(Kernel kern) - { - if (kern == null) - { - throw new ArgumentNullException("kern"); - } - m_Kernel = kern; - foreach (SolutionNode sol in kern.Solutions) - { - CleanSolution(sol); - } - m_Kernel = null; - } - - /// - /// Gets the name. - /// - /// The name. - public string Name - { - get - { - return "nant"; - } - } - - #endregion - } -} diff --git a/Prebuild/src/Core/Targets/.svn/text-base/SharpDevelop2Target.cs.svn-base b/Prebuild/src/Core/Targets/.svn/text-base/SharpDevelop2Target.cs.svn-base deleted file mode 100644 index 66dd1bc..0000000 --- a/Prebuild/src/Core/Targets/.svn/text-base/SharpDevelop2Target.cs.svn-base +++ /dev/null @@ -1,82 +0,0 @@ -#region BSD License -/* -Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com) - -Redistribution and use in source and binary forms, with or without modification, are permitted -provided that the following conditions are met: - -* Redistributions of source code must retain the above copyright notice, this list of conditions - and the following disclaimer. -* Redistributions in binary form must reproduce the above copyright notice, this list of conditions - and the following disclaimer in the documentation and/or other materials provided with the - distribution. -* The name of the author may not be used to endorse or promote products derived from this software - without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, -BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY -OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING -IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ -#endregion - -using System; - -using Prebuild.Core.Attributes; - -namespace Prebuild.Core.Targets -{ - /// - /// - /// - [Target("sharpdev2")] - public class SharpDevelop2Target : VS2005Target - { - #region Properties - public override string VersionName - { - get - { - return "SharpDevelop2"; - } - } - #endregion - - #region Public Methods - - /// - /// Writes the specified kern. - /// - /// The kern. - public override void Write(Kernel kern) - { - base.Write(kern); - } - - /// - /// Cleans the specified kern. - /// - /// The kern. - public override void Clean(Kernel kern) - { - base.Clean(kern); - } - - /// - /// Gets the name. - /// - /// The name. - public override string Name - { - get - { - return "sharpdev2"; - } - } - - #endregion - } -} diff --git a/Prebuild/src/Core/Targets/.svn/text-base/SharpDevelopTarget.cs.svn-base b/Prebuild/src/Core/Targets/.svn/text-base/SharpDevelopTarget.cs.svn-base deleted file mode 100644 index 8e32050..0000000 --- a/Prebuild/src/Core/Targets/.svn/text-base/SharpDevelopTarget.cs.svn-base +++ /dev/null @@ -1,425 +0,0 @@ -#region BSD License -/* -Copyright (c) 2004 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com) - -Redistribution and use in source and binary forms, with or without modification, are permitted -provided that the following conditions are met: - -* Redistributions of source code must retain the above copyright notice, this list of conditions - and the following disclaimer. -* Redistributions in binary form must reproduce the above copyright notice, this list of conditions - and the following disclaimer in the documentation and/or other materials provided with the - distribution. -* The name of the author may not be used to endorse or promote products derived from this software - without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, -BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY -OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING -IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ -#endregion - -using System; -using System.IO; -using System.Text.RegularExpressions; - -using Prebuild.Core.Attributes; -using Prebuild.Core.Interfaces; -using Prebuild.Core.Nodes; -using Prebuild.Core.Utilities; - -namespace Prebuild.Core.Targets -{ - /// - /// - /// - [Target("sharpdev")] - public class SharpDevelopTarget : ITarget - { - #region Fields - - private Kernel m_Kernel; - - #endregion - - #region Private Methods - - private static string PrependPath(string path) - { - string tmpPath = Helper.NormalizePath(path, '/'); - Regex regex = new Regex(@"(\w):/(\w+)"); - Match match = regex.Match(tmpPath); - if(match.Success || tmpPath[0] == '.' || tmpPath[0] == '/') - { - tmpPath = Helper.NormalizePath(tmpPath); - } - else - { - tmpPath = Helper.NormalizePath("./" + tmpPath); - } - - return tmpPath; - } - - private static string BuildReference(SolutionNode solution, ReferenceNode refr) - { - string ret = ""; - } - else - { - ProjectNode project = (ProjectNode)refr.Parent; - string fileRef = FindFileReference(refr.Name, project); - - if(refr.Path != null || fileRef != null) - { - ret += "Assembly\" refto=\""; - - string finalPath = (refr.Path != null) ? Helper.MakeFilePath(refr.Path, refr.Name, "dll") : fileRef; - - ret += finalPath; - ret += "\" localcopy=\"" + refr.LocalCopy.ToString() + "\" />"; - return ret; - } - - ret += "Gac\" refto=\""; - try - { - //Assembly assem = Assembly.Load(refr.Name); - ret += refr.Name;// assem.FullName; - } - catch (System.NullReferenceException e) - { - e.ToString(); - ret += refr.Name; - } - ret += "\" localcopy=\"" + refr.LocalCopy.ToString() + "\" />"; - } - - return ret; - } - - private static string FindFileReference(string refName, ProjectNode project) - { - foreach(ReferencePathNode refPath in project.ReferencePaths) - { - string fullPath = Helper.MakeFilePath(refPath.Path, refName, "dll"); - - if(File.Exists(fullPath)) - { - return fullPath; - } - } - - return null; - } - - /// - /// Gets the XML doc file. - /// - /// The project. - /// The conf. - /// - public static string GenerateXmlDocFile(ProjectNode project, ConfigurationNode conf) - { - if( conf == null ) - { - throw new ArgumentNullException("conf"); - } - if( project == null ) - { - throw new ArgumentNullException("project"); - } - string docFile = (string)conf.Options["XmlDocFile"]; - if(docFile != null && docFile.Length == 0)//default to assembly name if not specified - { - return "False"; - } - return "True"; - } - - private void WriteProject(SolutionNode solution, ProjectNode project) - { - string csComp = "Csc"; - string netRuntime = "MsNet"; - if(project.Runtime == ClrRuntime.Mono) - { - csComp = "Mcs"; - netRuntime = "Mono"; - } - - string projFile = Helper.MakeFilePath(project.FullPath, project.Name, "prjx"); - StreamWriter ss = new StreamWriter(projFile); - - m_Kernel.CurrentWorkingDirectory.Push(); - Helper.SetCurrentDir(Path.GetDirectoryName(projFile)); - - using(ss) - { - ss.WriteLine( - "", - project.Name, - project.RootNamespace - ); - - ss.WriteLine(" "); - foreach(string file in project.Files) - { - string buildAction = "Compile"; - switch(project.Files.GetBuildAction(file)) - { - case BuildAction.None: - buildAction = "Nothing"; - break; - - case BuildAction.Content: - buildAction = "Exclude"; - break; - - case BuildAction.EmbeddedResource: - buildAction = "EmbedAsResource"; - break; - - default: - buildAction = "Compile"; - break; - } - - // Sort of a hack, we try and resolve the path and make it relative, if we can. - string filePath = PrependPath(file); - ss.WriteLine(" ", filePath, buildAction); - } - ss.WriteLine(" "); - - ss.WriteLine(" "); - foreach(ReferenceNode refr in project.References) - { - ss.WriteLine(" {0}", BuildReference(solution, refr)); - } - ss.WriteLine(" "); - - ss.Write(" "); - - int count = 0; - - ss.WriteLine(" ", solution.ActiveConfig); - - foreach(ConfigurationNode conf in project.Configurations) - { - ss.Write(" "); - ss.Write(" "); - - ss.Write(" "); - - ss.Write(" "); - ss.WriteLine(" "); - - count++; - } - ss.WriteLine(" "); - ss.WriteLine(""); - } - - m_Kernel.CurrentWorkingDirectory.Pop(); - } - - private void WriteCombine(SolutionNode solution) - { - m_Kernel.Log.Write("Creating SharpDevelop combine and project files"); - foreach(ProjectNode project in solution.Projects) - { - if(m_Kernel.AllowProject(project.FilterGroups)) - { - m_Kernel.Log.Write("...Creating project: {0}", project.Name); - WriteProject(solution, project); - } - } - - m_Kernel.Log.Write(""); - string combFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "cmbx"); - StreamWriter ss = new StreamWriter(combFile); - - m_Kernel.CurrentWorkingDirectory.Push(); - Helper.SetCurrentDir(Path.GetDirectoryName(combFile)); - - using(ss) - { - ss.WriteLine("", solution.Name); - - int count = 0; - foreach(ProjectNode project in solution.Projects) - { - if(count == 0) - ss.WriteLine(" ", project.Name); - - ss.WriteLine(" ", project.Name); - count++; - } - ss.WriteLine(" "); - - ss.WriteLine(" "); - foreach(ProjectNode project in solution.Projects) - { - string path = Helper.MakePathRelativeTo(solution.FullPath, project.FullPath); - ss.WriteLine(" ", - Helper.MakeFilePath(path, project.Name, "prjx")); - } - ss.WriteLine(" "); - - count = 0; - foreach(ConfigurationNode conf in solution.Configurations) - { - if(count == 0) - { - ss.WriteLine(" ", conf.Name); - } - - ss.WriteLine(" ", conf.Name); - foreach(ProjectNode project in solution.Projects) - { - ss.WriteLine(" ", project.Name, conf.Name); - } - ss.WriteLine(" "); - - count++; - } - ss.WriteLine(" "); - ss.WriteLine(""); - } - - m_Kernel.CurrentWorkingDirectory.Pop(); - } - - private void CleanProject(ProjectNode project) - { - m_Kernel.Log.Write("...Cleaning project: {0}", project.Name); - string projectFile = Helper.MakeFilePath(project.FullPath, project.Name, "prjx"); - Helper.DeleteIfExists(projectFile); - } - - private void CleanSolution(SolutionNode solution) - { - m_Kernel.Log.Write("Cleaning SharpDevelop combine and project files for", solution.Name); - - string slnFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "cmbx"); - Helper.DeleteIfExists(slnFile); - - foreach(ProjectNode project in solution.Projects) - { - CleanProject(project); - } - - m_Kernel.Log.Write(""); - } - - #endregion - - #region ITarget Members - - /// - /// Writes the specified kern. - /// - /// The kern. - public void Write(Kernel kern) - { - if( kern == null ) - { - throw new ArgumentNullException("kern"); - } - m_Kernel = kern; - foreach(SolutionNode solution in kern.Solutions) - { - WriteCombine(solution); - } - m_Kernel = null; - } - - /// - /// Cleans the specified kern. - /// - /// The kern. - public virtual void Clean(Kernel kern) - { - if( kern == null ) - { - throw new ArgumentNullException("kern"); - } - m_Kernel = kern; - foreach(SolutionNode sol in kern.Solutions) - { - CleanSolution(sol); - } - m_Kernel = null; - } - - /// - /// Gets the name. - /// - /// The name. - public string Name - { - get - { - return "sharpdev"; - } - } - - #endregion - } -} diff --git a/Prebuild/src/Core/Targets/.svn/text-base/ToolInfo.cs.svn-base b/Prebuild/src/Core/Targets/.svn/text-base/ToolInfo.cs.svn-base deleted file mode 100644 index 935c674..0000000 --- a/Prebuild/src/Core/Targets/.svn/text-base/ToolInfo.cs.svn-base +++ /dev/null @@ -1,197 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace Prebuild.Core.Targets -{ - /// - /// - /// - public struct ToolInfo - { - string name; - string guid; - string fileExtension; - string xmlTag; - string importProject; - - /// - /// Gets or sets the name. - /// - /// The name. - public string Name - { - get - { - return name; - } - set - { - name = value; - } - } - - /// - /// Gets or sets the GUID. - /// - /// The GUID. - public string Guid - { - get - { - return guid; - } - set - { - guid = value; - } - } - - /// - /// Gets or sets the file extension. - /// - /// The file extension. - public string FileExtension - { - get - { - return fileExtension; - } - set - { - fileExtension = value; - } - } - public string LanguageExtension - { - get - { - switch (this.Name) - { - case "C#": - return ".cs"; - case "VisualBasic": - return ".vb"; - case "Boo": - return ".boo"; - default: - return ".cs"; - } - } - } - /// - /// Gets or sets the XML tag. - /// - /// The XML tag. - public string XmlTag - { - get - { - return xmlTag; - } - set - { - xmlTag = value; - } - } - - /// - /// Gets or sets the import project property. - /// - /// The ImportProject tag. - public string ImportProject - { - get - { - return importProject; - } - set - { - importProject = value; - } - } - - /// - /// Initializes a new instance of the class. - /// - /// The name. - /// The GUID. - /// The file extension. - /// The XML. - /// The import project. - public ToolInfo(string name, string guid, string fileExtension, string xml, string importProject) - { - this.name = name; - this.guid = guid; - this.fileExtension = fileExtension; - this.xmlTag = xml; - this.importProject = importProject; - } - - /// - /// Initializes a new instance of the class. - /// - /// The name. - /// The GUID. - /// The file extension. - /// The XML. - public ToolInfo(string name, string guid, string fileExtension, string xml) - { - this.name = name; - this.guid = guid; - this.fileExtension = fileExtension; - this.xmlTag = xml; - this.importProject = "$(MSBuildBinPath)\\Microsoft." + xml + ".Targets"; - } - - /// - /// Equals operator - /// - /// ToolInfo to compare - /// true if toolInfos are equal - public override bool Equals(object obj) - { - if (obj == null) - { - throw new ArgumentNullException("obj"); - } - if (obj.GetType() != typeof(ToolInfo)) - return false; - - ToolInfo c = (ToolInfo)obj; - return ((this.name == c.name) && (this.guid == c.guid) && (this.fileExtension == c.fileExtension) && (this.importProject == c.importProject)); - } - - /// - /// Equals operator - /// - /// ToolInfo to compare - /// ToolInfo to compare - /// True if toolInfos are equal - public static bool operator ==(ToolInfo c1, ToolInfo c2) - { - return ((c1.name == c2.name) && (c1.guid == c2.guid) && (c1.fileExtension == c2.fileExtension) && (c1.importProject == c2.importProject) && (c1.xmlTag == c2.xmlTag)); - } - - /// - /// Not equals operator - /// - /// ToolInfo to compare - /// ToolInfo to compare - /// True if toolInfos are not equal - public static bool operator !=(ToolInfo c1, ToolInfo c2) - { - return !(c1 == c2); - } - - /// - /// Hash Code - /// - /// Hash code - public override int GetHashCode() - { - return name.GetHashCode() ^ guid.GetHashCode() ^ this.fileExtension.GetHashCode() ^ this.importProject.GetHashCode() ^ this.xmlTag.GetHashCode(); - - } - } -} diff --git a/Prebuild/src/Core/Targets/.svn/text-base/VS2002Target.cs.svn-base b/Prebuild/src/Core/Targets/.svn/text-base/VS2002Target.cs.svn-base deleted file mode 100644 index 2292624..0000000 --- a/Prebuild/src/Core/Targets/.svn/text-base/VS2002Target.cs.svn-base +++ /dev/null @@ -1,87 +0,0 @@ -#region BSD License -/* -Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com) - -Redistribution and use in source and binary forms, with or without modification, are permitted -provided that the following conditions are met: - -* Redistributions of source code must retain the above copyright notice, this list of conditions - and the following disclaimer. -* Redistributions in binary form must reproduce the above copyright notice, this list of conditions - and the following disclaimer in the documentation and/or other materials provided with the - distribution. -* The name of the author may not be used to endorse or promote products derived from this software - without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, -BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY -OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING -IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ -#endregion - -using System; - -using Prebuild.Core.Attributes; - -namespace Prebuild.Core.Targets -{ - /// - /// - /// - [Target("vs2002")] - public class VS2002Target : VS2003Target - { - #region Private Methods - - private void SetVS2002() - { - this.SolutionVersion = "7.00"; - this.ProductVersion = "7.0.9254"; - this.SchemaVersion = "1.0"; - this.VersionName = "2002"; - this.Version = VSVersion.VS70; - } - - #endregion - - #region Public Methods - - /// - /// Writes the specified kern. - /// - /// The kern. - public override void Write(Kernel kern) - { - SetVS2002(); - base.Write(kern); - } - - /// - /// Cleans the specified kern. - /// - /// The kern. - public override void Clean(Kernel kern) - { - SetVS2002(); - base.Clean(kern); - } - - /// - /// Gets the name. - /// - /// The name. - public override string Name - { - get - { - return "vs2002"; - } - } - - #endregion - } -} diff --git a/Prebuild/src/Core/Targets/.svn/text-base/VS2003Target.cs.svn-base b/Prebuild/src/Core/Targets/.svn/text-base/VS2003Target.cs.svn-base deleted file mode 100644 index 10e2dc4..0000000 --- a/Prebuild/src/Core/Targets/.svn/text-base/VS2003Target.cs.svn-base +++ /dev/null @@ -1,593 +0,0 @@ -#region BSD License -/* -Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com) - -Redistribution and use in source and binary forms, with or without modification, are permitted -provided that the following conditions are met: - -* Redistributions of source code must retain the above copyright notice, this list of conditions - and the following disclaimer. -* Redistributions in binary form must reproduce the above copyright notice, this list of conditions - and the following disclaimer in the documentation and/or other materials provided with the - distribution. -* The name of the author may not be used to endorse or promote products derived from this software - without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, -BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY -OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING -IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ -#endregion - -using System; -using System.Collections.Generic; -using System.IO; - -using Prebuild.Core.Attributes; -using Prebuild.Core.Interfaces; -using Prebuild.Core.Nodes; -using Prebuild.Core.Utilities; - -namespace Prebuild.Core.Targets -{ - [Target("vs2003")] - public class VS2003Target : ITarget - { - - #region Fields - - string solutionVersion = "8.00"; - string productVersion = "7.10.3077"; - string schemaVersion = "2.0"; - string versionName = "2003"; - VSVersion version = VSVersion.VS71; - - readonly Dictionary m_Tools = new Dictionary(); - Kernel m_Kernel; - - /// - /// Gets or sets the solution version. - /// - /// The solution version. - protected string SolutionVersion - { - get - { - return solutionVersion; - } - set - { - solutionVersion = value; - } - } - /// - /// Gets or sets the product version. - /// - /// The product version. - protected string ProductVersion - { - get - { - return productVersion; - } - set - { - productVersion = value; - } - } - /// - /// Gets or sets the schema version. - /// - /// The schema version. - protected string SchemaVersion - { - get - { - return schemaVersion; - } - set - { - schemaVersion = value; - } - } - /// - /// Gets or sets the name of the version. - /// - /// The name of the version. - protected string VersionName - { - get - { - return versionName; - } - set - { - versionName = value; - } - } - /// - /// Gets or sets the version. - /// - /// The version. - protected VSVersion Version - { - get - { - return version; - } - set - { - version = value; - } - } - - #endregion - - #region Constructors - - /// - /// Initializes a new instance of the class. - /// - public VS2003Target() - { - m_Tools["C#"] = new ToolInfo("C#", "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}", "csproj", "CSHARP"); - m_Tools["VB.NET"] = new ToolInfo("VB.NET", "{F184B08F-C81C-45F6-A57F-5ABD9991F28F}", "vbproj", "VisualBasic"); - } - - #endregion - - #region Private Methods - - private string MakeRefPath(ProjectNode project) - { - string ret = ""; - foreach(ReferencePathNode node in project.ReferencePaths) - { - try - { - string fullPath = Helper.ResolvePath(node.Path); - if(ret.Length < 1) - { - ret = fullPath; - } - else - { - ret += ";" + fullPath; - } - } - catch(ArgumentException) - { - m_Kernel.Log.Write(LogType.Warning, "Could not resolve reference path: {0}", node.Path); - } - } - - return ret; - } - - private void WriteProject(SolutionNode solution, ProjectNode project) - { - if(!m_Tools.ContainsKey(project.Language)) - { - throw new UnknownLanguageException("Unknown .NET language: " + project.Language); - } - - ToolInfo toolInfo = m_Tools[project.Language]; - string projectFile = Helper.MakeFilePath(project.FullPath, project.Name, toolInfo.FileExtension); - StreamWriter ps = new StreamWriter(projectFile); - - m_Kernel.CurrentWorkingDirectory.Push(); - Helper.SetCurrentDir(Path.GetDirectoryName(projectFile)); - - using(ps) - { - ps.WriteLine(""); - ps.WriteLine(" <{0}", toolInfo.XmlTag); - ps.WriteLine("\t\t\t\tProjectType = \"Local\""); - ps.WriteLine("\t\t\t\tProductVersion = \"{0}\"", ProductVersion); - ps.WriteLine("\t\t\t\tSchemaVersion = \"{0}\"", SchemaVersion); - ps.WriteLine("\t\t\t\tProjectGuid = \"{{{0}}}\"", project.Guid.ToString().ToUpper()); - ps.WriteLine("\t\t>"); - - ps.WriteLine("\t\t\t\t"); - ps.WriteLine(" "); - - foreach(ConfigurationNode conf in project.Configurations) - { - ps.WriteLine("\t\t\t\t "); - } - - ps.WriteLine(" "); - - ps.WriteLine(" "); - foreach(ReferenceNode refr in project.References) - { - ps.WriteLine(" "); - } - ps.WriteLine(" "); - - ps.WriteLine(" "); - ps.WriteLine(" "); - - ps.WriteLine(" "); - - foreach(string file in project.Files) - { - string fileName = file.Replace(".\\", ""); - ps.WriteLine(" "); - - if (project.Files.GetSubType(file) != SubType.Code && project.Files.GetSubType(file) != SubType.Settings) - { - ps.WriteLine(" "); - - } - } - ps.WriteLine(" "); - - ps.WriteLine(" "); - ps.WriteLine(" ", toolInfo.XmlTag); - ps.WriteLine(""); - } - - ps = new StreamWriter(projectFile + ".user"); - using(ps) - { - ps.WriteLine(""); - ps.WriteLine(" <{0}>", toolInfo.XmlTag); - ps.WriteLine(" "); - - ps.WriteLine(" ", MakeRefPath(project)); - foreach(ConfigurationNode conf in project.Configurations) - { - ps.WriteLine(" "); - } - ps.WriteLine(" "); - - ps.WriteLine(" "); - ps.WriteLine(" ", toolInfo.XmlTag); - ps.WriteLine(""); - } - - m_Kernel.CurrentWorkingDirectory.Pop(); - } - - /// - /// Gets the XML doc file. - /// - /// The project. - /// The conf. - /// - public static string GetXmlDocFile(ProjectNode project, ConfigurationNode conf) - { - if( conf == null ) - { - throw new ArgumentNullException("conf"); - } - if( project == null ) - { - throw new ArgumentNullException("project"); - } - // if(!(bool)conf.Options["GenerateXmlDocFile"]) //default to none, if the generate option is false - // { - // return string.Empty; - // } - - //default to "AssemblyName.xml" - //string defaultValue = Path.GetFileNameWithoutExtension(project.AssemblyName) + ".xml"; - //return (string)conf.Options["XmlDocFile", defaultValue]; - - //default to no XmlDocFile file - return (string)conf.Options["XmlDocFile", ""]; - } - - private void WriteSolution(SolutionNode solution) - { - m_Kernel.Log.Write("Creating Visual Studio {0} solution and project files", VersionName); - - foreach(ProjectNode project in solution.Projects) - { - if(m_Kernel.AllowProject(project.FilterGroups)) - { - m_Kernel.Log.Write("...Creating project: {0}", project.Name); - WriteProject(solution, project); - } - } - - m_Kernel.Log.Write(""); - string solutionFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "sln"); - StreamWriter ss = new StreamWriter(solutionFile); - - m_Kernel.CurrentWorkingDirectory.Push(); - Helper.SetCurrentDir(Path.GetDirectoryName(solutionFile)); - - using(ss) - { - ss.WriteLine("Microsoft Visual Studio Solution File, Format Version {0}", SolutionVersion); - foreach(ProjectNode project in solution.Projects) - { - if(!m_Tools.ContainsKey(project.Language)) - { - throw new UnknownLanguageException("Unknown .NET language: " + project.Language); - } - - ToolInfo toolInfo = m_Tools[project.Language]; - - string path = Helper.MakePathRelativeTo(solution.FullPath, project.FullPath); - ss.WriteLine("Project(\"{0}\") = \"{1}\", \"{2}\", \"{{{3}}}\"", - toolInfo.Guid, project.Name, Helper.MakeFilePath(path, project.Name, - toolInfo.FileExtension), project.Guid.ToString().ToUpper()); - - ss.WriteLine("\tProjectSection(ProjectDependencies) = postProject"); - ss.WriteLine("\tEndProjectSection"); - - ss.WriteLine("EndProject"); - } - - ss.WriteLine("Global"); - - ss.WriteLine("\tGlobalSection(SolutionConfiguration) = preSolution"); - foreach(ConfigurationNode conf in solution.Configurations) - { - ss.WriteLine("\t\t{0} = {0}", conf.Name); - } - ss.WriteLine("\tEndGlobalSection"); - - ss.WriteLine("\tGlobalSection(ProjectDependencies) = postSolution"); - foreach(ProjectNode project in solution.Projects) - { - for(int i = 0; i < project.References.Count; i++) - { - ReferenceNode refr = project.References[i]; - if(solution.ProjectsTable.ContainsKey(refr.Name)) - { - ProjectNode refProject = solution.ProjectsTable[refr.Name]; - ss.WriteLine("\t\t({{{0}}}).{1} = ({{{2}}})", - project.Guid.ToString().ToUpper() - , i, - refProject.Guid.ToString().ToUpper() - ); - } - } - } - ss.WriteLine("\tEndGlobalSection"); - - ss.WriteLine("\tGlobalSection(ProjectConfiguration) = postSolution"); - foreach(ProjectNode project in solution.Projects) - { - foreach(ConfigurationNode conf in solution.Configurations) - { - ss.WriteLine("\t\t{{{0}}}.{1}.ActiveCfg = {1}|.NET", - project.Guid.ToString().ToUpper(), - conf.Name); - - ss.WriteLine("\t\t{{{0}}}.{1}.Build.0 = {1}|.NET", - project.Guid.ToString().ToUpper(), - conf.Name); - } - } - ss.WriteLine("\tEndGlobalSection"); - - if(solution.Files != null) - { - ss.WriteLine("\tGlobalSection(SolutionItems) = postSolution"); - foreach(string file in solution.Files) - { - ss.WriteLine("\t\t{0} = {0}", file); - } - ss.WriteLine("\tEndGlobalSection"); - } - - ss.WriteLine("\tGlobalSection(ExtensibilityGlobals) = postSolution"); - ss.WriteLine("\tEndGlobalSection"); - ss.WriteLine("\tGlobalSection(ExtensibilityAddIns) = postSolution"); - ss.WriteLine("\tEndGlobalSection"); - - ss.WriteLine("EndGlobal"); - } - - m_Kernel.CurrentWorkingDirectory.Pop(); - } - - private void CleanProject(ProjectNode project) - { - m_Kernel.Log.Write("...Cleaning project: {0}", project.Name); - - ToolInfo toolInfo = m_Tools[project.Language]; - string projectFile = Helper.MakeFilePath(project.FullPath, project.Name, toolInfo.FileExtension); - string userFile = projectFile + ".user"; - - Helper.DeleteIfExists(projectFile); - Helper.DeleteIfExists(userFile); - } - - private void CleanSolution(SolutionNode solution) - { - m_Kernel.Log.Write("Cleaning Visual Studio {0} solution and project files", VersionName, solution.Name); - - string slnFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "sln"); - string suoFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "suo"); - - Helper.DeleteIfExists(slnFile); - Helper.DeleteIfExists(suoFile); - - foreach(ProjectNode project in solution.Projects) - { - CleanProject(project); - } - - m_Kernel.Log.Write(""); - } - - #endregion - - #region ITarget Members - - /// - /// Writes the specified kern. - /// - /// The kern. - public virtual void Write(Kernel kern) - { - if( kern == null ) - { - throw new ArgumentNullException("kern"); - } - m_Kernel = kern; - foreach(SolutionNode sol in m_Kernel.Solutions) - { - WriteSolution(sol); - } - m_Kernel = null; - } - - /// - /// Cleans the specified kern. - /// - /// The kern. - public virtual void Clean(Kernel kern) - { - if( kern == null ) - { - throw new ArgumentNullException("kern"); - } - m_Kernel = kern; - foreach(SolutionNode sol in m_Kernel.Solutions) - { - CleanSolution(sol); - } - m_Kernel = null; - } - - /// - /// Gets the name. - /// - /// The name. - public virtual string Name - { - get - { - return "vs2003"; - } - } - - #endregion - } -} diff --git a/Prebuild/src/Core/Targets/.svn/text-base/VS2005Target.cs.svn-base b/Prebuild/src/Core/Targets/.svn/text-base/VS2005Target.cs.svn-base deleted file mode 100644 index 9c70e26..0000000 --- a/Prebuild/src/Core/Targets/.svn/text-base/VS2005Target.cs.svn-base +++ /dev/null @@ -1,147 +0,0 @@ -#region BSD License -/* -Copyright (c) 2004 Matthew Holmes (matthew@wildfiregames.com) - -Redistribution and use in source and binary forms, with or without modification, are permitted -provided that the following conditions are met: - -* Redistributions of source code must retain the above copyright notice, this list of conditions - and the following disclaimer. -* Redistributions in binary form must reproduce the above copyright notice, this list of conditions - and the following disclaimer in the documentation and/or other materials provided with the - distribution. -* The name of the author may not be used to endorse or promote products derived from this software - without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, -BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY -OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING -IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ -#endregion - -using System; -using System.IO; -using System.Text; - -using Prebuild.Core.Attributes; -using Prebuild.Core.Interfaces; -using Prebuild.Core.Nodes; -using Prebuild.Core.Utilities; - -namespace Prebuild.Core.Targets -{ - /// - /// - /// - [Target("vs2005")] - public class VS2005Target : VSGenericTarget - { - #region Inner Classes - - #endregion - - #region Fields - - string solutionVersion = "9.00"; - string productVersion = "8.0.50727"; - string schemaVersion = "2.0"; - string versionName = "Visual C# 2005"; - string name = "vs2005"; - - VSVersion version = VSVersion.VS80; - - public override string SolutionTag - { - get { return "# Visual Studio 2005"; } - } - - protected override string GetToolsVersionXml(FrameworkVersion frameworkVersion) - { - return string.Empty; - } - /// - /// Gets or sets the solution version. - /// - /// The solution version. - public override string SolutionVersion - { - get - { - return solutionVersion; - } - } - /// - /// Gets or sets the product version. - /// - /// The product version. - public override string ProductVersion - { - get - { - return productVersion; - } - } - /// - /// Gets or sets the schema version. - /// - /// The schema version. - public override string SchemaVersion - { - get - { - return schemaVersion; - } - } - /// - /// Gets or sets the name of the version. - /// - /// The name of the version. - public override string VersionName - { - get - { - return versionName; - } - } - /// - /// Gets or sets the version. - /// - /// The version. - public override VSVersion Version - { - get - { - return version; - } - } - /// - /// Gets the name. - /// - /// The name. - public override string Name - { - get - { - return name; - } - } - - #endregion - - #region Constructors - - /// - /// Initializes a new instance of the class. - /// - public VS2005Target() - : base() - { - } - - #endregion - } -} diff --git a/Prebuild/src/Core/Targets/.svn/text-base/VS2008Target.cs.svn-base b/Prebuild/src/Core/Targets/.svn/text-base/VS2008Target.cs.svn-base deleted file mode 100644 index fee4f7f..0000000 --- a/Prebuild/src/Core/Targets/.svn/text-base/VS2008Target.cs.svn-base +++ /dev/null @@ -1,127 +0,0 @@ -using System; -using System.IO; -using System.Text; - -using Prebuild.Core.Attributes; -using Prebuild.Core.Interfaces; -using Prebuild.Core.Nodes; -using Prebuild.Core.Utilities; -using System.CodeDom.Compiler; - -namespace Prebuild.Core.Targets -{ - - /// - /// - /// - [Target("vs2008")] - public class VS2008Target : VSGenericTarget - { - #region Fields - string solutionVersion = "10.00"; - string productVersion = "9.0.21022"; - string schemaVersion = "2.0"; - string versionName = "Visual Studio 2008"; - string name = "vs2008"; - VSVersion version = VSVersion.VS90; - - /// - /// Gets or sets the solution version. - /// - /// The solution version. - public override string SolutionVersion - { - get - { - return solutionVersion; - } - } - /// - /// Gets or sets the product version. - /// - /// The product version. - public override string ProductVersion - { - get - { - return productVersion; - } - } - /// - /// Gets or sets the schema version. - /// - /// The schema version. - public override string SchemaVersion - { - get - { - return schemaVersion; - } - } - /// - /// Gets or sets the name of the version. - /// - /// The name of the version. - public override string VersionName - { - get - { - return versionName; - } - } - /// - /// Gets or sets the version. - /// - /// The version. - public override VSVersion Version - { - get - { - return version; - } - } - /// - /// Gets the name. - /// - /// The name. - public override string Name - { - get - { - return name; - } - } - - protected override string GetToolsVersionXml(FrameworkVersion frameworkVersion) - { - switch (frameworkVersion) - { - case FrameworkVersion.v3_5: - return "ToolsVersion=\"3.5\""; - case FrameworkVersion.v3_0: - return "ToolsVersion=\"3.0\""; - default: - return "ToolsVersion=\"2.0\""; - } - } - - public override string SolutionTag - { - get { return "# Visual Studio 2008"; } - } - - #endregion - - #region Constructors - - /// - /// Initializes a new instance of the class. - /// - public VS2008Target() - : base() - { - } - - #endregion - } -} diff --git a/Prebuild/src/Core/Targets/.svn/text-base/VS2010Target.cs.svn-base b/Prebuild/src/Core/Targets/.svn/text-base/VS2010Target.cs.svn-base deleted file mode 100644 index b16120c..0000000 --- a/Prebuild/src/Core/Targets/.svn/text-base/VS2010Target.cs.svn-base +++ /dev/null @@ -1,138 +0,0 @@ -using System; -using System.IO; -using System.Text; - -using Prebuild.Core.Attributes; -using Prebuild.Core.Interfaces; -using Prebuild.Core.Nodes; -using Prebuild.Core.Utilities; -using System.CodeDom.Compiler; - -namespace Prebuild.Core.Targets -{ - - /// - /// - /// - [Target("vs2010")] - public class VS2010Target : VSGenericTarget - { - #region Fields - - string solutionVersion = "11.00"; - string productVersion = "9.0.30729"; - string schemaVersion = "2.0"; - string versionName = "Visual Studio 2010"; - string name = "vs2010"; - VSVersion version = VSVersion.VS10; - - #endregion - - #region Properties - - /// - /// Gets or sets the solution version. - /// - /// The solution version. - public override string SolutionVersion - { - get - { - return solutionVersion; - } - } - - /// - /// Gets or sets the product version. - /// - /// The product version. - public override string ProductVersion - { - get - { - return productVersion; - } - } - - /// - /// Gets or sets the schema version. - /// - /// The schema version. - public override string SchemaVersion - { - get - { - return schemaVersion; - } - } - - /// - /// Gets or sets the name of the version. - /// - /// The name of the version. - public override string VersionName - { - get - { - return versionName; - } - } - - /// - /// Gets or sets the version. - /// - /// The version. - public override VSVersion Version - { - get - { - return version; - } - } - - /// - /// Gets the name. - /// - /// The name. - public override string Name - { - get - { - return name; - } - } - - protected override string GetToolsVersionXml(FrameworkVersion frameworkVersion) - { - switch (frameworkVersion) - { - case FrameworkVersion.v4_0: - case FrameworkVersion.v3_5: - return "ToolsVersion=\"4.0\""; - case FrameworkVersion.v3_0: - return "ToolsVersion=\"3.0\""; - default: - return "ToolsVersion=\"2.0\""; - } - } - - public override string SolutionTag - { - get { return "# Visual Studio 2010"; } - } - - #endregion - - #region Constructors - - /// - /// Initializes a new instance of the class. - /// - public VS2010Target() - : base() - { - } - - #endregion - } -} diff --git a/Prebuild/src/Core/Targets/.svn/text-base/VSGenericTarget.cs.svn-base b/Prebuild/src/Core/Targets/.svn/text-base/VSGenericTarget.cs.svn-base deleted file mode 100644 index cd3f5bb..0000000 --- a/Prebuild/src/Core/Targets/.svn/text-base/VSGenericTarget.cs.svn-base +++ /dev/null @@ -1,922 +0,0 @@ -#region BSD License -/* -Copyright (c) 2008 Matthew Holmes (matthew@wildfiregames.com), John Anderson (sontek@gmail.com) - -Redistribution and use in source and binary forms, with or without modification, are permitted -provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, this list of conditions - and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, this list of conditions - and the following disclaimer in the documentation and/or other materials provided with the - distribution. - * The name of the author may not be used to endorse or promote products derived from this software - without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, -BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY -OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING -IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -#endregion - -using System; -using System.Collections.Generic; -using System.IO; -using Prebuild.Core.Interfaces; -using Prebuild.Core.Nodes; -using Prebuild.Core.Utilities; -using System.CodeDom.Compiler; - -namespace Prebuild.Core.Targets -{ - - /// - /// - /// - public abstract class VSGenericTarget : ITarget - { - #region Fields - - readonly Dictionary tools = new Dictionary(); - Kernel kernel; - #endregion - - #region Properties - /// - /// Gets or sets the solution version. - /// - /// The solution version. - public abstract string SolutionVersion { get; } - /// - /// Gets or sets the product version. - /// - /// The product version. - public abstract string ProductVersion { get; } - /// - /// Gets or sets the schema version. - /// - /// The schema version. - public abstract string SchemaVersion { get; } - /// - /// Gets or sets the name of the version. - /// - /// The name of the version. - public abstract string VersionName { get; } - /// - /// Gets or sets the version. - /// - /// The version. - public abstract VSVersion Version { get; } - /// - /// Gets the name. - /// - /// The name. - public abstract string Name { get; } - - protected abstract string GetToolsVersionXml(FrameworkVersion version); - public abstract string SolutionTag { get; } - - #endregion - - #region Constructors - - /// - /// Initializes a new instance of the class. - /// - protected VSGenericTarget() - { - tools["C#"] = new ToolInfo("C#", "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}", "csproj", "CSHARP", "$(MSBuildBinPath)\\Microsoft.CSHARP.Targets"); - tools["Database"] = new ToolInfo("Database", "{4F174C21-8C12-11D0-8340-0000F80270F8}", "dbp", "UNKNOWN"); - tools["Boo"] = new ToolInfo("Boo", "{45CEA7DC-C2ED-48A6-ACE0-E16144C02365}", "booproj", "Boo", "$(BooBinPath)\\Boo.Microsoft.Build.targets"); - tools["VisualBasic"] = new ToolInfo("VisualBasic", "{F184B08F-C81C-45F6-A57F-5ABD9991F28F}", "vbproj", "VisualBasic", "$(MSBuildBinPath)\\Microsoft.VisualBasic.Targets"); - tools["Folder"] = new ToolInfo("Folder", "{2150E333-8FDC-42A3-9474-1A3956D46DE8}", null, null); - } - - #endregion - - #region Private Methods - - private string MakeRefPath(ProjectNode project) - { - string ret = ""; - foreach (ReferencePathNode node in project.ReferencePaths) - { - try - { - string fullPath = Helper.ResolvePath(node.Path); - if (ret.Length < 1) - { - ret = fullPath; - } - else - { - ret += ";" + fullPath; - } - } - catch (ArgumentException) - { - kernel.Log.Write(LogType.Warning, "Could not resolve reference path: {0}", node.Path); - } - } - - return ret; - } - - private static ProjectNode FindProjectInSolution(string name, SolutionNode solution) - { - SolutionNode node = solution; - - while (node.Parent is SolutionNode) - node = node.Parent as SolutionNode; - - return FindProjectInSolutionRecursively(name, node); - } - - private static ProjectNode FindProjectInSolutionRecursively(string name, SolutionNode solution) - { - if (solution.ProjectsTable.ContainsKey(name)) - return solution.ProjectsTable[name]; - - foreach (SolutionNode child in solution.Solutions) - { - ProjectNode node = FindProjectInSolutionRecursively(name, child); - if (node != null) - return node; - } - - return null; - } - - private void WriteProject(SolutionNode solution, ProjectNode project) - { - if (!tools.ContainsKey(project.Language)) - { - throw new UnknownLanguageException("Unknown .NET language: " + project.Language); - } - - ToolInfo toolInfo = tools[project.Language]; - string projectFile = Helper.MakeFilePath(project.FullPath, project.Name, toolInfo.FileExtension); - StreamWriter ps = new StreamWriter(projectFile); - - kernel.CurrentWorkingDirectory.Push(); - Helper.SetCurrentDir(Path.GetDirectoryName(projectFile)); - - #region Project File - using (ps) - { - ps.WriteLine("", GetToolsVersionXml(project.FrameworkVersion)); - ps.WriteLine(" "); - ps.WriteLine(" Local"); - ps.WriteLine(" {0}", ProductVersion); - ps.WriteLine(" {0}", SchemaVersion); - ps.WriteLine(" {{{0}}}", project.Guid.ToString().ToUpper()); - - // Visual Studio has a hard coded guid for the project type - if (project.Type == ProjectType.Web) - ps.WriteLine(" {349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}"); - ps.WriteLine(" Debug"); - ps.WriteLine(" {0}", project.AppIcon); - ps.WriteLine(" "); - ps.WriteLine(" "); - ps.WriteLine(" {0}", project.AssemblyName); - foreach (ConfigurationNode conf in project.Configurations) - { - if (conf.Options.KeyFile != "") - { - ps.WriteLine(" {0}", conf.Options.KeyFile); - ps.WriteLine(" true"); - break; - } - } - ps.WriteLine(" JScript"); - ps.WriteLine(" Grid"); - ps.WriteLine(" IE50"); - ps.WriteLine(" false"); - ps.WriteLine(" {0}", project.FrameworkVersion.ToString().Replace("_", ".")); - - ps.WriteLine(" {0}", project.Type == ProjectType.Web ? ProjectType.Library.ToString() : project.Type.ToString()); - ps.WriteLine(" {0}", project.DesignerFolder); - ps.WriteLine(" {0}", project.RootNamespace); - ps.WriteLine(" {0}", project.StartupObject); - if (string.IsNullOrEmpty(project.DebugStartParameters)) - { - ps.WriteLine(" {0}", project.DebugStartParameters); - } - ps.WriteLine(" "); - ps.WriteLine(" "); - - ps.WriteLine(" "); - - foreach (ConfigurationNode conf in project.Configurations) - { - ps.Write(" ", conf.Name, conf.Platform); - ps.WriteLine(" {0}", conf.Options["AllowUnsafe"]); - ps.WriteLine(" {0}", conf.Options["BaseAddress"]); - ps.WriteLine(" {0}", conf.Options["CheckUnderflowOverflow"]); - ps.WriteLine(" "); - ps.WriteLine(" "); - ps.WriteLine(" {0}", conf.Options["CompilerDefines"]); - ps.WriteLine(" {0}", Helper.NormalizePath(conf.Options["XmlDocFile"].ToString())); - ps.WriteLine(" {0}", conf.Options["DebugInformation"]); - ps.WriteLine(" {0}", conf.Options["FileAlignment"]); - ps.WriteLine(" {0}", conf.Options["OptimizeCode"]); - if (project.Type != ProjectType.Web) - ps.WriteLine(" {0}", - Helper.EndPath(Helper.NormalizePath(conf.Options["OutputPath"].ToString()))); - else - ps.WriteLine(" {0}", - Helper.EndPath(Helper.NormalizePath("bin\\"))); - - ps.WriteLine(" {0}", conf.Options["RegisterComInterop"]); - ps.WriteLine(" {0}", conf.Options["RemoveIntegerChecks"]); - ps.WriteLine(" {0}", conf.Options["WarningsAsErrors"]); - ps.WriteLine(" {0}", conf.Options["WarningLevel"]); - ps.WriteLine(" {0}", conf.Options["NoStdLib"]); - ps.WriteLine(" {0}", conf.Options["SuppressWarnings"]); - ps.WriteLine(" {0}", conf.Platform); - ps.WriteLine(" "); - } - - //ps.WriteLine(" "); - - Dictionary projectReferences = new Dictionary(); - List otherReferences = new List(); - - foreach (ReferenceNode refr in project.References) - { - ProjectNode projectNode = FindProjectInSolution(refr.Name, solution); - - if (projectNode == null) - otherReferences.Add(refr); - else - projectReferences.Add(refr, projectNode); - } - // Assembly References - ps.WriteLine(" "); - - foreach (ReferenceNode refr in otherReferences) - { - ps.Write(" "); - ps.Write(" "); - ps.Write(refr.Name); - ps.WriteLine(""); - - if(!String.IsNullOrEmpty(refr.Path)) - { - // Use absolute path to assembly (for determining assembly type) - string absolutePath = Path.Combine(project.FullPath, refr.Path); - if(File.Exists(Helper.MakeFilePath(absolutePath, refr.Name, "exe"))) { - // Assembly is an executable (exe) - ps.WriteLine(" {0}", Helper.MakeFilePath(refr.Path, refr.Name, "exe")); - } else if(File.Exists(Helper.MakeFilePath(absolutePath, refr.Name, "dll"))) { - // Assembly is an library (dll) - ps.WriteLine(" {0}", Helper.MakeFilePath(refr.Path, refr.Name, "dll")); - } else { - string referencePath = Helper.MakeFilePath(refr.Path, refr.Name, "dll"); - kernel.Log.Write(LogType.Warning, "Reference \"{0}\": The specified file doesn't exist.", referencePath); - ps.WriteLine(" {0}", Helper.MakeFilePath(refr.Path, refr.Name, "dll")); - } - } - - ps.WriteLine(" {0}", refr.LocalCopy); - ps.WriteLine(" "); - } - ps.WriteLine(" "); - - //Project References - ps.WriteLine(" "); - foreach (KeyValuePair pair in projectReferences) - { - ToolInfo tool = tools[pair.Value.Language]; - if (tools == null) - throw new UnknownLanguageException(); - - string path = - Helper.MakePathRelativeTo(project.FullPath, - Helper.MakeFilePath(pair.Value.FullPath, pair.Value.Name, tool.FileExtension)); - ps.WriteLine(" ", path); - - // TODO: Allow reference to visual basic projects - ps.WriteLine(" {0}", pair.Value.Name); - ps.WriteLine(" {0}", pair.Value.Guid.ToString("B").ToUpper()); - ps.WriteLine(" {0}", tool.Guid.ToUpper()); - - //This is the Copy Local flag in VS - ps.WriteLine(" {0}", pair.Key.LocalCopy); - - ps.WriteLine(" "); - } - ps.WriteLine(" "); - - // ps.WriteLine(" "); - ps.WriteLine(" "); - - // ps.WriteLine(" "); - List list = new List(); - - foreach (string path in project.Files) - { - string lower = path.ToLower(); - if (lower.EndsWith(".resx")) - { - string codebehind = String.Format("{0}.Designer{1}", path.Substring(0, path.LastIndexOf('.')), toolInfo.LanguageExtension); - if (!list.Contains(codebehind)) - list.Add(codebehind); - } - - } - - foreach (string filePath in project.Files) - { - // if (file == "Properties\\Bind.Designer.cs") - // { - // Console.WriteLine("Wait a minute!"); - // Console.WriteLine(project.Files.GetSubType(file).ToString()); - // } - SubType subType = project.Files.GetSubType(filePath); - - // Visual Studio chokes on file names if forward slash is used as a path separator - // instead of backslash. So we must make sure that all file paths written to the - // project file use \ as a path separator. - string file = filePath.Replace(@"/", @"\"); - - if (subType != SubType.Code && subType != SubType.Settings && subType != SubType.Designer - && subType != SubType.CodeBehind) - { - ps.WriteLine(" ", file.Substring(0, file.LastIndexOf('.')) + ".resx"); - ps.WriteLine(" {0}", Path.GetFileName(file)); - ps.WriteLine(" Designer"); - ps.WriteLine(" "); - // - } - - if (subType == SubType.Designer) - { - ps.WriteLine(" ", file); - - string autogen_name = file.Substring(0, file.LastIndexOf('.')) + ".Designer.cs"; - string dependent_name = filePath.Substring(0, file.LastIndexOf('.')) + ".cs"; - - // Check for a parent .cs file with the same name as this designer file - if (File.Exists(Helper.NormalizePath(dependent_name))) - { - ps.WriteLine(" {0}", Path.GetFileName(dependent_name)); - } - else - { - ps.WriteLine(" ResXFileCodeGenerator"); - ps.WriteLine(" {0}", Path.GetFileName(autogen_name)); - ps.WriteLine(" " + subType + ""); - } - - ps.WriteLine(" "); - if (File.Exists(Helper.NormalizePath(autogen_name))) - { - ps.WriteLine(" ", autogen_name); - //ps.WriteLine(" True"); - - // If a parent .cs file exists, link this autogen file to it. Otherwise link - // to the designer file - if (File.Exists(dependent_name)) - { - ps.WriteLine(" {0}", Path.GetFileName(dependent_name)); - } - else - { - ps.WriteLine(" True"); - ps.WriteLine(" {0}", Path.GetFileName(filePath)); - } - - ps.WriteLine(" "); - } - list.Add(autogen_name); - } - if (subType == SubType.Settings) - { - ps.Write(" <{0} ", project.Files.GetBuildAction(filePath)); - ps.WriteLine("Include=\"{0}\">", file); - string fileName = Path.GetFileName(filePath); - if (project.Files.GetBuildAction(filePath) == BuildAction.None) - { - ps.WriteLine(" SettingsSingleFileGenerator"); - ps.WriteLine(" {0}", fileName.Substring(0, fileName.LastIndexOf('.')) + ".Designer.cs"); - } - else - { - ps.WriteLine(" Code"); - ps.WriteLine(" True"); - ps.WriteLine(" True"); - string fileNameShort = fileName.Substring(0, fileName.LastIndexOf('.')); - string fileNameShorter = fileNameShort.Substring(0, fileNameShort.LastIndexOf('.')); - ps.WriteLine(" {0}", Path.GetFileName(fileNameShorter + ".settings")); - } - ps.WriteLine(" ", project.Files.GetBuildAction(filePath)); - } - else if (subType != SubType.Designer) - { - string path = Helper.NormalizePath(file); - string path_lower = path.ToLower(); - - if (!list.Contains(filePath)) - { - ps.Write(" <{0} ", project.Files.GetBuildAction(filePath)); - - int startPos = 0; - if (project.Files.GetPreservePath(filePath)) - { - while ((@"./\").IndexOf(file.Substring(startPos, 1)) != -1) - startPos++; - - } - else - { - startPos = file.LastIndexOf(Path.GetFileName(path)); - } - - // be sure to write out the path with backslashes so VS recognizes - // the file properly. - ps.WriteLine("Include=\"{0}\">", file); - - int last_period_index = file.LastIndexOf('.'); - string short_file_name = file.Substring(0, last_period_index); - string extension = Path.GetExtension(path); - // make this upper case, so that when File.Exists tests for the - // existence of a designer file on a case-sensitive platform, - // it is correctly identified. - string designer_format = string.Format(".Designer{0}", extension); - - if (path_lower.EndsWith(designer_format.ToLowerInvariant())) - { - int designer_index = path.IndexOf(designer_format); - string file_name = path.Substring(0, designer_index); - - // There are two corrections to the next lines: - // 1. Fix the connection between a designer file and a form - // or usercontrol that don't have an associated resx file. - // 2. Connect settings files to associated designer files. - if (File.Exists(file_name + extension)) - ps.WriteLine(" {0}", Path.GetFileName(file_name + extension)); - else if (File.Exists(file_name + ".resx")) - ps.WriteLine(" {0}", Path.GetFileName(file_name + ".resx")); - else if (File.Exists(file_name + ".settings")) - { - ps.WriteLine(" {0}", Path.GetFileName(file_name + ".settings")); - ps.WriteLine(" True"); - ps.WriteLine(" True"); - } - } - else if (subType == SubType.CodeBehind) - { - ps.WriteLine(" {0}", Path.GetFileName(short_file_name)); - } - if (project.Files.GetIsLink(filePath)) - { - string alias = project.Files.GetLinkPath(filePath); - alias += file.Substring(startPos); - alias = Helper.NormalizePath(alias); - ps.WriteLine(" {0}", alias); - } - else if (project.Files.GetBuildAction(filePath) != BuildAction.None) - { - if (project.Files.GetBuildAction(filePath) != BuildAction.EmbeddedResource) - { - ps.WriteLine(" {0}", subType); - } - } - - if (project.Files.GetCopyToOutput(filePath) != CopyToOutput.Never) - { - ps.WriteLine(" {0}", project.Files.GetCopyToOutput(filePath)); - } - - ps.WriteLine(" ", project.Files.GetBuildAction(filePath)); - } - } - } - - ps.WriteLine(" "); - ps.WriteLine(" "); - ps.WriteLine(" "); - ps.WriteLine(" "); - ps.WriteLine(" "); - ps.WriteLine(" "); - ps.WriteLine(" "); - ps.WriteLine(" "); - ps.WriteLine(""); - } - #endregion - - #region User File - - ps = new StreamWriter(projectFile + ".user"); - using (ps) - { - // Get the first configuration from the project. - ConfigurationNode firstConfiguration = null; - - if (project.Configurations.Count > 0) - { - firstConfiguration = project.Configurations[0]; - } - - ps.WriteLine(""); - //ps.WriteLine( "" ); - //ps.WriteLine(" <{0}>", toolInfo.XMLTag); - //ps.WriteLine(" "); - ps.WriteLine(" "); - //ps.WriteLine(" ", MakeRefPath(project)); - - if (firstConfiguration != null) - { - ps.WriteLine(" {0}", firstConfiguration.Name); - ps.WriteLine(" {0}", firstConfiguration.Platform); - } - - ps.WriteLine(" {0}", MakeRefPath(project)); - ps.WriteLine(" {0}", ProductVersion); - ps.WriteLine(" ProjectFiles"); - ps.WriteLine(" 0"); - ps.WriteLine(" "); - foreach (ConfigurationNode conf in project.Configurations) - { - ps.Write(" "); - } - ps.WriteLine(""); - } - #endregion - - kernel.CurrentWorkingDirectory.Pop(); - } - - private void WriteSolution(SolutionNode solution, bool writeSolutionToDisk) - { - kernel.Log.Write("Creating {0} solution and project files", VersionName); - - foreach (SolutionNode child in solution.Solutions) - { - kernel.Log.Write("...Creating folder: {0}", child.Name); - WriteSolution(child, false); - } - - foreach (ProjectNode project in solution.Projects) - { - kernel.Log.Write("...Creating project: {0}", project.Name); - WriteProject(solution, project); - } - - foreach (DatabaseProjectNode project in solution.DatabaseProjects) - { - kernel.Log.Write("...Creating database project: {0}", project.Name); - WriteDatabaseProject(solution, project); - } - - if (writeSolutionToDisk) // only write main solution - { - kernel.Log.Write(""); - string solutionFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "sln"); - - using (StreamWriter ss = new StreamWriter(solutionFile)) - { - kernel.CurrentWorkingDirectory.Push(); - Helper.SetCurrentDir(Path.GetDirectoryName(solutionFile)); - - ss.WriteLine("Microsoft Visual Studio Solution File, Format Version {0}", SolutionVersion); - ss.WriteLine(SolutionTag); - - WriteProjectDeclarations(ss, solution, solution); - - ss.WriteLine("Global"); - - ss.WriteLine("\tGlobalSection(SolutionConfigurationPlatforms) = preSolution"); - foreach (ConfigurationNode conf in solution.Configurations) - { - ss.WriteLine("\t\t{0} = {0}", conf.NameAndPlatform); - } - ss.WriteLine("\tEndGlobalSection"); - - ss.WriteLine("\tGlobalSection(ProjectConfigurationPlatforms) = postSolution"); - WriteConfigurationLines(solution.Configurations, solution, ss); - ss.WriteLine("\tEndGlobalSection"); - - if (solution.Solutions.Count > 0) - { - ss.WriteLine("\tGlobalSection(NestedProjects) = preSolution"); - foreach (SolutionNode embeddedSolution in solution.Solutions) - { - WriteNestedProjectMap(ss, embeddedSolution); - } - ss.WriteLine("\tEndGlobalSection"); - } - - ss.WriteLine("EndGlobal"); - } - - kernel.CurrentWorkingDirectory.Pop(); - } - } - - private void WriteProjectDeclarations(TextWriter writer, SolutionNode actualSolution, SolutionNode embeddedSolution) - { - foreach (SolutionNode childSolution in embeddedSolution.Solutions) - { - WriteEmbeddedSolution(writer, childSolution); - WriteProjectDeclarations(writer, actualSolution, childSolution); - } - - foreach (ProjectNode project in embeddedSolution.Projects) - { - WriteProject(actualSolution, writer, project); - } - - foreach (DatabaseProjectNode dbProject in embeddedSolution.DatabaseProjects) - { - WriteProject(actualSolution, writer, dbProject); - } - - if (actualSolution.Guid == embeddedSolution.Guid) - { - WriteSolutionFiles(actualSolution, writer); - } - } - - private static void WriteNestedProjectMap(TextWriter writer, SolutionNode embeddedSolution) - { - foreach (ProjectNode project in embeddedSolution.Projects) - { - WriteNestedProject(writer, embeddedSolution, project.Guid); - } - - foreach (DatabaseProjectNode dbProject in embeddedSolution.DatabaseProjects) - { - WriteNestedProject(writer, embeddedSolution, dbProject.Guid); - } - - foreach (SolutionNode child in embeddedSolution.Solutions) - { - WriteNestedProject(writer, embeddedSolution, child.Guid); - WriteNestedProjectMap(writer, child); - } - } - - private static void WriteNestedProject(TextWriter writer, SolutionNode solution, Guid projectGuid) - { - WriteNestedFolder(writer, solution.Guid, projectGuid); - } - - private static void WriteNestedFolder(TextWriter writer, Guid parentGuid, Guid childGuid) - { - writer.WriteLine("\t\t{0} = {1}", - childGuid.ToString("B").ToUpper(), - parentGuid.ToString("B").ToUpper()); - } - - private static void WriteConfigurationLines(IEnumerable configurations, SolutionNode solution, TextWriter ss) - { - foreach (ProjectNode project in solution.Projects) - { - foreach (ConfigurationNode conf in configurations) - { - ss.WriteLine("\t\t{0}.{1}.ActiveCfg = {1}", - project.Guid.ToString("B").ToUpper(), - conf.NameAndPlatform); - - ss.WriteLine("\t\t{0}.{1}.Build.0 = {1}", - project.Guid.ToString("B").ToUpper(), - conf.NameAndPlatform); - } - } - - foreach (SolutionNode child in solution.Solutions) - { - WriteConfigurationLines(configurations, child, ss); - } - } - - private void WriteSolutionFiles(SolutionNode solution, TextWriter ss) - { - if(solution.Files != null && solution.Files.Count > 0) - WriteProject(ss, "Folder", solution.Guid, "Solution Files", "Solution Files", solution.Files); - } - - private void WriteEmbeddedSolution(TextWriter writer, SolutionNode embeddedSolution) - { - WriteProject(writer, "Folder", embeddedSolution.Guid, embeddedSolution.Name, embeddedSolution.Name, embeddedSolution.Files); - } - - private void WriteProject(SolutionNode solution, TextWriter ss, ProjectNode project) - { - WriteProject(ss, solution, project.Language, project.Guid, project.Name, project.FullPath); - } - - private void WriteProject(SolutionNode solution, TextWriter ss, DatabaseProjectNode dbProject) - { - if (solution.Files != null && solution.Files.Count > 0) - WriteProject(ss, solution, "Database", dbProject.Guid, dbProject.Name, dbProject.FullPath); - } - - const string ProjectDeclarationBeginFormat = "Project(\"{0}\") = \"{1}\", \"{2}\", \"{3}\""; - const string ProjectDeclarationEndFormat = "EndProject"; - - private void WriteProject(TextWriter ss, SolutionNode solution, string language, Guid guid, string name, string projectFullPath) - { - if (!tools.ContainsKey(language)) - throw new UnknownLanguageException("Unknown .NET language: " + language); - - ToolInfo toolInfo = tools[language]; - - string path = Helper.MakePathRelativeTo(solution.FullPath, projectFullPath); - - path = Helper.MakeFilePath(path, name, toolInfo.FileExtension); - - WriteProject(ss, language, guid, name, path); - } - - private void WriteProject(TextWriter writer, string language, Guid projectGuid, string name, string location) - { - WriteProject(writer, language, projectGuid, name, location, null); - } - - private void WriteProject(TextWriter writer, string language, Guid projectGuid, string name, string location, FilesNode files) - { - if (!tools.ContainsKey(language)) - throw new UnknownLanguageException("Unknown .NET language: " + language); - - ToolInfo toolInfo = tools[language]; - - writer.WriteLine(ProjectDeclarationBeginFormat, - toolInfo.Guid, - name, - location, - projectGuid.ToString("B").ToUpper()); - - if (files != null) - { - writer.WriteLine("\tProjectSection(SolutionItems) = preProject"); - - foreach (string file in files) - writer.WriteLine("\t\t{0} = {0}", file); - - writer.WriteLine("\tEndProjectSection"); - } - - writer.WriteLine(ProjectDeclarationEndFormat); - } - - private void WriteDatabaseProject(SolutionNode solution, DatabaseProjectNode project) - { - string projectFile = Helper.MakeFilePath(project.FullPath, project.Name, "dbp"); - IndentedTextWriter ps = new IndentedTextWriter(new StreamWriter(projectFile), " "); - - kernel.CurrentWorkingDirectory.Push(); - - Helper.SetCurrentDir(Path.GetDirectoryName(projectFile)); - - using (ps) - { - ps.WriteLine("# Microsoft Developer Studio Project File - Database Project"); - ps.WriteLine("Begin DataProject = \"{0}\"", project.Name); - ps.Indent++; - ps.WriteLine("MSDTVersion = \"80\""); - // TODO: Use the project.Files property - if (ContainsSqlFiles(Path.GetDirectoryName(projectFile))) - WriteDatabaseFoldersAndFiles(ps, Path.GetDirectoryName(projectFile)); - - ps.WriteLine("Begin DBRefFolder = \"Database References\""); - ps.Indent++; - foreach (DatabaseReferenceNode reference in project.References) - { - ps.WriteLine("Begin DBRefNode = \"{0}\"", reference.Name); - ps.Indent++; - ps.WriteLine("ConnectStr = \"{0}\"", reference.ConnectionString); - ps.WriteLine("Provider = \"{0}\"", reference.ProviderId.ToString("B").ToUpper()); - //ps.WriteLine("Colorizer = 5"); - ps.Indent--; - ps.WriteLine("End"); - } - ps.Indent--; - ps.WriteLine("End"); - ps.Indent--; - ps.WriteLine("End"); - - ps.Flush(); - } - - kernel.CurrentWorkingDirectory.Pop(); - } - - private static bool ContainsSqlFiles(string folder) - { - if(Directory.GetFiles(folder, "*.sql").Length > 0) - return true; // if the folder contains 1 .sql file, that's good enough - - foreach (string child in Directory.GetDirectories(folder)) - { - if (ContainsSqlFiles(child)) - return true; // if 1 child folder contains a .sql file, still good enough - } - - return false; - } - - private static void WriteDatabaseFoldersAndFiles(IndentedTextWriter writer, string folder) - { - foreach (string child in Directory.GetDirectories(folder)) - { - if (ContainsSqlFiles(child)) - { - writer.WriteLine("Begin Folder = \"{0}\"", Path.GetFileName(child)); - writer.Indent++; - WriteDatabaseFoldersAndFiles(writer, child); - writer.Indent--; - writer.WriteLine("End"); - } - } - foreach (string file in Directory.GetFiles(folder, "*.sql")) - { - writer.WriteLine("Script = \"{0}\"", Path.GetFileName(file)); - } - } - - private void CleanProject(ProjectNode project) - { - kernel.Log.Write("...Cleaning project: {0}", project.Name); - - ToolInfo toolInfo = tools[project.Language]; - string projectFile = Helper.MakeFilePath(project.FullPath, project.Name, toolInfo.FileExtension); - string userFile = projectFile + ".user"; - - Helper.DeleteIfExists(projectFile); - Helper.DeleteIfExists(userFile); - } - - private void CleanSolution(SolutionNode solution) - { - kernel.Log.Write("Cleaning {0} solution and project files", VersionName, solution.Name); - - string slnFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "sln"); - string suoFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "suo"); - - Helper.DeleteIfExists(slnFile); - Helper.DeleteIfExists(suoFile); - - foreach (ProjectNode project in solution.Projects) - { - CleanProject(project); - } - - kernel.Log.Write(""); - } - - #endregion - - #region ITarget Members - - /// - /// Writes the specified kern. - /// - /// The kern. - public virtual void Write(Kernel kern) - { - if (kern == null) - { - throw new ArgumentNullException("kern"); - } - kernel = kern; - foreach (SolutionNode sol in kernel.Solutions) - { - WriteSolution(sol, true); - } - kernel = null; - } - - /// - /// Cleans the specified kern. - /// - /// The kern. - public virtual void Clean(Kernel kern) - { - if (kern == null) - { - throw new ArgumentNullException("kern"); - } - kernel = kern; - foreach (SolutionNode sol in kernel.Solutions) - { - CleanSolution(sol); - } - kernel = null; - } - - #endregion - } -} diff --git a/Prebuild/src/Core/Targets/.svn/text-base/VSVersion.cs.svn-base b/Prebuild/src/Core/Targets/.svn/text-base/VSVersion.cs.svn-base deleted file mode 100644 index 699b5ca..0000000 --- a/Prebuild/src/Core/Targets/.svn/text-base/VSVersion.cs.svn-base +++ /dev/null @@ -1,54 +0,0 @@ -#region BSD License -/* -Copyright (c) 2008-2009 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com), John Anderson (sontek@gmail.com) - -Redistribution and use in source and binary forms, with or without modification, are permitted -provided that the following conditions are met: - -* Redistributions of source code must retain the above copyright notice, this list of conditions - and the following disclaimer. -* Redistributions in binary form must reproduce the above copyright notice, this list of conditions - and the following disclaimer in the documentation and/or other materials provided with the - distribution. -* The name of the author may not be used to endorse or promote products derived from this software - without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, -BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY -OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING -IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ -#endregion - -namespace Prebuild.Core.Targets -{ - /// - /// - /// - public enum VSVersion - { - /// - /// Visual Studio 2002 - /// - VS70, - /// - /// Visual Studio 2003 - /// - VS71, - /// - /// Visual Studio 2005 - /// - VS80, - /// - /// Visual Studio 2008 - /// - VS90, - /// - /// Visual Studio 2010 - /// - VS10 - } -} diff --git a/Prebuild/src/Core/Targets/.svn/text-base/XcodeTarget.cs.svn-base b/Prebuild/src/Core/Targets/.svn/text-base/XcodeTarget.cs.svn-base deleted file mode 100644 index 5393cec..0000000 --- a/Prebuild/src/Core/Targets/.svn/text-base/XcodeTarget.cs.svn-base +++ /dev/null @@ -1,594 +0,0 @@ -#region BSD License -/* -Copyright (c) 2004 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com) - -Redistribution and use in source and binary forms, with or without modification, are permitted -provided that the following conditions are met: - -* Redistributions of source code must retain the above copyright notice, this list of conditions - and the following disclaimer. -* Redistributions in binary form must reproduce the above copyright notice, this list of conditions - and the following disclaimer in the documentation and/or other materials provided with the - distribution. -* The name of the author may not be used to endorse or promote products derived from this software - without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, -BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY -OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING -IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ -#endregion - -using System; -using System.IO; -using System.Reflection; -using System.Text.RegularExpressions; - -using Prebuild.Core.Attributes; -using Prebuild.Core.Interfaces; -using Prebuild.Core.Nodes; -using Prebuild.Core.Utilities; - -namespace Prebuild.Core.Targets -{ - /// - /// - /// - [Target("xcode")] - public class XcodeTarget : ITarget - { - #region Fields - - private Kernel m_Kernel; - - #endregion - - #region Private Methods - - private static string PrependPath(string path) - { - string tmpPath = Helper.NormalizePath(path, '/'); - Regex regex = new Regex(@"(\w):/(\w+)"); - Match match = regex.Match(tmpPath); - //if(match.Success || tmpPath[0] == '.' || tmpPath[0] == '/') - //{ - tmpPath = Helper.NormalizePath(tmpPath); - //} - // else - // { - // tmpPath = Helper.NormalizePath("./" + tmpPath); - // } - - return tmpPath; - } - - private static string BuildReference(SolutionNode solution, ReferenceNode refr) - { - string ret = ""; - if (solution.ProjectsTable.ContainsKey(refr.Name)) - { - ProjectNode project = (ProjectNode)solution.ProjectsTable[refr.Name]; - string fileRef = FindFileReference(refr.Name, project); - string finalPath = Helper.NormalizePath(Helper.MakeFilePath(project.FullPath + "/${build.dir}/", refr.Name, "dll"), '/'); - ret += finalPath; - return ret; - } - else - { - ProjectNode project = (ProjectNode)refr.Parent; - string fileRef = FindFileReference(refr.Name, project); - - if (refr.Path != null || fileRef != null) - { - string finalPath = (refr.Path != null) ? Helper.NormalizePath(refr.Path + "/" + refr.Name + ".dll", '/') : fileRef; - ret += finalPath; - return ret; - } - - try - { - //Assembly assem = Assembly.Load(refr.Name); - //if (assem != null) - //{ - //ret += (refr.Name + ".dll"); - //} - //else - //{ - ret += (refr.Name + ".dll"); - //} - } - catch (System.NullReferenceException e) - { - e.ToString(); - ret += refr.Name + ".dll"; - } - } - return ret; - } - - private static string BuildReferencePath(SolutionNode solution, ReferenceNode refr) - { - string ret = ""; - if (solution.ProjectsTable.ContainsKey(refr.Name)) - { - ProjectNode project = (ProjectNode)solution.ProjectsTable[refr.Name]; - string fileRef = FindFileReference(refr.Name, project); - string finalPath = Helper.NormalizePath(Helper.MakeReferencePath(project.FullPath + "/${build.dir}/"), '/'); - ret += finalPath; - return ret; - } - else - { - ProjectNode project = (ProjectNode)refr.Parent; - string fileRef = FindFileReference(refr.Name, project); - - if (refr.Path != null || fileRef != null) - { - string finalPath = (refr.Path != null) ? Helper.NormalizePath(refr.Path, '/') : fileRef; - ret += finalPath; - return ret; - } - - try - { - Assembly assem = Assembly.Load(refr.Name); - if (assem != null) - { - ret += ""; - } - else - { - ret += ""; - } - } - catch (System.NullReferenceException e) - { - e.ToString(); - ret += ""; - } - } - return ret; - } - - private static string FindFileReference(string refName, ProjectNode project) - { - foreach (ReferencePathNode refPath in project.ReferencePaths) - { - string fullPath = Helper.MakeFilePath(refPath.Path, refName, "dll"); - - if (File.Exists(fullPath)) - { - return fullPath; - } - } - - return null; - } - - /// - /// Gets the XML doc file. - /// - /// The project. - /// The conf. - /// - public static string GetXmlDocFile(ProjectNode project, ConfigurationNode conf) - { - if (conf == null) - { - throw new ArgumentNullException("conf"); - } - if (project == null) - { - throw new ArgumentNullException("project"); - } - string docFile = (string)conf.Options["XmlDocFile"]; - // if(docFile != null && docFile.Length == 0)//default to assembly name if not specified - // { - // return Path.GetFileNameWithoutExtension(project.AssemblyName) + ".xml"; - // } - return docFile; - } - - private void WriteProject(SolutionNode solution, ProjectNode project) - { - string projFile = Helper.MakeFilePath(project.FullPath, project.Name + (project.Type == ProjectType.Library ? ".dll" : ".exe"), "build"); - StreamWriter ss = new StreamWriter(projFile); - - m_Kernel.CurrentWorkingDirectory.Push(); - Helper.SetCurrentDir(Path.GetDirectoryName(projFile)); - bool hasDoc = false; - - using (ss) - { - ss.WriteLine(""); - ss.WriteLine("", project.Name); - ss.WriteLine(" ", "build"); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - foreach (ReferenceNode refr in project.References) - { - if (refr.LocalCopy) - { - ss.WriteLine(" ", '/')); - } - } - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.Write(" "); - ss.WriteLine(" ", project.RootNamespace); - foreach (string file in project.Files) - { - switch (project.Files.GetBuildAction(file)) - { - case BuildAction.EmbeddedResource: - ss.WriteLine(" {0}", ""); - break; - default: - if (project.Files.GetSubType(file) != SubType.Code && project.Files.GetSubType(file) != SubType.Settings) - { - ss.WriteLine(" ", file.Substring(0, file.LastIndexOf('.')) + ".resx"); - } - break; - } - } - //if (project.Files.GetSubType(file).ToString() != "Code") - //{ - // ps.WriteLine(" ", file.Substring(0, file.LastIndexOf('.')) + ".resx"); - - ss.WriteLine(" "); - ss.WriteLine(" "); - foreach (string file in project.Files) - { - switch (project.Files.GetBuildAction(file)) - { - case BuildAction.Compile: - ss.WriteLine(" "); - break; - default: - break; - } - } - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - foreach (ReferenceNode refr in project.References) - { - ss.WriteLine(" ", '/')); - } - ss.WriteLine(" "); - - ss.WriteLine(" "); - ss.WriteLine(" "); - - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - - ss.WriteLine(" "); - if (hasDoc) - { - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.Write(" "); - } - else - { - ss.WriteLine(".exe\" />"); - } - - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - // foreach(ReferenceNode refr in project.References) - // { - // string path = Helper.NormalizePath(Helper.MakePathRelativeTo(project.FullPath, BuildReferencePath(solution, refr)), '/'); - // if (path != "") - // { - // ss.WriteLine(" ", path); - // } - // } - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - } - ss.WriteLine(" "); - ss.WriteLine(""); - } - m_Kernel.CurrentWorkingDirectory.Pop(); - } - - private void WriteCombine(SolutionNode solution) - { - m_Kernel.Log.Write("Creating Xcode build files"); - foreach (ProjectNode project in solution.Projects) - { - if (m_Kernel.AllowProject(project.FilterGroups)) - { - m_Kernel.Log.Write("...Creating project: {0}", project.Name); - WriteProject(solution, project); - } - } - - m_Kernel.Log.Write(""); - DirectoryInfo directoryInfo = new DirectoryInfo(Path.Combine(solution.FullPath, solution.Name + ".xcodeproj")); - if (!directoryInfo.Exists) - { - directoryInfo.Create(); - } - string combFile = Helper.MakeFilePath(Path.Combine(solution.FullPath, solution.Name + ".xcodeproj"), "project", "pbxproj"); - StreamWriter ss = new StreamWriter(combFile); - - m_Kernel.CurrentWorkingDirectory.Push(); - Helper.SetCurrentDir(Path.GetDirectoryName(combFile)); - - using (ss) - { - ss.WriteLine(""); - ss.WriteLine("", solution.Name); - ss.WriteLine(" "); - ss.WriteLine(); - - //ss.WriteLine(" "); - //ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - - foreach (ConfigurationNode conf in solution.Configurations) - { - // Set the project.config to a non-debug configuration - if (conf.Options["DebugInformation"].ToString().ToLower() != "true") - { - ss.WriteLine(" ", conf.Name); - } - ss.WriteLine(); - ss.WriteLine(" ", conf.Name); - ss.WriteLine(" ", conf.Name); - ss.WriteLine(" ", conf.Options["DebugInformation"].ToString().ToLower()); - ss.WriteLine(" "); - ss.WriteLine(); - } - - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(); - - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(); - - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(); - - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(); - - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(); - - ss.WriteLine(" "); - ss.WriteLine(" "); - //ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - //foreach(ProjectNode project in solution.Projects) - //{ - // string path = Helper.MakePathRelativeTo(solution.FullPath, project.FullPath); - // ss.Write(" "); - //} - ss.WriteLine(" "); - ss.WriteLine(); - - ss.WriteLine(" "); - - foreach (ProjectNode project in solution.ProjectsTableOrder) - { - string path = Helper.MakePathRelativeTo(solution.FullPath, project.FullPath); - ss.Write(" "); - } - ss.WriteLine(" "); - ss.WriteLine(); - - ss.WriteLine(" "); - ss.WriteLine(); - ss.WriteLine(" "); - ss.WriteLine(); - //ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(); - - ss.WriteLine(" "); - ss.WriteLine(" "); - foreach (ProjectNode project in solution.Projects) - { - string path = Helper.MakePathRelativeTo(solution.FullPath, project.FullPath); - ss.Write(" "); - } - ss.WriteLine(" "); - ss.WriteLine(); - ss.WriteLine(""); - } - - m_Kernel.CurrentWorkingDirectory.Pop(); - } - - private void CleanProject(ProjectNode project) - { - m_Kernel.Log.Write("...Cleaning project: {0}", project.Name); - string projectFile = Helper.MakeFilePath(project.FullPath, project.Name + (project.Type == ProjectType.Library ? ".dll" : ".exe"), "build"); - Helper.DeleteIfExists(projectFile); - } - - private void CleanSolution(SolutionNode solution) - { - m_Kernel.Log.Write("Cleaning Xcode build files for", solution.Name); - - string slnFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "build"); - Helper.DeleteIfExists(slnFile); - - foreach (ProjectNode project in solution.Projects) - { - CleanProject(project); - } - - m_Kernel.Log.Write(""); - } - - #endregion - - #region ITarget Members - - /// - /// Writes the specified kern. - /// - /// The kern. - public void Write(Kernel kern) - { - if (kern == null) - { - throw new ArgumentNullException("kern"); - } - m_Kernel = kern; - foreach (SolutionNode solution in kern.Solutions) - { - WriteCombine(solution); - } - m_Kernel = null; - } - - /// - /// Cleans the specified kern. - /// - /// The kern. - public virtual void Clean(Kernel kern) - { - if (kern == null) - { - throw new ArgumentNullException("kern"); - } - m_Kernel = kern; - foreach (SolutionNode sol in kern.Solutions) - { - CleanSolution(sol); - } - m_Kernel = null; - } - - /// - /// Gets the name. - /// - /// The name. - public string Name - { - get - { - return "xcode"; - } - } - - #endregion - } -} diff --git a/Prebuild/src/Core/Utilities/.svn/all-wcprops b/Prebuild/src/Core/Utilities/.svn/all-wcprops deleted file mode 100644 index 7418c29..0000000 --- a/Prebuild/src/Core/Utilities/.svn/all-wcprops +++ /dev/null @@ -1,29 +0,0 @@ -K 25 -svn:wc:ra_dav:version-url -V 60 -/svnroot/dnpb/!svn/ver/309/trunk/Prebuild/src/Core/Utilities -END -Helper.cs -K 25 -svn:wc:ra_dav:version-url -V 70 -/svnroot/dnpb/!svn/ver/307/trunk/Prebuild/src/Core/Utilities/Helper.cs -END -Log.cs -K 25 -svn:wc:ra_dav:version-url -V 67 -/svnroot/dnpb/!svn/ver/309/trunk/Prebuild/src/Core/Utilities/Log.cs -END -CommandLineCollection.cs -K 25 -svn:wc:ra_dav:version-url -V 85 -/svnroot/dnpb/!svn/ver/307/trunk/Prebuild/src/Core/Utilities/CommandLineCollection.cs -END -CurrentDirectory.cs -K 25 -svn:wc:ra_dav:version-url -V 80 -/svnroot/dnpb/!svn/ver/307/trunk/Prebuild/src/Core/Utilities/CurrentDirectory.cs -END diff --git a/Prebuild/src/Core/Utilities/.svn/dir-prop-base b/Prebuild/src/Core/Utilities/.svn/dir-prop-base deleted file mode 100644 index a1989a0..0000000 --- a/Prebuild/src/Core/Utilities/.svn/dir-prop-base +++ /dev/null @@ -1,5 +0,0 @@ -K 10 -svn:ignore -V 5 -*.swp -END diff --git a/Prebuild/src/Core/Utilities/.svn/entries b/Prebuild/src/Core/Utilities/.svn/entries deleted file mode 100644 index cc148d7..0000000 --- a/Prebuild/src/Core/Utilities/.svn/entries +++ /dev/null @@ -1,164 +0,0 @@ -10 - -dir -323 -https://dnpb.svn.sourceforge.net/svnroot/dnpb/trunk/Prebuild/src/Core/Utilities -https://dnpb.svn.sourceforge.net/svnroot/dnpb - - - -2009-04-15T01:40:10.014568Z -309 -kunnis -has-props - - - - - - - - - - - - - -3355ff64-970d-0410-bbe8-d0fbd18be4fb - -Helper.cs -file - - - - -2010-09-10T22:51:44.000000Z -7a0749dec0ce5453fc73dd11f89ce613 -2009-04-15T01:28:16.827957Z -307 -kunnis -has-props - - - - - - - - - - - - - - - - - - - - -14966 - -Log.cs -file - - - - -2010-09-10T22:51:44.000000Z -d91804d20a90778d74744cd14bb2fa4c -2009-04-15T01:40:10.014568Z -309 -kunnis -has-props - - - - - - - - - - - - - - - - - - - - -6100 - -CommandLineCollection.cs -file - - - - -2010-09-10T22:51:44.000000Z -2a00bed45ea425e5e8a21a5ff6a68d69 -2009-04-15T01:28:16.827957Z -307 -kunnis -has-props - - - - - - - - - - - - - - - - - - - - -4032 - -CurrentDirectory.cs -file - - - - -2010-09-10T22:51:44.000000Z -e710723e685cc628a3761209001c8767 -2009-04-15T01:28:16.827957Z -307 -kunnis -has-props - - - - - - - - - - - - - - - - - - - - -2124 - diff --git a/Prebuild/src/Core/Utilities/.svn/prop-base/CommandLineCollection.cs.svn-base b/Prebuild/src/Core/Utilities/.svn/prop-base/CommandLineCollection.cs.svn-base deleted file mode 100644 index 7b57b30..0000000 --- a/Prebuild/src/Core/Utilities/.svn/prop-base/CommandLineCollection.cs.svn-base +++ /dev/null @@ -1,9 +0,0 @@ -K 13 -svn:eol-style -V 6 -native -K 12 -svn:keywords -V 23 -Author Date Id Revision -END diff --git a/Prebuild/src/Core/Utilities/.svn/prop-base/CurrentDirectory.cs.svn-base b/Prebuild/src/Core/Utilities/.svn/prop-base/CurrentDirectory.cs.svn-base deleted file mode 100644 index 7b57b30..0000000 --- a/Prebuild/src/Core/Utilities/.svn/prop-base/CurrentDirectory.cs.svn-base +++ /dev/null @@ -1,9 +0,0 @@ -K 13 -svn:eol-style -V 6 -native -K 12 -svn:keywords -V 23 -Author Date Id Revision -END diff --git a/Prebuild/src/Core/Utilities/.svn/prop-base/Helper.cs.svn-base b/Prebuild/src/Core/Utilities/.svn/prop-base/Helper.cs.svn-base deleted file mode 100644 index 7b57b30..0000000 --- a/Prebuild/src/Core/Utilities/.svn/prop-base/Helper.cs.svn-base +++ /dev/null @@ -1,9 +0,0 @@ -K 13 -svn:eol-style -V 6 -native -K 12 -svn:keywords -V 23 -Author Date Id Revision -END diff --git a/Prebuild/src/Core/Utilities/.svn/prop-base/Log.cs.svn-base b/Prebuild/src/Core/Utilities/.svn/prop-base/Log.cs.svn-base deleted file mode 100644 index 7b57b30..0000000 --- a/Prebuild/src/Core/Utilities/.svn/prop-base/Log.cs.svn-base +++ /dev/null @@ -1,9 +0,0 @@ -K 13 -svn:eol-style -V 6 -native -K 12 -svn:keywords -V 23 -Author Date Id Revision -END diff --git a/Prebuild/src/Core/Utilities/.svn/text-base/CommandLineCollection.cs.svn-base b/Prebuild/src/Core/Utilities/.svn/text-base/CommandLineCollection.cs.svn-base deleted file mode 100644 index 786fa1e..0000000 --- a/Prebuild/src/Core/Utilities/.svn/text-base/CommandLineCollection.cs.svn-base +++ /dev/null @@ -1,152 +0,0 @@ -#region BSD License -/* -Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com) - -Redistribution and use in source and binary forms, with or without modification, are permitted -provided that the following conditions are met: - -* Redistributions of source code must retain the above copyright notice, this list of conditions - and the following disclaimer. -* Redistributions in binary form must reproduce the above copyright notice, this list of conditions - and the following disclaimer in the documentation and/or other materials provided with the - distribution. -* The name of the author may not be used to endorse or promote products derived from this software - without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, -BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY -OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING -IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ -#endregion - -using System.Collections; -using System.Collections.Generic; - -namespace Prebuild.Core.Utilities -{ - /// - /// The CommandLine class parses and interprets the command-line arguments passed to - /// prebuild. - /// - public class CommandLineCollection : IEnumerable> - { - #region Fields - - // The raw OS arguments - private readonly string[] m_RawArgs; - - // Command-line argument storage - private readonly Dictionary m_Arguments = new Dictionary(); - - #endregion - - #region Constructors - - /// - /// Create a new CommandLine instance and set some internal variables. - /// - public CommandLineCollection(string[] args) - { - m_RawArgs = args; - - Parse(); - } - - #endregion - - #region Private Methods - - private void Parse() - { - if(m_RawArgs.Length < 1) - return; - - int idx = 0; - string lastArg = null; - - while(idx 2 && arg[0] == '/') - { - arg = arg.Substring(1); - lastArg = arg; - m_Arguments[arg] = ""; - } - else - { - if(lastArg != null) - { - m_Arguments[lastArg] = arg; - lastArg = null; - } - } - - idx++; - } - } - - #endregion - - #region Public Methods - - /// - /// Wases the passed. - /// - /// The arg. - /// - public bool WasPassed(string arg) - { - return (m_Arguments.ContainsKey(arg)); - } - - #endregion - - #region Properties - - /// - /// Gets the parameter associated with the command line option - /// - /// Returns null if option was not specified, - /// null string if no parameter was specified, and the value if a parameter was specified - public string this[string index] - { - get - { - if(m_Arguments.ContainsKey(index)) - { - return (m_Arguments[index]); - } - return null; - } - } - - #endregion - - #region IEnumerable Members - - /// - /// Returns an enumerator that can iterate through a collection. - /// - /// - /// An - /// that can be used to iterate through the collection. - /// - public IEnumerator> GetEnumerator() - { - return m_Arguments.GetEnumerator(); - } - - IEnumerator IEnumerable.GetEnumerator() - { - return GetEnumerator(); - } - - #endregion - } -} diff --git a/Prebuild/src/Core/Utilities/.svn/text-base/CurrentDirectory.cs.svn-base b/Prebuild/src/Core/Utilities/.svn/text-base/CurrentDirectory.cs.svn-base deleted file mode 100644 index 9624c35..0000000 --- a/Prebuild/src/Core/Utilities/.svn/text-base/CurrentDirectory.cs.svn-base +++ /dev/null @@ -1,68 +0,0 @@ -#region BSD License -/* -Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com) - -Redistribution and use in source and binary forms, with or without modification, are permitted -provided that the following conditions are met: - -* Redistributions of source code must retain the above copyright notice, this list of conditions - and the following disclaimer. -* Redistributions in binary form must reproduce the above copyright notice, this list of conditions - and the following disclaimer in the documentation and/or other materials provided with the - distribution. -* The name of the author may not be used to endorse or promote products derived from this software - without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, -BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY -OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING -IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ -#endregion - -using System; -using System.Collections.Generic; - -namespace Prebuild.Core.Utilities -{ - /// - /// - /// - public class CurrentDirectory - { - #region Fields - - private readonly Stack m_Stack = new Stack(); - - #endregion - - #region Public Methods - - /// - /// Pushes this instance. - /// - public void Push() - { - m_Stack.Push(Environment.CurrentDirectory); - } - - /// - /// Pops this instance. - /// - public void Pop() - { - if(m_Stack.Count < 1) - { - return; - } - - string cwd = m_Stack.Pop(); - Helper.SetCurrentDir(cwd); - } - - #endregion - } -} diff --git a/Prebuild/src/Core/Utilities/.svn/text-base/Helper.cs.svn-base b/Prebuild/src/Core/Utilities/.svn/text-base/Helper.cs.svn-base deleted file mode 100644 index 8c3e968..0000000 --- a/Prebuild/src/Core/Utilities/.svn/text-base/Helper.cs.svn-base +++ /dev/null @@ -1,575 +0,0 @@ -#region BSD License -/* -Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com) - -Redistribution and use in source and binary forms, with or without modification, are permitted -provided that the following conditions are met: - -* Redistributions of source code must retain the above copyright notice, this list of conditions - and the following disclaimer. -* Redistributions in binary form must reproduce the above copyright notice, this list of conditions - and the following disclaimer in the documentation and/or other materials provided with the - distribution. -* The name of the author may not be used to endorse or promote products derived from this software - without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, -BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY -OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING -IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ -#endregion - -using System; -using System.Collections.Generic; -using System.Diagnostics; -using System.IO; -using System.Runtime.InteropServices; -using System.Text.RegularExpressions; -using System.Collections.Specialized; -using System.Xml; -using Prebuild.Core.Nodes; - -namespace Prebuild.Core.Utilities -{ - /// - /// - /// - public class Helper - { - #region Fields - - static bool checkForOSVariables; - - /// - /// - /// - public static bool CheckForOSVariables - { - get - { - return checkForOSVariables; - } - set - { - checkForOSVariables = value; - } - } - - #endregion - - #region Public Methods - - #region String Parsing - - public delegate string StringLookup(string key); - - /// - /// Gets a collection of StringLocationPair objects that represent the matches - /// - /// The target. - /// The before group. - /// The after group. - /// if set to true [include delimiters in substrings]. - /// - public static StringCollection FindGroups(string target, string beforeGroup, string afterGroup, bool includeDelimitersInSubstrings) - { - if( beforeGroup == null ) - { - throw new ArgumentNullException("beforeGroup"); - } - if( afterGroup == null ) - { - throw new ArgumentNullException("afterGroup"); - } - StringCollection results = new StringCollection(); - if(target == null || target.Length == 0) - { - return results; - } - - int beforeMod = 0; - int afterMod = 0; - if(includeDelimitersInSubstrings) - { - //be sure to not exlude the delims - beforeMod = beforeGroup.Length; - afterMod = afterGroup.Length; - } - int startIndex = 0; - while((startIndex = target.IndexOf(beforeGroup,startIndex)) != -1) { - int endIndex = target.IndexOf(afterGroup,startIndex);//the index of the char after it - if(endIndex == -1) - { - break; - } - int length = endIndex - startIndex - beforeGroup.Length;//move to the first char in the string - string substring = substring = target.Substring(startIndex + beforeGroup.Length - beforeMod, - length - afterMod); - - results.Add(substring); - //results.Add(new StringLocationPair(substring,startIndex)); - startIndex = endIndex + 1; - //the Interpolate*() methods will not work if expressions are expandded inside expression due to an optimization - //so start after endIndex - - } - return results; - } - - /// - /// Replaces the groups. - /// - /// The target. - /// The before group. - /// The after group. - /// The lookup. - /// - public static string ReplaceGroups(string target, string beforeGroup, string afterGroup, StringLookup lookup) { - if( target == null ) - { - throw new ArgumentNullException("target"); - } - //int targetLength = target.Length; - StringCollection strings = FindGroups(target,beforeGroup,afterGroup,false); - if( lookup == null ) - { - throw new ArgumentNullException("lookup"); - } - foreach(string substring in strings) - { - target = target.Replace(beforeGroup + substring + afterGroup, lookup(substring) ); - } - return target; - } - - /// - /// Replaces ${var} statements in a string with the corresonding values as detirmined by the lookup delegate - /// - /// The target. - /// The lookup. - /// - public static string InterpolateForVariables(string target, StringLookup lookup) - { - return ReplaceGroups(target, "${" , "}" , lookup); - } - - /// - /// Replaces ${var} statements in a string with the corresonding environment variable with name var - /// - /// - /// - public static string InterpolateForEnvironmentVariables(string target) - { - return InterpolateForVariables(target, new StringLookup(Environment.GetEnvironmentVariable)); - } - - #endregion - - /// - /// Translates the value. - /// - /// Type of the translate. - /// The translation item. - /// - public static object TranslateValue(Type translateType, string translationItem) - { - if(translationItem == null) - { - return null; - } - - try - { - string lowerVal = translationItem.ToLower(); - if(translateType == typeof(bool)) - { - return (lowerVal == "true" || lowerVal == "1" || lowerVal == "y" || lowerVal == "yes" || lowerVal == "on"); - } - else if(translateType == typeof(int)) - { - return (Int32.Parse(translationItem)); - } - else - { - return translationItem; - } - } - catch(FormatException) - { - return null; - } - } - - /// - /// Deletes if exists. - /// - /// The file. - /// - public static bool DeleteIfExists(string file) - { - string resFile = null; - try - { - resFile = ResolvePath(file); - } - catch(ArgumentException) - { - return false; - } - - if(!File.Exists(resFile)) - { - return false; - } - - File.Delete(resFile); - return true; - } - - static readonly char seperator = Path.DirectorySeparatorChar; - - // This little gem was taken from the NeL source, thanks guys! - /// - /// Makes a relative path - /// - /// Path to start from - /// Path to end at - /// Path that will get from startPath to endPath - public static string MakePathRelativeTo(string startPath, string endPath) - { - string tmp = NormalizePath(startPath, seperator); - string src = NormalizePath(endPath, seperator); - string prefix = ""; - - while(true) - { - if((String.Compare(tmp, 0, src, 0, tmp.Length) == 0)) - { - string ret; - int size = tmp.Length; - if(size == src.Length) - { - return "./"; - } - if((src.Length > tmp.Length) && src[tmp.Length - 1] != seperator) - { - } - else - { - ret = prefix + endPath.Substring(size, endPath.Length - size); - ret = ret.Trim(); - if(ret[0] == seperator) - { - ret = "." + ret; - } - - return NormalizePath(ret); - } - - } - - if(tmp.Length < 2) - { - break; - } - - int lastPos = tmp.LastIndexOf(seperator, tmp.Length - 2); - int prevPos = tmp.IndexOf(seperator); - - if((lastPos == prevPos) || (lastPos == -1)) - { - break; - } - - tmp = tmp.Substring(0, lastPos + 1); - prefix += ".." + seperator.ToString(); - } - - return endPath; - } - - /// - /// Resolves the path. - /// - /// The path. - /// - public static string ResolvePath(string path) - { - string tmpPath = NormalizePath(path); - if(tmpPath.Length < 1) - { - tmpPath = "."; - } - - tmpPath = Path.GetFullPath(tmpPath); - if(!File.Exists(tmpPath) && !Directory.Exists(tmpPath)) - { - throw new ArgumentException("Path could not be resolved: " + tmpPath); - } - - return tmpPath; - } - - /// - /// Normalizes the path. - /// - /// The path. - /// The separator character. - /// - public static string NormalizePath(string path, char separatorCharacter) - { - if(path == null || path == "" || path.Length < 1) - { - return ""; - } - - string tmpPath = path.Replace('\\', '/'); - tmpPath = tmpPath.Replace('/', separatorCharacter); - return tmpPath; - } - - /// - /// Normalizes the path. - /// - /// The path. - /// - public static string NormalizePath(string path) - { - return NormalizePath(path, Path.DirectorySeparatorChar); - } - - /// - /// Ends the path. - /// - /// The path. - /// The separator character. - /// - public static string EndPath(string path, char separatorCharacter) - { - if(path == null || path == "" || path.Length < 1) - { - return ""; - } - - if(!path.EndsWith(separatorCharacter.ToString())) - { - return (path + separatorCharacter); - } - - return path; - } - - /// - /// Ends the path. - /// - /// The path. - /// - public static string EndPath(string path) - { - return EndPath(path, Path.DirectorySeparatorChar); - } - - /// - /// Makes the file path. - /// - /// The path. - /// The name. - /// The ext. - /// - public static string MakeFilePath(string path, string name, string ext) - { - string ret = EndPath(NormalizePath(path)); - - if( name == null ) - { - throw new ArgumentNullException("name"); - } - - ret += name; - if(!name.EndsWith("." + ext)) - { - ret += "." + ext; - } - - //foreach(char c in Path.GetInvalidPathChars()) - //{ - // ret = ret.Replace(c, '_'); - //} - - return ret; - } - - /// - /// Makes the file path. - /// - /// The path. - /// The name. - /// - public static string MakeFilePath(string path, string name) - { - string ret = EndPath(NormalizePath(path)); - - if( name == null ) - { - throw new ArgumentNullException("name"); - } - - ret += name; - - //foreach (char c in Path.GetInvalidPathChars()) - //{ - // ret = ret.Replace(c, '_'); - //} - - return ret; - } - - /// - /// - /// - /// - /// - public static string MakeReferencePath(string path) - { - string ret = EndPath(NormalizePath(path)); - - //foreach (char c in Path.GetInvalidPathChars()) - //{ - // ret = ret.Replace(c, '_'); - //} - - return ret; - } - - /// - /// Sets the current dir. - /// - /// The path. - public static void SetCurrentDir(string path) - { - if( path == null ) - { - throw new ArgumentNullException("path"); - } - if(path.Length < 1) - { - return; - } - - Environment.CurrentDirectory = path; - } - - /// - /// Checks the type. - /// - /// The type to check. - /// The attr. - /// The inter. - /// - public static object CheckType(Type typeToCheck, Type attr, Type inter) - { - if(typeToCheck == null || attr == null) - { - return null; - } - - object[] attrs = typeToCheck.GetCustomAttributes(attr, false); - if(attrs == null || attrs.Length < 1) - { - return null; - } - if( inter == null ) - { - throw new ArgumentNullException("inter"); - } - - if(typeToCheck.GetInterface(inter.FullName) == null) - { - return null; - } - - return attrs[0]; - } - - /// - /// Attributes the value. - /// - /// The node. - /// The attr. - /// The def. - /// - public static string AttributeValue(XmlNode node, string attr, string def) - { - if( node == null ) - { - throw new ArgumentNullException("node"); - } - if(node.Attributes[attr] == null) - { - return def; - } - string val = node.Attributes[attr].Value; - if(!CheckForOSVariables) - { - return val; - } - - return InterpolateForEnvironmentVariables(val); - } - - /// - /// Parses the boolean. - /// - /// The node. - /// The attr. - /// if set to true [default value]. - /// - public static bool ParseBoolean(XmlNode node, string attr, bool defaultValue) - { - if( node == null ) - { - throw new ArgumentNullException("node"); - } - if(node.Attributes[attr] == null) - { - return defaultValue; - } - return bool.Parse(node.Attributes[attr].Value); - } - - /// - /// Enums the attribute value. - /// - /// The node. - /// The attr. - /// Type of the enum. - /// The def. - /// - public static object EnumAttributeValue(XmlNode node, string attr, Type enumType, object def) - { - if( def == null ) - { - throw new ArgumentNullException("def"); - } - string val = AttributeValue(node, attr, def.ToString()); - return Enum.Parse(enumType, val, true); - } - - /// - /// - /// - /// - /// - /// - public static string AssemblyFullName(string assemblyName, ProjectType projectType) - { - return assemblyName + (projectType == ProjectType.Library ? ".dll" : ".exe"); - } - - #endregion - } -} diff --git a/Prebuild/src/Core/Utilities/.svn/text-base/Log.cs.svn-base b/Prebuild/src/Core/Utilities/.svn/text-base/Log.cs.svn-base deleted file mode 100644 index 4df3def..0000000 --- a/Prebuild/src/Core/Utilities/.svn/text-base/Log.cs.svn-base +++ /dev/null @@ -1,276 +0,0 @@ -#region BSD License -/* -Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com) - -Redistribution and use in source and binary forms, with or without modification, are permitted -provided that the following conditions are met: - -* Redistributions of source code must retain the above copyright notice, this list of conditions - and the following disclaimer. -* Redistributions in binary form must reproduce the above copyright notice, this list of conditions - and the following disclaimer in the documentation and/or other materials provided with the - distribution. -* The name of the author may not be used to endorse or promote products derived from this software - without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, -BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY -OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING -IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ -#endregion - -using System; -using System.IO; - -namespace Prebuild.Core.Utilities -{ - /// - /// - /// - public enum LogType - { - /// - /// - /// - None, - /// - /// - /// - Info, - /// - /// - /// - Warning, - /// - /// - /// - Error - } - - /// - /// - /// - [Flags] - public enum LogTargets - { - /// - /// - /// - None = 0, - /// - /// - /// - Null = 1, - /// - /// - /// - File = 2, - /// - /// - /// - Console = 4 - } - - /// - /// Summary description for Log. - /// - public class Log : IDisposable - { - #region Fields - - private TextWriter m_Writer; - private LogTargets m_Target = LogTargets.Null; - bool disposed; - - #endregion - - #region Constructors - - /// - /// Initializes a new instance of the class. - /// - /// The target. - /// Name of the file. - public Log(LogTargets target, string fileName) - { - m_Target = target; - - if ((m_Target & LogTargets.File) != 0) - { - m_Writer = new StreamWriter(fileName, false); - } - else if ((m_Target & LogTargets.Console) != 0) - { - // Prevents null reference exceptions when outputing to the log file. - // This seems to only happen when running on a network drive. - m_Writer = Console.Out; - } - } - - #endregion - - #region Public Methods - - /// - /// Writes this instance. - /// - public void Write() - { - Write(string.Empty); - } - - /// - /// Writes the specified MSG. - /// - /// The MSG. - public void Write(string msg) - { - if((m_Target & LogTargets.Null) != 0) - { - return; - } - - if((m_Target & LogTargets.Console) != 0) - { - Console.WriteLine(msg); - } - if((m_Target & LogTargets.File) != 0 && m_Writer != null) - { - m_Writer.WriteLine(msg); - } - } - - /// - /// Writes the specified format. - /// - /// The format. - /// The args. - public void Write(string format, params object[] args) - { - Write(string.Format(format,args)); - } - - /// - /// Writes the specified type. - /// - /// The type. - /// The format. - /// The args. - public void Write(LogType type, string format, params object[] args) - { - if((m_Target & LogTargets.Null) != 0) - { - return; - } - - string str = ""; - switch(type) - { - case LogType.Info: - str = "[I] "; - break; - case LogType.Warning: - str = "[!] "; - break; - case LogType.Error: - str = "[X] "; - break; - } - - Write(str + format,args); - } - - /// - /// Writes the exception. - /// - /// The type. - /// The ex. - public void WriteException(LogType type, Exception ex) - { - if(ex != null) - { - Write(type, ex.Message); - //#if DEBUG - m_Writer.WriteLine("Exception @{0} stack trace [[", ex.TargetSite.Name); - m_Writer.WriteLine(ex.StackTrace); - m_Writer.WriteLine("]]"); - //#endif - } - } - - /// - /// Flushes this instance. - /// - public void Flush() - { - if(m_Writer != null) - { - m_Writer.Flush(); - } - } - - #endregion - - #region IDisposable Members - - /// - /// Performs application-defined tasks associated with freeing, releasing, or - /// resetting unmanaged resources. - /// - public void Dispose() - { - Dispose(true); - GC.SuppressFinalize(this); - } - - /// - /// Dispose objects - /// - /// - /// If true, it will dispose close the handle - /// - /// - /// Will dispose managed and unmanaged resources. - /// - protected virtual void Dispose(bool disposing) - { - if (!this.disposed) - { - if (disposing) - { - if (m_Writer != null) - { - m_Writer.Close(); - m_Writer = null; - } - } - } - this.disposed = true; - } - - /// - /// - /// - ~Log() - { - this.Dispose(false); - } - - /// - /// Closes and destroys this object - /// - /// - /// Same as Dispose(true) - /// - public void Close() - { - Dispose(); - } - - #endregion - } -} diff --git a/Prebuild/src/Properties/.svn/all-wcprops b/Prebuild/src/Properties/.svn/all-wcprops deleted file mode 100644 index 0fdb604..0000000 --- a/Prebuild/src/Properties/.svn/all-wcprops +++ /dev/null @@ -1,11 +0,0 @@ -K 25 -svn:wc:ra_dav:version-url -V 56 -/svnroot/dnpb/!svn/ver/323/trunk/Prebuild/src/Properties -END -AssemblyInfo.cs -K 25 -svn:wc:ra_dav:version-url -V 72 -/svnroot/dnpb/!svn/ver/323/trunk/Prebuild/src/Properties/AssemblyInfo.cs -END diff --git a/Prebuild/src/Properties/.svn/entries b/Prebuild/src/Properties/.svn/entries deleted file mode 100644 index 0a81c5c..0000000 --- a/Prebuild/src/Properties/.svn/entries +++ /dev/null @@ -1,62 +0,0 @@ -10 - -dir -323 -https://dnpb.svn.sourceforge.net/svnroot/dnpb/trunk/Prebuild/src/Properties -https://dnpb.svn.sourceforge.net/svnroot/dnpb - - - -2010-09-10T17:51:36.189738Z -323 -jhurliman - - - - - - - - - - - - - - -3355ff64-970d-0410-bbe8-d0fbd18be4fb - -AssemblyInfo.cs -file - - - - -2010-09-10T22:51:45.000000Z -91e38b76ed4b8de4873bd78e0c587989 -2010-09-10T17:51:36.189738Z -323 -jhurliman -has-props - - - - - - - - - - - - - - - - - - - - -4691 - diff --git a/Prebuild/src/Properties/.svn/prop-base/AssemblyInfo.cs.svn-base b/Prebuild/src/Properties/.svn/prop-base/AssemblyInfo.cs.svn-base deleted file mode 100644 index 7b57b30..0000000 --- a/Prebuild/src/Properties/.svn/prop-base/AssemblyInfo.cs.svn-base +++ /dev/null @@ -1,9 +0,0 @@ -K 13 -svn:eol-style -V 6 -native -K 12 -svn:keywords -V 23 -Author Date Id Revision -END diff --git a/Prebuild/src/Properties/.svn/text-base/AssemblyInfo.cs.svn-base b/Prebuild/src/Properties/.svn/text-base/AssemblyInfo.cs.svn-base deleted file mode 100644 index f3ac30f..0000000 --- a/Prebuild/src/Properties/.svn/text-base/AssemblyInfo.cs.svn-base +++ /dev/null @@ -1,113 +0,0 @@ -#region BSD License -/* - -Copyright (c) 2004 - 2008 -Matthew Holmes (matthew@wildfiregames.com), -Dan Moorehead (dan05a@gmail.com), -Dave Hudson (jendave@yahoo.com), -Rob Loach (http://www.robloach.net), -C.J. Adams-Collier (cjac@colliertech.org), - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - -* Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - -* Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - -* The name of the author may not be used to endorse or promote - products derived from this software without specific prior written - permission. - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR -IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, -INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, -STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING -IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -POSSIBILITY OF SUCH DAMAGE. - -*/ -#endregion - -using System; -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; -using System.Security.Permissions; -using System.Resources; - - -// FxCop recommended attributes -[assembly: ComVisible(false)] -[assembly: FileIOPermission(SecurityAction.RequestMinimum, Unrestricted=true)] -[assembly: CLSCompliant(true)] - -// -// 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(".NET Prebuild")] -[assembly: AssemblyDescription("A .NET project file build tool")] -[assembly: AssemblyConfiguration(".NET CLR")] -[assembly: AssemblyCompany("The Prebuild Project")] -[assembly: AssemblyProduct("")] -[assembly: AssemblyCopyright("Copyright 2004-2010 " + - "Matthew Holmes, " + - "Dan Moorehead, " + - "C.J. Adams-Collier, " + - "Rob Loach, " + - "David Hudson," + - "John Hurliman")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] -[assembly: NeutralResourcesLanguageAttribute("en-US")] -[assembly: AssemblyVersion("2.0.5.*")] - -// -// 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 Revision and Build Numbers -// by using the '*' as shown below: - -// -// In order to sign your assembly you must specify a key to use. Refer to the -// Microsoft .NET Framework documentation for more information on assembly signing. -// -// Use the attributes below to control which key is used for signing. -// -// Notes: -// (*) If no key is specified, the assembly is not signed. -// (*) KeyName refers to a key that has been installed in the Crypto Service -// Provider (CSP) on your machine. KeyFile refers to a file which contains -// a key. -// (*) If the KeyFile and the KeyName values are both specified, the -// following processing occurs: -// (1) If the KeyName can be found in the CSP, that key is used. -// (2) If the KeyName does not exist and the KeyFile does exist, the key -// in the KeyFile is installed into the CSP and used. -// (*) In order to create a KeyFile, you can use the sn.exe (Strong Name) utility. -// When specifying the KeyFile, the location of the KeyFile should be -// relative to the project output directory which is -// %Project Directory%\obj\. For example, if your KeyFile is -// located in the project directory, you would specify the AssemblyKeyFile -// attribute as [assembly: AssemblyKeyFile("..\\..\\mykey.snk")] -// (*) Delay Signing is an advanced option - see the Microsoft .NET Framework -// documentation for more information on this. -// -[assembly: AssemblyDelaySign(false)] -[assembly: AssemblyKeyName("")] diff --git a/Prebuild/src/data/.svn/all-wcprops b/Prebuild/src/data/.svn/all-wcprops deleted file mode 100644 index 3af3c24..0000000 --- a/Prebuild/src/data/.svn/all-wcprops +++ /dev/null @@ -1,71 +0,0 @@ -K 25 -svn:wc:ra_dav:version-url -V 50 -/svnroot/dnpb/!svn/ver/316/trunk/Prebuild/src/data -END -dnpb-1.3.xsd -K 25 -svn:wc:ra_dav:version-url -V 62 -/svnroot/dnpb/!svn/ver/96/trunk/Prebuild/src/data/dnpb-1.3.xsd -END -dnpb-1.4.xsd -K 25 -svn:wc:ra_dav:version-url -V 62 -/svnroot/dnpb/!svn/ver/96/trunk/Prebuild/src/data/dnpb-1.4.xsd -END -dnpb-1.5.xsd -K 25 -svn:wc:ra_dav:version-url -V 62 -/svnroot/dnpb/!svn/ver/96/trunk/Prebuild/src/data/dnpb-1.5.xsd -END -prebuild-1.6.xsd -K 25 -svn:wc:ra_dav:version-url -V 66 -/svnroot/dnpb/!svn/ver/96/trunk/Prebuild/src/data/prebuild-1.6.xsd -END -prebuild-1.7.xsd -K 25 -svn:wc:ra_dav:version-url -V 67 -/svnroot/dnpb/!svn/ver/299/trunk/Prebuild/src/data/prebuild-1.7.xsd -END -prebuild-1.8.xsd -K 25 -svn:wc:ra_dav:version-url -V 67 -/svnroot/dnpb/!svn/ver/314/trunk/Prebuild/src/data/prebuild-1.8.xsd -END -autotools.xml -K 25 -svn:wc:ra_dav:version-url -V 64 -/svnroot/dnpb/!svn/ver/256/trunk/Prebuild/src/data/autotools.xml -END -prebuild-1.9.xsd -K 25 -svn:wc:ra_dav:version-url -V 67 -/svnroot/dnpb/!svn/ver/316/trunk/Prebuild/src/data/prebuild-1.9.xsd -END -dnpb-1.0.xsd -K 25 -svn:wc:ra_dav:version-url -V 62 -/svnroot/dnpb/!svn/ver/96/trunk/Prebuild/src/data/dnpb-1.0.xsd -END -dnpb-1.1.xsd -K 25 -svn:wc:ra_dav:version-url -V 62 -/svnroot/dnpb/!svn/ver/96/trunk/Prebuild/src/data/dnpb-1.1.xsd -END -dnpb-1.2.xsd -K 25 -svn:wc:ra_dav:version-url -V 62 -/svnroot/dnpb/!svn/ver/96/trunk/Prebuild/src/data/dnpb-1.2.xsd -END diff --git a/Prebuild/src/data/.svn/dir-prop-base b/Prebuild/src/data/.svn/dir-prop-base deleted file mode 100644 index 29ffe33..0000000 --- a/Prebuild/src/data/.svn/dir-prop-base +++ /dev/null @@ -1,6 +0,0 @@ -K 10 -svn:ignore -V 11 -*.swp -*.xsx -END diff --git a/Prebuild/src/data/.svn/entries b/Prebuild/src/data/.svn/entries deleted file mode 100644 index 935b447..0000000 --- a/Prebuild/src/data/.svn/entries +++ /dev/null @@ -1,402 +0,0 @@ -10 - -dir -323 -https://dnpb.svn.sourceforge.net/svnroot/dnpb/trunk/Prebuild/src/data -https://dnpb.svn.sourceforge.net/svnroot/dnpb - - - -2010-05-08T05:43:01.449559Z -316 -jhurliman -has-props - - - - - - - - - - - - - -3355ff64-970d-0410-bbe8-d0fbd18be4fb - -dnpb-1.3.xsd -file - - - - -2010-09-10T22:51:45.000000Z -636ed9edea90e5104ad1879c96552b91 -2004-12-29T02:08:06.000000Z -35 -xeonx -has-props - - - - - - - - - - - - - - - - - - - - -7995 - -dnpb-1.4.xsd -file - - - - -2010-09-10T22:51:45.000000Z -3e883fc616c786e3835ba3386ede4269 -2005-12-23T06:05:38.000000Z -39 -jendave -has-props - - - - - - - - - - - - - - - - - - - - -8197 - -dnpb-1.5.xsd -file - - - - -2010-09-10T22:51:45.000000Z -c692bbcd63f10ca4c93da1c19f5b107e -2006-01-23T23:19:16.000000Z -55 -jendave -has-props - - - - - - - - - - - - - - - - - - - - -8420 - -prebuild-1.6.xsd -file - - - - -2010-09-10T22:51:45.000000Z -61f6e6f13f64ae842b1324cf145934ad -2006-02-28T18:13:10.884431Z -95 -jendave -has-props - - - - - - - - - - - - - - - - - - - - -9770 - -prebuild-1.7.xsd -file - - - - -2010-09-10T22:51:45.000000Z -edf1193fad8922061845cf48cc8eb851 -2009-02-21T05:36:29.327384Z -299 -kunnis - - - - - - - - - - - - - - - - - - - - - -16083 - -prebuild-1.8.xsd -file - - - - -2010-09-10T22:51:45.000000Z -6eb078509319faa7ae4cdc55af184ac1 -2009-06-06T19:43:44.493200Z -314 -dmoonfire - - - - - - - - - - - - - - - - - - - - - -15296 - -autotools.xml -file - - - - -2010-09-10T22:51:45.000000Z -e119a174539f100e18d2ee73c5660318 -2008-02-07T16:31:29.630257Z -256 -cjcollier - - - - - - - - - - - - - - - - - - - - - -27653 - -prebuild-1.9.xsd -file - - - - -2010-09-10T22:51:45.000000Z -8988b0f7fc4462d76183a4c0b72121e9 -2010-05-08T05:43:01.449559Z -316 -jhurliman - - - - - - - - - - - - - - - - - - - - - -14622 - -dnpb-1.0.xsd -file - - - - -2010-09-10T22:51:45.000000Z -080c1e8ce73ec5aff528c2a62b355c38 -2004-04-19T07:06:45.000000Z -17 -calefaction -has-props - - - - - - - - - - - - - - - - - - - - -6878 - -dnpb-1.1.xsd -file - - - - -2010-09-10T22:51:45.000000Z -b00a1d973849b76554afb17f8a21978c -2004-04-22T00:51:14.000000Z -18 -calefaction -has-props - - - - - - - - - - - - - - - - - - - - -6883 - -dnpb-1.2.xsd -file - - - - -2010-09-10T22:51:45.000000Z -7ebd6286a2df12ef5e21e835342b1daa -2004-09-15T19:40:37.000000Z -29 -calefaction -has-props - - - - - - - - - - - - - - - - - - - - -7639 - diff --git a/Prebuild/src/data/.svn/prop-base/dnpb-1.0.xsd.svn-base b/Prebuild/src/data/.svn/prop-base/dnpb-1.0.xsd.svn-base deleted file mode 100644 index 7b57b30..0000000 --- a/Prebuild/src/data/.svn/prop-base/dnpb-1.0.xsd.svn-base +++ /dev/null @@ -1,9 +0,0 @@ -K 13 -svn:eol-style -V 6 -native -K 12 -svn:keywords -V 23 -Author Date Id Revision -END diff --git a/Prebuild/src/data/.svn/prop-base/dnpb-1.1.xsd.svn-base b/Prebuild/src/data/.svn/prop-base/dnpb-1.1.xsd.svn-base deleted file mode 100644 index 7b57b30..0000000 --- a/Prebuild/src/data/.svn/prop-base/dnpb-1.1.xsd.svn-base +++ /dev/null @@ -1,9 +0,0 @@ -K 13 -svn:eol-style -V 6 -native -K 12 -svn:keywords -V 23 -Author Date Id Revision -END diff --git a/Prebuild/src/data/.svn/prop-base/dnpb-1.2.xsd.svn-base b/Prebuild/src/data/.svn/prop-base/dnpb-1.2.xsd.svn-base deleted file mode 100644 index 7b57b30..0000000 --- a/Prebuild/src/data/.svn/prop-base/dnpb-1.2.xsd.svn-base +++ /dev/null @@ -1,9 +0,0 @@ -K 13 -svn:eol-style -V 6 -native -K 12 -svn:keywords -V 23 -Author Date Id Revision -END diff --git a/Prebuild/src/data/.svn/prop-base/dnpb-1.3.xsd.svn-base b/Prebuild/src/data/.svn/prop-base/dnpb-1.3.xsd.svn-base deleted file mode 100644 index 7b57b30..0000000 --- a/Prebuild/src/data/.svn/prop-base/dnpb-1.3.xsd.svn-base +++ /dev/null @@ -1,9 +0,0 @@ -K 13 -svn:eol-style -V 6 -native -K 12 -svn:keywords -V 23 -Author Date Id Revision -END diff --git a/Prebuild/src/data/.svn/prop-base/dnpb-1.4.xsd.svn-base b/Prebuild/src/data/.svn/prop-base/dnpb-1.4.xsd.svn-base deleted file mode 100644 index 7b57b30..0000000 --- a/Prebuild/src/data/.svn/prop-base/dnpb-1.4.xsd.svn-base +++ /dev/null @@ -1,9 +0,0 @@ -K 13 -svn:eol-style -V 6 -native -K 12 -svn:keywords -V 23 -Author Date Id Revision -END diff --git a/Prebuild/src/data/.svn/prop-base/dnpb-1.5.xsd.svn-base b/Prebuild/src/data/.svn/prop-base/dnpb-1.5.xsd.svn-base deleted file mode 100644 index 7b57b30..0000000 --- a/Prebuild/src/data/.svn/prop-base/dnpb-1.5.xsd.svn-base +++ /dev/null @@ -1,9 +0,0 @@ -K 13 -svn:eol-style -V 6 -native -K 12 -svn:keywords -V 23 -Author Date Id Revision -END diff --git a/Prebuild/src/data/.svn/prop-base/prebuild-1.6.xsd.svn-base b/Prebuild/src/data/.svn/prop-base/prebuild-1.6.xsd.svn-base deleted file mode 100644 index 7b57b30..0000000 --- a/Prebuild/src/data/.svn/prop-base/prebuild-1.6.xsd.svn-base +++ /dev/null @@ -1,9 +0,0 @@ -K 13 -svn:eol-style -V 6 -native -K 12 -svn:keywords -V 23 -Author Date Id Revision -END diff --git a/Prebuild/src/data/.svn/text-base/autotools.xml.svn-base b/Prebuild/src/data/.svn/text-base/autotools.xml.svn-base deleted file mode 100644 index ee4b064..0000000 --- a/Prebuild/src/data/.svn/text-base/autotools.xml.svn-base +++ /dev/null @@ -1,790 +0,0 @@ - - - - - #!/bin/sh -# Run this to generate all the initial makefiles, etc. -# Ripped off from Mono, which ripped off from GNOME macros version - -DIE=0 - -srcdir=`dirname $0` -test -z "$srcdir" && srcdir=. - -if [ -n "$MONO_PATH" ]; then - # from -> /mono/lib:/another/mono/lib - # to -> /mono /another/mono - for i in `echo ${MONO_PATH} | tr ":" " "`; do - i=`dirname ${i}` - if [ -n "{i}" -a -d "${i}/share/aclocal" ]; then - ACLOCAL_FLAGS="-I ${i}/share/aclocal $ACLOCAL_FLAGS" - fi - if [ -n "{i}" -a -d "${i}/bin" ]; then - PATH="${i}/bin:$PATH" - fi - done - export PATH -fi - -(autoconf --version) < /dev/null > /dev/null 2>&1 || { - echo - echo "**Error**: You must have \`autoconf' installed to compile Mono." - echo "Download the appropriate package for your distribution," - echo "or get the source tarball at ftp://ftp.gnu.org/pub/gnu/" - DIE=1 -} - -if [ -z "$LIBTOOL" ]; then - LIBTOOL=`which glibtool 2>/dev/null` - if [ ! -x "$LIBTOOL" ]; then - LIBTOOL=`which libtool` - fi -fi - -(grep "^AM_PROG_LIBTOOL" $srcdir/configure.ac >/dev/null) && { - ($LIBTOOL --version) < /dev/null > /dev/null 2>&1 || { - echo - echo "**Error**: You must have \`libtool' installed to compile Mono." - echo "Get ftp://ftp.gnu.org/pub/gnu/libtool-1.2d.tar.gz" - echo "(or a newer version if it is available)" - DIE=1 - } -} - -grep "^AM_GNU_GETTEXT" $srcdir/configure.ac >/dev/null && { - grep "sed.*POTFILES" $srcdir/configure.ac >/dev/null || \ - (gettext --version) < /dev/null > /dev/null 2>&1 || { - echo - echo "**Error**: You must have \`gettext' installed to compile Mono." - echo "Get ftp://alpha.gnu.org/gnu/gettext-0.10.35.tar.gz" - echo "(or a newer version if it is available)" - DIE=1 - } -} - -(automake --version) < /dev/null > /dev/null 2>&1 || { - echo - echo "**Error**: You must have \`automake' installed to compile Mono." - echo "Get ftp://ftp.gnu.org/pub/gnu/automake-1.3.tar.gz" - echo "(or a newer version if it is available)" - DIE=1 - NO_AUTOMAKE=yes -} - -# if no automake, don't bother testing for aclocal -test -n "$NO_AUTOMAKE" || (aclocal --version) < /dev/null > /dev/null 2>&1 || { - echo - echo "**Error**: Missing \`aclocal'. The version of \`automake'" - echo "installed doesn't appear recent enough." - echo "Get ftp://ftp.gnu.org/pub/gnu/automake-1.3.tar.gz" - echo "(or a newer version if it is available)" - DIE=1 -} - -if test "$DIE" -eq 1; then - exit 1 -fi - -if test -z "$NOCONFIGURE"; then - -if test -z "$*"; then - echo "**Warning**: I am going to run \`configure' with no arguments." - echo "If you wish to pass any to it, please specify them on the" - echo \`$0\'" command line." - echo -fi - -fi - -case $CC in -xlc ) - am_opt=--include-deps;; -esac - - -if grep "^AM_PROG_LIBTOOL" configure.ac >/dev/null; then - if test -z "$NO_LIBTOOLIZE" ; then - echo "Running libtoolize..." - ${LIBTOOL}ize --force --copy - fi -fi - -echo "Running aclocal $ACLOCAL_FLAGS ..." -aclocal $ACLOCAL_FLAGS || { - echo - echo "**Error**: aclocal failed. This may mean that you have not" - echo "installed all of the packages you need, or you may need to" - echo "set ACLOCAL_FLAGS to include \"-I \$prefix/share/aclocal\"" - echo "for the prefix where you installed the packages whose" - echo "macros were not found" - exit 1 -} - -if grep "^AM_CONFIG_HEADER" configure.ac >/dev/null; then - echo "Running autoheader..." - autoheader || { echo "**Error**: autoheader failed."; exit 1; } -fi - -echo "Running automake --gnu $am_opt ..." -automake --add-missing --gnu $am_opt || - { echo "**Error**: automake failed."; exit 1; } -echo "Running autoconf ..." -autoconf || { echo "**Error**: autoconf failed."; exit 1; } - -conf_flags="--enable-maintainer-mode --enable-compile-warnings" #--enable-iso-c - -if test x$NOCONFIGURE = x; then - echo Running $srcdir/configure $conf_flags "$@" ... - $srcdir/configure $conf_flags "$@" \ - && echo Now type \`make\' to compile $PKG_NAME || exit 1 -else - echo Skipping configure process. -fi - - - - - - - - - - - - - - - - AC_INIT([],[]) - -AC_PREREQ(2.60) -AC_CANONICAL_SYSTEM -AC_CONFIG_AUX_DIR(.) -AM_INIT_AUTOMAKE([1.9 tar-ustar foreign]) -AM_MAINTAINER_MODE -dnl AC_PROG_INTLTOOL([0.25]) -AC_PROG_INSTALL - -ASSEMBLY_NAME= -PROJECT_NAME= -PROJECT_VERSION=$VERSION -PROJECT_DESCRIPTION="" -PROJECT_TYPE="" - -AC_SUBST(ASSEMBLY_NAME) -AC_SUBST(PROJECT_NAME) -AC_SUBST(PROJECT_VERSION) -AC_SUBST(DESCRIPTION) - -AC_MSG_CHECKING([assembly type]) -case $PROJECT_TYPE in - *Exe) - ASSEMBLY_EXTENSION=exe - ;; - *Library) - ASSEMBLY_EXTENSION=dll - ;; - *) - AC_MSG_ERROR([*** Please add support for project type $PROJECT_TYPE to configure.ac checks!]) - ;; -esac -AC_MSG_RESULT([$PROJECT_TYPE]) - -AC_SUBST(ASSEMBLY_EXTENSION) - -AC_MSG_CHECKING([whether we're compiling from an RCS]) -if test -f "$srcdir/.cvs_version" ; then - from_rcs=cvs -else - if test -f "$srcdir/.svn/entries" ; then - from_rcs=svn - else - from_rcs=no - fi -fi - -AC_MSG_RESULT($from_rcs) - -MONO_REQUIRED_VERSION=1.1 - -PKG_CHECK_MODULES(MONO_DEPENDENCY, mono >= $MONO_REQUIRED_VERSION, has_mono=true, has_mono=false) - -if test "x$has_mono" = "xtrue"; then - AC_PATH_PROG(RUNTIME, mono, no) - AC_PATH_PROG(CSC, gmcs, no) - AC_PATH_PROG(RESGEN, resgen2, no) - if test `uname -s` = "Darwin"; then - LIB_PREFIX= - LIB_SUFFIX=.dylib - else - LIB_PREFIX=.so - LIB_SUFFIX= - fi -else - AC_PATH_PROG(CSC, csc.exe, no) - if test x$CSC = "xno"; then - AC_MSG_ERROR([You need to install either mono or .Net]) - else - RUNTIME= - LIB_PREFIX= - LIB_SUFFIX= - fi -fi - -AC_PATH_PROG(GACUTIL, gacutil) -if test "x$GACUTIL" = "xno" ; then - AC_MSG_ERROR([No gacutil tool found]) -fi - -GACUTIL_FLAGS='/package /gacdir $(DESTDIR)$(prefix)/lib' -AC_SUBST(GACUTIL_FLAGS) - -AC_SUBST(PATH) -AC_SUBST(LD_LIBRARY_PATH) - -AC_SUBST(LIB_PREFIX) -AC_SUBST(LIB_SUFFIX) -AC_SUBST(RUNTIME) -AC_SUBST(CSC) -AC_SUBST(RESGEN) -AC_SUBST(GACUTIL) - -AC_SUBST(BASE_DEPENDENCIES_CFLAGS) -AC_SUBST(BASE_DEPENDENCIES_LIBS) - -dnl Find monodoc -MONODOC_REQUIRED_VERSION=1.0 -AC_SUBST(MONODOC_REQUIRED_VERSION) - -PKG_CHECK_MODULES(MONODOC_DEPENDENCY, monodoc >= $MONODOC_REQUIRED_VERSION, enable_monodoc=yes, enable_monodoc=no) - -if test "x$enable_monodoc" = "xyes"; then - AC_PATH_PROG(MONODOC, monodoc, no) - if test x$MONODOC = xno; then - enable_monodoc=no - fi -else - MONODOC= -fi - -AC_SUBST(MONODOC) -AM_CONDITIONAL(ENABLE_MONODOC, test "x$enable_monodoc" = "xyes") - -winbuild=no -case "$host" in - *-*-mingw*|*-*-cygwin*) - winbuild=yes - ;; -esac -AM_CONDITIONAL(WINBUILD, test x$winbuild = xyes) - -AC_CONFIG_FILES() -AC_CONFIG_FILES(.pc) - -AC_CONFIG_FILES(Makefile) -AC_OUTPUT - -echo "===" -echo "" -echo "Project configuration summary" -echo "" -echo " * Installation prefix: $prefix" -echo " * compiler: $CSC" -echo " * Documentation: $enable_monodoc ($MONODOC)" -echo " * Project Name: $PROJECT_NAME" -echo " * Version: $PROJECT_VERSION" -echo "" -echo "===" - - - - - - - - - - - - - - - - - - - - - - - - - - -ASSEMBLY=$(ASSEMBLY_NAME).$(ASSEMBLY_EXTENSION) - - -dir = $(prefix)/lib/ -_DATA = $(ASSEMBLY) $(ASSEMBLY).config - -bin_SCRIPTS= - -pkgconfigdir = $(prefix)/lib/pkgconfig -pkgconfig_DATA = .pc - -dir = $(prefix)/lib/mono/ -_DATA = $(ASSEMBLY).config - -noinst_DATA = $(ASSEMBLY) - - -PACKAGES = -BINARY_LIBS = -SYSTEM_LIBS = -RESOURCES_SRC = -RESOURCES = $(RESOURCES_SRC:.resx=.resources) -SOURCES = - -EXTRA_DIST=$(SOURCES) $(BINARY_LIBS) $(RESOURCES_SRC) install-sh missing - -CLEANFILES=$(ASSEMBLY) - - - - - - - -/$(ASSEMBLY): $(srcdir)/$(ASSEMBLY).response $(RESOURCES) $(SOURCES) $(BINARY_LIBS) - mkdir -p doc && mkdir -p && $(CSC) /out:$@ \ - /target: \ - $(addprefix /resource:$(srcdir)/, $(RESOURCES)) \ - $(addprefix /pkg:, $(PACKAGES)) \ - $(addprefix /r:, $(SYSTEM_LIBS)) \ - $(addprefix /r:$(srcdir)/, $(BINARY_LIBS)) \ - @$(srcdir)/$(ASSEMBLY).response \ - /doc:doc/ \ - /keyfile:$(srcdir)/ \ - /unsafe \ - && rm -f $(ASSEMBLY) \ - && ln $@ $(ASSEMBLY) - -CLEANFILES+=/$(ASSEMBLY) - - -EXTRA_DIST+= - -: /$(ASSEMBLY) - rm -f $(ASSEMBLY) \ - && ln /$(ASSEMBLY) $(ASSEMBLY) - - - - - -_install-data-local: /$(ASSEMBLY) - echo "$(GACUTIL) /i $(ASSEMBLY) /f $(GACUTIL_FLAGS)"; \ - $(GACUTIL) /i $(ASSEMBLY) /f $(GACUTIL_FLAGS) || exit 1; - -_uninstall-local: - if [`gacutil -l | grep "Number" | awk -F= '{print $$2}'` -gt "0" ] ; \ - then \ - echo "$(GACUTIL) /u $(ASSEMBLY_NAME) $(GACUTIL_FLAGS)"; \ - $(GACUTIL) /u $(ASSEMBLY_NAME) $(GACUTIL_FLAGS) || exit 1; \ - fi - - - -noinst__dir = $(prefix)/lib/mono/ -noinst___DATA = /$(ASSEMBLY) - - - - - - -$(ASSEMBLY): - - -$(srcdir)/$(ASSEMBLY).response: $(srcdir)/Makefile - echo "$(addprefix $(srcdir)/, $(SOURCES))" > $@ - - -all: $(ASSEMBLY) - -# rule to compile .resx files to .resources -%.resources: %.resx - $(RESGEN) /useSourcePath /compile $(@:.resources=.resx) - - - - - -install-data-local: _install-data-local - -uninstall-local: _uninstall-local - - - -#dir+=$(noinst__dir) -#_DATA+=$(noinst___DATA) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -prefix=@prefix@ -exec_prefix=${prefix} -libdir=${exec_prefix}/lib/mono/@PROJECT_NAME@ - -Name: -Description: -Version: @PROJECT_VERSION@ -Requires: -Libs: -r:${libdir}/@PROJECT_NAME@.dll - - - - - - - - - - - #!/bin/sh -# Run this to generate all the initial makefiles, etc. -# Ripped off from Mono, which ripped off from GNOME macros version - -DIE=0 - -srcdir=`dirname $0` -test -z "$srcdir" && srcdir=. - -if [ -n "$MONO_PATH" ]; then - # from -> /mono/lib:/another/mono/lib - # to -> /mono /another/mono - for i in `echo ${MONO_PATH} | tr ":" " "`; do - i=`dirname ${i}` - if [ -n "{i}" -a -d "${i}/share/aclocal" ]; then - ACLOCAL_FLAGS="-I ${i}/share/aclocal $ACLOCAL_FLAGS" - fi - if [ -n "{i}" -a -d "${i}/bin" ]; then - PATH="${i}/bin:$PATH" - fi - done - export PATH -fi - -(autoconf --version) < /dev/null > /dev/null 2>&1 || { - echo - echo "**Error**: You must have \`autoconf' installed to compile Mono." - echo "Download the appropriate package for your distribution," - echo "or get the source tarball at ftp://ftp.gnu.org/pub/gnu/" - DIE=1 -} - -if [ -z "$LIBTOOL" ]; then - LIBTOOL=`which glibtool 2>/dev/null` - if [ ! -x "$LIBTOOL" ]; then - LIBTOOL=`which libtool` - fi -fi - -(grep "^AM_PROG_LIBTOOL" $srcdir/configure.ac >/dev/null) && { - ($LIBTOOL --version) < /dev/null > /dev/null 2>&1 || { - echo - echo "**Error**: You must have \`libtool' installed to compile Mono." - echo "Get ftp://ftp.gnu.org/pub/gnu/libtool-1.2d.tar.gz" - echo "(or a newer version if it is available)" - DIE=1 - } -} - -grep "^AM_GNU_GETTEXT" $srcdir/configure.ac >/dev/null && { - grep "sed.*POTFILES" $srcdir/configure.ac >/dev/null || \ - (gettext --version) < /dev/null > /dev/null 2>&1 || { - echo - echo "**Error**: You must have \`gettext' installed to compile Mono." - echo "Get ftp://alpha.gnu.org/gnu/gettext-0.10.35.tar.gz" - echo "(or a newer version if it is available)" - DIE=1 - } -} - -(automake --version) < /dev/null > /dev/null 2>&1 || { - echo - echo "**Error**: You must have \`automake' installed to compile Mono." - echo "Get ftp://ftp.gnu.org/pub/gnu/automake-1.3.tar.gz" - echo "(or a newer version if it is available)" - DIE=1 - NO_AUTOMAKE=yes -} - - -# if no automake, don't bother testing for aclocal -test -n "$NO_AUTOMAKE" || (aclocal --version) < /dev/null > /dev/null 2>&1 || { - echo - echo "**Error**: Missing \`aclocal'. The version of \`automake'" - echo "installed doesn't appear recent enough." - echo "Get ftp://ftp.gnu.org/pub/gnu/automake-1.3.tar.gz" - echo "(or a newer version if it is available)" - DIE=1 -} - -if test "$DIE" -eq 1; then - exit 1 -fi - -if test -z "$*"; then - echo "**Warning**: I am going to run \`configure' with no arguments." - echo "If you wish to pass any to it, please specify them on the" - echo \`$0\'" command line." - echo -fi - -case $CC in -xlc ) - am_opt=--include-deps;; -esac - - -if grep "^AM_PROG_LIBTOOL" configure.ac >/dev/null; then - if test -z "$NO_LIBTOOLIZE" ; then - echo "Running libtoolize..." - ${LIBTOOL}ize --force --copy - fi -fi - -echo "Running aclocal $ACLOCAL_FLAGS ..." -aclocal $ACLOCAL_FLAGS || { - echo - echo "**Error**: aclocal failed. This may mean that you have not" - echo "installed all of the packages you need, or you may need to" - echo "set ACLOCAL_FLAGS to include \"-I \$prefix/share/aclocal\"" - echo "for the prefix where you installed the packages whose" - echo "macros were not found" - exit 1 -} - -if grep "^AM_CONFIG_HEADER" configure.ac >/dev/null; then - echo "Running autoheader..." - autoheader || { echo "**Error**: autoheader failed."; exit 1; } -fi - -echo "Running automake --gnu $am_opt ..." -automake --add-missing --gnu $am_opt || - { echo "**Error**: automake failed."; exit 1; } -echo "Running autoconf ..." -autoconf || { echo "**Error**: autoconf failed."; exit 1; } - - -echo Running /autogen.sh ... -(cd $srcdir/ ; NOCONFIGURE=1 /bin/sh ./autogen.sh "$@") -echo Done running /autogen.sh ... - - -conf_flags="--enable-maintainer-mode --enable-compile-warnings" #--enable-iso-c - -if test x$NOCONFIGURE = x; then - echo Running $srcdir/configure $conf_flags "$@" ... - $srcdir/configure $conf_flags "$@" \ - && echo Now type \`make\' to compile $PKG_NAME || exit 1 -else - echo Skipping configure process. -fi - - - - - - - - - - -AC_INIT([]-solution,[]) -AC_CONFIG_AUX_DIR(.) -AM_INIT_AUTOMAKE([1.9 tar-ustar foreign]) -EXTRA_DIST="install-sh missing" -SOLUTION_NAME= -SOLUTION_VERSION=$VERSION -SOLUTION_DESCRIPTION="" -AC_SUBST(DESCRIPTION) - -AM_MAINTAINER_MODE - -dnl AC_PROG_INTLTOOL([0.25]) - -AC_PROG_INSTALL - -AC_MSG_CHECKING([whether we're building from an RCS]) -if test -f "$srcdir/.cvs_version" ; then - from_rcs=cvs -else - if test -f "$srcdir/.svn/entries" ; then - from_rcs=svn - else - from_rcs=no - fi -fi - -AC_MSG_RESULT($from_rcs) - -CONFIG="Release" -AC_SUBST(CONFIG) - -AC_CONFIG_SUBDIRS( -) - - -AC_OUTPUT([ -Makefile -]) - -echo "===" -echo "" -echo "Solution configuration summary" -echo "" -echo " * Solution Name: $SOLUTION_NAME" -echo " * Version: $SOLUTION_VERSION" -echo " * Packages:" -echo " - " -echo "" -echo "===" - - - - - - - - - SUBDIRS = - - - - - - - - - - - - -#! /bin/sh - -PACKAGE= -prefix=@prefix@ -exec_prefix=@exec_prefix@ - -# %%$@%$# why oh why isn't it $sharedir/ -# Day changed to 30 Mar 2007 -# ... -# 07:50 < cj> why are we installing .exe assemblies to $prefix/lib/$package/ and -# not $prefix/share/$package ? -# 07:50 < jonp> momentum. -# 07:50 < jonp> and it's hard to say that a .exe isn't platform specific -# 07:50 < jonp> as it can still contain DllImport's which make platform -# assumptions - -packagedir=$prefix/lib/ -export MONO_PATH=$MONO_PATH - -exec @RUNTIME@ $packagedir/$PACKAGE.exe "$@" - - - - - diff --git a/Prebuild/src/data/.svn/text-base/dnpb-1.0.xsd.svn-base b/Prebuild/src/data/.svn/text-base/dnpb-1.0.xsd.svn-base deleted file mode 100644 index b9e0e4e..0000000 --- a/Prebuild/src/data/.svn/text-base/dnpb-1.0.xsd.svn-base +++ /dev/null @@ -1,183 +0,0 @@ - - - - - Copyright (c) 2004 Matthew Holmes (kerion@houston.rr.com) - - Redistribution and use in source and binary forms, with or without modification, are permitted - provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, this list of conditions - and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, this list of conditions - and the following disclaimer in the documentation and/or other materials provided with the - distribution. - * The name of the author may not be used to endorse or promote products derived from this software - without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, - BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY - OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING - IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/Prebuild/src/data/.svn/text-base/dnpb-1.1.xsd.svn-base b/Prebuild/src/data/.svn/text-base/dnpb-1.1.xsd.svn-base deleted file mode 100644 index 2c065a3..0000000 --- a/Prebuild/src/data/.svn/text-base/dnpb-1.1.xsd.svn-base +++ /dev/null @@ -1,184 +0,0 @@ - - - - - Copyright (c) 2004 Matthew Holmes (kerion@houston.rr.com) - - Redistribution and use in source and binary forms, with or without modification, are permitted - provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, this list of conditions - and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, this list of conditions - and the following disclaimer in the documentation and/or other materials provided with the - distribution. - * The name of the author may not be used to endorse or promote products derived from this software - without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, - BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY - OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING - IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/Prebuild/src/data/.svn/text-base/dnpb-1.2.xsd.svn-base b/Prebuild/src/data/.svn/text-base/dnpb-1.2.xsd.svn-base deleted file mode 100644 index d694ab4..0000000 --- a/Prebuild/src/data/.svn/text-base/dnpb-1.2.xsd.svn-base +++ /dev/null @@ -1,198 +0,0 @@ - - - - - Copyright (c) 2004 Matthew Holmes (calefaction _at_ houston _._ rr _._ com) - - Redistribution and use in source and binary forms, with or without modification, are permitted - provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, this list of conditions - and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, this list of conditions - and the following disclaimer in the documentation and/or other materials provided with the - distribution. - * The name of the author may not be used to endorse or promote products derived from this software - without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, - BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY - OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING - IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/Prebuild/src/data/.svn/text-base/dnpb-1.3.xsd.svn-base b/Prebuild/src/data/.svn/text-base/dnpb-1.3.xsd.svn-base deleted file mode 100644 index 8f31a54..0000000 --- a/Prebuild/src/data/.svn/text-base/dnpb-1.3.xsd.svn-base +++ /dev/null @@ -1,206 +0,0 @@ - - - - - Copyright (c) 2004-2005 Matthew Holmes (calefaction at houston . rr . com), Dan Moorehead (dan05a at gmail . com) - - .NET Pre-Build is an XML-driven pre-build tool allowing developers to - easily generate project or make files for major IDE's and .NET - development tools including: Visual Studio 2003, Visual Studio 2002, - SharpDevelop, MonoDevelop, and NAnt. - - BSD License: - - Redistribution and use in source and binary forms, with or without modification, are permitted - provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, this list of conditions - and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, this list of conditions - and the following disclaimer in the documentation and/or other materials provided with the - distribution. - * The name of the author may not be used to endorse or promote products derived from this software - without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR 'AS IS' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, - BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY - OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING - IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/Prebuild/src/data/.svn/text-base/dnpb-1.4.xsd.svn-base b/Prebuild/src/data/.svn/text-base/dnpb-1.4.xsd.svn-base deleted file mode 100644 index 1da50fc..0000000 --- a/Prebuild/src/data/.svn/text-base/dnpb-1.4.xsd.svn-base +++ /dev/null @@ -1,212 +0,0 @@ - - - - - Copyright (c) 2004-2005 Matthew Holmes (calefaction at houston . rr . com), Dan Moorehead (dan05a at gmail . com) - - .NET Prebuild is a cross-platform XML-driven pre-build tool which - allows developers to easily generate project or make files for major - IDE's and .NET development tools including: Visual Studio .NET 2002 and - 2003, SharpDevelop, MonoDevelop, and NAnt. - - BSD License: - - Redistribution and use in source and binary forms, with or without modification, are permitted - provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, this list of conditions - and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, this list of conditions - and the following disclaimer in the documentation and/or other materials provided with the - distribution. - * The name of the author may not be used to endorse or promote products derived from this software - without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR 'AS IS' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, - BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY - OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING - IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Prebuild/src/data/.svn/text-base/dnpb-1.5.xsd.svn-base b/Prebuild/src/data/.svn/text-base/dnpb-1.5.xsd.svn-base deleted file mode 100644 index e2b21f0..0000000 --- a/Prebuild/src/data/.svn/text-base/dnpb-1.5.xsd.svn-base +++ /dev/null @@ -1,215 +0,0 @@ - - - - - Copyright (c) 2004-2005 Matthew Holmes (calefaction at houston . rr . com), Dan Moorehead (dan05a at gmail . com) - - .NET Prebuild is a cross-platform XML-driven pre-build tool which - allows developers to easily generate project or make files for major - IDE's and .NET development tools including: Visual Studio .NET 2002 and - 2003, SharpDevelop, MonoDevelop, and NAnt. - - BSD License: - - Redistribution and use in source and binary forms, with or without modification, are permitted - provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, this list of conditions - and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, this list of conditions - and the following disclaimer in the documentation and/or other materials provided with the - distribution. - * The name of the author may not be used to endorse or promote products derived from this software - without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR 'AS IS' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, - BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY - OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING - IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Prebuild/src/data/.svn/text-base/prebuild-1.6.xsd.svn-base b/Prebuild/src/data/.svn/text-base/prebuild-1.6.xsd.svn-base deleted file mode 100644 index 57ebd2e..0000000 --- a/Prebuild/src/data/.svn/text-base/prebuild-1.6.xsd.svn-base +++ /dev/null @@ -1,231 +0,0 @@ - - - - - Copyright (c) 2004-2005 Matthew Holmes (calefaction at houston . rr . com), Dan Moorehead (dan05a at gmail . com) - - .NET Prebuild is a cross-platform XML-driven pre-build tool which - allows developers to easily generate project or make files for major - IDE's and .NET development tools including: Visual Studio .NET 2002 and - 2003, SharpDevelop, MonoDevelop, and NAnt. - - BSD License: - - Redistribution and use in source and binary forms, with or without modification, are permitted - provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, this list of conditions - and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, this list of conditions - and the following disclaimer in the documentation and/or other materials provided with the - distribution. - * The name of the author may not be used to endorse or promote products derived from this software - without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR 'AS IS' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, - BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY - OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING - IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Prebuild/src/data/.svn/text-base/prebuild-1.7.xsd.svn-base b/Prebuild/src/data/.svn/text-base/prebuild-1.7.xsd.svn-base deleted file mode 100644 index 3675503..0000000 --- a/Prebuild/src/data/.svn/text-base/prebuild-1.7.xsd.svn-base +++ /dev/null @@ -1,350 +0,0 @@ - - - - - Copyright (c) 2004-2007 - Matthew Holmes (calefaction at houston . rr . com), - Dan Moorehead (dan05a at gmail . com), - David Hudson (jendave at yahoo dot com), - C.J. Adams-Collier (cjac at colliertech dot com) - - .NET Prebuild is a cross-platform XML-driven pre-build tool which - allows developers to easily generate project or make files for major - IDE's and .NET development tools including: Visual Studio .NET 2002, - 2003, and 2005, SharpDevelop, MonoDevelop, NAnt, Xcode and the GNU Autotools. - - BSD License: - - Redistribution and use in source and binary forms, with or without modification, are permitted - provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, this list of conditions - and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, this list of conditions - and the following disclaimer in the documentation and/or other materials provided with the - distribution. - * The name of the author may not be used to endorse or promote products derived from this software - without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR 'AS IS' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, - BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY - OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING - IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Prebuild/src/data/.svn/text-base/prebuild-1.8.xsd.svn-base b/Prebuild/src/data/.svn/text-base/prebuild-1.8.xsd.svn-base deleted file mode 100644 index 8f5c1a4..0000000 --- a/Prebuild/src/data/.svn/text-base/prebuild-1.8.xsd.svn-base +++ /dev/null @@ -1,331 +0,0 @@ - - - - - Copyright (c) 2004-2007 - Matthew Holmes (calefaction at houston . rr . com), - Dan Moorehead (dan05a at gmail . com), - David Hudson (jendave at yahoo dot com), - C.J. Adams-Collier (cjac at colliertech dot com) - - .NET Prebuild is a cross-platform XML-driven pre-build tool which - allows developers to easily generate project or make files for major - IDE's and .NET development tools including: Visual Studio .NET 2002, - 2003, and 2005, SharpDevelop, MonoDevelop, NAnt, Xcode and the GNU Autotools. - - BSD License: - - Redistribution and use in source and binary forms, with or without modification, are permitted - provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, this list of conditions - and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, this list of conditions - and the following disclaimer in the documentation and/or other materials provided with the - distribution. - * The name of the author may not be used to endorse or promote products derived from this software - without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR 'AS IS' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, - BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY - OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING - IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Prebuild/src/data/.svn/text-base/prebuild-1.9.xsd.svn-base b/Prebuild/src/data/.svn/text-base/prebuild-1.9.xsd.svn-base deleted file mode 100644 index fbca556..0000000 --- a/Prebuild/src/data/.svn/text-base/prebuild-1.9.xsd.svn-base +++ /dev/null @@ -1,336 +0,0 @@ - - - - - Copyright (c) 2004-2007 - Matthew Holmes (calefaction at houston . rr . com), - Dan Moorehead (dan05a at gmail . com), - David Hudson (jendave at yahoo dot com), - C.J. Adams-Collier (cjac at colliertech dot com) - - .NET Prebuild is a cross-platform XML-driven pre-build tool which - allows developers to easily generate project or make files for major - IDE's and .NET development tools including: Visual Studio .NET 2002, - 2003, and 2005, SharpDevelop, MonoDevelop, NAnt, Xcode and the GNU Autotools. - - BSD License: - - Redistribution and use in source and binary forms, with or without modification, are permitted - provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, this list of conditions - and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, this list of conditions - and the following disclaimer in the documentation and/or other materials provided with the - distribution. - * The name of the author may not be used to endorse or promote products derived from this software - without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR 'AS IS' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, - BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY - OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING - IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Prebuild/tests/.svn/all-wcprops b/Prebuild/tests/.svn/all-wcprops deleted file mode 100644 index 0668acb..0000000 --- a/Prebuild/tests/.svn/all-wcprops +++ /dev/null @@ -1,59 +0,0 @@ -K 25 -svn:wc:ra_dav:version-url -V 47 -/svnroot/dnpb/!svn/ver/280/trunk/Prebuild/tests -END -include-001.expected -K 25 -svn:wc:ra_dav:version-url -V 68 -/svnroot/dnpb/!svn/ver/279/trunk/Prebuild/tests/include-001.expected -END -include-002.expected -K 25 -svn:wc:ra_dav:version-url -V 68 -/svnroot/dnpb/!svn/ver/280/trunk/Prebuild/tests/include-002.expected -END -include-001.include -K 25 -svn:wc:ra_dav:version-url -V 67 -/svnroot/dnpb/!svn/ver/279/trunk/Prebuild/tests/include-001.include -END -include-002-2.include -K 25 -svn:wc:ra_dav:version-url -V 69 -/svnroot/dnpb/!svn/ver/280/trunk/Prebuild/tests/include-002-2.include -END -include-002.include -K 25 -svn:wc:ra_dav:version-url -V 67 -/svnroot/dnpb/!svn/ver/280/trunk/Prebuild/tests/include-002.include -END -include-001.prebuild -K 25 -svn:wc:ra_dav:version-url -V 68 -/svnroot/dnpb/!svn/ver/279/trunk/Prebuild/tests/include-001.prebuild -END -include-002.prebuild -K 25 -svn:wc:ra_dav:version-url -V 68 -/svnroot/dnpb/!svn/ver/280/trunk/Prebuild/tests/include-002.prebuild -END -README.txt -K 25 -svn:wc:ra_dav:version-url -V 58 -/svnroot/dnpb/!svn/ver/279/trunk/Prebuild/tests/README.txt -END -Makefile -K 25 -svn:wc:ra_dav:version-url -V 56 -/svnroot/dnpb/!svn/ver/279/trunk/Prebuild/tests/Makefile -END diff --git a/Prebuild/tests/.svn/entries b/Prebuild/tests/.svn/entries deleted file mode 100644 index 2a70cf9..0000000 --- a/Prebuild/tests/.svn/entries +++ /dev/null @@ -1,334 +0,0 @@ -10 - -dir -323 -https://dnpb.svn.sourceforge.net/svnroot/dnpb/trunk/Prebuild/tests -https://dnpb.svn.sourceforge.net/svnroot/dnpb - - - -2008-12-10T02:26:03.443834Z -280 -dmoonfire - - - - - - - - - - - - - - -3355ff64-970d-0410-bbe8-d0fbd18be4fb - -include-001.expected -file - - - - -2010-09-10T22:51:45.000000Z -d65010a81975867917d4468950ec7ccc -2008-12-10T02:04:22.474237Z -279 -dmoonfire - - - - - - - - - - - - - - - - - - - - - -1784 - -include-002.expected -file - - - - -2010-09-10T22:51:45.000000Z -dcef68172b57f9e1b2228f1dba535934 -2008-12-10T02:26:03.443834Z -280 -dmoonfire - - - - - - - - - - - - - - - - - - - - - -1150 - -include-001.include -file - - - - -2010-09-10T22:51:45.000000Z -92601282deffe7c461f80b407525446d -2008-12-10T02:04:22.474237Z -279 -dmoonfire - - - - - - - - - - - - - - - - - - - - - -983 - -include-002-2.include -file - - - - -2010-09-10T22:51:45.000000Z -d9f24dc85d95d7310516187910433c8c -2008-12-10T02:26:03.443834Z -280 -dmoonfire - - - - - - - - - - - - - - - - - - - - - -307 - -include-002.include -file - - - - -2010-09-10T22:51:45.000000Z -44815ffa6c2dc32d4df9977b5fe49ca4 -2008-12-10T02:26:03.443834Z -280 -dmoonfire - - - - - - - - - - - - - - - - - - - - - -332 - -include-001.prebuild -file - - - - -2010-09-10T22:51:45.000000Z -d01a5391189ada3dcd7d3becf254f151 -2008-12-10T02:04:22.474237Z -279 -dmoonfire - - - - - - - - - - - - - - - - - - - - - -742 - -include-002.prebuild -file - - - - -2010-09-10T22:51:45.000000Z -22ad11b07dd489b41ec998e03c83a397 -2008-12-10T02:26:03.443834Z -280 -dmoonfire - - - - - - - - - - - - - - - - - - - - - -289 - -README.txt -file - - - - -2010-09-10T22:51:45.000000Z -6b111c08a76e929cb94b77c99774ef78 -2008-12-10T02:04:22.474237Z -279 -dmoonfire - - - - - - - - - - - - - - - - - - - - - -326 - -Makefile -file - - - - -2010-09-10T22:51:45.000000Z -eed6712c3f5e4478d92137f6657aba56 -2008-12-10T02:04:22.474237Z -279 -dmoonfire - - - - - - - - - - - - - - - - - - - - - -456 - diff --git a/Prebuild/tests/.svn/text-base/Makefile.svn-base b/Prebuild/tests/.svn/text-base/Makefile.svn-base deleted file mode 100644 index 4a8ddf4..0000000 --- a/Prebuild/tests/.svn/text-base/Makefile.svn-base +++ /dev/null @@ -1,24 +0,0 @@ -# -# Executable -# - -# Executables -PREBUILD = mono ../src/bin/Release/prebuild.exe /target makefile - -# Files -PREBUILDS = $(wildcard *.prebuild) -RESULTS = $(PREBUILDS:prebuild=results) -TESTS = $(PREBUILDS:prebuild=test) - -all: $(TESTS) - -clean: - rm -f *~ *.log - rm -f $(RESULTS) - -%.test: %.prebuild - $(PREBUILD) /log $*.log /file $*.prebuild /ppi $*.results >& /dev/null - if ! cmp $*.expected $*.results; then \ - echo $*.prebuild failed; \ - false; \ - fi diff --git a/Prebuild/tests/.svn/text-base/README.txt.svn-base b/Prebuild/tests/.svn/text-base/README.txt.svn-base deleted file mode 100644 index 2c2de3b..0000000 --- a/Prebuild/tests/.svn/text-base/README.txt.svn-base +++ /dev/null @@ -1,5 +0,0 @@ -There are some tests that are run via a Makfile in this -directory. They haven't been included in any form of unit tests, but -they are there to help test the functionality in some what. Simply -build prebuild (so there is a src/bin/Release/prebuild.exe) and type -`make` in this directory. Everything should pass without errors. diff --git a/Prebuild/tests/.svn/text-base/include-001.expected.svn-base b/Prebuild/tests/.svn/text-base/include-001.expected.svn-base deleted file mode 100644 index 26374b5..0000000 --- a/Prebuild/tests/.svn/text-base/include-001.expected.svn-base +++ /dev/null @@ -1,46 +0,0 @@ - - - - - DEBUG;TRACE - false - bin/Debug - true - - - - - TRACE - bin/Release - true - false - - - - - - DEBUG;TRACE - false - bin/Debug - true - Prebuild.snk - 1595 - - - - - TRACE - bin/Release - true - false - Prebuild.snk - 1595 - - - - - - - - - diff --git a/Prebuild/tests/.svn/text-base/include-001.include.svn-base b/Prebuild/tests/.svn/text-base/include-001.include.svn-base deleted file mode 100644 index 7f75962..0000000 --- a/Prebuild/tests/.svn/text-base/include-001.include.svn-base +++ /dev/null @@ -1,33 +0,0 @@ - - - - DEBUG;TRACE - false - bin/Debug - true - Prebuild.snk - 1595 - - - - - TRACE - bin/Release - true - false - Prebuild.snk - 1595 - - - - - - - diff --git a/Prebuild/tests/.svn/text-base/include-001.prebuild.svn-base b/Prebuild/tests/.svn/text-base/include-001.prebuild.svn-base deleted file mode 100644 index 8047008..0000000 --- a/Prebuild/tests/.svn/text-base/include-001.prebuild.svn-base +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - DEBUG;TRACE - false - bin/Debug - true - - - - - TRACE - bin/Release - true - false - - - - - diff --git a/Prebuild/tests/.svn/text-base/include-002-2.include.svn-base b/Prebuild/tests/.svn/text-base/include-002-2.include.svn-base deleted file mode 100644 index 661b7f3..0000000 --- a/Prebuild/tests/.svn/text-base/include-002-2.include.svn-base +++ /dev/null @@ -1,8 +0,0 @@ - - - DEBUG;TRACE - false - bin/Debug - true - - diff --git a/Prebuild/tests/.svn/text-base/include-002.expected.svn-base b/Prebuild/tests/.svn/text-base/include-002.expected.svn-base deleted file mode 100644 index 9849658..0000000 --- a/Prebuild/tests/.svn/text-base/include-002.expected.svn-base +++ /dev/null @@ -1,26 +0,0 @@ - - - - - DEBUG;TRACE - false - bin/Debug - true - - - - - - DEBUG;TRACE - false - bin/Debug - true - - - - - - - - - diff --git a/Prebuild/tests/.svn/text-base/include-002.include.svn-base b/Prebuild/tests/.svn/text-base/include-002.include.svn-base deleted file mode 100644 index 64f4058..0000000 --- a/Prebuild/tests/.svn/text-base/include-002.include.svn-base +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - diff --git a/Prebuild/tests/.svn/text-base/include-002.prebuild.svn-base b/Prebuild/tests/.svn/text-base/include-002.prebuild.svn-base deleted file mode 100644 index 9e85f20..0000000 --- a/Prebuild/tests/.svn/text-base/include-002.prebuild.svn-base +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - -- cgit v1.1 From 47ac9f97b11ae9de535550ba7e6c836ee81dab55 Mon Sep 17 00:00:00 2001 From: John Hurliman Date: Sat, 11 Sep 2010 18:29:38 -0700 Subject: Re-enabled asset last access time logging in MySQL --- OpenSim/Data/MySQL/MySQLAssetData.cs | 3 --- 1 file changed, 3 deletions(-) diff --git a/OpenSim/Data/MySQL/MySQLAssetData.cs b/OpenSim/Data/MySQL/MySQLAssetData.cs index fe5152a..ed92f3e 100644 --- a/OpenSim/Data/MySQL/MySQLAssetData.cs +++ b/OpenSim/Data/MySQL/MySQLAssetData.cs @@ -214,9 +214,6 @@ namespace OpenSim.Data.MySQL private void UpdateAccessTime(AssetBase asset) { - // Writing to the database every time Get() is called on an asset is killing us. Seriously. -jph - return; - lock (m_dbLock) { using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) -- cgit v1.1 From 109b51758398d24a96a16900e8feb24361aee29d Mon Sep 17 00:00:00 2001 From: John Hurliman Date: Sat, 11 Sep 2010 20:43:06 -0700 Subject: Fixed the naming mess around data connectors for simulation data --- OpenSim/Data/MSSQL/MSSQLLegacyRegionData.cs | 1572 ------------- OpenSim/Data/MSSQL/MSSQLSimulationData.cs | 1572 +++++++++++++ OpenSim/Data/MySQL/MySQLLegacyRegionData.cs | 1820 --------------- OpenSim/Data/MySQL/MySQLSimulationData.cs | 1820 +++++++++++++++ OpenSim/Data/Null/NullDataStore.cs | 112 - OpenSim/Data/Null/NullSimulationData.cs | 112 + OpenSim/Data/SQLite/SQLiteRegionData.cs | 2355 -------------------- OpenSim/Data/SQLite/SQLiteSimulationData.cs | 2355 ++++++++++++++++++++ OpenSim/Data/SQLiteLegacy/SQLiteRegionData.cs | 2261 ------------------- OpenSim/Data/SQLiteLegacy/SQLiteSimulationData.cs | 2261 +++++++++++++++++++ OpenSim/Data/Tests/RegionTests.cs | 12 +- .../Framework/Interfaces/IEntityInventory.cs | 2 +- .../Framework/Interfaces/IRegionDataStore.cs | 111 - .../Framework/Interfaces/ISimulationDataStore.cs | 111 + OpenSim/Region/Framework/Scenes/EventManager.cs | 4 +- .../Region/Framework/Scenes/SceneObjectGroup.cs | 2 +- .../Framework/Scenes/SceneObjectPartInventory.cs | 2 +- OpenSim/Region/Framework/StorageManager.cs | 10 +- OpenSim/Tests/Common/Mock/MockRegionDataPlugin.cs | 2 +- 19 files changed, 8248 insertions(+), 8248 deletions(-) delete mode 100644 OpenSim/Data/MSSQL/MSSQLLegacyRegionData.cs create mode 100644 OpenSim/Data/MSSQL/MSSQLSimulationData.cs delete mode 100644 OpenSim/Data/MySQL/MySQLLegacyRegionData.cs create mode 100644 OpenSim/Data/MySQL/MySQLSimulationData.cs delete mode 100644 OpenSim/Data/Null/NullDataStore.cs create mode 100644 OpenSim/Data/Null/NullSimulationData.cs delete mode 100644 OpenSim/Data/SQLite/SQLiteRegionData.cs create mode 100644 OpenSim/Data/SQLite/SQLiteSimulationData.cs delete mode 100644 OpenSim/Data/SQLiteLegacy/SQLiteRegionData.cs create mode 100644 OpenSim/Data/SQLiteLegacy/SQLiteSimulationData.cs delete mode 100644 OpenSim/Region/Framework/Interfaces/IRegionDataStore.cs create mode 100644 OpenSim/Region/Framework/Interfaces/ISimulationDataStore.cs diff --git a/OpenSim/Data/MSSQL/MSSQLLegacyRegionData.cs b/OpenSim/Data/MSSQL/MSSQLLegacyRegionData.cs deleted file mode 100644 index 77b8a10..0000000 --- a/OpenSim/Data/MSSQL/MSSQLLegacyRegionData.cs +++ /dev/null @@ -1,1572 +0,0 @@ -/* - * Copyright (c) Contributors, http://opensimulator.org/ - * See CONTRIBUTORS.TXT for a full list of copyright holders. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of the OpenSimulator Project nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -using System; -using System.Collections.Generic; -using System.Data; -using System.Data.SqlClient; -using System.Drawing; -using System.IO; -using System.Reflection; -using log4net; -using OpenMetaverse; -using OpenSim.Framework; -using OpenSim.Region.Framework.Interfaces; -using OpenSim.Region.Framework.Scenes; - -namespace OpenSim.Data.MSSQL -{ - /// - /// A MSSQL Interface for the Region Server. - /// - public class MSSQLRegionDataStore : IRegionDataStore - { - private const string _migrationStore = "RegionStore"; - - // private static FileSystemDataStore Instance = new FileSystemDataStore(); - private static readonly ILog _Log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - - /// - /// The database manager - /// - private MSSQLManager _Database; - private string m_connectionString; - /// - /// Initialises the region datastore - /// - /// The connection string. - public void Initialise(string connectionString) - { - m_connectionString = connectionString; - _Database = new MSSQLManager(connectionString); - - - //Migration settings - _Database.CheckMigration(_migrationStore); - } - - /// - /// Dispose the database - /// - public void Dispose() { } - - #region SceneObjectGroup region for loading and Store of the scene. - - /// - /// Loads the objects present in the region. - /// - /// The region UUID. - /// - public List LoadObjects(UUID regionUUID) - { - UUID lastGroupID = UUID.Zero; - - Dictionary prims = new Dictionary(); - Dictionary objects = new Dictionary(); - SceneObjectGroup grp = null; - - string sql = "SELECT *, " + - "sort = CASE WHEN prims.UUID = prims.SceneGroupID THEN 0 ELSE 1 END " + - "FROM prims " + - "LEFT JOIN primshapes ON prims.UUID = primshapes.UUID " + - "WHERE RegionUUID = @RegionUUID " + - "ORDER BY SceneGroupID asc, sort asc, LinkNumber asc"; - - using (SqlConnection conn = new SqlConnection(m_connectionString)) - using (SqlCommand command = new SqlCommand(sql, conn)) - { - command.Parameters.Add(_Database.CreateParameter("@regionUUID", regionUUID)); - conn.Open(); - using (SqlDataReader reader = command.ExecuteReader()) - { - while (reader.Read()) - { - SceneObjectPart sceneObjectPart = BuildPrim(reader); - if (reader["Shape"] is DBNull) - sceneObjectPart.Shape = PrimitiveBaseShape.Default; - else - sceneObjectPart.Shape = BuildShape(reader); - - prims[sceneObjectPart.UUID] = sceneObjectPart; - - UUID groupID = new UUID((Guid)reader["SceneGroupID"]); - - if (groupID != lastGroupID) // New SOG - { - if (grp != null) - objects[grp.UUID] = grp; - - lastGroupID = groupID; - - // There sometimes exist OpenSim bugs that 'orphan groups' so that none of the prims are - // recorded as the root prim (for which the UUID must equal the persisted group UUID). In - // this case, force the UUID to be the same as the group UUID so that at least these can be - // deleted (we need to change the UUID so that any other prims in the linkset can also be - // deleted). - if (sceneObjectPart.UUID != groupID && groupID != UUID.Zero) - { - _Log.WarnFormat( - "[REGION DB]: Found root prim {0} {1} at {2} where group was actually {3}. Forcing UUID to group UUID", - sceneObjectPart.Name, sceneObjectPart.UUID, sceneObjectPart.GroupPosition, groupID); - - sceneObjectPart.UUID = groupID; - } - - grp = new SceneObjectGroup(sceneObjectPart); - } - else - { - // Black magic to preserve link numbers - // Why is this needed, fix this in AddPart method. - int link = sceneObjectPart.LinkNum; - - grp.AddPart(sceneObjectPart); - - if (link != 0) - sceneObjectPart.LinkNum = link; - } - } - } - } - - if (grp != null) - objects[grp.UUID] = grp; - - // Instead of attempting to LoadItems on every prim, - // most of which probably have no items... get a - // list from DB of all prims which have items and - // LoadItems only on those - List primsWithInventory = new List(); - string qry = "select distinct primID from primitems"; - using (SqlConnection conn = new SqlConnection(m_connectionString)) - using (SqlCommand command = new SqlCommand(qry, conn)) - { - conn.Open(); - using (SqlDataReader itemReader = command.ExecuteReader()) - { - while (itemReader.Read()) - { - if (!(itemReader["primID"] is DBNull)) - { - UUID primID = new UUID(itemReader["primID"].ToString()); - if (prims.ContainsKey(primID)) - { - primsWithInventory.Add(prims[primID]); - } - } - } - } - } - - LoadItems(primsWithInventory); - - _Log.DebugFormat("[REGION DB]: Loaded {0} objects using {1} prims", objects.Count, prims.Count); - - return new List(objects.Values); - } - - /// - /// Load in the prim's persisted inventory. - /// - /// all prims with inventory on a region - private void LoadItems(List allPrimsWithInventory) - { - string sql = "SELECT * FROM primitems WHERE PrimID = @PrimID"; - using (SqlConnection conn = new SqlConnection(m_connectionString)) - using (SqlCommand command = new SqlCommand(sql, conn)) - { - conn.Open(); - foreach (SceneObjectPart objectPart in allPrimsWithInventory) - { - command.Parameters.Clear(); - command.Parameters.Add(_Database.CreateParameter("@PrimID", objectPart.UUID)); - - List inventory = new List(); - - using (SqlDataReader reader = command.ExecuteReader()) - { - while (reader.Read()) - { - TaskInventoryItem item = BuildItem(reader); - - item.ParentID = objectPart.UUID; // Values in database are - // often wrong - inventory.Add(item); - } - } - - objectPart.Inventory.RestoreInventoryItems(inventory); - } - } - } - - /// - /// Stores all object's details apart from inventory - /// - /// - /// - public void StoreObject(SceneObjectGroup obj, UUID regionUUID) - { - _Log.DebugFormat("[MSSQL]: Adding/Changing SceneObjectGroup: {0} to region: {1}, object has {2} prims.", obj.UUID, regionUUID, obj.Children.Count); - - using (SqlConnection conn = new SqlConnection(m_connectionString)) - { - conn.Open(); - SqlTransaction transaction = conn.BeginTransaction(); - - try - { - foreach (SceneObjectPart sceneObjectPart in obj.Children.Values) - { - //Update prim - using (SqlCommand sqlCommand = conn.CreateCommand()) - { - sqlCommand.Transaction = transaction; - try - { - StoreSceneObjectPrim(sceneObjectPart, sqlCommand, obj.UUID, regionUUID); - } - catch (SqlException sqlEx) - { - _Log.ErrorFormat("[REGION DB]: Store SceneObjectPrim SQL error: {0} at line {1}", sqlEx.Message, sqlEx.LineNumber); - throw; - } - } - - //Update primshapes - using (SqlCommand sqlCommand = conn.CreateCommand()) - { - sqlCommand.Transaction = transaction; - try - { - StoreSceneObjectPrimShapes(sceneObjectPart, sqlCommand, obj.UUID, regionUUID); - } - catch (SqlException sqlEx) - { - _Log.ErrorFormat("[REGION DB]: Store SceneObjectPrimShapes SQL error: {0} at line {1}", sqlEx.Message, sqlEx.LineNumber); - throw; - } - } - } - - transaction.Commit(); - } - catch (Exception ex) - { - _Log.ErrorFormat("[REGION DB]: Store SceneObjectGroup error: {0}, Rolling back...", ex.Message); - try - { - transaction.Rollback(); - } - catch (Exception ex2) - { - //Show error - _Log.InfoFormat("[REGION DB]: Rollback of SceneObjectGroup store transaction failed with error: {0}", ex2.Message); - - } - } - } - } - - /// - /// Stores the prim of the sceneobjectpart. - /// - /// The sceneobjectpart or prim. - /// The SQL command with the transaction. - /// The scenegroup UUID. - /// The region UUID. - private void StoreSceneObjectPrim(SceneObjectPart sceneObjectPart, SqlCommand sqlCommand, UUID sceneGroupID, UUID regionUUID) - { - //Big query to update or insert a new prim. - //Note for SQL Server 2008 this could be simplified - string queryPrims = @" -IF EXISTS (SELECT UUID FROM prims WHERE UUID = @UUID) - BEGIN - UPDATE prims SET - CreationDate = @CreationDate, Name = @Name, Text = @Text, Description = @Description, SitName = @SitName, - TouchName = @TouchName, ObjectFlags = @ObjectFlags, OwnerMask = @OwnerMask, NextOwnerMask = @NextOwnerMask, GroupMask = @GroupMask, - EveryoneMask = @EveryoneMask, BaseMask = @BaseMask, PositionX = @PositionX, PositionY = @PositionY, PositionZ = @PositionZ, - GroupPositionX = @GroupPositionX, GroupPositionY = @GroupPositionY, GroupPositionZ = @GroupPositionZ, VelocityX = @VelocityX, - VelocityY = @VelocityY, VelocityZ = @VelocityZ, AngularVelocityX = @AngularVelocityX, AngularVelocityY = @AngularVelocityY, - AngularVelocityZ = @AngularVelocityZ, AccelerationX = @AccelerationX, AccelerationY = @AccelerationY, - AccelerationZ = @AccelerationZ, RotationX = @RotationX, RotationY = @RotationY, RotationZ = @RotationZ, RotationW = @RotationW, - SitTargetOffsetX = @SitTargetOffsetX, SitTargetOffsetY = @SitTargetOffsetY, SitTargetOffsetZ = @SitTargetOffsetZ, - SitTargetOrientW = @SitTargetOrientW, SitTargetOrientX = @SitTargetOrientX, SitTargetOrientY = @SitTargetOrientY, - SitTargetOrientZ = @SitTargetOrientZ, RegionUUID = @RegionUUID, CreatorID = @CreatorID, OwnerID = @OwnerID, GroupID = @GroupID, - LastOwnerID = @LastOwnerID, SceneGroupID = @SceneGroupID, PayPrice = @PayPrice, PayButton1 = @PayButton1, PayButton2 = @PayButton2, - PayButton3 = @PayButton3, PayButton4 = @PayButton4, LoopedSound = @LoopedSound, LoopedSoundGain = @LoopedSoundGain, - TextureAnimation = @TextureAnimation, OmegaX = @OmegaX, OmegaY = @OmegaY, OmegaZ = @OmegaZ, CameraEyeOffsetX = @CameraEyeOffsetX, - CameraEyeOffsetY = @CameraEyeOffsetY, CameraEyeOffsetZ = @CameraEyeOffsetZ, CameraAtOffsetX = @CameraAtOffsetX, - CameraAtOffsetY = @CameraAtOffsetY, CameraAtOffsetZ = @CameraAtOffsetZ, ForceMouselook = @ForceMouselook, - ScriptAccessPin = @ScriptAccessPin, AllowedDrop = @AllowedDrop, DieAtEdge = @DieAtEdge, SalePrice = @SalePrice, - SaleType = @SaleType, ColorR = @ColorR, ColorG = @ColorG, ColorB = @ColorB, ColorA = @ColorA, ParticleSystem = @ParticleSystem, - ClickAction = @ClickAction, Material = @Material, CollisionSound = @CollisionSound, CollisionSoundVolume = @CollisionSoundVolume, PassTouches = @PassTouches, - LinkNumber = @LinkNumber, MediaURL = @MediaURL - WHERE UUID = @UUID - END -ELSE - BEGIN - INSERT INTO - prims ( - UUID, CreationDate, Name, Text, Description, SitName, TouchName, ObjectFlags, OwnerMask, NextOwnerMask, GroupMask, - EveryoneMask, BaseMask, PositionX, PositionY, PositionZ, GroupPositionX, GroupPositionY, GroupPositionZ, VelocityX, - VelocityY, VelocityZ, AngularVelocityX, AngularVelocityY, AngularVelocityZ, AccelerationX, AccelerationY, AccelerationZ, - RotationX, RotationY, RotationZ, RotationW, SitTargetOffsetX, SitTargetOffsetY, SitTargetOffsetZ, SitTargetOrientW, - SitTargetOrientX, SitTargetOrientY, SitTargetOrientZ, RegionUUID, CreatorID, OwnerID, GroupID, LastOwnerID, SceneGroupID, - PayPrice, PayButton1, PayButton2, PayButton3, PayButton4, LoopedSound, LoopedSoundGain, TextureAnimation, OmegaX, - OmegaY, OmegaZ, CameraEyeOffsetX, CameraEyeOffsetY, CameraEyeOffsetZ, CameraAtOffsetX, CameraAtOffsetY, CameraAtOffsetZ, - ForceMouselook, ScriptAccessPin, AllowedDrop, DieAtEdge, SalePrice, SaleType, ColorR, ColorG, ColorB, ColorA, - ParticleSystem, ClickAction, Material, CollisionSound, CollisionSoundVolume, PassTouches, LinkNumber, MediaURL - ) VALUES ( - @UUID, @CreationDate, @Name, @Text, @Description, @SitName, @TouchName, @ObjectFlags, @OwnerMask, @NextOwnerMask, @GroupMask, - @EveryoneMask, @BaseMask, @PositionX, @PositionY, @PositionZ, @GroupPositionX, @GroupPositionY, @GroupPositionZ, @VelocityX, - @VelocityY, @VelocityZ, @AngularVelocityX, @AngularVelocityY, @AngularVelocityZ, @AccelerationX, @AccelerationY, @AccelerationZ, - @RotationX, @RotationY, @RotationZ, @RotationW, @SitTargetOffsetX, @SitTargetOffsetY, @SitTargetOffsetZ, @SitTargetOrientW, - @SitTargetOrientX, @SitTargetOrientY, @SitTargetOrientZ, @RegionUUID, @CreatorID, @OwnerID, @GroupID, @LastOwnerID, @SceneGroupID, - @PayPrice, @PayButton1, @PayButton2, @PayButton3, @PayButton4, @LoopedSound, @LoopedSoundGain, @TextureAnimation, @OmegaX, - @OmegaY, @OmegaZ, @CameraEyeOffsetX, @CameraEyeOffsetY, @CameraEyeOffsetZ, @CameraAtOffsetX, @CameraAtOffsetY, @CameraAtOffsetZ, - @ForceMouselook, @ScriptAccessPin, @AllowedDrop, @DieAtEdge, @SalePrice, @SaleType, @ColorR, @ColorG, @ColorB, @ColorA, - @ParticleSystem, @ClickAction, @Material, @CollisionSound, @CollisionSoundVolume, @PassTouches, @LinkNumber, @MediaURL - ) - END"; - - //Set commandtext. - sqlCommand.CommandText = queryPrims; - //Add parameters - sqlCommand.Parameters.AddRange(CreatePrimParameters(sceneObjectPart, sceneGroupID, regionUUID)); - - //Execute the query. If it fails then error is trapped in calling function - sqlCommand.ExecuteNonQuery(); - } - - /// - /// Stores the scene object prim shapes. - /// - /// The sceneobjectpart containing prim shape. - /// The SQL command with the transaction. - /// The scenegroup UUID. - /// The region UUID. - private void StoreSceneObjectPrimShapes(SceneObjectPart sceneObjectPart, SqlCommand sqlCommand, UUID sceneGroupID, UUID regionUUID) - { - //Big query to or insert or update primshapes - //Note for SQL Server 2008 this can be simplified - string queryPrimShapes = @" -IF EXISTS (SELECT UUID FROM primshapes WHERE UUID = @UUID) - BEGIN - UPDATE primshapes SET - Shape = @Shape, ScaleX = @ScaleX, ScaleY = @ScaleY, ScaleZ = @ScaleZ, PCode = @PCode, PathBegin = @PathBegin, - PathEnd = @PathEnd, PathScaleX = @PathScaleX, PathScaleY = @PathScaleY, PathShearX = @PathShearX, PathShearY = @PathShearY, - PathSkew = @PathSkew, PathCurve = @PathCurve, PathRadiusOffset = @PathRadiusOffset, PathRevolutions = @PathRevolutions, - PathTaperX = @PathTaperX, PathTaperY = @PathTaperY, PathTwist = @PathTwist, PathTwistBegin = @PathTwistBegin, - ProfileBegin = @ProfileBegin, ProfileEnd = @ProfileEnd, ProfileCurve = @ProfileCurve, ProfileHollow = @ProfileHollow, - Texture = @Texture, ExtraParams = @ExtraParams, State = @State, Media = @Media - WHERE UUID = @UUID - END -ELSE - BEGIN - INSERT INTO - primshapes ( - UUID, Shape, ScaleX, ScaleY, ScaleZ, PCode, PathBegin, PathEnd, PathScaleX, PathScaleY, PathShearX, PathShearY, - PathSkew, PathCurve, PathRadiusOffset, PathRevolutions, PathTaperX, PathTaperY, PathTwist, PathTwistBegin, ProfileBegin, - ProfileEnd, ProfileCurve, ProfileHollow, Texture, ExtraParams, State, Media - ) VALUES ( - @UUID, @Shape, @ScaleX, @ScaleY, @ScaleZ, @PCode, @PathBegin, @PathEnd, @PathScaleX, @PathScaleY, @PathShearX, @PathShearY, - @PathSkew, @PathCurve, @PathRadiusOffset, @PathRevolutions, @PathTaperX, @PathTaperY, @PathTwist, @PathTwistBegin, @ProfileBegin, - @ProfileEnd, @ProfileCurve, @ProfileHollow, @Texture, @ExtraParams, @State, @Media - ) - END"; - - //Set commandtext. - sqlCommand.CommandText = queryPrimShapes; - - //Add parameters - sqlCommand.Parameters.AddRange(CreatePrimShapeParameters(sceneObjectPart, sceneGroupID, regionUUID)); - - //Execute the query. If it fails then error is trapped in calling function - sqlCommand.ExecuteNonQuery(); - - } - - /// - /// Removes a object from the database. - /// Meaning removing it from tables Prims, PrimShapes and PrimItems - /// - /// id of scenegroup - /// regionUUID (is this used anyway - public void RemoveObject(UUID objectID, UUID regionUUID) - { - _Log.InfoFormat("[MSSQL]: Removing obj: {0} from region: {1}", objectID, regionUUID); - - //Remove from prims and primsitem table - string sqlPrims = "DELETE FROM PRIMS WHERE SceneGroupID = @objectID"; - string sqlPrimItems = "DELETE FROM PRIMITEMS WHERE primID in (SELECT UUID FROM PRIMS WHERE SceneGroupID = @objectID)"; - string sqlPrimShapes = "DELETE FROM PRIMSHAPES WHERE uuid in (SELECT UUID FROM PRIMS WHERE SceneGroupID = @objectID)"; - - lock (_Database) - { - //Using the non transaction mode. - using (SqlConnection conn = new SqlConnection(m_connectionString)) - using (SqlCommand cmd = new SqlCommand()) - { - cmd.Connection = conn; - cmd.CommandText = sqlPrimShapes; - conn.Open(); - cmd.Parameters.Add(_Database.CreateParameter("objectID", objectID)); - cmd.ExecuteNonQuery(); - - cmd.CommandText = sqlPrimItems; - cmd.ExecuteNonQuery(); - - cmd.CommandText = sqlPrims; - cmd.ExecuteNonQuery(); - } - } - } - - /// - /// Store the inventory of a prim. Warning deletes everything first and then adds all again. - /// - /// - /// - public void StorePrimInventory(UUID primID, ICollection items) - { - //_Log.InfoFormat("[REGION DB: Persisting Prim Inventory with prim ID {0}", primID); - - //Statement from MySQL section! - // For now, we're just going to crudely remove all the previous inventory items - // no matter whether they have changed or not, and replace them with the current set. - - //Delete everything from PrimID - //TODO add index on PrimID in DB, if not already exist - - string sql = "DELETE PRIMITEMS WHERE primID = @primID"; - using (SqlConnection conn = new SqlConnection(m_connectionString)) - using (SqlCommand cmd = new SqlCommand(sql, conn)) - { - cmd.Parameters.Add(_Database.CreateParameter("@primID", primID)); - conn.Open(); - cmd.ExecuteNonQuery(); - } - - sql = - @"INSERT INTO primitems ( - itemID,primID,assetID,parentFolderID,invType,assetType,name,description,creationDate,creatorID,ownerID,lastOwnerID,groupID, - nextPermissions,currentPermissions,basePermissions,everyonePermissions,groupPermissions,flags) - VALUES (@itemID,@primID,@assetID,@parentFolderID,@invType,@assetType,@name,@description,@creationDate,@creatorID,@ownerID, - @lastOwnerID,@groupID,@nextPermissions,@currentPermissions,@basePermissions,@everyonePermissions,@groupPermissions,@flags)"; - - using (SqlConnection conn = new SqlConnection(m_connectionString)) - using (SqlCommand cmd = new SqlCommand(sql, conn)) - { - foreach (TaskInventoryItem taskItem in items) - { - cmd.Parameters.AddRange(CreatePrimInventoryParameters(taskItem)); - conn.Open(); - cmd.ExecuteNonQuery(); - - cmd.Parameters.Clear(); - } - } - } - - #endregion - - /// - /// Loads the terrain map. - /// - /// regionID. - /// - public double[,] LoadTerrain(UUID regionID) - { - double[,] terrain = new double[(int)Constants.RegionSize, (int)Constants.RegionSize]; - terrain.Initialize(); - - string sql = "select top 1 RegionUUID, Revision, Heightfield from terrain where RegionUUID = @RegionUUID order by Revision desc"; - - using (SqlConnection conn = new SqlConnection(m_connectionString)) - using (SqlCommand cmd = new SqlCommand(sql, conn)) - { - // MySqlParameter param = new MySqlParameter(); - cmd.Parameters.Add(_Database.CreateParameter("@RegionUUID", regionID)); - conn.Open(); - using (SqlDataReader reader = cmd.ExecuteReader()) - { - int rev; - if (reader.Read()) - { - MemoryStream str = new MemoryStream((byte[])reader["Heightfield"]); - BinaryReader br = new BinaryReader(str); - for (int x = 0; x < (int)Constants.RegionSize; x++) - { - for (int y = 0; y < (int)Constants.RegionSize; y++) - { - terrain[x, y] = br.ReadDouble(); - } - } - rev = (int)reader["Revision"]; - } - else - { - _Log.Info("[REGION DB]: No terrain found for region"); - return null; - } - _Log.Info("[REGION DB]: Loaded terrain revision r" + rev); - } - } - - return terrain; - } - - /// - /// Stores the terrain map to DB. - /// - /// terrain map data. - /// regionID. - public void StoreTerrain(double[,] terrain, UUID regionID) - { - int revision = Util.UnixTimeSinceEpoch(); - - //Delete old terrain map - string sql = "delete from terrain where RegionUUID=@RegionUUID"; - using (SqlConnection conn = new SqlConnection(m_connectionString)) - using (SqlCommand cmd = new SqlCommand(sql, conn)) - { - cmd.Parameters.Add(_Database.CreateParameter("@RegionUUID", regionID)); - conn.Open(); - cmd.ExecuteNonQuery(); - } - - sql = "insert into terrain(RegionUUID, Revision, Heightfield) values(@RegionUUID, @Revision, @Heightfield)"; - - using (SqlConnection conn = new SqlConnection(m_connectionString)) - using (SqlCommand cmd = new SqlCommand(sql, conn)) - { - cmd.Parameters.Add(_Database.CreateParameter("@RegionUUID", regionID)); - cmd.Parameters.Add(_Database.CreateParameter("@Revision", revision)); - cmd.Parameters.Add(_Database.CreateParameter("@Heightfield", serializeTerrain(terrain))); - conn.Open(); - cmd.ExecuteNonQuery(); - } - - _Log.Info("[REGION DB]: Stored terrain revision r " + revision); - } - - /// - /// Loads all the land objects of a region. - /// - /// The region UUID. - /// - public List LoadLandObjects(UUID regionUUID) - { - List LandDataForRegion = new List(); - - string sql = "select * from land where RegionUUID = @RegionUUID"; - - //Retrieve all land data from region - using (SqlConnection conn = new SqlConnection(m_connectionString)) - using (SqlCommand cmd = new SqlCommand(sql, conn)) - { - cmd.Parameters.Add(_Database.CreateParameter("@RegionUUID", regionUUID)); - conn.Open(); - using (SqlDataReader readerLandData = cmd.ExecuteReader()) - { - while (readerLandData.Read()) - { - LandDataForRegion.Add(BuildLandData(readerLandData)); - } - } - } - - //Retrieve all accesslist data for all landdata - foreach (LandData LandData in LandDataForRegion) - { - sql = "select * from landaccesslist where LandUUID = @LandUUID"; - using (SqlConnection conn = new SqlConnection(m_connectionString)) - using (SqlCommand cmd = new SqlCommand(sql, conn)) - { - cmd.Parameters.Add(_Database.CreateParameter("@LandUUID", LandData.GlobalID)); - conn.Open(); - using (SqlDataReader readerAccessList = cmd.ExecuteReader()) - { - while (readerAccessList.Read()) - { - LandData.ParcelAccessList.Add(BuildLandAccessData(readerAccessList)); - } - } - } - } - - //Return data - return LandDataForRegion; - } - - /// - /// Stores land object with landaccess list. - /// - /// parcel data. - public void StoreLandObject(ILandObject parcel) - { - //As this is only one record in land table I just delete all and then add a new record. - //As the delete landaccess is already in the mysql code - - //Delete old values - RemoveLandObject(parcel.LandData.GlobalID); - - //Insert new values - string sql = @"INSERT INTO [land] -([UUID],[RegionUUID],[LocalLandID],[Bitmap],[Name],[Description],[OwnerUUID],[IsGroupOwned],[Area],[AuctionID],[Category],[ClaimDate],[ClaimPrice],[GroupUUID],[SalePrice],[LandStatus],[LandFlags],[LandingType],[MediaAutoScale],[MediaTextureUUID],[MediaURL],[MusicURL],[PassHours],[PassPrice],[SnapshotUUID],[UserLocationX],[UserLocationY],[UserLocationZ],[UserLookAtX],[UserLookAtY],[UserLookAtZ],[AuthbuyerID],[OtherCleanTime]) -VALUES -(@UUID,@RegionUUID,@LocalLandID,@Bitmap,@Name,@Description,@OwnerUUID,@IsGroupOwned,@Area,@AuctionID,@Category,@ClaimDate,@ClaimPrice,@GroupUUID,@SalePrice,@LandStatus,@LandFlags,@LandingType,@MediaAutoScale,@MediaTextureUUID,@MediaURL,@MusicURL,@PassHours,@PassPrice,@SnapshotUUID,@UserLocationX,@UserLocationY,@UserLocationZ,@UserLookAtX,@UserLookAtY,@UserLookAtZ,@AuthbuyerID,@OtherCleanTime)"; - - using (SqlConnection conn = new SqlConnection(m_connectionString)) - using (SqlCommand cmd = new SqlCommand(sql, conn)) - { - cmd.Parameters.AddRange(CreateLandParameters(parcel.LandData, parcel.RegionUUID)); - conn.Open(); - cmd.ExecuteNonQuery(); - } - - sql = "INSERT INTO [landaccesslist] ([LandUUID],[AccessUUID],[Flags]) VALUES (@LandUUID,@AccessUUID,@Flags)"; - - using (SqlConnection conn = new SqlConnection(m_connectionString)) - using (SqlCommand cmd = new SqlCommand(sql, conn)) - { - conn.Open(); - foreach (ParcelManager.ParcelAccessEntry parcelAccessEntry in parcel.LandData.ParcelAccessList) - { - cmd.Parameters.AddRange(CreateLandAccessParameters(parcelAccessEntry, parcel.RegionUUID)); - - cmd.ExecuteNonQuery(); - cmd.Parameters.Clear(); - } - } - } - - /// - /// Removes a land object from DB. - /// - /// UUID of landobject - public void RemoveLandObject(UUID globalID) - { - string sql = "delete from land where UUID=@UUID"; - using (SqlConnection conn = new SqlConnection(m_connectionString)) - using (SqlCommand cmd = new SqlCommand(sql, conn)) - { - cmd.Parameters.Add(_Database.CreateParameter("@UUID", globalID)); - conn.Open(); - cmd.ExecuteNonQuery(); - } - sql = "delete from landaccesslist where LandUUID=@UUID"; - using (SqlConnection conn = new SqlConnection(m_connectionString)) - using (SqlCommand cmd = new SqlCommand(sql, conn)) - { - cmd.Parameters.Add(_Database.CreateParameter("@UUID", globalID)); - conn.Open(); - cmd.ExecuteNonQuery(); - } - } - public RegionLightShareData LoadRegionWindlightSettings(UUID regionUUID) - { - //This connector doesn't support the windlight module yet - //Return default LL windlight settings - return new RegionLightShareData(); - } - public void StoreRegionWindlightSettings(RegionLightShareData wl) - { - //This connector doesn't support the windlight module yet - } - /// - /// Loads the settings of a region. - /// - /// The region UUID. - /// - public RegionSettings LoadRegionSettings(UUID regionUUID) - { - string sql = "select * from regionsettings where regionUUID = @regionUUID"; - RegionSettings regionSettings; - using (SqlConnection conn = new SqlConnection(m_connectionString)) - using (SqlCommand cmd = new SqlCommand(sql, conn)) - { - cmd.Parameters.Add(_Database.CreateParameter("@regionUUID", regionUUID)); - conn.Open(); - using (SqlDataReader reader = cmd.ExecuteReader()) - { - if (reader.Read()) - { - regionSettings = BuildRegionSettings(reader); - regionSettings.OnSave += StoreRegionSettings; - - return regionSettings; - } - } - } - - //If we reach this point then there are new region settings for that region - regionSettings = new RegionSettings(); - regionSettings.RegionUUID = regionUUID; - regionSettings.OnSave += StoreRegionSettings; - - //Store new values - StoreNewRegionSettings(regionSettings); - - return regionSettings; - } - - /// - /// Store region settings, need to check if the check is really necesary. If we can make something for creating new region. - /// - /// region settings. - public void StoreRegionSettings(RegionSettings regionSettings) - { - //Little check if regionUUID already exist in DB - string regionUUID; - string sql = "SELECT regionUUID FROM regionsettings WHERE regionUUID = @regionUUID"; - using (SqlConnection conn = new SqlConnection(m_connectionString)) - using (SqlCommand cmd = new SqlCommand(sql, conn)) - { - cmd.Parameters.Add(_Database.CreateParameter("@regionUUID", regionSettings.RegionUUID)); - conn.Open(); - regionUUID = cmd.ExecuteScalar().ToString(); - } - - if (string.IsNullOrEmpty(regionUUID)) - { - StoreNewRegionSettings(regionSettings); - } - else - { - //This method only updates region settings!!! First call LoadRegionSettings to create new region settings in DB - sql = - @"UPDATE [regionsettings] SET [block_terraform] = @block_terraform ,[block_fly] = @block_fly ,[allow_damage] = @allow_damage -,[restrict_pushing] = @restrict_pushing ,[allow_land_resell] = @allow_land_resell ,[allow_land_join_divide] = @allow_land_join_divide -,[block_show_in_search] = @block_show_in_search ,[agent_limit] = @agent_limit ,[object_bonus] = @object_bonus ,[maturity] = @maturity -,[disable_scripts] = @disable_scripts ,[disable_collisions] = @disable_collisions ,[disable_physics] = @disable_physics -,[terrain_texture_1] = @terrain_texture_1 ,[terrain_texture_2] = @terrain_texture_2 ,[terrain_texture_3] = @terrain_texture_3 -,[terrain_texture_4] = @terrain_texture_4 ,[elevation_1_nw] = @elevation_1_nw ,[elevation_2_nw] = @elevation_2_nw -,[elevation_1_ne] = @elevation_1_ne ,[elevation_2_ne] = @elevation_2_ne ,[elevation_1_se] = @elevation_1_se ,[elevation_2_se] = @elevation_2_se -,[elevation_1_sw] = @elevation_1_sw ,[elevation_2_sw] = @elevation_2_sw ,[water_height] = @water_height ,[terrain_raise_limit] = @terrain_raise_limit -,[terrain_lower_limit] = @terrain_lower_limit ,[use_estate_sun] = @use_estate_sun ,[fixed_sun] = @fixed_sun ,[sun_position] = @sun_position -,[covenant] = @covenant , [sunvectorx] = @sunvectorx, [sunvectory] = @sunvectory, [sunvectorz] = @sunvectorz, [Sandbox] = @Sandbox, [loaded_creation_datetime] = @loaded_creation_datetime, [loaded_creation_id] = @loaded_creation_id - WHERE [regionUUID] = @regionUUID"; - - using (SqlConnection conn = new SqlConnection(m_connectionString)) - using (SqlCommand cmd = new SqlCommand(sql, conn)) - { - cmd.Parameters.AddRange(CreateRegionSettingParameters(regionSettings)); - conn.Open(); - cmd.ExecuteNonQuery(); - } - } - } - - public void Shutdown() - { - //Not used?? - } - - #region Private Methods - - /// - /// Serializes the terrain data for storage in DB. - /// - /// terrain data - /// - private static Array serializeTerrain(double[,] val) - { - MemoryStream str = new MemoryStream(((int)Constants.RegionSize * (int)Constants.RegionSize) * sizeof(double)); - BinaryWriter bw = new BinaryWriter(str); - - // TODO: COMPATIBILITY - Add byte-order conversions - for (int x = 0; x < (int)Constants.RegionSize; x++) - for (int y = 0; y < (int)Constants.RegionSize; y++) - { - double height = val[x, y]; - if (height == 0.0) - height = double.Epsilon; - - bw.Write(height); - } - - return str.ToArray(); - } - - /// - /// Stores new regionsettings. - /// - /// The region settings. - private void StoreNewRegionSettings(RegionSettings regionSettings) - { - string sql = @"INSERT INTO [regionsettings] - ([regionUUID],[block_terraform],[block_fly],[allow_damage],[restrict_pushing],[allow_land_resell],[allow_land_join_divide], - [block_show_in_search],[agent_limit],[object_bonus],[maturity],[disable_scripts],[disable_collisions],[disable_physics], - [terrain_texture_1],[terrain_texture_2],[terrain_texture_3],[terrain_texture_4],[elevation_1_nw],[elevation_2_nw],[elevation_1_ne], - [elevation_2_ne],[elevation_1_se],[elevation_2_se],[elevation_1_sw],[elevation_2_sw],[water_height],[terrain_raise_limit], - [terrain_lower_limit],[use_estate_sun],[fixed_sun],[sun_position],[covenant],[sunvectorx], [sunvectory], [sunvectorz],[Sandbox], [loaded_creation_datetime], [loaded_creation_id] - ) - VALUES - (@regionUUID,@block_terraform,@block_fly,@allow_damage,@restrict_pushing,@allow_land_resell,@allow_land_join_divide, - @block_show_in_search,@agent_limit,@object_bonus,@maturity,@disable_scripts,@disable_collisions,@disable_physics, - @terrain_texture_1,@terrain_texture_2,@terrain_texture_3,@terrain_texture_4,@elevation_1_nw,@elevation_2_nw,@elevation_1_ne, - @elevation_2_ne,@elevation_1_se,@elevation_2_se,@elevation_1_sw,@elevation_2_sw,@water_height,@terrain_raise_limit, - @terrain_lower_limit,@use_estate_sun,@fixed_sun,@sun_position,@covenant,@sunvectorx,@sunvectory, @sunvectorz, @Sandbox, @loaded_creation_datetime, @loaded_creation_id)"; - - using (SqlConnection conn = new SqlConnection(m_connectionString)) - using (SqlCommand cmd = new SqlCommand(sql, conn)) - { - cmd.Parameters.AddRange(CreateRegionSettingParameters(regionSettings)); - conn.Open(); - cmd.ExecuteNonQuery(); - } - } - - #region Private DataRecord conversion methods - - /// - /// Builds the region settings from a datarecod. - /// - /// datarecord with regionsettings. - /// - private static RegionSettings BuildRegionSettings(IDataRecord row) - { - //TODO change this is some more generic code so we doesnt have to change it every time a new field is added? - RegionSettings newSettings = new RegionSettings(); - - newSettings.RegionUUID = new UUID((Guid)row["regionUUID"]); - newSettings.BlockTerraform = Convert.ToBoolean(row["block_terraform"]); - newSettings.AllowDamage = Convert.ToBoolean(row["allow_damage"]); - newSettings.BlockFly = Convert.ToBoolean(row["block_fly"]); - newSettings.RestrictPushing = Convert.ToBoolean(row["restrict_pushing"]); - newSettings.AllowLandResell = Convert.ToBoolean(row["allow_land_resell"]); - newSettings.AllowLandJoinDivide = Convert.ToBoolean(row["allow_land_join_divide"]); - newSettings.BlockShowInSearch = Convert.ToBoolean(row["block_show_in_search"]); - newSettings.AgentLimit = Convert.ToInt32(row["agent_limit"]); - newSettings.ObjectBonus = Convert.ToDouble(row["object_bonus"]); - newSettings.Maturity = Convert.ToInt32(row["maturity"]); - newSettings.DisableScripts = Convert.ToBoolean(row["disable_scripts"]); - newSettings.DisableCollisions = Convert.ToBoolean(row["disable_collisions"]); - newSettings.DisablePhysics = Convert.ToBoolean(row["disable_physics"]); - newSettings.TerrainTexture1 = new UUID((Guid)row["terrain_texture_1"]); - newSettings.TerrainTexture2 = new UUID((Guid)row["terrain_texture_2"]); - newSettings.TerrainTexture3 = new UUID((Guid)row["terrain_texture_3"]); - newSettings.TerrainTexture4 = new UUID((Guid)row["terrain_texture_4"]); - newSettings.Elevation1NW = Convert.ToDouble(row["elevation_1_nw"]); - newSettings.Elevation2NW = Convert.ToDouble(row["elevation_2_nw"]); - newSettings.Elevation1NE = Convert.ToDouble(row["elevation_1_ne"]); - newSettings.Elevation2NE = Convert.ToDouble(row["elevation_2_ne"]); - newSettings.Elevation1SE = Convert.ToDouble(row["elevation_1_se"]); - newSettings.Elevation2SE = Convert.ToDouble(row["elevation_2_se"]); - newSettings.Elevation1SW = Convert.ToDouble(row["elevation_1_sw"]); - newSettings.Elevation2SW = Convert.ToDouble(row["elevation_2_sw"]); - newSettings.WaterHeight = Convert.ToDouble(row["water_height"]); - newSettings.TerrainRaiseLimit = Convert.ToDouble(row["terrain_raise_limit"]); - newSettings.TerrainLowerLimit = Convert.ToDouble(row["terrain_lower_limit"]); - newSettings.UseEstateSun = Convert.ToBoolean(row["use_estate_sun"]); - newSettings.Sandbox = Convert.ToBoolean(row["sandbox"]); - newSettings.FixedSun = Convert.ToBoolean(row["fixed_sun"]); - newSettings.SunPosition = Convert.ToDouble(row["sun_position"]); - newSettings.SunVector = new Vector3( - Convert.ToSingle(row["sunvectorx"]), - Convert.ToSingle(row["sunvectory"]), - Convert.ToSingle(row["sunvectorz"]) - ); - newSettings.Covenant = new UUID((Guid)row["covenant"]); - - newSettings.LoadedCreationDateTime = Convert.ToInt32(row["loaded_creation_datetime"]); - - if (row["loaded_creation_id"] is DBNull) - newSettings.LoadedCreationID = ""; - else - newSettings.LoadedCreationID = (String)row["loaded_creation_id"]; - return newSettings; - } - - /// - /// Builds the land data from a datarecord. - /// - /// datarecord with land data - /// - private static LandData BuildLandData(IDataRecord row) - { - LandData newData = new LandData(); - - newData.GlobalID = new UUID((Guid)row["UUID"]); - newData.LocalID = Convert.ToInt32(row["LocalLandID"]); - - // Bitmap is a byte[512] - newData.Bitmap = (Byte[])row["Bitmap"]; - - newData.Name = (string)row["Name"]; - newData.Description = (string)row["Description"]; - newData.OwnerID = new UUID((Guid)row["OwnerUUID"]); - newData.IsGroupOwned = Convert.ToBoolean(row["IsGroupOwned"]); - newData.Area = Convert.ToInt32(row["Area"]); - newData.AuctionID = Convert.ToUInt32(row["AuctionID"]); //Unemplemented - newData.Category = (ParcelCategory)Convert.ToInt32(row["Category"]); - //Enum libsecondlife.Parcel.ParcelCategory - newData.ClaimDate = Convert.ToInt32(row["ClaimDate"]); - newData.ClaimPrice = Convert.ToInt32(row["ClaimPrice"]); - newData.GroupID = new UUID((Guid)row["GroupUUID"]); - newData.SalePrice = Convert.ToInt32(row["SalePrice"]); - newData.Status = (ParcelStatus)Convert.ToInt32(row["LandStatus"]); - //Enum. libsecondlife.Parcel.ParcelStatus - newData.Flags = Convert.ToUInt32(row["LandFlags"]); - newData.LandingType = Convert.ToByte(row["LandingType"]); - newData.MediaAutoScale = Convert.ToByte(row["MediaAutoScale"]); - newData.MediaID = new UUID((Guid)row["MediaTextureUUID"]); - newData.MediaURL = (string)row["MediaURL"]; - newData.MusicURL = (string)row["MusicURL"]; - newData.PassHours = Convert.ToSingle(row["PassHours"]); - newData.PassPrice = Convert.ToInt32(row["PassPrice"]); - - // UUID authedbuyer; - // UUID snapshotID; - // - // if (UUID.TryParse((string)row["AuthBuyerID"], out authedbuyer)) - // newData.AuthBuyerID = authedbuyer; - // - // if (UUID.TryParse((string)row["SnapshotUUID"], out snapshotID)) - // newData.SnapshotID = snapshotID; - newData.AuthBuyerID = new UUID((Guid)row["AuthBuyerID"]); - newData.SnapshotID = new UUID((Guid)row["SnapshotUUID"]); - - newData.OtherCleanTime = Convert.ToInt32(row["OtherCleanTime"]); - - try - { - newData.UserLocation = - new Vector3(Convert.ToSingle(row["UserLocationX"]), Convert.ToSingle(row["UserLocationY"]), - Convert.ToSingle(row["UserLocationZ"])); - newData.UserLookAt = - new Vector3(Convert.ToSingle(row["UserLookAtX"]), Convert.ToSingle(row["UserLookAtY"]), - Convert.ToSingle(row["UserLookAtZ"])); - } - catch (InvalidCastException) - { - newData.UserLocation = Vector3.Zero; - newData.UserLookAt = Vector3.Zero; - _Log.ErrorFormat("[PARCEL]: unable to get parcel telehub settings for {1}", newData.Name); - } - - newData.ParcelAccessList = new List(); - - return newData; - } - - /// - /// Builds the landaccess data from a data record. - /// - /// datarecord with landaccess data - /// - private static ParcelManager.ParcelAccessEntry BuildLandAccessData(IDataRecord row) - { - ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry(); - entry.AgentID = new UUID((Guid)row["AccessUUID"]); - entry.Flags = (AccessList)Convert.ToInt32(row["Flags"]); - entry.Time = new DateTime(); - return entry; - } - - /// - /// Builds the prim from a datarecord. - /// - /// datarecord - /// - private static SceneObjectPart BuildPrim(IDataRecord primRow) - { - SceneObjectPart prim = new SceneObjectPart(); - - prim.UUID = new UUID((Guid)primRow["UUID"]); - // explicit conversion of integers is required, which sort - // of sucks. No idea if there is a shortcut here or not. - prim.CreationDate = Convert.ToInt32(primRow["CreationDate"]); - prim.Name = (string)primRow["Name"]; - // various text fields - prim.Text = (string)primRow["Text"]; - prim.Color = Color.FromArgb(Convert.ToInt32(primRow["ColorA"]), - Convert.ToInt32(primRow["ColorR"]), - Convert.ToInt32(primRow["ColorG"]), - Convert.ToInt32(primRow["ColorB"])); - prim.Description = (string)primRow["Description"]; - prim.SitName = (string)primRow["SitName"]; - prim.TouchName = (string)primRow["TouchName"]; - // permissions - prim.Flags = (PrimFlags)Convert.ToUInt32(primRow["ObjectFlags"]); - prim.CreatorID = new UUID((Guid)primRow["CreatorID"]); - prim.OwnerID = new UUID((Guid)primRow["OwnerID"]); - prim.GroupID = new UUID((Guid)primRow["GroupID"]); - prim.LastOwnerID = new UUID((Guid)primRow["LastOwnerID"]); - prim.OwnerMask = Convert.ToUInt32(primRow["OwnerMask"]); - prim.NextOwnerMask = Convert.ToUInt32(primRow["NextOwnerMask"]); - prim.GroupMask = Convert.ToUInt32(primRow["GroupMask"]); - prim.EveryoneMask = Convert.ToUInt32(primRow["EveryoneMask"]); - prim.BaseMask = Convert.ToUInt32(primRow["BaseMask"]); - // vectors - prim.OffsetPosition = new Vector3( - Convert.ToSingle(primRow["PositionX"]), - Convert.ToSingle(primRow["PositionY"]), - Convert.ToSingle(primRow["PositionZ"])); - - prim.GroupPosition = new Vector3( - Convert.ToSingle(primRow["GroupPositionX"]), - Convert.ToSingle(primRow["GroupPositionY"]), - Convert.ToSingle(primRow["GroupPositionZ"])); - - prim.Velocity = new Vector3( - Convert.ToSingle(primRow["VelocityX"]), - Convert.ToSingle(primRow["VelocityY"]), - Convert.ToSingle(primRow["VelocityZ"])); - - prim.AngularVelocity = new Vector3( - Convert.ToSingle(primRow["AngularVelocityX"]), - Convert.ToSingle(primRow["AngularVelocityY"]), - Convert.ToSingle(primRow["AngularVelocityZ"])); - - prim.Acceleration = new Vector3( - Convert.ToSingle(primRow["AccelerationX"]), - Convert.ToSingle(primRow["AccelerationY"]), - Convert.ToSingle(primRow["AccelerationZ"])); - - // quaternions - prim.RotationOffset = new Quaternion( - Convert.ToSingle(primRow["RotationX"]), - Convert.ToSingle(primRow["RotationY"]), - Convert.ToSingle(primRow["RotationZ"]), - Convert.ToSingle(primRow["RotationW"])); - - prim.SitTargetPositionLL = new Vector3( - Convert.ToSingle(primRow["SitTargetOffsetX"]), - Convert.ToSingle(primRow["SitTargetOffsetY"]), - Convert.ToSingle(primRow["SitTargetOffsetZ"])); - - prim.SitTargetOrientationLL = new Quaternion( - Convert.ToSingle(primRow["SitTargetOrientX"]), - Convert.ToSingle(primRow["SitTargetOrientY"]), - Convert.ToSingle(primRow["SitTargetOrientZ"]), - Convert.ToSingle(primRow["SitTargetOrientW"])); - - prim.PayPrice[0] = Convert.ToInt32(primRow["PayPrice"]); - prim.PayPrice[1] = Convert.ToInt32(primRow["PayButton1"]); - prim.PayPrice[2] = Convert.ToInt32(primRow["PayButton2"]); - prim.PayPrice[3] = Convert.ToInt32(primRow["PayButton3"]); - prim.PayPrice[4] = Convert.ToInt32(primRow["PayButton4"]); - - prim.Sound = new UUID((Guid)primRow["LoopedSound"]); - prim.SoundGain = Convert.ToSingle(primRow["LoopedSoundGain"]); - prim.SoundFlags = 1; // If it's persisted at all, it's looped - - if (!(primRow["TextureAnimation"] is DBNull)) - prim.TextureAnimation = (Byte[])primRow["TextureAnimation"]; - if (!(primRow["ParticleSystem"] is DBNull)) - prim.ParticleSystem = (Byte[])primRow["ParticleSystem"]; - - prim.AngularVelocity = new Vector3( - Convert.ToSingle(primRow["OmegaX"]), - Convert.ToSingle(primRow["OmegaY"]), - Convert.ToSingle(primRow["OmegaZ"])); - - prim.SetCameraEyeOffset(new Vector3( - Convert.ToSingle(primRow["CameraEyeOffsetX"]), - Convert.ToSingle(primRow["CameraEyeOffsetY"]), - Convert.ToSingle(primRow["CameraEyeOffsetZ"]) - )); - - prim.SetCameraAtOffset(new Vector3( - Convert.ToSingle(primRow["CameraAtOffsetX"]), - Convert.ToSingle(primRow["CameraAtOffsetY"]), - Convert.ToSingle(primRow["CameraAtOffsetZ"]) - )); - - if (Convert.ToInt16(primRow["ForceMouselook"]) != 0) - prim.SetForceMouselook(true); - - prim.ScriptAccessPin = Convert.ToInt32(primRow["ScriptAccessPin"]); - - if (Convert.ToInt16(primRow["AllowedDrop"]) != 0) - prim.AllowedDrop = true; - - if (Convert.ToInt16(primRow["DieAtEdge"]) != 0) - prim.DIE_AT_EDGE = true; - - prim.SalePrice = Convert.ToInt32(primRow["SalePrice"]); - prim.ObjectSaleType = Convert.ToByte(primRow["SaleType"]); - - prim.Material = Convert.ToByte(primRow["Material"]); - - if (!(primRow["ClickAction"] is DBNull)) - prim.ClickAction = Convert.ToByte(primRow["ClickAction"]); - - prim.CollisionSound = new UUID((Guid)primRow["CollisionSound"]); - prim.CollisionSoundVolume = Convert.ToSingle(primRow["CollisionSoundVolume"]); - if (Convert.ToInt16(primRow["PassTouches"]) != 0) - prim.PassTouches = true; - prim.LinkNum = Convert.ToInt32(primRow["LinkNumber"]); - - if (!(primRow["MediaURL"] is System.DBNull)) - prim.MediaUrl = (string)primRow["MediaURL"]; - - return prim; - } - - /// - /// Builds the prim shape from a datarecord. - /// - /// The row. - /// - private static PrimitiveBaseShape BuildShape(IDataRecord shapeRow) - { - PrimitiveBaseShape baseShape = new PrimitiveBaseShape(); - - baseShape.Scale = new Vector3( - Convert.ToSingle(shapeRow["ScaleX"]), - Convert.ToSingle(shapeRow["ScaleY"]), - Convert.ToSingle(shapeRow["ScaleZ"])); - - // paths - baseShape.PCode = Convert.ToByte(shapeRow["PCode"]); - baseShape.PathBegin = Convert.ToUInt16(shapeRow["PathBegin"]); - baseShape.PathEnd = Convert.ToUInt16(shapeRow["PathEnd"]); - baseShape.PathScaleX = Convert.ToByte(shapeRow["PathScaleX"]); - baseShape.PathScaleY = Convert.ToByte(shapeRow["PathScaleY"]); - baseShape.PathShearX = Convert.ToByte(shapeRow["PathShearX"]); - baseShape.PathShearY = Convert.ToByte(shapeRow["PathShearY"]); - baseShape.PathSkew = Convert.ToSByte(shapeRow["PathSkew"]); - baseShape.PathCurve = Convert.ToByte(shapeRow["PathCurve"]); - baseShape.PathRadiusOffset = Convert.ToSByte(shapeRow["PathRadiusOffset"]); - baseShape.PathRevolutions = Convert.ToByte(shapeRow["PathRevolutions"]); - baseShape.PathTaperX = Convert.ToSByte(shapeRow["PathTaperX"]); - baseShape.PathTaperY = Convert.ToSByte(shapeRow["PathTaperY"]); - baseShape.PathTwist = Convert.ToSByte(shapeRow["PathTwist"]); - baseShape.PathTwistBegin = Convert.ToSByte(shapeRow["PathTwistBegin"]); - // profile - baseShape.ProfileBegin = Convert.ToUInt16(shapeRow["ProfileBegin"]); - baseShape.ProfileEnd = Convert.ToUInt16(shapeRow["ProfileEnd"]); - baseShape.ProfileCurve = Convert.ToByte(shapeRow["ProfileCurve"]); - baseShape.ProfileHollow = Convert.ToUInt16(shapeRow["ProfileHollow"]); - - byte[] textureEntry = (byte[])shapeRow["Texture"]; - baseShape.TextureEntry = textureEntry; - - baseShape.ExtraParams = (byte[])shapeRow["ExtraParams"]; - - try - { - baseShape.State = Convert.ToByte(shapeRow["State"]); - } - catch (InvalidCastException) - { - } - - if (!(shapeRow["Media"] is System.DBNull)) - baseShape.Media = PrimitiveBaseShape.MediaList.FromXml((string)shapeRow["Media"]); - - return baseShape; - } - - /// - /// Build a prim inventory item from the persisted data. - /// - /// - /// - private static TaskInventoryItem BuildItem(IDataRecord inventoryRow) - { - TaskInventoryItem taskItem = new TaskInventoryItem(); - - taskItem.ItemID = new UUID((Guid)inventoryRow["itemID"]); - taskItem.ParentPartID = new UUID((Guid)inventoryRow["primID"]); - taskItem.AssetID = new UUID((Guid)inventoryRow["assetID"]); - taskItem.ParentID = new UUID((Guid)inventoryRow["parentFolderID"]); - - taskItem.InvType = Convert.ToInt32(inventoryRow["invType"]); - taskItem.Type = Convert.ToInt32(inventoryRow["assetType"]); - - taskItem.Name = (string)inventoryRow["name"]; - taskItem.Description = (string)inventoryRow["description"]; - taskItem.CreationDate = Convert.ToUInt32(inventoryRow["creationDate"]); - taskItem.CreatorID = new UUID((Guid)inventoryRow["creatorID"]); - taskItem.OwnerID = new UUID((Guid)inventoryRow["ownerID"]); - taskItem.LastOwnerID = new UUID((Guid)inventoryRow["lastOwnerID"]); - taskItem.GroupID = new UUID((Guid)inventoryRow["groupID"]); - - taskItem.NextPermissions = Convert.ToUInt32(inventoryRow["nextPermissions"]); - taskItem.CurrentPermissions = Convert.ToUInt32(inventoryRow["currentPermissions"]); - taskItem.BasePermissions = Convert.ToUInt32(inventoryRow["basePermissions"]); - taskItem.EveryonePermissions = Convert.ToUInt32(inventoryRow["everyonePermissions"]); - taskItem.GroupPermissions = Convert.ToUInt32(inventoryRow["groupPermissions"]); - taskItem.Flags = Convert.ToUInt32(inventoryRow["flags"]); - - return taskItem; - } - - #endregion - - #region Create parameters methods - - /// - /// Creates the prim inventory parameters. - /// - /// item in inventory. - /// - private SqlParameter[] CreatePrimInventoryParameters(TaskInventoryItem taskItem) - { - List parameters = new List(); - - parameters.Add(_Database.CreateParameter("itemID", taskItem.ItemID)); - parameters.Add(_Database.CreateParameter("primID", taskItem.ParentPartID)); - parameters.Add(_Database.CreateParameter("assetID", taskItem.AssetID)); - parameters.Add(_Database.CreateParameter("parentFolderID", taskItem.ParentID)); - parameters.Add(_Database.CreateParameter("invType", taskItem.InvType)); - parameters.Add(_Database.CreateParameter("assetType", taskItem.Type)); - - parameters.Add(_Database.CreateParameter("name", taskItem.Name)); - parameters.Add(_Database.CreateParameter("description", taskItem.Description)); - parameters.Add(_Database.CreateParameter("creationDate", taskItem.CreationDate)); - parameters.Add(_Database.CreateParameter("creatorID", taskItem.CreatorID)); - parameters.Add(_Database.CreateParameter("ownerID", taskItem.OwnerID)); - parameters.Add(_Database.CreateParameter("lastOwnerID", taskItem.LastOwnerID)); - parameters.Add(_Database.CreateParameter("groupID", taskItem.GroupID)); - parameters.Add(_Database.CreateParameter("nextPermissions", taskItem.NextPermissions)); - parameters.Add(_Database.CreateParameter("currentPermissions", taskItem.CurrentPermissions)); - parameters.Add(_Database.CreateParameter("basePermissions", taskItem.BasePermissions)); - parameters.Add(_Database.CreateParameter("everyonePermissions", taskItem.EveryonePermissions)); - parameters.Add(_Database.CreateParameter("groupPermissions", taskItem.GroupPermissions)); - parameters.Add(_Database.CreateParameter("flags", taskItem.Flags)); - - return parameters.ToArray(); - } - - /// - /// Creates the region setting parameters. - /// - /// regionsettings. - /// - private SqlParameter[] CreateRegionSettingParameters(RegionSettings settings) - { - List parameters = new List(); - - parameters.Add(_Database.CreateParameter("regionUUID", settings.RegionUUID)); - parameters.Add(_Database.CreateParameter("block_terraform", settings.BlockTerraform)); - parameters.Add(_Database.CreateParameter("block_fly", settings.BlockFly)); - parameters.Add(_Database.CreateParameter("allow_damage", settings.AllowDamage)); - parameters.Add(_Database.CreateParameter("restrict_pushing", settings.RestrictPushing)); - parameters.Add(_Database.CreateParameter("allow_land_resell", settings.AllowLandResell)); - parameters.Add(_Database.CreateParameter("allow_land_join_divide", settings.AllowLandJoinDivide)); - parameters.Add(_Database.CreateParameter("block_show_in_search", settings.BlockShowInSearch)); - parameters.Add(_Database.CreateParameter("agent_limit", settings.AgentLimit)); - parameters.Add(_Database.CreateParameter("object_bonus", settings.ObjectBonus)); - parameters.Add(_Database.CreateParameter("maturity", settings.Maturity)); - parameters.Add(_Database.CreateParameter("disable_scripts", settings.DisableScripts)); - parameters.Add(_Database.CreateParameter("disable_collisions", settings.DisableCollisions)); - parameters.Add(_Database.CreateParameter("disable_physics", settings.DisablePhysics)); - parameters.Add(_Database.CreateParameter("terrain_texture_1", settings.TerrainTexture1)); - parameters.Add(_Database.CreateParameter("terrain_texture_2", settings.TerrainTexture2)); - parameters.Add(_Database.CreateParameter("terrain_texture_3", settings.TerrainTexture3)); - parameters.Add(_Database.CreateParameter("terrain_texture_4", settings.TerrainTexture4)); - parameters.Add(_Database.CreateParameter("elevation_1_nw", settings.Elevation1NW)); - parameters.Add(_Database.CreateParameter("elevation_2_nw", settings.Elevation2NW)); - parameters.Add(_Database.CreateParameter("elevation_1_ne", settings.Elevation1NE)); - parameters.Add(_Database.CreateParameter("elevation_2_ne", settings.Elevation2NE)); - parameters.Add(_Database.CreateParameter("elevation_1_se", settings.Elevation1SE)); - parameters.Add(_Database.CreateParameter("elevation_2_se", settings.Elevation2SE)); - parameters.Add(_Database.CreateParameter("elevation_1_sw", settings.Elevation1SW)); - parameters.Add(_Database.CreateParameter("elevation_2_sw", settings.Elevation2SW)); - parameters.Add(_Database.CreateParameter("water_height", settings.WaterHeight)); - parameters.Add(_Database.CreateParameter("terrain_raise_limit", settings.TerrainRaiseLimit)); - parameters.Add(_Database.CreateParameter("terrain_lower_limit", settings.TerrainLowerLimit)); - parameters.Add(_Database.CreateParameter("use_estate_sun", settings.UseEstateSun)); - parameters.Add(_Database.CreateParameter("sandbox", settings.Sandbox)); - parameters.Add(_Database.CreateParameter("fixed_sun", settings.FixedSun)); - parameters.Add(_Database.CreateParameter("sun_position", settings.SunPosition)); - parameters.Add(_Database.CreateParameter("sunvectorx", settings.SunVector.X)); - parameters.Add(_Database.CreateParameter("sunvectory", settings.SunVector.Y)); - parameters.Add(_Database.CreateParameter("sunvectorz", settings.SunVector.Z)); - parameters.Add(_Database.CreateParameter("covenant", settings.Covenant)); - parameters.Add(_Database.CreateParameter("Loaded_Creation_DateTime", settings.LoadedCreationDateTime)); - parameters.Add(_Database.CreateParameter("Loaded_Creation_ID", settings.LoadedCreationID)); - - return parameters.ToArray(); - } - - /// - /// Creates the land parameters. - /// - /// land parameters. - /// region UUID. - /// - private SqlParameter[] CreateLandParameters(LandData land, UUID regionUUID) - { - List parameters = new List(); - - parameters.Add(_Database.CreateParameter("UUID", land.GlobalID)); - parameters.Add(_Database.CreateParameter("RegionUUID", regionUUID)); - parameters.Add(_Database.CreateParameter("LocalLandID", land.LocalID)); - - // Bitmap is a byte[512] - parameters.Add(_Database.CreateParameter("Bitmap", land.Bitmap)); - - parameters.Add(_Database.CreateParameter("Name", land.Name)); - parameters.Add(_Database.CreateParameter("Description", land.Description)); - parameters.Add(_Database.CreateParameter("OwnerUUID", land.OwnerID)); - parameters.Add(_Database.CreateParameter("IsGroupOwned", land.IsGroupOwned)); - parameters.Add(_Database.CreateParameter("Area", land.Area)); - parameters.Add(_Database.CreateParameter("AuctionID", land.AuctionID)); //Unemplemented - parameters.Add(_Database.CreateParameter("Category", (int)land.Category)); //Enum libsecondlife.Parcel.ParcelCategory - parameters.Add(_Database.CreateParameter("ClaimDate", land.ClaimDate)); - parameters.Add(_Database.CreateParameter("ClaimPrice", land.ClaimPrice)); - parameters.Add(_Database.CreateParameter("GroupUUID", land.GroupID)); - parameters.Add(_Database.CreateParameter("SalePrice", land.SalePrice)); - parameters.Add(_Database.CreateParameter("LandStatus", (int)land.Status)); //Enum. libsecondlife.Parcel.ParcelStatus - parameters.Add(_Database.CreateParameter("LandFlags", land.Flags)); - parameters.Add(_Database.CreateParameter("LandingType", land.LandingType)); - parameters.Add(_Database.CreateParameter("MediaAutoScale", land.MediaAutoScale)); - parameters.Add(_Database.CreateParameter("MediaTextureUUID", land.MediaID)); - parameters.Add(_Database.CreateParameter("MediaURL", land.MediaURL)); - parameters.Add(_Database.CreateParameter("MusicURL", land.MusicURL)); - parameters.Add(_Database.CreateParameter("PassHours", land.PassHours)); - parameters.Add(_Database.CreateParameter("PassPrice", land.PassPrice)); - parameters.Add(_Database.CreateParameter("SnapshotUUID", land.SnapshotID)); - parameters.Add(_Database.CreateParameter("UserLocationX", land.UserLocation.X)); - parameters.Add(_Database.CreateParameter("UserLocationY", land.UserLocation.Y)); - parameters.Add(_Database.CreateParameter("UserLocationZ", land.UserLocation.Z)); - parameters.Add(_Database.CreateParameter("UserLookAtX", land.UserLookAt.X)); - parameters.Add(_Database.CreateParameter("UserLookAtY", land.UserLookAt.Y)); - parameters.Add(_Database.CreateParameter("UserLookAtZ", land.UserLookAt.Z)); - parameters.Add(_Database.CreateParameter("AuthBuyerID", land.AuthBuyerID)); - parameters.Add(_Database.CreateParameter("OtherCleanTime", land.OtherCleanTime)); - - return parameters.ToArray(); - } - - /// - /// Creates the land access parameters. - /// - /// parcel access entry. - /// parcel ID. - /// - private SqlParameter[] CreateLandAccessParameters(ParcelManager.ParcelAccessEntry parcelAccessEntry, UUID parcelID) - { - List parameters = new List(); - - parameters.Add(_Database.CreateParameter("LandUUID", parcelID)); - parameters.Add(_Database.CreateParameter("AccessUUID", parcelAccessEntry.AgentID)); - parameters.Add(_Database.CreateParameter("Flags", parcelAccessEntry.Flags)); - - return parameters.ToArray(); - } - - /// - /// Creates the prim parameters for storing in DB. - /// - /// Basic data of SceneObjectpart prim. - /// The scenegroup ID. - /// The region ID. - /// - private SqlParameter[] CreatePrimParameters(SceneObjectPart prim, UUID sceneGroupID, UUID regionUUID) - { - List parameters = new List(); - - parameters.Add(_Database.CreateParameter("UUID", prim.UUID)); - parameters.Add(_Database.CreateParameter("RegionUUID", regionUUID)); - parameters.Add(_Database.CreateParameter("CreationDate", prim.CreationDate)); - parameters.Add(_Database.CreateParameter("Name", prim.Name)); - parameters.Add(_Database.CreateParameter("SceneGroupID", sceneGroupID)); - // the UUID of the root part for this SceneObjectGroup - // various text fields - parameters.Add(_Database.CreateParameter("Text", prim.Text)); - parameters.Add(_Database.CreateParameter("ColorR", prim.Color.R)); - parameters.Add(_Database.CreateParameter("ColorG", prim.Color.G)); - parameters.Add(_Database.CreateParameter("ColorB", prim.Color.B)); - parameters.Add(_Database.CreateParameter("ColorA", prim.Color.A)); - parameters.Add(_Database.CreateParameter("Description", prim.Description)); - parameters.Add(_Database.CreateParameter("SitName", prim.SitName)); - parameters.Add(_Database.CreateParameter("TouchName", prim.TouchName)); - // permissions - parameters.Add(_Database.CreateParameter("ObjectFlags", (uint)prim.Flags)); - parameters.Add(_Database.CreateParameter("CreatorID", prim.CreatorID)); - parameters.Add(_Database.CreateParameter("OwnerID", prim.OwnerID)); - parameters.Add(_Database.CreateParameter("GroupID", prim.GroupID)); - parameters.Add(_Database.CreateParameter("LastOwnerID", prim.LastOwnerID)); - parameters.Add(_Database.CreateParameter("OwnerMask", prim.OwnerMask)); - parameters.Add(_Database.CreateParameter("NextOwnerMask", prim.NextOwnerMask)); - parameters.Add(_Database.CreateParameter("GroupMask", prim.GroupMask)); - parameters.Add(_Database.CreateParameter("EveryoneMask", prim.EveryoneMask)); - parameters.Add(_Database.CreateParameter("BaseMask", prim.BaseMask)); - // vectors - parameters.Add(_Database.CreateParameter("PositionX", prim.OffsetPosition.X)); - parameters.Add(_Database.CreateParameter("PositionY", prim.OffsetPosition.Y)); - parameters.Add(_Database.CreateParameter("PositionZ", prim.OffsetPosition.Z)); - parameters.Add(_Database.CreateParameter("GroupPositionX", prim.GroupPosition.X)); - parameters.Add(_Database.CreateParameter("GroupPositionY", prim.GroupPosition.Y)); - parameters.Add(_Database.CreateParameter("GroupPositionZ", prim.GroupPosition.Z)); - parameters.Add(_Database.CreateParameter("VelocityX", prim.Velocity.X)); - parameters.Add(_Database.CreateParameter("VelocityY", prim.Velocity.Y)); - parameters.Add(_Database.CreateParameter("VelocityZ", prim.Velocity.Z)); - parameters.Add(_Database.CreateParameter("AngularVelocityX", prim.AngularVelocity.X)); - parameters.Add(_Database.CreateParameter("AngularVelocityY", prim.AngularVelocity.Y)); - parameters.Add(_Database.CreateParameter("AngularVelocityZ", prim.AngularVelocity.Z)); - parameters.Add(_Database.CreateParameter("AccelerationX", prim.Acceleration.X)); - parameters.Add(_Database.CreateParameter("AccelerationY", prim.Acceleration.Y)); - parameters.Add(_Database.CreateParameter("AccelerationZ", prim.Acceleration.Z)); - // quaternions - parameters.Add(_Database.CreateParameter("RotationX", prim.RotationOffset.X)); - parameters.Add(_Database.CreateParameter("RotationY", prim.RotationOffset.Y)); - parameters.Add(_Database.CreateParameter("RotationZ", prim.RotationOffset.Z)); - parameters.Add(_Database.CreateParameter("RotationW", prim.RotationOffset.W)); - - // Sit target - Vector3 sitTargetPos = prim.SitTargetPositionLL; - parameters.Add(_Database.CreateParameter("SitTargetOffsetX", sitTargetPos.X)); - parameters.Add(_Database.CreateParameter("SitTargetOffsetY", sitTargetPos.Y)); - parameters.Add(_Database.CreateParameter("SitTargetOffsetZ", sitTargetPos.Z)); - - Quaternion sitTargetOrient = prim.SitTargetOrientationLL; - parameters.Add(_Database.CreateParameter("SitTargetOrientW", sitTargetOrient.W)); - parameters.Add(_Database.CreateParameter("SitTargetOrientX", sitTargetOrient.X)); - parameters.Add(_Database.CreateParameter("SitTargetOrientY", sitTargetOrient.Y)); - parameters.Add(_Database.CreateParameter("SitTargetOrientZ", sitTargetOrient.Z)); - - parameters.Add(_Database.CreateParameter("PayPrice", prim.PayPrice[0])); - parameters.Add(_Database.CreateParameter("PayButton1", prim.PayPrice[1])); - parameters.Add(_Database.CreateParameter("PayButton2", prim.PayPrice[2])); - parameters.Add(_Database.CreateParameter("PayButton3", prim.PayPrice[3])); - parameters.Add(_Database.CreateParameter("PayButton4", prim.PayPrice[4])); - - if ((prim.SoundFlags & 1) != 0) // Looped - { - parameters.Add(_Database.CreateParameter("LoopedSound", prim.Sound)); - parameters.Add(_Database.CreateParameter("LoopedSoundGain", prim.SoundGain)); - } - else - { - parameters.Add(_Database.CreateParameter("LoopedSound", UUID.Zero)); - parameters.Add(_Database.CreateParameter("LoopedSoundGain", 0.0f)); - } - - parameters.Add(_Database.CreateParameter("TextureAnimation", prim.TextureAnimation)); - parameters.Add(_Database.CreateParameter("ParticleSystem", prim.ParticleSystem)); - - parameters.Add(_Database.CreateParameter("OmegaX", prim.AngularVelocity.X)); - parameters.Add(_Database.CreateParameter("OmegaY", prim.AngularVelocity.Y)); - parameters.Add(_Database.CreateParameter("OmegaZ", prim.AngularVelocity.Z)); - - parameters.Add(_Database.CreateParameter("CameraEyeOffsetX", prim.GetCameraEyeOffset().X)); - parameters.Add(_Database.CreateParameter("CameraEyeOffsetY", prim.GetCameraEyeOffset().Y)); - parameters.Add(_Database.CreateParameter("CameraEyeOffsetZ", prim.GetCameraEyeOffset().Z)); - - parameters.Add(_Database.CreateParameter("CameraAtOffsetX", prim.GetCameraAtOffset().X)); - parameters.Add(_Database.CreateParameter("CameraAtOffsetY", prim.GetCameraAtOffset().Y)); - parameters.Add(_Database.CreateParameter("CameraAtOffsetZ", prim.GetCameraAtOffset().Z)); - - if (prim.GetForceMouselook()) - parameters.Add(_Database.CreateParameter("ForceMouselook", 1)); - else - parameters.Add(_Database.CreateParameter("ForceMouselook", 0)); - - parameters.Add(_Database.CreateParameter("ScriptAccessPin", prim.ScriptAccessPin)); - - if (prim.AllowedDrop) - parameters.Add(_Database.CreateParameter("AllowedDrop", 1)); - else - parameters.Add(_Database.CreateParameter("AllowedDrop", 0)); - - if (prim.DIE_AT_EDGE) - parameters.Add(_Database.CreateParameter("DieAtEdge", 1)); - else - parameters.Add(_Database.CreateParameter("DieAtEdge", 0)); - - parameters.Add(_Database.CreateParameter("SalePrice", prim.SalePrice)); - parameters.Add(_Database.CreateParameter("SaleType", prim.ObjectSaleType)); - - byte clickAction = prim.ClickAction; - parameters.Add(_Database.CreateParameter("ClickAction", clickAction)); - - parameters.Add(_Database.CreateParameter("Material", prim.Material)); - - parameters.Add(_Database.CreateParameter("CollisionSound", prim.CollisionSound)); - parameters.Add(_Database.CreateParameter("CollisionSoundVolume", prim.CollisionSoundVolume)); - if (prim.PassTouches) - parameters.Add(_Database.CreateParameter("PassTouches", 1)); - else - parameters.Add(_Database.CreateParameter("PassTouches", 0)); - parameters.Add(_Database.CreateParameter("LinkNumber", prim.LinkNum)); - parameters.Add(_Database.CreateParameter("MediaURL", prim.MediaUrl)); - - return parameters.ToArray(); - } - - /// - /// Creates the primshape parameters for stroing in DB. - /// - /// Basic data of SceneObjectpart prim. - /// The scene group ID. - /// The region UUID. - /// - private SqlParameter[] CreatePrimShapeParameters(SceneObjectPart prim, UUID sceneGroupID, UUID regionUUID) - { - List parameters = new List(); - - PrimitiveBaseShape s = prim.Shape; - parameters.Add(_Database.CreateParameter("UUID", prim.UUID)); - // shape is an enum - parameters.Add(_Database.CreateParameter("Shape", 0)); - // vectors - parameters.Add(_Database.CreateParameter("ScaleX", s.Scale.X)); - parameters.Add(_Database.CreateParameter("ScaleY", s.Scale.Y)); - parameters.Add(_Database.CreateParameter("ScaleZ", s.Scale.Z)); - // paths - parameters.Add(_Database.CreateParameter("PCode", s.PCode)); - parameters.Add(_Database.CreateParameter("PathBegin", s.PathBegin)); - parameters.Add(_Database.CreateParameter("PathEnd", s.PathEnd)); - parameters.Add(_Database.CreateParameter("PathScaleX", s.PathScaleX)); - parameters.Add(_Database.CreateParameter("PathScaleY", s.PathScaleY)); - parameters.Add(_Database.CreateParameter("PathShearX", s.PathShearX)); - parameters.Add(_Database.CreateParameter("PathShearY", s.PathShearY)); - parameters.Add(_Database.CreateParameter("PathSkew", s.PathSkew)); - parameters.Add(_Database.CreateParameter("PathCurve", s.PathCurve)); - parameters.Add(_Database.CreateParameter("PathRadiusOffset", s.PathRadiusOffset)); - parameters.Add(_Database.CreateParameter("PathRevolutions", s.PathRevolutions)); - parameters.Add(_Database.CreateParameter("PathTaperX", s.PathTaperX)); - parameters.Add(_Database.CreateParameter("PathTaperY", s.PathTaperY)); - parameters.Add(_Database.CreateParameter("PathTwist", s.PathTwist)); - parameters.Add(_Database.CreateParameter("PathTwistBegin", s.PathTwistBegin)); - // profile - parameters.Add(_Database.CreateParameter("ProfileBegin", s.ProfileBegin)); - parameters.Add(_Database.CreateParameter("ProfileEnd", s.ProfileEnd)); - parameters.Add(_Database.CreateParameter("ProfileCurve", s.ProfileCurve)); - parameters.Add(_Database.CreateParameter("ProfileHollow", s.ProfileHollow)); - parameters.Add(_Database.CreateParameter("Texture", s.TextureEntry)); - parameters.Add(_Database.CreateParameter("ExtraParams", s.ExtraParams)); - parameters.Add(_Database.CreateParameter("State", s.State)); - parameters.Add(_Database.CreateParameter("Media", null == s.Media ? null : s.Media.ToXml())); - - return parameters.ToArray(); - } - - #endregion - - #endregion - } -} diff --git a/OpenSim/Data/MSSQL/MSSQLSimulationData.cs b/OpenSim/Data/MSSQL/MSSQLSimulationData.cs new file mode 100644 index 0000000..ae105d5 --- /dev/null +++ b/OpenSim/Data/MSSQL/MSSQLSimulationData.cs @@ -0,0 +1,1572 @@ +/* + * Copyright (c) Contributors, http://opensimulator.org/ + * See CONTRIBUTORS.TXT for a full list of copyright holders. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the OpenSimulator Project nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +using System; +using System.Collections.Generic; +using System.Data; +using System.Data.SqlClient; +using System.Drawing; +using System.IO; +using System.Reflection; +using log4net; +using OpenMetaverse; +using OpenSim.Framework; +using OpenSim.Region.Framework.Interfaces; +using OpenSim.Region.Framework.Scenes; + +namespace OpenSim.Data.MSSQL +{ + /// + /// A MSSQL Interface for the Region Server. + /// + public class MSSQLSimulationData : ISimulationDataStore + { + private const string _migrationStore = "RegionStore"; + + // private static FileSystemDataStore Instance = new FileSystemDataStore(); + private static readonly ILog _Log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + + /// + /// The database manager + /// + private MSSQLManager _Database; + private string m_connectionString; + /// + /// Initialises the region datastore + /// + /// The connection string. + public void Initialise(string connectionString) + { + m_connectionString = connectionString; + _Database = new MSSQLManager(connectionString); + + + //Migration settings + _Database.CheckMigration(_migrationStore); + } + + /// + /// Dispose the database + /// + public void Dispose() { } + + #region SceneObjectGroup region for loading and Store of the scene. + + /// + /// Loads the objects present in the region. + /// + /// The region UUID. + /// + public List LoadObjects(UUID regionUUID) + { + UUID lastGroupID = UUID.Zero; + + Dictionary prims = new Dictionary(); + Dictionary objects = new Dictionary(); + SceneObjectGroup grp = null; + + string sql = "SELECT *, " + + "sort = CASE WHEN prims.UUID = prims.SceneGroupID THEN 0 ELSE 1 END " + + "FROM prims " + + "LEFT JOIN primshapes ON prims.UUID = primshapes.UUID " + + "WHERE RegionUUID = @RegionUUID " + + "ORDER BY SceneGroupID asc, sort asc, LinkNumber asc"; + + using (SqlConnection conn = new SqlConnection(m_connectionString)) + using (SqlCommand command = new SqlCommand(sql, conn)) + { + command.Parameters.Add(_Database.CreateParameter("@regionUUID", regionUUID)); + conn.Open(); + using (SqlDataReader reader = command.ExecuteReader()) + { + while (reader.Read()) + { + SceneObjectPart sceneObjectPart = BuildPrim(reader); + if (reader["Shape"] is DBNull) + sceneObjectPart.Shape = PrimitiveBaseShape.Default; + else + sceneObjectPart.Shape = BuildShape(reader); + + prims[sceneObjectPart.UUID] = sceneObjectPart; + + UUID groupID = new UUID((Guid)reader["SceneGroupID"]); + + if (groupID != lastGroupID) // New SOG + { + if (grp != null) + objects[grp.UUID] = grp; + + lastGroupID = groupID; + + // There sometimes exist OpenSim bugs that 'orphan groups' so that none of the prims are + // recorded as the root prim (for which the UUID must equal the persisted group UUID). In + // this case, force the UUID to be the same as the group UUID so that at least these can be + // deleted (we need to change the UUID so that any other prims in the linkset can also be + // deleted). + if (sceneObjectPart.UUID != groupID && groupID != UUID.Zero) + { + _Log.WarnFormat( + "[REGION DB]: Found root prim {0} {1} at {2} where group was actually {3}. Forcing UUID to group UUID", + sceneObjectPart.Name, sceneObjectPart.UUID, sceneObjectPart.GroupPosition, groupID); + + sceneObjectPart.UUID = groupID; + } + + grp = new SceneObjectGroup(sceneObjectPart); + } + else + { + // Black magic to preserve link numbers + // Why is this needed, fix this in AddPart method. + int link = sceneObjectPart.LinkNum; + + grp.AddPart(sceneObjectPart); + + if (link != 0) + sceneObjectPart.LinkNum = link; + } + } + } + } + + if (grp != null) + objects[grp.UUID] = grp; + + // Instead of attempting to LoadItems on every prim, + // most of which probably have no items... get a + // list from DB of all prims which have items and + // LoadItems only on those + List primsWithInventory = new List(); + string qry = "select distinct primID from primitems"; + using (SqlConnection conn = new SqlConnection(m_connectionString)) + using (SqlCommand command = new SqlCommand(qry, conn)) + { + conn.Open(); + using (SqlDataReader itemReader = command.ExecuteReader()) + { + while (itemReader.Read()) + { + if (!(itemReader["primID"] is DBNull)) + { + UUID primID = new UUID(itemReader["primID"].ToString()); + if (prims.ContainsKey(primID)) + { + primsWithInventory.Add(prims[primID]); + } + } + } + } + } + + LoadItems(primsWithInventory); + + _Log.DebugFormat("[REGION DB]: Loaded {0} objects using {1} prims", objects.Count, prims.Count); + + return new List(objects.Values); + } + + /// + /// Load in the prim's persisted inventory. + /// + /// all prims with inventory on a region + private void LoadItems(List allPrimsWithInventory) + { + string sql = "SELECT * FROM primitems WHERE PrimID = @PrimID"; + using (SqlConnection conn = new SqlConnection(m_connectionString)) + using (SqlCommand command = new SqlCommand(sql, conn)) + { + conn.Open(); + foreach (SceneObjectPart objectPart in allPrimsWithInventory) + { + command.Parameters.Clear(); + command.Parameters.Add(_Database.CreateParameter("@PrimID", objectPart.UUID)); + + List inventory = new List(); + + using (SqlDataReader reader = command.ExecuteReader()) + { + while (reader.Read()) + { + TaskInventoryItem item = BuildItem(reader); + + item.ParentID = objectPart.UUID; // Values in database are + // often wrong + inventory.Add(item); + } + } + + objectPart.Inventory.RestoreInventoryItems(inventory); + } + } + } + + /// + /// Stores all object's details apart from inventory + /// + /// + /// + public void StoreObject(SceneObjectGroup obj, UUID regionUUID) + { + _Log.DebugFormat("[MSSQL]: Adding/Changing SceneObjectGroup: {0} to region: {1}, object has {2} prims.", obj.UUID, regionUUID, obj.Children.Count); + + using (SqlConnection conn = new SqlConnection(m_connectionString)) + { + conn.Open(); + SqlTransaction transaction = conn.BeginTransaction(); + + try + { + foreach (SceneObjectPart sceneObjectPart in obj.Children.Values) + { + //Update prim + using (SqlCommand sqlCommand = conn.CreateCommand()) + { + sqlCommand.Transaction = transaction; + try + { + StoreSceneObjectPrim(sceneObjectPart, sqlCommand, obj.UUID, regionUUID); + } + catch (SqlException sqlEx) + { + _Log.ErrorFormat("[REGION DB]: Store SceneObjectPrim SQL error: {0} at line {1}", sqlEx.Message, sqlEx.LineNumber); + throw; + } + } + + //Update primshapes + using (SqlCommand sqlCommand = conn.CreateCommand()) + { + sqlCommand.Transaction = transaction; + try + { + StoreSceneObjectPrimShapes(sceneObjectPart, sqlCommand, obj.UUID, regionUUID); + } + catch (SqlException sqlEx) + { + _Log.ErrorFormat("[REGION DB]: Store SceneObjectPrimShapes SQL error: {0} at line {1}", sqlEx.Message, sqlEx.LineNumber); + throw; + } + } + } + + transaction.Commit(); + } + catch (Exception ex) + { + _Log.ErrorFormat("[REGION DB]: Store SceneObjectGroup error: {0}, Rolling back...", ex.Message); + try + { + transaction.Rollback(); + } + catch (Exception ex2) + { + //Show error + _Log.InfoFormat("[REGION DB]: Rollback of SceneObjectGroup store transaction failed with error: {0}", ex2.Message); + + } + } + } + } + + /// + /// Stores the prim of the sceneobjectpart. + /// + /// The sceneobjectpart or prim. + /// The SQL command with the transaction. + /// The scenegroup UUID. + /// The region UUID. + private void StoreSceneObjectPrim(SceneObjectPart sceneObjectPart, SqlCommand sqlCommand, UUID sceneGroupID, UUID regionUUID) + { + //Big query to update or insert a new prim. + //Note for SQL Server 2008 this could be simplified + string queryPrims = @" +IF EXISTS (SELECT UUID FROM prims WHERE UUID = @UUID) + BEGIN + UPDATE prims SET + CreationDate = @CreationDate, Name = @Name, Text = @Text, Description = @Description, SitName = @SitName, + TouchName = @TouchName, ObjectFlags = @ObjectFlags, OwnerMask = @OwnerMask, NextOwnerMask = @NextOwnerMask, GroupMask = @GroupMask, + EveryoneMask = @EveryoneMask, BaseMask = @BaseMask, PositionX = @PositionX, PositionY = @PositionY, PositionZ = @PositionZ, + GroupPositionX = @GroupPositionX, GroupPositionY = @GroupPositionY, GroupPositionZ = @GroupPositionZ, VelocityX = @VelocityX, + VelocityY = @VelocityY, VelocityZ = @VelocityZ, AngularVelocityX = @AngularVelocityX, AngularVelocityY = @AngularVelocityY, + AngularVelocityZ = @AngularVelocityZ, AccelerationX = @AccelerationX, AccelerationY = @AccelerationY, + AccelerationZ = @AccelerationZ, RotationX = @RotationX, RotationY = @RotationY, RotationZ = @RotationZ, RotationW = @RotationW, + SitTargetOffsetX = @SitTargetOffsetX, SitTargetOffsetY = @SitTargetOffsetY, SitTargetOffsetZ = @SitTargetOffsetZ, + SitTargetOrientW = @SitTargetOrientW, SitTargetOrientX = @SitTargetOrientX, SitTargetOrientY = @SitTargetOrientY, + SitTargetOrientZ = @SitTargetOrientZ, RegionUUID = @RegionUUID, CreatorID = @CreatorID, OwnerID = @OwnerID, GroupID = @GroupID, + LastOwnerID = @LastOwnerID, SceneGroupID = @SceneGroupID, PayPrice = @PayPrice, PayButton1 = @PayButton1, PayButton2 = @PayButton2, + PayButton3 = @PayButton3, PayButton4 = @PayButton4, LoopedSound = @LoopedSound, LoopedSoundGain = @LoopedSoundGain, + TextureAnimation = @TextureAnimation, OmegaX = @OmegaX, OmegaY = @OmegaY, OmegaZ = @OmegaZ, CameraEyeOffsetX = @CameraEyeOffsetX, + CameraEyeOffsetY = @CameraEyeOffsetY, CameraEyeOffsetZ = @CameraEyeOffsetZ, CameraAtOffsetX = @CameraAtOffsetX, + CameraAtOffsetY = @CameraAtOffsetY, CameraAtOffsetZ = @CameraAtOffsetZ, ForceMouselook = @ForceMouselook, + ScriptAccessPin = @ScriptAccessPin, AllowedDrop = @AllowedDrop, DieAtEdge = @DieAtEdge, SalePrice = @SalePrice, + SaleType = @SaleType, ColorR = @ColorR, ColorG = @ColorG, ColorB = @ColorB, ColorA = @ColorA, ParticleSystem = @ParticleSystem, + ClickAction = @ClickAction, Material = @Material, CollisionSound = @CollisionSound, CollisionSoundVolume = @CollisionSoundVolume, PassTouches = @PassTouches, + LinkNumber = @LinkNumber, MediaURL = @MediaURL + WHERE UUID = @UUID + END +ELSE + BEGIN + INSERT INTO + prims ( + UUID, CreationDate, Name, Text, Description, SitName, TouchName, ObjectFlags, OwnerMask, NextOwnerMask, GroupMask, + EveryoneMask, BaseMask, PositionX, PositionY, PositionZ, GroupPositionX, GroupPositionY, GroupPositionZ, VelocityX, + VelocityY, VelocityZ, AngularVelocityX, AngularVelocityY, AngularVelocityZ, AccelerationX, AccelerationY, AccelerationZ, + RotationX, RotationY, RotationZ, RotationW, SitTargetOffsetX, SitTargetOffsetY, SitTargetOffsetZ, SitTargetOrientW, + SitTargetOrientX, SitTargetOrientY, SitTargetOrientZ, RegionUUID, CreatorID, OwnerID, GroupID, LastOwnerID, SceneGroupID, + PayPrice, PayButton1, PayButton2, PayButton3, PayButton4, LoopedSound, LoopedSoundGain, TextureAnimation, OmegaX, + OmegaY, OmegaZ, CameraEyeOffsetX, CameraEyeOffsetY, CameraEyeOffsetZ, CameraAtOffsetX, CameraAtOffsetY, CameraAtOffsetZ, + ForceMouselook, ScriptAccessPin, AllowedDrop, DieAtEdge, SalePrice, SaleType, ColorR, ColorG, ColorB, ColorA, + ParticleSystem, ClickAction, Material, CollisionSound, CollisionSoundVolume, PassTouches, LinkNumber, MediaURL + ) VALUES ( + @UUID, @CreationDate, @Name, @Text, @Description, @SitName, @TouchName, @ObjectFlags, @OwnerMask, @NextOwnerMask, @GroupMask, + @EveryoneMask, @BaseMask, @PositionX, @PositionY, @PositionZ, @GroupPositionX, @GroupPositionY, @GroupPositionZ, @VelocityX, + @VelocityY, @VelocityZ, @AngularVelocityX, @AngularVelocityY, @AngularVelocityZ, @AccelerationX, @AccelerationY, @AccelerationZ, + @RotationX, @RotationY, @RotationZ, @RotationW, @SitTargetOffsetX, @SitTargetOffsetY, @SitTargetOffsetZ, @SitTargetOrientW, + @SitTargetOrientX, @SitTargetOrientY, @SitTargetOrientZ, @RegionUUID, @CreatorID, @OwnerID, @GroupID, @LastOwnerID, @SceneGroupID, + @PayPrice, @PayButton1, @PayButton2, @PayButton3, @PayButton4, @LoopedSound, @LoopedSoundGain, @TextureAnimation, @OmegaX, + @OmegaY, @OmegaZ, @CameraEyeOffsetX, @CameraEyeOffsetY, @CameraEyeOffsetZ, @CameraAtOffsetX, @CameraAtOffsetY, @CameraAtOffsetZ, + @ForceMouselook, @ScriptAccessPin, @AllowedDrop, @DieAtEdge, @SalePrice, @SaleType, @ColorR, @ColorG, @ColorB, @ColorA, + @ParticleSystem, @ClickAction, @Material, @CollisionSound, @CollisionSoundVolume, @PassTouches, @LinkNumber, @MediaURL + ) + END"; + + //Set commandtext. + sqlCommand.CommandText = queryPrims; + //Add parameters + sqlCommand.Parameters.AddRange(CreatePrimParameters(sceneObjectPart, sceneGroupID, regionUUID)); + + //Execute the query. If it fails then error is trapped in calling function + sqlCommand.ExecuteNonQuery(); + } + + /// + /// Stores the scene object prim shapes. + /// + /// The sceneobjectpart containing prim shape. + /// The SQL command with the transaction. + /// The scenegroup UUID. + /// The region UUID. + private void StoreSceneObjectPrimShapes(SceneObjectPart sceneObjectPart, SqlCommand sqlCommand, UUID sceneGroupID, UUID regionUUID) + { + //Big query to or insert or update primshapes + //Note for SQL Server 2008 this can be simplified + string queryPrimShapes = @" +IF EXISTS (SELECT UUID FROM primshapes WHERE UUID = @UUID) + BEGIN + UPDATE primshapes SET + Shape = @Shape, ScaleX = @ScaleX, ScaleY = @ScaleY, ScaleZ = @ScaleZ, PCode = @PCode, PathBegin = @PathBegin, + PathEnd = @PathEnd, PathScaleX = @PathScaleX, PathScaleY = @PathScaleY, PathShearX = @PathShearX, PathShearY = @PathShearY, + PathSkew = @PathSkew, PathCurve = @PathCurve, PathRadiusOffset = @PathRadiusOffset, PathRevolutions = @PathRevolutions, + PathTaperX = @PathTaperX, PathTaperY = @PathTaperY, PathTwist = @PathTwist, PathTwistBegin = @PathTwistBegin, + ProfileBegin = @ProfileBegin, ProfileEnd = @ProfileEnd, ProfileCurve = @ProfileCurve, ProfileHollow = @ProfileHollow, + Texture = @Texture, ExtraParams = @ExtraParams, State = @State, Media = @Media + WHERE UUID = @UUID + END +ELSE + BEGIN + INSERT INTO + primshapes ( + UUID, Shape, ScaleX, ScaleY, ScaleZ, PCode, PathBegin, PathEnd, PathScaleX, PathScaleY, PathShearX, PathShearY, + PathSkew, PathCurve, PathRadiusOffset, PathRevolutions, PathTaperX, PathTaperY, PathTwist, PathTwistBegin, ProfileBegin, + ProfileEnd, ProfileCurve, ProfileHollow, Texture, ExtraParams, State, Media + ) VALUES ( + @UUID, @Shape, @ScaleX, @ScaleY, @ScaleZ, @PCode, @PathBegin, @PathEnd, @PathScaleX, @PathScaleY, @PathShearX, @PathShearY, + @PathSkew, @PathCurve, @PathRadiusOffset, @PathRevolutions, @PathTaperX, @PathTaperY, @PathTwist, @PathTwistBegin, @ProfileBegin, + @ProfileEnd, @ProfileCurve, @ProfileHollow, @Texture, @ExtraParams, @State, @Media + ) + END"; + + //Set commandtext. + sqlCommand.CommandText = queryPrimShapes; + + //Add parameters + sqlCommand.Parameters.AddRange(CreatePrimShapeParameters(sceneObjectPart, sceneGroupID, regionUUID)); + + //Execute the query. If it fails then error is trapped in calling function + sqlCommand.ExecuteNonQuery(); + + } + + /// + /// Removes a object from the database. + /// Meaning removing it from tables Prims, PrimShapes and PrimItems + /// + /// id of scenegroup + /// regionUUID (is this used anyway + public void RemoveObject(UUID objectID, UUID regionUUID) + { + _Log.InfoFormat("[MSSQL]: Removing obj: {0} from region: {1}", objectID, regionUUID); + + //Remove from prims and primsitem table + string sqlPrims = "DELETE FROM PRIMS WHERE SceneGroupID = @objectID"; + string sqlPrimItems = "DELETE FROM PRIMITEMS WHERE primID in (SELECT UUID FROM PRIMS WHERE SceneGroupID = @objectID)"; + string sqlPrimShapes = "DELETE FROM PRIMSHAPES WHERE uuid in (SELECT UUID FROM PRIMS WHERE SceneGroupID = @objectID)"; + + lock (_Database) + { + //Using the non transaction mode. + using (SqlConnection conn = new SqlConnection(m_connectionString)) + using (SqlCommand cmd = new SqlCommand()) + { + cmd.Connection = conn; + cmd.CommandText = sqlPrimShapes; + conn.Open(); + cmd.Parameters.Add(_Database.CreateParameter("objectID", objectID)); + cmd.ExecuteNonQuery(); + + cmd.CommandText = sqlPrimItems; + cmd.ExecuteNonQuery(); + + cmd.CommandText = sqlPrims; + cmd.ExecuteNonQuery(); + } + } + } + + /// + /// Store the inventory of a prim. Warning deletes everything first and then adds all again. + /// + /// + /// + public void StorePrimInventory(UUID primID, ICollection items) + { + //_Log.InfoFormat("[REGION DB: Persisting Prim Inventory with prim ID {0}", primID); + + //Statement from MySQL section! + // For now, we're just going to crudely remove all the previous inventory items + // no matter whether they have changed or not, and replace them with the current set. + + //Delete everything from PrimID + //TODO add index on PrimID in DB, if not already exist + + string sql = "DELETE PRIMITEMS WHERE primID = @primID"; + using (SqlConnection conn = new SqlConnection(m_connectionString)) + using (SqlCommand cmd = new SqlCommand(sql, conn)) + { + cmd.Parameters.Add(_Database.CreateParameter("@primID", primID)); + conn.Open(); + cmd.ExecuteNonQuery(); + } + + sql = + @"INSERT INTO primitems ( + itemID,primID,assetID,parentFolderID,invType,assetType,name,description,creationDate,creatorID,ownerID,lastOwnerID,groupID, + nextPermissions,currentPermissions,basePermissions,everyonePermissions,groupPermissions,flags) + VALUES (@itemID,@primID,@assetID,@parentFolderID,@invType,@assetType,@name,@description,@creationDate,@creatorID,@ownerID, + @lastOwnerID,@groupID,@nextPermissions,@currentPermissions,@basePermissions,@everyonePermissions,@groupPermissions,@flags)"; + + using (SqlConnection conn = new SqlConnection(m_connectionString)) + using (SqlCommand cmd = new SqlCommand(sql, conn)) + { + foreach (TaskInventoryItem taskItem in items) + { + cmd.Parameters.AddRange(CreatePrimInventoryParameters(taskItem)); + conn.Open(); + cmd.ExecuteNonQuery(); + + cmd.Parameters.Clear(); + } + } + } + + #endregion + + /// + /// Loads the terrain map. + /// + /// regionID. + /// + public double[,] LoadTerrain(UUID regionID) + { + double[,] terrain = new double[(int)Constants.RegionSize, (int)Constants.RegionSize]; + terrain.Initialize(); + + string sql = "select top 1 RegionUUID, Revision, Heightfield from terrain where RegionUUID = @RegionUUID order by Revision desc"; + + using (SqlConnection conn = new SqlConnection(m_connectionString)) + using (SqlCommand cmd = new SqlCommand(sql, conn)) + { + // MySqlParameter param = new MySqlParameter(); + cmd.Parameters.Add(_Database.CreateParameter("@RegionUUID", regionID)); + conn.Open(); + using (SqlDataReader reader = cmd.ExecuteReader()) + { + int rev; + if (reader.Read()) + { + MemoryStream str = new MemoryStream((byte[])reader["Heightfield"]); + BinaryReader br = new BinaryReader(str); + for (int x = 0; x < (int)Constants.RegionSize; x++) + { + for (int y = 0; y < (int)Constants.RegionSize; y++) + { + terrain[x, y] = br.ReadDouble(); + } + } + rev = (int)reader["Revision"]; + } + else + { + _Log.Info("[REGION DB]: No terrain found for region"); + return null; + } + _Log.Info("[REGION DB]: Loaded terrain revision r" + rev); + } + } + + return terrain; + } + + /// + /// Stores the terrain map to DB. + /// + /// terrain map data. + /// regionID. + public void StoreTerrain(double[,] terrain, UUID regionID) + { + int revision = Util.UnixTimeSinceEpoch(); + + //Delete old terrain map + string sql = "delete from terrain where RegionUUID=@RegionUUID"; + using (SqlConnection conn = new SqlConnection(m_connectionString)) + using (SqlCommand cmd = new SqlCommand(sql, conn)) + { + cmd.Parameters.Add(_Database.CreateParameter("@RegionUUID", regionID)); + conn.Open(); + cmd.ExecuteNonQuery(); + } + + sql = "insert into terrain(RegionUUID, Revision, Heightfield) values(@RegionUUID, @Revision, @Heightfield)"; + + using (SqlConnection conn = new SqlConnection(m_connectionString)) + using (SqlCommand cmd = new SqlCommand(sql, conn)) + { + cmd.Parameters.Add(_Database.CreateParameter("@RegionUUID", regionID)); + cmd.Parameters.Add(_Database.CreateParameter("@Revision", revision)); + cmd.Parameters.Add(_Database.CreateParameter("@Heightfield", serializeTerrain(terrain))); + conn.Open(); + cmd.ExecuteNonQuery(); + } + + _Log.Info("[REGION DB]: Stored terrain revision r " + revision); + } + + /// + /// Loads all the land objects of a region. + /// + /// The region UUID. + /// + public List LoadLandObjects(UUID regionUUID) + { + List LandDataForRegion = new List(); + + string sql = "select * from land where RegionUUID = @RegionUUID"; + + //Retrieve all land data from region + using (SqlConnection conn = new SqlConnection(m_connectionString)) + using (SqlCommand cmd = new SqlCommand(sql, conn)) + { + cmd.Parameters.Add(_Database.CreateParameter("@RegionUUID", regionUUID)); + conn.Open(); + using (SqlDataReader readerLandData = cmd.ExecuteReader()) + { + while (readerLandData.Read()) + { + LandDataForRegion.Add(BuildLandData(readerLandData)); + } + } + } + + //Retrieve all accesslist data for all landdata + foreach (LandData LandData in LandDataForRegion) + { + sql = "select * from landaccesslist where LandUUID = @LandUUID"; + using (SqlConnection conn = new SqlConnection(m_connectionString)) + using (SqlCommand cmd = new SqlCommand(sql, conn)) + { + cmd.Parameters.Add(_Database.CreateParameter("@LandUUID", LandData.GlobalID)); + conn.Open(); + using (SqlDataReader readerAccessList = cmd.ExecuteReader()) + { + while (readerAccessList.Read()) + { + LandData.ParcelAccessList.Add(BuildLandAccessData(readerAccessList)); + } + } + } + } + + //Return data + return LandDataForRegion; + } + + /// + /// Stores land object with landaccess list. + /// + /// parcel data. + public void StoreLandObject(ILandObject parcel) + { + //As this is only one record in land table I just delete all and then add a new record. + //As the delete landaccess is already in the mysql code + + //Delete old values + RemoveLandObject(parcel.LandData.GlobalID); + + //Insert new values + string sql = @"INSERT INTO [land] +([UUID],[RegionUUID],[LocalLandID],[Bitmap],[Name],[Description],[OwnerUUID],[IsGroupOwned],[Area],[AuctionID],[Category],[ClaimDate],[ClaimPrice],[GroupUUID],[SalePrice],[LandStatus],[LandFlags],[LandingType],[MediaAutoScale],[MediaTextureUUID],[MediaURL],[MusicURL],[PassHours],[PassPrice],[SnapshotUUID],[UserLocationX],[UserLocationY],[UserLocationZ],[UserLookAtX],[UserLookAtY],[UserLookAtZ],[AuthbuyerID],[OtherCleanTime]) +VALUES +(@UUID,@RegionUUID,@LocalLandID,@Bitmap,@Name,@Description,@OwnerUUID,@IsGroupOwned,@Area,@AuctionID,@Category,@ClaimDate,@ClaimPrice,@GroupUUID,@SalePrice,@LandStatus,@LandFlags,@LandingType,@MediaAutoScale,@MediaTextureUUID,@MediaURL,@MusicURL,@PassHours,@PassPrice,@SnapshotUUID,@UserLocationX,@UserLocationY,@UserLocationZ,@UserLookAtX,@UserLookAtY,@UserLookAtZ,@AuthbuyerID,@OtherCleanTime)"; + + using (SqlConnection conn = new SqlConnection(m_connectionString)) + using (SqlCommand cmd = new SqlCommand(sql, conn)) + { + cmd.Parameters.AddRange(CreateLandParameters(parcel.LandData, parcel.RegionUUID)); + conn.Open(); + cmd.ExecuteNonQuery(); + } + + sql = "INSERT INTO [landaccesslist] ([LandUUID],[AccessUUID],[Flags]) VALUES (@LandUUID,@AccessUUID,@Flags)"; + + using (SqlConnection conn = new SqlConnection(m_connectionString)) + using (SqlCommand cmd = new SqlCommand(sql, conn)) + { + conn.Open(); + foreach (ParcelManager.ParcelAccessEntry parcelAccessEntry in parcel.LandData.ParcelAccessList) + { + cmd.Parameters.AddRange(CreateLandAccessParameters(parcelAccessEntry, parcel.RegionUUID)); + + cmd.ExecuteNonQuery(); + cmd.Parameters.Clear(); + } + } + } + + /// + /// Removes a land object from DB. + /// + /// UUID of landobject + public void RemoveLandObject(UUID globalID) + { + string sql = "delete from land where UUID=@UUID"; + using (SqlConnection conn = new SqlConnection(m_connectionString)) + using (SqlCommand cmd = new SqlCommand(sql, conn)) + { + cmd.Parameters.Add(_Database.CreateParameter("@UUID", globalID)); + conn.Open(); + cmd.ExecuteNonQuery(); + } + sql = "delete from landaccesslist where LandUUID=@UUID"; + using (SqlConnection conn = new SqlConnection(m_connectionString)) + using (SqlCommand cmd = new SqlCommand(sql, conn)) + { + cmd.Parameters.Add(_Database.CreateParameter("@UUID", globalID)); + conn.Open(); + cmd.ExecuteNonQuery(); + } + } + public RegionLightShareData LoadRegionWindlightSettings(UUID regionUUID) + { + //This connector doesn't support the windlight module yet + //Return default LL windlight settings + return new RegionLightShareData(); + } + public void StoreRegionWindlightSettings(RegionLightShareData wl) + { + //This connector doesn't support the windlight module yet + } + /// + /// Loads the settings of a region. + /// + /// The region UUID. + /// + public RegionSettings LoadRegionSettings(UUID regionUUID) + { + string sql = "select * from regionsettings where regionUUID = @regionUUID"; + RegionSettings regionSettings; + using (SqlConnection conn = new SqlConnection(m_connectionString)) + using (SqlCommand cmd = new SqlCommand(sql, conn)) + { + cmd.Parameters.Add(_Database.CreateParameter("@regionUUID", regionUUID)); + conn.Open(); + using (SqlDataReader reader = cmd.ExecuteReader()) + { + if (reader.Read()) + { + regionSettings = BuildRegionSettings(reader); + regionSettings.OnSave += StoreRegionSettings; + + return regionSettings; + } + } + } + + //If we reach this point then there are new region settings for that region + regionSettings = new RegionSettings(); + regionSettings.RegionUUID = regionUUID; + regionSettings.OnSave += StoreRegionSettings; + + //Store new values + StoreNewRegionSettings(regionSettings); + + return regionSettings; + } + + /// + /// Store region settings, need to check if the check is really necesary. If we can make something for creating new region. + /// + /// region settings. + public void StoreRegionSettings(RegionSettings regionSettings) + { + //Little check if regionUUID already exist in DB + string regionUUID; + string sql = "SELECT regionUUID FROM regionsettings WHERE regionUUID = @regionUUID"; + using (SqlConnection conn = new SqlConnection(m_connectionString)) + using (SqlCommand cmd = new SqlCommand(sql, conn)) + { + cmd.Parameters.Add(_Database.CreateParameter("@regionUUID", regionSettings.RegionUUID)); + conn.Open(); + regionUUID = cmd.ExecuteScalar().ToString(); + } + + if (string.IsNullOrEmpty(regionUUID)) + { + StoreNewRegionSettings(regionSettings); + } + else + { + //This method only updates region settings!!! First call LoadRegionSettings to create new region settings in DB + sql = + @"UPDATE [regionsettings] SET [block_terraform] = @block_terraform ,[block_fly] = @block_fly ,[allow_damage] = @allow_damage +,[restrict_pushing] = @restrict_pushing ,[allow_land_resell] = @allow_land_resell ,[allow_land_join_divide] = @allow_land_join_divide +,[block_show_in_search] = @block_show_in_search ,[agent_limit] = @agent_limit ,[object_bonus] = @object_bonus ,[maturity] = @maturity +,[disable_scripts] = @disable_scripts ,[disable_collisions] = @disable_collisions ,[disable_physics] = @disable_physics +,[terrain_texture_1] = @terrain_texture_1 ,[terrain_texture_2] = @terrain_texture_2 ,[terrain_texture_3] = @terrain_texture_3 +,[terrain_texture_4] = @terrain_texture_4 ,[elevation_1_nw] = @elevation_1_nw ,[elevation_2_nw] = @elevation_2_nw +,[elevation_1_ne] = @elevation_1_ne ,[elevation_2_ne] = @elevation_2_ne ,[elevation_1_se] = @elevation_1_se ,[elevation_2_se] = @elevation_2_se +,[elevation_1_sw] = @elevation_1_sw ,[elevation_2_sw] = @elevation_2_sw ,[water_height] = @water_height ,[terrain_raise_limit] = @terrain_raise_limit +,[terrain_lower_limit] = @terrain_lower_limit ,[use_estate_sun] = @use_estate_sun ,[fixed_sun] = @fixed_sun ,[sun_position] = @sun_position +,[covenant] = @covenant , [sunvectorx] = @sunvectorx, [sunvectory] = @sunvectory, [sunvectorz] = @sunvectorz, [Sandbox] = @Sandbox, [loaded_creation_datetime] = @loaded_creation_datetime, [loaded_creation_id] = @loaded_creation_id + WHERE [regionUUID] = @regionUUID"; + + using (SqlConnection conn = new SqlConnection(m_connectionString)) + using (SqlCommand cmd = new SqlCommand(sql, conn)) + { + cmd.Parameters.AddRange(CreateRegionSettingParameters(regionSettings)); + conn.Open(); + cmd.ExecuteNonQuery(); + } + } + } + + public void Shutdown() + { + //Not used?? + } + + #region Private Methods + + /// + /// Serializes the terrain data for storage in DB. + /// + /// terrain data + /// + private static Array serializeTerrain(double[,] val) + { + MemoryStream str = new MemoryStream(((int)Constants.RegionSize * (int)Constants.RegionSize) * sizeof(double)); + BinaryWriter bw = new BinaryWriter(str); + + // TODO: COMPATIBILITY - Add byte-order conversions + for (int x = 0; x < (int)Constants.RegionSize; x++) + for (int y = 0; y < (int)Constants.RegionSize; y++) + { + double height = val[x, y]; + if (height == 0.0) + height = double.Epsilon; + + bw.Write(height); + } + + return str.ToArray(); + } + + /// + /// Stores new regionsettings. + /// + /// The region settings. + private void StoreNewRegionSettings(RegionSettings regionSettings) + { + string sql = @"INSERT INTO [regionsettings] + ([regionUUID],[block_terraform],[block_fly],[allow_damage],[restrict_pushing],[allow_land_resell],[allow_land_join_divide], + [block_show_in_search],[agent_limit],[object_bonus],[maturity],[disable_scripts],[disable_collisions],[disable_physics], + [terrain_texture_1],[terrain_texture_2],[terrain_texture_3],[terrain_texture_4],[elevation_1_nw],[elevation_2_nw],[elevation_1_ne], + [elevation_2_ne],[elevation_1_se],[elevation_2_se],[elevation_1_sw],[elevation_2_sw],[water_height],[terrain_raise_limit], + [terrain_lower_limit],[use_estate_sun],[fixed_sun],[sun_position],[covenant],[sunvectorx], [sunvectory], [sunvectorz],[Sandbox], [loaded_creation_datetime], [loaded_creation_id] + ) + VALUES + (@regionUUID,@block_terraform,@block_fly,@allow_damage,@restrict_pushing,@allow_land_resell,@allow_land_join_divide, + @block_show_in_search,@agent_limit,@object_bonus,@maturity,@disable_scripts,@disable_collisions,@disable_physics, + @terrain_texture_1,@terrain_texture_2,@terrain_texture_3,@terrain_texture_4,@elevation_1_nw,@elevation_2_nw,@elevation_1_ne, + @elevation_2_ne,@elevation_1_se,@elevation_2_se,@elevation_1_sw,@elevation_2_sw,@water_height,@terrain_raise_limit, + @terrain_lower_limit,@use_estate_sun,@fixed_sun,@sun_position,@covenant,@sunvectorx,@sunvectory, @sunvectorz, @Sandbox, @loaded_creation_datetime, @loaded_creation_id)"; + + using (SqlConnection conn = new SqlConnection(m_connectionString)) + using (SqlCommand cmd = new SqlCommand(sql, conn)) + { + cmd.Parameters.AddRange(CreateRegionSettingParameters(regionSettings)); + conn.Open(); + cmd.ExecuteNonQuery(); + } + } + + #region Private DataRecord conversion methods + + /// + /// Builds the region settings from a datarecod. + /// + /// datarecord with regionsettings. + /// + private static RegionSettings BuildRegionSettings(IDataRecord row) + { + //TODO change this is some more generic code so we doesnt have to change it every time a new field is added? + RegionSettings newSettings = new RegionSettings(); + + newSettings.RegionUUID = new UUID((Guid)row["regionUUID"]); + newSettings.BlockTerraform = Convert.ToBoolean(row["block_terraform"]); + newSettings.AllowDamage = Convert.ToBoolean(row["allow_damage"]); + newSettings.BlockFly = Convert.ToBoolean(row["block_fly"]); + newSettings.RestrictPushing = Convert.ToBoolean(row["restrict_pushing"]); + newSettings.AllowLandResell = Convert.ToBoolean(row["allow_land_resell"]); + newSettings.AllowLandJoinDivide = Convert.ToBoolean(row["allow_land_join_divide"]); + newSettings.BlockShowInSearch = Convert.ToBoolean(row["block_show_in_search"]); + newSettings.AgentLimit = Convert.ToInt32(row["agent_limit"]); + newSettings.ObjectBonus = Convert.ToDouble(row["object_bonus"]); + newSettings.Maturity = Convert.ToInt32(row["maturity"]); + newSettings.DisableScripts = Convert.ToBoolean(row["disable_scripts"]); + newSettings.DisableCollisions = Convert.ToBoolean(row["disable_collisions"]); + newSettings.DisablePhysics = Convert.ToBoolean(row["disable_physics"]); + newSettings.TerrainTexture1 = new UUID((Guid)row["terrain_texture_1"]); + newSettings.TerrainTexture2 = new UUID((Guid)row["terrain_texture_2"]); + newSettings.TerrainTexture3 = new UUID((Guid)row["terrain_texture_3"]); + newSettings.TerrainTexture4 = new UUID((Guid)row["terrain_texture_4"]); + newSettings.Elevation1NW = Convert.ToDouble(row["elevation_1_nw"]); + newSettings.Elevation2NW = Convert.ToDouble(row["elevation_2_nw"]); + newSettings.Elevation1NE = Convert.ToDouble(row["elevation_1_ne"]); + newSettings.Elevation2NE = Convert.ToDouble(row["elevation_2_ne"]); + newSettings.Elevation1SE = Convert.ToDouble(row["elevation_1_se"]); + newSettings.Elevation2SE = Convert.ToDouble(row["elevation_2_se"]); + newSettings.Elevation1SW = Convert.ToDouble(row["elevation_1_sw"]); + newSettings.Elevation2SW = Convert.ToDouble(row["elevation_2_sw"]); + newSettings.WaterHeight = Convert.ToDouble(row["water_height"]); + newSettings.TerrainRaiseLimit = Convert.ToDouble(row["terrain_raise_limit"]); + newSettings.TerrainLowerLimit = Convert.ToDouble(row["terrain_lower_limit"]); + newSettings.UseEstateSun = Convert.ToBoolean(row["use_estate_sun"]); + newSettings.Sandbox = Convert.ToBoolean(row["sandbox"]); + newSettings.FixedSun = Convert.ToBoolean(row["fixed_sun"]); + newSettings.SunPosition = Convert.ToDouble(row["sun_position"]); + newSettings.SunVector = new Vector3( + Convert.ToSingle(row["sunvectorx"]), + Convert.ToSingle(row["sunvectory"]), + Convert.ToSingle(row["sunvectorz"]) + ); + newSettings.Covenant = new UUID((Guid)row["covenant"]); + + newSettings.LoadedCreationDateTime = Convert.ToInt32(row["loaded_creation_datetime"]); + + if (row["loaded_creation_id"] is DBNull) + newSettings.LoadedCreationID = ""; + else + newSettings.LoadedCreationID = (String)row["loaded_creation_id"]; + return newSettings; + } + + /// + /// Builds the land data from a datarecord. + /// + /// datarecord with land data + /// + private static LandData BuildLandData(IDataRecord row) + { + LandData newData = new LandData(); + + newData.GlobalID = new UUID((Guid)row["UUID"]); + newData.LocalID = Convert.ToInt32(row["LocalLandID"]); + + // Bitmap is a byte[512] + newData.Bitmap = (Byte[])row["Bitmap"]; + + newData.Name = (string)row["Name"]; + newData.Description = (string)row["Description"]; + newData.OwnerID = new UUID((Guid)row["OwnerUUID"]); + newData.IsGroupOwned = Convert.ToBoolean(row["IsGroupOwned"]); + newData.Area = Convert.ToInt32(row["Area"]); + newData.AuctionID = Convert.ToUInt32(row["AuctionID"]); //Unemplemented + newData.Category = (ParcelCategory)Convert.ToInt32(row["Category"]); + //Enum libsecondlife.Parcel.ParcelCategory + newData.ClaimDate = Convert.ToInt32(row["ClaimDate"]); + newData.ClaimPrice = Convert.ToInt32(row["ClaimPrice"]); + newData.GroupID = new UUID((Guid)row["GroupUUID"]); + newData.SalePrice = Convert.ToInt32(row["SalePrice"]); + newData.Status = (ParcelStatus)Convert.ToInt32(row["LandStatus"]); + //Enum. libsecondlife.Parcel.ParcelStatus + newData.Flags = Convert.ToUInt32(row["LandFlags"]); + newData.LandingType = Convert.ToByte(row["LandingType"]); + newData.MediaAutoScale = Convert.ToByte(row["MediaAutoScale"]); + newData.MediaID = new UUID((Guid)row["MediaTextureUUID"]); + newData.MediaURL = (string)row["MediaURL"]; + newData.MusicURL = (string)row["MusicURL"]; + newData.PassHours = Convert.ToSingle(row["PassHours"]); + newData.PassPrice = Convert.ToInt32(row["PassPrice"]); + + // UUID authedbuyer; + // UUID snapshotID; + // + // if (UUID.TryParse((string)row["AuthBuyerID"], out authedbuyer)) + // newData.AuthBuyerID = authedbuyer; + // + // if (UUID.TryParse((string)row["SnapshotUUID"], out snapshotID)) + // newData.SnapshotID = snapshotID; + newData.AuthBuyerID = new UUID((Guid)row["AuthBuyerID"]); + newData.SnapshotID = new UUID((Guid)row["SnapshotUUID"]); + + newData.OtherCleanTime = Convert.ToInt32(row["OtherCleanTime"]); + + try + { + newData.UserLocation = + new Vector3(Convert.ToSingle(row["UserLocationX"]), Convert.ToSingle(row["UserLocationY"]), + Convert.ToSingle(row["UserLocationZ"])); + newData.UserLookAt = + new Vector3(Convert.ToSingle(row["UserLookAtX"]), Convert.ToSingle(row["UserLookAtY"]), + Convert.ToSingle(row["UserLookAtZ"])); + } + catch (InvalidCastException) + { + newData.UserLocation = Vector3.Zero; + newData.UserLookAt = Vector3.Zero; + _Log.ErrorFormat("[PARCEL]: unable to get parcel telehub settings for {1}", newData.Name); + } + + newData.ParcelAccessList = new List(); + + return newData; + } + + /// + /// Builds the landaccess data from a data record. + /// + /// datarecord with landaccess data + /// + private static ParcelManager.ParcelAccessEntry BuildLandAccessData(IDataRecord row) + { + ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry(); + entry.AgentID = new UUID((Guid)row["AccessUUID"]); + entry.Flags = (AccessList)Convert.ToInt32(row["Flags"]); + entry.Time = new DateTime(); + return entry; + } + + /// + /// Builds the prim from a datarecord. + /// + /// datarecord + /// + private static SceneObjectPart BuildPrim(IDataRecord primRow) + { + SceneObjectPart prim = new SceneObjectPart(); + + prim.UUID = new UUID((Guid)primRow["UUID"]); + // explicit conversion of integers is required, which sort + // of sucks. No idea if there is a shortcut here or not. + prim.CreationDate = Convert.ToInt32(primRow["CreationDate"]); + prim.Name = (string)primRow["Name"]; + // various text fields + prim.Text = (string)primRow["Text"]; + prim.Color = Color.FromArgb(Convert.ToInt32(primRow["ColorA"]), + Convert.ToInt32(primRow["ColorR"]), + Convert.ToInt32(primRow["ColorG"]), + Convert.ToInt32(primRow["ColorB"])); + prim.Description = (string)primRow["Description"]; + prim.SitName = (string)primRow["SitName"]; + prim.TouchName = (string)primRow["TouchName"]; + // permissions + prim.Flags = (PrimFlags)Convert.ToUInt32(primRow["ObjectFlags"]); + prim.CreatorID = new UUID((Guid)primRow["CreatorID"]); + prim.OwnerID = new UUID((Guid)primRow["OwnerID"]); + prim.GroupID = new UUID((Guid)primRow["GroupID"]); + prim.LastOwnerID = new UUID((Guid)primRow["LastOwnerID"]); + prim.OwnerMask = Convert.ToUInt32(primRow["OwnerMask"]); + prim.NextOwnerMask = Convert.ToUInt32(primRow["NextOwnerMask"]); + prim.GroupMask = Convert.ToUInt32(primRow["GroupMask"]); + prim.EveryoneMask = Convert.ToUInt32(primRow["EveryoneMask"]); + prim.BaseMask = Convert.ToUInt32(primRow["BaseMask"]); + // vectors + prim.OffsetPosition = new Vector3( + Convert.ToSingle(primRow["PositionX"]), + Convert.ToSingle(primRow["PositionY"]), + Convert.ToSingle(primRow["PositionZ"])); + + prim.GroupPosition = new Vector3( + Convert.ToSingle(primRow["GroupPositionX"]), + Convert.ToSingle(primRow["GroupPositionY"]), + Convert.ToSingle(primRow["GroupPositionZ"])); + + prim.Velocity = new Vector3( + Convert.ToSingle(primRow["VelocityX"]), + Convert.ToSingle(primRow["VelocityY"]), + Convert.ToSingle(primRow["VelocityZ"])); + + prim.AngularVelocity = new Vector3( + Convert.ToSingle(primRow["AngularVelocityX"]), + Convert.ToSingle(primRow["AngularVelocityY"]), + Convert.ToSingle(primRow["AngularVelocityZ"])); + + prim.Acceleration = new Vector3( + Convert.ToSingle(primRow["AccelerationX"]), + Convert.ToSingle(primRow["AccelerationY"]), + Convert.ToSingle(primRow["AccelerationZ"])); + + // quaternions + prim.RotationOffset = new Quaternion( + Convert.ToSingle(primRow["RotationX"]), + Convert.ToSingle(primRow["RotationY"]), + Convert.ToSingle(primRow["RotationZ"]), + Convert.ToSingle(primRow["RotationW"])); + + prim.SitTargetPositionLL = new Vector3( + Convert.ToSingle(primRow["SitTargetOffsetX"]), + Convert.ToSingle(primRow["SitTargetOffsetY"]), + Convert.ToSingle(primRow["SitTargetOffsetZ"])); + + prim.SitTargetOrientationLL = new Quaternion( + Convert.ToSingle(primRow["SitTargetOrientX"]), + Convert.ToSingle(primRow["SitTargetOrientY"]), + Convert.ToSingle(primRow["SitTargetOrientZ"]), + Convert.ToSingle(primRow["SitTargetOrientW"])); + + prim.PayPrice[0] = Convert.ToInt32(primRow["PayPrice"]); + prim.PayPrice[1] = Convert.ToInt32(primRow["PayButton1"]); + prim.PayPrice[2] = Convert.ToInt32(primRow["PayButton2"]); + prim.PayPrice[3] = Convert.ToInt32(primRow["PayButton3"]); + prim.PayPrice[4] = Convert.ToInt32(primRow["PayButton4"]); + + prim.Sound = new UUID((Guid)primRow["LoopedSound"]); + prim.SoundGain = Convert.ToSingle(primRow["LoopedSoundGain"]); + prim.SoundFlags = 1; // If it's persisted at all, it's looped + + if (!(primRow["TextureAnimation"] is DBNull)) + prim.TextureAnimation = (Byte[])primRow["TextureAnimation"]; + if (!(primRow["ParticleSystem"] is DBNull)) + prim.ParticleSystem = (Byte[])primRow["ParticleSystem"]; + + prim.AngularVelocity = new Vector3( + Convert.ToSingle(primRow["OmegaX"]), + Convert.ToSingle(primRow["OmegaY"]), + Convert.ToSingle(primRow["OmegaZ"])); + + prim.SetCameraEyeOffset(new Vector3( + Convert.ToSingle(primRow["CameraEyeOffsetX"]), + Convert.ToSingle(primRow["CameraEyeOffsetY"]), + Convert.ToSingle(primRow["CameraEyeOffsetZ"]) + )); + + prim.SetCameraAtOffset(new Vector3( + Convert.ToSingle(primRow["CameraAtOffsetX"]), + Convert.ToSingle(primRow["CameraAtOffsetY"]), + Convert.ToSingle(primRow["CameraAtOffsetZ"]) + )); + + if (Convert.ToInt16(primRow["ForceMouselook"]) != 0) + prim.SetForceMouselook(true); + + prim.ScriptAccessPin = Convert.ToInt32(primRow["ScriptAccessPin"]); + + if (Convert.ToInt16(primRow["AllowedDrop"]) != 0) + prim.AllowedDrop = true; + + if (Convert.ToInt16(primRow["DieAtEdge"]) != 0) + prim.DIE_AT_EDGE = true; + + prim.SalePrice = Convert.ToInt32(primRow["SalePrice"]); + prim.ObjectSaleType = Convert.ToByte(primRow["SaleType"]); + + prim.Material = Convert.ToByte(primRow["Material"]); + + if (!(primRow["ClickAction"] is DBNull)) + prim.ClickAction = Convert.ToByte(primRow["ClickAction"]); + + prim.CollisionSound = new UUID((Guid)primRow["CollisionSound"]); + prim.CollisionSoundVolume = Convert.ToSingle(primRow["CollisionSoundVolume"]); + if (Convert.ToInt16(primRow["PassTouches"]) != 0) + prim.PassTouches = true; + prim.LinkNum = Convert.ToInt32(primRow["LinkNumber"]); + + if (!(primRow["MediaURL"] is System.DBNull)) + prim.MediaUrl = (string)primRow["MediaURL"]; + + return prim; + } + + /// + /// Builds the prim shape from a datarecord. + /// + /// The row. + /// + private static PrimitiveBaseShape BuildShape(IDataRecord shapeRow) + { + PrimitiveBaseShape baseShape = new PrimitiveBaseShape(); + + baseShape.Scale = new Vector3( + Convert.ToSingle(shapeRow["ScaleX"]), + Convert.ToSingle(shapeRow["ScaleY"]), + Convert.ToSingle(shapeRow["ScaleZ"])); + + // paths + baseShape.PCode = Convert.ToByte(shapeRow["PCode"]); + baseShape.PathBegin = Convert.ToUInt16(shapeRow["PathBegin"]); + baseShape.PathEnd = Convert.ToUInt16(shapeRow["PathEnd"]); + baseShape.PathScaleX = Convert.ToByte(shapeRow["PathScaleX"]); + baseShape.PathScaleY = Convert.ToByte(shapeRow["PathScaleY"]); + baseShape.PathShearX = Convert.ToByte(shapeRow["PathShearX"]); + baseShape.PathShearY = Convert.ToByte(shapeRow["PathShearY"]); + baseShape.PathSkew = Convert.ToSByte(shapeRow["PathSkew"]); + baseShape.PathCurve = Convert.ToByte(shapeRow["PathCurve"]); + baseShape.PathRadiusOffset = Convert.ToSByte(shapeRow["PathRadiusOffset"]); + baseShape.PathRevolutions = Convert.ToByte(shapeRow["PathRevolutions"]); + baseShape.PathTaperX = Convert.ToSByte(shapeRow["PathTaperX"]); + baseShape.PathTaperY = Convert.ToSByte(shapeRow["PathTaperY"]); + baseShape.PathTwist = Convert.ToSByte(shapeRow["PathTwist"]); + baseShape.PathTwistBegin = Convert.ToSByte(shapeRow["PathTwistBegin"]); + // profile + baseShape.ProfileBegin = Convert.ToUInt16(shapeRow["ProfileBegin"]); + baseShape.ProfileEnd = Convert.ToUInt16(shapeRow["ProfileEnd"]); + baseShape.ProfileCurve = Convert.ToByte(shapeRow["ProfileCurve"]); + baseShape.ProfileHollow = Convert.ToUInt16(shapeRow["ProfileHollow"]); + + byte[] textureEntry = (byte[])shapeRow["Texture"]; + baseShape.TextureEntry = textureEntry; + + baseShape.ExtraParams = (byte[])shapeRow["ExtraParams"]; + + try + { + baseShape.State = Convert.ToByte(shapeRow["State"]); + } + catch (InvalidCastException) + { + } + + if (!(shapeRow["Media"] is System.DBNull)) + baseShape.Media = PrimitiveBaseShape.MediaList.FromXml((string)shapeRow["Media"]); + + return baseShape; + } + + /// + /// Build a prim inventory item from the persisted data. + /// + /// + /// + private static TaskInventoryItem BuildItem(IDataRecord inventoryRow) + { + TaskInventoryItem taskItem = new TaskInventoryItem(); + + taskItem.ItemID = new UUID((Guid)inventoryRow["itemID"]); + taskItem.ParentPartID = new UUID((Guid)inventoryRow["primID"]); + taskItem.AssetID = new UUID((Guid)inventoryRow["assetID"]); + taskItem.ParentID = new UUID((Guid)inventoryRow["parentFolderID"]); + + taskItem.InvType = Convert.ToInt32(inventoryRow["invType"]); + taskItem.Type = Convert.ToInt32(inventoryRow["assetType"]); + + taskItem.Name = (string)inventoryRow["name"]; + taskItem.Description = (string)inventoryRow["description"]; + taskItem.CreationDate = Convert.ToUInt32(inventoryRow["creationDate"]); + taskItem.CreatorID = new UUID((Guid)inventoryRow["creatorID"]); + taskItem.OwnerID = new UUID((Guid)inventoryRow["ownerID"]); + taskItem.LastOwnerID = new UUID((Guid)inventoryRow["lastOwnerID"]); + taskItem.GroupID = new UUID((Guid)inventoryRow["groupID"]); + + taskItem.NextPermissions = Convert.ToUInt32(inventoryRow["nextPermissions"]); + taskItem.CurrentPermissions = Convert.ToUInt32(inventoryRow["currentPermissions"]); + taskItem.BasePermissions = Convert.ToUInt32(inventoryRow["basePermissions"]); + taskItem.EveryonePermissions = Convert.ToUInt32(inventoryRow["everyonePermissions"]); + taskItem.GroupPermissions = Convert.ToUInt32(inventoryRow["groupPermissions"]); + taskItem.Flags = Convert.ToUInt32(inventoryRow["flags"]); + + return taskItem; + } + + #endregion + + #region Create parameters methods + + /// + /// Creates the prim inventory parameters. + /// + /// item in inventory. + /// + private SqlParameter[] CreatePrimInventoryParameters(TaskInventoryItem taskItem) + { + List parameters = new List(); + + parameters.Add(_Database.CreateParameter("itemID", taskItem.ItemID)); + parameters.Add(_Database.CreateParameter("primID", taskItem.ParentPartID)); + parameters.Add(_Database.CreateParameter("assetID", taskItem.AssetID)); + parameters.Add(_Database.CreateParameter("parentFolderID", taskItem.ParentID)); + parameters.Add(_Database.CreateParameter("invType", taskItem.InvType)); + parameters.Add(_Database.CreateParameter("assetType", taskItem.Type)); + + parameters.Add(_Database.CreateParameter("name", taskItem.Name)); + parameters.Add(_Database.CreateParameter("description", taskItem.Description)); + parameters.Add(_Database.CreateParameter("creationDate", taskItem.CreationDate)); + parameters.Add(_Database.CreateParameter("creatorID", taskItem.CreatorID)); + parameters.Add(_Database.CreateParameter("ownerID", taskItem.OwnerID)); + parameters.Add(_Database.CreateParameter("lastOwnerID", taskItem.LastOwnerID)); + parameters.Add(_Database.CreateParameter("groupID", taskItem.GroupID)); + parameters.Add(_Database.CreateParameter("nextPermissions", taskItem.NextPermissions)); + parameters.Add(_Database.CreateParameter("currentPermissions", taskItem.CurrentPermissions)); + parameters.Add(_Database.CreateParameter("basePermissions", taskItem.BasePermissions)); + parameters.Add(_Database.CreateParameter("everyonePermissions", taskItem.EveryonePermissions)); + parameters.Add(_Database.CreateParameter("groupPermissions", taskItem.GroupPermissions)); + parameters.Add(_Database.CreateParameter("flags", taskItem.Flags)); + + return parameters.ToArray(); + } + + /// + /// Creates the region setting parameters. + /// + /// regionsettings. + /// + private SqlParameter[] CreateRegionSettingParameters(RegionSettings settings) + { + List parameters = new List(); + + parameters.Add(_Database.CreateParameter("regionUUID", settings.RegionUUID)); + parameters.Add(_Database.CreateParameter("block_terraform", settings.BlockTerraform)); + parameters.Add(_Database.CreateParameter("block_fly", settings.BlockFly)); + parameters.Add(_Database.CreateParameter("allow_damage", settings.AllowDamage)); + parameters.Add(_Database.CreateParameter("restrict_pushing", settings.RestrictPushing)); + parameters.Add(_Database.CreateParameter("allow_land_resell", settings.AllowLandResell)); + parameters.Add(_Database.CreateParameter("allow_land_join_divide", settings.AllowLandJoinDivide)); + parameters.Add(_Database.CreateParameter("block_show_in_search", settings.BlockShowInSearch)); + parameters.Add(_Database.CreateParameter("agent_limit", settings.AgentLimit)); + parameters.Add(_Database.CreateParameter("object_bonus", settings.ObjectBonus)); + parameters.Add(_Database.CreateParameter("maturity", settings.Maturity)); + parameters.Add(_Database.CreateParameter("disable_scripts", settings.DisableScripts)); + parameters.Add(_Database.CreateParameter("disable_collisions", settings.DisableCollisions)); + parameters.Add(_Database.CreateParameter("disable_physics", settings.DisablePhysics)); + parameters.Add(_Database.CreateParameter("terrain_texture_1", settings.TerrainTexture1)); + parameters.Add(_Database.CreateParameter("terrain_texture_2", settings.TerrainTexture2)); + parameters.Add(_Database.CreateParameter("terrain_texture_3", settings.TerrainTexture3)); + parameters.Add(_Database.CreateParameter("terrain_texture_4", settings.TerrainTexture4)); + parameters.Add(_Database.CreateParameter("elevation_1_nw", settings.Elevation1NW)); + parameters.Add(_Database.CreateParameter("elevation_2_nw", settings.Elevation2NW)); + parameters.Add(_Database.CreateParameter("elevation_1_ne", settings.Elevation1NE)); + parameters.Add(_Database.CreateParameter("elevation_2_ne", settings.Elevation2NE)); + parameters.Add(_Database.CreateParameter("elevation_1_se", settings.Elevation1SE)); + parameters.Add(_Database.CreateParameter("elevation_2_se", settings.Elevation2SE)); + parameters.Add(_Database.CreateParameter("elevation_1_sw", settings.Elevation1SW)); + parameters.Add(_Database.CreateParameter("elevation_2_sw", settings.Elevation2SW)); + parameters.Add(_Database.CreateParameter("water_height", settings.WaterHeight)); + parameters.Add(_Database.CreateParameter("terrain_raise_limit", settings.TerrainRaiseLimit)); + parameters.Add(_Database.CreateParameter("terrain_lower_limit", settings.TerrainLowerLimit)); + parameters.Add(_Database.CreateParameter("use_estate_sun", settings.UseEstateSun)); + parameters.Add(_Database.CreateParameter("sandbox", settings.Sandbox)); + parameters.Add(_Database.CreateParameter("fixed_sun", settings.FixedSun)); + parameters.Add(_Database.CreateParameter("sun_position", settings.SunPosition)); + parameters.Add(_Database.CreateParameter("sunvectorx", settings.SunVector.X)); + parameters.Add(_Database.CreateParameter("sunvectory", settings.SunVector.Y)); + parameters.Add(_Database.CreateParameter("sunvectorz", settings.SunVector.Z)); + parameters.Add(_Database.CreateParameter("covenant", settings.Covenant)); + parameters.Add(_Database.CreateParameter("Loaded_Creation_DateTime", settings.LoadedCreationDateTime)); + parameters.Add(_Database.CreateParameter("Loaded_Creation_ID", settings.LoadedCreationID)); + + return parameters.ToArray(); + } + + /// + /// Creates the land parameters. + /// + /// land parameters. + /// region UUID. + /// + private SqlParameter[] CreateLandParameters(LandData land, UUID regionUUID) + { + List parameters = new List(); + + parameters.Add(_Database.CreateParameter("UUID", land.GlobalID)); + parameters.Add(_Database.CreateParameter("RegionUUID", regionUUID)); + parameters.Add(_Database.CreateParameter("LocalLandID", land.LocalID)); + + // Bitmap is a byte[512] + parameters.Add(_Database.CreateParameter("Bitmap", land.Bitmap)); + + parameters.Add(_Database.CreateParameter("Name", land.Name)); + parameters.Add(_Database.CreateParameter("Description", land.Description)); + parameters.Add(_Database.CreateParameter("OwnerUUID", land.OwnerID)); + parameters.Add(_Database.CreateParameter("IsGroupOwned", land.IsGroupOwned)); + parameters.Add(_Database.CreateParameter("Area", land.Area)); + parameters.Add(_Database.CreateParameter("AuctionID", land.AuctionID)); //Unemplemented + parameters.Add(_Database.CreateParameter("Category", (int)land.Category)); //Enum libsecondlife.Parcel.ParcelCategory + parameters.Add(_Database.CreateParameter("ClaimDate", land.ClaimDate)); + parameters.Add(_Database.CreateParameter("ClaimPrice", land.ClaimPrice)); + parameters.Add(_Database.CreateParameter("GroupUUID", land.GroupID)); + parameters.Add(_Database.CreateParameter("SalePrice", land.SalePrice)); + parameters.Add(_Database.CreateParameter("LandStatus", (int)land.Status)); //Enum. libsecondlife.Parcel.ParcelStatus + parameters.Add(_Database.CreateParameter("LandFlags", land.Flags)); + parameters.Add(_Database.CreateParameter("LandingType", land.LandingType)); + parameters.Add(_Database.CreateParameter("MediaAutoScale", land.MediaAutoScale)); + parameters.Add(_Database.CreateParameter("MediaTextureUUID", land.MediaID)); + parameters.Add(_Database.CreateParameter("MediaURL", land.MediaURL)); + parameters.Add(_Database.CreateParameter("MusicURL", land.MusicURL)); + parameters.Add(_Database.CreateParameter("PassHours", land.PassHours)); + parameters.Add(_Database.CreateParameter("PassPrice", land.PassPrice)); + parameters.Add(_Database.CreateParameter("SnapshotUUID", land.SnapshotID)); + parameters.Add(_Database.CreateParameter("UserLocationX", land.UserLocation.X)); + parameters.Add(_Database.CreateParameter("UserLocationY", land.UserLocation.Y)); + parameters.Add(_Database.CreateParameter("UserLocationZ", land.UserLocation.Z)); + parameters.Add(_Database.CreateParameter("UserLookAtX", land.UserLookAt.X)); + parameters.Add(_Database.CreateParameter("UserLookAtY", land.UserLookAt.Y)); + parameters.Add(_Database.CreateParameter("UserLookAtZ", land.UserLookAt.Z)); + parameters.Add(_Database.CreateParameter("AuthBuyerID", land.AuthBuyerID)); + parameters.Add(_Database.CreateParameter("OtherCleanTime", land.OtherCleanTime)); + + return parameters.ToArray(); + } + + /// + /// Creates the land access parameters. + /// + /// parcel access entry. + /// parcel ID. + /// + private SqlParameter[] CreateLandAccessParameters(ParcelManager.ParcelAccessEntry parcelAccessEntry, UUID parcelID) + { + List parameters = new List(); + + parameters.Add(_Database.CreateParameter("LandUUID", parcelID)); + parameters.Add(_Database.CreateParameter("AccessUUID", parcelAccessEntry.AgentID)); + parameters.Add(_Database.CreateParameter("Flags", parcelAccessEntry.Flags)); + + return parameters.ToArray(); + } + + /// + /// Creates the prim parameters for storing in DB. + /// + /// Basic data of SceneObjectpart prim. + /// The scenegroup ID. + /// The region ID. + /// + private SqlParameter[] CreatePrimParameters(SceneObjectPart prim, UUID sceneGroupID, UUID regionUUID) + { + List parameters = new List(); + + parameters.Add(_Database.CreateParameter("UUID", prim.UUID)); + parameters.Add(_Database.CreateParameter("RegionUUID", regionUUID)); + parameters.Add(_Database.CreateParameter("CreationDate", prim.CreationDate)); + parameters.Add(_Database.CreateParameter("Name", prim.Name)); + parameters.Add(_Database.CreateParameter("SceneGroupID", sceneGroupID)); + // the UUID of the root part for this SceneObjectGroup + // various text fields + parameters.Add(_Database.CreateParameter("Text", prim.Text)); + parameters.Add(_Database.CreateParameter("ColorR", prim.Color.R)); + parameters.Add(_Database.CreateParameter("ColorG", prim.Color.G)); + parameters.Add(_Database.CreateParameter("ColorB", prim.Color.B)); + parameters.Add(_Database.CreateParameter("ColorA", prim.Color.A)); + parameters.Add(_Database.CreateParameter("Description", prim.Description)); + parameters.Add(_Database.CreateParameter("SitName", prim.SitName)); + parameters.Add(_Database.CreateParameter("TouchName", prim.TouchName)); + // permissions + parameters.Add(_Database.CreateParameter("ObjectFlags", (uint)prim.Flags)); + parameters.Add(_Database.CreateParameter("CreatorID", prim.CreatorID)); + parameters.Add(_Database.CreateParameter("OwnerID", prim.OwnerID)); + parameters.Add(_Database.CreateParameter("GroupID", prim.GroupID)); + parameters.Add(_Database.CreateParameter("LastOwnerID", prim.LastOwnerID)); + parameters.Add(_Database.CreateParameter("OwnerMask", prim.OwnerMask)); + parameters.Add(_Database.CreateParameter("NextOwnerMask", prim.NextOwnerMask)); + parameters.Add(_Database.CreateParameter("GroupMask", prim.GroupMask)); + parameters.Add(_Database.CreateParameter("EveryoneMask", prim.EveryoneMask)); + parameters.Add(_Database.CreateParameter("BaseMask", prim.BaseMask)); + // vectors + parameters.Add(_Database.CreateParameter("PositionX", prim.OffsetPosition.X)); + parameters.Add(_Database.CreateParameter("PositionY", prim.OffsetPosition.Y)); + parameters.Add(_Database.CreateParameter("PositionZ", prim.OffsetPosition.Z)); + parameters.Add(_Database.CreateParameter("GroupPositionX", prim.GroupPosition.X)); + parameters.Add(_Database.CreateParameter("GroupPositionY", prim.GroupPosition.Y)); + parameters.Add(_Database.CreateParameter("GroupPositionZ", prim.GroupPosition.Z)); + parameters.Add(_Database.CreateParameter("VelocityX", prim.Velocity.X)); + parameters.Add(_Database.CreateParameter("VelocityY", prim.Velocity.Y)); + parameters.Add(_Database.CreateParameter("VelocityZ", prim.Velocity.Z)); + parameters.Add(_Database.CreateParameter("AngularVelocityX", prim.AngularVelocity.X)); + parameters.Add(_Database.CreateParameter("AngularVelocityY", prim.AngularVelocity.Y)); + parameters.Add(_Database.CreateParameter("AngularVelocityZ", prim.AngularVelocity.Z)); + parameters.Add(_Database.CreateParameter("AccelerationX", prim.Acceleration.X)); + parameters.Add(_Database.CreateParameter("AccelerationY", prim.Acceleration.Y)); + parameters.Add(_Database.CreateParameter("AccelerationZ", prim.Acceleration.Z)); + // quaternions + parameters.Add(_Database.CreateParameter("RotationX", prim.RotationOffset.X)); + parameters.Add(_Database.CreateParameter("RotationY", prim.RotationOffset.Y)); + parameters.Add(_Database.CreateParameter("RotationZ", prim.RotationOffset.Z)); + parameters.Add(_Database.CreateParameter("RotationW", prim.RotationOffset.W)); + + // Sit target + Vector3 sitTargetPos = prim.SitTargetPositionLL; + parameters.Add(_Database.CreateParameter("SitTargetOffsetX", sitTargetPos.X)); + parameters.Add(_Database.CreateParameter("SitTargetOffsetY", sitTargetPos.Y)); + parameters.Add(_Database.CreateParameter("SitTargetOffsetZ", sitTargetPos.Z)); + + Quaternion sitTargetOrient = prim.SitTargetOrientationLL; + parameters.Add(_Database.CreateParameter("SitTargetOrientW", sitTargetOrient.W)); + parameters.Add(_Database.CreateParameter("SitTargetOrientX", sitTargetOrient.X)); + parameters.Add(_Database.CreateParameter("SitTargetOrientY", sitTargetOrient.Y)); + parameters.Add(_Database.CreateParameter("SitTargetOrientZ", sitTargetOrient.Z)); + + parameters.Add(_Database.CreateParameter("PayPrice", prim.PayPrice[0])); + parameters.Add(_Database.CreateParameter("PayButton1", prim.PayPrice[1])); + parameters.Add(_Database.CreateParameter("PayButton2", prim.PayPrice[2])); + parameters.Add(_Database.CreateParameter("PayButton3", prim.PayPrice[3])); + parameters.Add(_Database.CreateParameter("PayButton4", prim.PayPrice[4])); + + if ((prim.SoundFlags & 1) != 0) // Looped + { + parameters.Add(_Database.CreateParameter("LoopedSound", prim.Sound)); + parameters.Add(_Database.CreateParameter("LoopedSoundGain", prim.SoundGain)); + } + else + { + parameters.Add(_Database.CreateParameter("LoopedSound", UUID.Zero)); + parameters.Add(_Database.CreateParameter("LoopedSoundGain", 0.0f)); + } + + parameters.Add(_Database.CreateParameter("TextureAnimation", prim.TextureAnimation)); + parameters.Add(_Database.CreateParameter("ParticleSystem", prim.ParticleSystem)); + + parameters.Add(_Database.CreateParameter("OmegaX", prim.AngularVelocity.X)); + parameters.Add(_Database.CreateParameter("OmegaY", prim.AngularVelocity.Y)); + parameters.Add(_Database.CreateParameter("OmegaZ", prim.AngularVelocity.Z)); + + parameters.Add(_Database.CreateParameter("CameraEyeOffsetX", prim.GetCameraEyeOffset().X)); + parameters.Add(_Database.CreateParameter("CameraEyeOffsetY", prim.GetCameraEyeOffset().Y)); + parameters.Add(_Database.CreateParameter("CameraEyeOffsetZ", prim.GetCameraEyeOffset().Z)); + + parameters.Add(_Database.CreateParameter("CameraAtOffsetX", prim.GetCameraAtOffset().X)); + parameters.Add(_Database.CreateParameter("CameraAtOffsetY", prim.GetCameraAtOffset().Y)); + parameters.Add(_Database.CreateParameter("CameraAtOffsetZ", prim.GetCameraAtOffset().Z)); + + if (prim.GetForceMouselook()) + parameters.Add(_Database.CreateParameter("ForceMouselook", 1)); + else + parameters.Add(_Database.CreateParameter("ForceMouselook", 0)); + + parameters.Add(_Database.CreateParameter("ScriptAccessPin", prim.ScriptAccessPin)); + + if (prim.AllowedDrop) + parameters.Add(_Database.CreateParameter("AllowedDrop", 1)); + else + parameters.Add(_Database.CreateParameter("AllowedDrop", 0)); + + if (prim.DIE_AT_EDGE) + parameters.Add(_Database.CreateParameter("DieAtEdge", 1)); + else + parameters.Add(_Database.CreateParameter("DieAtEdge", 0)); + + parameters.Add(_Database.CreateParameter("SalePrice", prim.SalePrice)); + parameters.Add(_Database.CreateParameter("SaleType", prim.ObjectSaleType)); + + byte clickAction = prim.ClickAction; + parameters.Add(_Database.CreateParameter("ClickAction", clickAction)); + + parameters.Add(_Database.CreateParameter("Material", prim.Material)); + + parameters.Add(_Database.CreateParameter("CollisionSound", prim.CollisionSound)); + parameters.Add(_Database.CreateParameter("CollisionSoundVolume", prim.CollisionSoundVolume)); + if (prim.PassTouches) + parameters.Add(_Database.CreateParameter("PassTouches", 1)); + else + parameters.Add(_Database.CreateParameter("PassTouches", 0)); + parameters.Add(_Database.CreateParameter("LinkNumber", prim.LinkNum)); + parameters.Add(_Database.CreateParameter("MediaURL", prim.MediaUrl)); + + return parameters.ToArray(); + } + + /// + /// Creates the primshape parameters for stroing in DB. + /// + /// Basic data of SceneObjectpart prim. + /// The scene group ID. + /// The region UUID. + /// + private SqlParameter[] CreatePrimShapeParameters(SceneObjectPart prim, UUID sceneGroupID, UUID regionUUID) + { + List parameters = new List(); + + PrimitiveBaseShape s = prim.Shape; + parameters.Add(_Database.CreateParameter("UUID", prim.UUID)); + // shape is an enum + parameters.Add(_Database.CreateParameter("Shape", 0)); + // vectors + parameters.Add(_Database.CreateParameter("ScaleX", s.Scale.X)); + parameters.Add(_Database.CreateParameter("ScaleY", s.Scale.Y)); + parameters.Add(_Database.CreateParameter("ScaleZ", s.Scale.Z)); + // paths + parameters.Add(_Database.CreateParameter("PCode", s.PCode)); + parameters.Add(_Database.CreateParameter("PathBegin", s.PathBegin)); + parameters.Add(_Database.CreateParameter("PathEnd", s.PathEnd)); + parameters.Add(_Database.CreateParameter("PathScaleX", s.PathScaleX)); + parameters.Add(_Database.CreateParameter("PathScaleY", s.PathScaleY)); + parameters.Add(_Database.CreateParameter("PathShearX", s.PathShearX)); + parameters.Add(_Database.CreateParameter("PathShearY", s.PathShearY)); + parameters.Add(_Database.CreateParameter("PathSkew", s.PathSkew)); + parameters.Add(_Database.CreateParameter("PathCurve", s.PathCurve)); + parameters.Add(_Database.CreateParameter("PathRadiusOffset", s.PathRadiusOffset)); + parameters.Add(_Database.CreateParameter("PathRevolutions", s.PathRevolutions)); + parameters.Add(_Database.CreateParameter("PathTaperX", s.PathTaperX)); + parameters.Add(_Database.CreateParameter("PathTaperY", s.PathTaperY)); + parameters.Add(_Database.CreateParameter("PathTwist", s.PathTwist)); + parameters.Add(_Database.CreateParameter("PathTwistBegin", s.PathTwistBegin)); + // profile + parameters.Add(_Database.CreateParameter("ProfileBegin", s.ProfileBegin)); + parameters.Add(_Database.CreateParameter("ProfileEnd", s.ProfileEnd)); + parameters.Add(_Database.CreateParameter("ProfileCurve", s.ProfileCurve)); + parameters.Add(_Database.CreateParameter("ProfileHollow", s.ProfileHollow)); + parameters.Add(_Database.CreateParameter("Texture", s.TextureEntry)); + parameters.Add(_Database.CreateParameter("ExtraParams", s.ExtraParams)); + parameters.Add(_Database.CreateParameter("State", s.State)); + parameters.Add(_Database.CreateParameter("Media", null == s.Media ? null : s.Media.ToXml())); + + return parameters.ToArray(); + } + + #endregion + + #endregion + } +} diff --git a/OpenSim/Data/MySQL/MySQLLegacyRegionData.cs b/OpenSim/Data/MySQL/MySQLLegacyRegionData.cs deleted file mode 100644 index a39e68d..0000000 --- a/OpenSim/Data/MySQL/MySQLLegacyRegionData.cs +++ /dev/null @@ -1,1820 +0,0 @@ -/* - * Copyright (c) Contributors, http://opensimulator.org/ - * See CONTRIBUTORS.TXT for a full list of copyright holders. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of the OpenSimulator Project nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -using System; -using System.Collections.Generic; -using System.Data; -using System.Drawing; -using System.IO; -using System.Reflection; -using System.Threading; -using log4net; -using MySql.Data.MySqlClient; -using OpenMetaverse; -using OpenSim.Framework; -using OpenSim.Region.Framework.Interfaces; -using OpenSim.Region.Framework.Scenes; -using OpenSim.Data; - -namespace OpenSim.Data.MySQL -{ - /// - /// A MySQL Interface for the Region Server - /// - public class MySQLDataStore : IRegionDataStore - { - private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - - private string m_connectionString; - private object m_dbLock = new object(); - - public void Initialise(string connectionString) - { - m_connectionString = connectionString; - - using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) - { - dbcon.Open(); - - // Apply new Migrations - // - Assembly assem = GetType().Assembly; - Migration m = new Migration(dbcon, assem, "RegionStore"); - m.Update(); - - // Clean dropped attachments - // - try - { - using (MySqlCommand cmd = dbcon.CreateCommand()) - { - cmd.CommandText = "delete from prims, primshapes using prims " + - "left join primshapes on prims.uuid = primshapes.uuid " + - "where PCode = 9 and State <> 0"; - ExecuteNonQuery(cmd); - } - } - catch (MySqlException ex) - { - m_log.Error("[REGION DB]: Error cleaning up dropped attachments: " + ex.Message); - } - } - } - - private IDataReader ExecuteReader(MySqlCommand c) - { - IDataReader r = null; - - try - { - r = c.ExecuteReader(); - } - catch (Exception e) - { - m_log.Error("[REGION DB]: MySQL error in ExecuteReader: " + e.Message); - throw; - } - - return r; - } - - private void ExecuteNonQuery(MySqlCommand c) - { - try - { - c.ExecuteNonQuery(); - } - catch (Exception e) - { - m_log.Error("[REGION DB]: MySQL error in ExecuteNonQuery: " + e.Message); - throw; - } - } - - public void Dispose() {} - - public void StoreObject(SceneObjectGroup obj, UUID regionUUID) - { - uint flags = obj.RootPart.GetEffectiveObjectFlags(); - - // Eligibility check - // - if ((flags & (uint)PrimFlags.Temporary) != 0) - return; - if ((flags & (uint)PrimFlags.TemporaryOnRez) != 0) - return; - - lock (m_dbLock) - { - using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) - { - dbcon.Open(); - MySqlCommand cmd = dbcon.CreateCommand(); - - foreach (SceneObjectPart prim in obj.Children.Values) - { - cmd.Parameters.Clear(); - - cmd.CommandText = "replace into prims (" + - "UUID, CreationDate, " + - "Name, Text, Description, " + - "SitName, TouchName, ObjectFlags, " + - "OwnerMask, NextOwnerMask, GroupMask, " + - "EveryoneMask, BaseMask, PositionX, " + - "PositionY, PositionZ, GroupPositionX, " + - "GroupPositionY, GroupPositionZ, VelocityX, " + - "VelocityY, VelocityZ, AngularVelocityX, " + - "AngularVelocityY, AngularVelocityZ, " + - "AccelerationX, AccelerationY, " + - "AccelerationZ, RotationX, " + - "RotationY, RotationZ, " + - "RotationW, SitTargetOffsetX, " + - "SitTargetOffsetY, SitTargetOffsetZ, " + - "SitTargetOrientW, SitTargetOrientX, " + - "SitTargetOrientY, SitTargetOrientZ, " + - "RegionUUID, CreatorID, " + - "OwnerID, GroupID, " + - "LastOwnerID, SceneGroupID, " + - "PayPrice, PayButton1, " + - "PayButton2, PayButton3, " + - "PayButton4, LoopedSound, " + - "LoopedSoundGain, TextureAnimation, " + - "OmegaX, OmegaY, OmegaZ, " + - "CameraEyeOffsetX, CameraEyeOffsetY, " + - "CameraEyeOffsetZ, CameraAtOffsetX, " + - "CameraAtOffsetY, CameraAtOffsetZ, " + - "ForceMouselook, ScriptAccessPin, " + - "AllowedDrop, DieAtEdge, " + - "SalePrice, SaleType, " + - "ColorR, ColorG, ColorB, ColorA, " + - "ParticleSystem, ClickAction, Material, " + - "CollisionSound, CollisionSoundVolume, " + - "PassTouches, " + - "LinkNumber, MediaURL) values (" + "?UUID, " + - "?CreationDate, ?Name, ?Text, " + - "?Description, ?SitName, ?TouchName, " + - "?ObjectFlags, ?OwnerMask, ?NextOwnerMask, " + - "?GroupMask, ?EveryoneMask, ?BaseMask, " + - "?PositionX, ?PositionY, ?PositionZ, " + - "?GroupPositionX, ?GroupPositionY, " + - "?GroupPositionZ, ?VelocityX, " + - "?VelocityY, ?VelocityZ, ?AngularVelocityX, " + - "?AngularVelocityY, ?AngularVelocityZ, " + - "?AccelerationX, ?AccelerationY, " + - "?AccelerationZ, ?RotationX, " + - "?RotationY, ?RotationZ, " + - "?RotationW, ?SitTargetOffsetX, " + - "?SitTargetOffsetY, ?SitTargetOffsetZ, " + - "?SitTargetOrientW, ?SitTargetOrientX, " + - "?SitTargetOrientY, ?SitTargetOrientZ, " + - "?RegionUUID, ?CreatorID, ?OwnerID, " + - "?GroupID, ?LastOwnerID, ?SceneGroupID, " + - "?PayPrice, ?PayButton1, ?PayButton2, " + - "?PayButton3, ?PayButton4, ?LoopedSound, " + - "?LoopedSoundGain, ?TextureAnimation, " + - "?OmegaX, ?OmegaY, ?OmegaZ, " + - "?CameraEyeOffsetX, ?CameraEyeOffsetY, " + - "?CameraEyeOffsetZ, ?CameraAtOffsetX, " + - "?CameraAtOffsetY, ?CameraAtOffsetZ, " + - "?ForceMouselook, ?ScriptAccessPin, " + - "?AllowedDrop, ?DieAtEdge, ?SalePrice, " + - "?SaleType, ?ColorR, ?ColorG, " + - "?ColorB, ?ColorA, ?ParticleSystem, " + - "?ClickAction, ?Material, ?CollisionSound, " + - "?CollisionSoundVolume, ?PassTouches, ?LinkNumber, ?MediaURL)"; - - FillPrimCommand(cmd, prim, obj.UUID, regionUUID); - - ExecuteNonQuery(cmd); - - cmd.Parameters.Clear(); - - cmd.CommandText = "replace into primshapes (" + - "UUID, Shape, ScaleX, ScaleY, " + - "ScaleZ, PCode, PathBegin, PathEnd, " + - "PathScaleX, PathScaleY, PathShearX, " + - "PathShearY, PathSkew, PathCurve, " + - "PathRadiusOffset, PathRevolutions, " + - "PathTaperX, PathTaperY, PathTwist, " + - "PathTwistBegin, ProfileBegin, ProfileEnd, " + - "ProfileCurve, ProfileHollow, Texture, " + - "ExtraParams, State, Media) values (?UUID, " + - "?Shape, ?ScaleX, ?ScaleY, ?ScaleZ, " + - "?PCode, ?PathBegin, ?PathEnd, " + - "?PathScaleX, ?PathScaleY, " + - "?PathShearX, ?PathShearY, " + - "?PathSkew, ?PathCurve, ?PathRadiusOffset, " + - "?PathRevolutions, ?PathTaperX, " + - "?PathTaperY, ?PathTwist, " + - "?PathTwistBegin, ?ProfileBegin, " + - "?ProfileEnd, ?ProfileCurve, " + - "?ProfileHollow, ?Texture, ?ExtraParams, " + - "?State, ?Media)"; - - FillShapeCommand(cmd, prim); - - ExecuteNonQuery(cmd); - } - - cmd.Dispose(); - } - } - } - - public void RemoveObject(UUID obj, UUID regionUUID) - { -// m_log.DebugFormat("[REGION DB]: Deleting scene object {0} from {1} in database", obj, regionUUID); - - List uuids = new List(); - - // Formerly, this used to check the region UUID. - // That makes no sense, as we remove the contents of a prim - // unconditionally, but the prim dependent on the region ID. - // So, we would destroy an object and cause hard to detect - // issues if we delete the contents only. Deleting it all may - // cause the loss of a prim, but is cleaner. - // It's also faster because it uses the primary key. - // - lock (m_dbLock) - { - using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) - { - dbcon.Open(); - - using (MySqlCommand cmd = dbcon.CreateCommand()) - { - cmd.CommandText = "select UUID from prims where SceneGroupID= ?UUID"; - cmd.Parameters.AddWithValue("UUID", obj.ToString()); - - using (IDataReader reader = ExecuteReader(cmd)) - { - while (reader.Read()) - uuids.Add(DBGuid.FromDB(reader["UUID"].ToString())); - } - - // delete the main prims - cmd.CommandText = "delete from prims where SceneGroupID= ?UUID"; - ExecuteNonQuery(cmd); - } - } - } - - // there is no way this should be < 1 unless there is - // a very corrupt database, but in that case be extra - // safe anyway. - if (uuids.Count > 0) - { - RemoveShapes(uuids); - RemoveItems(uuids); - } - } - - /// - /// Remove all persisted items of the given prim. - /// The caller must acquire the necessrary synchronization locks - /// - /// the Item UUID - private void RemoveItems(UUID uuid) - { - lock (m_dbLock) - { - using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) - { - dbcon.Open(); - - using (MySqlCommand cmd = dbcon.CreateCommand()) - { - cmd.CommandText = "delete from primitems where PrimID = ?PrimID"; - cmd.Parameters.AddWithValue("PrimID", uuid.ToString()); - - ExecuteNonQuery(cmd); - } - } - } - } - - /// - /// Remove all persisted shapes for a list of prims - /// The caller must acquire the necessrary synchronization locks - /// - /// the list of UUIDs - private void RemoveShapes(List uuids) - { - lock (m_dbLock) - { - string sql = "delete from primshapes where "; - using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) - { - dbcon.Open(); - - using (MySqlCommand cmd = dbcon.CreateCommand()) - { - for (int i = 0; i < uuids.Count; i++) - { - if ((i + 1) == uuids.Count) - {// end of the list - sql += "(UUID = ?UUID" + i + ")"; - } - else - { - sql += "(UUID = ?UUID" + i + ") or "; - } - } - cmd.CommandText = sql; - - for (int i = 0; i < uuids.Count; i++) - cmd.Parameters.AddWithValue("UUID" + i, uuids[i].ToString()); - - ExecuteNonQuery(cmd); - } - } - } - } - - /// - /// Remove all persisted items for a list of prims - /// The caller must acquire the necessrary synchronization locks - /// - /// the list of UUIDs - private void RemoveItems(List uuids) - { - lock (m_dbLock) - { - string sql = "delete from primitems where "; - using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) - { - dbcon.Open(); - - using (MySqlCommand cmd = dbcon.CreateCommand()) - { - for (int i = 0; i < uuids.Count; i++) - { - if ((i + 1) == uuids.Count) - { - // end of the list - sql += "(PrimID = ?PrimID" + i + ")"; - } - else - { - sql += "(PrimID = ?PrimID" + i + ") or "; - } - } - cmd.CommandText = sql; - - for (int i = 0; i < uuids.Count; i++) - cmd.Parameters.AddWithValue("PrimID" + i, uuids[i].ToString()); - - ExecuteNonQuery(cmd); - } - } - } - } - - public List LoadObjects(UUID regionID) - { - const int ROWS_PER_QUERY = 5000; - - Dictionary prims = new Dictionary(ROWS_PER_QUERY); - Dictionary objects = new Dictionary(); - int count = 0; - - #region Prim Loading - - lock (m_dbLock) - { - using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) - { - dbcon.Open(); - - using (MySqlCommand cmd = dbcon.CreateCommand()) - { - cmd.CommandText = - "SELECT * FROM prims LEFT JOIN primshapes ON prims.UUID = primshapes.UUID WHERE RegionUUID = ?RegionUUID"; - cmd.Parameters.AddWithValue("RegionUUID", regionID.ToString()); - - using (IDataReader reader = ExecuteReader(cmd)) - { - while (reader.Read()) - { - SceneObjectPart prim = BuildPrim(reader); - if (reader["Shape"] is DBNull) - prim.Shape = PrimitiveBaseShape.Default; - else - prim.Shape = BuildShape(reader); - - UUID parentID = DBGuid.FromDB(reader["SceneGroupID"].ToString()); - if (parentID != prim.UUID) - prim.ParentUUID = parentID; - - prims[prim.UUID] = prim; - - ++count; - if (count % ROWS_PER_QUERY == 0) - m_log.Debug("[REGION DB]: Loaded " + count + " prims..."); - } - } - } - } - } - - #endregion Prim Loading - - #region SceneObjectGroup Creation - - // Create all of the SOGs from the root prims first - foreach (SceneObjectPart prim in prims.Values) - { - if (prim.ParentUUID == UUID.Zero) - objects[prim.UUID] = new SceneObjectGroup(prim); - } - - // Add all of the children objects to the SOGs - foreach (SceneObjectPart prim in prims.Values) - { - SceneObjectGroup sog; - if (prim.UUID != prim.ParentUUID) - { - if (objects.TryGetValue(prim.ParentUUID, out sog)) - { - int originalLinkNum = prim.LinkNum; - - sog.AddPart(prim); - - // SceneObjectGroup.AddPart() tries to be smart and automatically set the LinkNum. - // We override that here - if (originalLinkNum != 0) - prim.LinkNum = originalLinkNum; - } - else - { - m_log.WarnFormat( - "[REGION DB]: Database contains an orphan child prim {0} {1} in region {2} pointing to missing parent {3}. This prim will not be loaded.", - prim.Name, prim.UUID, regionID, prim.ParentUUID); - } - } - } - - #endregion SceneObjectGroup Creation - - m_log.DebugFormat("[REGION DB]: Loaded {0} objects using {1} prims", objects.Count, prims.Count); - - #region Prim Inventory Loading - - // Instead of attempting to LoadItems on every prim, - // most of which probably have no items... get a - // list from DB of all prims which have items and - // LoadItems only on those - List primsWithInventory = new List(); - lock (m_dbLock) - { - using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) - { - dbcon.Open(); - - using (MySqlCommand itemCmd = dbcon.CreateCommand()) - { - itemCmd.CommandText = "SELECT DISTINCT primID FROM primitems"; - using (IDataReader itemReader = ExecuteReader(itemCmd)) - { - while (itemReader.Read()) - { - if (!(itemReader["primID"] is DBNull)) - { - UUID primID = DBGuid.FromDB(itemReader["primID"].ToString()); - if (prims.ContainsKey(primID)) - primsWithInventory.Add(prims[primID]); - } - } - } - } - } - } - - foreach (SceneObjectPart prim in primsWithInventory) - { - LoadItems(prim); - } - - #endregion Prim Inventory Loading - - m_log.DebugFormat("[REGION DB]: Loaded inventory from {0} objects", primsWithInventory.Count); - - return new List(objects.Values); - } - - /// - /// Load in a prim's persisted inventory. - /// - /// The prim - private void LoadItems(SceneObjectPart prim) - { - lock (m_dbLock) - { - List inventory = new List(); - - using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) - { - dbcon.Open(); - - using (MySqlCommand cmd = dbcon.CreateCommand()) - { - cmd.CommandText = "select * from primitems where PrimID = ?PrimID"; - cmd.Parameters.AddWithValue("PrimID", prim.UUID.ToString()); - - using (IDataReader reader = ExecuteReader(cmd)) - { - while (reader.Read()) - { - TaskInventoryItem item = BuildItem(reader); - - item.ParentID = prim.UUID; // Values in database are often wrong - inventory.Add(item); - } - } - } - } - - prim.Inventory.RestoreInventoryItems(inventory); - } - } - - public void StoreTerrain(double[,] ter, UUID regionID) - { - m_log.Info("[REGION DB]: Storing terrain"); - - lock (m_dbLock) - { - using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) - { - dbcon.Open(); - - using (MySqlCommand cmd = dbcon.CreateCommand()) - { - cmd.CommandText = "delete from terrain where RegionUUID = ?RegionUUID"; - cmd.Parameters.AddWithValue("RegionUUID", regionID.ToString()); - - ExecuteNonQuery(cmd); - - cmd.CommandText = "insert into terrain (RegionUUID, " + - "Revision, Heightfield) values (?RegionUUID, " + - "1, ?Heightfield)"; - - cmd.Parameters.AddWithValue("Heightfield", SerializeTerrain(ter)); - - ExecuteNonQuery(cmd); - } - } - } - } - - public double[,] LoadTerrain(UUID regionID) - { - double[,] terrain = null; - - lock (m_dbLock) - { - using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) - { - dbcon.Open(); - - using (MySqlCommand cmd = dbcon.CreateCommand()) - { - cmd.CommandText = "select RegionUUID, Revision, Heightfield " + - "from terrain where RegionUUID = ?RegionUUID " + - "order by Revision desc limit 1"; - cmd.Parameters.AddWithValue("RegionUUID", regionID.ToString()); - - using (IDataReader reader = ExecuteReader(cmd)) - { - while (reader.Read()) - { - int rev = Convert.ToInt32(reader["Revision"]); - - terrain = new double[(int)Constants.RegionSize, (int)Constants.RegionSize]; - terrain.Initialize(); - - using (MemoryStream mstr = new MemoryStream((byte[])reader["Heightfield"])) - { - using (BinaryReader br = new BinaryReader(mstr)) - { - for (int x = 0; x < (int)Constants.RegionSize; x++) - { - for (int y = 0; y < (int)Constants.RegionSize; y++) - { - terrain[x, y] = br.ReadDouble(); - } - } - } - - m_log.InfoFormat("[REGION DB]: Loaded terrain revision r{0}", rev); - } - } - } - } - } - } - - return terrain; - } - - public void RemoveLandObject(UUID globalID) - { - lock (m_dbLock) - { - using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) - { - dbcon.Open(); - - using (MySqlCommand cmd = dbcon.CreateCommand()) - { - cmd.CommandText = "delete from land where UUID = ?UUID"; - cmd.Parameters.AddWithValue("UUID", globalID.ToString()); - - ExecuteNonQuery(cmd); - } - } - } - } - - public void StoreLandObject(ILandObject parcel) - { - lock (m_dbLock) - { - using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) - { - dbcon.Open(); - - using (MySqlCommand cmd = dbcon.CreateCommand()) - { - cmd.CommandText = "replace into land (UUID, RegionUUID, " + - "LocalLandID, Bitmap, Name, Description, " + - "OwnerUUID, IsGroupOwned, Area, AuctionID, " + - "Category, ClaimDate, ClaimPrice, GroupUUID, " + - "SalePrice, LandStatus, LandFlags, LandingType, " + - "MediaAutoScale, MediaTextureUUID, MediaURL, " + - "MusicURL, PassHours, PassPrice, SnapshotUUID, " + - "UserLocationX, UserLocationY, UserLocationZ, " + - "UserLookAtX, UserLookAtY, UserLookAtZ, " + - "AuthbuyerID, OtherCleanTime, MediaType, MediaDescription, " + - "MediaSize, MediaLoop, ObscureMusic, ObscureMedia) values (" + - "?UUID, ?RegionUUID, " + - "?LocalLandID, ?Bitmap, ?Name, ?Description, " + - "?OwnerUUID, ?IsGroupOwned, ?Area, ?AuctionID, " + - "?Category, ?ClaimDate, ?ClaimPrice, ?GroupUUID, " + - "?SalePrice, ?LandStatus, ?LandFlags, ?LandingType, " + - "?MediaAutoScale, ?MediaTextureUUID, ?MediaURL, " + - "?MusicURL, ?PassHours, ?PassPrice, ?SnapshotUUID, " + - "?UserLocationX, ?UserLocationY, ?UserLocationZ, " + - "?UserLookAtX, ?UserLookAtY, ?UserLookAtZ, " + - "?AuthbuyerID, ?OtherCleanTime, ?MediaType, ?MediaDescription, "+ - "CONCAT(?MediaWidth, ',', ?MediaHeight), ?MediaLoop, ?ObscureMusic, ?ObscureMedia)"; - - FillLandCommand(cmd, parcel.LandData, parcel.RegionUUID); - - ExecuteNonQuery(cmd); - - cmd.CommandText = "delete from landaccesslist where LandUUID = ?UUID"; - - ExecuteNonQuery(cmd); - - cmd.Parameters.Clear(); - cmd.CommandText = "insert into landaccesslist (LandUUID, " + - "AccessUUID, Flags) values (?LandUUID, ?AccessUUID, " + - "?Flags)"; - - foreach (ParcelManager.ParcelAccessEntry entry in parcel.LandData.ParcelAccessList) - { - FillLandAccessCommand(cmd, entry, parcel.LandData.GlobalID); - ExecuteNonQuery(cmd); - cmd.Parameters.Clear(); - } - } - } - } - } - - public RegionLightShareData LoadRegionWindlightSettings(UUID regionUUID) - { - RegionLightShareData nWP = new RegionLightShareData(); - nWP.OnSave += StoreRegionWindlightSettings; - - using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) - { - dbcon.Open(); - - string command = "select * from `regionwindlight` where region_id = ?regionID"; - - using(MySqlCommand cmd = new MySqlCommand(command)) - { - cmd.Connection = dbcon; - - cmd.Parameters.AddWithValue("?regionID", regionUUID.ToString()); - - IDataReader result = ExecuteReader(cmd); - if (!result.Read()) - { - //No result, so store our default windlight profile and return it - nWP.regionID = regionUUID; - StoreRegionWindlightSettings(nWP); - return nWP; - } - else - { - nWP.regionID = DBGuid.FromDB(result["region_id"]); - nWP.waterColor.X = Convert.ToSingle(result["water_color_r"]); - nWP.waterColor.Y = Convert.ToSingle(result["water_color_g"]); - nWP.waterColor.Z = Convert.ToSingle(result["water_color_b"]); - nWP.waterFogDensityExponent = Convert.ToSingle(result["water_fog_density_exponent"]); - nWP.underwaterFogModifier = Convert.ToSingle(result["underwater_fog_modifier"]); - nWP.reflectionWaveletScale.X = Convert.ToSingle(result["reflection_wavelet_scale_1"]); - nWP.reflectionWaveletScale.Y = Convert.ToSingle(result["reflection_wavelet_scale_2"]); - nWP.reflectionWaveletScale.Z = Convert.ToSingle(result["reflection_wavelet_scale_3"]); - nWP.fresnelScale = Convert.ToSingle(result["fresnel_scale"]); - nWP.fresnelOffset = Convert.ToSingle(result["fresnel_offset"]); - nWP.refractScaleAbove = Convert.ToSingle(result["refract_scale_above"]); - nWP.refractScaleBelow = Convert.ToSingle(result["refract_scale_below"]); - nWP.blurMultiplier = Convert.ToSingle(result["blur_multiplier"]); - nWP.bigWaveDirection.X = Convert.ToSingle(result["big_wave_direction_x"]); - nWP.bigWaveDirection.Y = Convert.ToSingle(result["big_wave_direction_y"]); - nWP.littleWaveDirection.X = Convert.ToSingle(result["little_wave_direction_x"]); - nWP.littleWaveDirection.Y = Convert.ToSingle(result["little_wave_direction_y"]); - UUID.TryParse(result["normal_map_texture"].ToString(), out nWP.normalMapTexture); - nWP.horizon.X = Convert.ToSingle(result["horizon_r"]); - nWP.horizon.Y = Convert.ToSingle(result["horizon_g"]); - nWP.horizon.Z = Convert.ToSingle(result["horizon_b"]); - nWP.horizon.W = Convert.ToSingle(result["horizon_i"]); - nWP.hazeHorizon = Convert.ToSingle(result["haze_horizon"]); - nWP.blueDensity.X = Convert.ToSingle(result["blue_density_r"]); - nWP.blueDensity.Y = Convert.ToSingle(result["blue_density_g"]); - nWP.blueDensity.Z = Convert.ToSingle(result["blue_density_b"]); - nWP.blueDensity.W = Convert.ToSingle(result["blue_density_i"]); - nWP.hazeDensity = Convert.ToSingle(result["haze_density"]); - nWP.densityMultiplier = Convert.ToSingle(result["density_multiplier"]); - nWP.distanceMultiplier = Convert.ToSingle(result["distance_multiplier"]); - nWP.maxAltitude = Convert.ToUInt16(result["max_altitude"]); - nWP.sunMoonColor.X = Convert.ToSingle(result["sun_moon_color_r"]); - nWP.sunMoonColor.Y = Convert.ToSingle(result["sun_moon_color_g"]); - nWP.sunMoonColor.Z = Convert.ToSingle(result["sun_moon_color_b"]); - nWP.sunMoonColor.W = Convert.ToSingle(result["sun_moon_color_i"]); - nWP.sunMoonPosition = Convert.ToSingle(result["sun_moon_position"]); - nWP.ambient.X = Convert.ToSingle(result["ambient_r"]); - nWP.ambient.Y = Convert.ToSingle(result["ambient_g"]); - nWP.ambient.Z = Convert.ToSingle(result["ambient_b"]); - nWP.ambient.W = Convert.ToSingle(result["ambient_i"]); - nWP.eastAngle = Convert.ToSingle(result["east_angle"]); - nWP.sunGlowFocus = Convert.ToSingle(result["sun_glow_focus"]); - nWP.sunGlowSize = Convert.ToSingle(result["sun_glow_size"]); - nWP.sceneGamma = Convert.ToSingle(result["scene_gamma"]); - nWP.starBrightness = Convert.ToSingle(result["star_brightness"]); - nWP.cloudColor.X = Convert.ToSingle(result["cloud_color_r"]); - nWP.cloudColor.Y = Convert.ToSingle(result["cloud_color_g"]); - nWP.cloudColor.Z = Convert.ToSingle(result["cloud_color_b"]); - nWP.cloudColor.W = Convert.ToSingle(result["cloud_color_i"]); - nWP.cloudXYDensity.X = Convert.ToSingle(result["cloud_x"]); - nWP.cloudXYDensity.Y = Convert.ToSingle(result["cloud_y"]); - nWP.cloudXYDensity.Z = Convert.ToSingle(result["cloud_density"]); - nWP.cloudCoverage = Convert.ToSingle(result["cloud_coverage"]); - nWP.cloudScale = Convert.ToSingle(result["cloud_scale"]); - nWP.cloudDetailXYDensity.X = Convert.ToSingle(result["cloud_detail_x"]); - nWP.cloudDetailXYDensity.Y = Convert.ToSingle(result["cloud_detail_y"]); - nWP.cloudDetailXYDensity.Z = Convert.ToSingle(result["cloud_detail_density"]); - nWP.cloudScrollX = Convert.ToSingle(result["cloud_scroll_x"]); - nWP.cloudScrollXLock = Convert.ToBoolean(result["cloud_scroll_x_lock"]); - nWP.cloudScrollY = Convert.ToSingle(result["cloud_scroll_y"]); - nWP.cloudScrollYLock = Convert.ToBoolean(result["cloud_scroll_y_lock"]); - nWP.drawClassicClouds = Convert.ToBoolean(result["draw_classic_clouds"]); - } - } - } - return nWP; - } - - public RegionSettings LoadRegionSettings(UUID regionUUID) - { - RegionSettings rs = null; - - lock (m_dbLock) - { - using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) - { - dbcon.Open(); - - using (MySqlCommand cmd = dbcon.CreateCommand()) - { - cmd.CommandText = "select * from regionsettings where regionUUID = ?RegionUUID"; - cmd.Parameters.AddWithValue("regionUUID", regionUUID); - - using (IDataReader reader = ExecuteReader(cmd)) - { - if (reader.Read()) - { - rs = BuildRegionSettings(reader); - rs.OnSave += StoreRegionSettings; - } - else - { - rs = new RegionSettings(); - rs.RegionUUID = regionUUID; - rs.OnSave += StoreRegionSettings; - - StoreRegionSettings(rs); - } - } - } - } - } - - return rs; - } - - public void StoreRegionWindlightSettings(RegionLightShareData wl) - { - using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) - { - dbcon.Open(); - - using (MySqlCommand cmd = dbcon.CreateCommand()) - { - cmd.CommandText = "REPLACE INTO `regionwindlight` (`region_id`, `water_color_r`, `water_color_g`, "; - cmd.CommandText += "`water_color_b`, `water_fog_density_exponent`, `underwater_fog_modifier`, "; - cmd.CommandText += "`reflection_wavelet_scale_1`, `reflection_wavelet_scale_2`, `reflection_wavelet_scale_3`, "; - cmd.CommandText += "`fresnel_scale`, `fresnel_offset`, `refract_scale_above`, `refract_scale_below`, "; - cmd.CommandText += "`blur_multiplier`, `big_wave_direction_x`, `big_wave_direction_y`, `little_wave_direction_x`, "; - cmd.CommandText += "`little_wave_direction_y`, `normal_map_texture`, `horizon_r`, `horizon_g`, `horizon_b`, "; - cmd.CommandText += "`horizon_i`, `haze_horizon`, `blue_density_r`, `blue_density_g`, `blue_density_b`, "; - cmd.CommandText += "`blue_density_i`, `haze_density`, `density_multiplier`, `distance_multiplier`, `max_altitude`, "; - cmd.CommandText += "`sun_moon_color_r`, `sun_moon_color_g`, `sun_moon_color_b`, `sun_moon_color_i`, `sun_moon_position`, "; - cmd.CommandText += "`ambient_r`, `ambient_g`, `ambient_b`, `ambient_i`, `east_angle`, `sun_glow_focus`, `sun_glow_size`, "; - cmd.CommandText += "`scene_gamma`, `star_brightness`, `cloud_color_r`, `cloud_color_g`, `cloud_color_b`, `cloud_color_i`, "; - cmd.CommandText += "`cloud_x`, `cloud_y`, `cloud_density`, `cloud_coverage`, `cloud_scale`, `cloud_detail_x`, "; - cmd.CommandText += "`cloud_detail_y`, `cloud_detail_density`, `cloud_scroll_x`, `cloud_scroll_x_lock`, `cloud_scroll_y`, "; - cmd.CommandText += "`cloud_scroll_y_lock`, `draw_classic_clouds`) VALUES (?region_id, ?water_color_r, "; - cmd.CommandText += "?water_color_g, ?water_color_b, ?water_fog_density_exponent, ?underwater_fog_modifier, ?reflection_wavelet_scale_1, "; - cmd.CommandText += "?reflection_wavelet_scale_2, ?reflection_wavelet_scale_3, ?fresnel_scale, ?fresnel_offset, ?refract_scale_above, "; - cmd.CommandText += "?refract_scale_below, ?blur_multiplier, ?big_wave_direction_x, ?big_wave_direction_y, ?little_wave_direction_x, "; - cmd.CommandText += "?little_wave_direction_y, ?normal_map_texture, ?horizon_r, ?horizon_g, ?horizon_b, ?horizon_i, ?haze_horizon, "; - cmd.CommandText += "?blue_density_r, ?blue_density_g, ?blue_density_b, ?blue_density_i, ?haze_density, ?density_multiplier, "; - cmd.CommandText += "?distance_multiplier, ?max_altitude, ?sun_moon_color_r, ?sun_moon_color_g, ?sun_moon_color_b, "; - cmd.CommandText += "?sun_moon_color_i, ?sun_moon_position, ?ambient_r, ?ambient_g, ?ambient_b, ?ambient_i, ?east_angle, "; - cmd.CommandText += "?sun_glow_focus, ?sun_glow_size, ?scene_gamma, ?star_brightness, ?cloud_color_r, ?cloud_color_g, "; - cmd.CommandText += "?cloud_color_b, ?cloud_color_i, ?cloud_x, ?cloud_y, ?cloud_density, ?cloud_coverage, ?cloud_scale, "; - cmd.CommandText += "?cloud_detail_x, ?cloud_detail_y, ?cloud_detail_density, ?cloud_scroll_x, ?cloud_scroll_x_lock, "; - cmd.CommandText += "?cloud_scroll_y, ?cloud_scroll_y_lock, ?draw_classic_clouds)"; - - cmd.Parameters.AddWithValue("region_id", wl.regionID); - cmd.Parameters.AddWithValue("water_color_r", wl.waterColor.X); - cmd.Parameters.AddWithValue("water_color_g", wl.waterColor.Y); - cmd.Parameters.AddWithValue("water_color_b", wl.waterColor.Z); - cmd.Parameters.AddWithValue("water_fog_density_exponent", wl.waterFogDensityExponent); - cmd.Parameters.AddWithValue("underwater_fog_modifier", wl.underwaterFogModifier); - cmd.Parameters.AddWithValue("reflection_wavelet_scale_1", wl.reflectionWaveletScale.X); - cmd.Parameters.AddWithValue("reflection_wavelet_scale_2", wl.reflectionWaveletScale.Y); - cmd.Parameters.AddWithValue("reflection_wavelet_scale_3", wl.reflectionWaveletScale.Z); - cmd.Parameters.AddWithValue("fresnel_scale", wl.fresnelScale); - cmd.Parameters.AddWithValue("fresnel_offset", wl.fresnelOffset); - cmd.Parameters.AddWithValue("refract_scale_above", wl.refractScaleAbove); - cmd.Parameters.AddWithValue("refract_scale_below", wl.refractScaleBelow); - cmd.Parameters.AddWithValue("blur_multiplier", wl.blurMultiplier); - cmd.Parameters.AddWithValue("big_wave_direction_x", wl.bigWaveDirection.X); - cmd.Parameters.AddWithValue("big_wave_direction_y", wl.bigWaveDirection.Y); - cmd.Parameters.AddWithValue("little_wave_direction_x", wl.littleWaveDirection.X); - cmd.Parameters.AddWithValue("little_wave_direction_y", wl.littleWaveDirection.Y); - cmd.Parameters.AddWithValue("normal_map_texture", wl.normalMapTexture); - cmd.Parameters.AddWithValue("horizon_r", wl.horizon.X); - cmd.Parameters.AddWithValue("horizon_g", wl.horizon.Y); - cmd.Parameters.AddWithValue("horizon_b", wl.horizon.Z); - cmd.Parameters.AddWithValue("horizon_i", wl.horizon.W); - cmd.Parameters.AddWithValue("haze_horizon", wl.hazeHorizon); - cmd.Parameters.AddWithValue("blue_density_r", wl.blueDensity.X); - cmd.Parameters.AddWithValue("blue_density_g", wl.blueDensity.Y); - cmd.Parameters.AddWithValue("blue_density_b", wl.blueDensity.Z); - cmd.Parameters.AddWithValue("blue_density_i", wl.blueDensity.W); - cmd.Parameters.AddWithValue("haze_density", wl.hazeDensity); - cmd.Parameters.AddWithValue("density_multiplier", wl.densityMultiplier); - cmd.Parameters.AddWithValue("distance_multiplier", wl.distanceMultiplier); - cmd.Parameters.AddWithValue("max_altitude", wl.maxAltitude); - cmd.Parameters.AddWithValue("sun_moon_color_r", wl.sunMoonColor.X); - cmd.Parameters.AddWithValue("sun_moon_color_g", wl.sunMoonColor.Y); - cmd.Parameters.AddWithValue("sun_moon_color_b", wl.sunMoonColor.Z); - cmd.Parameters.AddWithValue("sun_moon_color_i", wl.sunMoonColor.W); - cmd.Parameters.AddWithValue("sun_moon_position", wl.sunMoonPosition); - cmd.Parameters.AddWithValue("ambient_r", wl.ambient.X); - cmd.Parameters.AddWithValue("ambient_g", wl.ambient.Y); - cmd.Parameters.AddWithValue("ambient_b", wl.ambient.Z); - cmd.Parameters.AddWithValue("ambient_i", wl.ambient.W); - cmd.Parameters.AddWithValue("east_angle", wl.eastAngle); - cmd.Parameters.AddWithValue("sun_glow_focus", wl.sunGlowFocus); - cmd.Parameters.AddWithValue("sun_glow_size", wl.sunGlowSize); - cmd.Parameters.AddWithValue("scene_gamma", wl.sceneGamma); - cmd.Parameters.AddWithValue("star_brightness", wl.starBrightness); - cmd.Parameters.AddWithValue("cloud_color_r", wl.cloudColor.X); - cmd.Parameters.AddWithValue("cloud_color_g", wl.cloudColor.Y); - cmd.Parameters.AddWithValue("cloud_color_b", wl.cloudColor.Z); - cmd.Parameters.AddWithValue("cloud_color_i", wl.cloudColor.W); - cmd.Parameters.AddWithValue("cloud_x", wl.cloudXYDensity.X); - cmd.Parameters.AddWithValue("cloud_y", wl.cloudXYDensity.Y); - cmd.Parameters.AddWithValue("cloud_density", wl.cloudXYDensity.Z); - cmd.Parameters.AddWithValue("cloud_coverage", wl.cloudCoverage); - cmd.Parameters.AddWithValue("cloud_scale", wl.cloudScale); - cmd.Parameters.AddWithValue("cloud_detail_x", wl.cloudDetailXYDensity.X); - cmd.Parameters.AddWithValue("cloud_detail_y", wl.cloudDetailXYDensity.Y); - cmd.Parameters.AddWithValue("cloud_detail_density", wl.cloudDetailXYDensity.Z); - cmd.Parameters.AddWithValue("cloud_scroll_x", wl.cloudScrollX); - cmd.Parameters.AddWithValue("cloud_scroll_x_lock", wl.cloudScrollXLock); - cmd.Parameters.AddWithValue("cloud_scroll_y", wl.cloudScrollY); - cmd.Parameters.AddWithValue("cloud_scroll_y_lock", wl.cloudScrollYLock); - cmd.Parameters.AddWithValue("draw_classic_clouds", wl.drawClassicClouds); - - ExecuteNonQuery(cmd); - } - } - } - - public void StoreRegionSettings(RegionSettings rs) - { - lock (m_dbLock) - { - using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) - { - dbcon.Open(); - - using (MySqlCommand cmd = dbcon.CreateCommand()) - { - cmd.CommandText = "replace into regionsettings (regionUUID, " + - "block_terraform, block_fly, allow_damage, " + - "restrict_pushing, allow_land_resell, " + - "allow_land_join_divide, block_show_in_search, " + - "agent_limit, object_bonus, maturity, " + - "disable_scripts, disable_collisions, " + - "disable_physics, terrain_texture_1, " + - "terrain_texture_2, terrain_texture_3, " + - "terrain_texture_4, elevation_1_nw, " + - "elevation_2_nw, elevation_1_ne, " + - "elevation_2_ne, elevation_1_se, " + - "elevation_2_se, elevation_1_sw, " + - "elevation_2_sw, water_height, " + - "terrain_raise_limit, terrain_lower_limit, " + - "use_estate_sun, fixed_sun, sun_position, " + - "covenant, Sandbox, sunvectorx, sunvectory, " + - "sunvectorz, loaded_creation_datetime, " + - "loaded_creation_id, map_tile_ID) values (?RegionUUID, ?BlockTerraform, " + - "?BlockFly, ?AllowDamage, ?RestrictPushing, " + - "?AllowLandResell, ?AllowLandJoinDivide, " + - "?BlockShowInSearch, ?AgentLimit, ?ObjectBonus, " + - "?Maturity, ?DisableScripts, ?DisableCollisions, " + - "?DisablePhysics, ?TerrainTexture1, " + - "?TerrainTexture2, ?TerrainTexture3, " + - "?TerrainTexture4, ?Elevation1NW, ?Elevation2NW, " + - "?Elevation1NE, ?Elevation2NE, ?Elevation1SE, " + - "?Elevation2SE, ?Elevation1SW, ?Elevation2SW, " + - "?WaterHeight, ?TerrainRaiseLimit, " + - "?TerrainLowerLimit, ?UseEstateSun, ?FixedSun, " + - "?SunPosition, ?Covenant, ?Sandbox, " + - "?SunVectorX, ?SunVectorY, ?SunVectorZ, " + - "?LoadedCreationDateTime, ?LoadedCreationID, " + - "?TerrainImageID)"; - - FillRegionSettingsCommand(cmd, rs); - - ExecuteNonQuery(cmd); - } - } - } - } - - public List LoadLandObjects(UUID regionUUID) - { - List landData = new List(); - - lock (m_dbLock) - { - using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) - { - dbcon.Open(); - - using (MySqlCommand cmd = dbcon.CreateCommand()) - { - cmd.CommandText = "select * from land where RegionUUID = ?RegionUUID"; - cmd.Parameters.AddWithValue("RegionUUID", regionUUID.ToString()); - - using (IDataReader reader = ExecuteReader(cmd)) - { - while (reader.Read()) - { - LandData newLand = BuildLandData(reader); - landData.Add(newLand); - } - } - } - - using (MySqlCommand cmd = dbcon.CreateCommand()) - { - foreach (LandData land in landData) - { - cmd.Parameters.Clear(); - cmd.CommandText = "select * from landaccesslist where LandUUID = ?LandUUID"; - cmd.Parameters.AddWithValue("LandUUID", land.GlobalID.ToString()); - - using (IDataReader reader = ExecuteReader(cmd)) - { - while (reader.Read()) - { - land.ParcelAccessList.Add(BuildLandAccessData(reader)); - } - } - } - } - } - } - - return landData; - } - - public void Shutdown() - { - } - - private SceneObjectPart BuildPrim(IDataReader row) - { - SceneObjectPart prim = new SceneObjectPart(); - - // depending on the MySQL connector version, CHAR(36) may be already converted to Guid! - prim.UUID = DBGuid.FromDB(row["UUID"]); - prim.CreatorID = DBGuid.FromDB(row["CreatorID"]); - prim.OwnerID = DBGuid.FromDB(row["OwnerID"]); - prim.GroupID = DBGuid.FromDB(row["GroupID"]); - prim.LastOwnerID = DBGuid.FromDB(row["LastOwnerID"]); - - // explicit conversion of integers is required, which sort - // of sucks. No idea if there is a shortcut here or not. - prim.CreationDate = (int)row["CreationDate"]; - if (row["Name"] != DBNull.Value) - prim.Name = (string)row["Name"]; - else - prim.Name = String.Empty; - // Various text fields - prim.Text = (string)row["Text"]; - prim.Color = Color.FromArgb((int)row["ColorA"], - (int)row["ColorR"], - (int)row["ColorG"], - (int)row["ColorB"]); - prim.Description = (string)row["Description"]; - prim.SitName = (string)row["SitName"]; - prim.TouchName = (string)row["TouchName"]; - // Permissions - prim.Flags = (PrimFlags)(int)row["ObjectFlags"]; - prim.OwnerMask = (uint)(int)row["OwnerMask"]; - prim.NextOwnerMask = (uint)(int)row["NextOwnerMask"]; - prim.GroupMask = (uint)(int)row["GroupMask"]; - prim.EveryoneMask = (uint)(int)row["EveryoneMask"]; - prim.BaseMask = (uint)(int)row["BaseMask"]; - - // Vectors - prim.OffsetPosition = new Vector3( - (float)(double)row["PositionX"], - (float)(double)row["PositionY"], - (float)(double)row["PositionZ"] - ); - prim.GroupPosition = new Vector3( - (float)(double)row["GroupPositionX"], - (float)(double)row["GroupPositionY"], - (float)(double)row["GroupPositionZ"] - ); - prim.Velocity = new Vector3( - (float)(double)row["VelocityX"], - (float)(double)row["VelocityY"], - (float)(double)row["VelocityZ"] - ); - prim.AngularVelocity = new Vector3( - (float)(double)row["AngularVelocityX"], - (float)(double)row["AngularVelocityY"], - (float)(double)row["AngularVelocityZ"] - ); - prim.Acceleration = new Vector3( - (float)(double)row["AccelerationX"], - (float)(double)row["AccelerationY"], - (float)(double)row["AccelerationZ"] - ); - // quaternions - prim.RotationOffset = new Quaternion( - (float)(double)row["RotationX"], - (float)(double)row["RotationY"], - (float)(double)row["RotationZ"], - (float)(double)row["RotationW"] - ); - prim.SitTargetPositionLL = new Vector3( - (float)(double)row["SitTargetOffsetX"], - (float)(double)row["SitTargetOffsetY"], - (float)(double)row["SitTargetOffsetZ"] - ); - prim.SitTargetOrientationLL = new Quaternion( - (float)(double)row["SitTargetOrientX"], - (float)(double)row["SitTargetOrientY"], - (float)(double)row["SitTargetOrientZ"], - (float)(double)row["SitTargetOrientW"] - ); - - prim.PayPrice[0] = (int)row["PayPrice"]; - prim.PayPrice[1] = (int)row["PayButton1"]; - prim.PayPrice[2] = (int)row["PayButton2"]; - prim.PayPrice[3] = (int)row["PayButton3"]; - prim.PayPrice[4] = (int)row["PayButton4"]; - - prim.Sound = DBGuid.FromDB(row["LoopedSound"].ToString()); - prim.SoundGain = (float)(double)row["LoopedSoundGain"]; - prim.SoundFlags = 1; // If it's persisted at all, it's looped - - if (!(row["TextureAnimation"] is DBNull)) - prim.TextureAnimation = (byte[])row["TextureAnimation"]; - if (!(row["ParticleSystem"] is DBNull)) - prim.ParticleSystem = (byte[])row["ParticleSystem"]; - - prim.AngularVelocity = new Vector3( - (float)(double)row["OmegaX"], - (float)(double)row["OmegaY"], - (float)(double)row["OmegaZ"] - ); - - prim.SetCameraEyeOffset(new Vector3( - (float)(double)row["CameraEyeOffsetX"], - (float)(double)row["CameraEyeOffsetY"], - (float)(double)row["CameraEyeOffsetZ"] - )); - - prim.SetCameraAtOffset(new Vector3( - (float)(double)row["CameraAtOffsetX"], - (float)(double)row["CameraAtOffsetY"], - (float)(double)row["CameraAtOffsetZ"] - )); - - prim.SetForceMouselook((sbyte)row["ForceMouselook"] != 0); - prim.ScriptAccessPin = (int)row["ScriptAccessPin"]; - prim.AllowedDrop = ((sbyte)row["AllowedDrop"] != 0); - prim.DIE_AT_EDGE = ((sbyte)row["DieAtEdge"] != 0); - - prim.SalePrice = (int)row["SalePrice"]; - prim.ObjectSaleType = unchecked((byte)(sbyte)row["SaleType"]); - - prim.Material = unchecked((byte)(sbyte)row["Material"]); - - if (!(row["ClickAction"] is DBNull)) - prim.ClickAction = unchecked((byte)(sbyte)row["ClickAction"]); - - prim.CollisionSound = DBGuid.FromDB(row["CollisionSound"]); - prim.CollisionSoundVolume = (float)(double)row["CollisionSoundVolume"]; - - prim.PassTouches = ((sbyte)row["PassTouches"] != 0); - prim.LinkNum = (int)row["LinkNumber"]; - - if (!(row["MediaURL"] is System.DBNull)) - prim.MediaUrl = (string)row["MediaURL"]; - - return prim; - } - - - /// - /// Build a prim inventory item from the persisted data. - /// - /// - /// - private static TaskInventoryItem BuildItem(IDataReader row) - { - TaskInventoryItem taskItem = new TaskInventoryItem(); - - taskItem.ItemID = DBGuid.FromDB(row["itemID"]); - taskItem.ParentPartID = DBGuid.FromDB(row["primID"]); - taskItem.AssetID = DBGuid.FromDB(row["assetID"]); - taskItem.ParentID = DBGuid.FromDB(row["parentFolderID"]); - - taskItem.InvType = Convert.ToInt32(row["invType"]); - taskItem.Type = Convert.ToInt32(row["assetType"]); - - taskItem.Name = (String)row["name"]; - taskItem.Description = (String)row["description"]; - taskItem.CreationDate = Convert.ToUInt32(row["creationDate"]); - taskItem.CreatorID = DBGuid.FromDB(row["creatorID"]); - taskItem.OwnerID = DBGuid.FromDB(row["ownerID"]); - taskItem.LastOwnerID = DBGuid.FromDB(row["lastOwnerID"]); - taskItem.GroupID = DBGuid.FromDB(row["groupID"]); - - taskItem.NextPermissions = Convert.ToUInt32(row["nextPermissions"]); - taskItem.CurrentPermissions = Convert.ToUInt32(row["currentPermissions"]); - taskItem.BasePermissions = Convert.ToUInt32(row["basePermissions"]); - taskItem.EveryonePermissions = Convert.ToUInt32(row["everyonePermissions"]); - taskItem.GroupPermissions = Convert.ToUInt32(row["groupPermissions"]); - taskItem.Flags = Convert.ToUInt32(row["flags"]); - - return taskItem; - } - - private static RegionSettings BuildRegionSettings(IDataReader row) - { - RegionSettings newSettings = new RegionSettings(); - - newSettings.RegionUUID = DBGuid.FromDB(row["regionUUID"]); - newSettings.BlockTerraform = Convert.ToBoolean(row["block_terraform"]); - newSettings.AllowDamage = Convert.ToBoolean(row["allow_damage"]); - newSettings.BlockFly = Convert.ToBoolean(row["block_fly"]); - newSettings.RestrictPushing = Convert.ToBoolean(row["restrict_pushing"]); - newSettings.AllowLandResell = Convert.ToBoolean(row["allow_land_resell"]); - newSettings.AllowLandJoinDivide = Convert.ToBoolean(row["allow_land_join_divide"]); - newSettings.BlockShowInSearch = Convert.ToBoolean(row["block_show_in_search"]); - newSettings.AgentLimit = Convert.ToInt32(row["agent_limit"]); - newSettings.ObjectBonus = Convert.ToDouble(row["object_bonus"]); - newSettings.Maturity = Convert.ToInt32(row["maturity"]); - newSettings.DisableScripts = Convert.ToBoolean(row["disable_scripts"]); - newSettings.DisableCollisions = Convert.ToBoolean(row["disable_collisions"]); - newSettings.DisablePhysics = Convert.ToBoolean(row["disable_physics"]); - newSettings.TerrainTexture1 = DBGuid.FromDB(row["terrain_texture_1"]); - newSettings.TerrainTexture2 = DBGuid.FromDB(row["terrain_texture_2"]); - newSettings.TerrainTexture3 = DBGuid.FromDB(row["terrain_texture_3"]); - newSettings.TerrainTexture4 = DBGuid.FromDB(row["terrain_texture_4"]); - newSettings.Elevation1NW = Convert.ToDouble(row["elevation_1_nw"]); - newSettings.Elevation2NW = Convert.ToDouble(row["elevation_2_nw"]); - newSettings.Elevation1NE = Convert.ToDouble(row["elevation_1_ne"]); - newSettings.Elevation2NE = Convert.ToDouble(row["elevation_2_ne"]); - newSettings.Elevation1SE = Convert.ToDouble(row["elevation_1_se"]); - newSettings.Elevation2SE = Convert.ToDouble(row["elevation_2_se"]); - newSettings.Elevation1SW = Convert.ToDouble(row["elevation_1_sw"]); - newSettings.Elevation2SW = Convert.ToDouble(row["elevation_2_sw"]); - newSettings.WaterHeight = Convert.ToDouble(row["water_height"]); - newSettings.TerrainRaiseLimit = Convert.ToDouble(row["terrain_raise_limit"]); - newSettings.TerrainLowerLimit = Convert.ToDouble(row["terrain_lower_limit"]); - newSettings.UseEstateSun = Convert.ToBoolean(row["use_estate_sun"]); - newSettings.Sandbox = Convert.ToBoolean(row["sandbox"]); - newSettings.SunVector = new Vector3 ( - Convert.ToSingle(row["sunvectorx"]), - Convert.ToSingle(row["sunvectory"]), - Convert.ToSingle(row["sunvectorz"]) - ); - newSettings.FixedSun = Convert.ToBoolean(row["fixed_sun"]); - newSettings.SunPosition = Convert.ToDouble(row["sun_position"]); - newSettings.Covenant = DBGuid.FromDB(row["covenant"]); - - newSettings.LoadedCreationDateTime = Convert.ToInt32(row["loaded_creation_datetime"]); - - if (row["loaded_creation_id"] is DBNull) - newSettings.LoadedCreationID = ""; - else - newSettings.LoadedCreationID = (String) row["loaded_creation_id"]; - - newSettings.TerrainImageID = DBGuid.FromDB(row["map_tile_ID"]); - - return newSettings; - } - - /// - /// - /// - /// - /// - private static LandData BuildLandData(IDataReader row) - { - LandData newData = new LandData(); - - newData.GlobalID = DBGuid.FromDB(row["UUID"]); - newData.LocalID = Convert.ToInt32(row["LocalLandID"]); - - // Bitmap is a byte[512] - newData.Bitmap = (Byte[]) row["Bitmap"]; - - newData.Name = (String) row["Name"]; - newData.Description = (String) row["Description"]; - newData.OwnerID = DBGuid.FromDB(row["OwnerUUID"]); - newData.IsGroupOwned = Convert.ToBoolean(row["IsGroupOwned"]); - newData.Area = Convert.ToInt32(row["Area"]); - newData.AuctionID = Convert.ToUInt32(row["AuctionID"]); //Unimplemented - newData.Category = (ParcelCategory) Convert.ToInt32(row["Category"]); - //Enum libsecondlife.Parcel.ParcelCategory - newData.ClaimDate = Convert.ToInt32(row["ClaimDate"]); - newData.ClaimPrice = Convert.ToInt32(row["ClaimPrice"]); - newData.GroupID = DBGuid.FromDB(row["GroupUUID"]); - newData.SalePrice = Convert.ToInt32(row["SalePrice"]); - newData.Status = (ParcelStatus) Convert.ToInt32(row["LandStatus"]); - //Enum. libsecondlife.Parcel.ParcelStatus - newData.Flags = Convert.ToUInt32(row["LandFlags"]); - newData.LandingType = Convert.ToByte(row["LandingType"]); - newData.MediaAutoScale = Convert.ToByte(row["MediaAutoScale"]); - newData.MediaID = DBGuid.FromDB(row["MediaTextureUUID"]); - newData.MediaURL = (String) row["MediaURL"]; - newData.MusicURL = (String) row["MusicURL"]; - newData.PassHours = Convert.ToSingle(row["PassHours"]); - newData.PassPrice = Convert.ToInt32(row["PassPrice"]); - UUID authedbuyer = UUID.Zero; - UUID snapshotID = UUID.Zero; - - UUID.TryParse((string)row["AuthBuyerID"], out authedbuyer); - UUID.TryParse((string)row["SnapshotUUID"], out snapshotID); - newData.OtherCleanTime = Convert.ToInt32(row["OtherCleanTime"]); - - newData.AuthBuyerID = authedbuyer; - newData.SnapshotID = snapshotID; - try - { - newData.UserLocation = - new Vector3(Convert.ToSingle(row["UserLocationX"]), Convert.ToSingle(row["UserLocationY"]), - Convert.ToSingle(row["UserLocationZ"])); - newData.UserLookAt = - new Vector3(Convert.ToSingle(row["UserLookAtX"]), Convert.ToSingle(row["UserLookAtY"]), - Convert.ToSingle(row["UserLookAtZ"])); - } - catch (InvalidCastException) - { - newData.UserLocation = Vector3.Zero; - newData.UserLookAt = Vector3.Zero; - m_log.ErrorFormat("[PARCEL]: unable to get parcel telehub settings for {1}", newData.Name); - } - - newData.MediaDescription = (string) row["MediaDescription"]; - newData.MediaType = (string) row["MediaType"]; - newData.MediaWidth = Convert.ToInt32((((string) row["MediaSize"]).Split(','))[0]); - newData.MediaHeight = Convert.ToInt32((((string) row["MediaSize"]).Split(','))[1]); - newData.MediaLoop = Convert.ToBoolean(row["MediaLoop"]); - newData.ObscureMusic = Convert.ToBoolean(row["ObscureMusic"]); - newData.ObscureMedia = Convert.ToBoolean(row["ObscureMedia"]); - - newData.ParcelAccessList = new List(); - - return newData; - } - - /// - /// - /// - /// - /// - private static ParcelManager.ParcelAccessEntry BuildLandAccessData(IDataReader row) - { - ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry(); - entry.AgentID = DBGuid.FromDB(row["AccessUUID"]); - entry.Flags = (AccessList) Convert.ToInt32(row["Flags"]); - entry.Time = new DateTime(); - return entry; - } - - /// - /// - /// - /// - /// - private static Array SerializeTerrain(double[,] val) - { - MemoryStream str = new MemoryStream(((int)Constants.RegionSize * (int)Constants.RegionSize) *sizeof (double)); - BinaryWriter bw = new BinaryWriter(str); - - // TODO: COMPATIBILITY - Add byte-order conversions - for (int x = 0; x < (int)Constants.RegionSize; x++) - for (int y = 0; y < (int)Constants.RegionSize; y++) - { - double height = val[x, y]; - if (height == 0.0) - height = double.Epsilon; - - bw.Write(height); - } - - return str.ToArray(); - } - - /// - /// Fill the prim command with prim values - /// - /// - /// - /// - /// - private void FillPrimCommand(MySqlCommand cmd, SceneObjectPart prim, UUID sceneGroupID, UUID regionUUID) - { - cmd.Parameters.AddWithValue("UUID", prim.UUID.ToString()); - cmd.Parameters.AddWithValue("RegionUUID", regionUUID.ToString()); - cmd.Parameters.AddWithValue("CreationDate", prim.CreationDate); - cmd.Parameters.AddWithValue("Name", prim.Name); - cmd.Parameters.AddWithValue("SceneGroupID", sceneGroupID.ToString()); - // the UUID of the root part for this SceneObjectGroup - // various text fields - cmd.Parameters.AddWithValue("Text", prim.Text); - cmd.Parameters.AddWithValue("ColorR", prim.Color.R); - cmd.Parameters.AddWithValue("ColorG", prim.Color.G); - cmd.Parameters.AddWithValue("ColorB", prim.Color.B); - cmd.Parameters.AddWithValue("ColorA", prim.Color.A); - cmd.Parameters.AddWithValue("Description", prim.Description); - cmd.Parameters.AddWithValue("SitName", prim.SitName); - cmd.Parameters.AddWithValue("TouchName", prim.TouchName); - // permissions - cmd.Parameters.AddWithValue("ObjectFlags", (uint)prim.Flags); - cmd.Parameters.AddWithValue("CreatorID", prim.CreatorID.ToString()); - cmd.Parameters.AddWithValue("OwnerID", prim.OwnerID.ToString()); - cmd.Parameters.AddWithValue("GroupID", prim.GroupID.ToString()); - cmd.Parameters.AddWithValue("LastOwnerID", prim.LastOwnerID.ToString()); - cmd.Parameters.AddWithValue("OwnerMask", prim.OwnerMask); - cmd.Parameters.AddWithValue("NextOwnerMask", prim.NextOwnerMask); - cmd.Parameters.AddWithValue("GroupMask", prim.GroupMask); - cmd.Parameters.AddWithValue("EveryoneMask", prim.EveryoneMask); - cmd.Parameters.AddWithValue("BaseMask", prim.BaseMask); - // vectors - cmd.Parameters.AddWithValue("PositionX", (double)prim.OffsetPosition.X); - cmd.Parameters.AddWithValue("PositionY", (double)prim.OffsetPosition.Y); - cmd.Parameters.AddWithValue("PositionZ", (double)prim.OffsetPosition.Z); - cmd.Parameters.AddWithValue("GroupPositionX", (double)prim.GroupPosition.X); - cmd.Parameters.AddWithValue("GroupPositionY", (double)prim.GroupPosition.Y); - cmd.Parameters.AddWithValue("GroupPositionZ", (double)prim.GroupPosition.Z); - cmd.Parameters.AddWithValue("VelocityX", (double)prim.Velocity.X); - cmd.Parameters.AddWithValue("VelocityY", (double)prim.Velocity.Y); - cmd.Parameters.AddWithValue("VelocityZ", (double)prim.Velocity.Z); - cmd.Parameters.AddWithValue("AngularVelocityX", (double)prim.AngularVelocity.X); - cmd.Parameters.AddWithValue("AngularVelocityY", (double)prim.AngularVelocity.Y); - cmd.Parameters.AddWithValue("AngularVelocityZ", (double)prim.AngularVelocity.Z); - cmd.Parameters.AddWithValue("AccelerationX", (double)prim.Acceleration.X); - cmd.Parameters.AddWithValue("AccelerationY", (double)prim.Acceleration.Y); - cmd.Parameters.AddWithValue("AccelerationZ", (double)prim.Acceleration.Z); - // quaternions - cmd.Parameters.AddWithValue("RotationX", (double)prim.RotationOffset.X); - cmd.Parameters.AddWithValue("RotationY", (double)prim.RotationOffset.Y); - cmd.Parameters.AddWithValue("RotationZ", (double)prim.RotationOffset.Z); - cmd.Parameters.AddWithValue("RotationW", (double)prim.RotationOffset.W); - - // Sit target - Vector3 sitTargetPos = prim.SitTargetPositionLL; - cmd.Parameters.AddWithValue("SitTargetOffsetX", (double)sitTargetPos.X); - cmd.Parameters.AddWithValue("SitTargetOffsetY", (double)sitTargetPos.Y); - cmd.Parameters.AddWithValue("SitTargetOffsetZ", (double)sitTargetPos.Z); - - Quaternion sitTargetOrient = prim.SitTargetOrientationLL; - cmd.Parameters.AddWithValue("SitTargetOrientW", (double)sitTargetOrient.W); - cmd.Parameters.AddWithValue("SitTargetOrientX", (double)sitTargetOrient.X); - cmd.Parameters.AddWithValue("SitTargetOrientY", (double)sitTargetOrient.Y); - cmd.Parameters.AddWithValue("SitTargetOrientZ", (double)sitTargetOrient.Z); - - cmd.Parameters.AddWithValue("PayPrice", prim.PayPrice[0]); - cmd.Parameters.AddWithValue("PayButton1", prim.PayPrice[1]); - cmd.Parameters.AddWithValue("PayButton2", prim.PayPrice[2]); - cmd.Parameters.AddWithValue("PayButton3", prim.PayPrice[3]); - cmd.Parameters.AddWithValue("PayButton4", prim.PayPrice[4]); - - if ((prim.SoundFlags & 1) != 0) // Looped - { - cmd.Parameters.AddWithValue("LoopedSound", prim.Sound.ToString()); - cmd.Parameters.AddWithValue("LoopedSoundGain", prim.SoundGain); - } - else - { - cmd.Parameters.AddWithValue("LoopedSound", UUID.Zero); - cmd.Parameters.AddWithValue("LoopedSoundGain", 0.0f); - } - - cmd.Parameters.AddWithValue("TextureAnimation", prim.TextureAnimation); - cmd.Parameters.AddWithValue("ParticleSystem", prim.ParticleSystem); - - cmd.Parameters.AddWithValue("OmegaX", (double)prim.AngularVelocity.X); - cmd.Parameters.AddWithValue("OmegaY", (double)prim.AngularVelocity.Y); - cmd.Parameters.AddWithValue("OmegaZ", (double)prim.AngularVelocity.Z); - - cmd.Parameters.AddWithValue("CameraEyeOffsetX", (double)prim.GetCameraEyeOffset().X); - cmd.Parameters.AddWithValue("CameraEyeOffsetY", (double)prim.GetCameraEyeOffset().Y); - cmd.Parameters.AddWithValue("CameraEyeOffsetZ", (double)prim.GetCameraEyeOffset().Z); - - cmd.Parameters.AddWithValue("CameraAtOffsetX", (double)prim.GetCameraAtOffset().X); - cmd.Parameters.AddWithValue("CameraAtOffsetY", (double)prim.GetCameraAtOffset().Y); - cmd.Parameters.AddWithValue("CameraAtOffsetZ", (double)prim.GetCameraAtOffset().Z); - - if (prim.GetForceMouselook()) - cmd.Parameters.AddWithValue("ForceMouselook", 1); - else - cmd.Parameters.AddWithValue("ForceMouselook", 0); - - cmd.Parameters.AddWithValue("ScriptAccessPin", prim.ScriptAccessPin); - - if (prim.AllowedDrop) - cmd.Parameters.AddWithValue("AllowedDrop", 1); - else - cmd.Parameters.AddWithValue("AllowedDrop", 0); - - if (prim.DIE_AT_EDGE) - cmd.Parameters.AddWithValue("DieAtEdge", 1); - else - cmd.Parameters.AddWithValue("DieAtEdge", 0); - - cmd.Parameters.AddWithValue("SalePrice", prim.SalePrice); - cmd.Parameters.AddWithValue("SaleType", unchecked((sbyte)(prim.ObjectSaleType))); - - byte clickAction = prim.ClickAction; - cmd.Parameters.AddWithValue("ClickAction", unchecked((sbyte)(clickAction))); - - cmd.Parameters.AddWithValue("Material", unchecked((sbyte)(prim.Material))); - - cmd.Parameters.AddWithValue("CollisionSound", prim.CollisionSound.ToString()); - cmd.Parameters.AddWithValue("CollisionSoundVolume", prim.CollisionSoundVolume); - - if (prim.PassTouches) - cmd.Parameters.AddWithValue("PassTouches", 1); - else - cmd.Parameters.AddWithValue("PassTouches", 0); - - cmd.Parameters.AddWithValue("LinkNumber", prim.LinkNum); - cmd.Parameters.AddWithValue("MediaURL", prim.MediaUrl); - } - - /// - /// - /// - /// - /// - private static void FillItemCommand(MySqlCommand cmd, TaskInventoryItem taskItem) - { - cmd.Parameters.AddWithValue("itemID", taskItem.ItemID); - cmd.Parameters.AddWithValue("primID", taskItem.ParentPartID); - cmd.Parameters.AddWithValue("assetID", taskItem.AssetID); - cmd.Parameters.AddWithValue("parentFolderID", taskItem.ParentID); - - cmd.Parameters.AddWithValue("invType", taskItem.InvType); - cmd.Parameters.AddWithValue("assetType", taskItem.Type); - - cmd.Parameters.AddWithValue("name", taskItem.Name); - cmd.Parameters.AddWithValue("description", taskItem.Description); - cmd.Parameters.AddWithValue("creationDate", taskItem.CreationDate); - cmd.Parameters.AddWithValue("creatorID", taskItem.CreatorID); - cmd.Parameters.AddWithValue("ownerID", taskItem.OwnerID); - cmd.Parameters.AddWithValue("lastOwnerID", taskItem.LastOwnerID); - cmd.Parameters.AddWithValue("groupID", taskItem.GroupID); - cmd.Parameters.AddWithValue("nextPermissions", taskItem.NextPermissions); - cmd.Parameters.AddWithValue("currentPermissions", taskItem.CurrentPermissions); - cmd.Parameters.AddWithValue("basePermissions", taskItem.BasePermissions); - cmd.Parameters.AddWithValue("everyonePermissions", taskItem.EveryonePermissions); - cmd.Parameters.AddWithValue("groupPermissions", taskItem.GroupPermissions); - cmd.Parameters.AddWithValue("flags", taskItem.Flags); - } - - /// - /// - /// - private static void FillRegionSettingsCommand(MySqlCommand cmd, RegionSettings settings) - { - cmd.Parameters.AddWithValue("RegionUUID", settings.RegionUUID.ToString()); - cmd.Parameters.AddWithValue("BlockTerraform", settings.BlockTerraform); - cmd.Parameters.AddWithValue("BlockFly", settings.BlockFly); - cmd.Parameters.AddWithValue("AllowDamage", settings.AllowDamage); - cmd.Parameters.AddWithValue("RestrictPushing", settings.RestrictPushing); - cmd.Parameters.AddWithValue("AllowLandResell", settings.AllowLandResell); - cmd.Parameters.AddWithValue("AllowLandJoinDivide", settings.AllowLandJoinDivide); - cmd.Parameters.AddWithValue("BlockShowInSearch", settings.BlockShowInSearch); - cmd.Parameters.AddWithValue("AgentLimit", settings.AgentLimit); - cmd.Parameters.AddWithValue("ObjectBonus", settings.ObjectBonus); - cmd.Parameters.AddWithValue("Maturity", settings.Maturity); - cmd.Parameters.AddWithValue("DisableScripts", settings.DisableScripts); - cmd.Parameters.AddWithValue("DisableCollisions", settings.DisableCollisions); - cmd.Parameters.AddWithValue("DisablePhysics", settings.DisablePhysics); - cmd.Parameters.AddWithValue("TerrainTexture1", settings.TerrainTexture1.ToString()); - cmd.Parameters.AddWithValue("TerrainTexture2", settings.TerrainTexture2.ToString()); - cmd.Parameters.AddWithValue("TerrainTexture3", settings.TerrainTexture3.ToString()); - cmd.Parameters.AddWithValue("TerrainTexture4", settings.TerrainTexture4.ToString()); - cmd.Parameters.AddWithValue("Elevation1NW", settings.Elevation1NW); - cmd.Parameters.AddWithValue("Elevation2NW", settings.Elevation2NW); - cmd.Parameters.AddWithValue("Elevation1NE", settings.Elevation1NE); - cmd.Parameters.AddWithValue("Elevation2NE", settings.Elevation2NE); - cmd.Parameters.AddWithValue("Elevation1SE", settings.Elevation1SE); - cmd.Parameters.AddWithValue("Elevation2SE", settings.Elevation2SE); - cmd.Parameters.AddWithValue("Elevation1SW", settings.Elevation1SW); - cmd.Parameters.AddWithValue("Elevation2SW", settings.Elevation2SW); - cmd.Parameters.AddWithValue("WaterHeight", settings.WaterHeight); - cmd.Parameters.AddWithValue("TerrainRaiseLimit", settings.TerrainRaiseLimit); - cmd.Parameters.AddWithValue("TerrainLowerLimit", settings.TerrainLowerLimit); - cmd.Parameters.AddWithValue("UseEstateSun", settings.UseEstateSun); - cmd.Parameters.AddWithValue("Sandbox", settings.Sandbox); - cmd.Parameters.AddWithValue("SunVectorX", settings.SunVector.X); - cmd.Parameters.AddWithValue("SunVectorY", settings.SunVector.Y); - cmd.Parameters.AddWithValue("SunVectorZ", settings.SunVector.Z); - cmd.Parameters.AddWithValue("FixedSun", settings.FixedSun); - cmd.Parameters.AddWithValue("SunPosition", settings.SunPosition); - cmd.Parameters.AddWithValue("Covenant", settings.Covenant.ToString()); - cmd.Parameters.AddWithValue("LoadedCreationDateTime", settings.LoadedCreationDateTime); - cmd.Parameters.AddWithValue("LoadedCreationID", settings.LoadedCreationID); - cmd.Parameters.AddWithValue("TerrainImageID", settings.TerrainImageID); - - } - - /// - /// - /// - /// - /// - /// - private static void FillLandCommand(MySqlCommand cmd, LandData land, UUID regionUUID) - { - cmd.Parameters.AddWithValue("UUID", land.GlobalID.ToString()); - cmd.Parameters.AddWithValue("RegionUUID", regionUUID.ToString()); - cmd.Parameters.AddWithValue("LocalLandID", land.LocalID); - - // Bitmap is a byte[512] - cmd.Parameters.AddWithValue("Bitmap", land.Bitmap); - - cmd.Parameters.AddWithValue("Name", land.Name); - cmd.Parameters.AddWithValue("Description", land.Description); - cmd.Parameters.AddWithValue("OwnerUUID", land.OwnerID.ToString()); - cmd.Parameters.AddWithValue("IsGroupOwned", land.IsGroupOwned); - cmd.Parameters.AddWithValue("Area", land.Area); - cmd.Parameters.AddWithValue("AuctionID", land.AuctionID); //Unemplemented - cmd.Parameters.AddWithValue("Category", land.Category); //Enum libsecondlife.Parcel.ParcelCategory - cmd.Parameters.AddWithValue("ClaimDate", land.ClaimDate); - cmd.Parameters.AddWithValue("ClaimPrice", land.ClaimPrice); - cmd.Parameters.AddWithValue("GroupUUID", land.GroupID.ToString()); - cmd.Parameters.AddWithValue("SalePrice", land.SalePrice); - cmd.Parameters.AddWithValue("LandStatus", land.Status); //Enum. libsecondlife.Parcel.ParcelStatus - cmd.Parameters.AddWithValue("LandFlags", land.Flags); - cmd.Parameters.AddWithValue("LandingType", land.LandingType); - cmd.Parameters.AddWithValue("MediaAutoScale", land.MediaAutoScale); - cmd.Parameters.AddWithValue("MediaTextureUUID", land.MediaID.ToString()); - cmd.Parameters.AddWithValue("MediaURL", land.MediaURL); - cmd.Parameters.AddWithValue("MusicURL", land.MusicURL); - cmd.Parameters.AddWithValue("PassHours", land.PassHours); - cmd.Parameters.AddWithValue("PassPrice", land.PassPrice); - cmd.Parameters.AddWithValue("SnapshotUUID", land.SnapshotID.ToString()); - cmd.Parameters.AddWithValue("UserLocationX", land.UserLocation.X); - cmd.Parameters.AddWithValue("UserLocationY", land.UserLocation.Y); - cmd.Parameters.AddWithValue("UserLocationZ", land.UserLocation.Z); - cmd.Parameters.AddWithValue("UserLookAtX", land.UserLookAt.X); - cmd.Parameters.AddWithValue("UserLookAtY", land.UserLookAt.Y); - cmd.Parameters.AddWithValue("UserLookAtZ", land.UserLookAt.Z); - cmd.Parameters.AddWithValue("AuthBuyerID", land.AuthBuyerID); - cmd.Parameters.AddWithValue("OtherCleanTime", land.OtherCleanTime); - cmd.Parameters.AddWithValue("MediaDescription", land.MediaDescription); - cmd.Parameters.AddWithValue("MediaType", land.MediaType); - cmd.Parameters.AddWithValue("MediaWidth", land.MediaWidth); - cmd.Parameters.AddWithValue("MediaHeight", land.MediaHeight); - cmd.Parameters.AddWithValue("MediaLoop", land.MediaLoop); - cmd.Parameters.AddWithValue("ObscureMusic", land.ObscureMusic); - cmd.Parameters.AddWithValue("ObscureMedia", land.ObscureMedia); - - } - - /// - /// - /// - /// - /// - /// - private static void FillLandAccessCommand(MySqlCommand cmd, ParcelManager.ParcelAccessEntry entry, UUID parcelID) - { - cmd.Parameters.AddWithValue("LandUUID", parcelID.ToString()); - cmd.Parameters.AddWithValue("AccessUUID", entry.AgentID.ToString()); - cmd.Parameters.AddWithValue("Flags", entry.Flags); - } - - /// - /// - /// - /// - /// - private PrimitiveBaseShape BuildShape(IDataReader row) - { - PrimitiveBaseShape s = new PrimitiveBaseShape(); - s.Scale = new Vector3( - (float)(double)row["ScaleX"], - (float)(double)row["ScaleY"], - (float)(double)row["ScaleZ"] - ); - // paths - s.PCode = (byte)(int)row["PCode"]; - s.PathBegin = (ushort)(int)row["PathBegin"]; - s.PathEnd = (ushort)(int)row["PathEnd"]; - s.PathScaleX = (byte)(int)row["PathScaleX"]; - s.PathScaleY = (byte)(int)row["PathScaleY"]; - s.PathShearX = (byte)(int)row["PathShearX"]; - s.PathShearY = (byte)(int)row["PathShearY"]; - s.PathSkew = (sbyte)(int)row["PathSkew"]; - s.PathCurve = (byte)(int)row["PathCurve"]; - s.PathRadiusOffset = (sbyte)(int)row["PathRadiusOffset"]; - s.PathRevolutions = (byte)(int)row["PathRevolutions"]; - s.PathTaperX = (sbyte)(int)row["PathTaperX"]; - s.PathTaperY = (sbyte)(int)row["PathTaperY"]; - s.PathTwist = (sbyte)(int)row["PathTwist"]; - s.PathTwistBegin = (sbyte)(int)row["PathTwistBegin"]; - // profile - s.ProfileBegin = (ushort)(int)row["ProfileBegin"]; - s.ProfileEnd = (ushort)(int)row["ProfileEnd"]; - s.ProfileCurve = (byte)(int)row["ProfileCurve"]; - s.ProfileHollow = (ushort)(int)row["ProfileHollow"]; - s.TextureEntry = (byte[])row["Texture"]; - - s.ExtraParams = (byte[])row["ExtraParams"]; - - s.State = (byte)(int)row["State"]; - - if (!(row["Media"] is System.DBNull)) - s.Media = PrimitiveBaseShape.MediaList.FromXml((string)row["Media"]); - - return s; - } - - /// - /// - /// - /// - /// - private void FillShapeCommand(MySqlCommand cmd, SceneObjectPart prim) - { - PrimitiveBaseShape s = prim.Shape; - cmd.Parameters.AddWithValue("UUID", prim.UUID.ToString()); - // shape is an enum - cmd.Parameters.AddWithValue("Shape", 0); - // vectors - cmd.Parameters.AddWithValue("ScaleX", (double)s.Scale.X); - cmd.Parameters.AddWithValue("ScaleY", (double)s.Scale.Y); - cmd.Parameters.AddWithValue("ScaleZ", (double)s.Scale.Z); - // paths - cmd.Parameters.AddWithValue("PCode", s.PCode); - cmd.Parameters.AddWithValue("PathBegin", s.PathBegin); - cmd.Parameters.AddWithValue("PathEnd", s.PathEnd); - cmd.Parameters.AddWithValue("PathScaleX", s.PathScaleX); - cmd.Parameters.AddWithValue("PathScaleY", s.PathScaleY); - cmd.Parameters.AddWithValue("PathShearX", s.PathShearX); - cmd.Parameters.AddWithValue("PathShearY", s.PathShearY); - cmd.Parameters.AddWithValue("PathSkew", s.PathSkew); - cmd.Parameters.AddWithValue("PathCurve", s.PathCurve); - cmd.Parameters.AddWithValue("PathRadiusOffset", s.PathRadiusOffset); - cmd.Parameters.AddWithValue("PathRevolutions", s.PathRevolutions); - cmd.Parameters.AddWithValue("PathTaperX", s.PathTaperX); - cmd.Parameters.AddWithValue("PathTaperY", s.PathTaperY); - cmd.Parameters.AddWithValue("PathTwist", s.PathTwist); - cmd.Parameters.AddWithValue("PathTwistBegin", s.PathTwistBegin); - // profile - cmd.Parameters.AddWithValue("ProfileBegin", s.ProfileBegin); - cmd.Parameters.AddWithValue("ProfileEnd", s.ProfileEnd); - cmd.Parameters.AddWithValue("ProfileCurve", s.ProfileCurve); - cmd.Parameters.AddWithValue("ProfileHollow", s.ProfileHollow); - cmd.Parameters.AddWithValue("Texture", s.TextureEntry); - cmd.Parameters.AddWithValue("ExtraParams", s.ExtraParams); - cmd.Parameters.AddWithValue("State", s.State); - cmd.Parameters.AddWithValue("Media", null == s.Media ? null : s.Media.ToXml()); - } - - public void StorePrimInventory(UUID primID, ICollection items) - { - lock (m_dbLock) - { - RemoveItems(primID); - - using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) - { - dbcon.Open(); - - MySqlCommand cmd = dbcon.CreateCommand(); - - if (items.Count == 0) - return; - - cmd.CommandText = "insert into primitems (" + - "invType, assetType, name, " + - "description, creationDate, nextPermissions, " + - "currentPermissions, basePermissions, " + - "everyonePermissions, groupPermissions, " + - "flags, itemID, primID, assetID, " + - "parentFolderID, creatorID, ownerID, " + - "groupID, lastOwnerID) values (?invType, " + - "?assetType, ?name, ?description, " + - "?creationDate, ?nextPermissions, " + - "?currentPermissions, ?basePermissions, " + - "?everyonePermissions, ?groupPermissions, " + - "?flags, ?itemID, ?primID, ?assetID, " + - "?parentFolderID, ?creatorID, ?ownerID, " + - "?groupID, ?lastOwnerID)"; - - foreach (TaskInventoryItem item in items) - { - cmd.Parameters.Clear(); - - FillItemCommand(cmd, item); - - ExecuteNonQuery(cmd); - } - - cmd.Dispose(); - } - } - } - } -} diff --git a/OpenSim/Data/MySQL/MySQLSimulationData.cs b/OpenSim/Data/MySQL/MySQLSimulationData.cs new file mode 100644 index 0000000..36f73ef --- /dev/null +++ b/OpenSim/Data/MySQL/MySQLSimulationData.cs @@ -0,0 +1,1820 @@ +/* + * Copyright (c) Contributors, http://opensimulator.org/ + * See CONTRIBUTORS.TXT for a full list of copyright holders. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the OpenSimulator Project nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +using System; +using System.Collections.Generic; +using System.Data; +using System.Drawing; +using System.IO; +using System.Reflection; +using System.Threading; +using log4net; +using MySql.Data.MySqlClient; +using OpenMetaverse; +using OpenSim.Framework; +using OpenSim.Region.Framework.Interfaces; +using OpenSim.Region.Framework.Scenes; +using OpenSim.Data; + +namespace OpenSim.Data.MySQL +{ + /// + /// A MySQL Interface for the Region Server + /// + public class MySQLSimulationData : ISimulationDataStore + { + private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + + private string m_connectionString; + private object m_dbLock = new object(); + + public void Initialise(string connectionString) + { + m_connectionString = connectionString; + + using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) + { + dbcon.Open(); + + // Apply new Migrations + // + Assembly assem = GetType().Assembly; + Migration m = new Migration(dbcon, assem, "RegionStore"); + m.Update(); + + // Clean dropped attachments + // + try + { + using (MySqlCommand cmd = dbcon.CreateCommand()) + { + cmd.CommandText = "delete from prims, primshapes using prims " + + "left join primshapes on prims.uuid = primshapes.uuid " + + "where PCode = 9 and State <> 0"; + ExecuteNonQuery(cmd); + } + } + catch (MySqlException ex) + { + m_log.Error("[REGION DB]: Error cleaning up dropped attachments: " + ex.Message); + } + } + } + + private IDataReader ExecuteReader(MySqlCommand c) + { + IDataReader r = null; + + try + { + r = c.ExecuteReader(); + } + catch (Exception e) + { + m_log.Error("[REGION DB]: MySQL error in ExecuteReader: " + e.Message); + throw; + } + + return r; + } + + private void ExecuteNonQuery(MySqlCommand c) + { + try + { + c.ExecuteNonQuery(); + } + catch (Exception e) + { + m_log.Error("[REGION DB]: MySQL error in ExecuteNonQuery: " + e.Message); + throw; + } + } + + public void Dispose() {} + + public void StoreObject(SceneObjectGroup obj, UUID regionUUID) + { + uint flags = obj.RootPart.GetEffectiveObjectFlags(); + + // Eligibility check + // + if ((flags & (uint)PrimFlags.Temporary) != 0) + return; + if ((flags & (uint)PrimFlags.TemporaryOnRez) != 0) + return; + + lock (m_dbLock) + { + using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) + { + dbcon.Open(); + MySqlCommand cmd = dbcon.CreateCommand(); + + foreach (SceneObjectPart prim in obj.Children.Values) + { + cmd.Parameters.Clear(); + + cmd.CommandText = "replace into prims (" + + "UUID, CreationDate, " + + "Name, Text, Description, " + + "SitName, TouchName, ObjectFlags, " + + "OwnerMask, NextOwnerMask, GroupMask, " + + "EveryoneMask, BaseMask, PositionX, " + + "PositionY, PositionZ, GroupPositionX, " + + "GroupPositionY, GroupPositionZ, VelocityX, " + + "VelocityY, VelocityZ, AngularVelocityX, " + + "AngularVelocityY, AngularVelocityZ, " + + "AccelerationX, AccelerationY, " + + "AccelerationZ, RotationX, " + + "RotationY, RotationZ, " + + "RotationW, SitTargetOffsetX, " + + "SitTargetOffsetY, SitTargetOffsetZ, " + + "SitTargetOrientW, SitTargetOrientX, " + + "SitTargetOrientY, SitTargetOrientZ, " + + "RegionUUID, CreatorID, " + + "OwnerID, GroupID, " + + "LastOwnerID, SceneGroupID, " + + "PayPrice, PayButton1, " + + "PayButton2, PayButton3, " + + "PayButton4, LoopedSound, " + + "LoopedSoundGain, TextureAnimation, " + + "OmegaX, OmegaY, OmegaZ, " + + "CameraEyeOffsetX, CameraEyeOffsetY, " + + "CameraEyeOffsetZ, CameraAtOffsetX, " + + "CameraAtOffsetY, CameraAtOffsetZ, " + + "ForceMouselook, ScriptAccessPin, " + + "AllowedDrop, DieAtEdge, " + + "SalePrice, SaleType, " + + "ColorR, ColorG, ColorB, ColorA, " + + "ParticleSystem, ClickAction, Material, " + + "CollisionSound, CollisionSoundVolume, " + + "PassTouches, " + + "LinkNumber, MediaURL) values (" + "?UUID, " + + "?CreationDate, ?Name, ?Text, " + + "?Description, ?SitName, ?TouchName, " + + "?ObjectFlags, ?OwnerMask, ?NextOwnerMask, " + + "?GroupMask, ?EveryoneMask, ?BaseMask, " + + "?PositionX, ?PositionY, ?PositionZ, " + + "?GroupPositionX, ?GroupPositionY, " + + "?GroupPositionZ, ?VelocityX, " + + "?VelocityY, ?VelocityZ, ?AngularVelocityX, " + + "?AngularVelocityY, ?AngularVelocityZ, " + + "?AccelerationX, ?AccelerationY, " + + "?AccelerationZ, ?RotationX, " + + "?RotationY, ?RotationZ, " + + "?RotationW, ?SitTargetOffsetX, " + + "?SitTargetOffsetY, ?SitTargetOffsetZ, " + + "?SitTargetOrientW, ?SitTargetOrientX, " + + "?SitTargetOrientY, ?SitTargetOrientZ, " + + "?RegionUUID, ?CreatorID, ?OwnerID, " + + "?GroupID, ?LastOwnerID, ?SceneGroupID, " + + "?PayPrice, ?PayButton1, ?PayButton2, " + + "?PayButton3, ?PayButton4, ?LoopedSound, " + + "?LoopedSoundGain, ?TextureAnimation, " + + "?OmegaX, ?OmegaY, ?OmegaZ, " + + "?CameraEyeOffsetX, ?CameraEyeOffsetY, " + + "?CameraEyeOffsetZ, ?CameraAtOffsetX, " + + "?CameraAtOffsetY, ?CameraAtOffsetZ, " + + "?ForceMouselook, ?ScriptAccessPin, " + + "?AllowedDrop, ?DieAtEdge, ?SalePrice, " + + "?SaleType, ?ColorR, ?ColorG, " + + "?ColorB, ?ColorA, ?ParticleSystem, " + + "?ClickAction, ?Material, ?CollisionSound, " + + "?CollisionSoundVolume, ?PassTouches, ?LinkNumber, ?MediaURL)"; + + FillPrimCommand(cmd, prim, obj.UUID, regionUUID); + + ExecuteNonQuery(cmd); + + cmd.Parameters.Clear(); + + cmd.CommandText = "replace into primshapes (" + + "UUID, Shape, ScaleX, ScaleY, " + + "ScaleZ, PCode, PathBegin, PathEnd, " + + "PathScaleX, PathScaleY, PathShearX, " + + "PathShearY, PathSkew, PathCurve, " + + "PathRadiusOffset, PathRevolutions, " + + "PathTaperX, PathTaperY, PathTwist, " + + "PathTwistBegin, ProfileBegin, ProfileEnd, " + + "ProfileCurve, ProfileHollow, Texture, " + + "ExtraParams, State, Media) values (?UUID, " + + "?Shape, ?ScaleX, ?ScaleY, ?ScaleZ, " + + "?PCode, ?PathBegin, ?PathEnd, " + + "?PathScaleX, ?PathScaleY, " + + "?PathShearX, ?PathShearY, " + + "?PathSkew, ?PathCurve, ?PathRadiusOffset, " + + "?PathRevolutions, ?PathTaperX, " + + "?PathTaperY, ?PathTwist, " + + "?PathTwistBegin, ?ProfileBegin, " + + "?ProfileEnd, ?ProfileCurve, " + + "?ProfileHollow, ?Texture, ?ExtraParams, " + + "?State, ?Media)"; + + FillShapeCommand(cmd, prim); + + ExecuteNonQuery(cmd); + } + + cmd.Dispose(); + } + } + } + + public void RemoveObject(UUID obj, UUID regionUUID) + { +// m_log.DebugFormat("[REGION DB]: Deleting scene object {0} from {1} in database", obj, regionUUID); + + List uuids = new List(); + + // Formerly, this used to check the region UUID. + // That makes no sense, as we remove the contents of a prim + // unconditionally, but the prim dependent on the region ID. + // So, we would destroy an object and cause hard to detect + // issues if we delete the contents only. Deleting it all may + // cause the loss of a prim, but is cleaner. + // It's also faster because it uses the primary key. + // + lock (m_dbLock) + { + using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) + { + dbcon.Open(); + + using (MySqlCommand cmd = dbcon.CreateCommand()) + { + cmd.CommandText = "select UUID from prims where SceneGroupID= ?UUID"; + cmd.Parameters.AddWithValue("UUID", obj.ToString()); + + using (IDataReader reader = ExecuteReader(cmd)) + { + while (reader.Read()) + uuids.Add(DBGuid.FromDB(reader["UUID"].ToString())); + } + + // delete the main prims + cmd.CommandText = "delete from prims where SceneGroupID= ?UUID"; + ExecuteNonQuery(cmd); + } + } + } + + // there is no way this should be < 1 unless there is + // a very corrupt database, but in that case be extra + // safe anyway. + if (uuids.Count > 0) + { + RemoveShapes(uuids); + RemoveItems(uuids); + } + } + + /// + /// Remove all persisted items of the given prim. + /// The caller must acquire the necessrary synchronization locks + /// + /// the Item UUID + private void RemoveItems(UUID uuid) + { + lock (m_dbLock) + { + using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) + { + dbcon.Open(); + + using (MySqlCommand cmd = dbcon.CreateCommand()) + { + cmd.CommandText = "delete from primitems where PrimID = ?PrimID"; + cmd.Parameters.AddWithValue("PrimID", uuid.ToString()); + + ExecuteNonQuery(cmd); + } + } + } + } + + /// + /// Remove all persisted shapes for a list of prims + /// The caller must acquire the necessrary synchronization locks + /// + /// the list of UUIDs + private void RemoveShapes(List uuids) + { + lock (m_dbLock) + { + string sql = "delete from primshapes where "; + using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) + { + dbcon.Open(); + + using (MySqlCommand cmd = dbcon.CreateCommand()) + { + for (int i = 0; i < uuids.Count; i++) + { + if ((i + 1) == uuids.Count) + {// end of the list + sql += "(UUID = ?UUID" + i + ")"; + } + else + { + sql += "(UUID = ?UUID" + i + ") or "; + } + } + cmd.CommandText = sql; + + for (int i = 0; i < uuids.Count; i++) + cmd.Parameters.AddWithValue("UUID" + i, uuids[i].ToString()); + + ExecuteNonQuery(cmd); + } + } + } + } + + /// + /// Remove all persisted items for a list of prims + /// The caller must acquire the necessrary synchronization locks + /// + /// the list of UUIDs + private void RemoveItems(List uuids) + { + lock (m_dbLock) + { + string sql = "delete from primitems where "; + using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) + { + dbcon.Open(); + + using (MySqlCommand cmd = dbcon.CreateCommand()) + { + for (int i = 0; i < uuids.Count; i++) + { + if ((i + 1) == uuids.Count) + { + // end of the list + sql += "(PrimID = ?PrimID" + i + ")"; + } + else + { + sql += "(PrimID = ?PrimID" + i + ") or "; + } + } + cmd.CommandText = sql; + + for (int i = 0; i < uuids.Count; i++) + cmd.Parameters.AddWithValue("PrimID" + i, uuids[i].ToString()); + + ExecuteNonQuery(cmd); + } + } + } + } + + public List LoadObjects(UUID regionID) + { + const int ROWS_PER_QUERY = 5000; + + Dictionary prims = new Dictionary(ROWS_PER_QUERY); + Dictionary objects = new Dictionary(); + int count = 0; + + #region Prim Loading + + lock (m_dbLock) + { + using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) + { + dbcon.Open(); + + using (MySqlCommand cmd = dbcon.CreateCommand()) + { + cmd.CommandText = + "SELECT * FROM prims LEFT JOIN primshapes ON prims.UUID = primshapes.UUID WHERE RegionUUID = ?RegionUUID"; + cmd.Parameters.AddWithValue("RegionUUID", regionID.ToString()); + + using (IDataReader reader = ExecuteReader(cmd)) + { + while (reader.Read()) + { + SceneObjectPart prim = BuildPrim(reader); + if (reader["Shape"] is DBNull) + prim.Shape = PrimitiveBaseShape.Default; + else + prim.Shape = BuildShape(reader); + + UUID parentID = DBGuid.FromDB(reader["SceneGroupID"].ToString()); + if (parentID != prim.UUID) + prim.ParentUUID = parentID; + + prims[prim.UUID] = prim; + + ++count; + if (count % ROWS_PER_QUERY == 0) + m_log.Debug("[REGION DB]: Loaded " + count + " prims..."); + } + } + } + } + } + + #endregion Prim Loading + + #region SceneObjectGroup Creation + + // Create all of the SOGs from the root prims first + foreach (SceneObjectPart prim in prims.Values) + { + if (prim.ParentUUID == UUID.Zero) + objects[prim.UUID] = new SceneObjectGroup(prim); + } + + // Add all of the children objects to the SOGs + foreach (SceneObjectPart prim in prims.Values) + { + SceneObjectGroup sog; + if (prim.UUID != prim.ParentUUID) + { + if (objects.TryGetValue(prim.ParentUUID, out sog)) + { + int originalLinkNum = prim.LinkNum; + + sog.AddPart(prim); + + // SceneObjectGroup.AddPart() tries to be smart and automatically set the LinkNum. + // We override that here + if (originalLinkNum != 0) + prim.LinkNum = originalLinkNum; + } + else + { + m_log.WarnFormat( + "[REGION DB]: Database contains an orphan child prim {0} {1} in region {2} pointing to missing parent {3}. This prim will not be loaded.", + prim.Name, prim.UUID, regionID, prim.ParentUUID); + } + } + } + + #endregion SceneObjectGroup Creation + + m_log.DebugFormat("[REGION DB]: Loaded {0} objects using {1} prims", objects.Count, prims.Count); + + #region Prim Inventory Loading + + // Instead of attempting to LoadItems on every prim, + // most of which probably have no items... get a + // list from DB of all prims which have items and + // LoadItems only on those + List primsWithInventory = new List(); + lock (m_dbLock) + { + using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) + { + dbcon.Open(); + + using (MySqlCommand itemCmd = dbcon.CreateCommand()) + { + itemCmd.CommandText = "SELECT DISTINCT primID FROM primitems"; + using (IDataReader itemReader = ExecuteReader(itemCmd)) + { + while (itemReader.Read()) + { + if (!(itemReader["primID"] is DBNull)) + { + UUID primID = DBGuid.FromDB(itemReader["primID"].ToString()); + if (prims.ContainsKey(primID)) + primsWithInventory.Add(prims[primID]); + } + } + } + } + } + } + + foreach (SceneObjectPart prim in primsWithInventory) + { + LoadItems(prim); + } + + #endregion Prim Inventory Loading + + m_log.DebugFormat("[REGION DB]: Loaded inventory from {0} objects", primsWithInventory.Count); + + return new List(objects.Values); + } + + /// + /// Load in a prim's persisted inventory. + /// + /// The prim + private void LoadItems(SceneObjectPart prim) + { + lock (m_dbLock) + { + List inventory = new List(); + + using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) + { + dbcon.Open(); + + using (MySqlCommand cmd = dbcon.CreateCommand()) + { + cmd.CommandText = "select * from primitems where PrimID = ?PrimID"; + cmd.Parameters.AddWithValue("PrimID", prim.UUID.ToString()); + + using (IDataReader reader = ExecuteReader(cmd)) + { + while (reader.Read()) + { + TaskInventoryItem item = BuildItem(reader); + + item.ParentID = prim.UUID; // Values in database are often wrong + inventory.Add(item); + } + } + } + } + + prim.Inventory.RestoreInventoryItems(inventory); + } + } + + public void StoreTerrain(double[,] ter, UUID regionID) + { + m_log.Info("[REGION DB]: Storing terrain"); + + lock (m_dbLock) + { + using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) + { + dbcon.Open(); + + using (MySqlCommand cmd = dbcon.CreateCommand()) + { + cmd.CommandText = "delete from terrain where RegionUUID = ?RegionUUID"; + cmd.Parameters.AddWithValue("RegionUUID", regionID.ToString()); + + ExecuteNonQuery(cmd); + + cmd.CommandText = "insert into terrain (RegionUUID, " + + "Revision, Heightfield) values (?RegionUUID, " + + "1, ?Heightfield)"; + + cmd.Parameters.AddWithValue("Heightfield", SerializeTerrain(ter)); + + ExecuteNonQuery(cmd); + } + } + } + } + + public double[,] LoadTerrain(UUID regionID) + { + double[,] terrain = null; + + lock (m_dbLock) + { + using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) + { + dbcon.Open(); + + using (MySqlCommand cmd = dbcon.CreateCommand()) + { + cmd.CommandText = "select RegionUUID, Revision, Heightfield " + + "from terrain where RegionUUID = ?RegionUUID " + + "order by Revision desc limit 1"; + cmd.Parameters.AddWithValue("RegionUUID", regionID.ToString()); + + using (IDataReader reader = ExecuteReader(cmd)) + { + while (reader.Read()) + { + int rev = Convert.ToInt32(reader["Revision"]); + + terrain = new double[(int)Constants.RegionSize, (int)Constants.RegionSize]; + terrain.Initialize(); + + using (MemoryStream mstr = new MemoryStream((byte[])reader["Heightfield"])) + { + using (BinaryReader br = new BinaryReader(mstr)) + { + for (int x = 0; x < (int)Constants.RegionSize; x++) + { + for (int y = 0; y < (int)Constants.RegionSize; y++) + { + terrain[x, y] = br.ReadDouble(); + } + } + } + + m_log.InfoFormat("[REGION DB]: Loaded terrain revision r{0}", rev); + } + } + } + } + } + } + + return terrain; + } + + public void RemoveLandObject(UUID globalID) + { + lock (m_dbLock) + { + using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) + { + dbcon.Open(); + + using (MySqlCommand cmd = dbcon.CreateCommand()) + { + cmd.CommandText = "delete from land where UUID = ?UUID"; + cmd.Parameters.AddWithValue("UUID", globalID.ToString()); + + ExecuteNonQuery(cmd); + } + } + } + } + + public void StoreLandObject(ILandObject parcel) + { + lock (m_dbLock) + { + using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) + { + dbcon.Open(); + + using (MySqlCommand cmd = dbcon.CreateCommand()) + { + cmd.CommandText = "replace into land (UUID, RegionUUID, " + + "LocalLandID, Bitmap, Name, Description, " + + "OwnerUUID, IsGroupOwned, Area, AuctionID, " + + "Category, ClaimDate, ClaimPrice, GroupUUID, " + + "SalePrice, LandStatus, LandFlags, LandingType, " + + "MediaAutoScale, MediaTextureUUID, MediaURL, " + + "MusicURL, PassHours, PassPrice, SnapshotUUID, " + + "UserLocationX, UserLocationY, UserLocationZ, " + + "UserLookAtX, UserLookAtY, UserLookAtZ, " + + "AuthbuyerID, OtherCleanTime, MediaType, MediaDescription, " + + "MediaSize, MediaLoop, ObscureMusic, ObscureMedia) values (" + + "?UUID, ?RegionUUID, " + + "?LocalLandID, ?Bitmap, ?Name, ?Description, " + + "?OwnerUUID, ?IsGroupOwned, ?Area, ?AuctionID, " + + "?Category, ?ClaimDate, ?ClaimPrice, ?GroupUUID, " + + "?SalePrice, ?LandStatus, ?LandFlags, ?LandingType, " + + "?MediaAutoScale, ?MediaTextureUUID, ?MediaURL, " + + "?MusicURL, ?PassHours, ?PassPrice, ?SnapshotUUID, " + + "?UserLocationX, ?UserLocationY, ?UserLocationZ, " + + "?UserLookAtX, ?UserLookAtY, ?UserLookAtZ, " + + "?AuthbuyerID, ?OtherCleanTime, ?MediaType, ?MediaDescription, "+ + "CONCAT(?MediaWidth, ',', ?MediaHeight), ?MediaLoop, ?ObscureMusic, ?ObscureMedia)"; + + FillLandCommand(cmd, parcel.LandData, parcel.RegionUUID); + + ExecuteNonQuery(cmd); + + cmd.CommandText = "delete from landaccesslist where LandUUID = ?UUID"; + + ExecuteNonQuery(cmd); + + cmd.Parameters.Clear(); + cmd.CommandText = "insert into landaccesslist (LandUUID, " + + "AccessUUID, Flags) values (?LandUUID, ?AccessUUID, " + + "?Flags)"; + + foreach (ParcelManager.ParcelAccessEntry entry in parcel.LandData.ParcelAccessList) + { + FillLandAccessCommand(cmd, entry, parcel.LandData.GlobalID); + ExecuteNonQuery(cmd); + cmd.Parameters.Clear(); + } + } + } + } + } + + public RegionLightShareData LoadRegionWindlightSettings(UUID regionUUID) + { + RegionLightShareData nWP = new RegionLightShareData(); + nWP.OnSave += StoreRegionWindlightSettings; + + using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) + { + dbcon.Open(); + + string command = "select * from `regionwindlight` where region_id = ?regionID"; + + using(MySqlCommand cmd = new MySqlCommand(command)) + { + cmd.Connection = dbcon; + + cmd.Parameters.AddWithValue("?regionID", regionUUID.ToString()); + + IDataReader result = ExecuteReader(cmd); + if (!result.Read()) + { + //No result, so store our default windlight profile and return it + nWP.regionID = regionUUID; + StoreRegionWindlightSettings(nWP); + return nWP; + } + else + { + nWP.regionID = DBGuid.FromDB(result["region_id"]); + nWP.waterColor.X = Convert.ToSingle(result["water_color_r"]); + nWP.waterColor.Y = Convert.ToSingle(result["water_color_g"]); + nWP.waterColor.Z = Convert.ToSingle(result["water_color_b"]); + nWP.waterFogDensityExponent = Convert.ToSingle(result["water_fog_density_exponent"]); + nWP.underwaterFogModifier = Convert.ToSingle(result["underwater_fog_modifier"]); + nWP.reflectionWaveletScale.X = Convert.ToSingle(result["reflection_wavelet_scale_1"]); + nWP.reflectionWaveletScale.Y = Convert.ToSingle(result["reflection_wavelet_scale_2"]); + nWP.reflectionWaveletScale.Z = Convert.ToSingle(result["reflection_wavelet_scale_3"]); + nWP.fresnelScale = Convert.ToSingle(result["fresnel_scale"]); + nWP.fresnelOffset = Convert.ToSingle(result["fresnel_offset"]); + nWP.refractScaleAbove = Convert.ToSingle(result["refract_scale_above"]); + nWP.refractScaleBelow = Convert.ToSingle(result["refract_scale_below"]); + nWP.blurMultiplier = Convert.ToSingle(result["blur_multiplier"]); + nWP.bigWaveDirection.X = Convert.ToSingle(result["big_wave_direction_x"]); + nWP.bigWaveDirection.Y = Convert.ToSingle(result["big_wave_direction_y"]); + nWP.littleWaveDirection.X = Convert.ToSingle(result["little_wave_direction_x"]); + nWP.littleWaveDirection.Y = Convert.ToSingle(result["little_wave_direction_y"]); + UUID.TryParse(result["normal_map_texture"].ToString(), out nWP.normalMapTexture); + nWP.horizon.X = Convert.ToSingle(result["horizon_r"]); + nWP.horizon.Y = Convert.ToSingle(result["horizon_g"]); + nWP.horizon.Z = Convert.ToSingle(result["horizon_b"]); + nWP.horizon.W = Convert.ToSingle(result["horizon_i"]); + nWP.hazeHorizon = Convert.ToSingle(result["haze_horizon"]); + nWP.blueDensity.X = Convert.ToSingle(result["blue_density_r"]); + nWP.blueDensity.Y = Convert.ToSingle(result["blue_density_g"]); + nWP.blueDensity.Z = Convert.ToSingle(result["blue_density_b"]); + nWP.blueDensity.W = Convert.ToSingle(result["blue_density_i"]); + nWP.hazeDensity = Convert.ToSingle(result["haze_density"]); + nWP.densityMultiplier = Convert.ToSingle(result["density_multiplier"]); + nWP.distanceMultiplier = Convert.ToSingle(result["distance_multiplier"]); + nWP.maxAltitude = Convert.ToUInt16(result["max_altitude"]); + nWP.sunMoonColor.X = Convert.ToSingle(result["sun_moon_color_r"]); + nWP.sunMoonColor.Y = Convert.ToSingle(result["sun_moon_color_g"]); + nWP.sunMoonColor.Z = Convert.ToSingle(result["sun_moon_color_b"]); + nWP.sunMoonColor.W = Convert.ToSingle(result["sun_moon_color_i"]); + nWP.sunMoonPosition = Convert.ToSingle(result["sun_moon_position"]); + nWP.ambient.X = Convert.ToSingle(result["ambient_r"]); + nWP.ambient.Y = Convert.ToSingle(result["ambient_g"]); + nWP.ambient.Z = Convert.ToSingle(result["ambient_b"]); + nWP.ambient.W = Convert.ToSingle(result["ambient_i"]); + nWP.eastAngle = Convert.ToSingle(result["east_angle"]); + nWP.sunGlowFocus = Convert.ToSingle(result["sun_glow_focus"]); + nWP.sunGlowSize = Convert.ToSingle(result["sun_glow_size"]); + nWP.sceneGamma = Convert.ToSingle(result["scene_gamma"]); + nWP.starBrightness = Convert.ToSingle(result["star_brightness"]); + nWP.cloudColor.X = Convert.ToSingle(result["cloud_color_r"]); + nWP.cloudColor.Y = Convert.ToSingle(result["cloud_color_g"]); + nWP.cloudColor.Z = Convert.ToSingle(result["cloud_color_b"]); + nWP.cloudColor.W = Convert.ToSingle(result["cloud_color_i"]); + nWP.cloudXYDensity.X = Convert.ToSingle(result["cloud_x"]); + nWP.cloudXYDensity.Y = Convert.ToSingle(result["cloud_y"]); + nWP.cloudXYDensity.Z = Convert.ToSingle(result["cloud_density"]); + nWP.cloudCoverage = Convert.ToSingle(result["cloud_coverage"]); + nWP.cloudScale = Convert.ToSingle(result["cloud_scale"]); + nWP.cloudDetailXYDensity.X = Convert.ToSingle(result["cloud_detail_x"]); + nWP.cloudDetailXYDensity.Y = Convert.ToSingle(result["cloud_detail_y"]); + nWP.cloudDetailXYDensity.Z = Convert.ToSingle(result["cloud_detail_density"]); + nWP.cloudScrollX = Convert.ToSingle(result["cloud_scroll_x"]); + nWP.cloudScrollXLock = Convert.ToBoolean(result["cloud_scroll_x_lock"]); + nWP.cloudScrollY = Convert.ToSingle(result["cloud_scroll_y"]); + nWP.cloudScrollYLock = Convert.ToBoolean(result["cloud_scroll_y_lock"]); + nWP.drawClassicClouds = Convert.ToBoolean(result["draw_classic_clouds"]); + } + } + } + return nWP; + } + + public RegionSettings LoadRegionSettings(UUID regionUUID) + { + RegionSettings rs = null; + + lock (m_dbLock) + { + using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) + { + dbcon.Open(); + + using (MySqlCommand cmd = dbcon.CreateCommand()) + { + cmd.CommandText = "select * from regionsettings where regionUUID = ?RegionUUID"; + cmd.Parameters.AddWithValue("regionUUID", regionUUID); + + using (IDataReader reader = ExecuteReader(cmd)) + { + if (reader.Read()) + { + rs = BuildRegionSettings(reader); + rs.OnSave += StoreRegionSettings; + } + else + { + rs = new RegionSettings(); + rs.RegionUUID = regionUUID; + rs.OnSave += StoreRegionSettings; + + StoreRegionSettings(rs); + } + } + } + } + } + + return rs; + } + + public void StoreRegionWindlightSettings(RegionLightShareData wl) + { + using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) + { + dbcon.Open(); + + using (MySqlCommand cmd = dbcon.CreateCommand()) + { + cmd.CommandText = "REPLACE INTO `regionwindlight` (`region_id`, `water_color_r`, `water_color_g`, "; + cmd.CommandText += "`water_color_b`, `water_fog_density_exponent`, `underwater_fog_modifier`, "; + cmd.CommandText += "`reflection_wavelet_scale_1`, `reflection_wavelet_scale_2`, `reflection_wavelet_scale_3`, "; + cmd.CommandText += "`fresnel_scale`, `fresnel_offset`, `refract_scale_above`, `refract_scale_below`, "; + cmd.CommandText += "`blur_multiplier`, `big_wave_direction_x`, `big_wave_direction_y`, `little_wave_direction_x`, "; + cmd.CommandText += "`little_wave_direction_y`, `normal_map_texture`, `horizon_r`, `horizon_g`, `horizon_b`, "; + cmd.CommandText += "`horizon_i`, `haze_horizon`, `blue_density_r`, `blue_density_g`, `blue_density_b`, "; + cmd.CommandText += "`blue_density_i`, `haze_density`, `density_multiplier`, `distance_multiplier`, `max_altitude`, "; + cmd.CommandText += "`sun_moon_color_r`, `sun_moon_color_g`, `sun_moon_color_b`, `sun_moon_color_i`, `sun_moon_position`, "; + cmd.CommandText += "`ambient_r`, `ambient_g`, `ambient_b`, `ambient_i`, `east_angle`, `sun_glow_focus`, `sun_glow_size`, "; + cmd.CommandText += "`scene_gamma`, `star_brightness`, `cloud_color_r`, `cloud_color_g`, `cloud_color_b`, `cloud_color_i`, "; + cmd.CommandText += "`cloud_x`, `cloud_y`, `cloud_density`, `cloud_coverage`, `cloud_scale`, `cloud_detail_x`, "; + cmd.CommandText += "`cloud_detail_y`, `cloud_detail_density`, `cloud_scroll_x`, `cloud_scroll_x_lock`, `cloud_scroll_y`, "; + cmd.CommandText += "`cloud_scroll_y_lock`, `draw_classic_clouds`) VALUES (?region_id, ?water_color_r, "; + cmd.CommandText += "?water_color_g, ?water_color_b, ?water_fog_density_exponent, ?underwater_fog_modifier, ?reflection_wavelet_scale_1, "; + cmd.CommandText += "?reflection_wavelet_scale_2, ?reflection_wavelet_scale_3, ?fresnel_scale, ?fresnel_offset, ?refract_scale_above, "; + cmd.CommandText += "?refract_scale_below, ?blur_multiplier, ?big_wave_direction_x, ?big_wave_direction_y, ?little_wave_direction_x, "; + cmd.CommandText += "?little_wave_direction_y, ?normal_map_texture, ?horizon_r, ?horizon_g, ?horizon_b, ?horizon_i, ?haze_horizon, "; + cmd.CommandText += "?blue_density_r, ?blue_density_g, ?blue_density_b, ?blue_density_i, ?haze_density, ?density_multiplier, "; + cmd.CommandText += "?distance_multiplier, ?max_altitude, ?sun_moon_color_r, ?sun_moon_color_g, ?sun_moon_color_b, "; + cmd.CommandText += "?sun_moon_color_i, ?sun_moon_position, ?ambient_r, ?ambient_g, ?ambient_b, ?ambient_i, ?east_angle, "; + cmd.CommandText += "?sun_glow_focus, ?sun_glow_size, ?scene_gamma, ?star_brightness, ?cloud_color_r, ?cloud_color_g, "; + cmd.CommandText += "?cloud_color_b, ?cloud_color_i, ?cloud_x, ?cloud_y, ?cloud_density, ?cloud_coverage, ?cloud_scale, "; + cmd.CommandText += "?cloud_detail_x, ?cloud_detail_y, ?cloud_detail_density, ?cloud_scroll_x, ?cloud_scroll_x_lock, "; + cmd.CommandText += "?cloud_scroll_y, ?cloud_scroll_y_lock, ?draw_classic_clouds)"; + + cmd.Parameters.AddWithValue("region_id", wl.regionID); + cmd.Parameters.AddWithValue("water_color_r", wl.waterColor.X); + cmd.Parameters.AddWithValue("water_color_g", wl.waterColor.Y); + cmd.Parameters.AddWithValue("water_color_b", wl.waterColor.Z); + cmd.Parameters.AddWithValue("water_fog_density_exponent", wl.waterFogDensityExponent); + cmd.Parameters.AddWithValue("underwater_fog_modifier", wl.underwaterFogModifier); + cmd.Parameters.AddWithValue("reflection_wavelet_scale_1", wl.reflectionWaveletScale.X); + cmd.Parameters.AddWithValue("reflection_wavelet_scale_2", wl.reflectionWaveletScale.Y); + cmd.Parameters.AddWithValue("reflection_wavelet_scale_3", wl.reflectionWaveletScale.Z); + cmd.Parameters.AddWithValue("fresnel_scale", wl.fresnelScale); + cmd.Parameters.AddWithValue("fresnel_offset", wl.fresnelOffset); + cmd.Parameters.AddWithValue("refract_scale_above", wl.refractScaleAbove); + cmd.Parameters.AddWithValue("refract_scale_below", wl.refractScaleBelow); + cmd.Parameters.AddWithValue("blur_multiplier", wl.blurMultiplier); + cmd.Parameters.AddWithValue("big_wave_direction_x", wl.bigWaveDirection.X); + cmd.Parameters.AddWithValue("big_wave_direction_y", wl.bigWaveDirection.Y); + cmd.Parameters.AddWithValue("little_wave_direction_x", wl.littleWaveDirection.X); + cmd.Parameters.AddWithValue("little_wave_direction_y", wl.littleWaveDirection.Y); + cmd.Parameters.AddWithValue("normal_map_texture", wl.normalMapTexture); + cmd.Parameters.AddWithValue("horizon_r", wl.horizon.X); + cmd.Parameters.AddWithValue("horizon_g", wl.horizon.Y); + cmd.Parameters.AddWithValue("horizon_b", wl.horizon.Z); + cmd.Parameters.AddWithValue("horizon_i", wl.horizon.W); + cmd.Parameters.AddWithValue("haze_horizon", wl.hazeHorizon); + cmd.Parameters.AddWithValue("blue_density_r", wl.blueDensity.X); + cmd.Parameters.AddWithValue("blue_density_g", wl.blueDensity.Y); + cmd.Parameters.AddWithValue("blue_density_b", wl.blueDensity.Z); + cmd.Parameters.AddWithValue("blue_density_i", wl.blueDensity.W); + cmd.Parameters.AddWithValue("haze_density", wl.hazeDensity); + cmd.Parameters.AddWithValue("density_multiplier", wl.densityMultiplier); + cmd.Parameters.AddWithValue("distance_multiplier", wl.distanceMultiplier); + cmd.Parameters.AddWithValue("max_altitude", wl.maxAltitude); + cmd.Parameters.AddWithValue("sun_moon_color_r", wl.sunMoonColor.X); + cmd.Parameters.AddWithValue("sun_moon_color_g", wl.sunMoonColor.Y); + cmd.Parameters.AddWithValue("sun_moon_color_b", wl.sunMoonColor.Z); + cmd.Parameters.AddWithValue("sun_moon_color_i", wl.sunMoonColor.W); + cmd.Parameters.AddWithValue("sun_moon_position", wl.sunMoonPosition); + cmd.Parameters.AddWithValue("ambient_r", wl.ambient.X); + cmd.Parameters.AddWithValue("ambient_g", wl.ambient.Y); + cmd.Parameters.AddWithValue("ambient_b", wl.ambient.Z); + cmd.Parameters.AddWithValue("ambient_i", wl.ambient.W); + cmd.Parameters.AddWithValue("east_angle", wl.eastAngle); + cmd.Parameters.AddWithValue("sun_glow_focus", wl.sunGlowFocus); + cmd.Parameters.AddWithValue("sun_glow_size", wl.sunGlowSize); + cmd.Parameters.AddWithValue("scene_gamma", wl.sceneGamma); + cmd.Parameters.AddWithValue("star_brightness", wl.starBrightness); + cmd.Parameters.AddWithValue("cloud_color_r", wl.cloudColor.X); + cmd.Parameters.AddWithValue("cloud_color_g", wl.cloudColor.Y); + cmd.Parameters.AddWithValue("cloud_color_b", wl.cloudColor.Z); + cmd.Parameters.AddWithValue("cloud_color_i", wl.cloudColor.W); + cmd.Parameters.AddWithValue("cloud_x", wl.cloudXYDensity.X); + cmd.Parameters.AddWithValue("cloud_y", wl.cloudXYDensity.Y); + cmd.Parameters.AddWithValue("cloud_density", wl.cloudXYDensity.Z); + cmd.Parameters.AddWithValue("cloud_coverage", wl.cloudCoverage); + cmd.Parameters.AddWithValue("cloud_scale", wl.cloudScale); + cmd.Parameters.AddWithValue("cloud_detail_x", wl.cloudDetailXYDensity.X); + cmd.Parameters.AddWithValue("cloud_detail_y", wl.cloudDetailXYDensity.Y); + cmd.Parameters.AddWithValue("cloud_detail_density", wl.cloudDetailXYDensity.Z); + cmd.Parameters.AddWithValue("cloud_scroll_x", wl.cloudScrollX); + cmd.Parameters.AddWithValue("cloud_scroll_x_lock", wl.cloudScrollXLock); + cmd.Parameters.AddWithValue("cloud_scroll_y", wl.cloudScrollY); + cmd.Parameters.AddWithValue("cloud_scroll_y_lock", wl.cloudScrollYLock); + cmd.Parameters.AddWithValue("draw_classic_clouds", wl.drawClassicClouds); + + ExecuteNonQuery(cmd); + } + } + } + + public void StoreRegionSettings(RegionSettings rs) + { + lock (m_dbLock) + { + using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) + { + dbcon.Open(); + + using (MySqlCommand cmd = dbcon.CreateCommand()) + { + cmd.CommandText = "replace into regionsettings (regionUUID, " + + "block_terraform, block_fly, allow_damage, " + + "restrict_pushing, allow_land_resell, " + + "allow_land_join_divide, block_show_in_search, " + + "agent_limit, object_bonus, maturity, " + + "disable_scripts, disable_collisions, " + + "disable_physics, terrain_texture_1, " + + "terrain_texture_2, terrain_texture_3, " + + "terrain_texture_4, elevation_1_nw, " + + "elevation_2_nw, elevation_1_ne, " + + "elevation_2_ne, elevation_1_se, " + + "elevation_2_se, elevation_1_sw, " + + "elevation_2_sw, water_height, " + + "terrain_raise_limit, terrain_lower_limit, " + + "use_estate_sun, fixed_sun, sun_position, " + + "covenant, Sandbox, sunvectorx, sunvectory, " + + "sunvectorz, loaded_creation_datetime, " + + "loaded_creation_id, map_tile_ID) values (?RegionUUID, ?BlockTerraform, " + + "?BlockFly, ?AllowDamage, ?RestrictPushing, " + + "?AllowLandResell, ?AllowLandJoinDivide, " + + "?BlockShowInSearch, ?AgentLimit, ?ObjectBonus, " + + "?Maturity, ?DisableScripts, ?DisableCollisions, " + + "?DisablePhysics, ?TerrainTexture1, " + + "?TerrainTexture2, ?TerrainTexture3, " + + "?TerrainTexture4, ?Elevation1NW, ?Elevation2NW, " + + "?Elevation1NE, ?Elevation2NE, ?Elevation1SE, " + + "?Elevation2SE, ?Elevation1SW, ?Elevation2SW, " + + "?WaterHeight, ?TerrainRaiseLimit, " + + "?TerrainLowerLimit, ?UseEstateSun, ?FixedSun, " + + "?SunPosition, ?Covenant, ?Sandbox, " + + "?SunVectorX, ?SunVectorY, ?SunVectorZ, " + + "?LoadedCreationDateTime, ?LoadedCreationID, " + + "?TerrainImageID)"; + + FillRegionSettingsCommand(cmd, rs); + + ExecuteNonQuery(cmd); + } + } + } + } + + public List LoadLandObjects(UUID regionUUID) + { + List landData = new List(); + + lock (m_dbLock) + { + using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) + { + dbcon.Open(); + + using (MySqlCommand cmd = dbcon.CreateCommand()) + { + cmd.CommandText = "select * from land where RegionUUID = ?RegionUUID"; + cmd.Parameters.AddWithValue("RegionUUID", regionUUID.ToString()); + + using (IDataReader reader = ExecuteReader(cmd)) + { + while (reader.Read()) + { + LandData newLand = BuildLandData(reader); + landData.Add(newLand); + } + } + } + + using (MySqlCommand cmd = dbcon.CreateCommand()) + { + foreach (LandData land in landData) + { + cmd.Parameters.Clear(); + cmd.CommandText = "select * from landaccesslist where LandUUID = ?LandUUID"; + cmd.Parameters.AddWithValue("LandUUID", land.GlobalID.ToString()); + + using (IDataReader reader = ExecuteReader(cmd)) + { + while (reader.Read()) + { + land.ParcelAccessList.Add(BuildLandAccessData(reader)); + } + } + } + } + } + } + + return landData; + } + + public void Shutdown() + { + } + + private SceneObjectPart BuildPrim(IDataReader row) + { + SceneObjectPart prim = new SceneObjectPart(); + + // depending on the MySQL connector version, CHAR(36) may be already converted to Guid! + prim.UUID = DBGuid.FromDB(row["UUID"]); + prim.CreatorID = DBGuid.FromDB(row["CreatorID"]); + prim.OwnerID = DBGuid.FromDB(row["OwnerID"]); + prim.GroupID = DBGuid.FromDB(row["GroupID"]); + prim.LastOwnerID = DBGuid.FromDB(row["LastOwnerID"]); + + // explicit conversion of integers is required, which sort + // of sucks. No idea if there is a shortcut here or not. + prim.CreationDate = (int)row["CreationDate"]; + if (row["Name"] != DBNull.Value) + prim.Name = (string)row["Name"]; + else + prim.Name = String.Empty; + // Various text fields + prim.Text = (string)row["Text"]; + prim.Color = Color.FromArgb((int)row["ColorA"], + (int)row["ColorR"], + (int)row["ColorG"], + (int)row["ColorB"]); + prim.Description = (string)row["Description"]; + prim.SitName = (string)row["SitName"]; + prim.TouchName = (string)row["TouchName"]; + // Permissions + prim.Flags = (PrimFlags)(int)row["ObjectFlags"]; + prim.OwnerMask = (uint)(int)row["OwnerMask"]; + prim.NextOwnerMask = (uint)(int)row["NextOwnerMask"]; + prim.GroupMask = (uint)(int)row["GroupMask"]; + prim.EveryoneMask = (uint)(int)row["EveryoneMask"]; + prim.BaseMask = (uint)(int)row["BaseMask"]; + + // Vectors + prim.OffsetPosition = new Vector3( + (float)(double)row["PositionX"], + (float)(double)row["PositionY"], + (float)(double)row["PositionZ"] + ); + prim.GroupPosition = new Vector3( + (float)(double)row["GroupPositionX"], + (float)(double)row["GroupPositionY"], + (float)(double)row["GroupPositionZ"] + ); + prim.Velocity = new Vector3( + (float)(double)row["VelocityX"], + (float)(double)row["VelocityY"], + (float)(double)row["VelocityZ"] + ); + prim.AngularVelocity = new Vector3( + (float)(double)row["AngularVelocityX"], + (float)(double)row["AngularVelocityY"], + (float)(double)row["AngularVelocityZ"] + ); + prim.Acceleration = new Vector3( + (float)(double)row["AccelerationX"], + (float)(double)row["AccelerationY"], + (float)(double)row["AccelerationZ"] + ); + // quaternions + prim.RotationOffset = new Quaternion( + (float)(double)row["RotationX"], + (float)(double)row["RotationY"], + (float)(double)row["RotationZ"], + (float)(double)row["RotationW"] + ); + prim.SitTargetPositionLL = new Vector3( + (float)(double)row["SitTargetOffsetX"], + (float)(double)row["SitTargetOffsetY"], + (float)(double)row["SitTargetOffsetZ"] + ); + prim.SitTargetOrientationLL = new Quaternion( + (float)(double)row["SitTargetOrientX"], + (float)(double)row["SitTargetOrientY"], + (float)(double)row["SitTargetOrientZ"], + (float)(double)row["SitTargetOrientW"] + ); + + prim.PayPrice[0] = (int)row["PayPrice"]; + prim.PayPrice[1] = (int)row["PayButton1"]; + prim.PayPrice[2] = (int)row["PayButton2"]; + prim.PayPrice[3] = (int)row["PayButton3"]; + prim.PayPrice[4] = (int)row["PayButton4"]; + + prim.Sound = DBGuid.FromDB(row["LoopedSound"].ToString()); + prim.SoundGain = (float)(double)row["LoopedSoundGain"]; + prim.SoundFlags = 1; // If it's persisted at all, it's looped + + if (!(row["TextureAnimation"] is DBNull)) + prim.TextureAnimation = (byte[])row["TextureAnimation"]; + if (!(row["ParticleSystem"] is DBNull)) + prim.ParticleSystem = (byte[])row["ParticleSystem"]; + + prim.AngularVelocity = new Vector3( + (float)(double)row["OmegaX"], + (float)(double)row["OmegaY"], + (float)(double)row["OmegaZ"] + ); + + prim.SetCameraEyeOffset(new Vector3( + (float)(double)row["CameraEyeOffsetX"], + (float)(double)row["CameraEyeOffsetY"], + (float)(double)row["CameraEyeOffsetZ"] + )); + + prim.SetCameraAtOffset(new Vector3( + (float)(double)row["CameraAtOffsetX"], + (float)(double)row["CameraAtOffsetY"], + (float)(double)row["CameraAtOffsetZ"] + )); + + prim.SetForceMouselook((sbyte)row["ForceMouselook"] != 0); + prim.ScriptAccessPin = (int)row["ScriptAccessPin"]; + prim.AllowedDrop = ((sbyte)row["AllowedDrop"] != 0); + prim.DIE_AT_EDGE = ((sbyte)row["DieAtEdge"] != 0); + + prim.SalePrice = (int)row["SalePrice"]; + prim.ObjectSaleType = unchecked((byte)(sbyte)row["SaleType"]); + + prim.Material = unchecked((byte)(sbyte)row["Material"]); + + if (!(row["ClickAction"] is DBNull)) + prim.ClickAction = unchecked((byte)(sbyte)row["ClickAction"]); + + prim.CollisionSound = DBGuid.FromDB(row["CollisionSound"]); + prim.CollisionSoundVolume = (float)(double)row["CollisionSoundVolume"]; + + prim.PassTouches = ((sbyte)row["PassTouches"] != 0); + prim.LinkNum = (int)row["LinkNumber"]; + + if (!(row["MediaURL"] is System.DBNull)) + prim.MediaUrl = (string)row["MediaURL"]; + + return prim; + } + + + /// + /// Build a prim inventory item from the persisted data. + /// + /// + /// + private static TaskInventoryItem BuildItem(IDataReader row) + { + TaskInventoryItem taskItem = new TaskInventoryItem(); + + taskItem.ItemID = DBGuid.FromDB(row["itemID"]); + taskItem.ParentPartID = DBGuid.FromDB(row["primID"]); + taskItem.AssetID = DBGuid.FromDB(row["assetID"]); + taskItem.ParentID = DBGuid.FromDB(row["parentFolderID"]); + + taskItem.InvType = Convert.ToInt32(row["invType"]); + taskItem.Type = Convert.ToInt32(row["assetType"]); + + taskItem.Name = (String)row["name"]; + taskItem.Description = (String)row["description"]; + taskItem.CreationDate = Convert.ToUInt32(row["creationDate"]); + taskItem.CreatorID = DBGuid.FromDB(row["creatorID"]); + taskItem.OwnerID = DBGuid.FromDB(row["ownerID"]); + taskItem.LastOwnerID = DBGuid.FromDB(row["lastOwnerID"]); + taskItem.GroupID = DBGuid.FromDB(row["groupID"]); + + taskItem.NextPermissions = Convert.ToUInt32(row["nextPermissions"]); + taskItem.CurrentPermissions = Convert.ToUInt32(row["currentPermissions"]); + taskItem.BasePermissions = Convert.ToUInt32(row["basePermissions"]); + taskItem.EveryonePermissions = Convert.ToUInt32(row["everyonePermissions"]); + taskItem.GroupPermissions = Convert.ToUInt32(row["groupPermissions"]); + taskItem.Flags = Convert.ToUInt32(row["flags"]); + + return taskItem; + } + + private static RegionSettings BuildRegionSettings(IDataReader row) + { + RegionSettings newSettings = new RegionSettings(); + + newSettings.RegionUUID = DBGuid.FromDB(row["regionUUID"]); + newSettings.BlockTerraform = Convert.ToBoolean(row["block_terraform"]); + newSettings.AllowDamage = Convert.ToBoolean(row["allow_damage"]); + newSettings.BlockFly = Convert.ToBoolean(row["block_fly"]); + newSettings.RestrictPushing = Convert.ToBoolean(row["restrict_pushing"]); + newSettings.AllowLandResell = Convert.ToBoolean(row["allow_land_resell"]); + newSettings.AllowLandJoinDivide = Convert.ToBoolean(row["allow_land_join_divide"]); + newSettings.BlockShowInSearch = Convert.ToBoolean(row["block_show_in_search"]); + newSettings.AgentLimit = Convert.ToInt32(row["agent_limit"]); + newSettings.ObjectBonus = Convert.ToDouble(row["object_bonus"]); + newSettings.Maturity = Convert.ToInt32(row["maturity"]); + newSettings.DisableScripts = Convert.ToBoolean(row["disable_scripts"]); + newSettings.DisableCollisions = Convert.ToBoolean(row["disable_collisions"]); + newSettings.DisablePhysics = Convert.ToBoolean(row["disable_physics"]); + newSettings.TerrainTexture1 = DBGuid.FromDB(row["terrain_texture_1"]); + newSettings.TerrainTexture2 = DBGuid.FromDB(row["terrain_texture_2"]); + newSettings.TerrainTexture3 = DBGuid.FromDB(row["terrain_texture_3"]); + newSettings.TerrainTexture4 = DBGuid.FromDB(row["terrain_texture_4"]); + newSettings.Elevation1NW = Convert.ToDouble(row["elevation_1_nw"]); + newSettings.Elevation2NW = Convert.ToDouble(row["elevation_2_nw"]); + newSettings.Elevation1NE = Convert.ToDouble(row["elevation_1_ne"]); + newSettings.Elevation2NE = Convert.ToDouble(row["elevation_2_ne"]); + newSettings.Elevation1SE = Convert.ToDouble(row["elevation_1_se"]); + newSettings.Elevation2SE = Convert.ToDouble(row["elevation_2_se"]); + newSettings.Elevation1SW = Convert.ToDouble(row["elevation_1_sw"]); + newSettings.Elevation2SW = Convert.ToDouble(row["elevation_2_sw"]); + newSettings.WaterHeight = Convert.ToDouble(row["water_height"]); + newSettings.TerrainRaiseLimit = Convert.ToDouble(row["terrain_raise_limit"]); + newSettings.TerrainLowerLimit = Convert.ToDouble(row["terrain_lower_limit"]); + newSettings.UseEstateSun = Convert.ToBoolean(row["use_estate_sun"]); + newSettings.Sandbox = Convert.ToBoolean(row["sandbox"]); + newSettings.SunVector = new Vector3 ( + Convert.ToSingle(row["sunvectorx"]), + Convert.ToSingle(row["sunvectory"]), + Convert.ToSingle(row["sunvectorz"]) + ); + newSettings.FixedSun = Convert.ToBoolean(row["fixed_sun"]); + newSettings.SunPosition = Convert.ToDouble(row["sun_position"]); + newSettings.Covenant = DBGuid.FromDB(row["covenant"]); + + newSettings.LoadedCreationDateTime = Convert.ToInt32(row["loaded_creation_datetime"]); + + if (row["loaded_creation_id"] is DBNull) + newSettings.LoadedCreationID = ""; + else + newSettings.LoadedCreationID = (String) row["loaded_creation_id"]; + + newSettings.TerrainImageID = DBGuid.FromDB(row["map_tile_ID"]); + + return newSettings; + } + + /// + /// + /// + /// + /// + private static LandData BuildLandData(IDataReader row) + { + LandData newData = new LandData(); + + newData.GlobalID = DBGuid.FromDB(row["UUID"]); + newData.LocalID = Convert.ToInt32(row["LocalLandID"]); + + // Bitmap is a byte[512] + newData.Bitmap = (Byte[]) row["Bitmap"]; + + newData.Name = (String) row["Name"]; + newData.Description = (String) row["Description"]; + newData.OwnerID = DBGuid.FromDB(row["OwnerUUID"]); + newData.IsGroupOwned = Convert.ToBoolean(row["IsGroupOwned"]); + newData.Area = Convert.ToInt32(row["Area"]); + newData.AuctionID = Convert.ToUInt32(row["AuctionID"]); //Unimplemented + newData.Category = (ParcelCategory) Convert.ToInt32(row["Category"]); + //Enum libsecondlife.Parcel.ParcelCategory + newData.ClaimDate = Convert.ToInt32(row["ClaimDate"]); + newData.ClaimPrice = Convert.ToInt32(row["ClaimPrice"]); + newData.GroupID = DBGuid.FromDB(row["GroupUUID"]); + newData.SalePrice = Convert.ToInt32(row["SalePrice"]); + newData.Status = (ParcelStatus) Convert.ToInt32(row["LandStatus"]); + //Enum. libsecondlife.Parcel.ParcelStatus + newData.Flags = Convert.ToUInt32(row["LandFlags"]); + newData.LandingType = Convert.ToByte(row["LandingType"]); + newData.MediaAutoScale = Convert.ToByte(row["MediaAutoScale"]); + newData.MediaID = DBGuid.FromDB(row["MediaTextureUUID"]); + newData.MediaURL = (String) row["MediaURL"]; + newData.MusicURL = (String) row["MusicURL"]; + newData.PassHours = Convert.ToSingle(row["PassHours"]); + newData.PassPrice = Convert.ToInt32(row["PassPrice"]); + UUID authedbuyer = UUID.Zero; + UUID snapshotID = UUID.Zero; + + UUID.TryParse((string)row["AuthBuyerID"], out authedbuyer); + UUID.TryParse((string)row["SnapshotUUID"], out snapshotID); + newData.OtherCleanTime = Convert.ToInt32(row["OtherCleanTime"]); + + newData.AuthBuyerID = authedbuyer; + newData.SnapshotID = snapshotID; + try + { + newData.UserLocation = + new Vector3(Convert.ToSingle(row["UserLocationX"]), Convert.ToSingle(row["UserLocationY"]), + Convert.ToSingle(row["UserLocationZ"])); + newData.UserLookAt = + new Vector3(Convert.ToSingle(row["UserLookAtX"]), Convert.ToSingle(row["UserLookAtY"]), + Convert.ToSingle(row["UserLookAtZ"])); + } + catch (InvalidCastException) + { + newData.UserLocation = Vector3.Zero; + newData.UserLookAt = Vector3.Zero; + m_log.ErrorFormat("[PARCEL]: unable to get parcel telehub settings for {1}", newData.Name); + } + + newData.MediaDescription = (string) row["MediaDescription"]; + newData.MediaType = (string) row["MediaType"]; + newData.MediaWidth = Convert.ToInt32((((string) row["MediaSize"]).Split(','))[0]); + newData.MediaHeight = Convert.ToInt32((((string) row["MediaSize"]).Split(','))[1]); + newData.MediaLoop = Convert.ToBoolean(row["MediaLoop"]); + newData.ObscureMusic = Convert.ToBoolean(row["ObscureMusic"]); + newData.ObscureMedia = Convert.ToBoolean(row["ObscureMedia"]); + + newData.ParcelAccessList = new List(); + + return newData; + } + + /// + /// + /// + /// + /// + private static ParcelManager.ParcelAccessEntry BuildLandAccessData(IDataReader row) + { + ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry(); + entry.AgentID = DBGuid.FromDB(row["AccessUUID"]); + entry.Flags = (AccessList) Convert.ToInt32(row["Flags"]); + entry.Time = new DateTime(); + return entry; + } + + /// + /// + /// + /// + /// + private static Array SerializeTerrain(double[,] val) + { + MemoryStream str = new MemoryStream(((int)Constants.RegionSize * (int)Constants.RegionSize) *sizeof (double)); + BinaryWriter bw = new BinaryWriter(str); + + // TODO: COMPATIBILITY - Add byte-order conversions + for (int x = 0; x < (int)Constants.RegionSize; x++) + for (int y = 0; y < (int)Constants.RegionSize; y++) + { + double height = val[x, y]; + if (height == 0.0) + height = double.Epsilon; + + bw.Write(height); + } + + return str.ToArray(); + } + + /// + /// Fill the prim command with prim values + /// + /// + /// + /// + /// + private void FillPrimCommand(MySqlCommand cmd, SceneObjectPart prim, UUID sceneGroupID, UUID regionUUID) + { + cmd.Parameters.AddWithValue("UUID", prim.UUID.ToString()); + cmd.Parameters.AddWithValue("RegionUUID", regionUUID.ToString()); + cmd.Parameters.AddWithValue("CreationDate", prim.CreationDate); + cmd.Parameters.AddWithValue("Name", prim.Name); + cmd.Parameters.AddWithValue("SceneGroupID", sceneGroupID.ToString()); + // the UUID of the root part for this SceneObjectGroup + // various text fields + cmd.Parameters.AddWithValue("Text", prim.Text); + cmd.Parameters.AddWithValue("ColorR", prim.Color.R); + cmd.Parameters.AddWithValue("ColorG", prim.Color.G); + cmd.Parameters.AddWithValue("ColorB", prim.Color.B); + cmd.Parameters.AddWithValue("ColorA", prim.Color.A); + cmd.Parameters.AddWithValue("Description", prim.Description); + cmd.Parameters.AddWithValue("SitName", prim.SitName); + cmd.Parameters.AddWithValue("TouchName", prim.TouchName); + // permissions + cmd.Parameters.AddWithValue("ObjectFlags", (uint)prim.Flags); + cmd.Parameters.AddWithValue("CreatorID", prim.CreatorID.ToString()); + cmd.Parameters.AddWithValue("OwnerID", prim.OwnerID.ToString()); + cmd.Parameters.AddWithValue("GroupID", prim.GroupID.ToString()); + cmd.Parameters.AddWithValue("LastOwnerID", prim.LastOwnerID.ToString()); + cmd.Parameters.AddWithValue("OwnerMask", prim.OwnerMask); + cmd.Parameters.AddWithValue("NextOwnerMask", prim.NextOwnerMask); + cmd.Parameters.AddWithValue("GroupMask", prim.GroupMask); + cmd.Parameters.AddWithValue("EveryoneMask", prim.EveryoneMask); + cmd.Parameters.AddWithValue("BaseMask", prim.BaseMask); + // vectors + cmd.Parameters.AddWithValue("PositionX", (double)prim.OffsetPosition.X); + cmd.Parameters.AddWithValue("PositionY", (double)prim.OffsetPosition.Y); + cmd.Parameters.AddWithValue("PositionZ", (double)prim.OffsetPosition.Z); + cmd.Parameters.AddWithValue("GroupPositionX", (double)prim.GroupPosition.X); + cmd.Parameters.AddWithValue("GroupPositionY", (double)prim.GroupPosition.Y); + cmd.Parameters.AddWithValue("GroupPositionZ", (double)prim.GroupPosition.Z); + cmd.Parameters.AddWithValue("VelocityX", (double)prim.Velocity.X); + cmd.Parameters.AddWithValue("VelocityY", (double)prim.Velocity.Y); + cmd.Parameters.AddWithValue("VelocityZ", (double)prim.Velocity.Z); + cmd.Parameters.AddWithValue("AngularVelocityX", (double)prim.AngularVelocity.X); + cmd.Parameters.AddWithValue("AngularVelocityY", (double)prim.AngularVelocity.Y); + cmd.Parameters.AddWithValue("AngularVelocityZ", (double)prim.AngularVelocity.Z); + cmd.Parameters.AddWithValue("AccelerationX", (double)prim.Acceleration.X); + cmd.Parameters.AddWithValue("AccelerationY", (double)prim.Acceleration.Y); + cmd.Parameters.AddWithValue("AccelerationZ", (double)prim.Acceleration.Z); + // quaternions + cmd.Parameters.AddWithValue("RotationX", (double)prim.RotationOffset.X); + cmd.Parameters.AddWithValue("RotationY", (double)prim.RotationOffset.Y); + cmd.Parameters.AddWithValue("RotationZ", (double)prim.RotationOffset.Z); + cmd.Parameters.AddWithValue("RotationW", (double)prim.RotationOffset.W); + + // Sit target + Vector3 sitTargetPos = prim.SitTargetPositionLL; + cmd.Parameters.AddWithValue("SitTargetOffsetX", (double)sitTargetPos.X); + cmd.Parameters.AddWithValue("SitTargetOffsetY", (double)sitTargetPos.Y); + cmd.Parameters.AddWithValue("SitTargetOffsetZ", (double)sitTargetPos.Z); + + Quaternion sitTargetOrient = prim.SitTargetOrientationLL; + cmd.Parameters.AddWithValue("SitTargetOrientW", (double)sitTargetOrient.W); + cmd.Parameters.AddWithValue("SitTargetOrientX", (double)sitTargetOrient.X); + cmd.Parameters.AddWithValue("SitTargetOrientY", (double)sitTargetOrient.Y); + cmd.Parameters.AddWithValue("SitTargetOrientZ", (double)sitTargetOrient.Z); + + cmd.Parameters.AddWithValue("PayPrice", prim.PayPrice[0]); + cmd.Parameters.AddWithValue("PayButton1", prim.PayPrice[1]); + cmd.Parameters.AddWithValue("PayButton2", prim.PayPrice[2]); + cmd.Parameters.AddWithValue("PayButton3", prim.PayPrice[3]); + cmd.Parameters.AddWithValue("PayButton4", prim.PayPrice[4]); + + if ((prim.SoundFlags & 1) != 0) // Looped + { + cmd.Parameters.AddWithValue("LoopedSound", prim.Sound.ToString()); + cmd.Parameters.AddWithValue("LoopedSoundGain", prim.SoundGain); + } + else + { + cmd.Parameters.AddWithValue("LoopedSound", UUID.Zero); + cmd.Parameters.AddWithValue("LoopedSoundGain", 0.0f); + } + + cmd.Parameters.AddWithValue("TextureAnimation", prim.TextureAnimation); + cmd.Parameters.AddWithValue("ParticleSystem", prim.ParticleSystem); + + cmd.Parameters.AddWithValue("OmegaX", (double)prim.AngularVelocity.X); + cmd.Parameters.AddWithValue("OmegaY", (double)prim.AngularVelocity.Y); + cmd.Parameters.AddWithValue("OmegaZ", (double)prim.AngularVelocity.Z); + + cmd.Parameters.AddWithValue("CameraEyeOffsetX", (double)prim.GetCameraEyeOffset().X); + cmd.Parameters.AddWithValue("CameraEyeOffsetY", (double)prim.GetCameraEyeOffset().Y); + cmd.Parameters.AddWithValue("CameraEyeOffsetZ", (double)prim.GetCameraEyeOffset().Z); + + cmd.Parameters.AddWithValue("CameraAtOffsetX", (double)prim.GetCameraAtOffset().X); + cmd.Parameters.AddWithValue("CameraAtOffsetY", (double)prim.GetCameraAtOffset().Y); + cmd.Parameters.AddWithValue("CameraAtOffsetZ", (double)prim.GetCameraAtOffset().Z); + + if (prim.GetForceMouselook()) + cmd.Parameters.AddWithValue("ForceMouselook", 1); + else + cmd.Parameters.AddWithValue("ForceMouselook", 0); + + cmd.Parameters.AddWithValue("ScriptAccessPin", prim.ScriptAccessPin); + + if (prim.AllowedDrop) + cmd.Parameters.AddWithValue("AllowedDrop", 1); + else + cmd.Parameters.AddWithValue("AllowedDrop", 0); + + if (prim.DIE_AT_EDGE) + cmd.Parameters.AddWithValue("DieAtEdge", 1); + else + cmd.Parameters.AddWithValue("DieAtEdge", 0); + + cmd.Parameters.AddWithValue("SalePrice", prim.SalePrice); + cmd.Parameters.AddWithValue("SaleType", unchecked((sbyte)(prim.ObjectSaleType))); + + byte clickAction = prim.ClickAction; + cmd.Parameters.AddWithValue("ClickAction", unchecked((sbyte)(clickAction))); + + cmd.Parameters.AddWithValue("Material", unchecked((sbyte)(prim.Material))); + + cmd.Parameters.AddWithValue("CollisionSound", prim.CollisionSound.ToString()); + cmd.Parameters.AddWithValue("CollisionSoundVolume", prim.CollisionSoundVolume); + + if (prim.PassTouches) + cmd.Parameters.AddWithValue("PassTouches", 1); + else + cmd.Parameters.AddWithValue("PassTouches", 0); + + cmd.Parameters.AddWithValue("LinkNumber", prim.LinkNum); + cmd.Parameters.AddWithValue("MediaURL", prim.MediaUrl); + } + + /// + /// + /// + /// + /// + private static void FillItemCommand(MySqlCommand cmd, TaskInventoryItem taskItem) + { + cmd.Parameters.AddWithValue("itemID", taskItem.ItemID); + cmd.Parameters.AddWithValue("primID", taskItem.ParentPartID); + cmd.Parameters.AddWithValue("assetID", taskItem.AssetID); + cmd.Parameters.AddWithValue("parentFolderID", taskItem.ParentID); + + cmd.Parameters.AddWithValue("invType", taskItem.InvType); + cmd.Parameters.AddWithValue("assetType", taskItem.Type); + + cmd.Parameters.AddWithValue("name", taskItem.Name); + cmd.Parameters.AddWithValue("description", taskItem.Description); + cmd.Parameters.AddWithValue("creationDate", taskItem.CreationDate); + cmd.Parameters.AddWithValue("creatorID", taskItem.CreatorID); + cmd.Parameters.AddWithValue("ownerID", taskItem.OwnerID); + cmd.Parameters.AddWithValue("lastOwnerID", taskItem.LastOwnerID); + cmd.Parameters.AddWithValue("groupID", taskItem.GroupID); + cmd.Parameters.AddWithValue("nextPermissions", taskItem.NextPermissions); + cmd.Parameters.AddWithValue("currentPermissions", taskItem.CurrentPermissions); + cmd.Parameters.AddWithValue("basePermissions", taskItem.BasePermissions); + cmd.Parameters.AddWithValue("everyonePermissions", taskItem.EveryonePermissions); + cmd.Parameters.AddWithValue("groupPermissions", taskItem.GroupPermissions); + cmd.Parameters.AddWithValue("flags", taskItem.Flags); + } + + /// + /// + /// + private static void FillRegionSettingsCommand(MySqlCommand cmd, RegionSettings settings) + { + cmd.Parameters.AddWithValue("RegionUUID", settings.RegionUUID.ToString()); + cmd.Parameters.AddWithValue("BlockTerraform", settings.BlockTerraform); + cmd.Parameters.AddWithValue("BlockFly", settings.BlockFly); + cmd.Parameters.AddWithValue("AllowDamage", settings.AllowDamage); + cmd.Parameters.AddWithValue("RestrictPushing", settings.RestrictPushing); + cmd.Parameters.AddWithValue("AllowLandResell", settings.AllowLandResell); + cmd.Parameters.AddWithValue("AllowLandJoinDivide", settings.AllowLandJoinDivide); + cmd.Parameters.AddWithValue("BlockShowInSearch", settings.BlockShowInSearch); + cmd.Parameters.AddWithValue("AgentLimit", settings.AgentLimit); + cmd.Parameters.AddWithValue("ObjectBonus", settings.ObjectBonus); + cmd.Parameters.AddWithValue("Maturity", settings.Maturity); + cmd.Parameters.AddWithValue("DisableScripts", settings.DisableScripts); + cmd.Parameters.AddWithValue("DisableCollisions", settings.DisableCollisions); + cmd.Parameters.AddWithValue("DisablePhysics", settings.DisablePhysics); + cmd.Parameters.AddWithValue("TerrainTexture1", settings.TerrainTexture1.ToString()); + cmd.Parameters.AddWithValue("TerrainTexture2", settings.TerrainTexture2.ToString()); + cmd.Parameters.AddWithValue("TerrainTexture3", settings.TerrainTexture3.ToString()); + cmd.Parameters.AddWithValue("TerrainTexture4", settings.TerrainTexture4.ToString()); + cmd.Parameters.AddWithValue("Elevation1NW", settings.Elevation1NW); + cmd.Parameters.AddWithValue("Elevation2NW", settings.Elevation2NW); + cmd.Parameters.AddWithValue("Elevation1NE", settings.Elevation1NE); + cmd.Parameters.AddWithValue("Elevation2NE", settings.Elevation2NE); + cmd.Parameters.AddWithValue("Elevation1SE", settings.Elevation1SE); + cmd.Parameters.AddWithValue("Elevation2SE", settings.Elevation2SE); + cmd.Parameters.AddWithValue("Elevation1SW", settings.Elevation1SW); + cmd.Parameters.AddWithValue("Elevation2SW", settings.Elevation2SW); + cmd.Parameters.AddWithValue("WaterHeight", settings.WaterHeight); + cmd.Parameters.AddWithValue("TerrainRaiseLimit", settings.TerrainRaiseLimit); + cmd.Parameters.AddWithValue("TerrainLowerLimit", settings.TerrainLowerLimit); + cmd.Parameters.AddWithValue("UseEstateSun", settings.UseEstateSun); + cmd.Parameters.AddWithValue("Sandbox", settings.Sandbox); + cmd.Parameters.AddWithValue("SunVectorX", settings.SunVector.X); + cmd.Parameters.AddWithValue("SunVectorY", settings.SunVector.Y); + cmd.Parameters.AddWithValue("SunVectorZ", settings.SunVector.Z); + cmd.Parameters.AddWithValue("FixedSun", settings.FixedSun); + cmd.Parameters.AddWithValue("SunPosition", settings.SunPosition); + cmd.Parameters.AddWithValue("Covenant", settings.Covenant.ToString()); + cmd.Parameters.AddWithValue("LoadedCreationDateTime", settings.LoadedCreationDateTime); + cmd.Parameters.AddWithValue("LoadedCreationID", settings.LoadedCreationID); + cmd.Parameters.AddWithValue("TerrainImageID", settings.TerrainImageID); + + } + + /// + /// + /// + /// + /// + /// + private static void FillLandCommand(MySqlCommand cmd, LandData land, UUID regionUUID) + { + cmd.Parameters.AddWithValue("UUID", land.GlobalID.ToString()); + cmd.Parameters.AddWithValue("RegionUUID", regionUUID.ToString()); + cmd.Parameters.AddWithValue("LocalLandID", land.LocalID); + + // Bitmap is a byte[512] + cmd.Parameters.AddWithValue("Bitmap", land.Bitmap); + + cmd.Parameters.AddWithValue("Name", land.Name); + cmd.Parameters.AddWithValue("Description", land.Description); + cmd.Parameters.AddWithValue("OwnerUUID", land.OwnerID.ToString()); + cmd.Parameters.AddWithValue("IsGroupOwned", land.IsGroupOwned); + cmd.Parameters.AddWithValue("Area", land.Area); + cmd.Parameters.AddWithValue("AuctionID", land.AuctionID); //Unemplemented + cmd.Parameters.AddWithValue("Category", land.Category); //Enum libsecondlife.Parcel.ParcelCategory + cmd.Parameters.AddWithValue("ClaimDate", land.ClaimDate); + cmd.Parameters.AddWithValue("ClaimPrice", land.ClaimPrice); + cmd.Parameters.AddWithValue("GroupUUID", land.GroupID.ToString()); + cmd.Parameters.AddWithValue("SalePrice", land.SalePrice); + cmd.Parameters.AddWithValue("LandStatus", land.Status); //Enum. libsecondlife.Parcel.ParcelStatus + cmd.Parameters.AddWithValue("LandFlags", land.Flags); + cmd.Parameters.AddWithValue("LandingType", land.LandingType); + cmd.Parameters.AddWithValue("MediaAutoScale", land.MediaAutoScale); + cmd.Parameters.AddWithValue("MediaTextureUUID", land.MediaID.ToString()); + cmd.Parameters.AddWithValue("MediaURL", land.MediaURL); + cmd.Parameters.AddWithValue("MusicURL", land.MusicURL); + cmd.Parameters.AddWithValue("PassHours", land.PassHours); + cmd.Parameters.AddWithValue("PassPrice", land.PassPrice); + cmd.Parameters.AddWithValue("SnapshotUUID", land.SnapshotID.ToString()); + cmd.Parameters.AddWithValue("UserLocationX", land.UserLocation.X); + cmd.Parameters.AddWithValue("UserLocationY", land.UserLocation.Y); + cmd.Parameters.AddWithValue("UserLocationZ", land.UserLocation.Z); + cmd.Parameters.AddWithValue("UserLookAtX", land.UserLookAt.X); + cmd.Parameters.AddWithValue("UserLookAtY", land.UserLookAt.Y); + cmd.Parameters.AddWithValue("UserLookAtZ", land.UserLookAt.Z); + cmd.Parameters.AddWithValue("AuthBuyerID", land.AuthBuyerID); + cmd.Parameters.AddWithValue("OtherCleanTime", land.OtherCleanTime); + cmd.Parameters.AddWithValue("MediaDescription", land.MediaDescription); + cmd.Parameters.AddWithValue("MediaType", land.MediaType); + cmd.Parameters.AddWithValue("MediaWidth", land.MediaWidth); + cmd.Parameters.AddWithValue("MediaHeight", land.MediaHeight); + cmd.Parameters.AddWithValue("MediaLoop", land.MediaLoop); + cmd.Parameters.AddWithValue("ObscureMusic", land.ObscureMusic); + cmd.Parameters.AddWithValue("ObscureMedia", land.ObscureMedia); + + } + + /// + /// + /// + /// + /// + /// + private static void FillLandAccessCommand(MySqlCommand cmd, ParcelManager.ParcelAccessEntry entry, UUID parcelID) + { + cmd.Parameters.AddWithValue("LandUUID", parcelID.ToString()); + cmd.Parameters.AddWithValue("AccessUUID", entry.AgentID.ToString()); + cmd.Parameters.AddWithValue("Flags", entry.Flags); + } + + /// + /// + /// + /// + /// + private PrimitiveBaseShape BuildShape(IDataReader row) + { + PrimitiveBaseShape s = new PrimitiveBaseShape(); + s.Scale = new Vector3( + (float)(double)row["ScaleX"], + (float)(double)row["ScaleY"], + (float)(double)row["ScaleZ"] + ); + // paths + s.PCode = (byte)(int)row["PCode"]; + s.PathBegin = (ushort)(int)row["PathBegin"]; + s.PathEnd = (ushort)(int)row["PathEnd"]; + s.PathScaleX = (byte)(int)row["PathScaleX"]; + s.PathScaleY = (byte)(int)row["PathScaleY"]; + s.PathShearX = (byte)(int)row["PathShearX"]; + s.PathShearY = (byte)(int)row["PathShearY"]; + s.PathSkew = (sbyte)(int)row["PathSkew"]; + s.PathCurve = (byte)(int)row["PathCurve"]; + s.PathRadiusOffset = (sbyte)(int)row["PathRadiusOffset"]; + s.PathRevolutions = (byte)(int)row["PathRevolutions"]; + s.PathTaperX = (sbyte)(int)row["PathTaperX"]; + s.PathTaperY = (sbyte)(int)row["PathTaperY"]; + s.PathTwist = (sbyte)(int)row["PathTwist"]; + s.PathTwistBegin = (sbyte)(int)row["PathTwistBegin"]; + // profile + s.ProfileBegin = (ushort)(int)row["ProfileBegin"]; + s.ProfileEnd = (ushort)(int)row["ProfileEnd"]; + s.ProfileCurve = (byte)(int)row["ProfileCurve"]; + s.ProfileHollow = (ushort)(int)row["ProfileHollow"]; + s.TextureEntry = (byte[])row["Texture"]; + + s.ExtraParams = (byte[])row["ExtraParams"]; + + s.State = (byte)(int)row["State"]; + + if (!(row["Media"] is System.DBNull)) + s.Media = PrimitiveBaseShape.MediaList.FromXml((string)row["Media"]); + + return s; + } + + /// + /// + /// + /// + /// + private void FillShapeCommand(MySqlCommand cmd, SceneObjectPart prim) + { + PrimitiveBaseShape s = prim.Shape; + cmd.Parameters.AddWithValue("UUID", prim.UUID.ToString()); + // shape is an enum + cmd.Parameters.AddWithValue("Shape", 0); + // vectors + cmd.Parameters.AddWithValue("ScaleX", (double)s.Scale.X); + cmd.Parameters.AddWithValue("ScaleY", (double)s.Scale.Y); + cmd.Parameters.AddWithValue("ScaleZ", (double)s.Scale.Z); + // paths + cmd.Parameters.AddWithValue("PCode", s.PCode); + cmd.Parameters.AddWithValue("PathBegin", s.PathBegin); + cmd.Parameters.AddWithValue("PathEnd", s.PathEnd); + cmd.Parameters.AddWithValue("PathScaleX", s.PathScaleX); + cmd.Parameters.AddWithValue("PathScaleY", s.PathScaleY); + cmd.Parameters.AddWithValue("PathShearX", s.PathShearX); + cmd.Parameters.AddWithValue("PathShearY", s.PathShearY); + cmd.Parameters.AddWithValue("PathSkew", s.PathSkew); + cmd.Parameters.AddWithValue("PathCurve", s.PathCurve); + cmd.Parameters.AddWithValue("PathRadiusOffset", s.PathRadiusOffset); + cmd.Parameters.AddWithValue("PathRevolutions", s.PathRevolutions); + cmd.Parameters.AddWithValue("PathTaperX", s.PathTaperX); + cmd.Parameters.AddWithValue("PathTaperY", s.PathTaperY); + cmd.Parameters.AddWithValue("PathTwist", s.PathTwist); + cmd.Parameters.AddWithValue("PathTwistBegin", s.PathTwistBegin); + // profile + cmd.Parameters.AddWithValue("ProfileBegin", s.ProfileBegin); + cmd.Parameters.AddWithValue("ProfileEnd", s.ProfileEnd); + cmd.Parameters.AddWithValue("ProfileCurve", s.ProfileCurve); + cmd.Parameters.AddWithValue("ProfileHollow", s.ProfileHollow); + cmd.Parameters.AddWithValue("Texture", s.TextureEntry); + cmd.Parameters.AddWithValue("ExtraParams", s.ExtraParams); + cmd.Parameters.AddWithValue("State", s.State); + cmd.Parameters.AddWithValue("Media", null == s.Media ? null : s.Media.ToXml()); + } + + public void StorePrimInventory(UUID primID, ICollection items) + { + lock (m_dbLock) + { + RemoveItems(primID); + + using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) + { + dbcon.Open(); + + MySqlCommand cmd = dbcon.CreateCommand(); + + if (items.Count == 0) + return; + + cmd.CommandText = "insert into primitems (" + + "invType, assetType, name, " + + "description, creationDate, nextPermissions, " + + "currentPermissions, basePermissions, " + + "everyonePermissions, groupPermissions, " + + "flags, itemID, primID, assetID, " + + "parentFolderID, creatorID, ownerID, " + + "groupID, lastOwnerID) values (?invType, " + + "?assetType, ?name, ?description, " + + "?creationDate, ?nextPermissions, " + + "?currentPermissions, ?basePermissions, " + + "?everyonePermissions, ?groupPermissions, " + + "?flags, ?itemID, ?primID, ?assetID, " + + "?parentFolderID, ?creatorID, ?ownerID, " + + "?groupID, ?lastOwnerID)"; + + foreach (TaskInventoryItem item in items) + { + cmd.Parameters.Clear(); + + FillItemCommand(cmd, item); + + ExecuteNonQuery(cmd); + } + + cmd.Dispose(); + } + } + } + } +} diff --git a/OpenSim/Data/Null/NullDataStore.cs b/OpenSim/Data/Null/NullDataStore.cs deleted file mode 100644 index 3ba44bb..0000000 --- a/OpenSim/Data/Null/NullDataStore.cs +++ /dev/null @@ -1,112 +0,0 @@ -/* - * Copyright (c) Contributors, http://opensimulator.org/ - * See CONTRIBUTORS.TXT for a full list of copyright holders. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of the OpenSimulator Project nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -using System.Collections.Generic; -using OpenMetaverse; -using OpenSim.Framework; -using OpenSim.Region.Framework.Interfaces; -using OpenSim.Region.Framework.Scenes; - -namespace OpenSim.Data.Null -{ - /// - /// NULL DataStore, do not store anything - /// - public class NullDataStore : IRegionDataStore - { - public void Initialise(string dbfile) - { - return; - } - - public void Dispose() - { - } - - public void StoreRegionSettings(RegionSettings rs) - { - } - public RegionLightShareData LoadRegionWindlightSettings(UUID regionUUID) - { - //This connector doesn't support the windlight module yet - //Return default LL windlight settings - return new RegionLightShareData(); - } - public void StoreRegionWindlightSettings(RegionLightShareData wl) - { - //This connector doesn't support the windlight module yet - } - public RegionSettings LoadRegionSettings(UUID regionUUID) - { - return null; - } - - public void StoreObject(SceneObjectGroup obj, UUID regionUUID) - { - } - - public void RemoveObject(UUID obj, UUID regionUUID) - { - } - - // see IRegionDatastore - public void StorePrimInventory(UUID primID, ICollection items) - { - } - - public List LoadObjects(UUID regionUUID) - { - return new List(); - } - - public void StoreTerrain(double[,] ter, UUID regionID) - { - } - - public double[,] LoadTerrain(UUID regionID) - { - return null; - } - - public void RemoveLandObject(UUID globalID) - { - } - - public void StoreLandObject(ILandObject land) - { - } - - public List LoadLandObjects(UUID regionUUID) - { - return new List(); - } - - public void Shutdown() - { - } - } -} diff --git a/OpenSim/Data/Null/NullSimulationData.cs b/OpenSim/Data/Null/NullSimulationData.cs new file mode 100644 index 0000000..9c7da8e --- /dev/null +++ b/OpenSim/Data/Null/NullSimulationData.cs @@ -0,0 +1,112 @@ +/* + * Copyright (c) Contributors, http://opensimulator.org/ + * See CONTRIBUTORS.TXT for a full list of copyright holders. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the OpenSimulator Project nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +using System.Collections.Generic; +using OpenMetaverse; +using OpenSim.Framework; +using OpenSim.Region.Framework.Interfaces; +using OpenSim.Region.Framework.Scenes; + +namespace OpenSim.Data.Null +{ + /// + /// NULL DataStore, do not store anything + /// + public class NullSimulationData : ISimulationDataStore + { + public void Initialise(string dbfile) + { + return; + } + + public void Dispose() + { + } + + public void StoreRegionSettings(RegionSettings rs) + { + } + public RegionLightShareData LoadRegionWindlightSettings(UUID regionUUID) + { + //This connector doesn't support the windlight module yet + //Return default LL windlight settings + return new RegionLightShareData(); + } + public void StoreRegionWindlightSettings(RegionLightShareData wl) + { + //This connector doesn't support the windlight module yet + } + public RegionSettings LoadRegionSettings(UUID regionUUID) + { + return null; + } + + public void StoreObject(SceneObjectGroup obj, UUID regionUUID) + { + } + + public void RemoveObject(UUID obj, UUID regionUUID) + { + } + + // see IRegionDatastore + public void StorePrimInventory(UUID primID, ICollection items) + { + } + + public List LoadObjects(UUID regionUUID) + { + return new List(); + } + + public void StoreTerrain(double[,] ter, UUID regionID) + { + } + + public double[,] LoadTerrain(UUID regionID) + { + return null; + } + + public void RemoveLandObject(UUID globalID) + { + } + + public void StoreLandObject(ILandObject land) + { + } + + public List LoadLandObjects(UUID regionUUID) + { + return new List(); + } + + public void Shutdown() + { + } + } +} diff --git a/OpenSim/Data/SQLite/SQLiteRegionData.cs b/OpenSim/Data/SQLite/SQLiteRegionData.cs deleted file mode 100644 index 88699a7..0000000 --- a/OpenSim/Data/SQLite/SQLiteRegionData.cs +++ /dev/null @@ -1,2355 +0,0 @@ -/* - * Copyright (c) Contributors, http://opensimulator.org/ - * See CONTRIBUTORS.TXT for a full list of copyright holders. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of the OpenSimulator Project nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -using System; -using System.Collections.Generic; -using System.Data; -using System.Drawing; -using System.IO; -using System.Reflection; -using log4net; -using Mono.Data.Sqlite; -using OpenMetaverse; -using OpenMetaverse.StructuredData; -using OpenSim.Framework; -using OpenSim.Region.Framework.Interfaces; -using OpenSim.Region.Framework.Scenes; - -namespace OpenSim.Data.SQLite -{ - /// - /// A RegionData Interface to the SQLite database - /// - public class SQLiteRegionData : IRegionDataStore - { - private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - - private const string primSelect = "select * from prims"; - private const string shapeSelect = "select * from primshapes"; - private const string itemsSelect = "select * from primitems"; - private const string terrainSelect = "select * from terrain limit 1"; - private const string landSelect = "select * from land"; - private const string landAccessListSelect = "select distinct * from landaccesslist"; - private const string regionbanListSelect = "select * from regionban"; - private const string regionSettingsSelect = "select * from regionsettings"; - - private DataSet ds; - private SqliteDataAdapter primDa; - private SqliteDataAdapter shapeDa; - private SqliteDataAdapter itemsDa; - private SqliteDataAdapter terrainDa; - private SqliteDataAdapter landDa; - private SqliteDataAdapter landAccessListDa; - private SqliteDataAdapter regionSettingsDa; - - private SqliteConnection m_conn; - - private String m_connectionString; - - // Temporary attribute while this is experimental - - /*********************************************************************** - * - * Public Interface Functions - * - **********************************************************************/ - - /// - /// See IRegionDataStore - /// - /// Initialises RegionData Interface - /// Loads and initialises a new SQLite connection and maintains it. - /// - /// - /// the connection string - public void Initialise(string connectionString) - { - try - { - m_connectionString = connectionString; - - ds = new DataSet("Region"); - - m_log.Info("[SQLITE REGION DB]: Sqlite - connecting: " + connectionString); - m_conn = new SqliteConnection(m_connectionString); - m_conn.Open(); - - SqliteCommand primSelectCmd = new SqliteCommand(primSelect, m_conn); - primDa = new SqliteDataAdapter(primSelectCmd); - - SqliteCommand shapeSelectCmd = new SqliteCommand(shapeSelect, m_conn); - shapeDa = new SqliteDataAdapter(shapeSelectCmd); - // SqliteCommandBuilder shapeCb = new SqliteCommandBuilder(shapeDa); - - SqliteCommand itemsSelectCmd = new SqliteCommand(itemsSelect, m_conn); - itemsDa = new SqliteDataAdapter(itemsSelectCmd); - - SqliteCommand terrainSelectCmd = new SqliteCommand(terrainSelect, m_conn); - terrainDa = new SqliteDataAdapter(terrainSelectCmd); - - SqliteCommand landSelectCmd = new SqliteCommand(landSelect, m_conn); - landDa = new SqliteDataAdapter(landSelectCmd); - - SqliteCommand landAccessListSelectCmd = new SqliteCommand(landAccessListSelect, m_conn); - landAccessListDa = new SqliteDataAdapter(landAccessListSelectCmd); - - SqliteCommand regionSettingsSelectCmd = new SqliteCommand(regionSettingsSelect, m_conn); - regionSettingsDa = new SqliteDataAdapter(regionSettingsSelectCmd); - // This actually does the roll forward assembly stuff - Assembly assem = GetType().Assembly; - Migration m = new Migration(m_conn, assem, "RegionStore"); - m.Update(); - - lock (ds) - { - ds.Tables.Add(createPrimTable()); - setupPrimCommands(primDa, m_conn); - - ds.Tables.Add(createShapeTable()); - setupShapeCommands(shapeDa, m_conn); - - ds.Tables.Add(createItemsTable()); - setupItemsCommands(itemsDa, m_conn); - - ds.Tables.Add(createTerrainTable()); - setupTerrainCommands(terrainDa, m_conn); - - ds.Tables.Add(createLandTable()); - setupLandCommands(landDa, m_conn); - - ds.Tables.Add(createLandAccessListTable()); - setupLandAccessCommands(landAccessListDa, m_conn); - - ds.Tables.Add(createRegionSettingsTable()); - setupRegionSettingsCommands(regionSettingsDa, m_conn); - - // WORKAROUND: This is a work around for sqlite on - // windows, which gets really unhappy with blob columns - // that have no sample data in them. At some point we - // need to actually find a proper way to handle this. - try - { - primDa.Fill(ds.Tables["prims"]); - } - catch (Exception) - { - m_log.Info("[SQLITE REGION DB]: Caught fill error on prims table"); - } - - try - { - shapeDa.Fill(ds.Tables["primshapes"]); - } - catch (Exception) - { - m_log.Info("[SQLITE REGION DB]: Caught fill error on primshapes table"); - } - - try - { - itemsDa.Fill(ds.Tables["primitems"]); - } - catch (Exception) - { - m_log.Info("[SQLITE REGION DB]: Caught fill error on primitems table"); - } - - try - { - terrainDa.Fill(ds.Tables["terrain"]); - } - catch (Exception) - { - m_log.Info("[SQLITE REGION DB]: Caught fill error on terrain table"); - } - - try - { - landDa.Fill(ds.Tables["land"]); - } - catch (Exception) - { - m_log.Info("[SQLITE REGION DB]: Caught fill error on land table"); - } - - try - { - landAccessListDa.Fill(ds.Tables["landaccesslist"]); - } - catch (Exception) - { - m_log.Info("[SQLITE REGION DB]: Caught fill error on landaccesslist table"); - } - - try - { - regionSettingsDa.Fill(ds.Tables["regionsettings"]); - } - catch (Exception) - { - m_log.Info("[SQLITE REGION DB]: Caught fill error on regionsettings table"); - } - - // We have to create a data set mapping for every table, otherwise the IDataAdaptor.Update() will not populate rows with values! - // Not sure exactly why this is - this kind of thing was not necessary before - justincc 20100409 - // Possibly because we manually set up our own DataTables before connecting to the database - CreateDataSetMapping(primDa, "prims"); - CreateDataSetMapping(shapeDa, "primshapes"); - CreateDataSetMapping(itemsDa, "primitems"); - CreateDataSetMapping(terrainDa, "terrain"); - CreateDataSetMapping(landDa, "land"); - CreateDataSetMapping(landAccessListDa, "landaccesslist"); - CreateDataSetMapping(regionSettingsDa, "regionsettings"); - } - } - catch (Exception e) - { - m_log.Error(e); - Environment.Exit(23); - } - - return; - } - - public void Dispose() - { - if (m_conn != null) - { - m_conn.Close(); - m_conn = null; - } - if (ds != null) - { - ds.Dispose(); - ds = null; - } - if (primDa != null) - { - primDa.Dispose(); - primDa = null; - } - if (shapeDa != null) - { - shapeDa.Dispose(); - shapeDa = null; - } - if (itemsDa != null) - { - itemsDa.Dispose(); - itemsDa = null; - } - if (terrainDa != null) - { - terrainDa.Dispose(); - terrainDa = null; - } - if (landDa != null) - { - landDa.Dispose(); - landDa = null; - } - if (landAccessListDa != null) - { - landAccessListDa.Dispose(); - landAccessListDa = null; - } - if (regionSettingsDa != null) - { - regionSettingsDa.Dispose(); - regionSettingsDa = null; - } - } - - public void StoreRegionSettings(RegionSettings rs) - { - lock (ds) - { - DataTable regionsettings = ds.Tables["regionsettings"]; - - DataRow settingsRow = regionsettings.Rows.Find(rs.RegionUUID.ToString()); - if (settingsRow == null) - { - settingsRow = regionsettings.NewRow(); - fillRegionSettingsRow(settingsRow, rs); - regionsettings.Rows.Add(settingsRow); - } - else - { - fillRegionSettingsRow(settingsRow, rs); - } - - Commit(); - } - } - public RegionLightShareData LoadRegionWindlightSettings(UUID regionUUID) - { - //This connector doesn't support the windlight module yet - //Return default LL windlight settings - return new RegionLightShareData(); - } - public void StoreRegionWindlightSettings(RegionLightShareData wl) - { - //This connector doesn't support the windlight module yet - } - public RegionSettings LoadRegionSettings(UUID regionUUID) - { - lock (ds) - { - DataTable regionsettings = ds.Tables["regionsettings"]; - - string searchExp = "regionUUID = '" + regionUUID.ToString() + "'"; - DataRow[] rawsettings = regionsettings.Select(searchExp); - if (rawsettings.Length == 0) - { - RegionSettings rs = new RegionSettings(); - rs.RegionUUID = regionUUID; - rs.OnSave += StoreRegionSettings; - - StoreRegionSettings(rs); - - return rs; - } - DataRow row = rawsettings[0]; - - RegionSettings newSettings = buildRegionSettings(row); - newSettings.OnSave += StoreRegionSettings; - - return newSettings; - } - } - - /// - /// Adds an object into region storage - /// - /// the object - /// the region UUID - public void StoreObject(SceneObjectGroup obj, UUID regionUUID) - { - uint flags = obj.RootPart.GetEffectiveObjectFlags(); - - // Eligibility check - // - if ((flags & (uint)PrimFlags.Temporary) != 0) - return; - if ((flags & (uint)PrimFlags.TemporaryOnRez) != 0) - return; - - lock (ds) - { - foreach (SceneObjectPart prim in obj.Children.Values) - { -// m_log.Info("[REGION DB]: Adding obj: " + obj.UUID + " to region: " + regionUUID); - addPrim(prim, obj.UUID, regionUUID); - } - } - - Commit(); - // m_log.Info("[Dump of prims]: " + ds.GetXml()); - } - - /// - /// Removes an object from region storage - /// - /// the object - /// the region UUID - public void RemoveObject(UUID obj, UUID regionUUID) - { - // m_log.InfoFormat("[REGION DB]: Removing obj: {0} from region: {1}", obj.Guid, regionUUID); - - DataTable prims = ds.Tables["prims"]; - DataTable shapes = ds.Tables["primshapes"]; - - string selectExp = "SceneGroupID = '" + obj + "' and RegionUUID = '" + regionUUID + "'"; - lock (ds) - { - DataRow[] primRows = prims.Select(selectExp); - foreach (DataRow row in primRows) - { - // Remove shape rows - UUID uuid = new UUID((string) row["UUID"]); - DataRow shapeRow = shapes.Rows.Find(uuid.ToString()); - if (shapeRow != null) - { - shapeRow.Delete(); - } - - RemoveItems(uuid); - - // Remove prim row - row.Delete(); - } - } - - Commit(); - } - - /// - /// Remove all persisted items of the given prim. - /// The caller must acquire the necessrary synchronization locks and commit or rollback changes. - /// - /// The item UUID - private void RemoveItems(UUID uuid) - { - DataTable items = ds.Tables["primitems"]; - - String sql = String.Format("primID = '{0}'", uuid); - DataRow[] itemRows = items.Select(sql); - - foreach (DataRow itemRow in itemRows) - { - itemRow.Delete(); - } - } - - /// - /// Load persisted objects from region storage. - /// - /// The region UUID - /// List of loaded groups - public List LoadObjects(UUID regionUUID) - { - Dictionary createdObjects = new Dictionary(); - - List retvals = new List(); - - DataTable prims = ds.Tables["prims"]; - DataTable shapes = ds.Tables["primshapes"]; - - string byRegion = "RegionUUID = '" + regionUUID + "'"; - - lock (ds) - { - DataRow[] primsForRegion = prims.Select(byRegion); -// m_log.Info("[SQLITE REGION DB]: Loaded " + primsForRegion.Length + " prims for region: " + regionUUID); - - // First, create all groups - foreach (DataRow primRow in primsForRegion) - { - try - { - SceneObjectPart prim = null; - - string uuid = (string) primRow["UUID"]; - string objID = (string) primRow["SceneGroupID"]; - - if (uuid == objID) //is new SceneObjectGroup ? - { - prim = buildPrim(primRow); - DataRow shapeRow = shapes.Rows.Find(prim.UUID.ToString()); - if (shapeRow != null) - { - prim.Shape = buildShape(shapeRow); - } - else - { - m_log.Warn( - "[SQLITE REGION DB]: No shape found for prim in storage, so setting default box shape"); - prim.Shape = PrimitiveBaseShape.Default; - } - - SceneObjectGroup group = new SceneObjectGroup(prim); - createdObjects.Add(group.UUID, group); - retvals.Add(group); - LoadItems(prim); - } - } - catch (Exception e) - { - m_log.Error("[SQLITE REGION DB]: Failed create prim object in new group, exception and data follows"); - m_log.Error("[SQLITE REGION DB]: ", e); - foreach (DataColumn col in prims.Columns) - { - m_log.Error("[SQLITE REGION DB]: Col: " + col.ColumnName + " => " + primRow[col]); - } - } - } - - // Now fill the groups with part data - foreach (DataRow primRow in primsForRegion) - { - try - { - SceneObjectPart prim = null; - - string uuid = (string) primRow["UUID"]; - string objID = (string) primRow["SceneGroupID"]; - if (uuid != objID) //is new SceneObjectGroup ? - { - prim = buildPrim(primRow); - DataRow shapeRow = shapes.Rows.Find(prim.UUID.ToString()); - if (shapeRow != null) - { - prim.Shape = buildShape(shapeRow); - } - else - { - m_log.Warn( - "[SQLITE REGION DB]: No shape found for prim in storage, so setting default box shape"); - prim.Shape = PrimitiveBaseShape.Default; - } - - createdObjects[new UUID(objID)].AddPart(prim); - LoadItems(prim); - } - } - catch (Exception e) - { - m_log.Error("[SQLITE REGION DB]: Failed create prim object in group, exception and data follows"); - m_log.Error("[SQLITE REGION DB]: ", e); - foreach (DataColumn col in prims.Columns) - { - m_log.Error("[SQLITE REGION DB]: Col: " + col.ColumnName + " => " + primRow[col]); - } - } - } - } - return retvals; - } - - /// - /// Load in a prim's persisted inventory. - /// - /// the prim - private void LoadItems(SceneObjectPart prim) - { -// m_log.DebugFormat("[SQLITE REGION DB]: Loading inventory for {0} {1}", prim.Name, prim.UUID); - - DataTable dbItems = ds.Tables["primitems"]; - String sql = String.Format("primID = '{0}'", prim.UUID.ToString()); - DataRow[] dbItemRows = dbItems.Select(sql); - IList inventory = new List(); - -// m_log.DebugFormat( -// "[SQLITE REGION DB]: Found {0} items for {1} {2}", dbItemRows.Length, prim.Name, prim.UUID); - - foreach (DataRow row in dbItemRows) - { - TaskInventoryItem item = buildItem(row); - inventory.Add(item); - -// m_log.DebugFormat("[SQLITE REGION DB]: Restored item {0} {1}", item.Name, item.ItemID); - } - - prim.Inventory.RestoreInventoryItems(inventory); - } - - /// - /// Store a terrain revision in region storage - /// - /// terrain heightfield - /// region UUID - public void StoreTerrain(double[,] ter, UUID regionID) - { - lock (ds) - { - int revision = Util.UnixTimeSinceEpoch(); - - // This is added to get rid of the infinitely growing - // terrain databases which negatively impact on SQLite - // over time. Before reenabling this feature there - // needs to be a limitter put on the number of - // revisions in the database, as this old - // implementation is a DOS attack waiting to happen. - - using ( - SqliteCommand cmd = - new SqliteCommand("delete from terrain where RegionUUID=:RegionUUID and Revision <= :Revision", - m_conn)) - { - cmd.Parameters.Add(new SqliteParameter(":RegionUUID", regionID.ToString())); - cmd.Parameters.Add(new SqliteParameter(":Revision", revision)); - cmd.ExecuteNonQuery(); - } - - // the following is an work around for .NET. The perf - // issues associated with it aren't as bad as you think. - m_log.Debug("[SQLITE REGION DB]: Storing terrain revision r" + revision.ToString()); - String sql = "insert into terrain(RegionUUID, Revision, Heightfield)" + - " values(:RegionUUID, :Revision, :Heightfield)"; - - using (SqliteCommand cmd = new SqliteCommand(sql, m_conn)) - { - cmd.Parameters.Add(new SqliteParameter(":RegionUUID", regionID.ToString())); - cmd.Parameters.Add(new SqliteParameter(":Revision", revision)); - cmd.Parameters.Add(new SqliteParameter(":Heightfield", serializeTerrain(ter))); - cmd.ExecuteNonQuery(); - } - } - } - - /// - /// Load the latest terrain revision from region storage - /// - /// the region UUID - /// Heightfield data - public double[,] LoadTerrain(UUID regionID) - { - lock (ds) - { - double[,] terret = new double[(int)Constants.RegionSize, (int)Constants.RegionSize]; - terret.Initialize(); - - String sql = "select RegionUUID, Revision, Heightfield from terrain" + - " where RegionUUID=:RegionUUID order by Revision desc"; - - using (SqliteCommand cmd = new SqliteCommand(sql, m_conn)) - { - cmd.Parameters.Add(new SqliteParameter(":RegionUUID", regionID.ToString())); - - using (IDataReader row = cmd.ExecuteReader()) - { - int rev = 0; - if (row.Read()) - { - // TODO: put this into a function - using (MemoryStream str = new MemoryStream((byte[])row["Heightfield"])) - { - using (BinaryReader br = new BinaryReader(str)) - { - for (int x = 0; x < (int)Constants.RegionSize; x++) - { - for (int y = 0; y < (int)Constants.RegionSize; y++) - { - terret[x, y] = br.ReadDouble(); - } - } - } - } - rev = Convert.ToInt32(row["Revision"]); - } - else - { - m_log.Warn("[SQLITE REGION DB]: No terrain found for region"); - return null; - } - - m_log.Debug("[SQLITE REGION DB]: Loaded terrain revision r" + rev.ToString()); - } - } - return terret; - } - } - - /// - /// - /// - /// - public void RemoveLandObject(UUID globalID) - { - lock (ds) - { - // Can't use blanket SQL statements when using SqlAdapters unless you re-read the data into the adapter - // after you're done. - // replaced below code with the SqliteAdapter version. - //using (SqliteCommand cmd = new SqliteCommand("delete from land where UUID=:UUID", m_conn)) - //{ - // cmd.Parameters.Add(new SqliteParameter(":UUID", globalID.ToString())); - // cmd.ExecuteNonQuery(); - //} - - //using (SqliteCommand cmd = new SqliteCommand("delete from landaccesslist where LandUUID=:UUID", m_conn)) - //{ - // cmd.Parameters.Add(new SqliteParameter(":UUID", globalID.ToString())); - // cmd.ExecuteNonQuery(); - //} - - DataTable land = ds.Tables["land"]; - DataTable landaccesslist = ds.Tables["landaccesslist"]; - DataRow landRow = land.Rows.Find(globalID.ToString()); - if (landRow != null) - { - land.Rows.Remove(landRow); - } - List rowsToDelete = new List(); - foreach (DataRow rowToCheck in landaccesslist.Rows) - { - if (rowToCheck["LandUUID"].ToString() == globalID.ToString()) - rowsToDelete.Add(rowToCheck); - } - for (int iter = 0; iter < rowsToDelete.Count; iter++) - { - landaccesslist.Rows.Remove(rowsToDelete[iter]); - } - - - } - Commit(); - } - - /// - /// - /// - /// - public void StoreLandObject(ILandObject parcel) - { - lock (ds) - { - DataTable land = ds.Tables["land"]; - DataTable landaccesslist = ds.Tables["landaccesslist"]; - - DataRow landRow = land.Rows.Find(parcel.LandData.GlobalID.ToString()); - if (landRow == null) - { - landRow = land.NewRow(); - fillLandRow(landRow, parcel.LandData, parcel.RegionUUID); - land.Rows.Add(landRow); - } - else - { - fillLandRow(landRow, parcel.LandData, parcel.RegionUUID); - } - - // I know this caused someone issues before, but OpenSim is unusable if we leave this stuff around - //using (SqliteCommand cmd = new SqliteCommand("delete from landaccesslist where LandUUID=:LandUUID", m_conn)) - //{ - // cmd.Parameters.Add(new SqliteParameter(":LandUUID", parcel.LandData.GlobalID.ToString())); - // cmd.ExecuteNonQuery(); - -// } - - // This is the slower.. but more appropriate thing to do - - // We can't modify the table with direct queries before calling Commit() and re-filling them. - List rowsToDelete = new List(); - foreach (DataRow rowToCheck in landaccesslist.Rows) - { - if (rowToCheck["LandUUID"].ToString() == parcel.LandData.GlobalID.ToString()) - rowsToDelete.Add(rowToCheck); - } - for (int iter = 0; iter < rowsToDelete.Count; iter++) - { - landaccesslist.Rows.Remove(rowsToDelete[iter]); - } - rowsToDelete.Clear(); - foreach (ParcelManager.ParcelAccessEntry entry in parcel.LandData.ParcelAccessList) - { - DataRow newAccessRow = landaccesslist.NewRow(); - fillLandAccessRow(newAccessRow, entry, parcel.LandData.GlobalID); - landaccesslist.Rows.Add(newAccessRow); - } - } - - Commit(); - } - - /// - /// - /// - /// - /// - public List LoadLandObjects(UUID regionUUID) - { - List landDataForRegion = new List(); - lock (ds) - { - DataTable land = ds.Tables["land"]; - DataTable landaccesslist = ds.Tables["landaccesslist"]; - string searchExp = "RegionUUID = '" + regionUUID + "'"; - DataRow[] rawDataForRegion = land.Select(searchExp); - foreach (DataRow rawDataLand in rawDataForRegion) - { - LandData newLand = buildLandData(rawDataLand); - string accessListSearchExp = "LandUUID = '" + newLand.GlobalID + "'"; - DataRow[] rawDataForLandAccessList = landaccesslist.Select(accessListSearchExp); - foreach (DataRow rawDataLandAccess in rawDataForLandAccessList) - { - newLand.ParcelAccessList.Add(buildLandAccessData(rawDataLandAccess)); - } - - landDataForRegion.Add(newLand); - } - } - return landDataForRegion; - } - - /// - /// - /// - public void Commit() - { - //m_log.Debug("[SQLITE]: Starting commit"); - lock (ds) - { - primDa.Update(ds, "prims"); - shapeDa.Update(ds, "primshapes"); - - itemsDa.Update(ds, "primitems"); - - terrainDa.Update(ds, "terrain"); - landDa.Update(ds, "land"); - landAccessListDa.Update(ds, "landaccesslist"); - try - { - regionSettingsDa.Update(ds, "regionsettings"); - } - catch (SqliteException SqlEx) - { - throw new Exception( - "There was a SQL error or connection string configuration error when saving the region settings. This could be a bug, it could also happen if ConnectionString is defined in the [DatabaseService] section of StandaloneCommon.ini in the config_include folder. This could also happen if the config_include folder doesn't exist or if the OpenSim.ini [Architecture] section isn't set. If this is your first time running OpenSimulator, please restart the simulator and bug a developer to fix this!", - SqlEx); - } - ds.AcceptChanges(); - } - } - - /// - /// See - /// - public void Shutdown() - { - Commit(); - } - - /*********************************************************************** - * - * Database Definition Functions - * - * This should be db agnostic as we define them in ADO.NET terms - * - **********************************************************************/ - - protected void CreateDataSetMapping(IDataAdapter da, string tableName) - { - ITableMapping dbMapping = da.TableMappings.Add(tableName, tableName); - foreach (DataColumn col in ds.Tables[tableName].Columns) - { - dbMapping.ColumnMappings.Add(col.ColumnName, col.ColumnName); - } - } - - /// - /// - /// - /// - /// - /// - private static void createCol(DataTable dt, string name, Type type) - { - DataColumn col = new DataColumn(name, type); - dt.Columns.Add(col); - } - - /// - /// Creates the "terrain" table - /// - /// terrain table DataTable - private static DataTable createTerrainTable() - { - DataTable terrain = new DataTable("terrain"); - - createCol(terrain, "RegionUUID", typeof (String)); - createCol(terrain, "Revision", typeof (Int32)); - createCol(terrain, "Heightfield", typeof (Byte[])); - - return terrain; - } - - /// - /// Creates the "prims" table - /// - /// prim table DataTable - private static DataTable createPrimTable() - { - DataTable prims = new DataTable("prims"); - - createCol(prims, "UUID", typeof (String)); - createCol(prims, "RegionUUID", typeof (String)); - createCol(prims, "CreationDate", typeof (Int32)); - createCol(prims, "Name", typeof (String)); - createCol(prims, "SceneGroupID", typeof (String)); - // various text fields - createCol(prims, "Text", typeof (String)); - createCol(prims, "ColorR", typeof (Int32)); - createCol(prims, "ColorG", typeof (Int32)); - createCol(prims, "ColorB", typeof (Int32)); - createCol(prims, "ColorA", typeof (Int32)); - createCol(prims, "Description", typeof (String)); - createCol(prims, "SitName", typeof (String)); - createCol(prims, "TouchName", typeof (String)); - // permissions - createCol(prims, "ObjectFlags", typeof (Int32)); - createCol(prims, "CreatorID", typeof (String)); - createCol(prims, "OwnerID", typeof (String)); - createCol(prims, "GroupID", typeof (String)); - createCol(prims, "LastOwnerID", typeof (String)); - createCol(prims, "OwnerMask", typeof (Int32)); - createCol(prims, "NextOwnerMask", typeof (Int32)); - createCol(prims, "GroupMask", typeof (Int32)); - createCol(prims, "EveryoneMask", typeof (Int32)); - createCol(prims, "BaseMask", typeof (Int32)); - // vectors - createCol(prims, "PositionX", typeof (Double)); - createCol(prims, "PositionY", typeof (Double)); - createCol(prims, "PositionZ", typeof (Double)); - createCol(prims, "GroupPositionX", typeof (Double)); - createCol(prims, "GroupPositionY", typeof (Double)); - createCol(prims, "GroupPositionZ", typeof (Double)); - createCol(prims, "VelocityX", typeof (Double)); - createCol(prims, "VelocityY", typeof (Double)); - createCol(prims, "VelocityZ", typeof (Double)); - createCol(prims, "AngularVelocityX", typeof (Double)); - createCol(prims, "AngularVelocityY", typeof (Double)); - createCol(prims, "AngularVelocityZ", typeof (Double)); - createCol(prims, "AccelerationX", typeof (Double)); - createCol(prims, "AccelerationY", typeof (Double)); - createCol(prims, "AccelerationZ", typeof (Double)); - // quaternions - createCol(prims, "RotationX", typeof (Double)); - createCol(prims, "RotationY", typeof (Double)); - createCol(prims, "RotationZ", typeof (Double)); - createCol(prims, "RotationW", typeof (Double)); - - // sit target - createCol(prims, "SitTargetOffsetX", typeof (Double)); - createCol(prims, "SitTargetOffsetY", typeof (Double)); - createCol(prims, "SitTargetOffsetZ", typeof (Double)); - - createCol(prims, "SitTargetOrientW", typeof (Double)); - createCol(prims, "SitTargetOrientX", typeof (Double)); - createCol(prims, "SitTargetOrientY", typeof (Double)); - createCol(prims, "SitTargetOrientZ", typeof (Double)); - - createCol(prims, "PayPrice", typeof(Int32)); - createCol(prims, "PayButton1", typeof(Int32)); - createCol(prims, "PayButton2", typeof(Int32)); - createCol(prims, "PayButton3", typeof(Int32)); - createCol(prims, "PayButton4", typeof(Int32)); - - createCol(prims, "LoopedSound", typeof(String)); - createCol(prims, "LoopedSoundGain", typeof(Double)); - createCol(prims, "TextureAnimation", typeof(String)); - createCol(prims, "ParticleSystem", typeof(String)); - - createCol(prims, "OmegaX", typeof(Double)); - createCol(prims, "OmegaY", typeof(Double)); - createCol(prims, "OmegaZ", typeof(Double)); - - createCol(prims, "CameraEyeOffsetX", typeof(Double)); - createCol(prims, "CameraEyeOffsetY", typeof(Double)); - createCol(prims, "CameraEyeOffsetZ", typeof(Double)); - - createCol(prims, "CameraAtOffsetX", typeof(Double)); - createCol(prims, "CameraAtOffsetY", typeof(Double)); - createCol(prims, "CameraAtOffsetZ", typeof(Double)); - - createCol(prims, "ForceMouselook", typeof(Int16)); - - createCol(prims, "ScriptAccessPin", typeof(Int32)); - - createCol(prims, "AllowedDrop", typeof(Int16)); - createCol(prims, "DieAtEdge", typeof(Int16)); - - createCol(prims, "SalePrice", typeof(Int32)); - createCol(prims, "SaleType", typeof(Int16)); - - // click action - createCol(prims, "ClickAction", typeof (Byte)); - - createCol(prims, "Material", typeof(Byte)); - - createCol(prims, "CollisionSound", typeof(String)); - createCol(prims, "CollisionSoundVolume", typeof(Double)); - - createCol(prims, "VolumeDetect", typeof(Int16)); - - createCol(prims, "MediaURL", typeof(String)); - - // Add in contraints - prims.PrimaryKey = new DataColumn[] {prims.Columns["UUID"]}; - - return prims; - } - - /// - /// Creates "primshapes" table - /// - /// shape table DataTable - private static DataTable createShapeTable() - { - DataTable shapes = new DataTable("primshapes"); - createCol(shapes, "UUID", typeof (String)); - // shape is an enum - createCol(shapes, "Shape", typeof (Int32)); - // vectors - createCol(shapes, "ScaleX", typeof (Double)); - createCol(shapes, "ScaleY", typeof (Double)); - createCol(shapes, "ScaleZ", typeof (Double)); - // paths - createCol(shapes, "PCode", typeof (Int32)); - createCol(shapes, "PathBegin", typeof (Int32)); - createCol(shapes, "PathEnd", typeof (Int32)); - createCol(shapes, "PathScaleX", typeof (Int32)); - createCol(shapes, "PathScaleY", typeof (Int32)); - createCol(shapes, "PathShearX", typeof (Int32)); - createCol(shapes, "PathShearY", typeof (Int32)); - createCol(shapes, "PathSkew", typeof (Int32)); - createCol(shapes, "PathCurve", typeof (Int32)); - createCol(shapes, "PathRadiusOffset", typeof (Int32)); - createCol(shapes, "PathRevolutions", typeof (Int32)); - createCol(shapes, "PathTaperX", typeof (Int32)); - createCol(shapes, "PathTaperY", typeof (Int32)); - createCol(shapes, "PathTwist", typeof (Int32)); - createCol(shapes, "PathTwistBegin", typeof (Int32)); - // profile - createCol(shapes, "ProfileBegin", typeof (Int32)); - createCol(shapes, "ProfileEnd", typeof (Int32)); - createCol(shapes, "ProfileCurve", typeof (Int32)); - createCol(shapes, "ProfileHollow", typeof (Int32)); - createCol(shapes, "State", typeof(Int32)); - // text TODO: this isn't right, but I'm not sure the right - // way to specify this as a blob atm - createCol(shapes, "Texture", typeof (Byte[])); - createCol(shapes, "ExtraParams", typeof (Byte[])); - createCol(shapes, "Media", typeof(String)); - - shapes.PrimaryKey = new DataColumn[] {shapes.Columns["UUID"]}; - - return shapes; - } - - /// - /// creates "primitems" table - /// - /// item table DataTable - private static DataTable createItemsTable() - { - DataTable items = new DataTable("primitems"); - - createCol(items, "itemID", typeof (String)); - createCol(items, "primID", typeof (String)); - createCol(items, "assetID", typeof (String)); - createCol(items, "parentFolderID", typeof (String)); - - createCol(items, "invType", typeof (Int32)); - createCol(items, "assetType", typeof (Int32)); - - createCol(items, "name", typeof (String)); - createCol(items, "description", typeof (String)); - - createCol(items, "creationDate", typeof (Int64)); - createCol(items, "creatorID", typeof (String)); - createCol(items, "ownerID", typeof (String)); - createCol(items, "lastOwnerID", typeof (String)); - createCol(items, "groupID", typeof (String)); - - createCol(items, "nextPermissions", typeof (UInt32)); - createCol(items, "currentPermissions", typeof (UInt32)); - createCol(items, "basePermissions", typeof (UInt32)); - createCol(items, "everyonePermissions", typeof (UInt32)); - createCol(items, "groupPermissions", typeof (UInt32)); - createCol(items, "flags", typeof (UInt32)); - - items.PrimaryKey = new DataColumn[] { items.Columns["itemID"] }; - - return items; - } - - /// - /// Creates "land" table - /// - /// land table DataTable - private static DataTable createLandTable() - { - DataTable land = new DataTable("land"); - createCol(land, "UUID", typeof (String)); - createCol(land, "RegionUUID", typeof (String)); - createCol(land, "LocalLandID", typeof (UInt32)); - - // Bitmap is a byte[512] - createCol(land, "Bitmap", typeof (Byte[])); - - createCol(land, "Name", typeof (String)); - createCol(land, "Desc", typeof (String)); - createCol(land, "OwnerUUID", typeof (String)); - createCol(land, "IsGroupOwned", typeof (Boolean)); - createCol(land, "Area", typeof (Int32)); - createCol(land, "AuctionID", typeof (Int32)); //Unemplemented - createCol(land, "Category", typeof (Int32)); //Enum OpenMetaverse.Parcel.ParcelCategory - createCol(land, "ClaimDate", typeof (Int32)); - createCol(land, "ClaimPrice", typeof (Int32)); - createCol(land, "GroupUUID", typeof (string)); - createCol(land, "SalePrice", typeof (Int32)); - createCol(land, "LandStatus", typeof (Int32)); //Enum. OpenMetaverse.Parcel.ParcelStatus - createCol(land, "LandFlags", typeof (UInt32)); - createCol(land, "LandingType", typeof (Byte)); - createCol(land, "MediaAutoScale", typeof (Byte)); - createCol(land, "MediaTextureUUID", typeof (String)); - createCol(land, "MediaURL", typeof (String)); - createCol(land, "MusicURL", typeof (String)); - createCol(land, "PassHours", typeof (Double)); - createCol(land, "PassPrice", typeof (UInt32)); - createCol(land, "SnapshotUUID", typeof (String)); - createCol(land, "UserLocationX", typeof (Double)); - createCol(land, "UserLocationY", typeof (Double)); - createCol(land, "UserLocationZ", typeof (Double)); - createCol(land, "UserLookAtX", typeof (Double)); - createCol(land, "UserLookAtY", typeof (Double)); - createCol(land, "UserLookAtZ", typeof (Double)); - createCol(land, "AuthbuyerID", typeof(String)); - createCol(land, "OtherCleanTime", typeof(Int32)); - - land.PrimaryKey = new DataColumn[] {land.Columns["UUID"]}; - - return land; - } - - /// - /// create "landaccesslist" table - /// - /// Landacceslist DataTable - private static DataTable createLandAccessListTable() - { - DataTable landaccess = new DataTable("landaccesslist"); - createCol(landaccess, "LandUUID", typeof (String)); - createCol(landaccess, "AccessUUID", typeof (String)); - createCol(landaccess, "Flags", typeof (UInt32)); - - return landaccess; - } - - private static DataTable createRegionSettingsTable() - { - DataTable regionsettings = new DataTable("regionsettings"); - createCol(regionsettings, "regionUUID", typeof(String)); - createCol(regionsettings, "block_terraform", typeof (Int32)); - createCol(regionsettings, "block_fly", typeof (Int32)); - createCol(regionsettings, "allow_damage", typeof (Int32)); - createCol(regionsettings, "restrict_pushing", typeof (Int32)); - createCol(regionsettings, "allow_land_resell", typeof (Int32)); - createCol(regionsettings, "allow_land_join_divide", typeof (Int32)); - createCol(regionsettings, "block_show_in_search", typeof (Int32)); - createCol(regionsettings, "agent_limit", typeof (Int32)); - createCol(regionsettings, "object_bonus", typeof (Double)); - createCol(regionsettings, "maturity", typeof (Int32)); - createCol(regionsettings, "disable_scripts", typeof (Int32)); - createCol(regionsettings, "disable_collisions", typeof (Int32)); - createCol(regionsettings, "disable_physics", typeof (Int32)); - createCol(regionsettings, "terrain_texture_1", typeof(String)); - createCol(regionsettings, "terrain_texture_2", typeof(String)); - createCol(regionsettings, "terrain_texture_3", typeof(String)); - createCol(regionsettings, "terrain_texture_4", typeof(String)); - createCol(regionsettings, "elevation_1_nw", typeof (Double)); - createCol(regionsettings, "elevation_2_nw", typeof (Double)); - createCol(regionsettings, "elevation_1_ne", typeof (Double)); - createCol(regionsettings, "elevation_2_ne", typeof (Double)); - createCol(regionsettings, "elevation_1_se", typeof (Double)); - createCol(regionsettings, "elevation_2_se", typeof (Double)); - createCol(regionsettings, "elevation_1_sw", typeof (Double)); - createCol(regionsettings, "elevation_2_sw", typeof (Double)); - createCol(regionsettings, "water_height", typeof (Double)); - createCol(regionsettings, "terrain_raise_limit", typeof (Double)); - createCol(regionsettings, "terrain_lower_limit", typeof (Double)); - createCol(regionsettings, "use_estate_sun", typeof (Int32)); - createCol(regionsettings, "sandbox", typeof (Int32)); - createCol(regionsettings, "sunvectorx",typeof (Double)); - createCol(regionsettings, "sunvectory",typeof (Double)); - createCol(regionsettings, "sunvectorz",typeof (Double)); - createCol(regionsettings, "fixed_sun", typeof (Int32)); - createCol(regionsettings, "sun_position", typeof (Double)); - createCol(regionsettings, "covenant", typeof(String)); - createCol(regionsettings, "map_tile_ID", typeof(String)); - regionsettings.PrimaryKey = new DataColumn[] { regionsettings.Columns["regionUUID"] }; - return regionsettings; - } - - /*********************************************************************** - * - * Convert between ADO.NET <=> OpenSim Objects - * - * These should be database independant - * - **********************************************************************/ - - /// - /// - /// - /// - /// - private SceneObjectPart buildPrim(DataRow row) - { - // Code commented. Uncomment to test the unit test inline. - - // The unit test mentions this commented code for the purposes - // of debugging a unit test failure - - // SceneObjectGroup sog = new SceneObjectGroup(); - // SceneObjectPart sop = new SceneObjectPart(); - // sop.LocalId = 1; - // sop.Name = "object1"; - // sop.Description = "object1"; - // sop.Text = ""; - // sop.SitName = ""; - // sop.TouchName = ""; - // sop.UUID = UUID.Random(); - // sop.Shape = PrimitiveBaseShape.Default; - // sog.SetRootPart(sop); - // Add breakpoint in above line. Check sop fields. - - // TODO: this doesn't work yet because something more - // interesting has to be done to actually get these values - // back out. Not enough time to figure it out yet. - - SceneObjectPart prim = new SceneObjectPart(); - prim.UUID = new UUID((String) row["UUID"]); - // explicit conversion of integers is required, which sort - // of sucks. No idea if there is a shortcut here or not. - prim.CreationDate = Convert.ToInt32(row["CreationDate"]); - prim.Name = row["Name"] == DBNull.Value ? string.Empty : (string)row["Name"]; - // various text fields - prim.Text = (String) row["Text"]; - prim.Color = Color.FromArgb(Convert.ToInt32(row["ColorA"]), - Convert.ToInt32(row["ColorR"]), - Convert.ToInt32(row["ColorG"]), - Convert.ToInt32(row["ColorB"])); - prim.Description = (String) row["Description"]; - prim.SitName = (String) row["SitName"]; - prim.TouchName = (String) row["TouchName"]; - // permissions - prim.ObjectFlags = Convert.ToUInt32(row["ObjectFlags"]); - prim.CreatorID = new UUID((String) row["CreatorID"]); - prim.OwnerID = new UUID((String) row["OwnerID"]); - prim.GroupID = new UUID((String) row["GroupID"]); - prim.LastOwnerID = new UUID((String) row["LastOwnerID"]); - prim.OwnerMask = Convert.ToUInt32(row["OwnerMask"]); - prim.NextOwnerMask = Convert.ToUInt32(row["NextOwnerMask"]); - prim.GroupMask = Convert.ToUInt32(row["GroupMask"]); - prim.EveryoneMask = Convert.ToUInt32(row["EveryoneMask"]); - prim.BaseMask = Convert.ToUInt32(row["BaseMask"]); - // vectors - prim.OffsetPosition = new Vector3( - Convert.ToSingle(row["PositionX"]), - Convert.ToSingle(row["PositionY"]), - Convert.ToSingle(row["PositionZ"]) - ); - prim.GroupPosition = new Vector3( - Convert.ToSingle(row["GroupPositionX"]), - Convert.ToSingle(row["GroupPositionY"]), - Convert.ToSingle(row["GroupPositionZ"]) - ); - prim.Velocity = new Vector3( - Convert.ToSingle(row["VelocityX"]), - Convert.ToSingle(row["VelocityY"]), - Convert.ToSingle(row["VelocityZ"]) - ); - prim.AngularVelocity = new Vector3( - Convert.ToSingle(row["AngularVelocityX"]), - Convert.ToSingle(row["AngularVelocityY"]), - Convert.ToSingle(row["AngularVelocityZ"]) - ); - prim.Acceleration = new Vector3( - Convert.ToSingle(row["AccelerationX"]), - Convert.ToSingle(row["AccelerationY"]), - Convert.ToSingle(row["AccelerationZ"]) - ); - // quaternions - prim.RotationOffset = new Quaternion( - Convert.ToSingle(row["RotationX"]), - Convert.ToSingle(row["RotationY"]), - Convert.ToSingle(row["RotationZ"]), - Convert.ToSingle(row["RotationW"]) - ); - - prim.SitTargetPositionLL = new Vector3( - Convert.ToSingle(row["SitTargetOffsetX"]), - Convert.ToSingle(row["SitTargetOffsetY"]), - Convert.ToSingle(row["SitTargetOffsetZ"])); - prim.SitTargetOrientationLL = new Quaternion( - Convert.ToSingle( - row["SitTargetOrientX"]), - Convert.ToSingle( - row["SitTargetOrientY"]), - Convert.ToSingle( - row["SitTargetOrientZ"]), - Convert.ToSingle( - row["SitTargetOrientW"])); - - prim.ClickAction = Convert.ToByte(row["ClickAction"]); - prim.PayPrice[0] = Convert.ToInt32(row["PayPrice"]); - prim.PayPrice[1] = Convert.ToInt32(row["PayButton1"]); - prim.PayPrice[2] = Convert.ToInt32(row["PayButton2"]); - prim.PayPrice[3] = Convert.ToInt32(row["PayButton3"]); - prim.PayPrice[4] = Convert.ToInt32(row["PayButton4"]); - - prim.Sound = new UUID(row["LoopedSound"].ToString()); - prim.SoundGain = Convert.ToSingle(row["LoopedSoundGain"]); - prim.SoundFlags = 1; // If it's persisted at all, it's looped - - if (!row.IsNull("TextureAnimation")) - prim.TextureAnimation = Convert.FromBase64String(row["TextureAnimation"].ToString()); - if (!row.IsNull("ParticleSystem")) - prim.ParticleSystem = Convert.FromBase64String(row["ParticleSystem"].ToString()); - - prim.AngularVelocity = new Vector3( - Convert.ToSingle(row["OmegaX"]), - Convert.ToSingle(row["OmegaY"]), - Convert.ToSingle(row["OmegaZ"]) - ); - - prim.SetCameraEyeOffset(new Vector3( - Convert.ToSingle(row["CameraEyeOffsetX"]), - Convert.ToSingle(row["CameraEyeOffsetY"]), - Convert.ToSingle(row["CameraEyeOffsetZ"]) - )); - - prim.SetCameraAtOffset(new Vector3( - Convert.ToSingle(row["CameraAtOffsetX"]), - Convert.ToSingle(row["CameraAtOffsetY"]), - Convert.ToSingle(row["CameraAtOffsetZ"]) - )); - - if (Convert.ToInt16(row["ForceMouselook"]) != 0) - prim.SetForceMouselook(true); - - prim.ScriptAccessPin = Convert.ToInt32(row["ScriptAccessPin"]); - - if (Convert.ToInt16(row["AllowedDrop"]) != 0) - prim.AllowedDrop = true; - - if (Convert.ToInt16(row["DieAtEdge"]) != 0) - prim.DIE_AT_EDGE = true; - - prim.SalePrice = Convert.ToInt32(row["SalePrice"]); - prim.ObjectSaleType = Convert.ToByte(row["SaleType"]); - - prim.Material = Convert.ToByte(row["Material"]); - - prim.CollisionSound = new UUID(row["CollisionSound"].ToString()); - prim.CollisionSoundVolume = Convert.ToSingle(row["CollisionSoundVolume"]); - - if (Convert.ToInt16(row["VolumeDetect"]) != 0) - prim.VolumeDetectActive = true; - - if (!(row["MediaURL"] is System.DBNull)) - { - //m_log.DebugFormat("[SQLITE]: MediaUrl type [{0}]", row["MediaURL"].GetType()); - prim.MediaUrl = (string)row["MediaURL"]; - } - - return prim; - } - - /// - /// Build a prim inventory item from the persisted data. - /// - /// - /// - private static TaskInventoryItem buildItem(DataRow row) - { - TaskInventoryItem taskItem = new TaskInventoryItem(); - - taskItem.ItemID = new UUID((String)row["itemID"]); - taskItem.ParentPartID = new UUID((String)row["primID"]); - taskItem.AssetID = new UUID((String)row["assetID"]); - taskItem.ParentID = new UUID((String)row["parentFolderID"]); - - taskItem.InvType = Convert.ToInt32(row["invType"]); - taskItem.Type = Convert.ToInt32(row["assetType"]); - - taskItem.Name = (String)row["name"]; - taskItem.Description = (String)row["description"]; - taskItem.CreationDate = Convert.ToUInt32(row["creationDate"]); - taskItem.CreatorID = new UUID((String)row["creatorID"]); - taskItem.OwnerID = new UUID((String)row["ownerID"]); - taskItem.LastOwnerID = new UUID((String)row["lastOwnerID"]); - taskItem.GroupID = new UUID((String)row["groupID"]); - - taskItem.NextPermissions = Convert.ToUInt32(row["nextPermissions"]); - taskItem.CurrentPermissions = Convert.ToUInt32(row["currentPermissions"]); - taskItem.BasePermissions = Convert.ToUInt32(row["basePermissions"]); - taskItem.EveryonePermissions = Convert.ToUInt32(row["everyonePermissions"]); - taskItem.GroupPermissions = Convert.ToUInt32(row["groupPermissions"]); - taskItem.Flags = Convert.ToUInt32(row["flags"]); - - return taskItem; - } - - /// - /// Build a Land Data from the persisted data. - /// - /// - /// - private LandData buildLandData(DataRow row) - { - LandData newData = new LandData(); - - newData.GlobalID = new UUID((String) row["UUID"]); - newData.LocalID = Convert.ToInt32(row["LocalLandID"]); - - // Bitmap is a byte[512] - newData.Bitmap = (Byte[]) row["Bitmap"]; - - newData.Name = (String) row["Name"]; - newData.Description = (String) row["Desc"]; - newData.OwnerID = (UUID)(String) row["OwnerUUID"]; - newData.IsGroupOwned = (Boolean) row["IsGroupOwned"]; - newData.Area = Convert.ToInt32(row["Area"]); - newData.AuctionID = Convert.ToUInt32(row["AuctionID"]); //Unemplemented - newData.Category = (ParcelCategory) Convert.ToInt32(row["Category"]); - //Enum OpenMetaverse.Parcel.ParcelCategory - newData.ClaimDate = Convert.ToInt32(row["ClaimDate"]); - newData.ClaimPrice = Convert.ToInt32(row["ClaimPrice"]); - newData.GroupID = new UUID((String) row["GroupUUID"]); - newData.SalePrice = Convert.ToInt32(row["SalePrice"]); - newData.Status = (ParcelStatus) Convert.ToInt32(row["LandStatus"]); - //Enum. OpenMetaverse.Parcel.ParcelStatus - newData.Flags = Convert.ToUInt32(row["LandFlags"]); - newData.LandingType = (Byte) row["LandingType"]; - newData.MediaAutoScale = (Byte) row["MediaAutoScale"]; - newData.MediaID = new UUID((String) row["MediaTextureUUID"]); - newData.MediaURL = (String) row["MediaURL"]; - newData.MusicURL = (String) row["MusicURL"]; - newData.PassHours = Convert.ToSingle(row["PassHours"]); - newData.PassPrice = Convert.ToInt32(row["PassPrice"]); - newData.SnapshotID = (UUID)(String) row["SnapshotUUID"]; - try - { - - newData.UserLocation = - new Vector3(Convert.ToSingle(row["UserLocationX"]), Convert.ToSingle(row["UserLocationY"]), - Convert.ToSingle(row["UserLocationZ"])); - newData.UserLookAt = - new Vector3(Convert.ToSingle(row["UserLookAtX"]), Convert.ToSingle(row["UserLookAtY"]), - Convert.ToSingle(row["UserLookAtZ"])); - - } - catch (InvalidCastException) - { - m_log.ErrorFormat("[SQLITE REGION DB]: unable to get parcel telehub settings for {1}", newData.Name); - newData.UserLocation = Vector3.Zero; - newData.UserLookAt = Vector3.Zero; - } - newData.ParcelAccessList = new List(); - UUID authBuyerID = UUID.Zero; - - UUID.TryParse((string)row["AuthbuyerID"], out authBuyerID); - - newData.OtherCleanTime = Convert.ToInt32(row["OtherCleanTime"]); - - return newData; - } - - private RegionSettings buildRegionSettings(DataRow row) - { - RegionSettings newSettings = new RegionSettings(); - - newSettings.RegionUUID = new UUID((string) row["regionUUID"]); - newSettings.BlockTerraform = Convert.ToBoolean(row["block_terraform"]); - newSettings.AllowDamage = Convert.ToBoolean(row["allow_damage"]); - newSettings.BlockFly = Convert.ToBoolean(row["block_fly"]); - newSettings.RestrictPushing = Convert.ToBoolean(row["restrict_pushing"]); - newSettings.AllowLandResell = Convert.ToBoolean(row["allow_land_resell"]); - newSettings.AllowLandJoinDivide = Convert.ToBoolean(row["allow_land_join_divide"]); - newSettings.BlockShowInSearch = Convert.ToBoolean(row["block_show_in_search"]); - newSettings.AgentLimit = Convert.ToInt32(row["agent_limit"]); - newSettings.ObjectBonus = Convert.ToDouble(row["object_bonus"]); - newSettings.Maturity = Convert.ToInt32(row["maturity"]); - newSettings.DisableScripts = Convert.ToBoolean(row["disable_scripts"]); - newSettings.DisableCollisions = Convert.ToBoolean(row["disable_collisions"]); - newSettings.DisablePhysics = Convert.ToBoolean(row["disable_physics"]); - newSettings.TerrainTexture1 = new UUID((String) row["terrain_texture_1"]); - newSettings.TerrainTexture2 = new UUID((String) row["terrain_texture_2"]); - newSettings.TerrainTexture3 = new UUID((String) row["terrain_texture_3"]); - newSettings.TerrainTexture4 = new UUID((String) row["terrain_texture_4"]); - newSettings.Elevation1NW = Convert.ToDouble(row["elevation_1_nw"]); - newSettings.Elevation2NW = Convert.ToDouble(row["elevation_2_nw"]); - newSettings.Elevation1NE = Convert.ToDouble(row["elevation_1_ne"]); - newSettings.Elevation2NE = Convert.ToDouble(row["elevation_2_ne"]); - newSettings.Elevation1SE = Convert.ToDouble(row["elevation_1_se"]); - newSettings.Elevation2SE = Convert.ToDouble(row["elevation_2_se"]); - newSettings.Elevation1SW = Convert.ToDouble(row["elevation_1_sw"]); - newSettings.Elevation2SW = Convert.ToDouble(row["elevation_2_sw"]); - newSettings.WaterHeight = Convert.ToDouble(row["water_height"]); - newSettings.TerrainRaiseLimit = Convert.ToDouble(row["terrain_raise_limit"]); - newSettings.TerrainLowerLimit = Convert.ToDouble(row["terrain_lower_limit"]); - newSettings.UseEstateSun = Convert.ToBoolean(row["use_estate_sun"]); - newSettings.Sandbox = Convert.ToBoolean(row["sandbox"]); - newSettings.SunVector = new Vector3 ( - Convert.ToSingle(row["sunvectorx"]), - Convert.ToSingle(row["sunvectory"]), - Convert.ToSingle(row["sunvectorz"]) - ); - newSettings.FixedSun = Convert.ToBoolean(row["fixed_sun"]); - newSettings.SunPosition = Convert.ToDouble(row["sun_position"]); - newSettings.Covenant = new UUID((String) row["covenant"]); - newSettings.TerrainImageID = new UUID((String)row["map_tile_ID"]); - - return newSettings; - } - - /// - /// Build a land access entry from the persisted data. - /// - /// - /// - private static ParcelManager.ParcelAccessEntry buildLandAccessData(DataRow row) - { - ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry(); - entry.AgentID = new UUID((string) row["AccessUUID"]); - entry.Flags = (AccessList) row["Flags"]; - entry.Time = new DateTime(); - return entry; - } - - /// - /// - /// - /// - /// - private static Array serializeTerrain(double[,] val) - { - MemoryStream str = new MemoryStream(((int)Constants.RegionSize * (int)Constants.RegionSize) *sizeof (double)); - BinaryWriter bw = new BinaryWriter(str); - - // TODO: COMPATIBILITY - Add byte-order conversions - for (int x = 0; x < (int)Constants.RegionSize; x++) - for (int y = 0; y < (int)Constants.RegionSize; y++) - bw.Write(val[x, y]); - - return str.ToArray(); - } - -// private void fillTerrainRow(DataRow row, UUID regionUUID, int rev, double[,] val) -// { -// row["RegionUUID"] = regionUUID; -// row["Revision"] = rev; - - // MemoryStream str = new MemoryStream(((int)Constants.RegionSize * (int)Constants.RegionSize)*sizeof (double)); -// BinaryWriter bw = new BinaryWriter(str); - -// // TODO: COMPATIBILITY - Add byte-order conversions - // for (int x = 0; x < (int)Constants.RegionSize; x++) - // for (int y = 0; y < (int)Constants.RegionSize; y++) -// bw.Write(val[x, y]); - -// row["Heightfield"] = str.ToArray(); -// } - - /// - /// - /// - /// - /// - /// - /// - private static void fillPrimRow(DataRow row, SceneObjectPart prim, UUID sceneGroupID, UUID regionUUID) - { - row["UUID"] = prim.UUID.ToString(); - row["RegionUUID"] = regionUUID.ToString(); - row["CreationDate"] = prim.CreationDate; - row["Name"] = prim.Name; - row["SceneGroupID"] = sceneGroupID.ToString(); - // the UUID of the root part for this SceneObjectGroup - // various text fields - row["Text"] = prim.Text; - row["Description"] = prim.Description; - row["SitName"] = prim.SitName; - row["TouchName"] = prim.TouchName; - // permissions - row["ObjectFlags"] = prim.ObjectFlags; - row["CreatorID"] = prim.CreatorID.ToString(); - row["OwnerID"] = prim.OwnerID.ToString(); - row["GroupID"] = prim.GroupID.ToString(); - row["LastOwnerID"] = prim.LastOwnerID.ToString(); - row["OwnerMask"] = prim.OwnerMask; - row["NextOwnerMask"] = prim.NextOwnerMask; - row["GroupMask"] = prim.GroupMask; - row["EveryoneMask"] = prim.EveryoneMask; - row["BaseMask"] = prim.BaseMask; - // vectors - row["PositionX"] = prim.OffsetPosition.X; - row["PositionY"] = prim.OffsetPosition.Y; - row["PositionZ"] = prim.OffsetPosition.Z; - row["GroupPositionX"] = prim.GroupPosition.X; - row["GroupPositionY"] = prim.GroupPosition.Y; - row["GroupPositionZ"] = prim.GroupPosition.Z; - row["VelocityX"] = prim.Velocity.X; - row["VelocityY"] = prim.Velocity.Y; - row["VelocityZ"] = prim.Velocity.Z; - row["AngularVelocityX"] = prim.AngularVelocity.X; - row["AngularVelocityY"] = prim.AngularVelocity.Y; - row["AngularVelocityZ"] = prim.AngularVelocity.Z; - row["AccelerationX"] = prim.Acceleration.X; - row["AccelerationY"] = prim.Acceleration.Y; - row["AccelerationZ"] = prim.Acceleration.Z; - // quaternions - row["RotationX"] = prim.RotationOffset.X; - row["RotationY"] = prim.RotationOffset.Y; - row["RotationZ"] = prim.RotationOffset.Z; - row["RotationW"] = prim.RotationOffset.W; - - // Sit target - Vector3 sitTargetPos = prim.SitTargetPositionLL; - row["SitTargetOffsetX"] = sitTargetPos.X; - row["SitTargetOffsetY"] = sitTargetPos.Y; - row["SitTargetOffsetZ"] = sitTargetPos.Z; - - Quaternion sitTargetOrient = prim.SitTargetOrientationLL; - row["SitTargetOrientW"] = sitTargetOrient.W; - row["SitTargetOrientX"] = sitTargetOrient.X; - row["SitTargetOrientY"] = sitTargetOrient.Y; - row["SitTargetOrientZ"] = sitTargetOrient.Z; - row["ColorR"] = Convert.ToInt32(prim.Color.R); - row["ColorG"] = Convert.ToInt32(prim.Color.G); - row["ColorB"] = Convert.ToInt32(prim.Color.B); - row["ColorA"] = Convert.ToInt32(prim.Color.A); - row["PayPrice"] = prim.PayPrice[0]; - row["PayButton1"] = prim.PayPrice[1]; - row["PayButton2"] = prim.PayPrice[2]; - row["PayButton3"] = prim.PayPrice[3]; - row["PayButton4"] = prim.PayPrice[4]; - - row["TextureAnimation"] = Convert.ToBase64String(prim.TextureAnimation); - row["ParticleSystem"] = Convert.ToBase64String(prim.ParticleSystem); - - row["OmegaX"] = prim.AngularVelocity.X; - row["OmegaY"] = prim.AngularVelocity.Y; - row["OmegaZ"] = prim.AngularVelocity.Z; - - row["CameraEyeOffsetX"] = prim.GetCameraEyeOffset().X; - row["CameraEyeOffsetY"] = prim.GetCameraEyeOffset().Y; - row["CameraEyeOffsetZ"] = prim.GetCameraEyeOffset().Z; - - row["CameraAtOffsetX"] = prim.GetCameraAtOffset().X; - row["CameraAtOffsetY"] = prim.GetCameraAtOffset().Y; - row["CameraAtOffsetZ"] = prim.GetCameraAtOffset().Z; - - - if ((prim.SoundFlags & 1) != 0) // Looped - { - row["LoopedSound"] = prim.Sound.ToString(); - row["LoopedSoundGain"] = prim.SoundGain; - } - else - { - row["LoopedSound"] = UUID.Zero.ToString(); - row["LoopedSoundGain"] = 0.0f; - } - - if (prim.GetForceMouselook()) - row["ForceMouselook"] = 1; - else - row["ForceMouselook"] = 0; - - row["ScriptAccessPin"] = prim.ScriptAccessPin; - - if (prim.AllowedDrop) - row["AllowedDrop"] = 1; - else - row["AllowedDrop"] = 0; - - if (prim.DIE_AT_EDGE) - row["DieAtEdge"] = 1; - else - row["DieAtEdge"] = 0; - - row["SalePrice"] = prim.SalePrice; - row["SaleType"] = Convert.ToInt16(prim.ObjectSaleType); - - // click action - row["ClickAction"] = prim.ClickAction; - - row["SalePrice"] = prim.SalePrice; - row["Material"] = prim.Material; - - row["CollisionSound"] = prim.CollisionSound.ToString(); - row["CollisionSoundVolume"] = prim.CollisionSoundVolume; - if (prim.VolumeDetectActive) - row["VolumeDetect"] = 1; - else - row["VolumeDetect"] = 0; - - row["MediaURL"] = prim.MediaUrl; - } - - /// - /// - /// - /// - /// - private static void fillItemRow(DataRow row, TaskInventoryItem taskItem) - { - row["itemID"] = taskItem.ItemID.ToString(); - row["primID"] = taskItem.ParentPartID.ToString(); - row["assetID"] = taskItem.AssetID.ToString(); - row["parentFolderID"] = taskItem.ParentID.ToString(); - - row["invType"] = taskItem.InvType; - row["assetType"] = taskItem.Type; - - row["name"] = taskItem.Name; - row["description"] = taskItem.Description; - row["creationDate"] = taskItem.CreationDate; - row["creatorID"] = taskItem.CreatorID.ToString(); - row["ownerID"] = taskItem.OwnerID.ToString(); - row["lastOwnerID"] = taskItem.LastOwnerID.ToString(); - row["groupID"] = taskItem.GroupID.ToString(); - row["nextPermissions"] = taskItem.NextPermissions; - row["currentPermissions"] = taskItem.CurrentPermissions; - row["basePermissions"] = taskItem.BasePermissions; - row["everyonePermissions"] = taskItem.EveryonePermissions; - row["groupPermissions"] = taskItem.GroupPermissions; - row["flags"] = taskItem.Flags; - } - - /// - /// - /// - /// - /// - /// - private static void fillLandRow(DataRow row, LandData land, UUID regionUUID) - { - row["UUID"] = land.GlobalID.ToString(); - row["RegionUUID"] = regionUUID.ToString(); - row["LocalLandID"] = land.LocalID; - - // Bitmap is a byte[512] - row["Bitmap"] = land.Bitmap; - - row["Name"] = land.Name; - row["Desc"] = land.Description; - row["OwnerUUID"] = land.OwnerID.ToString(); - row["IsGroupOwned"] = land.IsGroupOwned; - row["Area"] = land.Area; - row["AuctionID"] = land.AuctionID; //Unemplemented - row["Category"] = land.Category; //Enum OpenMetaverse.Parcel.ParcelCategory - row["ClaimDate"] = land.ClaimDate; - row["ClaimPrice"] = land.ClaimPrice; - row["GroupUUID"] = land.GroupID.ToString(); - row["SalePrice"] = land.SalePrice; - row["LandStatus"] = land.Status; //Enum. OpenMetaverse.Parcel.ParcelStatus - row["LandFlags"] = land.Flags; - row["LandingType"] = land.LandingType; - row["MediaAutoScale"] = land.MediaAutoScale; - row["MediaTextureUUID"] = land.MediaID.ToString(); - row["MediaURL"] = land.MediaURL; - row["MusicURL"] = land.MusicURL; - row["PassHours"] = land.PassHours; - row["PassPrice"] = land.PassPrice; - row["SnapshotUUID"] = land.SnapshotID.ToString(); - row["UserLocationX"] = land.UserLocation.X; - row["UserLocationY"] = land.UserLocation.Y; - row["UserLocationZ"] = land.UserLocation.Z; - row["UserLookAtX"] = land.UserLookAt.X; - row["UserLookAtY"] = land.UserLookAt.Y; - row["UserLookAtZ"] = land.UserLookAt.Z; - row["AuthbuyerID"] = land.AuthBuyerID.ToString(); - row["OtherCleanTime"] = land.OtherCleanTime; - row["MediaType"] = land.MediaType; - row["MediaDescription"] = land.MediaDescription; - row["MediaSize"] = land.MediaWidth.ToString() + "," + land.MediaHeight.ToString(); - row["MediaLoop"] = land.MediaLoop.ToString(); - row["ObscureMusic"] = land.ObscureMusic.ToString(); - row["ObscureMedia"] = land.ObscureMedia.ToString(); - } - - /// - /// - /// - /// - /// - /// - private static void fillLandAccessRow(DataRow row, ParcelManager.ParcelAccessEntry entry, UUID parcelID) - { - row["LandUUID"] = parcelID.ToString(); - row["AccessUUID"] = entry.AgentID.ToString(); - row["Flags"] = entry.Flags; - } - - private static void fillRegionSettingsRow(DataRow row, RegionSettings settings) - { - row["regionUUID"] = settings.RegionUUID.ToString(); - row["block_terraform"] = settings.BlockTerraform; - row["block_fly"] = settings.BlockFly; - row["allow_damage"] = settings.AllowDamage; - row["restrict_pushing"] = settings.RestrictPushing; - row["allow_land_resell"] = settings.AllowLandResell; - row["allow_land_join_divide"] = settings.AllowLandJoinDivide; - row["block_show_in_search"] = settings.BlockShowInSearch; - row["agent_limit"] = settings.AgentLimit; - row["object_bonus"] = settings.ObjectBonus; - row["maturity"] = settings.Maturity; - row["disable_scripts"] = settings.DisableScripts; - row["disable_collisions"] = settings.DisableCollisions; - row["disable_physics"] = settings.DisablePhysics; - row["terrain_texture_1"] = settings.TerrainTexture1.ToString(); - row["terrain_texture_2"] = settings.TerrainTexture2.ToString(); - row["terrain_texture_3"] = settings.TerrainTexture3.ToString(); - row["terrain_texture_4"] = settings.TerrainTexture4.ToString(); - row["elevation_1_nw"] = settings.Elevation1NW; - row["elevation_2_nw"] = settings.Elevation2NW; - row["elevation_1_ne"] = settings.Elevation1NE; - row["elevation_2_ne"] = settings.Elevation2NE; - row["elevation_1_se"] = settings.Elevation1SE; - row["elevation_2_se"] = settings.Elevation2SE; - row["elevation_1_sw"] = settings.Elevation1SW; - row["elevation_2_sw"] = settings.Elevation2SW; - row["water_height"] = settings.WaterHeight; - row["terrain_raise_limit"] = settings.TerrainRaiseLimit; - row["terrain_lower_limit"] = settings.TerrainLowerLimit; - row["use_estate_sun"] = settings.UseEstateSun; - row["Sandbox"] = settings.Sandbox; // database uses upper case S for sandbox - row["sunvectorx"] = settings.SunVector.X; - row["sunvectory"] = settings.SunVector.Y; - row["sunvectorz"] = settings.SunVector.Z; - row["fixed_sun"] = settings.FixedSun; - row["sun_position"] = settings.SunPosition; - row["covenant"] = settings.Covenant.ToString(); - row["map_tile_ID"] = settings.TerrainImageID.ToString(); - } - - /// - /// - /// - /// - /// - private PrimitiveBaseShape buildShape(DataRow row) - { - PrimitiveBaseShape s = new PrimitiveBaseShape(); - s.Scale = new Vector3( - Convert.ToSingle(row["ScaleX"]), - Convert.ToSingle(row["ScaleY"]), - Convert.ToSingle(row["ScaleZ"]) - ); - // paths - s.PCode = Convert.ToByte(row["PCode"]); - s.PathBegin = Convert.ToUInt16(row["PathBegin"]); - s.PathEnd = Convert.ToUInt16(row["PathEnd"]); - s.PathScaleX = Convert.ToByte(row["PathScaleX"]); - s.PathScaleY = Convert.ToByte(row["PathScaleY"]); - s.PathShearX = Convert.ToByte(row["PathShearX"]); - s.PathShearY = Convert.ToByte(row["PathShearY"]); - s.PathSkew = Convert.ToSByte(row["PathSkew"]); - s.PathCurve = Convert.ToByte(row["PathCurve"]); - s.PathRadiusOffset = Convert.ToSByte(row["PathRadiusOffset"]); - s.PathRevolutions = Convert.ToByte(row["PathRevolutions"]); - s.PathTaperX = Convert.ToSByte(row["PathTaperX"]); - s.PathTaperY = Convert.ToSByte(row["PathTaperY"]); - s.PathTwist = Convert.ToSByte(row["PathTwist"]); - s.PathTwistBegin = Convert.ToSByte(row["PathTwistBegin"]); - // profile - s.ProfileBegin = Convert.ToUInt16(row["ProfileBegin"]); - s.ProfileEnd = Convert.ToUInt16(row["ProfileEnd"]); - s.ProfileCurve = Convert.ToByte(row["ProfileCurve"]); - s.ProfileHollow = Convert.ToUInt16(row["ProfileHollow"]); - s.State = Convert.ToByte(row["State"]); - - byte[] textureEntry = (byte[])row["Texture"]; - s.TextureEntry = textureEntry; - - s.ExtraParams = (byte[]) row["ExtraParams"]; - - if (!(row["Media"] is System.DBNull)) - s.Media = PrimitiveBaseShape.MediaList.FromXml((string)row["Media"]); - - return s; - } - - /// - /// - /// - /// - /// - private static void fillShapeRow(DataRow row, SceneObjectPart prim) - { - PrimitiveBaseShape s = prim.Shape; - row["UUID"] = prim.UUID.ToString(); - // shape is an enum - row["Shape"] = 0; - // vectors - row["ScaleX"] = s.Scale.X; - row["ScaleY"] = s.Scale.Y; - row["ScaleZ"] = s.Scale.Z; - // paths - row["PCode"] = s.PCode; - row["PathBegin"] = s.PathBegin; - row["PathEnd"] = s.PathEnd; - row["PathScaleX"] = s.PathScaleX; - row["PathScaleY"] = s.PathScaleY; - row["PathShearX"] = s.PathShearX; - row["PathShearY"] = s.PathShearY; - row["PathSkew"] = s.PathSkew; - row["PathCurve"] = s.PathCurve; - row["PathRadiusOffset"] = s.PathRadiusOffset; - row["PathRevolutions"] = s.PathRevolutions; - row["PathTaperX"] = s.PathTaperX; - row["PathTaperY"] = s.PathTaperY; - row["PathTwist"] = s.PathTwist; - row["PathTwistBegin"] = s.PathTwistBegin; - // profile - row["ProfileBegin"] = s.ProfileBegin; - row["ProfileEnd"] = s.ProfileEnd; - row["ProfileCurve"] = s.ProfileCurve; - row["ProfileHollow"] = s.ProfileHollow; - row["State"] = s.State; - - row["Texture"] = s.TextureEntry; - row["ExtraParams"] = s.ExtraParams; - - if (s.Media != null) - row["Media"] = s.Media.ToXml(); - } - - /// - /// Persistently store a prim. - /// - /// - /// - /// - private void addPrim(SceneObjectPart prim, UUID sceneGroupID, UUID regionUUID) - { - DataTable prims = ds.Tables["prims"]; - DataTable shapes = ds.Tables["primshapes"]; - - DataRow primRow = prims.Rows.Find(prim.UUID.ToString()); - if (primRow == null) - { - primRow = prims.NewRow(); - fillPrimRow(primRow, prim, sceneGroupID, regionUUID); - prims.Rows.Add(primRow); - } - else - { - fillPrimRow(primRow, prim, sceneGroupID, regionUUID); - } - - DataRow shapeRow = shapes.Rows.Find(prim.UUID.ToString()); - if (shapeRow == null) - { - shapeRow = shapes.NewRow(); - fillShapeRow(shapeRow, prim); - shapes.Rows.Add(shapeRow); - } - else - { - fillShapeRow(shapeRow, prim); - } - } - - /// - /// see IRegionDatastore - /// - /// - /// - public void StorePrimInventory(UUID primID, ICollection items) - { -// m_log.DebugFormat("[SQLITE REGION DB]: Entered StorePrimInventory with prim ID {0}", primID); - - DataTable dbItems = ds.Tables["primitems"]; - - // For now, we're just going to crudely remove all the previous inventory items - // no matter whether they have changed or not, and replace them with the current set. - lock (ds) - { - RemoveItems(primID); - - // repalce with current inventory details - foreach (TaskInventoryItem newItem in items) - { -// m_log.InfoFormat( -// "[DATASTORE]: ", -// "Adding item {0}, {1} to prim ID {2}", -// newItem.Name, newItem.ItemID, newItem.ParentPartID); - - DataRow newItemRow = dbItems.NewRow(); - fillItemRow(newItemRow, newItem); - dbItems.Rows.Add(newItemRow); - } - } - - Commit(); - } - - /*********************************************************************** - * - * SQL Statement Creation Functions - * - * These functions create SQL statements for update, insert, and create. - * They can probably be factored later to have a db independant - * portion and a db specific portion - * - **********************************************************************/ - - /// - /// Create an insert command - /// - /// table name - /// data table - /// the created command - /// - /// This is subtle enough to deserve some commentary. - /// Instead of doing *lots* and *lots of hardcoded strings - /// for database definitions we'll use the fact that - /// realistically all insert statements look like "insert - /// into A(b, c) values(:b, :c) on the parameterized query - /// front. If we just have a list of b, c, etc... we can - /// generate these strings instead of typing them out. - /// - private static SqliteCommand createInsertCommand(string table, DataTable dt) - { - string[] cols = new string[dt.Columns.Count]; - for (int i = 0; i < dt.Columns.Count; i++) - { - DataColumn col = dt.Columns[i]; - cols[i] = col.ColumnName; - } - - string sql = "insert into " + table + "("; - sql += String.Join(", ", cols); - // important, the first ':' needs to be here, the rest get added in the join - sql += ") values (:"; - sql += String.Join(", :", cols); - sql += ")"; - //m_log.DebugFormat("[SQLITE]: Created insert command {0}", sql); - SqliteCommand cmd = new SqliteCommand(sql); - - // this provides the binding for all our parameters, so - // much less code than it used to be - foreach (DataColumn col in dt.Columns) - { - cmd.Parameters.Add(createSqliteParameter(col.ColumnName, col.DataType)); - } - return cmd; - } - - - /// - /// create an update command - /// - /// table name - /// - /// - /// the created command - private static SqliteCommand createUpdateCommand(string table, string pk, DataTable dt) - { - string sql = "update " + table + " set "; - string subsql = String.Empty; - foreach (DataColumn col in dt.Columns) - { - if (subsql.Length > 0) - { - // a map function would rock so much here - subsql += ", "; - } - subsql += col.ColumnName + "= :" + col.ColumnName; - } - sql += subsql; - sql += " where " + pk; - SqliteCommand cmd = new SqliteCommand(sql); - - // this provides the binding for all our parameters, so - // much less code than it used to be - - foreach (DataColumn col in dt.Columns) - { - cmd.Parameters.Add(createSqliteParameter(col.ColumnName, col.DataType)); - } - return cmd; - } - - /// - /// create an update command - /// - /// table name - /// - /// - /// the created command - private static SqliteCommand createUpdateCommand(string table, string pk1, string pk2, DataTable dt) - { - string sql = "update " + table + " set "; - string subsql = String.Empty; - foreach (DataColumn col in dt.Columns) - { - if (subsql.Length > 0) - { - // a map function would rock so much here - subsql += ", "; - } - subsql += col.ColumnName + "= :" + col.ColumnName; - } - sql += subsql; - sql += " where " + pk1 + " and " + pk2; - SqliteCommand cmd = new SqliteCommand(sql); - - // this provides the binding for all our parameters, so - // much less code than it used to be - - foreach (DataColumn col in dt.Columns) - { - cmd.Parameters.Add(createSqliteParameter(col.ColumnName, col.DataType)); - } - return cmd; - } - - /// - /// - /// - /// Data Table - /// - // private static string defineTable(DataTable dt) - // { - // string sql = "create table " + dt.TableName + "("; - // string subsql = String.Empty; - // foreach (DataColumn col in dt.Columns) - // { - // if (subsql.Length > 0) - // { - // // a map function would rock so much here - // subsql += ",\n"; - // } - // subsql += col.ColumnName + " " + sqliteType(col.DataType); - // if (dt.PrimaryKey.Length > 0 && col == dt.PrimaryKey[0]) - // { - // subsql += " primary key"; - // } - // } - // sql += subsql; - // sql += ")"; - // return sql; - // } - - /*********************************************************************** - * - * Database Binding functions - * - * These will be db specific due to typing, and minor differences - * in databases. - * - **********************************************************************/ - - /// - /// This is a convenience function that collapses 5 repetitive - /// lines for defining SqliteParameters to 2 parameters: - /// column name and database type. - /// - /// It assumes certain conventions like :param as the param - /// name to replace in parametrized queries, and that source - /// version is always current version, both of which are fine - /// for us. - /// - ///a built sqlite parameter - private static SqliteParameter createSqliteParameter(string name, Type type) - { - SqliteParameter param = new SqliteParameter(); - param.ParameterName = ":" + name; - param.DbType = dbtypeFromType(type); - param.SourceColumn = name; - param.SourceVersion = DataRowVersion.Current; - return param; - } - - /// - /// - /// - /// - /// - private void setupPrimCommands(SqliteDataAdapter da, SqliteConnection conn) - { - da.InsertCommand = createInsertCommand("prims", ds.Tables["prims"]); - da.InsertCommand.Connection = conn; - - da.UpdateCommand = createUpdateCommand("prims", "UUID=:UUID", ds.Tables["prims"]); - da.UpdateCommand.Connection = conn; - - SqliteCommand delete = new SqliteCommand("delete from prims where UUID = :UUID"); - delete.Parameters.Add(createSqliteParameter("UUID", typeof (String))); - delete.Connection = conn; - da.DeleteCommand = delete; - } - - /// - /// - /// - /// - /// - private void setupItemsCommands(SqliteDataAdapter da, SqliteConnection conn) - { - da.InsertCommand = createInsertCommand("primitems", ds.Tables["primitems"]); - da.InsertCommand.Connection = conn; - - da.UpdateCommand = createUpdateCommand("primitems", "itemID = :itemID", ds.Tables["primitems"]); - da.UpdateCommand.Connection = conn; - - SqliteCommand delete = new SqliteCommand("delete from primitems where itemID = :itemID"); - delete.Parameters.Add(createSqliteParameter("itemID", typeof (String))); - delete.Connection = conn; - da.DeleteCommand = delete; - } - - /// - /// - /// - /// - /// - private void setupTerrainCommands(SqliteDataAdapter da, SqliteConnection conn) - { - da.InsertCommand = createInsertCommand("terrain", ds.Tables["terrain"]); - da.InsertCommand.Connection = conn; - } - - /// - /// - /// - /// - /// - private void setupLandCommands(SqliteDataAdapter da, SqliteConnection conn) - { - da.InsertCommand = createInsertCommand("land", ds.Tables["land"]); - da.InsertCommand.Connection = conn; - - da.UpdateCommand = createUpdateCommand("land", "UUID=:UUID", ds.Tables["land"]); - da.UpdateCommand.Connection = conn; - - SqliteCommand delete = new SqliteCommand("delete from land where UUID=:UUID"); - delete.Parameters.Add(createSqliteParameter("UUID", typeof(String))); - da.DeleteCommand = delete; - da.DeleteCommand.Connection = conn; - } - - /// - /// - /// - /// - /// - private void setupLandAccessCommands(SqliteDataAdapter da, SqliteConnection conn) - { - da.InsertCommand = createInsertCommand("landaccesslist", ds.Tables["landaccesslist"]); - da.InsertCommand.Connection = conn; - - da.UpdateCommand = createUpdateCommand("landaccesslist", "LandUUID=:landUUID", "AccessUUID=:AccessUUID", ds.Tables["landaccesslist"]); - da.UpdateCommand.Connection = conn; - - SqliteCommand delete = new SqliteCommand("delete from landaccesslist where LandUUID= :LandUUID and AccessUUID= :AccessUUID"); - delete.Parameters.Add(createSqliteParameter("LandUUID", typeof(String))); - delete.Parameters.Add(createSqliteParameter("AccessUUID", typeof(String))); - da.DeleteCommand = delete; - da.DeleteCommand.Connection = conn; - - } - - private void setupRegionSettingsCommands(SqliteDataAdapter da, SqliteConnection conn) - { - da.InsertCommand = createInsertCommand("regionsettings", ds.Tables["regionsettings"]); - da.InsertCommand.Connection = conn; - da.UpdateCommand = createUpdateCommand("regionsettings", "regionUUID=:regionUUID", ds.Tables["regionsettings"]); - da.UpdateCommand.Connection = conn; - } - - /// - /// - /// - /// - /// - private void setupShapeCommands(SqliteDataAdapter da, SqliteConnection conn) - { - da.InsertCommand = createInsertCommand("primshapes", ds.Tables["primshapes"]); - da.InsertCommand.Connection = conn; - - da.UpdateCommand = createUpdateCommand("primshapes", "UUID=:UUID", ds.Tables["primshapes"]); - da.UpdateCommand.Connection = conn; - - SqliteCommand delete = new SqliteCommand("delete from primshapes where UUID = :UUID"); - delete.Parameters.Add(createSqliteParameter("UUID", typeof (String))); - delete.Connection = conn; - da.DeleteCommand = delete; - } - - /*********************************************************************** - * - * Type conversion functions - * - **********************************************************************/ - - /// - /// Type conversion function - /// - /// - /// - private static DbType dbtypeFromType(Type type) - { - if (type == typeof (String)) - { - return DbType.String; - } - else if (type == typeof (Int32)) - { - return DbType.Int32; - } - else if (type == typeof (Double)) - { - return DbType.Double; - } - else if (type == typeof (Byte)) - { - return DbType.Byte; - } - else if (type == typeof (Double)) - { - return DbType.Double; - } - else if (type == typeof (Byte[])) - { - return DbType.Binary; - } - else - { - return DbType.String; - } - } - - static void PrintDataSet(DataSet ds) - { - // Print out any name and extended properties. - Console.WriteLine("DataSet is named: {0}", ds.DataSetName); - foreach (System.Collections.DictionaryEntry de in ds.ExtendedProperties) - { - Console.WriteLine("Key = {0}, Value = {1}", de.Key, de.Value); - } - Console.WriteLine(); - foreach (DataTable dt in ds.Tables) - { - Console.WriteLine("=> {0} Table:", dt.TableName); - // Print out the column names. - for (int curCol = 0; curCol < dt.Columns.Count; curCol++) - { - Console.Write(dt.Columns[curCol].ColumnName + "\t"); - } - Console.WriteLine("\n----------------------------------"); - // Print the DataTable. - for (int curRow = 0; curRow < dt.Rows.Count; curRow++) - { - for (int curCol = 0; curCol < dt.Columns.Count; curCol++) - { - Console.Write(dt.Rows[curRow][curCol].ToString() + "\t"); - } - Console.WriteLine(); - } - } - } - - } -} diff --git a/OpenSim/Data/SQLite/SQLiteSimulationData.cs b/OpenSim/Data/SQLite/SQLiteSimulationData.cs new file mode 100644 index 0000000..55c27b2 --- /dev/null +++ b/OpenSim/Data/SQLite/SQLiteSimulationData.cs @@ -0,0 +1,2355 @@ +/* + * Copyright (c) Contributors, http://opensimulator.org/ + * See CONTRIBUTORS.TXT for a full list of copyright holders. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the OpenSimulator Project nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +using System; +using System.Collections.Generic; +using System.Data; +using System.Drawing; +using System.IO; +using System.Reflection; +using log4net; +using Mono.Data.Sqlite; +using OpenMetaverse; +using OpenMetaverse.StructuredData; +using OpenSim.Framework; +using OpenSim.Region.Framework.Interfaces; +using OpenSim.Region.Framework.Scenes; + +namespace OpenSim.Data.SQLite +{ + /// + /// A RegionData Interface to the SQLite database + /// + public class SQLiteSimulationData : ISimulationDataStore + { + private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + + private const string primSelect = "select * from prims"; + private const string shapeSelect = "select * from primshapes"; + private const string itemsSelect = "select * from primitems"; + private const string terrainSelect = "select * from terrain limit 1"; + private const string landSelect = "select * from land"; + private const string landAccessListSelect = "select distinct * from landaccesslist"; + private const string regionbanListSelect = "select * from regionban"; + private const string regionSettingsSelect = "select * from regionsettings"; + + private DataSet ds; + private SqliteDataAdapter primDa; + private SqliteDataAdapter shapeDa; + private SqliteDataAdapter itemsDa; + private SqliteDataAdapter terrainDa; + private SqliteDataAdapter landDa; + private SqliteDataAdapter landAccessListDa; + private SqliteDataAdapter regionSettingsDa; + + private SqliteConnection m_conn; + + private String m_connectionString; + + // Temporary attribute while this is experimental + + /*********************************************************************** + * + * Public Interface Functions + * + **********************************************************************/ + + /// + /// See IRegionDataStore + /// + /// Initialises RegionData Interface + /// Loads and initialises a new SQLite connection and maintains it. + /// + /// + /// the connection string + public void Initialise(string connectionString) + { + try + { + m_connectionString = connectionString; + + ds = new DataSet("Region"); + + m_log.Info("[SQLITE REGION DB]: Sqlite - connecting: " + connectionString); + m_conn = new SqliteConnection(m_connectionString); + m_conn.Open(); + + SqliteCommand primSelectCmd = new SqliteCommand(primSelect, m_conn); + primDa = new SqliteDataAdapter(primSelectCmd); + + SqliteCommand shapeSelectCmd = new SqliteCommand(shapeSelect, m_conn); + shapeDa = new SqliteDataAdapter(shapeSelectCmd); + // SqliteCommandBuilder shapeCb = new SqliteCommandBuilder(shapeDa); + + SqliteCommand itemsSelectCmd = new SqliteCommand(itemsSelect, m_conn); + itemsDa = new SqliteDataAdapter(itemsSelectCmd); + + SqliteCommand terrainSelectCmd = new SqliteCommand(terrainSelect, m_conn); + terrainDa = new SqliteDataAdapter(terrainSelectCmd); + + SqliteCommand landSelectCmd = new SqliteCommand(landSelect, m_conn); + landDa = new SqliteDataAdapter(landSelectCmd); + + SqliteCommand landAccessListSelectCmd = new SqliteCommand(landAccessListSelect, m_conn); + landAccessListDa = new SqliteDataAdapter(landAccessListSelectCmd); + + SqliteCommand regionSettingsSelectCmd = new SqliteCommand(regionSettingsSelect, m_conn); + regionSettingsDa = new SqliteDataAdapter(regionSettingsSelectCmd); + // This actually does the roll forward assembly stuff + Assembly assem = GetType().Assembly; + Migration m = new Migration(m_conn, assem, "RegionStore"); + m.Update(); + + lock (ds) + { + ds.Tables.Add(createPrimTable()); + setupPrimCommands(primDa, m_conn); + + ds.Tables.Add(createShapeTable()); + setupShapeCommands(shapeDa, m_conn); + + ds.Tables.Add(createItemsTable()); + setupItemsCommands(itemsDa, m_conn); + + ds.Tables.Add(createTerrainTable()); + setupTerrainCommands(terrainDa, m_conn); + + ds.Tables.Add(createLandTable()); + setupLandCommands(landDa, m_conn); + + ds.Tables.Add(createLandAccessListTable()); + setupLandAccessCommands(landAccessListDa, m_conn); + + ds.Tables.Add(createRegionSettingsTable()); + setupRegionSettingsCommands(regionSettingsDa, m_conn); + + // WORKAROUND: This is a work around for sqlite on + // windows, which gets really unhappy with blob columns + // that have no sample data in them. At some point we + // need to actually find a proper way to handle this. + try + { + primDa.Fill(ds.Tables["prims"]); + } + catch (Exception) + { + m_log.Info("[SQLITE REGION DB]: Caught fill error on prims table"); + } + + try + { + shapeDa.Fill(ds.Tables["primshapes"]); + } + catch (Exception) + { + m_log.Info("[SQLITE REGION DB]: Caught fill error on primshapes table"); + } + + try + { + itemsDa.Fill(ds.Tables["primitems"]); + } + catch (Exception) + { + m_log.Info("[SQLITE REGION DB]: Caught fill error on primitems table"); + } + + try + { + terrainDa.Fill(ds.Tables["terrain"]); + } + catch (Exception) + { + m_log.Info("[SQLITE REGION DB]: Caught fill error on terrain table"); + } + + try + { + landDa.Fill(ds.Tables["land"]); + } + catch (Exception) + { + m_log.Info("[SQLITE REGION DB]: Caught fill error on land table"); + } + + try + { + landAccessListDa.Fill(ds.Tables["landaccesslist"]); + } + catch (Exception) + { + m_log.Info("[SQLITE REGION DB]: Caught fill error on landaccesslist table"); + } + + try + { + regionSettingsDa.Fill(ds.Tables["regionsettings"]); + } + catch (Exception) + { + m_log.Info("[SQLITE REGION DB]: Caught fill error on regionsettings table"); + } + + // We have to create a data set mapping for every table, otherwise the IDataAdaptor.Update() will not populate rows with values! + // Not sure exactly why this is - this kind of thing was not necessary before - justincc 20100409 + // Possibly because we manually set up our own DataTables before connecting to the database + CreateDataSetMapping(primDa, "prims"); + CreateDataSetMapping(shapeDa, "primshapes"); + CreateDataSetMapping(itemsDa, "primitems"); + CreateDataSetMapping(terrainDa, "terrain"); + CreateDataSetMapping(landDa, "land"); + CreateDataSetMapping(landAccessListDa, "landaccesslist"); + CreateDataSetMapping(regionSettingsDa, "regionsettings"); + } + } + catch (Exception e) + { + m_log.Error(e); + Environment.Exit(23); + } + + return; + } + + public void Dispose() + { + if (m_conn != null) + { + m_conn.Close(); + m_conn = null; + } + if (ds != null) + { + ds.Dispose(); + ds = null; + } + if (primDa != null) + { + primDa.Dispose(); + primDa = null; + } + if (shapeDa != null) + { + shapeDa.Dispose(); + shapeDa = null; + } + if (itemsDa != null) + { + itemsDa.Dispose(); + itemsDa = null; + } + if (terrainDa != null) + { + terrainDa.Dispose(); + terrainDa = null; + } + if (landDa != null) + { + landDa.Dispose(); + landDa = null; + } + if (landAccessListDa != null) + { + landAccessListDa.Dispose(); + landAccessListDa = null; + } + if (regionSettingsDa != null) + { + regionSettingsDa.Dispose(); + regionSettingsDa = null; + } + } + + public void StoreRegionSettings(RegionSettings rs) + { + lock (ds) + { + DataTable regionsettings = ds.Tables["regionsettings"]; + + DataRow settingsRow = regionsettings.Rows.Find(rs.RegionUUID.ToString()); + if (settingsRow == null) + { + settingsRow = regionsettings.NewRow(); + fillRegionSettingsRow(settingsRow, rs); + regionsettings.Rows.Add(settingsRow); + } + else + { + fillRegionSettingsRow(settingsRow, rs); + } + + Commit(); + } + } + public RegionLightShareData LoadRegionWindlightSettings(UUID regionUUID) + { + //This connector doesn't support the windlight module yet + //Return default LL windlight settings + return new RegionLightShareData(); + } + public void StoreRegionWindlightSettings(RegionLightShareData wl) + { + //This connector doesn't support the windlight module yet + } + public RegionSettings LoadRegionSettings(UUID regionUUID) + { + lock (ds) + { + DataTable regionsettings = ds.Tables["regionsettings"]; + + string searchExp = "regionUUID = '" + regionUUID.ToString() + "'"; + DataRow[] rawsettings = regionsettings.Select(searchExp); + if (rawsettings.Length == 0) + { + RegionSettings rs = new RegionSettings(); + rs.RegionUUID = regionUUID; + rs.OnSave += StoreRegionSettings; + + StoreRegionSettings(rs); + + return rs; + } + DataRow row = rawsettings[0]; + + RegionSettings newSettings = buildRegionSettings(row); + newSettings.OnSave += StoreRegionSettings; + + return newSettings; + } + } + + /// + /// Adds an object into region storage + /// + /// the object + /// the region UUID + public void StoreObject(SceneObjectGroup obj, UUID regionUUID) + { + uint flags = obj.RootPart.GetEffectiveObjectFlags(); + + // Eligibility check + // + if ((flags & (uint)PrimFlags.Temporary) != 0) + return; + if ((flags & (uint)PrimFlags.TemporaryOnRez) != 0) + return; + + lock (ds) + { + foreach (SceneObjectPart prim in obj.Children.Values) + { +// m_log.Info("[REGION DB]: Adding obj: " + obj.UUID + " to region: " + regionUUID); + addPrim(prim, obj.UUID, regionUUID); + } + } + + Commit(); + // m_log.Info("[Dump of prims]: " + ds.GetXml()); + } + + /// + /// Removes an object from region storage + /// + /// the object + /// the region UUID + public void RemoveObject(UUID obj, UUID regionUUID) + { + // m_log.InfoFormat("[REGION DB]: Removing obj: {0} from region: {1}", obj.Guid, regionUUID); + + DataTable prims = ds.Tables["prims"]; + DataTable shapes = ds.Tables["primshapes"]; + + string selectExp = "SceneGroupID = '" + obj + "' and RegionUUID = '" + regionUUID + "'"; + lock (ds) + { + DataRow[] primRows = prims.Select(selectExp); + foreach (DataRow row in primRows) + { + // Remove shape rows + UUID uuid = new UUID((string) row["UUID"]); + DataRow shapeRow = shapes.Rows.Find(uuid.ToString()); + if (shapeRow != null) + { + shapeRow.Delete(); + } + + RemoveItems(uuid); + + // Remove prim row + row.Delete(); + } + } + + Commit(); + } + + /// + /// Remove all persisted items of the given prim. + /// The caller must acquire the necessrary synchronization locks and commit or rollback changes. + /// + /// The item UUID + private void RemoveItems(UUID uuid) + { + DataTable items = ds.Tables["primitems"]; + + String sql = String.Format("primID = '{0}'", uuid); + DataRow[] itemRows = items.Select(sql); + + foreach (DataRow itemRow in itemRows) + { + itemRow.Delete(); + } + } + + /// + /// Load persisted objects from region storage. + /// + /// The region UUID + /// List of loaded groups + public List LoadObjects(UUID regionUUID) + { + Dictionary createdObjects = new Dictionary(); + + List retvals = new List(); + + DataTable prims = ds.Tables["prims"]; + DataTable shapes = ds.Tables["primshapes"]; + + string byRegion = "RegionUUID = '" + regionUUID + "'"; + + lock (ds) + { + DataRow[] primsForRegion = prims.Select(byRegion); +// m_log.Info("[SQLITE REGION DB]: Loaded " + primsForRegion.Length + " prims for region: " + regionUUID); + + // First, create all groups + foreach (DataRow primRow in primsForRegion) + { + try + { + SceneObjectPart prim = null; + + string uuid = (string) primRow["UUID"]; + string objID = (string) primRow["SceneGroupID"]; + + if (uuid == objID) //is new SceneObjectGroup ? + { + prim = buildPrim(primRow); + DataRow shapeRow = shapes.Rows.Find(prim.UUID.ToString()); + if (shapeRow != null) + { + prim.Shape = buildShape(shapeRow); + } + else + { + m_log.Warn( + "[SQLITE REGION DB]: No shape found for prim in storage, so setting default box shape"); + prim.Shape = PrimitiveBaseShape.Default; + } + + SceneObjectGroup group = new SceneObjectGroup(prim); + createdObjects.Add(group.UUID, group); + retvals.Add(group); + LoadItems(prim); + } + } + catch (Exception e) + { + m_log.Error("[SQLITE REGION DB]: Failed create prim object in new group, exception and data follows"); + m_log.Error("[SQLITE REGION DB]: ", e); + foreach (DataColumn col in prims.Columns) + { + m_log.Error("[SQLITE REGION DB]: Col: " + col.ColumnName + " => " + primRow[col]); + } + } + } + + // Now fill the groups with part data + foreach (DataRow primRow in primsForRegion) + { + try + { + SceneObjectPart prim = null; + + string uuid = (string) primRow["UUID"]; + string objID = (string) primRow["SceneGroupID"]; + if (uuid != objID) //is new SceneObjectGroup ? + { + prim = buildPrim(primRow); + DataRow shapeRow = shapes.Rows.Find(prim.UUID.ToString()); + if (shapeRow != null) + { + prim.Shape = buildShape(shapeRow); + } + else + { + m_log.Warn( + "[SQLITE REGION DB]: No shape found for prim in storage, so setting default box shape"); + prim.Shape = PrimitiveBaseShape.Default; + } + + createdObjects[new UUID(objID)].AddPart(prim); + LoadItems(prim); + } + } + catch (Exception e) + { + m_log.Error("[SQLITE REGION DB]: Failed create prim object in group, exception and data follows"); + m_log.Error("[SQLITE REGION DB]: ", e); + foreach (DataColumn col in prims.Columns) + { + m_log.Error("[SQLITE REGION DB]: Col: " + col.ColumnName + " => " + primRow[col]); + } + } + } + } + return retvals; + } + + /// + /// Load in a prim's persisted inventory. + /// + /// the prim + private void LoadItems(SceneObjectPart prim) + { +// m_log.DebugFormat("[SQLITE REGION DB]: Loading inventory for {0} {1}", prim.Name, prim.UUID); + + DataTable dbItems = ds.Tables["primitems"]; + String sql = String.Format("primID = '{0}'", prim.UUID.ToString()); + DataRow[] dbItemRows = dbItems.Select(sql); + IList inventory = new List(); + +// m_log.DebugFormat( +// "[SQLITE REGION DB]: Found {0} items for {1} {2}", dbItemRows.Length, prim.Name, prim.UUID); + + foreach (DataRow row in dbItemRows) + { + TaskInventoryItem item = buildItem(row); + inventory.Add(item); + +// m_log.DebugFormat("[SQLITE REGION DB]: Restored item {0} {1}", item.Name, item.ItemID); + } + + prim.Inventory.RestoreInventoryItems(inventory); + } + + /// + /// Store a terrain revision in region storage + /// + /// terrain heightfield + /// region UUID + public void StoreTerrain(double[,] ter, UUID regionID) + { + lock (ds) + { + int revision = Util.UnixTimeSinceEpoch(); + + // This is added to get rid of the infinitely growing + // terrain databases which negatively impact on SQLite + // over time. Before reenabling this feature there + // needs to be a limitter put on the number of + // revisions in the database, as this old + // implementation is a DOS attack waiting to happen. + + using ( + SqliteCommand cmd = + new SqliteCommand("delete from terrain where RegionUUID=:RegionUUID and Revision <= :Revision", + m_conn)) + { + cmd.Parameters.Add(new SqliteParameter(":RegionUUID", regionID.ToString())); + cmd.Parameters.Add(new SqliteParameter(":Revision", revision)); + cmd.ExecuteNonQuery(); + } + + // the following is an work around for .NET. The perf + // issues associated with it aren't as bad as you think. + m_log.Debug("[SQLITE REGION DB]: Storing terrain revision r" + revision.ToString()); + String sql = "insert into terrain(RegionUUID, Revision, Heightfield)" + + " values(:RegionUUID, :Revision, :Heightfield)"; + + using (SqliteCommand cmd = new SqliteCommand(sql, m_conn)) + { + cmd.Parameters.Add(new SqliteParameter(":RegionUUID", regionID.ToString())); + cmd.Parameters.Add(new SqliteParameter(":Revision", revision)); + cmd.Parameters.Add(new SqliteParameter(":Heightfield", serializeTerrain(ter))); + cmd.ExecuteNonQuery(); + } + } + } + + /// + /// Load the latest terrain revision from region storage + /// + /// the region UUID + /// Heightfield data + public double[,] LoadTerrain(UUID regionID) + { + lock (ds) + { + double[,] terret = new double[(int)Constants.RegionSize, (int)Constants.RegionSize]; + terret.Initialize(); + + String sql = "select RegionUUID, Revision, Heightfield from terrain" + + " where RegionUUID=:RegionUUID order by Revision desc"; + + using (SqliteCommand cmd = new SqliteCommand(sql, m_conn)) + { + cmd.Parameters.Add(new SqliteParameter(":RegionUUID", regionID.ToString())); + + using (IDataReader row = cmd.ExecuteReader()) + { + int rev = 0; + if (row.Read()) + { + // TODO: put this into a function + using (MemoryStream str = new MemoryStream((byte[])row["Heightfield"])) + { + using (BinaryReader br = new BinaryReader(str)) + { + for (int x = 0; x < (int)Constants.RegionSize; x++) + { + for (int y = 0; y < (int)Constants.RegionSize; y++) + { + terret[x, y] = br.ReadDouble(); + } + } + } + } + rev = Convert.ToInt32(row["Revision"]); + } + else + { + m_log.Warn("[SQLITE REGION DB]: No terrain found for region"); + return null; + } + + m_log.Debug("[SQLITE REGION DB]: Loaded terrain revision r" + rev.ToString()); + } + } + return terret; + } + } + + /// + /// + /// + /// + public void RemoveLandObject(UUID globalID) + { + lock (ds) + { + // Can't use blanket SQL statements when using SqlAdapters unless you re-read the data into the adapter + // after you're done. + // replaced below code with the SqliteAdapter version. + //using (SqliteCommand cmd = new SqliteCommand("delete from land where UUID=:UUID", m_conn)) + //{ + // cmd.Parameters.Add(new SqliteParameter(":UUID", globalID.ToString())); + // cmd.ExecuteNonQuery(); + //} + + //using (SqliteCommand cmd = new SqliteCommand("delete from landaccesslist where LandUUID=:UUID", m_conn)) + //{ + // cmd.Parameters.Add(new SqliteParameter(":UUID", globalID.ToString())); + // cmd.ExecuteNonQuery(); + //} + + DataTable land = ds.Tables["land"]; + DataTable landaccesslist = ds.Tables["landaccesslist"]; + DataRow landRow = land.Rows.Find(globalID.ToString()); + if (landRow != null) + { + land.Rows.Remove(landRow); + } + List rowsToDelete = new List(); + foreach (DataRow rowToCheck in landaccesslist.Rows) + { + if (rowToCheck["LandUUID"].ToString() == globalID.ToString()) + rowsToDelete.Add(rowToCheck); + } + for (int iter = 0; iter < rowsToDelete.Count; iter++) + { + landaccesslist.Rows.Remove(rowsToDelete[iter]); + } + + + } + Commit(); + } + + /// + /// + /// + /// + public void StoreLandObject(ILandObject parcel) + { + lock (ds) + { + DataTable land = ds.Tables["land"]; + DataTable landaccesslist = ds.Tables["landaccesslist"]; + + DataRow landRow = land.Rows.Find(parcel.LandData.GlobalID.ToString()); + if (landRow == null) + { + landRow = land.NewRow(); + fillLandRow(landRow, parcel.LandData, parcel.RegionUUID); + land.Rows.Add(landRow); + } + else + { + fillLandRow(landRow, parcel.LandData, parcel.RegionUUID); + } + + // I know this caused someone issues before, but OpenSim is unusable if we leave this stuff around + //using (SqliteCommand cmd = new SqliteCommand("delete from landaccesslist where LandUUID=:LandUUID", m_conn)) + //{ + // cmd.Parameters.Add(new SqliteParameter(":LandUUID", parcel.LandData.GlobalID.ToString())); + // cmd.ExecuteNonQuery(); + +// } + + // This is the slower.. but more appropriate thing to do + + // We can't modify the table with direct queries before calling Commit() and re-filling them. + List rowsToDelete = new List(); + foreach (DataRow rowToCheck in landaccesslist.Rows) + { + if (rowToCheck["LandUUID"].ToString() == parcel.LandData.GlobalID.ToString()) + rowsToDelete.Add(rowToCheck); + } + for (int iter = 0; iter < rowsToDelete.Count; iter++) + { + landaccesslist.Rows.Remove(rowsToDelete[iter]); + } + rowsToDelete.Clear(); + foreach (ParcelManager.ParcelAccessEntry entry in parcel.LandData.ParcelAccessList) + { + DataRow newAccessRow = landaccesslist.NewRow(); + fillLandAccessRow(newAccessRow, entry, parcel.LandData.GlobalID); + landaccesslist.Rows.Add(newAccessRow); + } + } + + Commit(); + } + + /// + /// + /// + /// + /// + public List LoadLandObjects(UUID regionUUID) + { + List landDataForRegion = new List(); + lock (ds) + { + DataTable land = ds.Tables["land"]; + DataTable landaccesslist = ds.Tables["landaccesslist"]; + string searchExp = "RegionUUID = '" + regionUUID + "'"; + DataRow[] rawDataForRegion = land.Select(searchExp); + foreach (DataRow rawDataLand in rawDataForRegion) + { + LandData newLand = buildLandData(rawDataLand); + string accessListSearchExp = "LandUUID = '" + newLand.GlobalID + "'"; + DataRow[] rawDataForLandAccessList = landaccesslist.Select(accessListSearchExp); + foreach (DataRow rawDataLandAccess in rawDataForLandAccessList) + { + newLand.ParcelAccessList.Add(buildLandAccessData(rawDataLandAccess)); + } + + landDataForRegion.Add(newLand); + } + } + return landDataForRegion; + } + + /// + /// + /// + public void Commit() + { + //m_log.Debug("[SQLITE]: Starting commit"); + lock (ds) + { + primDa.Update(ds, "prims"); + shapeDa.Update(ds, "primshapes"); + + itemsDa.Update(ds, "primitems"); + + terrainDa.Update(ds, "terrain"); + landDa.Update(ds, "land"); + landAccessListDa.Update(ds, "landaccesslist"); + try + { + regionSettingsDa.Update(ds, "regionsettings"); + } + catch (SqliteException SqlEx) + { + throw new Exception( + "There was a SQL error or connection string configuration error when saving the region settings. This could be a bug, it could also happen if ConnectionString is defined in the [DatabaseService] section of StandaloneCommon.ini in the config_include folder. This could also happen if the config_include folder doesn't exist or if the OpenSim.ini [Architecture] section isn't set. If this is your first time running OpenSimulator, please restart the simulator and bug a developer to fix this!", + SqlEx); + } + ds.AcceptChanges(); + } + } + + /// + /// See + /// + public void Shutdown() + { + Commit(); + } + + /*********************************************************************** + * + * Database Definition Functions + * + * This should be db agnostic as we define them in ADO.NET terms + * + **********************************************************************/ + + protected void CreateDataSetMapping(IDataAdapter da, string tableName) + { + ITableMapping dbMapping = da.TableMappings.Add(tableName, tableName); + foreach (DataColumn col in ds.Tables[tableName].Columns) + { + dbMapping.ColumnMappings.Add(col.ColumnName, col.ColumnName); + } + } + + /// + /// + /// + /// + /// + /// + private static void createCol(DataTable dt, string name, Type type) + { + DataColumn col = new DataColumn(name, type); + dt.Columns.Add(col); + } + + /// + /// Creates the "terrain" table + /// + /// terrain table DataTable + private static DataTable createTerrainTable() + { + DataTable terrain = new DataTable("terrain"); + + createCol(terrain, "RegionUUID", typeof (String)); + createCol(terrain, "Revision", typeof (Int32)); + createCol(terrain, "Heightfield", typeof (Byte[])); + + return terrain; + } + + /// + /// Creates the "prims" table + /// + /// prim table DataTable + private static DataTable createPrimTable() + { + DataTable prims = new DataTable("prims"); + + createCol(prims, "UUID", typeof (String)); + createCol(prims, "RegionUUID", typeof (String)); + createCol(prims, "CreationDate", typeof (Int32)); + createCol(prims, "Name", typeof (String)); + createCol(prims, "SceneGroupID", typeof (String)); + // various text fields + createCol(prims, "Text", typeof (String)); + createCol(prims, "ColorR", typeof (Int32)); + createCol(prims, "ColorG", typeof (Int32)); + createCol(prims, "ColorB", typeof (Int32)); + createCol(prims, "ColorA", typeof (Int32)); + createCol(prims, "Description", typeof (String)); + createCol(prims, "SitName", typeof (String)); + createCol(prims, "TouchName", typeof (String)); + // permissions + createCol(prims, "ObjectFlags", typeof (Int32)); + createCol(prims, "CreatorID", typeof (String)); + createCol(prims, "OwnerID", typeof (String)); + createCol(prims, "GroupID", typeof (String)); + createCol(prims, "LastOwnerID", typeof (String)); + createCol(prims, "OwnerMask", typeof (Int32)); + createCol(prims, "NextOwnerMask", typeof (Int32)); + createCol(prims, "GroupMask", typeof (Int32)); + createCol(prims, "EveryoneMask", typeof (Int32)); + createCol(prims, "BaseMask", typeof (Int32)); + // vectors + createCol(prims, "PositionX", typeof (Double)); + createCol(prims, "PositionY", typeof (Double)); + createCol(prims, "PositionZ", typeof (Double)); + createCol(prims, "GroupPositionX", typeof (Double)); + createCol(prims, "GroupPositionY", typeof (Double)); + createCol(prims, "GroupPositionZ", typeof (Double)); + createCol(prims, "VelocityX", typeof (Double)); + createCol(prims, "VelocityY", typeof (Double)); + createCol(prims, "VelocityZ", typeof (Double)); + createCol(prims, "AngularVelocityX", typeof (Double)); + createCol(prims, "AngularVelocityY", typeof (Double)); + createCol(prims, "AngularVelocityZ", typeof (Double)); + createCol(prims, "AccelerationX", typeof (Double)); + createCol(prims, "AccelerationY", typeof (Double)); + createCol(prims, "AccelerationZ", typeof (Double)); + // quaternions + createCol(prims, "RotationX", typeof (Double)); + createCol(prims, "RotationY", typeof (Double)); + createCol(prims, "RotationZ", typeof (Double)); + createCol(prims, "RotationW", typeof (Double)); + + // sit target + createCol(prims, "SitTargetOffsetX", typeof (Double)); + createCol(prims, "SitTargetOffsetY", typeof (Double)); + createCol(prims, "SitTargetOffsetZ", typeof (Double)); + + createCol(prims, "SitTargetOrientW", typeof (Double)); + createCol(prims, "SitTargetOrientX", typeof (Double)); + createCol(prims, "SitTargetOrientY", typeof (Double)); + createCol(prims, "SitTargetOrientZ", typeof (Double)); + + createCol(prims, "PayPrice", typeof(Int32)); + createCol(prims, "PayButton1", typeof(Int32)); + createCol(prims, "PayButton2", typeof(Int32)); + createCol(prims, "PayButton3", typeof(Int32)); + createCol(prims, "PayButton4", typeof(Int32)); + + createCol(prims, "LoopedSound", typeof(String)); + createCol(prims, "LoopedSoundGain", typeof(Double)); + createCol(prims, "TextureAnimation", typeof(String)); + createCol(prims, "ParticleSystem", typeof(String)); + + createCol(prims, "OmegaX", typeof(Double)); + createCol(prims, "OmegaY", typeof(Double)); + createCol(prims, "OmegaZ", typeof(Double)); + + createCol(prims, "CameraEyeOffsetX", typeof(Double)); + createCol(prims, "CameraEyeOffsetY", typeof(Double)); + createCol(prims, "CameraEyeOffsetZ", typeof(Double)); + + createCol(prims, "CameraAtOffsetX", typeof(Double)); + createCol(prims, "CameraAtOffsetY", typeof(Double)); + createCol(prims, "CameraAtOffsetZ", typeof(Double)); + + createCol(prims, "ForceMouselook", typeof(Int16)); + + createCol(prims, "ScriptAccessPin", typeof(Int32)); + + createCol(prims, "AllowedDrop", typeof(Int16)); + createCol(prims, "DieAtEdge", typeof(Int16)); + + createCol(prims, "SalePrice", typeof(Int32)); + createCol(prims, "SaleType", typeof(Int16)); + + // click action + createCol(prims, "ClickAction", typeof (Byte)); + + createCol(prims, "Material", typeof(Byte)); + + createCol(prims, "CollisionSound", typeof(String)); + createCol(prims, "CollisionSoundVolume", typeof(Double)); + + createCol(prims, "VolumeDetect", typeof(Int16)); + + createCol(prims, "MediaURL", typeof(String)); + + // Add in contraints + prims.PrimaryKey = new DataColumn[] {prims.Columns["UUID"]}; + + return prims; + } + + /// + /// Creates "primshapes" table + /// + /// shape table DataTable + private static DataTable createShapeTable() + { + DataTable shapes = new DataTable("primshapes"); + createCol(shapes, "UUID", typeof (String)); + // shape is an enum + createCol(shapes, "Shape", typeof (Int32)); + // vectors + createCol(shapes, "ScaleX", typeof (Double)); + createCol(shapes, "ScaleY", typeof (Double)); + createCol(shapes, "ScaleZ", typeof (Double)); + // paths + createCol(shapes, "PCode", typeof (Int32)); + createCol(shapes, "PathBegin", typeof (Int32)); + createCol(shapes, "PathEnd", typeof (Int32)); + createCol(shapes, "PathScaleX", typeof (Int32)); + createCol(shapes, "PathScaleY", typeof (Int32)); + createCol(shapes, "PathShearX", typeof (Int32)); + createCol(shapes, "PathShearY", typeof (Int32)); + createCol(shapes, "PathSkew", typeof (Int32)); + createCol(shapes, "PathCurve", typeof (Int32)); + createCol(shapes, "PathRadiusOffset", typeof (Int32)); + createCol(shapes, "PathRevolutions", typeof (Int32)); + createCol(shapes, "PathTaperX", typeof (Int32)); + createCol(shapes, "PathTaperY", typeof (Int32)); + createCol(shapes, "PathTwist", typeof (Int32)); + createCol(shapes, "PathTwistBegin", typeof (Int32)); + // profile + createCol(shapes, "ProfileBegin", typeof (Int32)); + createCol(shapes, "ProfileEnd", typeof (Int32)); + createCol(shapes, "ProfileCurve", typeof (Int32)); + createCol(shapes, "ProfileHollow", typeof (Int32)); + createCol(shapes, "State", typeof(Int32)); + // text TODO: this isn't right, but I'm not sure the right + // way to specify this as a blob atm + createCol(shapes, "Texture", typeof (Byte[])); + createCol(shapes, "ExtraParams", typeof (Byte[])); + createCol(shapes, "Media", typeof(String)); + + shapes.PrimaryKey = new DataColumn[] {shapes.Columns["UUID"]}; + + return shapes; + } + + /// + /// creates "primitems" table + /// + /// item table DataTable + private static DataTable createItemsTable() + { + DataTable items = new DataTable("primitems"); + + createCol(items, "itemID", typeof (String)); + createCol(items, "primID", typeof (String)); + createCol(items, "assetID", typeof (String)); + createCol(items, "parentFolderID", typeof (String)); + + createCol(items, "invType", typeof (Int32)); + createCol(items, "assetType", typeof (Int32)); + + createCol(items, "name", typeof (String)); + createCol(items, "description", typeof (String)); + + createCol(items, "creationDate", typeof (Int64)); + createCol(items, "creatorID", typeof (String)); + createCol(items, "ownerID", typeof (String)); + createCol(items, "lastOwnerID", typeof (String)); + createCol(items, "groupID", typeof (String)); + + createCol(items, "nextPermissions", typeof (UInt32)); + createCol(items, "currentPermissions", typeof (UInt32)); + createCol(items, "basePermissions", typeof (UInt32)); + createCol(items, "everyonePermissions", typeof (UInt32)); + createCol(items, "groupPermissions", typeof (UInt32)); + createCol(items, "flags", typeof (UInt32)); + + items.PrimaryKey = new DataColumn[] { items.Columns["itemID"] }; + + return items; + } + + /// + /// Creates "land" table + /// + /// land table DataTable + private static DataTable createLandTable() + { + DataTable land = new DataTable("land"); + createCol(land, "UUID", typeof (String)); + createCol(land, "RegionUUID", typeof (String)); + createCol(land, "LocalLandID", typeof (UInt32)); + + // Bitmap is a byte[512] + createCol(land, "Bitmap", typeof (Byte[])); + + createCol(land, "Name", typeof (String)); + createCol(land, "Desc", typeof (String)); + createCol(land, "OwnerUUID", typeof (String)); + createCol(land, "IsGroupOwned", typeof (Boolean)); + createCol(land, "Area", typeof (Int32)); + createCol(land, "AuctionID", typeof (Int32)); //Unemplemented + createCol(land, "Category", typeof (Int32)); //Enum OpenMetaverse.Parcel.ParcelCategory + createCol(land, "ClaimDate", typeof (Int32)); + createCol(land, "ClaimPrice", typeof (Int32)); + createCol(land, "GroupUUID", typeof (string)); + createCol(land, "SalePrice", typeof (Int32)); + createCol(land, "LandStatus", typeof (Int32)); //Enum. OpenMetaverse.Parcel.ParcelStatus + createCol(land, "LandFlags", typeof (UInt32)); + createCol(land, "LandingType", typeof (Byte)); + createCol(land, "MediaAutoScale", typeof (Byte)); + createCol(land, "MediaTextureUUID", typeof (String)); + createCol(land, "MediaURL", typeof (String)); + createCol(land, "MusicURL", typeof (String)); + createCol(land, "PassHours", typeof (Double)); + createCol(land, "PassPrice", typeof (UInt32)); + createCol(land, "SnapshotUUID", typeof (String)); + createCol(land, "UserLocationX", typeof (Double)); + createCol(land, "UserLocationY", typeof (Double)); + createCol(land, "UserLocationZ", typeof (Double)); + createCol(land, "UserLookAtX", typeof (Double)); + createCol(land, "UserLookAtY", typeof (Double)); + createCol(land, "UserLookAtZ", typeof (Double)); + createCol(land, "AuthbuyerID", typeof(String)); + createCol(land, "OtherCleanTime", typeof(Int32)); + + land.PrimaryKey = new DataColumn[] {land.Columns["UUID"]}; + + return land; + } + + /// + /// create "landaccesslist" table + /// + /// Landacceslist DataTable + private static DataTable createLandAccessListTable() + { + DataTable landaccess = new DataTable("landaccesslist"); + createCol(landaccess, "LandUUID", typeof (String)); + createCol(landaccess, "AccessUUID", typeof (String)); + createCol(landaccess, "Flags", typeof (UInt32)); + + return landaccess; + } + + private static DataTable createRegionSettingsTable() + { + DataTable regionsettings = new DataTable("regionsettings"); + createCol(regionsettings, "regionUUID", typeof(String)); + createCol(regionsettings, "block_terraform", typeof (Int32)); + createCol(regionsettings, "block_fly", typeof (Int32)); + createCol(regionsettings, "allow_damage", typeof (Int32)); + createCol(regionsettings, "restrict_pushing", typeof (Int32)); + createCol(regionsettings, "allow_land_resell", typeof (Int32)); + createCol(regionsettings, "allow_land_join_divide", typeof (Int32)); + createCol(regionsettings, "block_show_in_search", typeof (Int32)); + createCol(regionsettings, "agent_limit", typeof (Int32)); + createCol(regionsettings, "object_bonus", typeof (Double)); + createCol(regionsettings, "maturity", typeof (Int32)); + createCol(regionsettings, "disable_scripts", typeof (Int32)); + createCol(regionsettings, "disable_collisions", typeof (Int32)); + createCol(regionsettings, "disable_physics", typeof (Int32)); + createCol(regionsettings, "terrain_texture_1", typeof(String)); + createCol(regionsettings, "terrain_texture_2", typeof(String)); + createCol(regionsettings, "terrain_texture_3", typeof(String)); + createCol(regionsettings, "terrain_texture_4", typeof(String)); + createCol(regionsettings, "elevation_1_nw", typeof (Double)); + createCol(regionsettings, "elevation_2_nw", typeof (Double)); + createCol(regionsettings, "elevation_1_ne", typeof (Double)); + createCol(regionsettings, "elevation_2_ne", typeof (Double)); + createCol(regionsettings, "elevation_1_se", typeof (Double)); + createCol(regionsettings, "elevation_2_se", typeof (Double)); + createCol(regionsettings, "elevation_1_sw", typeof (Double)); + createCol(regionsettings, "elevation_2_sw", typeof (Double)); + createCol(regionsettings, "water_height", typeof (Double)); + createCol(regionsettings, "terrain_raise_limit", typeof (Double)); + createCol(regionsettings, "terrain_lower_limit", typeof (Double)); + createCol(regionsettings, "use_estate_sun", typeof (Int32)); + createCol(regionsettings, "sandbox", typeof (Int32)); + createCol(regionsettings, "sunvectorx",typeof (Double)); + createCol(regionsettings, "sunvectory",typeof (Double)); + createCol(regionsettings, "sunvectorz",typeof (Double)); + createCol(regionsettings, "fixed_sun", typeof (Int32)); + createCol(regionsettings, "sun_position", typeof (Double)); + createCol(regionsettings, "covenant", typeof(String)); + createCol(regionsettings, "map_tile_ID", typeof(String)); + regionsettings.PrimaryKey = new DataColumn[] { regionsettings.Columns["regionUUID"] }; + return regionsettings; + } + + /*********************************************************************** + * + * Convert between ADO.NET <=> OpenSim Objects + * + * These should be database independant + * + **********************************************************************/ + + /// + /// + /// + /// + /// + private SceneObjectPart buildPrim(DataRow row) + { + // Code commented. Uncomment to test the unit test inline. + + // The unit test mentions this commented code for the purposes + // of debugging a unit test failure + + // SceneObjectGroup sog = new SceneObjectGroup(); + // SceneObjectPart sop = new SceneObjectPart(); + // sop.LocalId = 1; + // sop.Name = "object1"; + // sop.Description = "object1"; + // sop.Text = ""; + // sop.SitName = ""; + // sop.TouchName = ""; + // sop.UUID = UUID.Random(); + // sop.Shape = PrimitiveBaseShape.Default; + // sog.SetRootPart(sop); + // Add breakpoint in above line. Check sop fields. + + // TODO: this doesn't work yet because something more + // interesting has to be done to actually get these values + // back out. Not enough time to figure it out yet. + + SceneObjectPart prim = new SceneObjectPart(); + prim.UUID = new UUID((String) row["UUID"]); + // explicit conversion of integers is required, which sort + // of sucks. No idea if there is a shortcut here or not. + prim.CreationDate = Convert.ToInt32(row["CreationDate"]); + prim.Name = row["Name"] == DBNull.Value ? string.Empty : (string)row["Name"]; + // various text fields + prim.Text = (String) row["Text"]; + prim.Color = Color.FromArgb(Convert.ToInt32(row["ColorA"]), + Convert.ToInt32(row["ColorR"]), + Convert.ToInt32(row["ColorG"]), + Convert.ToInt32(row["ColorB"])); + prim.Description = (String) row["Description"]; + prim.SitName = (String) row["SitName"]; + prim.TouchName = (String) row["TouchName"]; + // permissions + prim.ObjectFlags = Convert.ToUInt32(row["ObjectFlags"]); + prim.CreatorID = new UUID((String) row["CreatorID"]); + prim.OwnerID = new UUID((String) row["OwnerID"]); + prim.GroupID = new UUID((String) row["GroupID"]); + prim.LastOwnerID = new UUID((String) row["LastOwnerID"]); + prim.OwnerMask = Convert.ToUInt32(row["OwnerMask"]); + prim.NextOwnerMask = Convert.ToUInt32(row["NextOwnerMask"]); + prim.GroupMask = Convert.ToUInt32(row["GroupMask"]); + prim.EveryoneMask = Convert.ToUInt32(row["EveryoneMask"]); + prim.BaseMask = Convert.ToUInt32(row["BaseMask"]); + // vectors + prim.OffsetPosition = new Vector3( + Convert.ToSingle(row["PositionX"]), + Convert.ToSingle(row["PositionY"]), + Convert.ToSingle(row["PositionZ"]) + ); + prim.GroupPosition = new Vector3( + Convert.ToSingle(row["GroupPositionX"]), + Convert.ToSingle(row["GroupPositionY"]), + Convert.ToSingle(row["GroupPositionZ"]) + ); + prim.Velocity = new Vector3( + Convert.ToSingle(row["VelocityX"]), + Convert.ToSingle(row["VelocityY"]), + Convert.ToSingle(row["VelocityZ"]) + ); + prim.AngularVelocity = new Vector3( + Convert.ToSingle(row["AngularVelocityX"]), + Convert.ToSingle(row["AngularVelocityY"]), + Convert.ToSingle(row["AngularVelocityZ"]) + ); + prim.Acceleration = new Vector3( + Convert.ToSingle(row["AccelerationX"]), + Convert.ToSingle(row["AccelerationY"]), + Convert.ToSingle(row["AccelerationZ"]) + ); + // quaternions + prim.RotationOffset = new Quaternion( + Convert.ToSingle(row["RotationX"]), + Convert.ToSingle(row["RotationY"]), + Convert.ToSingle(row["RotationZ"]), + Convert.ToSingle(row["RotationW"]) + ); + + prim.SitTargetPositionLL = new Vector3( + Convert.ToSingle(row["SitTargetOffsetX"]), + Convert.ToSingle(row["SitTargetOffsetY"]), + Convert.ToSingle(row["SitTargetOffsetZ"])); + prim.SitTargetOrientationLL = new Quaternion( + Convert.ToSingle( + row["SitTargetOrientX"]), + Convert.ToSingle( + row["SitTargetOrientY"]), + Convert.ToSingle( + row["SitTargetOrientZ"]), + Convert.ToSingle( + row["SitTargetOrientW"])); + + prim.ClickAction = Convert.ToByte(row["ClickAction"]); + prim.PayPrice[0] = Convert.ToInt32(row["PayPrice"]); + prim.PayPrice[1] = Convert.ToInt32(row["PayButton1"]); + prim.PayPrice[2] = Convert.ToInt32(row["PayButton2"]); + prim.PayPrice[3] = Convert.ToInt32(row["PayButton3"]); + prim.PayPrice[4] = Convert.ToInt32(row["PayButton4"]); + + prim.Sound = new UUID(row["LoopedSound"].ToString()); + prim.SoundGain = Convert.ToSingle(row["LoopedSoundGain"]); + prim.SoundFlags = 1; // If it's persisted at all, it's looped + + if (!row.IsNull("TextureAnimation")) + prim.TextureAnimation = Convert.FromBase64String(row["TextureAnimation"].ToString()); + if (!row.IsNull("ParticleSystem")) + prim.ParticleSystem = Convert.FromBase64String(row["ParticleSystem"].ToString()); + + prim.AngularVelocity = new Vector3( + Convert.ToSingle(row["OmegaX"]), + Convert.ToSingle(row["OmegaY"]), + Convert.ToSingle(row["OmegaZ"]) + ); + + prim.SetCameraEyeOffset(new Vector3( + Convert.ToSingle(row["CameraEyeOffsetX"]), + Convert.ToSingle(row["CameraEyeOffsetY"]), + Convert.ToSingle(row["CameraEyeOffsetZ"]) + )); + + prim.SetCameraAtOffset(new Vector3( + Convert.ToSingle(row["CameraAtOffsetX"]), + Convert.ToSingle(row["CameraAtOffsetY"]), + Convert.ToSingle(row["CameraAtOffsetZ"]) + )); + + if (Convert.ToInt16(row["ForceMouselook"]) != 0) + prim.SetForceMouselook(true); + + prim.ScriptAccessPin = Convert.ToInt32(row["ScriptAccessPin"]); + + if (Convert.ToInt16(row["AllowedDrop"]) != 0) + prim.AllowedDrop = true; + + if (Convert.ToInt16(row["DieAtEdge"]) != 0) + prim.DIE_AT_EDGE = true; + + prim.SalePrice = Convert.ToInt32(row["SalePrice"]); + prim.ObjectSaleType = Convert.ToByte(row["SaleType"]); + + prim.Material = Convert.ToByte(row["Material"]); + + prim.CollisionSound = new UUID(row["CollisionSound"].ToString()); + prim.CollisionSoundVolume = Convert.ToSingle(row["CollisionSoundVolume"]); + + if (Convert.ToInt16(row["VolumeDetect"]) != 0) + prim.VolumeDetectActive = true; + + if (!(row["MediaURL"] is System.DBNull)) + { + //m_log.DebugFormat("[SQLITE]: MediaUrl type [{0}]", row["MediaURL"].GetType()); + prim.MediaUrl = (string)row["MediaURL"]; + } + + return prim; + } + + /// + /// Build a prim inventory item from the persisted data. + /// + /// + /// + private static TaskInventoryItem buildItem(DataRow row) + { + TaskInventoryItem taskItem = new TaskInventoryItem(); + + taskItem.ItemID = new UUID((String)row["itemID"]); + taskItem.ParentPartID = new UUID((String)row["primID"]); + taskItem.AssetID = new UUID((String)row["assetID"]); + taskItem.ParentID = new UUID((String)row["parentFolderID"]); + + taskItem.InvType = Convert.ToInt32(row["invType"]); + taskItem.Type = Convert.ToInt32(row["assetType"]); + + taskItem.Name = (String)row["name"]; + taskItem.Description = (String)row["description"]; + taskItem.CreationDate = Convert.ToUInt32(row["creationDate"]); + taskItem.CreatorID = new UUID((String)row["creatorID"]); + taskItem.OwnerID = new UUID((String)row["ownerID"]); + taskItem.LastOwnerID = new UUID((String)row["lastOwnerID"]); + taskItem.GroupID = new UUID((String)row["groupID"]); + + taskItem.NextPermissions = Convert.ToUInt32(row["nextPermissions"]); + taskItem.CurrentPermissions = Convert.ToUInt32(row["currentPermissions"]); + taskItem.BasePermissions = Convert.ToUInt32(row["basePermissions"]); + taskItem.EveryonePermissions = Convert.ToUInt32(row["everyonePermissions"]); + taskItem.GroupPermissions = Convert.ToUInt32(row["groupPermissions"]); + taskItem.Flags = Convert.ToUInt32(row["flags"]); + + return taskItem; + } + + /// + /// Build a Land Data from the persisted data. + /// + /// + /// + private LandData buildLandData(DataRow row) + { + LandData newData = new LandData(); + + newData.GlobalID = new UUID((String) row["UUID"]); + newData.LocalID = Convert.ToInt32(row["LocalLandID"]); + + // Bitmap is a byte[512] + newData.Bitmap = (Byte[]) row["Bitmap"]; + + newData.Name = (String) row["Name"]; + newData.Description = (String) row["Desc"]; + newData.OwnerID = (UUID)(String) row["OwnerUUID"]; + newData.IsGroupOwned = (Boolean) row["IsGroupOwned"]; + newData.Area = Convert.ToInt32(row["Area"]); + newData.AuctionID = Convert.ToUInt32(row["AuctionID"]); //Unemplemented + newData.Category = (ParcelCategory) Convert.ToInt32(row["Category"]); + //Enum OpenMetaverse.Parcel.ParcelCategory + newData.ClaimDate = Convert.ToInt32(row["ClaimDate"]); + newData.ClaimPrice = Convert.ToInt32(row["ClaimPrice"]); + newData.GroupID = new UUID((String) row["GroupUUID"]); + newData.SalePrice = Convert.ToInt32(row["SalePrice"]); + newData.Status = (ParcelStatus) Convert.ToInt32(row["LandStatus"]); + //Enum. OpenMetaverse.Parcel.ParcelStatus + newData.Flags = Convert.ToUInt32(row["LandFlags"]); + newData.LandingType = (Byte) row["LandingType"]; + newData.MediaAutoScale = (Byte) row["MediaAutoScale"]; + newData.MediaID = new UUID((String) row["MediaTextureUUID"]); + newData.MediaURL = (String) row["MediaURL"]; + newData.MusicURL = (String) row["MusicURL"]; + newData.PassHours = Convert.ToSingle(row["PassHours"]); + newData.PassPrice = Convert.ToInt32(row["PassPrice"]); + newData.SnapshotID = (UUID)(String) row["SnapshotUUID"]; + try + { + + newData.UserLocation = + new Vector3(Convert.ToSingle(row["UserLocationX"]), Convert.ToSingle(row["UserLocationY"]), + Convert.ToSingle(row["UserLocationZ"])); + newData.UserLookAt = + new Vector3(Convert.ToSingle(row["UserLookAtX"]), Convert.ToSingle(row["UserLookAtY"]), + Convert.ToSingle(row["UserLookAtZ"])); + + } + catch (InvalidCastException) + { + m_log.ErrorFormat("[SQLITE REGION DB]: unable to get parcel telehub settings for {1}", newData.Name); + newData.UserLocation = Vector3.Zero; + newData.UserLookAt = Vector3.Zero; + } + newData.ParcelAccessList = new List(); + UUID authBuyerID = UUID.Zero; + + UUID.TryParse((string)row["AuthbuyerID"], out authBuyerID); + + newData.OtherCleanTime = Convert.ToInt32(row["OtherCleanTime"]); + + return newData; + } + + private RegionSettings buildRegionSettings(DataRow row) + { + RegionSettings newSettings = new RegionSettings(); + + newSettings.RegionUUID = new UUID((string) row["regionUUID"]); + newSettings.BlockTerraform = Convert.ToBoolean(row["block_terraform"]); + newSettings.AllowDamage = Convert.ToBoolean(row["allow_damage"]); + newSettings.BlockFly = Convert.ToBoolean(row["block_fly"]); + newSettings.RestrictPushing = Convert.ToBoolean(row["restrict_pushing"]); + newSettings.AllowLandResell = Convert.ToBoolean(row["allow_land_resell"]); + newSettings.AllowLandJoinDivide = Convert.ToBoolean(row["allow_land_join_divide"]); + newSettings.BlockShowInSearch = Convert.ToBoolean(row["block_show_in_search"]); + newSettings.AgentLimit = Convert.ToInt32(row["agent_limit"]); + newSettings.ObjectBonus = Convert.ToDouble(row["object_bonus"]); + newSettings.Maturity = Convert.ToInt32(row["maturity"]); + newSettings.DisableScripts = Convert.ToBoolean(row["disable_scripts"]); + newSettings.DisableCollisions = Convert.ToBoolean(row["disable_collisions"]); + newSettings.DisablePhysics = Convert.ToBoolean(row["disable_physics"]); + newSettings.TerrainTexture1 = new UUID((String) row["terrain_texture_1"]); + newSettings.TerrainTexture2 = new UUID((String) row["terrain_texture_2"]); + newSettings.TerrainTexture3 = new UUID((String) row["terrain_texture_3"]); + newSettings.TerrainTexture4 = new UUID((String) row["terrain_texture_4"]); + newSettings.Elevation1NW = Convert.ToDouble(row["elevation_1_nw"]); + newSettings.Elevation2NW = Convert.ToDouble(row["elevation_2_nw"]); + newSettings.Elevation1NE = Convert.ToDouble(row["elevation_1_ne"]); + newSettings.Elevation2NE = Convert.ToDouble(row["elevation_2_ne"]); + newSettings.Elevation1SE = Convert.ToDouble(row["elevation_1_se"]); + newSettings.Elevation2SE = Convert.ToDouble(row["elevation_2_se"]); + newSettings.Elevation1SW = Convert.ToDouble(row["elevation_1_sw"]); + newSettings.Elevation2SW = Convert.ToDouble(row["elevation_2_sw"]); + newSettings.WaterHeight = Convert.ToDouble(row["water_height"]); + newSettings.TerrainRaiseLimit = Convert.ToDouble(row["terrain_raise_limit"]); + newSettings.TerrainLowerLimit = Convert.ToDouble(row["terrain_lower_limit"]); + newSettings.UseEstateSun = Convert.ToBoolean(row["use_estate_sun"]); + newSettings.Sandbox = Convert.ToBoolean(row["sandbox"]); + newSettings.SunVector = new Vector3 ( + Convert.ToSingle(row["sunvectorx"]), + Convert.ToSingle(row["sunvectory"]), + Convert.ToSingle(row["sunvectorz"]) + ); + newSettings.FixedSun = Convert.ToBoolean(row["fixed_sun"]); + newSettings.SunPosition = Convert.ToDouble(row["sun_position"]); + newSettings.Covenant = new UUID((String) row["covenant"]); + newSettings.TerrainImageID = new UUID((String)row["map_tile_ID"]); + + return newSettings; + } + + /// + /// Build a land access entry from the persisted data. + /// + /// + /// + private static ParcelManager.ParcelAccessEntry buildLandAccessData(DataRow row) + { + ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry(); + entry.AgentID = new UUID((string) row["AccessUUID"]); + entry.Flags = (AccessList) row["Flags"]; + entry.Time = new DateTime(); + return entry; + } + + /// + /// + /// + /// + /// + private static Array serializeTerrain(double[,] val) + { + MemoryStream str = new MemoryStream(((int)Constants.RegionSize * (int)Constants.RegionSize) *sizeof (double)); + BinaryWriter bw = new BinaryWriter(str); + + // TODO: COMPATIBILITY - Add byte-order conversions + for (int x = 0; x < (int)Constants.RegionSize; x++) + for (int y = 0; y < (int)Constants.RegionSize; y++) + bw.Write(val[x, y]); + + return str.ToArray(); + } + +// private void fillTerrainRow(DataRow row, UUID regionUUID, int rev, double[,] val) +// { +// row["RegionUUID"] = regionUUID; +// row["Revision"] = rev; + + // MemoryStream str = new MemoryStream(((int)Constants.RegionSize * (int)Constants.RegionSize)*sizeof (double)); +// BinaryWriter bw = new BinaryWriter(str); + +// // TODO: COMPATIBILITY - Add byte-order conversions + // for (int x = 0; x < (int)Constants.RegionSize; x++) + // for (int y = 0; y < (int)Constants.RegionSize; y++) +// bw.Write(val[x, y]); + +// row["Heightfield"] = str.ToArray(); +// } + + /// + /// + /// + /// + /// + /// + /// + private static void fillPrimRow(DataRow row, SceneObjectPart prim, UUID sceneGroupID, UUID regionUUID) + { + row["UUID"] = prim.UUID.ToString(); + row["RegionUUID"] = regionUUID.ToString(); + row["CreationDate"] = prim.CreationDate; + row["Name"] = prim.Name; + row["SceneGroupID"] = sceneGroupID.ToString(); + // the UUID of the root part for this SceneObjectGroup + // various text fields + row["Text"] = prim.Text; + row["Description"] = prim.Description; + row["SitName"] = prim.SitName; + row["TouchName"] = prim.TouchName; + // permissions + row["ObjectFlags"] = prim.ObjectFlags; + row["CreatorID"] = prim.CreatorID.ToString(); + row["OwnerID"] = prim.OwnerID.ToString(); + row["GroupID"] = prim.GroupID.ToString(); + row["LastOwnerID"] = prim.LastOwnerID.ToString(); + row["OwnerMask"] = prim.OwnerMask; + row["NextOwnerMask"] = prim.NextOwnerMask; + row["GroupMask"] = prim.GroupMask; + row["EveryoneMask"] = prim.EveryoneMask; + row["BaseMask"] = prim.BaseMask; + // vectors + row["PositionX"] = prim.OffsetPosition.X; + row["PositionY"] = prim.OffsetPosition.Y; + row["PositionZ"] = prim.OffsetPosition.Z; + row["GroupPositionX"] = prim.GroupPosition.X; + row["GroupPositionY"] = prim.GroupPosition.Y; + row["GroupPositionZ"] = prim.GroupPosition.Z; + row["VelocityX"] = prim.Velocity.X; + row["VelocityY"] = prim.Velocity.Y; + row["VelocityZ"] = prim.Velocity.Z; + row["AngularVelocityX"] = prim.AngularVelocity.X; + row["AngularVelocityY"] = prim.AngularVelocity.Y; + row["AngularVelocityZ"] = prim.AngularVelocity.Z; + row["AccelerationX"] = prim.Acceleration.X; + row["AccelerationY"] = prim.Acceleration.Y; + row["AccelerationZ"] = prim.Acceleration.Z; + // quaternions + row["RotationX"] = prim.RotationOffset.X; + row["RotationY"] = prim.RotationOffset.Y; + row["RotationZ"] = prim.RotationOffset.Z; + row["RotationW"] = prim.RotationOffset.W; + + // Sit target + Vector3 sitTargetPos = prim.SitTargetPositionLL; + row["SitTargetOffsetX"] = sitTargetPos.X; + row["SitTargetOffsetY"] = sitTargetPos.Y; + row["SitTargetOffsetZ"] = sitTargetPos.Z; + + Quaternion sitTargetOrient = prim.SitTargetOrientationLL; + row["SitTargetOrientW"] = sitTargetOrient.W; + row["SitTargetOrientX"] = sitTargetOrient.X; + row["SitTargetOrientY"] = sitTargetOrient.Y; + row["SitTargetOrientZ"] = sitTargetOrient.Z; + row["ColorR"] = Convert.ToInt32(prim.Color.R); + row["ColorG"] = Convert.ToInt32(prim.Color.G); + row["ColorB"] = Convert.ToInt32(prim.Color.B); + row["ColorA"] = Convert.ToInt32(prim.Color.A); + row["PayPrice"] = prim.PayPrice[0]; + row["PayButton1"] = prim.PayPrice[1]; + row["PayButton2"] = prim.PayPrice[2]; + row["PayButton3"] = prim.PayPrice[3]; + row["PayButton4"] = prim.PayPrice[4]; + + row["TextureAnimation"] = Convert.ToBase64String(prim.TextureAnimation); + row["ParticleSystem"] = Convert.ToBase64String(prim.ParticleSystem); + + row["OmegaX"] = prim.AngularVelocity.X; + row["OmegaY"] = prim.AngularVelocity.Y; + row["OmegaZ"] = prim.AngularVelocity.Z; + + row["CameraEyeOffsetX"] = prim.GetCameraEyeOffset().X; + row["CameraEyeOffsetY"] = prim.GetCameraEyeOffset().Y; + row["CameraEyeOffsetZ"] = prim.GetCameraEyeOffset().Z; + + row["CameraAtOffsetX"] = prim.GetCameraAtOffset().X; + row["CameraAtOffsetY"] = prim.GetCameraAtOffset().Y; + row["CameraAtOffsetZ"] = prim.GetCameraAtOffset().Z; + + + if ((prim.SoundFlags & 1) != 0) // Looped + { + row["LoopedSound"] = prim.Sound.ToString(); + row["LoopedSoundGain"] = prim.SoundGain; + } + else + { + row["LoopedSound"] = UUID.Zero.ToString(); + row["LoopedSoundGain"] = 0.0f; + } + + if (prim.GetForceMouselook()) + row["ForceMouselook"] = 1; + else + row["ForceMouselook"] = 0; + + row["ScriptAccessPin"] = prim.ScriptAccessPin; + + if (prim.AllowedDrop) + row["AllowedDrop"] = 1; + else + row["AllowedDrop"] = 0; + + if (prim.DIE_AT_EDGE) + row["DieAtEdge"] = 1; + else + row["DieAtEdge"] = 0; + + row["SalePrice"] = prim.SalePrice; + row["SaleType"] = Convert.ToInt16(prim.ObjectSaleType); + + // click action + row["ClickAction"] = prim.ClickAction; + + row["SalePrice"] = prim.SalePrice; + row["Material"] = prim.Material; + + row["CollisionSound"] = prim.CollisionSound.ToString(); + row["CollisionSoundVolume"] = prim.CollisionSoundVolume; + if (prim.VolumeDetectActive) + row["VolumeDetect"] = 1; + else + row["VolumeDetect"] = 0; + + row["MediaURL"] = prim.MediaUrl; + } + + /// + /// + /// + /// + /// + private static void fillItemRow(DataRow row, TaskInventoryItem taskItem) + { + row["itemID"] = taskItem.ItemID.ToString(); + row["primID"] = taskItem.ParentPartID.ToString(); + row["assetID"] = taskItem.AssetID.ToString(); + row["parentFolderID"] = taskItem.ParentID.ToString(); + + row["invType"] = taskItem.InvType; + row["assetType"] = taskItem.Type; + + row["name"] = taskItem.Name; + row["description"] = taskItem.Description; + row["creationDate"] = taskItem.CreationDate; + row["creatorID"] = taskItem.CreatorID.ToString(); + row["ownerID"] = taskItem.OwnerID.ToString(); + row["lastOwnerID"] = taskItem.LastOwnerID.ToString(); + row["groupID"] = taskItem.GroupID.ToString(); + row["nextPermissions"] = taskItem.NextPermissions; + row["currentPermissions"] = taskItem.CurrentPermissions; + row["basePermissions"] = taskItem.BasePermissions; + row["everyonePermissions"] = taskItem.EveryonePermissions; + row["groupPermissions"] = taskItem.GroupPermissions; + row["flags"] = taskItem.Flags; + } + + /// + /// + /// + /// + /// + /// + private static void fillLandRow(DataRow row, LandData land, UUID regionUUID) + { + row["UUID"] = land.GlobalID.ToString(); + row["RegionUUID"] = regionUUID.ToString(); + row["LocalLandID"] = land.LocalID; + + // Bitmap is a byte[512] + row["Bitmap"] = land.Bitmap; + + row["Name"] = land.Name; + row["Desc"] = land.Description; + row["OwnerUUID"] = land.OwnerID.ToString(); + row["IsGroupOwned"] = land.IsGroupOwned; + row["Area"] = land.Area; + row["AuctionID"] = land.AuctionID; //Unemplemented + row["Category"] = land.Category; //Enum OpenMetaverse.Parcel.ParcelCategory + row["ClaimDate"] = land.ClaimDate; + row["ClaimPrice"] = land.ClaimPrice; + row["GroupUUID"] = land.GroupID.ToString(); + row["SalePrice"] = land.SalePrice; + row["LandStatus"] = land.Status; //Enum. OpenMetaverse.Parcel.ParcelStatus + row["LandFlags"] = land.Flags; + row["LandingType"] = land.LandingType; + row["MediaAutoScale"] = land.MediaAutoScale; + row["MediaTextureUUID"] = land.MediaID.ToString(); + row["MediaURL"] = land.MediaURL; + row["MusicURL"] = land.MusicURL; + row["PassHours"] = land.PassHours; + row["PassPrice"] = land.PassPrice; + row["SnapshotUUID"] = land.SnapshotID.ToString(); + row["UserLocationX"] = land.UserLocation.X; + row["UserLocationY"] = land.UserLocation.Y; + row["UserLocationZ"] = land.UserLocation.Z; + row["UserLookAtX"] = land.UserLookAt.X; + row["UserLookAtY"] = land.UserLookAt.Y; + row["UserLookAtZ"] = land.UserLookAt.Z; + row["AuthbuyerID"] = land.AuthBuyerID.ToString(); + row["OtherCleanTime"] = land.OtherCleanTime; + row["MediaType"] = land.MediaType; + row["MediaDescription"] = land.MediaDescription; + row["MediaSize"] = land.MediaWidth.ToString() + "," + land.MediaHeight.ToString(); + row["MediaLoop"] = land.MediaLoop.ToString(); + row["ObscureMusic"] = land.ObscureMusic.ToString(); + row["ObscureMedia"] = land.ObscureMedia.ToString(); + } + + /// + /// + /// + /// + /// + /// + private static void fillLandAccessRow(DataRow row, ParcelManager.ParcelAccessEntry entry, UUID parcelID) + { + row["LandUUID"] = parcelID.ToString(); + row["AccessUUID"] = entry.AgentID.ToString(); + row["Flags"] = entry.Flags; + } + + private static void fillRegionSettingsRow(DataRow row, RegionSettings settings) + { + row["regionUUID"] = settings.RegionUUID.ToString(); + row["block_terraform"] = settings.BlockTerraform; + row["block_fly"] = settings.BlockFly; + row["allow_damage"] = settings.AllowDamage; + row["restrict_pushing"] = settings.RestrictPushing; + row["allow_land_resell"] = settings.AllowLandResell; + row["allow_land_join_divide"] = settings.AllowLandJoinDivide; + row["block_show_in_search"] = settings.BlockShowInSearch; + row["agent_limit"] = settings.AgentLimit; + row["object_bonus"] = settings.ObjectBonus; + row["maturity"] = settings.Maturity; + row["disable_scripts"] = settings.DisableScripts; + row["disable_collisions"] = settings.DisableCollisions; + row["disable_physics"] = settings.DisablePhysics; + row["terrain_texture_1"] = settings.TerrainTexture1.ToString(); + row["terrain_texture_2"] = settings.TerrainTexture2.ToString(); + row["terrain_texture_3"] = settings.TerrainTexture3.ToString(); + row["terrain_texture_4"] = settings.TerrainTexture4.ToString(); + row["elevation_1_nw"] = settings.Elevation1NW; + row["elevation_2_nw"] = settings.Elevation2NW; + row["elevation_1_ne"] = settings.Elevation1NE; + row["elevation_2_ne"] = settings.Elevation2NE; + row["elevation_1_se"] = settings.Elevation1SE; + row["elevation_2_se"] = settings.Elevation2SE; + row["elevation_1_sw"] = settings.Elevation1SW; + row["elevation_2_sw"] = settings.Elevation2SW; + row["water_height"] = settings.WaterHeight; + row["terrain_raise_limit"] = settings.TerrainRaiseLimit; + row["terrain_lower_limit"] = settings.TerrainLowerLimit; + row["use_estate_sun"] = settings.UseEstateSun; + row["Sandbox"] = settings.Sandbox; // database uses upper case S for sandbox + row["sunvectorx"] = settings.SunVector.X; + row["sunvectory"] = settings.SunVector.Y; + row["sunvectorz"] = settings.SunVector.Z; + row["fixed_sun"] = settings.FixedSun; + row["sun_position"] = settings.SunPosition; + row["covenant"] = settings.Covenant.ToString(); + row["map_tile_ID"] = settings.TerrainImageID.ToString(); + } + + /// + /// + /// + /// + /// + private PrimitiveBaseShape buildShape(DataRow row) + { + PrimitiveBaseShape s = new PrimitiveBaseShape(); + s.Scale = new Vector3( + Convert.ToSingle(row["ScaleX"]), + Convert.ToSingle(row["ScaleY"]), + Convert.ToSingle(row["ScaleZ"]) + ); + // paths + s.PCode = Convert.ToByte(row["PCode"]); + s.PathBegin = Convert.ToUInt16(row["PathBegin"]); + s.PathEnd = Convert.ToUInt16(row["PathEnd"]); + s.PathScaleX = Convert.ToByte(row["PathScaleX"]); + s.PathScaleY = Convert.ToByte(row["PathScaleY"]); + s.PathShearX = Convert.ToByte(row["PathShearX"]); + s.PathShearY = Convert.ToByte(row["PathShearY"]); + s.PathSkew = Convert.ToSByte(row["PathSkew"]); + s.PathCurve = Convert.ToByte(row["PathCurve"]); + s.PathRadiusOffset = Convert.ToSByte(row["PathRadiusOffset"]); + s.PathRevolutions = Convert.ToByte(row["PathRevolutions"]); + s.PathTaperX = Convert.ToSByte(row["PathTaperX"]); + s.PathTaperY = Convert.ToSByte(row["PathTaperY"]); + s.PathTwist = Convert.ToSByte(row["PathTwist"]); + s.PathTwistBegin = Convert.ToSByte(row["PathTwistBegin"]); + // profile + s.ProfileBegin = Convert.ToUInt16(row["ProfileBegin"]); + s.ProfileEnd = Convert.ToUInt16(row["ProfileEnd"]); + s.ProfileCurve = Convert.ToByte(row["ProfileCurve"]); + s.ProfileHollow = Convert.ToUInt16(row["ProfileHollow"]); + s.State = Convert.ToByte(row["State"]); + + byte[] textureEntry = (byte[])row["Texture"]; + s.TextureEntry = textureEntry; + + s.ExtraParams = (byte[]) row["ExtraParams"]; + + if (!(row["Media"] is System.DBNull)) + s.Media = PrimitiveBaseShape.MediaList.FromXml((string)row["Media"]); + + return s; + } + + /// + /// + /// + /// + /// + private static void fillShapeRow(DataRow row, SceneObjectPart prim) + { + PrimitiveBaseShape s = prim.Shape; + row["UUID"] = prim.UUID.ToString(); + // shape is an enum + row["Shape"] = 0; + // vectors + row["ScaleX"] = s.Scale.X; + row["ScaleY"] = s.Scale.Y; + row["ScaleZ"] = s.Scale.Z; + // paths + row["PCode"] = s.PCode; + row["PathBegin"] = s.PathBegin; + row["PathEnd"] = s.PathEnd; + row["PathScaleX"] = s.PathScaleX; + row["PathScaleY"] = s.PathScaleY; + row["PathShearX"] = s.PathShearX; + row["PathShearY"] = s.PathShearY; + row["PathSkew"] = s.PathSkew; + row["PathCurve"] = s.PathCurve; + row["PathRadiusOffset"] = s.PathRadiusOffset; + row["PathRevolutions"] = s.PathRevolutions; + row["PathTaperX"] = s.PathTaperX; + row["PathTaperY"] = s.PathTaperY; + row["PathTwist"] = s.PathTwist; + row["PathTwistBegin"] = s.PathTwistBegin; + // profile + row["ProfileBegin"] = s.ProfileBegin; + row["ProfileEnd"] = s.ProfileEnd; + row["ProfileCurve"] = s.ProfileCurve; + row["ProfileHollow"] = s.ProfileHollow; + row["State"] = s.State; + + row["Texture"] = s.TextureEntry; + row["ExtraParams"] = s.ExtraParams; + + if (s.Media != null) + row["Media"] = s.Media.ToXml(); + } + + /// + /// Persistently store a prim. + /// + /// + /// + /// + private void addPrim(SceneObjectPart prim, UUID sceneGroupID, UUID regionUUID) + { + DataTable prims = ds.Tables["prims"]; + DataTable shapes = ds.Tables["primshapes"]; + + DataRow primRow = prims.Rows.Find(prim.UUID.ToString()); + if (primRow == null) + { + primRow = prims.NewRow(); + fillPrimRow(primRow, prim, sceneGroupID, regionUUID); + prims.Rows.Add(primRow); + } + else + { + fillPrimRow(primRow, prim, sceneGroupID, regionUUID); + } + + DataRow shapeRow = shapes.Rows.Find(prim.UUID.ToString()); + if (shapeRow == null) + { + shapeRow = shapes.NewRow(); + fillShapeRow(shapeRow, prim); + shapes.Rows.Add(shapeRow); + } + else + { + fillShapeRow(shapeRow, prim); + } + } + + /// + /// see IRegionDatastore + /// + /// + /// + public void StorePrimInventory(UUID primID, ICollection items) + { +// m_log.DebugFormat("[SQLITE REGION DB]: Entered StorePrimInventory with prim ID {0}", primID); + + DataTable dbItems = ds.Tables["primitems"]; + + // For now, we're just going to crudely remove all the previous inventory items + // no matter whether they have changed or not, and replace them with the current set. + lock (ds) + { + RemoveItems(primID); + + // repalce with current inventory details + foreach (TaskInventoryItem newItem in items) + { +// m_log.InfoFormat( +// "[DATASTORE]: ", +// "Adding item {0}, {1} to prim ID {2}", +// newItem.Name, newItem.ItemID, newItem.ParentPartID); + + DataRow newItemRow = dbItems.NewRow(); + fillItemRow(newItemRow, newItem); + dbItems.Rows.Add(newItemRow); + } + } + + Commit(); + } + + /*********************************************************************** + * + * SQL Statement Creation Functions + * + * These functions create SQL statements for update, insert, and create. + * They can probably be factored later to have a db independant + * portion and a db specific portion + * + **********************************************************************/ + + /// + /// Create an insert command + /// + /// table name + /// data table + /// the created command + /// + /// This is subtle enough to deserve some commentary. + /// Instead of doing *lots* and *lots of hardcoded strings + /// for database definitions we'll use the fact that + /// realistically all insert statements look like "insert + /// into A(b, c) values(:b, :c) on the parameterized query + /// front. If we just have a list of b, c, etc... we can + /// generate these strings instead of typing them out. + /// + private static SqliteCommand createInsertCommand(string table, DataTable dt) + { + string[] cols = new string[dt.Columns.Count]; + for (int i = 0; i < dt.Columns.Count; i++) + { + DataColumn col = dt.Columns[i]; + cols[i] = col.ColumnName; + } + + string sql = "insert into " + table + "("; + sql += String.Join(", ", cols); + // important, the first ':' needs to be here, the rest get added in the join + sql += ") values (:"; + sql += String.Join(", :", cols); + sql += ")"; + //m_log.DebugFormat("[SQLITE]: Created insert command {0}", sql); + SqliteCommand cmd = new SqliteCommand(sql); + + // this provides the binding for all our parameters, so + // much less code than it used to be + foreach (DataColumn col in dt.Columns) + { + cmd.Parameters.Add(createSqliteParameter(col.ColumnName, col.DataType)); + } + return cmd; + } + + + /// + /// create an update command + /// + /// table name + /// + /// + /// the created command + private static SqliteCommand createUpdateCommand(string table, string pk, DataTable dt) + { + string sql = "update " + table + " set "; + string subsql = String.Empty; + foreach (DataColumn col in dt.Columns) + { + if (subsql.Length > 0) + { + // a map function would rock so much here + subsql += ", "; + } + subsql += col.ColumnName + "= :" + col.ColumnName; + } + sql += subsql; + sql += " where " + pk; + SqliteCommand cmd = new SqliteCommand(sql); + + // this provides the binding for all our parameters, so + // much less code than it used to be + + foreach (DataColumn col in dt.Columns) + { + cmd.Parameters.Add(createSqliteParameter(col.ColumnName, col.DataType)); + } + return cmd; + } + + /// + /// create an update command + /// + /// table name + /// + /// + /// the created command + private static SqliteCommand createUpdateCommand(string table, string pk1, string pk2, DataTable dt) + { + string sql = "update " + table + " set "; + string subsql = String.Empty; + foreach (DataColumn col in dt.Columns) + { + if (subsql.Length > 0) + { + // a map function would rock so much here + subsql += ", "; + } + subsql += col.ColumnName + "= :" + col.ColumnName; + } + sql += subsql; + sql += " where " + pk1 + " and " + pk2; + SqliteCommand cmd = new SqliteCommand(sql); + + // this provides the binding for all our parameters, so + // much less code than it used to be + + foreach (DataColumn col in dt.Columns) + { + cmd.Parameters.Add(createSqliteParameter(col.ColumnName, col.DataType)); + } + return cmd; + } + + /// + /// + /// + /// Data Table + /// + // private static string defineTable(DataTable dt) + // { + // string sql = "create table " + dt.TableName + "("; + // string subsql = String.Empty; + // foreach (DataColumn col in dt.Columns) + // { + // if (subsql.Length > 0) + // { + // // a map function would rock so much here + // subsql += ",\n"; + // } + // subsql += col.ColumnName + " " + sqliteType(col.DataType); + // if (dt.PrimaryKey.Length > 0 && col == dt.PrimaryKey[0]) + // { + // subsql += " primary key"; + // } + // } + // sql += subsql; + // sql += ")"; + // return sql; + // } + + /*********************************************************************** + * + * Database Binding functions + * + * These will be db specific due to typing, and minor differences + * in databases. + * + **********************************************************************/ + + /// + /// This is a convenience function that collapses 5 repetitive + /// lines for defining SqliteParameters to 2 parameters: + /// column name and database type. + /// + /// It assumes certain conventions like :param as the param + /// name to replace in parametrized queries, and that source + /// version is always current version, both of which are fine + /// for us. + /// + ///a built sqlite parameter + private static SqliteParameter createSqliteParameter(string name, Type type) + { + SqliteParameter param = new SqliteParameter(); + param.ParameterName = ":" + name; + param.DbType = dbtypeFromType(type); + param.SourceColumn = name; + param.SourceVersion = DataRowVersion.Current; + return param; + } + + /// + /// + /// + /// + /// + private void setupPrimCommands(SqliteDataAdapter da, SqliteConnection conn) + { + da.InsertCommand = createInsertCommand("prims", ds.Tables["prims"]); + da.InsertCommand.Connection = conn; + + da.UpdateCommand = createUpdateCommand("prims", "UUID=:UUID", ds.Tables["prims"]); + da.UpdateCommand.Connection = conn; + + SqliteCommand delete = new SqliteCommand("delete from prims where UUID = :UUID"); + delete.Parameters.Add(createSqliteParameter("UUID", typeof (String))); + delete.Connection = conn; + da.DeleteCommand = delete; + } + + /// + /// + /// + /// + /// + private void setupItemsCommands(SqliteDataAdapter da, SqliteConnection conn) + { + da.InsertCommand = createInsertCommand("primitems", ds.Tables["primitems"]); + da.InsertCommand.Connection = conn; + + da.UpdateCommand = createUpdateCommand("primitems", "itemID = :itemID", ds.Tables["primitems"]); + da.UpdateCommand.Connection = conn; + + SqliteCommand delete = new SqliteCommand("delete from primitems where itemID = :itemID"); + delete.Parameters.Add(createSqliteParameter("itemID", typeof (String))); + delete.Connection = conn; + da.DeleteCommand = delete; + } + + /// + /// + /// + /// + /// + private void setupTerrainCommands(SqliteDataAdapter da, SqliteConnection conn) + { + da.InsertCommand = createInsertCommand("terrain", ds.Tables["terrain"]); + da.InsertCommand.Connection = conn; + } + + /// + /// + /// + /// + /// + private void setupLandCommands(SqliteDataAdapter da, SqliteConnection conn) + { + da.InsertCommand = createInsertCommand("land", ds.Tables["land"]); + da.InsertCommand.Connection = conn; + + da.UpdateCommand = createUpdateCommand("land", "UUID=:UUID", ds.Tables["land"]); + da.UpdateCommand.Connection = conn; + + SqliteCommand delete = new SqliteCommand("delete from land where UUID=:UUID"); + delete.Parameters.Add(createSqliteParameter("UUID", typeof(String))); + da.DeleteCommand = delete; + da.DeleteCommand.Connection = conn; + } + + /// + /// + /// + /// + /// + private void setupLandAccessCommands(SqliteDataAdapter da, SqliteConnection conn) + { + da.InsertCommand = createInsertCommand("landaccesslist", ds.Tables["landaccesslist"]); + da.InsertCommand.Connection = conn; + + da.UpdateCommand = createUpdateCommand("landaccesslist", "LandUUID=:landUUID", "AccessUUID=:AccessUUID", ds.Tables["landaccesslist"]); + da.UpdateCommand.Connection = conn; + + SqliteCommand delete = new SqliteCommand("delete from landaccesslist where LandUUID= :LandUUID and AccessUUID= :AccessUUID"); + delete.Parameters.Add(createSqliteParameter("LandUUID", typeof(String))); + delete.Parameters.Add(createSqliteParameter("AccessUUID", typeof(String))); + da.DeleteCommand = delete; + da.DeleteCommand.Connection = conn; + + } + + private void setupRegionSettingsCommands(SqliteDataAdapter da, SqliteConnection conn) + { + da.InsertCommand = createInsertCommand("regionsettings", ds.Tables["regionsettings"]); + da.InsertCommand.Connection = conn; + da.UpdateCommand = createUpdateCommand("regionsettings", "regionUUID=:regionUUID", ds.Tables["regionsettings"]); + da.UpdateCommand.Connection = conn; + } + + /// + /// + /// + /// + /// + private void setupShapeCommands(SqliteDataAdapter da, SqliteConnection conn) + { + da.InsertCommand = createInsertCommand("primshapes", ds.Tables["primshapes"]); + da.InsertCommand.Connection = conn; + + da.UpdateCommand = createUpdateCommand("primshapes", "UUID=:UUID", ds.Tables["primshapes"]); + da.UpdateCommand.Connection = conn; + + SqliteCommand delete = new SqliteCommand("delete from primshapes where UUID = :UUID"); + delete.Parameters.Add(createSqliteParameter("UUID", typeof (String))); + delete.Connection = conn; + da.DeleteCommand = delete; + } + + /*********************************************************************** + * + * Type conversion functions + * + **********************************************************************/ + + /// + /// Type conversion function + /// + /// + /// + private static DbType dbtypeFromType(Type type) + { + if (type == typeof (String)) + { + return DbType.String; + } + else if (type == typeof (Int32)) + { + return DbType.Int32; + } + else if (type == typeof (Double)) + { + return DbType.Double; + } + else if (type == typeof (Byte)) + { + return DbType.Byte; + } + else if (type == typeof (Double)) + { + return DbType.Double; + } + else if (type == typeof (Byte[])) + { + return DbType.Binary; + } + else + { + return DbType.String; + } + } + + static void PrintDataSet(DataSet ds) + { + // Print out any name and extended properties. + Console.WriteLine("DataSet is named: {0}", ds.DataSetName); + foreach (System.Collections.DictionaryEntry de in ds.ExtendedProperties) + { + Console.WriteLine("Key = {0}, Value = {1}", de.Key, de.Value); + } + Console.WriteLine(); + foreach (DataTable dt in ds.Tables) + { + Console.WriteLine("=> {0} Table:", dt.TableName); + // Print out the column names. + for (int curCol = 0; curCol < dt.Columns.Count; curCol++) + { + Console.Write(dt.Columns[curCol].ColumnName + "\t"); + } + Console.WriteLine("\n----------------------------------"); + // Print the DataTable. + for (int curRow = 0; curRow < dt.Rows.Count; curRow++) + { + for (int curCol = 0; curCol < dt.Columns.Count; curCol++) + { + Console.Write(dt.Rows[curRow][curCol].ToString() + "\t"); + } + Console.WriteLine(); + } + } + } + + } +} diff --git a/OpenSim/Data/SQLiteLegacy/SQLiteRegionData.cs b/OpenSim/Data/SQLiteLegacy/SQLiteRegionData.cs deleted file mode 100644 index b5ce4c0..0000000 --- a/OpenSim/Data/SQLiteLegacy/SQLiteRegionData.cs +++ /dev/null @@ -1,2261 +0,0 @@ -/* - * Copyright (c) Contributors, http://opensimulator.org/ - * See CONTRIBUTORS.TXT for a full list of copyright holders. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of the OpenSimulator Project nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -using System; -using System.Collections.Generic; -using System.Data; -using System.Drawing; -using System.IO; -using System.Reflection; -using log4net; -using Mono.Data.SqliteClient; -using OpenMetaverse; -using OpenSim.Framework; -using OpenSim.Region.Framework.Interfaces; -using OpenSim.Region.Framework.Scenes; - -namespace OpenSim.Data.SQLiteLegacy -{ - /// - /// A RegionData Interface to the SQLite database - /// - public class SQLiteRegionData : IRegionDataStore - { - private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - - private const string primSelect = "select * from prims"; - private const string shapeSelect = "select * from primshapes"; - private const string itemsSelect = "select * from primitems"; - private const string terrainSelect = "select * from terrain limit 1"; - private const string landSelect = "select * from land"; - private const string landAccessListSelect = "select distinct * from landaccesslist"; - private const string regionbanListSelect = "select * from regionban"; - private const string regionSettingsSelect = "select * from regionsettings"; - - private DataSet ds; - private SqliteDataAdapter primDa; - private SqliteDataAdapter shapeDa; - private SqliteDataAdapter itemsDa; - private SqliteDataAdapter terrainDa; - private SqliteDataAdapter landDa; - private SqliteDataAdapter landAccessListDa; - private SqliteDataAdapter regionSettingsDa; - - private SqliteConnection m_conn; - - private String m_connectionString; - - // Temporary attribute while this is experimental - - /*********************************************************************** - * - * Public Interface Functions - * - **********************************************************************/ - - /// - /// See IRegionDataStore - /// - /// Initialises RegionData Interface - /// Loads and initialises a new SQLite connection and maintains it. - /// - /// - /// the connection string - public void Initialise(string connectionString) - { - m_connectionString = connectionString; - - ds = new DataSet(); - - m_log.Info("[REGION DB]: Sqlite - connecting: " + connectionString); - m_conn = new SqliteConnection(m_connectionString); - m_conn.Open(); - - - - SqliteCommand primSelectCmd = new SqliteCommand(primSelect, m_conn); - primDa = new SqliteDataAdapter(primSelectCmd); - // SqliteCommandBuilder primCb = new SqliteCommandBuilder(primDa); - - SqliteCommand shapeSelectCmd = new SqliteCommand(shapeSelect, m_conn); - shapeDa = new SqliteDataAdapter(shapeSelectCmd); - // SqliteCommandBuilder shapeCb = new SqliteCommandBuilder(shapeDa); - - SqliteCommand itemsSelectCmd = new SqliteCommand(itemsSelect, m_conn); - itemsDa = new SqliteDataAdapter(itemsSelectCmd); - - SqliteCommand terrainSelectCmd = new SqliteCommand(terrainSelect, m_conn); - terrainDa = new SqliteDataAdapter(terrainSelectCmd); - - SqliteCommand landSelectCmd = new SqliteCommand(landSelect, m_conn); - landDa = new SqliteDataAdapter(landSelectCmd); - - SqliteCommand landAccessListSelectCmd = new SqliteCommand(landAccessListSelect, m_conn); - landAccessListDa = new SqliteDataAdapter(landAccessListSelectCmd); - - SqliteCommand regionSettingsSelectCmd = new SqliteCommand(regionSettingsSelect, m_conn); - regionSettingsDa = new SqliteDataAdapter(regionSettingsSelectCmd); - // This actually does the roll forward assembly stuff - Assembly assem = GetType().Assembly; - Migration m = new Migration(m_conn, assem, "RegionStore"); - m.Update(); - - lock (ds) - { - ds.Tables.Add(createPrimTable()); - setupPrimCommands(primDa, m_conn); - primDa.Fill(ds.Tables["prims"]); - - ds.Tables.Add(createShapeTable()); - setupShapeCommands(shapeDa, m_conn); - - ds.Tables.Add(createItemsTable()); - setupItemsCommands(itemsDa, m_conn); - itemsDa.Fill(ds.Tables["primitems"]); - - ds.Tables.Add(createTerrainTable()); - setupTerrainCommands(terrainDa, m_conn); - - ds.Tables.Add(createLandTable()); - setupLandCommands(landDa, m_conn); - - ds.Tables.Add(createLandAccessListTable()); - setupLandAccessCommands(landAccessListDa, m_conn); - - ds.Tables.Add(createRegionSettingsTable()); - - setupRegionSettingsCommands(regionSettingsDa, m_conn); - - // WORKAROUND: This is a work around for sqlite on - // windows, which gets really unhappy with blob columns - // that have no sample data in them. At some point we - // need to actually find a proper way to handle this. - try - { - shapeDa.Fill(ds.Tables["primshapes"]); - } - catch (Exception) - { - m_log.Info("[REGION DB]: Caught fill error on primshapes table"); - } - - try - { - terrainDa.Fill(ds.Tables["terrain"]); - } - catch (Exception) - { - m_log.Info("[REGION DB]: Caught fill error on terrain table"); - } - - try - { - landDa.Fill(ds.Tables["land"]); - } - catch (Exception) - { - m_log.Info("[REGION DB]: Caught fill error on land table"); - } - - try - { - landAccessListDa.Fill(ds.Tables["landaccesslist"]); - } - catch (Exception) - { - m_log.Info("[REGION DB]: Caught fill error on landaccesslist table"); - } - - try - { - regionSettingsDa.Fill(ds.Tables["regionsettings"]); - } - catch (Exception) - { - m_log.Info("[REGION DB]: Caught fill error on regionsettings table"); - } - return; - } - } - - public void Dispose() - { - if (m_conn != null) - { - m_conn.Close(); - m_conn = null; - } - if (ds != null) - { - ds.Dispose(); - ds = null; - } - if (primDa != null) - { - primDa.Dispose(); - primDa = null; - } - if (shapeDa != null) - { - shapeDa.Dispose(); - shapeDa = null; - } - if (itemsDa != null) - { - itemsDa.Dispose(); - itemsDa = null; - } - if (terrainDa != null) - { - terrainDa.Dispose(); - terrainDa = null; - } - if (landDa != null) - { - landDa.Dispose(); - landDa = null; - } - if (landAccessListDa != null) - { - landAccessListDa.Dispose(); - landAccessListDa = null; - } - if (regionSettingsDa != null) - { - regionSettingsDa.Dispose(); - regionSettingsDa = null; - } - } - - public void StoreRegionSettings(RegionSettings rs) - { - lock (ds) - { - DataTable regionsettings = ds.Tables["regionsettings"]; - - DataRow settingsRow = regionsettings.Rows.Find(rs.RegionUUID.ToString()); - if (settingsRow == null) - { - settingsRow = regionsettings.NewRow(); - fillRegionSettingsRow(settingsRow, rs); - regionsettings.Rows.Add(settingsRow); - } - else - { - fillRegionSettingsRow(settingsRow, rs); - } - - Commit(); - } - } - public RegionLightShareData LoadRegionWindlightSettings(UUID regionUUID) - { - //This connector doesn't support the windlight module yet - //Return default LL windlight settings - return new RegionLightShareData(); - } - public void StoreRegionWindlightSettings(RegionLightShareData wl) - { - //This connector doesn't support the windlight module yet - } - public RegionSettings LoadRegionSettings(UUID regionUUID) - { - lock (ds) - { - DataTable regionsettings = ds.Tables["regionsettings"]; - - string searchExp = "regionUUID = '" + regionUUID.ToString() + "'"; - DataRow[] rawsettings = regionsettings.Select(searchExp); - if (rawsettings.Length == 0) - { - RegionSettings rs = new RegionSettings(); - rs.RegionUUID = regionUUID; - rs.OnSave += StoreRegionSettings; - - StoreRegionSettings(rs); - - return rs; - } - DataRow row = rawsettings[0]; - - RegionSettings newSettings = buildRegionSettings(row); - newSettings.OnSave += StoreRegionSettings; - - return newSettings; - } - } - - /// - /// Adds an object into region storage - /// - /// the object - /// the region UUID - public void StoreObject(SceneObjectGroup obj, UUID regionUUID) - { - uint flags = obj.RootPart.GetEffectiveObjectFlags(); - - // Eligibility check - // - if ((flags & (uint)PrimFlags.Temporary) != 0) - return; - if ((flags & (uint)PrimFlags.TemporaryOnRez) != 0) - return; - - lock (ds) - { - foreach (SceneObjectPart prim in obj.Children.Values) - { -// m_log.Info("[REGION DB]: Adding obj: " + obj.UUID + " to region: " + regionUUID); - addPrim(prim, obj.UUID, regionUUID); - } - } - - Commit(); - // m_log.Info("[Dump of prims]: " + ds.GetXml()); - } - - /// - /// Removes an object from region storage - /// - /// the object - /// the region UUID - public void RemoveObject(UUID obj, UUID regionUUID) - { - // m_log.InfoFormat("[REGION DB]: Removing obj: {0} from region: {1}", obj.Guid, regionUUID); - - DataTable prims = ds.Tables["prims"]; - DataTable shapes = ds.Tables["primshapes"]; - - string selectExp = "SceneGroupID = '" + obj + "' and RegionUUID = '" + regionUUID + "'"; - lock (ds) - { - DataRow[] primRows = prims.Select(selectExp); - foreach (DataRow row in primRows) - { - // Remove shape rows - UUID uuid = new UUID((string) row["UUID"]); - DataRow shapeRow = shapes.Rows.Find(uuid.ToString()); - if (shapeRow != null) - { - shapeRow.Delete(); - } - - RemoveItems(uuid); - - // Remove prim row - row.Delete(); - } - } - - Commit(); - } - - /// - /// Remove all persisted items of the given prim. - /// The caller must acquire the necessrary synchronization locks and commit or rollback changes. - /// - /// The item UUID - private void RemoveItems(UUID uuid) - { - DataTable items = ds.Tables["primitems"]; - - String sql = String.Format("primID = '{0}'", uuid); - DataRow[] itemRows = items.Select(sql); - - foreach (DataRow itemRow in itemRows) - { - itemRow.Delete(); - } - } - - /// - /// Load persisted objects from region storage. - /// - /// The region UUID - /// List of loaded groups - public List LoadObjects(UUID regionUUID) - { - Dictionary createdObjects = new Dictionary(); - - List retvals = new List(); - - DataTable prims = ds.Tables["prims"]; - DataTable shapes = ds.Tables["primshapes"]; - - string byRegion = "RegionUUID = '" + regionUUID + "'"; - - lock (ds) - { - DataRow[] primsForRegion = prims.Select(byRegion); - m_log.Info("[REGION DB]: Loaded " + primsForRegion.Length + " prims for region: " + regionUUID); - - // First, create all groups - foreach (DataRow primRow in primsForRegion) - { - try - { - SceneObjectPart prim = null; - - string uuid = (string) primRow["UUID"]; - string objID = (string) primRow["SceneGroupID"]; - - if (uuid == objID) //is new SceneObjectGroup ? - { - prim = buildPrim(primRow); - DataRow shapeRow = shapes.Rows.Find(prim.UUID.ToString()); - if (shapeRow != null) - { - prim.Shape = buildShape(shapeRow); - } - else - { - m_log.Info( - "[REGION DB]: No shape found for prim in storage, so setting default box shape"); - prim.Shape = PrimitiveBaseShape.Default; - } - - SceneObjectGroup group = new SceneObjectGroup(prim); - createdObjects.Add(group.UUID, group); - retvals.Add(group); - LoadItems(prim); - } - } - catch (Exception e) - { - m_log.Error("[REGION DB]: Failed create prim object in new group, exception and data follows"); - m_log.Info("[REGION DB]: " + e.ToString()); - foreach (DataColumn col in prims.Columns) - { - m_log.Info("[REGION DB]: Col: " + col.ColumnName + " => " + primRow[col]); - } - } - } - - // Now fill the groups with part data - foreach (DataRow primRow in primsForRegion) - { - try - { - SceneObjectPart prim = null; - - string uuid = (string) primRow["UUID"]; - string objID = (string) primRow["SceneGroupID"]; - if (uuid != objID) //is new SceneObjectGroup ? - { - prim = buildPrim(primRow); - DataRow shapeRow = shapes.Rows.Find(prim.UUID.ToString()); - if (shapeRow != null) - { - prim.Shape = buildShape(shapeRow); - } - else - { - m_log.Warn( - "[REGION DB]: No shape found for prim in storage, so setting default box shape"); - prim.Shape = PrimitiveBaseShape.Default; - } - - createdObjects[new UUID(objID)].AddPart(prim); - LoadItems(prim); - } - } - catch (Exception e) - { - m_log.Error("[REGION DB]: Failed create prim object in group, exception and data follows"); - m_log.Info("[REGION DB]: " + e.ToString()); - foreach (DataColumn col in prims.Columns) - { - m_log.Info("[REGION DB]: Col: " + col.ColumnName + " => " + primRow[col]); - } - } - } - } - return retvals; - } - - /// - /// Load in a prim's persisted inventory. - /// - /// the prim - private void LoadItems(SceneObjectPart prim) - { - //m_log.DebugFormat("[DATASTORE]: Loading inventory for {0}, {1}", prim.Name, prim.UUID); - - DataTable dbItems = ds.Tables["primitems"]; - String sql = String.Format("primID = '{0}'", prim.UUID.ToString()); - DataRow[] dbItemRows = dbItems.Select(sql); - IList inventory = new List(); - - foreach (DataRow row in dbItemRows) - { - TaskInventoryItem item = buildItem(row); - inventory.Add(item); - - //m_log.DebugFormat("[DATASTORE]: Restored item {0}, {1}", item.Name, item.ItemID); - } - - prim.Inventory.RestoreInventoryItems(inventory); - } - - /// - /// Store a terrain revision in region storage - /// - /// terrain heightfield - /// region UUID - public void StoreTerrain(double[,] ter, UUID regionID) - { - lock (ds) - { - int revision = Util.UnixTimeSinceEpoch(); - - // This is added to get rid of the infinitely growing - // terrain databases which negatively impact on SQLite - // over time. Before reenabling this feature there - // needs to be a limitter put on the number of - // revisions in the database, as this old - // implementation is a DOS attack waiting to happen. - - using ( - SqliteCommand cmd = - new SqliteCommand("delete from terrain where RegionUUID=:RegionUUID and Revision <= :Revision", - m_conn)) - { - cmd.Parameters.Add(new SqliteParameter(":RegionUUID", regionID.ToString())); - cmd.Parameters.Add(new SqliteParameter(":Revision", revision)); - cmd.ExecuteNonQuery(); - } - - // the following is an work around for .NET. The perf - // issues associated with it aren't as bad as you think. - m_log.Info("[REGION DB]: Storing terrain revision r" + revision.ToString()); - String sql = "insert into terrain(RegionUUID, Revision, Heightfield)" + - " values(:RegionUUID, :Revision, :Heightfield)"; - - using (SqliteCommand cmd = new SqliteCommand(sql, m_conn)) - { - cmd.Parameters.Add(new SqliteParameter(":RegionUUID", regionID.ToString())); - cmd.Parameters.Add(new SqliteParameter(":Revision", revision)); - cmd.Parameters.Add(new SqliteParameter(":Heightfield", serializeTerrain(ter))); - cmd.ExecuteNonQuery(); - } - } - } - - /// - /// Load the latest terrain revision from region storage - /// - /// the region UUID - /// Heightfield data - public double[,] LoadTerrain(UUID regionID) - { - lock (ds) - { - double[,] terret = new double[(int)Constants.RegionSize, (int)Constants.RegionSize]; - terret.Initialize(); - - String sql = "select RegionUUID, Revision, Heightfield from terrain" + - " where RegionUUID=:RegionUUID order by Revision desc"; - - using (SqliteCommand cmd = new SqliteCommand(sql, m_conn)) - { - cmd.Parameters.Add(new SqliteParameter(":RegionUUID", regionID.ToString())); - - using (IDataReader row = cmd.ExecuteReader()) - { - int rev = 0; - if (row.Read()) - { - // TODO: put this into a function - using (MemoryStream str = new MemoryStream((byte[])row["Heightfield"])) - { - using (BinaryReader br = new BinaryReader(str)) - { - for (int x = 0; x < (int)Constants.RegionSize; x++) - { - for (int y = 0; y < (int)Constants.RegionSize; y++) - { - terret[x, y] = br.ReadDouble(); - } - } - } - } - rev = (int) row["Revision"]; - } - else - { - m_log.Info("[REGION DB]: No terrain found for region"); - return null; - } - - m_log.Info("[REGION DB]: Loaded terrain revision r" + rev.ToString()); - } - } - return terret; - } - } - - /// - /// - /// - /// - public void RemoveLandObject(UUID globalID) - { - lock (ds) - { - // Can't use blanket SQL statements when using SqlAdapters unless you re-read the data into the adapter - // after you're done. - // replaced below code with the SqliteAdapter version. - //using (SqliteCommand cmd = new SqliteCommand("delete from land where UUID=:UUID", m_conn)) - //{ - // cmd.Parameters.Add(new SqliteParameter(":UUID", globalID.ToString())); - // cmd.ExecuteNonQuery(); - //} - - //using (SqliteCommand cmd = new SqliteCommand("delete from landaccesslist where LandUUID=:UUID", m_conn)) - //{ - // cmd.Parameters.Add(new SqliteParameter(":UUID", globalID.ToString())); - // cmd.ExecuteNonQuery(); - //} - - DataTable land = ds.Tables["land"]; - DataTable landaccesslist = ds.Tables["landaccesslist"]; - DataRow landRow = land.Rows.Find(globalID.ToString()); - if (landRow != null) - { - land.Rows.Remove(landRow); - } - List rowsToDelete = new List(); - foreach (DataRow rowToCheck in landaccesslist.Rows) - { - if (rowToCheck["LandUUID"].ToString() == globalID.ToString()) - rowsToDelete.Add(rowToCheck); - } - for (int iter = 0; iter < rowsToDelete.Count; iter++) - { - landaccesslist.Rows.Remove(rowsToDelete[iter]); - } - - - } - Commit(); - } - - /// - /// - /// - /// - public void StoreLandObject(ILandObject parcel) - { - lock (ds) - { - DataTable land = ds.Tables["land"]; - DataTable landaccesslist = ds.Tables["landaccesslist"]; - - DataRow landRow = land.Rows.Find(parcel.LandData.GlobalID.ToString()); - if (landRow == null) - { - landRow = land.NewRow(); - fillLandRow(landRow, parcel.LandData, parcel.RegionUUID); - land.Rows.Add(landRow); - } - else - { - fillLandRow(landRow, parcel.LandData, parcel.RegionUUID); - } - - // I know this caused someone issues before, but OpenSim is unusable if we leave this stuff around - //using (SqliteCommand cmd = new SqliteCommand("delete from landaccesslist where LandUUID=:LandUUID", m_conn)) - //{ - // cmd.Parameters.Add(new SqliteParameter(":LandUUID", parcel.LandData.GlobalID.ToString())); - // cmd.ExecuteNonQuery(); - -// } - - // This is the slower.. but more appropriate thing to do - - // We can't modify the table with direct queries before calling Commit() and re-filling them. - List rowsToDelete = new List(); - foreach (DataRow rowToCheck in landaccesslist.Rows) - { - if (rowToCheck["LandUUID"].ToString() == parcel.LandData.GlobalID.ToString()) - rowsToDelete.Add(rowToCheck); - } - for (int iter = 0; iter < rowsToDelete.Count; iter++) - { - landaccesslist.Rows.Remove(rowsToDelete[iter]); - } - rowsToDelete.Clear(); - foreach (ParcelManager.ParcelAccessEntry entry in parcel.LandData.ParcelAccessList) - { - DataRow newAccessRow = landaccesslist.NewRow(); - fillLandAccessRow(newAccessRow, entry, parcel.LandData.GlobalID); - landaccesslist.Rows.Add(newAccessRow); - } - } - - Commit(); - } - - /// - /// - /// - /// - /// - public List LoadLandObjects(UUID regionUUID) - { - List landDataForRegion = new List(); - lock (ds) - { - DataTable land = ds.Tables["land"]; - DataTable landaccesslist = ds.Tables["landaccesslist"]; - string searchExp = "RegionUUID = '" + regionUUID + "'"; - DataRow[] rawDataForRegion = land.Select(searchExp); - foreach (DataRow rawDataLand in rawDataForRegion) - { - LandData newLand = buildLandData(rawDataLand); - string accessListSearchExp = "LandUUID = '" + newLand.GlobalID + "'"; - DataRow[] rawDataForLandAccessList = landaccesslist.Select(accessListSearchExp); - foreach (DataRow rawDataLandAccess in rawDataForLandAccessList) - { - newLand.ParcelAccessList.Add(buildLandAccessData(rawDataLandAccess)); - } - - landDataForRegion.Add(newLand); - } - } - return landDataForRegion; - } - - /// - /// - /// - public void Commit() - { - lock (ds) - { - primDa.Update(ds, "prims"); - shapeDa.Update(ds, "primshapes"); - - itemsDa.Update(ds, "primitems"); - - terrainDa.Update(ds, "terrain"); - landDa.Update(ds, "land"); - landAccessListDa.Update(ds, "landaccesslist"); - try - { - regionSettingsDa.Update(ds, "regionsettings"); - } - catch (SqliteExecutionException SqlEx) - { - if (SqlEx.Message.Contains("logic error")) - { - throw new Exception( - "There was a SQL error or connection string configuration error when saving the region settings. This could be a bug, it could also happen if ConnectionString is defined in the [DatabaseService] section of StandaloneCommon.ini in the config_include folder. This could also happen if the config_include folder doesn't exist or if the OpenSim.ini [Architecture] section isn't set. If this is your first time running OpenSimulator, please restart the simulator and bug a developer to fix this!", - SqlEx); - } - else - { - throw SqlEx; - } - } - ds.AcceptChanges(); - } - } - - /// - /// See - /// - public void Shutdown() - { - Commit(); - } - - /*********************************************************************** - * - * Database Definition Functions - * - * This should be db agnostic as we define them in ADO.NET terms - * - **********************************************************************/ - - /// - /// - /// - /// - /// - /// - private static void createCol(DataTable dt, string name, Type type) - { - DataColumn col = new DataColumn(name, type); - dt.Columns.Add(col); - } - - /// - /// Creates the "terrain" table - /// - /// terrain table DataTable - private static DataTable createTerrainTable() - { - DataTable terrain = new DataTable("terrain"); - - createCol(terrain, "RegionUUID", typeof (String)); - createCol(terrain, "Revision", typeof (Int32)); - createCol(terrain, "Heightfield", typeof (Byte[])); - - return terrain; - } - - /// - /// Creates the "prims" table - /// - /// prim table DataTable - private static DataTable createPrimTable() - { - DataTable prims = new DataTable("prims"); - - createCol(prims, "UUID", typeof (String)); - createCol(prims, "RegionUUID", typeof (String)); - createCol(prims, "CreationDate", typeof (Int32)); - createCol(prims, "Name", typeof (String)); - createCol(prims, "SceneGroupID", typeof (String)); - // various text fields - createCol(prims, "Text", typeof (String)); - createCol(prims, "ColorR", typeof (Int32)); - createCol(prims, "ColorG", typeof (Int32)); - createCol(prims, "ColorB", typeof (Int32)); - createCol(prims, "ColorA", typeof (Int32)); - createCol(prims, "Description", typeof (String)); - createCol(prims, "SitName", typeof (String)); - createCol(prims, "TouchName", typeof (String)); - // permissions - createCol(prims, "ObjectFlags", typeof (Int32)); - createCol(prims, "CreatorID", typeof (String)); - createCol(prims, "OwnerID", typeof (String)); - createCol(prims, "GroupID", typeof (String)); - createCol(prims, "LastOwnerID", typeof (String)); - createCol(prims, "OwnerMask", typeof (Int32)); - createCol(prims, "NextOwnerMask", typeof (Int32)); - createCol(prims, "GroupMask", typeof (Int32)); - createCol(prims, "EveryoneMask", typeof (Int32)); - createCol(prims, "BaseMask", typeof (Int32)); - // vectors - createCol(prims, "PositionX", typeof (Double)); - createCol(prims, "PositionY", typeof (Double)); - createCol(prims, "PositionZ", typeof (Double)); - createCol(prims, "GroupPositionX", typeof (Double)); - createCol(prims, "GroupPositionY", typeof (Double)); - createCol(prims, "GroupPositionZ", typeof (Double)); - createCol(prims, "VelocityX", typeof (Double)); - createCol(prims, "VelocityY", typeof (Double)); - createCol(prims, "VelocityZ", typeof (Double)); - createCol(prims, "AngularVelocityX", typeof (Double)); - createCol(prims, "AngularVelocityY", typeof (Double)); - createCol(prims, "AngularVelocityZ", typeof (Double)); - createCol(prims, "AccelerationX", typeof (Double)); - createCol(prims, "AccelerationY", typeof (Double)); - createCol(prims, "AccelerationZ", typeof (Double)); - // quaternions - createCol(prims, "RotationX", typeof (Double)); - createCol(prims, "RotationY", typeof (Double)); - createCol(prims, "RotationZ", typeof (Double)); - createCol(prims, "RotationW", typeof (Double)); - - // sit target - createCol(prims, "SitTargetOffsetX", typeof (Double)); - createCol(prims, "SitTargetOffsetY", typeof (Double)); - createCol(prims, "SitTargetOffsetZ", typeof (Double)); - - createCol(prims, "SitTargetOrientW", typeof (Double)); - createCol(prims, "SitTargetOrientX", typeof (Double)); - createCol(prims, "SitTargetOrientY", typeof (Double)); - createCol(prims, "SitTargetOrientZ", typeof (Double)); - - createCol(prims, "PayPrice", typeof(Int32)); - createCol(prims, "PayButton1", typeof(Int32)); - createCol(prims, "PayButton2", typeof(Int32)); - createCol(prims, "PayButton3", typeof(Int32)); - createCol(prims, "PayButton4", typeof(Int32)); - - createCol(prims, "LoopedSound", typeof(String)); - createCol(prims, "LoopedSoundGain", typeof(Double)); - createCol(prims, "TextureAnimation", typeof(String)); - createCol(prims, "ParticleSystem", typeof(String)); - - createCol(prims, "OmegaX", typeof(Double)); - createCol(prims, "OmegaY", typeof(Double)); - createCol(prims, "OmegaZ", typeof(Double)); - - createCol(prims, "CameraEyeOffsetX", typeof(Double)); - createCol(prims, "CameraEyeOffsetY", typeof(Double)); - createCol(prims, "CameraEyeOffsetZ", typeof(Double)); - - createCol(prims, "CameraAtOffsetX", typeof(Double)); - createCol(prims, "CameraAtOffsetY", typeof(Double)); - createCol(prims, "CameraAtOffsetZ", typeof(Double)); - - createCol(prims, "ForceMouselook", typeof(Int16)); - - createCol(prims, "ScriptAccessPin", typeof(Int32)); - - createCol(prims, "AllowedDrop", typeof(Int16)); - createCol(prims, "DieAtEdge", typeof(Int16)); - - createCol(prims, "SalePrice", typeof(Int32)); - createCol(prims, "SaleType", typeof(Int16)); - - // click action - createCol(prims, "ClickAction", typeof (Byte)); - - createCol(prims, "Material", typeof(Byte)); - - createCol(prims, "CollisionSound", typeof(String)); - createCol(prims, "CollisionSoundVolume", typeof(Double)); - - createCol(prims, "VolumeDetect", typeof(Int16)); - - // Add in contraints - prims.PrimaryKey = new DataColumn[] {prims.Columns["UUID"]}; - - return prims; - } - - /// - /// Creates "primshapes" table - /// - /// shape table DataTable - private static DataTable createShapeTable() - { - DataTable shapes = new DataTable("primshapes"); - createCol(shapes, "UUID", typeof (String)); - // shape is an enum - createCol(shapes, "Shape", typeof (Int32)); - // vectors - createCol(shapes, "ScaleX", typeof (Double)); - createCol(shapes, "ScaleY", typeof (Double)); - createCol(shapes, "ScaleZ", typeof (Double)); - // paths - createCol(shapes, "PCode", typeof (Int32)); - createCol(shapes, "PathBegin", typeof (Int32)); - createCol(shapes, "PathEnd", typeof (Int32)); - createCol(shapes, "PathScaleX", typeof (Int32)); - createCol(shapes, "PathScaleY", typeof (Int32)); - createCol(shapes, "PathShearX", typeof (Int32)); - createCol(shapes, "PathShearY", typeof (Int32)); - createCol(shapes, "PathSkew", typeof (Int32)); - createCol(shapes, "PathCurve", typeof (Int32)); - createCol(shapes, "PathRadiusOffset", typeof (Int32)); - createCol(shapes, "PathRevolutions", typeof (Int32)); - createCol(shapes, "PathTaperX", typeof (Int32)); - createCol(shapes, "PathTaperY", typeof (Int32)); - createCol(shapes, "PathTwist", typeof (Int32)); - createCol(shapes, "PathTwistBegin", typeof (Int32)); - // profile - createCol(shapes, "ProfileBegin", typeof (Int32)); - createCol(shapes, "ProfileEnd", typeof (Int32)); - createCol(shapes, "ProfileCurve", typeof (Int32)); - createCol(shapes, "ProfileHollow", typeof (Int32)); - createCol(shapes, "State", typeof(Int32)); - // text TODO: this isn't right, but I'm not sure the right - // way to specify this as a blob atm - createCol(shapes, "Texture", typeof (Byte[])); - createCol(shapes, "ExtraParams", typeof (Byte[])); - - shapes.PrimaryKey = new DataColumn[] {shapes.Columns["UUID"]}; - - return shapes; - } - - /// - /// creates "primitems" table - /// - /// item table DataTable - private static DataTable createItemsTable() - { - DataTable items = new DataTable("primitems"); - - createCol(items, "itemID", typeof (String)); - createCol(items, "primID", typeof (String)); - createCol(items, "assetID", typeof (String)); - createCol(items, "parentFolderID", typeof (String)); - - createCol(items, "invType", typeof (Int32)); - createCol(items, "assetType", typeof (Int32)); - - createCol(items, "name", typeof (String)); - createCol(items, "description", typeof (String)); - - createCol(items, "creationDate", typeof (Int64)); - createCol(items, "creatorID", typeof (String)); - createCol(items, "ownerID", typeof (String)); - createCol(items, "lastOwnerID", typeof (String)); - createCol(items, "groupID", typeof (String)); - - createCol(items, "nextPermissions", typeof (UInt32)); - createCol(items, "currentPermissions", typeof (UInt32)); - createCol(items, "basePermissions", typeof (UInt32)); - createCol(items, "everyonePermissions", typeof (UInt32)); - createCol(items, "groupPermissions", typeof (UInt32)); - createCol(items, "flags", typeof (UInt32)); - - items.PrimaryKey = new DataColumn[] { items.Columns["itemID"] }; - - return items; - } - - /// - /// Creates "land" table - /// - /// land table DataTable - private static DataTable createLandTable() - { - DataTable land = new DataTable("land"); - createCol(land, "UUID", typeof (String)); - createCol(land, "RegionUUID", typeof (String)); - createCol(land, "LocalLandID", typeof (UInt32)); - - // Bitmap is a byte[512] - createCol(land, "Bitmap", typeof (Byte[])); - - createCol(land, "Name", typeof (String)); - createCol(land, "Desc", typeof (String)); - createCol(land, "OwnerUUID", typeof (String)); - createCol(land, "IsGroupOwned", typeof (Boolean)); - createCol(land, "Area", typeof (Int32)); - createCol(land, "AuctionID", typeof (Int32)); //Unemplemented - createCol(land, "Category", typeof (Int32)); //Enum OpenMetaverse.Parcel.ParcelCategory - createCol(land, "ClaimDate", typeof (Int32)); - createCol(land, "ClaimPrice", typeof (Int32)); - createCol(land, "GroupUUID", typeof (string)); - createCol(land, "SalePrice", typeof (Int32)); - createCol(land, "LandStatus", typeof (Int32)); //Enum. OpenMetaverse.Parcel.ParcelStatus - createCol(land, "LandFlags", typeof (UInt32)); - createCol(land, "LandingType", typeof (Byte)); - createCol(land, "MediaAutoScale", typeof (Byte)); - createCol(land, "MediaTextureUUID", typeof (String)); - createCol(land, "MediaURL", typeof (String)); - createCol(land, "MusicURL", typeof (String)); - createCol(land, "PassHours", typeof (Double)); - createCol(land, "PassPrice", typeof (UInt32)); - createCol(land, "SnapshotUUID", typeof (String)); - createCol(land, "UserLocationX", typeof (Double)); - createCol(land, "UserLocationY", typeof (Double)); - createCol(land, "UserLocationZ", typeof (Double)); - createCol(land, "UserLookAtX", typeof (Double)); - createCol(land, "UserLookAtY", typeof (Double)); - createCol(land, "UserLookAtZ", typeof (Double)); - createCol(land, "AuthbuyerID", typeof(String)); - createCol(land, "OtherCleanTime", typeof(Int32)); - - land.PrimaryKey = new DataColumn[] {land.Columns["UUID"]}; - - return land; - } - - /// - /// create "landaccesslist" table - /// - /// Landacceslist DataTable - private static DataTable createLandAccessListTable() - { - DataTable landaccess = new DataTable("landaccesslist"); - createCol(landaccess, "LandUUID", typeof (String)); - createCol(landaccess, "AccessUUID", typeof (String)); - createCol(landaccess, "Flags", typeof (UInt32)); - - return landaccess; - } - - private static DataTable createRegionSettingsTable() - { - DataTable regionsettings = new DataTable("regionsettings"); - createCol(regionsettings, "regionUUID", typeof(String)); - createCol(regionsettings, "block_terraform", typeof (Int32)); - createCol(regionsettings, "block_fly", typeof (Int32)); - createCol(regionsettings, "allow_damage", typeof (Int32)); - createCol(regionsettings, "restrict_pushing", typeof (Int32)); - createCol(regionsettings, "allow_land_resell", typeof (Int32)); - createCol(regionsettings, "allow_land_join_divide", typeof (Int32)); - createCol(regionsettings, "block_show_in_search", typeof (Int32)); - createCol(regionsettings, "agent_limit", typeof (Int32)); - createCol(regionsettings, "object_bonus", typeof (Double)); - createCol(regionsettings, "maturity", typeof (Int32)); - createCol(regionsettings, "disable_scripts", typeof (Int32)); - createCol(regionsettings, "disable_collisions", typeof (Int32)); - createCol(regionsettings, "disable_physics", typeof (Int32)); - createCol(regionsettings, "terrain_texture_1", typeof(String)); - createCol(regionsettings, "terrain_texture_2", typeof(String)); - createCol(regionsettings, "terrain_texture_3", typeof(String)); - createCol(regionsettings, "terrain_texture_4", typeof(String)); - createCol(regionsettings, "elevation_1_nw", typeof (Double)); - createCol(regionsettings, "elevation_2_nw", typeof (Double)); - createCol(regionsettings, "elevation_1_ne", typeof (Double)); - createCol(regionsettings, "elevation_2_ne", typeof (Double)); - createCol(regionsettings, "elevation_1_se", typeof (Double)); - createCol(regionsettings, "elevation_2_se", typeof (Double)); - createCol(regionsettings, "elevation_1_sw", typeof (Double)); - createCol(regionsettings, "elevation_2_sw", typeof (Double)); - createCol(regionsettings, "water_height", typeof (Double)); - createCol(regionsettings, "terrain_raise_limit", typeof (Double)); - createCol(regionsettings, "terrain_lower_limit", typeof (Double)); - createCol(regionsettings, "use_estate_sun", typeof (Int32)); - createCol(regionsettings, "sandbox", typeof (Int32)); - createCol(regionsettings, "sunvectorx",typeof (Double)); - createCol(regionsettings, "sunvectory",typeof (Double)); - createCol(regionsettings, "sunvectorz",typeof (Double)); - createCol(regionsettings, "fixed_sun", typeof (Int32)); - createCol(regionsettings, "sun_position", typeof (Double)); - createCol(regionsettings, "covenant", typeof(String)); - regionsettings.PrimaryKey = new DataColumn[] { regionsettings.Columns["regionUUID"] }; - return regionsettings; - } - - /*********************************************************************** - * - * Convert between ADO.NET <=> OpenSim Objects - * - * These should be database independant - * - **********************************************************************/ - - /// - /// - /// - /// - /// - private SceneObjectPart buildPrim(DataRow row) - { - // Code commented. Uncomment to test the unit test inline. - - // The unit test mentions this commented code for the purposes - // of debugging a unit test failure - - // SceneObjectGroup sog = new SceneObjectGroup(); - // SceneObjectPart sop = new SceneObjectPart(); - // sop.LocalId = 1; - // sop.Name = "object1"; - // sop.Description = "object1"; - // sop.Text = ""; - // sop.SitName = ""; - // sop.TouchName = ""; - // sop.UUID = UUID.Random(); - // sop.Shape = PrimitiveBaseShape.Default; - // sog.SetRootPart(sop); - // Add breakpoint in above line. Check sop fields. - - // TODO: this doesn't work yet because something more - // interesting has to be done to actually get these values - // back out. Not enough time to figure it out yet. - - SceneObjectPart prim = new SceneObjectPart(); - prim.UUID = new UUID((String) row["UUID"]); - // explicit conversion of integers is required, which sort - // of sucks. No idea if there is a shortcut here or not. - prim.CreationDate = Convert.ToInt32(row["CreationDate"]); - prim.Name = row["Name"] == DBNull.Value ? string.Empty : (string)row["Name"]; - // various text fields - prim.Text = (String) row["Text"]; - prim.Color = Color.FromArgb(Convert.ToInt32(row["ColorA"]), - Convert.ToInt32(row["ColorR"]), - Convert.ToInt32(row["ColorG"]), - Convert.ToInt32(row["ColorB"])); - prim.Description = (String) row["Description"]; - prim.SitName = (String) row["SitName"]; - prim.TouchName = (String) row["TouchName"]; - // permissions - prim.Flags = (PrimFlags)Convert.ToUInt32(row["ObjectFlags"]); - prim.CreatorID = new UUID((String) row["CreatorID"]); - prim.OwnerID = new UUID((String) row["OwnerID"]); - prim.GroupID = new UUID((String) row["GroupID"]); - prim.LastOwnerID = new UUID((String) row["LastOwnerID"]); - prim.OwnerMask = Convert.ToUInt32(row["OwnerMask"]); - prim.NextOwnerMask = Convert.ToUInt32(row["NextOwnerMask"]); - prim.GroupMask = Convert.ToUInt32(row["GroupMask"]); - prim.EveryoneMask = Convert.ToUInt32(row["EveryoneMask"]); - prim.BaseMask = Convert.ToUInt32(row["BaseMask"]); - // vectors - prim.OffsetPosition = new Vector3( - Convert.ToSingle(row["PositionX"]), - Convert.ToSingle(row["PositionY"]), - Convert.ToSingle(row["PositionZ"]) - ); - prim.GroupPosition = new Vector3( - Convert.ToSingle(row["GroupPositionX"]), - Convert.ToSingle(row["GroupPositionY"]), - Convert.ToSingle(row["GroupPositionZ"]) - ); - prim.Velocity = new Vector3( - Convert.ToSingle(row["VelocityX"]), - Convert.ToSingle(row["VelocityY"]), - Convert.ToSingle(row["VelocityZ"]) - ); - prim.AngularVelocity = new Vector3( - Convert.ToSingle(row["AngularVelocityX"]), - Convert.ToSingle(row["AngularVelocityY"]), - Convert.ToSingle(row["AngularVelocityZ"]) - ); - prim.Acceleration = new Vector3( - Convert.ToSingle(row["AccelerationX"]), - Convert.ToSingle(row["AccelerationY"]), - Convert.ToSingle(row["AccelerationZ"]) - ); - // quaternions - prim.RotationOffset = new Quaternion( - Convert.ToSingle(row["RotationX"]), - Convert.ToSingle(row["RotationY"]), - Convert.ToSingle(row["RotationZ"]), - Convert.ToSingle(row["RotationW"]) - ); - - prim.SitTargetPositionLL = new Vector3( - Convert.ToSingle(row["SitTargetOffsetX"]), - Convert.ToSingle(row["SitTargetOffsetY"]), - Convert.ToSingle(row["SitTargetOffsetZ"])); - prim.SitTargetOrientationLL = new Quaternion( - Convert.ToSingle( - row["SitTargetOrientX"]), - Convert.ToSingle( - row["SitTargetOrientY"]), - Convert.ToSingle( - row["SitTargetOrientZ"]), - Convert.ToSingle( - row["SitTargetOrientW"])); - - prim.ClickAction = Convert.ToByte(row["ClickAction"]); - prim.PayPrice[0] = Convert.ToInt32(row["PayPrice"]); - prim.PayPrice[1] = Convert.ToInt32(row["PayButton1"]); - prim.PayPrice[2] = Convert.ToInt32(row["PayButton2"]); - prim.PayPrice[3] = Convert.ToInt32(row["PayButton3"]); - prim.PayPrice[4] = Convert.ToInt32(row["PayButton4"]); - - prim.Sound = new UUID(row["LoopedSound"].ToString()); - prim.SoundGain = Convert.ToSingle(row["LoopedSoundGain"]); - prim.SoundFlags = 1; // If it's persisted at all, it's looped - - if (!row.IsNull("TextureAnimation")) - prim.TextureAnimation = Convert.FromBase64String(row["TextureAnimation"].ToString()); - if (!row.IsNull("ParticleSystem")) - prim.ParticleSystem = Convert.FromBase64String(row["ParticleSystem"].ToString()); - - prim.AngularVelocity = new Vector3( - Convert.ToSingle(row["OmegaX"]), - Convert.ToSingle(row["OmegaY"]), - Convert.ToSingle(row["OmegaZ"]) - ); - - prim.SetCameraEyeOffset(new Vector3( - Convert.ToSingle(row["CameraEyeOffsetX"]), - Convert.ToSingle(row["CameraEyeOffsetY"]), - Convert.ToSingle(row["CameraEyeOffsetZ"]) - )); - - prim.SetCameraAtOffset(new Vector3( - Convert.ToSingle(row["CameraAtOffsetX"]), - Convert.ToSingle(row["CameraAtOffsetY"]), - Convert.ToSingle(row["CameraAtOffsetZ"]) - )); - - if (Convert.ToInt16(row["ForceMouselook"]) != 0) - prim.SetForceMouselook(true); - - prim.ScriptAccessPin = Convert.ToInt32(row["ScriptAccessPin"]); - - if (Convert.ToInt16(row["AllowedDrop"]) != 0) - prim.AllowedDrop = true; - - if (Convert.ToInt16(row["DieAtEdge"]) != 0) - prim.DIE_AT_EDGE = true; - - prim.SalePrice = Convert.ToInt32(row["SalePrice"]); - prim.ObjectSaleType = Convert.ToByte(row["SaleType"]); - - prim.Material = Convert.ToByte(row["Material"]); - - prim.CollisionSound = new UUID(row["CollisionSound"].ToString()); - prim.CollisionSoundVolume = Convert.ToSingle(row["CollisionSoundVolume"]); - - if (Convert.ToInt16(row["VolumeDetect"]) != 0) - prim.VolumeDetectActive = true; - - return prim; - } - - /// - /// Build a prim inventory item from the persisted data. - /// - /// - /// - private static TaskInventoryItem buildItem(DataRow row) - { - TaskInventoryItem taskItem = new TaskInventoryItem(); - - taskItem.ItemID = new UUID((String)row["itemID"]); - taskItem.ParentPartID = new UUID((String)row["primID"]); - taskItem.AssetID = new UUID((String)row["assetID"]); - taskItem.ParentID = new UUID((String)row["parentFolderID"]); - - taskItem.InvType = Convert.ToInt32(row["invType"]); - taskItem.Type = Convert.ToInt32(row["assetType"]); - - taskItem.Name = (String)row["name"]; - taskItem.Description = (String)row["description"]; - taskItem.CreationDate = Convert.ToUInt32(row["creationDate"]); - taskItem.CreatorID = new UUID((String)row["creatorID"]); - taskItem.OwnerID = new UUID((String)row["ownerID"]); - taskItem.LastOwnerID = new UUID((String)row["lastOwnerID"]); - taskItem.GroupID = new UUID((String)row["groupID"]); - - taskItem.NextPermissions = Convert.ToUInt32(row["nextPermissions"]); - taskItem.CurrentPermissions = Convert.ToUInt32(row["currentPermissions"]); - taskItem.BasePermissions = Convert.ToUInt32(row["basePermissions"]); - taskItem.EveryonePermissions = Convert.ToUInt32(row["everyonePermissions"]); - taskItem.GroupPermissions = Convert.ToUInt32(row["groupPermissions"]); - taskItem.Flags = Convert.ToUInt32(row["flags"]); - - return taskItem; - } - - /// - /// Build a Land Data from the persisted data. - /// - /// - /// - private LandData buildLandData(DataRow row) - { - LandData newData = new LandData(); - - newData.GlobalID = new UUID((String) row["UUID"]); - newData.LocalID = Convert.ToInt32(row["LocalLandID"]); - - // Bitmap is a byte[512] - newData.Bitmap = (Byte[]) row["Bitmap"]; - - newData.Name = (String) row["Name"]; - newData.Description = (String) row["Desc"]; - newData.OwnerID = (UUID)(String) row["OwnerUUID"]; - newData.IsGroupOwned = (Boolean) row["IsGroupOwned"]; - newData.Area = Convert.ToInt32(row["Area"]); - newData.AuctionID = Convert.ToUInt32(row["AuctionID"]); //Unemplemented - newData.Category = (ParcelCategory) Convert.ToInt32(row["Category"]); - //Enum OpenMetaverse.Parcel.ParcelCategory - newData.ClaimDate = Convert.ToInt32(row["ClaimDate"]); - newData.ClaimPrice = Convert.ToInt32(row["ClaimPrice"]); - newData.GroupID = new UUID((String) row["GroupUUID"]); - newData.SalePrice = Convert.ToInt32(row["SalePrice"]); - newData.Status = (ParcelStatus) Convert.ToInt32(row["LandStatus"]); - //Enum. OpenMetaverse.Parcel.ParcelStatus - newData.Flags = Convert.ToUInt32(row["LandFlags"]); - newData.LandingType = (Byte) row["LandingType"]; - newData.MediaAutoScale = (Byte) row["MediaAutoScale"]; - newData.MediaID = new UUID((String) row["MediaTextureUUID"]); - newData.MediaURL = (String) row["MediaURL"]; - newData.MusicURL = (String) row["MusicURL"]; - newData.PassHours = Convert.ToSingle(row["PassHours"]); - newData.PassPrice = Convert.ToInt32(row["PassPrice"]); - newData.SnapshotID = (UUID)(String) row["SnapshotUUID"]; - try - { - - newData.UserLocation = - new Vector3(Convert.ToSingle(row["UserLocationX"]), Convert.ToSingle(row["UserLocationY"]), - Convert.ToSingle(row["UserLocationZ"])); - newData.UserLookAt = - new Vector3(Convert.ToSingle(row["UserLookAtX"]), Convert.ToSingle(row["UserLookAtY"]), - Convert.ToSingle(row["UserLookAtZ"])); - - } - catch (InvalidCastException) - { - m_log.ErrorFormat("[PARCEL]: unable to get parcel telehub settings for {1}", newData.Name); - newData.UserLocation = Vector3.Zero; - newData.UserLookAt = Vector3.Zero; - } - newData.ParcelAccessList = new List(); - UUID authBuyerID = UUID.Zero; - - UUID.TryParse((string)row["AuthbuyerID"], out authBuyerID); - - newData.OtherCleanTime = Convert.ToInt32(row["OtherCleanTime"]); - - return newData; - } - - private RegionSettings buildRegionSettings(DataRow row) - { - RegionSettings newSettings = new RegionSettings(); - - newSettings.RegionUUID = new UUID((string) row["regionUUID"]); - newSettings.BlockTerraform = Convert.ToBoolean(row["block_terraform"]); - newSettings.AllowDamage = Convert.ToBoolean(row["allow_damage"]); - newSettings.BlockFly = Convert.ToBoolean(row["block_fly"]); - newSettings.RestrictPushing = Convert.ToBoolean(row["restrict_pushing"]); - newSettings.AllowLandResell = Convert.ToBoolean(row["allow_land_resell"]); - newSettings.AllowLandJoinDivide = Convert.ToBoolean(row["allow_land_join_divide"]); - newSettings.BlockShowInSearch = Convert.ToBoolean(row["block_show_in_search"]); - newSettings.AgentLimit = Convert.ToInt32(row["agent_limit"]); - newSettings.ObjectBonus = Convert.ToDouble(row["object_bonus"]); - newSettings.Maturity = Convert.ToInt32(row["maturity"]); - newSettings.DisableScripts = Convert.ToBoolean(row["disable_scripts"]); - newSettings.DisableCollisions = Convert.ToBoolean(row["disable_collisions"]); - newSettings.DisablePhysics = Convert.ToBoolean(row["disable_physics"]); - newSettings.TerrainTexture1 = new UUID((String) row["terrain_texture_1"]); - newSettings.TerrainTexture2 = new UUID((String) row["terrain_texture_2"]); - newSettings.TerrainTexture3 = new UUID((String) row["terrain_texture_3"]); - newSettings.TerrainTexture4 = new UUID((String) row["terrain_texture_4"]); - newSettings.Elevation1NW = Convert.ToDouble(row["elevation_1_nw"]); - newSettings.Elevation2NW = Convert.ToDouble(row["elevation_2_nw"]); - newSettings.Elevation1NE = Convert.ToDouble(row["elevation_1_ne"]); - newSettings.Elevation2NE = Convert.ToDouble(row["elevation_2_ne"]); - newSettings.Elevation1SE = Convert.ToDouble(row["elevation_1_se"]); - newSettings.Elevation2SE = Convert.ToDouble(row["elevation_2_se"]); - newSettings.Elevation1SW = Convert.ToDouble(row["elevation_1_sw"]); - newSettings.Elevation2SW = Convert.ToDouble(row["elevation_2_sw"]); - newSettings.WaterHeight = Convert.ToDouble(row["water_height"]); - newSettings.TerrainRaiseLimit = Convert.ToDouble(row["terrain_raise_limit"]); - newSettings.TerrainLowerLimit = Convert.ToDouble(row["terrain_lower_limit"]); - newSettings.UseEstateSun = Convert.ToBoolean(row["use_estate_sun"]); - newSettings.Sandbox = Convert.ToBoolean(row["sandbox"]); - newSettings.SunVector = new Vector3 ( - Convert.ToSingle(row["sunvectorx"]), - Convert.ToSingle(row["sunvectory"]), - Convert.ToSingle(row["sunvectorz"]) - ); - newSettings.FixedSun = Convert.ToBoolean(row["fixed_sun"]); - newSettings.SunPosition = Convert.ToDouble(row["sun_position"]); - newSettings.Covenant = new UUID((String) row["covenant"]); - - return newSettings; - } - - /// - /// Build a land access entry from the persisted data. - /// - /// - /// - private static ParcelManager.ParcelAccessEntry buildLandAccessData(DataRow row) - { - ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry(); - entry.AgentID = new UUID((string) row["AccessUUID"]); - entry.Flags = (AccessList) row["Flags"]; - entry.Time = new DateTime(); - return entry; - } - - /// - /// - /// - /// - /// - private static Array serializeTerrain(double[,] val) - { - MemoryStream str = new MemoryStream(((int)Constants.RegionSize * (int)Constants.RegionSize) *sizeof (double)); - BinaryWriter bw = new BinaryWriter(str); - - // TODO: COMPATIBILITY - Add byte-order conversions - for (int x = 0; x < (int)Constants.RegionSize; x++) - for (int y = 0; y < (int)Constants.RegionSize; y++) - bw.Write(val[x, y]); - - return str.ToArray(); - } - -// private void fillTerrainRow(DataRow row, UUID regionUUID, int rev, double[,] val) -// { -// row["RegionUUID"] = regionUUID; -// row["Revision"] = rev; - - // MemoryStream str = new MemoryStream(((int)Constants.RegionSize * (int)Constants.RegionSize)*sizeof (double)); -// BinaryWriter bw = new BinaryWriter(str); - -// // TODO: COMPATIBILITY - Add byte-order conversions - // for (int x = 0; x < (int)Constants.RegionSize; x++) - // for (int y = 0; y < (int)Constants.RegionSize; y++) -// bw.Write(val[x, y]); - -// row["Heightfield"] = str.ToArray(); -// } - - /// - /// - /// - /// - /// - /// - /// - private static void fillPrimRow(DataRow row, SceneObjectPart prim, UUID sceneGroupID, UUID regionUUID) - { - row["UUID"] = prim.UUID.ToString(); - row["RegionUUID"] = regionUUID.ToString(); - row["CreationDate"] = prim.CreationDate; - row["Name"] = prim.Name; - row["SceneGroupID"] = sceneGroupID.ToString(); - // the UUID of the root part for this SceneObjectGroup - // various text fields - row["Text"] = prim.Text; - row["Description"] = prim.Description; - row["SitName"] = prim.SitName; - row["TouchName"] = prim.TouchName; - // permissions - row["ObjectFlags"] = (uint)prim.Flags; - row["CreatorID"] = prim.CreatorID.ToString(); - row["OwnerID"] = prim.OwnerID.ToString(); - row["GroupID"] = prim.GroupID.ToString(); - row["LastOwnerID"] = prim.LastOwnerID.ToString(); - row["OwnerMask"] = prim.OwnerMask; - row["NextOwnerMask"] = prim.NextOwnerMask; - row["GroupMask"] = prim.GroupMask; - row["EveryoneMask"] = prim.EveryoneMask; - row["BaseMask"] = prim.BaseMask; - // vectors - row["PositionX"] = prim.OffsetPosition.X; - row["PositionY"] = prim.OffsetPosition.Y; - row["PositionZ"] = prim.OffsetPosition.Z; - row["GroupPositionX"] = prim.GroupPosition.X; - row["GroupPositionY"] = prim.GroupPosition.Y; - row["GroupPositionZ"] = prim.GroupPosition.Z; - row["VelocityX"] = prim.Velocity.X; - row["VelocityY"] = prim.Velocity.Y; - row["VelocityZ"] = prim.Velocity.Z; - row["AngularVelocityX"] = prim.AngularVelocity.X; - row["AngularVelocityY"] = prim.AngularVelocity.Y; - row["AngularVelocityZ"] = prim.AngularVelocity.Z; - row["AccelerationX"] = prim.Acceleration.X; - row["AccelerationY"] = prim.Acceleration.Y; - row["AccelerationZ"] = prim.Acceleration.Z; - // quaternions - row["RotationX"] = prim.RotationOffset.X; - row["RotationY"] = prim.RotationOffset.Y; - row["RotationZ"] = prim.RotationOffset.Z; - row["RotationW"] = prim.RotationOffset.W; - - // Sit target - Vector3 sitTargetPos = prim.SitTargetPositionLL; - row["SitTargetOffsetX"] = sitTargetPos.X; - row["SitTargetOffsetY"] = sitTargetPos.Y; - row["SitTargetOffsetZ"] = sitTargetPos.Z; - - Quaternion sitTargetOrient = prim.SitTargetOrientationLL; - row["SitTargetOrientW"] = sitTargetOrient.W; - row["SitTargetOrientX"] = sitTargetOrient.X; - row["SitTargetOrientY"] = sitTargetOrient.Y; - row["SitTargetOrientZ"] = sitTargetOrient.Z; - row["ColorR"] = Convert.ToInt32(prim.Color.R); - row["ColorG"] = Convert.ToInt32(prim.Color.G); - row["ColorB"] = Convert.ToInt32(prim.Color.B); - row["ColorA"] = Convert.ToInt32(prim.Color.A); - row["PayPrice"] = prim.PayPrice[0]; - row["PayButton1"] = prim.PayPrice[1]; - row["PayButton2"] = prim.PayPrice[2]; - row["PayButton3"] = prim.PayPrice[3]; - row["PayButton4"] = prim.PayPrice[4]; - - - row["TextureAnimation"] = Convert.ToBase64String(prim.TextureAnimation); - row["ParticleSystem"] = Convert.ToBase64String(prim.ParticleSystem); - - row["OmegaX"] = prim.AngularVelocity.X; - row["OmegaY"] = prim.AngularVelocity.Y; - row["OmegaZ"] = prim.AngularVelocity.Z; - - row["CameraEyeOffsetX"] = prim.GetCameraEyeOffset().X; - row["CameraEyeOffsetY"] = prim.GetCameraEyeOffset().Y; - row["CameraEyeOffsetZ"] = prim.GetCameraEyeOffset().Z; - - row["CameraAtOffsetX"] = prim.GetCameraAtOffset().X; - row["CameraAtOffsetY"] = prim.GetCameraAtOffset().Y; - row["CameraAtOffsetZ"] = prim.GetCameraAtOffset().Z; - - - if ((prim.SoundFlags & 1) != 0) // Looped - { - row["LoopedSound"] = prim.Sound.ToString(); - row["LoopedSoundGain"] = prim.SoundGain; - } - else - { - row["LoopedSound"] = UUID.Zero.ToString(); - row["LoopedSoundGain"] = 0.0f; - } - - if (prim.GetForceMouselook()) - row["ForceMouselook"] = 1; - else - row["ForceMouselook"] = 0; - - row["ScriptAccessPin"] = prim.ScriptAccessPin; - - if (prim.AllowedDrop) - row["AllowedDrop"] = 1; - else - row["AllowedDrop"] = 0; - - if (prim.DIE_AT_EDGE) - row["DieAtEdge"] = 1; - else - row["DieAtEdge"] = 0; - - row["SalePrice"] = prim.SalePrice; - row["SaleType"] = Convert.ToInt16(prim.ObjectSaleType); - - // click action - row["ClickAction"] = prim.ClickAction; - - row["SalePrice"] = prim.SalePrice; - row["Material"] = prim.Material; - - row["CollisionSound"] = prim.CollisionSound.ToString(); - row["CollisionSoundVolume"] = prim.CollisionSoundVolume; - if (prim.VolumeDetectActive) - row["VolumeDetect"] = 1; - else - row["VolumeDetect"] = 0; - - } - - /// - /// - /// - /// - /// - private static void fillItemRow(DataRow row, TaskInventoryItem taskItem) - { - row["itemID"] = taskItem.ItemID.ToString(); - row["primID"] = taskItem.ParentPartID.ToString(); - row["assetID"] = taskItem.AssetID.ToString(); - row["parentFolderID"] = taskItem.ParentID.ToString(); - - row["invType"] = taskItem.InvType; - row["assetType"] = taskItem.Type; - - row["name"] = taskItem.Name; - row["description"] = taskItem.Description; - row["creationDate"] = taskItem.CreationDate; - row["creatorID"] = taskItem.CreatorID.ToString(); - row["ownerID"] = taskItem.OwnerID.ToString(); - row["lastOwnerID"] = taskItem.LastOwnerID.ToString(); - row["groupID"] = taskItem.GroupID.ToString(); - row["nextPermissions"] = taskItem.NextPermissions; - row["currentPermissions"] = taskItem.CurrentPermissions; - row["basePermissions"] = taskItem.BasePermissions; - row["everyonePermissions"] = taskItem.EveryonePermissions; - row["groupPermissions"] = taskItem.GroupPermissions; - row["flags"] = taskItem.Flags; - } - - /// - /// - /// - /// - /// - /// - private static void fillLandRow(DataRow row, LandData land, UUID regionUUID) - { - row["UUID"] = land.GlobalID.ToString(); - row["RegionUUID"] = regionUUID.ToString(); - row["LocalLandID"] = land.LocalID; - - // Bitmap is a byte[512] - row["Bitmap"] = land.Bitmap; - - row["Name"] = land.Name; - row["Desc"] = land.Description; - row["OwnerUUID"] = land.OwnerID.ToString(); - row["IsGroupOwned"] = land.IsGroupOwned; - row["Area"] = land.Area; - row["AuctionID"] = land.AuctionID; //Unemplemented - row["Category"] = land.Category; //Enum OpenMetaverse.Parcel.ParcelCategory - row["ClaimDate"] = land.ClaimDate; - row["ClaimPrice"] = land.ClaimPrice; - row["GroupUUID"] = land.GroupID.ToString(); - row["SalePrice"] = land.SalePrice; - row["LandStatus"] = land.Status; //Enum. OpenMetaverse.Parcel.ParcelStatus - row["LandFlags"] = land.Flags; - row["LandingType"] = land.LandingType; - row["MediaAutoScale"] = land.MediaAutoScale; - row["MediaTextureUUID"] = land.MediaID.ToString(); - row["MediaURL"] = land.MediaURL; - row["MusicURL"] = land.MusicURL; - row["PassHours"] = land.PassHours; - row["PassPrice"] = land.PassPrice; - row["SnapshotUUID"] = land.SnapshotID.ToString(); - row["UserLocationX"] = land.UserLocation.X; - row["UserLocationY"] = land.UserLocation.Y; - row["UserLocationZ"] = land.UserLocation.Z; - row["UserLookAtX"] = land.UserLookAt.X; - row["UserLookAtY"] = land.UserLookAt.Y; - row["UserLookAtZ"] = land.UserLookAt.Z; - row["AuthbuyerID"] = land.AuthBuyerID.ToString(); - row["OtherCleanTime"] = land.OtherCleanTime; - } - - /// - /// - /// - /// - /// - /// - private static void fillLandAccessRow(DataRow row, ParcelManager.ParcelAccessEntry entry, UUID parcelID) - { - row["LandUUID"] = parcelID.ToString(); - row["AccessUUID"] = entry.AgentID.ToString(); - row["Flags"] = entry.Flags; - } - - private static void fillRegionSettingsRow(DataRow row, RegionSettings settings) - { - row["regionUUID"] = settings.RegionUUID.ToString(); - row["block_terraform"] = settings.BlockTerraform; - row["block_fly"] = settings.BlockFly; - row["allow_damage"] = settings.AllowDamage; - row["restrict_pushing"] = settings.RestrictPushing; - row["allow_land_resell"] = settings.AllowLandResell; - row["allow_land_join_divide"] = settings.AllowLandJoinDivide; - row["block_show_in_search"] = settings.BlockShowInSearch; - row["agent_limit"] = settings.AgentLimit; - row["object_bonus"] = settings.ObjectBonus; - row["maturity"] = settings.Maturity; - row["disable_scripts"] = settings.DisableScripts; - row["disable_collisions"] = settings.DisableCollisions; - row["disable_physics"] = settings.DisablePhysics; - row["terrain_texture_1"] = settings.TerrainTexture1.ToString(); - row["terrain_texture_2"] = settings.TerrainTexture2.ToString(); - row["terrain_texture_3"] = settings.TerrainTexture3.ToString(); - row["terrain_texture_4"] = settings.TerrainTexture4.ToString(); - row["elevation_1_nw"] = settings.Elevation1NW; - row["elevation_2_nw"] = settings.Elevation2NW; - row["elevation_1_ne"] = settings.Elevation1NE; - row["elevation_2_ne"] = settings.Elevation2NE; - row["elevation_1_se"] = settings.Elevation1SE; - row["elevation_2_se"] = settings.Elevation2SE; - row["elevation_1_sw"] = settings.Elevation1SW; - row["elevation_2_sw"] = settings.Elevation2SW; - row["water_height"] = settings.WaterHeight; - row["terrain_raise_limit"] = settings.TerrainRaiseLimit; - row["terrain_lower_limit"] = settings.TerrainLowerLimit; - row["use_estate_sun"] = settings.UseEstateSun; - row["Sandbox"] = settings.Sandbox; // database uses upper case S for sandbox - row["sunvectorx"] = settings.SunVector.X; - row["sunvectory"] = settings.SunVector.Y; - row["sunvectorz"] = settings.SunVector.Z; - row["fixed_sun"] = settings.FixedSun; - row["sun_position"] = settings.SunPosition; - row["covenant"] = settings.Covenant.ToString(); - } - - /// - /// - /// - /// - /// - private PrimitiveBaseShape buildShape(DataRow row) - { - PrimitiveBaseShape s = new PrimitiveBaseShape(); - s.Scale = new Vector3( - Convert.ToSingle(row["ScaleX"]), - Convert.ToSingle(row["ScaleY"]), - Convert.ToSingle(row["ScaleZ"]) - ); - // paths - s.PCode = Convert.ToByte(row["PCode"]); - s.PathBegin = Convert.ToUInt16(row["PathBegin"]); - s.PathEnd = Convert.ToUInt16(row["PathEnd"]); - s.PathScaleX = Convert.ToByte(row["PathScaleX"]); - s.PathScaleY = Convert.ToByte(row["PathScaleY"]); - s.PathShearX = Convert.ToByte(row["PathShearX"]); - s.PathShearY = Convert.ToByte(row["PathShearY"]); - s.PathSkew = Convert.ToSByte(row["PathSkew"]); - s.PathCurve = Convert.ToByte(row["PathCurve"]); - s.PathRadiusOffset = Convert.ToSByte(row["PathRadiusOffset"]); - s.PathRevolutions = Convert.ToByte(row["PathRevolutions"]); - s.PathTaperX = Convert.ToSByte(row["PathTaperX"]); - s.PathTaperY = Convert.ToSByte(row["PathTaperY"]); - s.PathTwist = Convert.ToSByte(row["PathTwist"]); - s.PathTwistBegin = Convert.ToSByte(row["PathTwistBegin"]); - // profile - s.ProfileBegin = Convert.ToUInt16(row["ProfileBegin"]); - s.ProfileEnd = Convert.ToUInt16(row["ProfileEnd"]); - s.ProfileCurve = Convert.ToByte(row["ProfileCurve"]); - s.ProfileHollow = Convert.ToUInt16(row["ProfileHollow"]); - s.State = Convert.ToByte(row["State"]); - - byte[] textureEntry = (byte[])row["Texture"]; - s.TextureEntry = textureEntry; - - s.ExtraParams = (byte[]) row["ExtraParams"]; - return s; - } - - /// - /// - /// - /// - /// - private static void fillShapeRow(DataRow row, SceneObjectPart prim) - { - PrimitiveBaseShape s = prim.Shape; - row["UUID"] = prim.UUID.ToString(); - // shape is an enum - row["Shape"] = 0; - // vectors - row["ScaleX"] = s.Scale.X; - row["ScaleY"] = s.Scale.Y; - row["ScaleZ"] = s.Scale.Z; - // paths - row["PCode"] = s.PCode; - row["PathBegin"] = s.PathBegin; - row["PathEnd"] = s.PathEnd; - row["PathScaleX"] = s.PathScaleX; - row["PathScaleY"] = s.PathScaleY; - row["PathShearX"] = s.PathShearX; - row["PathShearY"] = s.PathShearY; - row["PathSkew"] = s.PathSkew; - row["PathCurve"] = s.PathCurve; - row["PathRadiusOffset"] = s.PathRadiusOffset; - row["PathRevolutions"] = s.PathRevolutions; - row["PathTaperX"] = s.PathTaperX; - row["PathTaperY"] = s.PathTaperY; - row["PathTwist"] = s.PathTwist; - row["PathTwistBegin"] = s.PathTwistBegin; - // profile - row["ProfileBegin"] = s.ProfileBegin; - row["ProfileEnd"] = s.ProfileEnd; - row["ProfileCurve"] = s.ProfileCurve; - row["ProfileHollow"] = s.ProfileHollow; - row["State"] = s.State; - - row["Texture"] = s.TextureEntry; - row["ExtraParams"] = s.ExtraParams; - } - - /// - /// - /// - /// - /// - /// - private void addPrim(SceneObjectPart prim, UUID sceneGroupID, UUID regionUUID) - { - - DataTable prims = ds.Tables["prims"]; - DataTable shapes = ds.Tables["primshapes"]; - - DataRow primRow = prims.Rows.Find(prim.UUID.ToString()); - if (primRow == null) - { - primRow = prims.NewRow(); - fillPrimRow(primRow, prim, sceneGroupID, regionUUID); - prims.Rows.Add(primRow); - } - else - { - fillPrimRow(primRow, prim, sceneGroupID, regionUUID); - } - - DataRow shapeRow = shapes.Rows.Find(prim.UUID.ToString()); - if (shapeRow == null) - { - shapeRow = shapes.NewRow(); - fillShapeRow(shapeRow, prim); - shapes.Rows.Add(shapeRow); - } - else - { - fillShapeRow(shapeRow, prim); - } - } - - /// - /// see IRegionDatastore - /// - /// - /// - public void StorePrimInventory(UUID primID, ICollection items) - { - m_log.InfoFormat("[REGION DB]: Entered StorePrimInventory with prim ID {0}", primID); - - DataTable dbItems = ds.Tables["primitems"]; - - // For now, we're just going to crudely remove all the previous inventory items - // no matter whether they have changed or not, and replace them with the current set. - lock (ds) - { - RemoveItems(primID); - - // repalce with current inventory details - foreach (TaskInventoryItem newItem in items) - { -// m_log.InfoFormat( -// "[DATASTORE]: ", -// "Adding item {0}, {1} to prim ID {2}", -// newItem.Name, newItem.ItemID, newItem.ParentPartID); - - DataRow newItemRow = dbItems.NewRow(); - fillItemRow(newItemRow, newItem); - dbItems.Rows.Add(newItemRow); - } - } - - Commit(); - } - - /*********************************************************************** - * - * SQL Statement Creation Functions - * - * These functions create SQL statements for update, insert, and create. - * They can probably be factored later to have a db independant - * portion and a db specific portion - * - **********************************************************************/ - - /// - /// Create an insert command - /// - /// table name - /// data table - /// the created command - /// - /// This is subtle enough to deserve some commentary. - /// Instead of doing *lots* and *lots of hardcoded strings - /// for database definitions we'll use the fact that - /// realistically all insert statements look like "insert - /// into A(b, c) values(:b, :c) on the parameterized query - /// front. If we just have a list of b, c, etc... we can - /// generate these strings instead of typing them out. - /// - private static SqliteCommand createInsertCommand(string table, DataTable dt) - { - string[] cols = new string[dt.Columns.Count]; - for (int i = 0; i < dt.Columns.Count; i++) - { - DataColumn col = dt.Columns[i]; - cols[i] = col.ColumnName; - } - - string sql = "insert into " + table + "("; - sql += String.Join(", ", cols); - // important, the first ':' needs to be here, the rest get added in the join - sql += ") values (:"; - sql += String.Join(", :", cols); - sql += ")"; - SqliteCommand cmd = new SqliteCommand(sql); - - // this provides the binding for all our parameters, so - // much less code than it used to be - foreach (DataColumn col in dt.Columns) - { - cmd.Parameters.Add(createSqliteParameter(col.ColumnName, col.DataType)); - } - return cmd; - } - - - /// - /// create an update command - /// - /// table name - /// - /// - /// the created command - private static SqliteCommand createUpdateCommand(string table, string pk, DataTable dt) - { - string sql = "update " + table + " set "; - string subsql = String.Empty; - foreach (DataColumn col in dt.Columns) - { - if (subsql.Length > 0) - { - // a map function would rock so much here - subsql += ", "; - } - subsql += col.ColumnName + "= :" + col.ColumnName; - } - sql += subsql; - sql += " where " + pk; - SqliteCommand cmd = new SqliteCommand(sql); - - // this provides the binding for all our parameters, so - // much less code than it used to be - - foreach (DataColumn col in dt.Columns) - { - cmd.Parameters.Add(createSqliteParameter(col.ColumnName, col.DataType)); - } - return cmd; - } - - /// - /// create an update command - /// - /// table name - /// - /// - /// the created command - private static SqliteCommand createUpdateCommand(string table, string pk1, string pk2, DataTable dt) - { - string sql = "update " + table + " set "; - string subsql = String.Empty; - foreach (DataColumn col in dt.Columns) - { - if (subsql.Length > 0) - { - // a map function would rock so much here - subsql += ", "; - } - subsql += col.ColumnName + "= :" + col.ColumnName; - } - sql += subsql; - sql += " where " + pk1 + " and " + pk2; - SqliteCommand cmd = new SqliteCommand(sql); - - // this provides the binding for all our parameters, so - // much less code than it used to be - - foreach (DataColumn col in dt.Columns) - { - cmd.Parameters.Add(createSqliteParameter(col.ColumnName, col.DataType)); - } - return cmd; - } - - /// - /// - /// - /// Data Table - /// - // private static string defineTable(DataTable dt) - // { - // string sql = "create table " + dt.TableName + "("; - // string subsql = String.Empty; - // foreach (DataColumn col in dt.Columns) - // { - // if (subsql.Length > 0) - // { - // // a map function would rock so much here - // subsql += ",\n"; - // } - // subsql += col.ColumnName + " " + sqliteType(col.DataType); - // if (dt.PrimaryKey.Length > 0 && col == dt.PrimaryKey[0]) - // { - // subsql += " primary key"; - // } - // } - // sql += subsql; - // sql += ")"; - // return sql; - // } - - /*********************************************************************** - * - * Database Binding functions - * - * These will be db specific due to typing, and minor differences - * in databases. - * - **********************************************************************/ - - /// - /// This is a convenience function that collapses 5 repetitive - /// lines for defining SqliteParameters to 2 parameters: - /// column name and database type. - /// - /// It assumes certain conventions like :param as the param - /// name to replace in parametrized queries, and that source - /// version is always current version, both of which are fine - /// for us. - /// - ///a built sqlite parameter - private static SqliteParameter createSqliteParameter(string name, Type type) - { - SqliteParameter param = new SqliteParameter(); - param.ParameterName = ":" + name; - param.DbType = dbtypeFromType(type); - param.SourceColumn = name; - param.SourceVersion = DataRowVersion.Current; - return param; - } - - /// - /// - /// - /// - /// - private void setupPrimCommands(SqliteDataAdapter da, SqliteConnection conn) - { - da.InsertCommand = createInsertCommand("prims", ds.Tables["prims"]); - da.InsertCommand.Connection = conn; - - da.UpdateCommand = createUpdateCommand("prims", "UUID=:UUID", ds.Tables["prims"]); - da.UpdateCommand.Connection = conn; - - SqliteCommand delete = new SqliteCommand("delete from prims where UUID = :UUID"); - delete.Parameters.Add(createSqliteParameter("UUID", typeof (String))); - delete.Connection = conn; - da.DeleteCommand = delete; - } - - /// - /// - /// - /// - /// - private void setupItemsCommands(SqliteDataAdapter da, SqliteConnection conn) - { - da.InsertCommand = createInsertCommand("primitems", ds.Tables["primitems"]); - da.InsertCommand.Connection = conn; - - da.UpdateCommand = createUpdateCommand("primitems", "itemID = :itemID", ds.Tables["primitems"]); - da.UpdateCommand.Connection = conn; - - SqliteCommand delete = new SqliteCommand("delete from primitems where itemID = :itemID"); - delete.Parameters.Add(createSqliteParameter("itemID", typeof (String))); - delete.Connection = conn; - da.DeleteCommand = delete; - } - - /// - /// - /// - /// - /// - private void setupTerrainCommands(SqliteDataAdapter da, SqliteConnection conn) - { - da.InsertCommand = createInsertCommand("terrain", ds.Tables["terrain"]); - da.InsertCommand.Connection = conn; - } - - /// - /// - /// - /// - /// - private void setupLandCommands(SqliteDataAdapter da, SqliteConnection conn) - { - da.InsertCommand = createInsertCommand("land", ds.Tables["land"]); - da.InsertCommand.Connection = conn; - - da.UpdateCommand = createUpdateCommand("land", "UUID=:UUID", ds.Tables["land"]); - da.UpdateCommand.Connection = conn; - - SqliteCommand delete = new SqliteCommand("delete from land where UUID=:UUID"); - delete.Parameters.Add(createSqliteParameter("UUID", typeof(String))); - da.DeleteCommand = delete; - da.DeleteCommand.Connection = conn; - } - - /// - /// - /// - /// - /// - private void setupLandAccessCommands(SqliteDataAdapter da, SqliteConnection conn) - { - da.InsertCommand = createInsertCommand("landaccesslist", ds.Tables["landaccesslist"]); - da.InsertCommand.Connection = conn; - - da.UpdateCommand = createUpdateCommand("landaccesslist", "LandUUID=:landUUID", "AccessUUID=:AccessUUID", ds.Tables["landaccesslist"]); - da.UpdateCommand.Connection = conn; - - SqliteCommand delete = new SqliteCommand("delete from landaccesslist where LandUUID= :LandUUID and AccessUUID= :AccessUUID"); - delete.Parameters.Add(createSqliteParameter("LandUUID", typeof(String))); - delete.Parameters.Add(createSqliteParameter("AccessUUID", typeof(String))); - da.DeleteCommand = delete; - da.DeleteCommand.Connection = conn; - - } - - private void setupRegionSettingsCommands(SqliteDataAdapter da, SqliteConnection conn) - { - da.InsertCommand = createInsertCommand("regionsettings", ds.Tables["regionsettings"]); - da.InsertCommand.Connection = conn; - da.UpdateCommand = createUpdateCommand("regionsettings", "regionUUID=:regionUUID", ds.Tables["regionsettings"]); - da.UpdateCommand.Connection = conn; - } - - /// - /// - /// - /// - /// - private void setupShapeCommands(SqliteDataAdapter da, SqliteConnection conn) - { - da.InsertCommand = createInsertCommand("primshapes", ds.Tables["primshapes"]); - da.InsertCommand.Connection = conn; - - da.UpdateCommand = createUpdateCommand("primshapes", "UUID=:UUID", ds.Tables["primshapes"]); - da.UpdateCommand.Connection = conn; - - SqliteCommand delete = new SqliteCommand("delete from primshapes where UUID = :UUID"); - delete.Parameters.Add(createSqliteParameter("UUID", typeof (String))); - delete.Connection = conn; - da.DeleteCommand = delete; - } - - /*********************************************************************** - * - * Type conversion functions - * - **********************************************************************/ - - /// - /// Type conversion function - /// - /// - /// - private static DbType dbtypeFromType(Type type) - { - if (type == typeof (String)) - { - return DbType.String; - } - else if (type == typeof (Int32)) - { - return DbType.Int32; - } - else if (type == typeof (Double)) - { - return DbType.Double; - } - else if (type == typeof (Byte)) - { - return DbType.Byte; - } - else if (type == typeof (Double)) - { - return DbType.Double; - } - else if (type == typeof (Byte[])) - { - return DbType.Binary; - } - else - { - return DbType.String; - } - } - - } -} diff --git a/OpenSim/Data/SQLiteLegacy/SQLiteSimulationData.cs b/OpenSim/Data/SQLiteLegacy/SQLiteSimulationData.cs new file mode 100644 index 0000000..878117e --- /dev/null +++ b/OpenSim/Data/SQLiteLegacy/SQLiteSimulationData.cs @@ -0,0 +1,2261 @@ +/* + * Copyright (c) Contributors, http://opensimulator.org/ + * See CONTRIBUTORS.TXT for a full list of copyright holders. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the OpenSimulator Project nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +using System; +using System.Collections.Generic; +using System.Data; +using System.Drawing; +using System.IO; +using System.Reflection; +using log4net; +using Mono.Data.SqliteClient; +using OpenMetaverse; +using OpenSim.Framework; +using OpenSim.Region.Framework.Interfaces; +using OpenSim.Region.Framework.Scenes; + +namespace OpenSim.Data.SQLiteLegacy +{ + /// + /// A RegionData Interface to the SQLite database + /// + public class SQLiteSimulationData : ISimulationDataStore + { + private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + + private const string primSelect = "select * from prims"; + private const string shapeSelect = "select * from primshapes"; + private const string itemsSelect = "select * from primitems"; + private const string terrainSelect = "select * from terrain limit 1"; + private const string landSelect = "select * from land"; + private const string landAccessListSelect = "select distinct * from landaccesslist"; + private const string regionbanListSelect = "select * from regionban"; + private const string regionSettingsSelect = "select * from regionsettings"; + + private DataSet ds; + private SqliteDataAdapter primDa; + private SqliteDataAdapter shapeDa; + private SqliteDataAdapter itemsDa; + private SqliteDataAdapter terrainDa; + private SqliteDataAdapter landDa; + private SqliteDataAdapter landAccessListDa; + private SqliteDataAdapter regionSettingsDa; + + private SqliteConnection m_conn; + + private String m_connectionString; + + // Temporary attribute while this is experimental + + /*********************************************************************** + * + * Public Interface Functions + * + **********************************************************************/ + + /// + /// See IRegionDataStore + /// + /// Initialises RegionData Interface + /// Loads and initialises a new SQLite connection and maintains it. + /// + /// + /// the connection string + public void Initialise(string connectionString) + { + m_connectionString = connectionString; + + ds = new DataSet(); + + m_log.Info("[REGION DB]: Sqlite - connecting: " + connectionString); + m_conn = new SqliteConnection(m_connectionString); + m_conn.Open(); + + + + SqliteCommand primSelectCmd = new SqliteCommand(primSelect, m_conn); + primDa = new SqliteDataAdapter(primSelectCmd); + // SqliteCommandBuilder primCb = new SqliteCommandBuilder(primDa); + + SqliteCommand shapeSelectCmd = new SqliteCommand(shapeSelect, m_conn); + shapeDa = new SqliteDataAdapter(shapeSelectCmd); + // SqliteCommandBuilder shapeCb = new SqliteCommandBuilder(shapeDa); + + SqliteCommand itemsSelectCmd = new SqliteCommand(itemsSelect, m_conn); + itemsDa = new SqliteDataAdapter(itemsSelectCmd); + + SqliteCommand terrainSelectCmd = new SqliteCommand(terrainSelect, m_conn); + terrainDa = new SqliteDataAdapter(terrainSelectCmd); + + SqliteCommand landSelectCmd = new SqliteCommand(landSelect, m_conn); + landDa = new SqliteDataAdapter(landSelectCmd); + + SqliteCommand landAccessListSelectCmd = new SqliteCommand(landAccessListSelect, m_conn); + landAccessListDa = new SqliteDataAdapter(landAccessListSelectCmd); + + SqliteCommand regionSettingsSelectCmd = new SqliteCommand(regionSettingsSelect, m_conn); + regionSettingsDa = new SqliteDataAdapter(regionSettingsSelectCmd); + // This actually does the roll forward assembly stuff + Assembly assem = GetType().Assembly; + Migration m = new Migration(m_conn, assem, "RegionStore"); + m.Update(); + + lock (ds) + { + ds.Tables.Add(createPrimTable()); + setupPrimCommands(primDa, m_conn); + primDa.Fill(ds.Tables["prims"]); + + ds.Tables.Add(createShapeTable()); + setupShapeCommands(shapeDa, m_conn); + + ds.Tables.Add(createItemsTable()); + setupItemsCommands(itemsDa, m_conn); + itemsDa.Fill(ds.Tables["primitems"]); + + ds.Tables.Add(createTerrainTable()); + setupTerrainCommands(terrainDa, m_conn); + + ds.Tables.Add(createLandTable()); + setupLandCommands(landDa, m_conn); + + ds.Tables.Add(createLandAccessListTable()); + setupLandAccessCommands(landAccessListDa, m_conn); + + ds.Tables.Add(createRegionSettingsTable()); + + setupRegionSettingsCommands(regionSettingsDa, m_conn); + + // WORKAROUND: This is a work around for sqlite on + // windows, which gets really unhappy with blob columns + // that have no sample data in them. At some point we + // need to actually find a proper way to handle this. + try + { + shapeDa.Fill(ds.Tables["primshapes"]); + } + catch (Exception) + { + m_log.Info("[REGION DB]: Caught fill error on primshapes table"); + } + + try + { + terrainDa.Fill(ds.Tables["terrain"]); + } + catch (Exception) + { + m_log.Info("[REGION DB]: Caught fill error on terrain table"); + } + + try + { + landDa.Fill(ds.Tables["land"]); + } + catch (Exception) + { + m_log.Info("[REGION DB]: Caught fill error on land table"); + } + + try + { + landAccessListDa.Fill(ds.Tables["landaccesslist"]); + } + catch (Exception) + { + m_log.Info("[REGION DB]: Caught fill error on landaccesslist table"); + } + + try + { + regionSettingsDa.Fill(ds.Tables["regionsettings"]); + } + catch (Exception) + { + m_log.Info("[REGION DB]: Caught fill error on regionsettings table"); + } + return; + } + } + + public void Dispose() + { + if (m_conn != null) + { + m_conn.Close(); + m_conn = null; + } + if (ds != null) + { + ds.Dispose(); + ds = null; + } + if (primDa != null) + { + primDa.Dispose(); + primDa = null; + } + if (shapeDa != null) + { + shapeDa.Dispose(); + shapeDa = null; + } + if (itemsDa != null) + { + itemsDa.Dispose(); + itemsDa = null; + } + if (terrainDa != null) + { + terrainDa.Dispose(); + terrainDa = null; + } + if (landDa != null) + { + landDa.Dispose(); + landDa = null; + } + if (landAccessListDa != null) + { + landAccessListDa.Dispose(); + landAccessListDa = null; + } + if (regionSettingsDa != null) + { + regionSettingsDa.Dispose(); + regionSettingsDa = null; + } + } + + public void StoreRegionSettings(RegionSettings rs) + { + lock (ds) + { + DataTable regionsettings = ds.Tables["regionsettings"]; + + DataRow settingsRow = regionsettings.Rows.Find(rs.RegionUUID.ToString()); + if (settingsRow == null) + { + settingsRow = regionsettings.NewRow(); + fillRegionSettingsRow(settingsRow, rs); + regionsettings.Rows.Add(settingsRow); + } + else + { + fillRegionSettingsRow(settingsRow, rs); + } + + Commit(); + } + } + public RegionLightShareData LoadRegionWindlightSettings(UUID regionUUID) + { + //This connector doesn't support the windlight module yet + //Return default LL windlight settings + return new RegionLightShareData(); + } + public void StoreRegionWindlightSettings(RegionLightShareData wl) + { + //This connector doesn't support the windlight module yet + } + public RegionSettings LoadRegionSettings(UUID regionUUID) + { + lock (ds) + { + DataTable regionsettings = ds.Tables["regionsettings"]; + + string searchExp = "regionUUID = '" + regionUUID.ToString() + "'"; + DataRow[] rawsettings = regionsettings.Select(searchExp); + if (rawsettings.Length == 0) + { + RegionSettings rs = new RegionSettings(); + rs.RegionUUID = regionUUID; + rs.OnSave += StoreRegionSettings; + + StoreRegionSettings(rs); + + return rs; + } + DataRow row = rawsettings[0]; + + RegionSettings newSettings = buildRegionSettings(row); + newSettings.OnSave += StoreRegionSettings; + + return newSettings; + } + } + + /// + /// Adds an object into region storage + /// + /// the object + /// the region UUID + public void StoreObject(SceneObjectGroup obj, UUID regionUUID) + { + uint flags = obj.RootPart.GetEffectiveObjectFlags(); + + // Eligibility check + // + if ((flags & (uint)PrimFlags.Temporary) != 0) + return; + if ((flags & (uint)PrimFlags.TemporaryOnRez) != 0) + return; + + lock (ds) + { + foreach (SceneObjectPart prim in obj.Children.Values) + { +// m_log.Info("[REGION DB]: Adding obj: " + obj.UUID + " to region: " + regionUUID); + addPrim(prim, obj.UUID, regionUUID); + } + } + + Commit(); + // m_log.Info("[Dump of prims]: " + ds.GetXml()); + } + + /// + /// Removes an object from region storage + /// + /// the object + /// the region UUID + public void RemoveObject(UUID obj, UUID regionUUID) + { + // m_log.InfoFormat("[REGION DB]: Removing obj: {0} from region: {1}", obj.Guid, regionUUID); + + DataTable prims = ds.Tables["prims"]; + DataTable shapes = ds.Tables["primshapes"]; + + string selectExp = "SceneGroupID = '" + obj + "' and RegionUUID = '" + regionUUID + "'"; + lock (ds) + { + DataRow[] primRows = prims.Select(selectExp); + foreach (DataRow row in primRows) + { + // Remove shape rows + UUID uuid = new UUID((string) row["UUID"]); + DataRow shapeRow = shapes.Rows.Find(uuid.ToString()); + if (shapeRow != null) + { + shapeRow.Delete(); + } + + RemoveItems(uuid); + + // Remove prim row + row.Delete(); + } + } + + Commit(); + } + + /// + /// Remove all persisted items of the given prim. + /// The caller must acquire the necessrary synchronization locks and commit or rollback changes. + /// + /// The item UUID + private void RemoveItems(UUID uuid) + { + DataTable items = ds.Tables["primitems"]; + + String sql = String.Format("primID = '{0}'", uuid); + DataRow[] itemRows = items.Select(sql); + + foreach (DataRow itemRow in itemRows) + { + itemRow.Delete(); + } + } + + /// + /// Load persisted objects from region storage. + /// + /// The region UUID + /// List of loaded groups + public List LoadObjects(UUID regionUUID) + { + Dictionary createdObjects = new Dictionary(); + + List retvals = new List(); + + DataTable prims = ds.Tables["prims"]; + DataTable shapes = ds.Tables["primshapes"]; + + string byRegion = "RegionUUID = '" + regionUUID + "'"; + + lock (ds) + { + DataRow[] primsForRegion = prims.Select(byRegion); + m_log.Info("[REGION DB]: Loaded " + primsForRegion.Length + " prims for region: " + regionUUID); + + // First, create all groups + foreach (DataRow primRow in primsForRegion) + { + try + { + SceneObjectPart prim = null; + + string uuid = (string) primRow["UUID"]; + string objID = (string) primRow["SceneGroupID"]; + + if (uuid == objID) //is new SceneObjectGroup ? + { + prim = buildPrim(primRow); + DataRow shapeRow = shapes.Rows.Find(prim.UUID.ToString()); + if (shapeRow != null) + { + prim.Shape = buildShape(shapeRow); + } + else + { + m_log.Info( + "[REGION DB]: No shape found for prim in storage, so setting default box shape"); + prim.Shape = PrimitiveBaseShape.Default; + } + + SceneObjectGroup group = new SceneObjectGroup(prim); + createdObjects.Add(group.UUID, group); + retvals.Add(group); + LoadItems(prim); + } + } + catch (Exception e) + { + m_log.Error("[REGION DB]: Failed create prim object in new group, exception and data follows"); + m_log.Info("[REGION DB]: " + e.ToString()); + foreach (DataColumn col in prims.Columns) + { + m_log.Info("[REGION DB]: Col: " + col.ColumnName + " => " + primRow[col]); + } + } + } + + // Now fill the groups with part data + foreach (DataRow primRow in primsForRegion) + { + try + { + SceneObjectPart prim = null; + + string uuid = (string) primRow["UUID"]; + string objID = (string) primRow["SceneGroupID"]; + if (uuid != objID) //is new SceneObjectGroup ? + { + prim = buildPrim(primRow); + DataRow shapeRow = shapes.Rows.Find(prim.UUID.ToString()); + if (shapeRow != null) + { + prim.Shape = buildShape(shapeRow); + } + else + { + m_log.Warn( + "[REGION DB]: No shape found for prim in storage, so setting default box shape"); + prim.Shape = PrimitiveBaseShape.Default; + } + + createdObjects[new UUID(objID)].AddPart(prim); + LoadItems(prim); + } + } + catch (Exception e) + { + m_log.Error("[REGION DB]: Failed create prim object in group, exception and data follows"); + m_log.Info("[REGION DB]: " + e.ToString()); + foreach (DataColumn col in prims.Columns) + { + m_log.Info("[REGION DB]: Col: " + col.ColumnName + " => " + primRow[col]); + } + } + } + } + return retvals; + } + + /// + /// Load in a prim's persisted inventory. + /// + /// the prim + private void LoadItems(SceneObjectPart prim) + { + //m_log.DebugFormat("[DATASTORE]: Loading inventory for {0}, {1}", prim.Name, prim.UUID); + + DataTable dbItems = ds.Tables["primitems"]; + String sql = String.Format("primID = '{0}'", prim.UUID.ToString()); + DataRow[] dbItemRows = dbItems.Select(sql); + IList inventory = new List(); + + foreach (DataRow row in dbItemRows) + { + TaskInventoryItem item = buildItem(row); + inventory.Add(item); + + //m_log.DebugFormat("[DATASTORE]: Restored item {0}, {1}", item.Name, item.ItemID); + } + + prim.Inventory.RestoreInventoryItems(inventory); + } + + /// + /// Store a terrain revision in region storage + /// + /// terrain heightfield + /// region UUID + public void StoreTerrain(double[,] ter, UUID regionID) + { + lock (ds) + { + int revision = Util.UnixTimeSinceEpoch(); + + // This is added to get rid of the infinitely growing + // terrain databases which negatively impact on SQLite + // over time. Before reenabling this feature there + // needs to be a limitter put on the number of + // revisions in the database, as this old + // implementation is a DOS attack waiting to happen. + + using ( + SqliteCommand cmd = + new SqliteCommand("delete from terrain where RegionUUID=:RegionUUID and Revision <= :Revision", + m_conn)) + { + cmd.Parameters.Add(new SqliteParameter(":RegionUUID", regionID.ToString())); + cmd.Parameters.Add(new SqliteParameter(":Revision", revision)); + cmd.ExecuteNonQuery(); + } + + // the following is an work around for .NET. The perf + // issues associated with it aren't as bad as you think. + m_log.Info("[REGION DB]: Storing terrain revision r" + revision.ToString()); + String sql = "insert into terrain(RegionUUID, Revision, Heightfield)" + + " values(:RegionUUID, :Revision, :Heightfield)"; + + using (SqliteCommand cmd = new SqliteCommand(sql, m_conn)) + { + cmd.Parameters.Add(new SqliteParameter(":RegionUUID", regionID.ToString())); + cmd.Parameters.Add(new SqliteParameter(":Revision", revision)); + cmd.Parameters.Add(new SqliteParameter(":Heightfield", serializeTerrain(ter))); + cmd.ExecuteNonQuery(); + } + } + } + + /// + /// Load the latest terrain revision from region storage + /// + /// the region UUID + /// Heightfield data + public double[,] LoadTerrain(UUID regionID) + { + lock (ds) + { + double[,] terret = new double[(int)Constants.RegionSize, (int)Constants.RegionSize]; + terret.Initialize(); + + String sql = "select RegionUUID, Revision, Heightfield from terrain" + + " where RegionUUID=:RegionUUID order by Revision desc"; + + using (SqliteCommand cmd = new SqliteCommand(sql, m_conn)) + { + cmd.Parameters.Add(new SqliteParameter(":RegionUUID", regionID.ToString())); + + using (IDataReader row = cmd.ExecuteReader()) + { + int rev = 0; + if (row.Read()) + { + // TODO: put this into a function + using (MemoryStream str = new MemoryStream((byte[])row["Heightfield"])) + { + using (BinaryReader br = new BinaryReader(str)) + { + for (int x = 0; x < (int)Constants.RegionSize; x++) + { + for (int y = 0; y < (int)Constants.RegionSize; y++) + { + terret[x, y] = br.ReadDouble(); + } + } + } + } + rev = (int) row["Revision"]; + } + else + { + m_log.Info("[REGION DB]: No terrain found for region"); + return null; + } + + m_log.Info("[REGION DB]: Loaded terrain revision r" + rev.ToString()); + } + } + return terret; + } + } + + /// + /// + /// + /// + public void RemoveLandObject(UUID globalID) + { + lock (ds) + { + // Can't use blanket SQL statements when using SqlAdapters unless you re-read the data into the adapter + // after you're done. + // replaced below code with the SqliteAdapter version. + //using (SqliteCommand cmd = new SqliteCommand("delete from land where UUID=:UUID", m_conn)) + //{ + // cmd.Parameters.Add(new SqliteParameter(":UUID", globalID.ToString())); + // cmd.ExecuteNonQuery(); + //} + + //using (SqliteCommand cmd = new SqliteCommand("delete from landaccesslist where LandUUID=:UUID", m_conn)) + //{ + // cmd.Parameters.Add(new SqliteParameter(":UUID", globalID.ToString())); + // cmd.ExecuteNonQuery(); + //} + + DataTable land = ds.Tables["land"]; + DataTable landaccesslist = ds.Tables["landaccesslist"]; + DataRow landRow = land.Rows.Find(globalID.ToString()); + if (landRow != null) + { + land.Rows.Remove(landRow); + } + List rowsToDelete = new List(); + foreach (DataRow rowToCheck in landaccesslist.Rows) + { + if (rowToCheck["LandUUID"].ToString() == globalID.ToString()) + rowsToDelete.Add(rowToCheck); + } + for (int iter = 0; iter < rowsToDelete.Count; iter++) + { + landaccesslist.Rows.Remove(rowsToDelete[iter]); + } + + + } + Commit(); + } + + /// + /// + /// + /// + public void StoreLandObject(ILandObject parcel) + { + lock (ds) + { + DataTable land = ds.Tables["land"]; + DataTable landaccesslist = ds.Tables["landaccesslist"]; + + DataRow landRow = land.Rows.Find(parcel.LandData.GlobalID.ToString()); + if (landRow == null) + { + landRow = land.NewRow(); + fillLandRow(landRow, parcel.LandData, parcel.RegionUUID); + land.Rows.Add(landRow); + } + else + { + fillLandRow(landRow, parcel.LandData, parcel.RegionUUID); + } + + // I know this caused someone issues before, but OpenSim is unusable if we leave this stuff around + //using (SqliteCommand cmd = new SqliteCommand("delete from landaccesslist where LandUUID=:LandUUID", m_conn)) + //{ + // cmd.Parameters.Add(new SqliteParameter(":LandUUID", parcel.LandData.GlobalID.ToString())); + // cmd.ExecuteNonQuery(); + +// } + + // This is the slower.. but more appropriate thing to do + + // We can't modify the table with direct queries before calling Commit() and re-filling them. + List rowsToDelete = new List(); + foreach (DataRow rowToCheck in landaccesslist.Rows) + { + if (rowToCheck["LandUUID"].ToString() == parcel.LandData.GlobalID.ToString()) + rowsToDelete.Add(rowToCheck); + } + for (int iter = 0; iter < rowsToDelete.Count; iter++) + { + landaccesslist.Rows.Remove(rowsToDelete[iter]); + } + rowsToDelete.Clear(); + foreach (ParcelManager.ParcelAccessEntry entry in parcel.LandData.ParcelAccessList) + { + DataRow newAccessRow = landaccesslist.NewRow(); + fillLandAccessRow(newAccessRow, entry, parcel.LandData.GlobalID); + landaccesslist.Rows.Add(newAccessRow); + } + } + + Commit(); + } + + /// + /// + /// + /// + /// + public List LoadLandObjects(UUID regionUUID) + { + List landDataForRegion = new List(); + lock (ds) + { + DataTable land = ds.Tables["land"]; + DataTable landaccesslist = ds.Tables["landaccesslist"]; + string searchExp = "RegionUUID = '" + regionUUID + "'"; + DataRow[] rawDataForRegion = land.Select(searchExp); + foreach (DataRow rawDataLand in rawDataForRegion) + { + LandData newLand = buildLandData(rawDataLand); + string accessListSearchExp = "LandUUID = '" + newLand.GlobalID + "'"; + DataRow[] rawDataForLandAccessList = landaccesslist.Select(accessListSearchExp); + foreach (DataRow rawDataLandAccess in rawDataForLandAccessList) + { + newLand.ParcelAccessList.Add(buildLandAccessData(rawDataLandAccess)); + } + + landDataForRegion.Add(newLand); + } + } + return landDataForRegion; + } + + /// + /// + /// + public void Commit() + { + lock (ds) + { + primDa.Update(ds, "prims"); + shapeDa.Update(ds, "primshapes"); + + itemsDa.Update(ds, "primitems"); + + terrainDa.Update(ds, "terrain"); + landDa.Update(ds, "land"); + landAccessListDa.Update(ds, "landaccesslist"); + try + { + regionSettingsDa.Update(ds, "regionsettings"); + } + catch (SqliteExecutionException SqlEx) + { + if (SqlEx.Message.Contains("logic error")) + { + throw new Exception( + "There was a SQL error or connection string configuration error when saving the region settings. This could be a bug, it could also happen if ConnectionString is defined in the [DatabaseService] section of StandaloneCommon.ini in the config_include folder. This could also happen if the config_include folder doesn't exist or if the OpenSim.ini [Architecture] section isn't set. If this is your first time running OpenSimulator, please restart the simulator and bug a developer to fix this!", + SqlEx); + } + else + { + throw SqlEx; + } + } + ds.AcceptChanges(); + } + } + + /// + /// See + /// + public void Shutdown() + { + Commit(); + } + + /*********************************************************************** + * + * Database Definition Functions + * + * This should be db agnostic as we define them in ADO.NET terms + * + **********************************************************************/ + + /// + /// + /// + /// + /// + /// + private static void createCol(DataTable dt, string name, Type type) + { + DataColumn col = new DataColumn(name, type); + dt.Columns.Add(col); + } + + /// + /// Creates the "terrain" table + /// + /// terrain table DataTable + private static DataTable createTerrainTable() + { + DataTable terrain = new DataTable("terrain"); + + createCol(terrain, "RegionUUID", typeof (String)); + createCol(terrain, "Revision", typeof (Int32)); + createCol(terrain, "Heightfield", typeof (Byte[])); + + return terrain; + } + + /// + /// Creates the "prims" table + /// + /// prim table DataTable + private static DataTable createPrimTable() + { + DataTable prims = new DataTable("prims"); + + createCol(prims, "UUID", typeof (String)); + createCol(prims, "RegionUUID", typeof (String)); + createCol(prims, "CreationDate", typeof (Int32)); + createCol(prims, "Name", typeof (String)); + createCol(prims, "SceneGroupID", typeof (String)); + // various text fields + createCol(prims, "Text", typeof (String)); + createCol(prims, "ColorR", typeof (Int32)); + createCol(prims, "ColorG", typeof (Int32)); + createCol(prims, "ColorB", typeof (Int32)); + createCol(prims, "ColorA", typeof (Int32)); + createCol(prims, "Description", typeof (String)); + createCol(prims, "SitName", typeof (String)); + createCol(prims, "TouchName", typeof (String)); + // permissions + createCol(prims, "ObjectFlags", typeof (Int32)); + createCol(prims, "CreatorID", typeof (String)); + createCol(prims, "OwnerID", typeof (String)); + createCol(prims, "GroupID", typeof (String)); + createCol(prims, "LastOwnerID", typeof (String)); + createCol(prims, "OwnerMask", typeof (Int32)); + createCol(prims, "NextOwnerMask", typeof (Int32)); + createCol(prims, "GroupMask", typeof (Int32)); + createCol(prims, "EveryoneMask", typeof (Int32)); + createCol(prims, "BaseMask", typeof (Int32)); + // vectors + createCol(prims, "PositionX", typeof (Double)); + createCol(prims, "PositionY", typeof (Double)); + createCol(prims, "PositionZ", typeof (Double)); + createCol(prims, "GroupPositionX", typeof (Double)); + createCol(prims, "GroupPositionY", typeof (Double)); + createCol(prims, "GroupPositionZ", typeof (Double)); + createCol(prims, "VelocityX", typeof (Double)); + createCol(prims, "VelocityY", typeof (Double)); + createCol(prims, "VelocityZ", typeof (Double)); + createCol(prims, "AngularVelocityX", typeof (Double)); + createCol(prims, "AngularVelocityY", typeof (Double)); + createCol(prims, "AngularVelocityZ", typeof (Double)); + createCol(prims, "AccelerationX", typeof (Double)); + createCol(prims, "AccelerationY", typeof (Double)); + createCol(prims, "AccelerationZ", typeof (Double)); + // quaternions + createCol(prims, "RotationX", typeof (Double)); + createCol(prims, "RotationY", typeof (Double)); + createCol(prims, "RotationZ", typeof (Double)); + createCol(prims, "RotationW", typeof (Double)); + + // sit target + createCol(prims, "SitTargetOffsetX", typeof (Double)); + createCol(prims, "SitTargetOffsetY", typeof (Double)); + createCol(prims, "SitTargetOffsetZ", typeof (Double)); + + createCol(prims, "SitTargetOrientW", typeof (Double)); + createCol(prims, "SitTargetOrientX", typeof (Double)); + createCol(prims, "SitTargetOrientY", typeof (Double)); + createCol(prims, "SitTargetOrientZ", typeof (Double)); + + createCol(prims, "PayPrice", typeof(Int32)); + createCol(prims, "PayButton1", typeof(Int32)); + createCol(prims, "PayButton2", typeof(Int32)); + createCol(prims, "PayButton3", typeof(Int32)); + createCol(prims, "PayButton4", typeof(Int32)); + + createCol(prims, "LoopedSound", typeof(String)); + createCol(prims, "LoopedSoundGain", typeof(Double)); + createCol(prims, "TextureAnimation", typeof(String)); + createCol(prims, "ParticleSystem", typeof(String)); + + createCol(prims, "OmegaX", typeof(Double)); + createCol(prims, "OmegaY", typeof(Double)); + createCol(prims, "OmegaZ", typeof(Double)); + + createCol(prims, "CameraEyeOffsetX", typeof(Double)); + createCol(prims, "CameraEyeOffsetY", typeof(Double)); + createCol(prims, "CameraEyeOffsetZ", typeof(Double)); + + createCol(prims, "CameraAtOffsetX", typeof(Double)); + createCol(prims, "CameraAtOffsetY", typeof(Double)); + createCol(prims, "CameraAtOffsetZ", typeof(Double)); + + createCol(prims, "ForceMouselook", typeof(Int16)); + + createCol(prims, "ScriptAccessPin", typeof(Int32)); + + createCol(prims, "AllowedDrop", typeof(Int16)); + createCol(prims, "DieAtEdge", typeof(Int16)); + + createCol(prims, "SalePrice", typeof(Int32)); + createCol(prims, "SaleType", typeof(Int16)); + + // click action + createCol(prims, "ClickAction", typeof (Byte)); + + createCol(prims, "Material", typeof(Byte)); + + createCol(prims, "CollisionSound", typeof(String)); + createCol(prims, "CollisionSoundVolume", typeof(Double)); + + createCol(prims, "VolumeDetect", typeof(Int16)); + + // Add in contraints + prims.PrimaryKey = new DataColumn[] {prims.Columns["UUID"]}; + + return prims; + } + + /// + /// Creates "primshapes" table + /// + /// shape table DataTable + private static DataTable createShapeTable() + { + DataTable shapes = new DataTable("primshapes"); + createCol(shapes, "UUID", typeof (String)); + // shape is an enum + createCol(shapes, "Shape", typeof (Int32)); + // vectors + createCol(shapes, "ScaleX", typeof (Double)); + createCol(shapes, "ScaleY", typeof (Double)); + createCol(shapes, "ScaleZ", typeof (Double)); + // paths + createCol(shapes, "PCode", typeof (Int32)); + createCol(shapes, "PathBegin", typeof (Int32)); + createCol(shapes, "PathEnd", typeof (Int32)); + createCol(shapes, "PathScaleX", typeof (Int32)); + createCol(shapes, "PathScaleY", typeof (Int32)); + createCol(shapes, "PathShearX", typeof (Int32)); + createCol(shapes, "PathShearY", typeof (Int32)); + createCol(shapes, "PathSkew", typeof (Int32)); + createCol(shapes, "PathCurve", typeof (Int32)); + createCol(shapes, "PathRadiusOffset", typeof (Int32)); + createCol(shapes, "PathRevolutions", typeof (Int32)); + createCol(shapes, "PathTaperX", typeof (Int32)); + createCol(shapes, "PathTaperY", typeof (Int32)); + createCol(shapes, "PathTwist", typeof (Int32)); + createCol(shapes, "PathTwistBegin", typeof (Int32)); + // profile + createCol(shapes, "ProfileBegin", typeof (Int32)); + createCol(shapes, "ProfileEnd", typeof (Int32)); + createCol(shapes, "ProfileCurve", typeof (Int32)); + createCol(shapes, "ProfileHollow", typeof (Int32)); + createCol(shapes, "State", typeof(Int32)); + // text TODO: this isn't right, but I'm not sure the right + // way to specify this as a blob atm + createCol(shapes, "Texture", typeof (Byte[])); + createCol(shapes, "ExtraParams", typeof (Byte[])); + + shapes.PrimaryKey = new DataColumn[] {shapes.Columns["UUID"]}; + + return shapes; + } + + /// + /// creates "primitems" table + /// + /// item table DataTable + private static DataTable createItemsTable() + { + DataTable items = new DataTable("primitems"); + + createCol(items, "itemID", typeof (String)); + createCol(items, "primID", typeof (String)); + createCol(items, "assetID", typeof (String)); + createCol(items, "parentFolderID", typeof (String)); + + createCol(items, "invType", typeof (Int32)); + createCol(items, "assetType", typeof (Int32)); + + createCol(items, "name", typeof (String)); + createCol(items, "description", typeof (String)); + + createCol(items, "creationDate", typeof (Int64)); + createCol(items, "creatorID", typeof (String)); + createCol(items, "ownerID", typeof (String)); + createCol(items, "lastOwnerID", typeof (String)); + createCol(items, "groupID", typeof (String)); + + createCol(items, "nextPermissions", typeof (UInt32)); + createCol(items, "currentPermissions", typeof (UInt32)); + createCol(items, "basePermissions", typeof (UInt32)); + createCol(items, "everyonePermissions", typeof (UInt32)); + createCol(items, "groupPermissions", typeof (UInt32)); + createCol(items, "flags", typeof (UInt32)); + + items.PrimaryKey = new DataColumn[] { items.Columns["itemID"] }; + + return items; + } + + /// + /// Creates "land" table + /// + /// land table DataTable + private static DataTable createLandTable() + { + DataTable land = new DataTable("land"); + createCol(land, "UUID", typeof (String)); + createCol(land, "RegionUUID", typeof (String)); + createCol(land, "LocalLandID", typeof (UInt32)); + + // Bitmap is a byte[512] + createCol(land, "Bitmap", typeof (Byte[])); + + createCol(land, "Name", typeof (String)); + createCol(land, "Desc", typeof (String)); + createCol(land, "OwnerUUID", typeof (String)); + createCol(land, "IsGroupOwned", typeof (Boolean)); + createCol(land, "Area", typeof (Int32)); + createCol(land, "AuctionID", typeof (Int32)); //Unemplemented + createCol(land, "Category", typeof (Int32)); //Enum OpenMetaverse.Parcel.ParcelCategory + createCol(land, "ClaimDate", typeof (Int32)); + createCol(land, "ClaimPrice", typeof (Int32)); + createCol(land, "GroupUUID", typeof (string)); + createCol(land, "SalePrice", typeof (Int32)); + createCol(land, "LandStatus", typeof (Int32)); //Enum. OpenMetaverse.Parcel.ParcelStatus + createCol(land, "LandFlags", typeof (UInt32)); + createCol(land, "LandingType", typeof (Byte)); + createCol(land, "MediaAutoScale", typeof (Byte)); + createCol(land, "MediaTextureUUID", typeof (String)); + createCol(land, "MediaURL", typeof (String)); + createCol(land, "MusicURL", typeof (String)); + createCol(land, "PassHours", typeof (Double)); + createCol(land, "PassPrice", typeof (UInt32)); + createCol(land, "SnapshotUUID", typeof (String)); + createCol(land, "UserLocationX", typeof (Double)); + createCol(land, "UserLocationY", typeof (Double)); + createCol(land, "UserLocationZ", typeof (Double)); + createCol(land, "UserLookAtX", typeof (Double)); + createCol(land, "UserLookAtY", typeof (Double)); + createCol(land, "UserLookAtZ", typeof (Double)); + createCol(land, "AuthbuyerID", typeof(String)); + createCol(land, "OtherCleanTime", typeof(Int32)); + + land.PrimaryKey = new DataColumn[] {land.Columns["UUID"]}; + + return land; + } + + /// + /// create "landaccesslist" table + /// + /// Landacceslist DataTable + private static DataTable createLandAccessListTable() + { + DataTable landaccess = new DataTable("landaccesslist"); + createCol(landaccess, "LandUUID", typeof (String)); + createCol(landaccess, "AccessUUID", typeof (String)); + createCol(landaccess, "Flags", typeof (UInt32)); + + return landaccess; + } + + private static DataTable createRegionSettingsTable() + { + DataTable regionsettings = new DataTable("regionsettings"); + createCol(regionsettings, "regionUUID", typeof(String)); + createCol(regionsettings, "block_terraform", typeof (Int32)); + createCol(regionsettings, "block_fly", typeof (Int32)); + createCol(regionsettings, "allow_damage", typeof (Int32)); + createCol(regionsettings, "restrict_pushing", typeof (Int32)); + createCol(regionsettings, "allow_land_resell", typeof (Int32)); + createCol(regionsettings, "allow_land_join_divide", typeof (Int32)); + createCol(regionsettings, "block_show_in_search", typeof (Int32)); + createCol(regionsettings, "agent_limit", typeof (Int32)); + createCol(regionsettings, "object_bonus", typeof (Double)); + createCol(regionsettings, "maturity", typeof (Int32)); + createCol(regionsettings, "disable_scripts", typeof (Int32)); + createCol(regionsettings, "disable_collisions", typeof (Int32)); + createCol(regionsettings, "disable_physics", typeof (Int32)); + createCol(regionsettings, "terrain_texture_1", typeof(String)); + createCol(regionsettings, "terrain_texture_2", typeof(String)); + createCol(regionsettings, "terrain_texture_3", typeof(String)); + createCol(regionsettings, "terrain_texture_4", typeof(String)); + createCol(regionsettings, "elevation_1_nw", typeof (Double)); + createCol(regionsettings, "elevation_2_nw", typeof (Double)); + createCol(regionsettings, "elevation_1_ne", typeof (Double)); + createCol(regionsettings, "elevation_2_ne", typeof (Double)); + createCol(regionsettings, "elevation_1_se", typeof (Double)); + createCol(regionsettings, "elevation_2_se", typeof (Double)); + createCol(regionsettings, "elevation_1_sw", typeof (Double)); + createCol(regionsettings, "elevation_2_sw", typeof (Double)); + createCol(regionsettings, "water_height", typeof (Double)); + createCol(regionsettings, "terrain_raise_limit", typeof (Double)); + createCol(regionsettings, "terrain_lower_limit", typeof (Double)); + createCol(regionsettings, "use_estate_sun", typeof (Int32)); + createCol(regionsettings, "sandbox", typeof (Int32)); + createCol(regionsettings, "sunvectorx",typeof (Double)); + createCol(regionsettings, "sunvectory",typeof (Double)); + createCol(regionsettings, "sunvectorz",typeof (Double)); + createCol(regionsettings, "fixed_sun", typeof (Int32)); + createCol(regionsettings, "sun_position", typeof (Double)); + createCol(regionsettings, "covenant", typeof(String)); + regionsettings.PrimaryKey = new DataColumn[] { regionsettings.Columns["regionUUID"] }; + return regionsettings; + } + + /*********************************************************************** + * + * Convert between ADO.NET <=> OpenSim Objects + * + * These should be database independant + * + **********************************************************************/ + + /// + /// + /// + /// + /// + private SceneObjectPart buildPrim(DataRow row) + { + // Code commented. Uncomment to test the unit test inline. + + // The unit test mentions this commented code for the purposes + // of debugging a unit test failure + + // SceneObjectGroup sog = new SceneObjectGroup(); + // SceneObjectPart sop = new SceneObjectPart(); + // sop.LocalId = 1; + // sop.Name = "object1"; + // sop.Description = "object1"; + // sop.Text = ""; + // sop.SitName = ""; + // sop.TouchName = ""; + // sop.UUID = UUID.Random(); + // sop.Shape = PrimitiveBaseShape.Default; + // sog.SetRootPart(sop); + // Add breakpoint in above line. Check sop fields. + + // TODO: this doesn't work yet because something more + // interesting has to be done to actually get these values + // back out. Not enough time to figure it out yet. + + SceneObjectPart prim = new SceneObjectPart(); + prim.UUID = new UUID((String) row["UUID"]); + // explicit conversion of integers is required, which sort + // of sucks. No idea if there is a shortcut here or not. + prim.CreationDate = Convert.ToInt32(row["CreationDate"]); + prim.Name = row["Name"] == DBNull.Value ? string.Empty : (string)row["Name"]; + // various text fields + prim.Text = (String) row["Text"]; + prim.Color = Color.FromArgb(Convert.ToInt32(row["ColorA"]), + Convert.ToInt32(row["ColorR"]), + Convert.ToInt32(row["ColorG"]), + Convert.ToInt32(row["ColorB"])); + prim.Description = (String) row["Description"]; + prim.SitName = (String) row["SitName"]; + prim.TouchName = (String) row["TouchName"]; + // permissions + prim.Flags = (PrimFlags)Convert.ToUInt32(row["ObjectFlags"]); + prim.CreatorID = new UUID((String) row["CreatorID"]); + prim.OwnerID = new UUID((String) row["OwnerID"]); + prim.GroupID = new UUID((String) row["GroupID"]); + prim.LastOwnerID = new UUID((String) row["LastOwnerID"]); + prim.OwnerMask = Convert.ToUInt32(row["OwnerMask"]); + prim.NextOwnerMask = Convert.ToUInt32(row["NextOwnerMask"]); + prim.GroupMask = Convert.ToUInt32(row["GroupMask"]); + prim.EveryoneMask = Convert.ToUInt32(row["EveryoneMask"]); + prim.BaseMask = Convert.ToUInt32(row["BaseMask"]); + // vectors + prim.OffsetPosition = new Vector3( + Convert.ToSingle(row["PositionX"]), + Convert.ToSingle(row["PositionY"]), + Convert.ToSingle(row["PositionZ"]) + ); + prim.GroupPosition = new Vector3( + Convert.ToSingle(row["GroupPositionX"]), + Convert.ToSingle(row["GroupPositionY"]), + Convert.ToSingle(row["GroupPositionZ"]) + ); + prim.Velocity = new Vector3( + Convert.ToSingle(row["VelocityX"]), + Convert.ToSingle(row["VelocityY"]), + Convert.ToSingle(row["VelocityZ"]) + ); + prim.AngularVelocity = new Vector3( + Convert.ToSingle(row["AngularVelocityX"]), + Convert.ToSingle(row["AngularVelocityY"]), + Convert.ToSingle(row["AngularVelocityZ"]) + ); + prim.Acceleration = new Vector3( + Convert.ToSingle(row["AccelerationX"]), + Convert.ToSingle(row["AccelerationY"]), + Convert.ToSingle(row["AccelerationZ"]) + ); + // quaternions + prim.RotationOffset = new Quaternion( + Convert.ToSingle(row["RotationX"]), + Convert.ToSingle(row["RotationY"]), + Convert.ToSingle(row["RotationZ"]), + Convert.ToSingle(row["RotationW"]) + ); + + prim.SitTargetPositionLL = new Vector3( + Convert.ToSingle(row["SitTargetOffsetX"]), + Convert.ToSingle(row["SitTargetOffsetY"]), + Convert.ToSingle(row["SitTargetOffsetZ"])); + prim.SitTargetOrientationLL = new Quaternion( + Convert.ToSingle( + row["SitTargetOrientX"]), + Convert.ToSingle( + row["SitTargetOrientY"]), + Convert.ToSingle( + row["SitTargetOrientZ"]), + Convert.ToSingle( + row["SitTargetOrientW"])); + + prim.ClickAction = Convert.ToByte(row["ClickAction"]); + prim.PayPrice[0] = Convert.ToInt32(row["PayPrice"]); + prim.PayPrice[1] = Convert.ToInt32(row["PayButton1"]); + prim.PayPrice[2] = Convert.ToInt32(row["PayButton2"]); + prim.PayPrice[3] = Convert.ToInt32(row["PayButton3"]); + prim.PayPrice[4] = Convert.ToInt32(row["PayButton4"]); + + prim.Sound = new UUID(row["LoopedSound"].ToString()); + prim.SoundGain = Convert.ToSingle(row["LoopedSoundGain"]); + prim.SoundFlags = 1; // If it's persisted at all, it's looped + + if (!row.IsNull("TextureAnimation")) + prim.TextureAnimation = Convert.FromBase64String(row["TextureAnimation"].ToString()); + if (!row.IsNull("ParticleSystem")) + prim.ParticleSystem = Convert.FromBase64String(row["ParticleSystem"].ToString()); + + prim.AngularVelocity = new Vector3( + Convert.ToSingle(row["OmegaX"]), + Convert.ToSingle(row["OmegaY"]), + Convert.ToSingle(row["OmegaZ"]) + ); + + prim.SetCameraEyeOffset(new Vector3( + Convert.ToSingle(row["CameraEyeOffsetX"]), + Convert.ToSingle(row["CameraEyeOffsetY"]), + Convert.ToSingle(row["CameraEyeOffsetZ"]) + )); + + prim.SetCameraAtOffset(new Vector3( + Convert.ToSingle(row["CameraAtOffsetX"]), + Convert.ToSingle(row["CameraAtOffsetY"]), + Convert.ToSingle(row["CameraAtOffsetZ"]) + )); + + if (Convert.ToInt16(row["ForceMouselook"]) != 0) + prim.SetForceMouselook(true); + + prim.ScriptAccessPin = Convert.ToInt32(row["ScriptAccessPin"]); + + if (Convert.ToInt16(row["AllowedDrop"]) != 0) + prim.AllowedDrop = true; + + if (Convert.ToInt16(row["DieAtEdge"]) != 0) + prim.DIE_AT_EDGE = true; + + prim.SalePrice = Convert.ToInt32(row["SalePrice"]); + prim.ObjectSaleType = Convert.ToByte(row["SaleType"]); + + prim.Material = Convert.ToByte(row["Material"]); + + prim.CollisionSound = new UUID(row["CollisionSound"].ToString()); + prim.CollisionSoundVolume = Convert.ToSingle(row["CollisionSoundVolume"]); + + if (Convert.ToInt16(row["VolumeDetect"]) != 0) + prim.VolumeDetectActive = true; + + return prim; + } + + /// + /// Build a prim inventory item from the persisted data. + /// + /// + /// + private static TaskInventoryItem buildItem(DataRow row) + { + TaskInventoryItem taskItem = new TaskInventoryItem(); + + taskItem.ItemID = new UUID((String)row["itemID"]); + taskItem.ParentPartID = new UUID((String)row["primID"]); + taskItem.AssetID = new UUID((String)row["assetID"]); + taskItem.ParentID = new UUID((String)row["parentFolderID"]); + + taskItem.InvType = Convert.ToInt32(row["invType"]); + taskItem.Type = Convert.ToInt32(row["assetType"]); + + taskItem.Name = (String)row["name"]; + taskItem.Description = (String)row["description"]; + taskItem.CreationDate = Convert.ToUInt32(row["creationDate"]); + taskItem.CreatorID = new UUID((String)row["creatorID"]); + taskItem.OwnerID = new UUID((String)row["ownerID"]); + taskItem.LastOwnerID = new UUID((String)row["lastOwnerID"]); + taskItem.GroupID = new UUID((String)row["groupID"]); + + taskItem.NextPermissions = Convert.ToUInt32(row["nextPermissions"]); + taskItem.CurrentPermissions = Convert.ToUInt32(row["currentPermissions"]); + taskItem.BasePermissions = Convert.ToUInt32(row["basePermissions"]); + taskItem.EveryonePermissions = Convert.ToUInt32(row["everyonePermissions"]); + taskItem.GroupPermissions = Convert.ToUInt32(row["groupPermissions"]); + taskItem.Flags = Convert.ToUInt32(row["flags"]); + + return taskItem; + } + + /// + /// Build a Land Data from the persisted data. + /// + /// + /// + private LandData buildLandData(DataRow row) + { + LandData newData = new LandData(); + + newData.GlobalID = new UUID((String) row["UUID"]); + newData.LocalID = Convert.ToInt32(row["LocalLandID"]); + + // Bitmap is a byte[512] + newData.Bitmap = (Byte[]) row["Bitmap"]; + + newData.Name = (String) row["Name"]; + newData.Description = (String) row["Desc"]; + newData.OwnerID = (UUID)(String) row["OwnerUUID"]; + newData.IsGroupOwned = (Boolean) row["IsGroupOwned"]; + newData.Area = Convert.ToInt32(row["Area"]); + newData.AuctionID = Convert.ToUInt32(row["AuctionID"]); //Unemplemented + newData.Category = (ParcelCategory) Convert.ToInt32(row["Category"]); + //Enum OpenMetaverse.Parcel.ParcelCategory + newData.ClaimDate = Convert.ToInt32(row["ClaimDate"]); + newData.ClaimPrice = Convert.ToInt32(row["ClaimPrice"]); + newData.GroupID = new UUID((String) row["GroupUUID"]); + newData.SalePrice = Convert.ToInt32(row["SalePrice"]); + newData.Status = (ParcelStatus) Convert.ToInt32(row["LandStatus"]); + //Enum. OpenMetaverse.Parcel.ParcelStatus + newData.Flags = Convert.ToUInt32(row["LandFlags"]); + newData.LandingType = (Byte) row["LandingType"]; + newData.MediaAutoScale = (Byte) row["MediaAutoScale"]; + newData.MediaID = new UUID((String) row["MediaTextureUUID"]); + newData.MediaURL = (String) row["MediaURL"]; + newData.MusicURL = (String) row["MusicURL"]; + newData.PassHours = Convert.ToSingle(row["PassHours"]); + newData.PassPrice = Convert.ToInt32(row["PassPrice"]); + newData.SnapshotID = (UUID)(String) row["SnapshotUUID"]; + try + { + + newData.UserLocation = + new Vector3(Convert.ToSingle(row["UserLocationX"]), Convert.ToSingle(row["UserLocationY"]), + Convert.ToSingle(row["UserLocationZ"])); + newData.UserLookAt = + new Vector3(Convert.ToSingle(row["UserLookAtX"]), Convert.ToSingle(row["UserLookAtY"]), + Convert.ToSingle(row["UserLookAtZ"])); + + } + catch (InvalidCastException) + { + m_log.ErrorFormat("[PARCEL]: unable to get parcel telehub settings for {1}", newData.Name); + newData.UserLocation = Vector3.Zero; + newData.UserLookAt = Vector3.Zero; + } + newData.ParcelAccessList = new List(); + UUID authBuyerID = UUID.Zero; + + UUID.TryParse((string)row["AuthbuyerID"], out authBuyerID); + + newData.OtherCleanTime = Convert.ToInt32(row["OtherCleanTime"]); + + return newData; + } + + private RegionSettings buildRegionSettings(DataRow row) + { + RegionSettings newSettings = new RegionSettings(); + + newSettings.RegionUUID = new UUID((string) row["regionUUID"]); + newSettings.BlockTerraform = Convert.ToBoolean(row["block_terraform"]); + newSettings.AllowDamage = Convert.ToBoolean(row["allow_damage"]); + newSettings.BlockFly = Convert.ToBoolean(row["block_fly"]); + newSettings.RestrictPushing = Convert.ToBoolean(row["restrict_pushing"]); + newSettings.AllowLandResell = Convert.ToBoolean(row["allow_land_resell"]); + newSettings.AllowLandJoinDivide = Convert.ToBoolean(row["allow_land_join_divide"]); + newSettings.BlockShowInSearch = Convert.ToBoolean(row["block_show_in_search"]); + newSettings.AgentLimit = Convert.ToInt32(row["agent_limit"]); + newSettings.ObjectBonus = Convert.ToDouble(row["object_bonus"]); + newSettings.Maturity = Convert.ToInt32(row["maturity"]); + newSettings.DisableScripts = Convert.ToBoolean(row["disable_scripts"]); + newSettings.DisableCollisions = Convert.ToBoolean(row["disable_collisions"]); + newSettings.DisablePhysics = Convert.ToBoolean(row["disable_physics"]); + newSettings.TerrainTexture1 = new UUID((String) row["terrain_texture_1"]); + newSettings.TerrainTexture2 = new UUID((String) row["terrain_texture_2"]); + newSettings.TerrainTexture3 = new UUID((String) row["terrain_texture_3"]); + newSettings.TerrainTexture4 = new UUID((String) row["terrain_texture_4"]); + newSettings.Elevation1NW = Convert.ToDouble(row["elevation_1_nw"]); + newSettings.Elevation2NW = Convert.ToDouble(row["elevation_2_nw"]); + newSettings.Elevation1NE = Convert.ToDouble(row["elevation_1_ne"]); + newSettings.Elevation2NE = Convert.ToDouble(row["elevation_2_ne"]); + newSettings.Elevation1SE = Convert.ToDouble(row["elevation_1_se"]); + newSettings.Elevation2SE = Convert.ToDouble(row["elevation_2_se"]); + newSettings.Elevation1SW = Convert.ToDouble(row["elevation_1_sw"]); + newSettings.Elevation2SW = Convert.ToDouble(row["elevation_2_sw"]); + newSettings.WaterHeight = Convert.ToDouble(row["water_height"]); + newSettings.TerrainRaiseLimit = Convert.ToDouble(row["terrain_raise_limit"]); + newSettings.TerrainLowerLimit = Convert.ToDouble(row["terrain_lower_limit"]); + newSettings.UseEstateSun = Convert.ToBoolean(row["use_estate_sun"]); + newSettings.Sandbox = Convert.ToBoolean(row["sandbox"]); + newSettings.SunVector = new Vector3 ( + Convert.ToSingle(row["sunvectorx"]), + Convert.ToSingle(row["sunvectory"]), + Convert.ToSingle(row["sunvectorz"]) + ); + newSettings.FixedSun = Convert.ToBoolean(row["fixed_sun"]); + newSettings.SunPosition = Convert.ToDouble(row["sun_position"]); + newSettings.Covenant = new UUID((String) row["covenant"]); + + return newSettings; + } + + /// + /// Build a land access entry from the persisted data. + /// + /// + /// + private static ParcelManager.ParcelAccessEntry buildLandAccessData(DataRow row) + { + ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry(); + entry.AgentID = new UUID((string) row["AccessUUID"]); + entry.Flags = (AccessList) row["Flags"]; + entry.Time = new DateTime(); + return entry; + } + + /// + /// + /// + /// + /// + private static Array serializeTerrain(double[,] val) + { + MemoryStream str = new MemoryStream(((int)Constants.RegionSize * (int)Constants.RegionSize) *sizeof (double)); + BinaryWriter bw = new BinaryWriter(str); + + // TODO: COMPATIBILITY - Add byte-order conversions + for (int x = 0; x < (int)Constants.RegionSize; x++) + for (int y = 0; y < (int)Constants.RegionSize; y++) + bw.Write(val[x, y]); + + return str.ToArray(); + } + +// private void fillTerrainRow(DataRow row, UUID regionUUID, int rev, double[,] val) +// { +// row["RegionUUID"] = regionUUID; +// row["Revision"] = rev; + + // MemoryStream str = new MemoryStream(((int)Constants.RegionSize * (int)Constants.RegionSize)*sizeof (double)); +// BinaryWriter bw = new BinaryWriter(str); + +// // TODO: COMPATIBILITY - Add byte-order conversions + // for (int x = 0; x < (int)Constants.RegionSize; x++) + // for (int y = 0; y < (int)Constants.RegionSize; y++) +// bw.Write(val[x, y]); + +// row["Heightfield"] = str.ToArray(); +// } + + /// + /// + /// + /// + /// + /// + /// + private static void fillPrimRow(DataRow row, SceneObjectPart prim, UUID sceneGroupID, UUID regionUUID) + { + row["UUID"] = prim.UUID.ToString(); + row["RegionUUID"] = regionUUID.ToString(); + row["CreationDate"] = prim.CreationDate; + row["Name"] = prim.Name; + row["SceneGroupID"] = sceneGroupID.ToString(); + // the UUID of the root part for this SceneObjectGroup + // various text fields + row["Text"] = prim.Text; + row["Description"] = prim.Description; + row["SitName"] = prim.SitName; + row["TouchName"] = prim.TouchName; + // permissions + row["ObjectFlags"] = (uint)prim.Flags; + row["CreatorID"] = prim.CreatorID.ToString(); + row["OwnerID"] = prim.OwnerID.ToString(); + row["GroupID"] = prim.GroupID.ToString(); + row["LastOwnerID"] = prim.LastOwnerID.ToString(); + row["OwnerMask"] = prim.OwnerMask; + row["NextOwnerMask"] = prim.NextOwnerMask; + row["GroupMask"] = prim.GroupMask; + row["EveryoneMask"] = prim.EveryoneMask; + row["BaseMask"] = prim.BaseMask; + // vectors + row["PositionX"] = prim.OffsetPosition.X; + row["PositionY"] = prim.OffsetPosition.Y; + row["PositionZ"] = prim.OffsetPosition.Z; + row["GroupPositionX"] = prim.GroupPosition.X; + row["GroupPositionY"] = prim.GroupPosition.Y; + row["GroupPositionZ"] = prim.GroupPosition.Z; + row["VelocityX"] = prim.Velocity.X; + row["VelocityY"] = prim.Velocity.Y; + row["VelocityZ"] = prim.Velocity.Z; + row["AngularVelocityX"] = prim.AngularVelocity.X; + row["AngularVelocityY"] = prim.AngularVelocity.Y; + row["AngularVelocityZ"] = prim.AngularVelocity.Z; + row["AccelerationX"] = prim.Acceleration.X; + row["AccelerationY"] = prim.Acceleration.Y; + row["AccelerationZ"] = prim.Acceleration.Z; + // quaternions + row["RotationX"] = prim.RotationOffset.X; + row["RotationY"] = prim.RotationOffset.Y; + row["RotationZ"] = prim.RotationOffset.Z; + row["RotationW"] = prim.RotationOffset.W; + + // Sit target + Vector3 sitTargetPos = prim.SitTargetPositionLL; + row["SitTargetOffsetX"] = sitTargetPos.X; + row["SitTargetOffsetY"] = sitTargetPos.Y; + row["SitTargetOffsetZ"] = sitTargetPos.Z; + + Quaternion sitTargetOrient = prim.SitTargetOrientationLL; + row["SitTargetOrientW"] = sitTargetOrient.W; + row["SitTargetOrientX"] = sitTargetOrient.X; + row["SitTargetOrientY"] = sitTargetOrient.Y; + row["SitTargetOrientZ"] = sitTargetOrient.Z; + row["ColorR"] = Convert.ToInt32(prim.Color.R); + row["ColorG"] = Convert.ToInt32(prim.Color.G); + row["ColorB"] = Convert.ToInt32(prim.Color.B); + row["ColorA"] = Convert.ToInt32(prim.Color.A); + row["PayPrice"] = prim.PayPrice[0]; + row["PayButton1"] = prim.PayPrice[1]; + row["PayButton2"] = prim.PayPrice[2]; + row["PayButton3"] = prim.PayPrice[3]; + row["PayButton4"] = prim.PayPrice[4]; + + + row["TextureAnimation"] = Convert.ToBase64String(prim.TextureAnimation); + row["ParticleSystem"] = Convert.ToBase64String(prim.ParticleSystem); + + row["OmegaX"] = prim.AngularVelocity.X; + row["OmegaY"] = prim.AngularVelocity.Y; + row["OmegaZ"] = prim.AngularVelocity.Z; + + row["CameraEyeOffsetX"] = prim.GetCameraEyeOffset().X; + row["CameraEyeOffsetY"] = prim.GetCameraEyeOffset().Y; + row["CameraEyeOffsetZ"] = prim.GetCameraEyeOffset().Z; + + row["CameraAtOffsetX"] = prim.GetCameraAtOffset().X; + row["CameraAtOffsetY"] = prim.GetCameraAtOffset().Y; + row["CameraAtOffsetZ"] = prim.GetCameraAtOffset().Z; + + + if ((prim.SoundFlags & 1) != 0) // Looped + { + row["LoopedSound"] = prim.Sound.ToString(); + row["LoopedSoundGain"] = prim.SoundGain; + } + else + { + row["LoopedSound"] = UUID.Zero.ToString(); + row["LoopedSoundGain"] = 0.0f; + } + + if (prim.GetForceMouselook()) + row["ForceMouselook"] = 1; + else + row["ForceMouselook"] = 0; + + row["ScriptAccessPin"] = prim.ScriptAccessPin; + + if (prim.AllowedDrop) + row["AllowedDrop"] = 1; + else + row["AllowedDrop"] = 0; + + if (prim.DIE_AT_EDGE) + row["DieAtEdge"] = 1; + else + row["DieAtEdge"] = 0; + + row["SalePrice"] = prim.SalePrice; + row["SaleType"] = Convert.ToInt16(prim.ObjectSaleType); + + // click action + row["ClickAction"] = prim.ClickAction; + + row["SalePrice"] = prim.SalePrice; + row["Material"] = prim.Material; + + row["CollisionSound"] = prim.CollisionSound.ToString(); + row["CollisionSoundVolume"] = prim.CollisionSoundVolume; + if (prim.VolumeDetectActive) + row["VolumeDetect"] = 1; + else + row["VolumeDetect"] = 0; + + } + + /// + /// + /// + /// + /// + private static void fillItemRow(DataRow row, TaskInventoryItem taskItem) + { + row["itemID"] = taskItem.ItemID.ToString(); + row["primID"] = taskItem.ParentPartID.ToString(); + row["assetID"] = taskItem.AssetID.ToString(); + row["parentFolderID"] = taskItem.ParentID.ToString(); + + row["invType"] = taskItem.InvType; + row["assetType"] = taskItem.Type; + + row["name"] = taskItem.Name; + row["description"] = taskItem.Description; + row["creationDate"] = taskItem.CreationDate; + row["creatorID"] = taskItem.CreatorID.ToString(); + row["ownerID"] = taskItem.OwnerID.ToString(); + row["lastOwnerID"] = taskItem.LastOwnerID.ToString(); + row["groupID"] = taskItem.GroupID.ToString(); + row["nextPermissions"] = taskItem.NextPermissions; + row["currentPermissions"] = taskItem.CurrentPermissions; + row["basePermissions"] = taskItem.BasePermissions; + row["everyonePermissions"] = taskItem.EveryonePermissions; + row["groupPermissions"] = taskItem.GroupPermissions; + row["flags"] = taskItem.Flags; + } + + /// + /// + /// + /// + /// + /// + private static void fillLandRow(DataRow row, LandData land, UUID regionUUID) + { + row["UUID"] = land.GlobalID.ToString(); + row["RegionUUID"] = regionUUID.ToString(); + row["LocalLandID"] = land.LocalID; + + // Bitmap is a byte[512] + row["Bitmap"] = land.Bitmap; + + row["Name"] = land.Name; + row["Desc"] = land.Description; + row["OwnerUUID"] = land.OwnerID.ToString(); + row["IsGroupOwned"] = land.IsGroupOwned; + row["Area"] = land.Area; + row["AuctionID"] = land.AuctionID; //Unemplemented + row["Category"] = land.Category; //Enum OpenMetaverse.Parcel.ParcelCategory + row["ClaimDate"] = land.ClaimDate; + row["ClaimPrice"] = land.ClaimPrice; + row["GroupUUID"] = land.GroupID.ToString(); + row["SalePrice"] = land.SalePrice; + row["LandStatus"] = land.Status; //Enum. OpenMetaverse.Parcel.ParcelStatus + row["LandFlags"] = land.Flags; + row["LandingType"] = land.LandingType; + row["MediaAutoScale"] = land.MediaAutoScale; + row["MediaTextureUUID"] = land.MediaID.ToString(); + row["MediaURL"] = land.MediaURL; + row["MusicURL"] = land.MusicURL; + row["PassHours"] = land.PassHours; + row["PassPrice"] = land.PassPrice; + row["SnapshotUUID"] = land.SnapshotID.ToString(); + row["UserLocationX"] = land.UserLocation.X; + row["UserLocationY"] = land.UserLocation.Y; + row["UserLocationZ"] = land.UserLocation.Z; + row["UserLookAtX"] = land.UserLookAt.X; + row["UserLookAtY"] = land.UserLookAt.Y; + row["UserLookAtZ"] = land.UserLookAt.Z; + row["AuthbuyerID"] = land.AuthBuyerID.ToString(); + row["OtherCleanTime"] = land.OtherCleanTime; + } + + /// + /// + /// + /// + /// + /// + private static void fillLandAccessRow(DataRow row, ParcelManager.ParcelAccessEntry entry, UUID parcelID) + { + row["LandUUID"] = parcelID.ToString(); + row["AccessUUID"] = entry.AgentID.ToString(); + row["Flags"] = entry.Flags; + } + + private static void fillRegionSettingsRow(DataRow row, RegionSettings settings) + { + row["regionUUID"] = settings.RegionUUID.ToString(); + row["block_terraform"] = settings.BlockTerraform; + row["block_fly"] = settings.BlockFly; + row["allow_damage"] = settings.AllowDamage; + row["restrict_pushing"] = settings.RestrictPushing; + row["allow_land_resell"] = settings.AllowLandResell; + row["allow_land_join_divide"] = settings.AllowLandJoinDivide; + row["block_show_in_search"] = settings.BlockShowInSearch; + row["agent_limit"] = settings.AgentLimit; + row["object_bonus"] = settings.ObjectBonus; + row["maturity"] = settings.Maturity; + row["disable_scripts"] = settings.DisableScripts; + row["disable_collisions"] = settings.DisableCollisions; + row["disable_physics"] = settings.DisablePhysics; + row["terrain_texture_1"] = settings.TerrainTexture1.ToString(); + row["terrain_texture_2"] = settings.TerrainTexture2.ToString(); + row["terrain_texture_3"] = settings.TerrainTexture3.ToString(); + row["terrain_texture_4"] = settings.TerrainTexture4.ToString(); + row["elevation_1_nw"] = settings.Elevation1NW; + row["elevation_2_nw"] = settings.Elevation2NW; + row["elevation_1_ne"] = settings.Elevation1NE; + row["elevation_2_ne"] = settings.Elevation2NE; + row["elevation_1_se"] = settings.Elevation1SE; + row["elevation_2_se"] = settings.Elevation2SE; + row["elevation_1_sw"] = settings.Elevation1SW; + row["elevation_2_sw"] = settings.Elevation2SW; + row["water_height"] = settings.WaterHeight; + row["terrain_raise_limit"] = settings.TerrainRaiseLimit; + row["terrain_lower_limit"] = settings.TerrainLowerLimit; + row["use_estate_sun"] = settings.UseEstateSun; + row["Sandbox"] = settings.Sandbox; // database uses upper case S for sandbox + row["sunvectorx"] = settings.SunVector.X; + row["sunvectory"] = settings.SunVector.Y; + row["sunvectorz"] = settings.SunVector.Z; + row["fixed_sun"] = settings.FixedSun; + row["sun_position"] = settings.SunPosition; + row["covenant"] = settings.Covenant.ToString(); + } + + /// + /// + /// + /// + /// + private PrimitiveBaseShape buildShape(DataRow row) + { + PrimitiveBaseShape s = new PrimitiveBaseShape(); + s.Scale = new Vector3( + Convert.ToSingle(row["ScaleX"]), + Convert.ToSingle(row["ScaleY"]), + Convert.ToSingle(row["ScaleZ"]) + ); + // paths + s.PCode = Convert.ToByte(row["PCode"]); + s.PathBegin = Convert.ToUInt16(row["PathBegin"]); + s.PathEnd = Convert.ToUInt16(row["PathEnd"]); + s.PathScaleX = Convert.ToByte(row["PathScaleX"]); + s.PathScaleY = Convert.ToByte(row["PathScaleY"]); + s.PathShearX = Convert.ToByte(row["PathShearX"]); + s.PathShearY = Convert.ToByte(row["PathShearY"]); + s.PathSkew = Convert.ToSByte(row["PathSkew"]); + s.PathCurve = Convert.ToByte(row["PathCurve"]); + s.PathRadiusOffset = Convert.ToSByte(row["PathRadiusOffset"]); + s.PathRevolutions = Convert.ToByte(row["PathRevolutions"]); + s.PathTaperX = Convert.ToSByte(row["PathTaperX"]); + s.PathTaperY = Convert.ToSByte(row["PathTaperY"]); + s.PathTwist = Convert.ToSByte(row["PathTwist"]); + s.PathTwistBegin = Convert.ToSByte(row["PathTwistBegin"]); + // profile + s.ProfileBegin = Convert.ToUInt16(row["ProfileBegin"]); + s.ProfileEnd = Convert.ToUInt16(row["ProfileEnd"]); + s.ProfileCurve = Convert.ToByte(row["ProfileCurve"]); + s.ProfileHollow = Convert.ToUInt16(row["ProfileHollow"]); + s.State = Convert.ToByte(row["State"]); + + byte[] textureEntry = (byte[])row["Texture"]; + s.TextureEntry = textureEntry; + + s.ExtraParams = (byte[]) row["ExtraParams"]; + return s; + } + + /// + /// + /// + /// + /// + private static void fillShapeRow(DataRow row, SceneObjectPart prim) + { + PrimitiveBaseShape s = prim.Shape; + row["UUID"] = prim.UUID.ToString(); + // shape is an enum + row["Shape"] = 0; + // vectors + row["ScaleX"] = s.Scale.X; + row["ScaleY"] = s.Scale.Y; + row["ScaleZ"] = s.Scale.Z; + // paths + row["PCode"] = s.PCode; + row["PathBegin"] = s.PathBegin; + row["PathEnd"] = s.PathEnd; + row["PathScaleX"] = s.PathScaleX; + row["PathScaleY"] = s.PathScaleY; + row["PathShearX"] = s.PathShearX; + row["PathShearY"] = s.PathShearY; + row["PathSkew"] = s.PathSkew; + row["PathCurve"] = s.PathCurve; + row["PathRadiusOffset"] = s.PathRadiusOffset; + row["PathRevolutions"] = s.PathRevolutions; + row["PathTaperX"] = s.PathTaperX; + row["PathTaperY"] = s.PathTaperY; + row["PathTwist"] = s.PathTwist; + row["PathTwistBegin"] = s.PathTwistBegin; + // profile + row["ProfileBegin"] = s.ProfileBegin; + row["ProfileEnd"] = s.ProfileEnd; + row["ProfileCurve"] = s.ProfileCurve; + row["ProfileHollow"] = s.ProfileHollow; + row["State"] = s.State; + + row["Texture"] = s.TextureEntry; + row["ExtraParams"] = s.ExtraParams; + } + + /// + /// + /// + /// + /// + /// + private void addPrim(SceneObjectPart prim, UUID sceneGroupID, UUID regionUUID) + { + + DataTable prims = ds.Tables["prims"]; + DataTable shapes = ds.Tables["primshapes"]; + + DataRow primRow = prims.Rows.Find(prim.UUID.ToString()); + if (primRow == null) + { + primRow = prims.NewRow(); + fillPrimRow(primRow, prim, sceneGroupID, regionUUID); + prims.Rows.Add(primRow); + } + else + { + fillPrimRow(primRow, prim, sceneGroupID, regionUUID); + } + + DataRow shapeRow = shapes.Rows.Find(prim.UUID.ToString()); + if (shapeRow == null) + { + shapeRow = shapes.NewRow(); + fillShapeRow(shapeRow, prim); + shapes.Rows.Add(shapeRow); + } + else + { + fillShapeRow(shapeRow, prim); + } + } + + /// + /// see IRegionDatastore + /// + /// + /// + public void StorePrimInventory(UUID primID, ICollection items) + { + m_log.InfoFormat("[REGION DB]: Entered StorePrimInventory with prim ID {0}", primID); + + DataTable dbItems = ds.Tables["primitems"]; + + // For now, we're just going to crudely remove all the previous inventory items + // no matter whether they have changed or not, and replace them with the current set. + lock (ds) + { + RemoveItems(primID); + + // repalce with current inventory details + foreach (TaskInventoryItem newItem in items) + { +// m_log.InfoFormat( +// "[DATASTORE]: ", +// "Adding item {0}, {1} to prim ID {2}", +// newItem.Name, newItem.ItemID, newItem.ParentPartID); + + DataRow newItemRow = dbItems.NewRow(); + fillItemRow(newItemRow, newItem); + dbItems.Rows.Add(newItemRow); + } + } + + Commit(); + } + + /*********************************************************************** + * + * SQL Statement Creation Functions + * + * These functions create SQL statements for update, insert, and create. + * They can probably be factored later to have a db independant + * portion and a db specific portion + * + **********************************************************************/ + + /// + /// Create an insert command + /// + /// table name + /// data table + /// the created command + /// + /// This is subtle enough to deserve some commentary. + /// Instead of doing *lots* and *lots of hardcoded strings + /// for database definitions we'll use the fact that + /// realistically all insert statements look like "insert + /// into A(b, c) values(:b, :c) on the parameterized query + /// front. If we just have a list of b, c, etc... we can + /// generate these strings instead of typing them out. + /// + private static SqliteCommand createInsertCommand(string table, DataTable dt) + { + string[] cols = new string[dt.Columns.Count]; + for (int i = 0; i < dt.Columns.Count; i++) + { + DataColumn col = dt.Columns[i]; + cols[i] = col.ColumnName; + } + + string sql = "insert into " + table + "("; + sql += String.Join(", ", cols); + // important, the first ':' needs to be here, the rest get added in the join + sql += ") values (:"; + sql += String.Join(", :", cols); + sql += ")"; + SqliteCommand cmd = new SqliteCommand(sql); + + // this provides the binding for all our parameters, so + // much less code than it used to be + foreach (DataColumn col in dt.Columns) + { + cmd.Parameters.Add(createSqliteParameter(col.ColumnName, col.DataType)); + } + return cmd; + } + + + /// + /// create an update command + /// + /// table name + /// + /// + /// the created command + private static SqliteCommand createUpdateCommand(string table, string pk, DataTable dt) + { + string sql = "update " + table + " set "; + string subsql = String.Empty; + foreach (DataColumn col in dt.Columns) + { + if (subsql.Length > 0) + { + // a map function would rock so much here + subsql += ", "; + } + subsql += col.ColumnName + "= :" + col.ColumnName; + } + sql += subsql; + sql += " where " + pk; + SqliteCommand cmd = new SqliteCommand(sql); + + // this provides the binding for all our parameters, so + // much less code than it used to be + + foreach (DataColumn col in dt.Columns) + { + cmd.Parameters.Add(createSqliteParameter(col.ColumnName, col.DataType)); + } + return cmd; + } + + /// + /// create an update command + /// + /// table name + /// + /// + /// the created command + private static SqliteCommand createUpdateCommand(string table, string pk1, string pk2, DataTable dt) + { + string sql = "update " + table + " set "; + string subsql = String.Empty; + foreach (DataColumn col in dt.Columns) + { + if (subsql.Length > 0) + { + // a map function would rock so much here + subsql += ", "; + } + subsql += col.ColumnName + "= :" + col.ColumnName; + } + sql += subsql; + sql += " where " + pk1 + " and " + pk2; + SqliteCommand cmd = new SqliteCommand(sql); + + // this provides the binding for all our parameters, so + // much less code than it used to be + + foreach (DataColumn col in dt.Columns) + { + cmd.Parameters.Add(createSqliteParameter(col.ColumnName, col.DataType)); + } + return cmd; + } + + /// + /// + /// + /// Data Table + /// + // private static string defineTable(DataTable dt) + // { + // string sql = "create table " + dt.TableName + "("; + // string subsql = String.Empty; + // foreach (DataColumn col in dt.Columns) + // { + // if (subsql.Length > 0) + // { + // // a map function would rock so much here + // subsql += ",\n"; + // } + // subsql += col.ColumnName + " " + sqliteType(col.DataType); + // if (dt.PrimaryKey.Length > 0 && col == dt.PrimaryKey[0]) + // { + // subsql += " primary key"; + // } + // } + // sql += subsql; + // sql += ")"; + // return sql; + // } + + /*********************************************************************** + * + * Database Binding functions + * + * These will be db specific due to typing, and minor differences + * in databases. + * + **********************************************************************/ + + /// + /// This is a convenience function that collapses 5 repetitive + /// lines for defining SqliteParameters to 2 parameters: + /// column name and database type. + /// + /// It assumes certain conventions like :param as the param + /// name to replace in parametrized queries, and that source + /// version is always current version, both of which are fine + /// for us. + /// + ///a built sqlite parameter + private static SqliteParameter createSqliteParameter(string name, Type type) + { + SqliteParameter param = new SqliteParameter(); + param.ParameterName = ":" + name; + param.DbType = dbtypeFromType(type); + param.SourceColumn = name; + param.SourceVersion = DataRowVersion.Current; + return param; + } + + /// + /// + /// + /// + /// + private void setupPrimCommands(SqliteDataAdapter da, SqliteConnection conn) + { + da.InsertCommand = createInsertCommand("prims", ds.Tables["prims"]); + da.InsertCommand.Connection = conn; + + da.UpdateCommand = createUpdateCommand("prims", "UUID=:UUID", ds.Tables["prims"]); + da.UpdateCommand.Connection = conn; + + SqliteCommand delete = new SqliteCommand("delete from prims where UUID = :UUID"); + delete.Parameters.Add(createSqliteParameter("UUID", typeof (String))); + delete.Connection = conn; + da.DeleteCommand = delete; + } + + /// + /// + /// + /// + /// + private void setupItemsCommands(SqliteDataAdapter da, SqliteConnection conn) + { + da.InsertCommand = createInsertCommand("primitems", ds.Tables["primitems"]); + da.InsertCommand.Connection = conn; + + da.UpdateCommand = createUpdateCommand("primitems", "itemID = :itemID", ds.Tables["primitems"]); + da.UpdateCommand.Connection = conn; + + SqliteCommand delete = new SqliteCommand("delete from primitems where itemID = :itemID"); + delete.Parameters.Add(createSqliteParameter("itemID", typeof (String))); + delete.Connection = conn; + da.DeleteCommand = delete; + } + + /// + /// + /// + /// + /// + private void setupTerrainCommands(SqliteDataAdapter da, SqliteConnection conn) + { + da.InsertCommand = createInsertCommand("terrain", ds.Tables["terrain"]); + da.InsertCommand.Connection = conn; + } + + /// + /// + /// + /// + /// + private void setupLandCommands(SqliteDataAdapter da, SqliteConnection conn) + { + da.InsertCommand = createInsertCommand("land", ds.Tables["land"]); + da.InsertCommand.Connection = conn; + + da.UpdateCommand = createUpdateCommand("land", "UUID=:UUID", ds.Tables["land"]); + da.UpdateCommand.Connection = conn; + + SqliteCommand delete = new SqliteCommand("delete from land where UUID=:UUID"); + delete.Parameters.Add(createSqliteParameter("UUID", typeof(String))); + da.DeleteCommand = delete; + da.DeleteCommand.Connection = conn; + } + + /// + /// + /// + /// + /// + private void setupLandAccessCommands(SqliteDataAdapter da, SqliteConnection conn) + { + da.InsertCommand = createInsertCommand("landaccesslist", ds.Tables["landaccesslist"]); + da.InsertCommand.Connection = conn; + + da.UpdateCommand = createUpdateCommand("landaccesslist", "LandUUID=:landUUID", "AccessUUID=:AccessUUID", ds.Tables["landaccesslist"]); + da.UpdateCommand.Connection = conn; + + SqliteCommand delete = new SqliteCommand("delete from landaccesslist where LandUUID= :LandUUID and AccessUUID= :AccessUUID"); + delete.Parameters.Add(createSqliteParameter("LandUUID", typeof(String))); + delete.Parameters.Add(createSqliteParameter("AccessUUID", typeof(String))); + da.DeleteCommand = delete; + da.DeleteCommand.Connection = conn; + + } + + private void setupRegionSettingsCommands(SqliteDataAdapter da, SqliteConnection conn) + { + da.InsertCommand = createInsertCommand("regionsettings", ds.Tables["regionsettings"]); + da.InsertCommand.Connection = conn; + da.UpdateCommand = createUpdateCommand("regionsettings", "regionUUID=:regionUUID", ds.Tables["regionsettings"]); + da.UpdateCommand.Connection = conn; + } + + /// + /// + /// + /// + /// + private void setupShapeCommands(SqliteDataAdapter da, SqliteConnection conn) + { + da.InsertCommand = createInsertCommand("primshapes", ds.Tables["primshapes"]); + da.InsertCommand.Connection = conn; + + da.UpdateCommand = createUpdateCommand("primshapes", "UUID=:UUID", ds.Tables["primshapes"]); + da.UpdateCommand.Connection = conn; + + SqliteCommand delete = new SqliteCommand("delete from primshapes where UUID = :UUID"); + delete.Parameters.Add(createSqliteParameter("UUID", typeof (String))); + delete.Connection = conn; + da.DeleteCommand = delete; + } + + /*********************************************************************** + * + * Type conversion functions + * + **********************************************************************/ + + /// + /// Type conversion function + /// + /// + /// + private static DbType dbtypeFromType(Type type) + { + if (type == typeof (String)) + { + return DbType.String; + } + else if (type == typeof (Int32)) + { + return DbType.Int32; + } + else if (type == typeof (Double)) + { + return DbType.Double; + } + else if (type == typeof (Byte)) + { + return DbType.Byte; + } + else if (type == typeof (Double)) + { + return DbType.Double; + } + else if (type == typeof (Byte[])) + { + return DbType.Binary; + } + else + { + return DbType.String; + } + } + + } +} diff --git a/OpenSim/Data/Tests/RegionTests.cs b/OpenSim/Data/Tests/RegionTests.cs index 29bf5a3..a081462 100644 --- a/OpenSim/Data/Tests/RegionTests.cs +++ b/OpenSim/Data/Tests/RegionTests.cs @@ -61,17 +61,17 @@ namespace OpenSim.Data.Tests #else [TestFixture(Description = "Region store tests (SQLite)")] - public class SQLiteRegionTests : RegionTests + public class SQLiteRegionTests : RegionTests { } [TestFixture(Description = "Region store tests (MySQL)")] - public class MySqlRegionTests : RegionTests + public class MySqlRegionTests : RegionTests { } [TestFixture(Description = "Region store tests (MS SQL Server)")] - public class MSSQLRegionTests : RegionTests + public class MSSQLRegionTests : RegionTests { } @@ -79,11 +79,11 @@ namespace OpenSim.Data.Tests public class RegionTests : BasicDataServiceTest where TConn : DbConnection, new() - where TRegStore : class, IRegionDataStore, new() + where TRegStore : class, ISimulationDataStore, new() { bool m_rebuildDB; - public IRegionDataStore db; + public ISimulationDataStore db; public UUID zero = UUID.Zero; public UUID region1 = UUID.Random(); public UUID region2 = UUID.Random(); @@ -122,7 +122,7 @@ namespace OpenSim.Data.Tests protected override void InitService(object service) { ClearDB(); - db = (IRegionDataStore)service; + db = (ISimulationDataStore)service; db.Initialise(m_connStr); } diff --git a/OpenSim/Region/Framework/Interfaces/IEntityInventory.cs b/OpenSim/Region/Framework/Interfaces/IEntityInventory.cs index ae2e844..54845fd 100644 --- a/OpenSim/Region/Framework/Interfaces/IEntityInventory.cs +++ b/OpenSim/Region/Framework/Interfaces/IEntityInventory.cs @@ -200,7 +200,7 @@ namespace OpenSim.Region.Framework.Interfaces /// Backup the inventory to the given data store /// /// - void ProcessInventoryBackup(IRegionDataStore datastore); + void ProcessInventoryBackup(ISimulationDataStore datastore); uint MaskEffectivePermissions(); diff --git a/OpenSim/Region/Framework/Interfaces/IRegionDataStore.cs b/OpenSim/Region/Framework/Interfaces/IRegionDataStore.cs deleted file mode 100644 index 3e8e196..0000000 --- a/OpenSim/Region/Framework/Interfaces/IRegionDataStore.cs +++ /dev/null @@ -1,111 +0,0 @@ -/* - * Copyright (c) Contributors, http://opensimulator.org/ - * See CONTRIBUTORS.TXT for a full list of copyright holders. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of the OpenSimulator Project nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -using System.Collections.Generic; -using OpenMetaverse; -using OpenSim.Framework; -using OpenSim.Region.Framework.Scenes; - -namespace OpenSim.Region.Framework.Interfaces -{ - public interface IRegionDataStore - { - /// - /// Initialises the data storage engine - /// - /// The file to save the database to (may not be applicable). Alternatively, - /// a connection string for the database - void Initialise(string filename); - - /// - /// Dispose the database - /// - void Dispose(); - - /// - /// Stores all object's details apart from inventory - /// - /// - /// - void StoreObject(SceneObjectGroup obj, UUID regionUUID); - - /// - /// Entirely removes the object, including inventory - /// - /// - /// - /// - void RemoveObject(UUID uuid, UUID regionUUID); - - /// - /// Store a prim's inventory - /// - /// - void StorePrimInventory(UUID primID, ICollection items); - - /// - /// Load persisted objects from region storage. - /// - /// the Region UUID - /// List of loaded groups - List LoadObjects(UUID regionUUID); - - /// - /// Store a terrain revision in region storage - /// - /// HeightField data - /// region UUID - void StoreTerrain(double[,] terrain, UUID regionID); - - /// - /// Load the latest terrain revision from region storage - /// - /// the region UUID - /// Heightfield data - double[,] LoadTerrain(UUID regionID); - - void StoreLandObject(ILandObject Parcel); - - /// - /// - /// delete from land where UUID=globalID - /// delete from landaccesslist where LandUUID=globalID - /// - /// - /// - void RemoveLandObject(UUID globalID); - - List LoadLandObjects(UUID regionUUID); - - void StoreRegionSettings(RegionSettings rs); - RegionSettings LoadRegionSettings(UUID regionUUID); - RegionLightShareData LoadRegionWindlightSettings(UUID regionUUID); - void StoreRegionWindlightSettings(RegionLightShareData wl); - - void Shutdown(); - } -} diff --git a/OpenSim/Region/Framework/Interfaces/ISimulationDataStore.cs b/OpenSim/Region/Framework/Interfaces/ISimulationDataStore.cs new file mode 100644 index 0000000..0a4d531 --- /dev/null +++ b/OpenSim/Region/Framework/Interfaces/ISimulationDataStore.cs @@ -0,0 +1,111 @@ +/* + * Copyright (c) Contributors, http://opensimulator.org/ + * See CONTRIBUTORS.TXT for a full list of copyright holders. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the OpenSimulator Project nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +using System.Collections.Generic; +using OpenMetaverse; +using OpenSim.Framework; +using OpenSim.Region.Framework.Scenes; + +namespace OpenSim.Region.Framework.Interfaces +{ + public interface ISimulationDataStore + { + /// + /// Initialises the data storage engine + /// + /// The file to save the database to (may not be applicable). Alternatively, + /// a connection string for the database + void Initialise(string filename); + + /// + /// Dispose the database + /// + void Dispose(); + + /// + /// Stores all object's details apart from inventory + /// + /// + /// + void StoreObject(SceneObjectGroup obj, UUID regionUUID); + + /// + /// Entirely removes the object, including inventory + /// + /// + /// + /// + void RemoveObject(UUID uuid, UUID regionUUID); + + /// + /// Store a prim's inventory + /// + /// + void StorePrimInventory(UUID primID, ICollection items); + + /// + /// Load persisted objects from region storage. + /// + /// the Region UUID + /// List of loaded groups + List LoadObjects(UUID regionUUID); + + /// + /// Store a terrain revision in region storage + /// + /// HeightField data + /// region UUID + void StoreTerrain(double[,] terrain, UUID regionID); + + /// + /// Load the latest terrain revision from region storage + /// + /// the region UUID + /// Heightfield data + double[,] LoadTerrain(UUID regionID); + + void StoreLandObject(ILandObject Parcel); + + /// + /// + /// delete from land where UUID=globalID + /// delete from landaccesslist where LandUUID=globalID + /// + /// + /// + void RemoveLandObject(UUID globalID); + + List LoadLandObjects(UUID regionUUID); + + void StoreRegionSettings(RegionSettings rs); + RegionSettings LoadRegionSettings(UUID regionUUID); + RegionLightShareData LoadRegionWindlightSettings(UUID regionUUID); + void StoreRegionWindlightSettings(RegionLightShareData wl); + + void Shutdown(); + } +} diff --git a/OpenSim/Region/Framework/Scenes/EventManager.cs b/OpenSim/Region/Framework/Scenes/EventManager.cs index c434e4f..6b2e03e 100644 --- a/OpenSim/Region/Framework/Scenes/EventManager.cs +++ b/OpenSim/Region/Framework/Scenes/EventManager.cs @@ -57,7 +57,7 @@ namespace OpenSim.Region.Framework.Scenes public event OnTerrainTickDelegate OnTerrainTick; - public delegate void OnBackupDelegate(IRegionDataStore datastore, bool forceBackup); + public delegate void OnBackupDelegate(ISimulationDataStore datastore, bool forceBackup); public event OnBackupDelegate OnBackup; @@ -684,7 +684,7 @@ namespace OpenSim.Region.Framework.Scenes } } - public void TriggerOnBackup(IRegionDataStore dstore, bool forced) + public void TriggerOnBackup(ISimulationDataStore dstore, bool forced) { OnBackupDelegate handlerOnAttach = OnBackup; if (handlerOnAttach != null) diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index ba5e33c..4024328 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -1378,7 +1378,7 @@ namespace OpenSim.Region.Framework.Scenes /// Processes backup. /// /// - public virtual void ProcessBackup(IRegionDataStore datastore, bool forcedBackup) + public virtual void ProcessBackup(ISimulationDataStore datastore, bool forcedBackup) { if (!m_isBackedUp) { diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs index 87c4860..1984d45 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs @@ -848,7 +848,7 @@ namespace OpenSim.Region.Framework.Scenes /// Process inventory backup /// /// - public void ProcessInventoryBackup(IRegionDataStore datastore) + public void ProcessInventoryBackup(ISimulationDataStore datastore) { if (HasInventoryChanged) { diff --git a/OpenSim/Region/Framework/StorageManager.cs b/OpenSim/Region/Framework/StorageManager.cs index 9375b4a..06caa18 100644 --- a/OpenSim/Region/Framework/StorageManager.cs +++ b/OpenSim/Region/Framework/StorageManager.cs @@ -36,9 +36,9 @@ namespace OpenSim.Region.Framework { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - protected IRegionDataStore m_dataStore; + protected ISimulationDataStore m_dataStore; - public IRegionDataStore DataStore + public ISimulationDataStore DataStore { get { return m_dataStore; } } @@ -50,7 +50,7 @@ namespace OpenSim.Region.Framework get { return m_estateDataStore; } } - public StorageManager(IRegionDataStore storage) + public StorageManager(ISimulationDataStore storage) { m_dataStore = storage; } @@ -68,8 +68,8 @@ namespace OpenSim.Region.Framework if (typeInterface != null) { - IRegionDataStore plug = - (IRegionDataStore) Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); + ISimulationDataStore plug = + (ISimulationDataStore)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); plug.Initialise(connectionstring); m_dataStore = plug; diff --git a/OpenSim/Tests/Common/Mock/MockRegionDataPlugin.cs b/OpenSim/Tests/Common/Mock/MockRegionDataPlugin.cs index 2a055cc..e95d26a 100644 --- a/OpenSim/Tests/Common/Mock/MockRegionDataPlugin.cs +++ b/OpenSim/Tests/Common/Mock/MockRegionDataPlugin.cs @@ -39,7 +39,7 @@ namespace OpenSim.Data.Null /// Mock region data plugin. This obeys the api contract for persistence but stores everything in memory, so that /// tests can check correct persistence. /// - public class NullDataStore : IRegionDataStore + public class NullDataStore : ISimulationDataStore { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); -- cgit v1.1 From e2544584ad57a30def4f6b13eeaafe90eb81fe9e Mon Sep 17 00:00:00 2001 From: John Hurliman Date: Sat, 11 Sep 2010 22:02:34 -0700 Subject: Changed all string references of "IRegionDataStore" to "ISimulationDataStore" --- OpenSim/Data/Null/NullSimulationData.cs | 1 - OpenSim/Data/SQLite/SQLiteSimulationData.cs | 2 -- OpenSim/Data/SQLiteLegacy/SQLiteSimulationData.cs | 2 -- OpenSim/Region/Framework/StorageManager.cs | 4 ++-- OpenSim/Tests/Common/Mock/MockRegionDataPlugin.cs | 1 - 5 files changed, 2 insertions(+), 8 deletions(-) diff --git a/OpenSim/Data/Null/NullSimulationData.cs b/OpenSim/Data/Null/NullSimulationData.cs index 9c7da8e..34d3a4e 100644 --- a/OpenSim/Data/Null/NullSimulationData.cs +++ b/OpenSim/Data/Null/NullSimulationData.cs @@ -73,7 +73,6 @@ namespace OpenSim.Data.Null { } - // see IRegionDatastore public void StorePrimInventory(UUID primID, ICollection items) { } diff --git a/OpenSim/Data/SQLite/SQLiteSimulationData.cs b/OpenSim/Data/SQLite/SQLiteSimulationData.cs index 55c27b2..1820f78 100644 --- a/OpenSim/Data/SQLite/SQLiteSimulationData.cs +++ b/OpenSim/Data/SQLite/SQLiteSimulationData.cs @@ -79,7 +79,6 @@ namespace OpenSim.Data.SQLite **********************************************************************/ /// - /// See IRegionDataStore /// /// Initialises RegionData Interface /// Loads and initialises a new SQLite connection and maintains it. @@ -1951,7 +1950,6 @@ namespace OpenSim.Data.SQLite } /// - /// see IRegionDatastore /// /// /// diff --git a/OpenSim/Data/SQLiteLegacy/SQLiteSimulationData.cs b/OpenSim/Data/SQLiteLegacy/SQLiteSimulationData.cs index 878117e..e9c6aa5 100644 --- a/OpenSim/Data/SQLiteLegacy/SQLiteSimulationData.cs +++ b/OpenSim/Data/SQLiteLegacy/SQLiteSimulationData.cs @@ -78,7 +78,6 @@ namespace OpenSim.Data.SQLiteLegacy **********************************************************************/ /// - /// See IRegionDataStore /// /// Initialises RegionData Interface /// Loads and initialises a new SQLite connection and maintains it. @@ -1888,7 +1887,6 @@ namespace OpenSim.Data.SQLiteLegacy } /// - /// see IRegionDatastore /// /// /// diff --git a/OpenSim/Region/Framework/StorageManager.cs b/OpenSim/Region/Framework/StorageManager.cs index 06caa18..47db2b3 100644 --- a/OpenSim/Region/Framework/StorageManager.cs +++ b/OpenSim/Region/Framework/StorageManager.cs @@ -64,7 +64,7 @@ namespace OpenSim.Region.Framework { if (pluginType.IsPublic) { - Type typeInterface = pluginType.GetInterface("IRegionDataStore", true); + Type typeInterface = pluginType.GetInterface("ISimulationDataStore", true); if (typeInterface != null) { @@ -74,7 +74,7 @@ namespace OpenSim.Region.Framework m_dataStore = plug; - m_log.Info("[DATASTORE]: Added IRegionDataStore Interface"); + m_log.Info("[DATASTORE]: Added ISimulationDataStore Interface"); } typeInterface = pluginType.GetInterface("IEstateDataStore", true); diff --git a/OpenSim/Tests/Common/Mock/MockRegionDataPlugin.cs b/OpenSim/Tests/Common/Mock/MockRegionDataPlugin.cs index e95d26a..315d405 100644 --- a/OpenSim/Tests/Common/Mock/MockRegionDataPlugin.cs +++ b/OpenSim/Tests/Common/Mock/MockRegionDataPlugin.cs @@ -114,7 +114,6 @@ namespace OpenSim.Data.Null } } - // see IRegionDatastore public void StorePrimInventory(UUID primID, ICollection items) { m_primItems[primID] = items; -- cgit v1.1 From 007912d6f4810192853c4aeee5f9834de748f2b2 Mon Sep 17 00:00:00 2001 From: John Hurliman Date: Sat, 11 Sep 2010 23:41:48 -0700 Subject: Shuffling fields and properties around in Scene to make Scene.cs more readable --- OpenSim/Region/Framework/Scenes/Scene.cs | 262 +++++++++++++++---------------- 1 file changed, 124 insertions(+), 138 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 6fa78e0..46b84bb 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -57,55 +57,21 @@ namespace OpenSim.Region.Framework.Scenes public partial class Scene : SceneBase { - public delegate void SynchronizeSceneHandler(Scene scene); - public SynchronizeSceneHandler SynchronizeScene = null; - - /* Used by the loadbalancer plugin on GForge */ - protected int m_splitRegionID = 0; - public int SplitRegionID - { - get { return m_splitRegionID; } - set { m_splitRegionID = value; } - } - private const long DEFAULT_MIN_TIME_FOR_PERSISTENCE = 60L; private const long DEFAULT_MAX_TIME_FOR_PERSISTENCE = 600L; - #region Fields + public delegate void SynchronizeSceneHandler(Scene scene); - protected Timer m_restartWaitTimer = new Timer(); + #region Fields + public SynchronizeSceneHandler SynchronizeScene; public SimStatsReporter StatsReporter; - - protected List m_regionRestartNotifyList = new List(); - protected List m_neighbours = new List(); - - private volatile int m_bordersLocked = 0; - public bool BordersLocked - { - get { return m_bordersLocked == 1; } - set - { - if (value == true) - m_bordersLocked = 1; - else - m_bordersLocked = 0; - } - } public List NorthBorders = new List(); public List EastBorders = new List(); public List SouthBorders = new List(); public List WestBorders = new List(); - /// - /// The scene graph for this scene - /// - /// TODO: Possibly stop other classes being able to manipulate this directly. - private SceneGraph m_sceneGraph; - - /// - /// Are we applying physics to any of the prims in this scene? - /// + /// Are we applying physics to any of the prims in this scene? public bool m_physicalPrim; public float m_maxNonphys = 256; public float m_maxPhys = 10; @@ -119,24 +85,127 @@ namespace OpenSim.Region.Framework.Scenes // root agents when ACL denies access to root agent public bool m_strictAccessControl = true; public int MaxUndoCount = 5; + public bool LoginsDisabled = true; + public bool LoadingPrims; + public IXfer XferManager; + + // the minimum time that must elapse before a changed object will be considered for persisted + public long m_dontPersistBefore = DEFAULT_MIN_TIME_FOR_PERSISTENCE * 10000000L; + // the maximum time that must elapse before a changed object will be considered for persisted + public long m_persistAfter = DEFAULT_MAX_TIME_FOR_PERSISTENCE * 10000000L; + + protected int m_splitRegionID; + protected Timer m_restartWaitTimer = new Timer(); + protected List m_regionRestartNotifyList = new List(); + protected List m_neighbours = new List(); + protected string m_simulatorVersion = "OpenSimulator Server"; + protected ModuleLoader m_moduleLoader; + protected StorageManager m_storageManager; + protected AgentCircuitManager m_authenticateHandler; + protected SceneCommunicationService m_sceneGridService; + + protected IAssetService m_AssetService; + protected IAuthorizationService m_AuthorizationService; + protected IInventoryService m_InventoryService; + protected IGridService m_GridService; + protected ILibraryService m_LibraryService; + protected ISimulationService m_simulationService; + protected IAuthenticationService m_AuthenticationService; + protected IPresenceService m_PresenceService; + protected IUserAccountService m_UserAccountService; + protected IAvatarService m_AvatarService; + protected IGridUserService m_GridUserService; + + protected IXMLRPC m_xmlrpcModule; + protected IWorldComm m_worldCommModule; + protected IAvatarFactory m_AvatarFactory; + protected IConfigSource m_config; + protected IRegionSerialiserModule m_serialiser; + protected IDialogModule m_dialogModule; + protected IEntityTransferModule m_teleportModule; + protected ICapabilitiesModule m_capsModule; + // Central Update Loop + protected int m_fps = 10; + protected uint m_frame; + protected float m_timespan = 0.089f; + protected DateTime m_lastupdate = DateTime.UtcNow; + + // TODO: Possibly stop other classes being able to manipulate this directly. + private SceneGraph m_sceneGraph; + private volatile int m_bordersLocked; private int m_RestartTimerCounter; private readonly Timer m_restartTimer = new Timer(15000); // Wait before firing private int m_incrementsof15seconds; private volatile bool m_backingup; - private Dictionary m_returns = new Dictionary(); private Dictionary m_groupsWithTargets = new Dictionary(); + private Object m_heartbeatLock = new Object(); - protected string m_simulatorVersion = "OpenSimulator Server"; + private int m_update_physics = 1; + private int m_update_entitymovement = 1; + private int m_update_objects = 1; // Update objects which have scheduled themselves for updates + private int m_update_presences = 1; // Update scene presence movements + private int m_update_events = 1; + private int m_update_backup = 200; + private int m_update_terrain = 50; + private int m_update_land = 1; + private int m_update_coarse_locations = 50; - protected ModuleLoader m_moduleLoader; - protected StorageManager m_storageManager; - protected AgentCircuitManager m_authenticateHandler; + private int frameMS; + private int physicsMS2; + private int physicsMS; + private int otherMS; + private int tempOnRezMS; + private int eventMS; + private int backupMS; + private int terrainMS; + private int landMS; + private int lastCompletedFrame; - protected SceneCommunicationService m_sceneGridService; - public bool LoginsDisabled = true; - public bool LoadingPrims = false; + private bool m_physics_enabled = true; + private bool m_scripts_enabled = true; + private string m_defaultScriptEngine; + private int m_LastLogin; + private Thread HeartbeatThread; + private volatile bool shuttingdown; + + private int m_lastUpdate; + private bool m_firstHeartbeat = true; + private object m_deleting_scene_object = new object(); + + private UpdatePrioritizationSchemes m_priorityScheme = UpdatePrioritizationSchemes.Time; + private bool m_reprioritizationEnabled = true; + private double m_reprioritizationInterval = 5000.0; + private double m_rootReprioritizationDistance = 10.0; + private double m_childReprioritizationDistance = 20.0; + + private Timer m_mapGenerationTimer = new Timer(); + private bool m_generateMaptiles; + + #endregion Fields + + #region Properties + + /* Used by the loadbalancer plugin on GForge */ + public int SplitRegionID + { + get { return m_splitRegionID; } + set { m_splitRegionID = value; } + } + + public bool BordersLocked + { + get { return m_bordersLocked == 1; } + set + { + if (value == true) + m_bordersLocked = 1; + else + m_bordersLocked = 0; + } + } + public new float TimeDilation { get { return m_sceneGraph.PhysicsScene.TimeDilation; } @@ -147,13 +216,6 @@ namespace OpenSim.Region.Framework.Scenes get { return m_sceneGridService; } } - public IXfer XferManager; - - protected IAssetService m_AssetService; - protected IAuthorizationService m_AuthorizationService; - - private Object m_heartbeatLock = new Object(); - public IAssetService AssetService { get @@ -191,8 +253,6 @@ namespace OpenSim.Region.Framework.Scenes } } - protected IInventoryService m_InventoryService; - public IInventoryService InventoryService { get @@ -211,8 +271,6 @@ namespace OpenSim.Region.Framework.Scenes } } - protected IGridService m_GridService; - public IGridService GridService { get @@ -231,8 +289,6 @@ namespace OpenSim.Region.Framework.Scenes } } - protected ILibraryService m_LibraryService; - public ILibraryService LibraryService { get @@ -244,7 +300,6 @@ namespace OpenSim.Region.Framework.Scenes } } - protected ISimulationService m_simulationService; public ISimulationService SimulationService { get @@ -255,7 +310,6 @@ namespace OpenSim.Region.Framework.Scenes } } - protected IAuthenticationService m_AuthenticationService; public IAuthenticationService AuthenticationService { get @@ -266,7 +320,6 @@ namespace OpenSim.Region.Framework.Scenes } } - protected IPresenceService m_PresenceService; public IPresenceService PresenceService { get @@ -276,7 +329,7 @@ namespace OpenSim.Region.Framework.Scenes return m_PresenceService; } } - protected IUserAccountService m_UserAccountService; + public IUserAccountService UserAccountService { get @@ -287,8 +340,7 @@ namespace OpenSim.Region.Framework.Scenes } } - protected OpenSim.Services.Interfaces.IAvatarService m_AvatarService; - public OpenSim.Services.Interfaces.IAvatarService AvatarService + public IAvatarService AvatarService { get { @@ -298,7 +350,6 @@ namespace OpenSim.Region.Framework.Scenes } } - protected IGridUserService m_GridUserService; public IGridUserService GridUserService { get @@ -309,58 +360,18 @@ namespace OpenSim.Region.Framework.Scenes } } - protected IXMLRPC m_xmlrpcModule; - protected IWorldComm m_worldCommModule; public IAttachmentsModule AttachmentsModule { get; set; } - protected IAvatarFactory m_AvatarFactory; + public IAvatarFactory AvatarFactory { get { return m_AvatarFactory; } } - protected IConfigSource m_config; - protected IRegionSerialiserModule m_serialiser; - protected IDialogModule m_dialogModule; - protected IEntityTransferModule m_teleportModule; - protected ICapabilitiesModule m_capsModule; public ICapabilitiesModule CapsModule { get { return m_capsModule; } } - protected override IConfigSource GetConfig() - { - return m_config; - } - - // Central Update Loop - - protected int m_fps = 10; - protected uint m_frame; - protected float m_timespan = 0.089f; - protected DateTime m_lastupdate = DateTime.UtcNow; - - private int m_update_physics = 1; - private int m_update_entitymovement = 1; - private int m_update_objects = 1; // Update objects which have scheduled themselves for updates - private int m_update_presences = 1; // Update scene presence movements - private int m_update_events = 1; - private int m_update_backup = 200; - private int m_update_terrain = 50; - private int m_update_land = 1; - private int m_update_coarse_locations = 50; - - private int frameMS; - private int physicsMS2; - private int physicsMS; - private int otherMS; - private int tempOnRezMS; - private int eventMS; - private int backupMS; - private int terrainMS; - private int landMS; - private int lastCompletedFrame; - public int MonitorFrameTime { get { return frameMS; } } public int MonitorPhysicsUpdateTime { get { return physicsMS; } } public int MonitorPhysicsSyncTime { get { return physicsMS2; } } @@ -372,36 +383,6 @@ namespace OpenSim.Region.Framework.Scenes public int MonitorLandTime { get { return landMS; } } public int MonitorLastFrameTick { get { return lastCompletedFrame; } } - private bool m_physics_enabled = true; - private bool m_scripts_enabled = true; - private string m_defaultScriptEngine; - private int m_LastLogin; - private Thread HeartbeatThread; - private volatile bool shuttingdown; - - private int m_lastUpdate; - private bool m_firstHeartbeat = true; - - private object m_deleting_scene_object = new object(); - - // the minimum time that must elapse before a changed object will be considered for persisted - public long m_dontPersistBefore = DEFAULT_MIN_TIME_FOR_PERSISTENCE * 10000000L; - // the maximum time that must elapse before a changed object will be considered for persisted - public long m_persistAfter = DEFAULT_MAX_TIME_FOR_PERSISTENCE * 10000000L; - - private UpdatePrioritizationSchemes m_priorityScheme = UpdatePrioritizationSchemes.Time; - private bool m_reprioritizationEnabled = true; - private double m_reprioritizationInterval = 5000.0; - private double m_rootReprioritizationDistance = 10.0; - private double m_childReprioritizationDistance = 20.0; - - private Timer m_mapGenerationTimer = new Timer(); - bool m_generateMaptiles = false; - - #endregion - - #region Properties - public UpdatePrioritizationSchemes UpdatePrioritizationScheme { get { return m_priorityScheme; } } public bool IsReprioritizationEnabled { get { return m_reprioritizationEnabled; } } public double ReprioritizationInterval { get { return m_reprioritizationInterval; } } @@ -481,7 +462,7 @@ namespace OpenSim.Region.Framework.Scenes set { m_sceneGraph.RestorePresences = value; } } - #endregion + #endregion Properties #region Constructors @@ -3954,6 +3935,11 @@ namespace OpenSim.Region.Framework.Scenes #region Other Methods + protected override IConfigSource GetConfig() + { + return m_config; + } + #endregion public void HandleObjectPermissionsUpdate(IClientAPI controller, UUID agentID, UUID sessionID, byte field, uint localId, uint mask, byte set) -- cgit v1.1 From 16d782eaa25e73e39b8aaa02383592ac4813a109 Mon Sep 17 00:00:00 2001 From: John Hurliman Date: Sun, 12 Sep 2010 00:30:13 -0700 Subject: Added a stub for OpenSim.Services.Connectors.Simulation.SimulationDataServiceConnector --- .../Framework/Interfaces/ISimulationDataService.cs | 98 ++++++++++++++++ OpenSim/Region/Framework/StorageManager.cs | 24 +--- .../Simulation/SimulationDataServiceConnector.cs | 125 +++++++++++++++++++++ 3 files changed, 227 insertions(+), 20 deletions(-) create mode 100644 OpenSim/Region/Framework/Interfaces/ISimulationDataService.cs create mode 100644 OpenSim/Services/Connectors/Simulation/SimulationDataServiceConnector.cs diff --git a/OpenSim/Region/Framework/Interfaces/ISimulationDataService.cs b/OpenSim/Region/Framework/Interfaces/ISimulationDataService.cs new file mode 100644 index 0000000..edaa07c --- /dev/null +++ b/OpenSim/Region/Framework/Interfaces/ISimulationDataService.cs @@ -0,0 +1,98 @@ +/* + * Copyright (c) Contributors, http://opensimulator.org/ + * See CONTRIBUTORS.TXT for a full list of copyright holders. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the OpenSimulator Project nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +using System; +using System.Collections.Generic; +using OpenMetaverse; +using OpenSim.Framework; +using OpenSim.Region.Framework.Scenes; + +namespace OpenSim.Region.Framework.Interfaces +{ + public interface ISimulationDataService + { + /// + /// Stores all object's details apart from inventory + /// + /// + /// + void StoreObject(SceneObjectGroup obj, UUID regionUUID); + + /// + /// Entirely removes the object, including inventory + /// + /// + /// + /// + void RemoveObject(UUID uuid, UUID regionUUID); + + /// + /// Store a prim's inventory + /// + /// + void StorePrimInventory(UUID primID, ICollection items); + + /// + /// Load persisted objects from region storage. + /// + /// the Region UUID + /// List of loaded groups + List LoadObjects(UUID regionUUID); + + /// + /// Store a terrain revision in region storage + /// + /// HeightField data + /// region UUID + void StoreTerrain(double[,] terrain, UUID regionID); + + /// + /// Load the latest terrain revision from region storage + /// + /// the region UUID + /// Heightfield data + double[,] LoadTerrain(UUID regionID); + + void StoreLandObject(ILandObject Parcel); + + /// + /// + /// delete from land where UUID=globalID + /// delete from landaccesslist where LandUUID=globalID + /// + /// + /// + void RemoveLandObject(UUID globalID); + + List LoadLandObjects(UUID regionUUID); + + void StoreRegionSettings(RegionSettings rs); + RegionSettings LoadRegionSettings(UUID regionUUID); + RegionLightShareData LoadRegionWindlightSettings(UUID regionUUID); + void StoreRegionWindlightSettings(RegionLightShareData wl); + } +} diff --git a/OpenSim/Region/Framework/StorageManager.cs b/OpenSim/Region/Framework/StorageManager.cs index 47db2b3..c858d56 100644 --- a/OpenSim/Region/Framework/StorageManager.cs +++ b/OpenSim/Region/Framework/StorageManager.cs @@ -36,24 +36,8 @@ namespace OpenSim.Region.Framework { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - protected ISimulationDataStore m_dataStore; - - public ISimulationDataStore DataStore - { - get { return m_dataStore; } - } - - private IEstateDataStore m_estateDataStore; - - public IEstateDataStore EstateDataStore - { - get { return m_estateDataStore; } - } - - public StorageManager(ISimulationDataStore storage) - { - m_dataStore = storage; - } + public readonly ISimulationDataStore DataStore; + public readonly IEstateDataStore EstateDataStore; public StorageManager(string dllName, string connectionstring, string estateconnectionstring) { @@ -72,7 +56,7 @@ namespace OpenSim.Region.Framework (ISimulationDataStore)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); plug.Initialise(connectionstring); - m_dataStore = plug; + DataStore = plug; m_log.Info("[DATASTORE]: Added ISimulationDataStore Interface"); } @@ -85,7 +69,7 @@ namespace OpenSim.Region.Framework (IEstateDataStore) Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); estPlug.Initialise(estateconnectionstring); - m_estateDataStore = estPlug; + EstateDataStore = estPlug; } } } diff --git a/OpenSim/Services/Connectors/Simulation/SimulationDataServiceConnector.cs b/OpenSim/Services/Connectors/Simulation/SimulationDataServiceConnector.cs new file mode 100644 index 0000000..93147d4 --- /dev/null +++ b/OpenSim/Services/Connectors/Simulation/SimulationDataServiceConnector.cs @@ -0,0 +1,125 @@ +/* + * Copyright (c) Contributors, http://opensimulator.org/ + * See CONTRIBUTORS.TXT for a full list of copyright holders. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the OpenSimulator Project nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +using System; +using System.Collections.Generic; +using System.Reflection; +using log4net; +using Nini.Config; +using OpenMetaverse; +using OpenSim.Framework; +using OpenSim.Region.Framework.Interfaces; +using OpenSim.Region.Framework.Scenes; +using OpenSim.Server.Base; + +namespace OpenSim.Services.Connectors.Simulation +{ + public class SimulationDataServiceConnector : ISimulationDataService + { + private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + + private ISimulationDataStore m_simDataStore; + + public SimulationDataServiceConnector() + { + } + + public SimulationDataServiceConnector(IConfigSource config) + { + Initialise(config); + } + + public virtual void Initialise(IConfigSource config) + { + IConfig serverConfig = config.Configs["SimulationDataStore"]; + if (serverConfig == null) + throw new Exception("No section 'SimulationDataStore' in config file"); + + string simDataStore = serverConfig.GetString("StoreModule", String.Empty); + + Object[] args = new Object[] { config }; + m_simDataStore = ServerUtils.LoadPlugin(simDataStore, args); + } + + public void StoreObject(SceneObjectGroup obj, UUID regionUUID) + { + } + + public void RemoveObject(UUID uuid, UUID regionUUID) + { + } + + public void StorePrimInventory(UUID primID, ICollection items) + { + } + + public List LoadObjects(UUID regionUUID) + { + return new List(0); + } + + public void StoreTerrain(double[,] terrain, UUID regionID) + { + } + + public double[,] LoadTerrain(UUID regionID) + { + return new double[Constants.RegionSize, Constants.RegionSize]; + } + + public void StoreLandObject(ILandObject Parcel) + { + } + + public void RemoveLandObject(UUID globalID) + { + } + + public List LoadLandObjects(UUID regionUUID) + { + return new List(0); + } + + public void StoreRegionSettings(RegionSettings rs) + { + } + + public RegionSettings LoadRegionSettings(UUID regionUUID) + { + return null; + } + + public RegionLightShareData LoadRegionWindlightSettings(UUID regionUUID) + { + return null; + } + + public void StoreRegionWindlightSettings(RegionLightShareData wl) + { + } + } +} -- cgit v1.1 From 20cd1da6bf6118352af1f1f206bcd2303f098d6d Mon Sep 17 00:00:00 2001 From: Jeff Ames Date: Sun, 12 Sep 2010 12:54:31 -0400 Subject: Add copyright headers. --- OpenSim/Data/DBGuids.cs | 29 +++++++++++++++++++++++++- OpenSim/Data/Null/NullInventoryData.cs | 29 +++++++++++++++++++++++++- OpenSim/Data/Tests/BasicDataServiceTest.cs | 29 +++++++++++++++++++++++++- OpenSim/Data/Tests/DefaultTestConns.cs | 29 +++++++++++++++++++++++++- OpenSim/Framework/Console/MockConsole.cs | 29 +++++++++++++++++++++++++- OpenSim/Framework/Lazy.cs | 2 +- OpenSim/Region/Framework/Scenes/Prioritizer.cs | 27 ++++++++++++++++++++++++ 7 files changed, 168 insertions(+), 6 deletions(-) diff --git a/OpenSim/Data/DBGuids.cs b/OpenSim/Data/DBGuids.cs index fb6832b..c40e8bb 100644 --- a/OpenSim/Data/DBGuids.cs +++ b/OpenSim/Data/DBGuids.cs @@ -1,4 +1,31 @@ -using System; +/* + * Copyright (c) Contributors, http://opensimulator.org/ + * See CONTRIBUTORS.TXT for a full list of copyright holders. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the OpenSimulator Project nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +using System; using System.Collections.Generic; using System.Text; using OpenMetaverse; diff --git a/OpenSim/Data/Null/NullInventoryData.cs b/OpenSim/Data/Null/NullInventoryData.cs index 8f196e2..fe9ed01 100644 --- a/OpenSim/Data/Null/NullInventoryData.cs +++ b/OpenSim/Data/Null/NullInventoryData.cs @@ -1,4 +1,31 @@ -using System; +/* + * Copyright (c) Contributors, http://opensimulator.org/ + * See CONTRIBUTORS.TXT for a full list of copyright holders. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the OpenSimulator Project nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +using System; using System.Collections.Generic; using OpenMetaverse; diff --git a/OpenSim/Data/Tests/BasicDataServiceTest.cs b/OpenSim/Data/Tests/BasicDataServiceTest.cs index c261126..272a2ca 100644 --- a/OpenSim/Data/Tests/BasicDataServiceTest.cs +++ b/OpenSim/Data/Tests/BasicDataServiceTest.cs @@ -1,4 +1,31 @@ -using System; +/* + * Copyright (c) Contributors, http://opensimulator.org/ + * See CONTRIBUTORS.TXT for a full list of copyright holders. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the OpenSimulator Project nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +using System; using System.IO; using System.Collections.Generic; using log4net.Config; diff --git a/OpenSim/Data/Tests/DefaultTestConns.cs b/OpenSim/Data/Tests/DefaultTestConns.cs index 7b52af5..7c47bdd 100644 --- a/OpenSim/Data/Tests/DefaultTestConns.cs +++ b/OpenSim/Data/Tests/DefaultTestConns.cs @@ -1,4 +1,31 @@ -using System; +/* + * Copyright (c) Contributors, http://opensimulator.org/ + * See CONTRIBUTORS.TXT for a full list of copyright holders. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the OpenSimulator Project nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +using System; using System.Collections.Generic; using System.Linq; using System.Text; diff --git a/OpenSim/Framework/Console/MockConsole.cs b/OpenSim/Framework/Console/MockConsole.cs index 9eb1977..a29b370 100644 --- a/OpenSim/Framework/Console/MockConsole.cs +++ b/OpenSim/Framework/Console/MockConsole.cs @@ -1,4 +1,31 @@ -using System; +/* + * Copyright (c) Contributors, http://opensimulator.org/ + * See CONTRIBUTORS.TXT for a full list of copyright holders. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the OpenSimulator Project nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +using System; using System.Threading; using System.Collections.Generic; using System.Text; diff --git a/OpenSim/Framework/Lazy.cs b/OpenSim/Framework/Lazy.cs index 8a417ac..91de4bd 100644 --- a/OpenSim/Framework/Lazy.cs +++ b/OpenSim/Framework/Lazy.cs @@ -1,4 +1,4 @@ -// +// // Lazy.cs // // Authors: diff --git a/OpenSim/Region/Framework/Scenes/Prioritizer.cs b/OpenSim/Region/Framework/Scenes/Prioritizer.cs index 272f718..581b11c 100644 --- a/OpenSim/Region/Framework/Scenes/Prioritizer.cs +++ b/OpenSim/Region/Framework/Scenes/Prioritizer.cs @@ -1,3 +1,30 @@ +/* + * Copyright (c) Contributors, http://opensimulator.org/ + * See CONTRIBUTORS.TXT for a full list of copyright holders. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the OpenSimulator Project nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + using System; using System.Collections.Generic; using log4net; -- cgit v1.1 From f1f0bc23f4501ba99035283d3407ddad2b21b785 Mon Sep 17 00:00:00 2001 From: Jeff Ames Date: Sun, 12 Sep 2010 13:43:49 -0400 Subject: Formatting cleanup. --- .../Rest/Inventory/RestAppearanceServices.cs | 4 +- OpenSim/Data/DBGuids.cs | 2 +- OpenSim/Data/MSSQL/MSSQLSimulationData.cs | 6 +- OpenSim/Data/Migration.cs | 14 +- OpenSim/Data/MySQL/MySQLInventoryData.cs | 2 +- OpenSim/Data/MySQL/MySQLSimulationData.cs | 22 +- OpenSim/Data/SQLite/SQLiteInventoryStore.cs | 6 +- OpenSim/Data/SQLite/SQLiteSimulationData.cs | 57 +++-- OpenSim/Data/Tests/BasicDataServiceTest.cs | 10 +- OpenSim/Framework/Capabilities/Caps.cs | 2 +- OpenSim/Framework/Console/CommandConsole.cs | 2 +- OpenSim/Framework/Console/LocalConsole.cs | 18 +- OpenSim/Framework/LandData.cs | 28 +-- OpenSim/Framework/LandUpdateArgs.cs | 14 +- OpenSim/Framework/PrimitiveBaseShape.cs | 74 +++--- OpenSim/Framework/RegionInfo.cs | 28 +-- .../Framework/Serialization/ArchiveConstants.cs | 20 +- .../Framework/Servers/HttpServer/BaseHttpServer.cs | 121 +++++----- OpenSim/Region/Application/Application.cs | 2 +- OpenSim/Region/Application/OpenSim.cs | 16 +- .../Region/ClientStack/LindenUDP/LLClientView.cs | 261 ++++++++++----------- .../Avatar/Attachments/AttachmentsModule.cs | 24 +- .../CoreModules/Avatar/Combat/CombatModule.cs | 4 +- .../Region/CoreModules/Avatar/Gods/GodsModule.cs | 6 +- .../Avatar/InstantMessage/MessageTransferModule.cs | 2 +- .../Archiver/InventoryArchiveReadRequest.cs | 18 +- .../Archiver/InventoryArchiveWriteRequest.cs | 10 +- .../Archiver/InventoryArchiverException.cs | 2 +- .../Inventory/Archiver/InventoryArchiverModule.cs | 28 +-- .../Archiver/Tests/InventoryArchiverTests.cs | 54 ++--- .../Framework/EventQueue/EventQueueGetModule.cs | 4 +- .../Framework/EventQueue/EventQueueHelper.cs | 18 +- .../InventoryAccess/InventoryAccessModule.cs | 2 +- .../Statistics/Logging/BinaryLoggingModule.cs | 12 +- .../Inventory/InventoryCache.cs | 2 +- .../Inventory/LocalInventoryServiceConnector.cs | 2 +- .../Inventory/RemoteXInventoryServiceConnector.cs | 2 +- .../CoreModules/World/Archiver/ArchiveHelpers.cs | 8 +- .../CoreModules/World/Land/LandManagementModule.cs | 115 +++++---- .../Region/CoreModules/World/Land/LandObject.cs | 14 +- .../CoreModules/World/Media/Moap/MoapModule.cs | 98 ++++---- .../World/Objects/BuySell/BuySellModule.cs | 14 +- .../World/Permissions/PermissionsModule.cs | 22 +- .../CoreModules/World/Terrain/TerrainModule.cs | 2 +- .../Region/CoreModules/World/Wind/WindModule.cs | 2 +- .../CoreModules/World/WorldMap/MapImageModule.cs | 2 +- .../CoreModules/World/WorldMap/WorldMapModule.cs | 2 +- .../Framework/Interfaces/IAttachmentsModule.cs | 2 +- .../Region/Framework/Interfaces/IGroupsModule.cs | 6 +- .../Interfaces/IInventoryArchiverModule.cs | 16 +- OpenSim/Region/Framework/Interfaces/IMoapModule.cs | 2 +- .../Region/Framework/Interfaces/IWorldMapModule.cs | 2 +- OpenSim/Region/Framework/Scenes/EventManager.cs | 12 +- OpenSim/Region/Framework/Scenes/Prioritizer.cs | 10 +- OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | 12 +- .../Framework/Scenes/Scene.PacketHandlers.cs | 2 +- .../Region/Framework/Scenes/Scene.Permissions.cs | 2 +- OpenSim/Region/Framework/Scenes/Scene.cs | 18 +- OpenSim/Region/Framework/Scenes/SceneBase.cs | 2 +- OpenSim/Region/Framework/Scenes/SceneGraph.cs | 6 +- .../Region/Framework/Scenes/SceneObjectGroup.cs | 18 +- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 22 +- .../Framework/Scenes/SceneObjectPartInventory.cs | 2 +- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 2 +- OpenSim/Region/Framework/Scenes/SceneViewer.cs | 4 +- .../Framework/Scenes/Tests/SceneGraphTests.cs | 4 +- .../Scenes/Tests/SceneObjectLinkingTests.cs | 18 +- .../Framework/Scenes/Tests/TaskInventoryTests.cs | 14 +- .../Avatar/XmlRpcGroups/GroupsModule.cs | 2 +- .../SimianGroupsServicesConnectorModule.cs | 39 ++- .../XmlRpcGroupsServicesConnectorModule.cs | 4 +- .../ContentManagementSystem/MetaEntity.cs | 2 +- .../Scripting/Minimodule/SOPObject.cs | 4 +- .../World/MoneyModule/SampleMoneyModule.cs | 2 +- .../RegionCombinerIndividualEventForwarder.cs | 4 +- .../RegionCombinerLargeLandChannel.cs | 6 +- .../Shared/Api/Implementation/LSL_Api.cs | 8 +- .../Shared/Api/Implementation/OSSL_Api.cs | 6 +- .../Api/Implementation/Plugins/SensorRepeat.cs | 4 +- OpenSim/Region/ScriptEngine/XEngine/XEngine.cs | 2 +- OpenSim/Server/Base/ServerUtils.cs | 2 +- .../Hypergrid/GatekeeperServiceConnector.cs | 2 +- .../Connectors/Inventory/XInventoryConnector.cs | 2 +- .../Services/InventoryService/InventoryService.cs | 4 +- OpenSim/Services/LLLoginService/LLLoginService.cs | 2 +- .../UserAccountService/UserAccountService.cs | 20 +- OpenSim/Tests/Common/Mock/MockRegionDataPlugin.cs | 6 +- OpenSim/Tests/Common/Mock/TestScene.cs | 2 +- OpenSim/Tests/Common/Setup/AssetHelpers.cs | 4 +- OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs | 37 ++- .../Tests/Common/Setup/UserInventoryTestUtils.cs | 4 +- OpenSim/Tests/Common/Setup/UserProfileTestUtils.cs | 8 +- 92 files changed, 756 insertions(+), 774 deletions(-) diff --git a/OpenSim/ApplicationPlugins/Rest/Inventory/RestAppearanceServices.cs b/OpenSim/ApplicationPlugins/Rest/Inventory/RestAppearanceServices.cs index 4369216..8271d76 100644 --- a/OpenSim/ApplicationPlugins/Rest/Inventory/RestAppearanceServices.cs +++ b/OpenSim/ApplicationPlugins/Rest/Inventory/RestAppearanceServices.cs @@ -384,7 +384,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory // } // // rdata.Respond(String.Format("Appearance {0} : Normal completion", rdata.method)); -// +// // } /// @@ -449,7 +449,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory // rdata.userAppearance = new AvatarAppearance(); // rdata.userAppearance.Owner = old.Owner; // adata = new AvatarData(rdata.userAppearance); -// +// // Rest.AvatarServices.SetAvatar(rdata.userProfile.ID, adata); // // rdata.Complete(); diff --git a/OpenSim/Data/DBGuids.cs b/OpenSim/Data/DBGuids.cs index c40e8bb..ad1c19c 100644 --- a/OpenSim/Data/DBGuids.cs +++ b/OpenSim/Data/DBGuids.cs @@ -44,7 +44,7 @@ namespace OpenSim.Data /// public static UUID FromDB(object id) { - if( (id == null) || (id == DBNull.Value)) + if ((id == null) || (id == DBNull.Value)) return UUID.Zero; if (id.GetType() == typeof(Guid)) diff --git a/OpenSim/Data/MSSQL/MSSQLSimulationData.cs b/OpenSim/Data/MSSQL/MSSQLSimulationData.cs index ae105d5..e4bfc28 100644 --- a/OpenSim/Data/MSSQL/MSSQLSimulationData.cs +++ b/OpenSim/Data/MSSQL/MSSQLSimulationData.cs @@ -1126,7 +1126,7 @@ VALUES prim.LinkNum = Convert.ToInt32(primRow["LinkNumber"]); if (!(primRow["MediaURL"] is System.DBNull)) - prim.MediaUrl = (string)primRow["MediaURL"]; + prim.MediaUrl = (string)primRow["MediaURL"]; return prim; } @@ -1180,7 +1180,7 @@ VALUES { } - if (!(shapeRow["Media"] is System.DBNull)) + if (!(shapeRow["Media"] is System.DBNull)) baseShape.Media = PrimitiveBaseShape.MediaList.FromXml((string)shapeRow["Media"]); return baseShape; @@ -1511,7 +1511,7 @@ VALUES parameters.Add(_Database.CreateParameter("PassTouches", 1)); else parameters.Add(_Database.CreateParameter("PassTouches", 0)); - parameters.Add(_Database.CreateParameter("LinkNumber", prim.LinkNum)); + parameters.Add(_Database.CreateParameter("LinkNumber", prim.LinkNum)); parameters.Add(_Database.CreateParameter("MediaURL", prim.MediaUrl)); return parameters.ToArray(); diff --git a/OpenSim/Data/Migration.cs b/OpenSim/Data/Migration.cs index 86531d9..fc9a142 100644 --- a/OpenSim/Data/Migration.cs +++ b/OpenSim/Data/Migration.cs @@ -122,7 +122,7 @@ namespace OpenSim.Data int ver = FindVersion(_conn, "migrations"); if (ver <= 0) // -1 = no table, 0 = no version record { - if( ver < 0 ) + if (ver < 0) ExecuteScript("create table migrations(name varchar(100), version int)"); InsertVersion("migrations", 1); } @@ -288,7 +288,7 @@ namespace OpenSim.Data SortedList migrations = new SortedList(); string[] names = _assem.GetManifestResourceNames(); - if( names.Length == 0 ) // should never happen + if (names.Length == 0) // should never happen return migrations; Array.Sort(names); // we want all the migrations ordered @@ -297,7 +297,7 @@ namespace OpenSim.Data Match m = null; string sFile = Array.FindLast(names, nm => { m = _match_new.Match(nm); return m.Success; }); // ; nm.StartsWith(sPrefix, StringComparison.InvariantCultureIgnoreCase - if( (m != null) && !String.IsNullOrEmpty(sFile) ) + if ((m != null) && !String.IsNullOrEmpty(sFile)) { /* The filename should be '.migrations[.NNN]' where NNN * is the last version number defined in the file. If the '.NNN' part is recognized, the code can skip @@ -312,7 +312,7 @@ namespace OpenSim.Data if (m.Groups.Count > 1 && int.TryParse(m.Groups[1].Value, out nLastVerFound)) { - if( nLastVerFound <= after ) + if (nLastVerFound <= after) goto scan_old_style; } @@ -329,7 +329,7 @@ namespace OpenSim.Data sb.Length = 0; } - if ( (nVersion > 0) && (nVersion > after) && (script.Count > 0) && !migrations.ContainsKey(nVersion)) // script to the versioned script list + if ((nVersion > 0) && (nVersion > after) && (script.Count > 0) && !migrations.ContainsKey(nVersion)) // script to the versioned script list { migrations[nVersion] = script.ToArray(); } @@ -345,7 +345,7 @@ namespace OpenSim.Data string sLine = resourceReader.ReadLine(); nLineNo++; - if( String.IsNullOrEmpty(sLine) || sLine.StartsWith("#") ) // ignore a comment or empty line + if (String.IsNullOrEmpty(sLine) || sLine.StartsWith("#")) // ignore a comment or empty line continue; if (sLine.Trim().Equals(":GO", StringComparison.InvariantCultureIgnoreCase)) @@ -392,7 +392,7 @@ scan_old_style: if (m.Success) { int version = int.Parse(m.Groups[1].ToString()); - if ( (version > after) && !migrations.ContainsKey(version) ) + if ((version > after) && !migrations.ContainsKey(version)) { using (Stream resource = _assem.GetManifestResourceStream(s)) { diff --git a/OpenSim/Data/MySQL/MySQLInventoryData.cs b/OpenSim/Data/MySQL/MySQLInventoryData.cs index 0aea30f..2dca3eb 100644 --- a/OpenSim/Data/MySQL/MySQLInventoryData.cs +++ b/OpenSim/Data/MySQL/MySQLInventoryData.cs @@ -286,7 +286,7 @@ namespace OpenSim.Data.MySQL InventoryItemBase item = new InventoryItemBase(); // TODO: this is to handle a case where NULLs creep in there, which we are not sure is endemic to the system, or legacy. It would be nice to live fix these. - // ( DBGuid.FromDB() reads db NULLs as well, returns UUID.Zero ) + // (DBGuid.FromDB() reads db NULLs as well, returns UUID.Zero) item.CreatorId = reader["creatorID"].ToString(); // Be a bit safer in parsing these because the diff --git a/OpenSim/Data/MySQL/MySQLSimulationData.cs b/OpenSim/Data/MySQL/MySQLSimulationData.cs index 36f73ef..8201cef 100644 --- a/OpenSim/Data/MySQL/MySQLSimulationData.cs +++ b/OpenSim/Data/MySQL/MySQLSimulationData.cs @@ -680,7 +680,7 @@ namespace OpenSim.Data.MySQL "UserLocationX, UserLocationY, UserLocationZ, " + "UserLookAtX, UserLookAtY, UserLookAtZ, " + "AuthbuyerID, OtherCleanTime, MediaType, MediaDescription, " + - "MediaSize, MediaLoop, ObscureMusic, ObscureMedia) values (" + + "MediaSize, MediaLoop, ObscureMusic, ObscureMedia) values (" + "?UUID, ?RegionUUID, " + "?LocalLandID, ?Bitmap, ?Name, ?Description, " + "?OwnerUUID, ?IsGroupOwned, ?Area, ?AuctionID, " + @@ -691,7 +691,7 @@ namespace OpenSim.Data.MySQL "?UserLocationX, ?UserLocationY, ?UserLocationZ, " + "?UserLookAtX, ?UserLookAtY, ?UserLookAtZ, " + "?AuthbuyerID, ?OtherCleanTime, ?MediaType, ?MediaDescription, "+ - "CONCAT(?MediaWidth, ',', ?MediaHeight), ?MediaLoop, ?ObscureMusic, ?ObscureMedia)"; + "CONCAT(?MediaWidth, ',', ?MediaHeight), ?MediaLoop, ?ObscureMusic, ?ObscureMedia)"; FillLandCommand(cmd, parcel.LandData, parcel.RegionUUID); @@ -728,7 +728,7 @@ namespace OpenSim.Data.MySQL string command = "select * from `regionwindlight` where region_id = ?regionID"; - using(MySqlCommand cmd = new MySqlCommand(command)) + using (MySqlCommand cmd = new MySqlCommand(command)) { cmd.Connection = dbcon; @@ -1350,13 +1350,13 @@ namespace OpenSim.Data.MySQL m_log.ErrorFormat("[PARCEL]: unable to get parcel telehub settings for {1}", newData.Name); } - newData.MediaDescription = (string) row["MediaDescription"]; - newData.MediaType = (string) row["MediaType"]; - newData.MediaWidth = Convert.ToInt32((((string) row["MediaSize"]).Split(','))[0]); - newData.MediaHeight = Convert.ToInt32((((string) row["MediaSize"]).Split(','))[1]); - newData.MediaLoop = Convert.ToBoolean(row["MediaLoop"]); - newData.ObscureMusic = Convert.ToBoolean(row["ObscureMusic"]); - newData.ObscureMedia = Convert.ToBoolean(row["ObscureMedia"]); + newData.MediaDescription = (string) row["MediaDescription"]; + newData.MediaType = (string) row["MediaType"]; + newData.MediaWidth = Convert.ToInt32((((string) row["MediaSize"]).Split(','))[0]); + newData.MediaHeight = Convert.ToInt32((((string) row["MediaSize"]).Split(','))[1]); + newData.MediaLoop = Convert.ToBoolean(row["MediaLoop"]); + newData.ObscureMusic = Convert.ToBoolean(row["ObscureMusic"]); + newData.ObscureMedia = Convert.ToBoolean(row["ObscureMedia"]); newData.ParcelAccessList = new List(); @@ -1724,7 +1724,7 @@ namespace OpenSim.Data.MySQL s.State = (byte)(int)row["State"]; - if (!(row["Media"] is System.DBNull)) + if (!(row["Media"] is System.DBNull)) s.Media = PrimitiveBaseShape.MediaList.FromXml((string)row["Media"]); return s; diff --git a/OpenSim/Data/SQLite/SQLiteInventoryStore.cs b/OpenSim/Data/SQLite/SQLiteInventoryStore.cs index ece2495..ecf8e02 100644 --- a/OpenSim/Data/SQLite/SQLiteInventoryStore.cs +++ b/OpenSim/Data/SQLite/SQLiteInventoryStore.cs @@ -731,12 +731,12 @@ namespace OpenSim.Data.SQLite **********************************************************************/ protected void CreateDataSetMapping(IDataAdapter da, string tableName) - { + { ITableMapping dbMapping = da.TableMappings.Add(tableName, tableName); foreach (DataColumn col in ds.Tables[tableName].Columns) - { + { dbMapping.ColumnMappings.Add(col.ColumnName, col.ColumnName); - } + } } /// diff --git a/OpenSim/Data/SQLite/SQLiteSimulationData.cs b/OpenSim/Data/SQLite/SQLiteSimulationData.cs index 1820f78..7460961 100644 --- a/OpenSim/Data/SQLite/SQLiteSimulationData.cs +++ b/OpenSim/Data/SQLite/SQLiteSimulationData.cs @@ -176,7 +176,7 @@ namespace OpenSim.Data.SQLite { m_log.Info("[SQLITE REGION DB]: Caught fill error on primitems table"); } - + try { terrainDa.Fill(ds.Tables["terrain"]); @@ -510,7 +510,7 @@ namespace OpenSim.Data.SQLite "[SQLITE REGION DB]: No shape found for prim in storage, so setting default box shape"); prim.Shape = PrimitiveBaseShape.Default; } - + createdObjects[new UUID(objID)].AddPart(prim); LoadItems(prim); } @@ -534,17 +534,17 @@ namespace OpenSim.Data.SQLite /// /// the prim private void LoadItems(SceneObjectPart prim) - { -// m_log.DebugFormat("[SQLITE REGION DB]: Loading inventory for {0} {1}", prim.Name, prim.UUID); - + { +// m_log.DebugFormat("[SQLITE REGION DB]: Loading inventory for {0} {1}", prim.Name, prim.UUID); + DataTable dbItems = ds.Tables["primitems"]; - String sql = String.Format("primID = '{0}'", prim.UUID.ToString()); + String sql = String.Format("primID = '{0}'", prim.UUID.ToString()); DataRow[] dbItemRows = dbItems.Select(sql); IList inventory = new List(); -// m_log.DebugFormat( -// "[SQLITE REGION DB]: Found {0} items for {1} {2}", dbItemRows.Length, prim.Name, prim.UUID); - +// m_log.DebugFormat( +// "[SQLITE REGION DB]: Found {0} items for {1} {2}", dbItemRows.Length, prim.Name, prim.UUID); + foreach (DataRow row in dbItemRows) { TaskInventoryItem item = buildItem(row); @@ -693,8 +693,6 @@ namespace OpenSim.Data.SQLite { landaccesslist.Rows.Remove(rowsToDelete[iter]); } - - } Commit(); } @@ -804,7 +802,7 @@ namespace OpenSim.Data.SQLite try { regionSettingsDa.Update(ds, "regionsettings"); - } + } catch (SqliteException SqlEx) { throw new Exception( @@ -974,7 +972,7 @@ namespace OpenSim.Data.SQLite createCol(prims, "CollisionSoundVolume", typeof(Double)); createCol(prims, "VolumeDetect", typeof(Int16)); - + createCol(prims, "MediaURL", typeof(String)); // Add in contraints @@ -1191,10 +1189,10 @@ namespace OpenSim.Data.SQLite private SceneObjectPart buildPrim(DataRow row) { // Code commented. Uncomment to test the unit test inline. - - // The unit test mentions this commented code for the purposes + + // The unit test mentions this commented code for the purposes // of debugging a unit test failure - + // SceneObjectGroup sog = new SceneObjectGroup(); // SceneObjectPart sop = new SceneObjectPart(); // sop.LocalId = 1; @@ -1211,7 +1209,7 @@ namespace OpenSim.Data.SQLite // TODO: this doesn't work yet because something more // interesting has to be done to actually get these values // back out. Not enough time to figure it out yet. - + SceneObjectPart prim = new SceneObjectPart(); prim.UUID = new UUID((String) row["UUID"]); // explicit conversion of integers is required, which sort @@ -1341,7 +1339,7 @@ namespace OpenSim.Data.SQLite if (Convert.ToInt16(row["VolumeDetect"]) != 0) prim.VolumeDetectActive = true; - + if (!(row["MediaURL"] is System.DBNull)) { //m_log.DebugFormat("[SQLITE]: MediaUrl type [{0}]", row["MediaURL"].GetType()); @@ -1680,7 +1678,7 @@ namespace OpenSim.Data.SQLite row["VolumeDetect"] = 1; else row["VolumeDetect"] = 0; - + row["MediaURL"] = prim.MediaUrl; } @@ -1758,12 +1756,12 @@ namespace OpenSim.Data.SQLite row["UserLookAtZ"] = land.UserLookAt.Z; row["AuthbuyerID"] = land.AuthBuyerID.ToString(); row["OtherCleanTime"] = land.OtherCleanTime; - row["MediaType"] = land.MediaType; - row["MediaDescription"] = land.MediaDescription; - row["MediaSize"] = land.MediaWidth.ToString() + "," + land.MediaHeight.ToString(); - row["MediaLoop"] = land.MediaLoop.ToString(); - row["ObscureMusic"] = land.ObscureMusic.ToString(); - row["ObscureMedia"] = land.ObscureMedia.ToString(); + row["MediaType"] = land.MediaType; + row["MediaDescription"] = land.MediaDescription; + row["MediaSize"] = land.MediaWidth.ToString() + "," + land.MediaHeight.ToString(); + row["MediaLoop"] = land.MediaLoop.ToString(); + row["ObscureMusic"] = land.ObscureMusic.ToString(); + row["ObscureMedia"] = land.ObscureMedia.ToString(); } /// @@ -1861,10 +1859,10 @@ namespace OpenSim.Data.SQLite s.TextureEntry = textureEntry; s.ExtraParams = (byte[]) row["ExtraParams"]; - + if (!(row["Media"] is System.DBNull)) s.Media = PrimitiveBaseShape.MediaList.FromXml((string)row["Media"]); - + return s; } @@ -1908,7 +1906,7 @@ namespace OpenSim.Data.SQLite row["Texture"] = s.TextureEntry; row["ExtraParams"] = s.ExtraParams; - + if (s.Media != null) row["Media"] = s.Media.ToXml(); } @@ -2246,7 +2244,6 @@ namespace OpenSim.Data.SQLite delete.Parameters.Add(createSqliteParameter("AccessUUID", typeof(String))); da.DeleteCommand = delete; da.DeleteCommand.Connection = conn; - } private void setupRegionSettingsCommands(SqliteDataAdapter da, SqliteConnection conn) @@ -2318,7 +2315,7 @@ namespace OpenSim.Data.SQLite return DbType.String; } } - + static void PrintDataSet(DataSet ds) { // Print out any name and extended properties. diff --git a/OpenSim/Data/Tests/BasicDataServiceTest.cs b/OpenSim/Data/Tests/BasicDataServiceTest.cs index 272a2ca..7d85f0c 100644 --- a/OpenSim/Data/Tests/BasicDataServiceTest.cs +++ b/OpenSim/Data/Tests/BasicDataServiceTest.cs @@ -68,13 +68,13 @@ namespace OpenSim.Data.Tests { m_connStr = !String.IsNullOrEmpty(conn) ? conn : DefaultTestConns.Get(typeof(TConn)); - m_log = LogManager.GetLogger(this.GetType()); + m_log = LogManager.GetLogger(this.GetType()); OpenSim.Tests.Common.TestLogging.LogToConsole(); // TODO: Is that right? } /// /// To be overridden in derived classes. Do whatever init with the m_service, like setting the conn string to it. - /// You'd probably want to to cast the 'service' to a more specific type and store it in a member var. + /// You'd probably want to to cast the 'service' to a more specific type and store it in a member var. /// This framework takes care of disposing it, if it's disposable. /// /// The service being tested @@ -145,12 +145,12 @@ namespace OpenSim.Data.Tests { if (m_service != null) { - if( m_service is IDisposable) + if (m_service is IDisposable) ((IDisposable)m_service).Dispose(); m_service = null; } - if( !String.IsNullOrEmpty(m_file) && File.Exists(m_file) ) + if (!String.IsNullOrEmpty(m_file) && File.Exists(m_file)) File.Delete(m_file); } @@ -231,7 +231,7 @@ namespace OpenSim.Data.Tests lst += ", " + s; } - string sCond = stores.Length > 1 ? ("in (" + lst + ")") : ("=" + lst); + string sCond = stores.Length > 1 ? ("in (" + lst + ")") : ("=" + lst); try { ExecuteSql("DELETE FROM migrations where name " + sCond); diff --git a/OpenSim/Framework/Capabilities/Caps.cs b/OpenSim/Framework/Capabilities/Caps.cs index 8a339fe..6f32adf 100644 --- a/OpenSim/Framework/Capabilities/Caps.cs +++ b/OpenSim/Framework/Capabilities/Caps.cs @@ -760,7 +760,7 @@ namespace OpenSim.Framework.Capabilities string uploaderPath = Util.RandomClass.Next(5000, 8000).ToString("0000"); BakedTextureUploader uploader = - new BakedTextureUploader( capsBase + uploaderPath, + new BakedTextureUploader(capsBase + uploaderPath, m_httpListener); uploader.OnUpLoad += BakedTextureUploaded; diff --git a/OpenSim/Framework/Console/CommandConsole.cs b/OpenSim/Framework/Console/CommandConsole.cs index b17dbc0..52bcd55 100644 --- a/OpenSim/Framework/Console/CommandConsole.cs +++ b/OpenSim/Framework/Console/CommandConsole.cs @@ -151,7 +151,7 @@ namespace OpenSim.Framework.Console help.Add(commandInfo.descriptive_help); if (descriptiveHelp != string.Empty) - help.Add(string.Empty); + help.Add(string.Empty); } else { diff --git a/OpenSim/Framework/Console/LocalConsole.cs b/OpenSim/Framework/Console/LocalConsole.cs index c968031..6043094 100644 --- a/OpenSim/Framework/Console/LocalConsole.cs +++ b/OpenSim/Framework/Console/LocalConsole.cs @@ -38,7 +38,7 @@ namespace OpenSim.Framework.Console { /// /// A console that uses cursor control and color - /// + /// public class LocalConsole : CommandConsole { // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); @@ -100,8 +100,8 @@ namespace OpenSim.Framework.Console private int SetCursorTop(int top) { // From at least mono 2.4.2.3, window resizing can give mono an invalid row and column values. If we try - // to set a cursor row position with a currently invalid column, mono will throw an exception. - // Therefore, we need to make sure that the column position is valid first. + // to set a cursor row position with a currently invalid column, mono will throw an exception. + // Therefore, we need to make sure that the column position is valid first. int left = System.Console.CursorLeft; if (left < 0) @@ -121,7 +121,7 @@ namespace OpenSim.Framework.Console { top = 0; } - else + else { int bh = System.Console.BufferHeight; @@ -133,7 +133,7 @@ namespace OpenSim.Framework.Console System.Console.CursorTop = top; return top; - } + } /// /// Set the cursor column. @@ -145,12 +145,12 @@ namespace OpenSim.Framework.Console /// /// /// The new cursor column. - /// + /// private int SetCursorLeft(int left) { // From at least mono 2.4.2.3, window resizing can give mono an invalid row and column values. If we try - // to set a cursor column position with a currently invalid row, mono will throw an exception. - // Therefore, we need to make sure that the row position is valid first. + // to set a cursor column position with a currently invalid row, mono will throw an exception. + // Therefore, we need to make sure that the row position is valid first. int top = System.Console.CursorTop; if (top < 0) @@ -214,7 +214,7 @@ namespace OpenSim.Framework.Console System.Console.Write("{0}", prompt); SetCursorTop(new_y); - SetCursorLeft(new_x); + SetCursorLeft(new_x); } } diff --git a/OpenSim/Framework/LandData.cs b/OpenSim/Framework/LandData.cs index 8d3266b..accf52e 100644 --- a/OpenSim/Framework/LandData.cs +++ b/OpenSim/Framework/LandData.cs @@ -89,13 +89,13 @@ namespace OpenSim.Framework private Vector3 _userLocation = new Vector3(); private Vector3 _userLookAt = new Vector3(); private int _otherCleanTime = 0; - private string _mediaType = "none/none"; - private string _mediaDescription = ""; - private int _mediaHeight = 0; - private int _mediaWidth = 0; - private bool _mediaLoop = false; - private bool _obscureMusic = false; - private bool _obscureMedia = false; + private string _mediaType = "none/none"; + private string _mediaDescription = ""; + private int _mediaHeight = 0; + private int _mediaWidth = 0; + private bool _mediaLoop = false; + private bool _obscureMusic = false; + private bool _obscureMedia = false; /// /// Whether to obscure parcel media URL @@ -690,13 +690,13 @@ namespace OpenSim.Framework landData._userLocation = _userLocation; landData._userLookAt = _userLookAt; landData._otherCleanTime = _otherCleanTime; - landData._mediaType = _mediaType; - landData._mediaDescription = _mediaDescription; - landData._mediaWidth = _mediaWidth; - landData._mediaHeight = _mediaHeight; - landData._mediaLoop = _mediaLoop; - landData._obscureMusic = _obscureMusic; - landData._obscureMedia = _obscureMedia; + landData._mediaType = _mediaType; + landData._mediaDescription = _mediaDescription; + landData._mediaWidth = _mediaWidth; + landData._mediaHeight = _mediaHeight; + landData._mediaLoop = _mediaLoop; + landData._obscureMusic = _obscureMusic; + landData._obscureMedia = _obscureMedia; landData._parcelAccessList.Clear(); foreach (ParcelManager.ParcelAccessEntry entry in _parcelAccessList) diff --git a/OpenSim/Framework/LandUpdateArgs.cs b/OpenSim/Framework/LandUpdateArgs.cs index ed496a1..7d6c4f2 100644 --- a/OpenSim/Framework/LandUpdateArgs.cs +++ b/OpenSim/Framework/LandUpdateArgs.cs @@ -49,12 +49,12 @@ namespace OpenSim.Framework public UUID SnapshotID; public Vector3 UserLocation; public Vector3 UserLookAt; - public string MediaType; - public string MediaDescription; - public int MediaHeight; - public int MediaWidth; - public bool MediaLoop; - public bool ObscureMusic; - public bool ObscureMedia; + public string MediaType; + public string MediaDescription; + public int MediaHeight; + public int MediaWidth; + public bool MediaLoop; + public bool ObscureMusic; + public bool ObscureMedia; } } diff --git a/OpenSim/Framework/PrimitiveBaseShape.cs b/OpenSim/Framework/PrimitiveBaseShape.cs index 70a61cc..0a81363 100644 --- a/OpenSim/Framework/PrimitiveBaseShape.cs +++ b/OpenSim/Framework/PrimitiveBaseShape.cs @@ -175,7 +175,7 @@ namespace OpenSim.Framework } } } - + /// /// Entries to store media textures on each face /// @@ -1216,28 +1216,28 @@ namespace OpenSim.Framework prim.Properties.Permissions = new Permissions(); prim.Properties.SalePrice = 10; prim.Properties.SaleType = new SaleType(); - + return prim; } - + /// /// Encapsulates a list of media entries. /// - /// This class is necessary because we want to replace auto-serialization of MediaEntry with something more + /// This class is necessary because we want to replace auto-serialization of MediaEntry with something more /// OSD like and less vulnerable to change. public class MediaList : List, IXmlSerializable - { + { public const string MEDIA_TEXTURE_TYPE = "sl"; - + public MediaList() : base() {} public MediaList(IEnumerable collection) : base(collection) {} public MediaList(int capacity) : base(capacity) {} - + public XmlSchema GetSchema() { return null; } - + public string ToXml() { lock (this) @@ -1245,78 +1245,78 @@ namespace OpenSim.Framework using (StringWriter sw = new StringWriter()) { using (XmlTextWriter xtw = new XmlTextWriter(sw)) - { + { xtw.WriteStartElement("OSMedia"); xtw.WriteAttributeString("type", MEDIA_TEXTURE_TYPE); xtw.WriteAttributeString("version", "0.1"); - + OSDArray meArray = new OSDArray(); foreach (MediaEntry me in this) { OSD osd = (null == me ? new OSD() : me.GetOSD()); meArray.Add(osd); - } - + } + xtw.WriteStartElement("OSData"); xtw.WriteRaw(OSDParser.SerializeLLSDXmlString(meArray)); xtw.WriteEndElement(); - + xtw.WriteEndElement(); - - xtw.Flush(); + + xtw.Flush(); return sw.ToString(); } - } - } + } + } } - + public void WriteXml(XmlWriter writer) - { + { writer.WriteRaw(ToXml()); } - + public static MediaList FromXml(string rawXml) { MediaList ml = new MediaList(); ml.ReadXml(rawXml); return ml; } - + public void ReadXml(string rawXml) - { + { using (StringReader sr = new StringReader(rawXml)) { using (XmlTextReader xtr = new XmlTextReader(sr)) - { + { xtr.MoveToContent(); - + string type = xtr.GetAttribute("type"); //m_log.DebugFormat("[MOAP]: Loaded media texture entry with type {0}", type); - + if (type != MEDIA_TEXTURE_TYPE) - return; - - xtr.ReadStartElement("OSMedia"); - + return; + + xtr.ReadStartElement("OSMedia"); + OSDArray osdMeArray = (OSDArray)OSDParser.DeserializeLLSDXml(xtr.ReadInnerXml()); foreach (OSD osdMe in osdMeArray) { MediaEntry me = (osdMe is OSDMap ? MediaEntry.FromOSD(osdMe) : new MediaEntry()); Add(me); } - - xtr.ReadEndElement(); + + xtr.ReadEndElement(); } } - } - + } + public void ReadXml(XmlReader reader) { if (reader.IsEmptyElement) return; - + ReadXml(reader.ReadInnerXml()); - } + } } - } -} \ No newline at end of file + } +} diff --git a/OpenSim/Framework/RegionInfo.cs b/OpenSim/Framework/RegionInfo.cs index 12c58c3..08d5398 100644 --- a/OpenSim/Framework/RegionInfo.cs +++ b/OpenSim/Framework/RegionInfo.cs @@ -97,9 +97,9 @@ namespace OpenSim.Framework [Serializable] public class SimpleRegionInfo - { + { // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - + /// /// The port by which http communication occurs with the region (most noticeably, CAPS communication) /// @@ -344,7 +344,7 @@ namespace OpenSim.Framework public string proxyUrl = ""; public int ProxyOffset = 0; public string regionSecret = UUID.Random().ToString(); - + public string osSecret; public UUID lastMapUUID = UUID.Zero; @@ -699,7 +699,7 @@ namespace OpenSim.Framework RegionID = new UUID(regionUUID); originRegionID = RegionID; // What IS this?! - + RegionName = name; string location = config.GetString("Location", String.Empty); @@ -720,7 +720,7 @@ namespace OpenSim.Framework // Internal IP IPAddress address; - + if (config.Contains("InternalAddress")) { address = IPAddress.Parse(config.GetString("InternalAddress", String.Empty)); @@ -774,7 +774,7 @@ namespace OpenSim.Framework { m_externalHostName = Util.GetLocalHost().ToString(); m_log.InfoFormat( - "[REGIONINFO]: Resolving SYSTEMIP to {0} for external hostname of region {1}", + "[REGIONINFO]: Resolving SYSTEMIP to {0} for external hostname of region {1}", m_externalHostName, name); } else @@ -909,16 +909,16 @@ namespace OpenSim.Framework configMember.addConfigurationOption("nonphysical_prim_max", ConfigurationOption.ConfigurationTypes.TYPE_INT32, "Maximum size for nonphysical prims", m_nonphysPrimMax.ToString(), true); - + configMember.addConfigurationOption("physical_prim_max", ConfigurationOption.ConfigurationTypes.TYPE_INT32, "Maximum size for physical prims", m_physPrimMax.ToString(), true); - + configMember.addConfigurationOption("clamp_prim_size", ConfigurationOption.ConfigurationTypes.TYPE_BOOLEAN, "Clamp prims to max size", m_clampPrimSize.ToString(), true); - + configMember.addConfigurationOption("object_capacity", ConfigurationOption.ConfigurationTypes.TYPE_INT32, "Max objects this sim will hold", m_objectCapacity.ToString(), true); - + configMember.addConfigurationOption("scope_id", ConfigurationOption.ConfigurationTypes.TYPE_UUID, "Scope ID for this region", ScopeID.ToString(), true); @@ -956,16 +956,16 @@ namespace OpenSim.Framework configMember.addConfigurationOption("lastmap_refresh", ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, "Last Map Refresh", Util.UnixTimeSinceEpoch().ToString(), true); - + configMember.addConfigurationOption("nonphysical_prim_max", ConfigurationOption.ConfigurationTypes.TYPE_INT32, "Maximum size for nonphysical prims", "0", true); - + configMember.addConfigurationOption("physical_prim_max", ConfigurationOption.ConfigurationTypes.TYPE_INT32, "Maximum size for physical prims", "0", true); - + configMember.addConfigurationOption("clamp_prim_size", ConfigurationOption.ConfigurationTypes.TYPE_BOOLEAN, "Clamp prims to max size", "false", true); - + configMember.addConfigurationOption("object_capacity", ConfigurationOption.ConfigurationTypes.TYPE_INT32, "Max objects this sim will hold", "0", true); diff --git a/OpenSim/Framework/Serialization/ArchiveConstants.cs b/OpenSim/Framework/Serialization/ArchiveConstants.cs index 3143e3b..7a9b33d 100644 --- a/OpenSim/Framework/Serialization/ArchiveConstants.cs +++ b/OpenSim/Framework/Serialization/ArchiveConstants.cs @@ -157,9 +157,9 @@ namespace OpenSim.Framework.Serialization public static string CreateOarObjectFilename(string objectName, UUID uuid, Vector3 pos) { return string.Format( - OAR_OBJECT_FILENAME_TEMPLATE, objectName, + OAR_OBJECT_FILENAME_TEMPLATE, objectName, Math.Round(pos.X), Math.Round(pos.Y), Math.Round(pos.Z), - uuid); + uuid); } /// @@ -171,9 +171,9 @@ namespace OpenSim.Framework.Serialization /// public static string CreateOarObjectPath(string objectName, UUID uuid, Vector3 pos) { - return OBJECTS_PATH + CreateOarObjectFilename(objectName, uuid, pos); - } - + return OBJECTS_PATH + CreateOarObjectFilename(objectName, uuid, pos); + } + /// /// Extract a plain path from an IAR path /// @@ -184,18 +184,18 @@ namespace OpenSim.Framework.Serialization List plainDirs = new List(); string[] iarDirs = iarPath.Split(new char[] { '/' }, StringSplitOptions.RemoveEmptyEntries); - + foreach (string iarDir in iarDirs) { if (!iarDir.Contains(ArchiveConstants.INVENTORY_NODE_NAME_COMPONENT_SEPARATOR)) plainDirs.Add(iarDir); - + int i = iarDir.LastIndexOf(ArchiveConstants.INVENTORY_NODE_NAME_COMPONENT_SEPARATOR); plainDirs.Add(iarDir.Remove(i)); } - - return string.Join("/", plainDirs.ToArray()); + + return string.Join("/", plainDirs.ToArray()); } } -} \ No newline at end of file +} diff --git a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs index d20f8c9..452df38 100644 --- a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs +++ b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs @@ -51,7 +51,7 @@ namespace OpenSim.Framework.Servers.HttpServer { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private HttpServerLogWriter httpserverlog = new HttpServerLogWriter(); - + private volatile int NotSocketErrors = 0; public volatile bool HTTPDRunning = false; @@ -160,7 +160,7 @@ namespace OpenSim.Framework.Servers.HttpServer m_rpcHandlers[method] = handler; m_rpcHandlersKeepAlive[method] = keepAlive; // default } - + return true; } @@ -182,7 +182,7 @@ namespace OpenSim.Framework.Servers.HttpServer public bool AddHTTPHandler(string methodName, GenericHTTPMethod handler) { //m_log.DebugFormat("[BASE HTTP SERVER]: Registering {0}", methodName); - + lock (m_HTTPHandlers) { if (!m_HTTPHandlers.ContainsKey(methodName)) @@ -204,14 +204,14 @@ namespace OpenSim.Framework.Servers.HttpServer if (!m_pollHandlers.ContainsKey(methodName)) { m_pollHandlers.Add(methodName,args); - pollHandlerResult = true; + pollHandlerResult = true; } } - + if (pollHandlerResult) return AddHTTPHandler(methodName, handler); - return false; + return false; } // Note that the agent string is provided simply to differentiate @@ -257,51 +257,51 @@ namespace OpenSim.Framework.Servers.HttpServer { IHttpClientContext context = (IHttpClientContext)source; IHttpRequest request = args.Request; - + PollServiceEventArgs psEvArgs; - + if (TryGetPollServiceHTTPHandler(request.UriPath.ToString(), out psEvArgs)) { PollServiceHttpRequest psreq = new PollServiceHttpRequest(psEvArgs, context, request); - + if (psEvArgs.Request != null) { OSHttpRequest req = new OSHttpRequest(context, request); - + Stream requestStream = req.InputStream; - + Encoding encoding = Encoding.UTF8; StreamReader reader = new StreamReader(requestStream, encoding); - + string requestBody = reader.ReadToEnd(); - + Hashtable keysvals = new Hashtable(); Hashtable headervals = new Hashtable(); - + string[] querystringkeys = req.QueryString.AllKeys; string[] rHeaders = req.Headers.AllKeys; - + keysvals.Add("body", requestBody); keysvals.Add("uri", req.RawUrl); keysvals.Add("content-type", req.ContentType); keysvals.Add("http-method", req.HttpMethod); - + foreach (string queryname in querystringkeys) { keysvals.Add(queryname, req.QueryString[queryname]); } - + foreach (string headername in rHeaders) { headervals[headername] = req.Headers[headername]; } - + keysvals.Add("headers", headervals); keysvals.Add("querystringkeys", querystringkeys); - + psEvArgs.Request(psreq.RequestID, keysvals); } - + m_PollServiceManager.Enqueue(psreq); } else @@ -348,10 +348,10 @@ namespace OpenSim.Framework.Servers.HttpServer { try { -// m_log.Debug("[BASE HTTP SERVER]: Handling request to " + request.RawUrl); - +// m_log.Debug("[BASE HTTP SERVER]: Handling request to " + request.RawUrl); + Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US", true); - + // This is the REST agent interface. We require an agent to properly identify // itself. If the REST handler recognizes the prefix it will attempt to // satisfy the request. If it is not recognizable, and no damage has occurred @@ -456,7 +456,7 @@ namespace OpenSim.Framework.Servers.HttpServer } request.InputStream.Close(); - + // HTTP IN support. The script engine taes it from here // Nothing to worry about for us. // @@ -540,7 +540,7 @@ namespace OpenSim.Framework.Servers.HttpServer HandleLLSDRequests(request, response); return; } - + // m_log.DebugFormat("[BASE HTTP SERVER]: Checking for HTTP Handler for request {0}", request.RawUrl); if (DoWeHaveAHTTPHandler(request.RawUrl)) { @@ -594,7 +594,7 @@ namespace OpenSim.Framework.Servers.HttpServer } } } - + if (String.IsNullOrEmpty(bestMatch)) { streamHandler = null; @@ -641,7 +641,7 @@ namespace OpenSim.Framework.Servers.HttpServer private bool TryGetHTTPHandler(string handlerKey, out GenericHTTPMethod HTTPHandler) { // m_log.DebugFormat("[BASE HTTP HANDLER]: Looking for HTTP handler for {0}", handlerKey); - + string bestMatch = null; lock (m_HTTPHandlers) @@ -727,14 +727,14 @@ namespace OpenSim.Framework.Servers.HttpServer { xmlRprcRequest.Params.Add(request.RemoteIPEndPoint); // Param[1] XmlRpcResponse xmlRpcResponse; - + XmlRpcMethod method; bool methodWasFound; lock (m_rpcHandlers) { methodWasFound = m_rpcHandlers.TryGetValue(methodName, out method); } - + if (methodWasFound) { xmlRprcRequest.Params.Add(request.Url); // Param[2] @@ -766,10 +766,10 @@ namespace OpenSim.Framework.Servers.HttpServer else { xmlRpcResponse = new XmlRpcResponse(); - + // Code set in accordance with http://xmlrpc-epi.sourceforge.net/specs/rfc.fault_codes.php xmlRpcResponse.SetFault( - XmlRpcErrorCodes.SERVER_ERROR_METHOD, + XmlRpcErrorCodes.SERVER_ERROR_METHOD, String.Format("Requested method [{0}] not found", methodName)); } @@ -786,11 +786,11 @@ namespace OpenSim.Framework.Servers.HttpServer response.KeepAlive = false; m_log.ErrorFormat("[BASE HTTP SERVER]: Handler not found for http request {0}", request.RawUrl); - + response.SendChunked = false; response.ContentLength64 = buf.Length; response.ContentEncoding = Encoding.UTF8; - + try { response.OutputStream.Write(buf, 0, buf.Length); @@ -872,13 +872,13 @@ namespace OpenSim.Framework.Servers.HttpServer OSD llsdRequest = null; OSD llsdResponse = null; - + bool LegacyLLSDLoginLibOMV = (requestBody.Contains("passwd") && requestBody.Contains("mac") && requestBody.Contains("viewer_digest")); - + if (requestBody.Length == 0) // Get Request { - requestBody = "requestget"; + requestBody = "requestget"; } try { @@ -1090,7 +1090,7 @@ namespace OpenSim.Framework.Servers.HttpServer string bestMatch = null; //m_log.DebugFormat("[BASE HTTP HANDLER]: Checking if we have an HTTP handler for {0}", searchquery); - + lock (m_HTTPHandlers) { foreach (string pattern in m_HTTPHandlers.Keys) @@ -1156,7 +1156,7 @@ namespace OpenSim.Framework.Servers.HttpServer // You have to specifically register for '/' and to get it, you must specificaly request it // if (pattern == "/" && searchquery == "/" || pattern != "/") - bestMatch = pattern; + bestMatch = pattern; } } } @@ -1236,11 +1236,11 @@ namespace OpenSim.Framework.Servers.HttpServer } public void HandleHTTPRequest(OSHttpRequest request, OSHttpResponse response) - { + { // m_log.DebugFormat( -// "[BASE HTTP SERVER]: HandleHTTPRequest for request to {0}, method {1}", +// "[BASE HTTP SERVER]: HandleHTTPRequest for request to {0}, method {1}", // request.RawUrl, request.HttpMethod); - + switch (request.HttpMethod) { case "OPTIONS": @@ -1256,7 +1256,7 @@ namespace OpenSim.Framework.Servers.HttpServer private void HandleContentVerbs(OSHttpRequest request, OSHttpResponse response) { // m_log.DebugFormat("[BASE HTTP SERVER]: HandleContentVerbs for request to {0}", request.RawUrl); - + // This is a test. There's a workable alternative.. as this way sucks. // We'd like to put this into a text file parhaps that's easily editable. // @@ -1391,7 +1391,7 @@ namespace OpenSim.Framework.Servers.HttpServer // m_log.DebugFormat( // "[BASE HTTP HANDLER]: TryGetHTTPHandlerPathBased() looking for HTTP handler to match {0}", searchquery); - + lock (m_HTTPHandlers) { foreach (string pattern in m_HTTPHandlers.Keys) @@ -1452,7 +1452,7 @@ namespace OpenSim.Framework.Servers.HttpServer //Even though only one other part of the entire code uses HTTPHandlers, we shouldn't expect this //and should check for NullReferenceExceptions - + if (string.IsNullOrEmpty(contentType)) { contentType = "text/html"; @@ -1472,8 +1472,8 @@ namespace OpenSim.Framework.Servers.HttpServer byte[] buffer; - if (!(contentType.Contains("image") - || contentType.Contains("x-shockwave-flash") + if (!(contentType.Contains("image") + || contentType.Contains("x-shockwave-flash") || contentType.Contains("application/x-oar"))) { // Text @@ -1504,7 +1504,7 @@ namespace OpenSim.Framework.Servers.HttpServer { response.OutputStream.Flush(); response.Send(); - + //if (!response.KeepAlive && response.ReuseContext) // response.FreeContext(); } @@ -1611,11 +1611,11 @@ namespace OpenSim.Framework.Servers.HttpServer m_httpListener2 = CoolHTTPListener.Create(m_listenIPAddress, (int)m_port); m_httpListener2.ExceptionThrown += httpServerException; m_httpListener2.LogWriter = httpserverlog; - - // Uncomment this line in addition to those in HttpServerLogWriter + + // Uncomment this line in addition to those in HttpServerLogWriter // if you want more detailed trace information from the HttpServer //m_httpListener2.UseTraceLogs = true; - + //m_httpListener2.DisconnectHandler = httpServerDisconnectMonitor; } else @@ -1643,8 +1643,8 @@ namespace OpenSim.Framework.Servers.HttpServer { m_log.Error("[BASE HTTP SERVER]: Error - " + e.Message); m_log.Error("[BASE HTTP SERVER]: Tip: Do you have permission to listen on port " + m_port + ", " + m_sslport + "?"); - - // We want this exception to halt the entire server since in current configurations we aren't too + + // We want this exception to halt the entire server since in current configurations we aren't too // useful without inbound HTTP. throw e; } @@ -1656,7 +1656,7 @@ namespace OpenSim.Framework.Servers.HttpServer { case SocketError.NotSocket: NotSocketErrors++; - + break; } } @@ -1686,12 +1686,11 @@ namespace OpenSim.Framework.Servers.HttpServer m_httpListener2.LogWriter = null; m_httpListener2.RequestReceived -= OnRequest; m_httpListener2.Stop(); - } + } catch (NullReferenceException) { m_log.Warn("[BASE HTTP SERVER]: Null Reference when stopping HttpServer."); } - } public void RemoveStreamHandler(string httpMethod, string path) @@ -1712,7 +1711,7 @@ namespace OpenSim.Framework.Servers.HttpServer m_HTTPHandlers.Remove(path); return; } - + m_HTTPHandlers.Remove(GetHandlerKey(httpMethod, path)); } } @@ -1728,7 +1727,6 @@ namespace OpenSim.Framework.Servers.HttpServer } RemoveHTTPHandler(httpMethod, path); - } public bool RemoveAgentHandler(string agent, IHttpAgentHandler handler) @@ -1759,7 +1757,6 @@ namespace OpenSim.Framework.Servers.HttpServer } } - public bool RemoveLLSDHandler(string path, LLSDMethod handler) { try @@ -1833,7 +1830,7 @@ namespace OpenSim.Framework.Servers.HttpServer oresp = osresp; } } - + /// /// Relays HttpServer log messages to our own logging mechanism. /// @@ -1852,7 +1849,7 @@ namespace OpenSim.Framework.Servers.HttpServer { case LogPrio.Trace: m_log.DebugFormat("[{0}]: {1}", source, message); - break; + break; case LogPrio.Debug: m_log.DebugFormat("[{0}]: {1}", source, message); break; @@ -1872,8 +1869,8 @@ namespace OpenSim.Framework.Servers.HttpServer break; } */ - + return; } } -} \ No newline at end of file +} diff --git a/OpenSim/Region/Application/Application.cs b/OpenSim/Region/Application/Application.cs index b860cf6..d120f03 100644 --- a/OpenSim/Region/Application/Application.cs +++ b/OpenSim/Region/Application/Application.cs @@ -225,7 +225,7 @@ namespace OpenSim } } MainConsole.Instance = null; - } + } */ configSource.Alias.AddAlias("On", true); configSource.Alias.AddAlias("Off", false); diff --git a/OpenSim/Region/Application/OpenSim.cs b/OpenSim/Region/Application/OpenSim.cs index 4f2d223..c85ff82 100644 --- a/OpenSim/Region/Application/OpenSim.cs +++ b/OpenSim/Region/Application/OpenSim.cs @@ -152,7 +152,7 @@ namespace OpenSim RegisterConsoleCommands(); base.StartupSpecific(); - + MainServer.Instance.AddStreamHandler(new OpenSim.SimStatusHandler()); MainServer.Instance.AddStreamHandler(new OpenSim.XSimStatusHandler(this)); if (userStatsURI != String.Empty) @@ -192,7 +192,7 @@ namespace OpenSim // Hook up to the watchdog timer Watchdog.OnWatchdogTimeout += WatchdogTimeoutHandler; - PrintFileToConsole("startuplogo.txt"); + PrintFileToConsole("startuplogo.txt"); // For now, start at the 'root' level by default if (m_sceneManager.Scenes.Count == 1) // If there is only one region, select it @@ -218,8 +218,8 @@ namespace OpenSim m_console.Commands.AddCommand("region", false, "debug packet", "debug packet ", - "Turn on packet debugging", - "If level > 255 then all incoming and outgoing packets are logged.\n" + "Turn on packet debugging", + "If level > 255 then all incoming and outgoing packets are logged.\n" + "If level <= 255 then incoming AgentUpdate and outgoing SimStats and SimulatorViewerTimeMessage packets are not logged.\n" + "If level <= 200 then incoming RequestImage and outgoing ImagePacket, ImageData, LayerData and CoarseLocationUpdate packets are not logged.\n" + "If level <= 100 then incoming ViewerEffect and AgentAnimation and outgoing ViewerEffect and AvatarAnimation packets are not logged.\n" @@ -561,11 +561,11 @@ namespace OpenSim { regInfo = new RegionInfo(regionName, regionFile, false, ConfigSource.Source, regionName); } - + IScene scene; PopulateRegionEstateInfo(regInfo); - CreateRegion(regInfo, true, out scene); - regInfo.EstateSettings.Save(); + CreateRegion(regInfo, true, out scene); + regInfo.EstateSettings.Save(); } /// @@ -943,7 +943,7 @@ namespace OpenSim delegate(Scene scene) { MainConsole.Instance.Output(String.Format( - "Region Name: {0}, Region XLoc: {1}, Region YLoc: {2}, Region Port: {3}", + "Region Name: {0}, Region XLoc: {1}, Region YLoc: {2}, Region Port: {3}", scene.RegionInfo.RegionName, scene.RegionInfo.RegionLocX, scene.RegionInfo.RegionLocY, diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index a6315a9..f35691a 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs @@ -63,7 +63,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP /// Debug packet level. See OpenSim.RegisterConsoleCommands() for more details. /// protected int m_debugPacketLevel = 0; - + #region Events public event GenericMessage OnGenericMessage; @@ -287,7 +287,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP public event MuteListEntryRemove OnRemoveMuteListEntry; public event GodlikeMessage onGodlikeMessage; public event GodUpdateRegionInfoUpdate OnGodUpdateRegionInfoUpdate; - #endregion Events @@ -329,12 +328,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP /// ownerless phantom. /// /// All manipulation of this set has to occur under an m_entityUpdates.SyncRoot lock - /// + /// /// protected HashSet m_killRecord; - -// protected HashSet m_attachmentsSent; - + +// protected HashSet m_attachmentsSent; + private int m_moneyBalance; private int m_animationSequenceNumber = 1; private bool m_SendLogoutPacketWhenClosing = true; @@ -383,22 +382,22 @@ namespace OpenSim.Region.ClientStack.LindenUDP public string ActiveGroupName { get { return m_activeGroupName; } } public ulong ActiveGroupPowers { get { return m_activeGroupPowers; } } public bool IsGroupMember(UUID groupID) { return m_groupPowers.ContainsKey(groupID); } - + /// /// First name of the agent/avatar represented by the client /// public string FirstName { get { return m_firstName; } } - + /// /// Last name of the agent/avatar represented by the client /// public string LastName { get { return m_lastName; } } - + /// /// Full name of the client (first name and last name) /// public string Name { get { return FirstName + " " + LastName; } } - + public uint CircuitCode { get { return m_circuitCode; } } public int MoneyBalance { get { return m_moneyBalance; } } public int NextAnimationSequenceNumber { get { return m_animationSequenceNumber++; } } @@ -440,7 +439,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP m_entityUpdates = new PriorityQueue(m_scene.Entities.Count); m_fullUpdateDataBlocksBuilder = new List(); m_killRecord = new HashSet(); -// m_attachmentsSent = new HashSet(); +// m_attachmentsSent = new HashSet(); m_assetService = m_scene.RequestModuleInterface(); m_GroupsModule = scene.RequestModuleInterface(); @@ -654,7 +653,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP // Make sure that we see any exception caused by the asynchronous operation. m_log.Error( string.Format("[LLCLIENTVIEW]: Caught exception while processing {0}", packetObject.Pack), e); - } + } } #endregion Packet Handling @@ -865,7 +864,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP foreach (GroupActiveProposals Proposal in Proposals) { GroupActiveProposalItemReplyPacket GAPIRP = new GroupActiveProposalItemReplyPacket(); - + GAPIRP.AgentData.AgentID = AgentId; GAPIRP.AgentData.GroupID = groupID; GAPIRP.TransactionData.TransactionID = transactionID; @@ -889,7 +888,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP if (Proposals.Length == 0) { GroupActiveProposalItemReplyPacket GAPIRP = new GroupActiveProposalItemReplyPacket(); - + GAPIRP.AgentData.AgentID = AgentId; GAPIRP.AgentData.GroupID = groupID; GAPIRP.TransactionData.TransactionID = transactionID; @@ -944,7 +943,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP if (Votes.Length == 0) { GroupVoteHistoryItemReplyPacket GVHIRP = new GroupVoteHistoryItemReplyPacket(); - + GVHIRP.AgentData.AgentID = AgentId; GVHIRP.AgentData.GroupID = groupID; GVHIRP.TransactionData.TransactionID = transactionID; @@ -968,7 +967,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP OutPacket(GVHIRP, ThrottleOutPacketType.Task); } } - + public void SendGroupAccountingDetails(IClientAPI sender,UUID groupID, UUID transactionID, UUID sessionID, int amt) { GroupAccountDetailsReplyPacket GADRP = new GroupAccountDetailsReplyPacket(); @@ -987,13 +986,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP GADRP.HistoryData[0] = History; OutPacket(GADRP, ThrottleOutPacketType.Task); } - + public void SendGroupAccountingSummary(IClientAPI sender,UUID groupID, uint moneyAmt, int totalTier, int usedTier) { GroupAccountSummaryReplyPacket GASRP = (GroupAccountSummaryReplyPacket)PacketPool.Instance.GetPacket( PacketType.GroupAccountSummaryReply); - + GASRP.AgentData = new GroupAccountSummaryReplyPacket.AgentDataBlock(); GASRP.AgentData.AgentID = sender.AgentId; GASRP.AgentData.GroupID = groupID; @@ -1020,13 +1019,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP GASRP.MoneyData.LightTaxEstimate = 0; OutPacket(GASRP, ThrottleOutPacketType.Task); } - + public void SendGroupTransactionsSummaryDetails(IClientAPI sender,UUID groupID, UUID transactionID, UUID sessionID, int amt) { GroupAccountTransactionsReplyPacket GATRP = (GroupAccountTransactionsReplyPacket)PacketPool.Instance.GetPacket( PacketType.GroupAccountTransactionsReply); - + GATRP.AgentData = new GroupAccountTransactionsReplyPacket.AgentDataBlock(); GATRP.AgentData.AgentID = sender.AgentId; GATRP.AgentData.GroupID = groupID; @@ -1510,7 +1509,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP public void SendKillObject(ulong regionHandle, uint localID) { // m_log.DebugFormat("[CLIENT]: Sending KillObjectPacket to {0} for {1} in {2}", Name, localID, regionHandle); - + KillObjectPacket kill = (KillObjectPacket)PacketPool.Instance.GetPacket(PacketType.KillObject); // TODO: don't create new blocks if recycling an old packet kill.ObjectData = new KillObjectPacket.ObjectDataBlock[1]; @@ -3469,9 +3468,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP objupdate.ObjectData[0] = CreateAvatarUpdateBlock(presence); OutPacket(objupdate, ThrottleOutPacketType.Task); - + // We need to record the avatar local id since the root prim of an attachment points to this. -// m_attachmentsSent.Add(avatar.LocalId); +// m_attachmentsSent.Add(avatar.LocalId); } public void SendCoarseLocationUpdate(List users, List CoarseLocations) @@ -3519,7 +3518,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP #region Primitive Packet/Data Sending Methods /// - /// Generate one of the object update packets based on PrimUpdateFlags + /// Generate one of the object update packets based on PrimUpdateFlags /// and broadcast the packet to clients /// public void SendPrimUpdate(ISceneEntity entity, PrimUpdateFlags updateFlags) @@ -3527,7 +3526,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP double priority = m_prioritizer.GetUpdatePriority(this, entity); lock (m_entityUpdates.SyncRoot) - m_entityUpdates.Enqueue(priority, new EntityUpdate(entity, updateFlags), entity.LocalId); + m_entityUpdates.Enqueue(priority, new EntityUpdate(entity, updateFlags), entity.LocalId); } private void ProcessEntityUpdates(int maxUpdates) @@ -3544,20 +3543,20 @@ namespace OpenSim.Region.ClientStack.LindenUDP EntityUpdate update; while (updatesThisCall < maxUpdates && m_entityUpdates.TryDequeue(out update)) { - // Please do not remove this unless you can demonstrate on the OpenSim mailing list that a client + // Please do not remove this unless you can demonstrate on the OpenSim mailing list that a client // will never receive an update after a prim kill. Even then, keeping the kill record may be a good // safety measure. // - // Receiving updates after kills results in undeleteable prims that persist until relog and + // Receiving updates after kills results in undeleteable prims that persist until relog and // currently occurs because prims can be deleted before all queued updates are sent. if (m_killRecord.Contains(update.Entity.LocalId)) { // m_log.WarnFormat( -// "[CLIENT]: Preventing full update for prim with local id {0} after client for user {1} told it was deleted", -// update.Entity.LocalId, Name); +// "[CLIENT]: Preventing full update for prim with local id {0} after client for user {1} told it was deleted", +// update.Entity.LocalId, Name); continue; } - + if (update.Entity is SceneObjectPart) { SceneObjectPart part = (SceneObjectPart)update.Entity; @@ -3642,28 +3641,28 @@ namespace OpenSim.Region.ClientStack.LindenUDP // string text = sop.Text; // if (text.IndexOf("\n") >= 0) // text = text.Remove(text.IndexOf("\n")); -// +// // if (m_attachmentsSent.Contains(sop.ParentID)) // { //// m_log.DebugFormat( //// "[CLIENT]: Sending full info about attached prim {0} text {1}", //// sop.LocalId, text); -// +// // objectUpdateBlocks.Value.Add(CreatePrimUpdateBlock(sop, this.m_agentId)); -// +// // m_attachmentsSent.Add(sop.LocalId); // } // else // { // m_log.DebugFormat( -// "[CLIENT]: Requeueing full update of prim {0} text {1} since we haven't sent its parent {2} yet", +// "[CLIENT]: Requeueing full update of prim {0} text {1} since we haven't sent its parent {2} yet", // sop.LocalId, text, sop.ParentID); -// -// m_entityUpdates.Enqueue(double.MaxValue, update, sop.LocalId); +// +// m_entityUpdates.Enqueue(double.MaxValue, update, sop.LocalId); // } // } // else -// { +// { objectUpdateBlocks.Value.Add(CreatePrimUpdateBlock((SceneObjectPart)update.Entity, this.m_agentId)); // } } @@ -3977,7 +3976,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP m_propertiesPacketTimer.Stop(); return; } - + m_propertiesPacketTimer.Stop(); m_propertiesPacketTimer.Start(); } @@ -4208,7 +4207,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP public void SendLandProperties(int sequence_id, bool snap_selection, int request_result, LandData landData, float simObjectBonusFactor, int parcelObjectCapacity, int simObjectCapacity, uint regionFlags) { - ParcelPropertiesMessage updateMessage = new ParcelPropertiesMessage(); + ParcelPropertiesMessage updateMessage = new ParcelPropertiesMessage(); updateMessage.AABBMax = landData.AABBMax; updateMessage.AABBMin = landData.AABBMin; @@ -4252,7 +4251,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP updateMessage.PassHours = landData.PassHours; updateMessage.PassPrice = landData.PassPrice; updateMessage.PublicCount = 0; //TODO: Unimplemented - + updateMessage.RegionPushOverride = (regionFlags & (uint)RegionFlags.RestrictPushObject) > 0; updateMessage.RegionDenyAnonymous = (regionFlags & (uint)RegionFlags.DenyAnonymous) > 0; @@ -4282,13 +4281,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP updateMessage.UserLocation = landData.UserLocation; updateMessage.UserLookAt = landData.UserLookAt; - updateMessage.MediaType = landData.MediaType; - updateMessage.MediaDesc = landData.MediaDescription; - updateMessage.MediaWidth = landData.MediaWidth; - updateMessage.MediaHeight = landData.MediaHeight; - updateMessage.MediaLoop = landData.MediaLoop; - updateMessage.ObscureMusic = landData.ObscureMusic; - updateMessage.ObscureMedia = landData.ObscureMedia; + updateMessage.MediaType = landData.MediaType; + updateMessage.MediaDesc = landData.MediaDescription; + updateMessage.MediaWidth = landData.MediaWidth; + updateMessage.MediaHeight = landData.MediaHeight; + updateMessage.MediaLoop = landData.MediaLoop; + updateMessage.ObscureMusic = landData.ObscureMusic; + updateMessage.ObscureMedia = landData.ObscureMedia; try { @@ -4297,8 +4296,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP { eq.ParcelProperties(updateMessage, this.AgentId); } else { - m_log.Warn("No EQ Interface when sending parcel data."); - } + m_log.Warn("No EQ Interface when sending parcel data."); + } } catch (Exception ex) { @@ -4671,9 +4670,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP } // m_log.DebugFormat( -// "[LLCLIENTVIEW]: Constructing client update for part {0} {1} with flags {2}, localId {3}", +// "[LLCLIENTVIEW]: Constructing client update for part {0} {1} with flags {2}, localId {3}", // data.Name, update.FullID, flags, update.ID); - + update.UpdateFlags = (uint)flags; #endregion PrimFlags @@ -4806,11 +4805,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP AddLocalPacketHandler(PacketType.ObjectScale, HandleObjectScale); AddLocalPacketHandler(PacketType.ObjectRotation, HandleObjectRotation); AddLocalPacketHandler(PacketType.ObjectFlagUpdate, HandleObjectFlagUpdate); - + // Handle ObjectImage (TextureEntry) updates synchronously, since when updating multiple prim faces at once, // some clients will send out a separate ObjectImage packet for each face AddLocalPacketHandler(PacketType.ObjectImage, HandleObjectImage, false); - + AddLocalPacketHandler(PacketType.ObjectGrab, HandleObjectGrab, false); AddLocalPacketHandler(PacketType.ObjectGrabUpdate, HandleObjectGrabUpdate, false); AddLocalPacketHandler(PacketType.ObjectDeGrab, HandleObjectDeGrab); @@ -5065,12 +5064,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP return false; } - + private bool HandleParcelGodMarkAsContent(IClientAPI client, Packet Packet) { ParcelGodMarkAsContentPacket ParcelGodMarkAsContent = (ParcelGodMarkAsContentPacket)Packet; - + ParcelGodMark ParcelGodMarkAsContentHandler = OnParcelGodMark; if (ParcelGodMarkAsContentHandler != null) { @@ -5081,11 +5080,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP } return false; } - + private bool HandleFreezeUser(IClientAPI client, Packet Packet) { FreezeUserPacket FreezeUser = (FreezeUserPacket)Packet; - + FreezeUserUpdate FreezeUserHandler = OnParcelFreezeUser; if (FreezeUserHandler != null) { @@ -5097,12 +5096,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP } return false; } - + private bool HandleEjectUser(IClientAPI client, Packet Packet) { EjectUserPacket EjectUser = (EjectUserPacket)Packet; - + EjectUserUpdate EjectUserHandler = OnParcelEjectUser; if (EjectUserHandler != null) { @@ -5114,12 +5113,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP } return false; } - + private bool HandleParcelBuyPass(IClientAPI client, Packet Packet) { ParcelBuyPassPacket ParcelBuyPass = (ParcelBuyPassPacket)Packet; - + ParcelBuyPass ParcelBuyPassHandler = OnParcelBuyPass; if (ParcelBuyPassHandler != null) { @@ -5130,7 +5129,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP } return false; } - + private bool HandleParcelBuyRequest(IClientAPI sender, Packet Pack) { ParcelBuyPacket parcel = (ParcelBuyPacket)Pack; @@ -5352,7 +5351,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP ScriptDialogReplyPacket rdialog = (ScriptDialogReplyPacket)Pack; //m_log.DebugFormat("[CLIENT]: Received ScriptDialogReply from {0}", rdialog.Data.ObjectID); - + #region Packet Session and User Check if (m_checkPackets) { @@ -5498,12 +5497,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP } return true; } - + private bool HandleFindAgent(IClientAPI client, Packet Packet) { FindAgentPacket FindAgent = (FindAgentPacket)Packet; - + FindAgentUpdate FindAgentHandler = OnFindAgent; if (FindAgentHandler != null) { @@ -5512,12 +5511,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP } return false; } - + private bool HandleTrackAgent(IClientAPI client, Packet Packet) { TrackAgentPacket TrackAgent = (TrackAgentPacket)Packet; - + TrackAgentUpdate TrackAgentHandler = OnTrackAgent; if (TrackAgentHandler != null) { @@ -5528,7 +5527,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP } return false; } - + private bool HandlerRezObject(IClientAPI sender, Packet Pack) { RezObjectPacket rezPacket = (RezObjectPacket)Pack; @@ -7184,19 +7183,19 @@ namespace OpenSim.Region.ClientStack.LindenUDP UUID requestID = new UUID(transfer.TransferInfo.Params, 80); // m_log.DebugFormat( -// "[CLIENT]: Got request for asset {0} from item {1} in prim {2} by {3}", +// "[CLIENT]: Got request for asset {0} from item {1} in prim {2} by {3}", // requestID, itemID, taskID, Name); - + if (!(((Scene)m_scene).Permissions.BypassPermissions())) { if (taskID != UUID.Zero) // Prim { SceneObjectPart part = ((Scene)m_scene).GetSceneObjectPart(taskID); - + if (part == null) { m_log.WarnFormat( - "[CLIENT]: {0} requested asset {1} from item {2} in prim {3} but prim does not exist", + "[CLIENT]: {0} requested asset {1} from item {2} in prim {3} but prim does not exist", Name, requestID, itemID, taskID); return true; } @@ -7205,11 +7204,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP if (tii == null) { m_log.WarnFormat( - "[CLIENT]: {0} requested asset {1} from item {2} in prim {3} but item does not exist", - Name, requestID, itemID, taskID); + "[CLIENT]: {0} requested asset {1} from item {2} in prim {3} but item does not exist", + Name, requestID, itemID, taskID); return true; - } - + } + if (tii.Type == (int)AssetType.LSLText) { if (!((Scene)m_scene).Permissions.CanEditScript(itemID, taskID, AgentId)) @@ -7228,41 +7227,41 @@ namespace OpenSim.Region.ClientStack.LindenUDP { m_log.WarnFormat( "[CLIENT]: {0} requested asset {1} from item {2} in prim {3} but the prim is owned by {4}", - Name, requestID, itemID, taskID, part.OwnerID); + Name, requestID, itemID, taskID, part.OwnerID); return true; } - + if ((part.OwnerMask & (uint)PermissionMask.Modify) == 0) { m_log.WarnFormat( - "[CLIENT]: {0} requested asset {1} from item {2} in prim {3} but modify permissions are not set", - Name, requestID, itemID, taskID); + "[CLIENT]: {0} requested asset {1} from item {2} in prim {3} but modify permissions are not set", + Name, requestID, itemID, taskID); return true; } - + if (tii.OwnerID != AgentId) { m_log.WarnFormat( - "[CLIENT]: {0} requested asset {1} from item {2} in prim {3} but the item is owned by {4}", - Name, requestID, itemID, taskID, tii.OwnerID); + "[CLIENT]: {0} requested asset {1} from item {2} in prim {3} but the item is owned by {4}", + Name, requestID, itemID, taskID, tii.OwnerID); return true; } - + if (( - tii.CurrentPermissions & ((uint)PermissionMask.Modify | (uint)PermissionMask.Copy | (uint)PermissionMask.Transfer)) + tii.CurrentPermissions & ((uint)PermissionMask.Modify | (uint)PermissionMask.Copy | (uint)PermissionMask.Transfer)) != ((uint)PermissionMask.Modify | (uint)PermissionMask.Copy | (uint)PermissionMask.Transfer)) { m_log.WarnFormat( - "[CLIENT]: {0} requested asset {1} from item {2} in prim {3} but item permissions are not modify/copy/transfer", - Name, requestID, itemID, taskID); + "[CLIENT]: {0} requested asset {1} from item {2} in prim {3} but item permissions are not modify/copy/transfer", + Name, requestID, itemID, taskID); return true; } - + if (tii.AssetID != requestID) { m_log.WarnFormat( - "[CLIENT]: {0} requested asset {1} from item {2} in prim {3} but this does not match item's asset {4}", - Name, requestID, itemID, taskID, tii.AssetID); + "[CLIENT]: {0} requested asset {1} from item {2} in prim {3} but this does not match item's asset {4}", + Name, requestID, itemID, taskID, tii.AssetID); return true; } } @@ -7866,7 +7865,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP newTaskItem, updatetask.UpdateData.LocalID); } } - } + } return true; } @@ -8861,7 +8860,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP // return true; } - + private bool HandleRequestRegionInfo(IClientAPI sender, Packet Pack) { RequestRegionInfoPacket.AgentDataBlock mPacket = ((RequestRegionInfoPacket)Pack).AgentData; @@ -8882,7 +8881,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP } return true; } - + private bool HandleEstateCovenantRequest(IClientAPI sender, Packet Pack) { @@ -8919,7 +8918,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP return true; } - + private bool HandleGodUpdateRegionInfoUpdate(IClientAPI client, Packet Packet) { GodUpdateRegionInfoPacket GodUpdateRegionInfo = @@ -8939,7 +8938,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP } return false; } - + private bool HandleSimWideDeletes(IClientAPI client, Packet Packet) { SimWideDeletesPacket SimWideDeletesRequest = @@ -8952,7 +8951,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP } return false; } - + private bool HandleGodlikeMessage(IClientAPI client, Packet Packet) { GodlikeMessagePacket GodlikeMessage = @@ -8969,7 +8968,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP } return false; } - + private bool HandleSaveStatePacket(IClientAPI client, Packet Packet) { StateSavePacket SaveStateMessage = @@ -8982,7 +8981,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP } return false; } - + private bool HandleGodKickUser(IClientAPI sender, Packet Pack) { GodKickUserPacket gkupack = (GodKickUserPacket)Pack; @@ -9120,7 +9119,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP } return true; } - + #endregion Economy/Transaction Packets #region Script Packets @@ -9333,7 +9332,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP } return true; } - + private bool HandleUpdateMuteListEntry(IClientAPI client, Packet Packet) { UpdateMuteListEntryPacket UpdateMuteListEntry = @@ -9349,7 +9348,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP } return false; } - + private bool HandleRemoveMuteListEntry(IClientAPI client, Packet Packet) { RemoveMuteListEntryPacket RemoveMuteListEntry = @@ -9365,7 +9364,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP } return false; } - + private bool HandleUserReport(IClientAPI client, Packet Packet) { UserReportPacket UserReport = @@ -9390,7 +9389,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP } return false; } - + private bool HandleSendPostcard(IClientAPI client, Packet packet) { // SendPostcardPacket SendPostcard = @@ -9672,7 +9671,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP return true; } - + private bool HandleGroupVoteHistoryRequest(IClientAPI client, Packet Packet) { GroupVoteHistoryRequestPacket GroupVoteHistoryRequest = @@ -9685,7 +9684,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP } return false; } - + private bool HandleGroupActiveProposalsRequest(IClientAPI client, Packet Packet) { GroupActiveProposalsRequestPacket GroupActiveProposalsRequest = @@ -9698,7 +9697,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP } return false; } - + private bool HandleGroupAccountDetailsRequest(IClientAPI client, Packet Packet) { GroupAccountDetailsRequestPacket GroupAccountDetailsRequest = @@ -9711,7 +9710,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP } return false; } - + private bool HandleGroupAccountSummaryRequest(IClientAPI client, Packet Packet) { GroupAccountSummaryRequestPacket GroupAccountSummaryRequest = @@ -9724,7 +9723,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP } return false; } - + private bool HandleGroupTransactionsDetailsRequest(IClientAPI client, Packet Packet) { GroupAccountTransactionsRequestPacket GroupAccountTransactionsRequest = @@ -9737,7 +9736,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP } return false; } - + private bool HandleGroupTitlesRequest(IClientAPI sender, Packet Pack) { GroupTitlesRequestPacket groupTitlesRequest = @@ -11185,26 +11184,25 @@ namespace OpenSim.Region.ClientStack.LindenUDP if (m_debugPacketLevel > 0) { bool outputPacket = true; - - if (m_debugPacketLevel <= 255 + + if (m_debugPacketLevel <= 255 && (packet.Type == PacketType.SimStats || packet.Type == PacketType.SimulatorViewerTimeMessage)) outputPacket = false; - - if (m_debugPacketLevel <= 200 - && - (packet.Type == PacketType.ImagePacket + + if (m_debugPacketLevel <= 200 + && (packet.Type == PacketType.ImagePacket || packet.Type == PacketType.ImageData || packet.Type == PacketType.LayerData - || packet.Type == PacketType.CoarseLocationUpdate)) + || packet.Type == PacketType.CoarseLocationUpdate)) outputPacket = false; - + if (m_debugPacketLevel <= 100 && (packet.Type == PacketType.AvatarAnimation || packet.Type == PacketType.ViewerEffect)) - outputPacket = false; - + outputPacket = false; + if (outputPacket) m_log.DebugFormat("[CLIENT]: Packet OUT {0}", packet.Type); } - + m_udpServer.SendPacket(m_udpClient, packet, throttlePacketType, doAutomaticSplitting); } @@ -11279,16 +11277,16 @@ namespace OpenSim.Region.ClientStack.LindenUDP if (m_debugPacketLevel > 0) { bool outputPacket = true; - + if (m_debugPacketLevel <= 255 && packet.Type == PacketType.AgentUpdate) outputPacket = false; - + if (m_debugPacketLevel <= 200 && packet.Type == PacketType.RequestImage) outputPacket = false; - + if (m_debugPacketLevel <= 100 && (packet.Type == PacketType.ViewerEffect || packet.Type == PacketType.AgentAnimation)) outputPacket = false; - + if (outputPacket) m_log.DebugFormat("[CLIENT]: Packet IN {0}", packet.Type); } @@ -11551,12 +11549,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP UUID requestID = UUID.Zero; byte source = (byte)SourceType.Asset; - - if (transferRequest.TransferInfo.SourceType == (int)SourceType.Asset) + + if (transferRequest.TransferInfo.SourceType == (int)SourceType.Asset) { requestID = new UUID(transferRequest.TransferInfo.Params, 0); } - else if (transferRequest.TransferInfo.SourceType == (int)SourceType.SimInventoryItem) + else if (transferRequest.TransferInfo.SourceType == (int)SourceType.SimInventoryItem) { requestID = new UUID(transferRequest.TransferInfo.Params, 80); source = (byte)SourceType.SimInventoryItem; @@ -11802,7 +11800,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP public PacketMethod method; public bool Async; } - + public class AsyncPacketProcess { public bool result = false; @@ -11871,8 +11869,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP dialog.Data.FirstName = Util.StringToBytes256(ownerFirstName); dialog.Data.LastName = Util.StringToBytes256(ownerLastName); dialog.Data.Message = Util.StringToBytes256(message); - - + ScriptDialogPacket.ButtonsBlock[] buttons = new ScriptDialogPacket.ButtonsBlock[1]; buttons[0] = new ScriptDialogPacket.ButtonsBlock(); buttons[0].ButtonLabel = Util.StringToBytes256("!!llTextBox!!"); @@ -11886,7 +11883,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP { ScenePresence presence = p as ScenePresence; // It turns out to get the agent to stop flying, you have to feed it stop flying velocities - // There's no explicit message to send the client to tell it to stop flying.. it relies on the + // There's no explicit message to send the client to tell it to stop flying.. it relies on the // velocity, collision plane and avatar height // Add 1/6 the avatar's height to it's position so it doesn't shoot into the air @@ -11903,7 +11900,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP // attach a suitable collision plane regardless of the actual situation to force the LLClient to land. // Collision plane below the avatar's position a 6th of the avatar's height is suitable. - // Mind you, that this method doesn't get called if the avatar's velocity magnitude is greater then a + // Mind you, that this method doesn't get called if the avatar's velocity magnitude is greater then a // certain amount.. because the LLClient wouldn't land in that situation anyway. // why are we still testing for this really old height value default??? diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs index 7270304..5604f49 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs @@ -48,8 +48,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments protected Scene m_scene = null; - public string Name { get { return "Attachments Module"; } } - public Type ReplaceableInterface { get { return null; } } + public string Name { get { return "Attachments Module"; } } + public Type ReplaceableInterface { get { return null; } } public void Initialise(IConfigSource source) {} @@ -80,7 +80,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments client.OnRezMultipleAttachmentsFromInv += RezMultipleAttachmentsFromInventory; client.OnObjectAttach += AttachObject; client.OnObjectDetach += DetachObject; - client.OnDetachAttachmentIntoInv += ShowDetachInUserInventory; + client.OnDetachAttachmentIntoInv += ShowDetachInUserInventory; } public void UnsubscribeFromClientEvents(IClientAPI client) @@ -89,7 +89,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments client.OnRezMultipleAttachmentsFromInv -= RezMultipleAttachmentsFromInventory; client.OnObjectAttach -= AttachObject; client.OnObjectDetach -= DetachObject; - client.OnDetachAttachmentIntoInv -= ShowDetachInUserInventory; + client.OnDetachAttachmentIntoInv -= ShowDetachInUserInventory; } /// @@ -173,12 +173,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments UUID itemID = UUID.Zero; if (sp != null) { - foreach(SceneObjectGroup grp in sp.GetAttachments(AttachmentPt)) + foreach (SceneObjectGroup grp in sp.GetAttachments(AttachmentPt)) { itemID = grp.GetFromItemID(); if (itemID != UUID.Zero) DetachSingleAttachmentToInv(itemID, remoteClient); - } + } } if (group.GetFromItemID() == UUID.Zero) @@ -225,7 +225,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments public UUID RezSingleAttachmentFromInventory( IClientAPI remoteClient, UUID itemID, uint AttachmentPt, bool updateInventoryStatus) - { + { SceneObjectGroup att = RezSingleAttachmentFromInventoryInternal(remoteClient, itemID, AttachmentPt); if (updateInventoryStatus) @@ -241,8 +241,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments if (null == att) return UUID.Zero; else - return att.UUID; - } + return att.UUID; + } protected SceneObjectGroup RezSingleAttachmentFromInventoryInternal( IClientAPI remoteClient, UUID itemID, uint AttachmentPt) @@ -298,7 +298,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments } return null; - } + } public UUID SetAttachmentInventoryStatus( SceneObjectGroup att, IClientAPI remoteClient, UUID itemID, uint AttachmentPt) @@ -473,7 +473,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments sog.RootPart.IsAttachment = false; sog.AbsolutePosition = sog.RootPart.AttachedPos; UpdateKnownItem(client, sog, sog.GetFromItemID(), sog.OwnerID); - sog.SetAttachmentPoint(attachmentPoint); + sog.SetAttachmentPoint(attachmentPoint); } /// @@ -600,7 +600,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments // In case it is later dropped again, don't let // it get cleaned up so.RootPart.RemFlag(PrimFlags.TemporaryOnRez); - so.HasGroupChanged = false; + so.HasGroupChanged = false; } } } diff --git a/OpenSim/Region/CoreModules/Avatar/Combat/CombatModule.cs b/OpenSim/Region/CoreModules/Avatar/Combat/CombatModule.cs index 032e55a..25322a1 100644 --- a/OpenSim/Region/CoreModules/Avatar/Combat/CombatModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Combat/CombatModule.cs @@ -132,7 +132,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Combat.CombatModule try { deadAvatar.ControllingClient.SendAgentAlertMessage(deadAvatarMessage, true); - if(killingAvatar != null) + if (killingAvatar != null) killingAvatar.ControllingClient.SendAlertMessage("You fragged " + deadAvatar.Firstname + " " + deadAvatar.Lastname); } catch (InvalidOperationException) @@ -143,7 +143,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Combat.CombatModule } private void AvatarEnteringParcel(ScenePresence avatar, int localLandID, UUID regionID) - { + { try { ILandObject obj = avatar.Scene.LandChannel.GetLandObject(avatar.AbsolutePosition.X, avatar.AbsolutePosition.Y); diff --git a/OpenSim/Region/CoreModules/Avatar/Gods/GodsModule.cs b/OpenSim/Region/CoreModules/Avatar/Gods/GodsModule.cs index 4b30b0d..5ec64d5 100644 --- a/OpenSim/Region/CoreModules/Avatar/Gods/GodsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Gods/GodsModule.cs @@ -58,13 +58,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Gods public void SubscribeToClientEvents(IClientAPI client) { client.OnGodKickUser += KickUser; - client.OnRequestGodlikePowers += RequestGodlikePowers; - } + client.OnRequestGodlikePowers += RequestGodlikePowers; + } public void UnsubscribeFromClientEvents(IClientAPI client) { client.OnGodKickUser -= KickUser; - client.OnRequestGodlikePowers -= RequestGodlikePowers; + client.OnRequestGodlikePowers -= RequestGodlikePowers; } public void RequestGodlikePowers( diff --git a/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs b/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs index 13bae2e..43bbf0d 100644 --- a/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs @@ -137,7 +137,7 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage { if (scene.Entities.ContainsKey(toAgentID) && scene.Entities[toAgentID] is ScenePresence) - { + { // m_log.DebugFormat( // "[INSTANT MESSAGE]: Looking for root agent {0} in {1}", // toAgentID.ToString(), scene.RegionInfo.RegionName); diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs index 52342ec..c1df827 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs @@ -179,14 +179,14 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver m_log.DebugFormat( "[INVENTORY ARCHIVER]: Successfully loaded {0} assets with {1} failures", successfulAssetRestores, failedAssetRestores); - m_log.InfoFormat("[INVENTORY ARCHIVER]: Successfully loaded {0} items", successfulItemRestores); + m_log.InfoFormat("[INVENTORY ARCHIVER]: Successfully loaded {0} items", successfulItemRestores); return loadedNodes; } finally { m_loadStream.Close(); - } + } } public void Close() @@ -201,7 +201,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver /// The item archive path to replicate /// The root folder for the inventory load /// - /// The folders that we have resolved so far for a given archive path. + /// The folders that we have resolved so far for a given archive path. /// This method will add more folders if necessary /// /// @@ -246,17 +246,17 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver /// The root folder for the inventory load /// /// - /// The folders that we have resolved so far for a given archive path. + /// The folders that we have resolved so far for a given archive path. /// /// /// The folder in the user's inventory that matches best the archive path given. If no such folder was found /// then the passed in root destination folder is returned. - /// + /// protected InventoryFolderBase ResolveDestinationFolder( - InventoryFolderBase rootDestFolder, - ref string archivePath, + InventoryFolderBase rootDestFolder, + ref string archivePath, Dictionary resolvedFolders) - { + { // string originalArchivePath = archivePath; while (archivePath.Length > 0) @@ -370,7 +370,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver if (0 == i) loadedNodes.Add(destFolder); - } + } } /// diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs index 9908018..bae5a7a 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs @@ -119,7 +119,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver protected void ReceivedAllAssets(ICollection assetsFoundUuids, ICollection assetsNotFoundUuids) { Exception reportedException = null; - bool succeeded = true; + bool succeeded = true; try { @@ -136,7 +136,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver finally { m_saveStream.Close(); - } + } m_module.TriggerInventoryArchiveSaved( m_id, succeeded, m_userInfo, m_invPath, m_saveStream, reportedException); @@ -270,7 +270,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver { // We couldn't find the path indicated string errorMessage = string.Format("Aborted save. Could not find inventory path {0}", m_invPath); - Exception e = new InventoryArchiverException(errorMessage); + Exception e = new InventoryArchiverException(errorMessage); m_module.TriggerInventoryArchiveSaved(m_id, false, m_userInfo, m_invPath, m_saveStream, e); throw e; } @@ -283,7 +283,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver "[INVENTORY ARCHIVER]: Found folder {0} {1} at {2}", inventoryFolder.Name, inventoryFolder.ID, - m_invPath == String.Empty ? InventoryFolderImpl.PATH_DELIMITER : m_invPath ); + m_invPath == String.Empty ? InventoryFolderImpl.PATH_DELIMITER : m_invPath); //recurse through all dirs getting dirs and files SaveInvFolder(inventoryFolder, ArchiveConstants.INVENTORY_PATH, !saveFolderContentsOnly); @@ -301,7 +301,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver //SaveUsers(); new AssetsRequest( - new AssetsArchiver(m_archiveWriter), m_assetUuids, m_scene.AssetService, ReceivedAllAssets).Execute(); + new AssetsArchiver(m_archiveWriter), m_assetUuids, m_scene.AssetService, ReceivedAllAssets).Execute(); } catch (Exception) { diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverException.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverException.cs index e07e2ca..5fd1a7e 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverException.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverException.cs @@ -33,7 +33,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver /// Signals an inventory archiving problem /// public class InventoryArchiverException : Exception - { + { public InventoryArchiverException(string message) : base(message) {} public InventoryArchiverException(string message, Exception e) : base(message, e) {} } diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs index f03f2a1..2eaca49 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs @@ -91,12 +91,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver scene.AddCommand( this, "load iar", - "load iar []", + "load iar []", //"load iar [--merge] []", "Load user inventory archive (IAR).", //"--merge is an option which merges the loaded IAR with existing inventory folders where possible, rather than always creating new ones" //+ " is user's first name." + Environment.NewLine - " is user's first name." + Environment.NewLine + " is user's first name." + Environment.NewLine + " is user's last name." + Environment.NewLine + " is the path inside the user's inventory where the IAR should be loaded." + Environment.NewLine + " is the user's password." + Environment.NewLine @@ -241,7 +241,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver if (CheckPresence(userInfo.PrincipalID)) { InventoryArchiveReadRequest request; - bool merge = (options.ContainsKey("merge") ? (bool)options["merge"] : false); + bool merge = (options.ContainsKey("merge") ? (bool)options["merge"] : false); try { @@ -286,10 +286,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver if (CheckPresence(userInfo.PrincipalID)) { InventoryArchiveReadRequest request; - bool merge = (options.ContainsKey("merge") ? (bool)options["merge"] : false); + bool merge = (options.ContainsKey("merge") ? (bool)options["merge"] : false); try - { + { request = new InventoryArchiveReadRequest(m_aScene, userInfo, invPath, loadPath, merge); } catch (EntryPointNotFoundException e) @@ -325,20 +325,20 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver protected void HandleLoadInvConsoleCommand(string module, string[] cmdparams) { try - { - m_log.Info("[INVENTORY ARCHIVER]: PLEASE NOTE THAT THIS FACILITY IS EXPERIMENTAL. BUG REPORTS WELCOME."); - - Dictionary options = new Dictionary(); + { + m_log.Info("[INVENTORY ARCHIVER]: PLEASE NOTE THAT THIS FACILITY IS EXPERIMENTAL. BUG REPORTS WELCOME."); + + Dictionary options = new Dictionary(); OptionSet optionSet = new OptionSet().Add("m|merge", delegate (string v) { options["merge"] = v != null; }); List mainParams = optionSet.Parse(cmdparams); - + if (mainParams.Count < 6) { m_log.Error( "[INVENTORY ARCHIVER]: usage is load iar [--merge] []"); return; - } + } string firstName = mainParams[2]; string lastName = mainParams[3]; @@ -353,7 +353,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver if (DearchiveInventory(firstName, lastName, invPath, pass, loadPath, options)) m_log.InfoFormat( "[INVENTORY ARCHIVER]: Loaded archive {0} for {1} {2}", - loadPath, firstName, lastName); + loadPath, firstName, lastName); } catch (InventoryArchiverException e) { @@ -390,7 +390,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver "[INVENTORY ARCHIVER]: Saving archive {0} using inventory path {1} for {2} {3}", savePath, invPath, firstName, lastName); - ArchiveInventory(id, firstName, lastName, invPath, pass, savePath, new Dictionary()); + ArchiveInventory(id, firstName, lastName, invPath, pass, savePath, new Dictionary()); } catch (InventoryArchiverException e) { @@ -398,7 +398,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver } lock (m_pendingConsoleSaves) - m_pendingConsoleSaves.Add(id); + m_pendingConsoleSaves.Add(id); } private void SaveInvConsoleCommandCompleted( diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs index d66a1d0..938886b2 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs @@ -58,18 +58,18 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests /// /// Stream of data representing a common IAR that can be reused in load tests. /// - protected MemoryStream m_iarStream; + protected MemoryStream m_iarStream; protected UserAccount m_ua1 = new UserAccount { PrincipalID = UUID.Parse("00000000-0000-0000-0000-000000000555"), FirstName = "Mr", - LastName = "Tiddles" }; + LastName = "Tiddles" }; protected UserAccount m_ua2 = new UserAccount { PrincipalID = UUID.Parse("00000000-0000-0000-0000-000000000666"), FirstName = "Lord", - LastName = "Lucan" }; + LastName = "Lucan" }; string m_item1Name = "b.lsl"; private void SaveCompleted( @@ -86,7 +86,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests } protected void ConstructDefaultIarForTestLoad() - { + { string archiveItemName = InventoryArchiveWriteRequest.CreateArchiveItemName(m_item1Name, UUID.Random()); MemoryStream archiveWriteStream = new MemoryStream(); @@ -104,7 +104,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests string item1FileName = string.Format("{0}{1}", ArchiveConstants.INVENTORY_PATH, archiveItemName); tar.WriteFile(item1FileName, UserInventoryItemSerializer.Serialize(item1)); - tar.Close(); + tar.Close(); m_iarStream = new MemoryStream(archiveWriteStream.ToArray()); } @@ -341,7 +341,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests // Assert.That(gotObject2File, Is.True, "No object2 file in archive"); // TODO: Test presence of more files and contents of files. - } + } /// /// Test that things work when the load path specified starts with a slash @@ -349,22 +349,22 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests [Test] public void TestLoadIarPathStartsWithSlash() { - TestHelper.InMethod(); + TestHelper.InMethod(); // log4net.Config.XmlConfigurator.Configure(); SerialiserModule serialiserModule = new SerialiserModule(); - InventoryArchiverModule archiverModule = new InventoryArchiverModule(true); - Scene scene = SceneSetupHelpers.SetupScene("inventory"); + InventoryArchiverModule archiverModule = new InventoryArchiverModule(true); + Scene scene = SceneSetupHelpers.SetupScene("inventory"); SceneSetupHelpers.SetupSceneModules(scene, serialiserModule, archiverModule); - UserProfileTestUtils.CreateUserWithInventory(scene, m_ua1, "password"); + UserProfileTestUtils.CreateUserWithInventory(scene, m_ua1, "password"); archiverModule.DearchiveInventory(m_ua1.FirstName, m_ua1.LastName, "/Objects", "password", m_iarStream); InventoryItemBase foundItem1 = InventoryArchiveUtils.FindItemByPath( scene.InventoryService, m_ua1.PrincipalID, "/Objects/" + m_item1Name); - Assert.That(foundItem1, Is.Not.Null, "Didn't find loaded item 1 in TestLoadIarFolderStartsWithSlash()"); + Assert.That(foundItem1, Is.Not.Null, "Didn't find loaded item 1 in TestLoadIarFolderStartsWithSlash()"); } /// @@ -376,7 +376,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests [Test] public void TestLoadIarV0_1ExistingUsers() { - TestHelper.InMethod(); + TestHelper.InMethod(); //log4net.Config.XmlConfigurator.Configure(); SerialiserModule serialiserModule = new SerialiserModule(); @@ -386,9 +386,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests Scene scene = SceneSetupHelpers.SetupScene("inventory"); SceneSetupHelpers.SetupSceneModules(scene, serialiserModule, archiverModule); - - UserProfileTestUtils.CreateUserWithInventory(scene, m_ua1, "meowfood"); - UserProfileTestUtils.CreateUserWithInventory(scene, m_ua2, "hampshire"); + + UserProfileTestUtils.CreateUserWithInventory(scene, m_ua1, "meowfood"); + UserProfileTestUtils.CreateUserWithInventory(scene, m_ua2, "hampshire"); archiverModule.DearchiveInventory(m_ua1.FirstName, m_ua1.LastName, "/", "meowfood", m_iarStream); @@ -450,7 +450,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests string userFirstName = "Jock"; string userLastName = "Stirrup"; UUID userId = UUID.Parse("00000000-0000-0000-0000-000000000020"); - UserProfileTestUtils.CreateUserWithInventory(scene, userFirstName, userLastName, userId, "meowfood"); + UserProfileTestUtils.CreateUserWithInventory(scene, userFirstName, userLastName, userId, "meowfood"); // Create asset SceneObjectGroup object1; @@ -524,7 +524,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests [Test] public void TestLoadIarV0_1AbsentUsers() { - TestHelper.InMethod(); + TestHelper.InMethod(); //log4net.Config.XmlConfigurator.Configure(); string userFirstName = "Charlie"; @@ -562,7 +562,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests Scene scene = SceneSetupHelpers.SetupScene("inventory"); SceneSetupHelpers.SetupSceneModules(scene, serialiserModule, archiverModule); - UserProfileTestUtils.CreateUserWithInventory(scene, userFirstName, userLastName, userUuid, "meowfood"); + UserProfileTestUtils.CreateUserWithInventory(scene, userFirstName, userLastName, userUuid, "meowfood"); archiverModule.DearchiveInventory(userFirstName, userLastName, "/", "meowfood", archiveReadStream); @@ -680,8 +680,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests string folder2aArchiveName = InventoryArchiveWriteRequest.CreateArchiveFolderName(folder2aName, UUID.Random()); string folder2bArchiveName = InventoryArchiveWriteRequest.CreateArchiveFolderName(folder2bName, UUID.Random()); - string iarPath1 = string.Join("", new string[] { folder1ArchiveName, folder2aArchiveName }); - string iarPath2 = string.Join("", new string[] { folder1ArchiveName, folder2bArchiveName }); + string iarPath1 = string.Join("", new string[] { folder1ArchiveName, folder2aArchiveName }); + string iarPath2 = string.Join("", new string[] { folder1ArchiveName, folder2bArchiveName }); { // Test replication of path1 @@ -694,7 +694,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests = InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, ua1.PrincipalID, folder1Name); Assert.That(folder1Candidates.Count, Is.EqualTo(1)); - InventoryFolderBase folder1 = folder1Candidates[0]; + InventoryFolderBase folder1 = folder1Candidates[0]; List folder2aCandidates = InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, folder1, folder2aName); Assert.That(folder2aCandidates.Count, Is.EqualTo(1)); @@ -715,11 +715,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests List folder2aCandidates = InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, folder1, folder2aName); - Assert.That(folder2aCandidates.Count, Is.EqualTo(1)); + Assert.That(folder2aCandidates.Count, Is.EqualTo(1)); List folder2bCandidates = InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, folder1, folder2bName); - Assert.That(folder2bCandidates.Count, Is.EqualTo(1)); + Assert.That(folder2bCandidates.Count, Is.EqualTo(1)); } } @@ -741,7 +741,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests InventoryFolderBase folder1 = UserInventoryTestUtils.CreateInventoryFolder( - scene.InventoryService, ua1.PrincipalID, folder1ExistingName); + scene.InventoryService, ua1.PrincipalID, folder1ExistingName); string folder1ArchiveName = InventoryArchiveWriteRequest.CreateArchiveFolderName(folder1ExistingName, UUID.Random()); string folder2ArchiveName = InventoryArchiveWriteRequest.CreateArchiveFolderName(folder2Name, UUID.Random()); @@ -772,7 +772,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests List folder2PostCandidates = InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, folder1Post, "b"); Assert.That(folder2PostCandidates.Count, Is.EqualTo(1)); - } + } /// /// Test replication of a partly existing archive path to the user's inventory. This should create @@ -792,7 +792,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests InventoryFolderBase folder1 = UserInventoryTestUtils.CreateInventoryFolder( - scene.InventoryService, ua1.PrincipalID, folder1ExistingName); + scene.InventoryService, ua1.PrincipalID, folder1ExistingName); string folder1ArchiveName = InventoryArchiveWriteRequest.CreateArchiveFolderName(folder1ExistingName, UUID.Random()); string folder2ArchiveName = InventoryArchiveWriteRequest.CreateArchiveFolderName(folder2Name, UUID.Random()); @@ -812,6 +812,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests List folder2PostCandidates = InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, folder1PostCandidates[0], "b"); Assert.That(folder2PostCandidates.Count, Is.EqualTo(1)); - } + } } } \ No newline at end of file diff --git a/OpenSim/Region/CoreModules/Framework/EventQueue/EventQueueGetModule.cs b/OpenSim/Region/CoreModules/Framework/EventQueue/EventQueueGetModule.cs index 35b70de..05fe3ee 100644 --- a/OpenSim/Region/CoreModules/Framework/EventQueue/EventQueueGetModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EventQueue/EventQueueGetModule.cs @@ -138,7 +138,7 @@ namespace OpenSim.Region.CoreModules.Framework.EventQueue { if (!queues.ContainsKey(agentId)) { - /* + /* m_log.DebugFormat( "[EVENTQUEUE]: Adding new queue for agent {0} in region {1}", agentId, m_scene.RegionInfo.RegionName); @@ -701,7 +701,7 @@ namespace OpenSim.Region.CoreModules.Framework.EventQueue public void ParcelProperties(ParcelPropertiesMessage parcelPropertiesMessage, UUID avatarID) { - OSD item = EventQueueHelper.ParcelProperties(parcelPropertiesMessage); + OSD item = EventQueueHelper.ParcelProperties(parcelPropertiesMessage); Enqueue(item, avatarID); } diff --git a/OpenSim/Region/CoreModules/Framework/EventQueue/EventQueueHelper.cs b/OpenSim/Region/CoreModules/Framework/EventQueue/EventQueueHelper.cs index b62df18..0d7d16a 100644 --- a/OpenSim/Region/CoreModules/Framework/EventQueue/EventQueueHelper.cs +++ b/OpenSim/Region/CoreModules/Framework/EventQueue/EventQueueHelper.cs @@ -55,7 +55,7 @@ namespace OpenSim.Region.CoreModules.Framework.EventQueue } // private static byte[] uintToByteArray(uint uIntValue) -// { +// { // byte[] result = new byte[4]; // Utils.UIntToBytesBig(uIntValue, result, 0); // return result; @@ -386,14 +386,14 @@ namespace OpenSim.Region.CoreModules.Framework.EventQueue return placesReply; } - public static OSD ParcelProperties(ParcelPropertiesMessage parcelPropertiesMessage) - { - OSDMap message = new OSDMap(); - message.Add("message", OSD.FromString("ParcelProperties")); - OSD message_body = parcelPropertiesMessage.Serialize(); - message.Add("body", message_body); - return message; - } + public static OSD ParcelProperties(ParcelPropertiesMessage parcelPropertiesMessage) + { + OSDMap message = new OSDMap(); + message.Add("message", OSD.FromString("ParcelProperties")); + OSD message_body = parcelPropertiesMessage.Serialize(); + message.Add("body", message_body); + return message; + } } } diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs index d87f7f1..4c4eeff 100644 --- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs +++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs @@ -594,7 +594,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess rootPart.Name = item.Name; rootPart.Description = item.Description; - List partList = null; + List partList = null; lock (group.Children) partList = new List(group.Children.Values); diff --git a/OpenSim/Region/CoreModules/Framework/Statistics/Logging/BinaryLoggingModule.cs b/OpenSim/Region/CoreModules/Framework/Statistics/Logging/BinaryLoggingModule.cs index b75a700..a75ff62 100644 --- a/OpenSim/Region/CoreModules/Framework/Statistics/Logging/BinaryLoggingModule.cs +++ b/OpenSim/Region/CoreModules/Framework/Statistics/Logging/BinaryLoggingModule.cs @@ -49,8 +49,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments protected bool m_collectStats; protected Scene m_scene = null; - public string Name { get { return "Binary Statistics Logging Module"; } } - public Type ReplaceableInterface { get { return null; } } + public string Name { get { return "Binary Statistics Logging Module"; } } + public Type ReplaceableInterface { get { return null; } } public void Initialise(IConfigSource source) { @@ -79,7 +79,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments catch { // if it doesn't work, we don't collect anything - } + } } public void AddRegion(Scene scene) @@ -94,12 +94,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments public void RegionLoaded(Scene scene) { if (m_collectStats) - m_scene.StatsReporter.OnSendStatsResult += LogSimStats; + m_scene.StatsReporter.OnSendStatsResult += LogSimStats; } public void Close() { - } + } public class StatLogger { @@ -164,6 +164,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments } } return; - } + } } } diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/InventoryCache.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/InventoryCache.cs index 4e2f602..2322d7c 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/InventoryCache.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/InventoryCache.cs @@ -185,7 +185,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory return folders[type]; } - m_log.WarnFormat("[INVENTORY CACHE]: Could not find folder for system type {0} for {1}", type, userID); + m_log.WarnFormat("[INVENTORY CACHE]: Could not find folder for system type {0} for {1}", type, userID); return null; } diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs index cbd9e05..ab6be50 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs @@ -220,7 +220,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory { // m_log.DebugFormat( // "[LOCAL INVENTORY SERVICES CONNECTOR]: Adding inventory item {0} to user {1} folder {2}", -// item.Name, item.Owner, item.Folder); +// item.Name, item.Owner, item.Folder); return m_InventoryService.AddItem(item); } diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteXInventoryServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteXInventoryServiceConnector.cs index 4ab6947..34205e3 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteXInventoryServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteXInventoryServiceConnector.cs @@ -227,7 +227,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory public bool AddItem(InventoryItemBase item) { if (item == null) - return false; + return false; return m_RemoteConnector.AddItem(item); } diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveHelpers.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveHelpers.cs index ddc3dd7..c72acc3 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/ArchiveHelpers.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiveHelpers.cs @@ -33,7 +33,7 @@ using OpenSim.Framework.Serialization; using OpenSim.Region.Framework.Scenes; namespace OpenSim.Region.CoreModules.World.Archiver -{ +{ /// /// Helper methods for archive manipulation /// @@ -50,7 +50,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver public static string CreateObjectFilename(SceneObjectGroup sog) { return ArchiveConstants.CreateOarObjectFilename(sog.Name, sog.UUID, sog.AbsolutePosition); - } + } /// /// Create the path used to store an object in an OpenSim Archive. @@ -62,7 +62,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver public static string CreateObjectPath(SceneObjectGroup sog) { return ArchiveConstants.CreateOarObjectPath(sog.Name, sog.UUID, sog.AbsolutePosition); - } + } /// /// Resolve path to a working FileStream @@ -123,6 +123,6 @@ namespace OpenSim.Region.CoreModules.World.Archiver // return new BufferedStream(file, (int) response.ContentLength); return new BufferedStream(file, 1000000); - } + } } } \ No newline at end of file diff --git a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs index ea71fd9..634685a 100644 --- a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs +++ b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs @@ -72,12 +72,12 @@ namespace OpenSim.Region.CoreModules.World.Land #pragma warning restore 0429 /// - /// Local land ids at specified region co-ordinates (region size / 4) + /// Local land ids at specified region co-ordinates (region size / 4) /// private readonly int[,] m_landIDList = new int[landArrayMax, landArrayMax]; /// - /// Land objects keyed by local id + /// Land objects keyed by local id /// private readonly Dictionary m_landList = new Dictionary(); @@ -92,8 +92,8 @@ namespace OpenSim.Region.CoreModules.World.Land #region INonSharedRegionModule Members - public Type ReplaceableInterface - { + public Type ReplaceableInterface + { get { return null; } } @@ -192,7 +192,7 @@ namespace OpenSim.Region.CoreModules.World.Land Debug.WriteLine(string.Format("Stopping force position because {0} is close enough to position {1}", forcedPosition.Value, clientAvatar.AbsolutePosition)); forcedPosition = null; } - //if we are far away, teleport + //if we are far away, teleport else if (Vector3.Distance(clientAvatar.AbsolutePosition, forcedPosition.Value) > 3) { Debug.WriteLine(string.Format("Teleporting out because {0} is too far from avatar position {1}", forcedPosition.Value, clientAvatar.AbsolutePosition)); @@ -321,8 +321,6 @@ namespace OpenSim.Region.CoreModules.World.Land } } - - private void ForceAvatarToPosition(ScenePresence avatar, Vector3? position) { if (m_scene.Permissions.IsGod(avatar.UUID)) return; @@ -336,7 +334,6 @@ namespace OpenSim.Region.CoreModules.World.Land { avatar.ControllingClient.SendAlertMessage( "You are not allowed on this parcel because the land owner has restricted access."); - } public void EventManagerOnAvatarEnteringNewParcel(ScenePresence avatar, int localLandID, UUID regionID) @@ -448,7 +445,7 @@ namespace OpenSim.Region.CoreModules.World.Land if (clientAvatar.AbsolutePosition.Z < LandChannel.BAN_LINE_SAFETY_HIEGHT && clientAvatar.sentMessageAboutRestrictedParcelFlyingDown) { - EventManagerOnAvatarEnteringNewParcel(clientAvatar, parcel.LandData.LocalID, + EventManagerOnAvatarEnteringNewParcel(clientAvatar, parcel.LandData.LocalID, m_scene.RegionInfo.RegionID); //They are going under the safety line! if (!parcel.IsBannedFromLand(clientAvatar.UUID)) @@ -652,7 +649,7 @@ namespace OpenSim.Region.CoreModules.World.Land if (x_float > Constants.RegionSize || x_float <= 0 || y_float > Constants.RegionSize || y_float <= 0) return null; - + try { x = Convert.ToInt32(Math.Floor(Convert.ToDouble(x_float) / 4.0)); @@ -667,7 +664,7 @@ namespace OpenSim.Region.CoreModules.World.Land { return null; } - + lock (m_landList) { // Corner case. If an autoreturn happens during sim startup @@ -687,7 +684,7 @@ namespace OpenSim.Region.CoreModules.World.Land // they happen every time at border crossings throw new Exception("Error: Parcel not found at point " + x + ", " + y); } - + lock (m_landIDList) { try @@ -741,7 +738,6 @@ namespace OpenSim.Region.CoreModules.World.Land public void EventManagerOnObjectBeingRemovedFromScene(SceneObjectGroup obj) { - lock (m_landList) { foreach (LandObject p in m_landList.Values) @@ -936,7 +932,7 @@ namespace OpenSim.Region.CoreModules.World.Land return; } } - + lock (m_landList) { foreach (ILandObject slaveLandObject in selectedLandObjects) @@ -1078,7 +1074,6 @@ namespace OpenSim.Region.CoreModules.World.Land temp.Add(currentParcel); } } - } } @@ -1121,7 +1116,7 @@ namespace OpenSim.Region.CoreModules.World.Land join(west, south, east, north, remote_client.AgentId); } - public void ClientOnParcelSelectObjects(int local_id, int request_type, + public void ClientOnParcelSelectObjects(int local_id, int request_type, List returnIDs, IClientAPI remote_client) { m_landList[local_id].SendForceObjectSelect(local_id, request_type, returnIDs, remote_client); @@ -1358,31 +1353,31 @@ namespace OpenSim.Region.CoreModules.World.Land { return RemoteParcelRequest(request, path, param, agentID, caps); })); - UUID parcelCapID = UUID.Random(); - caps.RegisterHandler("ParcelPropertiesUpdate", - new RestStreamHandler("POST", "/CAPS/" + parcelCapID, - delegate(string request, string path, string param, - OSHttpRequest httpRequest, OSHttpResponse httpResponse) - { - return ProcessPropertiesUpdate(request, path, param, agentID, caps); - })); - } - private string ProcessPropertiesUpdate(string request, string path, string param, UUID agentID, Caps caps) - { - IClientAPI client; - if ( ! m_scene.TryGetClient(agentID, out client) ) { - m_log.WarnFormat("[LAND] unable to retrieve IClientAPI for {0}", agentID.ToString() ); - return LLSDHelpers.SerialiseLLSDReply(new LLSDEmpty()); - } - - ParcelPropertiesUpdateMessage properties = new ParcelPropertiesUpdateMessage(); - OpenMetaverse.StructuredData.OSDMap args = (OpenMetaverse.StructuredData.OSDMap) OSDParser.DeserializeLLSDXml(request); - - properties.Deserialize(args); - - LandUpdateArgs land_update = new LandUpdateArgs(); - int parcelID = properties.LocalID; - land_update.AuthBuyerID = properties.AuthBuyerID; + UUID parcelCapID = UUID.Random(); + caps.RegisterHandler("ParcelPropertiesUpdate", + new RestStreamHandler("POST", "/CAPS/" + parcelCapID, + delegate(string request, string path, string param, + OSHttpRequest httpRequest, OSHttpResponse httpResponse) + { + return ProcessPropertiesUpdate(request, path, param, agentID, caps); + })); + } + private string ProcessPropertiesUpdate(string request, string path, string param, UUID agentID, Caps caps) + { + IClientAPI client; + if (! m_scene.TryGetClient(agentID, out client)) { + m_log.WarnFormat("[LAND] unable to retrieve IClientAPI for {0}", agentID.ToString()); + return LLSDHelpers.SerialiseLLSDReply(new LLSDEmpty()); + } + + ParcelPropertiesUpdateMessage properties = new ParcelPropertiesUpdateMessage(); + OpenMetaverse.StructuredData.OSDMap args = (OpenMetaverse.StructuredData.OSDMap) OSDParser.DeserializeLLSDXml(request); + + properties.Deserialize(args); + + LandUpdateArgs land_update = new LandUpdateArgs(); + int parcelID = properties.LocalID; + land_update.AuthBuyerID = properties.AuthBuyerID; land_update.Category = properties.Category; land_update.Desc = properties.Desc; land_update.GroupID = properties.GroupID; @@ -1399,15 +1394,15 @@ namespace OpenSim.Region.CoreModules.World.Land land_update.SnapshotID = properties.SnapshotID; land_update.UserLocation = properties.UserLocation; land_update.UserLookAt = properties.UserLookAt; - land_update.MediaDescription = properties.MediaDesc; - land_update.MediaType = properties.MediaType; - land_update.MediaWidth = properties.MediaWidth; - land_update.MediaHeight = properties.MediaHeight; - land_update.MediaLoop = properties.MediaLoop; - land_update.ObscureMusic = properties.ObscureMusic; - land_update.ObscureMedia = properties.ObscureMedia; - - ILandObject land; + land_update.MediaDescription = properties.MediaDesc; + land_update.MediaType = properties.MediaType; + land_update.MediaWidth = properties.MediaWidth; + land_update.MediaHeight = properties.MediaHeight; + land_update.MediaLoop = properties.MediaLoop; + land_update.ObscureMusic = properties.ObscureMusic; + land_update.ObscureMedia = properties.ObscureMedia; + + ILandObject land; lock (m_landList) { m_landList.TryGetValue(parcelID, out land); @@ -1415,15 +1410,15 @@ namespace OpenSim.Region.CoreModules.World.Land if (land != null) { - land.UpdateLandProperties(land_update, client); + land.UpdateLandProperties(land_update, client); m_scene.EventManager.TriggerOnParcelPropertiesUpdateRequest(land_update, parcelID, client); - } + } else { - m_log.WarnFormat("[LAND] unable to find parcelID {0}", parcelID); - } + m_log.WarnFormat("[LAND] unable to find parcelID {0}", parcelID); + } return LLSDHelpers.SerialiseLLSDReply(new LLSDEmpty()); - } + } // we cheat here: As we don't have (and want) a grid-global parcel-store, we can't return the // "real" parcelID, because we wouldn't be able to map that to the region the parcel belongs to. // So, we create a "fake" parcelID by using the regionHandle (64 bit), and the local (integer) x @@ -1500,19 +1495,19 @@ namespace OpenSim.Region.CoreModules.World.Land if (parcelID == UUID.Zero) return; - ExtendedLandData data = - (ExtendedLandData)parcelInfoCache.Get(parcelID.ToString(), - delegate(string id) + ExtendedLandData data = + (ExtendedLandData)parcelInfoCache.Get(parcelID.ToString(), + delegate(string id) { UUID parcel = UUID.Zero; UUID.TryParse(id, out parcel); // assume we've got the parcelID we just computed in RemoteParcelRequest ExtendedLandData extLandData = new ExtendedLandData(); - Util.ParseFakeParcelID(parcel, out extLandData.RegionHandle, + Util.ParseFakeParcelID(parcel, out extLandData.RegionHandle, out extLandData.X, out extLandData.Y); m_log.DebugFormat("[LAND] got parcelinfo request for regionHandle {0}, x/y {1}/{2}", extLandData.RegionHandle, extLandData.X, extLandData.Y); - + // for this region or for somewhere else? if (extLandData.RegionHandle == m_scene.RegionInfo.RegionHandle) { diff --git a/OpenSim/Region/CoreModules/World/Land/LandObject.cs b/OpenSim/Region/CoreModules/World/Land/LandObject.cs index 499b60c..d87352f 100644 --- a/OpenSim/Region/CoreModules/World/Land/LandObject.cs +++ b/OpenSim/Region/CoreModules/World/Land/LandObject.cs @@ -229,13 +229,13 @@ namespace OpenSim.Region.CoreModules.World.Land newData.SnapshotID = args.SnapshotID; newData.UserLocation = args.UserLocation; newData.UserLookAt = args.UserLookAt; - newData.MediaType = args.MediaType; - newData.MediaDescription = args.MediaDescription; - newData.MediaWidth = args.MediaWidth; - newData.MediaHeight = args.MediaHeight; - newData.MediaLoop = args.MediaLoop; - newData.ObscureMusic = args.ObscureMusic; - newData.ObscureMedia = args.ObscureMedia; + newData.MediaType = args.MediaType; + newData.MediaDescription = args.MediaDescription; + newData.MediaWidth = args.MediaWidth; + newData.MediaHeight = args.MediaHeight; + newData.MediaLoop = args.MediaLoop; + newData.ObscureMusic = args.ObscureMusic; + newData.ObscureMedia = args.ObscureMedia; m_scene.LandChannel.UpdateLandObject(LandData.LocalID, newData); diff --git a/OpenSim/Region/CoreModules/World/Media/Moap/MoapModule.cs b/OpenSim/Region/CoreModules/World/Media/Moap/MoapModule.cs index 82ad109..7c5d044 100644 --- a/OpenSim/Region/CoreModules/World/Media/Moap/MoapModule.cs +++ b/OpenSim/Region/CoreModules/World/Media/Moap/MoapModule.cs @@ -54,11 +54,11 @@ namespace OpenSim.Region.CoreModules.Media.Moap { [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "MoapModule")] public class MoapModule : INonSharedRegionModule, IMoapModule - { + { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - public string Name { get { return "MoapModule"; } } - public Type ReplaceableInterface { get { return null; } } + public string Name { get { return "MoapModule"; } } + public Type ReplaceableInterface { get { return null; } } /// /// Is this module enabled? @@ -78,17 +78,17 @@ namespace OpenSim.Region.CoreModules.Media.Moap /// /// Track the ObjectMedia capabilities given to users keyed by agent. Lock m_omCapUsers to manipulate. /// - protected Dictionary m_omCapUrls = new Dictionary(); + protected Dictionary m_omCapUrls = new Dictionary(); /// /// Track the ObjectMediaUpdate capabilities given to users keyed by path - /// + /// protected Dictionary m_omuCapUsers = new Dictionary(); /// /// Track the ObjectMediaUpdate capabilities given to users keyed by agent. Lock m_omuCapUsers to manipulate - /// - protected Dictionary m_omuCapUrls = new Dictionary(); + /// + protected Dictionary m_omuCapUrls = new Dictionary(); public void Initialise(IConfigSource configSource) { @@ -129,7 +129,7 @@ namespace OpenSim.Region.CoreModules.Media.Moap m_scene.EventManager.OnRegisterCaps -= OnRegisterCaps; m_scene.EventManager.OnDeregisterCaps -= OnDeregisterCaps; m_scene.EventManager.OnSceneObjectPartCopy -= OnSceneObjectPartCopy; - } + } public void OnRegisterCaps(UUID agentID, Caps caps) { @@ -159,7 +159,7 @@ namespace OpenSim.Region.CoreModules.Media.Moap caps.RegisterHandler( "ObjectMediaNavigate", new RestStreamHandler("POST", omuCapUrl, HandleObjectMediaNavigateMessage)); } - } + } public void OnDeregisterCaps(UUID agentID, Caps caps) { @@ -179,7 +179,7 @@ namespace OpenSim.Region.CoreModules.Media.Moap } protected void OnSceneObjectPartCopy(SceneObjectPart copy, SceneObjectPart original, bool userExposed) - { + { if (original.Shape.Media != null) { PrimitiveBaseShape.MediaList dupeMedia = new PrimitiveBaseShape.MediaList(); @@ -195,7 +195,7 @@ namespace OpenSim.Region.CoreModules.Media.Moap } copy.Shape.Media = dupeMedia; - } + } } public MediaEntry GetMediaEntry(SceneObjectPart part, int face) @@ -211,9 +211,9 @@ namespace OpenSim.Region.CoreModules.Media.Moap me = null; } else - { + { lock (media) - me = media[face]; + me = media[face]; // TODO: Really need a proper copy constructor down in libopenmetaverse if (me != null) @@ -227,17 +227,17 @@ namespace OpenSim.Region.CoreModules.Media.Moap public void SetMediaEntry(SceneObjectPart part, int face, MediaEntry me) { - CheckFaceParam(part, face); + CheckFaceParam(part, face); if (null == part.Shape.Media) part.Shape.Media = new PrimitiveBaseShape.MediaList(new MediaEntry[part.GetNumberOfSides()]); - lock (part.Shape.Media) + lock (part.Shape.Media) part.Shape.Media[face] = me; - UpdateMediaUrl(part, UUID.Zero); + UpdateMediaUrl(part, UUID.Zero); part.ScheduleFullUpdate(); - part.TriggerScriptChangedEvent(Changed.MEDIA); + part.TriggerScriptChangedEvent(Changed.MEDIA); } public void ClearMediaEntry(SceneObjectPart part, int face) @@ -256,7 +256,7 @@ namespace OpenSim.Region.CoreModules.Media.Moap /// protected string HandleObjectMediaMessage( string request, string path, string param, OSHttpRequest httpRequest, OSHttpResponse httpResponse) - { + { // m_log.DebugFormat("[MOAP]: Got ObjectMedia path [{0}], raw request [{1}]", path, request); OSDMap osd = (OSDMap)OSDParser.DeserializeLLSDXml(request); @@ -266,12 +266,12 @@ namespace OpenSim.Region.CoreModules.Media.Moap if (omm.Request is ObjectMediaRequest) return HandleObjectMediaRequest(omm.Request as ObjectMediaRequest); else if (omm.Request is ObjectMediaUpdate) - return HandleObjectMediaUpdate(path, omm.Request as ObjectMediaUpdate); + return HandleObjectMediaUpdate(path, omm.Request as ObjectMediaUpdate); throw new Exception( string.Format( "[MOAP]: ObjectMediaMessage has unrecognized ObjectMediaBlock of {0}", - omm.Request.GetType())); + omm.Request.GetType())); } /// @@ -279,7 +279,7 @@ namespace OpenSim.Region.CoreModules.Media.Moap /// /// /// - protected string HandleObjectMediaRequest(ObjectMediaRequest omr) + protected string HandleObjectMediaRequest(ObjectMediaRequest omr) { UUID primId = omr.PrimID; @@ -318,7 +318,7 @@ namespace OpenSim.Region.CoreModules.Media.Moap /// Path on which this request was made /// /param> /// - protected string HandleObjectMediaUpdate(string path, ObjectMediaUpdate omu) + protected string HandleObjectMediaUpdate(string path, ObjectMediaUpdate omu) { UUID primId = omu.PrimID; @@ -330,9 +330,9 @@ namespace OpenSim.Region.CoreModules.Media.Moap "[MOAP]: Received an UPDATE ObjectMediaRequest for prim {0} but this doesn't exist in region {1}", primId, m_scene.RegionInfo.RegionName); return string.Empty; - } + } -// m_log.DebugFormat("[MOAP]: Received {0} media entries for prim {1}", omu.FaceMedia.Length, primId); +// m_log.DebugFormat("[MOAP]: Received {0} media entries for prim {1}", omu.FaceMedia.Length, primId); // for (int i = 0; i < omu.FaceMedia.Length; i++) // { @@ -374,14 +374,14 @@ namespace OpenSim.Region.CoreModules.Media.Moap part.Shape.Textures = te; // m_log.DebugFormat( // "[MOAP]: Media flags for face {0} is {1}", -// i, part.Shape.Textures.FaceTextures[i].MediaFlags); +// i, part.Shape.Textures.FaceTextures[i].MediaFlags); } } } else - { + { // We need to go through the media textures one at a time to make sure that we have permission - // to change them + // to change them // FIXME: Race condition here since some other texture entry manipulator may overwrite/get // overwritten. Unfortunately, PrimitiveBaseShape does not allow us to change texture entry @@ -391,18 +391,18 @@ namespace OpenSim.Region.CoreModules.Media.Moap lock (media) { for (int i = 0; i < media.Count; i++) - { + { if (m_scene.Permissions.CanControlPrimMedia(agentId, part.UUID, i)) - { + { media[i] = omu.FaceMedia[i]; // When a face is cleared this is done by setting the MediaFlags in the TextureEntry via a normal // texture update, so we don't need to worry about clearing MediaFlags here. if (null == media[i]) - continue; + continue; Primitive.TextureEntryFace face = te.CreateFace((uint)i); - face.MediaFlags = true; + face.MediaFlags = true; // m_log.DebugFormat( // "[MOAP]: Media flags for face {0} is {1}", @@ -414,11 +414,11 @@ namespace OpenSim.Region.CoreModules.Media.Moap part.Shape.Textures = te; -// for (int i2 = 0; i2 < part.Shape.Textures.FaceTextures.Length; i2++) -// m_log.DebugFormat("[MOAP]: FaceTexture[{0}] is {1}", i2, part.Shape.Textures.FaceTextures[i2]); +// for (int i2 = 0; i2 < part.Shape.Textures.FaceTextures.Length; i2++) +// m_log.DebugFormat("[MOAP]: FaceTexture[{0}] is {1}", i2, part.Shape.Textures.FaceTextures[i2]); } - UpdateMediaUrl(part, agentId); + UpdateMediaUrl(part, agentId); // Arguably, we could avoid sending a full update to the avatar that just changed the texture. part.ScheduleFullUpdate(); @@ -439,16 +439,16 @@ namespace OpenSim.Region.CoreModules.Media.Moap /// protected string HandleObjectMediaNavigateMessage( string request, string path, string param, OSHttpRequest httpRequest, OSHttpResponse httpResponse) - { + { // m_log.DebugFormat("[MOAP]: Got ObjectMediaNavigate request [{0}]", request); OSDMap osd = (OSDMap)OSDParser.DeserializeLLSDXml(request); ObjectMediaNavigateMessage omn = new ObjectMediaNavigateMessage(); - omn.Deserialize(osd); + omn.Deserialize(osd); UUID primId = omn.PrimID; - SceneObjectPart part = m_scene.GetSceneObjectPart(primId); + SceneObjectPart part = m_scene.GetSceneObjectPart(primId); if (null == part) { @@ -456,12 +456,12 @@ namespace OpenSim.Region.CoreModules.Media.Moap "[MOAP]: Received an ObjectMediaNavigateMessage for prim {0} but this doesn't exist in region {1}", primId, m_scene.RegionInfo.RegionName); return string.Empty; - } + } UUID agentId = default(UUID); lock (m_omuCapUsers) - agentId = m_omuCapUsers[path]; + agentId = m_omuCapUsers[path]; if (!m_scene.Permissions.CanInteractWithPrimMedia(agentId, part.UUID, omn.Face)) return string.Empty; @@ -484,7 +484,7 @@ namespace OpenSim.Region.CoreModules.Media.Moap return string.Empty; if (me.EnableWhiteList) - { + { if (!CheckUrlAgainstWhitelist(omn.URL, me.WhiteList)) { // m_log.DebugFormat( @@ -493,18 +493,18 @@ namespace OpenSim.Region.CoreModules.Media.Moap return string.Empty; } - } + } me.CurrentURL = omn.URL; UpdateMediaUrl(part, agentId); - part.ScheduleFullUpdate(); + part.ScheduleFullUpdate(); part.TriggerScriptChangedEvent(Changed.MEDIA); return OSDParser.SerializeLLSDXmlString(new OSD()); - } + } /// /// Check that the face number is valid for the given prim. @@ -519,7 +519,7 @@ namespace OpenSim.Region.CoreModules.Media.Moap int maxFaces = part.GetNumberOfSides() - 1; if (face > maxFaces) throw new ArgumentException( - string.Format("Face argument was {0} but max is {1}", face, maxFaces)); + string.Format("Face argument was {0} but max is {1}", face, maxFaces)); } /// @@ -542,9 +542,9 @@ namespace OpenSim.Region.CoreModules.Media.Moap string rawVersion = part.MediaUrl.Substring(5, 10); int version = int.Parse(rawVersion); part.MediaUrl = string.Format("x-mv:{0:D10}/{1}", ++version, updateId); - } + } -// m_log.DebugFormat("[MOAP]: Storing media url [{0}] in prim {1} {2}", part.MediaUrl, part.Name, part.UUID); +// m_log.DebugFormat("[MOAP]: Storing media url [{0}] in prim {1} {2}", part.MediaUrl, part.Name, part.UUID); } /// @@ -554,7 +554,7 @@ namespace OpenSim.Region.CoreModules.Media.Moap /// /// true if the url matches an entry on the whitelist, false otherwise protected bool CheckUrlAgainstWhitelist(string rawUrl, string[] whitelist) - { + { Uri url = new Uri(rawUrl); foreach (string origWlUrl in whitelist) @@ -575,7 +575,7 @@ namespace OpenSim.Region.CoreModules.Media.Moap if (url.Host.Contains(wlUrl)) { // m_log.DebugFormat("[MOAP]: Whitelist URL {0} matches {1}", origWlUrl, rawUrl); - return true; + return true; } } else @@ -588,7 +588,7 @@ namespace OpenSim.Region.CoreModules.Media.Moap return true; } } - } + } return false; } diff --git a/OpenSim/Region/CoreModules/World/Objects/BuySell/BuySellModule.cs b/OpenSim/Region/CoreModules/World/Objects/BuySell/BuySellModule.cs index 12750c5..db50339 100644 --- a/OpenSim/Region/CoreModules/World/Objects/BuySell/BuySellModule.cs +++ b/OpenSim/Region/CoreModules/World/Objects/BuySell/BuySellModule.cs @@ -49,8 +49,8 @@ namespace OpenSim.Region.CoreModules.World.Objects.BuySell protected Scene m_scene = null; protected IDialogModule m_dialogModule; - public string Name { get { return "Object BuySell Module"; } } - public Type ReplaceableInterface { get { return null; } } + public string Name { get { return "Object BuySell Module"; } } + public Type ReplaceableInterface { get { return null; } } public void Initialise(IConfigSource source) {} @@ -78,8 +78,8 @@ namespace OpenSim.Region.CoreModules.World.Objects.BuySell public void SubscribeToClientEvents(IClientAPI client) { - client.OnObjectSaleInfo += ObjectSaleInfo; - } + client.OnObjectSaleInfo += ObjectSaleInfo; + } protected void ObjectSaleInfo( IClientAPI client, UUID agentID, UUID sessionID, uint localID, byte saleType, int salePrice) @@ -99,7 +99,7 @@ namespace OpenSim.Region.CoreModules.World.Objects.BuySell part.ParentGroup.HasGroupChanged = true; part.GetProperties(client); - } + } public bool BuyObject(IClientAPI remoteClient, UUID categoryID, uint localID, byte saleType) { @@ -225,7 +225,7 @@ namespace OpenSim.Region.CoreModules.World.Objects.BuySell } else { - if (m_dialogModule != null) + if (m_dialogModule != null) m_dialogModule.SendAlertToUser(remoteClient, "Cannot buy now. Your inventory is unavailable"); return false; } @@ -261,6 +261,6 @@ namespace OpenSim.Region.CoreModules.World.Objects.BuySell } return true; - } + } } } \ No newline at end of file diff --git a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs index bc54997..573a22a 100644 --- a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs +++ b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs @@ -397,13 +397,13 @@ namespace OpenSim.Region.CoreModules.World.Permissions m_groupsModule = m_scene.RequestModuleInterface(); if (m_groupsModule == null) - m_log.Warn("[PERMISSIONS]: Groups module not found, group permissions will not work"); + m_log.Warn("[PERMISSIONS]: Groups module not found, group permissions will not work"); m_moapModule = m_scene.RequestModuleInterface(); // This log line will be commented out when no longer required for debugging // if (m_moapModule == null) -// m_log.Warn("[PERMISSIONS]: Media on a prim module not found, media on a prim permissions will not work"); +// m_log.Warn("[PERMISSIONS]: Media on a prim module not found, media on a prim permissions will not work"); } public void Close() @@ -1906,7 +1906,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions } private bool CanControlPrimMedia(UUID agentID, UUID primID, int face) - { + { // m_log.DebugFormat( // "[PERMISSONS]: Performing CanControlPrimMedia check with agentID {0}, primID {1}, face {2}", // agentID, primID, face); @@ -1918,7 +1918,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions if (null == part) return false; - MediaEntry me = m_moapModule.GetMediaEntry(part, face); + MediaEntry me = m_moapModule.GetMediaEntry(part, face); // If there is no existing media entry then it can be controlled (in this context, created). if (null == me) @@ -1929,7 +1929,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions // agentID, primID, face, me.ControlPermissions); return GenericPrimMediaPermission(part, agentID, me.ControlPermissions); - } + } private bool CanInteractWithPrimMedia(UUID agentID, UUID primID, int face) { @@ -1952,15 +1952,15 @@ namespace OpenSim.Region.CoreModules.World.Permissions // m_log.DebugFormat( // "[PERMISSIONS]: Checking CanInteractWithPrimMedia for {0} on {1} face {2} with interact permissions {3}", -// agentID, primID, face, me.InteractPermissions); +// agentID, primID, face, me.InteractPermissions); return GenericPrimMediaPermission(part, agentID, me.InteractPermissions); - } + } private bool GenericPrimMediaPermission(SceneObjectPart part, UUID agentID, MediaPermission perms) { // if (IsAdministrator(agentID)) -// return true; +// return true; if ((perms & MediaPermission.Anyone) == MediaPermission.Anyone) return true; @@ -1969,15 +1969,15 @@ namespace OpenSim.Region.CoreModules.World.Permissions { if (agentID == part.OwnerID) return true; - } + } if ((perms & MediaPermission.Group) == MediaPermission.Group) { if (IsGroupMember(part.GroupID, agentID, 0)) return true; - } + } - return false; + return false; } } } \ No newline at end of file diff --git a/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs b/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs index cb80111..25d73c2 100644 --- a/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs +++ b/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs @@ -814,7 +814,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain { //m_log.Debug("Terrain packet unacked, resending patch: " + patchX + " , " + patchY); client.SendLayerData(patchX, patchY, m_scene.Heightmap.GetFloatsSerialised()); - } + } private void StoreUndoState() { diff --git a/OpenSim/Region/CoreModules/World/Wind/WindModule.cs b/OpenSim/Region/CoreModules/World/Wind/WindModule.cs index 9736b73..6bac555 100644 --- a/OpenSim/Region/CoreModules/World/Wind/WindModule.cs +++ b/OpenSim/Region/CoreModules/World/Wind/WindModule.cs @@ -425,7 +425,7 @@ namespace OpenSim.Region.CoreModules { if (m_ready) { - if(m_scene.GetRootAgentCount() > 0) + if (m_scene.GetRootAgentCount() > 0) { // Ask wind plugin to generate a LL wind array to be cached locally // Try not to update this too often, as it may involve array copies diff --git a/OpenSim/Region/CoreModules/World/WorldMap/MapImageModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/MapImageModule.cs index 1d9c2bd..1bd1371 100644 --- a/OpenSim/Region/CoreModules/World/WorldMap/MapImageModule.cs +++ b/OpenSim/Region/CoreModules/World/WorldMap/MapImageModule.cs @@ -228,7 +228,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap SceneObjectGroup mapdot = (SceneObjectGroup)obj; Color mapdotspot = Color.Gray; // Default color when prim color is white - // Loop over prim in group + // Loop over prim in group List partList = null; lock (mapdot.Children) partList = new List(mapdot.Children.Values); diff --git a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs index f036d85..fbc8a50 100644 --- a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs +++ b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs @@ -307,7 +307,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap lock (m_rootAgents) { m_rootAgents.Remove(AgentId); - if(m_rootAgents.Count == 0) + if (m_rootAgents.Count == 0) StopThread(); } } diff --git a/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs b/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs index 05c1e00..1140b9b 100644 --- a/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs +++ b/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs @@ -55,7 +55,7 @@ namespace OpenSim.Region.Framework.Interfaces /// /// /// - /// true if the object was successfully attached, false otherwise + /// true if the object was successfully attached, false otherwise bool AttachObject( IClientAPI remoteClient, SceneObjectGroup grp, uint AttachmentPt, bool silent); diff --git a/OpenSim/Region/Framework/Interfaces/IGroupsModule.cs b/OpenSim/Region/Framework/Interfaces/IGroupsModule.cs index 2c091e7..4c501f6 100644 --- a/OpenSim/Region/Framework/Interfaces/IGroupsModule.cs +++ b/OpenSim/Region/Framework/Interfaces/IGroupsModule.cs @@ -65,7 +65,7 @@ namespace OpenSim.Region.Framework.Interfaces /// Get a group /// /// ID of the group - /// The group's data. Null if there is no such group. + /// The group's data. Null if there is no such group. GroupRecord GetGroupRecord(UUID GroupID); void ActivateGroup(IClientAPI remoteClient, UUID groupID); @@ -74,14 +74,14 @@ namespace OpenSim.Region.Framework.Interfaces List GroupRoleDataRequest(IClientAPI remoteClient, UUID groupID); List GroupRoleMembersRequest(IClientAPI remoteClient, UUID groupID); GroupProfileData GroupProfileRequest(IClientAPI remoteClient, UUID groupID); - GroupMembershipData[] GetMembershipData(UUID UserID); + GroupMembershipData[] GetMembershipData(UUID UserID); GroupMembershipData GetMembershipData(UUID GroupID, UUID UserID); void UpdateGroupInfo(IClientAPI remoteClient, UUID groupID, string charter, bool showInList, UUID insigniaID, int membershipFee, bool openEnrollment, bool allowPublish, bool maturePublish); void SetGroupAcceptNotices(IClientAPI remoteClient, UUID groupID, bool acceptNotices, bool listInProfile); - void GroupTitleUpdate(IClientAPI remoteClient, UUID GroupID, UUID TitleRoleID); + void GroupTitleUpdate(IClientAPI remoteClient, UUID GroupID, UUID TitleRoleID); GroupNoticeData[] GroupNoticesListRequest(IClientAPI remoteClient, UUID GroupID); string GetGroupTitle(UUID avatarID); diff --git a/OpenSim/Region/Framework/Interfaces/IInventoryArchiverModule.cs b/OpenSim/Region/Framework/Interfaces/IInventoryArchiverModule.cs index 01066e6..ddf7565 100644 --- a/OpenSim/Region/Framework/Interfaces/IInventoryArchiverModule.cs +++ b/OpenSim/Region/Framework/Interfaces/IInventoryArchiverModule.cs @@ -43,14 +43,14 @@ namespace OpenSim.Region.Framework.Interfaces /// Contains the exception generated if the save did not succeed public delegate void InventoryArchiveSaved( Guid id, bool succeeded, UserAccount userInfo, string invPath, Stream saveStream, Exception reportedException); - + public interface IInventoryArchiverModule { /// /// Fired when an archive inventory save has been completed. /// event InventoryArchiveSaved OnInventoryArchiveSaved; - + /// /// Dearchive a user's inventory folder from the given stream /// @@ -60,7 +60,7 @@ namespace OpenSim.Region.Framework.Interfaces /// The stream from which the inventory archive will be loaded /// true if the first stage of the operation succeeded, false otherwise bool DearchiveInventory(string firstName, string lastName, string invPath, string pass, Stream loadStream); - + /// /// Dearchive a user's inventory folder from the given stream /// @@ -72,8 +72,8 @@ namespace OpenSim.Region.Framework.Interfaces /// the loaded IAR with existing folders where possible. /// true if the first stage of the operation succeeded, false otherwise bool DearchiveInventory( - string firstName, string lastName, string invPath, string pass, Stream loadStream, - Dictionary options); + string firstName, string lastName, string invPath, string pass, Stream loadStream, + Dictionary options); /// /// Archive a user's inventory folder to the given stream @@ -85,7 +85,7 @@ namespace OpenSim.Region.Framework.Interfaces /// The stream to which the inventory archive will be saved /// true if the first stage of the operation succeeded, false otherwise bool ArchiveInventory(Guid id, string firstName, string lastName, string invPath, string pass, Stream saveStream); - + /// /// Archive a user's inventory folder to the given stream /// @@ -97,7 +97,7 @@ namespace OpenSim.Region.Framework.Interfaces /// Archiving options. Currently, there are none. /// true if the first stage of the operation succeeded, false otherwise bool ArchiveInventory( - Guid id, string firstName, string lastName, string invPath, string pass, Stream saveStream, - Dictionary options); + Guid id, string firstName, string lastName, string invPath, string pass, Stream saveStream, + Dictionary options); } } diff --git a/OpenSim/Region/Framework/Interfaces/IMoapModule.cs b/OpenSim/Region/Framework/Interfaces/IMoapModule.cs index 24b6860..1d3d240 100644 --- a/OpenSim/Region/Framework/Interfaces/IMoapModule.cs +++ b/OpenSim/Region/Framework/Interfaces/IMoapModule.cs @@ -63,5 +63,5 @@ namespace OpenSim.Region.Framework.Interfaces /// /// /param> void ClearMediaEntry(SceneObjectPart part, int face); - } + } } \ No newline at end of file diff --git a/OpenSim/Region/Framework/Interfaces/IWorldMapModule.cs b/OpenSim/Region/Framework/Interfaces/IWorldMapModule.cs index d6e31f4..65c57a6 100644 --- a/OpenSim/Region/Framework/Interfaces/IWorldMapModule.cs +++ b/OpenSim/Region/Framework/Interfaces/IWorldMapModule.cs @@ -31,7 +31,7 @@ namespace OpenSim.Region.Framework.Interfaces { /// /// Generate a map tile for the scene. a terrain texture for this scene - /// + /// void GenerateMaptile(); } } diff --git a/OpenSim/Region/Framework/Scenes/EventManager.cs b/OpenSim/Region/Framework/Scenes/EventManager.cs index 6b2e03e..ff4595e 100644 --- a/OpenSim/Region/Framework/Scenes/EventManager.cs +++ b/OpenSim/Region/Framework/Scenes/EventManager.cs @@ -332,7 +332,7 @@ namespace OpenSim.Region.Framework.Scenes /// If the object is being attached, then the avatarID will be present. If the object is being detached then /// the avatarID is UUID.Zero (I know, this doesn't make much sense but now it's historical). public delegate void Attach(uint localID, UUID itemID, UUID avatarID); - public event Attach OnAttach; + public event Attach OnAttach; /// /// Called immediately after an object is loaded from storage. @@ -344,7 +344,7 @@ namespace OpenSim.Region.Framework.Scenes /// Called immediately before an object is saved to storage. /// /// - /// The scene object being persisted. + /// The scene object being persisted. /// This is actually a copy of the original scene object so changes made here will be saved to storage but will not be kept in memory. /// /// @@ -363,7 +363,7 @@ namespace OpenSim.Region.Framework.Scenes public delegate void SceneObjectPartCopyDelegate(SceneObjectPart copy, SceneObjectPart original, bool userExposed); public delegate void RegionUp(GridRegion region); - public event RegionUp OnRegionUp; + public event RegionUp OnRegionUp; public class MoneyTransferArgs : EventArgs { @@ -2063,7 +2063,7 @@ namespace OpenSim.Region.Framework.Scenes } } } - } + } public void TriggerOnSceneObjectPreSave(SceneObjectGroup persistingSo, SceneObjectGroup originalSo) { @@ -2105,7 +2105,7 @@ namespace OpenSim.Region.Framework.Scenes } } } - } + } public void TriggerOnParcelPropertiesUpdateRequest(LandUpdateArgs args, int local_id, IClientAPI remote_client) @@ -2127,6 +2127,6 @@ namespace OpenSim.Region.Framework.Scenes } } } - } + } } } diff --git a/OpenSim/Region/Framework/Scenes/Prioritizer.cs b/OpenSim/Region/Framework/Scenes/Prioritizer.cs index 581b11c..19f8180 100644 --- a/OpenSim/Region/Framework/Scenes/Prioritizer.cs +++ b/OpenSim/Region/Framework/Scenes/Prioritizer.cs @@ -62,7 +62,7 @@ namespace OpenSim.Region.Framework.Scenes /// /// This is added to the priority of all child prims, to make sure that the root prim update is sent to the - /// viewer before child prim updates. + /// viewer before child prim updates. /// The adjustment is added to child prims and subtracted from root prims, so the gap ends up /// being double. We do it both ways so that there is a still a priority delta even if the priority is already /// double.MinValue or double.MaxValue. @@ -150,9 +150,9 @@ namespace OpenSim.Region.Framework.Scenes if (entity is SceneObjectPart) { // Can't use Scene.GetGroupByPrim() here, since the entity may have been delete from the scene - // before its scheduled update was triggered + // before its scheduled update was triggered //entityPos = m_scene.GetGroupByPrim(entity.LocalId).AbsolutePosition; - entityPos = ((SceneObjectPart)entity).ParentGroup.AbsolutePosition; + entityPos = ((SceneObjectPart)entity).ParentGroup.AbsolutePosition; } else { @@ -177,11 +177,11 @@ namespace OpenSim.Region.Framework.Scenes // Use group position for child prims Vector3 entityPos = entity.AbsolutePosition; if (entity is SceneObjectPart) - { + { // Can't use Scene.GetGroupByPrim() here, since the entity may have been delete from the scene // before its scheduled update was triggered //entityPos = m_scene.GetGroupByPrim(entity.LocalId).AbsolutePosition; - entityPos = ((SceneObjectPart)entity).ParentGroup.AbsolutePosition; + entityPos = ((SceneObjectPart)entity).ParentGroup.AbsolutePosition; } else { diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index a439eb9..838c648 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs @@ -145,7 +145,7 @@ namespace OpenSim.Region.Framework.Scenes item.Owner, item.Name, item.ID); return false; - } + } } /// @@ -253,7 +253,7 @@ namespace OpenSim.Region.Framework.Scenes // Update item with new asset item.AssetID = asset.FullID; if (group.UpdateInventoryItem(item)) - remoteClient.SendAgentAlertMessage("Script saved", false); + remoteClient.SendAgentAlertMessage("Script saved", false); part.GetProperties(remoteClient); @@ -1975,7 +1975,7 @@ namespace OpenSim.Region.Framework.Scenes return null; if (!Permissions.CanRezObject(group.PrimCount, item.OwnerID, pos)) - return null; + return null; if (!Permissions.BypassPermissions()) { @@ -2053,7 +2053,7 @@ namespace OpenSim.Region.Framework.Scenes List partList = null; lock (sog.Children) - partList = new List(sog.Children.Values); + partList = new List(sog.Children.Values); foreach (SceneObjectPart child in partList) child.Inventory.ChangeInventoryOwner(ownerID); @@ -2068,7 +2068,7 @@ namespace OpenSim.Region.Framework.Scenes List partList = null; lock (sog.Children) - partList = new List(sog.Children.Values); + partList = new List(sog.Children.Values); foreach (SceneObjectPart child in partList) { @@ -2078,7 +2078,7 @@ namespace OpenSim.Region.Framework.Scenes sog.SetOwnerId(groupID); sog.ApplyNextOwnerPermissions(); - } + } } foreach (uint localID in localIDs) diff --git a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs index 2f69476..7788e43 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs @@ -164,7 +164,7 @@ namespace OpenSim.Region.Framework.Scenes List partList = null; lock (sog.Children) - partList = new List(sog.Children.Values); + partList = new List(sog.Children.Values); foreach (SceneObjectPart part in partList) { diff --git a/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs b/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs index 4e80bf2..06890a0 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs @@ -997,6 +997,6 @@ namespace OpenSim.Region.Framework.Scenes } } return true; - } + } } } \ No newline at end of file diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 46b84bb..f8877e4 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -1916,7 +1916,7 @@ namespace OpenSim.Region.Framework.Scenes sceneObject.ScheduleGroupForFullUpdate(); return sceneObject; - } + } /// /// Add an object into the scene that has come from storage @@ -2009,7 +2009,7 @@ namespace OpenSim.Region.Framework.Scenes /// public bool AddNewSceneObject( SceneObjectGroup sceneObject, bool attachToBackup, Vector3 pos, Quaternion rot, Vector3 vel) - { + { return m_sceneGraph.AddNewSceneObject(sceneObject, attachToBackup, pos, rot, vel); } @@ -2102,12 +2102,12 @@ namespace OpenSim.Region.Framework.Scenes // group has recently been delinked from another group but that this change has not been persisted // to the DB. ForceSceneObjectBackup(so); - so.DetachFromBackup(); + so.DetachFromBackup(); m_storageManager.DataStore.RemoveObject(so.UUID, m_regInfo.RegionID); } // We need to keep track of this state in case this group is still queued for further backup. - so.IsDeleted = true; + so.IsDeleted = true; return true; } @@ -2394,7 +2394,7 @@ namespace OpenSim.Region.Framework.Scenes ScenePresence sp = GetScenePresence(userID); if (sp != null && AttachmentsModule != null) { - uint attPt = (uint)sp.Appearance.GetAttachpoint(itemID); + uint attPt = (uint)sp.Appearance.GetAttachpoint(itemID); AttachmentsModule.RezSingleAttachmentFromInventory(sp.ControllingClient, itemID, attPt); } @@ -2437,7 +2437,7 @@ namespace OpenSim.Region.Framework.Scenes sceneObject.RootPart.AddFlag(PrimFlags.Phantom); // Don't sent a full update here because this will cause full updates to be sent twice for - // attachments on region crossings, resulting in viewer glitches. + // attachments on region crossings, resulting in viewer glitches. AddRestoredSceneObject(sceneObject, false, false, false); // Handle attachment special case @@ -2681,7 +2681,7 @@ namespace OpenSim.Region.Framework.Scenes } public virtual void SubscribeToClientPrimEvents(IClientAPI client) - { + { client.OnUpdatePrimGroupPosition += m_sceneGraph.UpdatePrimPosition; client.OnUpdatePrimSinglePosition += m_sceneGraph.UpdatePrimSinglePosition; client.OnUpdatePrimGroupRotation += m_sceneGraph.UpdatePrimRotation; @@ -2717,7 +2717,7 @@ namespace OpenSim.Region.Framework.Scenes client.OnUndo += m_sceneGraph.HandleUndo; client.OnRedo += m_sceneGraph.HandleRedo; client.OnObjectDescription += m_sceneGraph.PrimDescription; - client.OnObjectDrop += m_sceneGraph.DropObject; + client.OnObjectDrop += m_sceneGraph.DropObject; client.OnObjectIncludeInSearch += m_sceneGraph.MakeObjectSearchable; client.OnObjectOwner += ObjectOwner; } @@ -3669,7 +3669,7 @@ namespace OpenSim.Region.Framework.Scenes public virtual void AgentCrossing(UUID agentID, Vector3 position, bool isFlying) { ScenePresence presence = GetScenePresence(agentID); - if(presence != null) + if (presence != null) { try { diff --git a/OpenSim/Region/Framework/Scenes/SceneBase.cs b/OpenSim/Region/Framework/Scenes/SceneBase.cs index f8591ba..c71aefa 100644 --- a/OpenSim/Region/Framework/Scenes/SceneBase.cs +++ b/OpenSim/Region/Framework/Scenes/SceneBase.cs @@ -521,7 +521,7 @@ namespace OpenSim.Region.Framework.Scenes /// /// /// - /// + /// public void AddCommand( object mod, string command, string shorthelp, string longhelp, string descriptivehelp, CommandDelegate callback) { diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs index f779a6d..5ac8ff5 100644 --- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs +++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs @@ -298,7 +298,7 @@ namespace OpenSim.Region.Framework.Scenes /// Position of the object /// Rotation of the object /// Velocity of the object. This parameter only has an effect if the object is physical - /// + /// public bool AddNewSceneObject( SceneObjectGroup sceneObject, bool attachToBackup, Vector3 pos, Quaternion rot, Vector3 vel) { @@ -322,7 +322,7 @@ namespace OpenSim.Region.Framework.Scenes } return true; - } + } /// /// Add an object to the scene. This will both update the scene, and send information about the @@ -1284,7 +1284,7 @@ namespace OpenSim.Region.Framework.Scenes SceneObjectGroup group = GetGroupByPrim(localID); if (group != null) - { + { if (group.IsAttachment || (group.RootPart.Shape.PCode == 9 && group.RootPart.Shape.State != 0)) { if (m_parentScene.AttachmentsModule != null) diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 4024328..4caa439 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -677,7 +677,7 @@ namespace OpenSim.Region.Framework.Scenes minY = 256f; minZ = 8192f; - lock(m_parts) + lock (m_parts) { foreach (SceneObjectPart part in m_parts.Values) { @@ -1005,7 +1005,7 @@ namespace OpenSim.Region.Framework.Scenes AbsolutePosition = detachedpos; m_rootPart.AttachedAvatar = UUID.Zero; - //Anakin Lohner bug #3839 + //Anakin Lohner bug #3839 lock (m_parts) { foreach (SceneObjectPart p in m_parts.Values) @@ -1226,7 +1226,7 @@ namespace OpenSim.Region.Framework.Scenes } /// - /// Delete this group from its scene. + /// Delete this group from its scene. /// /// /// This only handles the in-world consequences of deletion (e.g. any avatars sitting on it are forcibly stood @@ -1383,7 +1383,7 @@ namespace OpenSim.Region.Framework.Scenes if (!m_isBackedUp) { // m_log.DebugFormat( -// "[WATER WARS]: Ignoring backup of {0} {1} since object is not marked to be backed up", Name, UUID); +// "[WATER WARS]: Ignoring backup of {0} {1} since object is not marked to be backed up", Name, UUID); return; } @@ -1395,7 +1395,7 @@ namespace OpenSim.Region.Framework.Scenes } // Since this is the top of the section of call stack for backing up a particular scene object, don't let - // any exception propogate upwards. + // any exception propogate upwards. try { if (!m_scene.ShuttingDown) // if shutting down then there will be nothing to handle the return so leave till next restart @@ -1546,7 +1546,7 @@ namespace OpenSim.Region.Framework.Scenes newPart.LinkNum = part.LinkNum; } - // Need to duplicate the physics actor as well + // Need to duplicate the physics actor as well if (part.PhysActor != null && userExposed) { PrimitiveBaseShape pbs = part.Shape; @@ -1562,7 +1562,7 @@ namespace OpenSim.Region.Framework.Scenes part.PhysActor.LocalID = part.LocalId; part.DoPhysicsPropertyUpdate(part.PhysActor.IsPhysical, true); - } + } } if (userExposed) @@ -1838,7 +1838,7 @@ namespace OpenSim.Region.Framework.Scenes SceneObjectPart newPart = null; lock (m_parts) - { + { newPart = part.Copy(m_scene.AllocateLocalId(), OwnerID, GroupID, m_parts.Count, userExposed); newPart.SetParent(this); m_parts.Add(newPart.UUID, newPart); @@ -2337,7 +2337,7 @@ namespace OpenSim.Region.Framework.Scenes if (p.LinkNum > linkPart.LinkNum) p.LinkNum--; } - } + } } linkPart.ParentID = 0; diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 3753dcb..024bdc9 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -1010,12 +1010,12 @@ namespace OpenSim.Region.Framework.Scenes return m_mediaUrl; } - set - { + set + { m_mediaUrl = value; if (ParentGroup != null) - ParentGroup.HasGroupChanged = true; + ParentGroup.HasGroupChanged = true; } } @@ -1028,7 +1028,7 @@ namespace OpenSim.Region.Framework.Scenes // m_log.DebugFormat("[SOP]: Setting CreateSelected to {0} for {1} {2}", value, Name, UUID); m_createSelected = value; } - } + } #endregion @@ -1189,7 +1189,7 @@ namespace OpenSim.Region.Framework.Scenes /// /// Property flags. See OpenMetaverse.PrimFlags - /// + /// /// Example properties are PrimFlags.Phantom and PrimFlags.DieAtEdge public PrimFlags Flags { @@ -1355,7 +1355,7 @@ namespace OpenSim.Region.Framework.Scenes /// /// Tell the scene presence that it should send updates for this part to its client - /// + /// public void AddFullUpdateToAvatar(ScenePresence presence) { presence.SceneViewer.QueuePartForUpdate(this); @@ -1414,7 +1414,7 @@ namespace OpenSim.Region.Framework.Scenes m_parentGroup.Scene.ForEachScenePresence(delegate(ScenePresence sp) { - if(!sp.IsChildAgent) + if (!sp.IsChildAgent) sp.ControllingClient.SendAttachedSoundGainChange(UUID, (float)volume); }); } @@ -1659,7 +1659,7 @@ namespace OpenSim.Region.Framework.Scenes // m_log.DebugFormat("[SCENE OBJECT PART]: Clone of {0} {1} finished", Name, UUID); - return dupe; + return dupe; } protected void AssetReceived(string id, Object sender, AssetBase asset) @@ -1969,10 +1969,10 @@ namespace OpenSim.Region.Framework.Scenes } public uint GetEffectiveObjectFlags() - { + { // Commenting this section of code out since it doesn't actually do anything, as enums are handled by // value rather than reference -// PrimFlags f = _flags; +// PrimFlags f = _flags; // if (m_parentGroup == null || m_parentGroup.RootPart == this) // f &= ~(PrimFlags.Touch | PrimFlags.Money); @@ -4733,7 +4733,7 @@ namespace OpenSim.Region.Framework.Scenes if (ParentGroup == null || ParentGroup.IsDeleted) return; - if (IsAttachment && ParentGroup.RootPart != this) + if (IsAttachment && ParentGroup.RootPart != this) return; // Causes this thread to dig into the Client Thread Data. diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs index 1984d45..4affdef 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs @@ -1094,7 +1094,7 @@ namespace OpenSim.Region.Framework.Scenes item.OwnerChanged = false; engine.ResumeScript(item.ItemID); } - } + } } } } diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index cc9355e..177cf1e 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -1287,7 +1287,7 @@ namespace OpenSim.Region.Framework.Scenes // Setting parent ID would fix this, if we knew what value // to use. Or we could add a m_isSitting variable. //Animator.TrySetMovementAnimation("SIT_GROUND_CONSTRAINED"); - SitGround = true; + SitGround = true; } // In the future, these values might need to go global. diff --git a/OpenSim/Region/Framework/Scenes/SceneViewer.cs b/OpenSim/Region/Framework/Scenes/SceneViewer.cs index 7aa5a93..b45291f 100644 --- a/OpenSim/Region/Framework/Scenes/SceneViewer.cs +++ b/OpenSim/Region/Framework/Scenes/SceneViewer.cs @@ -73,7 +73,7 @@ namespace OpenSim.Region.Framework.Scenes { m_pendingObjects = new Queue(); - lock(m_pendingObjects) + lock (m_pendingObjects) { EntityBase[] entities = m_presence.Scene.Entities.GetEntities(); foreach (EntityBase e in entities) @@ -85,7 +85,7 @@ namespace OpenSim.Region.Framework.Scenes } } - lock(m_pendingObjects) + lock (m_pendingObjects) { while (m_pendingObjects != null && m_pendingObjects.Count > 0) { diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneGraphTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneGraphTests.cs index c9662ef..7d9a6a9 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneGraphTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneGraphTests.cs @@ -71,7 +71,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests Assert.That(dupeSo.Children.Count, Is.EqualTo(2)); SceneObjectPart dupePart1 = dupeSo.GetLinkNumPart(1); - SceneObjectPart dupePart2 = dupeSo.GetLinkNumPart(2); + SceneObjectPart dupePart2 = dupeSo.GetLinkNumPart(2); Assert.That(dupePart1.LocalId, Is.Not.EqualTo(part1.LocalId)); Assert.That(dupePart2.LocalId, Is.Not.EqualTo(part2.LocalId)); @@ -84,6 +84,6 @@ namespace OpenSim.Region.Framework.Scenes.Tests Assert.That(dupePart1.PhysActor, Is.Not.Null); Assert.That(dupePart2.PhysActor, Is.Not.Null); */ - } + } } } \ No newline at end of file diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs index e3ef263..9f787c9 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs @@ -270,7 +270,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests TestHelper.InMethod(); //log4net.Config.XmlConfigurator.Configure(); - TestScene scene = SceneSetupHelpers.SetupScene(); + TestScene scene = SceneSetupHelpers.SetupScene(); string rootPartName = "rootpart"; UUID rootPartUuid = new UUID("00000000-0000-0000-0000-000000000001"); @@ -282,11 +282,11 @@ namespace OpenSim.Region.Framework.Scenes.Tests { Name = rootPartName, UUID = rootPartUuid }; SceneObjectPart linkPart = new SceneObjectPart(UUID.Zero, PrimitiveBaseShape.Default, Vector3.Zero, Quaternion.Identity, Vector3.Zero) - { Name = linkPartName, UUID = linkPartUuid }; + { Name = linkPartName, UUID = linkPartUuid }; SceneObjectGroup sog = new SceneObjectGroup(rootPart); - sog.AddPart(linkPart); - scene.AddNewSceneObject(sog, true); + sog.AddPart(linkPart); + scene.AddNewSceneObject(sog, true); // In a test, we have to crank the backup handle manually. Normally this would be done by the timer invoked // scene backup thread. @@ -309,7 +309,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests TestHelper.InMethod(); //log4net.Config.XmlConfigurator.Configure(); - TestScene scene = SceneSetupHelpers.SetupScene(); + TestScene scene = SceneSetupHelpers.SetupScene(); string rootPartName = "rootpart"; UUID rootPartUuid = new UUID("00000000-0000-0000-0000-000000000001"); @@ -321,11 +321,11 @@ namespace OpenSim.Region.Framework.Scenes.Tests { Name = rootPartName, UUID = rootPartUuid }; SceneObjectPart linkPart = new SceneObjectPart(UUID.Zero, PrimitiveBaseShape.Default, Vector3.Zero, Quaternion.Identity, Vector3.Zero) - { Name = linkPartName, UUID = linkPartUuid }; + { Name = linkPartName, UUID = linkPartUuid }; SceneObjectGroup sog = new SceneObjectGroup(rootPart); - sog.AddPart(linkPart); - scene.AddNewSceneObject(sog, true); + sog.AddPart(linkPart); + scene.AddNewSceneObject(sog, true); // In a test, we have to crank the backup handle manually. Normally this would be done by the timer invoked // scene backup thread. @@ -333,7 +333,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests // These changes should occur immediately without waiting for a backup pass SceneObjectGroup groupToDelete = sog.DelinkFromGroup(linkPart, false); - scene.DeleteSceneObject(groupToDelete, false); + scene.DeleteSceneObject(groupToDelete, false); List storedObjects = scene.StorageManager.DataStore.LoadObjects(scene.RegionInfo.RegionID); diff --git a/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs b/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs index 5e491c2..fe59d4f 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs @@ -59,8 +59,8 @@ namespace OpenSim.Region.Framework.Tests string userFirstName = "Jock"; string userLastName = "Stirrup"; string userPassword = "troll"; - UUID userId = UUID.Parse("00000000-0000-0000-0000-000000000020"); - return UserProfileTestUtils.CreateUserWithInventory(scene, userFirstName, userLastName, userId, userPassword); + UUID userId = UUID.Parse("00000000-0000-0000-0000-000000000020"); + return UserProfileTestUtils.CreateUserWithInventory(scene, userFirstName, userLastName, userId, userPassword); } protected SceneObjectGroup CreateSO1(Scene scene, UUID ownerId) @@ -70,7 +70,7 @@ namespace OpenSim.Region.Framework.Tests SceneObjectPart part1 = new SceneObjectPart(ownerId, PrimitiveBaseShape.Default, Vector3.Zero, Quaternion.Identity, Vector3.Zero) { Name = part1Name, UUID = part1Id }; - return new SceneObjectGroup(part1); + return new SceneObjectGroup(part1); } protected TaskInventoryItem CreateSOItem1(Scene scene, SceneObjectPart part) @@ -79,7 +79,7 @@ namespace OpenSim.Region.Framework.Tests nc.BodyText = "Hello World!"; nc.Encode(); UUID ncAssetUuid = new UUID("00000000-0000-0000-1000-000000000000"); - UUID ncItemUuid = new UUID("00000000-0000-0000-1100-000000000000"); + UUID ncItemUuid = new UUID("00000000-0000-0000-1100-000000000000"); AssetBase ncAsset = AssetHelpers.CreateAsset(ncAssetUuid, AssetType.Notecard, nc.AssetData, UUID.Zero); scene.AssetService.Store(ncAsset); @@ -114,9 +114,9 @@ namespace OpenSim.Region.Framework.Tests scene.MoveTaskInventoryItem(user1.PrincipalID, folder.ID, sop1, sopItem1.ItemID); InventoryItemBase ncUserItem - = InventoryArchiveUtils.FindItemByPath(scene.InventoryService, user1.PrincipalID, "Objects/ncItem"); + = InventoryArchiveUtils.FindItemByPath(scene.InventoryService, user1.PrincipalID, "Objects/ncItem"); Assert.That(ncUserItem, Is.Not.Null, "Objects/ncItem was not found"); - } + } /// /// Test MoveTaskInventoryItem where the item has no parent folder assigned. @@ -138,7 +138,7 @@ namespace OpenSim.Region.Framework.Tests scene.MoveTaskInventoryItem(user1.PrincipalID, UUID.Zero, sop1, sopItem1.ItemID); InventoryItemBase ncUserItem - = InventoryArchiveUtils.FindItemByPath(scene.InventoryService, user1.PrincipalID, "Notecards/ncItem"); + = InventoryArchiveUtils.FindItemByPath(scene.InventoryService, user1.PrincipalID, "Notecards/ncItem"); Assert.That(ncUserItem, Is.Not.Null, "Notecards/ncItem was not found"); } } diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs index 2969503..6f044e0 100644 --- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs +++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs @@ -962,7 +962,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups if ((groupInfo == null) || (account == null)) { return; - } + } // Send Message to Ejectee GridInstantMessage msg = new GridInstantMessage(); diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/SimianGroupsServicesConnectorModule.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/SimianGroupsServicesConnectorModule.cs index 9363205..0d265f2 100644 --- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/SimianGroupsServicesConnectorModule.cs +++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/SimianGroupsServicesConnectorModule.cs @@ -91,11 +91,11 @@ using OpenSim.Services.Interfaces; * + RoleID * * GroupID -> GroupNotice -> NoticeID - * + TimeStamp [uint] - * + FromName [string] - * + Subject [string] - * + Message [string] - * + BinaryBucket [byte[]] + * + TimeStamp [uint] + * + FromName [string] + * + Subject [string] + * + Message [string] + * + BinaryBucket [byte[]] * * */ @@ -309,7 +309,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups GroupInfoMap["OwnerRoleID"] = OSD.FromUUID(OwnerRoleID); GroupInfoMap["OwnersPowers"] = OSD.FromULong((ulong)m_DefaultOwnerPowers); - if(SimianAddGeneric(GroupID, "Group", name, GroupInfoMap)) + if (SimianAddGeneric(GroupID, "Group", name, GroupInfoMap)) { AddGroupRole(requestingAgentID, GroupID, UUID.Zero, "Everyone", "Members of " + name, "Member of " + name, (ulong)m_DefaultEveryonePowers); AddGroupRole(requestingAgentID, GroupID, OwnerRoleID, "Owners", "Owners of " + name, "Owner of " + name, (ulong)m_DefaultOwnerPowers); @@ -334,7 +334,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups string GroupName; OSDMap GroupInfoMap; - if( SimianGetFirstGenericEntry(groupID, "GroupInfo", out GroupName, out GroupInfoMap) ) + if (SimianGetFirstGenericEntry(groupID, "GroupInfo", out GroupName, out GroupInfoMap)) { GroupInfoMap["Charter"] = OSD.FromString(charter); GroupInfoMap["ShowInList"] = OSD.FromBoolean(showInList); @@ -379,7 +379,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups string GroupRoleMemberType = "GroupRole" + groupID.ToString(); if (SimianGetGenericEntries(GroupRoleMemberType, roleID.ToString(), out GroupRoleMembers)) { - foreach(UUID UserID in GroupRoleMembers.Keys) + foreach (UUID UserID in GroupRoleMembers.Keys) { EnsureRoleNotSelectedByMember(groupID, roleID, UserID); @@ -724,7 +724,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups } OSDMap UserGroupMemberInfo; - if( SimianGetGenericEntry(agentID, "GroupMember", groupID.ToString(), out UserGroupMemberInfo) ) + if (SimianGetGenericEntry(agentID, "GroupMember", groupID.ToString(), out UserGroupMemberInfo)) { data.AcceptNotices = UserGroupMemberInfo["AcceptNotices"].AsBoolean(); data.Contribution = UserGroupMemberInfo["Contribution"].AsInteger(); @@ -736,7 +736,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups // OSDMap GroupRoleInfo; - if( SimianGetGenericEntry(groupID, "GroupRole", data.ActiveRole.ToString(), out GroupRoleInfo) ) + if (SimianGetGenericEntry(groupID, "GroupRole", data.ActiveRole.ToString(), out GroupRoleInfo)) { data.GroupTitle = GroupRoleInfo["Title"].AsString(); data.GroupPowers = GroupRoleInfo["Powers"].AsULong(); @@ -748,7 +748,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups // OSDMap GroupInfo; string GroupName; - if( SimianGetFirstGenericEntry(groupID, "Group", out GroupName, out GroupInfo) ) + if (SimianGetFirstGenericEntry(groupID, "Group", out GroupName, out GroupInfo)) { data.GroupID = groupID; data.AllowPublish = GroupInfo["AllowPublish"].AsBoolean(); @@ -928,12 +928,12 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups Dictionary GroupRoles; if (SimianGetGenericEntries(groupID, "GroupRole", out GroupRoles)) { - foreach( KeyValuePair Role in GroupRoles ) + foreach (KeyValuePair Role in GroupRoles) { Dictionary GroupRoleMembers; - if( SimianGetGenericEntries("GroupRole"+groupID.ToString(), Role.Key, out GroupRoleMembers) ) + if (SimianGetGenericEntries("GroupRole"+groupID.ToString(), Role.Key, out GroupRoleMembers)) { - foreach( KeyValuePair GroupRoleMember in GroupRoleMembers ) + foreach (KeyValuePair GroupRoleMember in GroupRoleMembers) { GroupRoleMembersData data = new GroupRoleMembersData(); @@ -1264,7 +1264,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups if (m_debugEnabled) m_log.InfoFormat("[SIMIAN-GROUPS-CONNECTOR] Generics Result {0}", entryMap["Value"].AsString()); maps.Add(entryMap["Key"].AsString(), (OSDMap)OSDParser.DeserializeJson(entryMap["Value"].AsString())); } - if(maps.Count == 0) + if (maps.Count == 0) { if (m_debugEnabled) m_log.InfoFormat("[SIMIAN-GROUPS-CONNECTOR] No Generics Results"); } @@ -1352,17 +1352,14 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups } // Check if this is an update or a request - if ( requestArgs["RequestMethod"] == "RemoveGeneric" - || requestArgs["RequestMethod"] == "AddGeneric" - ) - + if (requestArgs["RequestMethod"] == "RemoveGeneric" + || requestArgs["RequestMethod"] == "AddGeneric") { // Any and all updates cause the cache to clear m_memoryCache.Clear(); // Send update to server, return the response without caching it return WebUtil.PostToService(m_groupsServerURI, requestArgs); - } // If we're not doing an update, we must be requesting data @@ -1372,7 +1369,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups OSDMap response = null; if (!m_memoryCache.TryGetValue(CacheKey, out response)) { - // if it wasn't in the cache, pass the request to the Simian Grid Services + // if it wasn't in the cache, pass the request to the Simian Grid Services response = WebUtil.PostToService(m_groupsServerURI, requestArgs); // and cache the response diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs index 79b9a16..a88c5e2 100644 --- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs +++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs @@ -960,7 +960,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups } - if( resp == null ) + if (resp == null) { string UserService; UUID SessionID; @@ -1065,7 +1065,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups /// /// Group Request Tokens are an attempt to allow the groups service to authenticate - /// requests. + /// requests. /// TODO: This broke after the big grid refactor, either find a better way, or discard this /// /// diff --git a/OpenSim/Region/OptionalModules/ContentManagementSystem/MetaEntity.cs b/OpenSim/Region/OptionalModules/ContentManagementSystem/MetaEntity.cs index 796f437..d7838c5 100644 --- a/OpenSim/Region/OptionalModules/ContentManagementSystem/MetaEntity.cs +++ b/OpenSim/Region/OptionalModules/ContentManagementSystem/MetaEntity.cs @@ -161,7 +161,7 @@ namespace OpenSim.Region.OptionalModules.ContentManagement //finalize m_Entity.RootPart.PhysActor = null; - m_Entity.Children = parts; + m_Entity.Children = parts; } } diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/SOPObject.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/SOPObject.cs index c439e3e..59ad9d8 100644 --- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/SOPObject.cs +++ b/OpenSim/Region/OptionalModules/Scripting/Minimodule/SOPObject.cs @@ -432,7 +432,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule return; } - foreach(string button in buttons) + foreach (string button in buttons) { if (button == String.Empty) { @@ -448,7 +448,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule dm.SendDialogToUser( avatar, GetSOP().Name, GetSOP().UUID, GetSOP().OwnerID, - message, new UUID("00000000-0000-2222-3333-100000001000"), chat_channel, buttons); + message, new UUID("00000000-0000-2222-3333-100000001000"), chat_channel, buttons); } diff --git a/OpenSim/Region/OptionalModules/World/MoneyModule/SampleMoneyModule.cs b/OpenSim/Region/OptionalModules/World/MoneyModule/SampleMoneyModule.cs index 61cbb90..cc51c3b 100644 --- a/OpenSim/Region/OptionalModules/World/MoneyModule/SampleMoneyModule.cs +++ b/OpenSim/Region/OptionalModules/World/MoneyModule/SampleMoneyModule.cs @@ -824,5 +824,5 @@ namespace OpenSim.Region.OptionalModules.World.MoneyModule RegionMoneyRequest = 1, Gift = 2, Purchase = 3 - } + } } \ No newline at end of file diff --git a/OpenSim/Region/RegionCombinerModule/RegionCombinerIndividualEventForwarder.cs b/OpenSim/Region/RegionCombinerModule/RegionCombinerIndividualEventForwarder.cs index a0d6197..f424e7f 100644 --- a/OpenSim/Region/RegionCombinerModule/RegionCombinerIndividualEventForwarder.cs +++ b/OpenSim/Region/RegionCombinerModule/RegionCombinerIndividualEventForwarder.cs @@ -49,7 +49,7 @@ namespace OpenSim.Region.RegionCombinerModule public void ClientConnect(IClientAPI client) { m_virtScene.UnSubscribeToClientPrimEvents(client); - m_virtScene.UnSubscribeToClientPrimRezEvents(client); + m_virtScene.UnSubscribeToClientPrimRezEvents(client); m_virtScene.UnSubscribeToClientInventoryEvents(client); ((AttachmentsModule)m_virtScene.AttachmentsModule).UnsubscribeFromClientEvents(client); //m_virtScene.UnSubscribeToClientTeleportEvents(client); @@ -66,7 +66,7 @@ namespace OpenSim.Region.RegionCombinerModule client.OnRezObject += LocalRezObject; m_rootScene.SubscribeToClientInventoryEvents(client); - ((AttachmentsModule)m_rootScene.AttachmentsModule).SubscribeToClientEvents(client); + ((AttachmentsModule)m_rootScene.AttachmentsModule).SubscribeToClientEvents(client); //m_rootScene.SubscribeToClientTeleportEvents(client); m_rootScene.SubscribeToClientScriptEvents(client); diff --git a/OpenSim/Region/RegionCombinerModule/RegionCombinerLargeLandChannel.cs b/OpenSim/Region/RegionCombinerModule/RegionCombinerLargeLandChannel.cs index 33ff707..be5411a 100644 --- a/OpenSim/Region/RegionCombinerModule/RegionCombinerLargeLandChannel.cs +++ b/OpenSim/Region/RegionCombinerModule/RegionCombinerLargeLandChannel.cs @@ -118,7 +118,7 @@ public class RegionCombinerLargeLandChannel : ILandChannel return regionData.RegionScene.LandChannel.GetLandObject(x - offsetX, y - offsetY); } } - + ILandObject obj = new LandObject(UUID.Zero, false, RegData.RegionScene); obj.LandData.Name = "NO LAND"; return obj; @@ -142,14 +142,14 @@ public class RegionCombinerLargeLandChannel : ILandChannel public void Join(int start_x, int start_y, int end_x, int end_y, UUID attempting_user_id) { - RootRegionLandChannel.Join(start_x, start_y, end_x, end_y, attempting_user_id); + RootRegionLandChannel.Join(start_x, start_y, end_x, end_y, attempting_user_id); } public void Subdivide(int start_x, int start_y, int end_x, int end_y, UUID attempting_user_id) { RootRegionLandChannel.Subdivide(start_x, start_y, end_x, end_y, attempting_user_id); } - + public void ReturnObjectsInParcel(int localID, uint returnType, UUID[] agentIDs, UUID[] taskIDs, IClientAPI remoteClient) { RootRegionLandChannel.ReturnObjectsInParcel(localID, returnType, agentIDs, taskIDs, remoteClient); diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index a9c5d10..0692fdb 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -7977,7 +7977,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api res.Add(new LSL_Integer((int)me.ControlPermissions)); break; } - } + } return res; } @@ -7993,7 +7993,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (face < 0 || face > m_host.GetNumberOfSides() - 1) return ScriptBaseClass.LSL_STATUS_OK; - return SetPrimMediaParams(face, rules); + return SetPrimMediaParams(face, rules); } private LSL_Integer SetPrimMediaParams(int face, LSL_List rules) @@ -8082,7 +8082,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api me.ControlPermissions = (MediaPermission)(byte)(int)rules.GetLSLIntegerItem(i++); break; } - } + } module.SetMediaEntry(m_host, face, me); @@ -8102,7 +8102,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api IMoapModule module = m_ScriptEngine.World.RequestModuleInterface(); if (null == module) - throw new Exception("Media on a prim functions not available"); + throw new Exception("Media on a prim functions not available"); module.ClearMediaEntry(m_host, face); diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index a529a94..477c52d 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -1190,7 +1190,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api World.LandChannel.Join(startx,starty,endx,endy,m_host.OwnerID); } - + public void osParcelSubdivide(LSL_Vector pos1, LSL_Vector pos2) { CheckThreatLevel(ThreatLevel.High, "osParcelSubdivide"); @@ -1213,7 +1213,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api // can modify it ILandObject startLandObject = World.LandChannel.GetLandObject((int)pos.x, (int)pos.y); - if (startLandObject == null) + if (startLandObject == null) { OSSLShoutError("There is no land at that location"); return; @@ -1230,7 +1230,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api UUID uuid; // Process the rules, not sure what the impact would be of changing owner or group - for (int idx = 0; idx < rules.Length; ) + for (int idx = 0; idx < rules.Length;) { int code = rules.GetLSLIntegerItem(idx++); string arg = rules.GetLSLStringItem(idx++); diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs index 2b67e84..fefbb35 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs @@ -416,7 +416,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins List sensedEntities = new List(); // If nobody about quit fast - if(m_CmdManager.m_ScriptEngine.World.GetRootAgentCount() == 0) + if (m_CmdManager.m_ScriptEngine.World.GetRootAgentCount() == 0) return sensedEntities; SceneObjectPart SensePoint = ts.host; @@ -485,7 +485,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins { ScenePresence sp; // Try direct lookup by UUID - if(!m_CmdManager.m_ScriptEngine.World.TryGetScenePresence(ts.keyID, out sp)) + if (!m_CmdManager.m_ScriptEngine.World.TryGetScenePresence(ts.keyID, out sp)) return sensedEntities; senseEntity(sp); } diff --git a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs index 8102acd..427d4e5 100644 --- a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs +++ b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs @@ -564,7 +564,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine bool postOnRez = (bool)p[4]; StateSource stateSource = (StateSource)p[5]; - lock(m_CompileDict) + lock (m_CompileDict) { if (!m_CompileDict.ContainsKey(itemID)) return false; diff --git a/OpenSim/Server/Base/ServerUtils.cs b/OpenSim/Server/Base/ServerUtils.cs index e7a8294..f4472c7 100644 --- a/OpenSim/Server/Base/ServerUtils.cs +++ b/OpenSim/Server/Base/ServerUtils.cs @@ -62,7 +62,7 @@ namespace OpenSim.Server.Base /// /// /// The arguments which control which constructor is invoked on the plugin - /// + /// public static T LoadPlugin(string dllName, Object[] args) where T:class { string[] parts = dllName.Split(new char[] {':'}); diff --git a/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs b/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs index f5b5982..479a80e 100644 --- a/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs +++ b/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs @@ -86,7 +86,7 @@ namespace OpenSim.Services.Connectors.Hypergrid paramList.Add(hash); XmlRpcRequest request = new XmlRpcRequest("link_region", paramList); - string uri = "http://" + ((info.ServerURI != null && info.ServerURI != string.Empty && !info.ServerURI.StartsWith("http:")) ? info.ServerURI : info.ExternalEndPoint.Address + ":" + info.HttpPort + "/" ); + string uri = "http://" + ((info.ServerURI != null && info.ServerURI != string.Empty && !info.ServerURI.StartsWith("http:")) ? info.ServerURI : info.ExternalEndPoint.Address + ":" + info.HttpPort + "/"); m_log.Debug("[GATEKEEPER SERVICE CONNECTOR]: Linking to " + uri); XmlRpcResponse response = null; try diff --git a/OpenSim/Services/Connectors/Inventory/XInventoryConnector.cs b/OpenSim/Services/Connectors/Inventory/XInventoryConnector.cs index e25e7eb..403ee15 100644 --- a/OpenSim/Services/Connectors/Inventory/XInventoryConnector.cs +++ b/OpenSim/Services/Connectors/Inventory/XInventoryConnector.cs @@ -526,7 +526,7 @@ namespace OpenSim.Services.Connectors InventoryFolderBase folder = new InventoryFolderBase(); try - { + { folder.ParentID = new UUID(data["ParentID"].ToString()); folder.Type = short.Parse(data["Type"].ToString()); folder.Version = ushort.Parse(data["Version"].ToString()); diff --git a/OpenSim/Services/InventoryService/InventoryService.cs b/OpenSim/Services/InventoryService/InventoryService.cs index 86bca79..e543337 100644 --- a/OpenSim/Services/InventoryService/InventoryService.cs +++ b/OpenSim/Services/InventoryService/InventoryService.cs @@ -276,11 +276,11 @@ namespace OpenSim.Services.InventoryService List folders = RequestSubFolders(root.ID); foreach (InventoryFolderBase folder in folders) - { + { if (folder.Type == (short)type) { // m_log.DebugFormat( -// "[INVENTORY SERVICE]: Found folder {0} type {1}", folder.Name, (AssetType)folder.Type); +// "[INVENTORY SERVICE]: Found folder {0} type {1}", folder.Name, (AssetType)folder.Type); return folder; } diff --git a/OpenSim/Services/LLLoginService/LLLoginService.cs b/OpenSim/Services/LLLoginService/LLLoginService.cs index 3f9bc19..d30c149 100644 --- a/OpenSim/Services/LLLoginService/LLLoginService.cs +++ b/OpenSim/Services/LLLoginService/LLLoginService.cs @@ -308,7 +308,7 @@ namespace OpenSim.Services.LLLoginService { // something went wrong, make something up, so that we don't have to test this anywhere else guinfo = new GridUserInfo(); - guinfo.LastPosition = guinfo.HomePosition = new Vector3(128, 128, 30); + guinfo.LastPosition = guinfo.HomePosition = new Vector3(128, 128, 30); } // diff --git a/OpenSim/Services/UserAccountService/UserAccountService.cs b/OpenSim/Services/UserAccountService/UserAccountService.cs index 65c247f..f376cf8 100644 --- a/OpenSim/Services/UserAccountService/UserAccountService.cs +++ b/OpenSim/Services/UserAccountService/UserAccountService.cs @@ -97,10 +97,10 @@ namespace OpenSim.Services.UserAccountService public UserAccount GetUserAccount(UUID scopeID, string firstName, string lastName) { -// m_log.DebugFormat( -// "[USER ACCOUNT SERVICE]: Retrieving account by username for {0} {1}, scope {2}", -// firstName, lastName, scopeID); - +// m_log.DebugFormat( +// "[USER ACCOUNT SERVICE]: Retrieving account by username for {0} {1}, scope {2}", +// firstName, lastName, scopeID); + UserAccountData[] d; if (scopeID != UUID.Zero) @@ -235,10 +235,10 @@ namespace OpenSim.Services.UserAccountService public bool StoreUserAccount(UserAccount data) { -// m_log.DebugFormat( -// "[USER ACCOUNT SERVICE]: Storing user account for {0} {1} {2}, scope {3}", -// data.FirstName, data.LastName, data.PrincipalID, data.ScopeID); - +// m_log.DebugFormat( +// "[USER ACCOUNT SERVICE]: Storing user account for {0} {1} {2}, scope {3}", +// data.FirstName, data.LastName, data.PrincipalID, data.ScopeID); + UserAccountData d = new UserAccountData(); d.FirstName = data.FirstName; @@ -285,7 +285,7 @@ namespace OpenSim.Services.UserAccountService #endregion #region Console commands - + /// /// Handle the create user command from the console. /// @@ -296,7 +296,7 @@ namespace OpenSim.Services.UserAccountService string lastName; string password; string email; - + List excluded = new List(new char[]{' '}); if (cmdparams.Length < 3) diff --git a/OpenSim/Tests/Common/Mock/MockRegionDataPlugin.cs b/OpenSim/Tests/Common/Mock/MockRegionDataPlugin.cs index 315d405..f453a4b 100644 --- a/OpenSim/Tests/Common/Mock/MockRegionDataPlugin.cs +++ b/OpenSim/Tests/Common/Mock/MockRegionDataPlugin.cs @@ -99,7 +99,7 @@ namespace OpenSim.Data.Null } public void RemoveObject(UUID obj, UUID regionUUID) - { + { // All parts belonging to the object with the uuid are removed. List parts = new List(m_sceneObjectParts.Values); foreach (SceneObjectPart part in parts) @@ -108,7 +108,7 @@ namespace OpenSim.Data.Null { m_log.DebugFormat( "[MOCK REGION DATA PLUGIN]: Removing part {0} {1} as part of object {2} from {3}", - part.Name, part.UUID, obj, regionUUID); + part.Name, part.UUID, obj, regionUUID); m_sceneObjectParts.Remove(part.UUID); } } @@ -129,7 +129,7 @@ namespace OpenSim.Data.Null if (prim.IsRoot) { m_log.DebugFormat( - "[MOCK REGION DATA PLUGIN]: Loading root part {0} {1} in {2}", prim.Name, prim.UUID, regionUUID); + "[MOCK REGION DATA PLUGIN]: Loading root part {0} {1} in {2}", prim.Name, prim.UUID, regionUUID); objects[prim.UUID] = new SceneObjectGroup(prim); } } diff --git a/OpenSim/Tests/Common/Mock/TestScene.cs b/OpenSim/Tests/Common/Mock/TestScene.cs index 615e519..13f364b 100644 --- a/OpenSim/Tests/Common/Mock/TestScene.cs +++ b/OpenSim/Tests/Common/Mock/TestScene.cs @@ -69,6 +69,6 @@ namespace OpenSim.Tests.Common.Mock public AsyncSceneObjectGroupDeleter SceneObjectGroupDeleter { get { return m_asyncSceneObjectDeleter; } - } + } } } \ No newline at end of file diff --git a/OpenSim/Tests/Common/Setup/AssetHelpers.cs b/OpenSim/Tests/Common/Setup/AssetHelpers.cs index f9a80b0..8647cfe 100644 --- a/OpenSim/Tests/Common/Setup/AssetHelpers.cs +++ b/OpenSim/Tests/Common/Setup/AssetHelpers.cs @@ -54,8 +54,8 @@ namespace OpenSim.Tests.Common { AssetBase asset = CreateAsset(UUID.Random(), AssetType.Notecard, "hello", creatorId); scene.AssetService.Store(asset); - return asset; - } + return asset; + } /// /// Create an asset from the given scene object. diff --git a/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs b/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs index 9318a27..889389b 100644 --- a/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs +++ b/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs @@ -58,7 +58,7 @@ namespace OpenSim.Tests.Common.Setup public class SceneSetupHelpers { // These static variables in order to allow regions to be linked by shared modules and same - // CommunicationsManager. + // CommunicationsManager. private static ISharedRegionModule m_assetService = null; // private static ISharedRegionModule m_authenticationService = null; private static ISharedRegionModule m_inventoryService = null; @@ -69,19 +69,19 @@ namespace OpenSim.Tests.Common.Setup /// /// Set up a test scene /// - /// + /// /// Automatically starts service threads, as would the normal runtime. - /// + /// /// public static TestScene SetupScene() { return SetupScene(""); } - + /// /// Set up a test scene /// - /// + /// /// Starts real inventory and asset services, as opposed to mock ones, if true /// public static TestScene SetupScene(String realServices) @@ -94,7 +94,7 @@ namespace OpenSim.Tests.Common.Setup ///// ///// Set up a test scene ///// - ///// + ///// ///// Starts real inventory and asset services, as opposed to mock ones, if true ///// This should be the same if simulating two scenes within a standalone ///// @@ -167,13 +167,13 @@ namespace OpenSim.Tests.Common.Setup capsModule.Initialise(new IniConfigSource()); testScene.AddRegionModule(capsModule.Name, capsModule); capsModule.AddRegion(testScene); - + IRegionModule godsModule = new GodsModule(); godsModule.Initialise(testScene, new IniConfigSource()); testScene.AddModule(godsModule.Name, godsModule); realServices = realServices.ToLower(); // IConfigSource config = new IniConfigSource(); - + // If we have a brand new scene, need to initialize shared region modules if ((m_assetService == null && m_inventoryService == null) || newScene) { @@ -184,13 +184,13 @@ namespace OpenSim.Tests.Common.Setup // For now, always started a 'real' authentication service StartAuthenticationService(testScene, true); - + if (realServices.Contains("inventory")) StartInventoryService(testScene, true); else StartInventoryService(testScene, false); - - StartGridService(testScene, true); + + StartGridService(testScene, true); StartUserAccountService(testScene); StartPresenceService(testScene); } @@ -207,7 +207,7 @@ namespace OpenSim.Tests.Common.Setup m_presenceService.RegionLoaded(testScene); } - + m_inventoryService.PostInitialise(); m_assetService.PostInitialise(); m_userAccountService.PostInitialise(); @@ -250,7 +250,7 @@ namespace OpenSim.Tests.Common.Setup else config.Configs["AssetService"].Set("LocalServiceModule", "OpenSim.Tests.Common.dll:MockAssetService"); config.Configs["AssetService"].Set("StorageProvider", "OpenSim.Tests.Common.dll"); - assetService.Initialise(config); + assetService.Initialise(config); assetService.AddRegion(testScene); assetService.RegionLoaded(testScene); testScene.AddRegionModule(assetService.Name, assetService); @@ -277,7 +277,7 @@ namespace OpenSim.Tests.Common.Setup testScene.AddRegionModule(service.Name, service); //m_authenticationService = service; } - + private static void StartInventoryService(Scene testScene, bool real) { ISharedRegionModule inventoryService = new LocalInventoryServicesConnector(); @@ -285,7 +285,7 @@ namespace OpenSim.Tests.Common.Setup config.AddConfig("Modules"); config.AddConfig("InventoryService"); config.Configs["Modules"].Set("InventoryServices", "LocalInventoryServicesConnector"); - + if (real) { config.Configs["InventoryService"].Set("LocalServiceModule", "OpenSim.Services.InventoryService.dll:InventoryService"); @@ -294,7 +294,7 @@ namespace OpenSim.Tests.Common.Setup { config.Configs["InventoryService"].Set("LocalServiceModule", "OpenSim.Tests.Common.dll:MockInventoryService"); } - + config.Configs["InventoryService"].Set("StorageProvider", "OpenSim.Tests.Common.dll"); inventoryService.Initialise(config); inventoryService.AddRegion(testScene); @@ -338,14 +338,14 @@ namespace OpenSim.Tests.Common.Setup config.Configs["UserAccountService"].Set("StorageProvider", "OpenSim.Data.Null.dll"); config.Configs["UserAccountService"].Set( "LocalServiceModule", "OpenSim.Services.UserAccountService.dll:UserAccountService"); - + if (m_userAccountService == null) { ISharedRegionModule userAccountService = new LocalUserAccountServicesConnector(); userAccountService.Initialise(config); m_userAccountService = userAccountService; } - + m_userAccountService.AddRegion(testScene); m_userAccountService.RegionLoaded(testScene); testScene.AddRegionModule(m_userAccountService.Name, m_userAccountService); @@ -559,5 +559,4 @@ namespace OpenSim.Tests.Common.Setup sogd.InventoryDeQueueAndDelete(); } } - } diff --git a/OpenSim/Tests/Common/Setup/UserInventoryTestUtils.cs b/OpenSim/Tests/Common/Setup/UserInventoryTestUtils.cs index 915af7e..135c50e 100644 --- a/OpenSim/Tests/Common/Setup/UserInventoryTestUtils.cs +++ b/OpenSim/Tests/Common/Setup/UserInventoryTestUtils.cs @@ -42,7 +42,7 @@ namespace OpenSim.Tests.Common public static InventoryItemBase CreateInventoryItem( Scene scene, string itemName, UUID itemId, string folderPath, UUID userId) - { + { InventoryItemBase item = new InventoryItemBase(); item.Name = itemName; item.AssetID = AssetHelpers.CreateAsset(scene, userId).FullID; @@ -52,7 +52,7 @@ namespace OpenSim.Tests.Common InventoryFolderBase objsFolder = scene.InventoryService.GetFolderForType(userId, AssetType.Object); item.Folder = objsFolder.ID; - scene.AddInventoryItem(item); + scene.AddInventoryItem(item); return item; } diff --git a/OpenSim/Tests/Common/Setup/UserProfileTestUtils.cs b/OpenSim/Tests/Common/Setup/UserProfileTestUtils.cs index 26156f3..d01521d 100644 --- a/OpenSim/Tests/Common/Setup/UserProfileTestUtils.cs +++ b/OpenSim/Tests/Common/Setup/UserProfileTestUtils.cs @@ -53,7 +53,7 @@ namespace OpenSim.Tests.Common.Setup // UUID userId = UUID.Parse("00000000-0000-0000-0000-000000000099"); // return CreateUserWithInventory(commsManager, userId, callback); // } -// +// // /// // /// Create a test user with a standard inventory // /// @@ -108,11 +108,11 @@ namespace OpenSim.Tests.Common.Setup // { // LocalUserServices lus = (LocalUserServices)commsManager.UserService; // lus.AddUser(firstName, lastName, password, "bill@bailey.com", 1000, 1000, userId); -// +// // CachedUserInfo userInfo = commsManager.UserProfileCacheService.GetUserDetails(userId); // userInfo.OnInventoryReceived += callback; // userInfo.FetchInventory(); -// +// // return userInfo; // } @@ -140,6 +140,6 @@ namespace OpenSim.Tests.Common.Setup scene.UserAccountService.StoreUserAccount(ua); scene.InventoryService.CreateUserInventory(ua.PrincipalID); scene.AuthenticationService.SetPassword(ua.PrincipalID, pw); - } + } } } \ No newline at end of file -- cgit v1.1 From 0db1ed0b5a6f5bd104c6008f142d173c84263ce5 Mon Sep 17 00:00:00 2001 From: John Hurliman Date: Sun, 12 Sep 2010 14:20:26 -0700 Subject: * Added ISimulationDataService and IEstateDataService * Removed StorageManager * CONFIG CHANGE: There are no more database settings in OpenSim.ini. Check the config-include configuration files for region store and estate store database settings --- .../RemoteController/RemoteAdminPlugin.cs | 12 +- OpenSim/Data/MSSQL/MSSQLEstateData.cs | 9 ++ OpenSim/Data/MSSQL/MSSQLSimulationData.cs | 10 ++ OpenSim/Data/MySQL/MySQLEstateData.cs | 9 ++ OpenSim/Data/MySQL/MySQLSimulationData.cs | 9 ++ OpenSim/Data/SQLite/SQLiteEstateData.cs | 9 ++ OpenSim/Data/SQLite/SQLiteSimulationData.cs | 9 ++ OpenSim/Data/SQLiteLegacy/SQLiteEstateData.cs | 9 ++ OpenSim/Data/SQLiteLegacy/SQLiteSimulationData.cs | 9 ++ OpenSim/Framework/ConfigSettings.cs | 16 --- OpenSim/Region/Application/ConfigurationLoader.cs | 4 - OpenSim/Region/Application/OpenSimBase.cs | 56 +++++---- .../Region/ClientStack/RegionApplicationBase.cs | 33 ++--- .../Framework/Interfaces/IEntityInventory.cs | 2 +- .../Framework/Interfaces/IEstateDataService.cs | 45 +++++++ OpenSim/Region/Framework/Scenes/EventManager.cs | 4 +- OpenSim/Region/Framework/Scenes/Scene.cs | 102 ++++++++++----- .../Region/Framework/Scenes/SceneObjectGroup.cs | 2 +- .../Framework/Scenes/SceneObjectPartInventory.cs | 2 +- .../Scenes/Tests/SceneObjectLinkingTests.cs | 4 +- OpenSim/Region/Framework/StorageManager.cs | 80 ------------ .../Connectors/Simulation/EstateDataService.cs | 112 +++++++++++++++++ .../Connectors/Simulation/SimulationDataService.cs | 140 +++++++++++++++++++++ .../Simulation/SimulationDataServiceConnector.cs | 125 ------------------ OpenSim/Tests/Common/Mock/TestScene.cs | 10 +- OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs | 5 +- bin/OpenSim.ini.example | 27 ---- bin/config-include/Grid.ini | 5 + bin/config-include/GridCommon.ini.example | 21 ++++ bin/config-include/GridHypergrid.ini | 6 + bin/config-include/HyperSimianGrid.ini | 6 + bin/config-include/SimianGrid.ini | 6 + bin/config-include/Standalone.ini | 6 + bin/config-include/StandaloneCommon.ini.example | 2 + prebuild.xml | 5 +- 35 files changed, 558 insertions(+), 353 deletions(-) create mode 100644 OpenSim/Region/Framework/Interfaces/IEstateDataService.cs delete mode 100644 OpenSim/Region/Framework/StorageManager.cs create mode 100644 OpenSim/Services/Connectors/Simulation/EstateDataService.cs create mode 100644 OpenSim/Services/Connectors/Simulation/SimulationDataService.cs delete mode 100644 OpenSim/Services/Connectors/Simulation/SimulationDataServiceConnector.cs diff --git a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs index 4b5710a..bb0a5b5 100644 --- a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs +++ b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs @@ -638,7 +638,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController // Set the estate // Check for an existing estate - List estateIDs = m_application.StorageManager.EstateDataStore.GetEstates((string) requestData["estate_name"]); + List estateIDs = m_application.EstateDataService.GetEstates((string) requestData["estate_name"]); if (estateIDs.Count < 1) { UUID userID = UUID.Zero; @@ -666,7 +666,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController } // Create a new estate with the name provided - region.EstateSettings = m_application.StorageManager.EstateDataStore.LoadEstateSettings(region.RegionID, true); + region.EstateSettings = m_application.EstateDataService.LoadEstateSettings(region.RegionID, true); region.EstateSettings.EstateName = (string) requestData["estate_name"]; region.EstateSettings.EstateOwner = userID; @@ -676,10 +676,10 @@ namespace OpenSim.ApplicationPlugins.RemoteController else { int estateID = estateIDs[0]; - - region.EstateSettings = m_application.StorageManager.EstateDataStore.LoadEstateSettings(estateID); - - if (!m_application.StorageManager.EstateDataStore.LinkRegion(region.RegionID, estateID)) + + region.EstateSettings = m_application.EstateDataService.LoadEstateSettings(estateID); + + if (!m_application.EstateDataService.LinkRegion(region.RegionID, estateID)) throw new Exception("Failed to join estate."); } diff --git a/OpenSim/Data/MSSQL/MSSQLEstateData.cs b/OpenSim/Data/MSSQL/MSSQLEstateData.cs index 80bf106..e9a0935 100644 --- a/OpenSim/Data/MSSQL/MSSQLEstateData.cs +++ b/OpenSim/Data/MSSQL/MSSQLEstateData.cs @@ -50,6 +50,15 @@ namespace OpenSim.Data.MSSQL #region Public methods + public MSSQLEstateStore() + { + } + + public MSSQLEstateStore(string connectionString) + { + Initialise(connectionString); + } + /// /// Initialises the estatedata class. /// diff --git a/OpenSim/Data/MSSQL/MSSQLSimulationData.cs b/OpenSim/Data/MSSQL/MSSQLSimulationData.cs index ae105d5..8532af4 100644 --- a/OpenSim/Data/MSSQL/MSSQLSimulationData.cs +++ b/OpenSim/Data/MSSQL/MSSQLSimulationData.cs @@ -55,6 +55,16 @@ namespace OpenSim.Data.MSSQL /// private MSSQLManager _Database; private string m_connectionString; + + public MSSQLSimulationData() + { + } + + public MSSQLSimulationData(string connectionString) + { + Initialise(connectionString); + } + /// /// Initialises the region datastore /// diff --git a/OpenSim/Data/MySQL/MySQLEstateData.cs b/OpenSim/Data/MySQL/MySQLEstateData.cs index 9158f7a..c42c687 100644 --- a/OpenSim/Data/MySQL/MySQLEstateData.cs +++ b/OpenSim/Data/MySQL/MySQLEstateData.cs @@ -54,6 +54,15 @@ namespace OpenSim.Data.MySQL private Dictionary m_FieldMap = new Dictionary(); + public MySQLEstateStore() + { + } + + public MySQLEstateStore(string connectionString) + { + Initialise(connectionString); + } + public void Initialise(string connectionString) { m_connectionString = connectionString; diff --git a/OpenSim/Data/MySQL/MySQLSimulationData.cs b/OpenSim/Data/MySQL/MySQLSimulationData.cs index 36f73ef..ac752f6 100644 --- a/OpenSim/Data/MySQL/MySQLSimulationData.cs +++ b/OpenSim/Data/MySQL/MySQLSimulationData.cs @@ -52,6 +52,15 @@ namespace OpenSim.Data.MySQL private string m_connectionString; private object m_dbLock = new object(); + public MySQLSimulationData() + { + } + + public MySQLSimulationData(string connectionString) + { + Initialise(connectionString); + } + public void Initialise(string connectionString) { m_connectionString = connectionString; diff --git a/OpenSim/Data/SQLite/SQLiteEstateData.cs b/OpenSim/Data/SQLite/SQLiteEstateData.cs index fcf041e..d1d67eb 100644 --- a/OpenSim/Data/SQLite/SQLiteEstateData.cs +++ b/OpenSim/Data/SQLite/SQLiteEstateData.cs @@ -49,6 +49,15 @@ namespace OpenSim.Data.SQLite private Dictionary m_FieldMap = new Dictionary(); + public SQLiteEstateStore() + { + } + + public SQLiteEstateStore(string connectionString) + { + Initialise(connectionString); + } + public void Initialise(string connectionString) { m_connectionString = connectionString; diff --git a/OpenSim/Data/SQLite/SQLiteSimulationData.cs b/OpenSim/Data/SQLite/SQLiteSimulationData.cs index 1820f78..7e62e84 100644 --- a/OpenSim/Data/SQLite/SQLiteSimulationData.cs +++ b/OpenSim/Data/SQLite/SQLiteSimulationData.cs @@ -70,6 +70,15 @@ namespace OpenSim.Data.SQLite private String m_connectionString; + public SQLiteSimulationData() + { + } + + public SQLiteSimulationData(string connectionString) + { + Initialise(connectionString); + } + // Temporary attribute while this is experimental /*********************************************************************** diff --git a/OpenSim/Data/SQLiteLegacy/SQLiteEstateData.cs b/OpenSim/Data/SQLiteLegacy/SQLiteEstateData.cs index bf8ee14..547ea6b 100644 --- a/OpenSim/Data/SQLiteLegacy/SQLiteEstateData.cs +++ b/OpenSim/Data/SQLiteLegacy/SQLiteEstateData.cs @@ -49,6 +49,15 @@ namespace OpenSim.Data.SQLiteLegacy private Dictionary m_FieldMap = new Dictionary(); + public SQLiteEstateStore() + { + } + + public SQLiteEstateStore(string connectionString) + { + Initialise(connectionString); + } + public void Initialise(string connectionString) { m_connectionString = connectionString; diff --git a/OpenSim/Data/SQLiteLegacy/SQLiteSimulationData.cs b/OpenSim/Data/SQLiteLegacy/SQLiteSimulationData.cs index e9c6aa5..2dde926 100644 --- a/OpenSim/Data/SQLiteLegacy/SQLiteSimulationData.cs +++ b/OpenSim/Data/SQLiteLegacy/SQLiteSimulationData.cs @@ -69,6 +69,15 @@ namespace OpenSim.Data.SQLiteLegacy private String m_connectionString; + public SQLiteSimulationData() + { + } + + public SQLiteSimulationData(string connectionString) + { + Initialise(connectionString); + } + // Temporary attribute while this is experimental /*********************************************************************** diff --git a/OpenSim/Framework/ConfigSettings.cs b/OpenSim/Framework/ConfigSettings.cs index 8feaa37..be77341 100644 --- a/OpenSim/Framework/ConfigSettings.cs +++ b/OpenSim/Framework/ConfigSettings.cs @@ -124,22 +124,6 @@ namespace OpenSim.Framework set { m_standaloneUserSource = value; } } - protected string m_storageConnectionString; - - public string StorageConnectionString - { - get { return m_storageConnectionString; } - set { m_storageConnectionString = value; } - } - - protected string m_estateConnectionString; - - public string EstateConnectionString - { - get { return m_estateConnectionString; } - set { m_estateConnectionString = value; } - } - protected string m_librariesXMLFile; public string LibrariesXMLFile { diff --git a/OpenSim/Region/Application/ConfigurationLoader.cs b/OpenSim/Region/Application/ConfigurationLoader.cs index e69e3fc..e2e0640 100644 --- a/OpenSim/Region/Application/ConfigurationLoader.cs +++ b/OpenSim/Region/Application/ConfigurationLoader.cs @@ -345,10 +345,6 @@ namespace OpenSim m_configSettings.StorageDll = startupConfig.GetString("storage_plugin"); - m_configSettings.StorageConnectionString - = startupConfig.GetString("storage_connection_string"); - m_configSettings.EstateConnectionString - = startupConfig.GetString("estate_connection_string", m_configSettings.StorageConnectionString); m_configSettings.ClientstackDll = startupConfig.GetString("clientstack_plugin", "OpenSim.Region.ClientStack.LindenUDP.dll"); } diff --git a/OpenSim/Region/Application/OpenSimBase.cs b/OpenSim/Region/Application/OpenSimBase.cs index d2d2607..74ad168 100644 --- a/OpenSim/Region/Application/OpenSimBase.cs +++ b/OpenSim/Region/Application/OpenSimBase.cs @@ -45,6 +45,7 @@ using OpenSim.Region.Framework; using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; using OpenSim.Region.Physics.Manager; +using OpenSim.Server.Base; namespace OpenSim { @@ -186,6 +187,24 @@ namespace OpenSim userStatsURI = startupConfig.GetString("Stats_URI", String.Empty); } + // Load the simulation data service + IConfig simDataConfig = m_config.Source.Configs["SimulationDataStore"]; + if (simDataConfig == null) + throw new Exception("Configuration file is missing the [SimulationDataStore] section"); + string module = simDataConfig.GetString("LocalServiceModule", String.Empty); + if (String.IsNullOrEmpty(module)) + throw new Exception("Configuration file is missing the LocalServiceModule parameter in the [SimulationDataStore] section"); + m_simulationDataService = ServerUtils.LoadPlugin(module, new object[] { m_config.Source }); + + // Load the estate data service + IConfig estateDataConfig = m_config.Source.Configs["EstateDataStore"]; + if (estateDataConfig == null) + throw new Exception("Configuration file is missing the [EstateDataStore] section"); + module = estateDataConfig.GetString("LocalServiceModule", String.Empty); + if (String.IsNullOrEmpty(module)) + throw new Exception("Configuration file is missing the LocalServiceModule parameter in the [EstateDataStore] section"); + m_estateDataService = ServerUtils.LoadPlugin(module, new object[] { m_config.Source }); + base.StartupSpecific(); m_stats = StatsManager.StartCollectingSimExtraStats(); @@ -536,7 +555,7 @@ namespace OpenSim regionInfo.InternalEndPoint.Port = (int) port; - Scene scene = CreateScene(regionInfo, m_storageManager, circuitManager); + Scene scene = CreateScene(regionInfo, m_simulationDataService, m_estateDataService, circuitManager); if (m_autoCreateClientStack) { @@ -552,30 +571,19 @@ namespace OpenSim return scene; } - protected override StorageManager CreateStorageManager() - { - return - CreateStorageManager(m_configSettings.StorageConnectionString, m_configSettings.EstateConnectionString); - } - - protected StorageManager CreateStorageManager(string connectionstring, string estateconnectionstring) - { - return new StorageManager(m_configSettings.StorageDll, connectionstring, estateconnectionstring); - } - protected override ClientStackManager CreateClientStackManager() { return new ClientStackManager(m_configSettings.ClientstackDll); } - protected override Scene CreateScene(RegionInfo regionInfo, StorageManager storageManager, - AgentCircuitManager circuitManager) + protected override Scene CreateScene(RegionInfo regionInfo, ISimulationDataService simDataService, + IEstateDataService estateDataService, AgentCircuitManager circuitManager) { SceneCommunicationService sceneGridService = new SceneCommunicationService(); return new Scene( regionInfo, circuitManager, sceneGridService, - storageManager, m_moduleLoader, false, m_configSettings.PhysicalPrim, + simDataService, estateDataService, m_moduleLoader, false, m_configSettings.PhysicalPrim, m_configSettings.See_into_region_from_neighbor, m_config.Source, m_version); } @@ -792,21 +800,23 @@ namespace OpenSim /// public void PopulateRegionEstateInfo(RegionInfo regInfo) { - if (m_storageManager.EstateDataStore != null) + IEstateDataService estateDataService = EstateDataService; + + if (estateDataService != null) { - regInfo.EstateSettings = m_storageManager.EstateDataStore.LoadEstateSettings(regInfo.RegionID, false); + regInfo.EstateSettings = estateDataService.LoadEstateSettings(regInfo.RegionID, false); } - + if (regInfo.EstateSettings.EstateID == 0) // No record at all { MainConsole.Instance.Output("Your region is not part of an estate."); while (true) { - string response = MainConsole.Instance.CmdPrompt("Do you wish to join an existing estate?", "no", new List() {"yes", "no"}); + string response = MainConsole.Instance.CmdPrompt("Do you wish to join an existing estate?", "no", new List() { "yes", "no" }); if (response == "no") { // Create a new estate - regInfo.EstateSettings = m_storageManager.EstateDataStore.LoadEstateSettings(regInfo.RegionID, true); + regInfo.EstateSettings = estateDataService.LoadEstateSettings(regInfo.RegionID, true); regInfo.EstateSettings.EstateName = MainConsole.Instance.CmdPrompt("New estate name", regInfo.EstateSettings.EstateName); //regInfo.EstateSettings.Save(); @@ -818,7 +828,7 @@ namespace OpenSim if (response == "None") continue; - List estateIDs = m_storageManager.EstateDataStore.GetEstates(response); + List estateIDs = estateDataService.GetEstates(response); if (estateIDs.Count < 1) { MainConsole.Instance.Output("The name you have entered matches no known estate. Please try again"); @@ -827,9 +837,9 @@ namespace OpenSim int estateID = estateIDs[0]; - regInfo.EstateSettings = m_storageManager.EstateDataStore.LoadEstateSettings(estateID); + regInfo.EstateSettings = estateDataService.LoadEstateSettings(estateID); - if (m_storageManager.EstateDataStore.LinkRegion(regInfo.RegionID, estateID)) + if (estateDataService.LinkRegion(regInfo.RegionID, estateID)) break; MainConsole.Instance.Output("Joining the estate failed. Please try again."); diff --git a/OpenSim/Region/ClientStack/RegionApplicationBase.cs b/OpenSim/Region/ClientStack/RegionApplicationBase.cs index 46b68ec..ea1317a 100644 --- a/OpenSim/Region/ClientStack/RegionApplicationBase.cs +++ b/OpenSim/Region/ClientStack/RegionApplicationBase.cs @@ -36,6 +36,7 @@ using OpenSim.Framework.Communications; using OpenSim.Framework.Servers; using OpenSim.Framework.Servers.HttpServer; using OpenSim.Region.Framework; +using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; using OpenSim.Region.Physics.Manager; @@ -48,28 +49,16 @@ namespace OpenSim.Region.ClientStack protected Dictionary m_clientCircuits = new Dictionary(); protected NetworkServersInfo m_networkServersInfo; - - public NetworkServersInfo NetServersInfo - { - get { return m_networkServersInfo; } - } - protected uint m_httpServerPort; - - protected StorageManager m_storageManager; - - public StorageManager StorageManager - { - get { return m_storageManager; } - } - + protected ISimulationDataService m_simulationDataService; + protected IEstateDataService m_estateDataService; protected ClientStackManager m_clientStackManager; - - public SceneManager SceneManager - { - get { return m_sceneManager; } - } protected SceneManager m_sceneManager = new SceneManager(); + + public SceneManager SceneManager { get { return m_sceneManager; } } + public NetworkServersInfo NetServersInfo { get { return m_networkServersInfo; } } + public ISimulationDataService SimulationDataService { get { return m_simulationDataService; } } + public IEstateDataService EstateDataService { get { return m_estateDataService; } } protected abstract void Initialize(); @@ -83,15 +72,11 @@ namespace OpenSim.Region.ClientStack /// protected abstract PhysicsScene GetPhysicsScene(string osSceneIdentifier); - protected abstract StorageManager CreateStorageManager(); protected abstract ClientStackManager CreateClientStackManager(); - protected abstract Scene CreateScene(RegionInfo regionInfo, StorageManager storageManager, - AgentCircuitManager circuitManager); + protected abstract Scene CreateScene(RegionInfo regionInfo, ISimulationDataService simDataService, IEstateDataService estateDataService, AgentCircuitManager circuitManager); protected override void StartupSpecific() { - m_storageManager = CreateStorageManager(); - m_clientStackManager = CreateClientStackManager(); Initialize(); diff --git a/OpenSim/Region/Framework/Interfaces/IEntityInventory.cs b/OpenSim/Region/Framework/Interfaces/IEntityInventory.cs index 54845fd..7edb43e 100644 --- a/OpenSim/Region/Framework/Interfaces/IEntityInventory.cs +++ b/OpenSim/Region/Framework/Interfaces/IEntityInventory.cs @@ -200,7 +200,7 @@ namespace OpenSim.Region.Framework.Interfaces /// Backup the inventory to the given data store /// /// - void ProcessInventoryBackup(ISimulationDataStore datastore); + void ProcessInventoryBackup(ISimulationDataService datastore); uint MaskEffectivePermissions(); diff --git a/OpenSim/Region/Framework/Interfaces/IEstateDataService.cs b/OpenSim/Region/Framework/Interfaces/IEstateDataService.cs new file mode 100644 index 0000000..95c9659 --- /dev/null +++ b/OpenSim/Region/Framework/Interfaces/IEstateDataService.cs @@ -0,0 +1,45 @@ +/* + * Copyright (c) Contributors, http://opensimulator.org/ + * See CONTRIBUTORS.TXT for a full list of copyright holders. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the OpenSimulator Project nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +using System; +using System.Collections.Generic; +using OpenSim.Framework; +using OpenMetaverse; + +namespace OpenSim.Region.Framework.Interfaces +{ + public interface IEstateDataService + { + EstateSettings LoadEstateSettings(UUID regionID, bool create); + EstateSettings LoadEstateSettings(int estateID); + void StoreEstateSettings(EstateSettings es); + List GetEstates(string search); + bool LinkRegion(UUID regionID, int estateID); + List GetRegions(int estateID); + bool DeleteEstate(int estateID); + } +} diff --git a/OpenSim/Region/Framework/Scenes/EventManager.cs b/OpenSim/Region/Framework/Scenes/EventManager.cs index 6b2e03e..72b8de8 100644 --- a/OpenSim/Region/Framework/Scenes/EventManager.cs +++ b/OpenSim/Region/Framework/Scenes/EventManager.cs @@ -57,7 +57,7 @@ namespace OpenSim.Region.Framework.Scenes public event OnTerrainTickDelegate OnTerrainTick; - public delegate void OnBackupDelegate(ISimulationDataStore datastore, bool forceBackup); + public delegate void OnBackupDelegate(ISimulationDataService datastore, bool forceBackup); public event OnBackupDelegate OnBackup; @@ -684,7 +684,7 @@ namespace OpenSim.Region.Framework.Scenes } } - public void TriggerOnBackup(ISimulationDataStore dstore, bool forced) + public void TriggerOnBackup(ISimulationDataService dstore, bool forced) { OnBackupDelegate handlerOnAttach = OnBackup; if (handlerOnAttach != null) diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 46b84bb..9a9ef5f 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -100,10 +100,11 @@ namespace OpenSim.Region.Framework.Scenes protected List m_neighbours = new List(); protected string m_simulatorVersion = "OpenSimulator Server"; protected ModuleLoader m_moduleLoader; - protected StorageManager m_storageManager; protected AgentCircuitManager m_authenticateHandler; protected SceneCommunicationService m_sceneGridService; + protected ISimulationDataService m_SimulationDataService; + protected IEstateDataService m_EstateDataService; protected IAssetService m_AssetService; protected IAuthorizationService m_AuthorizationService; protected IInventoryService m_InventoryService; @@ -216,6 +217,42 @@ namespace OpenSim.Region.Framework.Scenes get { return m_sceneGridService; } } + public ISimulationDataService SimulationDataService + { + get + { + if (m_SimulationDataService == null) + { + m_SimulationDataService = RequestModuleInterface(); + + if (m_SimulationDataService == null) + { + throw new Exception("No ISimulationDataService available."); + } + } + + return m_SimulationDataService; + } + } + + public IEstateDataService EstateDataService + { + get + { + if (m_EstateDataService == null) + { + m_EstateDataService = RequestModuleInterface(); + + if (m_EstateDataService == null) + { + throw new Exception("No IEstateDataService available."); + } + } + + return m_EstateDataService; + } + } + public IAssetService AssetService { get @@ -468,7 +505,7 @@ namespace OpenSim.Region.Framework.Scenes public Scene(RegionInfo regInfo, AgentCircuitManager authen, SceneCommunicationService sceneGridService, - StorageManager storeManager, + ISimulationDataService simDataService, IEstateDataService estateDataService, ModuleLoader moduleLoader, bool dumpAssetsToFile, bool physicalPrim, bool SeeIntoRegionFromNeighbor, IConfigSource config, string simulatorVersion) { @@ -504,7 +541,8 @@ namespace OpenSim.Region.Framework.Scenes m_moduleLoader = moduleLoader; m_authenticateHandler = authen; m_sceneGridService = sceneGridService; - m_storageManager = storeManager; + m_SimulationDataService = simDataService; + m_EstateDataService = estateDataService; m_regInfo = regInfo; m_regionHandle = m_regInfo.RegionHandle; m_regionName = m_regInfo.RegionName; @@ -523,11 +561,9 @@ namespace OpenSim.Region.Framework.Scenes #region Region Settings // Load region settings - m_regInfo.RegionSettings = m_storageManager.DataStore.LoadRegionSettings(m_regInfo.RegionID); - if (m_storageManager.EstateDataStore != null) - { - m_regInfo.EstateSettings = m_storageManager.EstateDataStore.LoadEstateSettings(m_regInfo.RegionID, false); - } + m_regInfo.RegionSettings = simDataService.LoadRegionSettings(m_regInfo.RegionID); + if (estateDataService != null) + m_regInfo.EstateSettings = estateDataService.LoadEstateSettings(m_regInfo.RegionID, false); #endregion Region Settings @@ -537,9 +573,9 @@ namespace OpenSim.Region.Framework.Scenes //Bind Storage Manager functions to some land manager functions for this scene EventManager.OnLandObjectAdded += - new EventManager.LandObjectAdded(m_storageManager.DataStore.StoreLandObject); + new EventManager.LandObjectAdded(simDataService.StoreLandObject); EventManager.OnLandObjectRemoved += - new EventManager.LandObjectRemoved(m_storageManager.DataStore.RemoveLandObject); + new EventManager.LandObjectRemoved(simDataService.RemoveLandObject); m_sceneGraph = new SceneGraph(this, m_regInfo); @@ -1085,7 +1121,7 @@ namespace OpenSim.Region.Framework.Scenes { if (!entity.IsDeleted && entity is SceneObjectGroup && ((SceneObjectGroup)entity).HasGroupChanged) { - ((SceneObjectGroup)entity).ProcessBackup(m_storageManager.DataStore, false); + ((SceneObjectGroup)entity).ProcessBackup(SimulationDataService, false); } } @@ -1526,7 +1562,7 @@ namespace OpenSim.Region.Framework.Scenes { lock (m_returns) { - EventManager.TriggerOnBackup(m_storageManager.DataStore, forced); + EventManager.TriggerOnBackup(SimulationDataService, forced); m_backingup = false; foreach (KeyValuePair ret in m_returns) @@ -1567,7 +1603,7 @@ namespace OpenSim.Region.Framework.Scenes { if (group != null) { - group.ProcessBackup(m_storageManager.DataStore, true); + group.ProcessBackup(SimulationDataService, true); } } @@ -1609,19 +1645,19 @@ namespace OpenSim.Region.Framework.Scenes /// public void SaveTerrain() { - m_storageManager.DataStore.StoreTerrain(Heightmap.GetDoubles(), RegionInfo.RegionID); + SimulationDataService.StoreTerrain(Heightmap.GetDoubles(), RegionInfo.RegionID); } public void StoreWindlightProfile(RegionLightShareData wl) { m_regInfo.WindlightSettings = wl; - m_storageManager.DataStore.StoreRegionWindlightSettings(wl); + SimulationDataService.StoreRegionWindlightSettings(wl); m_eventManager.TriggerOnSaveNewWindlightProfile(); } public void LoadWindlightProfile() { - m_regInfo.WindlightSettings = m_storageManager.DataStore.LoadRegionWindlightSettings(RegionInfo.RegionID); + m_regInfo.WindlightSettings = SimulationDataService.LoadRegionWindlightSettings(RegionInfo.RegionID); m_eventManager.TriggerOnSaveNewWindlightProfile(); } @@ -1632,13 +1668,13 @@ namespace OpenSim.Region.Framework.Scenes { try { - double[,] map = m_storageManager.DataStore.LoadTerrain(RegionInfo.RegionID); + double[,] map = SimulationDataService.LoadTerrain(RegionInfo.RegionID); if (map == null) { m_log.Info("[TERRAIN]: No default terrain. Generating a new terrain."); Heightmap = new TerrainChannel(); - m_storageManager.DataStore.StoreTerrain(Heightmap.GetDoubles(), RegionInfo.RegionID); + SimulationDataService.StoreTerrain(Heightmap.GetDoubles(), RegionInfo.RegionID); } else { @@ -1655,7 +1691,7 @@ namespace OpenSim.Region.Framework.Scenes { Heightmap = new TerrainChannel(); - m_storageManager.DataStore.StoreTerrain(Heightmap.GetDoubles(), RegionInfo.RegionID); + SimulationDataService.StoreTerrain(Heightmap.GetDoubles(), RegionInfo.RegionID); } } catch (Exception e) @@ -1702,7 +1738,7 @@ namespace OpenSim.Region.Framework.Scenes public void loadAllLandObjectsFromStorage(UUID regionID) { m_log.Info("[SCENE]: Loading land objects from storage"); - List landData = m_storageManager.DataStore.LoadLandObjects(regionID); + List landData = SimulationDataService.LoadLandObjects(regionID); if (LandChannel != null) { @@ -1733,7 +1769,7 @@ namespace OpenSim.Region.Framework.Scenes LoadingPrims = true; m_log.Info("[SCENE]: Loading objects from datastore"); - List PrimsFromDB = m_storageManager.DataStore.LoadObjects(regionID); + List PrimsFromDB = SimulationDataService.LoadObjects(regionID); m_log.Info("[SCENE]: Loaded " + PrimsFromDB.Count + " objects from the datastore"); @@ -2102,12 +2138,12 @@ namespace OpenSim.Region.Framework.Scenes // group has recently been delinked from another group but that this change has not been persisted // to the DB. ForceSceneObjectBackup(so); - so.DetachFromBackup(); - m_storageManager.DataStore.RemoveObject(so.UUID, m_regInfo.RegionID); + so.DetachFromBackup(); + SimulationDataService.RemoveObject(so.UUID, m_regInfo.RegionID); } // We need to keep track of this state in case this group is still queued for further backup. - so.IsDeleted = true; + so.IsDeleted = true; return true; } @@ -4408,7 +4444,7 @@ namespace OpenSim.Region.Framework.Scenes public void DeleteFromStorage(UUID uuid) { - m_storageManager.DataStore.RemoveObject(uuid, m_regInfo.RegionID); + SimulationDataService.RemoveObject(uuid, m_regInfo.RegionID); } public int GetHealth() @@ -4817,17 +4853,21 @@ namespace OpenSim.Region.Framework.Scenes public List GetEstateRegions(int estateID) { - if (m_storageManager.EstateDataStore == null) - return new List(); + IEstateDataService estateDataService = EstateDataService; + if (estateDataService == null) + return new List(0); - return m_storageManager.EstateDataStore.GetRegions(estateID); + return estateDataService.GetRegions(estateID); } public void ReloadEstateData() { - m_regInfo.EstateSettings = m_storageManager.EstateDataStore.LoadEstateSettings(m_regInfo.RegionID, false); - - TriggerEstateSunUpdate(); + IEstateDataService estateDataService = EstateDataService; + if (estateDataService != null) + { + m_regInfo.EstateSettings = estateDataService.LoadEstateSettings(m_regInfo.RegionID, false); + TriggerEstateSunUpdate(); + } } public void TriggerEstateSunUpdate() diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 4024328..454f031 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -1378,7 +1378,7 @@ namespace OpenSim.Region.Framework.Scenes /// Processes backup. /// /// - public virtual void ProcessBackup(ISimulationDataStore datastore, bool forcedBackup) + public virtual void ProcessBackup(ISimulationDataService datastore, bool forcedBackup) { if (!m_isBackedUp) { diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs index 1984d45..e45d488 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs @@ -848,7 +848,7 @@ namespace OpenSim.Region.Framework.Scenes /// Process inventory backup /// /// - public void ProcessInventoryBackup(ISimulationDataStore datastore) + public void ProcessInventoryBackup(ISimulationDataService datastore) { if (HasInventoryChanged) { diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs index e3ef263..d634840 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs @@ -292,7 +292,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests // scene backup thread. scene.Backup(true); - List storedObjects = scene.StorageManager.DataStore.LoadObjects(scene.RegionInfo.RegionID); + List storedObjects = scene.SimulationDataService.LoadObjects(scene.RegionInfo.RegionID); Assert.That(storedObjects.Count, Is.EqualTo(1)); Assert.That(storedObjects[0].Children.Count, Is.EqualTo(2)); @@ -335,7 +335,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests SceneObjectGroup groupToDelete = sog.DelinkFromGroup(linkPart, false); scene.DeleteSceneObject(groupToDelete, false); - List storedObjects = scene.StorageManager.DataStore.LoadObjects(scene.RegionInfo.RegionID); + List storedObjects = scene.SimulationDataService.LoadObjects(scene.RegionInfo.RegionID); Assert.That(storedObjects.Count, Is.EqualTo(1)); Assert.That(storedObjects[0].Children.Count, Is.EqualTo(1)); diff --git a/OpenSim/Region/Framework/StorageManager.cs b/OpenSim/Region/Framework/StorageManager.cs deleted file mode 100644 index c858d56..0000000 --- a/OpenSim/Region/Framework/StorageManager.cs +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Copyright (c) Contributors, http://opensimulator.org/ - * See CONTRIBUTORS.TXT for a full list of copyright holders. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of the OpenSimulator Project nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -using System; -using System.Reflection; -using log4net; -using OpenSim.Region.Framework.Interfaces; - -namespace OpenSim.Region.Framework -{ - public class StorageManager - { - private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - - public readonly ISimulationDataStore DataStore; - public readonly IEstateDataStore EstateDataStore; - - public StorageManager(string dllName, string connectionstring, string estateconnectionstring) - { - m_log.Info("[DATASTORE]: Attempting to load " + dllName); - Assembly pluginAssembly = Assembly.LoadFrom(dllName); - - foreach (Type pluginType in pluginAssembly.GetTypes()) - { - if (pluginType.IsPublic) - { - Type typeInterface = pluginType.GetInterface("ISimulationDataStore", true); - - if (typeInterface != null) - { - ISimulationDataStore plug = - (ISimulationDataStore)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); - plug.Initialise(connectionstring); - - DataStore = plug; - - m_log.Info("[DATASTORE]: Added ISimulationDataStore Interface"); - } - - typeInterface = pluginType.GetInterface("IEstateDataStore", true); - - if (typeInterface != null) - { - IEstateDataStore estPlug = - (IEstateDataStore) Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); - estPlug.Initialise(estateconnectionstring); - - EstateDataStore = estPlug; - } - } - } - - //TODO: Add checking and warning to make sure it initialised. - } - } -} diff --git a/OpenSim/Services/Connectors/Simulation/EstateDataService.cs b/OpenSim/Services/Connectors/Simulation/EstateDataService.cs new file mode 100644 index 0000000..87c49d3 --- /dev/null +++ b/OpenSim/Services/Connectors/Simulation/EstateDataService.cs @@ -0,0 +1,112 @@ +/* + * Copyright (c) Contributors, http://opensimulator.org/ + * See CONTRIBUTORS.TXT for a full list of copyright holders. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the OpenSimulator Project nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +using System; +using System.Collections.Generic; +using OpenMetaverse; +using log4net; +using Mono.Addins; +using Nini.Config; +using System.Reflection; +using OpenSim.Services.Base; +using OpenSim.Services.Interfaces; +using OpenSim.Data; +using OpenSim.Framework; +using OpenSim.Region.Framework.Interfaces; +using OpenSim.Region.Framework.Scenes; + +namespace OpenSim.Services.Connectors +{ + public class EstateDataService : ServiceBase, IEstateDataService + { + private static readonly ILog m_log = + LogManager.GetLogger( + MethodBase.GetCurrentMethod().DeclaringType); + + protected IEstateDataStore m_database; + + public EstateDataService(IConfigSource config) + : base(config) + { + string dllName = String.Empty; + string connString = String.Empty; + + // Try reading the [DatabaseService] section, if it exists + IConfig dbConfig = config.Configs["DatabaseService"]; + if (dbConfig != null) + { + dllName = dbConfig.GetString("StorageProvider", String.Empty); + connString = dbConfig.GetString("EstateConnectionString", String.Empty); + if (String.IsNullOrEmpty(connString)) + connString = dbConfig.GetString("ConnectionString", String.Empty); + } + + // We tried, but this doesn't exist. We can't proceed + if (dllName == String.Empty) + throw new Exception("No StorageProvider configured"); + + m_database = LoadPlugin(dllName, new Object[] { connString }); + if (m_database == null) + throw new Exception("Could not find a storage interface in the given module"); + } + + public EstateSettings LoadEstateSettings(UUID regionID, bool create) + { + return m_database.LoadEstateSettings(regionID, create); + } + + public EstateSettings LoadEstateSettings(int estateID) + { + return m_database.LoadEstateSettings(estateID); + } + + public void StoreEstateSettings(EstateSettings es) + { + m_database.StoreEstateSettings(es); + } + + public List GetEstates(string search) + { + return m_database.GetEstates(search); + } + + public bool LinkRegion(UUID regionID, int estateID) + { + return m_database.LinkRegion(regionID, estateID); + } + + public List GetRegions(int estateID) + { + return m_database.GetRegions(estateID); + } + + public bool DeleteEstate(int estateID) + { + return m_database.DeleteEstate(estateID); + } + } +} diff --git a/OpenSim/Services/Connectors/Simulation/SimulationDataService.cs b/OpenSim/Services/Connectors/Simulation/SimulationDataService.cs new file mode 100644 index 0000000..946f7e4 --- /dev/null +++ b/OpenSim/Services/Connectors/Simulation/SimulationDataService.cs @@ -0,0 +1,140 @@ +/* + * Copyright (c) Contributors, http://opensimulator.org/ + * See CONTRIBUTORS.TXT for a full list of copyright holders. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the OpenSimulator Project nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +using System; +using System.Collections.Generic; +using OpenMetaverse; +using log4net; +using Mono.Addins; +using Nini.Config; +using System.Reflection; +using OpenSim.Services.Base; +using OpenSim.Services.Interfaces; +using OpenSim.Data; +using OpenSim.Framework; +using OpenSim.Region.Framework.Interfaces; +using OpenSim.Region.Framework.Scenes; + +namespace OpenSim.Services.Connectors +{ + public class SimulationDataService : ServiceBase, ISimulationDataService + { + private static readonly ILog m_log = + LogManager.GetLogger( + MethodBase.GetCurrentMethod().DeclaringType); + + protected ISimulationDataStore m_database; + + public SimulationDataService(IConfigSource config) + : base(config) + { + string dllName = String.Empty; + string connString = String.Empty; + + // Try reading the [DatabaseService] section, if it exists + IConfig dbConfig = config.Configs["DatabaseService"]; + if (dbConfig != null) + { + dllName = dbConfig.GetString("StorageProvider", String.Empty); + connString = dbConfig.GetString("ConnectionString", String.Empty); + } + + // We tried, but this doesn't exist. We can't proceed + if (dllName == String.Empty) + throw new Exception("No StorageProvider configured"); + + m_database = LoadPlugin(dllName, new Object[] { connString }); + if (m_database == null) + throw new Exception("Could not find a storage interface in the given module"); + } + + public void StoreObject(SceneObjectGroup obj, UUID regionUUID) + { + m_database.StoreObject(obj, regionUUID); + } + + public void RemoveObject(UUID uuid, UUID regionUUID) + { + m_database.RemoveObject(uuid, regionUUID); + } + + public void StorePrimInventory(UUID primID, ICollection items) + { + m_database.StorePrimInventory(primID, items); + } + + public List LoadObjects(UUID regionUUID) + { + return m_database.LoadObjects(regionUUID); + } + + public void StoreTerrain(double[,] terrain, UUID regionID) + { + m_database.StoreTerrain(terrain, regionID); + } + + public double[,] LoadTerrain(UUID regionID) + { + return m_database.LoadTerrain(regionID); + } + + public void StoreLandObject(ILandObject Parcel) + { + m_database.StoreLandObject(Parcel); + } + + public void RemoveLandObject(UUID globalID) + { + m_database.RemoveLandObject(globalID); + } + + public List LoadLandObjects(UUID regionUUID) + { + return m_database.LoadLandObjects(regionUUID); + } + + public void StoreRegionSettings(RegionSettings rs) + { + m_database.StoreRegionSettings(rs); + } + + public RegionSettings LoadRegionSettings(UUID regionUUID) + { + return m_database.LoadRegionSettings(regionUUID); + } + + public RegionLightShareData LoadRegionWindlightSettings(UUID regionUUID) + { + return m_database.LoadRegionWindlightSettings(regionUUID); + } + + public void StoreRegionWindlightSettings(RegionLightShareData wl) + { + m_database.StoreRegionWindlightSettings(wl); + } + } +} diff --git a/OpenSim/Services/Connectors/Simulation/SimulationDataServiceConnector.cs b/OpenSim/Services/Connectors/Simulation/SimulationDataServiceConnector.cs deleted file mode 100644 index 93147d4..0000000 --- a/OpenSim/Services/Connectors/Simulation/SimulationDataServiceConnector.cs +++ /dev/null @@ -1,125 +0,0 @@ -/* - * Copyright (c) Contributors, http://opensimulator.org/ - * See CONTRIBUTORS.TXT for a full list of copyright holders. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of the OpenSimulator Project nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -using System; -using System.Collections.Generic; -using System.Reflection; -using log4net; -using Nini.Config; -using OpenMetaverse; -using OpenSim.Framework; -using OpenSim.Region.Framework.Interfaces; -using OpenSim.Region.Framework.Scenes; -using OpenSim.Server.Base; - -namespace OpenSim.Services.Connectors.Simulation -{ - public class SimulationDataServiceConnector : ISimulationDataService - { - private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - - private ISimulationDataStore m_simDataStore; - - public SimulationDataServiceConnector() - { - } - - public SimulationDataServiceConnector(IConfigSource config) - { - Initialise(config); - } - - public virtual void Initialise(IConfigSource config) - { - IConfig serverConfig = config.Configs["SimulationDataStore"]; - if (serverConfig == null) - throw new Exception("No section 'SimulationDataStore' in config file"); - - string simDataStore = serverConfig.GetString("StoreModule", String.Empty); - - Object[] args = new Object[] { config }; - m_simDataStore = ServerUtils.LoadPlugin(simDataStore, args); - } - - public void StoreObject(SceneObjectGroup obj, UUID regionUUID) - { - } - - public void RemoveObject(UUID uuid, UUID regionUUID) - { - } - - public void StorePrimInventory(UUID primID, ICollection items) - { - } - - public List LoadObjects(UUID regionUUID) - { - return new List(0); - } - - public void StoreTerrain(double[,] terrain, UUID regionID) - { - } - - public double[,] LoadTerrain(UUID regionID) - { - return new double[Constants.RegionSize, Constants.RegionSize]; - } - - public void StoreLandObject(ILandObject Parcel) - { - } - - public void RemoveLandObject(UUID globalID) - { - } - - public List LoadLandObjects(UUID regionUUID) - { - return new List(0); - } - - public void StoreRegionSettings(RegionSettings rs) - { - } - - public RegionSettings LoadRegionSettings(UUID regionUUID) - { - return null; - } - - public RegionLightShareData LoadRegionWindlightSettings(UUID regionUUID) - { - return null; - } - - public void StoreRegionWindlightSettings(RegionLightShareData wl) - { - } - } -} diff --git a/OpenSim/Tests/Common/Mock/TestScene.cs b/OpenSim/Tests/Common/Mock/TestScene.cs index 615e519..4511228 100644 --- a/OpenSim/Tests/Common/Mock/TestScene.cs +++ b/OpenSim/Tests/Common/Mock/TestScene.cs @@ -31,6 +31,7 @@ using OpenSim.Framework; using OpenSim.Framework.Communications; using OpenSim.Framework.Servers; using OpenSim.Region.Framework; +using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; namespace OpenSim.Tests.Common.Mock @@ -39,20 +40,15 @@ namespace OpenSim.Tests.Common.Mock { public TestScene( RegionInfo regInfo, AgentCircuitManager authen, - SceneCommunicationService sceneGridService, StorageManager storeManager, + SceneCommunicationService sceneGridService, ISimulationDataService simDataService, IEstateDataService estateDataService, ModuleLoader moduleLoader, bool dumpAssetsToFile, bool physicalPrim, bool SeeIntoRegionFromNeighbor, IConfigSource config, string simulatorVersion) - : base(regInfo, authen, sceneGridService, storeManager, moduleLoader, + : base(regInfo, authen, sceneGridService, simDataService, estateDataService, moduleLoader, dumpAssetsToFile, physicalPrim, SeeIntoRegionFromNeighbor, config, simulatorVersion) { } /// - /// Allow retrieval for test check purposes - /// - public StorageManager StorageManager { get { return m_storageManager; } } - - /// /// Temporarily override session authentication for tests (namely teleport). /// /// diff --git a/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs b/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs index 9318a27..ffd0078 100644 --- a/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs +++ b/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs @@ -157,11 +157,12 @@ namespace OpenSim.Tests.Common.Setup AgentCircuitManager acm = new AgentCircuitManager(); SceneCommunicationService scs = new SceneCommunicationService(); - StorageManager sm = new StorageManager("OpenSim.Tests.Common.dll", "", ""); + ISimulationDataService simDataService = null; + IEstateDataService estateDataService = null; IConfigSource configSource = new IniConfigSource(); TestScene testScene = new TestScene( - regInfo, acm, scs, sm, null, false, false, false, configSource, null); + regInfo, acm, scs, simDataService, estateDataService, null, false, false, false, configSource, null); INonSharedRegionModule capsModule = new CapabilitiesModule(); capsModule.Initialise(new IniConfigSource()); diff --git a/bin/OpenSim.ini.example b/bin/OpenSim.ini.example index 08726ea..8d714ce 100644 --- a/bin/OpenSim.ini.example +++ b/bin/OpenSim.ini.example @@ -106,33 +106,6 @@ ; ## PRIM STORAGE ; ## - ; *** Prim Storage - only leave one storage_plugin uncommented *** - ; --- Null stores nothing - effectively disabling persistence: - ;storage_plugin = "OpenSim.Data.Null.dll" - - ; --- To use sqlite as region storage: - ; - ; PLEASE NOTE: Unfortunately, the current SQLite database plugin (necessary to use SQLite with Mono on Linux) is - ; not compatible with the sqlite3 library installed on Mac OSX. If you're using Mono 2.4 you can still use the old sqlite - ; library by uncommenting the SQLiteLegacy.dll storage plugin (and commenting out SQLite.dll). Unfortunately, the older library - ; will not work with Mono 2.6 on Mac OSX so you will either need to replace the OSX sqlite3 system library or use MySQL instead - ; - ; You will also need to do the same thing in config-include/StandaloneCommon.ini if you are running in standalone mode - storage_plugin = "OpenSim.Data.SQLite.dll" - ;storage_plugin = "OpenSim.Data.SQLiteLegacy.dll" - storage_connection_string="URI=file:OpenSim.db,version=3"; - - ; --- To use MySQL storage, supply your own connection string (this is only an example): - ; note that the supplied account needs create privilegies if you want it to auto-create needed tables. - ; - ; -->>> There are multiple connection strings defined in several places. Check it carefully! - ; - ; storage_plugin="OpenSim.Data.MySQL.dll" - ; storage_connection_string="Data Source=localhost;Database=opensim;User ID=opensim;Password=*****;Old Guids=true;"; - ; If you want to use a different database/server for estate data, then - ; uncomment and change this connect string. Defaults to the above if not set - ; estate_connection_string="Data Source=localhost;Database=opensim;User ID=opensim;Password=*****;"; - ; Persistence of changed objects happens during regular sweeps. The following control that behaviour to ; prevent frequently changing objects from heavily loading the region data store. ; If both of these values are set to zero then persistence of all changed objects will happen on every sweep. diff --git a/bin/config-include/Grid.ini b/bin/config-include/Grid.ini index 9a75f19..4a6a082 100644 --- a/bin/config-include/Grid.ini +++ b/bin/config-include/Grid.ini @@ -27,6 +27,11 @@ SimulationServiceInConnector = true LibraryModule = true +[SimulationDataStore] + LocalServiceModule = "OpenSim.Services.Connectors.dll:SimulationDataService" + +[EstateDataStore] + LocalServiceModule = "OpenSim.Services.Connectors.dll:EstateDataService" [GridService] LocalServiceModule = "OpenSim.Services.GridService.dll:GridService" diff --git a/bin/config-include/GridCommon.ini.example b/bin/config-include/GridCommon.ini.example index a19591b..c2cd5c3 100644 --- a/bin/config-include/GridCommon.ini.example +++ b/bin/config-include/GridCommon.ini.example @@ -1,3 +1,24 @@ +[DatabaseService] + ; + ; ### Choose the DB + ; + + ; SQLite + Include-Storage = "config-include/storage/SQLiteStandalone.ini"; + + ; Unfortunately the current SQLite database plugin is not compatible with Mac OSX. You can still use the older + ; legacy sqlite library if you are using Mono 2.4. Please see the notes in OpenSim.ini (search for sqlite) + ; for more details + ;Include-Storage = "config-include/storage/SQLiteLegacyStandalone.ini"; + + ; MySql + ; Uncomment these lines if you want to use mysql storage + ; Change the connection string to your db details + ;StorageProvider = "OpenSim.Data.MySQL.dll" + ;ConnectionString = "Data Source=localhost;Database=opensim;User ID=opensim;Password=***;" + ; Uncomment this line if you are using MySQL and want to use a different database for estates + ;EstateConnectionString = "Data Source=localhost;Database=opensim;User ID=opensim;Password=***;" + [AssetService] DefaultAssetLoader = "OpenSim.Framework.AssetLoader.Filesystem.dll" diff --git a/bin/config-include/GridHypergrid.ini b/bin/config-include/GridHypergrid.ini index ab29018..d69a945 100644 --- a/bin/config-include/GridHypergrid.ini +++ b/bin/config-include/GridHypergrid.ini @@ -30,6 +30,12 @@ SimulationServiceInConnector = true LibraryModule = true +[SimulationDataStore] + LocalServiceModule = "OpenSim.Services.Connectors.dll:SimulationDataService" + +[EstateDataStore] + LocalServiceModule = "OpenSim.Services.Connectors.dll:EstateDataService" + [AssetService] LocalGridAssetService = "OpenSim.Services.Connectors.dll:AssetServicesConnector" HypergridAssetService = "OpenSim.Services.Connectors.dll:HGAssetServiceConnector" diff --git a/bin/config-include/HyperSimianGrid.ini b/bin/config-include/HyperSimianGrid.ini index 49ba2ca..29b51de 100644 --- a/bin/config-include/HyperSimianGrid.ini +++ b/bin/config-include/HyperSimianGrid.ini @@ -41,6 +41,12 @@ AssetCaching = "FlotsamAssetCache" +[SimulationDataStore] + LocalServiceModule = "OpenSim.Services.Connectors.dll:SimulationDataService" + +[EstateDataStore] + LocalServiceModule = "OpenSim.Services.Connectors.dll:EstateDataService" + [Friends] Connector = "OpenSim.Services.Connectors.dll:SimianFriendsServiceConnector" diff --git a/bin/config-include/SimianGrid.ini b/bin/config-include/SimianGrid.ini index 9b27cc7..239ce30 100644 --- a/bin/config-include/SimianGrid.ini +++ b/bin/config-include/SimianGrid.ini @@ -41,6 +41,12 @@ AssetCaching = "FlotsamAssetCache" +[SimulationDataStore] + LocalServiceModule = "OpenSim.Services.Connectors.dll:SimulationDataService" + +[EstateDataStore] + LocalServiceModule = "OpenSim.Services.Connectors.dll:EstateDataService" + [Friends] Connector = "OpenSim.Services.Connectors.dll:SimianFriendsServiceConnector" diff --git a/bin/config-include/Standalone.ini b/bin/config-include/Standalone.ini index eae9801..d74b50e 100644 --- a/bin/config-include/Standalone.ini +++ b/bin/config-include/Standalone.ini @@ -22,6 +22,12 @@ LLLoginServiceInConnector = true GridInfoServiceInConnector = true +[SimulationDataStore] + LocalServiceModule = "OpenSim.Services.Connectors.dll:SimulationDataService" + +[EstateDataStore] + LocalServiceModule = "OpenSim.Services.Connectors.dll:EstateDataService" + [AssetService] LocalServiceModule = "OpenSim.Services.AssetService.dll:AssetService" diff --git a/bin/config-include/StandaloneCommon.ini.example b/bin/config-include/StandaloneCommon.ini.example index f862960..96ef602 100644 --- a/bin/config-include/StandaloneCommon.ini.example +++ b/bin/config-include/StandaloneCommon.ini.example @@ -18,6 +18,8 @@ ; Change the connection string to your db details ;StorageProvider = "OpenSim.Data.MySQL.dll" ;ConnectionString = "Data Source=localhost;Database=opensim;User ID=opensim;Password=***;Old Guids=true;" + ; Uncomment this line if you are using MySQL and want to use a different database for estates + ;EstateConnectionString = "Data Source=localhost;Database=opensim;User ID=opensim;Password=***;Old Guids=true;" [AssetService] DefaultAssetLoader = "OpenSim.Framework.AssetLoader.Filesystem.dll" diff --git a/prebuild.xml b/prebuild.xml index 7dec8ba..726991c 100644 --- a/prebuild.xml +++ b/prebuild.xml @@ -924,13 +924,15 @@ - + + + @@ -1653,6 +1655,7 @@ + -- cgit v1.1 From 18a9ac6b39b91865c33eeffa1ef8ff3e8a847c1b Mon Sep 17 00:00:00 2001 From: John Hurliman Date: Sun, 12 Sep 2010 15:04:51 -0700 Subject: Fix unit test SceneSetupHelpers to load the mock simulation data store --- OpenSim/Tests/Common/Mock/MockRegionDataPlugin.cs | 75 +++++++++++++++++++++++ OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs | 2 +- 2 files changed, 76 insertions(+), 1 deletion(-) diff --git a/OpenSim/Tests/Common/Mock/MockRegionDataPlugin.cs b/OpenSim/Tests/Common/Mock/MockRegionDataPlugin.cs index f453a4b..de6e815 100644 --- a/OpenSim/Tests/Common/Mock/MockRegionDataPlugin.cs +++ b/OpenSim/Tests/Common/Mock/MockRegionDataPlugin.cs @@ -35,6 +35,81 @@ using OpenSim.Region.Framework.Scenes; namespace OpenSim.Data.Null { + public class NullDataService : ISimulationDataService + { + private NullDataStore m_store; + + public NullDataService() + { + m_store = new NullDataStore(); + } + + public void StoreObject(SceneObjectGroup obj, UUID regionUUID) + { + m_store.StoreObject(obj, regionUUID); + } + + public void RemoveObject(UUID uuid, UUID regionUUID) + { + m_store.RemoveObject(uuid, regionUUID); + } + + public void StorePrimInventory(UUID primID, ICollection items) + { + m_store.StorePrimInventory(primID, items); + } + + public List LoadObjects(UUID regionUUID) + { + return m_store.LoadObjects(regionUUID); + } + + public void StoreTerrain(double[,] terrain, UUID regionID) + { + m_store.StoreTerrain(terrain, regionID); + } + + public double[,] LoadTerrain(UUID regionID) + { + return m_store.LoadTerrain(regionID); + } + + public void StoreLandObject(ILandObject Parcel) + { + m_store.StoreLandObject(Parcel); + } + + public void RemoveLandObject(UUID globalID) + { + m_store.RemoveLandObject(globalID); + } + + public List LoadLandObjects(UUID regionUUID) + { + return m_store.LoadLandObjects(regionUUID); + } + + public void StoreRegionSettings(RegionSettings rs) + { + m_store.StoreRegionSettings(rs); + } + + public RegionSettings LoadRegionSettings(UUID regionUUID) + { + return m_store.LoadRegionSettings(regionUUID); + } + + public RegionLightShareData LoadRegionWindlightSettings(UUID regionUUID) + { + return m_store.LoadRegionWindlightSettings(regionUUID); + } + + public void StoreRegionWindlightSettings(RegionLightShareData wl) + { + m_store.StoreRegionWindlightSettings(wl); + } + } + /// /// Mock region data plugin. This obeys the api contract for persistence but stores everything in memory, so that /// tests can check correct persistence. diff --git a/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs b/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs index ee76db4..fc9db03 100644 --- a/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs +++ b/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs @@ -157,7 +157,7 @@ namespace OpenSim.Tests.Common.Setup AgentCircuitManager acm = new AgentCircuitManager(); SceneCommunicationService scs = new SceneCommunicationService(); - ISimulationDataService simDataService = null; + ISimulationDataService simDataService = OpenSim.Server.Base.ServerUtils.LoadPlugin("OpenSim.Tests.Common.dll", null); IEstateDataService estateDataService = null; IConfigSource configSource = new IniConfigSource(); -- cgit v1.1