aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--OGS.sql134
-rw-r--r--OGS/OGS.sln (renamed from ogs/OGS-UserServer.sln)16
-rw-r--r--OGS/ServerConsole/Properties/AssemblyInfo.cs (renamed from ogs/ServerConsole/Properties/AssemblyInfo.cs)0
-rw-r--r--OGS/ServerConsole/ServerConsole.cs (renamed from ogs/ServerConsole/ServerConsole.cs)0
-rw-r--r--OGS/ServerConsole/ServerConsole.csproj (renamed from ogs/ServerConsole/ServerConsole.csproj)9
-rw-r--r--OGS/ServerConsole/default.build (renamed from ogs/ServerConsole/default.build)0
-rw-r--r--OGS/common/VersionInfo/VersionInfo.cs (renamed from ogs/common/VersionInfo/VersionInfo.cs)0
-rw-r--r--OGS/common/bin/ServerConsole.dllbin0 -> 16384 bytes
-rw-r--r--OGS/common/bin/ServerConsole.pdbbin0 -> 11776 bytes
-rw-r--r--[-rwxr-xr-x]OGS/common/bin/libsecondlife.dll (renamed from ogs/common/bin/libsecondlife.dll)bin2338816 -> 2338816 bytes
-rw-r--r--OGS/common/src/OGS-Console.cs (renamed from ogs/common/src/OGS-Console.cs)0
-rw-r--r--OGS/common/src/VersionInfo.cs.template (renamed from ogs/common/src/VersionInfo.cs.template)0
-rw-r--r--OGS/gridserver/default.build (renamed from ogs/gridserver/default.build)0
-rw-r--r--OGS/gridserver/src/ConsoleCmds.cs (renamed from ogs/gridserver/src/ConsoleCmds.cs)0
-rw-r--r--OGS/gridserver/src/GridHttp.cs (renamed from ogs/gridserver/src/GridHttp.cs)3
-rw-r--r--OGS/gridserver/src/Main.cs (renamed from ogs/gridserver/src/Main.cs)0
-rw-r--r--OGS/gridserver/src/OGS-GridServer.csproj (renamed from ogs/gridserver/src/OGS-GridServer.csproj)14
-rw-r--r--OGS/gridserver/src/Properties/AssemblyInfo.cs (renamed from ogs/gridserver/src/Properties/AssemblyInfo.cs)0
-rw-r--r--OGS/gridserver/src/SimProfiles.cs (renamed from ogs/gridserver/src/SimProfiles.cs)21
-rw-r--r--OGS/userserver/src/ConsoleCmds.cs (renamed from ogs/userserver/src/ConsoleCmds.cs)0
-rw-r--r--OGS/userserver/src/Main.cs (renamed from ogs/userserver/src/Main.cs)10
-rw-r--r--OGS/userserver/src/OGS-UserServer.csproj (renamed from ogs/userserver/src/OGS-UserServer.csproj)13
-rw-r--r--OGS/userserver/src/OGS-UserServer.csproj.user (renamed from ogs/userserver/src/OGS-UserServer.csproj.user)8
-rw-r--r--OGS/userserver/src/Properties/AssemblyInfo.cs (renamed from ogs/userserver/src/Properties/AssemblyInfo.cs)0
-rw-r--r--OGS/userserver/src/UserHttp.cs146
-rw-r--r--OpenSim.Config/SimConfigDb4o/AssemblyInfo.cs31
-rw-r--r--OpenSim.Config/SimConfigDb4o/DbSimConfig.cs176
-rw-r--r--OpenSim.Config/SimConfigDb4o/MapStorage.cs16
-rw-r--r--OpenSim.Config/SimConfigDb4o/OpenSim.Config.SimConfigDb4o.csproj107
-rw-r--r--OpenSim.Config/SimConfigDb4o/OpenSim.Config.SimConfigDb4o.dll.build47
-rw-r--r--OpenSim.Framework.Console/AssemblyInfo.cs31
-rw-r--r--OpenSim.Framework.Console/ConsoleBase.cs45
-rw-r--r--OpenSim.Framework.Console/MainConsole.cs (renamed from src/VersionInfo.cs.template)29
-rw-r--r--OpenSim.Framework.Console/OpenSim.Framework.Console.csproj85
-rw-r--r--OpenSim.Framework.Console/OpenSim.Framework.Console.dll.build41
-rw-r--r--OpenSim.Framework/AgentCiruitData.cs18
-rw-r--r--OpenSim.Framework/AssetBase.cs22
-rw-r--r--OpenSim.Framework/BlockingQueue.cs33
-rw-r--r--OpenSim.Framework/HeightMapGenHills.cs (renamed from src/HeightMapGenHills.cs)2
-rw-r--r--OpenSim.Framework/IAssetServer.cs (renamed from src/GridInterfaces/IAssetServer.cs)80
-rw-r--r--OpenSim.Framework/IConfig.cs (renamed from src/Config.cs)81
-rw-r--r--OpenSim.Framework/IGridServer.cs (renamed from src/GridInterfaces/ILocalStorage.cs)100
-rw-r--r--OpenSim.Framework/ILocalStorage.cs51
-rw-r--r--OpenSim.Framework/IUserServer.cs14
-rw-r--r--OpenSim.Framework/Inventory.cs127
-rw-r--r--OpenSim.Framework/LocalGridBase.cs21
-rw-r--r--OpenSim.Framework/Login.cs22
-rw-r--r--OpenSim.Framework/LoginService.cs (renamed from src/OpenSim.Framework/LoginService.cs)5
-rw-r--r--OpenSim.Framework/NeighbourInfo.cs19
-rw-r--r--OpenSim.Framework/OpenSim.Framework.csproj151
-rw-r--r--OpenSim.Framework/OpenSim.Framework.dll.build63
-rw-r--r--OpenSim.Framework/PrimData.cs45
-rw-r--r--OpenSim.Framework/Properties/AssemblyInfo.cs (renamed from src/Properties/AssemblyInfo.cs)10
-rw-r--r--OpenSim.Framework/RemoteGridBase.cs25
-rw-r--r--OpenSim.Framework/SimProfile.cs51
-rw-r--r--OpenSim.Framework/SimProfileBase.cs25
-rw-r--r--OpenSim.Framework/UserProfile.cs50
-rw-r--r--OpenSim.Framework/UserProfileManager.cs223
-rw-r--r--OpenSim.Framework/UserProfileManagerBase.cs91
-rw-r--r--OpenSim.Framework/Util.cs32
-rw-r--r--OpenSim.GridInterfaces/Local/AssemblyInfo.cs31
-rw-r--r--OpenSim.GridInterfaces/Local/LocalAssetServer.cs208
-rw-r--r--OpenSim.GridInterfaces/Local/LocalGridServer.cs (renamed from src/LocalServers/LocalGridServers/LocalGrid.cs)135
-rw-r--r--OpenSim.GridInterfaces/Local/OpenSim.GridInterfaces.Local.csproj104
-rw-r--r--OpenSim.GridInterfaces/Local/OpenSim.GridInterfaces.Local.dll.build46
-rw-r--r--OpenSim.GridInterfaces/Remote/AssemblyInfo.cs31
-rw-r--r--OpenSim.GridInterfaces/Remote/OpenSim.GridInterfaces.Remote.csproj101
-rw-r--r--OpenSim.GridInterfaces/Remote/OpenSim.GridInterfaces.Remote.dll.build45
-rw-r--r--OpenSim.GridInterfaces/Remote/RemoteAssetServer.cs102
-rw-r--r--OpenSim.GridInterfaces/Remote/RemoteGridServer.cs156
-rw-r--r--OpenSim.Physics/BasicPhysicsPlugin/AssemblyInfo.cs31
-rw-r--r--OpenSim.Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs (renamed from src/physics/plugins/PhysXplugin.cs)52
-rw-r--r--OpenSim.Physics/BasicPhysicsPlugin/OpenSim.Physics.BasicPhysicsPlugin.csproj90
-rw-r--r--OpenSim.Physics/BasicPhysicsPlugin/OpenSim.Physics.BasicPhysicsPlugin.csproj.user12
-rw-r--r--OpenSim.Physics/BasicPhysicsPlugin/OpenSim.Physics.BasicPhysicsPlugin.dll.build42
-rw-r--r--OpenSim.Physics/Manager/AssemblyInfo.cs31
-rw-r--r--OpenSim.Physics/Manager/OpenSim.Physics.Manager.csproj102
-rw-r--r--OpenSim.Physics/Manager/OpenSim.Physics.Manager.dll.build46
-rw-r--r--OpenSim.Physics/Manager/PhysicsActor.cs161
-rw-r--r--OpenSim.Physics/Manager/PhysicsManager.cs116
-rw-r--r--OpenSim.Physics/Manager/PhysicsScene.cs98
-rw-r--r--OpenSim.Physics/Manager/PhysicsVector.cs54
-rw-r--r--OpenSim.Physics/PhysXPlugin/AssemblyInfo.cs (renamed from src/physics/RealPhysX/RealPhysXplugin/AssemblyInfo.cs)0
-rw-r--r--OpenSim.Physics/PhysXPlugin/OpenSim.Physics.PhysXPlugin.csproj93
-rw-r--r--OpenSim.Physics/PhysXPlugin/OpenSim.Physics.PhysXPlugin.dll.build43
-rw-r--r--OpenSim.Physics/PhysXPlugin/PhysXPlugin.cs (renamed from src/physics/RealPhysX/RealPhysXplugin/RealPhysX.cs)69
-rw-r--r--OpenSim.RegionServer/Assets/AssetCache.cs589
-rw-r--r--OpenSim.RegionServer/Assets/InventoryCache.cs199
-rw-r--r--OpenSim.RegionServer/CAPS/SimHttp.cs175
-rw-r--r--OpenSim.RegionServer/Grid.cs89
-rw-r--r--OpenSim.RegionServer/OpenSim.RegionServer.csproj169
-rw-r--r--OpenSim.RegionServer/OpenSim.RegionServer.exe.build67
-rw-r--r--OpenSim.RegionServer/OpenSimApplication.cs16
-rw-r--r--OpenSim.RegionServer/OpenSimMain.cs320
-rw-r--r--OpenSim.RegionServer/OpenSimRoot.cs63
-rw-r--r--OpenSim.RegionServer/QueItem.cs18
-rw-r--r--OpenSim.RegionServer/SimClient.cs621
-rw-r--r--OpenSim.RegionServer/SimConsole.cs (renamed from src/OpenSimConsole.cs)22
-rw-r--r--OpenSim.RegionServer/UserServer/LocalUserProfileManager.cs76
-rw-r--r--OpenSim.RegionServer/UserServer/LoginServer.cs414
-rw-r--r--OpenSim.RegionServer/VersionInfo.cs (renamed from src/VersionInfo.cs)12
-rw-r--r--OpenSim.RegionServer/types/Mesh.cs (renamed from src/types/Mesh.cs)0
-rw-r--r--OpenSim.RegionServer/types/Triangle.cs (renamed from src/types/Triangle.cs)0
-rw-r--r--OpenSim.RegionServer/world/Avatar.cs501
-rw-r--r--OpenSim.RegionServer/world/Entity.cs (renamed from src/world/Entity.cs)2
-rw-r--r--OpenSim.RegionServer/world/Primitive.cs485
-rw-r--r--OpenSim.RegionServer/world/ScriptEngine.cs (renamed from src/world/ScriptEngine.cs)0
-rw-r--r--OpenSim.RegionServer/world/SurfacePatch.cs (renamed from src/world/SurfacePatch.cs)0
-rw-r--r--OpenSim.RegionServer/world/World.cs (renamed from src/world/World.cs)47
-rw-r--r--OpenSim.RegionServer/world/scripting/IScript.cs (renamed from src/world/scripting/IScript.cs)0
-rw-r--r--OpenSim.Storage/LocalStorageDb4o/AssemblyInfo.cs31
-rw-r--r--OpenSim.Storage/LocalStorageDb4o/Db4LocalStorage.cs (renamed from src/LocalStorage/Db4LocalStorage/Db4LocalStorage.cs)29
-rw-r--r--OpenSim.Storage/LocalStorageDb4o/OpenSim.Storage.LocalStorageDb4o.csproj104
-rw-r--r--OpenSim.Storage/LocalStorageDb4o/OpenSim.Storage.LocalStorageDb4o.dll.build46
-rw-r--r--OpenSim.Storage/LocalStorageDb4o/UUIDQuery.cs25
-rw-r--r--OpenSim.build94
-rw-r--r--OpenSim.sln89
-rw-r--r--Prebuild/Prebuild.build67
-rw-r--r--Prebuild/Prebuild.sln25
-rw-r--r--Prebuild/README230
-rw-r--r--Prebuild/TODO21
-rw-r--r--Prebuild/doc/prebuild-example1.xml300
-rw-r--r--Prebuild/doc/prebuild-example2.xml72
-rw-r--r--Prebuild/doc/prebuild-example3.xml113
-rw-r--r--Prebuild/doc/prebuild-example4.xml715
-rw-r--r--Prebuild/doc/prebuild-example5.xml187
-rw-r--r--Prebuild/prebuild2
-rw-r--r--Prebuild/prebuild.xml57
-rw-r--r--Prebuild/scripts/Clean.bat2
-rw-r--r--Prebuild/scripts/Help.bat2
-rw-r--r--Prebuild/scripts/MonoDevelop.sh2
-rw-r--r--Prebuild/scripts/Prebuild.nsi231
-rw-r--r--Prebuild/scripts/SharpDevelop.bat4
-rw-r--r--Prebuild/scripts/SharpDevelop2.bat4
-rw-r--r--Prebuild/scripts/VS2002.bat4
-rw-r--r--Prebuild/scripts/VS2003.bat4
-rw-r--r--Prebuild/scripts/VS2005.bat4
-rw-r--r--Prebuild/scripts/autotools.bat4
-rw-r--r--Prebuild/scripts/autotools.sh2
-rw-r--r--Prebuild/scripts/nant.bat4
-rw-r--r--Prebuild/scripts/nant.sh2
-rw-r--r--Prebuild/src/App.icobin0 -> 4286 bytes
-rw-r--r--Prebuild/src/Core/Attributes/DataNodeAttribute.cs81
-rw-r--r--Prebuild/src/Core/Attributes/OptionNodeAttribute.cs80
-rw-r--r--Prebuild/src/Core/Attributes/TargetAttribute.cs80
-rw-r--r--Prebuild/src/Core/FatalException.cs94
-rw-r--r--Prebuild/src/Core/Interfaces/IDataNode.cs56
-rw-r--r--Prebuild/src/Core/Interfaces/ITarget.cs60
-rw-r--r--Prebuild/src/Core/Kernel.cs758
-rw-r--r--Prebuild/src/Core/Nodes/ConfigurationNode.cs177
-rw-r--r--Prebuild/src/Core/Nodes/DataNode.cs82
-rw-r--r--Prebuild/src/Core/Nodes/ExcludeNode.cs85
-rw-r--r--Prebuild/src/Core/Nodes/FileNode.cs238
-rw-r--r--Prebuild/src/Core/Nodes/FilesNode.cs222
-rw-r--r--Prebuild/src/Core/Nodes/MatchNode.cs299
-rw-r--r--Prebuild/src/Core/Nodes/OptionsNode.cs655
-rw-r--r--Prebuild/src/Core/Nodes/ProcessNode.cs119
-rw-r--r--Prebuild/src/Core/Nodes/ProjectNode.cs490
-rw-r--r--Prebuild/src/Core/Nodes/ReferenceNode.cs143
-rw-r--r--Prebuild/src/Core/Nodes/ReferencePathNode.cs98
-rw-r--r--Prebuild/src/Core/Nodes/SolutionNode.cs284
-rw-r--r--Prebuild/src/Core/Parse/IfContext.cs163
-rw-r--r--Prebuild/src/Core/Parse/Preprocessor.cs519
-rw-r--r--Prebuild/src/Core/Targets/AutotoolsTarget.cs926
-rw-r--r--Prebuild/src/Core/Targets/DebugTarget.cs102
-rw-r--r--Prebuild/src/Core/Targets/MonoDevelopTarget.cs458
-rw-r--r--Prebuild/src/Core/Targets/NAntTarget.cs621
-rw-r--r--Prebuild/src/Core/Targets/SharpDevelop2Target.cs90
-rw-r--r--Prebuild/src/Core/Targets/SharpDevelopTarget.cs437
-rw-r--r--Prebuild/src/Core/Targets/VS2002Target.cs96
-rw-r--r--Prebuild/src/Core/Targets/VS2003Target.cs633
-rw-r--r--Prebuild/src/Core/Targets/VS2005Target.cs869
-rw-r--r--Prebuild/src/Core/UnknownLanguageException.cs63
-rw-r--r--Prebuild/src/Core/Utilities/CommandLineCollection.cs162
-rw-r--r--Prebuild/src/Core/Utilities/CurrentDirectory.cs89
-rw-r--r--Prebuild/src/Core/Utilities/Helper.cs661
-rw-r--r--Prebuild/src/Core/Utilities/Log.cs279
-rw-r--r--Prebuild/src/Core/WarningException.cs93
-rw-r--r--Prebuild/src/Prebuild.cs165
-rw-r--r--Prebuild/src/Prebuild.csproj199
-rw-r--r--Prebuild/src/Prebuild.exe.build80
-rw-r--r--Prebuild/src/Prebuild.snkbin0 -> 596 bytes
-rw-r--r--Prebuild/src/Properties/AssemblyInfo.cs101
-rw-r--r--Prebuild/src/data/dnpb-1.0.xsd183
-rw-r--r--Prebuild/src/data/dnpb-1.1.xsd184
-rw-r--r--Prebuild/src/data/dnpb-1.2.xsd198
-rw-r--r--Prebuild/src/data/dnpb-1.3.xsd206
-rw-r--r--Prebuild/src/data/dnpb-1.4.xsd212
-rw-r--r--Prebuild/src/data/dnpb-1.5.xsd215
-rw-r--r--Prebuild/src/data/prebuild-1.6.xsd231
-rw-r--r--Prebuild/src/data/prebuild-1.7.xsd261
-rw-r--r--README.txt33
-rw-r--r--STATE_OF_PREBUILD.txt15
-rw-r--r--VERSION1
-rwxr-xr-xgenvers.sh9
-rw-r--r--ogs/assetserver/assets/00000000000000005005000000000005/databin291 -> 0 bytes
-rw-r--r--ogs/assetserver/assets/00000000000000007007000000000006/databin153 -> 0 bytes
-rw-r--r--ogs/assetserver/assets/00000000000000007009000000000008/databin570 -> 0 bytes
-rw-r--r--ogs/assetserver/assets/66c41e3938f9f75a024e585989bfab73/data105
-rw-r--r--ogs/assetserver/assets/e0ee49b5a4184df8d3c9a65361fe7f49/data52
-rw-r--r--ogs/common/src/Util.cs87
-rw-r--r--ogs/genvers.sh9
-rw-r--r--ogs/ogs.build38
-rw-r--r--ogs/userserver/default.build63
-rw-r--r--ogs/userserver/src/UserHttp.cs287
-rw-r--r--ogs/userserver/src/UserProfiles.cs223
-rw-r--r--ogs/userserver/src/Util.cs87
-rw-r--r--opensim.build82
-rw-r--r--prebuild.xml326
-rw-r--r--src/AssemblyInfo.cs21
-rw-r--r--src/Assets/AssetCache.cs436
-rw-r--r--src/CAPS/SimHttp.cs165
-rw-r--r--src/Config/SimConfig/AssemblyInfo.cs21
-rw-r--r--src/Config/SimConfig/Db4SimConfig.cs177
-rw-r--r--src/Config/SimConfig/SimConfig.csproj52
-rw-r--r--src/Config/default.build53
-rw-r--r--src/GridInterfaces/AssemblyInfo.cs21
-rw-r--r--src/GridInterfaces/GridInterfaces.csproj40
-rw-r--r--src/GridInterfaces/IGridServer.cs145
-rw-r--r--src/GridInterfaces/default.build50
-rw-r--r--src/GridServers/LoginServer.cs350
-rw-r--r--src/LocalServers/LocalGridServers/AssemblyInfo.cs21
-rw-r--r--src/LocalServers/LocalGridServers/LocalGridServers.csproj48
-rw-r--r--src/LocalServers/default.build51
-rw-r--r--src/LocalStorage/Db4LocalStorage/AssemblyInfo.cs21
-rw-r--r--src/LocalStorage/Db4LocalStorage/Db4LocalStorage.csproj52
-rw-r--r--src/LocalStorage/default.build53
-rw-r--r--src/Main.cs338
-rw-r--r--src/OpenSim.Framework/AssemblyInfo.cs21
-rw-r--r--src/OpenSim.Framework/OpenSim.Framework.csproj49
-rw-r--r--src/OpenSim.Framework/Properties/AssemblyInfo.cs35
-rw-r--r--src/OpenSim.Framework/default.build50
-rw-r--r--src/OpenSimClient.cs471
-rw-r--r--src/RemoteServers/RemoteGridServers/AssemblyInfo.cs21
-rw-r--r--src/RemoteServers/RemoteGridServers/RemoteGrid.cs279
-rw-r--r--src/RemoteServers/RemoteGridServers/RemoteGridServers.csproj48
-rw-r--r--src/RemoteServers/default.build51
-rw-r--r--src/Second-server.csproj110
-rw-r--r--src/ServerConsole/ServerConsole/AssemblyInfo.cs21
-rw-r--r--src/ServerConsole/ServerConsole/ServerConsole.cs87
-rw-r--r--src/ServerConsole/ServerConsole/ServerConsole.csproj34
-rw-r--r--src/ServerConsole/default.build48
-rw-r--r--src/Util.cs99
-rw-r--r--src/opensim.sln80
-rw-r--r--src/physics/AssemblyInfo.cs21
-rw-r--r--src/physics/PhysicsManager.cs285
-rw-r--r--src/physics/PhysicsManager.csproj40
-rw-r--r--src/physics/RealPhysX/RealPhysXplugin/RealPhysXplugin.csproj46
-rw-r--r--src/physics/default.build49
-rw-r--r--src/physics/plugins/AssemblyInfo.cs21
-rw-r--r--src/physics/plugins/BasicPhysicsplugin.csproj51
-rw-r--r--src/physics/plugins/default.build51
-rw-r--r--src/world/Avatar.cs487
-rw-r--r--src/world/Primitive.cs429
254 files changed, 23147 insertions, 6669 deletions
diff --git a/OGS.sql b/OGS.sql
deleted file mode 100644
index 5efaf97..0000000
--- a/OGS.sql
+++ /dev/null
@@ -1,134 +0,0 @@
1-- phpMyAdmin SQL Dump
2-- version 2.6.3-pl1
3-- http://www.phpmyadmin.net
4--
5-- Host: 127.0.0.1
6-- Generation Time: Feb 16, 2007 at 09:54 PM
7-- Server version: 4.0.23
8-- PHP Version: 4.4.0
9--
10-- Database: `OGS`
11--
12
13-- --------------------------------------------------------
14
15--
16-- Table structure for table `Grid_settings`
17--
18
19DROP TABLE IF EXISTS `Grid_settings`;
20CREATE TABLE IF NOT EXISTS `Grid_settings` (
21 `Setting` text NOT NULL,
22 `value` text NOT NULL
23) TYPE=MyISAM;
24
25--
26-- Dumping data for table `Grid_settings`
27--
28
29INSERT INTO `Grid_settings` (`Setting`, `value`) VALUES ('highest_LLUUID', '51AEFF430000000000000000000002fd');
30
31-- --------------------------------------------------------
32
33--
34-- Table structure for table `foreign_profiles`
35--
36
37DROP TABLE IF EXISTS `foreign_profiles`;
38CREATE TABLE IF NOT EXISTS `foreign_profiles` (
39 `userprofile_LLUUID` varchar(32) NOT NULL default '',
40 `foreigngrid` text NOT NULL,
41 `profile_firstname` text NOT NULL,
42 `profile_lastname` text NOT NULL,
43 `profile_passwdmd5` text NOT NULL,
44 `homesim_ip` text NOT NULL,
45 `homesim_port` int(11) NOT NULL default '0',
46 `homeasset_url` text NOT NULL,
47 `homeuser_url` text NOT NULL,
48 `look_at` text NOT NULL,
49 `region_handle` text NOT NULL,
50 `position` text NOT NULL,
51 PRIMARY KEY (`userprofile_LLUUID`)
52) TYPE=MyISAM;
53
54--
55-- Dumping data for table `foreign_profiles`
56--
57
58
59-- --------------------------------------------------------
60
61--
62-- Table structure for table `local_user_profiles`
63--
64
65DROP TABLE IF EXISTS `local_user_profiles`;
66CREATE TABLE IF NOT EXISTS `local_user_profiles` (
67 `userprofile_LLUUID` varchar(32) NOT NULL default '',
68 `profile_firstname` text NOT NULL,
69 `profile_lastname` text NOT NULL,
70 `profile_passwdmd5` text NOT NULL,
71 `homesim_ip` text NOT NULL,
72 `homesim_port` int(11) NOT NULL default '0',
73 `homeasset_url` text NOT NULL,
74 `look_at` text NOT NULL,
75 `region_handle` text NOT NULL,
76 `position` text NOT NULL,
77 PRIMARY KEY (`userprofile_LLUUID`)
78) TYPE=MyISAM;
79
80--
81-- Dumping data for table `local_user_profiles`
82--
83
84INSERT INTO `local_user_profiles` (`userprofile_LLUUID`, `profile_firstname`, `profile_lastname`, `profile_passwdmd5`, `homesim_ip`, `homesim_port`, `homeasset_url`, `look_at`, `region_handle`, `position`) VALUES ('51AEFF43000000000000000000000100', 'Test', 'User', '$1$098f6bcd4621d373cade4e832627b4f6', '127.0.0.1', 1000, 'http://dummyassetserver.net/', 'r-0.57343, r-0.819255,r0', 'r255232,254976', 'r41.6589, r100.8374, r22.5072');
85
86-- --------------------------------------------------------
87
88--
89-- Table structure for table `region_profiles`
90--
91
92DROP TABLE IF EXISTS `region_profiles`;
93CREATE TABLE IF NOT EXISTS `region_profiles` (
94 `RegionID` varchar(32) NOT NULL default '',
95 `Name` text NOT NULL,
96 `GridLocX` bigint(20) NOT NULL default '0',
97 `GridLocY` bigint(20) NOT NULL default '0',
98 `region_handle` text NOT NULL,
99 `ip_addr` text NOT NULL,
100 `port` text NOT NULL,
101 PRIMARY KEY (`RegionID`)
102) TYPE=MyISAM;
103
104--
105-- Dumping data for table `region_profiles`
106--
107
108INSERT INTO `region_profiles` (`RegionID`, `Name`, `GridLocX`, `GridLocY`, `region_handle`, `ip_addr`, `port`) VALUES ('51AEFF43000000000000000000000200', 'Test sandbox', 997, 996, 'r255232,254976', '127.0.0.1', '1000');
109
110-- --------------------------------------------------------
111
112--
113-- Table structure for table `sessions`
114--
115
116DROP TABLE IF EXISTS `sessions`;
117CREATE TABLE IF NOT EXISTS `sessions` (
118 `session_id` varchar(32) NOT NULL default '',
119 `secure_session_id` text NOT NULL,
120 `agent_id` text NOT NULL,
121 `session_start` datetime NOT NULL default '0000-00-00 00:00:00',
122 `session_end` datetime NOT NULL default '0000-00-00 00:00:00',
123 `session_active` tinyint(4) NOT NULL default '0',
124 `current_location` text NOT NULL,
125 `remote_ip` text NOT NULL,
126 `circuit_code` int(11) NOT NULL default '0',
127 PRIMARY KEY (`session_id`)
128) TYPE=MyISAM;
129
130--
131-- Dumping data for table `sessions`
132--
133
134INSERT INTO `sessions` (`session_id`, `secure_session_id`, `agent_id`, `session_start`, `session_end`, `session_active`, `current_location`, `remote_ip`, `circuit_code`) VALUES ('51AEFF430000000000000000000002fc', '51AEFF430000000000000000000002fd', '51AEFF43000000000000000000000100', '2007-02-16 21:13:19', '0000-00-00 00:00:00', 1, 'r255232,254976', '81.174.255.70', 0);
diff --git a/ogs/OGS-UserServer.sln b/OGS/OGS.sln
index 6c98af1..20eb03a 100644
--- a/ogs/OGS-UserServer.sln
+++ b/OGS/OGS.sln
@@ -3,9 +3,11 @@ Microsoft Visual Studio Solution File, Format Version 9.00
3# Visual C# Express 2005 3# Visual C# Express 2005
4Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OGS-UserServer", "userserver\src\OGS-UserServer.csproj", "{D45B6E48-5668-478D-B9CB-6D46E665FACF}" 4Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OGS-UserServer", "userserver\src\OGS-UserServer.csproj", "{D45B6E48-5668-478D-B9CB-6D46E665FACF}"
5EndProject 5EndProject
6Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OGS-GridServer", "gridserver\src\OGS-GridServer.csproj", "{FE50A574-C8ED-433B-95F0-213A5EED2AB2}"
7EndProject
6Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ServerConsole", "ServerConsole\ServerConsole.csproj", "{7667E6E2-F227-41A2-B1B2-315613E1BAFC}" 8Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ServerConsole", "ServerConsole\ServerConsole.csproj", "{7667E6E2-F227-41A2-B1B2-315613E1BAFC}"
7EndProject 9EndProject
8Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OGS-GridServer", "gridserver\src\OGS-GridServer.csproj", "{FE50A574-C8ED-433B-95F0-213A5EED2AB2}" 10Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenSim.Framework", "..\OpenSim.FrameWork\OpenSim.Framework.csproj", "{2E46A825-3168-492F-93BC-637126B5B72B}"
9EndProject 11EndProject
10Global 12Global
11 GlobalSection(SolutionConfigurationPlatforms) = preSolution 13 GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -17,14 +19,18 @@ Global
17 {D45B6E48-5668-478D-B9CB-6D46E665FACF}.Debug|Any CPU.Build.0 = Debug|Any CPU 19 {D45B6E48-5668-478D-B9CB-6D46E665FACF}.Debug|Any CPU.Build.0 = Debug|Any CPU
18 {D45B6E48-5668-478D-B9CB-6D46E665FACF}.Release|Any CPU.ActiveCfg = Release|Any CPU 20 {D45B6E48-5668-478D-B9CB-6D46E665FACF}.Release|Any CPU.ActiveCfg = Release|Any CPU
19 {D45B6E48-5668-478D-B9CB-6D46E665FACF}.Release|Any CPU.Build.0 = Release|Any CPU 21 {D45B6E48-5668-478D-B9CB-6D46E665FACF}.Release|Any CPU.Build.0 = Release|Any CPU
20 {7667E6E2-F227-41A2-B1B2-315613E1BAFC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
21 {7667E6E2-F227-41A2-B1B2-315613E1BAFC}.Debug|Any CPU.Build.0 = Debug|Any CPU
22 {7667E6E2-F227-41A2-B1B2-315613E1BAFC}.Release|Any CPU.ActiveCfg = Release|Any CPU
23 {7667E6E2-F227-41A2-B1B2-315613E1BAFC}.Release|Any CPU.Build.0 = Release|Any CPU
24 {FE50A574-C8ED-433B-95F0-213A5EED2AB2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 22 {FE50A574-C8ED-433B-95F0-213A5EED2AB2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
25 {FE50A574-C8ED-433B-95F0-213A5EED2AB2}.Debug|Any CPU.Build.0 = Debug|Any CPU 23 {FE50A574-C8ED-433B-95F0-213A5EED2AB2}.Debug|Any CPU.Build.0 = Debug|Any CPU
26 {FE50A574-C8ED-433B-95F0-213A5EED2AB2}.Release|Any CPU.ActiveCfg = Release|Any CPU 24 {FE50A574-C8ED-433B-95F0-213A5EED2AB2}.Release|Any CPU.ActiveCfg = Release|Any CPU
27 {FE50A574-C8ED-433B-95F0-213A5EED2AB2}.Release|Any CPU.Build.0 = Release|Any CPU 25 {FE50A574-C8ED-433B-95F0-213A5EED2AB2}.Release|Any CPU.Build.0 = Release|Any CPU
26 {7667E6E2-F227-41A2-B1B2-315613E1BAFC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
27 {7667E6E2-F227-41A2-B1B2-315613E1BAFC}.Debug|Any CPU.Build.0 = Debug|Any CPU
28 {7667E6E2-F227-41A2-B1B2-315613E1BAFC}.Release|Any CPU.ActiveCfg = Release|Any CPU
29 {7667E6E2-F227-41A2-B1B2-315613E1BAFC}.Release|Any CPU.Build.0 = Release|Any CPU
30 {2E46A825-3168-492F-93BC-637126B5B72B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
31 {2E46A825-3168-492F-93BC-637126B5B72B}.Debug|Any CPU.Build.0 = Debug|Any CPU
32 {2E46A825-3168-492F-93BC-637126B5B72B}.Release|Any CPU.ActiveCfg = Release|Any CPU
33 {2E46A825-3168-492F-93BC-637126B5B72B}.Release|Any CPU.Build.0 = Release|Any CPU
28 EndGlobalSection 34 EndGlobalSection
29 GlobalSection(SolutionProperties) = preSolution 35 GlobalSection(SolutionProperties) = preSolution
30 HideSolutionNode = FALSE 36 HideSolutionNode = FALSE
diff --git a/ogs/ServerConsole/Properties/AssemblyInfo.cs b/OGS/ServerConsole/Properties/AssemblyInfo.cs
index 0028e2a..0028e2a 100644
--- a/ogs/ServerConsole/Properties/AssemblyInfo.cs
+++ b/OGS/ServerConsole/Properties/AssemblyInfo.cs
diff --git a/ogs/ServerConsole/ServerConsole.cs b/OGS/ServerConsole/ServerConsole.cs
index d50a7e2..d50a7e2 100644
--- a/ogs/ServerConsole/ServerConsole.cs
+++ b/OGS/ServerConsole/ServerConsole.cs
diff --git a/ogs/ServerConsole/ServerConsole.csproj b/OGS/ServerConsole/ServerConsole.csproj
index 7f3005e..d23ca52 100644
--- a/ogs/ServerConsole/ServerConsole.csproj
+++ b/OGS/ServerConsole/ServerConsole.csproj
@@ -9,8 +9,6 @@
9 <AppDesignerFolder>Properties</AppDesignerFolder> 9 <AppDesignerFolder>Properties</AppDesignerFolder>
10 <RootNamespace>ServerConsole</RootNamespace> 10 <RootNamespace>ServerConsole</RootNamespace>
11 <AssemblyName>ServerConsole</AssemblyName> 11 <AssemblyName>ServerConsole</AssemblyName>
12 <StartupObject>
13 </StartupObject>
14 </PropertyGroup> 12 </PropertyGroup>
15 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> 13 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
16 <DebugSymbols>true</DebugSymbols> 14 <DebugSymbols>true</DebugSymbols>
@@ -39,11 +37,4 @@
39 <Compile Include="ServerConsole.cs" /> 37 <Compile Include="ServerConsole.cs" />
40 </ItemGroup> 38 </ItemGroup>
41 <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> 39 <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
42 <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
43 Other similar extension points exist, see Microsoft.Common.targets.
44 <Target Name="BeforeBuild">
45 </Target>
46 <Target Name="AfterBuild">
47 </Target>
48 -->
49</Project> \ No newline at end of file 40</Project> \ No newline at end of file
diff --git a/ogs/ServerConsole/default.build b/OGS/ServerConsole/default.build
index 64a4f04..64a4f04 100644
--- a/ogs/ServerConsole/default.build
+++ b/OGS/ServerConsole/default.build
diff --git a/ogs/common/VersionInfo/VersionInfo.cs b/OGS/common/VersionInfo/VersionInfo.cs
index 9763e62..9763e62 100644
--- a/ogs/common/VersionInfo/VersionInfo.cs
+++ b/OGS/common/VersionInfo/VersionInfo.cs
diff --git a/OGS/common/bin/ServerConsole.dll b/OGS/common/bin/ServerConsole.dll
new file mode 100644
index 0000000..842e0d0
--- /dev/null
+++ b/OGS/common/bin/ServerConsole.dll
Binary files differ
diff --git a/OGS/common/bin/ServerConsole.pdb b/OGS/common/bin/ServerConsole.pdb
new file mode 100644
index 0000000..b0f3b63
--- /dev/null
+++ b/OGS/common/bin/ServerConsole.pdb
Binary files differ
diff --git a/ogs/common/bin/libsecondlife.dll b/OGS/common/bin/libsecondlife.dll
index 89d692a..89d692a 100755..100644
--- a/ogs/common/bin/libsecondlife.dll
+++ b/OGS/common/bin/libsecondlife.dll
Binary files differ
diff --git a/ogs/common/src/OGS-Console.cs b/OGS/common/src/OGS-Console.cs
index c35c75c..c35c75c 100644
--- a/ogs/common/src/OGS-Console.cs
+++ b/OGS/common/src/OGS-Console.cs
diff --git a/ogs/common/src/VersionInfo.cs.template b/OGS/common/src/VersionInfo.cs.template
index 8f73b4b..8f73b4b 100644
--- a/ogs/common/src/VersionInfo.cs.template
+++ b/OGS/common/src/VersionInfo.cs.template
diff --git a/ogs/gridserver/default.build b/OGS/gridserver/default.build
index b113b83..b113b83 100644
--- a/ogs/gridserver/default.build
+++ b/OGS/gridserver/default.build
diff --git a/ogs/gridserver/src/ConsoleCmds.cs b/OGS/gridserver/src/ConsoleCmds.cs
index 82a2279..82a2279 100644
--- a/ogs/gridserver/src/ConsoleCmds.cs
+++ b/OGS/gridserver/src/ConsoleCmds.cs
diff --git a/ogs/gridserver/src/GridHttp.cs b/OGS/gridserver/src/GridHttp.cs
index 833a8ac..496a3bc 100644
--- a/ogs/gridserver/src/GridHttp.cs
+++ b/OGS/gridserver/src/GridHttp.cs
@@ -38,6 +38,7 @@ using System.Collections;
38using System.Collections.Generic; 38using System.Collections.Generic;
39using libsecondlife; 39using libsecondlife;
40using ServerConsole; 40using ServerConsole;
41using OpenSim.Framework.Sims;
41 42
42namespace OpenGridServices 43namespace OpenGridServices
43{ 44{
@@ -73,7 +74,7 @@ namespace OpenGridServices
73 switch(request.MethodName) { 74 switch(request.MethodName) {
74 case "get_sim_info": 75 case "get_sim_info":
75 ulong req_handle=(ulong)Convert.ToInt64(requestData["region_handle"]); 76 ulong req_handle=(ulong)Convert.ToInt64(requestData["region_handle"]);
76 SimProfile TheSim = OpenGrid_Main.thegrid._regionmanager.GetProfileByHandle(req_handle); 77 SimProfileBase TheSim = OpenGrid_Main.thegrid._regionmanager.GetProfileByHandle(req_handle);
77 string RecvKey=""; 78 string RecvKey="";
78 string caller=(string)requestData["caller"]; 79 string caller=(string)requestData["caller"];
79 switch(caller) { 80 switch(caller) {
diff --git a/ogs/gridserver/src/Main.cs b/OGS/gridserver/src/Main.cs
index d29a1ae..d29a1ae 100644
--- a/ogs/gridserver/src/Main.cs
+++ b/OGS/gridserver/src/Main.cs
diff --git a/ogs/gridserver/src/OGS-GridServer.csproj b/OGS/gridserver/src/OGS-GridServer.csproj
index d984e9a..b957d40 100644
--- a/ogs/gridserver/src/OGS-GridServer.csproj
+++ b/OGS/gridserver/src/OGS-GridServer.csproj
@@ -40,9 +40,6 @@
40 <Compile Include="..\..\common\src\OGS-Console.cs"> 40 <Compile Include="..\..\common\src\OGS-Console.cs">
41 <Link>OGS-Console.cs</Link> 41 <Link>OGS-Console.cs</Link>
42 </Compile> 42 </Compile>
43 <Compile Include="..\..\common\src\Util.cs">
44 <Link>Util.cs</Link>
45 </Compile>
46 <Compile Include="..\..\common\VersionInfo\VersionInfo.cs"> 43 <Compile Include="..\..\common\VersionInfo\VersionInfo.cs">
47 <Link>VersionInfo.cs</Link> 44 <Link>VersionInfo.cs</Link>
48 </Compile> 45 </Compile>
@@ -53,17 +50,14 @@
53 <Compile Include="SimProfiles.cs" /> 50 <Compile Include="SimProfiles.cs" />
54 </ItemGroup> 51 </ItemGroup>
55 <ItemGroup> 52 <ItemGroup>
53 <ProjectReference Include="..\..\..\OpenSim.FrameWork\OpenSim.Framework.csproj">
54 <Project>{2E46A825-3168-492F-93BC-637126B5B72B}</Project>
55 <Name>OpenSim.Framework</Name>
56 </ProjectReference>
56 <ProjectReference Include="..\..\ServerConsole\ServerConsole.csproj"> 57 <ProjectReference Include="..\..\ServerConsole\ServerConsole.csproj">
57 <Project>{7667E6E2-F227-41A2-B1B2-315613E1BAFC}</Project> 58 <Project>{7667E6E2-F227-41A2-B1B2-315613E1BAFC}</Project>
58 <Name>ServerConsole</Name> 59 <Name>ServerConsole</Name>
59 </ProjectReference> 60 </ProjectReference>
60 </ItemGroup> 61 </ItemGroup>
61 <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> 62 <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
62 <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
63 Other similar extension points exist, see Microsoft.Common.targets.
64 <Target Name="BeforeBuild">
65 </Target>
66 <Target Name="AfterBuild">
67 </Target>
68 -->
69</Project> \ No newline at end of file 63</Project> \ No newline at end of file
diff --git a/ogs/gridserver/src/Properties/AssemblyInfo.cs b/OGS/gridserver/src/Properties/AssemblyInfo.cs
index 8471e6b..8471e6b 100644
--- a/ogs/gridserver/src/Properties/AssemblyInfo.cs
+++ b/OGS/gridserver/src/Properties/AssemblyInfo.cs
diff --git a/ogs/gridserver/src/SimProfiles.cs b/OGS/gridserver/src/SimProfiles.cs
index 91a92ea..6db8331 100644
--- a/ogs/gridserver/src/SimProfiles.cs
+++ b/OGS/gridserver/src/SimProfiles.cs
@@ -33,6 +33,8 @@ using System.Collections;
33using System.Collections.Generic; 33using System.Collections.Generic;
34using libsecondlife; 34using libsecondlife;
35using ServerConsole; 35using ServerConsole;
36using OpenSim.Framework.Utilities;
37using OpenSim.Framework.Sims;
36 38
37namespace OpenGridServices 39namespace OpenGridServices
38{ 40{
@@ -40,7 +42,7 @@ namespace OpenGridServices
40 /// </summary> 42 /// </summary>
41 public class SimProfileManager { 43 public class SimProfileManager {
42 44
43 public Dictionary<LLUUID, SimProfile> SimProfiles = new Dictionary<LLUUID, SimProfile>(); 45 public Dictionary<LLUUID, SimProfileBase> SimProfiles = new Dictionary<LLUUID, SimProfileBase>();
44 46
45 public SimProfileManager() { 47 public SimProfileManager() {
46 } 48 }
@@ -49,19 +51,19 @@ namespace OpenGridServices
49 // TODO: need to load from database 51 // TODO: need to load from database
50 } 52 }
51 53
52 public SimProfile GetProfileByHandle(ulong reqhandle) { 54 public SimProfileBase GetProfileByHandle(ulong reqhandle) {
53 foreach (libsecondlife.LLUUID UUID in SimProfiles.Keys) { 55 foreach (libsecondlife.LLUUID UUID in SimProfiles.Keys) {
54 if(SimProfiles[UUID].regionhandle==reqhandle) return SimProfiles[UUID]; 56 if(SimProfiles[UUID].regionhandle==reqhandle) return SimProfiles[UUID];
55 } 57 }
56 return null; 58 return null;
57 } 59 }
58 60
59 public SimProfile GetProfileByLLUUID(LLUUID ProfileLLUUID) { 61 public SimProfileBase GetProfileByLLUUID(LLUUID ProfileLLUUID) {
60 return SimProfiles[ProfileLLUUID]; 62 return SimProfiles[ProfileLLUUID];
61 } 63 }
62 64
63 public bool AuthenticateSim(LLUUID RegionUUID, uint regionhandle, string simrecvkey) { 65 public bool AuthenticateSim(LLUUID RegionUUID, uint regionhandle, string simrecvkey) {
64 SimProfile TheSim=GetProfileByHandle(regionhandle); 66 SimProfileBase TheSim=GetProfileByHandle(regionhandle);
65 if(TheSim != null) 67 if(TheSim != null)
66 if(TheSim.recvkey==simrecvkey) { 68 if(TheSim.recvkey==simrecvkey) {
67 return true; 69 return true;
@@ -71,8 +73,8 @@ namespace OpenGridServices
71 73
72 } 74 }
73 75
74 public SimProfile CreateNewProfile(string regionname, string caps_url, string sim_ip, uint sim_port, uint RegionLocX, uint RegionLocY, string sendkey, string recvkey) { 76 public SimProfileBase CreateNewProfile(string regionname, string caps_url, string sim_ip, uint sim_port, uint RegionLocX, uint RegionLocY, string sendkey, string recvkey) {
75 SimProfile newprofile = new SimProfile(); 77 SimProfileBase newprofile = new SimProfileBase();
76 newprofile.regionname=regionname; 78 newprofile.regionname=regionname;
77 newprofile.sim_ip=sim_ip; 79 newprofile.sim_ip=sim_ip;
78 newprofile.sim_port=sim_port; 80 newprofile.sim_port=sim_port;
@@ -89,7 +91,8 @@ namespace OpenGridServices
89 91
90 } 92 }
91 93
92 public class SimProfile { 94 /* is in OpenSim.Framework
95 public class SimProfileBase {
93 public LLUUID UUID; 96 public LLUUID UUID;
94 public ulong regionhandle; 97 public ulong regionhandle;
95 public string regionname; 98 public string regionname;
@@ -102,10 +105,10 @@ namespace OpenGridServices
102 public string recvkey; 105 public string recvkey;
103 106
104 107
105 public SimProfile() { 108 public SimProfileBase() {
106 } 109 }
107 110
108 111
109 } 112 }*/
110 113
111} 114}
diff --git a/ogs/userserver/src/ConsoleCmds.cs b/OGS/userserver/src/ConsoleCmds.cs
index f2568fc..f2568fc 100644
--- a/ogs/userserver/src/ConsoleCmds.cs
+++ b/OGS/userserver/src/ConsoleCmds.cs
diff --git a/ogs/userserver/src/Main.cs b/OGS/userserver/src/Main.cs
index 40ef916..7e5308e 100644
--- a/ogs/userserver/src/Main.cs
+++ b/OGS/userserver/src/Main.cs
@@ -33,6 +33,9 @@ using System.Collections.Generic;
33using System.Text; 33using System.Text;
34using libsecondlife; 34using libsecondlife;
35using ServerConsole; 35using ServerConsole;
36using OpenSim.Framework.User;
37using OpenSim.Framework.Sims;
38using OpenSim.Framework.Inventory;
36 39
37namespace OpenGridServices 40namespace OpenGridServices
38{ 41{
@@ -73,16 +76,17 @@ namespace OpenGridServices
73 public void Startup() { 76 public void Startup() {
74 ServerConsole.MainConsole.Instance.WriteLine("Main.cs:Startup() - Please press enter to retain default settings"); 77 ServerConsole.MainConsole.Instance.WriteLine("Main.cs:Startup() - Please press enter to retain default settings");
75 78
76 this.GridURL=ServerConsole.MainConsole.Instance.CmdPrompt("Grid URL: "); 79 this.GridURL=ServerConsole.MainConsole.Instance.CmdPrompt("Grid URL: ");
77 this.GridSendKey=ServerConsole.MainConsole.Instance.CmdPrompt("Key to send to grid: "); 80 this.GridSendKey=ServerConsole.MainConsole.Instance.CmdPrompt("Key to send to grid: ");
78 this.GridRecvKey=ServerConsole.MainConsole.Instance.CmdPrompt("Key to expect from grid: "); 81 this.GridRecvKey=ServerConsole.MainConsole.Instance.CmdPrompt("Key to expect from grid: ");
79 82
80 this.DefaultStartupMsg=ServerConsole.MainConsole.Instance.CmdPrompt("Default startup message for clients [Welcome to OGS!] :","Welcome to OGS!"); 83 this.DefaultStartupMsg=ServerConsole.MainConsole.Instance.CmdPrompt("Default startup message for clients [Welcome to OGS!] :","Welcome to OGS!");
81 84
82 ServerConsole.MainConsole.Instance.WriteLine("Main.cs:Startup() - Creating user profile manager"); 85 ServerConsole.MainConsole.Instance.WriteLine("Main.cs:Startup() - Creating user profile manager");
83 _profilemanager = new UserProfileManager(); 86 _profilemanager = new UserProfileManager();
84 _profilemanager.InitUserProfiles(); 87 _profilemanager.InitUserProfiles();
85 88 _profilemanager.SetKeys(GridSendKey, GridRecvKey, GridURL, DefaultStartupMsg);
89
86 90
87 string tempfirstname; 91 string tempfirstname;
88 string templastname; 92 string templastname;
diff --git a/ogs/userserver/src/OGS-UserServer.csproj b/OGS/userserver/src/OGS-UserServer.csproj
index f6737c8..f4fa8b6 100644
--- a/ogs/userserver/src/OGS-UserServer.csproj
+++ b/OGS/userserver/src/OGS-UserServer.csproj
@@ -48,21 +48,16 @@
48 <Compile Include="Main.cs" /> 48 <Compile Include="Main.cs" />
49 <Compile Include="Properties\AssemblyInfo.cs" /> 49 <Compile Include="Properties\AssemblyInfo.cs" />
50 <Compile Include="UserHttp.cs" /> 50 <Compile Include="UserHttp.cs" />
51 <Compile Include="UserProfiles.cs" />
52 <Compile Include="Util.cs" />
53 </ItemGroup> 51 </ItemGroup>
54 <ItemGroup> 52 <ItemGroup>
53 <ProjectReference Include="..\..\..\OpenSim.FrameWork\OpenSim.Framework.csproj">
54 <Project>{2E46A825-3168-492F-93BC-637126B5B72B}</Project>
55 <Name>OpenSim.Framework</Name>
56 </ProjectReference>
55 <ProjectReference Include="..\..\ServerConsole\ServerConsole.csproj"> 57 <ProjectReference Include="..\..\ServerConsole\ServerConsole.csproj">
56 <Project>{7667E6E2-F227-41A2-B1B2-315613E1BAFC}</Project> 58 <Project>{7667E6E2-F227-41A2-B1B2-315613E1BAFC}</Project>
57 <Name>ServerConsole</Name> 59 <Name>ServerConsole</Name>
58 </ProjectReference> 60 </ProjectReference>
59 </ItemGroup> 61 </ItemGroup>
60 <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> 62 <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
61 <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
62 Other similar extension points exist, see Microsoft.Common.targets.
63 <Target Name="BeforeBuild">
64 </Target>
65 <Target Name="AfterBuild">
66 </Target>
67 -->
68</Project> \ No newline at end of file 63</Project> \ No newline at end of file
diff --git a/ogs/userserver/src/OGS-UserServer.csproj.user b/OGS/userserver/src/OGS-UserServer.csproj.user
index 9c0b2d9..aa75a3d 100644
--- a/ogs/userserver/src/OGS-UserServer.csproj.user
+++ b/OGS/userserver/src/OGS-UserServer.csproj.user
@@ -1,14 +1,6 @@
1<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> 1<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
2 <PropertyGroup> 2 <PropertyGroup>
3 <PublishUrlHistory>publish\</PublishUrlHistory> 3 <PublishUrlHistory>publish\</PublishUrlHistory>
4 <InstallUrlHistory>
5 </InstallUrlHistory>
6 <SupportUrlHistory>
7 </SupportUrlHistory>
8 <UpdateUrlHistory>
9 </UpdateUrlHistory>
10 <BootstrapperUrlHistory>
11 </BootstrapperUrlHistory>
12 <ApplicationRevision>0</ApplicationRevision> 4 <ApplicationRevision>0</ApplicationRevision>
13 <FallbackCulture>en-US</FallbackCulture> 5 <FallbackCulture>en-US</FallbackCulture>
14 <VerifyUploadedFiles>false</VerifyUploadedFiles> 6 <VerifyUploadedFiles>false</VerifyUploadedFiles>
diff --git a/ogs/userserver/src/Properties/AssemblyInfo.cs b/OGS/userserver/src/Properties/AssemblyInfo.cs
index 5d5ce8d..5d5ce8d 100644
--- a/ogs/userserver/src/Properties/AssemblyInfo.cs
+++ b/OGS/userserver/src/Properties/AssemblyInfo.cs
diff --git a/OGS/userserver/src/UserHttp.cs b/OGS/userserver/src/UserHttp.cs
new file mode 100644
index 0000000..ce3cfcd
--- /dev/null
+++ b/OGS/userserver/src/UserHttp.cs
@@ -0,0 +1,146 @@
1/*
2Copyright (c) OpenGrid project, http://osgrid.org/
3
4
5* All rights reserved.
6*
7* Redistribution and use in source and binary forms, with or without
8* modification, are permitted provided that the following conditions are met:
9* * Redistributions of source code must retain the above copyright
10* notice, this list of conditions and the following disclaimer.
11* * Redistributions in binary form must reproduce the above copyright
12* notice, this list of conditions and the following disclaimer in the
13* documentation and/or other materials provided with the distribution.
14* * Neither the name of the <organization> nor the
15* names of its contributors may be used to endorse or promote products
16* derived from this software without specific prior written permission.
17*
18* THIS SOFTWARE IS PROVIDED BY <copyright holder> ``AS IS'' AND ANY
19* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
20* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21* DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY
22* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
24* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
25* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
27* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28*/
29
30using System;
31using System.Text;
32using Nwc.XmlRpc;
33using System.Threading;
34using System.Text.RegularExpressions;
35using System.Net;
36using System.IO;
37using System.Collections;
38using System.Collections.Generic;
39using libsecondlife;
40using ServerConsole;
41using OpenSim.Framework.User;
42using OpenSim.Framework.Sims;
43using OpenSim.Framework.Inventory;
44
45namespace OpenGridServices
46{
47 public class UserHTTPServer {
48 public Thread HTTPD;
49 public HttpListener Listener;
50
51 public UserHTTPServer() {
52 ServerConsole.MainConsole.Instance.WriteLine("Starting up HTTP Server");
53 HTTPD = new Thread(new ThreadStart(StartHTTP));
54 HTTPD.Start();
55 }
56
57 public void StartHTTP() {
58 ServerConsole.MainConsole.Instance.WriteLine("UserHttp.cs:StartHTTP() - Spawned main thread OK");
59 Listener = new HttpListener();
60
61 Listener.Prefixes.Add("http://+:8002/userserver/");
62 Listener.Prefixes.Add("http://+:8002/usersessions/");
63 Listener.Start();
64
65 HttpListenerContext context;
66 while(true) {
67 context = Listener.GetContext();
68 ThreadPool.QueueUserWorkItem(new WaitCallback(HandleRequest), context);
69 }
70 }
71
72 static string ParseXMLRPC(string requestBody) {
73 return OpenGridServices.OpenUser_Main.userserver._profilemanager.ParseXMLRPC(requestBody);
74 }
75
76 static string ParseREST(HttpListenerRequest www_req) {
77 Console.WriteLine("INCOMING REST - " + www_req.RawUrl);
78
79 char[] splitter = {'/'};
80 string[] rest_params = www_req.RawUrl.Split(splitter);
81 string req_type = rest_params[1]; // First part of the URL is the type of request - usersessions/userprofiles/inventory/blabla
82 switch(req_type) {
83 case "usersessions":
84 LLUUID sessionid = new LLUUID(rest_params[2]); // get usersessions/sessionid
85 if(www_req.HttpMethod=="DELETE") {
86 foreach (libsecondlife.LLUUID UUID in OpenUser_Main.userserver._profilemanager.UserProfiles.Keys) {
87 if(OpenUser_Main.userserver._profilemanager.UserProfiles[UUID].CurrentSessionID==sessionid) {
88 OpenUser_Main.userserver._profilemanager.UserProfiles[UUID].CurrentSessionID=null;
89 OpenUser_Main.userserver._profilemanager.UserProfiles[UUID].CurrentSecureSessionID=null;
90 OpenUser_Main.userserver._profilemanager.UserProfiles[UUID].Circuits.Clear();
91 }
92 }
93
94 }
95 return "OK";
96 break;
97 }
98
99 return "";
100 }
101
102
103 static void HandleRequest(Object stateinfo) {
104 HttpListenerContext context=(HttpListenerContext)stateinfo;
105
106 HttpListenerRequest request = context.Request;
107 HttpListenerResponse response = context.Response;
108
109 response.KeepAlive=false;
110 response.SendChunked=false;
111
112 System.IO.Stream body = request.InputStream;
113 System.Text.Encoding encoding = System.Text.Encoding.UTF8;
114 System.IO.StreamReader reader = new System.IO.StreamReader(body, encoding);
115
116 string requestBody = reader.ReadToEnd();
117 body.Close();
118 reader.Close();
119
120 string responseString="";
121 switch(request.ContentType) {
122 case "text/xml":
123 // must be XML-RPC, so pass to the XML-RPC parser
124
125 responseString=ParseXMLRPC(requestBody);
126 response.AddHeader("Content-type","text/xml");
127 break;
128
129 case "text/plaintext":
130 responseString=ParseREST(request);
131 response.AddHeader("Content-type","text/plaintext");
132 break;
133 }
134
135
136 byte[] buffer = System.Text.Encoding.UTF8.GetBytes(responseString);
137 System.IO.Stream output = response.OutputStream;
138 response.SendChunked=false;
139 response.ContentLength64=buffer.Length;
140 output.Write(buffer,0,buffer.Length);
141 output.Close();
142 }
143 }
144
145
146}
diff --git a/OpenSim.Config/SimConfigDb4o/AssemblyInfo.cs b/OpenSim.Config/SimConfigDb4o/AssemblyInfo.cs
new file mode 100644
index 0000000..96c3e73
--- /dev/null
+++ b/OpenSim.Config/SimConfigDb4o/AssemblyInfo.cs
@@ -0,0 +1,31 @@
1using System.Reflection;
2using System.Runtime.CompilerServices;
3using System.Runtime.InteropServices;
4
5// Information about this assembly is defined by the following
6// attributes.
7//
8// change them to the information which is associated with the assembly
9// you compile.
10
11[assembly: AssemblyTitle("SimConfig")]
12[assembly: AssemblyDescription("")]
13[assembly: AssemblyConfiguration("")]
14[assembly: AssemblyCompany("")]
15[assembly: AssemblyProduct("SimConfig")]
16[assembly: AssemblyCopyright("")]
17[assembly: AssemblyTrademark("")]
18[assembly: AssemblyCulture("")]
19
20// This sets the default COM visibility of types in the assembly to invisible.
21// If you need to expose a type to COM, use [ComVisible(true)] on that type.
22[assembly: ComVisible(false)]
23
24// The assembly version has following format :
25//
26// Major.Minor.Build.Revision
27//
28// You can specify all values by your own or you can build default build and revision
29// numbers with the '*' character (the default):
30
31[assembly: AssemblyVersion("1.0.*")]
diff --git a/OpenSim.Config/SimConfigDb4o/DbSimConfig.cs b/OpenSim.Config/SimConfigDb4o/DbSimConfig.cs
new file mode 100644
index 0000000..250f3fd
--- /dev/null
+++ b/OpenSim.Config/SimConfigDb4o/DbSimConfig.cs
@@ -0,0 +1,176 @@
1/*
2* Copyright (c) OpenSim project, http://sim.opensecondlife.org/
3*
4* Redistribution and use in source and binary forms, with or without
5* modification, are permitted provided that the following conditions are met:
6* * Redistributions of source code must retain the above copyright
7* notice, this list of conditions and the following disclaimer.
8* * Redistributions in binary form must reproduce the above copyright
9* notice, this list of conditions and the following disclaimer in the
10* documentation and/or other materials provided with the distribution.
11* * Neither the name of the <organization> nor the
12* names of its contributors may be used to endorse or promote products
13* derived from this software without specific prior written permission.
14*
15* THIS SOFTWARE IS PROVIDED BY <copyright holder> ``AS IS'' AND ANY
16* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
18* DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY
19* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
20* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
21* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
22* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
24* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25*
26*/
27using System;
28using System.Collections.Generic;
29using OpenSim;
30using OpenSim.Framework.Utilities;
31using OpenSim.Framework.Interfaces;
32using OpenSim.Framework.Terrain;
33//using OpenSim.world;
34using Db4objects.Db4o;
35
36namespace OpenSim.Config.SimConfigDb4o
37{
38 public class Db40ConfigPlugin: ISimConfig
39 {
40 public SimConfig GetConfigObject()
41 {
42 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Loading Db40Config dll");
43 return ( new DbSimConfig());
44 }
45 }
46
47 public class DbSimConfig : SimConfig
48 {
49 private bool isSandbox;
50 private IObjectContainer db;
51
52 public void LoadDefaults() {
53 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Config.cs:LoadDefaults() - Please press enter to retain default or enter new settings");
54
55 this.RegionName=OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("Name [OpenSim test]: ","OpenSim test");
56 this.RegionLocX=(uint)Convert.ToInt32(OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("Grid Location X [997]: ","997"));
57 this.RegionLocY=(uint)Convert.ToInt32(OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("Grid Location Y [996]: ","996"));
58 this.IPListenPort=Convert.ToInt32(OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("UDP port for client connections [9000]: ","9000"));
59 this.IPListenAddr=OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("IP Address to listen on for client connections [127.0.0.1]: ","127.0.0.1");
60
61 if(!isSandbox)
62 {
63 this.AssetURL=OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("Asset server URL: ");
64 this.AssetSendKey=OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("Asset server key: ");
65 this.GridURL=OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("Grid server URL: ");
66 this.GridSendKey = OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("Key to send to grid server: ");
67 this.GridRecvKey = OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("Key to expect from grid server: ");
68 this.UserURL = OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("User server URL: ");
69 this.UserSendKey = OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("Key to send to user server: ");
70 this.UserRecvKey = OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("Key to expect from user server: ");
71 }
72 this.RegionHandle = Util.UIntsToLong((RegionLocX*256), (RegionLocY*256));
73 }
74
75 public override void InitConfig(bool sandboxMode) {
76 this.isSandbox = sandboxMode;
77 try {
78 db = Db4oFactory.OpenFile("opensim.yap");
79 IObjectSet result = db.Get(typeof(DbSimConfig));
80 if(result.Count==1) {
81 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Config.cs:InitConfig() - Found a SimConfig object in the local database, loading");
82 foreach (DbSimConfig cfg in result) {
83 this.RegionName = cfg.RegionName;
84 this.RegionLocX = cfg.RegionLocX;
85 this.RegionLocY = cfg.RegionLocY;
86 this.RegionHandle = Util.UIntsToLong((RegionLocX*256), (RegionLocY*256));
87 this.IPListenPort = cfg.IPListenPort;
88 this.IPListenAddr = cfg.IPListenAddr;
89 this.AssetURL = cfg.AssetURL;
90 this.AssetSendKey = cfg.AssetSendKey;
91 this.GridURL = cfg.GridURL;
92 this.GridSendKey = cfg.GridSendKey;
93 }
94 } else {
95 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Config.cs:InitConfig() - Could not find object in database, loading precompiled defaults");
96 LoadDefaults();
97 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Writing out default settings to local database");
98 db.Set(this);
99 }
100 } catch(Exception e) {
101 db.Close();
102 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Config.cs:InitConfig() - Exception occured");
103 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(e.ToString());
104 }
105
106 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Sim settings loaded:");
107 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Name: " + this.RegionName);
108 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Region Location: [" + this.RegionLocX.ToString() + "," + this.RegionLocY + "]");
109 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Region Handle: " + this.RegionHandle.ToString());
110 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Listening on IP: " + this.IPListenAddr + ":" + this.IPListenPort);
111 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Sandbox Mode? " + isSandbox.ToString());
112 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Asset URL: " + this.AssetURL);
113 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Asset key: " + this.AssetSendKey);
114 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Grid URL: " + this.GridURL);
115 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Grid key: " + this.GridSendKey);
116 }
117
118 public override float[] LoadWorld()
119 {
120 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Config.cs:LoadWorld() - Loading world....");
121 //World blank = new World();
122 float[] heightmap = null;
123 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Config.cs:LoadWorld() - Looking for a heightmap in local DB");
124 IObjectSet world_result = db.Get(typeof(MapStorage));
125 if(world_result.Count>0) {
126 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Config.cs:LoadWorld() - Found a heightmap in local database, loading");
127 MapStorage map=(MapStorage)world_result.Next();
128 //blank.LandMap = map.Map;
129 heightmap = map.Map;
130 } else {
131 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Config.cs:LoadWorld() - No heightmap found, generating new one");
132 HeightmapGenHills hills = new HeightmapGenHills();
133 // blank.LandMap = hills.GenerateHeightmap(200, 4.0f, 80.0f, false);
134 heightmap = hills.GenerateHeightmap(200, 4.0f, 80.0f, false);
135 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Config.cs:LoadWorld() - Saving heightmap to local database");
136 MapStorage map= new MapStorage();
137 map.Map = heightmap; //blank.LandMap;
138 db.Set(map);
139 db.Commit();
140 }
141 return heightmap;
142 }
143
144 public override void SaveMap(float[] heightmap)
145 {
146 IObjectSet world_result = db.Get(typeof(MapStorage));
147 if(world_result.Count>0) {
148 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Config.cs:LoadWorld() - updating saved copy of heightmap in local database");
149 MapStorage map=(MapStorage)world_result.Next();
150 db.Delete(map);
151 }
152 MapStorage map1= new MapStorage();
153 map1.Map = heightmap; //OpenSim_Main.local_world.LandMap;
154 db.Set(map1);
155 db.Commit();
156 }
157
158 public override void LoadFromGrid() {
159 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Config.cs:LoadFromGrid() - dummy function, DOING ABSOLUTELY NOTHING AT ALL!!!");
160 // TODO: Make this crap work
161 /* WebRequest GridLogin = WebRequest.Create(this.GridURL + "regions/" + this.RegionHandle.ToString() + "/login");
162 WebResponse GridResponse = GridLogin.GetResponse();
163 byte[] idata = new byte[(int)GridResponse.ContentLength];
164 BinaryReader br = new BinaryReader(GridResponse.GetResponseStream());
165
166 br.Close();
167 GridResponse.Close();
168 */
169 }
170
171 public void Shutdown() {
172 db.Close();
173 }
174 }
175
176}
diff --git a/OpenSim.Config/SimConfigDb4o/MapStorage.cs b/OpenSim.Config/SimConfigDb4o/MapStorage.cs
new file mode 100644
index 0000000..eb68a94
--- /dev/null
+++ b/OpenSim.Config/SimConfigDb4o/MapStorage.cs
@@ -0,0 +1,16 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4
5namespace OpenSim.Config.SimConfigDb4o
6{
7 public class MapStorage
8 {
9 public float[] Map;
10
11 public MapStorage()
12 {
13
14 }
15 }
16}
diff --git a/OpenSim.Config/SimConfigDb4o/OpenSim.Config.SimConfigDb4o.csproj b/OpenSim.Config/SimConfigDb4o/OpenSim.Config.SimConfigDb4o.csproj
new file mode 100644
index 0000000..02f626f
--- /dev/null
+++ b/OpenSim.Config/SimConfigDb4o/OpenSim.Config.SimConfigDb4o.csproj
@@ -0,0 +1,107 @@
1<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
2 <PropertyGroup>
3 <ProjectType>Local</ProjectType>
4 <ProductVersion>8.0.50727</ProductVersion>
5 <SchemaVersion>2.0</SchemaVersion>
6 <ProjectGuid>{C077B28B-2F8D-4BD9-8E47-84C51B3A7358}</ProjectGuid>
7 <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
8 <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
9 <ApplicationIcon></ApplicationIcon>
10 <AssemblyKeyContainerName>
11 </AssemblyKeyContainerName>
12 <AssemblyName>OpenSim.Config.SimConfigDb4o</AssemblyName>
13 <DefaultClientScript>JScript</DefaultClientScript>
14 <DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout>
15 <DefaultTargetSchema>IE50</DefaultTargetSchema>
16 <DelaySign>false</DelaySign>
17 <OutputType>Library</OutputType>
18 <AppDesignerFolder></AppDesignerFolder>
19 <RootNamespace>OpenSim.Config.SimConfigDb4o</RootNamespace>
20 <StartupObject></StartupObject>
21 <FileUpgradeFlags>
22 </FileUpgradeFlags>
23 </PropertyGroup>
24 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
25 <AllowUnsafeBlocks>False</AllowUnsafeBlocks>
26 <BaseAddress>285212672</BaseAddress>
27 <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
28 <ConfigurationOverrideFile>
29 </ConfigurationOverrideFile>
30 <DefineConstants>TRACE;DEBUG</DefineConstants>
31 <DocumentationFile></DocumentationFile>
32 <DebugSymbols>True</DebugSymbols>
33 <FileAlignment>4096</FileAlignment>
34 <Optimize>False</Optimize>
35 <OutputPath>..\..\bin\</OutputPath>
36 <RegisterForComInterop>False</RegisterForComInterop>
37 <RemoveIntegerChecks>False</RemoveIntegerChecks>
38 <TreatWarningsAsErrors>False</TreatWarningsAsErrors>
39 <WarningLevel>4</WarningLevel>
40 <NoWarn></NoWarn>
41 </PropertyGroup>
42 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
43 <AllowUnsafeBlocks>False</AllowUnsafeBlocks>
44 <BaseAddress>285212672</BaseAddress>
45 <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
46 <ConfigurationOverrideFile>
47 </ConfigurationOverrideFile>
48 <DefineConstants>TRACE</DefineConstants>
49 <DocumentationFile></DocumentationFile>
50 <DebugSymbols>False</DebugSymbols>
51 <FileAlignment>4096</FileAlignment>
52 <Optimize>True</Optimize>
53 <OutputPath>..\..\bin\</OutputPath>
54 <RegisterForComInterop>False</RegisterForComInterop>
55 <RemoveIntegerChecks>False</RemoveIntegerChecks>
56 <TreatWarningsAsErrors>False</TreatWarningsAsErrors>
57 <WarningLevel>4</WarningLevel>
58 <NoWarn></NoWarn>
59 </PropertyGroup>
60 <ItemGroup>
61 <Reference Include="System" >
62 <HintPath>\System.dll</HintPath>
63 </Reference>
64 <Reference Include="System.Data.dll" >
65 <HintPath>\System.Data.dll.dll</HintPath>
66 </Reference>
67 <Reference Include="System.Xml.dll" >
68 <HintPath>\System.Xml.dll.dll</HintPath>
69 </Reference>
70 <Reference Include="libsecondlife.dll" >
71 <HintPath>\libsecondlife.dll.dll</HintPath>
72 </Reference>
73 <Reference Include="Db4objects.Db4o.dll" >
74 <HintPath>\Db4objects.Db4o.dll.dll</HintPath>
75 </Reference>
76 </ItemGroup>
77 <ItemGroup>
78 <ProjectReference Include="..\..\OpenSim.Framework\OpenSim.Framework.csproj">
79 <Name>OpenSim.Framework</Name>
80 <Project>{1D2865A9-CF8E-45F7-B96D-91ED128A32CF}</Project>
81 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
82 </ProjectReference>
83 <ProjectReference Include="..\..\OpenSim.Framework.Console\OpenSim.Framework.Console.csproj">
84 <Name>OpenSim.Framework.Console</Name>
85 <Project>{C8405E1A-EC19-48B6-9C8C-CA03624B9916}</Project>
86 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
87 </ProjectReference>
88 </ItemGroup>
89 <ItemGroup>
90 <Compile Include="AssemblyInfo.cs">
91 <SubType>Code</SubType>
92 </Compile>
93 <Compile Include="DbSimConfig.cs">
94 <SubType>Code</SubType>
95 </Compile>
96 <Compile Include="MapStorage.cs">
97 <SubType>Code</SubType>
98 </Compile>
99 </ItemGroup>
100 <Import Project="$(MSBuildBinPath)\Microsoft.CSHARP.Targets" />
101 <PropertyGroup>
102 <PreBuildEvent>
103 </PreBuildEvent>
104 <PostBuildEvent>
105 </PostBuildEvent>
106 </PropertyGroup>
107</Project>
diff --git a/OpenSim.Config/SimConfigDb4o/OpenSim.Config.SimConfigDb4o.dll.build b/OpenSim.Config/SimConfigDb4o/OpenSim.Config.SimConfigDb4o.dll.build
new file mode 100644
index 0000000..288e877
--- /dev/null
+++ b/OpenSim.Config/SimConfigDb4o/OpenSim.Config.SimConfigDb4o.dll.build
@@ -0,0 +1,47 @@
1<?xml version="1.0" ?>
2<project name="OpenSim.Config.SimConfigDb4o" default="build">
3 <target name="build">
4 <echo message="Build Directory is ${project::get-base-directory()}/${build.dir}" />
5 <mkdir dir="${project::get-base-directory()}/${build.dir}" />
6 <copy todir="${project::get-base-directory()}/${build.dir}">
7 <fileset basedir="${project::get-base-directory()}">
8 </fileset>
9 </copy>
10 <csc target="library" debug="${build.debug}" unsafe="False" define="TRACE;DEBUG" output="${project::get-base-directory()}/${build.dir}/${project::get-name()}.dll">
11 <resources prefix="OpenSim.Config.SimConfigDb4o" dynamicprefix="true" >
12 </resources>
13 <sources failonempty="true">
14 <include name="AssemblyInfo.cs" />
15 <include name="DbSimConfig.cs" />
16 <include name="MapStorage.cs" />
17 </sources>
18 <references basedir="${project::get-base-directory()}">
19 <lib>
20 <include name="${project::get-base-directory()}" />
21 <include name="${project::get-base-directory()}/${build.dir}" />
22 </lib>
23 <include name="System.dll" />
24 <include name="System.Data.dll.dll" />
25 <include name="System.Xml.dll.dll" />
26 <include name="../../bin/libsecondlife.dll" />
27 <include name="../../bin/Db4objects.Db4o.dll" />
28 <include name="../../OpenSim.Framework/${build.dir}/OpenSim.Framework.dll" />
29 <include name="../../OpenSim.Framework.Console/${build.dir}/OpenSim.Framework.Console.dll" />
30 </references>
31 </csc>
32 <echo message="Copying from [${project::get-base-directory()}/${build.dir}/] to [${project::get-base-directory()}/../../bin/" />
33 <mkdir dir="${project::get-base-directory()}/../../bin/"/>
34 <copy todir="${project::get-base-directory()}/../../bin/">
35 <fileset basedir="${project::get-base-directory()}/${build.dir}/" >
36 <include name="*.dll"/>
37 <include name="*.exe"/>
38 </fileset>
39 </copy>
40 </target>
41 <target name="clean">
42 <delete dir="${bin.dir}" failonerror="false" />
43 <delete dir="${obj.dir}" failonerror="false" />
44 </target>
45 <target name="doc" description="Creates documentation.">
46 </target>
47</project>
diff --git a/OpenSim.Framework.Console/AssemblyInfo.cs b/OpenSim.Framework.Console/AssemblyInfo.cs
new file mode 100644
index 0000000..00a9b7d
--- /dev/null
+++ b/OpenSim.Framework.Console/AssemblyInfo.cs
@@ -0,0 +1,31 @@
1using System.Reflection;
2using System.Runtime.CompilerServices;
3using System.Runtime.InteropServices;
4
5// Information about this assembly is defined by the following
6// attributes.
7//
8// change them to the information which is associated with the assembly
9// you compile.
10
11[assembly: AssemblyTitle("ServerConsole")]
12[assembly: AssemblyDescription("")]
13[assembly: AssemblyConfiguration("")]
14[assembly: AssemblyCompany("")]
15[assembly: AssemblyProduct("ServerConsole")]
16[assembly: AssemblyCopyright("")]
17[assembly: AssemblyTrademark("")]
18[assembly: AssemblyCulture("")]
19
20// This sets the default COM visibility of types in the assembly to invisible.
21// If you need to expose a type to COM, use [ComVisible(true)] on that type.
22[assembly: ComVisible(false)]
23
24// The assembly version has following format :
25//
26// Major.Minor.Build.Revision
27//
28// You can specify all values by your own or you can build default build and revision
29// numbers with the '*' character (the default):
30
31[assembly: AssemblyVersion("1.0.*")]
diff --git a/OpenSim.Framework.Console/ConsoleBase.cs b/OpenSim.Framework.Console/ConsoleBase.cs
new file mode 100644
index 0000000..5343e71
--- /dev/null
+++ b/OpenSim.Framework.Console/ConsoleBase.cs
@@ -0,0 +1,45 @@
1using System;
2
3namespace OpenSim.Framework.Console
4{
5 public abstract class ConsoleBase
6 {
7
8 public enum ConsoleType
9 {
10 Local, // Use stdio
11 TCP, // Use TCP/telnet
12 SimChat // Use in-world chat (for gods)
13 }
14
15 public abstract void Close();
16
17 public abstract void Write(string format, params object[] args);
18
19 public abstract void WriteLine(string format, params object[] args);
20
21 public abstract string ReadLine();
22
23 public abstract int Read();
24
25 // Displays a command prompt and waits for the user to enter a string, then returns that string
26 public abstract string CmdPrompt(string prompt);
27
28 // Displays a command prompt and returns a default value if the user simply presses enter
29 public abstract string CmdPrompt(string prompt, string defaultresponse);
30
31 // Displays a command prompt and returns a default value, user may only enter 1 of 2 options
32 public abstract string CmdPrompt(string prompt, string defaultresponse, string OptionA, string OptionB);
33
34 // Runs a command with a number of parameters
35 public abstract Object RunCmd(string Cmd, string[] cmdparams);
36
37 // Shows data about something
38 public abstract void ShowCommands(string ShowWhat);
39
40 // Displays a prompt to the user and then runs the command they entered
41 public abstract void MainConsolePrompt();
42
43 public abstract void SetStatus(string status);
44 }
45}
diff --git a/src/VersionInfo.cs.template b/OpenSim.Framework.Console/MainConsole.cs
index e4e1b95..02c4ae8 100644
--- a/src/VersionInfo.cs.template
+++ b/OpenSim.Framework.Console/MainConsole.cs
@@ -1,5 +1,5 @@
1/* 1/*
2Copyright (c) OpenSim project, http://osgrid.org/ 2* Copyright (c) OpenSim project, http://sim.opensecondlife.org/
3* 3*
4* Redistribution and use in source and binary forms, with or without 4* Redistribution and use in source and binary forms, with or without
5* modification, are permitted provided that the following conditions are met: 5* modification, are permitted provided that the following conditions are met:
@@ -22,16 +22,27 @@ Copyright (c) OpenSim project, http://osgrid.org/
22* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 23* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
24* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25*
25*/ 26*/
26
27using System; 27using System;
28 28
29namespace OpenSim 29namespace OpenSim.Framework.Console
30{ 30{
31 /// <summary> 31 public class MainConsole {
32 /// </summary> 32
33 public class VersionInfo 33 private static ConsoleBase instance;
34 { 34
35 public static string Version = "@@VERSION"; 35 public static ConsoleBase Instance
36 } 36 {
37 get
38 {
39 return instance;
40 }
41 set
42 {
43 instance = value;
44 }
45 }
46 }
47
37} 48}
diff --git a/OpenSim.Framework.Console/OpenSim.Framework.Console.csproj b/OpenSim.Framework.Console/OpenSim.Framework.Console.csproj
new file mode 100644
index 0000000..1f0da56
--- /dev/null
+++ b/OpenSim.Framework.Console/OpenSim.Framework.Console.csproj
@@ -0,0 +1,85 @@
1<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
2 <PropertyGroup>
3 <ProjectType>Local</ProjectType>
4 <ProductVersion>8.0.50727</ProductVersion>
5 <SchemaVersion>2.0</SchemaVersion>
6 <ProjectGuid>{C8405E1A-EC19-48B6-9C8C-CA03624B9916}</ProjectGuid>
7 <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
8 <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
9 <ApplicationIcon></ApplicationIcon>
10 <AssemblyKeyContainerName>
11 </AssemblyKeyContainerName>
12 <AssemblyName>OpenSim.Framework.Console</AssemblyName>
13 <DefaultClientScript>JScript</DefaultClientScript>
14 <DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout>
15 <DefaultTargetSchema>IE50</DefaultTargetSchema>
16 <DelaySign>false</DelaySign>
17 <OutputType>Library</OutputType>
18 <AppDesignerFolder></AppDesignerFolder>
19 <RootNamespace>OpenSim.Framework.Console</RootNamespace>
20 <StartupObject></StartupObject>
21 <FileUpgradeFlags>
22 </FileUpgradeFlags>
23 </PropertyGroup>
24 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
25 <AllowUnsafeBlocks>False</AllowUnsafeBlocks>
26 <BaseAddress>285212672</BaseAddress>
27 <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
28 <ConfigurationOverrideFile>
29 </ConfigurationOverrideFile>
30 <DefineConstants>TRACE;DEBUG</DefineConstants>
31 <DocumentationFile></DocumentationFile>
32 <DebugSymbols>True</DebugSymbols>
33 <FileAlignment>4096</FileAlignment>
34 <Optimize>False</Optimize>
35 <OutputPath>..\bin\</OutputPath>
36 <RegisterForComInterop>False</RegisterForComInterop>
37 <RemoveIntegerChecks>False</RemoveIntegerChecks>
38 <TreatWarningsAsErrors>False</TreatWarningsAsErrors>
39 <WarningLevel>4</WarningLevel>
40 <NoWarn></NoWarn>
41 </PropertyGroup>
42 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
43 <AllowUnsafeBlocks>False</AllowUnsafeBlocks>
44 <BaseAddress>285212672</BaseAddress>
45 <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
46 <ConfigurationOverrideFile>
47 </ConfigurationOverrideFile>
48 <DefineConstants>TRACE</DefineConstants>
49 <DocumentationFile></DocumentationFile>
50 <DebugSymbols>False</DebugSymbols>
51 <FileAlignment>4096</FileAlignment>
52 <Optimize>True</Optimize>
53 <OutputPath>..\bin\</OutputPath>
54 <RegisterForComInterop>False</RegisterForComInterop>
55 <RemoveIntegerChecks>False</RemoveIntegerChecks>
56 <TreatWarningsAsErrors>False</TreatWarningsAsErrors>
57 <WarningLevel>4</WarningLevel>
58 <NoWarn></NoWarn>
59 </PropertyGroup>
60 <ItemGroup>
61 <Reference Include="System" >
62 <HintPath>\System.dll</HintPath>
63 </Reference>
64 </ItemGroup>
65 <ItemGroup>
66 </ItemGroup>
67 <ItemGroup>
68 <Compile Include="AssemblyInfo.cs">
69 <SubType>Code</SubType>
70 </Compile>
71 <Compile Include="ConsoleBase.cs">
72 <SubType>Code</SubType>
73 </Compile>
74 <Compile Include="MainConsole.cs">
75 <SubType>Code</SubType>
76 </Compile>
77 </ItemGroup>
78 <Import Project="$(MSBuildBinPath)\Microsoft.CSHARP.Targets" />
79 <PropertyGroup>
80 <PreBuildEvent>
81 </PreBuildEvent>
82 <PostBuildEvent>
83 </PostBuildEvent>
84 </PropertyGroup>
85</Project>
diff --git a/OpenSim.Framework.Console/OpenSim.Framework.Console.dll.build b/OpenSim.Framework.Console/OpenSim.Framework.Console.dll.build
new file mode 100644
index 0000000..9ceaea6
--- /dev/null
+++ b/OpenSim.Framework.Console/OpenSim.Framework.Console.dll.build
@@ -0,0 +1,41 @@
1<?xml version="1.0" ?>
2<project name="OpenSim.Framework.Console" default="build">
3 <target name="build">
4 <echo message="Build Directory is ${project::get-base-directory()}/${build.dir}" />
5 <mkdir dir="${project::get-base-directory()}/${build.dir}" />
6 <copy todir="${project::get-base-directory()}/${build.dir}">
7 <fileset basedir="${project::get-base-directory()}">
8 </fileset>
9 </copy>
10 <csc target="library" debug="${build.debug}" unsafe="False" define="TRACE;DEBUG" output="${project::get-base-directory()}/${build.dir}/${project::get-name()}.dll">
11 <resources prefix="OpenSim.Framework.Console" dynamicprefix="true" >
12 </resources>
13 <sources failonempty="true">
14 <include name="AssemblyInfo.cs" />
15 <include name="ConsoleBase.cs" />
16 <include name="MainConsole.cs" />
17 </sources>
18 <references basedir="${project::get-base-directory()}">
19 <lib>
20 <include name="${project::get-base-directory()}" />
21 <include name="${project::get-base-directory()}/${build.dir}" />
22 </lib>
23 <include name="System.dll" />
24 </references>
25 </csc>
26 <echo message="Copying from [${project::get-base-directory()}/${build.dir}/] to [${project::get-base-directory()}/../bin/" />
27 <mkdir dir="${project::get-base-directory()}/../bin/"/>
28 <copy todir="${project::get-base-directory()}/../bin/">
29 <fileset basedir="${project::get-base-directory()}/${build.dir}/" >
30 <include name="*.dll"/>
31 <include name="*.exe"/>
32 </fileset>
33 </copy>
34 </target>
35 <target name="clean">
36 <delete dir="${bin.dir}" failonerror="false" />
37 <delete dir="${obj.dir}" failonerror="false" />
38 </target>
39 <target name="doc" description="Creates documentation.">
40 </target>
41</project>
diff --git a/OpenSim.Framework/AgentCiruitData.cs b/OpenSim.Framework/AgentCiruitData.cs
new file mode 100644
index 0000000..3ab8a80
--- /dev/null
+++ b/OpenSim.Framework/AgentCiruitData.cs
@@ -0,0 +1,18 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4using libsecondlife;
5
6namespace OpenSim.Framework.Interfaces
7{
8 public class AgentCircuitData
9 {
10 public AgentCircuitData() { }
11 public LLUUID AgentID;
12 public LLUUID SessionID;
13 public LLUUID SecureSessionID;
14 public string firstname;
15 public string lastname;
16 public uint circuitcode;
17 }
18}
diff --git a/OpenSim.Framework/AssetBase.cs b/OpenSim.Framework/AssetBase.cs
new file mode 100644
index 0000000..8206b30
--- /dev/null
+++ b/OpenSim.Framework/AssetBase.cs
@@ -0,0 +1,22 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4using libsecondlife;
5
6namespace OpenSim.Framework.Assets
7{
8 public class AssetBase
9 {
10 public byte[] Data;
11 public LLUUID FullID;
12 public sbyte Type;
13 public sbyte InvType;
14 public string Name;
15 public string Description;
16
17 public AssetBase()
18 {
19
20 }
21 }
22}
diff --git a/OpenSim.Framework/BlockingQueue.cs b/OpenSim.Framework/BlockingQueue.cs
new file mode 100644
index 0000000..f840354
--- /dev/null
+++ b/OpenSim.Framework/BlockingQueue.cs
@@ -0,0 +1,33 @@
1using System;
2using System.Threading;
3using System.Collections.Generic;
4using System.Text;
5
6namespace OpenSim.Framework.Utilities
7{
8 public class BlockingQueue<T>
9 {
10 private Queue<T> _queue = new Queue<T>();
11 private object _queueSync = new object();
12
13 public void Enqueue(T value)
14 {
15 lock (_queueSync)
16 {
17 _queue.Enqueue(value);
18 Monitor.Pulse(_queueSync);
19 }
20 }
21
22 public T Dequeue()
23 {
24 lock (_queueSync)
25 {
26 if (_queue.Count < 1)
27 Monitor.Wait(_queueSync);
28
29 return _queue.Dequeue();
30 }
31 }
32 }
33}
diff --git a/src/HeightMapGenHills.cs b/OpenSim.Framework/HeightMapGenHills.cs
index e7589af..6a729da 100644
--- a/src/HeightMapGenHills.cs
+++ b/OpenSim.Framework/HeightMapGenHills.cs
@@ -27,7 +27,7 @@
27 27
28using System; 28using System;
29 29
30namespace OpenSim 30namespace OpenSim.Framework.Terrain
31{ 31{
32 public class HeightmapGenHills 32 public class HeightmapGenHills
33 { 33 {
diff --git a/src/GridInterfaces/IAssetServer.cs b/OpenSim.Framework/IAssetServer.cs
index 6050a6c..a0de548 100644
--- a/src/GridInterfaces/IAssetServer.cs
+++ b/OpenSim.Framework/IAssetServer.cs
@@ -30,53 +30,39 @@ using System.Net.Sockets;
30using System.IO; 30using System.IO;
31using System.Threading; 31using System.Threading;
32using libsecondlife; 32using libsecondlife;
33using OpenSim.Framework.Assets;
33 34
34 35namespace OpenSim.Framework.Interfaces
35namespace OpenSim.GridServers
36{ 36{
37 /// <summary> 37 /// <summary>
38 /// Description of IAssetServer. 38 /// Description of IAssetServer.
39 /// </summary> 39 /// </summary>
40 40
41 public interface IAssetServer 41 public interface IAssetServer
42 { 42 {
43 void SetReceiver(IAssetReceiver receiver); 43 void SetReceiver(IAssetReceiver receiver);
44 void RequestAsset(LLUUID assetID, bool isTexture); 44 void RequestAsset(LLUUID assetID, bool isTexture);
45 void UpdateAsset(AssetBase asset); 45 void UpdateAsset(AssetBase asset);
46 void UploadNewAsset(AssetBase asset); 46 void UploadNewAsset(AssetBase asset);
47 void SetServerInfo(string ServerUrl, string ServerKey); 47 void SetServerInfo(string ServerUrl, string ServerKey);
48 } 48 void Close();
49 49 }
50 // could change to delegate? 50
51 public interface IAssetReceiver 51 // could change to delegate?
52 { 52 public interface IAssetReceiver
53 void AssetReceived(AssetBase asset, bool IsTexture); 53 {
54 void AssetNotFound(AssetBase asset); 54 void AssetReceived(AssetBase asset, bool IsTexture);
55 } 55 void AssetNotFound(AssetBase asset);
56 56 }
57 public struct ARequest 57
58 { 58 public interface IAssetPlugin
59 public LLUUID AssetID; 59 {
60 public bool IsTexture; 60 IAssetServer GetAssetServer();
61 } 61 }
62 62
63 public class AssetBase 63 public struct ARequest
64 { 64 {
65 public byte[] Data; 65 public LLUUID AssetID;
66 public LLUUID FullID; 66 public bool IsTexture;
67 public sbyte Type; 67 }
68 public sbyte InvType;
69 public string Name;
70 public string Description;
71
72 public AssetBase()
73 {
74
75 }
76 }
77
78 public interface IAssetPlugin
79 {
80 IAssetServer GetAssetServer();
81 }
82} 68}
diff --git a/src/Config.cs b/OpenSim.Framework/IConfig.cs
index 1c0a6cc..ca7f645 100644
--- a/src/Config.cs
+++ b/OpenSim.Framework/IConfig.cs
@@ -31,49 +31,48 @@ using System;
31using System.Collections.Generic; 31using System.Collections.Generic;
32using System.IO; 32using System.IO;
33using libsecondlife; 33using libsecondlife;
34using OpenSim.world; 34//using OpenSim.world;
35 35
36namespace OpenSim 36namespace OpenSim.Framework.Interfaces
37{ 37{
38 /// <summary> 38 /// <summary>
39 /// This class handles connection to the underlying database used for configuration of the region. 39 /// This class handles connection to the underlying database used for configuration of the region.
40 /// Region content is also stored by this class. The main entry point is InitConfig() which attempts to locate 40 /// Region content is also stored by this class. The main entry point is InitConfig() which attempts to locate
41 /// opensim.yap in the current working directory. If opensim.yap can not be found, default settings are loaded from 41 /// opensim.yap in the current working directory. If opensim.yap can not be found, default settings are loaded from
42 /// what is hardcoded here and then saved into opensim.yap for future startups. 42 /// what is hardcoded here and then saved into opensim.yap for future startups.
43 /// </summary> 43 /// </summary>
44 44
45 45
46 public abstract class SimConfig 46 public abstract class SimConfig
47 { 47 {
48 public string RegionName; 48 public string RegionName;
49 49
50 public uint RegionLocX; 50 public uint RegionLocX;
51 public uint RegionLocY; 51 public uint RegionLocY;
52 public ulong RegionHandle; 52 public ulong RegionHandle;
53 53
54 public int IPListenPort; 54 public int IPListenPort;
55 public string IPListenAddr; 55 public string IPListenAddr;
56 56
57 public string AssetURL; 57 public string AssetURL;
58 public string AssetSendKey; 58 public string AssetSendKey;
59 59
60 public string GridURL; 60 public string GridURL;
61 public string GridSendKey; 61 public string GridSendKey;
62 public string GridRecvKey; 62 public string GridRecvKey;
63 public string UserURL; 63 public string UserURL;
64 public string UserSendKey; 64 public string UserSendKey;
65 public string UserRecvKey; 65 public string UserRecvKey;
66
67 public abstract void InitConfig(bool sandboxMode);
68 public abstract void LoadFromGrid();
69 public abstract float[] LoadWorld();
70 public abstract void SaveMap(float[] heightmap);
71
72 }
66 73
67 74 public interface ISimConfig
68 public abstract void InitConfig(); 75 {
69 public abstract void LoadFromGrid(); 76 SimConfig GetConfigObject();
70 public abstract World LoadWorld(); 77 }
71 public abstract void SaveMap();
72
73 }
74
75 public interface ISimConfig
76 {
77 SimConfig GetConfigObject();
78 }
79} 78}
diff --git a/src/GridInterfaces/ILocalStorage.cs b/OpenSim.Framework/IGridServer.cs
index 6b7ded6..026dfab 100644
--- a/src/GridInterfaces/ILocalStorage.cs
+++ b/OpenSim.Framework/IGridServer.cs
@@ -25,62 +25,54 @@
25* 25*
26*/ 26*/
27 27
28
28using System; 29using System;
30using System.Collections.Generic;
31using System.Net;
32using System.Net.Sockets;
33using System.IO;
29using libsecondlife; 34using libsecondlife;
35using OpenSim;
30 36
31namespace GridInterfaces 37namespace OpenSim.Framework.Interfaces
32{ 38{
33 /// <summary> 39 /// <summary>
34 /// ILocalStorage. Really hacked together right now needs cleaning up 40 /// Handles connection to Grid Servers.
35 /// </summary> 41 /// also Sim to Sim connections?
36 public interface ILocalStorage 42 /// </summary>
37 { 43
38 void StorePrim(PrimData prim); 44 public interface IGridServer
39 void RemovePrim(LLUUID primID); 45 {
40 void LoadPrimitives(ILocalStorageReceiver receiver); 46 UUIDBlock RequestUUIDBlock();
41 void ShutDown(); 47 NeighbourInfo[] RequestNeighbours(); //should return a array of neighbouring regions
42 } 48 AuthenticateResponse AuthenticateSession(LLUUID sessionID, LLUUID agentID, uint circuitCode);
43 49 bool LogoutSession(LLUUID sessionID, LLUUID agentID, uint circuitCode);
44 public interface ILocalStorageReceiver 50 string GetName();
45 { 51 bool RequestConnection();
46 void PrimFromStorage(PrimData prim); 52 void SetServerInfo(string ServerUrl, string SendKey, string RecvKey);
47 } 53 void Close();
48 54 }
49 55
50 public class PrimData 56 public struct UUIDBlock
51 { 57 {
52 public LLUUID OwnerID; 58 public LLUUID BlockStart;
53 public byte PCode; 59 public LLUUID BlockEnd;
54 public byte PathBegin; 60 }
55 public byte PathEnd; 61
56 public byte PathScaleX; 62 public class AuthenticateResponse
57 public byte PathScaleY; 63 {
58 public byte PathShearX; 64 public bool Authorised;
59 public byte PathShearY; 65 public Login LoginInfo;
60 public sbyte PathSkew; 66
61 public byte ProfileBegin; 67 public AuthenticateResponse()
62 public byte ProfileEnd; 68 {
63 public LLVector3 Scale; 69
64 public byte PathCurve; 70 }
65 public byte ProfileCurve; 71
66 public uint ParentID=0; 72 }
67 public byte ProfileHollow; 73
68 public sbyte PathRadiusOffset; 74 public interface IGridPlugin
69 public byte PathRevolutions; 75 {
70 public sbyte PathTaperX; 76 IGridServer GetGridServer();
71 public sbyte PathTaperY; 77 }
72 public sbyte PathTwist;
73 public sbyte PathTwistBegin;
74
75 //following only used during prim storage
76 public LLVector3 Position;
77 public LLQuaternion Rotation;
78 public uint LocalID;
79 public LLUUID FullID;
80
81 public PrimData()
82 {
83
84 }
85 }
86} 78}
diff --git a/OpenSim.Framework/ILocalStorage.cs b/OpenSim.Framework/ILocalStorage.cs
new file mode 100644
index 0000000..e9aa1a2
--- /dev/null
+++ b/OpenSim.Framework/ILocalStorage.cs
@@ -0,0 +1,51 @@
1/*
2* Copyright (c) OpenSim project, http://sim.opensecondlife.org/
3*
4* Redistribution and use in source and binary forms, with or without
5* modification, are permitted provided that the following conditions are met:
6* * Redistributions of source code must retain the above copyright
7* notice, this list of conditions and the following disclaimer.
8* * Redistributions in binary form must reproduce the above copyright
9* notice, this list of conditions and the following disclaimer in the
10* documentation and/or other materials provided with the distribution.
11* * Neither the name of the <organization> nor the
12* names of its contributors may be used to endorse or promote products
13* derived from this software without specific prior written permission.
14*
15* THIS SOFTWARE IS PROVIDED BY <copyright holder> ``AS IS'' AND ANY
16* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
18* DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY
19* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
20* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
21* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
22* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
24* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25*
26*/
27
28using System;
29using libsecondlife;
30using OpenSim.Framework.Assets;
31
32namespace OpenSim.Framework.Interfaces
33{
34 /// <summary>
35 /// ILocalStorage. Really hacked together right now needs cleaning up
36 /// </summary>
37 public interface ILocalStorage
38 {
39 void StorePrim(PrimData prim);
40 void RemovePrim(LLUUID primID);
41 void LoadPrimitives(ILocalStorageReceiver receiver);
42 void ShutDown();
43 }
44
45 public interface ILocalStorageReceiver
46 {
47 void PrimFromStorage(PrimData prim);
48 }
49
50}
51
diff --git a/OpenSim.Framework/IUserServer.cs b/OpenSim.Framework/IUserServer.cs
new file mode 100644
index 0000000..bb2b668
--- /dev/null
+++ b/OpenSim.Framework/IUserServer.cs
@@ -0,0 +1,14 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4using OpenSim.Framework.Inventory;
5using libsecondlife;
6
7namespace OpenSim.Framework.Interfaces
8{
9 public interface IUserServer
10 {
11 AgentInventory RequestAgentsInventory(LLUUID agentID);
12 void SetServerInfo(string ServerUrl, string SendKey, string RecvKey);
13 }
14}
diff --git a/OpenSim.Framework/Inventory.cs b/OpenSim.Framework/Inventory.cs
new file mode 100644
index 0000000..e34ea75
--- /dev/null
+++ b/OpenSim.Framework/Inventory.cs
@@ -0,0 +1,127 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4using libsecondlife;
5using OpenSim.Framework.Assets;
6
7namespace OpenSim.Framework.Inventory
8{
9 public class AgentInventory
10 {
11 //Holds the local copy of Inventory info for a agent
12 public Dictionary<LLUUID, InventoryFolder> InventoryFolders;
13 public Dictionary<LLUUID, InventoryItem> InventoryItems;
14 public InventoryFolder InventoryRoot;
15 public int LastCached; //maybe used by opensim app, time this was last stored/compared to user server
16 public LLUUID AgentID;
17 public AvatarWearable[] Wearables;
18
19 public AgentInventory()
20 {
21 InventoryFolders = new Dictionary<LLUUID, InventoryFolder>();
22 InventoryItems = new Dictionary<LLUUID, InventoryItem>();
23 this.Initialise();
24 }
25
26 public virtual void Initialise()
27 {
28 Wearables = new AvatarWearable[2]; //should be 12 of these
29 for (int i = 0; i < 2; i++)
30 {
31 Wearables[i] = new AvatarWearable();
32 }
33
34 InventoryRoot = new InventoryFolder();
35 InventoryRoot.FolderID = LLUUID.Random();
36 InventoryRoot.ParentID = new LLUUID();
37 InventoryRoot.Version = 1;
38 InventoryRoot.DefaultType = 8;
39 InventoryRoot.FolderName = "My Inventory";
40 InventoryFolders.Add(InventoryRoot.FolderID, InventoryRoot);
41 }
42
43 public bool CreateNewFolder(LLUUID folderID)
44 {
45 InventoryFolder Folder = new InventoryFolder();
46 Folder.FolderID = folderID;
47 Folder.OwnerID = this.AgentID;
48 this.InventoryFolders.Add(Folder.FolderID, Folder);
49
50 return (true);
51 }
52
53 public LLUUID AddToInventory(LLUUID folderID, AssetBase asset)
54 {
55 if (this.InventoryFolders.ContainsKey(folderID))
56 {
57 LLUUID NewItemID = LLUUID.Random();
58
59 InventoryItem Item = new InventoryItem();
60 Item.FolderID = folderID;
61 Item.OwnerID = AgentID;
62 Item.AssetID = asset.FullID;
63 Item.ItemID = NewItemID;
64 Item.Type = asset.Type;
65 Item.Name = asset.Name;
66 Item.Description = asset.Description;
67 Item.InvType = asset.InvType;
68 this.InventoryItems.Add(Item.ItemID, Item);
69 InventoryFolder Folder = InventoryFolders[Item.FolderID];
70 Folder.Items.Add(Item);
71 return (Item.ItemID);
72 }
73 else
74 {
75 return (null);
76 }
77 }
78 }
79
80 public class InventoryFolder
81 {
82 public List<InventoryItem> Items;
83 //public List<InventoryFolder> Subfolders;
84 public LLUUID FolderID;
85 public LLUUID OwnerID;
86 public LLUUID ParentID;
87 public string FolderName;
88 public ushort DefaultType;
89 public ushort Version;
90
91 public InventoryFolder()
92 {
93 Items = new List<InventoryItem>();
94 //Subfolders = new List<InventoryFolder>();
95 }
96
97 }
98
99 public class InventoryItem
100 {
101 public LLUUID FolderID;
102 public LLUUID OwnerID;
103 public LLUUID ItemID;
104 public LLUUID AssetID;
105 public LLUUID CreatorID;
106 public sbyte InvType;
107 public sbyte Type;
108 public string Name;
109 public string Description;
110
111 public InventoryItem()
112 {
113 this.CreatorID = LLUUID.Zero;
114 }
115 }
116
117 public class AvatarWearable
118 {
119 public LLUUID AssetID = new LLUUID("00000000-0000-0000-0000-000000000000");
120 public LLUUID ItemID = new LLUUID("00000000-0000-0000-0000-000000000000");
121
122 public AvatarWearable()
123 {
124
125 }
126 }
127}
diff --git a/OpenSim.Framework/LocalGridBase.cs b/OpenSim.Framework/LocalGridBase.cs
new file mode 100644
index 0000000..c9b278a
--- /dev/null
+++ b/OpenSim.Framework/LocalGridBase.cs
@@ -0,0 +1,21 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4using libsecondlife;
5
6namespace OpenSim.Framework.Interfaces
7{
8 public abstract class LocalGridBase : IGridServer
9 {
10 public abstract UUIDBlock RequestUUIDBlock();
11 public abstract NeighbourInfo[] RequestNeighbours();
12 public abstract AuthenticateResponse AuthenticateSession(LLUUID sessionID, LLUUID agentID, uint circuitCode);
13 public abstract bool LogoutSession(LLUUID sessionID, LLUUID agentID, uint circuitCode);
14 public abstract string GetName();
15 public abstract bool RequestConnection();
16 public abstract void SetServerInfo(string ServerUrl, string SendKey, string RecvKey);
17 public abstract void AddNewSession(Login session);
18 public abstract void Close();
19 }
20
21}
diff --git a/OpenSim.Framework/Login.cs b/OpenSim.Framework/Login.cs
new file mode 100644
index 0000000..8a67853
--- /dev/null
+++ b/OpenSim.Framework/Login.cs
@@ -0,0 +1,22 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4using libsecondlife;
5
6namespace OpenSim.Framework.Interfaces
7{
8 public class Login
9 {
10 public string First = "Test";
11 public string Last = "User";
12 public LLUUID Agent;
13 public LLUUID Session;
14 public LLUUID SecureSession = LLUUID.Zero;
15 public LLUUID InventoryFolder;
16 public LLUUID BaseFolder;
17 public Login()
18 {
19
20 }
21 }
22}
diff --git a/src/OpenSim.Framework/LoginService.cs b/OpenSim.Framework/LoginService.cs
index 85fe761..eba0281 100644
--- a/src/OpenSim.Framework/LoginService.cs
+++ b/OpenSim.Framework/LoginService.cs
@@ -3,13 +3,12 @@ using System.Collections;
3using System.Collections.Generic; 3using System.Collections.Generic;
4using System.Text; 4using System.Text;
5using Nwc.XmlRpc; 5using Nwc.XmlRpc;
6using OpenSim.GridServers;
7using libsecondlife; 6using libsecondlife;
8 7
9namespace OpenSim.Framework 8namespace OpenSim.Framework.Grid
10{ 9{
11 public abstract class LoginService 10 public abstract class LoginService
12 { 11 {
13 12
14 } 13 }
15} 14} \ No newline at end of file
diff --git a/OpenSim.Framework/NeighbourInfo.cs b/OpenSim.Framework/NeighbourInfo.cs
new file mode 100644
index 0000000..8b4fa64
--- /dev/null
+++ b/OpenSim.Framework/NeighbourInfo.cs
@@ -0,0 +1,19 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4
5namespace OpenSim.Framework.Interfaces
6{
7 public class NeighbourInfo
8 {
9 public NeighbourInfo()
10 {
11 }
12
13 public ulong regionhandle;
14 public uint RegionLocX;
15 public uint RegionLocY;
16 public string sim_ip;
17 public uint sim_port;
18 }
19}
diff --git a/OpenSim.Framework/OpenSim.Framework.csproj b/OpenSim.Framework/OpenSim.Framework.csproj
new file mode 100644
index 0000000..7a10319
--- /dev/null
+++ b/OpenSim.Framework/OpenSim.Framework.csproj
@@ -0,0 +1,151 @@
1<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
2 <PropertyGroup>
3 <ProjectType>Local</ProjectType>
4 <ProductVersion>8.0.50727</ProductVersion>
5 <SchemaVersion>2.0</SchemaVersion>
6 <ProjectGuid>{1D2865A9-CF8E-45F7-B96D-91ED128A32CF}</ProjectGuid>
7 <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
8 <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
9 <ApplicationIcon></ApplicationIcon>
10 <AssemblyKeyContainerName>
11 </AssemblyKeyContainerName>
12 <AssemblyName>OpenSim.Framework</AssemblyName>
13 <DefaultClientScript>JScript</DefaultClientScript>
14 <DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout>
15 <DefaultTargetSchema>IE50</DefaultTargetSchema>
16 <DelaySign>false</DelaySign>
17 <OutputType>Library</OutputType>
18 <AppDesignerFolder></AppDesignerFolder>
19 <RootNamespace>OpenSim.Framework</RootNamespace>
20 <StartupObject></StartupObject>
21 <FileUpgradeFlags>
22 </FileUpgradeFlags>
23 </PropertyGroup>
24 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
25 <AllowUnsafeBlocks>False</AllowUnsafeBlocks>
26 <BaseAddress>285212672</BaseAddress>
27 <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
28 <ConfigurationOverrideFile>
29 </ConfigurationOverrideFile>
30 <DefineConstants>TRACE;DEBUG</DefineConstants>
31 <DocumentationFile></DocumentationFile>
32 <DebugSymbols>True</DebugSymbols>
33 <FileAlignment>4096</FileAlignment>
34 <Optimize>False</Optimize>
35 <OutputPath>..\bin\</OutputPath>
36 <RegisterForComInterop>False</RegisterForComInterop>
37 <RemoveIntegerChecks>False</RemoveIntegerChecks>
38 <TreatWarningsAsErrors>False</TreatWarningsAsErrors>
39 <WarningLevel>4</WarningLevel>
40 <NoWarn></NoWarn>
41 </PropertyGroup>
42 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
43 <AllowUnsafeBlocks>False</AllowUnsafeBlocks>
44 <BaseAddress>285212672</BaseAddress>
45 <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
46 <ConfigurationOverrideFile>
47 </ConfigurationOverrideFile>
48 <DefineConstants>TRACE</DefineConstants>
49 <DocumentationFile></DocumentationFile>
50 <DebugSymbols>False</DebugSymbols>
51 <FileAlignment>4096</FileAlignment>
52 <Optimize>True</Optimize>
53 <OutputPath>..\bin\</OutputPath>
54 <RegisterForComInterop>False</RegisterForComInterop>
55 <RemoveIntegerChecks>False</RemoveIntegerChecks>
56 <TreatWarningsAsErrors>False</TreatWarningsAsErrors>
57 <WarningLevel>4</WarningLevel>
58 <NoWarn></NoWarn>
59 </PropertyGroup>
60 <ItemGroup>
61 <Reference Include="System.dll" >
62 <HintPath>\System.dll.dll</HintPath>
63 </Reference>
64 <Reference Include="System.Xml.dll" >
65 <HintPath>\System.Xml.dll.dll</HintPath>
66 </Reference>
67 <Reference Include="libsecondlife.dll" >
68 <HintPath>\libsecondlife.dll.dll</HintPath>
69 </Reference>
70 </ItemGroup>
71 <ItemGroup>
72 </ItemGroup>
73 <ItemGroup>
74 <Compile Include="AgentCiruitData.cs">
75 <SubType>Code</SubType>
76 </Compile>
77 <Compile Include="AssetBase.cs">
78 <SubType>Code</SubType>
79 </Compile>
80 <Compile Include="BlockingQueue.cs">
81 <SubType>Code</SubType>
82 </Compile>
83 <Compile Include="HeightMapGenHills.cs">
84 <SubType>Code</SubType>
85 </Compile>
86 <Compile Include="IAssetServer.cs">
87 <SubType>Code</SubType>
88 </Compile>
89 <Compile Include="IConfig.cs">
90 <SubType>Code</SubType>
91 </Compile>
92 <Compile Include="IGridServer.cs">
93 <SubType>Code</SubType>
94 </Compile>
95 <Compile Include="ILocalStorage.cs">
96 <SubType>Code</SubType>
97 </Compile>
98 <Compile Include="Inventory.cs">
99 <SubType>Code</SubType>
100 </Compile>
101 <Compile Include="IUserServer.cs">
102 <SubType>Code</SubType>
103 </Compile>
104 <Compile Include="LocalGridBase.cs">
105 <SubType>Code</SubType>
106 </Compile>
107 <Compile Include="Login.cs">
108 <SubType>Code</SubType>
109 </Compile>
110 <Compile Include="LoginService.cs">
111 <SubType>Code</SubType>
112 </Compile>
113 <Compile Include="NeighbourInfo.cs">
114 <SubType>Code</SubType>
115 </Compile>
116 <Compile Include="PrimData.cs">
117 <SubType>Code</SubType>
118 </Compile>
119 <Compile Include="RemoteGridBase.cs">
120 <SubType>Code</SubType>
121 </Compile>
122 <Compile Include="SimProfile.cs">
123 <SubType>Code</SubType>
124 </Compile>
125 <Compile Include="SimProfileBase.cs">
126 <SubType>Code</SubType>
127 </Compile>
128 <Compile Include="UserProfile.cs">
129 <SubType>Code</SubType>
130 </Compile>
131 <Compile Include="UserProfileManager.cs">
132 <SubType>Code</SubType>
133 </Compile>
134 <Compile Include="UserProfileManagerBase.cs">
135 <SubType>Code</SubType>
136 </Compile>
137 <Compile Include="Util.cs">
138 <SubType>Code</SubType>
139 </Compile>
140 <Compile Include="Properties\AssemblyInfo.cs">
141 <SubType>Code</SubType>
142 </Compile>
143 </ItemGroup>
144 <Import Project="$(MSBuildBinPath)\Microsoft.CSHARP.Targets" />
145 <PropertyGroup>
146 <PreBuildEvent>
147 </PreBuildEvent>
148 <PostBuildEvent>
149 </PostBuildEvent>
150 </PropertyGroup>
151</Project>
diff --git a/OpenSim.Framework/OpenSim.Framework.dll.build b/OpenSim.Framework/OpenSim.Framework.dll.build
new file mode 100644
index 0000000..1418947
--- /dev/null
+++ b/OpenSim.Framework/OpenSim.Framework.dll.build
@@ -0,0 +1,63 @@
1<?xml version="1.0" ?>
2<project name="OpenSim.Framework" default="build">
3 <target name="build">
4 <echo message="Build Directory is ${project::get-base-directory()}/${build.dir}" />
5 <mkdir dir="${project::get-base-directory()}/${build.dir}" />
6 <copy todir="${project::get-base-directory()}/${build.dir}">
7 <fileset basedir="${project::get-base-directory()}">
8 </fileset>
9 </copy>
10 <csc target="library" debug="${build.debug}" unsafe="False" define="TRACE;DEBUG" output="${project::get-base-directory()}/${build.dir}/${project::get-name()}.dll">
11 <resources prefix="OpenSim.Framework" dynamicprefix="true" >
12 </resources>
13 <sources failonempty="true">
14 <include name="AgentCiruitData.cs" />
15 <include name="AssetBase.cs" />
16 <include name="BlockingQueue.cs" />
17 <include name="HeightMapGenHills.cs" />
18 <include name="IAssetServer.cs" />
19 <include name="IConfig.cs" />
20 <include name="IGridServer.cs" />
21 <include name="ILocalStorage.cs" />
22 <include name="Inventory.cs" />
23 <include name="IUserServer.cs" />
24 <include name="LocalGridBase.cs" />
25 <include name="Login.cs" />
26 <include name="LoginService.cs" />
27 <include name="NeighbourInfo.cs" />
28 <include name="PrimData.cs" />
29 <include name="RemoteGridBase.cs" />
30 <include name="SimProfile.cs" />
31 <include name="SimProfileBase.cs" />
32 <include name="UserProfile.cs" />
33 <include name="UserProfileManager.cs" />
34 <include name="UserProfileManagerBase.cs" />
35 <include name="Util.cs" />
36 <include name="Properties/AssemblyInfo.cs" />
37 </sources>
38 <references basedir="${project::get-base-directory()}">
39 <lib>
40 <include name="${project::get-base-directory()}" />
41 <include name="${project::get-base-directory()}/${build.dir}" />
42 </lib>
43 <include name="System.dll.dll" />
44 <include name="System.Xml.dll.dll" />
45 <include name="../bin/libsecondlife.dll" />
46 </references>
47 </csc>
48 <echo message="Copying from [${project::get-base-directory()}/${build.dir}/] to [${project::get-base-directory()}/../bin/" />
49 <mkdir dir="${project::get-base-directory()}/../bin/"/>
50 <copy todir="${project::get-base-directory()}/../bin/">
51 <fileset basedir="${project::get-base-directory()}/${build.dir}/" >
52 <include name="*.dll"/>
53 <include name="*.exe"/>
54 </fileset>
55 </copy>
56 </target>
57 <target name="clean">
58 <delete dir="${bin.dir}" failonerror="false" />
59 <delete dir="${obj.dir}" failonerror="false" />
60 </target>
61 <target name="doc" description="Creates documentation.">
62 </target>
63</project>
diff --git a/OpenSim.Framework/PrimData.cs b/OpenSim.Framework/PrimData.cs
new file mode 100644
index 0000000..175a014
--- /dev/null
+++ b/OpenSim.Framework/PrimData.cs
@@ -0,0 +1,45 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4using libsecondlife;
5
6namespace OpenSim.Framework.Assets
7{
8 public class PrimData
9 {
10 public LLUUID OwnerID;
11 public byte PCode;
12 public byte PathBegin;
13 public byte PathEnd;
14 public byte PathScaleX;
15 public byte PathScaleY;
16 public byte PathShearX;
17 public byte PathShearY;
18 public sbyte PathSkew;
19 public byte ProfileBegin;
20 public byte ProfileEnd;
21 public LLVector3 Scale;
22 public byte PathCurve;
23 public byte ProfileCurve;
24 public uint ParentID = 0;
25 public byte ProfileHollow;
26 public sbyte PathRadiusOffset;
27 public byte PathRevolutions;
28 public sbyte PathTaperX;
29 public sbyte PathTaperY;
30 public sbyte PathTwist;
31 public sbyte PathTwistBegin;
32 public byte[] Texture;
33
34 //following only used during prim storage
35 public LLVector3 Position;
36 public LLQuaternion Rotation;
37 public uint LocalID;
38 public LLUUID FullID;
39
40 public PrimData()
41 {
42
43 }
44 }
45}
diff --git a/src/Properties/AssemblyInfo.cs b/OpenSim.Framework/Properties/AssemblyInfo.cs
index 90fc127..86f5cdb 100644
--- a/src/Properties/AssemblyInfo.cs
+++ b/OpenSim.Framework/Properties/AssemblyInfo.cs
@@ -5,12 +5,12 @@ using System.Runtime.InteropServices;
5// General Information about an assembly is controlled through the following 5// General Information about an assembly is controlled through the following
6// set of attributes. Change these attribute values to modify the information 6// set of attributes. Change these attribute values to modify the information
7// associated with an assembly. 7// associated with an assembly.
8[assembly: AssemblyTitle("opensim")] 8[assembly: AssemblyTitle("OpenSim.FrameWork")]
9[assembly: AssemblyDescription("")] 9[assembly: AssemblyDescription("")]
10[assembly: AssemblyConfiguration("")] 10[assembly: AssemblyConfiguration("")]
11[assembly: AssemblyCompany("Playahead AB")] 11[assembly: AssemblyCompany("")]
12[assembly: AssemblyProduct("opensim")] 12[assembly: AssemblyProduct("OpenSim.FrameWork")]
13[assembly: AssemblyCopyright("Copyright © Playahead AB 2007")] 13[assembly: AssemblyCopyright("Copyright © 2007")]
14[assembly: AssemblyTrademark("")] 14[assembly: AssemblyTrademark("")]
15[assembly: AssemblyCulture("")] 15[assembly: AssemblyCulture("")]
16 16
@@ -20,7 +20,7 @@ using System.Runtime.InteropServices;
20[assembly: ComVisible(false)] 20[assembly: ComVisible(false)]
21 21
22// The following GUID is for the ID of the typelib if this project is exposed to COM 22// The following GUID is for the ID of the typelib if this project is exposed to COM
23[assembly: Guid("1d09756b-a461-4302-b6fe-15c455317909")] 23[assembly: Guid("a08e20c7-f191-4137-b1f0-9291408fa521")]
24 24
25// Version information for an assembly consists of the following four values: 25// Version information for an assembly consists of the following four values:
26// 26//
diff --git a/OpenSim.Framework/RemoteGridBase.cs b/OpenSim.Framework/RemoteGridBase.cs
new file mode 100644
index 0000000..6ca57df
--- /dev/null
+++ b/OpenSim.Framework/RemoteGridBase.cs
@@ -0,0 +1,25 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4using libsecondlife;
5
6namespace OpenSim.Framework.Interfaces
7{
8 public abstract class RemoteGridBase : IGridServer
9 {
10 public abstract Dictionary<uint, AgentCircuitData> agentcircuits
11 {
12 get;
13 set;
14 }
15
16 public abstract UUIDBlock RequestUUIDBlock();
17 public abstract NeighbourInfo[] RequestNeighbours();
18 public abstract AuthenticateResponse AuthenticateSession(LLUUID sessionID, LLUUID agentID, uint circuitCode);
19 public abstract bool LogoutSession(LLUUID sessionID, LLUUID agentID, uint circuitCode);
20 public abstract string GetName();
21 public abstract bool RequestConnection();
22 public abstract void SetServerInfo(string ServerUrl, string SendKey, string RecvKey);
23 public abstract void Close();
24 }
25}
diff --git a/OpenSim.Framework/SimProfile.cs b/OpenSim.Framework/SimProfile.cs
new file mode 100644
index 0000000..ac4cf9e
--- /dev/null
+++ b/OpenSim.Framework/SimProfile.cs
@@ -0,0 +1,51 @@
1using System;
2using System.Collections.Generic;
3using System.Collections;
4using System.Xml;
5using System.Text;
6using libsecondlife;
7using Nwc.XmlRpc;
8
9namespace OpenSim.Framework.Sims
10{
11 public class SimProfile : SimProfileBase
12 {
13 public SimProfile LoadFromGrid(ulong region_handle, string GridURL, string SendKey, string RecvKey)
14 {
15 try
16 {
17 Hashtable GridReqParams = new Hashtable();
18 GridReqParams["region_handle"] = region_handle.ToString();
19 GridReqParams["caller"] = "userserver";
20 GridReqParams["authkey"] = SendKey;
21 ArrayList SendParams = new ArrayList();
22 SendParams.Add(GridReqParams);
23 XmlRpcRequest GridReq = new XmlRpcRequest("get_sim_info", SendParams);
24
25 XmlRpcResponse GridResp = GridReq.Send(GridURL, 3000);
26
27 Hashtable RespData = (Hashtable)GridResp.Value;
28 this.UUID = new LLUUID((string)RespData["UUID"]);
29 this.regionhandle = (ulong)Convert.ToUInt64(RespData["regionhandle"]);
30 this.regionname = (string)RespData["regionname"];
31 this.sim_ip = (string)RespData["sim_ip"];
32 this.sim_port = (uint)Convert.ToUInt16(RespData["sim_port"]);
33 this.caps_url = (string)RespData["caps_url"];
34 this.RegionLocX = (uint)Convert.ToUInt32(RespData["RegionLocX"]);
35 this.RegionLocY = (uint)Convert.ToUInt32(RespData["RegionLocY"]);
36 this.sendkey = (string)RespData["sendkey"];
37 this.recvkey = (string)RespData["recvkey"];
38 }
39 catch (Exception e)
40 {
41 Console.WriteLine(e.ToString());
42 }
43 return this;
44 }
45
46 public SimProfile()
47 {
48 }
49 }
50
51}
diff --git a/OpenSim.Framework/SimProfileBase.cs b/OpenSim.Framework/SimProfileBase.cs
new file mode 100644
index 0000000..5fe2734
--- /dev/null
+++ b/OpenSim.Framework/SimProfileBase.cs
@@ -0,0 +1,25 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4using libsecondlife;
5
6namespace OpenSim.Framework.Sims
7{
8 public class SimProfileBase
9 {
10 public LLUUID UUID;
11 public ulong regionhandle;
12 public string regionname;
13 public string sim_ip;
14 public uint sim_port;
15 public string caps_url;
16 public uint RegionLocX;
17 public uint RegionLocY;
18 public string sendkey;
19 public string recvkey;
20
21 public SimProfileBase()
22 {
23 }
24 }
25}
diff --git a/OpenSim.Framework/UserProfile.cs b/OpenSim.Framework/UserProfile.cs
new file mode 100644
index 0000000..2c264c5
--- /dev/null
+++ b/OpenSim.Framework/UserProfile.cs
@@ -0,0 +1,50 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4using libsecondlife;
5using OpenSim.Framework.Inventory;
6
7namespace OpenSim.Framework.User
8{
9 public class UserProfile
10 {
11
12 public string firstname;
13 public string lastname;
14 public ulong homeregionhandle;
15 public LLVector3 homepos;
16 public LLVector3 homelookat;
17
18 public bool IsGridGod = false;
19 public bool IsLocal = true; // will be used in future for visitors from foreign grids
20 public string AssetURL;
21 public string MD5passwd;
22
23 public LLUUID CurrentSessionID;
24 public LLUUID CurrentSecureSessionID;
25 public LLUUID UUID;
26 public Dictionary<LLUUID, uint> Circuits = new Dictionary<LLUUID, uint>(); // tracks circuit codes
27
28 public AgentInventory Inventory;
29
30 public UserProfile()
31 {
32 Circuits = new Dictionary<LLUUID, uint>();
33 Inventory = new AgentInventory();
34 homeregionhandle = Helpers.UIntsToLong((997 * 256), (996 * 256)); ;
35 }
36
37 public void InitSessionData()
38 {
39 CurrentSessionID = LLUUID.Random();
40 CurrentSecureSessionID = LLUUID.Random();
41 }
42
43 public void AddSimCircuit(uint circuitCode, LLUUID regionUUID)
44 {
45 if (this.Circuits.ContainsKey(regionUUID) == false)
46 this.Circuits.Add(regionUUID, circuitCode);
47 }
48
49 }
50}
diff --git a/OpenSim.Framework/UserProfileManager.cs b/OpenSim.Framework/UserProfileManager.cs
new file mode 100644
index 0000000..f77ca4c
--- /dev/null
+++ b/OpenSim.Framework/UserProfileManager.cs
@@ -0,0 +1,223 @@
1using System;
2using System.Collections.Generic;
3using System.Collections;
4using System.Text;
5using System.Text.RegularExpressions;
6using System.Xml;
7using libsecondlife;
8using Nwc.XmlRpc;
9using OpenSim.Framework.Sims;
10using OpenSim.Framework.Inventory;
11using OpenSim.Framework.Utilities;
12
13namespace OpenSim.Framework.User
14{
15 public class UserProfileManager : UserProfileManagerBase
16 {
17 public string GridURL;
18 public string GridSendKey;
19 public string GridRecvKey;
20 public string DefaultStartupMsg;
21
22 public UserProfileManager()
23 {
24
25 }
26
27 public void SetKeys(string sendKey, string recvKey, string url, string message)
28 {
29 GridRecvKey = recvKey;
30 GridSendKey = sendKey;
31 GridURL = url;
32 DefaultStartupMsg = message;
33 }
34
35 public virtual string ParseXMLRPC(string requestBody)
36 {
37 XmlRpcRequest request = (XmlRpcRequest)(new XmlRpcRequestDeserializer()).Deserialize(requestBody);
38
39 Hashtable requestData = (Hashtable)request.Params[0];
40 switch (request.MethodName)
41 {
42 case "login_to_simulator":
43 bool GoodXML = (requestData.Contains("first") && requestData.Contains("last") && requestData.Contains("passwd"));
44 bool GoodLogin = false;
45 string firstname = "";
46 string lastname = "";
47 string passwd = "";
48
49 if (GoodXML)
50 {
51 firstname = (string)requestData["first"];
52 lastname = (string)requestData["last"];
53 passwd = (string)requestData["passwd"];
54 GoodLogin = AuthenticateUser(firstname, lastname, passwd);
55 }
56
57
58 if (!(GoodXML && GoodLogin))
59 {
60 XmlRpcResponse LoginErrorResp = new XmlRpcResponse();
61 Hashtable ErrorRespData = new Hashtable();
62 ErrorRespData["reason"] = "key";
63 ErrorRespData["message"] = "Error connecting to grid. Please double check your login details and check with the grid owner if you are sure these are correct";
64 ErrorRespData["login"] = "false";
65 LoginErrorResp.Value = ErrorRespData;
66 return (Regex.Replace(XmlRpcResponseSerializer.Singleton.Serialize(LoginErrorResp), " encoding=\"utf-16\"", ""));
67 }
68
69 UserProfile TheUser = GetProfileByName(firstname, lastname);
70
71 if (!((TheUser.CurrentSessionID == null) && (TheUser.CurrentSecureSessionID == null)))
72 {
73 XmlRpcResponse PresenceErrorResp = new XmlRpcResponse();
74 Hashtable PresenceErrorRespData = new Hashtable();
75 PresenceErrorRespData["reason"] = "presence";
76 PresenceErrorRespData["message"] = "You appear to be already logged in, if this is not the case please wait for your session to timeout, if this takes longer than a few minutes please contact the grid owner";
77 PresenceErrorRespData["login"] = "false";
78 PresenceErrorResp.Value = PresenceErrorRespData;
79 return (Regex.Replace(XmlRpcResponseSerializer.Singleton.Serialize(PresenceErrorResp), " encoding=\"utf-16\"", ""));
80
81 }
82
83 try
84 {
85 LLUUID AgentID = TheUser.UUID;
86 TheUser.InitSessionData();
87 // SimProfile SimInfo = new SimProfile();
88 // SimInfo = SimInfo.LoadFromGrid(TheUser.homeregionhandle, GridURL, GridSendKey, GridRecvKey);
89
90 XmlRpcResponse LoginGoodResp = new XmlRpcResponse();
91 Hashtable LoginGoodData = new Hashtable();
92
93 Hashtable GlobalT = new Hashtable();
94 GlobalT["sun_texture_id"] = "cce0f112-878f-4586-a2e2-a8f104bba271";
95 GlobalT["cloud_texture_id"] = "fc4b9f0b-d008-45c6-96a4-01dd947ac621";
96 GlobalT["moon_texture_id"] = "fc4b9f0b-d008-45c6-96a4-01dd947ac621";
97 ArrayList GlobalTextures = new ArrayList();
98 GlobalTextures.Add(GlobalT);
99
100 Hashtable LoginFlagsHash = new Hashtable();
101 LoginFlagsHash["daylight_savings"] = "N";
102 LoginFlagsHash["stipend_since_login"] = "N";
103 LoginFlagsHash["gendered"] = "Y";
104 LoginFlagsHash["ever_logged_in"] = "Y";
105 ArrayList LoginFlags = new ArrayList();
106 LoginFlags.Add(LoginFlagsHash);
107
108 Hashtable uiconfig = new Hashtable();
109 uiconfig["allow_first_life"] = "Y";
110 ArrayList ui_config = new ArrayList();
111 ui_config.Add(uiconfig);
112
113 Hashtable ClassifiedCategoriesHash = new Hashtable();
114 ClassifiedCategoriesHash["category_name"] = "bla bla";
115 ClassifiedCategoriesHash["category_id"] = (Int32)1;
116 ArrayList ClassifiedCategories = new ArrayList();
117 ClassifiedCategories.Add(ClassifiedCategoriesHash);
118
119 ArrayList AgentInventory = new ArrayList();
120 foreach (InventoryFolder InvFolder in TheUser.Inventory.InventoryFolders.Values)
121 {
122 Hashtable TempHash = new Hashtable();
123 TempHash["name"] = InvFolder.FolderName;
124 TempHash["parent_id"] = InvFolder.ParentID.ToStringHyphenated();
125 TempHash["version"] = (Int32)InvFolder.Version;
126 TempHash["type_default"] = (Int32)InvFolder.DefaultType;
127 TempHash["folder_id"] = InvFolder.FolderID.ToStringHyphenated();
128 AgentInventory.Add(TempHash);
129 }
130
131 Hashtable InventoryRootHash = new Hashtable();
132 InventoryRootHash["folder_id"] = TheUser.Inventory.InventoryRoot.FolderID.ToStringHyphenated();
133 ArrayList InventoryRoot = new ArrayList();
134 InventoryRoot.Add(InventoryRootHash);
135
136 Hashtable InitialOutfitHash = new Hashtable();
137 InitialOutfitHash["folder_name"] = "Nightclub Female";
138 InitialOutfitHash["gender"] = "female";
139 ArrayList InitialOutfit = new ArrayList();
140 InitialOutfit.Add(InitialOutfitHash);
141
142 uint circode = (uint)(Util.RandomClass.Next());
143 //TheUser.AddSimCircuit(circode, SimInfo.UUID);
144
145 LoginGoodData["last_name"] = "\"" + TheUser.firstname + "\"";
146 LoginGoodData["ui-config"] = ui_config;
147 LoginGoodData["sim_ip"] = "127.0.0.1"; //SimInfo.sim_ip.ToString();
148 LoginGoodData["login-flags"] = LoginFlags;
149 LoginGoodData["global-textures"] = GlobalTextures;
150 LoginGoodData["classified_categories"] = ClassifiedCategories;
151 LoginGoodData["event_categories"] = new ArrayList();
152 LoginGoodData["inventory-skeleton"] = AgentInventory;
153 LoginGoodData["inventory-skel-lib"] = new ArrayList();
154 LoginGoodData["inventory-root"] = InventoryRoot;
155 LoginGoodData["event_notifications"] = new ArrayList();
156 LoginGoodData["gestures"] = new ArrayList();
157 LoginGoodData["inventory-lib-owner"] = new ArrayList();
158 LoginGoodData["initial-outfit"] = InitialOutfit;
159 LoginGoodData["seconds_since_epoch"] = (Int32)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds;
160 LoginGoodData["start_location"] = "last";
161 LoginGoodData["home"] = "{'region_handle':[r" + (997 * 256).ToString() + ",r" + (996 * 256).ToString() + "], 'position':[r" + TheUser.homepos.X.ToString() + ",r" + TheUser.homepos.Y.ToString() + ",r" + TheUser.homepos.Z.ToString() + "], 'look_at':[r" + TheUser.homelookat.X.ToString() + ",r" + TheUser.homelookat.Y.ToString() + ",r" + TheUser.homelookat.Z.ToString() + "]}";
162 LoginGoodData["message"] = DefaultStartupMsg;
163 LoginGoodData["first_name"] = "\"" + firstname + "\"";
164 LoginGoodData["circuit_code"] = (Int32)circode;
165 LoginGoodData["sim_port"] = 9000; //(Int32)SimInfo.sim_port;
166 LoginGoodData["secure_session_id"] = TheUser.CurrentSecureSessionID.ToStringHyphenated();
167 LoginGoodData["look_at"] = "\n[r" + TheUser.homelookat.X.ToString() + ",r" + TheUser.homelookat.Y.ToString() + ",r" + TheUser.homelookat.Z.ToString() + "]\n";
168 LoginGoodData["agent_id"] = AgentID.ToStringHyphenated();
169 LoginGoodData["region_y"] = (Int32) 996 * 256; // (Int32)SimInfo.RegionLocY * 256;
170 LoginGoodData["region_x"] = (Int32) 997 * 256; //SimInfo.RegionLocX * 256;
171 LoginGoodData["seed_capability"] = null;
172 LoginGoodData["agent_access"] = "M";
173 LoginGoodData["session_id"] = TheUser.CurrentSessionID.ToStringHyphenated();
174 LoginGoodData["login"] = "true";
175
176 this.CustomiseResponse(ref LoginGoodData, TheUser);
177 LoginGoodResp.Value = LoginGoodData;
178 //TheUser.SendDataToSim(SimInfo);
179 return (Regex.Replace(XmlRpcResponseSerializer.Singleton.Serialize(LoginGoodResp), "utf-16", "utf-8"));
180
181 }
182 catch (Exception E)
183 {
184 Console.WriteLine(E.ToString());
185 }
186
187 break;
188 }
189
190 return "";
191 }
192
193 public virtual void CustomiseResponse(ref Hashtable response, UserProfile theUser)
194 {
195 //default method set up to act as ogs user server
196 SimProfile SimInfo = new SimProfile();
197 //get siminfo from grid server
198 SimInfo = SimInfo.LoadFromGrid(theUser.homeregionhandle, GridURL, GridSendKey, GridRecvKey);
199 uint circode = (uint)response["circuit_code"];
200 theUser.AddSimCircuit(circode, SimInfo.UUID);
201 response["home"] = "{'region_handle':[r" + (SimInfo.RegionLocX * 256).ToString() + ",r" + (SimInfo.RegionLocY * 256).ToString() + "], 'position':[r" + theUser.homepos.X.ToString() + ",r" + theUser.homepos.Y.ToString() + ",r" + theUser.homepos.Z.ToString() + "], 'look_at':[r" + theUser.homelookat.X.ToString() + ",r" + theUser.homelookat.Y.ToString() + ",r" + theUser.homelookat.Z.ToString() + "]}";
202 response["sim_ip"] = SimInfo.sim_ip.ToString();
203 response["sim_port"] = (Int32)SimInfo.sim_port;
204 response["region_y"] = (Int32) SimInfo.RegionLocY * 256;
205 response["region_x"] = (Int32) SimInfo.RegionLocX * 256;
206
207 //default is ogs user server, so let the sim know about the user via a XmlRpcRequest
208 Console.WriteLine(SimInfo.caps_url);
209 Hashtable SimParams = new Hashtable();
210 SimParams["session_id"] = theUser.CurrentSessionID.ToString();
211 SimParams["secure_session_id"] = theUser.CurrentSecureSessionID.ToString();
212 SimParams["firstname"] = theUser.firstname;
213 SimParams["lastname"] = theUser.lastname;
214 SimParams["agent_id"] = theUser.UUID.ToString();
215 SimParams["circuit_code"] = (Int32)theUser.Circuits[SimInfo.UUID];
216 ArrayList SendParams = new ArrayList();
217 SendParams.Add(SimParams);
218
219 XmlRpcRequest GridReq = new XmlRpcRequest("expect_user", SendParams);
220 XmlRpcResponse GridResp = GridReq.Send(SimInfo.caps_url, 3000);
221 }
222 }
223}
diff --git a/OpenSim.Framework/UserProfileManagerBase.cs b/OpenSim.Framework/UserProfileManagerBase.cs
new file mode 100644
index 0000000..ad03bc2
--- /dev/null
+++ b/OpenSim.Framework/UserProfileManagerBase.cs
@@ -0,0 +1,91 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4using libsecondlife;
5using OpenSim.Framework.Utilities;
6using OpenSim.Framework.Inventory;
7
8namespace OpenSim.Framework.User
9{
10 public class UserProfileManagerBase
11 {
12
13 public Dictionary<LLUUID, UserProfile> UserProfiles = new Dictionary<LLUUID, UserProfile>();
14
15 public UserProfileManagerBase()
16 {
17 }
18
19 public virtual void InitUserProfiles()
20 {
21 // TODO: need to load from database
22 }
23
24 public UserProfile GetProfileByName(string firstname, string lastname)
25 {
26 foreach (libsecondlife.LLUUID UUID in UserProfiles.Keys)
27 {
28 if ((UserProfiles[UUID].firstname == firstname) && (UserProfiles[UUID].lastname == lastname))
29 {
30 return UserProfiles[UUID];
31 }
32 }
33 return null;
34 }
35
36 public UserProfile GetProfileByLLUUID(LLUUID ProfileLLUUID)
37 {
38 return UserProfiles[ProfileLLUUID];
39 }
40
41 public virtual bool AuthenticateUser(string firstname, string lastname, string passwd)
42 {
43 UserProfile TheUser = GetProfileByName(firstname, lastname);
44 if (TheUser != null)
45 {
46 if (TheUser.MD5passwd == passwd)
47 {
48 return true;
49 }
50 else
51 {
52 return false;
53 }
54 }
55 else
56 {
57 return false;
58 }
59
60 }
61
62 public void SetGod(LLUUID GodID)
63 {
64 this.UserProfiles[GodID].IsGridGod = true;
65 }
66
67 public virtual UserProfile CreateNewProfile(string firstname, string lastname, string MD5passwd)
68 {
69 UserProfile newprofile = new UserProfile();
70 newprofile.homeregionhandle = Helpers.UIntsToLong((997 * 256), (996 * 256));
71 newprofile.firstname = firstname;
72 newprofile.lastname = lastname;
73 newprofile.MD5passwd = MD5passwd;
74 newprofile.UUID = LLUUID.Random();
75 this.UserProfiles.Add(newprofile.UUID, newprofile);
76 return newprofile;
77 }
78
79 public virtual AgentInventory GetUsersInventory(LLUUID agentID)
80 {
81 UserProfile user = this.GetProfileByLLUUID(agentID);
82 if (user != null)
83 {
84 return user.Inventory;
85 }
86
87 return null;
88 }
89
90 }
91}
diff --git a/OpenSim.Framework/Util.cs b/OpenSim.Framework/Util.cs
new file mode 100644
index 0000000..042360d
--- /dev/null
+++ b/OpenSim.Framework/Util.cs
@@ -0,0 +1,32 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4using libsecondlife;
5using libsecondlife.Packets;
6
7namespace OpenSim.Framework.Utilities
8{
9 public class Util
10 {
11 private static Random randomClass = new Random();
12
13 public static ulong UIntsToLong(uint X, uint Y)
14 {
15 return Helpers.UIntsToLong(X, Y);
16 }
17
18 public static Random RandomClass
19 {
20 get
21 {
22 return randomClass;
23 }
24 }
25
26 public Util()
27 {
28
29 }
30 }
31
32}
diff --git a/OpenSim.GridInterfaces/Local/AssemblyInfo.cs b/OpenSim.GridInterfaces/Local/AssemblyInfo.cs
new file mode 100644
index 0000000..103b49a
--- /dev/null
+++ b/OpenSim.GridInterfaces/Local/AssemblyInfo.cs
@@ -0,0 +1,31 @@
1using System.Reflection;
2using System.Runtime.CompilerServices;
3using System.Runtime.InteropServices;
4
5// Information about this assembly is defined by the following
6// attributes.
7//
8// change them to the information which is associated with the assembly
9// you compile.
10
11[assembly: AssemblyTitle("LocalGridServers")]
12[assembly: AssemblyDescription("")]
13[assembly: AssemblyConfiguration("")]
14[assembly: AssemblyCompany("")]
15[assembly: AssemblyProduct("LocalGridServers")]
16[assembly: AssemblyCopyright("")]
17[assembly: AssemblyTrademark("")]
18[assembly: AssemblyCulture("")]
19
20// This sets the default COM visibility of types in the assembly to invisible.
21// If you need to expose a type to COM, use [ComVisible(true)] on that type.
22[assembly: ComVisible(false)]
23
24// The assembly version has following format :
25//
26// Major.Minor.Build.Revision
27//
28// You can specify all values by your own or you can build default build and revision
29// numbers with the '*' character (the default):
30
31[assembly: AssemblyVersion("1.0.*")]
diff --git a/OpenSim.GridInterfaces/Local/LocalAssetServer.cs b/OpenSim.GridInterfaces/Local/LocalAssetServer.cs
new file mode 100644
index 0000000..6cd954a
--- /dev/null
+++ b/OpenSim.GridInterfaces/Local/LocalAssetServer.cs
@@ -0,0 +1,208 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4using System.Threading;
5using System.IO;
6using OpenSim.Framework.Interfaces;
7using OpenSim.Framework.Assets;
8using OpenSim.Framework.Utilities;
9using libsecondlife;
10using Db4objects.Db4o;
11using Db4objects.Db4o.Query;
12
13namespace OpenSim.GridInterfaces.Local
14{
15 public class LocalAssetPlugin : IAssetPlugin
16 {
17 public LocalAssetPlugin()
18 {
19
20 }
21
22 public IAssetServer GetAssetServer()
23 {
24 return (new LocalAssetServer());
25 }
26 }
27
28 public class LocalAssetServer : IAssetServer
29 {
30 private IAssetReceiver _receiver;
31 private BlockingQueue<ARequest> _assetRequests;
32 private IObjectContainer db;
33 private Thread _localAssetServerThread;
34
35 public LocalAssetServer()
36 {
37 bool yapfile;
38 this._assetRequests = new BlockingQueue<ARequest>();
39 yapfile = System.IO.File.Exists("assets.yap");
40
41 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Local Asset Server class created");
42 try
43 {
44 db = Db4oFactory.OpenFile("assets.yap");
45 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Db4 Asset database creation");
46 }
47 catch (Exception e)
48 {
49 db.Close();
50 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Db4 Asset server :Constructor - Exception occured");
51 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(e.ToString());
52 }
53 if (!yapfile)
54 {
55 this.SetUpAssetDatabase();
56 }
57 this._localAssetServerThread = new Thread(new ThreadStart(RunRequests));
58 this._localAssetServerThread.IsBackground = true;
59 this._localAssetServerThread.Start();
60
61 }
62
63 public void SetReceiver(IAssetReceiver receiver)
64 {
65 this._receiver = receiver;
66 }
67
68 public void RequestAsset(LLUUID assetID, bool isTexture)
69 {
70 ARequest req = new ARequest();
71 req.AssetID = assetID;
72 req.IsTexture = isTexture;
73 this._assetRequests.Enqueue(req);
74 }
75
76 public void UpdateAsset(AssetBase asset)
77 {
78
79 }
80
81 public void UploadNewAsset(AssetBase asset)
82 {
83 AssetStorage store = new AssetStorage();
84 store.Data = asset.Data;
85 store.Name = asset.Name;
86 store.UUID = asset.FullID;
87 db.Set(store);
88 db.Commit();
89 }
90
91 public void SetServerInfo(string ServerUrl, string ServerKey)
92 {
93
94 }
95 public void Close()
96 {
97 if (db != null)
98 {
99 Console.WriteLine("Closing local Asset server database");
100 db.Close();
101 }
102 }
103
104 private void RunRequests()
105 {
106 while (true)
107 {
108 byte[] idata = null;
109 bool found = false;
110 AssetStorage foundAsset = null;
111 ARequest req = this._assetRequests.Dequeue();
112 IObjectSet result = db.Query(new AssetUUIDQuery(req.AssetID));
113 if (result.Count > 0)
114 {
115 foundAsset = (AssetStorage)result.Next();
116 found = true;
117 }
118
119 AssetBase asset = new AssetBase();
120 if (found)
121 {
122 asset.FullID = foundAsset.UUID;
123 asset.Type = foundAsset.Type;
124 asset.InvType = foundAsset.Type;
125 asset.Name = foundAsset.Name;
126 idata = foundAsset.Data;
127 }
128 else
129 {
130 asset.FullID = LLUUID.Zero;
131 }
132 asset.Data = idata;
133 _receiver.AssetReceived(asset, req.IsTexture);
134 }
135
136 }
137
138 private void SetUpAssetDatabase()
139 {
140 Console.WriteLine("setting up Asset database");
141
142 AssetBase Image = new AssetBase();
143 Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000001");
144 Image.Name = "test Texture";
145 this.LoadAsset(Image, true, "testpic2.jp2");
146 AssetStorage store = new AssetStorage();
147 store.Data = Image.Data;
148 store.Name = Image.Name;
149 store.UUID = Image.FullID;
150 db.Set(store);
151 db.Commit();
152
153 Image = new AssetBase();
154 Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000002");
155 Image.Name = "test Texture2";
156 this.LoadAsset(Image, true, "map_base.jp2");
157 store = new AssetStorage();
158 store.Data = Image.Data;
159 store.Name = Image.Name;
160 store.UUID = Image.FullID;
161 db.Set(store);
162 db.Commit();
163
164 Image = new AssetBase();
165 Image.FullID = new LLUUID("00000000-0000-0000-5005-000000000005");
166 Image.Name = "Prim Base Texture";
167 this.LoadAsset(Image, true, "testpic2.jp2");
168 store = new AssetStorage();
169 store.Data = Image.Data;
170 store.Name = Image.Name;
171 store.UUID = Image.FullID;
172 db.Set(store);
173 db.Commit();
174
175 Image = new AssetBase();
176 Image.FullID = new LLUUID("66c41e39-38f9-f75a-024e-585989bfab73");
177 Image.Name = "Shape";
178 this.LoadAsset(Image, false, "base_shape.dat");
179 store = new AssetStorage();
180 store.Data = Image.Data;
181 store.Name = Image.Name;
182 store.UUID = Image.FullID;
183 db.Set(store);
184 db.Commit();
185
186
187 }
188
189 private void LoadAsset(AssetBase info, bool image, string filename)
190 {
191 //should request Asset from storage manager
192 //but for now read from file
193
194 string dataPath = Path.Combine(System.AppDomain.CurrentDomain.BaseDirectory, "assets"); //+ folder;
195 string fileName = Path.Combine(dataPath, filename);
196 FileInfo fInfo = new FileInfo(fileName);
197 long numBytes = fInfo.Length;
198 FileStream fStream = new FileStream(fileName, FileMode.Open, FileAccess.Read);
199 byte[] idata = new byte[numBytes];
200 BinaryReader br = new BinaryReader(fStream);
201 idata = br.ReadBytes((int)numBytes);
202 br.Close();
203 fStream.Close();
204 info.Data = idata;
205 //info.loaded=true;
206 }
207 }
208}
diff --git a/src/LocalServers/LocalGridServers/LocalGrid.cs b/OpenSim.GridInterfaces/Local/LocalGridServer.cs
index bd377d3..d70e989 100644
--- a/src/LocalServers/LocalGridServers/LocalGrid.cs
+++ b/OpenSim.GridInterfaces/Local/LocalGridServer.cs
@@ -27,10 +27,14 @@
27using System; 27using System;
28using System.Collections.Generic; 28using System.Collections.Generic;
29using System.Threading; 29using System.Threading;
30using OpenSim.GridServers; 30using System.IO;
31using OpenSim.Framework.Interfaces;
32using OpenSim.Framework.Assets;
31using libsecondlife; 33using libsecondlife;
34using Db4objects.Db4o;
35using Db4objects.Db4o.Query;
32 36
33namespace LocalGridServers 37namespace OpenSim.GridInterfaces.Local
34{ 38{
35 /// <summary> 39 /// <summary>
36 /// 40 ///
@@ -49,86 +53,26 @@ namespace LocalGridServers
49 } 53 }
50 } 54 }
51 55
52 public class LocalAssetPlugin : IAssetPlugin
53 {
54 public LocalAssetPlugin()
55 {
56
57 }
58
59 public IAssetServer GetAssetServer()
60 {
61 return(new LocalAssetServer());
62 }
63 }
64
65 public class LocalAssetServer : IAssetServer
66 {
67 private IAssetReceiver _receiver;
68 private BlockingQueue<ARequest> _assetRequests;
69
70 public LocalAssetServer()
71 {
72 this._assetRequests = new BlockingQueue<ARequest>();
73 ServerConsole.MainConsole.Instance.WriteLine("Local Asset Server class created");
74 }
75
76 public void SetReceiver(IAssetReceiver receiver)
77 {
78 this._receiver = receiver;
79 }
80
81 public void RequestAsset(LLUUID assetID, bool isTexture)
82 {
83 ARequest req = new ARequest();
84 req.AssetID = assetID;
85 req.IsTexture = isTexture;
86 //this._assetRequests.Enqueue(req);
87 }
88
89 public void UpdateAsset(AssetBase asset)
90 {
91
92 }
93
94 public void UploadNewAsset(AssetBase asset)
95 {
96
97 }
98
99 public void SetServerInfo(string ServerUrl, string SendKey)
100 {
101
102 }
103
104 private void RunRequests()
105 {
106 while(true)
107 {
108 Thread.Sleep(1000);
109 }
110 }
111 }
112
113 public class LocalGridServer : LocalGridBase 56 public class LocalGridServer : LocalGridBase
114 { 57 {
115 public List<Login> Sessions = new List<Login>(); 58 public List<Login> Sessions = new List<Login>();
116 59
117 public LocalGridServer() 60 public LocalGridServer()
118 { 61 {
119 Sessions = new List<Login>(); 62 Sessions = new List<Login>();
120 ServerConsole.MainConsole.Instance.WriteLine("Local Grid Server class created"); 63 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Local Grid Server class created");
121 }
122
123 public override string GetName()
124 {
125 return "Local";
126 } 64 }
127 65
128 public override bool RequestConnection() 66 public override bool RequestConnection()
129 { 67 {
130 return true; 68 return true;
131 } 69 }
70
71 public override string GetName()
72 {
73 return "Local";
74 }
75
132 public override AuthenticateResponse AuthenticateSession(LLUUID sessionID, LLUUID agentID, uint circuitCode) 76 public override AuthenticateResponse AuthenticateSession(LLUUID sessionID, LLUUID agentID, uint circuitCode)
133 { 77 {
134 //we are running local 78 //we are running local
@@ -159,17 +103,22 @@ namespace LocalGridServers
159 UUIDBlock uuidBlock = new UUIDBlock(); 103 UUIDBlock uuidBlock = new UUIDBlock();
160 return(uuidBlock); 104 return(uuidBlock);
161 } 105 }
162 106
163 public override neighbourinfo[] RequestNeighbours(ulong regionhandle) 107 public override NeighbourInfo[] RequestNeighbours()
164 { 108 {
165 return new neighbourinfo[8]; 109 return null;
166 } 110 }
167 111
168 public override void SetServerInfo(string GridServerUrl, string GridSendKey, string GridRecvKey, string UserServerUrl, string UserSendKey, string UserRecvKey) 112 public override void SetServerInfo(string ServerUrl, string SendKey, string RecvKey)
169 { 113 {
170 114
171 } 115 }
172 116
117 public override void Close()
118 {
119
120 }
121
173 /// <summary> 122 /// <summary>
174 /// used by the local login server to inform us of new sessions 123 /// used by the local login server to inform us of new sessions
175 /// </summary> 124 /// </summary>
@@ -182,30 +131,26 @@ namespace LocalGridServers
182 } 131 }
183 } 132 }
184 } 133 }
185
186 public class BlockingQueue< T > {
187 private Queue< T > _queue = new Queue< T >();
188 private object _queueSync = new object();
189 134
190 public void Enqueue(T value) 135 public class AssetUUIDQuery : Predicate
136 {
137 private LLUUID _findID;
138
139 public AssetUUIDQuery(LLUUID find)
191 { 140 {
192 lock(_queueSync) 141 _findID = find;
193 {
194 _queue.Enqueue(value);
195 Monitor.Pulse(_queueSync);
196 }
197 } 142 }
198 143 public bool Match(AssetStorage asset)
199 public T Dequeue()
200 { 144 {
201 lock(_queueSync) 145 return (asset.UUID == _findID);
202 {
203 if( _queue.Count < 1)
204 Monitor.Wait(_queueSync);
205
206 return _queue.Dequeue();
207 }
208 } 146 }
209 } 147 }
210 148
149 public class AssetStorage
150 {
151 public byte[] Data;
152 public sbyte Type;
153 public string Name;
154 public LLUUID UUID;
155 }
211} 156}
diff --git a/OpenSim.GridInterfaces/Local/OpenSim.GridInterfaces.Local.csproj b/OpenSim.GridInterfaces/Local/OpenSim.GridInterfaces.Local.csproj
new file mode 100644
index 0000000..b3318af
--- /dev/null
+++ b/OpenSim.GridInterfaces/Local/OpenSim.GridInterfaces.Local.csproj
@@ -0,0 +1,104 @@
1<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
2 <PropertyGroup>
3 <ProjectType>Local</ProjectType>
4 <ProductVersion>8.0.50727</ProductVersion>
5 <SchemaVersion>2.0</SchemaVersion>
6 <ProjectGuid>{FBF3DA4B-5176-4602-AA52-482D077EEC88}</ProjectGuid>
7 <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
8 <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
9 <ApplicationIcon></ApplicationIcon>
10 <AssemblyKeyContainerName>
11 </AssemblyKeyContainerName>
12 <AssemblyName>OpenSim.GridInterfaces.Local</AssemblyName>
13 <DefaultClientScript>JScript</DefaultClientScript>
14 <DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout>
15 <DefaultTargetSchema>IE50</DefaultTargetSchema>
16 <DelaySign>false</DelaySign>
17 <OutputType>Library</OutputType>
18 <AppDesignerFolder></AppDesignerFolder>
19 <RootNamespace>OpenSim.GridInterfaces.Local</RootNamespace>
20 <StartupObject></StartupObject>
21 <FileUpgradeFlags>
22 </FileUpgradeFlags>
23 </PropertyGroup>
24 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
25 <AllowUnsafeBlocks>False</AllowUnsafeBlocks>
26 <BaseAddress>285212672</BaseAddress>
27 <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
28 <ConfigurationOverrideFile>
29 </ConfigurationOverrideFile>
30 <DefineConstants>TRACE;DEBUG</DefineConstants>
31 <DocumentationFile></DocumentationFile>
32 <DebugSymbols>True</DebugSymbols>
33 <FileAlignment>4096</FileAlignment>
34 <Optimize>False</Optimize>
35 <OutputPath>..\..\bin\</OutputPath>
36 <RegisterForComInterop>False</RegisterForComInterop>
37 <RemoveIntegerChecks>False</RemoveIntegerChecks>
38 <TreatWarningsAsErrors>False</TreatWarningsAsErrors>
39 <WarningLevel>4</WarningLevel>
40 <NoWarn></NoWarn>
41 </PropertyGroup>
42 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
43 <AllowUnsafeBlocks>False</AllowUnsafeBlocks>
44 <BaseAddress>285212672</BaseAddress>
45 <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
46 <ConfigurationOverrideFile>
47 </ConfigurationOverrideFile>
48 <DefineConstants>TRACE</DefineConstants>
49 <DocumentationFile></DocumentationFile>
50 <DebugSymbols>False</DebugSymbols>
51 <FileAlignment>4096</FileAlignment>
52 <Optimize>True</Optimize>
53 <OutputPath>..\..\bin\</OutputPath>
54 <RegisterForComInterop>False</RegisterForComInterop>
55 <RemoveIntegerChecks>False</RemoveIntegerChecks>
56 <TreatWarningsAsErrors>False</TreatWarningsAsErrors>
57 <WarningLevel>4</WarningLevel>
58 <NoWarn></NoWarn>
59 </PropertyGroup>
60 <ItemGroup>
61 <Reference Include="System" >
62 <HintPath>\System.dll</HintPath>
63 </Reference>
64 <Reference Include="System.Xml.dll" >
65 <HintPath>\System.Xml.dll.dll</HintPath>
66 </Reference>
67 <Reference Include="Db4objects.Db4o.dll" >
68 <HintPath>\Db4objects.Db4o.dll.dll</HintPath>
69 </Reference>
70 <Reference Include="libsecondlife.dll" >
71 <HintPath>\libsecondlife.dll.dll</HintPath>
72 </Reference>
73 </ItemGroup>
74 <ItemGroup>
75 <ProjectReference Include="..\..\OpenSim.Framework\OpenSim.Framework.csproj">
76 <Name>OpenSim.Framework</Name>
77 <Project>{1D2865A9-CF8E-45F7-B96D-91ED128A32CF}</Project>
78 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
79 </ProjectReference>
80 <ProjectReference Include="..\..\OpenSim.Framework.Console\OpenSim.Framework.Console.csproj">
81 <Name>OpenSim.Framework.Console</Name>
82 <Project>{C8405E1A-EC19-48B6-9C8C-CA03624B9916}</Project>
83 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
84 </ProjectReference>
85 </ItemGroup>
86 <ItemGroup>
87 <Compile Include="AssemblyInfo.cs">
88 <SubType>Code</SubType>
89 </Compile>
90 <Compile Include="LocalAssetServer.cs">
91 <SubType>Code</SubType>
92 </Compile>
93 <Compile Include="LocalGridServer.cs">
94 <SubType>Code</SubType>
95 </Compile>
96 </ItemGroup>
97 <Import Project="$(MSBuildBinPath)\Microsoft.CSHARP.Targets" />
98 <PropertyGroup>
99 <PreBuildEvent>
100 </PreBuildEvent>
101 <PostBuildEvent>
102 </PostBuildEvent>
103 </PropertyGroup>
104</Project>
diff --git a/OpenSim.GridInterfaces/Local/OpenSim.GridInterfaces.Local.dll.build b/OpenSim.GridInterfaces/Local/OpenSim.GridInterfaces.Local.dll.build
new file mode 100644
index 0000000..eff1fac
--- /dev/null
+++ b/OpenSim.GridInterfaces/Local/OpenSim.GridInterfaces.Local.dll.build
@@ -0,0 +1,46 @@
1<?xml version="1.0" ?>
2<project name="OpenSim.GridInterfaces.Local" default="build">
3 <target name="build">
4 <echo message="Build Directory is ${project::get-base-directory()}/${build.dir}" />
5 <mkdir dir="${project::get-base-directory()}/${build.dir}" />
6 <copy todir="${project::get-base-directory()}/${build.dir}">
7 <fileset basedir="${project::get-base-directory()}">
8 </fileset>
9 </copy>
10 <csc target="library" debug="${build.debug}" unsafe="False" define="TRACE;DEBUG" output="${project::get-base-directory()}/${build.dir}/${project::get-name()}.dll">
11 <resources prefix="OpenSim.GridInterfaces.Local" dynamicprefix="true" >
12 </resources>
13 <sources failonempty="true">
14 <include name="AssemblyInfo.cs" />
15 <include name="LocalAssetServer.cs" />
16 <include name="LocalGridServer.cs" />
17 </sources>
18 <references basedir="${project::get-base-directory()}">
19 <lib>
20 <include name="${project::get-base-directory()}" />
21 <include name="${project::get-base-directory()}/${build.dir}" />
22 </lib>
23 <include name="System.dll" />
24 <include name="System.Xml.dll.dll" />
25 <include name="../../bin/Db4objects.Db4o.dll" />
26 <include name="../../bin/libsecondlife.dll" />
27 <include name="../../OpenSim.Framework/${build.dir}/OpenSim.Framework.dll" />
28 <include name="../../OpenSim.Framework.Console/${build.dir}/OpenSim.Framework.Console.dll" />
29 </references>
30 </csc>
31 <echo message="Copying from [${project::get-base-directory()}/${build.dir}/] to [${project::get-base-directory()}/../../bin/" />
32 <mkdir dir="${project::get-base-directory()}/../../bin/"/>
33 <copy todir="${project::get-base-directory()}/../../bin/">
34 <fileset basedir="${project::get-base-directory()}/${build.dir}/" >
35 <include name="*.dll"/>
36 <include name="*.exe"/>
37 </fileset>
38 </copy>
39 </target>
40 <target name="clean">
41 <delete dir="${bin.dir}" failonerror="false" />
42 <delete dir="${obj.dir}" failonerror="false" />
43 </target>
44 <target name="doc" description="Creates documentation.">
45 </target>
46</project>
diff --git a/OpenSim.GridInterfaces/Remote/AssemblyInfo.cs b/OpenSim.GridInterfaces/Remote/AssemblyInfo.cs
new file mode 100644
index 0000000..0fa7d6e
--- /dev/null
+++ b/OpenSim.GridInterfaces/Remote/AssemblyInfo.cs
@@ -0,0 +1,31 @@
1using System.Reflection;
2using System.Runtime.CompilerServices;
3using System.Runtime.InteropServices;
4
5// Information about this assembly is defined by the following
6// attributes.
7//
8// change them to the information which is associated with the assembly
9// you compile.
10
11[assembly: AssemblyTitle("RemoteGridServers")]
12[assembly: AssemblyDescription("")]
13[assembly: AssemblyConfiguration("")]
14[assembly: AssemblyCompany("")]
15[assembly: AssemblyProduct("RemoteGridServers")]
16[assembly: AssemblyCopyright("")]
17[assembly: AssemblyTrademark("")]
18[assembly: AssemblyCulture("")]
19
20// This sets the default COM visibility of types in the assembly to invisible.
21// If you need to expose a type to COM, use [ComVisible(true)] on that type.
22[assembly: ComVisible(false)]
23
24// The assembly version has following format :
25//
26// Major.Minor.Build.Revision
27//
28// You can specify all values by your own or you can build default build and revision
29// numbers with the '*' character (the default):
30
31[assembly: AssemblyVersion("1.0.*")]
diff --git a/OpenSim.GridInterfaces/Remote/OpenSim.GridInterfaces.Remote.csproj b/OpenSim.GridInterfaces/Remote/OpenSim.GridInterfaces.Remote.csproj
new file mode 100644
index 0000000..37d1d12
--- /dev/null
+++ b/OpenSim.GridInterfaces/Remote/OpenSim.GridInterfaces.Remote.csproj
@@ -0,0 +1,101 @@
1<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
2 <PropertyGroup>
3 <ProjectType>Local</ProjectType>
4 <ProductVersion>8.0.50727</ProductVersion>
5 <SchemaVersion>2.0</SchemaVersion>
6 <ProjectGuid>{2AF1E37E-064D-4590-8D7E-B6390F721BAE}</ProjectGuid>
7 <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
8 <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
9 <ApplicationIcon></ApplicationIcon>
10 <AssemblyKeyContainerName>
11 </AssemblyKeyContainerName>
12 <AssemblyName>OpenSim.GridInterfaces.Remote</AssemblyName>
13 <DefaultClientScript>JScript</DefaultClientScript>
14 <DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout>
15 <DefaultTargetSchema>IE50</DefaultTargetSchema>
16 <DelaySign>false</DelaySign>
17 <OutputType>Library</OutputType>
18 <AppDesignerFolder></AppDesignerFolder>
19 <RootNamespace>OpenSim.GridInterfaces.Remote</RootNamespace>
20 <StartupObject></StartupObject>
21 <FileUpgradeFlags>
22 </FileUpgradeFlags>
23 </PropertyGroup>
24 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
25 <AllowUnsafeBlocks>False</AllowUnsafeBlocks>
26 <BaseAddress>285212672</BaseAddress>
27 <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
28 <ConfigurationOverrideFile>
29 </ConfigurationOverrideFile>
30 <DefineConstants>TRACE;DEBUG</DefineConstants>
31 <DocumentationFile></DocumentationFile>
32 <DebugSymbols>True</DebugSymbols>
33 <FileAlignment>4096</FileAlignment>
34 <Optimize>False</Optimize>
35 <OutputPath>..\..\bin\</OutputPath>
36 <RegisterForComInterop>False</RegisterForComInterop>
37 <RemoveIntegerChecks>False</RemoveIntegerChecks>
38 <TreatWarningsAsErrors>False</TreatWarningsAsErrors>
39 <WarningLevel>4</WarningLevel>
40 <NoWarn></NoWarn>
41 </PropertyGroup>
42 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
43 <AllowUnsafeBlocks>False</AllowUnsafeBlocks>
44 <BaseAddress>285212672</BaseAddress>
45 <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
46 <ConfigurationOverrideFile>
47 </ConfigurationOverrideFile>
48 <DefineConstants>TRACE</DefineConstants>
49 <DocumentationFile></DocumentationFile>
50 <DebugSymbols>False</DebugSymbols>
51 <FileAlignment>4096</FileAlignment>
52 <Optimize>True</Optimize>
53 <OutputPath>..\..\bin\</OutputPath>
54 <RegisterForComInterop>False</RegisterForComInterop>
55 <RemoveIntegerChecks>False</RemoveIntegerChecks>
56 <TreatWarningsAsErrors>False</TreatWarningsAsErrors>
57 <WarningLevel>4</WarningLevel>
58 <NoWarn></NoWarn>
59 </PropertyGroup>
60 <ItemGroup>
61 <Reference Include="System" >
62 <HintPath>\System.dll</HintPath>
63 </Reference>
64 <Reference Include="System.Xml.dll" >
65 <HintPath>\System.Xml.dll.dll</HintPath>
66 </Reference>
67 <Reference Include="libsecondlife.dll" >
68 <HintPath>\libsecondlife.dll.dll</HintPath>
69 </Reference>
70 </ItemGroup>
71 <ItemGroup>
72 <ProjectReference Include="..\..\OpenSim.Framework\OpenSim.Framework.csproj">
73 <Name>OpenSim.Framework</Name>
74 <Project>{1D2865A9-CF8E-45F7-B96D-91ED128A32CF}</Project>
75 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
76 </ProjectReference>
77 <ProjectReference Include="..\..\OpenSim.Framework.Console\OpenSim.Framework.Console.csproj">
78 <Name>OpenSim.Framework.Console</Name>
79 <Project>{C8405E1A-EC19-48B6-9C8C-CA03624B9916}</Project>
80 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
81 </ProjectReference>
82 </ItemGroup>
83 <ItemGroup>
84 <Compile Include="AssemblyInfo.cs">
85 <SubType>Code</SubType>
86 </Compile>
87 <Compile Include="RemoteAssetServer.cs">
88 <SubType>Code</SubType>
89 </Compile>
90 <Compile Include="RemoteGridServer.cs">
91 <SubType>Code</SubType>
92 </Compile>
93 </ItemGroup>
94 <Import Project="$(MSBuildBinPath)\Microsoft.CSHARP.Targets" />
95 <PropertyGroup>
96 <PreBuildEvent>
97 </PreBuildEvent>
98 <PostBuildEvent>
99 </PostBuildEvent>
100 </PropertyGroup>
101</Project>
diff --git a/OpenSim.GridInterfaces/Remote/OpenSim.GridInterfaces.Remote.dll.build b/OpenSim.GridInterfaces/Remote/OpenSim.GridInterfaces.Remote.dll.build
new file mode 100644
index 0000000..e0d24ff
--- /dev/null
+++ b/OpenSim.GridInterfaces/Remote/OpenSim.GridInterfaces.Remote.dll.build
@@ -0,0 +1,45 @@
1<?xml version="1.0" ?>
2<project name="OpenSim.GridInterfaces.Remote" default="build">
3 <target name="build">
4 <echo message="Build Directory is ${project::get-base-directory()}/${build.dir}" />
5 <mkdir dir="${project::get-base-directory()}/${build.dir}" />
6 <copy todir="${project::get-base-directory()}/${build.dir}">
7 <fileset basedir="${project::get-base-directory()}">
8 </fileset>
9 </copy>
10 <csc target="library" debug="${build.debug}" unsafe="False" define="TRACE;DEBUG" output="${project::get-base-directory()}/${build.dir}/${project::get-name()}.dll">
11 <resources prefix="OpenSim.GridInterfaces.Remote" dynamicprefix="true" >
12 </resources>
13 <sources failonempty="true">
14 <include name="AssemblyInfo.cs" />
15 <include name="RemoteAssetServer.cs" />
16 <include name="RemoteGridServer.cs" />
17 </sources>
18 <references basedir="${project::get-base-directory()}">
19 <lib>
20 <include name="${project::get-base-directory()}" />
21 <include name="${project::get-base-directory()}/${build.dir}" />
22 </lib>
23 <include name="System.dll" />
24 <include name="System.Xml.dll.dll" />
25 <include name="../../bin/libsecondlife.dll" />
26 <include name="../../OpenSim.Framework/${build.dir}/OpenSim.Framework.dll" />
27 <include name="../../OpenSim.Framework.Console/${build.dir}/OpenSim.Framework.Console.dll" />
28 </references>
29 </csc>
30 <echo message="Copying from [${project::get-base-directory()}/${build.dir}/] to [${project::get-base-directory()}/../../bin/" />
31 <mkdir dir="${project::get-base-directory()}/../../bin/"/>
32 <copy todir="${project::get-base-directory()}/../../bin/">
33 <fileset basedir="${project::get-base-directory()}/${build.dir}/" >
34 <include name="*.dll"/>
35 <include name="*.exe"/>
36 </fileset>
37 </copy>
38 </target>
39 <target name="clean">
40 <delete dir="${bin.dir}" failonerror="false" />
41 <delete dir="${obj.dir}" failonerror="false" />
42 </target>
43 <target name="doc" description="Creates documentation.">
44 </target>
45</project>
diff --git a/OpenSim.GridInterfaces/Remote/RemoteAssetServer.cs b/OpenSim.GridInterfaces/Remote/RemoteAssetServer.cs
new file mode 100644
index 0000000..528e9fa
--- /dev/null
+++ b/OpenSim.GridInterfaces/Remote/RemoteAssetServer.cs
@@ -0,0 +1,102 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4using System.Threading;
5using System.Net;
6using System.Net.Sockets;
7using System.IO;
8using libsecondlife;
9using OpenSim.Framework.Interfaces;
10using OpenSim.Framework.Assets;
11using OpenSim.Framework.Utilities;
12
13namespace OpenSim.GridInterfaces.Remote
14{
15 public class RemoteAssetServer : IAssetServer
16 {
17 private IAssetReceiver _receiver;
18 private BlockingQueue<ARequest> _assetRequests;
19 private Thread _remoteAssetServerThread;
20 private string AssetServerUrl;
21 private string AssetSendKey;
22
23 public RemoteAssetServer()
24 {
25 this._assetRequests = new BlockingQueue<ARequest>();
26 this._remoteAssetServerThread = new Thread(new ThreadStart(RunRequests));
27 this._remoteAssetServerThread.IsBackground = true;
28 this._remoteAssetServerThread.Start();
29 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Remote Asset Server class created");
30 }
31
32 public void SetReceiver(IAssetReceiver receiver)
33 {
34 this._receiver = receiver;
35 }
36
37 public void RequestAsset(LLUUID assetID, bool isTexture)
38 {
39 ARequest req = new ARequest();
40 req.AssetID = assetID;
41 req.IsTexture = isTexture;
42 this._assetRequests.Enqueue(req);
43 }
44
45 public void UpdateAsset(AssetBase asset)
46 {
47
48 }
49
50 public void UploadNewAsset(AssetBase asset)
51 {
52
53 }
54
55 public void SetServerInfo(string ServerUrl, string ServerKey)
56 {
57 this.AssetServerUrl = ServerUrl;
58 this.AssetSendKey = ServerKey;
59 }
60
61 private void RunRequests()
62 {
63 while (true)
64 {
65 //we need to add support for the asset server not knowing about a requested asset
66 ARequest req = this._assetRequests.Dequeue();
67 LLUUID assetID = req.AssetID;
68 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(" RemoteAssetServer- Got a AssetServer request, processing it");
69 WebRequest AssetLoad = WebRequest.Create(this.AssetServerUrl + "getasset/" + AssetSendKey + "/" + assetID + "/data");
70 WebResponse AssetResponse = AssetLoad.GetResponse();
71 byte[] idata = new byte[(int)AssetResponse.ContentLength];
72 BinaryReader br = new BinaryReader(AssetResponse.GetResponseStream());
73 idata = br.ReadBytes((int)AssetResponse.ContentLength);
74 br.Close();
75
76 AssetBase asset = new AssetBase();
77 asset.FullID = assetID;
78 asset.Data = idata;
79 _receiver.AssetReceived(asset, req.IsTexture);
80 }
81 }
82
83 public void Close()
84 {
85
86 }
87 }
88
89 public class RemoteAssetPlugin : IAssetPlugin
90 {
91 public RemoteAssetPlugin()
92 {
93
94 }
95
96 public IAssetServer GetAssetServer()
97 {
98 return (new RemoteAssetServer());
99 }
100 }
101
102}
diff --git a/OpenSim.GridInterfaces/Remote/RemoteGridServer.cs b/OpenSim.GridInterfaces/Remote/RemoteGridServer.cs
new file mode 100644
index 0000000..5f48916
--- /dev/null
+++ b/OpenSim.GridInterfaces/Remote/RemoteGridServer.cs
@@ -0,0 +1,156 @@
1/*
2* Copyright (c) OpenSim project, http://sim.opensecondlife.org/
3*
4* Redistribution and use in source and binary forms, with or without
5* modification, are permitted provided that the following conditions are met:
6* * Redistributions of source code must retain the above copyright
7* notice, this list of conditions and the following disclaimer.
8* * Redistributions in binary form must reproduce the above copyright
9* notice, this list of conditions and the following disclaimer in the
10* documentation and/or other materials provided with the distribution.
11* * Neither the name of the <organization> nor the
12* names of its contributors may be used to endorse or promote products
13* derived from this software without specific prior written permission.
14*
15* THIS SOFTWARE IS PROVIDED BY <copyright holder> ``AS IS'' AND ANY
16* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
18* DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY
19* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
20* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
21* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
22* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
24* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25*
26*/
27using System;
28using System.Collections.Generic;
29using System.Threading;
30using System.Net;
31using System.Net.Sockets;
32using System.IO;
33using libsecondlife;
34using OpenSim.Framework.Interfaces;
35using OpenSim.Framework.Assets;
36
37namespace OpenSim.GridInterfaces.Remote
38{
39 public class RemoteGridServer : RemoteGridBase
40 {
41 private string GridServerUrl;
42 private string GridSendKey;
43 private string GridRecvKey;
44 private Dictionary<uint, AgentCircuitData> AgentCircuits = new Dictionary<uint, AgentCircuitData>();
45
46 public override Dictionary<uint, AgentCircuitData> agentcircuits
47 {
48 get { return AgentCircuits; }
49 set { AgentCircuits = value; }
50 }
51
52 public RemoteGridServer()
53 {
54 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Remote Grid Server class created");
55 }
56
57 public override bool RequestConnection()
58 {
59 return true;
60 }
61
62 public override AuthenticateResponse AuthenticateSession(LLUUID sessionID, LLUUID agentID, uint circuitcode)
63 {
64 AgentCircuitData validcircuit = null;
65 if (this.AgentCircuits.ContainsKey(circuitcode))
66 {
67 validcircuit = this.AgentCircuits[circuitcode];
68 }
69 AuthenticateResponse user = new AuthenticateResponse();
70 if (validcircuit == null)
71 {
72 //don't have this circuit code in our list
73 user.Authorised = false;
74 return (user);
75 }
76
77 if ((sessionID == validcircuit.SessionID) && (agentID == validcircuit.AgentID))
78 {
79 // YAY! Valid login
80 user.Authorised = true;
81 user.LoginInfo = new Login();
82 user.LoginInfo.Agent = agentID;
83 user.LoginInfo.Session = sessionID;
84 user.LoginInfo.SecureSession = validcircuit.SecureSessionID;
85 user.LoginInfo.First = validcircuit.firstname;
86 user.LoginInfo.Last = validcircuit.lastname;
87 }
88 else
89 {
90 // Invalid
91 user.Authorised = false;
92 }
93
94 return (user);
95 }
96
97 public override bool LogoutSession(LLUUID sessionID, LLUUID agentID, uint circuitCode)
98 {
99 WebRequest DeleteSession = WebRequest.Create(GridServerUrl + "/usersessions/" + sessionID.ToString());
100 DeleteSession.Method = "DELETE";
101 DeleteSession.ContentType = "text/plaintext";
102 DeleteSession.ContentLength = 0;
103
104 StreamWriter stOut = new StreamWriter(DeleteSession.GetRequestStream(), System.Text.Encoding.ASCII);
105 stOut.Write("");
106 stOut.Close();
107
108 StreamReader stIn = new StreamReader(DeleteSession.GetResponse().GetResponseStream());
109 string GridResponse = stIn.ReadToEnd();
110 stIn.Close();
111 return (true);
112 }
113
114 public override UUIDBlock RequestUUIDBlock()
115 {
116 UUIDBlock uuidBlock = new UUIDBlock();
117 return (uuidBlock);
118 }
119
120 public override NeighbourInfo[] RequestNeighbours()
121 {
122 return null;
123 }
124
125 public override void SetServerInfo(string ServerUrl, string SendKey, string RecvKey)
126 {
127 this.GridServerUrl = ServerUrl;
128 this.GridSendKey = SendKey;
129 this.GridRecvKey = RecvKey;
130 }
131
132 public override string GetName()
133 {
134 return "Remote";
135 }
136
137 public override void Close()
138 {
139
140 }
141 }
142
143 public class RemoteGridPlugin : IGridPlugin
144 {
145 public RemoteGridPlugin()
146 {
147
148 }
149
150 public IGridServer GetGridServer()
151 {
152 return (new RemoteGridServer());
153 }
154 }
155
156}
diff --git a/OpenSim.Physics/BasicPhysicsPlugin/AssemblyInfo.cs b/OpenSim.Physics/BasicPhysicsPlugin/AssemblyInfo.cs
new file mode 100644
index 0000000..0c9c06c
--- /dev/null
+++ b/OpenSim.Physics/BasicPhysicsPlugin/AssemblyInfo.cs
@@ -0,0 +1,31 @@
1using System.Reflection;
2using System.Runtime.CompilerServices;
3using System.Runtime.InteropServices;
4
5// Information about this assembly is defined by the following
6// attributes.
7//
8// change them to the information which is associated with the assembly
9// you compile.
10
11[assembly: AssemblyTitle("PhysXplugin")]
12[assembly: AssemblyDescription("")]
13[assembly: AssemblyConfiguration("")]
14[assembly: AssemblyCompany("")]
15[assembly: AssemblyProduct("PhysXplugin")]
16[assembly: AssemblyCopyright("")]
17[assembly: AssemblyTrademark("")]
18[assembly: AssemblyCulture("")]
19
20// This sets the default COM visibility of types in the assembly to invisible.
21// If you need to expose a type to COM, use [ComVisible(true)] on that type.
22[assembly: ComVisible(false)]
23
24// The assembly version has following format :
25//
26// Major.Minor.Build.Revision
27//
28// You can specify all values by your own or you can build default build and revision
29// numbers with the '*' character (the default):
30
31[assembly: AssemblyVersion("1.0.*")]
diff --git a/src/physics/plugins/PhysXplugin.cs b/OpenSim.Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs
index 8c09dc8..deff803 100644
--- a/src/physics/plugins/PhysXplugin.cs
+++ b/OpenSim.Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs
@@ -26,18 +26,18 @@
26*/ 26*/
27using System; 27using System;
28using System.Collections.Generic; 28using System.Collections.Generic;
29using PhysicsSystem; 29using OpenSim.Physics.Manager;
30 30
31namespace PhysXplugin 31namespace OpenSim.Physics.BasicPhysicsPlugin
32{ 32{
33 /// <summary> 33 /// <summary>
34 /// Will be the PhysX plugin but for now will be a very basic physics engine 34 /// Will be the PhysX plugin but for now will be a very basic physics engine
35 /// </summary> 35 /// </summary>
36 public class PhysXPlugin : IPhysicsPlugin 36 public class BasicPhysicsPlugin : IPhysicsPlugin
37 { 37 {
38 private PhysXScene _mScene; 38 private BasicScene _mScene;
39 39
40 public PhysXPlugin() 40 public BasicPhysicsPlugin()
41 { 41 {
42 42
43 } 43 }
@@ -51,14 +51,14 @@ namespace PhysXplugin
51 { 51 {
52 if(_mScene == null) 52 if(_mScene == null)
53 { 53 {
54 _mScene = new PhysXScene(); 54 _mScene = new BasicScene();
55 } 55 }
56 return(_mScene); 56 return(_mScene);
57 } 57 }
58 58
59 public string GetName() 59 public string GetName()
60 { 60 {
61 return("PhysX"); 61 return("basicphysics");
62 } 62 }
63 63
64 public void Dispose() 64 public void Dispose()
@@ -67,19 +67,19 @@ namespace PhysXplugin
67 } 67 }
68 } 68 }
69 69
70 public class PhysXScene :PhysicsScene 70 public class BasicScene :PhysicsScene
71 { 71 {
72 private List<PhysXActor> _actors = new List<PhysXActor>(); 72 private List<BasicActor> _actors = new List<BasicActor>();
73 private float[] _heightMap; 73 private float[] _heightMap;
74 74
75 public PhysXScene() 75 public BasicScene()
76 { 76 {
77 77
78 } 78 }
79 79
80 public override PhysicsActor AddAvatar(PhysicsVector position) 80 public override PhysicsActor AddAvatar(PhysicsVector position)
81 { 81 {
82 PhysXActor act = new PhysXActor(); 82 BasicActor act = new BasicActor();
83 act.Position = position; 83 act.Position = position;
84 _actors.Add(act); 84 _actors.Add(act);
85 return act; 85 return act;
@@ -92,7 +92,7 @@ namespace PhysXplugin
92 92
93 public override void Simulate(float timeStep) 93 public override void Simulate(float timeStep)
94 { 94 {
95 foreach (PhysXActor actor in _actors) 95 foreach (BasicActor actor in _actors)
96 { 96 {
97 actor.Position.X = actor.Position.X + (actor.Velocity.X * timeStep); 97 actor.Position.X = actor.Position.X + (actor.Velocity.X * timeStep);
98 actor.Position.Y = actor.Position.Y + (actor.Velocity.Y * timeStep); 98 actor.Position.Y = actor.Position.Y + (actor.Velocity.Y * timeStep);
@@ -151,13 +151,13 @@ namespace PhysXplugin
151 } 151 }
152 } 152 }
153 153
154 public class PhysXActor : PhysicsActor 154 public class BasicActor : PhysicsActor
155 { 155 {
156 private PhysicsVector _position; 156 private PhysicsVector _position;
157 private PhysicsVector _velocity; 157 private PhysicsVector _velocity;
158 private PhysicsVector _acceleration; 158 private PhysicsVector _acceleration;
159 private bool flying; 159 private bool flying;
160 public PhysXActor() 160 public BasicActor()
161 { 161 {
162 _velocity = new PhysicsVector(); 162 _velocity = new PhysicsVector();
163 _position = new PhysicsVector(); 163 _position = new PhysicsVector();
@@ -200,6 +200,18 @@ namespace PhysXplugin
200 } 200 }
201 } 201 }
202 202
203 public override Axiom.MathLib.Quaternion Orientation
204 {
205 get
206 {
207 return Axiom.MathLib.Quaternion.Identity;
208 }
209 set
210 {
211
212 }
213 }
214
203 public override PhysicsVector Acceleration 215 public override PhysicsVector Acceleration
204 { 216 {
205 get 217 get
@@ -208,6 +220,18 @@ namespace PhysXplugin
208 } 220 }
209 221
210 } 222 }
223
224 public override bool Kinematic
225 {
226 get
227 {
228 return true;
229 }
230 set
231 {
232
233 }
234 }
211 public void SetAcceleration (PhysicsVector accel) 235 public void SetAcceleration (PhysicsVector accel)
212 { 236 {
213 this._acceleration = accel; 237 this._acceleration = accel;
diff --git a/OpenSim.Physics/BasicPhysicsPlugin/OpenSim.Physics.BasicPhysicsPlugin.csproj b/OpenSim.Physics/BasicPhysicsPlugin/OpenSim.Physics.BasicPhysicsPlugin.csproj
new file mode 100644
index 0000000..dbfebd3
--- /dev/null
+++ b/OpenSim.Physics/BasicPhysicsPlugin/OpenSim.Physics.BasicPhysicsPlugin.csproj
@@ -0,0 +1,90 @@
1<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
2 <PropertyGroup>
3 <ProjectType>Local</ProjectType>
4 <ProductVersion>8.0.50727</ProductVersion>
5 <SchemaVersion>2.0</SchemaVersion>
6 <ProjectGuid>{00594B9E-29A5-4B9C-AEBD-0AD08C73CFE8}</ProjectGuid>
7 <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
8 <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
9 <ApplicationIcon></ApplicationIcon>
10 <AssemblyKeyContainerName>
11 </AssemblyKeyContainerName>
12 <AssemblyName>OpenSim.Physics.BasicPhysicsPlugin</AssemblyName>
13 <DefaultClientScript>JScript</DefaultClientScript>
14 <DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout>
15 <DefaultTargetSchema>IE50</DefaultTargetSchema>
16 <DelaySign>false</DelaySign>
17 <OutputType>Library</OutputType>
18 <AppDesignerFolder></AppDesignerFolder>
19 <RootNamespace>OpenSim.Physics.BasicPhysicsPlugin</RootNamespace>
20 <StartupObject></StartupObject>
21 <FileUpgradeFlags>
22 </FileUpgradeFlags>
23 </PropertyGroup>
24 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
25 <AllowUnsafeBlocks>False</AllowUnsafeBlocks>
26 <BaseAddress>285212672</BaseAddress>
27 <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
28 <ConfigurationOverrideFile>
29 </ConfigurationOverrideFile>
30 <DefineConstants>TRACE;DEBUG</DefineConstants>
31 <DocumentationFile></DocumentationFile>
32 <DebugSymbols>True</DebugSymbols>
33 <FileAlignment>4096</FileAlignment>
34 <Optimize>False</Optimize>
35 <OutputPath>..\..\bin\Physics\</OutputPath>
36 <RegisterForComInterop>False</RegisterForComInterop>
37 <RemoveIntegerChecks>False</RemoveIntegerChecks>
38 <TreatWarningsAsErrors>False</TreatWarningsAsErrors>
39 <WarningLevel>4</WarningLevel>
40 <NoWarn></NoWarn>
41 </PropertyGroup>
42 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
43 <AllowUnsafeBlocks>False</AllowUnsafeBlocks>
44 <BaseAddress>285212672</BaseAddress>
45 <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
46 <ConfigurationOverrideFile>
47 </ConfigurationOverrideFile>
48 <DefineConstants>TRACE</DefineConstants>
49 <DocumentationFile></DocumentationFile>
50 <DebugSymbols>False</DebugSymbols>
51 <FileAlignment>4096</FileAlignment>
52 <Optimize>True</Optimize>
53 <OutputPath>..\..\bin\Physics\</OutputPath>
54 <RegisterForComInterop>False</RegisterForComInterop>
55 <RemoveIntegerChecks>False</RemoveIntegerChecks>
56 <TreatWarningsAsErrors>False</TreatWarningsAsErrors>
57 <WarningLevel>4</WarningLevel>
58 <NoWarn></NoWarn>
59 </PropertyGroup>
60 <ItemGroup>
61 <Reference Include="System" >
62 <HintPath>\System.dll</HintPath>
63 </Reference>
64 <Reference Include="Axiom.MathLib.dll" >
65 <HintPath>\Axiom.MathLib.dll.dll</HintPath>
66 </Reference>
67 </ItemGroup>
68 <ItemGroup>
69 <ProjectReference Include="..\Manager\OpenSim.Physics.Manager.csproj">
70 <Name>OpenSim.Physics.Manager</Name>
71 <Project>{58360A80-9333-4E0F-8F83-3CF937E51633}</Project>
72 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
73 </ProjectReference>
74 </ItemGroup>
75 <ItemGroup>
76 <Compile Include="AssemblyInfo.cs">
77 <SubType>Code</SubType>
78 </Compile>
79 <Compile Include="BasicPhysicsPlugin.cs">
80 <SubType>Code</SubType>
81 </Compile>
82 </ItemGroup>
83 <Import Project="$(MSBuildBinPath)\Microsoft.CSHARP.Targets" />
84 <PropertyGroup>
85 <PreBuildEvent>
86 </PreBuildEvent>
87 <PostBuildEvent>
88 </PostBuildEvent>
89 </PropertyGroup>
90</Project>
diff --git a/OpenSim.Physics/BasicPhysicsPlugin/OpenSim.Physics.BasicPhysicsPlugin.csproj.user b/OpenSim.Physics/BasicPhysicsPlugin/OpenSim.Physics.BasicPhysicsPlugin.csproj.user
new file mode 100644
index 0000000..13e65a8
--- /dev/null
+++ b/OpenSim.Physics/BasicPhysicsPlugin/OpenSim.Physics.BasicPhysicsPlugin.csproj.user
@@ -0,0 +1,12 @@
1<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
2 <PropertyGroup>
3 <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
4 <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
5 <ReferencePath>C:\Documents and Settings\Stefan\My Documents\Projects\source\opensim\branches\zircon\bin\</ReferencePath>
6 <LastOpenVersion>8.0.50727</LastOpenVersion>
7 <ProjectView>ProjectFiles</ProjectView>
8 <ProjectTrust>0</ProjectTrust>
9 </PropertyGroup>
10 <PropertyGroup Condition = " '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' " />
11 <PropertyGroup Condition = " '$(Configuration)|$(Platform)' == 'Release|AnyCPU' " />
12</Project>
diff --git a/OpenSim.Physics/BasicPhysicsPlugin/OpenSim.Physics.BasicPhysicsPlugin.dll.build b/OpenSim.Physics/BasicPhysicsPlugin/OpenSim.Physics.BasicPhysicsPlugin.dll.build
new file mode 100644
index 0000000..f146733
--- /dev/null
+++ b/OpenSim.Physics/BasicPhysicsPlugin/OpenSim.Physics.BasicPhysicsPlugin.dll.build
@@ -0,0 +1,42 @@
1<?xml version="1.0" ?>
2<project name="OpenSim.Physics.BasicPhysicsPlugin" default="build">
3 <target name="build">
4 <echo message="Build Directory is ${project::get-base-directory()}/${build.dir}" />
5 <mkdir dir="${project::get-base-directory()}/${build.dir}" />
6 <copy todir="${project::get-base-directory()}/${build.dir}">
7 <fileset basedir="${project::get-base-directory()}">
8 </fileset>
9 </copy>
10 <csc target="library" debug="${build.debug}" unsafe="False" define="TRACE;DEBUG" output="${project::get-base-directory()}/${build.dir}/${project::get-name()}.dll">
11 <resources prefix="OpenSim.Physics.BasicPhysicsPlugin" dynamicprefix="true" >
12 </resources>
13 <sources failonempty="true">
14 <include name="AssemblyInfo.cs" />
15 <include name="BasicPhysicsPlugin.cs" />
16 </sources>
17 <references basedir="${project::get-base-directory()}">
18 <lib>
19 <include name="${project::get-base-directory()}" />
20 <include name="${project::get-base-directory()}/${build.dir}" />
21 </lib>
22 <include name="System.dll" />
23 <include name="../../bin/Axiom.MathLib.dll" />
24 <include name="../Manager/${build.dir}/OpenSim.Physics.Manager.dll" />
25 </references>
26 </csc>
27 <echo message="Copying from [${project::get-base-directory()}/${build.dir}/] to [${project::get-base-directory()}/../../bin/Physics/" />
28 <mkdir dir="${project::get-base-directory()}/../../bin/Physics/"/>
29 <copy todir="${project::get-base-directory()}/../../bin/Physics/">
30 <fileset basedir="${project::get-base-directory()}/${build.dir}/" >
31 <include name="*.dll"/>
32 <include name="*.exe"/>
33 </fileset>
34 </copy>
35 </target>
36 <target name="clean">
37 <delete dir="${bin.dir}" failonerror="false" />
38 <delete dir="${obj.dir}" failonerror="false" />
39 </target>
40 <target name="doc" description="Creates documentation.">
41 </target>
42</project>
diff --git a/OpenSim.Physics/Manager/AssemblyInfo.cs b/OpenSim.Physics/Manager/AssemblyInfo.cs
new file mode 100644
index 0000000..57a8913
--- /dev/null
+++ b/OpenSim.Physics/Manager/AssemblyInfo.cs
@@ -0,0 +1,31 @@
1using System.Reflection;
2using System.Runtime.CompilerServices;
3using System.Runtime.InteropServices;
4
5// Information about this assembly is defined by the following
6// attributes.
7//
8// change them to the information which is associated with the assembly
9// you compile.
10
11[assembly: AssemblyTitle("PhysicsManager")]
12[assembly: AssemblyDescription("")]
13[assembly: AssemblyConfiguration("")]
14[assembly: AssemblyCompany("")]
15[assembly: AssemblyProduct("PhysicsManager")]
16[assembly: AssemblyCopyright("")]
17[assembly: AssemblyTrademark("")]
18[assembly: AssemblyCulture("")]
19
20// This sets the default COM visibility of types in the assembly to invisible.
21// If you need to expose a type to COM, use [ComVisible(true)] on that type.
22[assembly: ComVisible(false)]
23
24// The assembly version has following format :
25//
26// Major.Minor.Build.Revision
27//
28// You can specify all values by your own or you can build default build and revision
29// numbers with the '*' character (the default):
30
31[assembly: AssemblyVersion("1.0.*")]
diff --git a/OpenSim.Physics/Manager/OpenSim.Physics.Manager.csproj b/OpenSim.Physics/Manager/OpenSim.Physics.Manager.csproj
new file mode 100644
index 0000000..728686e
--- /dev/null
+++ b/OpenSim.Physics/Manager/OpenSim.Physics.Manager.csproj
@@ -0,0 +1,102 @@
1<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
2 <PropertyGroup>
3 <ProjectType>Local</ProjectType>
4 <ProductVersion>8.0.50727</ProductVersion>
5 <SchemaVersion>2.0</SchemaVersion>
6 <ProjectGuid>{58360A80-9333-4E0F-8F83-3CF937E51633}</ProjectGuid>
7 <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
8 <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
9 <ApplicationIcon></ApplicationIcon>
10 <AssemblyKeyContainerName>
11 </AssemblyKeyContainerName>
12 <AssemblyName>OpenSim.Physics.Manager</AssemblyName>
13 <DefaultClientScript>JScript</DefaultClientScript>
14 <DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout>
15 <DefaultTargetSchema>IE50</DefaultTargetSchema>
16 <DelaySign>false</DelaySign>
17 <OutputType>Library</OutputType>
18 <AppDesignerFolder></AppDesignerFolder>
19 <RootNamespace>OpenSim.Physics.Manager</RootNamespace>
20 <StartupObject></StartupObject>
21 <FileUpgradeFlags>
22 </FileUpgradeFlags>
23 </PropertyGroup>
24 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
25 <AllowUnsafeBlocks>False</AllowUnsafeBlocks>
26 <BaseAddress>285212672</BaseAddress>
27 <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
28 <ConfigurationOverrideFile>
29 </ConfigurationOverrideFile>
30 <DefineConstants>TRACE;DEBUG</DefineConstants>
31 <DocumentationFile></DocumentationFile>
32 <DebugSymbols>True</DebugSymbols>
33 <FileAlignment>4096</FileAlignment>
34 <Optimize>False</Optimize>
35 <OutputPath>..\..\bin\</OutputPath>
36 <RegisterForComInterop>False</RegisterForComInterop>
37 <RemoveIntegerChecks>False</RemoveIntegerChecks>
38 <TreatWarningsAsErrors>False</TreatWarningsAsErrors>
39 <WarningLevel>4</WarningLevel>
40 <NoWarn></NoWarn>
41 </PropertyGroup>
42 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
43 <AllowUnsafeBlocks>False</AllowUnsafeBlocks>
44 <BaseAddress>285212672</BaseAddress>
45 <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
46 <ConfigurationOverrideFile>
47 </ConfigurationOverrideFile>
48 <DefineConstants>TRACE</DefineConstants>
49 <DocumentationFile></DocumentationFile>
50 <DebugSymbols>False</DebugSymbols>
51 <FileAlignment>4096</FileAlignment>
52 <Optimize>True</Optimize>
53 <OutputPath>..\..\bin\</OutputPath>
54 <RegisterForComInterop>False</RegisterForComInterop>
55 <RemoveIntegerChecks>False</RemoveIntegerChecks>
56 <TreatWarningsAsErrors>False</TreatWarningsAsErrors>
57 <WarningLevel>4</WarningLevel>
58 <NoWarn></NoWarn>
59 </PropertyGroup>
60 <ItemGroup>
61 <Reference Include="System" >
62 <HintPath>\System.dll</HintPath>
63 </Reference>
64 <Reference Include="System.Xml.dll" >
65 <HintPath>\System.Xml.dll.dll</HintPath>
66 </Reference>
67 <Reference Include="Axiom.MathLib.dll" >
68 <HintPath>\Axiom.MathLib.dll.dll</HintPath>
69 </Reference>
70 </ItemGroup>
71 <ItemGroup>
72 <ProjectReference Include="..\..\OpenSim.Framework.Console\OpenSim.Framework.Console.csproj">
73 <Name>OpenSim.Framework.Console</Name>
74 <Project>{C8405E1A-EC19-48B6-9C8C-CA03624B9916}</Project>
75 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
76 </ProjectReference>
77 </ItemGroup>
78 <ItemGroup>
79 <Compile Include="AssemblyInfo.cs">
80 <SubType>Code</SubType>
81 </Compile>
82 <Compile Include="PhysicsActor.cs">
83 <SubType>Code</SubType>
84 </Compile>
85 <Compile Include="PhysicsManager.cs">
86 <SubType>Code</SubType>
87 </Compile>
88 <Compile Include="PhysicsScene.cs">
89 <SubType>Code</SubType>
90 </Compile>
91 <Compile Include="PhysicsVector.cs">
92 <SubType>Code</SubType>
93 </Compile>
94 </ItemGroup>
95 <Import Project="$(MSBuildBinPath)\Microsoft.CSHARP.Targets" />
96 <PropertyGroup>
97 <PreBuildEvent>
98 </PreBuildEvent>
99 <PostBuildEvent>
100 </PostBuildEvent>
101 </PropertyGroup>
102</Project>
diff --git a/OpenSim.Physics/Manager/OpenSim.Physics.Manager.dll.build b/OpenSim.Physics/Manager/OpenSim.Physics.Manager.dll.build
new file mode 100644
index 0000000..0f6565b
--- /dev/null
+++ b/OpenSim.Physics/Manager/OpenSim.Physics.Manager.dll.build
@@ -0,0 +1,46 @@
1<?xml version="1.0" ?>
2<project name="OpenSim.Physics.Manager" default="build">
3 <target name="build">
4 <echo message="Build Directory is ${project::get-base-directory()}/${build.dir}" />
5 <mkdir dir="${project::get-base-directory()}/${build.dir}" />
6 <copy todir="${project::get-base-directory()}/${build.dir}">
7 <fileset basedir="${project::get-base-directory()}">
8 </fileset>
9 </copy>
10 <csc target="library" debug="${build.debug}" unsafe="False" define="TRACE;DEBUG" output="${project::get-base-directory()}/${build.dir}/${project::get-name()}.dll">
11 <resources prefix="OpenSim.Physics.Manager" dynamicprefix="true" >
12 </resources>
13 <sources failonempty="true">
14 <include name="AssemblyInfo.cs" />
15 <include name="PhysicsActor.cs" />
16 <include name="PhysicsManager.cs" />
17 <include name="PhysicsScene.cs" />
18 <include name="PhysicsVector.cs" />
19 </sources>
20 <references basedir="${project::get-base-directory()}">
21 <lib>
22 <include name="${project::get-base-directory()}" />
23 <include name="${project::get-base-directory()}/${build.dir}" />
24 </lib>
25 <include name="System.dll" />
26 <include name="System.Xml.dll.dll" />
27 <include name="../../bin/Axiom.MathLib.dll" />
28 <include name="../../OpenSim.Framework.Console/${build.dir}/OpenSim.Framework.Console.dll" />
29 </references>
30 </csc>
31 <echo message="Copying from [${project::get-base-directory()}/${build.dir}/] to [${project::get-base-directory()}/../../bin/" />
32 <mkdir dir="${project::get-base-directory()}/../../bin/"/>
33 <copy todir="${project::get-base-directory()}/../../bin/">
34 <fileset basedir="${project::get-base-directory()}/${build.dir}/" >
35 <include name="*.dll"/>
36 <include name="*.exe"/>
37 </fileset>
38 </copy>
39 </target>
40 <target name="clean">
41 <delete dir="${bin.dir}" failonerror="false" />
42 <delete dir="${obj.dir}" failonerror="false" />
43 </target>
44 <target name="doc" description="Creates documentation.">
45 </target>
46</project>
diff --git a/OpenSim.Physics/Manager/PhysicsActor.cs b/OpenSim.Physics/Manager/PhysicsActor.cs
new file mode 100644
index 0000000..a0b6c21
--- /dev/null
+++ b/OpenSim.Physics/Manager/PhysicsActor.cs
@@ -0,0 +1,161 @@
1/*
2* Copyright (c) OpenSim project, http://sim.opensecondlife.org/
3*
4* Redistribution and use in source and binary forms, with or without
5* modification, are permitted provided that the following conditions are met:
6* * Redistributions of source code must retain the above copyright
7* notice, this list of conditions and the following disclaimer.
8* * Redistributions in binary form must reproduce the above copyright
9* notice, this list of conditions and the following disclaimer in the
10* documentation and/or other materials provided with the distribution.
11* * Neither the name of the <organization> nor the
12* names of its contributors may be used to endorse or promote products
13* derived from this software without specific prior written permission.
14*
15* THIS SOFTWARE IS PROVIDED BY <copyright holder> ``AS IS'' AND ANY
16* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
18* DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY
19* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
20* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
21* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
22* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
24* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25*
26*/
27
28using System;
29using System.Collections.Generic;
30using System.Text;
31
32namespace OpenSim.Physics.Manager
33{
34 public abstract class PhysicsActor
35 {
36 public static PhysicsActor Null
37 {
38 get
39 {
40 return new NullPhysicsActor();
41 }
42 }
43
44 public abstract PhysicsVector Position
45 {
46 get;
47 set;
48 }
49
50 public abstract PhysicsVector Velocity
51 {
52 get;
53 set;
54 }
55
56 public abstract PhysicsVector Acceleration
57 {
58 get;
59 }
60
61 public abstract Axiom.MathLib.Quaternion Orientation
62 {
63 get;
64 set;
65 }
66
67 public abstract bool Flying
68 {
69 get;
70 set;
71 }
72
73 public abstract bool Kinematic
74 {
75 get;
76 set;
77 }
78
79 public abstract void AddForce(PhysicsVector force);
80
81 public abstract void SetMomentum(PhysicsVector momentum);
82 }
83
84 public class NullPhysicsActor : PhysicsActor
85 {
86 public override PhysicsVector Position
87 {
88 get
89 {
90 return PhysicsVector.Zero;
91 }
92 set
93 {
94 return;
95 }
96 }
97
98 public override PhysicsVector Velocity
99 {
100 get
101 {
102 return PhysicsVector.Zero;
103 }
104 set
105 {
106 return;
107 }
108 }
109
110 public override Axiom.MathLib.Quaternion Orientation
111 {
112 get
113 {
114 return Axiom.MathLib.Quaternion.Identity;
115 }
116 set
117 {
118
119 }
120 }
121
122 public override PhysicsVector Acceleration
123 {
124 get { return PhysicsVector.Zero; }
125 }
126
127 public override bool Flying
128 {
129 get
130 {
131 return false;
132 }
133 set
134 {
135 return;
136 }
137 }
138
139 public override bool Kinematic
140 {
141 get
142 {
143 return true;
144 }
145 set
146 {
147 return;
148 }
149 }
150
151 public override void AddForce(PhysicsVector force)
152 {
153 return;
154 }
155
156 public override void SetMomentum(PhysicsVector momentum)
157 {
158 return;
159 }
160 }
161}
diff --git a/OpenSim.Physics/Manager/PhysicsManager.cs b/OpenSim.Physics/Manager/PhysicsManager.cs
new file mode 100644
index 0000000..616682b
--- /dev/null
+++ b/OpenSim.Physics/Manager/PhysicsManager.cs
@@ -0,0 +1,116 @@
1/*
2* Copyright (c) OpenSim project, http://sim.opensecondlife.org/
3*
4* Redistribution and use in source and binary forms, with or without
5* modification, are permitted provided that the following conditions are met:
6* * Redistributions of source code must retain the above copyright
7* notice, this list of conditions and the following disclaimer.
8* * Redistributions in binary form must reproduce the above copyright
9* notice, this list of conditions and the following disclaimer in the
10* documentation and/or other materials provided with the distribution.
11* * Neither the name of the <organization> nor the
12* names of its contributors may be used to endorse or promote products
13* derived from this software without specific prior written permission.
14*
15* THIS SOFTWARE IS PROVIDED BY <copyright holder> ``AS IS'' AND ANY
16* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
18* DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY
19* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
20* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
21* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
22* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
24* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25*
26*/
27using System;
28using System.Collections.Generic;
29using System.Collections;
30using System.IO;
31using System.Reflection;
32using Axiom.MathLib;
33
34namespace OpenSim.Physics.Manager
35{
36 /// <summary>
37 /// Description of MyClass.
38 /// </summary>
39 public class PhysicsManager
40 {
41 private Dictionary<string, IPhysicsPlugin> _plugins=new Dictionary<string, IPhysicsPlugin>();
42
43 public PhysicsManager()
44 {
45
46 }
47
48 public PhysicsScene GetPhysicsScene(string engineName)
49 {
50 if (String.IsNullOrEmpty(engineName))
51 {
52 return new NullPhysicsScene();
53 }
54
55 if(_plugins.ContainsKey(engineName))
56 {
57 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("creating "+engineName);
58 return _plugins[engineName].GetScene();
59 }
60 else
61 {
62 string error = String.Format("couldn't find physicsEngine: {0}", engineName);
63 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(error);
64 throw new ArgumentException(error);
65 }
66 }
67
68 public void LoadPlugins()
69 {
70 string path = Path.Combine(System.AppDomain.CurrentDomain.BaseDirectory ,"Physics");
71 string[] pluginFiles = Directory.GetFiles(path, "*.dll");
72
73
74 for(int i= 0; i<pluginFiles.Length; i++)
75 {
76 this.AddPlugin(pluginFiles[i]);
77 }
78 }
79
80 private void AddPlugin(string FileName)
81 {
82 Assembly pluginAssembly = Assembly.LoadFrom(FileName);
83
84 foreach (Type pluginType in pluginAssembly.GetTypes())
85 {
86 if (pluginType.IsPublic)
87 {
88 if (!pluginType.IsAbstract)
89 {
90 Type typeInterface = pluginType.GetInterface("IPhysicsPlugin", true);
91
92 if (typeInterface != null)
93 {
94 IPhysicsPlugin plug = (IPhysicsPlugin)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString()));
95 plug.Init();
96 this._plugins.Add(plug.GetName(),plug);
97
98 }
99
100 typeInterface = null;
101 }
102 }
103 }
104
105 pluginAssembly = null;
106 }
107 }
108
109 public interface IPhysicsPlugin
110 {
111 bool Init();
112 PhysicsScene GetScene();
113 string GetName();
114 void Dispose();
115 }
116}
diff --git a/OpenSim.Physics/Manager/PhysicsScene.cs b/OpenSim.Physics/Manager/PhysicsScene.cs
new file mode 100644
index 0000000..35c961e
--- /dev/null
+++ b/OpenSim.Physics/Manager/PhysicsScene.cs
@@ -0,0 +1,98 @@
1/*
2* Copyright (c) OpenSim project, http://sim.opensecondlife.org/
3*
4* Redistribution and use in source and binary forms, with or without
5* modification, are permitted provided that the following conditions are met:
6* * Redistributions of source code must retain the above copyright
7* notice, this list of conditions and the following disclaimer.
8* * Redistributions in binary form must reproduce the above copyright
9* notice, this list of conditions and the following disclaimer in the
10* documentation and/or other materials provided with the distribution.
11* * Neither the name of the <organization> nor the
12* names of its contributors may be used to endorse or promote products
13* derived from this software without specific prior written permission.
14*
15* THIS SOFTWARE IS PROVIDED BY <copyright holder> ``AS IS'' AND ANY
16* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
18* DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY
19* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
20* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
21* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
22* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
24* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25*
26*/
27
28using System;
29using System.Collections.Generic;
30using System.Text;
31
32namespace OpenSim.Physics.Manager
33{
34 public abstract class PhysicsScene
35 {
36 public static PhysicsScene Null
37 {
38 get
39 {
40 return new NullPhysicsScene();
41 }
42 }
43
44 public abstract PhysicsActor AddAvatar(PhysicsVector position);
45
46 public abstract PhysicsActor AddPrim(PhysicsVector position, PhysicsVector size);
47
48 public abstract void Simulate(float timeStep);
49
50 public abstract void GetResults();
51
52 public abstract void SetTerrain(float[] heightMap);
53
54 public abstract bool IsThreaded
55 {
56 get;
57 }
58 }
59
60 public class NullPhysicsScene : PhysicsScene
61 {
62 private static int m_workIndicator;
63
64 public override PhysicsActor AddAvatar(PhysicsVector position)
65 {
66 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("NullPhysicsScene : AddAvatar({0})", position);
67 return PhysicsActor.Null;
68 }
69
70 public override PhysicsActor AddPrim(PhysicsVector position, PhysicsVector size)
71 {
72 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("NullPhysicsScene : AddPrim({0},{1})", position, size);
73 return PhysicsActor.Null;
74 }
75
76 public override void Simulate(float timeStep)
77 {
78 m_workIndicator = (m_workIndicator + 1) % 10;
79
80 OpenSim.Framework.Console.MainConsole.Instance.SetStatus(m_workIndicator.ToString());
81 }
82
83 public override void GetResults()
84 {
85 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("NullPhysicsScene : GetResults()");
86 }
87
88 public override void SetTerrain(float[] heightMap)
89 {
90 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("NullPhysicsScene : SetTerrain({0} items)", heightMap.Length);
91 }
92
93 public override bool IsThreaded
94 {
95 get { return false; }
96 }
97 }
98}
diff --git a/OpenSim.Physics/Manager/PhysicsVector.cs b/OpenSim.Physics/Manager/PhysicsVector.cs
new file mode 100644
index 0000000..3c824d0
--- /dev/null
+++ b/OpenSim.Physics/Manager/PhysicsVector.cs
@@ -0,0 +1,54 @@
1/*
2* Copyright (c) OpenSim project, http://sim.opensecondlife.org/
3*
4* Redistribution and use in source and binary forms, with or without
5* modification, are permitted provided that the following conditions are met:
6* * Redistributions of source code must retain the above copyright
7* notice, this list of conditions and the following disclaimer.
8* * Redistributions in binary form must reproduce the above copyright
9* notice, this list of conditions and the following disclaimer in the
10* documentation and/or other materials provided with the distribution.
11* * Neither the name of the <organization> nor the
12* names of its contributors may be used to endorse or promote products
13* derived from this software without specific prior written permission.
14*
15* THIS SOFTWARE IS PROVIDED BY <copyright holder> ``AS IS'' AND ANY
16* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
18* DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY
19* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
20* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
21* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
22* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
24* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25*
26*/
27
28using System;
29using System.Collections.Generic;
30using System.Text;
31
32namespace OpenSim.Physics.Manager
33{
34 public class PhysicsVector
35 {
36 public float X;
37 public float Y;
38 public float Z;
39
40 public PhysicsVector()
41 {
42
43 }
44
45 public PhysicsVector(float x, float y, float z)
46 {
47 X = x;
48 Y = y;
49 Z = z;
50 }
51
52 public static readonly PhysicsVector Zero = new PhysicsVector(0f, 0f, 0f);
53 }
54}
diff --git a/src/physics/RealPhysX/RealPhysXplugin/AssemblyInfo.cs b/OpenSim.Physics/PhysXPlugin/AssemblyInfo.cs
index 913aae7..913aae7 100644
--- a/src/physics/RealPhysX/RealPhysXplugin/AssemblyInfo.cs
+++ b/OpenSim.Physics/PhysXPlugin/AssemblyInfo.cs
diff --git a/OpenSim.Physics/PhysXPlugin/OpenSim.Physics.PhysXPlugin.csproj b/OpenSim.Physics/PhysXPlugin/OpenSim.Physics.PhysXPlugin.csproj
new file mode 100644
index 0000000..e1e8eea
--- /dev/null
+++ b/OpenSim.Physics/PhysXPlugin/OpenSim.Physics.PhysXPlugin.csproj
@@ -0,0 +1,93 @@
1<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
2 <PropertyGroup>
3 <ProjectType>Local</ProjectType>
4 <ProductVersion>8.0.50727</ProductVersion>
5 <SchemaVersion>2.0</SchemaVersion>
6 <ProjectGuid>{CBE1E31D-D7E3-4791-A616-F00173BBC26A}</ProjectGuid>
7 <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
8 <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
9 <ApplicationIcon></ApplicationIcon>
10 <AssemblyKeyContainerName>
11 </AssemblyKeyContainerName>
12 <AssemblyName>OpenSim.Physics.PhysXPlugin</AssemblyName>
13 <DefaultClientScript>JScript</DefaultClientScript>
14 <DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout>
15 <DefaultTargetSchema>IE50</DefaultTargetSchema>
16 <DelaySign>false</DelaySign>
17 <OutputType>Library</OutputType>
18 <AppDesignerFolder></AppDesignerFolder>
19 <RootNamespace>OpenSim.Physics.PhysXPlugin</RootNamespace>
20 <StartupObject></StartupObject>
21 <FileUpgradeFlags>
22 </FileUpgradeFlags>
23 </PropertyGroup>
24 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
25 <AllowUnsafeBlocks>False</AllowUnsafeBlocks>
26 <BaseAddress>285212672</BaseAddress>
27 <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
28 <ConfigurationOverrideFile>
29 </ConfigurationOverrideFile>
30 <DefineConstants>TRACE;DEBUG</DefineConstants>
31 <DocumentationFile></DocumentationFile>
32 <DebugSymbols>True</DebugSymbols>
33 <FileAlignment>4096</FileAlignment>
34 <Optimize>False</Optimize>
35 <OutputPath>..\..\bin\Physics\</OutputPath>
36 <RegisterForComInterop>False</RegisterForComInterop>
37 <RemoveIntegerChecks>False</RemoveIntegerChecks>
38 <TreatWarningsAsErrors>False</TreatWarningsAsErrors>
39 <WarningLevel>4</WarningLevel>
40 <NoWarn></NoWarn>
41 </PropertyGroup>
42 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
43 <AllowUnsafeBlocks>False</AllowUnsafeBlocks>
44 <BaseAddress>285212672</BaseAddress>
45 <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
46 <ConfigurationOverrideFile>
47 </ConfigurationOverrideFile>
48 <DefineConstants>TRACE</DefineConstants>
49 <DocumentationFile></DocumentationFile>
50 <DebugSymbols>False</DebugSymbols>
51 <FileAlignment>4096</FileAlignment>
52 <Optimize>True</Optimize>
53 <OutputPath>..\..\bin\Physics\</OutputPath>
54 <RegisterForComInterop>False</RegisterForComInterop>
55 <RemoveIntegerChecks>False</RemoveIntegerChecks>
56 <TreatWarningsAsErrors>False</TreatWarningsAsErrors>
57 <WarningLevel>4</WarningLevel>
58 <NoWarn></NoWarn>
59 </PropertyGroup>
60 <ItemGroup>
61 <Reference Include="System" >
62 <HintPath>\System.dll</HintPath>
63 </Reference>
64 <Reference Include="Axiom.MathLib.dll" >
65 <HintPath>\Axiom.MathLib.dll.dll</HintPath>
66 </Reference>
67 <Reference Include="PhysX_Wrapper_Dotnet.dll" >
68 <HintPath>\PhysX_Wrapper_Dotnet.dll.dll</HintPath>
69 </Reference>
70 </ItemGroup>
71 <ItemGroup>
72 <ProjectReference Include="..\Manager\OpenSim.Physics.Manager.csproj">
73 <Name>OpenSim.Physics.Manager</Name>
74 <Project>{58360A80-9333-4E0F-8F83-3CF937E51633}</Project>
75 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
76 </ProjectReference>
77 </ItemGroup>
78 <ItemGroup>
79 <Compile Include="AssemblyInfo.cs">
80 <SubType>Code</SubType>
81 </Compile>
82 <Compile Include="PhysXPlugin.cs">
83 <SubType>Code</SubType>
84 </Compile>
85 </ItemGroup>
86 <Import Project="$(MSBuildBinPath)\Microsoft.CSHARP.Targets" />
87 <PropertyGroup>
88 <PreBuildEvent>
89 </PreBuildEvent>
90 <PostBuildEvent>
91 </PostBuildEvent>
92 </PropertyGroup>
93</Project>
diff --git a/OpenSim.Physics/PhysXPlugin/OpenSim.Physics.PhysXPlugin.dll.build b/OpenSim.Physics/PhysXPlugin/OpenSim.Physics.PhysXPlugin.dll.build
new file mode 100644
index 0000000..8f9e7dc
--- /dev/null
+++ b/OpenSim.Physics/PhysXPlugin/OpenSim.Physics.PhysXPlugin.dll.build
@@ -0,0 +1,43 @@
1<?xml version="1.0" ?>
2<project name="OpenSim.Physics.PhysXPlugin" default="build">
3 <target name="build">
4 <echo message="Build Directory is ${project::get-base-directory()}/${build.dir}" />
5 <mkdir dir="${project::get-base-directory()}/${build.dir}" />
6 <copy todir="${project::get-base-directory()}/${build.dir}">
7 <fileset basedir="${project::get-base-directory()}">
8 </fileset>
9 </copy>
10 <csc target="library" debug="${build.debug}" unsafe="False" define="TRACE;DEBUG" output="${project::get-base-directory()}/${build.dir}/${project::get-name()}.dll">
11 <resources prefix="OpenSim.Physics.PhysXPlugin" dynamicprefix="true" >
12 </resources>
13 <sources failonempty="true">
14 <include name="AssemblyInfo.cs" />
15 <include name="PhysXPlugin.cs" />
16 </sources>
17 <references basedir="${project::get-base-directory()}">
18 <lib>
19 <include name="${project::get-base-directory()}" />
20 <include name="${project::get-base-directory()}/${build.dir}" />
21 </lib>
22 <include name="System.dll" />
23 <include name="../../bin/Axiom.MathLib.dll" />
24 <include name="../../bin/PhysX_Wrapper_Dotnet.dll" />
25 <include name="../Manager/${build.dir}/OpenSim.Physics.Manager.dll" />
26 </references>
27 </csc>
28 <echo message="Copying from [${project::get-base-directory()}/${build.dir}/] to [${project::get-base-directory()}/../../bin/Physics/" />
29 <mkdir dir="${project::get-base-directory()}/../../bin/Physics/"/>
30 <copy todir="${project::get-base-directory()}/../../bin/Physics/">
31 <fileset basedir="${project::get-base-directory()}/${build.dir}/" >
32 <include name="*.dll"/>
33 <include name="*.exe"/>
34 </fileset>
35 </copy>
36 </target>
37 <target name="clean">
38 <delete dir="${bin.dir}" failonerror="false" />
39 <delete dir="${obj.dir}" failonerror="false" />
40 </target>
41 <target name="doc" description="Creates documentation.">
42 </target>
43</project>
diff --git a/src/physics/RealPhysX/RealPhysXplugin/RealPhysX.cs b/OpenSim.Physics/PhysXPlugin/PhysXPlugin.cs
index 9576a40..043c2f1 100644
--- a/src/physics/RealPhysX/RealPhysXplugin/RealPhysX.cs
+++ b/OpenSim.Physics/PhysXPlugin/PhysXPlugin.cs
@@ -52,10 +52,10 @@
52*/ 52*/
53using System; 53using System;
54using System.Collections.Generic; 54using System.Collections.Generic;
55using PhysicsSystem; 55using OpenSim.Physics.Manager;
56using PhysXWrapper; 56using PhysXWrapper;
57 57
58namespace PhysXplugin 58namespace OpenSim.Physics.PhysXPlugin
59{ 59{
60 /// <summary> 60 /// <summary>
61 /// Will be the PhysX plugin but for now will be a very basic physics engine 61 /// Will be the PhysX plugin but for now will be a very basic physics engine
@@ -105,6 +105,7 @@ namespace PhysXplugin
105 public PhysXScene() 105 public PhysXScene()
106 { 106 {
107 mySdk = NxPhysicsSDK.CreateSDK(); 107 mySdk = NxPhysicsSDK.CreateSDK();
108 Console.WriteLine("Sdk created - now creating scene");
108 scene = mySdk.CreateScene(); 109 scene = mySdk.CreateScene();
109 110
110 } 111 }
@@ -179,6 +180,7 @@ namespace PhysXplugin
179 private PhysicsVector _acceleration; 180 private PhysicsVector _acceleration;
180 private NxCharacter _character; 181 private NxCharacter _character;
181 private bool flying; 182 private bool flying;
183 private float gravityAccel;
182 184
183 public PhysXCharacter(NxCharacter character) 185 public PhysXCharacter(NxCharacter character)
184 { 186 {
@@ -224,6 +226,30 @@ namespace PhysXplugin
224 } 226 }
225 } 227 }
226 228
229 public override bool Kinematic
230 {
231 get
232 {
233 return false;
234 }
235 set
236 {
237
238 }
239 }
240
241 public override Axiom.MathLib.Quaternion Orientation
242 {
243 get
244 {
245 return Axiom.MathLib.Quaternion.Identity;
246 }
247 set
248 {
249
250 }
251 }
252
227 public override PhysicsVector Acceleration 253 public override PhysicsVector Acceleration
228 { 254 {
229 get 255 get
@@ -258,9 +284,14 @@ namespace PhysXplugin
258 } 284 }
259 else 285 else
260 { 286 {
261 vec.Z = (-9.8f + this._velocity.Z) * timeStep; 287 gravityAccel+= -9.8f;
288 vec.Z = (gravityAccel + this._velocity.Z) * timeStep;
289 }
290 int res = this._character.Move(vec);
291 if(res == 1)
292 {
293 gravityAccel = 0;
262 } 294 }
263 this._character.Move(vec);
264 } 295 }
265 296
266 public void UpdatePosition() 297 public void UpdatePosition()
@@ -332,6 +363,36 @@ namespace PhysXplugin
332 } 363 }
333 } 364 }
334 365
366 public override bool Kinematic
367 {
368 get
369 {
370 return this._prim.Kinematic;
371 }
372 set
373 {
374 this._prim.Kinematic = value;
375 }
376 }
377
378 public override Axiom.MathLib.Quaternion Orientation
379 {
380 get
381 {
382 Axiom.MathLib.Quaternion res = new Axiom.MathLib.Quaternion();
383 PhysXWrapper.Quaternion quat = this._prim.GetOrientation();
384 res.w = quat.W;
385 res.x = quat.X;
386 res.y = quat.Y;
387 res.z = quat.Z;
388 return res;
389 }
390 set
391 {
392
393 }
394 }
395
335 public override PhysicsVector Acceleration 396 public override PhysicsVector Acceleration
336 { 397 {
337 get 398 get
diff --git a/OpenSim.RegionServer/Assets/AssetCache.cs b/OpenSim.RegionServer/Assets/AssetCache.cs
new file mode 100644
index 0000000..f7f2e10
--- /dev/null
+++ b/OpenSim.RegionServer/Assets/AssetCache.cs
@@ -0,0 +1,589 @@
1/*
2* Copyright (c) OpenSim project, http://sim.opensecondlife.org/
3*
4* Redistribution and use in source and binary forms, with or without
5* modification, are permitted provided that the following conditions are met:
6* * Redistributions of source code must retain the above copyright
7* notice, this list of conditions and the following disclaimer.
8* * Redistributions in binary form must reproduce the above copyright
9* notice, this list of conditions and the following disclaimer in the
10* documentation and/or other materials provided with the distribution.
11* * Neither the name of the <organization> nor the
12* names of its contributors may be used to endorse or promote products
13* derived from this software without specific prior written permission.
14*
15* THIS SOFTWARE IS PROVIDED BY <copyright holder> ``AS IS'' AND ANY
16* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
18* DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY
19* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
20* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
21* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
22* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
24* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25*
26*/
27
28using System;
29using System.Collections.Generic;
30using System.Threading;
31using libsecondlife;
32using libsecondlife.Packets;
33using OpenSim;
34using OpenSim.Framework.Interfaces;
35using OpenSim.Framework.Assets;
36using OpenSim.Framework.Utilities;
37
38namespace OpenSim.Assets
39{
40 /// <summary>
41 /// Manages local cache of assets and their sending to viewers.
42 /// </summary>
43 public class AssetCache : IAssetReceiver
44 {
45 public Dictionary<libsecondlife.LLUUID, AssetInfo> Assets;
46 public Dictionary<libsecondlife.LLUUID, TextureImage> Textures;
47
48 public List<AssetRequest> AssetRequests = new List<AssetRequest>(); //assets ready to be sent to viewers
49 public List<AssetRequest> TextureRequests = new List<AssetRequest>(); //textures ready to be sent
50
51 public Dictionary<LLUUID, AssetRequest> RequestedAssets = new Dictionary<LLUUID, AssetRequest>(); //Assets requested from the asset server
52 public Dictionary<LLUUID, AssetRequest> RequestedTextures = new Dictionary<LLUUID, AssetRequest>(); //Textures requested from the asset server
53
54 //private Dictionary<libsecondlife.LLUUID, AssetBase> IncomingAssets;
55
56 private IAssetServer _assetServer;
57 private Thread _assetCacheThread;
58 private LLUUID[] textureList = new LLUUID[2];
59
60 /// <summary>
61 ///
62 /// </summary>
63 public AssetCache(IAssetServer assetServer)
64 {
65 Console.WriteLine("Creating Asset cache");
66 _assetServer = assetServer;
67 _assetServer.SetReceiver(this);
68 Assets = new Dictionary<libsecondlife.LLUUID, AssetInfo>();
69 Textures = new Dictionary<libsecondlife.LLUUID, TextureImage>();
70 //IncomingAssets = new Dictionary<libsecondlife.LLUUID, AssetBase>();
71 this._assetCacheThread = new Thread(new ThreadStart(RunAssetManager));
72 this._assetCacheThread.IsBackground = true;
73 this._assetCacheThread.Start();
74
75 }
76
77 /// <summary>
78 ///
79 /// </summary>
80 public void RunAssetManager()
81 {
82 while (true)
83 {
84 try
85 {
86 //Console.WriteLine("Asset cache loop");
87 this.ProcessAssetQueue();
88 this.ProcessTextureQueue();
89 Thread.Sleep(500);
90 }
91 catch (Exception e)
92 {
93 Console.WriteLine(e.Message);
94 }
95 }
96 }
97
98 public void LoadDefaultTextureSet()
99 {
100 //hack: so we can give each user a set of textures
101 textureList[0] = new LLUUID("00000000-0000-0000-9999-000000000001");
102 textureList[1] = new LLUUID("00000000-0000-0000-9999-000000000002");
103 for (int i = 0; i < textureList.Length; i++)
104 {
105 this._assetServer.RequestAsset(textureList[i], true);
106 }
107
108 }
109
110 public AssetBase[] CreateNewInventorySet(LLUUID agentID)
111 {
112 AssetBase[] inventorySet = new AssetBase[this.textureList.Length];
113 for (int i = 0; i < textureList.Length; i++)
114 {
115 if (this.Textures.ContainsKey(textureList[i]))
116 {
117 inventorySet[i] = this.CloneImage(agentID, this.Textures[textureList[i]]);
118 TextureImage image = new TextureImage(inventorySet[i]);
119 this.Textures.Add(image.FullID, image);
120 this._assetServer.UploadNewAsset(image); //save the asset to the asset server
121 }
122 }
123 return inventorySet;
124 }
125
126 /// <summary>
127 ///
128 /// </summary>
129 private void ProcessTextureQueue()
130 {
131 if (this.TextureRequests.Count == 0)
132 {
133 //no requests waiting
134 return;
135 }
136 int num;
137
138 if (this.TextureRequests.Count < 5)
139 {
140 //lower than 5 so do all of them
141 num = this.TextureRequests.Count;
142 }
143 else
144 {
145 num = 5;
146 }
147 AssetRequest req;
148 Console.WriteLine("processing texture requests ( " + num + " )");
149 for (int i = 0; i < num; i++)
150 {
151 req = (AssetRequest)this.TextureRequests[i];
152 if (req.PacketCounter != req.NumPackets)
153 {
154 // if (req.ImageInfo.FullID == new LLUUID("00000000-0000-0000-5005-000000000005"))
155 Console.WriteLine("sending base texture ( " + req.ImageInfo.FullID + " ) in " + req.NumPackets + "number of packets");
156
157 if (req.PacketCounter == 0)
158 {
159 //first time for this request so send imagedata packet
160 if (req.NumPackets == 1)
161 {
162 //only one packet so send whole file
163 ImageDataPacket im = new ImageDataPacket();
164 im.ImageID.Packets = 1;
165 im.ImageID.ID = req.ImageInfo.FullID;
166 im.ImageID.Size = (uint)req.ImageInfo.Data.Length;
167 im.ImageData.Data = req.ImageInfo.Data;
168 im.ImageID.Codec = 2;
169 req.RequestUser.OutPacket(im);
170 req.PacketCounter++;
171 //req.ImageInfo.l= time;
172 //System.Console.WriteLine("sent texture: "+req.image_info.FullID);
173 }
174 else
175 {
176 //more than one packet so split file up
177 ImageDataPacket im = new ImageDataPacket();
178 im.ImageID.Packets = (ushort)req.NumPackets;
179 im.ImageID.ID = req.ImageInfo.FullID;
180 im.ImageID.Size = (uint)req.ImageInfo.Data.Length;
181 im.ImageData.Data = new byte[600];
182 Array.Copy(req.ImageInfo.Data, 0, im.ImageData.Data, 0, 600);
183 im.ImageID.Codec = 2;
184 req.RequestUser.OutPacket(im);
185 req.PacketCounter++;
186 //req.ImageInfo.last_used = time;
187 //System.Console.WriteLine("sent first packet of texture:
188 }
189 }
190 else
191 {
192 //send imagepacket
193 //more than one packet so split file up
194 ImagePacketPacket im = new ImagePacketPacket();
195 im.ImageID.Packet = (ushort)req.PacketCounter;
196 im.ImageID.ID = req.ImageInfo.FullID;
197 int size = req.ImageInfo.Data.Length - 600 - 1000 * (req.PacketCounter - 1);
198 if (size > 1000) size = 1000;
199 im.ImageData.Data = new byte[size];
200 Array.Copy(req.ImageInfo.Data, 600 + 1000 * (req.PacketCounter - 1), im.ImageData.Data, 0, size);
201 req.RequestUser.OutPacket(im);
202 req.PacketCounter++;
203 //req.ImageInfo.last_used = time;
204 //System.Console.WriteLine("sent a packet of texture: "+req.image_info.FullID);
205 }
206 }
207 }
208
209 //remove requests that have been completed
210 int count = 0;
211 for (int i = 0; i < num; i++)
212 {
213 if (this.TextureRequests.Count > count)
214 {
215 req = (AssetRequest)this.TextureRequests[count];
216 if (req.PacketCounter == req.NumPackets)
217 {
218 this.TextureRequests.Remove(req);
219 }
220 else
221 {
222 count++;
223 }
224 }
225 }
226
227 }
228 public void AssetReceived(AssetBase asset, bool IsTexture)
229 {
230 Console.WriteLine("received asset from asset server ( " + asset.FullID + " )");
231 if (asset.FullID != LLUUID.Zero) // if it is set to zero then the asset wasn't found by the server
232 {
233 //check if it is a texture or not
234 //then add to the correct cache list
235 //then check for waiting requests for this asset/texture (in the Requested lists)
236 //and move those requests into the Requests list.
237 if (IsTexture)
238 {
239 TextureImage image = new TextureImage(asset);
240 this.Textures.Add(image.FullID, image);
241 if (this.RequestedTextures.ContainsKey(image.FullID))
242 {
243 AssetRequest req = this.RequestedTextures[image.FullID];
244 req.ImageInfo = image;
245 if (image.Data.LongLength > 600)
246 {
247 //over 600 bytes so split up file
248 req.NumPackets = 1 + (int)(image.Data.Length - 600 + 999) / 1000;
249 }
250 else
251 {
252 req.NumPackets = 1;
253 }
254 this.RequestedTextures.Remove(image.FullID);
255 this.TextureRequests.Add(req);
256 }
257 }
258 else
259 {
260 AssetInfo assetInf = new AssetInfo(asset);
261 this.Assets.Add(assetInf.FullID, assetInf);
262 if (this.RequestedAssets.ContainsKey(assetInf.FullID))
263 {
264 AssetRequest req = this.RequestedAssets[assetInf.FullID];
265 req.AssetInf = assetInf;
266 if (assetInf.Data.LongLength > 600)
267 {
268 //over 600 bytes so split up file
269 req.NumPackets = 1 + (int)(assetInf.Data.Length - 600 + 999) / 1000;
270 }
271 else
272 {
273 req.NumPackets = 1;
274 }
275 this.RequestedAssets.Remove(assetInf.FullID);
276 this.AssetRequests.Add(req);
277 }
278 }
279 }
280 }
281
282 public void AssetNotFound(AssetBase asset)
283 {
284 //the asset server had no knowledge of requested asset
285
286 }
287
288 #region Assets
289 /// <summary>
290 ///
291 /// </summary>
292 /// <param name="userInfo"></param>
293 /// <param name="transferRequest"></param>
294 public void AddAssetRequest(SimClient userInfo, TransferRequestPacket transferRequest)
295 {
296 LLUUID requestID = new LLUUID(transferRequest.TransferInfo.Params, 0);
297 //check to see if asset is in local cache, if not we need to request it from asset server.
298 if (!this.Assets.ContainsKey(requestID))
299 {
300 //not found asset
301 // so request from asset server
302 if (!this.RequestedAssets.ContainsKey(requestID))
303 {
304 AssetRequest request = new AssetRequest();
305 request.RequestUser = userInfo;
306 request.RequestAssetID = requestID;
307 request.TransferRequestID = transferRequest.TransferInfo.TransferID;
308 this.RequestedAssets.Add(requestID, request);
309 this._assetServer.RequestAsset(requestID, false);
310 }
311 return;
312 }
313 //it is in our cache
314 AssetInfo asset = this.Assets[requestID];
315
316 //work out how many packets it should be sent in
317 // and add to the AssetRequests list
318 AssetRequest req = new AssetRequest();
319 req.RequestUser = userInfo;
320 req.RequestAssetID = requestID;
321 req.TransferRequestID = transferRequest.TransferInfo.TransferID;
322 req.AssetInf = asset;
323
324 if (asset.Data.LongLength > 600)
325 {
326 //over 600 bytes so split up file
327 req.NumPackets = 1 + (int)(asset.Data.Length - 600 + 999) / 1000;
328 }
329 else
330 {
331 req.NumPackets = 1;
332 }
333
334 this.AssetRequests.Add(req);
335 }
336
337 /// <summary>
338 ///
339 /// </summary>
340 private void ProcessAssetQueue()
341 {
342 if (this.AssetRequests.Count == 0)
343 {
344 //no requests waiting
345 return;
346 }
347 int num;
348
349 if (this.AssetRequests.Count < 5)
350 {
351 //lower than 5 so do all of them
352 num = this.AssetRequests.Count;
353 }
354 else
355 {
356 num = 5;
357 }
358 AssetRequest req;
359 for (int i = 0; i < num; i++)
360 {
361 req = (AssetRequest)this.AssetRequests[i];
362
363 TransferInfoPacket Transfer = new TransferInfoPacket();
364 Transfer.TransferInfo.ChannelType = 2;
365 Transfer.TransferInfo.Status = 0;
366 Transfer.TransferInfo.TargetType = 0;
367 Transfer.TransferInfo.Params = req.RequestAssetID.GetBytes();
368 Transfer.TransferInfo.Size = (int)req.AssetInf.Data.Length;
369 Transfer.TransferInfo.TransferID = req.TransferRequestID;
370 req.RequestUser.OutPacket(Transfer);
371
372 if (req.NumPackets == 1)
373 {
374 TransferPacketPacket TransferPacket = new TransferPacketPacket();
375 TransferPacket.TransferData.Packet = 0;
376 TransferPacket.TransferData.ChannelType = 2;
377 TransferPacket.TransferData.TransferID = req.TransferRequestID;
378 TransferPacket.TransferData.Data = req.AssetInf.Data;
379 TransferPacket.TransferData.Status = 1;
380 req.RequestUser.OutPacket(TransferPacket);
381 }
382 else
383 {
384 //more than one packet so split file up , for now it can't be bigger than 2000 bytes
385 TransferPacketPacket TransferPacket = new TransferPacketPacket();
386 TransferPacket.TransferData.Packet = 0;
387 TransferPacket.TransferData.ChannelType = 2;
388 TransferPacket.TransferData.TransferID = req.TransferRequestID;
389 byte[] chunk = new byte[1000];
390 Array.Copy(req.AssetInf.Data, chunk, 1000);
391 TransferPacket.TransferData.Data = chunk;
392 TransferPacket.TransferData.Status = 0;
393 req.RequestUser.OutPacket(TransferPacket);
394
395 TransferPacket = new TransferPacketPacket();
396 TransferPacket.TransferData.Packet = 1;
397 TransferPacket.TransferData.ChannelType = 2;
398 TransferPacket.TransferData.TransferID = req.TransferRequestID;
399 byte[] chunk1 = new byte[(req.AssetInf.Data.Length - 1000)];
400 Array.Copy(req.AssetInf.Data, 1000, chunk1, 0, chunk1.Length);
401 TransferPacket.TransferData.Data = chunk1;
402 TransferPacket.TransferData.Status = 1;
403 req.RequestUser.OutPacket(TransferPacket);
404 }
405
406 }
407
408 //remove requests that have been completed
409 for (int i = 0; i < num; i++)
410 {
411 this.AssetRequests.RemoveAt(0);
412 }
413
414 }
415
416 public AssetInfo CloneAsset(LLUUID newOwner, AssetInfo sourceAsset)
417 {
418 AssetInfo newAsset = new AssetInfo();
419 newAsset.Data = new byte[sourceAsset.Data.Length];
420 Array.Copy(sourceAsset.Data, newAsset.Data, sourceAsset.Data.Length);
421 newAsset.FullID = LLUUID.Random();
422 newAsset.Type = sourceAsset.Type;
423 newAsset.InvType = sourceAsset.InvType;
424 return (newAsset);
425 }
426 #endregion
427
428 #region Textures
429 /// <summary>
430 ///
431 /// </summary>
432 /// <param name="userInfo"></param>
433 /// <param name="imageID"></param>
434 public void AddTextureRequest(SimClient userInfo, LLUUID imageID)
435 {
436 if (imageID == new LLUUID("00000000-0000-0000-5005-000000000005"))
437 Console.WriteLine("request base prim texture ");
438
439 //check to see if texture is in local cache, if not request from asset server
440 if (!this.Textures.ContainsKey(imageID))
441 {
442 if (!this.RequestedTextures.ContainsKey(imageID))
443 {
444 //not is cache so request from asset server
445 AssetRequest request = new AssetRequest();
446 request.RequestUser = userInfo;
447 request.RequestAssetID = imageID;
448 request.IsTextureRequest = true;
449 this.RequestedTextures.Add(imageID, request);
450 this._assetServer.RequestAsset(imageID, true);
451 }
452 return;
453 }
454
455 TextureImage imag = this.Textures[imageID];
456 AssetRequest req = new AssetRequest();
457 req.RequestUser = userInfo;
458 req.RequestAssetID = imageID;
459 req.IsTextureRequest = true;
460 req.ImageInfo = imag;
461
462 if (imag.Data.LongLength > 600)
463 {
464 //over 600 bytes so split up file
465 req.NumPackets = 1 + (int)(imag.Data.Length - 600 + 999) / 1000;
466 }
467 else
468 {
469 req.NumPackets = 1;
470 }
471
472 this.TextureRequests.Add(req);
473 }
474
475 public TextureImage CloneImage(LLUUID newOwner, TextureImage source)
476 {
477 TextureImage newImage = new TextureImage();
478 newImage.Data = new byte[source.Data.Length];
479 Array.Copy(source.Data, newImage.Data, source.Data.Length);
480 //newImage.filename = source.filename;
481 newImage.FullID = LLUUID.Random();
482 newImage.Name = source.Name;
483 return (newImage);
484 }
485 #endregion
486
487 #region viewer asset uploading
488 public AssetBase UploadPacket(AssetUploadRequestPacket pack, LLUUID assetID)
489 {
490
491 AssetBase asset = null;
492 if (pack.AssetBlock.Type == 0)
493 {
494 if (pack.AssetBlock.AssetData.Length > 0)
495 {
496 //first packet for transaction
497 asset = new AssetBase();
498 asset.FullID = assetID;
499 asset.Type = pack.AssetBlock.Type;
500 asset.InvType = asset.Type;
501 asset.Name = "UploadedTexture" + Util.RandomClass.Next(1, 1000).ToString("000");
502 asset.Data = pack.AssetBlock.AssetData;
503 this._assetServer.UploadNewAsset(asset);
504 TextureImage image = new TextureImage(asset);
505 this.Textures.Add(image.FullID, image);
506 }
507 }
508
509 return asset;
510 }
511
512 /*
513 public AssetBase TransactionComplete(LLUUID transactionID)
514 {
515 AssetBase asset = null;
516 if(this.IncomingAssets.ContainsKey(transactionID))
517 {
518 // not the first packet of this transaction
519 asset = this.IncomingAssets[transactionID];
520 if(asset.Type == 0)
521 {
522 TextureImage image = new TextureImage(asset);
523 this.Textures.Add(image.FullID, image);
524 }
525 }
526 return asset;
527 }*/
528
529 #endregion
530
531 }
532
533 public class AssetRequest
534 {
535 public SimClient RequestUser;
536 public LLUUID RequestAssetID;
537 public AssetInfo AssetInf;
538 public TextureImage ImageInfo;
539 public LLUUID TransferRequestID;
540 public long DataPointer = 0;
541 public int NumPackets = 0;
542 public int PacketCounter = 0;
543 public bool IsTextureRequest;
544 //public bool AssetInCache;
545 //public int TimeRequested;
546
547 public AssetRequest()
548 {
549
550 }
551 }
552
553 public class AssetInfo : AssetBase
554 {
555 public AssetInfo()
556 {
557
558 }
559
560 public AssetInfo(AssetBase aBase)
561 {
562 Data = aBase.Data;
563 FullID = aBase.FullID;
564 Type = aBase.Type;
565 InvType = aBase.InvType;
566 Name = aBase.Name;
567 Description = aBase.Description;
568 }
569 }
570
571 public class TextureImage : AssetBase
572 {
573 public TextureImage()
574 {
575
576 }
577
578 public TextureImage(AssetBase aBase)
579 {
580 Data = aBase.Data;
581 FullID = aBase.FullID;
582 Type = aBase.Type;
583 InvType = aBase.InvType;
584 Name = aBase.Name;
585 Description = aBase.Description;
586 }
587 }
588
589}
diff --git a/OpenSim.RegionServer/Assets/InventoryCache.cs b/OpenSim.RegionServer/Assets/InventoryCache.cs
new file mode 100644
index 0000000..0788db2
--- /dev/null
+++ b/OpenSim.RegionServer/Assets/InventoryCache.cs
@@ -0,0 +1,199 @@
1/*
2* Copyright (c) OpenSim project, http://sim.opensecondlife.org/
3*
4* Redistribution and use in source and binary forms, with or without
5* modification, are permitted provided that the following conditions are met:
6* * Redistributions of source code must retain the above copyright
7* notice, this list of conditions and the following disclaimer.
8* * Redistributions in binary form must reproduce the above copyright
9* notice, this list of conditions and the following disclaimer in the
10* documentation and/or other materials provided with the distribution.
11* * Neither the name of the <organization> nor the
12* names of its contributors may be used to endorse or promote products
13* derived from this software without specific prior written permission.
14*
15* THIS SOFTWARE IS PROVIDED BY <copyright holder> ``AS IS'' AND ANY
16* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
18* DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY
19* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
20* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
21* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
22* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
24* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25*
26*/
27
28using System;
29using System.Collections.Generic;
30using libsecondlife;
31using OpenSim;
32using libsecondlife.Packets;
33//using OpenSim.GridServers;
34using OpenSim.Framework.Inventory;
35using OpenSim.Framework.Assets;
36
37namespace OpenSim.Assets
38{
39 /// <summary>
40 /// Description of InventoryManager.
41 /// </summary>
42 public class InventoryCache
43 {
44 private Dictionary<LLUUID, AgentInventory> _agentsInventory;
45 private List<UserServerRequest> _serverRequests; //list of requests made to user server.
46 private System.Text.Encoding _enc = System.Text.Encoding.ASCII;
47 private const uint FULL_MASK_PERMISSIONS = 2147483647;
48
49 public InventoryCache()
50 {
51 _agentsInventory = new Dictionary<LLUUID, AgentInventory>();
52 _serverRequests = new List<UserServerRequest>();
53 }
54
55 public void AddNewAgentsInventory(AgentInventory agentInventory)
56 {
57 this._agentsInventory.Add(agentInventory.AgentID, agentInventory);
58 }
59
60 public void ClientLeaving(LLUUID clientID)
61 {
62 if (this._agentsInventory.ContainsKey(clientID))
63 {
64 this._agentsInventory.Remove(clientID);
65 }
66
67 }
68 public bool CreateNewInventoryFolder(SimClient remoteClient, LLUUID folderID)
69 {
70 bool res = false;
71 if (folderID != LLUUID.Zero) //don't create a folder with a zero id
72 {
73 if (this._agentsInventory.ContainsKey(remoteClient.AgentID))
74 {
75 res = this._agentsInventory[remoteClient.AgentID].CreateNewFolder(folderID);
76 }
77 }
78 return res;
79 }
80
81 public LLUUID AddNewInventoryItem(SimClient remoteClient, LLUUID folderID, OpenSim.Framework.Assets.AssetBase asset)
82 {
83 LLUUID newItem = null;
84 if (this._agentsInventory.ContainsKey(remoteClient.AgentID))
85 {
86 newItem = this._agentsInventory[remoteClient.AgentID].AddToInventory(folderID, asset);
87 }
88
89 return newItem;
90 }
91
92 public void FetchInventoryDescendents(SimClient userInfo, FetchInventoryDescendentsPacket FetchDescend)
93 {
94 if (this._agentsInventory.ContainsKey(userInfo.AgentID))
95 {
96 AgentInventory agentInventory = this._agentsInventory[userInfo.AgentID];
97 if (FetchDescend.InventoryData.FetchItems)
98 {
99 if (agentInventory.InventoryFolders.ContainsKey(FetchDescend.InventoryData.FolderID))
100 {
101 InventoryFolder Folder = agentInventory.InventoryFolders[FetchDescend.InventoryData.FolderID];
102 InventoryDescendentsPacket Descend = new InventoryDescendentsPacket();
103 Descend.AgentData.AgentID = userInfo.AgentID;
104 Descend.AgentData.OwnerID = Folder.OwnerID;
105 Descend.AgentData.FolderID = FetchDescend.InventoryData.FolderID;
106 Descend.AgentData.Descendents = Folder.Items.Count;
107 Descend.AgentData.Version = Folder.Items.Count;
108
109
110 Descend.ItemData = new InventoryDescendentsPacket.ItemDataBlock[Folder.Items.Count];
111 for (int i = 0; i < Folder.Items.Count; i++)
112 {
113
114 InventoryItem Item = Folder.Items[i];
115 Descend.ItemData[i] = new InventoryDescendentsPacket.ItemDataBlock();
116 Descend.ItemData[i].ItemID = Item.ItemID;
117 Descend.ItemData[i].AssetID = Item.AssetID;
118 Descend.ItemData[i].CreatorID = Item.CreatorID;
119 Descend.ItemData[i].BaseMask = FULL_MASK_PERMISSIONS;
120 Descend.ItemData[i].CreationDate = 1000;
121 Descend.ItemData[i].Description = _enc.GetBytes(Item.Description + "\0");
122 Descend.ItemData[i].EveryoneMask = FULL_MASK_PERMISSIONS;
123 Descend.ItemData[i].Flags = 1;
124 Descend.ItemData[i].FolderID = Item.FolderID;
125 Descend.ItemData[i].GroupID = new LLUUID("00000000-0000-0000-0000-000000000000");
126 Descend.ItemData[i].GroupMask = FULL_MASK_PERMISSIONS;
127 Descend.ItemData[i].InvType = Item.InvType;
128 Descend.ItemData[i].Name = _enc.GetBytes(Item.Name + "\0");
129 Descend.ItemData[i].NextOwnerMask = FULL_MASK_PERMISSIONS;
130 Descend.ItemData[i].OwnerID = Item.OwnerID;
131 Descend.ItemData[i].OwnerMask = FULL_MASK_PERMISSIONS;
132 Descend.ItemData[i].SalePrice = 100;
133 Descend.ItemData[i].SaleType = 0;
134 Descend.ItemData[i].Type = Item.Type;
135 Descend.ItemData[i].CRC = libsecondlife.Helpers.InventoryCRC(1000, 0, Descend.ItemData[i].InvType, Descend.ItemData[i].Type, Descend.ItemData[i].AssetID, Descend.ItemData[i].GroupID, 100, Descend.ItemData[i].OwnerID, Descend.ItemData[i].CreatorID, Descend.ItemData[i].ItemID, Descend.ItemData[i].FolderID, FULL_MASK_PERMISSIONS, 1, FULL_MASK_PERMISSIONS, FULL_MASK_PERMISSIONS, FULL_MASK_PERMISSIONS);
136 }
137 userInfo.OutPacket(Descend);
138
139 }
140 }
141 else
142 {
143 Console.WriteLine("fetch subfolders");
144 }
145 }
146 }
147
148 public void FetchInventory(SimClient userInfo, FetchInventoryPacket FetchItems)
149 {
150 if (this._agentsInventory.ContainsKey(userInfo.AgentID))
151 {
152 AgentInventory agentInventory = this._agentsInventory[userInfo.AgentID];
153
154 for (int i = 0; i < FetchItems.InventoryData.Length; i++)
155 {
156 if (agentInventory.InventoryItems.ContainsKey(FetchItems.InventoryData[i].ItemID))
157 {
158 InventoryItem Item = agentInventory.InventoryItems[FetchItems.InventoryData[i].ItemID];
159 FetchInventoryReplyPacket InventoryReply = new FetchInventoryReplyPacket();
160 InventoryReply.AgentData.AgentID = userInfo.AgentID;
161 InventoryReply.InventoryData = new FetchInventoryReplyPacket.InventoryDataBlock[1];
162 InventoryReply.InventoryData[0] = new FetchInventoryReplyPacket.InventoryDataBlock();
163 InventoryReply.InventoryData[0].ItemID = Item.ItemID;
164 InventoryReply.InventoryData[0].AssetID = Item.AssetID;
165 InventoryReply.InventoryData[0].CreatorID = Item.CreatorID;
166 InventoryReply.InventoryData[0].BaseMask = FULL_MASK_PERMISSIONS;
167 InventoryReply.InventoryData[0].CreationDate = 1000;
168 InventoryReply.InventoryData[0].Description = _enc.GetBytes(Item.Description + "\0");
169 InventoryReply.InventoryData[0].EveryoneMask = FULL_MASK_PERMISSIONS;
170 InventoryReply.InventoryData[0].Flags = 1;
171 InventoryReply.InventoryData[0].FolderID = Item.FolderID;
172 InventoryReply.InventoryData[0].GroupID = new LLUUID("00000000-0000-0000-0000-000000000000");
173 InventoryReply.InventoryData[0].GroupMask = FULL_MASK_PERMISSIONS;
174 InventoryReply.InventoryData[0].InvType = Item.InvType;
175 InventoryReply.InventoryData[0].Name = _enc.GetBytes(Item.Name + "\0");
176 InventoryReply.InventoryData[0].NextOwnerMask = FULL_MASK_PERMISSIONS;
177 InventoryReply.InventoryData[0].OwnerID = Item.OwnerID;
178 InventoryReply.InventoryData[0].OwnerMask = FULL_MASK_PERMISSIONS;
179 InventoryReply.InventoryData[0].SalePrice = 100;
180 InventoryReply.InventoryData[0].SaleType = 0;
181 InventoryReply.InventoryData[0].Type = Item.Type;
182 InventoryReply.InventoryData[0].CRC = libsecondlife.Helpers.InventoryCRC(1000, 0, InventoryReply.InventoryData[0].InvType, InventoryReply.InventoryData[0].Type, InventoryReply.InventoryData[0].AssetID, InventoryReply.InventoryData[0].GroupID, 100, InventoryReply.InventoryData[0].OwnerID, InventoryReply.InventoryData[0].CreatorID, InventoryReply.InventoryData[0].ItemID, InventoryReply.InventoryData[0].FolderID, FULL_MASK_PERMISSIONS, 1, FULL_MASK_PERMISSIONS, FULL_MASK_PERMISSIONS, FULL_MASK_PERMISSIONS);
183 userInfo.OutPacket(InventoryReply);
184 }
185 }
186 }
187 }
188 }
189
190
191
192 public class UserServerRequest
193 {
194 public UserServerRequest()
195 {
196
197 }
198 }
199}
diff --git a/OpenSim.RegionServer/CAPS/SimHttp.cs b/OpenSim.RegionServer/CAPS/SimHttp.cs
new file mode 100644
index 0000000..f5a8705
--- /dev/null
+++ b/OpenSim.RegionServer/CAPS/SimHttp.cs
@@ -0,0 +1,175 @@
1/*
2Copyright (c) OpenSimCAPS project, http://osgrid.org/
3
4
5* All rights reserved.
6*
7* Redistribution and use in source and binary forms, with or without
8* modification, are permitted provided that the following conditions are met:
9* * Redistributions of source code must retain the above copyright
10* notice, this list of conditions and the following disclaimer.
11* * Redistributions in binary form must reproduce the above copyright
12* notice, this list of conditions and the following disclaimer in the
13* documentation and/or other materials provided with the distribution.
14* * Neither the name of the <organization> nor the
15* names of its contributors may be used to endorse or promote products
16* derived from this software without specific prior written permission.
17*
18* THIS SOFTWARE IS PROVIDED BY <copyright holder> ``AS IS'' AND ANY
19* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
20* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21* DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY
22* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
24* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
25* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
27* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28*/
29
30using System;
31using System.Text;
32using Nwc.XmlRpc;
33using System.Threading;
34using System.Text.RegularExpressions;
35using System.Net;
36using System.IO;
37using System.Collections;
38using System.Collections.Generic;
39using libsecondlife;
40using OpenSim.Framework.Console;
41using OpenSim.Framework.Interfaces;
42
43namespace OpenSim.CAPS
44{
45 // Dummy HTTP server, does nothing useful for now
46
47 public class SimCAPSHTTPServer
48 {
49 public Thread HTTPD;
50 public HttpListener Listener;
51
52 public SimCAPSHTTPServer()
53 {
54 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Starting up HTTP Server");
55 HTTPD = new Thread(new ThreadStart(StartHTTP));
56 HTTPD.Start();
57 }
58
59 public void StartHTTP()
60 {
61 try
62 {
63 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("SimHttp.cs:StartHTTP() - Spawned main thread OK");
64 Listener = new HttpListener();
65
66 Listener.Prefixes.Add("http://+:" + OpenSimRoot.Instance.Cfg.IPListenPort + "/");
67 Listener.Start();
68
69 HttpListenerContext context;
70 while (true)
71 {
72 context = Listener.GetContext();
73 ThreadPool.QueueUserWorkItem(new WaitCallback(HandleRequest), context);
74 }
75 }
76 catch (Exception e)
77 {
78 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(e.Message);
79 }
80 }
81
82 static string ParseXMLRPC(string requestBody)
83 {
84 try
85 {
86 XmlRpcRequest request = (XmlRpcRequest)(new XmlRpcRequestDeserializer()).Deserialize(requestBody);
87
88 Hashtable requestData = (Hashtable)request.Params[0];
89 switch (request.MethodName)
90 {
91 case "expect_user":
92 AgentCircuitData agent_data = new AgentCircuitData();
93 agent_data.SessionID = new LLUUID((string)requestData["session_id"]);
94 agent_data.SecureSessionID = new LLUUID((string)requestData["secure_session_id"]);
95 agent_data.firstname = (string)requestData["firstname"];
96 agent_data.lastname = (string)requestData["lastname"];
97 agent_data.AgentID = new LLUUID((string)requestData["agent_id"]);
98 agent_data.circuitcode = Convert.ToUInt32(requestData["circuit_code"]);
99 if (OpenSimRoot.Instance.GridServers.GridServer.GetName() == "Remote")
100 {
101 ((RemoteGridBase)OpenSimRoot.Instance.GridServers.GridServer).agentcircuits.Add((uint)agent_data.circuitcode, agent_data);
102 }
103 return "<?xml version=\"1.0\"?><methodResponse><params /></methodResponse>";
104 break;
105 }
106 }
107 catch (Exception e)
108 {
109 Console.WriteLine(e.ToString());
110 }
111 return "";
112 }
113
114 static string ParseREST(string requestBody, string requestURL)
115 {
116 return "";
117 }
118
119 static string ParseLLSDXML(string requestBody)
120 {
121 // dummy function for now - IMPLEMENT ME!
122 return "";
123 }
124
125 static void HandleRequest(Object stateinfo)
126 {
127 HttpListenerContext context = (HttpListenerContext)stateinfo;
128
129 HttpListenerRequest request = context.Request;
130 HttpListenerResponse response = context.Response;
131
132 response.KeepAlive = false;
133 response.SendChunked = false;
134
135 System.IO.Stream body = request.InputStream;
136 System.Text.Encoding encoding = System.Text.Encoding.UTF8;
137 System.IO.StreamReader reader = new System.IO.StreamReader(body, encoding);
138
139 string requestBody = reader.ReadToEnd();
140 body.Close();
141 reader.Close();
142
143 string responseString = "";
144 switch (request.ContentType)
145 {
146 case "text/xml":
147 // must be XML-RPC, so pass to the XML-RPC parser
148
149 responseString = ParseXMLRPC(requestBody);
150 response.AddHeader("Content-type", "text/xml");
151 break;
152
153 case "application/xml":
154 // probably LLSD we hope, otherwise it should be ignored by the parser
155 responseString = ParseLLSDXML(requestBody);
156 response.AddHeader("Content-type", "application/xml");
157 break;
158
159 case null:
160 // must be REST or invalid crap, so pass to the REST parser
161 responseString = ParseREST(request.Url.OriginalString, requestBody);
162 break;
163 }
164
165 byte[] buffer = System.Text.Encoding.UTF8.GetBytes(responseString);
166 System.IO.Stream output = response.OutputStream;
167 response.SendChunked = false;
168 response.ContentLength64 = buffer.Length;
169 output.Write(buffer, 0, buffer.Length);
170 output.Close();
171 }
172 }
173
174
175}
diff --git a/OpenSim.RegionServer/Grid.cs b/OpenSim.RegionServer/Grid.cs
new file mode 100644
index 0000000..b0df6a8
--- /dev/null
+++ b/OpenSim.RegionServer/Grid.cs
@@ -0,0 +1,89 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4using System.Reflection;
5using OpenSim.Framework.Interfaces;
6using OpenSim.UserServer;
7
8namespace OpenSim
9{
10 public class Grid
11 {
12 public IAssetServer AssetServer;
13 public IGridServer GridServer;
14 public string AssetDll = "";
15 public string GridDll = "";
16
17 public Grid()
18 {
19 }
20
21 public virtual void Initialise()
22 {
23 //load the dlls
24 this.AssetServer = this.LoadAssetDll(this.AssetDll);
25 this.GridServer = this.LoadGridDll(this.GridDll);
26 }
27 public virtual void Close()
28 {
29 this.AssetServer.Close();
30 this.GridServer.Close();
31 }
32
33 private IAssetServer LoadAssetDll(string dllName)
34 {
35 Assembly pluginAssembly = Assembly.LoadFrom(dllName);
36 IAssetServer server = null;
37
38 foreach (Type pluginType in pluginAssembly.GetTypes())
39 {
40 if (pluginType.IsPublic)
41 {
42 if (!pluginType.IsAbstract)
43 {
44 Type typeInterface = pluginType.GetInterface("IAssetPlugin", true);
45
46 if (typeInterface != null)
47 {
48 IAssetPlugin plug = (IAssetPlugin)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString()));
49 server = plug.GetAssetServer();
50 break;
51 }
52
53 typeInterface = null;
54 }
55 }
56 }
57 pluginAssembly = null;
58 return server;
59 }
60
61 private IGridServer LoadGridDll(string dllName)
62 {
63 Assembly pluginAssembly = Assembly.LoadFrom(dllName);
64 IGridServer server = null;
65
66 foreach (Type pluginType in pluginAssembly.GetTypes())
67 {
68 if (pluginType.IsPublic)
69 {
70 if (!pluginType.IsAbstract)
71 {
72 Type typeInterface = pluginType.GetInterface("IGridPlugin", true);
73
74 if (typeInterface != null)
75 {
76 IGridPlugin plug = (IGridPlugin)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString()));
77 server = plug.GetGridServer();
78 break;
79 }
80
81 typeInterface = null;
82 }
83 }
84 }
85 pluginAssembly = null;
86 return server;
87 }
88 }
89}
diff --git a/OpenSim.RegionServer/OpenSim.RegionServer.csproj b/OpenSim.RegionServer/OpenSim.RegionServer.csproj
new file mode 100644
index 0000000..ebf2f87
--- /dev/null
+++ b/OpenSim.RegionServer/OpenSim.RegionServer.csproj
@@ -0,0 +1,169 @@
1<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
2 <PropertyGroup>
3 <ProjectType>Local</ProjectType>
4 <ProductVersion>8.0.50727</ProductVersion>
5 <SchemaVersion>2.0</SchemaVersion>
6 <ProjectGuid>{B48F0D82-2DE5-42B0-9F1D-0F4353FA243A}</ProjectGuid>
7 <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
8 <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
9 <ApplicationIcon></ApplicationIcon>
10 <AssemblyKeyContainerName>
11 </AssemblyKeyContainerName>
12 <AssemblyName>OpenSim.RegionServer</AssemblyName>
13 <DefaultClientScript>JScript</DefaultClientScript>
14 <DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout>
15 <DefaultTargetSchema>IE50</DefaultTargetSchema>
16 <DelaySign>false</DelaySign>
17 <OutputType>Exe</OutputType>
18 <AppDesignerFolder></AppDesignerFolder>
19 <RootNamespace>OpenSim.RegionServer</RootNamespace>
20 <StartupObject>OpenSim.RegionServer</StartupObject>
21 <FileUpgradeFlags>
22 </FileUpgradeFlags>
23 </PropertyGroup>
24 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
25 <AllowUnsafeBlocks>False</AllowUnsafeBlocks>
26 <BaseAddress>285212672</BaseAddress>
27 <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
28 <ConfigurationOverrideFile>
29 </ConfigurationOverrideFile>
30 <DefineConstants>TRACE;DEBUG</DefineConstants>
31 <DocumentationFile></DocumentationFile>
32 <DebugSymbols>True</DebugSymbols>
33 <FileAlignment>4096</FileAlignment>
34 <Optimize>False</Optimize>
35 <OutputPath>..\bin\</OutputPath>
36 <RegisterForComInterop>False</RegisterForComInterop>
37 <RemoveIntegerChecks>False</RemoveIntegerChecks>
38 <TreatWarningsAsErrors>False</TreatWarningsAsErrors>
39 <WarningLevel>4</WarningLevel>
40 <NoWarn></NoWarn>
41 </PropertyGroup>
42 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
43 <AllowUnsafeBlocks>False</AllowUnsafeBlocks>
44 <BaseAddress>285212672</BaseAddress>
45 <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
46 <ConfigurationOverrideFile>
47 </ConfigurationOverrideFile>
48 <DefineConstants>TRACE</DefineConstants>
49 <DocumentationFile></DocumentationFile>
50 <DebugSymbols>False</DebugSymbols>
51 <FileAlignment>4096</FileAlignment>
52 <Optimize>True</Optimize>
53 <OutputPath>..\bin\</OutputPath>
54 <RegisterForComInterop>False</RegisterForComInterop>
55 <RemoveIntegerChecks>False</RemoveIntegerChecks>
56 <TreatWarningsAsErrors>False</TreatWarningsAsErrors>
57 <WarningLevel>4</WarningLevel>
58 <NoWarn></NoWarn>
59 </PropertyGroup>
60 <ItemGroup>
61 <Reference Include="System" >
62 <HintPath>\System.dll</HintPath>
63 </Reference>
64 <Reference Include="System.Xml.dll" >
65 <HintPath>\System.Xml.dll.dll</HintPath>
66 </Reference>
67 <Reference Include="libsecondlife.dll" >
68 <HintPath>\libsecondlife.dll.dll</HintPath>
69 </Reference>
70 <Reference Include="Axiom.MathLib.dll" >
71 <HintPath>\Axiom.MathLib.dll.dll</HintPath>
72 </Reference>
73 <Reference Include="Db4objects.Db4o.dll" >
74 <HintPath>\Db4objects.Db4o.dll.dll</HintPath>
75 </Reference>
76 </ItemGroup>
77 <ItemGroup>
78 <ProjectReference Include="..\OpenSim.Framework.Console\OpenSim.Framework.Console.csproj">
79 <Name>OpenSim.Framework.Console</Name>
80 <Project>{C8405E1A-EC19-48B6-9C8C-CA03624B9916}</Project>
81 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
82 </ProjectReference>
83 <ProjectReference Include="..\OpenSim.Physics\Manager\OpenSim.Physics.Manager.csproj">
84 <Name>OpenSim.Physics.Manager</Name>
85 <Project>{58360A80-9333-4E0F-8F83-3CF937E51633}</Project>
86 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
87 </ProjectReference>
88 <ProjectReference Include="..\OpenSim.Framework\OpenSim.Framework.csproj">
89 <Name>OpenSim.Framework</Name>
90 <Project>{1D2865A9-CF8E-45F7-B96D-91ED128A32CF}</Project>
91 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
92 </ProjectReference>
93 </ItemGroup>
94 <ItemGroup>
95 <Compile Include="Grid.cs">
96 <SubType>Code</SubType>
97 </Compile>
98 <Compile Include="OpenSimApplication.cs">
99 <SubType>Code</SubType>
100 </Compile>
101 <Compile Include="OpenSimMain.cs">
102 <SubType>Code</SubType>
103 </Compile>
104 <Compile Include="OpenSimRoot.cs">
105 <SubType>Code</SubType>
106 </Compile>
107 <Compile Include="QueItem.cs">
108 <SubType>Code</SubType>
109 </Compile>
110 <Compile Include="SimClient.cs">
111 <SubType>Code</SubType>
112 </Compile>
113 <Compile Include="SimConsole.cs">
114 <SubType>Code</SubType>
115 </Compile>
116 <Compile Include="VersionInfo.cs">
117 <SubType>Code</SubType>
118 </Compile>
119 <Compile Include="Assets\AssetCache.cs">
120 <SubType>Code</SubType>
121 </Compile>
122 <Compile Include="Assets\InventoryCache.cs">
123 <SubType>Code</SubType>
124 </Compile>
125 <Compile Include="CAPS\SimHttp.cs">
126 <SubType>Code</SubType>
127 </Compile>
128 <Compile Include="types\Mesh.cs">
129 <SubType>Code</SubType>
130 </Compile>
131 <Compile Include="types\Triangle.cs">
132 <SubType>Code</SubType>
133 </Compile>
134 <Compile Include="UserServer\LocalUserProfileManager.cs">
135 <SubType>Code</SubType>
136 </Compile>
137 <Compile Include="UserServer\LoginServer.cs">
138 <SubType>Code</SubType>
139 </Compile>
140 <Compile Include="world\Avatar.cs">
141 <SubType>Code</SubType>
142 </Compile>
143 <Compile Include="world\Entity.cs">
144 <SubType>Code</SubType>
145 </Compile>
146 <Compile Include="world\Primitive.cs">
147 <SubType>Code</SubType>
148 </Compile>
149 <Compile Include="world\ScriptEngine.cs">
150 <SubType>Code</SubType>
151 </Compile>
152 <Compile Include="world\SurfacePatch.cs">
153 <SubType>Code</SubType>
154 </Compile>
155 <Compile Include="world\World.cs">
156 <SubType>Code</SubType>
157 </Compile>
158 <Compile Include="world\scripting\IScript.cs">
159 <SubType>Code</SubType>
160 </Compile>
161 </ItemGroup>
162 <Import Project="$(MSBuildBinPath)\Microsoft.CSHARP.Targets" />
163 <PropertyGroup>
164 <PreBuildEvent>
165 </PreBuildEvent>
166 <PostBuildEvent>
167 </PostBuildEvent>
168 </PropertyGroup>
169</Project>
diff --git a/OpenSim.RegionServer/OpenSim.RegionServer.exe.build b/OpenSim.RegionServer/OpenSim.RegionServer.exe.build
new file mode 100644
index 0000000..c65f751
--- /dev/null
+++ b/OpenSim.RegionServer/OpenSim.RegionServer.exe.build
@@ -0,0 +1,67 @@
1<?xml version="1.0" ?>
2<project name="OpenSim.RegionServer" default="build">
3 <target name="build">
4 <echo message="Build Directory is ${project::get-base-directory()}/${build.dir}" />
5 <mkdir dir="${project::get-base-directory()}/${build.dir}" />
6 <copy todir="${project::get-base-directory()}/${build.dir}">
7 <fileset basedir="${project::get-base-directory()}">
8 </fileset>
9 </copy>
10 <csc target="exe" debug="${build.debug}" unsafe="False" define="TRACE;DEBUG" output="${project::get-base-directory()}/${build.dir}/${project::get-name()}.exe">
11 <resources prefix="OpenSim.RegionServer" dynamicprefix="true" >
12 </resources>
13 <sources failonempty="true">
14 <include name="Grid.cs" />
15 <include name="OpenSimApplication.cs" />
16 <include name="OpenSimMain.cs" />
17 <include name="OpenSimRoot.cs" />
18 <include name="QueItem.cs" />
19 <include name="SimClient.cs" />
20 <include name="SimConsole.cs" />
21 <include name="VersionInfo.cs" />
22 <include name="Assets/AssetCache.cs" />
23 <include name="Assets/InventoryCache.cs" />
24 <include name="CAPS/SimHttp.cs" />
25 <include name="types/Mesh.cs" />
26 <include name="types/Triangle.cs" />
27 <include name="UserServer/LocalUserProfileManager.cs" />
28 <include name="UserServer/LoginServer.cs" />
29 <include name="world/Avatar.cs" />
30 <include name="world/Entity.cs" />
31 <include name="world/Primitive.cs" />
32 <include name="world/ScriptEngine.cs" />
33 <include name="world/SurfacePatch.cs" />
34 <include name="world/World.cs" />
35 <include name="world/scripting/IScript.cs" />
36 </sources>
37 <references basedir="${project::get-base-directory()}">
38 <lib>
39 <include name="${project::get-base-directory()}" />
40 <include name="${project::get-base-directory()}/${build.dir}" />
41 </lib>
42 <include name="System.dll" />
43 <include name="System.Xml.dll.dll" />
44 <include name="../bin/libsecondlife.dll" />
45 <include name="../bin/Axiom.MathLib.dll" />
46 <include name="../bin/Db4objects.Db4o.dll" />
47 <include name="../OpenSim.Framework.Console/${build.dir}/OpenSim.Framework.Console.dll" />
48 <include name="../OpenSim.Physics/Manager/${build.dir}/OpenSim.Physics.Manager.dll" />
49 <include name="../OpenSim.Framework/${build.dir}/OpenSim.Framework.dll" />
50 </references>
51 </csc>
52 <echo message="Copying from [${project::get-base-directory()}/${build.dir}/] to [${project::get-base-directory()}/../bin/" />
53 <mkdir dir="${project::get-base-directory()}/../bin/"/>
54 <copy todir="${project::get-base-directory()}/../bin/">
55 <fileset basedir="${project::get-base-directory()}/${build.dir}/" >
56 <include name="*.dll"/>
57 <include name="*.exe"/>
58 </fileset>
59 </copy>
60 </target>
61 <target name="clean">
62 <delete dir="${bin.dir}" failonerror="false" />
63 <delete dir="${obj.dir}" failonerror="false" />
64 </target>
65 <target name="doc" description="Creates documentation.">
66 </target>
67</project>
diff --git a/OpenSim.RegionServer/OpenSimApplication.cs b/OpenSim.RegionServer/OpenSimApplication.cs
new file mode 100644
index 0000000..abfdf45
--- /dev/null
+++ b/OpenSim.RegionServer/OpenSimApplication.cs
@@ -0,0 +1,16 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4using System.Net;
5using System.Net.Sockets;
6
7namespace OpenSim
8{
9 public abstract class OpenSimApplication
10 {
11 public abstract void StartUp();
12 public abstract void Shutdown();
13 public abstract void SendPacketTo(byte[] buffer, int size, SocketFlags flags, uint circuitcode);// EndPoint packetSender);
14 public abstract void RemoveClientCircuit(uint circuitcode);
15 }
16}
diff --git a/OpenSim.RegionServer/OpenSimMain.cs b/OpenSim.RegionServer/OpenSimMain.cs
new file mode 100644
index 0000000..b2bc0b3
--- /dev/null
+++ b/OpenSim.RegionServer/OpenSimMain.cs
@@ -0,0 +1,320 @@
1/*
2Copyright (c) OpenSim project, http://osgrid.org/
3
4* All rights reserved.
5*
6* Redistribution and use in source and binary forms, with or without
7* modification, are permitted provided that the following conditions are met:
8* * Redistributions of source code must retain the above copyright
9* notice, this list of conditions and the following disclaimer.
10* * Redistributions in binary form must reproduce the above copyright
11* notice, this list of conditions and the following disclaimer in the
12* documentation and/or other materials provided with the distribution.
13* * Neither the name of the <organization> nor the
14* names of its contributors may be used to endorse or promote products
15* derived from this software without specific prior written permission.
16*
17* THIS SOFTWARE IS PROVIDED BY <copyright holder> ``AS IS'' AND ANY
18* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20* DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY
21* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27*/
28
29using System;
30using System.Text;
31using System.IO;
32using System.Threading;
33using System.Net;
34using System.Net.Sockets;
35using System.Timers;
36using System.Reflection;
37using System.Collections;
38using System.Collections.Generic;
39using libsecondlife;
40using libsecondlife.Packets;
41using OpenSim.world;
42using OpenSim.Framework.Interfaces;
43using OpenSim.UserServer;
44using OpenSim.Assets;
45using OpenSim.CAPS;
46using OpenSim.Framework.Console;
47using OpenSim.Physics.Manager;
48
49namespace OpenSim
50{
51 /// <summary>
52 ///
53 /// </summary>
54 public class OpenSimMain : OpenSimApplication
55 {
56 private Dictionary<EndPoint, uint> clientCircuits = new Dictionary<EndPoint, uint>();
57 private PhysicsManager physManager;
58
59 public Socket Server;
60 private IPEndPoint ServerIncoming;
61 private byte[] RecvBuffer = new byte[4096];
62 private byte[] ZeroBuffer = new byte[8192];
63 private IPEndPoint ipeSender;
64 private EndPoint epSender;
65 private AsyncCallback ReceivedData;
66
67 private System.Timers.Timer timer1 = new System.Timers.Timer();
68 private string ConfigDll = "OpenSim.Config.SimConfigDb4o.dll";
69 private string _physicsEngine = "basicphysics";
70 public bool sandbox = false;
71 public bool loginserver = false;
72
73 [STAThread]
74 public static void Main(string[] args)
75 {
76 Console.WriteLine("OpenSim " + VersionInfo.Version + "\n");
77 Console.WriteLine("Starting...\n");
78 OpenSim.Framework.Console.MainConsole.Instance = new SimConsole(OpenSim.Framework.Console.ConsoleBase.ConsoleType.Local, "", 0);
79
80 //OpenSimRoot.instance = new OpenSimRoot();
81 OpenSimMain sim = new OpenSimMain();
82 OpenSimRoot.Instance.Application = sim;
83
84 sim.sandbox = false;
85 sim.loginserver = false;
86 sim._physicsEngine = "basicphysics";
87
88 for (int i = 0; i < args.Length; i++)
89 {
90 if (args[i] == "-sandbox")
91 {
92 sim.sandbox = true;
93 OpenSimRoot.Instance.Sandbox = true;
94 }
95
96 if (args[i] == "-loginserver")
97 {
98 sim.loginserver = true;
99 }
100 if (args[i] == "-realphysx")
101 {
102 sim._physicsEngine = "RealPhysX";
103 OpenSim.world.Avatar.PhysicsEngineFlying = true;
104 }
105 }
106
107
108 OpenSimRoot.Instance.GridServers = new Grid();
109 if (sim.sandbox)
110 {
111 OpenSimRoot.Instance.GridServers.AssetDll = "OpenSim.GridInterfaces.Local.dll";
112 OpenSimRoot.Instance.GridServers.GridDll = "OpenSim.GridInterfaces.Local.dll";
113 OpenSimRoot.Instance.GridServers.Initialise();
114 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Starting in Sandbox mode");
115 }
116 else
117 {
118 OpenSimRoot.Instance.GridServers.AssetDll = "OpenSim.GridInterfaces.Remote.dll";
119 OpenSimRoot.Instance.GridServers.GridDll = "OpenSim.GridInterfaces.Remote.dll";
120 OpenSimRoot.Instance.GridServers.Initialise();
121 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Starting in Grid mode");
122 }
123
124 if (sim.loginserver && sim.sandbox)
125 {
126 LoginServer loginServer = new LoginServer(OpenSimRoot.Instance.GridServers.GridServer);
127 loginServer.Startup();
128 }
129
130 OpenSimRoot.Instance.StartUp();
131
132 while (true)
133 {
134 OpenSim.Framework.Console.MainConsole.Instance.MainConsolePrompt();
135 }
136 }
137
138 private OpenSimMain()
139 {
140 }
141
142 public override void StartUp()
143 {
144 OpenSimRoot.Instance.startuptime = DateTime.Now;
145
146 OpenSimRoot.Instance.AssetCache = new AssetCache(OpenSimRoot.Instance.GridServers.AssetServer);
147 OpenSimRoot.Instance.InventoryCache = new InventoryCache();
148
149 // We check our local database first, then the grid for config options
150 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Main.cs:Startup() - Loading configuration");
151 OpenSimRoot.Instance.Cfg = this.LoadConfigDll(this.ConfigDll);
152 OpenSimRoot.Instance.Cfg.InitConfig(this.sandbox);
153 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Main.cs:Startup() - Contacting gridserver");
154 OpenSimRoot.Instance.Cfg.LoadFromGrid();
155
156 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Main.cs:Startup() - We are " + OpenSimRoot.Instance.Cfg.RegionName + " at " + OpenSimRoot.Instance.Cfg.RegionLocX.ToString() + "," + OpenSimRoot.Instance.Cfg.RegionLocY.ToString());
157 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Initialising world");
158 OpenSimRoot.Instance.LocalWorld = new World();
159 OpenSimRoot.Instance.LocalWorld.LandMap = OpenSimRoot.Instance.Cfg.LoadWorld();
160
161 this.physManager = new OpenSim.Physics.Manager.PhysicsManager();
162 this.physManager.LoadPlugins();
163
164 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Main.cs:Startup() - Starting up messaging system");
165 OpenSimRoot.Instance.LocalWorld.PhysScene = this.physManager.GetPhysicsScene(this._physicsEngine); //should be reading from the config file what physics engine to use
166 OpenSimRoot.Instance.LocalWorld.PhysScene.SetTerrain(OpenSimRoot.Instance.LocalWorld.LandMap);
167
168 OpenSimRoot.Instance.GridServers.AssetServer.SetServerInfo(OpenSimRoot.Instance.Cfg.AssetURL, OpenSimRoot.Instance.Cfg.AssetSendKey);
169 OpenSimRoot.Instance.GridServers.GridServer.SetServerInfo(OpenSimRoot.Instance.Cfg.GridURL, OpenSimRoot.Instance.Cfg.GridSendKey, OpenSimRoot.Instance.Cfg.GridRecvKey);
170
171 OpenSimRoot.Instance.LocalWorld.LoadStorageDLL("OpenSim.Storage.LocalStorageDb4o.dll"); //all these dll names shouldn't be hard coded.
172 OpenSimRoot.Instance.LocalWorld.LoadPrimsFromStorage();
173
174 if (this.sandbox)
175 {
176 OpenSimRoot.Instance.AssetCache.LoadDefaultTextureSet();
177 }
178
179 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Main.cs:Startup() - Starting CAPS HTTP server");
180 OpenSimRoot.Instance.HttpServer = new SimCAPSHTTPServer();
181
182 timer1.Enabled = true;
183 timer1.Interval = 100;
184 timer1.Elapsed += new ElapsedEventHandler(this.Timer1Tick);
185
186 MainServerListener();
187 }
188
189 private SimConfig LoadConfigDll(string dllName)
190 {
191 Assembly pluginAssembly = Assembly.LoadFrom(dllName);
192 SimConfig config = null;
193
194 foreach (Type pluginType in pluginAssembly.GetTypes())
195 {
196 if (pluginType.IsPublic)
197 {
198 if (!pluginType.IsAbstract)
199 {
200 Type typeInterface = pluginType.GetInterface("ISimConfig", true);
201
202 if (typeInterface != null)
203 {
204 ISimConfig plug = (ISimConfig)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString()));
205 config = plug.GetConfigObject();
206 break;
207 }
208
209 typeInterface = null;
210 }
211 }
212 }
213 pluginAssembly = null;
214 return config;
215 }
216
217 private void OnReceivedData(IAsyncResult result)
218 {
219 ipeSender = new IPEndPoint(IPAddress.Any, 0);
220 epSender = (EndPoint)ipeSender;
221 Packet packet = null;
222 int numBytes = Server.EndReceiveFrom(result, ref epSender);
223 int packetEnd = numBytes - 1;
224 packet = Packet.BuildPacket(RecvBuffer, ref packetEnd, ZeroBuffer);
225
226 // This is either a new client or a packet to send to an old one
227 // if (OpenSimRoot.Instance.ClientThreads.ContainsKey(epSender))
228
229 // do we already have a circuit for this endpoint
230 if(this.clientCircuits.ContainsKey(epSender))
231 {
232 OpenSimRoot.Instance.ClientThreads[this.clientCircuits[epSender]].InPacket(packet);
233 }
234 else if (packet.Type == PacketType.UseCircuitCode)
235 { // new client
236 UseCircuitCodePacket useCircuit = (UseCircuitCodePacket)packet;
237 this.clientCircuits.Add(epSender, useCircuit.CircuitCode.Code);
238 SimClient newuser = new SimClient(epSender, useCircuit);
239 //OpenSimRoot.Instance.ClientThreads.Add(epSender, newuser);
240 OpenSimRoot.Instance.ClientThreads.Add(useCircuit.CircuitCode.Code, newuser);
241 }
242 else
243 { // invalid client
244 Console.Error.WriteLine("Main.cs:OnReceivedData() - WARNING: Got a packet from an invalid client - " + epSender.ToString());
245 }
246 Server.BeginReceiveFrom(RecvBuffer, 0, RecvBuffer.Length, SocketFlags.None, ref epSender, ReceivedData, null);
247 }
248
249 private void MainServerListener()
250 {
251 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Main.cs:MainServerListener() - New thread started");
252 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Main.cs:MainServerListener() - Opening UDP socket on " + OpenSimRoot.Instance.Cfg.IPListenAddr + ":" + OpenSimRoot.Instance.Cfg.IPListenPort);
253
254 ServerIncoming = new IPEndPoint(IPAddress.Any, OpenSimRoot.Instance.Cfg.IPListenPort);
255 Server = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
256 Server.Bind(ServerIncoming);
257
258 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Main.cs:MainServerListener() - UDP socket bound, getting ready to listen");
259
260 ipeSender = new IPEndPoint(IPAddress.Any, 0);
261 epSender = (EndPoint)ipeSender;
262 ReceivedData = new AsyncCallback(this.OnReceivedData);
263 Server.BeginReceiveFrom(RecvBuffer, 0, RecvBuffer.Length, SocketFlags.None, ref epSender, ReceivedData, null);
264
265 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Main.cs:MainServerListener() - Listening...");
266
267 }
268
269 public override void SendPacketTo(byte[] buffer, int size, SocketFlags flags, uint circuitcode )//EndPoint packetSender)
270 {
271 // find the endpoint for this circuit
272 EndPoint sendto = null;
273 foreach(KeyValuePair<EndPoint, uint> p in this.clientCircuits)
274 {
275 if (p.Value == circuitcode)
276 {
277 sendto = p.Key;
278 break;
279 }
280 }
281 if (sendto != null)
282 {
283 //we found the endpoint so send the packet to it
284 this.Server.SendTo(buffer, size, flags, sendto);
285 }
286 }
287
288 public override void RemoveClientCircuit(uint circuitcode)
289 {
290 foreach (KeyValuePair<EndPoint, uint> p in this.clientCircuits)
291 {
292 if (p.Value == circuitcode)
293 {
294 this.clientCircuits.Remove(p.Key);
295 break;
296 }
297 }
298 }
299
300 public override void Shutdown()
301 {
302 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Main.cs:Shutdown() - Closing all threads");
303 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Main.cs:Shutdown() - Killing listener thread");
304 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Main.cs:Shutdown() - Killing clients");
305 // IMPLEMENT THIS
306 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Main.cs:Shutdown() - Closing console and terminating");
307 OpenSimRoot.Instance.LocalWorld.Close();
308 OpenSimRoot.Instance.GridServers.Close();
309 OpenSim.Framework.Console.MainConsole.Instance.Close();
310 Environment.Exit(0);
311 }
312
313 void Timer1Tick(object sender, System.EventArgs e)
314 {
315 OpenSimRoot.Instance.LocalWorld.Update();
316 }
317 }
318
319
320}
diff --git a/OpenSim.RegionServer/OpenSimRoot.cs b/OpenSim.RegionServer/OpenSimRoot.cs
new file mode 100644
index 0000000..3361e5d
--- /dev/null
+++ b/OpenSim.RegionServer/OpenSimRoot.cs
@@ -0,0 +1,63 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4using System.Net;
5//using System.Net.Sockets;
6using libsecondlife;
7using libsecondlife.Packets;
8using OpenSim.world;
9using OpenSim.Framework.Interfaces;
10using OpenSim.UserServer;
11using OpenSim.Assets;
12using OpenSim.CAPS;
13using OpenSim.Framework.Console;
14using OpenSim.Physics.Manager;
15
16namespace OpenSim
17{
18 public sealed class OpenSimRoot
19 {
20 private static OpenSimRoot instance = new OpenSimRoot();
21
22 public static OpenSimRoot Instance
23 {
24 get
25 {
26 return instance;
27 }
28 }
29
30 private OpenSimRoot()
31 {
32
33 }
34
35 public World LocalWorld;
36 public Grid GridServers;
37 public SimConfig Cfg;
38 public SimCAPSHTTPServer HttpServer;
39 public AssetCache AssetCache;
40 public InventoryCache InventoryCache;
41 //public Dictionary<EndPoint, SimClient> ClientThreads = new Dictionary<EndPoint, SimClient>();
42 public Dictionary<uint, SimClient> ClientThreads = new Dictionary<uint, SimClient>();
43 public DateTime startuptime;
44 public OpenSimApplication Application;
45 public bool Sandbox = false;
46
47 public void StartUp()
48 {
49 if (this.Application != null)
50 {
51 this.Application.StartUp();
52 }
53 }
54
55 public void Shutdown()
56 {
57 if (this.Application != null)
58 {
59 this.Application.Shutdown();
60 }
61 }
62 }
63}
diff --git a/OpenSim.RegionServer/QueItem.cs b/OpenSim.RegionServer/QueItem.cs
new file mode 100644
index 0000000..747e026
--- /dev/null
+++ b/OpenSim.RegionServer/QueItem.cs
@@ -0,0 +1,18 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4using libsecondlife.Packets;
5
6namespace OpenSim
7{
8 public class QueItem
9 {
10 public QueItem()
11 {
12 }
13
14 public Packet Packet;
15 public bool Incoming;
16 }
17
18}
diff --git a/OpenSim.RegionServer/SimClient.cs b/OpenSim.RegionServer/SimClient.cs
new file mode 100644
index 0000000..210e0d9
--- /dev/null
+++ b/OpenSim.RegionServer/SimClient.cs
@@ -0,0 +1,621 @@
1/*
2Copyright (c) OpenSim project, http://osgrid.org/
3*
4* Redistribution and use in source and binary forms, with or without
5* modification, are permitted provided that the following conditions are met:
6* * Redistributions of source code must retain the above copyright
7* notice, this list of conditions and the following disclaimer.
8* * Redistributions in binary form must reproduce the above copyright
9* notice, this list of conditions and the following disclaimer in the
10* documentation and/or other materials provided with the distribution.
11* * Neither the name of the <organization> nor the
12* names of its contributors may be used to endorse or promote products
13* derived from this software without specific prior written permission.
14*
15* THIS SOFTWARE IS PROVIDED BY <copyright holder> ``AS IS'' AND ANY
16* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
18* DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY
19* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
20* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
21* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
22* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
24* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25*/
26
27using System;
28using System.Collections;
29using System.Collections.Generic;
30using libsecondlife;
31using libsecondlife.Packets;
32using System.Net;
33using System.Net.Sockets;
34using System.IO;
35using System.Threading;
36using System.Timers;
37using OpenSim.Framework.Interfaces;
38using OpenSim.Framework.Assets;
39using OpenSim.Framework.Inventory;
40using OpenSim.Framework.Utilities;
41using OpenSim.world;
42using OpenSim.Assets;
43
44namespace OpenSim
45{
46 /// <summary>
47 /// Handles new client connections
48 /// Constructor takes a single Packet and authenticates everything
49 /// </summary>
50 public class SimClient
51 {
52
53 public LLUUID AgentID;
54 public LLUUID SessionID;
55 public LLUUID SecureSessionID = LLUUID.Zero;
56 public uint CircuitCode;
57 public world.Avatar ClientAvatar;
58 private UseCircuitCodePacket cirpack;
59 private Thread ClientThread;
60 public EndPoint userEP;
61 private BlockingQueue<QueItem> PacketQueue;
62 private Dictionary<uint, uint> PendingAcks = new Dictionary<uint, uint>();
63 private Dictionary<uint, Packet> NeedAck = new Dictionary<uint, Packet>();
64 //private Dictionary<LLUUID, AssetBase> UploadedAssets = new Dictionary<LLUUID, AssetBase>();
65 private System.Timers.Timer AckTimer;
66 private uint Sequence = 0;
67 private object SequenceLock = new object();
68 private const int MAX_APPENDED_ACKS = 10;
69 private const int RESEND_TIMEOUT = 4000;
70 private const int MAX_SEQUENCE = 0xFFFFFF;
71 private LLUUID newAssetFolder = LLUUID.Zero;
72 private bool debug = false;
73
74 private void ack_pack(Packet Pack)
75 {
76 //libsecondlife.Packets.PacketAckPacket ack_it = new PacketAckPacket();
77 //ack_it.Packets = new PacketAckPacket.PacketsBlock[1];
78 //ack_it.Packets[0] = new PacketAckPacket.PacketsBlock();
79 //ack_it.Packets[0].ID = Pack.Header.ID;
80 //ack_it.Header.Reliable = false;
81
82 //OutPacket(ack_it);
83
84 if (Pack.Header.Reliable)
85 {
86 lock (PendingAcks)
87 {
88 uint sequence = (uint)Pack.Header.Sequence;
89 if (!PendingAcks.ContainsKey(sequence)) { PendingAcks[sequence] = sequence; }
90 }
91 }
92 }
93
94 protected virtual void ProcessInPacket(Packet Pack)
95 {
96 ack_pack(Pack);
97 if (debug)
98 {
99 if (Pack.Type != PacketType.AgentUpdate)
100 {
101 Console.WriteLine(Pack.Type.ToString());
102 }
103 }
104 switch (Pack.Type)
105 {
106 case PacketType.CompleteAgentMovement:
107 ClientAvatar.CompleteMovement(OpenSimRoot.Instance.LocalWorld);
108 ClientAvatar.SendInitialPosition();
109 break;
110 case PacketType.RegionHandshakeReply:
111 OpenSimRoot.Instance.LocalWorld.SendLayerData(this);
112 break;
113 case PacketType.AgentWearablesRequest:
114 ClientAvatar.SendInitialAppearance();
115 foreach (SimClient client in OpenSimRoot.Instance.ClientThreads.Values)
116 {
117 if (client.AgentID != this.AgentID)
118 {
119 ObjectUpdatePacket objupdate = client.ClientAvatar.CreateUpdatePacket();
120 this.OutPacket(objupdate);
121 client.ClientAvatar.SendAppearanceToOtherAgent(this);
122 }
123 }
124 OpenSimRoot.Instance.LocalWorld.GetInitialPrims(this);
125 break;
126 case PacketType.ObjectAdd:
127 OpenSimRoot.Instance.LocalWorld.AddNewPrim((ObjectAddPacket)Pack, this);
128 break;
129 case PacketType.ObjectLink:
130 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(Pack.ToString());
131 break;
132 case PacketType.ObjectScale:
133 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(Pack.ToString());
134 break;
135 case PacketType.ObjectShape:
136 ObjectShapePacket shape = (ObjectShapePacket)Pack;
137 for (int i = 0; i < shape.ObjectData.Length; i++)
138 {
139 foreach (Entity ent in OpenSimRoot.Instance.LocalWorld.Entities.Values)
140 {
141 if (ent.localid == shape.ObjectData[i].ObjectLocalID)
142 {
143 ((OpenSim.world.Primitive)ent).UpdateShape(shape.ObjectData[i]);
144 }
145 }
146 }
147 break;
148 case PacketType.MultipleObjectUpdate:
149 MultipleObjectUpdatePacket multipleupdate = (MultipleObjectUpdatePacket)Pack;
150
151 for (int i = 0; i < multipleupdate.ObjectData.Length; i++)
152 {
153 if (multipleupdate.ObjectData[i].Type == 9) //change position
154 {
155 libsecondlife.LLVector3 pos = new LLVector3(multipleupdate.ObjectData[i].Data, 0);
156 foreach (Entity ent in OpenSimRoot.Instance.LocalWorld.Entities.Values)
157 {
158 if (ent.localid == multipleupdate.ObjectData[i].ObjectLocalID)
159 {
160 ((OpenSim.world.Primitive)ent).UpdatePosition(pos);
161
162 }
163 }
164
165 //should update stored position of the prim
166 }
167 else if (multipleupdate.ObjectData[i].Type == 10)//rotation
168 {
169 libsecondlife.LLQuaternion rot = new LLQuaternion(multipleupdate.ObjectData[i].Data, 0, true);
170 foreach (Entity ent in OpenSimRoot.Instance.LocalWorld.Entities.Values)
171 {
172 if (ent.localid == multipleupdate.ObjectData[i].ObjectLocalID)
173 {
174 ent.rotation = new Axiom.MathLib.Quaternion(rot.W, rot.X, rot.Y, rot.W);
175 ((OpenSim.world.Primitive)ent).UpdateFlag = true;
176 }
177 }
178 }
179 else if (multipleupdate.ObjectData[i].Type == 13)//scale
180 {
181
182 libsecondlife.LLVector3 scale = new LLVector3(multipleupdate.ObjectData[i].Data, 12);
183 foreach (Entity ent in OpenSimRoot.Instance.LocalWorld.Entities.Values)
184 {
185 if (ent.localid == multipleupdate.ObjectData[i].ObjectLocalID)
186 {
187 ((OpenSim.world.Primitive)ent).Scale = scale;
188 }
189 }
190 }
191 }
192 break;
193 case PacketType.RequestImage:
194 RequestImagePacket imageRequest = (RequestImagePacket)Pack;
195 for (int i = 0; i < imageRequest.RequestImage.Length; i++)
196 {
197 OpenSimRoot.Instance.AssetCache.AddTextureRequest(this, imageRequest.RequestImage[i].Image);
198 }
199 break;
200 case PacketType.TransferRequest:
201 //Console.WriteLine("OpenSimClient.cs:ProcessInPacket() - Got transfer request");
202 TransferRequestPacket transfer = (TransferRequestPacket)Pack;
203 OpenSimRoot.Instance.AssetCache.AddAssetRequest(this, transfer);
204 break;
205 case PacketType.AgentUpdate:
206 ClientAvatar.HandleUpdate((AgentUpdatePacket)Pack);
207 break;
208 case PacketType.LogoutRequest:
209 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("OpenSimClient.cs:ProcessInPacket() - Got a logout request");
210 //send reply to let the client logout
211 LogoutReplyPacket logReply = new LogoutReplyPacket();
212 logReply.AgentData.AgentID = this.AgentID;
213 logReply.AgentData.SessionID = this.SessionID;
214 logReply.InventoryData = new LogoutReplyPacket.InventoryDataBlock[1];
215 logReply.InventoryData[0] = new LogoutReplyPacket.InventoryDataBlock();
216 logReply.InventoryData[0].ItemID = LLUUID.Zero;
217 OutPacket(logReply);
218 //tell all clients to kill our object
219 KillObjectPacket kill = new KillObjectPacket();
220 kill.ObjectData = new KillObjectPacket.ObjectDataBlock[1];
221 kill.ObjectData[0] = new KillObjectPacket.ObjectDataBlock();
222 kill.ObjectData[0].ID = this.ClientAvatar.localid;
223 foreach (SimClient client in OpenSimRoot.Instance.ClientThreads.Values)
224 {
225 client.OutPacket(kill);
226 }
227 OpenSimRoot.Instance.GridServers.GridServer.LogoutSession(this.SessionID, this.AgentID, this.CircuitCode);
228 lock (OpenSimRoot.Instance.LocalWorld.Entities)
229 {
230 OpenSimRoot.Instance.LocalWorld.Entities.Remove(this.AgentID);
231 }
232 //need to do other cleaning up here too
233 OpenSimRoot.Instance.ClientThreads.Remove(this.CircuitCode); //this.userEP);
234 OpenSimRoot.Instance.Application.RemoveClientCircuit(this.CircuitCode);
235 this.ClientThread.Abort();
236 break;
237 case PacketType.ChatFromViewer:
238 ChatFromViewerPacket inchatpack = (ChatFromViewerPacket)Pack;
239 if (Helpers.FieldToString(inchatpack.ChatData.Message) == "") break;
240
241 System.Text.Encoding _enc = System.Text.Encoding.ASCII;
242 libsecondlife.Packets.ChatFromSimulatorPacket reply = new ChatFromSimulatorPacket();
243 reply.ChatData.Audible = 1;
244 reply.ChatData.Message = inchatpack.ChatData.Message;
245 reply.ChatData.ChatType = 1;
246 reply.ChatData.SourceType = 1;
247 reply.ChatData.Position = this.ClientAvatar.position;
248 reply.ChatData.FromName = _enc.GetBytes(this.ClientAvatar.firstname + " " + this.ClientAvatar.lastname + "\0");
249 reply.ChatData.OwnerID = this.AgentID;
250 reply.ChatData.SourceID = this.AgentID;
251 foreach (SimClient client in OpenSimRoot.Instance.ClientThreads.Values)
252 {
253 client.OutPacket(reply);
254 }
255 break;
256 case PacketType.ObjectImage:
257 ObjectImagePacket imagePack = (ObjectImagePacket)Pack;
258 for (int i = 0; i < imagePack.ObjectData.Length; i++)
259 {
260 foreach (Entity ent in OpenSimRoot.Instance.LocalWorld.Entities.Values)
261 {
262 if (ent.localid == imagePack.ObjectData[i].ObjectLocalID)
263 {
264 ((OpenSim.world.Primitive)ent).UpdateTexture(imagePack.ObjectData[i].TextureEntry);
265 }
266 }
267 }
268 break;
269 case PacketType.ObjectFlagUpdate:
270 ObjectFlagUpdatePacket flags = (ObjectFlagUpdatePacket)Pack;
271 foreach (Entity ent in OpenSimRoot.Instance.LocalWorld.Entities.Values)
272 {
273 if (ent.localid == flags.AgentData.ObjectLocalID)
274 {
275 ((OpenSim.world.Primitive)ent).UpdateObjectFlags(flags);
276 }
277 }
278
279 break;
280 case PacketType.AssetUploadRequest:
281 AssetUploadRequestPacket request = (AssetUploadRequestPacket)Pack;
282 Console.WriteLine("upload request "+ request.AssetBlock.TransactionID);
283 AssetBase newAsset = OpenSimRoot.Instance.AssetCache.UploadPacket(request, LLUUID.Random());
284 if (newAsset != null)
285 {
286 OpenSimRoot.Instance.InventoryCache.AddNewInventoryItem(this, this.newAssetFolder, newAsset);
287 }
288 Console.WriteLine(request.ToString());
289 Console.WriteLine("combined uuid is " + request.AssetBlock.TransactionID.Combine(this.SecureSessionID).ToStringHyphenated());
290
291 AssetUploadCompletePacket response = new AssetUploadCompletePacket();
292 response.AssetBlock.Type =request.AssetBlock.Type;
293 response.AssetBlock.Success = true;
294 response.AssetBlock.UUID = request.AssetBlock.TransactionID.Combine(this.SecureSessionID);
295
296 this.OutPacket(response);
297 break;
298 case PacketType.CreateInventoryFolder:
299 //Console.WriteLine(Pack.ToString());
300 break;
301 case PacketType.CreateInventoryItem:
302 //Console.WriteLine(Pack.ToString());
303 break;
304 case PacketType.FetchInventory:
305 Console.WriteLine("fetch item packet");
306 FetchInventoryPacket FetchInventory = (FetchInventoryPacket)Pack;
307 OpenSimRoot.Instance.InventoryCache.FetchInventory(this, FetchInventory);
308 break;
309 case PacketType.FetchInventoryDescendents:
310 FetchInventoryDescendentsPacket Fetch = (FetchInventoryDescendentsPacket)Pack;
311 OpenSimRoot.Instance.InventoryCache.FetchInventoryDescendents(this, Fetch);
312 break;
313 }
314 }
315
316 private void ResendUnacked()
317 {
318 int now = Environment.TickCount;
319
320 lock (NeedAck)
321 {
322 foreach (Packet packet in NeedAck.Values)
323 {
324 if ((now - packet.TickCount > RESEND_TIMEOUT) && (!packet.Header.Resent))
325 {
326 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Resending " + packet.Type.ToString() + " packet, " +
327 (now - packet.TickCount) + "ms have passed");
328
329 packet.Header.Resent = true;
330 OutPacket(packet);
331 }
332 }
333 }
334 }
335
336 private void SendAcks()
337 {
338 lock (PendingAcks)
339 {
340 if (PendingAcks.Count > 0)
341 {
342 if (PendingAcks.Count > 250)
343 {
344 // FIXME: Handle the odd case where we have too many pending ACKs queued up
345 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Too many ACKs queued up!");
346 return;
347 }
348
349 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Sending PacketAck");
350
351
352 int i = 0;
353 PacketAckPacket acks = new PacketAckPacket();
354 acks.Packets = new PacketAckPacket.PacketsBlock[PendingAcks.Count];
355
356 foreach (uint ack in PendingAcks.Values)
357 {
358 acks.Packets[i] = new PacketAckPacket.PacketsBlock();
359 acks.Packets[i].ID = ack;
360 i++;
361 }
362
363 acks.Header.Reliable = false;
364 OutPacket(acks);
365
366 PendingAcks.Clear();
367 }
368 }
369 }
370
371 private void AckTimer_Elapsed(object sender, ElapsedEventArgs ea)
372 {
373 SendAcks();
374 ResendUnacked();
375 }
376
377 protected virtual void ProcessOutPacket(Packet Pack)
378 {
379
380 // Keep track of when this packet was sent out
381 Pack.TickCount = Environment.TickCount;
382
383 if (!Pack.Header.Resent)
384 {
385 // Set the sequence number
386 lock (SequenceLock)
387 {
388 if (Sequence >= MAX_SEQUENCE)
389 Sequence = 1;
390 else
391 Sequence++;
392 Pack.Header.Sequence = Sequence;
393 }
394
395 if (Pack.Header.Reliable) //DIRTY HACK
396 {
397 lock (NeedAck)
398 {
399 if (!NeedAck.ContainsKey(Pack.Header.Sequence))
400 {
401 NeedAck.Add(Pack.Header.Sequence, Pack);
402 }
403 else
404 {
405 // Client.Log("Attempted to add a duplicate sequence number (" +
406 // packet.Header.Sequence + ") to the NeedAck dictionary for packet type " +
407 // packet.Type.ToString(), Helpers.LogLevel.Warning);
408 }
409 }
410
411 // Don't append ACKs to resent packets, in case that's what was causing the
412 // delivery to fail
413 if (!Pack.Header.Resent)
414 {
415 // Append any ACKs that need to be sent out to this packet
416 lock (PendingAcks)
417 {
418 if (PendingAcks.Count > 0 && PendingAcks.Count < MAX_APPENDED_ACKS &&
419 Pack.Type != PacketType.PacketAck &&
420 Pack.Type != PacketType.LogoutRequest)
421 {
422 Pack.Header.AckList = new uint[PendingAcks.Count];
423 int i = 0;
424
425 foreach (uint ack in PendingAcks.Values)
426 {
427 Pack.Header.AckList[i] = ack;
428 i++;
429 }
430
431 PendingAcks.Clear();
432 Pack.Header.AppendedAcks = true;
433 }
434 }
435 }
436 }
437 }
438
439 //ServerConsole.MainConsole.Instance.WriteLine("OUT: \n" + Pack.ToString());
440
441 byte[] ZeroOutBuffer = new byte[4096];
442 byte[] sendbuffer;
443 sendbuffer = Pack.ToBytes();
444
445 try
446 {
447 if (Pack.Header.Zerocoded)
448 {
449 int packetsize = Helpers.ZeroEncode(sendbuffer, sendbuffer.Length, ZeroOutBuffer);
450 OpenSimRoot.Instance.Application.SendPacketTo(ZeroOutBuffer, packetsize, SocketFlags.None, CircuitCode);//userEP);
451 }
452 else
453 {
454 OpenSimRoot.Instance.Application.SendPacketTo(sendbuffer, sendbuffer.Length, SocketFlags.None, CircuitCode); //userEP);
455 }
456 }
457 catch (Exception)
458 {
459 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("OpenSimClient.cs:ProcessOutPacket() - WARNING: Socket exception occurred on connection " + userEP.ToString() + " - killing thread");
460 ClientThread.Abort();
461 }
462
463 }
464
465 public virtual void InPacket(Packet NewPack)
466 {
467 // Handle appended ACKs
468 if (NewPack.Header.AppendedAcks)
469 {
470 lock (NeedAck)
471 {
472 foreach (uint ack in NewPack.Header.AckList)
473 {
474 NeedAck.Remove(ack);
475 }
476 }
477 }
478
479 // Handle PacketAck packets
480 if (NewPack.Type == PacketType.PacketAck)
481 {
482 PacketAckPacket ackPacket = (PacketAckPacket)NewPack;
483
484 lock (NeedAck)
485 {
486 foreach (PacketAckPacket.PacketsBlock block in ackPacket.Packets)
487 {
488 NeedAck.Remove(block.ID);
489 }
490 }
491 }
492 else if ((NewPack.Type == PacketType.StartPingCheck))
493 {
494 //reply to pingcheck
495 libsecondlife.Packets.StartPingCheckPacket startPing = (libsecondlife.Packets.StartPingCheckPacket)NewPack;
496 libsecondlife.Packets.CompletePingCheckPacket endPing = new CompletePingCheckPacket();
497 endPing.PingID.PingID = startPing.PingID.PingID;
498 OutPacket(endPing);
499 }
500 else
501 {
502 QueItem item = new QueItem();
503 item.Packet = NewPack;
504 item.Incoming = true;
505 this.PacketQueue.Enqueue(item);
506 }
507
508 }
509
510 public virtual void OutPacket(Packet NewPack)
511 {
512 QueItem item = new QueItem();
513 item.Packet = NewPack;
514 item.Incoming = false;
515 this.PacketQueue.Enqueue(item);
516 }
517
518 public SimClient(EndPoint remoteEP, UseCircuitCodePacket initialcirpack)
519 {
520 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("OpenSimClient.cs - Started up new client thread to handle incoming request");
521 cirpack = initialcirpack;
522 userEP = remoteEP;
523 PacketQueue = new BlockingQueue<QueItem>();
524 AckTimer = new System.Timers.Timer(500);
525 AckTimer.Elapsed += new ElapsedEventHandler(AckTimer_Elapsed);
526 AckTimer.Start();
527
528 ClientThread = new Thread(new ThreadStart(AuthUser));
529 ClientThread.IsBackground = true;
530 ClientThread.Start();
531 }
532
533 protected virtual void ClientLoop()
534 {
535 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("OpenSimClient.cs:ClientLoop() - Entered loop");
536 while (true)
537 {
538 QueItem nextPacket = PacketQueue.Dequeue();
539 if (nextPacket.Incoming)
540 {
541 //is a incoming packet
542 ProcessInPacket(nextPacket.Packet);
543 }
544 else
545 {
546 //is a out going packet
547 ProcessOutPacket(nextPacket.Packet);
548 }
549 }
550 }
551
552 protected virtual void InitNewClient()
553 {
554 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("OpenSimClient.cs:InitNewClient() - Adding viewer agent to world");
555 OpenSimRoot.Instance.LocalWorld.AddViewerAgent(this);
556 world.Entity tempent = OpenSimRoot.Instance.LocalWorld.Entities[this.AgentID];
557 this.ClientAvatar = (world.Avatar)tempent;
558 }
559
560 protected virtual void AuthUser()
561 {
562 AuthenticateResponse sessionInfo = OpenSimRoot.Instance.GridServers.GridServer.AuthenticateSession(cirpack.CircuitCode.SessionID, cirpack.CircuitCode.ID, cirpack.CircuitCode.Code);
563 if (!sessionInfo.Authorised)
564 {
565 //session/circuit not authorised
566 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("OpenSimClient.cs:AuthUser() - New user request denied to " + userEP.ToString());
567 ClientThread.Abort();
568 }
569 else
570 {
571 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("OpenSimClient.cs:AuthUser() - Got authenticated connection from " + userEP.ToString());
572 //session is authorised
573 this.AgentID = cirpack.CircuitCode.ID;
574 this.SessionID = cirpack.CircuitCode.SessionID;
575 this.CircuitCode = cirpack.CircuitCode.Code;
576 InitNewClient(); //shouldn't be called here as we might be a child agent and not want a full avatar
577 this.ClientAvatar.firstname = sessionInfo.LoginInfo.First;
578 this.ClientAvatar.lastname = sessionInfo.LoginInfo.Last;
579 if (sessionInfo.LoginInfo.SecureSession != LLUUID.Zero)
580 {
581 this.SecureSessionID = sessionInfo.LoginInfo.SecureSession;
582 }
583
584 // Create Inventory, currently only works for sandbox mode
585 if (OpenSimRoot.Instance.Sandbox)
586 {
587 if (sessionInfo.LoginInfo.InventoryFolder != null)
588 {
589 this.CreateInventory(sessionInfo.LoginInfo.InventoryFolder);
590 if (sessionInfo.LoginInfo.BaseFolder != null)
591 {
592 OpenSimRoot.Instance.InventoryCache.CreateNewInventoryFolder(this, sessionInfo.LoginInfo.BaseFolder);
593 this.newAssetFolder = sessionInfo.LoginInfo.BaseFolder;
594 AssetBase[] inventorySet = OpenSimRoot.Instance.AssetCache.CreateNewInventorySet(this.AgentID);
595 if (inventorySet != null)
596 {
597 for (int i = 0; i < inventorySet.Length; i++)
598 {
599 if (inventorySet[i] != null)
600 {
601 OpenSimRoot.Instance.InventoryCache.AddNewInventoryItem(this, sessionInfo.LoginInfo.BaseFolder, inventorySet[i]);
602 }
603 }
604 }
605 }
606 }
607 }
608
609 ClientLoop();
610 }
611 }
612
613 private void CreateInventory(LLUUID baseFolder)
614 {
615 AgentInventory inventory = new AgentInventory();
616 inventory.AgentID = this.AgentID;
617 OpenSimRoot.Instance.InventoryCache.AddNewAgentsInventory(inventory);
618 OpenSimRoot.Instance.InventoryCache.CreateNewInventoryFolder(this, baseFolder);
619 }
620 }
621}
diff --git a/src/OpenSimConsole.cs b/OpenSim.RegionServer/SimConsole.cs
index cf8b648..d6d5e44 100644
--- a/src/OpenSimConsole.cs
+++ b/OpenSim.RegionServer/SimConsole.cs
@@ -33,14 +33,14 @@ using System.IO;
33using System.Net; 33using System.Net;
34using libsecondlife; 34using libsecondlife;
35using libsecondlife.Packets; 35using libsecondlife.Packets;
36using ServerConsole; 36using OpenSim.Framework.Console;
37 37
38namespace OpenSim 38namespace OpenSim
39{ 39{
40 /// <summary> 40 /// <summary>
41 /// Description of ServerConsole. 41 /// Description of ServerConsole.
42 /// </summary> 42 /// </summary>
43 public class MServerConsole : ConsoleBase 43 public class SimConsole : ConsoleBase
44 { 44 {
45 45
46 private ConsoleType ConsType; 46 private ConsoleType ConsType;
@@ -57,7 +57,7 @@ namespace OpenSim
57 // TCP - the port to bind to 57 // TCP - the port to bind to
58 // Local - param ignored 58 // Local - param ignored
59 // SimChat - the chat channel to accept commands from 59 // SimChat - the chat channel to accept commands from
60 public MServerConsole(ConsoleType constype, string sparam, int iparam) { 60 public SimConsole(ConsoleType constype, string sparam, int iparam) {
61 ConsType = constype; 61 ConsType = constype;
62 switch(constype) { 62 switch(constype) {
63 case ConsoleType.Local: 63 case ConsoleType.Local:
@@ -156,11 +156,11 @@ namespace OpenSim
156 break; 156 break;
157 157
158 case "regenerate": 158 case "regenerate":
159 OpenSim_Main.local_world.RegenerateTerrain(); 159 OpenSimRoot.Instance.LocalWorld.RegenerateTerrain();
160 break; 160 break;
161 161
162 case "shutdown": 162 case "shutdown":
163 OpenSim_Main.Shutdown(); 163 OpenSimRoot.Instance.Shutdown();
164 break; 164 break;
165 } 165 }
166 return null; 166 return null;
@@ -170,16 +170,16 @@ namespace OpenSim
170 public override void ShowCommands(string ShowWhat) { 170 public override void ShowCommands(string ShowWhat) {
171 switch(ShowWhat) { 171 switch(ShowWhat) {
172 case "uptime": 172 case "uptime":
173 this.WriteLine("OpenSim has been running since " + OpenSim_Main.sim.startuptime.ToString()); 173 this.WriteLine("OpenSim has been running since " + OpenSimRoot.Instance.startuptime.ToString());
174 this.WriteLine("That is " + (DateTime.Now-OpenSim_Main.sim.startuptime).ToString()); 174 this.WriteLine("That is " + (DateTime.Now-OpenSimRoot.Instance.startuptime).ToString());
175 break; 175 break;
176 case "users": 176 case "users":
177 OpenSim.world.Avatar TempAv; 177 OpenSim.world.Avatar TempAv;
178 this.WriteLine(String.Format("{0,-16}{1,-16}{2,-25}{3,-25}{4,-16}{5,-16}","Firstname", "Lastname","Agent ID", "Session ID", "Circuit", "IP")); 178 this.WriteLine(String.Format("{0,-16}{1,-16}{2,-25}{3,-25}{4,-16}{5,-16}","Firstname", "Lastname","Agent ID", "Session ID", "Circuit", "IP"));
179 foreach (libsecondlife.LLUUID UUID in OpenSim_Main.local_world.Entities.Keys) { 179 foreach (libsecondlife.LLUUID UUID in OpenSimRoot.Instance.LocalWorld.Entities.Keys) {
180 if(OpenSim_Main.local_world.Entities[UUID].ToString()== "OpenSim.world.Avatar") 180 if(OpenSimRoot.Instance.LocalWorld.Entities[UUID].ToString()== "OpenSim.world.Avatar")
181 { 181 {
182 TempAv=(OpenSim.world.Avatar)OpenSim_Main.local_world.Entities[UUID]; 182 TempAv=(OpenSim.world.Avatar)OpenSimRoot.Instance.LocalWorld.Entities[UUID];
183 this.WriteLine(String.Format("{0,-16}{1,-16}{2,-25}{3,-25}{4,-16},{5,-16}",TempAv.firstname, TempAv.lastname,UUID, TempAv.ControllingClient.SessionID, TempAv.ControllingClient.CircuitCode, TempAv.ControllingClient.userEP.ToString())); 183 this.WriteLine(String.Format("{0,-16}{1,-16}{2,-25}{3,-25}{4,-16},{5,-16}",TempAv.firstname, TempAv.lastname,UUID, TempAv.ControllingClient.SessionID, TempAv.ControllingClient.CircuitCode, TempAv.ControllingClient.userEP.ToString()));
184 } 184 }
185 } 185 }
@@ -190,7 +190,7 @@ namespace OpenSim
190 // Displays a prompt to the user and then runs the command they entered 190 // Displays a prompt to the user and then runs the command they entered
191 public override void MainConsolePrompt() { 191 public override void MainConsolePrompt() {
192 string[] tempstrarray; 192 string[] tempstrarray;
193 string tempstr = this.CmdPrompt("OpenSim-" + OpenSim_Main.cfg.RegionHandle.ToString() + " # "); 193 string tempstr = this.CmdPrompt("OpenSim-" + OpenSimRoot.Instance.Cfg.RegionHandle.ToString() + " # ");
194 tempstrarray = tempstr.Split(' '); 194 tempstrarray = tempstr.Split(' ');
195 string cmd=tempstrarray[0]; 195 string cmd=tempstrarray[0];
196 Array.Reverse(tempstrarray); 196 Array.Reverse(tempstrarray);
diff --git a/OpenSim.RegionServer/UserServer/LocalUserProfileManager.cs b/OpenSim.RegionServer/UserServer/LocalUserProfileManager.cs
new file mode 100644
index 0000000..83e340b
--- /dev/null
+++ b/OpenSim.RegionServer/UserServer/LocalUserProfileManager.cs
@@ -0,0 +1,76 @@
1using System;
2using System.Collections.Generic;
3using System.Collections;
4using System.Text;
5using OpenSim.Framework.User;
6using OpenSim.Framework.Grid;
7using OpenSim.Framework.Inventory;
8using OpenSim.Framework.Interfaces;
9using libsecondlife;
10
11namespace OpenSim.UserServer
12{
13 class LocalUserProfileManager : UserProfileManager
14 {
15 private IGridServer _gridServer;
16
17 public LocalUserProfileManager(IGridServer gridServer)
18 {
19 _gridServer = gridServer;
20 }
21
22 public override void InitUserProfiles()
23 {
24 // TODO: need to load from database
25 }
26
27 public override void CustomiseResponse(ref System.Collections.Hashtable response, UserProfile theUser)
28 {
29 uint circode = (uint)response["circuit_code"];
30 theUser.AddSimCircuit(circode, LLUUID.Random());
31 response["home"] = "{'region_handle':[r" + (997 * 256).ToString() + ",r" + (996 * 256).ToString() + "], 'position':[r" + theUser.homepos.X.ToString() + ",r" + theUser.homepos.Y.ToString() + ",r" + theUser.homepos.Z.ToString() + "], 'look_at':[r" + theUser.homelookat.X.ToString() + ",r" + theUser.homelookat.Y.ToString() + ",r" + theUser.homelookat.Z.ToString() + "]}";
32 response["sim_port"] = OpenSimRoot.Instance.Cfg.IPListenPort;
33 response["sim_ip"] = OpenSimRoot.Instance.Cfg.IPListenAddr;
34 response["region_y"] = (Int32)996 * 256;
35 response["region_x"] = (Int32)997* 256;
36
37 string first;
38 string last;
39 if (response.Contains("first"))
40 {
41 first = (string)response["first"];
42 }
43 else
44 {
45 first = "test";
46 }
47
48 if (response.Contains("last"))
49 {
50 last = (string)response["last"];
51 }
52 else
53 {
54 last = "User";
55 }
56
57 ArrayList InventoryList = (ArrayList)response["inventory-skeleton"];
58 Hashtable Inventory1 = (Hashtable)InventoryList[0];
59
60 Login _login = new Login();
61 //copy data to login object
62 _login.First = first;
63 _login.Last = last;
64 _login.Agent = new LLUUID((string)response["agent_id"]) ;
65 _login.Session = new LLUUID((string)response["session_id"]);
66 _login.BaseFolder = null;
67 _login.InventoryFolder = new LLUUID((string)Inventory1["folder_id"]);
68
69 //working on local computer if so lets add to the gridserver's list of sessions?
70 if (OpenSimRoot.Instance.GridServers.GridServer.GetName() == "Local")
71 {
72 ((LocalGridBase)this._gridServer).AddNewSession(_login);
73 }
74 }
75 }
76}
diff --git a/OpenSim.RegionServer/UserServer/LoginServer.cs b/OpenSim.RegionServer/UserServer/LoginServer.cs
new file mode 100644
index 0000000..86b098a
--- /dev/null
+++ b/OpenSim.RegionServer/UserServer/LoginServer.cs
@@ -0,0 +1,414 @@
1/*
2* Copyright (c) OpenSim project, http://sim.opensecondlife.org/
3*
4* Redistribution and use in source and binary forms, with or without
5* modification, are permitted provided that the following conditions are met:
6* * Redistributions of source code must retain the above copyright
7* notice, this list of conditions and the following disclaimer.
8* * Redistributions in binary form must reproduce the above copyright
9* notice, this list of conditions and the following disclaimer in the
10* documentation and/or other materials provided with the distribution.
11* * Neither the name of the <organization> nor the
12* names of its contributors may be used to endorse or promote products
13* derived from this software without specific prior written permission.
14*
15* THIS SOFTWARE IS PROVIDED BY <copyright holder> ``AS IS'' AND ANY
16* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
18* DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY
19* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
20* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
21* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
22* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
24* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25*
26*/
27
28using Nwc.XmlRpc;
29using System;
30using System.IO;
31using System.Net;
32using System.Net.Sockets;
33using System.Text;
34using System.Text.RegularExpressions;
35using System.Threading;
36using System.Collections;
37using System.Security.Cryptography;
38using System.Xml;
39using libsecondlife;
40using OpenSim;
41using OpenSim.Framework.Interfaces;
42using OpenSim.Framework.Grid;
43using OpenSim.Framework.Inventory;
44using OpenSim.Framework.User;
45using OpenSim.Framework.Utilities;
46
47namespace OpenSim.UserServer
48{
49
50 /// <summary>
51 /// When running in local (default) mode , handles client logins.
52 /// </summary>
53 public class LoginServer : LoginService , IUserServer
54 {
55 private IGridServer _gridServer;
56 private ushort _loginPort = 8080;
57 public IPAddress clientAddress = IPAddress.Loopback;
58 public IPAddress remoteAddress = IPAddress.Any;
59 private Socket loginServer;
60 private int NumClients;
61 private string _defaultResponse;
62 private bool userAccounts = false;
63 private string _mpasswd;
64 private bool _needPasswd = false;
65 private LocalUserProfileManager userManager;
66
67 public LoginServer(IGridServer gridServer)
68 {
69 _gridServer = gridServer;
70 }
71
72 // InitializeLogin: initialize the login
73 private void InitializeLogin()
74 {
75 this._needPasswd = false;
76 //read in default response string
77 StreamReader SR;
78 string lines;
79 SR = File.OpenText("new-login.dat");
80
81 //lines=SR.ReadLine();
82
83 while (!SR.EndOfStream)
84 {
85 lines = SR.ReadLine();
86 _defaultResponse += lines;
87 //lines = SR.ReadLine();
88 }
89 SR.Close();
90 this._mpasswd = EncodePassword("testpass");
91
92 userManager = new LocalUserProfileManager(this._gridServer);
93 userManager.InitUserProfiles();
94 userManager.SetKeys("", "", "", "Welcome to OpenSim");
95
96 loginServer = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
97 loginServer.Bind(new IPEndPoint(remoteAddress, _loginPort));
98 loginServer.Listen(1);
99 }
100
101 public void Startup()
102 {
103 this.InitializeLogin();
104 Thread runLoginProxy = new Thread(new ThreadStart(RunLogin));
105 runLoginProxy.IsBackground = true;
106 runLoginProxy.Start();
107 }
108
109 private void RunLogin()
110 {
111 Console.WriteLine("Starting Login Server");
112 try
113 {
114 for (; ; )
115 {
116 Socket client = loginServer.Accept();
117 IPEndPoint clientEndPoint = (IPEndPoint)client.RemoteEndPoint;
118
119
120 NetworkStream networkStream = new NetworkStream(client);
121 StreamReader networkReader = new StreamReader(networkStream);
122 StreamWriter networkWriter = new StreamWriter(networkStream);
123
124 try
125 {
126 LoginRequest(networkReader, networkWriter);
127 }
128 catch (Exception e)
129 {
130 Console.WriteLine(e.Message);
131 }
132
133 networkWriter.Close();
134 networkReader.Close();
135 networkStream.Close();
136
137 client.Close();
138
139 // send any packets queued for injection
140
141 }
142 }
143 catch (Exception e)
144 {
145 Console.WriteLine(e.Message);
146 Console.WriteLine(e.StackTrace);
147 }
148 }
149
150 // ProxyLogin: proxy a login request
151 private void LoginRequest(StreamReader reader, StreamWriter writer)
152 {
153 lock (this)
154 {
155 string line;
156 int contentLength = 0;
157 // read HTTP header
158 do
159 {
160 // read one line of the header
161 line = reader.ReadLine();
162
163 // check for premature EOF
164 if (line == null)
165 throw new Exception("EOF in client HTTP header");
166
167 // look for Content-Length
168 Match match = (new Regex(@"Content-Length: (\d+)$")).Match(line);
169 if (match.Success)
170 contentLength = Convert.ToInt32(match.Groups[1].Captures[0].ToString());
171 } while (line != "");
172
173 // read the HTTP body into a buffer
174 char[] content = new char[contentLength];
175 reader.Read(content, 0, contentLength);
176
177 if (this.userAccounts)
178 {
179 //ask the UserProfile Manager to process the request
180 string reply = this.userManager.ParseXMLRPC(new String(content));
181 // forward the XML-RPC response to the client
182 writer.WriteLine("HTTP/1.0 200 OK");
183 writer.WriteLine("Content-type: text/xml");
184 writer.WriteLine();
185 writer.WriteLine(reply);
186 }
187 else
188 {
189 //handle ourselves
190 XmlRpcRequest request = (XmlRpcRequest)(new XmlRpcRequestDeserializer()).Deserialize(new String(content));
191 if (request.MethodName == "login_to_simulator")
192 {
193 this.ProcessXmlRequest(request, writer);
194 }
195 else
196 {
197 XmlRpcResponse PresenceErrorResp = new XmlRpcResponse();
198 Hashtable PresenceErrorRespData = new Hashtable();
199 PresenceErrorRespData["reason"] = "XmlRequest"; ;
200 PresenceErrorRespData["message"] = "Unknown Rpc request";
201 PresenceErrorRespData["login"] = "false";
202 PresenceErrorResp.Value = PresenceErrorRespData;
203 string reply = Regex.Replace(XmlRpcResponseSerializer.Singleton.Serialize(PresenceErrorResp), " encoding=\"utf-16\"", "");
204 writer.WriteLine("HTTP/1.0 200 OK");
205 writer.WriteLine("Content-type: text/xml");
206 writer.WriteLine();
207 writer.WriteLine(reply);
208 }
209 }
210 }
211 }
212
213 public bool ProcessXmlRequest(XmlRpcRequest request, StreamWriter writer)
214 {
215 Hashtable requestData = (Hashtable)request.Params[0];
216 string first;
217 string last;
218 string passwd;
219 LLUUID Agent;
220 LLUUID Session;
221
222 //get login name
223 if (requestData.Contains("first"))
224 {
225 first = (string)requestData["first"];
226 }
227 else
228 {
229 first = "test";
230 }
231
232 if (requestData.Contains("last"))
233 {
234 last = (string)requestData["last"];
235 }
236 else
237 {
238 last = "User" + NumClients.ToString();
239 }
240
241 if (requestData.Contains("passwd"))
242 {
243 passwd = (string)requestData["passwd"];
244 }
245 else
246 {
247 passwd = "notfound";
248 }
249
250 if (!Authenticate(first, last, passwd))
251 {
252 XmlRpcResponse PresenceErrorResp = new XmlRpcResponse();
253 Hashtable PresenceErrorRespData = new Hashtable();
254 PresenceErrorRespData["reason"] = "key"; ;
255 PresenceErrorRespData["message"] = "You have entered an invalid name/password combination. Check Caps/lock.";
256 PresenceErrorRespData["login"] = "false";
257 PresenceErrorResp.Value = PresenceErrorRespData;
258 string reply = Regex.Replace(XmlRpcResponseSerializer.Singleton.Serialize(PresenceErrorResp), " encoding=\"utf-16\"", "");
259 writer.WriteLine("HTTP/1.0 200 OK");
260 writer.WriteLine("Content-type: text/xml");
261 writer.WriteLine();
262 writer.WriteLine(reply);
263 return false;
264 }
265
266 NumClients++;
267
268 //create a agent and session LLUUID
269 Agent = GetAgentId(first, last);
270 int SessionRand = Util.RandomClass.Next(1, 999);
271 Session = new LLUUID("aaaabbbb-0200-" + SessionRand.ToString("0000") + "-8664-58f53e442797");
272 LLUUID secureSess = LLUUID.Random();
273 //create some login info
274 Hashtable LoginFlagsHash = new Hashtable();
275 LoginFlagsHash["daylight_savings"] = "N";
276 LoginFlagsHash["stipend_since_login"] = "N";
277 LoginFlagsHash["gendered"] = "Y";
278 LoginFlagsHash["ever_logged_in"] = "Y";
279 ArrayList LoginFlags = new ArrayList();
280 LoginFlags.Add(LoginFlagsHash);
281
282 Hashtable GlobalT = new Hashtable();
283 GlobalT["sun_texture_id"] = "cce0f112-878f-4586-a2e2-a8f104bba271";
284 GlobalT["cloud_texture_id"] = "fc4b9f0b-d008-45c6-96a4-01dd947ac621";
285 GlobalT["moon_texture_id"] = "fc4b9f0b-d008-45c6-96a4-01dd947ac621";
286 ArrayList GlobalTextures = new ArrayList();
287 GlobalTextures.Add(GlobalT);
288
289 XmlRpcResponse response = (XmlRpcResponse)(new XmlRpcResponseDeserializer()).Deserialize(this._defaultResponse);
290 Hashtable responseData = (Hashtable)response.Value;
291
292 responseData["sim_port"] = OpenSimRoot.Instance.Cfg.IPListenPort;
293 responseData["sim_ip"] = OpenSimRoot.Instance.Cfg.IPListenAddr;
294 responseData["agent_id"] = Agent.ToStringHyphenated();
295 responseData["session_id"] = Session.ToStringHyphenated();
296 responseData["secure_session_id"]= secureSess.ToStringHyphenated();
297 responseData["circuit_code"] = (Int32)(Util.RandomClass.Next());
298 responseData["seconds_since_epoch"] = (Int32)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds;
299 responseData["login-flags"] = LoginFlags;
300 responseData["global-textures"] = GlobalTextures;
301
302 //inventory
303 ArrayList InventoryList = (ArrayList)responseData["inventory-skeleton"];
304 Hashtable Inventory1 = (Hashtable)InventoryList[0];
305 Hashtable Inventory2 = (Hashtable)InventoryList[1];
306 LLUUID BaseFolderID = LLUUID.Random();
307 LLUUID InventoryFolderID = LLUUID.Random();
308 Inventory2["name"] = "Base";
309 Inventory2["folder_id"] = BaseFolderID.ToStringHyphenated();
310 Inventory2["type_default"] = 0;
311 Inventory1["folder_id"] = InventoryFolderID.ToStringHyphenated();
312
313 ArrayList InventoryRoot = (ArrayList)responseData["inventory-root"];
314 Hashtable Inventoryroot = (Hashtable)InventoryRoot[0];
315 Inventoryroot["folder_id"] = InventoryFolderID.ToStringHyphenated();
316
317 CustomiseLoginResponse(responseData, first, last);
318
319 Login _login = new Login();
320 //copy data to login object
321 _login.First = first;
322 _login.Last = last;
323 _login.Agent = Agent;
324 _login.Session = Session;
325 _login.SecureSession = secureSess;
326 _login.BaseFolder = BaseFolderID;
327 _login.InventoryFolder = InventoryFolderID;
328
329 //working on local computer if so lets add to the gridserver's list of sessions?
330 if (OpenSimRoot.Instance.GridServers.GridServer.GetName() == "Local")
331 {
332 ((LocalGridBase)this._gridServer).AddNewSession(_login);
333 }
334
335 // forward the XML-RPC response to the client
336 writer.WriteLine("HTTP/1.0 200 OK");
337 writer.WriteLine("Content-type: text/xml");
338 writer.WriteLine();
339
340 XmlTextWriter responseWriter = new XmlTextWriter(writer);
341 XmlRpcResponseSerializer.Singleton.Serialize(responseWriter, response);
342 responseWriter.Close();
343
344 return true;
345 }
346
347 protected virtual void CustomiseLoginResponse(Hashtable responseData, string first, string last)
348 {
349 }
350
351 protected virtual LLUUID GetAgentId(string firstName, string lastName)
352 {
353 LLUUID Agent;
354 int AgentRand = Util.RandomClass.Next(1, 9999);
355 Agent = new LLUUID("99998888-0100-" + AgentRand.ToString("0000") + "-8ec1-0b1d5cd6aead");
356 return Agent;
357 }
358
359 protected virtual bool Authenticate(string first, string last, string passwd)
360 {
361 if (this._needPasswd)
362 {
363 //every user needs the password to login
364 string encodedPass = passwd.Remove(0, 3); //remove $1$
365 if (encodedPass == this._mpasswd)
366 {
367 return true;
368 }
369 else
370 {
371 return false;
372 }
373 }
374 else
375 {
376 //do not need password to login
377 return true;
378 }
379 }
380
381 private static string EncodePassword(string passwd)
382 {
383 Byte[] originalBytes;
384 Byte[] encodedBytes;
385 MD5 md5;
386
387 md5 = new MD5CryptoServiceProvider();
388 originalBytes = ASCIIEncoding.Default.GetBytes(passwd);
389 encodedBytes = md5.ComputeHash(originalBytes);
390
391 return Regex.Replace(BitConverter.ToString(encodedBytes), "-", "").ToLower();
392 }
393
394 //IUserServer implementation
395 public AgentInventory RequestAgentsInventory(LLUUID agentID)
396 {
397 AgentInventory aInventory = null;
398 if (this.userAccounts)
399 {
400 aInventory = this.userManager.GetUsersInventory(agentID);
401 }
402
403 return aInventory;
404 }
405
406 public void SetServerInfo(string ServerUrl, string SendKey, string RecvKey)
407 {
408
409 }
410
411 }
412
413
414}
diff --git a/src/VersionInfo.cs b/OpenSim.RegionServer/VersionInfo.cs
index 5cfd136..39767df 100644
--- a/src/VersionInfo.cs
+++ b/OpenSim.RegionServer/VersionInfo.cs
@@ -28,10 +28,10 @@ using System;
28 28
29namespace OpenSim 29namespace OpenSim
30{ 30{
31 /// <summary> 31 /// <summary>
32 /// </summary> 32 /// </summary>
33 public class VersionInfo 33 public class VersionInfo
34 { 34 {
35 public static string Version = "0.1, Build 1174381410, Revision 240M"; 35 public static string Version = "0.1, Build 1173843165, Revision 193:206M";
36 } 36 }
37} 37}
diff --git a/src/types/Mesh.cs b/OpenSim.RegionServer/types/Mesh.cs
index 3e00c91..3e00c91 100644
--- a/src/types/Mesh.cs
+++ b/OpenSim.RegionServer/types/Mesh.cs
diff --git a/src/types/Triangle.cs b/OpenSim.RegionServer/types/Triangle.cs
index 8dfea6e..8dfea6e 100644
--- a/src/types/Triangle.cs
+++ b/OpenSim.RegionServer/types/Triangle.cs
diff --git a/OpenSim.RegionServer/world/Avatar.cs b/OpenSim.RegionServer/world/Avatar.cs
new file mode 100644
index 0000000..b4a3b82
--- /dev/null
+++ b/OpenSim.RegionServer/world/Avatar.cs
@@ -0,0 +1,501 @@
1using System;
2using System.Collections.Generic;
3using System.IO;
4using System.Text;
5using libsecondlife;
6using libsecondlife.Packets;
7using OpenSim.Physics.Manager;
8using Axiom.MathLib;
9
10namespace OpenSim.world
11{
12 public class Avatar : Entity
13 {
14 public static bool PhysicsEngineFlying = false;
15 public string firstname;
16 public string lastname;
17 public SimClient ControllingClient;
18 private PhysicsActor _physActor;
19 private static libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock AvatarTemplate;
20 private bool updateflag = false;
21 private byte movementflag = 0;
22 private List<NewForce> forcesList = new List<NewForce>();
23 private short _updateCount = 0;
24 private Axiom.MathLib.Quaternion bodyRot;
25
26 public Avatar(SimClient TheClient)
27 {
28 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Avatar.cs - Loading details from grid (DUMMY)");
29 ControllingClient = TheClient;
30 localid = 8880000 + (OpenSimRoot.Instance.LocalWorld._localNumber++);
31 position = new LLVector3(100.0f, 100.0f, 30.0f);
32 position.Z = OpenSimRoot.Instance.LocalWorld.LandMap[(int)position.Y * 256 + (int)position.X] + 1;
33 }
34
35 public PhysicsActor PhysActor
36 {
37 set
38 {
39 this._physActor = value;
40 }
41 }
42
43 public override void addForces()
44 {
45 lock (this.forcesList)
46 {
47 if (this.forcesList.Count > 0)
48 {
49 for (int i = 0; i < this.forcesList.Count; i++)
50 {
51 NewForce force = this.forcesList[i];
52 PhysicsVector phyVector = new PhysicsVector(force.X, force.Y, force.Z);
53 this._physActor.Velocity = phyVector;
54 this.updateflag = true;
55 this.velocity = new LLVector3(force.X, force.Y, force.Z); //shouldn't really be doing this
56 // but as we are setting the velocity (rather than using real forces) at the moment it is okay.
57 }
58 for (int i = 0; i < this.forcesList.Count; i++)
59 {
60 this.forcesList.RemoveAt(0);
61 }
62 }
63 }
64 }
65
66 public override void update()
67 {
68
69 if (this.updateflag)
70 {
71 //need to send movement info
72 //so create the improvedterseobjectupdate packet
73 //use CreateTerseBlock()
74 ImprovedTerseObjectUpdatePacket.ObjectDataBlock terseBlock = CreateTerseBlock();
75 ImprovedTerseObjectUpdatePacket terse = new ImprovedTerseObjectUpdatePacket();
76 terse.RegionData.RegionHandle = OpenSimRoot.Instance.Cfg.RegionHandle; // FIXME
77 terse.RegionData.TimeDilation = 64096;
78 terse.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[1];
79 terse.ObjectData[0] = terseBlock;
80 foreach (SimClient client in OpenSimRoot.Instance.ClientThreads.Values)
81 {
82 client.OutPacket(terse);
83 }
84
85 updateflag = false;
86 //this._updateCount = 0;
87 }
88 else
89 {
90 //if((movementflag & 1) !=0)
91 //{
92 _updateCount++;
93 if (((!PhysicsEngineFlying) && (_updateCount > 3)) || (_updateCount > 0))
94 {
95 //It has been a while since last update was sent so lets send one.
96 ImprovedTerseObjectUpdatePacket.ObjectDataBlock terseBlock = CreateTerseBlock();
97 ImprovedTerseObjectUpdatePacket terse = new ImprovedTerseObjectUpdatePacket();
98 terse.RegionData.RegionHandle = OpenSimRoot.Instance.Cfg.RegionHandle; // FIXME
99 terse.RegionData.TimeDilation = 64096;
100 terse.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[1];
101 terse.ObjectData[0] = terseBlock;
102 foreach (SimClient client in OpenSimRoot.Instance.ClientThreads.Values)
103 {
104 client.OutPacket(terse);
105 }
106 _updateCount = 0;
107 }
108 //}
109 }
110 }
111
112 public static void SetupTemplate(string name)
113 {
114 int i = 0;
115 FileInfo fInfo = new FileInfo(name);
116 long numBytes = fInfo.Length;
117 FileStream fStream = new FileStream(name, FileMode.Open, FileAccess.Read);
118 BinaryReader br = new BinaryReader(fStream);
119 byte[] data1 = br.ReadBytes((int)numBytes);
120 br.Close();
121 fStream.Close();
122
123 libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock objdata = new libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock(data1, ref i);
124
125 System.Text.Encoding enc = System.Text.Encoding.ASCII;
126 libsecondlife.LLVector3 pos = new LLVector3(objdata.ObjectData, 16);
127 pos.X = 100f;
128 objdata.ID = 8880000;
129 objdata.NameValue = enc.GetBytes("FirstName STRING RW SV Test \nLastName STRING RW SV User \0");
130 libsecondlife.LLVector3 pos2 = new LLVector3(100f, 100f, 23f);
131 //objdata.FullID=user.AgentID;
132 byte[] pb = pos.GetBytes();
133 Array.Copy(pb, 0, objdata.ObjectData, 16, pb.Length);
134
135 Avatar.AvatarTemplate = objdata;
136 }
137
138 public void CompleteMovement(World RegionInfo)
139 {
140 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Avatar.cs:CompleteMovement() - Constructing AgentMovementComplete packet");
141 AgentMovementCompletePacket mov = new AgentMovementCompletePacket();
142 mov.AgentData.SessionID = this.ControllingClient.SessionID;
143 mov.AgentData.AgentID = this.ControllingClient.AgentID;
144 mov.Data.RegionHandle = OpenSimRoot.Instance.Cfg.RegionHandle;
145 // TODO - dynamicalise this stuff
146 mov.Data.Timestamp = 1172750370;
147 mov.Data.Position = new LLVector3(100f, 100f, 23f);
148 mov.Data.LookAt = new LLVector3(0.99f, 0.042f, 0);
149
150 ControllingClient.OutPacket(mov);
151 }
152
153 public void SendInitialPosition()
154 {
155
156 System.Text.Encoding _enc = System.Text.Encoding.ASCII;
157 //send a objectupdate packet with information about the clients avatar
158 ObjectUpdatePacket objupdate = new ObjectUpdatePacket();
159 objupdate.RegionData.RegionHandle = OpenSimRoot.Instance.Cfg.RegionHandle;
160 objupdate.RegionData.TimeDilation = 64096;
161 objupdate.ObjectData = new libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock[1];
162
163 objupdate.ObjectData[0] = AvatarTemplate;
164 //give this avatar object a local id and assign the user a name
165 objupdate.ObjectData[0].ID = this.localid;
166 this.uuid = objupdate.ObjectData[0].FullID = ControllingClient.AgentID;
167 objupdate.ObjectData[0].NameValue = _enc.GetBytes("FirstName STRING RW SV " + firstname + "\nLastName STRING RW SV " + lastname + " \0");
168
169 libsecondlife.LLVector3 pos2 = new LLVector3((float)this.position.X, (float)this.position.Y, (float)this.position.Z);
170
171 byte[] pb = pos2.GetBytes();
172
173 Array.Copy(pb, 0, objupdate.ObjectData[0].ObjectData, 16, pb.Length);
174 OpenSimRoot.Instance.LocalWorld._localNumber++;
175
176 foreach (SimClient client in OpenSimRoot.Instance.ClientThreads.Values)
177 {
178 client.OutPacket(objupdate);
179 if (client.AgentID != ControllingClient.AgentID)
180 {
181 SendAppearanceToOtherAgent(client);
182 }
183 }
184 //this.ControllingClient.OutPacket(objupdate);
185 }
186
187 public void SendInitialAppearance()
188 {
189 AgentWearablesUpdatePacket aw = new AgentWearablesUpdatePacket();
190 aw.AgentData.AgentID = this.ControllingClient.AgentID;
191 aw.AgentData.SerialNum = 0;
192 aw.AgentData.SessionID = ControllingClient.SessionID;
193
194 aw.WearableData = new AgentWearablesUpdatePacket.WearableDataBlock[13];
195 AgentWearablesUpdatePacket.WearableDataBlock awb = new AgentWearablesUpdatePacket.WearableDataBlock();
196 awb.WearableType = (byte)0;
197 awb.AssetID = new LLUUID("66c41e39-38f9-f75a-024e-585989bfab73");
198 awb.ItemID = LLUUID.Random();
199 aw.WearableData[0] = awb;
200
201 for (int i = 1; i < 13; i++)
202 {
203 awb = new AgentWearablesUpdatePacket.WearableDataBlock();
204 awb.WearableType = (byte)i;
205 awb.AssetID = new LLUUID("00000000-0000-0000-0000-000000000000");
206 awb.ItemID = new LLUUID("00000000-0000-0000-0000-000000000000");
207 aw.WearableData[i] = awb;
208 }
209
210 ControllingClient.OutPacket(aw);
211 }
212
213 public ObjectUpdatePacket CreateUpdatePacket()
214 {
215 System.Text.Encoding _enc = System.Text.Encoding.ASCII;
216 //send a objectupdate packet with information about the clients avatar
217 ObjectUpdatePacket objupdate = new ObjectUpdatePacket();
218 objupdate.RegionData.RegionHandle = OpenSimRoot.Instance.Cfg.RegionHandle;
219 objupdate.RegionData.TimeDilation = 64096;
220 objupdate.ObjectData = new libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock[1];
221
222 objupdate.ObjectData[0] = AvatarTemplate;
223 //give this avatar object a local id and assign the user a name
224 objupdate.ObjectData[0].ID = this.localid;
225 objupdate.ObjectData[0].FullID = ControllingClient.AgentID;
226 objupdate.ObjectData[0].NameValue = _enc.GetBytes("FirstName STRING RW SV " + firstname + "\nLastName STRING RW SV " + lastname + " \0");
227
228 libsecondlife.LLVector3 pos2 = new LLVector3((float)this._physActor.Position.X, (float)this._physActor.Position.Y, (float)this._physActor.Position.Z);
229
230 byte[] pb = pos2.GetBytes();
231
232 Array.Copy(pb, 0, objupdate.ObjectData[0].ObjectData, 16, pb.Length);
233 return objupdate;
234 }
235
236 public void SendAppearanceToOtherAgent(SimClient userInfo)
237 {
238 AvatarAppearancePacket avp = new AvatarAppearancePacket();
239
240
241 avp.VisualParam = new AvatarAppearancePacket.VisualParamBlock[218];
242 //avp.ObjectData.TextureEntry=this.avatar_template.TextureEntry;// br.ReadBytes((int)numBytes);
243
244 LLObject.TextureEntry ntex = new LLObject.TextureEntry(new LLUUID("00000000-0000-0000-0000-000000000005"));
245 avp.ObjectData.TextureEntry = ntex.ToBytes();
246
247 AvatarAppearancePacket.VisualParamBlock avblock = null;
248 for (int i = 0; i < 218; i++)
249 {
250 avblock = new AvatarAppearancePacket.VisualParamBlock();
251 avblock.ParamValue = (byte)100;
252 avp.VisualParam[i] = avblock;
253 }
254
255 avp.Sender.IsTrial = false;
256 avp.Sender.ID = ControllingClient.AgentID;
257 userInfo.OutPacket(avp);
258
259 }
260
261 public void HandleUpdate(AgentUpdatePacket pack)
262 {
263 if (((uint)pack.AgentData.ControlFlags & (uint)MainAvatar.AgentUpdateFlags.AGENT_CONTROL_FLY) != 0)
264 {
265 this._physActor.Flying = true;
266 }
267 else
268 {
269 this._physActor.Flying = false;
270 }
271 if (((uint)pack.AgentData.ControlFlags & (uint)MainAvatar.AgentUpdateFlags.AGENT_CONTROL_AT_POS) != 0)
272 {
273 Axiom.MathLib.Quaternion q = new Axiom.MathLib.Quaternion(pack.AgentData.BodyRotation.W, pack.AgentData.BodyRotation.X, pack.AgentData.BodyRotation.Y, pack.AgentData.BodyRotation.Z);
274 if (((movementflag & 1) == 0) || (q != this.bodyRot))
275 {
276 //we should add a new force to the list
277 // but for now we will deal with velocities
278 NewForce newVelocity = new NewForce();
279 Axiom.MathLib.Vector3 v3 = new Axiom.MathLib.Vector3(1, 0, 0);
280 Axiom.MathLib.Vector3 direc = q * v3;
281 direc.Normalize();
282
283 //work out velocity for sim physics system
284 direc = direc * ((0.03f) * 128f);
285 if (this._physActor.Flying)
286 direc *= 2;
287
288 newVelocity.X = direc.x;
289 newVelocity.Y = direc.y;
290 newVelocity.Z = direc.z;
291 this.forcesList.Add(newVelocity);
292 movementflag = 1;
293 this.bodyRot = q;
294 }
295 }
296 else if ((((uint)pack.AgentData.ControlFlags & (uint)MainAvatar.AgentUpdateFlags.AGENT_CONTROL_UP_POS) != 0) && (PhysicsEngineFlying))
297 {
298 if (((movementflag & 2) == 0) && this._physActor.Flying)
299 {
300 //we should add a new force to the list
301 // but for now we will deal with velocities
302 NewForce newVelocity = new NewForce();
303 Axiom.MathLib.Vector3 v3 = new Axiom.MathLib.Vector3(0, 0, 1);
304 Axiom.MathLib.Vector3 direc = v3;
305 direc.Normalize();
306
307 //work out velocity for sim physics system
308 direc = direc * ((0.03f) * 128f * 2);
309 newVelocity.X = direc.x;
310 newVelocity.Y = direc.y;
311 newVelocity.Z = direc.z;
312 this.forcesList.Add(newVelocity);
313 movementflag = 2;
314 }
315 }
316 else if ((((uint)pack.AgentData.ControlFlags & (uint)MainAvatar.AgentUpdateFlags.AGENT_CONTROL_UP_NEG) != 0) && (PhysicsEngineFlying))
317 {
318 if (((movementflag & 4) == 0) && this._physActor.Flying)
319 {
320 //we should add a new force to the list
321 // but for now we will deal with velocities
322 NewForce newVelocity = new NewForce();
323 Axiom.MathLib.Vector3 v3 = new Axiom.MathLib.Vector3(0, 0, -1);
324 //Axiom.MathLib.Quaternion q = new Axiom.MathLib.Quaternion(pack.AgentData.BodyRotation.W, pack.AgentData.BodyRotation.X, pack.AgentData.BodyRotation.Y, pack.AgentData.BodyRotation.Z);
325 Axiom.MathLib.Vector3 direc = v3;
326 direc.Normalize();
327
328 //work out velocity for sim physics system
329 direc = direc * ((0.03f) * 128f * 2);
330 newVelocity.X = direc.x;
331 newVelocity.Y = direc.y;
332 newVelocity.Z = direc.z;
333 this.forcesList.Add(newVelocity);
334 movementflag = 4;
335 }
336 }
337 else if (((uint)pack.AgentData.ControlFlags & (uint)MainAvatar.AgentUpdateFlags.AGENT_CONTROL_AT_NEG) != 0)
338 {
339 Axiom.MathLib.Quaternion q = new Axiom.MathLib.Quaternion(pack.AgentData.BodyRotation.W, pack.AgentData.BodyRotation.X, pack.AgentData.BodyRotation.Y, pack.AgentData.BodyRotation.Z);
340 if (((movementflag & 8) == 0) || (q != this.bodyRot))
341 {
342 //we should add a new force to the list
343 // but for now we will deal with velocities
344 NewForce newVelocity = new NewForce();
345 Axiom.MathLib.Vector3 v3 = new Axiom.MathLib.Vector3(-1, 0, 0);
346 Axiom.MathLib.Vector3 direc = q * v3;
347 direc.Normalize();
348
349 //work out velocity for sim physics system
350 direc = direc * ((0.03f) * 128f);
351 if (this._physActor.Flying)
352 direc *= 2;
353
354 newVelocity.X = direc.x;
355 newVelocity.Y = direc.y;
356 newVelocity.Z = direc.z;
357 this.forcesList.Add(newVelocity);
358 movementflag = 8;
359 this.bodyRot = q;
360 }
361 }
362 else
363 {
364 if ((movementflag) != 0)
365 {
366 NewForce newVelocity = new NewForce();
367 newVelocity.X = 0;
368 newVelocity.Y = 0;
369 newVelocity.Z = 0;
370 this.forcesList.Add(newVelocity);
371 movementflag = 0;
372 }
373 }
374 }
375
376 //should be moved somewhere else
377 public void SendRegionHandshake(World RegionInfo)
378 {
379 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Avatar.cs:SendRegionHandshake() - Creating empty RegionHandshake packet");
380 System.Text.Encoding _enc = System.Text.Encoding.ASCII;
381 RegionHandshakePacket handshake = new RegionHandshakePacket();
382
383 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Avatar.cs:SendRegionhandshake() - Filling in RegionHandshake details");
384 handshake.RegionInfo.BillableFactor = 0;
385 handshake.RegionInfo.IsEstateManager = false;
386 handshake.RegionInfo.TerrainHeightRange00 = 60;
387 handshake.RegionInfo.TerrainHeightRange01 = 60;
388 handshake.RegionInfo.TerrainHeightRange10 = 60;
389 handshake.RegionInfo.TerrainHeightRange11 = 60;
390 handshake.RegionInfo.TerrainStartHeight00 = 10;
391 handshake.RegionInfo.TerrainStartHeight01 = 10;
392 handshake.RegionInfo.TerrainStartHeight10 = 10;
393 handshake.RegionInfo.TerrainStartHeight11 = 10;
394 handshake.RegionInfo.SimAccess = 13;
395 handshake.RegionInfo.WaterHeight = 20;
396 handshake.RegionInfo.RegionFlags = 72458694;
397 handshake.RegionInfo.SimName = _enc.GetBytes(OpenSimRoot.Instance.Cfg.RegionName + "\0");
398 handshake.RegionInfo.SimOwner = new LLUUID("00000000-0000-0000-0000-000000000000");
399 handshake.RegionInfo.TerrainBase0 = new LLUUID("b8d3965a-ad78-bf43-699b-bff8eca6c975");
400 handshake.RegionInfo.TerrainBase1 = new LLUUID("abb783e6-3e93-26c0-248a-247666855da3");
401 handshake.RegionInfo.TerrainBase2 = new LLUUID("179cdabd-398a-9b6b-1391-4dc333ba321f");
402 handshake.RegionInfo.TerrainBase3 = new LLUUID("beb169c7-11ea-fff2-efe5-0f24dc881df2");
403 handshake.RegionInfo.TerrainDetail0 = new LLUUID("00000000-0000-0000-0000-000000000000");
404 handshake.RegionInfo.TerrainDetail1 = new LLUUID("00000000-0000-0000-0000-000000000000");
405 handshake.RegionInfo.TerrainDetail2 = new LLUUID("00000000-0000-0000-0000-000000000000");
406 handshake.RegionInfo.TerrainDetail3 = new LLUUID("00000000-0000-0000-0000-000000000000");
407 handshake.RegionInfo.CacheID = new LLUUID("545ec0a5-5751-1026-8a0b-216e38a7ab37");
408
409 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Avatar.cs:SendRegionHandshake() - Sending RegionHandshake packet");
410 this.ControllingClient.OutPacket(handshake);
411 }
412
413 public ImprovedTerseObjectUpdatePacket.ObjectDataBlock CreateTerseBlock()
414 {
415 byte[] bytes = new byte[60];
416 int i = 0;
417 ImprovedTerseObjectUpdatePacket.ObjectDataBlock dat = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock();
418
419 dat.TextureEntry = AvatarTemplate.TextureEntry;
420 libsecondlife.LLVector3 pos2 = new LLVector3(this._physActor.Position.X, this._physActor.Position.Y, this._physActor.Position.Z);
421
422 uint ID = this.localid;
423
424 bytes[i++] = (byte)(ID % 256);
425 bytes[i++] = (byte)((ID >> 8) % 256);
426 bytes[i++] = (byte)((ID >> 16) % 256);
427 bytes[i++] = (byte)((ID >> 24) % 256);
428 bytes[i++] = 0;
429 bytes[i++] = 1;
430 i += 14;
431 bytes[i++] = 128;
432 bytes[i++] = 63;
433
434 byte[] pb = pos2.GetBytes();
435 Array.Copy(pb, 0, bytes, i, pb.Length);
436 i += 12;
437 ushort InternVelocityX;
438 ushort InternVelocityY;
439 ushort InternVelocityZ;
440
441 Axiom.MathLib.Vector3 internDirec = new Axiom.MathLib.Vector3(this._physActor.Velocity.X, this._physActor.Velocity.Y, this._physActor.Velocity.Z);
442 internDirec = internDirec / 128.0f;
443 internDirec.x += 1;
444 internDirec.y += 1;
445 internDirec.z += 1;
446
447 InternVelocityX = (ushort)(32768 * internDirec.x);
448 InternVelocityY = (ushort)(32768 * internDirec.y);
449 InternVelocityZ = (ushort)(32768 * internDirec.z);
450
451 ushort ac = 32767;
452 bytes[i++] = (byte)(InternVelocityX % 256);
453 bytes[i++] = (byte)((InternVelocityX >> 8) % 256);
454 bytes[i++] = (byte)(InternVelocityY % 256);
455 bytes[i++] = (byte)((InternVelocityY >> 8) % 256);
456 bytes[i++] = (byte)(InternVelocityZ % 256);
457 bytes[i++] = (byte)((InternVelocityZ >> 8) % 256);
458
459 //accel
460 bytes[i++] = (byte)(ac % 256);
461 bytes[i++] = (byte)((ac >> 8) % 256);
462 bytes[i++] = (byte)(ac % 256);
463 bytes[i++] = (byte)((ac >> 8) % 256);
464 bytes[i++] = (byte)(ac % 256);
465 bytes[i++] = (byte)((ac >> 8) % 256);
466
467 //rot
468 bytes[i++] = (byte)(ac % 256);
469 bytes[i++] = (byte)((ac >> 8) % 256);
470 bytes[i++] = (byte)(ac % 256);
471 bytes[i++] = (byte)((ac >> 8) % 256);
472 bytes[i++] = (byte)(ac % 256);
473 bytes[i++] = (byte)((ac >> 8) % 256);
474 bytes[i++] = (byte)(ac % 256);
475 bytes[i++] = (byte)((ac >> 8) % 256);
476
477 //rotation vel
478 bytes[i++] = (byte)(ac % 256);
479 bytes[i++] = (byte)((ac >> 8) % 256);
480 bytes[i++] = (byte)(ac % 256);
481 bytes[i++] = (byte)((ac >> 8) % 256);
482 bytes[i++] = (byte)(ac % 256);
483 bytes[i++] = (byte)((ac >> 8) % 256);
484
485 dat.Data = bytes;
486 return (dat);
487 }
488 }
489
490 public class NewForce
491 {
492 public float X;
493 public float Y;
494 public float Z;
495
496 public NewForce()
497 {
498
499 }
500 }
501}
diff --git a/src/world/Entity.cs b/OpenSim.RegionServer/world/Entity.cs
index ee4b2e4..780f3a0 100644
--- a/src/world/Entity.cs
+++ b/OpenSim.RegionServer/world/Entity.cs
@@ -20,7 +20,7 @@ namespace OpenSim.world
20 public Entity() 20 public Entity()
21 { 21 {
22 uuid = new libsecondlife.LLUUID(); 22 uuid = new libsecondlife.LLUUID();
23 localid = 8880000 + (OpenSim_Main.local_world._localNumber++); // FIXME - race condition! 23 localid = 0;
24 position = new LLVector3(); 24 position = new LLVector3();
25 velocity = new LLVector3(); 25 velocity = new LLVector3();
26 rotation = new Quaternion(); 26 rotation = new Quaternion();
diff --git a/OpenSim.RegionServer/world/Primitive.cs b/OpenSim.RegionServer/world/Primitive.cs
new file mode 100644
index 0000000..b190d81
--- /dev/null
+++ b/OpenSim.RegionServer/world/Primitive.cs
@@ -0,0 +1,485 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4using OpenSim.types;
5using libsecondlife;
6using libsecondlife.Packets;
7using OpenSim.Framework.Interfaces;
8using OpenSim.Physics.Manager;
9using OpenSim.Framework.Assets;
10
11namespace OpenSim.world
12{
13 public class Primitive : Entity
14 {
15 protected float mesh_cutbegin;
16 protected float mesh_cutend;
17 protected PrimData primData;
18 protected bool newPrimFlag = false;
19 protected bool updateFlag = false;
20 protected bool dirtyFlag = false;
21 private ObjectUpdatePacket OurPacket;
22 private PhysicsActor _physActor;
23 private bool physicsEnabled = false;
24 private bool physicstest = false; //just added for testing
25
26 public bool PhysicsEnabled
27 {
28 get
29 {
30 return physicsEnabled;
31 }
32 set
33 {
34 physicsEnabled = value;
35 }
36 }
37 public bool UpdateFlag
38 {
39 get
40 {
41 return updateFlag;
42 }
43 set
44 {
45 updateFlag = value;
46 }
47 }
48 public LLVector3 Scale
49 {
50 set
51 {
52 this.primData.Scale = value;
53 this.dirtyFlag = true;
54 }
55 get
56 {
57 return this.primData.Scale;
58 }
59 }
60 public PhysicsActor PhysActor
61 {
62 set
63 {
64 this._physActor = value;
65 }
66 }
67
68 public Primitive()
69 {
70 mesh_cutbegin = 0.0f;
71 mesh_cutend = 1.0f;
72 }
73
74 public override Mesh getMesh()
75 {
76 Mesh mesh = new Mesh();
77 Triangle tri = new Triangle(
78 new Axiom.MathLib.Vector3(0.0f, 1.0f, 1.0f),
79 new Axiom.MathLib.Vector3(1.0f, 0.0f, 1.0f),
80 new Axiom.MathLib.Vector3(1.0f, 1.0f, 0.0f));
81
82 mesh.AddTri(tri);
83 mesh += base.getMesh();
84
85 return mesh;
86 }
87
88 public void UpdatePosition(LLVector3 pos)
89 {
90 this.position = pos;
91 if (this._physActor != null) // && this.physicsEnabled)
92 {
93 this._physActor.Position = new PhysicsVector(pos.X, pos.Y, pos.Z);
94 }
95 this.updateFlag = true;
96 }
97
98 public override void update()
99 {
100 if (this.newPrimFlag)
101 {
102 foreach (SimClient client in OpenSimRoot.Instance.ClientThreads.Values)
103 {
104 client.OutPacket(OurPacket);
105 }
106 this.newPrimFlag = false;
107 }
108 else if (this.updateFlag)
109 {
110 ImprovedTerseObjectUpdatePacket terse = new ImprovedTerseObjectUpdatePacket();
111 terse.RegionData.RegionHandle = OpenSimRoot.Instance.Cfg.RegionHandle; // FIXME
112 terse.RegionData.TimeDilation = 64096;
113 terse.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[1];
114 terse.ObjectData[0] = this.CreateImprovedBlock();
115 foreach (SimClient client in OpenSimRoot.Instance.ClientThreads.Values)
116 {
117 client.OutPacket(terse);
118 }
119 this.updateFlag = false;
120 }
121 else if (this.dirtyFlag)
122 {
123 foreach (SimClient client in OpenSimRoot.Instance.ClientThreads.Values)
124 {
125 UpdateClient(client);
126 }
127 this.dirtyFlag = false;
128 }
129 else
130 {
131 if (this._physActor != null && this.physicsEnabled)
132 {
133 ImprovedTerseObjectUpdatePacket terse = new ImprovedTerseObjectUpdatePacket();
134 terse.RegionData.RegionHandle = OpenSimRoot.Instance.Cfg.RegionHandle; // FIXME
135 terse.RegionData.TimeDilation = 64096;
136 terse.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[1];
137 terse.ObjectData[0] = this.CreateImprovedBlock();
138 foreach (SimClient client in OpenSimRoot.Instance.ClientThreads.Values)
139 {
140 client.OutPacket(terse);
141 }
142 }
143 }
144
145 if (this.physicstest)
146 {
147 LLVector3 pos = this.position;
148 pos.Z += 0.0001f;
149 this.UpdatePosition(pos);
150 this.physicstest = false;
151 }
152 }
153
154 public void UpdateClient(SimClient RemoteClient)
155 {
156
157 LLVector3 lPos;
158 if (this._physActor != null && this.physicsEnabled)
159 {
160 PhysicsVector pPos = this._physActor.Position;
161 lPos = new LLVector3(pPos.X, pPos.Y, pPos.Z);
162 }
163 else
164 {
165 lPos = this.position;
166 }
167 byte[] pb = lPos.GetBytes();
168 Array.Copy(pb, 0, OurPacket.ObjectData[0].ObjectData, 0, pb.Length);
169
170 // OurPacket should be update with the follwing in updateShape() rather than having to do it here
171 OurPacket.ObjectData[0].OwnerID = this.primData.OwnerID;
172 OurPacket.ObjectData[0].PCode = this.primData.PCode;
173 OurPacket.ObjectData[0].PathBegin = this.primData.PathBegin;
174 OurPacket.ObjectData[0].PathEnd = this.primData.PathEnd;
175 OurPacket.ObjectData[0].PathScaleX = this.primData.PathScaleX;
176 OurPacket.ObjectData[0].PathScaleY = this.primData.PathScaleY;
177 OurPacket.ObjectData[0].PathShearX = this.primData.PathShearX;
178 OurPacket.ObjectData[0].PathShearY = this.primData.PathShearY;
179 OurPacket.ObjectData[0].PathSkew = this.primData.PathSkew;
180 OurPacket.ObjectData[0].ProfileBegin = this.primData.ProfileBegin;
181 OurPacket.ObjectData[0].ProfileEnd = this.primData.ProfileEnd;
182 OurPacket.ObjectData[0].Scale = this.primData.Scale;
183 OurPacket.ObjectData[0].PathCurve = this.primData.PathCurve;
184 OurPacket.ObjectData[0].ProfileCurve = this.primData.ProfileCurve;
185 OurPacket.ObjectData[0].ParentID = 0;
186 OurPacket.ObjectData[0].ProfileHollow = this.primData.ProfileHollow;
187 //finish off copying rest of shape data
188 OurPacket.ObjectData[0].PathRadiusOffset = this.primData.PathRadiusOffset;
189 OurPacket.ObjectData[0].PathRevolutions = this.primData.PathRevolutions;
190 OurPacket.ObjectData[0].PathTaperX = this.primData.PathTaperX;
191 OurPacket.ObjectData[0].PathTaperY = this.primData.PathTaperY;
192 OurPacket.ObjectData[0].PathTwist = this.primData.PathTwist;
193 OurPacket.ObjectData[0].PathTwistBegin = this.primData.PathTwistBegin;
194
195 RemoteClient.OutPacket(OurPacket);
196 }
197
198 public void UpdateShape(ObjectShapePacket.ObjectDataBlock addPacket)
199 {
200 this.primData.PathBegin = addPacket.PathBegin;
201 this.primData.PathEnd = addPacket.PathEnd;
202 this.primData.PathScaleX = addPacket.PathScaleX;
203 this.primData.PathScaleY = addPacket.PathScaleY;
204 this.primData.PathShearX = addPacket.PathShearX;
205 this.primData.PathShearY = addPacket.PathShearY;
206 this.primData.PathSkew = addPacket.PathSkew;
207 this.primData.ProfileBegin = addPacket.ProfileBegin;
208 this.primData.ProfileEnd = addPacket.ProfileEnd;
209 this.primData.PathCurve = addPacket.PathCurve;
210 this.primData.ProfileCurve = addPacket.ProfileCurve;
211 this.primData.ProfileHollow = addPacket.ProfileHollow;
212 this.primData.PathRadiusOffset = addPacket.PathRadiusOffset;
213 this.primData.PathRevolutions = addPacket.PathRevolutions;
214 this.primData.PathTaperX = addPacket.PathTaperX;
215 this.primData.PathTaperY = addPacket.PathTaperY;
216 this.primData.PathTwist = addPacket.PathTwist;
217 this.primData.PathTwistBegin = addPacket.PathTwistBegin;
218 this.dirtyFlag = true;
219 }
220
221 public void UpdateTexture(byte[] tex)
222 {
223 this.primData.Texture = this.OurPacket.ObjectData[0].TextureEntry = tex;
224 this.dirtyFlag = true;
225 }
226
227 public void UpdateObjectFlags(ObjectFlagUpdatePacket pack)
228 {
229 if (this._physActor != null)
230 {
231 if (this._physActor.Kinematic == pack.AgentData.UsePhysics)
232 {
233 this._physActor.Kinematic = !pack.AgentData.UsePhysics; //if Usephysics = true, then Kinematic should = false
234 }
235 this.physicsEnabled = pack.AgentData.UsePhysics;
236 if (this._physActor.Kinematic == false)
237 {
238 LLVector3 pos = this.position;
239 this.UpdatePosition(pos);
240 pos.Z += 0.000001f;
241 this.UpdatePosition(pos);
242 this.physicstest = true;
243 }
244 else
245 {
246 PhysicsVector vec = this._physActor.Position;
247 LLVector3 pos = new LLVector3(vec.X, vec.Y, vec.Z);
248 this.position = pos;
249 this.updateFlag = true;
250 }
251 }
252 }
253
254 public void CreateFromPacket(ObjectAddPacket addPacket, LLUUID agentID, uint localID)
255 {
256 ObjectUpdatePacket objupdate = new ObjectUpdatePacket();
257 objupdate.RegionData.RegionHandle = OpenSimRoot.Instance.Cfg.RegionHandle;
258 objupdate.RegionData.TimeDilation = 64096;
259
260 objupdate.ObjectData = new libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock[1];
261 PrimData PData = new PrimData();
262 this.primData = PData;
263 objupdate.ObjectData[0] = new ObjectUpdatePacket.ObjectDataBlock();
264 objupdate.ObjectData[0].PSBlock = new byte[0];
265 objupdate.ObjectData[0].ExtraParams = new byte[1];
266 objupdate.ObjectData[0].MediaURL = new byte[0];
267 objupdate.ObjectData[0].NameValue = new byte[0];
268 objupdate.ObjectData[0].Text = new byte[0];
269 objupdate.ObjectData[0].TextColor = new byte[4];
270 objupdate.ObjectData[0].JointAxisOrAnchor = new LLVector3(0, 0, 0);
271 objupdate.ObjectData[0].JointPivot = new LLVector3(0, 0, 0);
272 objupdate.ObjectData[0].Material = 3;
273 objupdate.ObjectData[0].UpdateFlags = 32 + 65536 + 131072 + 256 + 4 + 8 + 2048 + 524288 + 268435456;
274 objupdate.ObjectData[0].TextureAnim = new byte[0];
275 objupdate.ObjectData[0].Sound = LLUUID.Zero;
276 LLObject.TextureEntry ntex = new LLObject.TextureEntry(new LLUUID("00000000-0000-0000-5005-000000000005"));
277 objupdate.ObjectData[0].TextureEntry = ntex.ToBytes();
278 objupdate.ObjectData[0].State = 0;
279 objupdate.ObjectData[0].Data = new byte[0];
280 PData.OwnerID = objupdate.ObjectData[0].OwnerID = agentID;
281 PData.PCode = objupdate.ObjectData[0].PCode = addPacket.ObjectData.PCode;
282 PData.PathBegin = objupdate.ObjectData[0].PathBegin = addPacket.ObjectData.PathBegin;
283 PData.PathEnd = objupdate.ObjectData[0].PathEnd = addPacket.ObjectData.PathEnd;
284 PData.PathScaleX = objupdate.ObjectData[0].PathScaleX = addPacket.ObjectData.PathScaleX;
285 PData.PathScaleY = objupdate.ObjectData[0].PathScaleY = addPacket.ObjectData.PathScaleY;
286 PData.PathShearX = objupdate.ObjectData[0].PathShearX = addPacket.ObjectData.PathShearX;
287 PData.PathShearY = objupdate.ObjectData[0].PathShearY = addPacket.ObjectData.PathShearY;
288 PData.PathSkew = objupdate.ObjectData[0].PathSkew = addPacket.ObjectData.PathSkew;
289 PData.ProfileBegin = objupdate.ObjectData[0].ProfileBegin = addPacket.ObjectData.ProfileBegin;
290 PData.ProfileEnd = objupdate.ObjectData[0].ProfileEnd = addPacket.ObjectData.ProfileEnd;
291 PData.Scale = objupdate.ObjectData[0].Scale = addPacket.ObjectData.Scale;
292 PData.PathCurve = objupdate.ObjectData[0].PathCurve = addPacket.ObjectData.PathCurve;
293 PData.ProfileCurve = objupdate.ObjectData[0].ProfileCurve = addPacket.ObjectData.ProfileCurve;
294 PData.ParentID = objupdate.ObjectData[0].ParentID = 0;
295 PData.ProfileHollow = objupdate.ObjectData[0].ProfileHollow = addPacket.ObjectData.ProfileHollow;
296
297 PData.PathRadiusOffset = objupdate.ObjectData[0].PathRadiusOffset = addPacket.ObjectData.PathRadiusOffset;
298 PData.PathRevolutions = objupdate.ObjectData[0].PathRevolutions = addPacket.ObjectData.PathRevolutions;
299 PData.PathTaperX = objupdate.ObjectData[0].PathTaperX = addPacket.ObjectData.PathTaperX;
300 PData.PathTaperY = objupdate.ObjectData[0].PathTaperY = addPacket.ObjectData.PathTaperY;
301 PData.PathTwist = objupdate.ObjectData[0].PathTwist = addPacket.ObjectData.PathTwist;
302 PData.PathTwistBegin = objupdate.ObjectData[0].PathTwistBegin = addPacket.ObjectData.PathTwistBegin;
303
304 objupdate.ObjectData[0].ID = (uint)(localID);
305 objupdate.ObjectData[0].FullID = new LLUUID("edba7151-5857-acc5-b30b-f01efef" + (localID - 702000).ToString("00000"));
306 objupdate.ObjectData[0].ObjectData = new byte[60];
307 objupdate.ObjectData[0].ObjectData[46] = 128;
308 objupdate.ObjectData[0].ObjectData[47] = 63;
309 LLVector3 pos1 = addPacket.ObjectData.RayEnd;
310 //update position
311 byte[] pb = pos1.GetBytes();
312 Array.Copy(pb, 0, objupdate.ObjectData[0].ObjectData, 0, pb.Length);
313
314 this.newPrimFlag = true;
315 this.uuid = objupdate.ObjectData[0].FullID;
316 this.localid = objupdate.ObjectData[0].ID;
317 this.position = pos1;
318 this.OurPacket = objupdate;
319 }
320
321 public void CreateFromStorage(PrimData store)
322 {
323 //need to clean this up as it shares a lot of code with CreateFromPacket()
324 ObjectUpdatePacket objupdate = new ObjectUpdatePacket();
325 objupdate.RegionData.RegionHandle = OpenSimRoot.Instance.Cfg.RegionHandle;
326 objupdate.RegionData.TimeDilation = 64096;
327 objupdate.ObjectData = new libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock[1];
328
329 this.primData = store;
330 objupdate.ObjectData[0] = new ObjectUpdatePacket.ObjectDataBlock();
331 objupdate.ObjectData[0].PSBlock = new byte[0];
332 objupdate.ObjectData[0].ExtraParams = new byte[1];
333 objupdate.ObjectData[0].MediaURL = new byte[0];
334 objupdate.ObjectData[0].NameValue = new byte[0];
335 objupdate.ObjectData[0].Text = new byte[0];
336 objupdate.ObjectData[0].TextColor = new byte[4];
337 objupdate.ObjectData[0].JointAxisOrAnchor = new LLVector3(0, 0, 0);
338 objupdate.ObjectData[0].JointPivot = new LLVector3(0, 0, 0);
339 objupdate.ObjectData[0].Material = 3;
340 objupdate.ObjectData[0].UpdateFlags = 32 + 65536 + 131072 + 256 + 4 + 8 + 2048 + 524288 + 268435456;
341 objupdate.ObjectData[0].TextureAnim = new byte[0];
342 objupdate.ObjectData[0].Sound = LLUUID.Zero;
343
344 if (store.Texture == null)
345 {
346 LLObject.TextureEntry ntex = new LLObject.TextureEntry(new LLUUID("00000000-0000-0000-5005-000000000005"));
347 objupdate.ObjectData[0].TextureEntry = ntex.ToBytes();
348 }
349 else
350 {
351 objupdate.ObjectData[0].TextureEntry = store.Texture;
352 }
353
354 objupdate.ObjectData[0].State = 0;
355 objupdate.ObjectData[0].Data = new byte[0];
356 objupdate.ObjectData[0].OwnerID = this.primData.OwnerID;
357 objupdate.ObjectData[0].PCode = this.primData.PCode;
358 objupdate.ObjectData[0].PathBegin = this.primData.PathBegin;
359 objupdate.ObjectData[0].PathEnd = this.primData.PathEnd;
360 objupdate.ObjectData[0].PathScaleX = this.primData.PathScaleX;
361 objupdate.ObjectData[0].PathScaleY = this.primData.PathScaleY;
362 objupdate.ObjectData[0].PathShearX = this.primData.PathShearX;
363 objupdate.ObjectData[0].PathShearY = this.primData.PathShearY;
364 objupdate.ObjectData[0].PathSkew = this.primData.PathSkew;
365 objupdate.ObjectData[0].ProfileBegin = this.primData.ProfileBegin;
366 objupdate.ObjectData[0].ProfileEnd = this.primData.ProfileEnd;
367 objupdate.ObjectData[0].Scale = this.primData.Scale;
368 objupdate.ObjectData[0].PathCurve = this.primData.PathCurve;
369 objupdate.ObjectData[0].ProfileCurve = this.primData.ProfileCurve;
370 objupdate.ObjectData[0].ParentID = 0;
371 objupdate.ObjectData[0].ProfileHollow = this.primData.ProfileHollow;
372 //finish off copying rest of shape data
373 objupdate.ObjectData[0].PathRadiusOffset = this.primData.PathRadiusOffset;
374 objupdate.ObjectData[0].PathRevolutions = this.primData.PathRevolutions;
375 objupdate.ObjectData[0].PathTaperX = this.primData.PathTaperX;
376 objupdate.ObjectData[0].PathTaperY = this.primData.PathTaperY;
377 objupdate.ObjectData[0].PathTwist = this.primData.PathTwist;
378 objupdate.ObjectData[0].PathTwistBegin = this.primData.PathTwistBegin;
379
380 objupdate.ObjectData[0].ID = (uint)store.LocalID;
381 objupdate.ObjectData[0].FullID = store.FullID;
382
383 objupdate.ObjectData[0].ObjectData = new byte[60];
384 objupdate.ObjectData[0].ObjectData[46] = 128;
385 objupdate.ObjectData[0].ObjectData[47] = 63;
386 LLVector3 pos1 = store.Position;
387 //update position
388 byte[] pb = pos1.GetBytes();
389 Array.Copy(pb, 0, objupdate.ObjectData[0].ObjectData, 0, pb.Length);
390
391 this.uuid = objupdate.ObjectData[0].FullID;
392 this.localid = objupdate.ObjectData[0].ID;
393 this.position = pos1;
394 this.OurPacket = objupdate;
395
396 }
397 public ImprovedTerseObjectUpdatePacket.ObjectDataBlock CreateImprovedBlock()
398 {
399 uint ID = this.localid;
400 byte[] bytes = new byte[60];
401
402 int i = 0;
403 ImprovedTerseObjectUpdatePacket.ObjectDataBlock dat = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock();
404 dat.TextureEntry = this.OurPacket.ObjectData[0].TextureEntry;
405
406 bytes[i++] = (byte)(ID % 256);
407 bytes[i++] = (byte)((ID >> 8) % 256);
408 bytes[i++] = (byte)((ID >> 16) % 256);
409 bytes[i++] = (byte)((ID >> 24) % 256);
410 bytes[i++] = 0;
411 bytes[i++] = 0;
412
413 LLVector3 lPos;
414 Axiom.MathLib.Quaternion lRot;
415 if (this._physActor != null && this.physicsEnabled)
416 {
417 PhysicsVector pPos = this._physActor.Position;
418 lPos = new LLVector3(pPos.X, pPos.Y, pPos.Z);
419 lRot = this._physActor.Orientation;
420 }
421 else
422 {
423 lPos = this.position;
424 lRot = this.rotation;
425 }
426 byte[] pb = lPos.GetBytes();
427 Array.Copy(pb, 0, bytes, i, pb.Length);
428 i += 12;
429 ushort ac = 32767;
430
431 //vel
432 bytes[i++] = (byte)(ac % 256);
433 bytes[i++] = (byte)((ac >> 8) % 256);
434 bytes[i++] = (byte)(ac % 256);
435 bytes[i++] = (byte)((ac >> 8) % 256);
436 bytes[i++] = (byte)(ac % 256);
437 bytes[i++] = (byte)((ac >> 8) % 256);
438
439 //accel
440 bytes[i++] = (byte)(ac % 256);
441 bytes[i++] = (byte)((ac >> 8) % 256);
442 bytes[i++] = (byte)(ac % 256);
443 bytes[i++] = (byte)((ac >> 8) % 256);
444 bytes[i++] = (byte)(ac % 256);
445 bytes[i++] = (byte)((ac >> 8) % 256);
446
447 ushort rw, rx, ry, rz;
448 rw = (ushort)(32768 * (lRot.w + 1));
449 rx = (ushort)(32768 * (lRot.x + 1));
450 ry = (ushort)(32768 * (lRot.y + 1));
451 rz = (ushort)(32768 * (lRot.z + 1));
452
453 //rot
454 bytes[i++] = (byte)(rx % 256);
455 bytes[i++] = (byte)((rx >> 8) % 256);
456 bytes[i++] = (byte)(ry % 256);
457 bytes[i++] = (byte)((ry >> 8) % 256);
458 bytes[i++] = (byte)(rz % 256);
459 bytes[i++] = (byte)((rz >> 8) % 256);
460 bytes[i++] = (byte)(rw % 256);
461 bytes[i++] = (byte)((rw >> 8) % 256);
462
463 //rotation vel
464 bytes[i++] = (byte)(ac % 256);
465 bytes[i++] = (byte)((ac >> 8) % 256);
466 bytes[i++] = (byte)(ac % 256);
467 bytes[i++] = (byte)((ac >> 8) % 256);
468 bytes[i++] = (byte)(ac % 256);
469 bytes[i++] = (byte)((ac >> 8) % 256);
470
471 dat.Data = bytes;
472 return dat;
473 }
474
475 public override void BackUp()
476 {
477 this.primData.FullID = this.uuid;
478 this.primData.LocalID = this.localid;
479 this.primData.Position = this.position;
480 this.primData.Rotation = new LLQuaternion(this.rotation.x, this.rotation.y, this.rotation.z, this.rotation.w);
481 OpenSimRoot.Instance.LocalWorld.localStorage.StorePrim(this.primData);
482 }
483 }
484
485}
diff --git a/src/world/ScriptEngine.cs b/OpenSim.RegionServer/world/ScriptEngine.cs
index f20a08e..f20a08e 100644
--- a/src/world/ScriptEngine.cs
+++ b/OpenSim.RegionServer/world/ScriptEngine.cs
diff --git a/src/world/SurfacePatch.cs b/OpenSim.RegionServer/world/SurfacePatch.cs
index 71e4116..71e4116 100644
--- a/src/world/SurfacePatch.cs
+++ b/OpenSim.RegionServer/world/SurfacePatch.cs
diff --git a/src/world/World.cs b/OpenSim.RegionServer/world/World.cs
index e1c84bc..ba99233 100644
--- a/src/world/World.cs
+++ b/OpenSim.RegionServer/world/World.cs
@@ -5,8 +5,10 @@ using System.Collections.Generic;
5using System.Text; 5using System.Text;
6using System.Reflection; 6using System.Reflection;
7using System.IO; 7using System.IO;
8using PhysicsSystem; 8using OpenSim.Physics.Manager;
9using GridInterfaces; 9using OpenSim.Framework.Interfaces;
10using OpenSim.Framework.Assets;
11using OpenSim.Framework.Terrain;
10 12
11namespace OpenSim.world 13namespace OpenSim.world
12{ 14{
@@ -26,10 +28,10 @@ namespace OpenSim.world
26 28
27 public World() 29 public World()
28 { 30 {
29 ServerConsole.MainConsole.Instance.WriteLine("World.cs - creating new entitities instance"); 31 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("World.cs - creating new entitities instance");
30 Entities = new Dictionary<libsecondlife.LLUUID, Entity>(); 32 Entities = new Dictionary<libsecondlife.LLUUID, Entity>();
31 33
32 ServerConsole.MainConsole.Instance.WriteLine("World.cs - creating LandMap"); 34 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("World.cs - creating LandMap");
33 TerrainManager = new TerrainManager(new SecondLife()); 35 TerrainManager = new TerrainManager(new SecondLife());
34 Avatar.SetupTemplate("avatar-template.dat"); 36 Avatar.SetupTemplate("avatar-template.dat");
35 // ServerConsole.MainConsole.Instance.WriteLine("World.cs - Creating script engine instance"); 37 // ServerConsole.MainConsole.Instance.WriteLine("World.cs - Creating script engine instance");
@@ -71,7 +73,7 @@ namespace OpenSim.world
71 73
72 //backup world data 74 //backup world data
73 this.storageCount++; 75 this.storageCount++;
74 if(storageCount> 300) //set to how often you want to backup 76 if(storageCount> 1200) //set to how often you want to backup
75 { 77 {
76 this.Backup(); 78 this.Backup();
77 storageCount =0; 79 storageCount =0;
@@ -112,15 +114,15 @@ namespace OpenSim.world
112 HeightmapGenHills hills = new HeightmapGenHills(); 114 HeightmapGenHills hills = new HeightmapGenHills();
113 this.LandMap = hills.GenerateHeightmap(200, 4.0f, 80.0f, false); 115 this.LandMap = hills.GenerateHeightmap(200, 4.0f, 80.0f, false);
114 this.phyScene.SetTerrain(this.LandMap); 116 this.phyScene.SetTerrain(this.LandMap);
115 OpenSim_Main.cfg.SaveMap(); 117 OpenSimRoot.Instance.Cfg.SaveMap(this.LandMap);
116 118
117 foreach(OpenSimClient client in OpenSim_Main.sim.ClientThreads.Values) { 119 foreach(SimClient client in OpenSimRoot.Instance.ClientThreads.Values) {
118 this.SendLayerData(client); 120 this.SendLayerData(client);
119 } 121 }
120 } 122 }
121 public void LoadPrimsFromStorage() 123 public void LoadPrimsFromStorage()
122 { 124 {
123 ServerConsole.MainConsole.Instance.WriteLine("World.cs: LoadPrimsFromStorage() - Loading primitives"); 125 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("World.cs: LoadPrimsFromStorage() - Loading primitives");
124 this.localStorage.LoadPrimitives(this); 126 this.localStorage.LoadPrimitives(this);
125 } 127 }
126 128
@@ -130,7 +132,7 @@ namespace OpenSim.world
130 { 132 {
131 _primCount = prim.LocalID + 1; 133 _primCount = prim.LocalID + 1;
132 } 134 }
133 ServerConsole.MainConsole.Instance.WriteLine("World.cs: PrimFromStorage() - Reloading prim (localId "+ prim.LocalID+ " ) from storage"); 135 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("World.cs: PrimFromStorage() - Reloading prim (localId "+ prim.LocalID+ " ) from storage");
134 Primitive nPrim = new Primitive(); 136 Primitive nPrim = new Primitive();
135 nPrim.CreateFromStorage(prim); 137 nPrim.CreateFromStorage(prim);
136 this.Entities.Add(nPrim.uuid, nPrim); 138 this.Entities.Add(nPrim.uuid, nPrim);
@@ -141,7 +143,7 @@ namespace OpenSim.world
141 this.localStorage.ShutDown(); 143 this.localStorage.ShutDown();
142 } 144 }
143 145
144 public void SendLayerData(OpenSimClient RemoteClient) { 146 public void SendLayerData(SimClient RemoteClient) {
145 int[] patches = new int[4]; 147 int[] patches = new int[4];
146 148
147 for (int y = 0; y < 16; y++) 149 for (int y = 0; y < 16; y++)
@@ -159,7 +161,7 @@ namespace OpenSim.world
159 } 161 }
160 } 162 }
161 163
162 public void GetInitialPrims(OpenSimClient RemoteClient) 164 public void GetInitialPrims(SimClient RemoteClient)
163 { 165 {
164 foreach (libsecondlife.LLUUID UUID in Entities.Keys) 166 foreach (libsecondlife.LLUUID UUID in Entities.Keys)
165 { 167 {
@@ -170,33 +172,36 @@ namespace OpenSim.world
170 } 172 }
171 } 173 }
172 174
173 public void AddViewerAgent(OpenSimClient AgentClient) { 175 public void AddViewerAgent(SimClient AgentClient) {
174 ServerConsole.MainConsole.Instance.WriteLine("World.cs:AddViewerAgent() - Creating new avatar for remote viewer agent"); 176 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("World.cs:AddViewerAgent() - Creating new avatar for remote viewer agent");
175 Avatar NewAvatar = new Avatar(AgentClient); 177 Avatar NewAvatar = new Avatar(AgentClient);
176 ServerConsole.MainConsole.Instance.WriteLine("World.cs:AddViewerAgent() - Adding new avatar to world"); 178 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("World.cs:AddViewerAgent() - Adding new avatar to world");
177 ServerConsole.MainConsole.Instance.WriteLine("World.cs:AddViewerAgent() - Starting RegionHandshake "); 179 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("World.cs:AddViewerAgent() - Starting RegionHandshake ");
178 NewAvatar.SendRegionHandshake(this); 180 NewAvatar.SendRegionHandshake(this);
179 PhysicsVector pVec = new PhysicsVector(NewAvatar.position.X, NewAvatar.position.Y, NewAvatar.position.Z); 181 PhysicsVector pVec = new PhysicsVector(NewAvatar.position.X, NewAvatar.position.Y, NewAvatar.position.Z);
180 NewAvatar.PhysActor = this.phyScene.AddAvatar(pVec); 182 NewAvatar.PhysActor = this.phyScene.AddAvatar(pVec);
181 this.Entities.Add(AgentClient.AgentID, NewAvatar); 183 this.Entities.Add(AgentClient.AgentID, NewAvatar);
182 } 184 }
183 185
184 public void AddNewPrim(ObjectAddPacket addPacket, OpenSimClient AgentClient) 186 public void AddNewPrim(ObjectAddPacket addPacket, SimClient AgentClient)
185 { 187 {
186 ServerConsole.MainConsole.Instance.WriteLine("World.cs: AddNewPrim() - Creating new prim"); 188 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("World.cs: AddNewPrim() - Creating new prim");
187 Primitive prim = new Primitive(); 189 Primitive prim = new Primitive();
188 prim.CreateFromPacket(addPacket, AgentClient.AgentID, this._primCount); 190 prim.CreateFromPacket(addPacket, AgentClient.AgentID, this._primCount);
189 PhysicsVector pVec = new PhysicsVector(prim.position.X, prim.position.Y, prim.position.Z); 191 PhysicsVector pVec = new PhysicsVector(prim.position.X, prim.position.Y, prim.position.Z);
190 PhysicsVector pSize = new PhysicsVector( 0.25f, 0.25f, 0.25f); 192 PhysicsVector pSize = new PhysicsVector( 0.255f, 0.255f, 0.255f);
191 //prim.PhysActor = this.phyScene.AddPrim(pVec, pSize ); 193 if(OpenSim.world.Avatar.PhysicsEngineFlying)
194 {
195 prim.PhysActor = this.phyScene.AddPrim(pVec, pSize );
196 }
192 //prim.PhysicsEnabled = true; 197 //prim.PhysicsEnabled = true;
193 this.Entities.Add(prim.uuid, prim); 198 this.Entities.Add(prim.uuid, prim);
194 this._primCount++; 199 this._primCount++;
195 } 200 }
196 201
197 public bool Backup() { 202 public bool Backup() {
198 /* TODO: Save the current world entities state. */ 203
199 ServerConsole.MainConsole.Instance.WriteLine("World.cs: Backup() - Backing up Primitives"); 204 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("World.cs: Backup() - Backing up Primitives");
200 foreach (libsecondlife.LLUUID UUID in Entities.Keys) 205 foreach (libsecondlife.LLUUID UUID in Entities.Keys)
201 { 206 {
202 Entities[UUID].BackUp(); 207 Entities[UUID].BackUp();
diff --git a/src/world/scripting/IScript.cs b/OpenSim.RegionServer/world/scripting/IScript.cs
index 550594d..550594d 100644
--- a/src/world/scripting/IScript.cs
+++ b/OpenSim.RegionServer/world/scripting/IScript.cs
diff --git a/OpenSim.Storage/LocalStorageDb4o/AssemblyInfo.cs b/OpenSim.Storage/LocalStorageDb4o/AssemblyInfo.cs
new file mode 100644
index 0000000..6610606
--- /dev/null
+++ b/OpenSim.Storage/LocalStorageDb4o/AssemblyInfo.cs
@@ -0,0 +1,31 @@
1using System.Reflection;
2using System.Runtime.CompilerServices;
3using System.Runtime.InteropServices;
4
5// Information about this assembly is defined by the following
6// attributes.
7//
8// change them to the information which is associated with the assembly
9// you compile.
10
11[assembly: AssemblyTitle("Db4LocalStorage")]
12[assembly: AssemblyDescription("")]
13[assembly: AssemblyConfiguration("")]
14[assembly: AssemblyCompany("")]
15[assembly: AssemblyProduct("Db4LocalStorage")]
16[assembly: AssemblyCopyright("")]
17[assembly: AssemblyTrademark("")]
18[assembly: AssemblyCulture("")]
19
20// This sets the default COM visibility of types in the assembly to invisible.
21// If you need to expose a type to COM, use [ComVisible(true)] on that type.
22[assembly: ComVisible(false)]
23
24// The assembly version has following format :
25//
26// Major.Minor.Build.Revision
27//
28// You can specify all values by your own or you can build default build and revision
29// numbers with the '*' character (the default):
30
31[assembly: AssemblyVersion("1.0.*")]
diff --git a/src/LocalStorage/Db4LocalStorage/Db4LocalStorage.cs b/OpenSim.Storage/LocalStorageDb4o/Db4LocalStorage.cs
index bb9825c..93ed9cc 100644
--- a/src/LocalStorage/Db4LocalStorage/Db4LocalStorage.cs
+++ b/OpenSim.Storage/LocalStorageDb4o/Db4LocalStorage.cs
@@ -29,9 +29,10 @@ using System.Collections.Generic;
29using Db4objects.Db4o; 29using Db4objects.Db4o;
30using Db4objects.Db4o.Query; 30using Db4objects.Db4o.Query;
31using libsecondlife; 31using libsecondlife;
32using GridInterfaces; 32using OpenSim.Framework.Interfaces;
33using OpenSim.Framework.Assets;
33 34
34namespace Db4LocalStorage 35namespace OpenSim.Storage.LocalStorageDb4o
35{ 36{
36 /// <summary> 37 /// <summary>
37 /// 38 ///
@@ -45,13 +46,13 @@ namespace Db4LocalStorage
45 try 46 try
46 { 47 {
47 db = Db4oFactory.OpenFile("localworld.yap"); 48 db = Db4oFactory.OpenFile("localworld.yap");
48 ServerConsole.MainConsole.Instance.WriteLine("Db4LocalStorage creation"); 49 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Db4LocalStorage creation");
49 } 50 }
50 catch(Exception e) 51 catch(Exception e)
51 { 52 {
52 db.Close(); 53 db.Close();
53 ServerConsole.MainConsole.Instance.WriteLine("Db4LocalStorage :Constructor - Exception occured"); 54 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Db4LocalStorage :Constructor - Exception occured");
54 ServerConsole.MainConsole.Instance.WriteLine(e.ToString()); 55 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(e.ToString());
55 } 56 }
56 } 57 }
57 58
@@ -84,6 +85,7 @@ namespace Db4LocalStorage
84 found.ProfileHollow = prim.ProfileHollow; 85 found.ProfileHollow = prim.ProfileHollow;
85 found.Position = prim.Position; 86 found.Position = prim.Position;
86 found.Rotation = prim.Rotation; 87 found.Rotation = prim.Rotation;
88 found.Texture = prim.Texture;
87 db.Set(found); 89 db.Set(found);
88 db.Commit(); 90 db.Commit();
89 } 91 }
@@ -109,7 +111,7 @@ namespace Db4LocalStorage
109 public void LoadPrimitives(ILocalStorageReceiver receiver) 111 public void LoadPrimitives(ILocalStorageReceiver receiver)
110 { 112 {
111 IObjectSet result = db.Get(typeof(PrimData)); 113 IObjectSet result = db.Get(typeof(PrimData));
112 ServerConsole.MainConsole.Instance.WriteLine("Db4LocalStorage.cs: LoadPrimitives() - number of prims in storages is "+result.Count); 114 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Db4LocalStorage.cs: LoadPrimitives() - number of prims in storages is "+result.Count);
113 foreach (PrimData prim in result) { 115 foreach (PrimData prim in result) {
114 receiver.PrimFromStorage(prim); 116 receiver.PrimFromStorage(prim);
115 } 117 }
@@ -121,19 +123,4 @@ namespace Db4LocalStorage
121 db.Close(); 123 db.Close();
122 } 124 }
123 } 125 }
124
125 public class UUIDQuery : Predicate
126 {
127 private LLUUID _findID;
128
129 public UUIDQuery(LLUUID find)
130 {
131 _findID = find;
132 }
133 public bool Match(PrimData prim)
134 {
135 return (prim.FullID == _findID);
136 }
137 }
138
139} 126}
diff --git a/OpenSim.Storage/LocalStorageDb4o/OpenSim.Storage.LocalStorageDb4o.csproj b/OpenSim.Storage/LocalStorageDb4o/OpenSim.Storage.LocalStorageDb4o.csproj
new file mode 100644
index 0000000..5c2ffa5
--- /dev/null
+++ b/OpenSim.Storage/LocalStorageDb4o/OpenSim.Storage.LocalStorageDb4o.csproj
@@ -0,0 +1,104 @@
1<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
2 <PropertyGroup>
3 <ProjectType>Local</ProjectType>
4 <ProductVersion>8.0.50727</ProductVersion>
5 <SchemaVersion>2.0</SchemaVersion>
6 <ProjectGuid>{2B5E9FF0-DE71-41DA-AC6A-B8E2D2D0AE09}</ProjectGuid>
7 <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
8 <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
9 <ApplicationIcon></ApplicationIcon>
10 <AssemblyKeyContainerName>
11 </AssemblyKeyContainerName>
12 <AssemblyName>OpenSim.Storage.LocalStorageDb4o</AssemblyName>
13 <DefaultClientScript>JScript</DefaultClientScript>
14 <DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout>
15 <DefaultTargetSchema>IE50</DefaultTargetSchema>
16 <DelaySign>false</DelaySign>
17 <OutputType>Library</OutputType>
18 <AppDesignerFolder></AppDesignerFolder>
19 <RootNamespace>OpenSim.Storage.LocalStorageDb4o</RootNamespace>
20 <StartupObject></StartupObject>
21 <FileUpgradeFlags>
22 </FileUpgradeFlags>
23 </PropertyGroup>
24 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
25 <AllowUnsafeBlocks>False</AllowUnsafeBlocks>
26 <BaseAddress>285212672</BaseAddress>
27 <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
28 <ConfigurationOverrideFile>
29 </ConfigurationOverrideFile>
30 <DefineConstants>TRACE;DEBUG</DefineConstants>
31 <DocumentationFile></DocumentationFile>
32 <DebugSymbols>True</DebugSymbols>
33 <FileAlignment>4096</FileAlignment>
34 <Optimize>False</Optimize>
35 <OutputPath>..\..\bin\</OutputPath>
36 <RegisterForComInterop>False</RegisterForComInterop>
37 <RemoveIntegerChecks>False</RemoveIntegerChecks>
38 <TreatWarningsAsErrors>False</TreatWarningsAsErrors>
39 <WarningLevel>4</WarningLevel>
40 <NoWarn></NoWarn>
41 </PropertyGroup>
42 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
43 <AllowUnsafeBlocks>False</AllowUnsafeBlocks>
44 <BaseAddress>285212672</BaseAddress>
45 <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
46 <ConfigurationOverrideFile>
47 </ConfigurationOverrideFile>
48 <DefineConstants>TRACE</DefineConstants>
49 <DocumentationFile></DocumentationFile>
50 <DebugSymbols>False</DebugSymbols>
51 <FileAlignment>4096</FileAlignment>
52 <Optimize>True</Optimize>
53 <OutputPath>..\..\bin\</OutputPath>
54 <RegisterForComInterop>False</RegisterForComInterop>
55 <RemoveIntegerChecks>False</RemoveIntegerChecks>
56 <TreatWarningsAsErrors>False</TreatWarningsAsErrors>
57 <WarningLevel>4</WarningLevel>
58 <NoWarn></NoWarn>
59 </PropertyGroup>
60 <ItemGroup>
61 <Reference Include="System" >
62 <HintPath>\System.dll</HintPath>
63 </Reference>
64 <Reference Include="System.Xml.dll" >
65 <HintPath>\System.Xml.dll.dll</HintPath>
66 </Reference>
67 <Reference Include="Db4objects.Db4o.dll" >
68 <HintPath>\Db4objects.Db4o.dll.dll</HintPath>
69 </Reference>
70 <Reference Include="libsecondlife.dll" >
71 <HintPath>\libsecondlife.dll.dll</HintPath>
72 </Reference>
73 </ItemGroup>
74 <ItemGroup>
75 <ProjectReference Include="..\..\OpenSim.Framework\OpenSim.Framework.csproj">
76 <Name>OpenSim.Framework</Name>
77 <Project>{1D2865A9-CF8E-45F7-B96D-91ED128A32CF}</Project>
78 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
79 </ProjectReference>
80 <ProjectReference Include="..\..\OpenSim.Framework.Console\OpenSim.Framework.Console.csproj">
81 <Name>OpenSim.Framework.Console</Name>
82 <Project>{C8405E1A-EC19-48B6-9C8C-CA03624B9916}</Project>
83 <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
84 </ProjectReference>
85 </ItemGroup>
86 <ItemGroup>
87 <Compile Include="AssemblyInfo.cs">
88 <SubType>Code</SubType>
89 </Compile>
90 <Compile Include="Db4LocalStorage.cs">
91 <SubType>Code</SubType>
92 </Compile>
93 <Compile Include="UUIDQuery.cs">
94 <SubType>Code</SubType>
95 </Compile>
96 </ItemGroup>
97 <Import Project="$(MSBuildBinPath)\Microsoft.CSHARP.Targets" />
98 <PropertyGroup>
99 <PreBuildEvent>
100 </PreBuildEvent>
101 <PostBuildEvent>
102 </PostBuildEvent>
103 </PropertyGroup>
104</Project>
diff --git a/OpenSim.Storage/LocalStorageDb4o/OpenSim.Storage.LocalStorageDb4o.dll.build b/OpenSim.Storage/LocalStorageDb4o/OpenSim.Storage.LocalStorageDb4o.dll.build
new file mode 100644
index 0000000..752d0ab
--- /dev/null
+++ b/OpenSim.Storage/LocalStorageDb4o/OpenSim.Storage.LocalStorageDb4o.dll.build
@@ -0,0 +1,46 @@
1<?xml version="1.0" ?>
2<project name="OpenSim.Storage.LocalStorageDb4o" default="build">
3 <target name="build">
4 <echo message="Build Directory is ${project::get-base-directory()}/${build.dir}" />
5 <mkdir dir="${project::get-base-directory()}/${build.dir}" />
6 <copy todir="${project::get-base-directory()}/${build.dir}">
7 <fileset basedir="${project::get-base-directory()}">
8 </fileset>
9 </copy>
10 <csc target="library" debug="${build.debug}" unsafe="False" define="TRACE;DEBUG" output="${project::get-base-directory()}/${build.dir}/${project::get-name()}.dll">
11 <resources prefix="OpenSim.Storage.LocalStorageDb4o" dynamicprefix="true" >
12 </resources>
13 <sources failonempty="true">
14 <include name="AssemblyInfo.cs" />
15 <include name="Db4LocalStorage.cs" />
16 <include name="UUIDQuery.cs" />
17 </sources>
18 <references basedir="${project::get-base-directory()}">
19 <lib>
20 <include name="${project::get-base-directory()}" />
21 <include name="${project::get-base-directory()}/${build.dir}" />
22 </lib>
23 <include name="System.dll" />
24 <include name="System.Xml.dll.dll" />
25 <include name="../../bin/Db4objects.Db4o.dll" />
26 <include name="../../bin/libsecondlife.dll" />
27 <include name="../../OpenSim.Framework/${build.dir}/OpenSim.Framework.dll" />
28 <include name="../../OpenSim.Framework.Console/${build.dir}/OpenSim.Framework.Console.dll" />
29 </references>
30 </csc>
31 <echo message="Copying from [${project::get-base-directory()}/${build.dir}/] to [${project::get-base-directory()}/../../bin/" />
32 <mkdir dir="${project::get-base-directory()}/../../bin/"/>
33 <copy todir="${project::get-base-directory()}/../../bin/">
34 <fileset basedir="${project::get-base-directory()}/${build.dir}/" >
35 <include name="*.dll"/>
36 <include name="*.exe"/>
37 </fileset>
38 </copy>
39 </target>
40 <target name="clean">
41 <delete dir="${bin.dir}" failonerror="false" />
42 <delete dir="${obj.dir}" failonerror="false" />
43 </target>
44 <target name="doc" description="Creates documentation.">
45 </target>
46</project>
diff --git a/OpenSim.Storage/LocalStorageDb4o/UUIDQuery.cs b/OpenSim.Storage/LocalStorageDb4o/UUIDQuery.cs
new file mode 100644
index 0000000..16b6685
--- /dev/null
+++ b/OpenSim.Storage/LocalStorageDb4o/UUIDQuery.cs
@@ -0,0 +1,25 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4using Db4objects.Db4o;
5using Db4objects.Db4o.Query;
6using libsecondlife;
7using OpenSim.Framework.Interfaces;
8using OpenSim.Framework.Assets;
9
10namespace OpenSim.Storage.LocalStorageDb4o
11{
12 public class UUIDQuery : Predicate
13 {
14 private LLUUID _findID;
15
16 public UUIDQuery(LLUUID find)
17 {
18 _findID = find;
19 }
20 public bool Match(PrimData prim)
21 {
22 return (prim.FullID == _findID);
23 }
24 }
25}
diff --git a/OpenSim.build b/OpenSim.build
new file mode 100644
index 0000000..6013f9d
--- /dev/null
+++ b/OpenSim.build
@@ -0,0 +1,94 @@
1<?xml version="1.0" ?>
2<project name="OpenSim" default="build">
3 <echo message="Using '${nant.settings.currentframework}' Framework"/>
4
5 <property name="bin.dir" value="bin" />
6 <property name="obj.dir" value="obj" />
7 <property name="doc.dir" value="doc" />
8 <property name="project.main.dir" value="${project::get-base-directory()}" />
9
10 <target name="Debug" description="">
11 <property name="project.config" value="Debug" />
12 <property name="build.debug" value="true" />
13 </target>
14
15 <property name="project.config" value="Release" />
16
17 <target name="Release" description="">
18 <property name="project.config" value="Release" />
19 <property name="build.debug" value="false" />
20 </target>
21
22 <target name="net-1.1" description="Sets framework to .NET 1.1">
23 <property name="nant.settings.currentframework" value="net-1.1" />
24 </target>
25
26 <target name="net-2.0" description="Sets framework to .NET 2.0">
27 <property name="nant.settings.currentframework" value="net-2.0" />
28 </target>
29
30 <target name="mono-2.0" description="Sets framework to mono 2.0">
31 <property name="nant.settings.currentframework" value="mono-2.0" />
32 </target>
33
34 <target name="mono-1.0" description="Sets framework to mono 1.0">
35 <property name="nant.settings.currentframework" value="mono-1.0" />
36 </target>
37
38 <target name="init" description="">
39 <call target="${project.config}" />
40 <sysinfo />
41 <echo message="Platform ${sys.os.platform}" />
42 <property name="build.dir" value="${bin.dir}/${project.config}" />
43 </target>
44
45 <target name="clean" description="">
46 <echo message="Deleting all builds from all configurations" />
47 <delete dir="${bin.dir}" failonerror="false" />
48 <delete dir="${obj.dir}" failonerror="false" />
49 <nant buildfile="OpenSim.Physics/PhysXPlugin/OpenSim.Physics.PhysXPlugin.dll.build" target="clean" />
50 <nant buildfile="OpenSim.Framework.Console/OpenSim.Framework.Console.dll.build" target="clean" />
51 <nant buildfile="OpenSim.Config/SimConfigDb4o/OpenSim.Config.SimConfigDb4o.dll.build" target="clean" />
52 <nant buildfile="OpenSim.Physics/BasicPhysicsPlugin/OpenSim.Physics.BasicPhysicsPlugin.dll.build" target="clean" />
53 <nant buildfile="OpenSim.GridInterfaces/Remote/OpenSim.GridInterfaces.Remote.dll.build" target="clean" />
54 <nant buildfile="OpenSim.Storage/LocalStorageDb4o/OpenSim.Storage.LocalStorageDb4o.dll.build" target="clean" />
55 <nant buildfile="OpenSim.Framework/OpenSim.Framework.dll.build" target="clean" />
56 <nant buildfile="OpenSim.RegionServer/OpenSim.RegionServer.exe.build" target="clean" />
57 <nant buildfile="OpenSim.Physics/Manager/OpenSim.Physics.Manager.dll.build" target="clean" />
58 <nant buildfile="OpenSim.GridInterfaces/Local/OpenSim.GridInterfaces.Local.dll.build" target="clean" />
59 </target>
60
61 <target name="build" depends="init" description="">
62 <nant buildfile="OpenSim.Framework/OpenSim.Framework.dll.build" target="build" />
63 <nant buildfile="OpenSim.Framework.Console/OpenSim.Framework.Console.dll.build" target="build" />
64 <nant buildfile="OpenSim.Physics/Manager/OpenSim.Physics.Manager.dll.build" target="build" />
65 <nant buildfile="OpenSim.Config/SimConfigDb4o/OpenSim.Config.SimConfigDb4o.dll.build" target="build" />
66 <nant buildfile="OpenSim.GridInterfaces/Local/OpenSim.GridInterfaces.Local.dll.build" target="build" />
67 <nant buildfile="OpenSim.GridInterfaces/Remote/OpenSim.GridInterfaces.Remote.dll.build" target="build" />
68 <nant buildfile="OpenSim.Physics/BasicPhysicsPlugin/OpenSim.Physics.BasicPhysicsPlugin.dll.build" target="build" />
69 <nant buildfile="OpenSim.Physics/PhysXPlugin/OpenSim.Physics.PhysXPlugin.dll.build" target="build" />
70 <nant buildfile="OpenSim.RegionServer/OpenSim.RegionServer.exe.build" target="build" />
71 <nant buildfile="OpenSim.Storage/LocalStorageDb4o/OpenSim.Storage.LocalStorageDb4o.dll.build" target="build" />
72 </target>
73
74 <target name="build-release" depends="Release, init, build" description="Builds in Release mode" />
75
76 <target name="build-debug" depends="Debug, init, build" description="Builds in Debug mode" />
77
78 <target name="package" depends="clean, doc" description="Builds all" />
79
80 <target name="doc" depends="build-release">
81 <echo message="Generating all documentation from all builds" />
82 <nant buildfile="OpenSim.Physics/PhysXPlugin/OpenSim.Physics.PhysXPlugin.dll.build" target="doc" />
83 <nant buildfile="OpenSim.Framework.Console/OpenSim.Framework.Console.dll.build" target="doc" />
84 <nant buildfile="OpenSim.Config/SimConfigDb4o/OpenSim.Config.SimConfigDb4o.dll.build" target="doc" />
85 <nant buildfile="OpenSim.Physics/BasicPhysicsPlugin/OpenSim.Physics.BasicPhysicsPlugin.dll.build" target="doc" />
86 <nant buildfile="OpenSim.GridInterfaces/Remote/OpenSim.GridInterfaces.Remote.dll.build" target="doc" />
87 <nant buildfile="OpenSim.Storage/LocalStorageDb4o/OpenSim.Storage.LocalStorageDb4o.dll.build" target="doc" />
88 <nant buildfile="OpenSim.Framework/OpenSim.Framework.dll.build" target="doc" />
89 <nant buildfile="OpenSim.RegionServer/OpenSim.RegionServer.exe.build" target="doc" />
90 <nant buildfile="OpenSim.Physics/Manager/OpenSim.Physics.Manager.dll.build" target="doc" />
91 <nant buildfile="OpenSim.GridInterfaces/Local/OpenSim.GridInterfaces.Local.dll.build" target="doc" />
92 </target>
93
94</project>
diff --git a/OpenSim.sln b/OpenSim.sln
new file mode 100644
index 0000000..9400771
--- /dev/null
+++ b/OpenSim.sln
@@ -0,0 +1,89 @@
1Microsoft Visual Studio Solution File, Format Version 9.00
2# Visual Studio 2005
3Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenSim.Physics.PhysXPlugin", "OpenSim.Physics\PhysXPlugin\OpenSim.Physics.PhysXPlugin.csproj", "{CBE1E31D-D7E3-4791-A616-F00173BBC26A}"
4EndProject
5Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenSim.Framework.Console", "OpenSim.Framework.Console\OpenSim.Framework.Console.csproj", "{C8405E1A-EC19-48B6-9C8C-CA03624B9916}"
6EndProject
7Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenSim.Config.SimConfigDb4o", "OpenSim.Config\SimConfigDb4o\OpenSim.Config.SimConfigDb4o.csproj", "{C077B28B-2F8D-4BD9-8E47-84C51B3A7358}"
8EndProject
9Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenSim.Physics.BasicPhysicsPlugin", "OpenSim.Physics\BasicPhysicsPlugin\OpenSim.Physics.BasicPhysicsPlugin.csproj", "{00594B9E-29A5-4B9C-AEBD-0AD08C73CFE8}"
10EndProject
11Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenSim.GridInterfaces.Remote", "OpenSim.GridInterfaces\Remote\OpenSim.GridInterfaces.Remote.csproj", "{2AF1E37E-064D-4590-8D7E-B6390F721BAE}"
12EndProject
13Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenSim.Storage.LocalStorageDb4o", "OpenSim.Storage\LocalStorageDb4o\OpenSim.Storage.LocalStorageDb4o.csproj", "{2B5E9FF0-DE71-41DA-AC6A-B8E2D2D0AE09}"
14EndProject
15Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenSim.Framework", "OpenSim.Framework\OpenSim.Framework.csproj", "{1D2865A9-CF8E-45F7-B96D-91ED128A32CF}"
16EndProject
17Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenSim.RegionServer", "OpenSim.RegionServer\OpenSim.RegionServer.csproj", "{B48F0D82-2DE5-42B0-9F1D-0F4353FA243A}"
18EndProject
19Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenSim.Physics.Manager", "OpenSim.Physics\Manager\OpenSim.Physics.Manager.csproj", "{58360A80-9333-4E0F-8F83-3CF937E51633}"
20EndProject
21Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenSim.GridInterfaces.Local", "OpenSim.GridInterfaces\Local\OpenSim.GridInterfaces.Local.csproj", "{FBF3DA4B-5176-4602-AA52-482D077EEC88}"
22EndProject
23Global
24 GlobalSection(SolutionConfigurationPlatforms) = preSolution
25 Debug|Any CPU = Debug|Any CPU
26 Release|Any CPU = Release|Any CPU
27 EndGlobalSection
28 GlobalSection(ProjectDependencies) = postSolution
29 ({CBE1E31D-D7E3-4791-A616-F00173BBC26A}).3 = ({58360A80-9333-4E0F-8F83-3CF937E51633})
30 ({C077B28B-2F8D-4BD9-8E47-84C51B3A7358}).5 = ({1D2865A9-CF8E-45F7-B96D-91ED128A32CF})
31 ({C077B28B-2F8D-4BD9-8E47-84C51B3A7358}).6 = ({C8405E1A-EC19-48B6-9C8C-CA03624B9916})
32 ({00594B9E-29A5-4B9C-AEBD-0AD08C73CFE8}).2 = ({58360A80-9333-4E0F-8F83-3CF937E51633})
33 ({2AF1E37E-064D-4590-8D7E-B6390F721BAE}).3 = ({1D2865A9-CF8E-45F7-B96D-91ED128A32CF})
34 ({2AF1E37E-064D-4590-8D7E-B6390F721BAE}).4 = ({C8405E1A-EC19-48B6-9C8C-CA03624B9916})
35 ({2B5E9FF0-DE71-41DA-AC6A-B8E2D2D0AE09}).4 = ({1D2865A9-CF8E-45F7-B96D-91ED128A32CF})
36 ({2B5E9FF0-DE71-41DA-AC6A-B8E2D2D0AE09}).5 = ({C8405E1A-EC19-48B6-9C8C-CA03624B9916})
37 ({B48F0D82-2DE5-42B0-9F1D-0F4353FA243A}).5 = ({C8405E1A-EC19-48B6-9C8C-CA03624B9916})
38 ({B48F0D82-2DE5-42B0-9F1D-0F4353FA243A}).6 = ({58360A80-9333-4E0F-8F83-3CF937E51633})
39 ({B48F0D82-2DE5-42B0-9F1D-0F4353FA243A}).7 = ({1D2865A9-CF8E-45F7-B96D-91ED128A32CF})
40 ({58360A80-9333-4E0F-8F83-3CF937E51633}).3 = ({C8405E1A-EC19-48B6-9C8C-CA03624B9916})
41 ({FBF3DA4B-5176-4602-AA52-482D077EEC88}).4 = ({1D2865A9-CF8E-45F7-B96D-91ED128A32CF})
42 ({FBF3DA4B-5176-4602-AA52-482D077EEC88}).5 = ({C8405E1A-EC19-48B6-9C8C-CA03624B9916})
43 EndGlobalSection
44 GlobalSection(ProjectConfigurationPlatforms) = postSolution
45 {CBE1E31D-D7E3-4791-A616-F00173BBC26A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
46 {CBE1E31D-D7E3-4791-A616-F00173BBC26A}.Debug|Any CPU.Build.0 = Debug|Any CPU
47 {CBE1E31D-D7E3-4791-A616-F00173BBC26A}.Release|Any CPU.ActiveCfg = Release|Any CPU
48 {CBE1E31D-D7E3-4791-A616-F00173BBC26A}.Release|Any CPU.Build.0 = Release|Any CPU
49 {C8405E1A-EC19-48B6-9C8C-CA03624B9916}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
50 {C8405E1A-EC19-48B6-9C8C-CA03624B9916}.Debug|Any CPU.Build.0 = Debug|Any CPU
51 {C8405E1A-EC19-48B6-9C8C-CA03624B9916}.Release|Any CPU.ActiveCfg = Release|Any CPU
52 {C8405E1A-EC19-48B6-9C8C-CA03624B9916}.Release|Any CPU.Build.0 = Release|Any CPU
53 {C077B28B-2F8D-4BD9-8E47-84C51B3A7358}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
54 {C077B28B-2F8D-4BD9-8E47-84C51B3A7358}.Debug|Any CPU.Build.0 = Debug|Any CPU
55 {C077B28B-2F8D-4BD9-8E47-84C51B3A7358}.Release|Any CPU.ActiveCfg = Release|Any CPU
56 {C077B28B-2F8D-4BD9-8E47-84C51B3A7358}.Release|Any CPU.Build.0 = Release|Any CPU
57 {00594B9E-29A5-4B9C-AEBD-0AD08C73CFE8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
58 {00594B9E-29A5-4B9C-AEBD-0AD08C73CFE8}.Debug|Any CPU.Build.0 = Debug|Any CPU
59 {00594B9E-29A5-4B9C-AEBD-0AD08C73CFE8}.Release|Any CPU.ActiveCfg = Release|Any CPU
60 {00594B9E-29A5-4B9C-AEBD-0AD08C73CFE8}.Release|Any CPU.Build.0 = Release|Any CPU
61 {2AF1E37E-064D-4590-8D7E-B6390F721BAE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
62 {2AF1E37E-064D-4590-8D7E-B6390F721BAE}.Debug|Any CPU.Build.0 = Debug|Any CPU
63 {2AF1E37E-064D-4590-8D7E-B6390F721BAE}.Release|Any CPU.ActiveCfg = Release|Any CPU
64 {2AF1E37E-064D-4590-8D7E-B6390F721BAE}.Release|Any CPU.Build.0 = Release|Any CPU
65 {2B5E9FF0-DE71-41DA-AC6A-B8E2D2D0AE09}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
66 {2B5E9FF0-DE71-41DA-AC6A-B8E2D2D0AE09}.Debug|Any CPU.Build.0 = Debug|Any CPU
67 {2B5E9FF0-DE71-41DA-AC6A-B8E2D2D0AE09}.Release|Any CPU.ActiveCfg = Release|Any CPU
68 {2B5E9FF0-DE71-41DA-AC6A-B8E2D2D0AE09}.Release|Any CPU.Build.0 = Release|Any CPU
69 {1D2865A9-CF8E-45F7-B96D-91ED128A32CF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
70 {1D2865A9-CF8E-45F7-B96D-91ED128A32CF}.Debug|Any CPU.Build.0 = Debug|Any CPU
71 {1D2865A9-CF8E-45F7-B96D-91ED128A32CF}.Release|Any CPU.ActiveCfg = Release|Any CPU
72 {1D2865A9-CF8E-45F7-B96D-91ED128A32CF}.Release|Any CPU.Build.0 = Release|Any CPU
73 {B48F0D82-2DE5-42B0-9F1D-0F4353FA243A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
74 {B48F0D82-2DE5-42B0-9F1D-0F4353FA243A}.Debug|Any CPU.Build.0 = Debug|Any CPU
75 {B48F0D82-2DE5-42B0-9F1D-0F4353FA243A}.Release|Any CPU.ActiveCfg = Release|Any CPU
76 {B48F0D82-2DE5-42B0-9F1D-0F4353FA243A}.Release|Any CPU.Build.0 = Release|Any CPU
77 {58360A80-9333-4E0F-8F83-3CF937E51633}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
78 {58360A80-9333-4E0F-8F83-3CF937E51633}.Debug|Any CPU.Build.0 = Debug|Any CPU
79 {58360A80-9333-4E0F-8F83-3CF937E51633}.Release|Any CPU.ActiveCfg = Release|Any CPU
80 {58360A80-9333-4E0F-8F83-3CF937E51633}.Release|Any CPU.Build.0 = Release|Any CPU
81 {FBF3DA4B-5176-4602-AA52-482D077EEC88}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
82 {FBF3DA4B-5176-4602-AA52-482D077EEC88}.Debug|Any CPU.Build.0 = Debug|Any CPU
83 {FBF3DA4B-5176-4602-AA52-482D077EEC88}.Release|Any CPU.ActiveCfg = Release|Any CPU
84 {FBF3DA4B-5176-4602-AA52-482D077EEC88}.Release|Any CPU.Build.0 = Release|Any CPU
85 EndGlobalSection
86 GlobalSection(SolutionProperties) = preSolution
87 HideSolutionNode = FALSE
88 EndGlobalSection
89EndGlobal
diff --git a/Prebuild/Prebuild.build b/Prebuild/Prebuild.build
new file mode 100644
index 0000000..395fb31
--- /dev/null
+++ b/Prebuild/Prebuild.build
@@ -0,0 +1,67 @@
1<?xml version="1.0" ?>
2<project name="Prebuild" default="build">
3 <echo message="Using '${nant.settings.currentframework}' Framework"/>
4
5 <property name="bin.dir" value="bin" />
6 <property name="obj.dir" value="obj" />
7 <property name="doc.dir" value="doc" />
8 <property name="project.main.dir" value="${project::get-base-directory()}" />
9
10 <target name="Debug" description="">
11 <property name="project.config" value="Debug" />
12 <property name="build.debug" value="true" />
13 </target>
14
15 <property name="project.config" value="Release" />
16
17 <target name="Release" description="">
18 <property name="project.config" value="Release" />
19 <property name="build.debug" value="false" />
20 </target>
21
22 <target name="net-1.1" description="Sets framework to .NET 1.1">
23 <property name="nant.settings.currentframework" value="net-1.1" />
24 </target>
25
26 <target name="net-2.0" description="Sets framework to .NET 2.0">
27 <property name="nant.settings.currentframework" value="net-2.0" />
28 </target>
29
30 <target name="mono-2.0" description="Sets framework to mono 2.0">
31 <property name="nant.settings.currentframework" value="mono-2.0" />
32 </target>
33
34 <target name="mono-1.0" description="Sets framework to mono 1.0">
35 <property name="nant.settings.currentframework" value="mono-1.0" />
36 </target>
37
38 <target name="init" description="">
39 <call target="${project.config}" />
40 <sysinfo />
41 <echo message="Platform ${sys.os.platform}" />
42 <property name="build.dir" value="${bin.dir}/${project.config}" />
43 </target>
44
45 <target name="clean" description="">
46 <echo message="Deleting all builds from all configurations" />
47 <delete dir="${bin.dir}" failonerror="false" />
48 <delete dir="${obj.dir}" failonerror="false" />
49 <nant buildfile="src/Prebuild.exe.build" target="clean" />
50 </target>
51
52 <target name="build" depends="init" description="">
53 <nant buildfile="src/Prebuild.exe.build" target="build" />
54 </target>
55
56 <target name="build-release" depends="Release, init, build" description="Builds in Release mode" />
57
58 <target name="build-debug" depends="Debug, init, build" description="Builds in Debug mode" />
59
60 <target name="package" depends="clean, doc" description="Builds all" />
61
62 <target name="doc" depends="build-release">
63 <echo message="Generating all documentation from all builds" />
64 <nant buildfile="src/Prebuild.exe.build" target="doc" />
65 </target>
66
67</project>
diff --git a/Prebuild/Prebuild.sln b/Prebuild/Prebuild.sln
new file mode 100644
index 0000000..a0bea09
--- /dev/null
+++ b/Prebuild/Prebuild.sln
@@ -0,0 +1,25 @@
1Microsoft Visual Studio Solution File, Format Version 9.00
2# Visual Studio 2005
3Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Prebuild", "src\Prebuild.csproj", "{A5CC8344-BEE4-442E-92F1-FBCB05D6AB78}"
4EndProject
5Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{468F1D07-AD17-4CC3-ABD0-2CA268E4E1A6}"
6 ProjectSection(SolutionItems) = preProject
7 prebuild = prebuild
8 prebuild.xml = prebuild.xml
9 EndProjectSection
10EndProject
11Global
12 GlobalSection(SolutionConfigurationPlatforms) = preSolution
13 Debug|Any CPU = Debug|Any CPU
14 Release|Any CPU = Release|Any CPU
15 EndGlobalSection
16 GlobalSection(ProjectConfigurationPlatforms) = postSolution
17 {A5CC8344-BEE4-442E-92F1-FBCB05D6AB78}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
18 {A5CC8344-BEE4-442E-92F1-FBCB05D6AB78}.Debug|Any CPU.Build.0 = Debug|Any CPU
19 {A5CC8344-BEE4-442E-92F1-FBCB05D6AB78}.Release|Any CPU.ActiveCfg = Release|Any CPU
20 {A5CC8344-BEE4-442E-92F1-FBCB05D6AB78}.Release|Any CPU.Build.0 = Release|Any CPU
21 EndGlobalSection
22 GlobalSection(SolutionProperties) = preSolution
23 HideSolutionNode = FALSE
24 EndGlobalSection
25EndGlobal
diff --git a/Prebuild/README b/Prebuild/README
new file mode 100644
index 0000000..eca6be1
--- /dev/null
+++ b/Prebuild/README
@@ -0,0 +1,230 @@
1Prebuild Instructions
2
3Prebuild 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.
4
5_________________________________________________________________________________
6Overview
7
8Prebuild 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.
9The Prebuild file
10
11_________________________________________________________________________________
12The currently supported developement tools and their associated batch and shell script files.
13
14Visual Studio .NET 2005 (VS2005.bat)
15Visual Studio .NET 2003 (VS2003.bat)
16Visual Studio .NET 2002 (VS2002.bat)
17SharpDevelop (SharpDevelop.bat) - http://www.icsharpcode.net/OpenSource/SD/
18SharpDevelop2 (SharpDevelop.bat) - http://www.icsharpcode.net/OpenSource/SD/
19MonoDevelop (MonoDevelop.sh) - http://www.monodevelop.com/
20NAnt (nant.sh and nant.bat) - http://nant.sourceforge.net/
21Autotools (autotools.bat and autotools.sh) http://www.gnu.org. Only partial support
22
23Notes:
24A Unix Shell script is provided for MonoDevelop, as this is more appropriate than a windows batch file.
25Visual Studio .NET 2005 and the Visual Express IDE's can import solutions from older versions of Visual Studio .NET.
26Makefiles are not currently supported.
27
28_________________________________________________________________________________
29Command Line Syntax:
30
31Example:
32>Prebuild /target vs2003
33
34This 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
35
36
37The syntax structure is as below, where commandParameter is optional depending on the command and you can provide several option-value pairs.
38Note: The '>' signified the command line, do not actually enter this manually
39
40>Prebuild /<option> <commandParameter>
41
42>Prebuild /target vs2003 /pause
43
44>Prebuild /target vs2003 /log ../Log.txt /pause /ppo /file ProjectConfig.xml
45
46>Prebuild /target sharpdev /log
47
48>Prebuild /removedir obj|bin
49
50>Prebuild /target vs2003 /allowedgroups Group1|Group2
51
52>Prebuild /clean
53
54>Prebuild /clean /yes
55
56>Prebuild /clean vs2003
57
58_________________________________________________________________________________
59Command Line Options:
60
61/usage - Shows the help information on how to use Prebuild and what the different options are and what they do
62
63/clean - The project files generated for the target type specified as a parameter for this option will be deleted. If no value is specified or if 'all' is specified, then project files for all the target types will be deleted.
64
65/target - Specified the name of the development tool for which project or make files will be generated. Possible parameter values include: vs2003, vs2002, sharpdev
66
67/file - Specifies the name of the XML which defines what files are to be referenced by the generated project files as well as configures the options for them. If not specified, prebuild.xml will be used as the default.
68
69/log - Specified the log file that should be written to for build errors. If this option is not specified, no log file is generated, but if just no value is specified, then the defaul filename will be used for the log (Prebuild.log).
70
71/ppo - Preprocesses the xml file to test for syntax errors or problems but doesn't generate the files
72
73/pause - Shows the console until you press a key so that you can view the messages written while performing the specified actions.
74This allows you to check if an errors occurred and - if so - what it was.
75
76/showtargets - Shows a list of all the targets that can be specified as values for the /clean and /target commands.
77
78/allowedgroups - This is 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
79
80/removedir - This is followed by a pipe-delimited list of directory names that will be deleted while recursivly searching the directory of the prebuild application and its child directories (eg. use obj|bin to delete all output and temporary directories before file releases)
81
82/yes - Answer yes to any warnings (e.g. when cleaning all projects).
83
84_________________________________________________________________________________
85Example Batch Files and Shell Scripts
86
87NOTE: Common batch and shell script files are included with Prebuild source and file releases.
88______________________________
89MonoDevelop
90
91#!/bin/sh
92# Generates a combine (.cmbx) and a set of project files (.prjx)
93# for MonoDevelop, a Mono port of SharpDevelop (http://icsharpcode.net/OpenSource/SD/Default.aspx)
94./Prebuild /target sharpdev /pause
95
96______________________________
97Visual Studio .NET 2003
98
99@rem Generates a solution (.sln) and a set of project files (.csproj)
100@rem for Microsoft Visual Studio .NET 2002
101Prebuild /target vs2003 /pause
102
103Notes:
104Text after lines that start with @rem are comments and are not evaluated
105You can also place pause on the last line instead of specifing the /pause command.
106
107________________________________________________________________________________
108Example XML Configuration File
109
110Note:
111XML Comments (<!-- Comment -->) are used to markup the prebuild.xml file with notes
112The below file may be out-of-date, however the RealmForge Prebuild file serves as an up-to-date and extensive example.
113It can be viewed using Tigris.org's WebSVN (http://realmforge.tigris.org/source/browse/realmforge/trunk/src/prebuild.xml) by just clicking on the "view file" link for the latest revision.
114
115_________________________________
116
117<?xml version="1.0" encoding="utf-8"?>
118 <!--The version of the XML schema specified in the version and xmlns attributes should match the one for which the version of Prebuild.exe used was compiled for. In this example it is the version 1.3 schema, you can find the XSD schema file at the url specified in the xmlns attribute. -->
119<Prebuild version="1.6" xmlns="http://dnpb.sourceforge.net/schemas/prebuild-1.6.xsd">
120 <Solution name="RealmForge"> <!--The title and file name for the solution, combine, workspace, or project group (depending on what development tool you are using)-->
121 <!--Configurations found as children of Solution are used as templates for the configurations found in the project, this allows you to avoid writing the same options in each project (and maintaining each of these). You can provide defaults and then override them in the configurations defined for each project. All options are optional.-->
122 <Configuration name="Debug">
123 <Options>
124 <!-- simple logically expressions can be evaluated, if, else, elseif, and endif are valid statements. Note that it is not neccisary to define POSIX or WIN32 -->
125 <?if OS = "Win32" ?>
126 <CompilerDefines>DEBUG;TRACE;WIN32</CompilerDefines>
127 <?else ?>
128 <CompilerDefines>DEBUG;TRACE;POSIX</CompilerDefines>
129 <?endif ?>
130 <OptimizeCode>false</OptimizeCode>
131 <CheckUnderflowOverflow>false</CheckUnderflowOverflow>
132 <AllowUnsafe>false</AllowUnsafe>
133 <WarningLevel>4</WarningLevel>
134 <!-The filter for the number of warnings or errors shown and the tolerance level as to what is an error. This is value from 0 to 4 where 4 is the most strict (least tolerent).-->
135
136 <WarningsAsErrors>false</WarningsAsErrors>
137 <SuppressWarnings>1591;219;1573;1572;168</SuppressWarnings>
138 <!-- A semicolon ';' delimited list of the warnings that are filtered and not shown in the output window during compiling a project. Only include the number portion of the warning codes that are shown in output during compilation (eg CS1591, should be entered as 1591)-->
139
140 <OutputPath>..\bin</OutputPath>
141 <DebugInformation>true</DebugInformation>
142 <RegisterComInterop>false</RegisterComInterop>
143 <IncrementalBuild>true</IncrementalBuild>
144 <BaseAddress>285212672</BaseAddress>
145 <FileAlignment>4096</FileAlignment>
146 <NoStdLib>false</NoStdLib>
147 <XmlDocFile>Docs.xml</XmlDocFile>
148 </Options>
149 </Configuration>
150 <Configuration name="Release"> <!-- You can define multple configurations that projects can have, but there is no way to define which one is selected by default as this is a part of the user preferences for a project, not the solution or project files -->
151 <Options>
152 <CompilerDefines>TRACE</CompilerDefines>
153 <OptimizeCode>true</OptimizeCode>
154 <CheckUnderflowOverflow>false</CheckUnderflowOverflow>
155 <AllowUnsafe>false</AllowUnsafe>
156 <WarningLevel>4</WarningLevel>
157 <WarningsAsErrors>false</WarningsAsErrors>
158 <SuppressWarnings>1591;219;1573;1572;168</SuppressWarnings>
159 <OutputPath>..\bin</OutputPath>
160 <DebugInformation>false</DebugInformation>
161 <RegisterComInterop>false</RegisterComInterop>
162 <IncrementalBuild>true</IncrementalBuild>
163 <BaseAddress>285212672</BaseAddress>
164 <FileAlignment>4096</FileAlignment>
165 <NoStdLib>false</NoStdLib>
166 <GenerateXmlDocFile>true</GenerateXmlDocFile>
167 <XmlDocFile>Docs.xml</XmlDocFile>
168 </Options>
169 </Configuration>
170
171 <!-- One of the projects that is included in the Solution -->
172 <Project name="RealmForge.Utility" Language="VisualBasic" path="Utility" type="Library" assemblyName="RealmForge.Utility" rootNamespace="RealmForge">
173 <Configuration name="Debug">
174 <Options>
175 <OutputPath>..\bin\lib\Utility</OutputPath>
176 <XmlDocFile>RealmForge.Utility.xml</XmlDocFile>
177 </Options>
178 </Configuration>
179 <Configuration name="Release">
180 <Options>
181 <OutputPath>..\bin\lib\Utility</OutputPath>
182 <XmlDocFile>RealmForge.Utility.xml</XmlDocFile>
183 </Options>
184 </Configuration>
185 <ReferencePath>../bin</ReferencePath>
186 <Reference name="System"/>
187 <Reference name="System.Data"/>
188 <Reference name="System.Drawing"/>
189 <Reference name="System.Xml"/>
190 <Reference name="System.Runtime.Serialization.Formatters.Soap"/>
191 <Reference name="ICSharpCode.SharpZipLib"/>
192 <Files>
193 <Match path="." pattern="*.vb" recurse="true"/>
194 </Files>
195 </Project>
196
197 <!-- Another projects that is included in the Solution -->
198 <Project name="DemoGame" Language="C#" path="DemoGame" type="WinExe" icon="..\bin\RealmForge.ico" assemblyName="DemoGame" rootNamespace="RealmForge">
199 <!-- icon is used to define the location of the .ico file that is embeeded in the assembly when the project is compiled. This is relative to the project path -->
200 <!--type defines the type of project, valid types are Library (.dll), WinExe (.exe), and Exe (.exe). WinExe is not windows specific, it just defines that it is a GUI application and that no Console or Command window will show when it is started-->
201
202 <Configuration name="Debug">
203 <Options>
204 <OutputPath>..\bin</OutputPath>
205 <XmlDocFile>DemoGame.xml</XmlDocFile>
206 </Options>
207 </Configuration>
208 <Configuration name="Release">
209 <Options>
210 <OutputPath>..\bin</OutputPath>
211 <XmlDocFile>DemoGame.xml</XmlDocFile>
212 </Options>
213 </Configuration>
214 <ReferencePath>../bin</ReferencePath>
215 <Reference name="System"/> <!-- Assemblies that are located in the GAC (installed, global) can be referenced-->
216 <Reference name="ode"/> <!-- Assemblies that are located in the output directory to which the file is built can be referenced -->
217 <Reference name="RealmForge.Utility"/> <!-- When you reference the name of another project, then that project (and it's output) will be referenced instead of looking for a pre-built assembly-->
218 <Files>
219 <Match path="." pattern="*.cs" recurse="true"/>
220 <Match path="." pattern="*.bmp" recurse="true" buildAction="EmbeddedResource"/>
221 <Match path="." pattern="[^a]*\.(png|jpg)" useRegex="true" buildAction="EmbeddedResource"/>
222
223 <!-- Uses a regex or regular expression to find all files that end with .png or .jpg but dont have the letter 'a' in their name and add them to the project as EmbeddedResource's. Because recurse enabled (default is false), only the values in the files in that are directly in the project directory (not child directories) are checked.-->
224 <!--EmbeddedResource, Content, and Compile are valid buildAction's-->
225 </Files>
226 </Project>
227
228 </Solution>
229</Prebuild>
230
diff --git a/Prebuild/TODO b/Prebuild/TODO
new file mode 100644
index 0000000..d01780a
--- /dev/null
+++ b/Prebuild/TODO
@@ -0,0 +1,21 @@
1* monodev target should be able to detect whether the project is 1.x
2 or 2.x runtime
3
4* make an autotools install target for .exe files
5
6* Fix the autotools target so that
7
8if(numProjects == 1){
9 for($projectDir){
10 generate_a_project_configure_dot_ac()
11 }
12}else{
13 generate_a_solution_configure_dot_ac()
14
15 foreach($project in $projectsList){
16 mkdir $project/
17 cd $project/
18 generate_a_project_configure_dot_ac
19 }
20}
21
diff --git a/Prebuild/doc/prebuild-example1.xml b/Prebuild/doc/prebuild-example1.xml
new file mode 100644
index 0000000..ea6f455
--- /dev/null
+++ b/Prebuild/doc/prebuild-example1.xml
@@ -0,0 +1,300 @@
1<?xml version="1.0" encoding="utf-8"?>
2<Prebuild version="1.6" xmlns="http://dnpb.sourceforge.net/schemas/prebuild-1.6.xsd">
3 <Solution name="RealmForge">
4 <Configuration name="Debug">
5 <Options>
6 <CompilerDefines>TRACE;DEBUG</CompilerDefines>
7 <OptimizeCode>false</OptimizeCode>
8 <CheckUnderflowOverflow>false</CheckUnderflowOverflow>
9 <AllowUnsafe>false</AllowUnsafe>
10 <WarningLevel>4</WarningLevel>
11 <WarningsAsErrors>false</WarningsAsErrors>
12 <SuppressWarnings>1591;219;1573;1572;168</SuppressWarnings>
13 <OutputPath>..\bin</OutputPath>
14 <DebugInformation>true</DebugInformation>
15 <RegisterComInterop>false</RegisterComInterop>
16 <IncrementalBuild>true</IncrementalBuild>
17 <BaseAddress>285212672</BaseAddress>
18 <FileAlignment>4096</FileAlignment>
19 <NoStdLib>false</NoStdLib>
20 <XmlDocFile>Docs.xml</XmlDocFile>
21 </Options>
22 </Configuration>
23 <Configuration name="Release">
24 <Options>
25 <CompilerDefines>TRACE</CompilerDefines>
26 <OptimizeCode>true</OptimizeCode>
27 <CheckUnderflowOverflow>false</CheckUnderflowOverflow>
28 <AllowUnsafe>false</AllowUnsafe>
29 <WarningLevel>4</WarningLevel>
30 <WarningsAsErrors>false</WarningsAsErrors>
31 <SuppressWarnings>1591;219;1573;1572;168</SuppressWarnings>
32 <OutputPath>..\bin</OutputPath>
33 <DebugInformation>false</DebugInformation>
34 <RegisterComInterop>false</RegisterComInterop>
35 <IncrementalBuild>true</IncrementalBuild>
36 <BaseAddress>285212672</BaseAddress>
37 <FileAlignment>4096</FileAlignment>
38 <NoStdLib>false</NoStdLib>
39 <XmlDocFile>Docs.xml</XmlDocFile>
40 </Options>
41 </Configuration>
42
43 <Project name="RealmForge.Utility" path="Utility" type="Library" assemblyName="RealmForge.Utility" rootNamespace="RealmForge">
44 <Configuration name="Debug">
45 <Options>
46 <OutputPath>..\bin\lib\Utility</OutputPath>
47 <XmlDocFile>RealmForge.Utility.xml</XmlDocFile>
48 </Options>
49 </Configuration>
50 <Configuration name="Release">
51 <Options>
52 <OutputPath>..\bin\lib\Utility</OutputPath>
53 <XmlDocFile>RealmForge.Utility.xml</XmlDocFile>
54 </Options>
55 </Configuration>
56 <ReferencePath>../bin</ReferencePath>
57 <Reference name="System"/>
58 <Reference name="System.Data"/>
59 <Reference name="System.Drawing"/>
60 <Reference name="System.Xml"/>
61 <Reference name="System.Runtime.Serialization.Formatters.Soap"/>
62 <Reference name="ICSharpCode.SharpZipLib"/>
63 <Files>
64 <Match pattern="*.cs" recurse="true"/>
65 </Files>
66 </Project>
67
68 <Project name="RealmForge.Framework" path="Framework" type="Library" assemblyName="RealmForge.Framework" rootNamespace="RealmForge">
69 <Configuration name="Debug">
70 <Options>
71 <OutputPath>..\bin\lib\Framework</OutputPath>
72 <XmlDocFile>RealmForge.Framework.xml</XmlDocFile>
73 </Options>
74 </Configuration>
75 <Configuration name="Release">
76 <Options>
77 <OutputPath>..\bin\lib\Framework</OutputPath>
78 <XmlDocFile>RealmForge.Framework.xml</XmlDocFile>
79 </Options>
80 </Configuration>
81 <ReferencePath>../bin</ReferencePath>
82 <Reference name="System"/>
83 <Reference name="System.Data"/>
84 <Reference name="System.Xml"/>
85 <Reference name="System.Windows.Forms"/>
86 <Reference name="System.Drawing"/>
87 <Reference name="Axiom.MathLib"/>
88 <Reference name="RealmForge.Utility"/>
89 <Reference name="Tao.OpenAl"/>
90 <Reference name="ICSharpCode.SharpZipLib"/>
91 <Reference name="csogg"/>
92 <Reference name="csvorbis"/>
93 <Files>
94 <Match pattern="*.cs" recurse="true"/>
95 <Match pattern="*.txt" recurse="true"/>
96 </Files>
97 </Project>
98
99 <Project name="RealmForge.Genres" path="Genres" type="Library" assemblyName="RealmForge.Genres" rootNamespace="RealmForge">
100 <Configuration name="Debug">
101 <Options>
102 <OutputPath>..\bin\lib\Genres</OutputPath>
103 <XmlDocFile>RealmForge.Genres.xml</XmlDocFile>
104 </Options>
105 </Configuration>
106 <Configuration name="Release">
107 <Options>
108 <OutputPath>..\bin\lib\Genres</OutputPath>
109 <XmlDocFile>RealmForge.Genres.xml</XmlDocFile>
110 </Options>
111 </Configuration>
112 <ReferencePath>../bin</ReferencePath>
113 <Reference name="System"/>
114 <Reference name="System.Data"/>
115 <Reference name="System.Xml"/>
116 <Reference name="System.Windows.Forms"/>
117 <Reference name="System.Drawing"/>
118 <Reference name="Axiom.MathLib"/>
119 <Reference name="RealmForge.Utility"/>
120 <Reference name="RealmForge.Framework"/>
121 <Files>
122 <Match pattern="*.cs" recurse="true"/>
123 </Files>
124 </Project>
125
126 <Project name="RealmForge.UI.Forms" path="Forms" type="Library" assemblyName="RealmForge.UI.Forms" rootNamespace="RealmForge">
127 <Configuration name="Debug">
128 <Options>
129 <OutputPath>..\bin\lib\Forms</OutputPath>
130 <XmlDocFile>RealmForge.UI.Forms.xml</XmlDocFile>
131 <AllowUnsafe>true</AllowUnsafe>
132 </Options>
133 </Configuration>
134 <Configuration name="Release">
135 <Options>
136 <OutputPath>..\bin\lib\Forms</OutputPath>
137 <XmlDocFile>RealmForge.UI.Forms.xml</XmlDocFile>
138 <AllowUnsafe>true</AllowUnsafe>
139 </Options>
140 </Configuration>
141 <ReferencePath>../bin</ReferencePath>
142 <Reference name="System"/>
143 <Reference name="System.Drawing"/>
144 <Reference name="System.Data"/>
145 <Reference name="System.Design"/>
146 <Reference name="System.Windows.Forms"/>
147 <Reference name="System.Xml"/>
148 <Reference name="Axiom.MathLib"/>
149 <Reference name="wx.NET"/>
150 <Reference name="RealmForge.Framework"/>
151 <Reference name="RealmForge.Utility"/>
152 <Files>
153 <File buildAction="EmbeddedResource">IDE\Resources\ImagesCaptionIDE.bmp</File>
154 <File buildAction="EmbeddedResource">IDE\Resources\ImagesCaptionPlain.bmp</File>
155 <File buildAction="EmbeddedResource">IDE\Resources\ImagesMenuControl.bmp</File>
156 <File buildAction="EmbeddedResource">IDE\Resources\ImagesPopupMenu.bmp</File>
157 <File buildAction="EmbeddedResource">IDE\Resources\ImagesTabbedGroups.bmp</File>
158 <File buildAction="EmbeddedResource">IDE\Resources\ImagesTabControl.bmp</File>
159 <File buildAction="EmbeddedResource">IDE\Resources\LibraryIcon.ico</File>
160 <File buildAction="EmbeddedResource">IDE\Resources\TabbedInvalid.cur</File>
161 <File buildAction="EmbeddedResource">IDE\Resources\TabbedValid.cur</File>
162 <File buildAction="EmbeddedResource">IDE\Resources\WizardPicture.bmp</File>
163 <File buildAction="EmbeddedResource">Controls\Trees\tv_minus.bmp</File>
164 <File buildAction="EmbeddedResource">Controls\Trees\tv_plus.bmp</File>
165 <File buildAction="EmbeddedResource">Controls\Trees\treeview.bmp</File>
166 <File buildAction="EmbeddedResource">Controls\Trees\listview.bmp</File>
167 <File buildAction="EmbeddedResource">IDE\Menus\MenuControl.bmp</File>
168 <File buildAction="EmbeddedResource">IDE\Controls\InertButton.bmp</File>
169 <File buildAction="EmbeddedResource">IDE\Controls\TabbedGroups.bmp</File>
170 <File buildAction="EmbeddedResource">IDE\Controls\TabCOntrol.bmp</File>
171 <File buildAction="EmbeddedResource">IDE\Controls\WizardControl.bmp</File>
172 <File buildAction="EmbeddedResource">Forms\IDETest.resx</File>
173 <File buildAction="EmbeddedResource">Forms\IDEWindow.resx</File>
174 <File buildAction="EmbeddedResource">Forms\Launcher.resx</File>
175 <File buildAction="EmbeddedResource">Forms\MainRenderFrame.resx</File>
176 <Match pattern="*.cs" recurse="true"/>
177 </Files>
178 </Project>
179
180 <Project name="RealmForge.RAGE" path="RAGE" type="Library" assemblyName="RealmForge.RAGE" rootNamespace="RealmForge">
181 <Configuration name="Debug">
182 <Options>
183 <OutputPath>..\bin\lib\RAGE</OutputPath>
184 <XmlDocFile>RealmForge.RAGE.xml</XmlDocFile>
185 </Options>
186 </Configuration>
187 <Configuration name="Release">
188 <Options>
189 <OutputPath>..\bin\lib\RAGE</OutputPath>
190 <XmlDocFile>RealmForge.RAGE.xml</XmlDocFile>
191 </Options>
192 </Configuration>
193 <ReferencePath>../bin</ReferencePath>
194 <ReferencePath>../bin</ReferencePath>
195 <Reference name="System"/>
196 <Reference name="System.XML"/>
197 <Reference name="System.Windows.Forms"/>
198 <Reference name="System.Drawing"/>
199 <Reference name="Axiom.Plugins.CgProgramManager"/>
200 <Reference name="Axiom.Engine"/>
201 <Reference name="Axiom.MathLib"/>
202 <Reference name="Axiom.Plugins.ParticleFX"/>
203 <Reference name="Axiom.Platforms.Win32"/>
204 <Reference name="Axiom.RenderSystems.DirectX9"/>
205 <Reference localCopy="false" name="Axiom.RenderSystems.OpenGL"/>
206 <Reference name="Axiom.SceneManagers.Octree"/>
207 <Reference name="ICSharpCode.SharpZipLib"/>
208 <Reference name="System.Data"/>
209 <Reference name="RealmForge.Framework"/>
210 <Reference name="RealmForge.Utility"/>
211 <Reference name="ode"/>
212 <Files>
213 <Match pattern="*.cs" recurse="true"/>
214 </Files>
215 </Project>
216
217
218 <Project name="RealmForge.ScriptLibrary" path="ScriptLibrary" type="Library" assemblyName="RealmForge.ScriptLibrary" rootNamespace="RSL">
219 <Configuration name="Debug">
220 <Options>
221 <OutputPath>..\bin\ScriptLibrary</OutputPath>
222 <XmlDocFile>RealmForge.ScriptLibrary.xml</XmlDocFile>
223 </Options>
224 </Configuration>
225 <Configuration name="Release">
226 <Options>
227 <OutputPath>..\bin\ScriptLibrary</OutputPath>
228 <XmlDocFile>RealmForge.ScriptLibrary.xml</XmlDocFile>
229 </Options>
230 </Configuration>
231 <ReferencePath>../bin</ReferencePath>
232 <Reference name="System"/>
233 <Reference name="System.XML"/>
234 <Reference name="System.Windows.Forms"/>
235 <Reference name="System.Drawing"/>
236 <Reference name="Axiom.MathLib"/>
237 <Reference name="wx.NET"/>
238 <Reference name="RealmForge.UI.Forms"/>
239 <Reference name="RealmForge.RAGE"/>
240 <Reference name="RealmForge.Framework"/>
241 <Reference name="RealmForge.Utility"/>
242 <Files>
243 <Match pattern="*.cs" recurse="true"/>
244 </Files>
245 </Project>
246
247
248 <Project name="Updater" path="Updater" type="WinExe" icon="..\bin\Updater.ico" assemblyName="Updater" rootNamespace="RealmForge">
249 <Configuration name="Debug">
250 <Options>
251 <OutputPath>..\bin\lib\Updater</OutputPath>
252 <XmlDocFile>Updater.xml</XmlDocFile>
253 </Options>
254 </Configuration>
255 <Configuration name="Release">
256 <Options>
257 <OutputPath>..\bin\lib\Updater</OutputPath>
258 <XmlDocFile>Updater.xml</XmlDocFile>
259 </Options>
260 </Configuration>
261 <ReferencePath>../bin</ReferencePath>
262 <Reference name="System"/>
263 <Reference name="RealmForge.UI.Forms"/>
264 <Reference name="RealmForge.Framework"/>
265 <Reference name="RealmForge.Utility"/>
266 <Files>
267 <Match pattern="*.cs" recurse="true"/>
268 </Files>
269 </Project>
270
271
272 <Project name="DemoGame" path="DemoGame" type="WinExe" icon="..\bin\RealmForge.ico" assemblyName="DemoGame" rootNamespace="RealmForge">
273 <Configuration name="Debug">
274 <Options>
275 <OutputPath>..\bin</OutputPath>
276 <XmlDocFile>DemoGame.xml</XmlDocFile>
277 </Options>
278 </Configuration>
279 <Configuration name="Release">
280 <Options>
281 <OutputPath>..\bin</OutputPath>
282 <XmlDocFile>DemoGame.xml</XmlDocFile>
283 </Options>
284 </Configuration>
285 <ReferencePath>../bin</ReferencePath>
286 <Reference name="System"/>
287 <Reference name="RealmForge.UI.Forms"/>
288 <Reference name="RealmForge.ScriptLibrary"/>
289 <Reference name="RealmForge.RAGE"/>
290 <Reference name="RealmForge.Framework"/>
291 <Reference name="RealmForge.Utility"/>
292 <Files>
293 <Match pattern="*.cs" recurse="true"/>
294 </Files>
295 </Project>
296
297 </Solution>
298</Prebuild>
299
300
diff --git a/Prebuild/doc/prebuild-example2.xml b/Prebuild/doc/prebuild-example2.xml
new file mode 100644
index 0000000..02276f6
--- /dev/null
+++ b/Prebuild/doc/prebuild-example2.xml
@@ -0,0 +1,72 @@
1<?xml version="1.0" encoding="utf-8" ?>
2<Prebuild xmlns="http://dnpb.sourceforge.net/schemas/prebuild-1.6.xsd">
3 <Solution name="Prebuild">
4 <Configuration name="Debug">
5 <Options>
6 <?if OS = "Win32" ?>
7 <CompilerDefines>DEBUG;TRACE;WIN32;NET</CompilerDefines>
8 <?else ?>
9 <CompilerDefines>DEBUG;TRACE;POSIX</CompilerDefines>
10 <?endif ?>
11 <OptimizeCode>false</OptimizeCode>
12 <OutputPath>bin\Debug</OutputPath>
13 <DebugInformation>true</DebugInformation>
14 <SuppressWarnings>1595</SuppressWarnings>
15 </Options>
16 </Configuration>
17 <Configuration name="Release">
18 <Options>
19 <?if OS = "Win32" ?>
20 <CompilerDefines>TRACE;WIN32;NET</CompilerDefines>
21 <?else ?>
22 <CompilerDefines>TRACE;POSIX</CompilerDefines>
23 <?endif ?>
24 <OutputPath>bin\Release</OutputPath>
25 <OptimizeCode>true</OptimizeCode>
26 <DebugInformation>false</DebugInformation>
27 <SuppressWarnings>1595</SuppressWarnings>
28 </Options>
29 </Configuration>
30 <Files>
31 <File>prebuild.xml</File>
32 <Match path="doc" pattern="*.txt"/>
33 </Files>
34 <Project name="Prebuild" path="src" language="C#" assemblyName="Prebuild" icon="App.ico" type="Exe" rootNamespace="Prebuild" startupObject="Prebuild.Prebuild">
35 <Configuration name="Debug">
36 <Options>
37 <?if OS = "Win32" ?>
38 <CompilerDefines>DEBUG;TRACE;WIN32;NET</CompilerDefines>
39 <?else ?>
40 <CompilerDefines>DEBUG;TRACE;POSIX</CompilerDefines>
41 <?endif ?>
42 <OptimizeCode>false</OptimizeCode>
43 <OutputPath>bin\Debug</OutputPath>
44 <DebugInformation>true</DebugInformation>
45 <XmlDocFile>Prebuild.xml</XmlDocFile>
46 <SuppressWarnings>1595</SuppressWarnings>
47 </Options>
48 </Configuration>
49 <Configuration name="Release">
50 <Options>
51 <?if OS = "Win32" ?>
52 <CompilerDefines>TRACE;WIN32;NET</CompilerDefines>
53 <?else ?>
54 <CompilerDefines>TRACE;POSIX</CompilerDefines>
55 <?endif ?>
56 <OutputPath>bin\Release</OutputPath>
57 <OptimizeCode>true</OptimizeCode>
58 <DebugInformation>false</DebugInformation>
59 <XmlDocFile>Prebuild.xml</XmlDocFile>
60 <SuppressWarnings>1595</SuppressWarnings>
61 </Options>
62 </Configuration>
63 <Reference name="System.Xml" />
64 <Reference name="System" />
65 <Files>
66 <Match pattern="App.ico" buildAction="EmbeddedResource"/>
67 <Match path="data" pattern="prebuild-1.6.xsd" buildAction="EmbeddedResource"/>
68 <Match pattern="*.cs" recurse="true"/>
69 </Files>
70 </Project>
71 </Solution>
72</Prebuild>
diff --git a/Prebuild/doc/prebuild-example3.xml b/Prebuild/doc/prebuild-example3.xml
new file mode 100644
index 0000000..1ba38f7
--- /dev/null
+++ b/Prebuild/doc/prebuild-example3.xml
@@ -0,0 +1,113 @@
1<?xml version="1.0" encoding="utf-8"?>
2 <!--The version of the XML schema specified in the version and xmlns attributes should match the one for which the version of Prebuild.exe used was compiled for. In this example it is the version 1.6 schema, you can find the XSD schema file at the url specified in the xmlns attribute. -->
3 <Prebuild version="1.6" xmlns="http://dnpb.sourceforge.net/schemas/prebuild-1.6.xsd">
4 <Solution name="RealmForge"> <!--The title and file name for the solution, combine, workspace, or project group (depending on what development tool you are using)-->
5 <!--Configurations found as children of Solution are used as templates for the configurations found in the project, this allows you to avoid writing the same options in each project (and maintaining each of these). You can provide defaults and then override them in the configurations defined for each project. All options are optional.-->
6 <Configuration name="Debug">
7 <Options>
8 <!-- simple logically expressions can be evaluated, if, else, elseif, and endif are valid statements. Note that it is not neccisary to define POSIX or WIN32 -->
9 <?if OS = "Win32" ?>
10 <CompilerDefines>DEBUG;TRACE;WIN32</CompilerDefines>
11 <?else ?>
12 <CompilerDefines>DEBUG;TRACE;POSIX</CompilerDefines>
13 <?endif ?>
14 <OptimizeCode>false</OptimizeCode>
15 <CheckUnderflowOverflow>false</CheckUnderflowOverflow>
16 <AllowUnsafe>false</AllowUnsafe>
17 <WarningLevel>4</WarningLevel>
18 <!--The filter for the number of warnings or errors shown and the tolerance level as to what is an error. This is value from 0 to 4 where 4 is the most strict (least tolerent).-->
19
20 <WarningsAsErrors>false</WarningsAsErrors>
21 <SuppressWarnings>1591;219;1573;1572;168</SuppressWarnings>
22 <!-- A semicolon ';' delimited list of the warnings that are filtered and not shown in the output window during compiling a project. Only include the number portion of the warning codes that are shown in output during compilation (eg CS1591, should be entered as 1591)-->
23
24 <OutputPath>..\bin</OutputPath>
25 <DebugInformation>true</DebugInformation>
26 <RegisterComInterop>false</RegisterComInterop>
27 <IncrementalBuild>true</IncrementalBuild>
28 <BaseAddress>285212672</BaseAddress>
29 <FileAlignment>4096</FileAlignment>
30 <NoStdLib>false</NoStdLib>
31 <XmlDocFile>Docs.xml</XmlDocFile>
32 </Options>
33 </Configuration>
34 <Configuration name="Release"> <!-- You can define multple configurations that projects can have, but there is no way to define which one is selected by default as this is a part of the user preferences for a project, not the solution or project files -->
35 <Options>
36 <CompilerDefines>TRACE</CompilerDefines>
37 <OptimizeCode>true</OptimizeCode>
38 <CheckUnderflowOverflow>false</CheckUnderflowOverflow>
39 <AllowUnsafe>false</AllowUnsafe>
40 <WarningLevel>4</WarningLevel>
41 <WarningsAsErrors>false</WarningsAsErrors>
42 <SuppressWarnings>1591;219;1573;1572;168</SuppressWarnings>
43 <OutputPath>..\bin</OutputPath>
44 <DebugInformation>false</DebugInformation>
45 <RegisterComInterop>false</RegisterComInterop>
46 <IncrementalBuild>true</IncrementalBuild>
47 <BaseAddress>285212672</BaseAddress>
48 <FileAlignment>4096</FileAlignment>
49 <NoStdLib>false</NoStdLib>
50 <XmlDocFile>Docs.xml</XmlDocFile>
51 </Options>
52 </Configuration>
53
54 <!-- One of the projects that is included in the Solution -->
55 <Project name="RealmForge.Utility" path="Utility" type="Library" assemblyName="RealmForge.Utility" rootNamespace="RealmForge">
56 <Configuration name="Debug">
57 <Options>
58 <OutputPath>..\bin\lib\Utility</OutputPath>
59 <XmlDocFile>RealmForge.Utility.xml</XmlDocFile>
60 </Options>
61 </Configuration>
62 <Configuration name="Release">
63 <Options>
64 <OutputPath>..\bin\lib\Utility</OutputPath>
65 <XmlDocFile>RealmForge.Utility.xml</XmlDocFile>
66 </Options>
67 </Configuration>
68 <ReferencePath>../bin</ReferencePath>
69 <Reference name="System"/>
70 <Reference name="System.Data"/>
71 <Reference name="System.Drawing"/>
72 <Reference name="System.Xml"/>
73 <Reference name="System.Runtime.Serialization.Formatters.Soap"/>
74 <Reference name="ICSharpCode.SharpZipLib"/>
75 <Files>
76 <Match pattern="*.cs" recurse="true"/>
77 </Files>
78 </Project>
79
80 <!-- Another projects that is included in the Solution -->
81 <Project name="DemoGame" path="DemoGame" type="WinExe" icon="..\bin\RealmForge.ico" assemblyName="DemoGame" rootNamespace="RealmForge">
82 <!-- icon is used to define the location of the .ico file that is embeeded in the assembly when the project is compiled. This is relative to the project path -->
83 <!--type defines the type of project, valid types are Library (.dll), WinExe (.exe), and Exe (.exe). WinExe is not windows specific, it just defines that it is a GUI application and that no Console or Command window will show when it is started-->
84
85 <Configuration name="Debug">
86 <Options>
87 <OutputPath>..\bin</OutputPath>
88 <XmlDocFile>DemoGame.xml</XmlDocFile>
89 </Options>
90 </Configuration>
91 <Configuration name="Release">
92 <Options>
93 <OutputPath>..\bin</OutputPath>
94 <XmlDocFile>DemoGame.xml</XmlDocFile>
95 </Options>
96 </Configuration>
97 <ReferencePath>../bin</ReferencePath>
98 <Reference name="System"/> <!-- Assemblies that are located in the GAC (installed, global) can be referenced-->
99 <Reference name="ode"/> <!-- Assemblies that are located in the output directory to which the file is built can be referenced -->
100 <Reference name="RealmForge.Utility"/> <!-- When you reference the name of another project, then that project (and it's output) will be referenced instead of looking for a pre-built assembly-->
101 <Files>
102 <!-- path defaults to . or the directory that prebuild.exe resides in -->
103 <Match path="." pattern="*.cs" recurse="true"/>
104 <Match pattern="*.bmp" recurse="true" buildAction="EmbeddedResource"/>
105 <Match pattern="[^a]*\.(png|jpg)" useRegex="true" buildAction="EmbeddedResource"/>
106
107 <!-- Uses a regex or regular expression to find all files that end with .png or .jpg but dont have the letter 'a' in their name and add them to the project as EmbeddedResource's. Because recurse enabled (default is false), only the values in the files in that are directly in the project directory (not child directories) are checked.-->
108 <!--EmbeddedResource, Content, and Compile are valid buildAction's-->
109 </Files>
110 </Project>
111
112 </Solution>
113</Prebuild>
diff --git a/Prebuild/doc/prebuild-example4.xml b/Prebuild/doc/prebuild-example4.xml
new file mode 100644
index 0000000..c6c223f
--- /dev/null
+++ b/Prebuild/doc/prebuild-example4.xml
@@ -0,0 +1,715 @@
1<?xml version="1.0" encoding="utf-8" ?>
2<Prebuild xmlns="http://dnpb.sourceforge.net/schemas/prebuild-1.6.xsd" version="1.6">
3 <Solution name="SdlDotNet">
4 <Configuration name="Debug">
5 <Options>
6 <CompilerDefines>DEBUG;TRACE</CompilerDefines>
7 <OptimizeCode>false</OptimizeCode>
8 <AllowUnsafe>false</AllowUnsafe>
9 <OutputPath>bin\Debug</OutputPath>
10 <DebugInformation>true</DebugInformation>
11 <WarningLevel>4</WarningLevel>
12 <SuppressWarnings>1595</SuppressWarnings>
13 </Options>
14 </Configuration>
15 <Configuration name="Release">
16 <Options>
17 <CompilerDefines>TRACE</CompilerDefines>
18 <OptimizeCode>true</OptimizeCode>
19 <AllowUnsafe>false</AllowUnsafe>
20 <OutputPath>bin\Release</OutputPath>
21 <DebugInformation>false</DebugInformation>
22 <WarningLevel>1</WarningLevel>
23 <SuppressWarnings>1595</SuppressWarnings>
24 </Options>
25 </Configuration>
26 <Files>
27 <File buildAction="Content">SdlDotNet.build</File>
28 <File buildAction="Content">prebuild.xml</File>
29 </Files>
30 <Project name="SdlDotNet" path="src" language="C#" type="Library" assemblyName="SdlDotNet" rootNamespace="SdlDotNet">
31 <Configuration name="Debug">
32 <Options>
33 <CompilerDefines>DEBUG;TRACE</CompilerDefines>
34 <OptimizeCode>false</OptimizeCode>
35 <AllowUnsafe>false</AllowUnsafe>
36 <OutputPath>bin\Debug</OutputPath>
37 <DebugInformation>true</DebugInformation>
38 <XmlDocFile>SdlDotNet.xml</XmlDocFile>
39 <WarningLevel>4</WarningLevel>
40 <SuppressWarnings>1595</SuppressWarnings>
41 </Options>
42 </Configuration>
43 <Configuration name="Release">
44 <Options>
45 <CompilerDefines>TRACE</CompilerDefines>
46 <OptimizeCode>true</OptimizeCode>
47 <AllowUnsafe>false</AllowUnsafe>
48 <OutputPath>bin\Release</OutputPath>
49 <XmlDocFile>SdlDotNet.xml</XmlDocFile>
50 <DebugInformation>false</DebugInformation>
51 <WarningLevel>1</WarningLevel>
52 <SuppressWarnings>1595</SuppressWarnings>
53 </Options>
54 </Configuration>
55 <Reference name="System" />
56 <Reference name="System.Windows.Forms" />
57 <Reference name="System.Drawing" />
58 <Reference name="Tao.Sdl" localCopy="true" path="..\\lib"/>
59 <Files>
60 <Match path="." pattern="SurfaceControl.cs" subType="Component" recurse="true"/>
61 <Match path="." pattern="*.bmp" buildAction="EmbeddedResource" recurse="true"/>
62 <Match path="." pattern="*.cs" recurse="true">
63 <Exclude name="SurfaceControl.cs"/>
64 </Match>
65 </Files>
66 </Project>
67 <Project name="Rectangles" path="examples\\Rectangles" language="C#" type="WinExe" startupObject="SdlDotNet.Examples.Rectangles.Rectangles" assemblyName="Rectangles" rootNamespace="SdlDotNet.Examples.Rectangles" icon="App.ico">
68 <Configuration name="Debug">
69 <Options>
70 <CompilerDefines>DEBUG;TRACE</CompilerDefines>
71 <OptimizeCode>false</OptimizeCode>
72 <AllowUnsafe>false</AllowUnsafe>
73 <OutputPath>bin\Debug</OutputPath>
74 <DebugInformation>true</DebugInformation>
75 <XmlDocFile>Rectangles.xml</XmlDocFile>
76 <WarningLevel>4</WarningLevel>
77 <SuppressWarnings>1595</SuppressWarnings>
78 </Options>
79 </Configuration>
80 <Configuration name="Release">
81 <Options>
82 <CompilerDefines>TRACE</CompilerDefines>
83 <OptimizeCode>true</OptimizeCode>
84 <AllowUnsafe>false</AllowUnsafe>
85 <OutputPath>bin\Release</OutputPath>
86 <DebugInformation>false</DebugInformation>
87 <XmlDocFile>Rectangles.xml</XmlDocFile>
88 <WarningLevel>1</WarningLevel>
89 <SuppressWarnings>1595</SuppressWarnings>
90 </Options>
91 </Configuration>
92 <Reference name="System" />
93 <Reference name="System.Drawing" />
94 <Reference name="SdlDotNet" localCopy="true"/>
95 <Files>
96 <File buildAction="EmbeddedResource">App.ico</File>
97 <Match path="." pattern="*.cs" recurse="true"/>
98 </Files>
99 </Project>
100 <Project name="Gears" path="examples\\Gears" language="C#" type="WinExe" startupObject="SdlDotNet.Examples.Gears.Gears" assemblyName="Gears" rootNamespace="SdlDotNet.Examples.Gears" icon="App.ico">
101 <Configuration name="Debug">
102 <Options>
103 <CompilerDefines>DEBUG;TRACE</CompilerDefines>
104 <OptimizeCode>false</OptimizeCode>
105 <AllowUnsafe>false</AllowUnsafe>
106 <OutputPath>bin\Debug</OutputPath>
107 <DebugInformation>true</DebugInformation>
108 <XmlDocFile>Gears.xml</XmlDocFile>
109 <WarningLevel>4</WarningLevel>
110 <SuppressWarnings>1595</SuppressWarnings>
111 </Options>
112 </Configuration>
113 <Configuration name="Release">
114 <Options>
115 <CompilerDefines>TRACE</CompilerDefines>
116 <OptimizeCode>true</OptimizeCode>
117 <AllowUnsafe>false</AllowUnsafe>
118 <OutputPath>bin\Release</OutputPath>
119 <DebugInformation>false</DebugInformation>
120 <XmlDocFile>Gears.xml</XmlDocFile>
121 <WarningLevel>1</WarningLevel>
122 <SuppressWarnings>1595</SuppressWarnings>
123 </Options>
124 </Configuration>
125 <Reference name="System" />
126 <Reference name="System.Drawing" />
127 <Reference name="SdlDotNet" localCopy="true"/>
128 <Reference name="Tao.OpenGl" localCopy="true" path="..\\..\\lib"/>
129 <Files>
130 <File buildAction="EmbeddedResource">App.ico</File>
131 <Match path="." pattern="*.cs" recurse="true"/>
132 </Files>
133 </Project>
134 <Project name="CDPlayer" path="examples\\CDPlayer" language="C#" type="WinExe" startupObject="SdlDotNet.Examples.CDPlayer.CDPlayer" assemblyName="CDPlayer" rootNamespace="SdlDotNet.Examples.CDPlayer" icon="App.ico">
135 <Configuration name="Debug">
136 <Options>
137 <CompilerDefines>DEBUG;TRACE</CompilerDefines>
138 <OptimizeCode>false</OptimizeCode>
139 <AllowUnsafe>false</AllowUnsafe>
140 <OutputPath>bin\Debug</OutputPath>
141 <DebugInformation>true</DebugInformation>
142 <XmlDocFile>CDPlayer.xml</XmlDocFile>
143 <WarningLevel>4</WarningLevel>
144 <SuppressWarnings>1595</SuppressWarnings>
145 </Options>
146 </Configuration>
147 <Configuration name="Release">
148 <Options>
149 <CompilerDefines>TRACE</CompilerDefines>
150 <OptimizeCode>true</OptimizeCode>
151 <AllowUnsafe>false</AllowUnsafe>
152 <OutputPath>bin\Release</OutputPath>
153 <DebugInformation>false</DebugInformation>
154 <XmlDocFile>CDPlayer.xml</XmlDocFile>
155 <WarningLevel>1</WarningLevel>
156 <SuppressWarnings>1595</SuppressWarnings>
157 </Options>
158 </Configuration>
159 <Reference name="System" />
160 <Reference name="System.Drawing" />
161 <Reference name="System.Windows.Forms" />
162 <Reference name="SdlDotNet" localCopy="true"/>
163 <Files>
164 <File buildAction="EmbeddedResource">App.ico</File>
165 <File subType="Form">CDPlayer.cs</File>
166 <Match path="." pattern="*.cs" recurse="true">
167 <Exclude name="CDPlayer.cs"/>
168 </Match>
169 </Files>
170 </Project>
171 <Project name="MoviePlayer" path="examples\\MoviePlayer" language="C#" type="WinExe" startupObject="SdlDotNet.Examples.MoviePlayer.MoviePlayer" assemblyName="MoviePlayer" rootNamespace="SdlDotNet.Examples.MoviePlayer" icon="App.ico">
172 <Configuration name="Debug">
173 <Options>
174 <CompilerDefines>DEBUG;TRACE</CompilerDefines>
175 <OptimizeCode>false</OptimizeCode>
176 <AllowUnsafe>false</AllowUnsafe>
177 <OutputPath>bin\Debug</OutputPath>
178 <DebugInformation>true</DebugInformation>
179 <XmlDocFile>MoviePlayer.xml</XmlDocFile>
180 <WarningLevel>4</WarningLevel>
181 <SuppressWarnings>1595</SuppressWarnings>
182 </Options>
183 </Configuration>
184 <Configuration name="Release">
185 <Options>
186 <CompilerDefines>TRACE</CompilerDefines>
187 <OptimizeCode>true</OptimizeCode>
188 <AllowUnsafe>false</AllowUnsafe>
189 <OutputPath>bin\Release</OutputPath>
190 <DebugInformation>false</DebugInformation>
191 <XmlDocFile>MoviePlayer.xml</XmlDocFile>
192 <WarningLevel>1</WarningLevel>
193 <SuppressWarnings>1595</SuppressWarnings>
194 </Options>
195 </Configuration>
196 <Reference name="System" />
197 <Reference name="System.Drawing" />
198 <Reference name="SdlDotNet" localCopy="true"/>
199 <Files>
200 <File buildAction="EmbeddedResource">App.ico</File>
201 <Match path="." pattern="*.cs" recurse="true"/>
202 </Files>
203 </Project>
204 <Project name="SimpleGame" path="examples\\SimpleGame" language="C#" type="WinExe" startupObject="SdlDotNet.Examples.SimpleGame.GameMain" assemblyName="SimpleGame" rootNamespace="SdlDotNet.Examples.SimpleGame" icon="App.ico">
205 <Configuration name="Debug">
206 <Options>
207 <CompilerDefines>DEBUG;TRACE</CompilerDefines>
208 <OptimizeCode>false</OptimizeCode>
209 <AllowUnsafe>false</AllowUnsafe>
210 <OutputPath>bin\Debug</OutputPath>
211 <DebugInformation>true</DebugInformation>
212 <XmlDocFile>SimpleGame.xml</XmlDocFile>
213 <WarningLevel>4</WarningLevel>
214 <SuppressWarnings>1595</SuppressWarnings>
215 </Options>
216 </Configuration>
217 <Configuration name="Release">
218 <Options>
219 <CompilerDefines>TRACE</CompilerDefines>
220 <OptimizeCode>true</OptimizeCode>
221 <AllowUnsafe>false</AllowUnsafe>
222 <OutputPath>bin\Release</OutputPath>
223 <DebugInformation>false</DebugInformation>
224 <XmlDocFile>SimpleGame.xml</XmlDocFile>
225 <WarningLevel>1</WarningLevel>
226 <SuppressWarnings>1595</SuppressWarnings>
227 </Options>
228 </Configuration>
229 <Reference name="System" />
230 <Reference name="System.Drawing" />
231 <Reference name="SdlDotNet" localCopy="true"/>
232 <Files>
233 <File buildAction="EmbeddedResource">App.ico</File>
234 <Match path="." pattern="*.cs" recurse="true"/>
235 </Files>
236 </Project>
237 <Project name="BombRun" path="examples\\BombRun" language="C#" type="WinExe" startupObject="SdlDotNet.Examples.BombRun.BombRun" assemblyName="BombRun" rootNamespace="SdlDotNet.Examples.BombRun" icon="App.ico">
238 <Configuration name="Debug">
239 <Options>
240 <CompilerDefines>DEBUG;TRACE</CompilerDefines>
241 <OptimizeCode>false</OptimizeCode>
242 <AllowUnsafe>false</AllowUnsafe>
243 <OutputPath>bin\Debug</OutputPath>
244 <DebugInformation>true</DebugInformation>
245 <XmlDocFile>BombRun.xml</XmlDocFile>
246 <WarningLevel>4</WarningLevel>
247 <SuppressWarnings>1595</SuppressWarnings>
248 </Options>
249 </Configuration>
250 <Configuration name="Release">
251 <Options>
252 <CompilerDefines>TRACE</CompilerDefines>
253 <OptimizeCode>true</OptimizeCode>
254 <AllowUnsafe>false</AllowUnsafe>
255 <OutputPath>bin\Release</OutputPath>
256 <DebugInformation>false</DebugInformation>
257 <XmlDocFile>BombRun.xml</XmlDocFile>
258 <WarningLevel>1</WarningLevel>
259 <SuppressWarnings>1595</SuppressWarnings>
260 </Options>
261 </Configuration>
262 <Reference name="System" />
263 <Reference name="System.Drawing" />
264 <Reference name="SdlDotNet" localCopy="true"/>
265 <Files>
266 <File buildAction="EmbeddedResource">App.ico</File>
267 <Match path="." pattern="*.cs" recurse="true"/>
268 </Files>
269 </Project>
270 <Project name="SnowDemo" path="examples\\SnowDemo" language="C#" type="WinExe" startupObject="SdlDotNet.Examples.SnowDemo.SnowDemo" assemblyName="SnowDemo" rootNamespace="SdlDotNet.Examples.SnowDemo" icon="App.ico">
271 <Configuration name="Debug">
272 <Options>
273 <CompilerDefines>DEBUG;TRACE</CompilerDefines>
274 <OptimizeCode>false</OptimizeCode>
275 <AllowUnsafe>false</AllowUnsafe>
276 <OutputPath>bin\Debug</OutputPath>
277 <DebugInformation>true</DebugInformation>
278 <XmlDocFile>SnowDemo.xml</XmlDocFile>
279 <WarningLevel>4</WarningLevel>
280 <SuppressWarnings>1595</SuppressWarnings>
281 </Options>
282 </Configuration>
283 <Configuration name="Release">
284 <Options>
285 <CompilerDefines>TRACE</CompilerDefines>
286 <OptimizeCode>true</OptimizeCode>
287 <AllowUnsafe>false</AllowUnsafe>
288 <OutputPath>bin\Release</OutputPath>
289 <DebugInformation>false</DebugInformation>
290 <XmlDocFile>SnowDemo.xml</XmlDocFile>
291 <WarningLevel>1</WarningLevel>
292 <SuppressWarnings>1595</SuppressWarnings>
293 </Options>
294 </Configuration>
295 <Reference name="System" />
296 <Reference name="System.Drawing" />
297 <Reference name="SdlDotNet" localCopy="true"/>
298 <Files>
299 <File buildAction="EmbeddedResource">App.ico</File>
300 <Match path="." pattern="*.cs" recurse="true"/>
301 </Files>
302 </Project>
303 <Project name="BounceSprites" path="examples\\BounceSprites" language="C#" type="WinExe" startupObject="SdlDotNet.Examples.BounceSprites.BounceSprites" assemblyName="BounceSprites" rootNamespace="SdlDotNet.Examples.BounceSprites" icon="App.ico">
304 <Configuration name="Debug">
305 <Options>
306 <CompilerDefines>DEBUG;TRACE</CompilerDefines>
307 <OptimizeCode>false</OptimizeCode>
308 <AllowUnsafe>false</AllowUnsafe>
309 <OutputPath>bin\Debug</OutputPath>
310 <DebugInformation>true</DebugInformation>
311 <XmlDocFile>BounceSprites.xml</XmlDocFile>
312 <WarningLevel>4</WarningLevel>
313 <SuppressWarnings>1595</SuppressWarnings>
314 </Options>
315 </Configuration>
316 <Configuration name="Release">
317 <Options>
318 <CompilerDefines>TRACE</CompilerDefines>
319 <OptimizeCode>true</OptimizeCode>
320 <AllowUnsafe>false</AllowUnsafe>
321 <OutputPath>bin\Release</OutputPath>
322 <DebugInformation>false</DebugInformation>
323 <XmlDocFile>BounceSprites.xml</XmlDocFile>
324 <WarningLevel>1</WarningLevel>
325 <SuppressWarnings>1595</SuppressWarnings>
326 </Options>
327 </Configuration>
328 <Reference name="System" />
329 <Reference name="System.Drawing" />
330 <Reference name="SdlDotNet" localCopy="true"/>
331 <Files>
332 <File buildAction="EmbeddedResource">App.ico</File>
333 <Match path="." pattern="*.cs" recurse="true"/>
334 </Files>
335 </Project>
336 <Project name="Triad" path="examples\\Triad" language="C#" type="WinExe" startupObject="SdlDotNet.Examples.Triad.MainObject" assemblyName="Triad" rootNamespace="SdlDotNet.Examples.Triad" icon="App.ico">
337 <Configuration name="Debug">
338 <Options>
339 <CompilerDefines>DEBUG;TRACE</CompilerDefines>
340 <OptimizeCode>false</OptimizeCode>
341 <AllowUnsafe>false</AllowUnsafe>
342 <OutputPath>bin\Debug</OutputPath>
343 <DebugInformation>true</DebugInformation>
344 <XmlDocFile>Triad.xml</XmlDocFile>
345 <WarningLevel>4</WarningLevel>
346 <SuppressWarnings>1595</SuppressWarnings>
347 </Options>
348 </Configuration>
349 <Configuration name="Release">
350 <Options>
351 <CompilerDefines>TRACE</CompilerDefines>
352 <OptimizeCode>true</OptimizeCode>
353 <AllowUnsafe>false</AllowUnsafe>
354 <OutputPath>bin\Release</OutputPath>
355 <DebugInformation>false</DebugInformation>
356 <XmlDocFile>Triad.xml</XmlDocFile>
357 <WarningLevel>1</WarningLevel>
358 <SuppressWarnings>1595</SuppressWarnings>
359 </Options>
360 </Configuration>
361 <Reference name="System" />
362 <Reference name="System.Drawing" />
363 <Reference name="SdlDotNet" localCopy="true"/>
364 <Reference name="nunit.framework" localCopy="true" path="..\\..\\lib"/>
365 <Files>
366 <File buildAction="EmbeddedResource">App.ico</File>
367 <Match path="." pattern="*.cs" recurse="true"/>
368 </Files>
369 </Project>
370 <Project name="GuiExample" path="examples\\GuiExample" language="C#" type="Library" assemblyName="GuiExample" rootNamespace="SdlDotNet.Examples.GuiExample">
371 <Configuration name="Debug">
372 <Options>
373 <CompilerDefines>DEBUG;TRACE</CompilerDefines>
374 <OptimizeCode>false</OptimizeCode>
375 <AllowUnsafe>false</AllowUnsafe>
376 <OutputPath>bin\Debug</OutputPath>
377 <DebugInformation>true</DebugInformation>
378 <XmlDocFile>GuiExample.xml</XmlDocFile>
379 <WarningLevel>4</WarningLevel>
380 <SuppressWarnings>1595</SuppressWarnings>
381 </Options>
382 </Configuration>
383 <Configuration name="Release">
384 <Options>
385 <CompilerDefines>TRACE</CompilerDefines>
386 <OptimizeCode>true</OptimizeCode>
387 <AllowUnsafe>false</AllowUnsafe>
388 <OutputPath>bin\Release</OutputPath>
389 <DebugInformation>false</DebugInformation>
390 <XmlDocFile>GuiExample.xml</XmlDocFile>
391 <WarningLevel>1</WarningLevel>
392 <SuppressWarnings>1595</SuppressWarnings>
393 </Options>
394 </Configuration>
395 <Reference name="System" />
396 <Reference name="System.Drawing" />
397 <Reference name="SdlDotNet" localCopy="true"/>
398 <Files>
399 <Match path="." pattern="*.cs" recurse="true"/>
400 </Files>
401 </Project>
402 <Project name="SpriteGuiDemos" path="examples\\SpriteGuiDemos" language="C#" type="WinExe" startupObject="SdlDotNet.Examples.SpriteGuiDemos.SdlDemo" assemblyName="SpriteGuiDemo" rootNamespace="SdlDotNet.Examples.SpriteGuiDemos" icon="App.ico">
403 <Configuration name="Debug">
404 <Options>
405 <CompilerDefines>DEBUG;TRACE</CompilerDefines>
406 <OptimizeCode>false</OptimizeCode>
407 <AllowUnsafe>false</AllowUnsafe>
408 <OutputPath>bin\Debug</OutputPath>
409 <DebugInformation>true</DebugInformation>
410 <XmlDocFile>SpriteGuiDemos.xml</XmlDocFile>
411 <WarningLevel>4</WarningLevel>
412 <SuppressWarnings>1595</SuppressWarnings>
413 </Options>
414 </Configuration>
415 <Configuration name="Release">
416 <Options>
417 <CompilerDefines>TRACE</CompilerDefines>
418 <OptimizeCode>true</OptimizeCode>
419 <AllowUnsafe>false</AllowUnsafe>
420 <OutputPath>bin\Release</OutputPath>
421 <DebugInformation>false</DebugInformation>
422 <XmlDocFile>SpriteGuiDemos.xml</XmlDocFile>
423 <WarningLevel>1</WarningLevel>
424 <SuppressWarnings>1595</SuppressWarnings>
425 </Options>
426 </Configuration>
427 <Reference name="System" />
428 <Reference name="System.Drawing" />
429 <Reference name="SdlDotNet" localCopy="true"/>
430 <Reference name="GuiExample" localCopy="true"/>
431 <Files>
432 <File buildAction="EmbeddedResource">App.ico</File>
433 <Match path="." pattern="*.cs" recurse="true"/>
434 </Files>
435 </Project>
436 <Project name="Tests" path="tests" language="C#" type="Library" assemblyName="SdlDotNet.Tests" rootNamespace="SdlDotNet.Tests">
437 <Configuration name="Debug">
438 <Options>
439 <CompilerDefines>DEBUG;TRACE</CompilerDefines>
440 <OptimizeCode>false</OptimizeCode>
441 <AllowUnsafe>false</AllowUnsafe>
442 <OutputPath>bin\Debug</OutputPath>
443 <DebugInformation>true</DebugInformation>
444 <XmlDocFile>SdlDotNet.Tests.xml</XmlDocFile>
445 <WarningLevel>4</WarningLevel>
446 <SuppressWarnings>1595</SuppressWarnings>
447 </Options>
448 </Configuration>
449 <Configuration name="Release">
450 <Options>
451 <CompilerDefines>TRACE</CompilerDefines>
452 <OptimizeCode>true</OptimizeCode>
453 <AllowUnsafe>false</AllowUnsafe>
454 <OutputPath>bin\Release</OutputPath>
455 <DebugInformation>false</DebugInformation>
456 <XmlDocFile>SdlDotNet.Tests.xml</XmlDocFile>
457 <WarningLevel>1</WarningLevel>
458 <SuppressWarnings>1595</SuppressWarnings>
459 </Options>
460 </Configuration>
461 <Reference name="System" />
462 <Reference name="System.Drawing" />
463 <Reference name="SdlDotNet" localCopy="true"/>
464 <Reference name="Tao.Sdl" localCopy="true" path="..\\lib"/>
465 <Reference name="GuiExample" localCopy="true"/>
466 <Reference name="nunit.framework" localCopy="true" path="..\\lib"/>
467 <Files>
468 <Match path="." pattern="*.cs" recurse="true"/>
469 </Files>
470 </Project>
471 <Project name="AudioExample" path="examples\\AudioExample" language="C#" type="WinExe" startupObject="SdlDotNet.Examples.AudioExample.AudioExample" assemblyName="AudioExample" rootNamespace="SdlDotNet.Examples.AudioExample" icon="App.ico">
472 <Configuration name="Debug">
473 <Options>
474 <CompilerDefines>DEBUG;TRACE</CompilerDefines>
475 <OptimizeCode>false</OptimizeCode>
476 <AllowUnsafe>false</AllowUnsafe>
477 <OutputPath>bin\Debug</OutputPath>
478 <DebugInformation>true</DebugInformation>
479 <XmlDocFile>AudioExample.xml</XmlDocFile>
480 <WarningLevel>4</WarningLevel>
481 <SuppressWarnings>1595</SuppressWarnings>
482 </Options>
483 </Configuration>
484 <Configuration name="Release">
485 <Options>
486 <CompilerDefines>TRACE</CompilerDefines>
487 <OptimizeCode>true</OptimizeCode>
488 <AllowUnsafe>false</AllowUnsafe>
489 <OutputPath>bin\Release</OutputPath>
490 <DebugInformation>false</DebugInformation>
491 <XmlDocFile>AudioExample.xml</XmlDocFile>
492 <WarningLevel>1</WarningLevel>
493 <SuppressWarnings>1595</SuppressWarnings>
494 </Options>
495 </Configuration>
496 <Reference name="System" />
497 <Reference name="System.Drawing" />
498 <Reference name="SdlDotNet" localCopy="true"/>
499 <Files>
500 <File buildAction="EmbeddedResource">App.ico</File>
501 <Match path="." pattern="*.cs" recurse="true"/>
502 </Files>
503 </Project>
504 <Project name="SdlDotNet.Particles" path="extras\\Particles" language="C#" type="Library" assemblyName="SdlDotNet.Particles" rootNamespace="SdlDotNet.Particles">
505 <Configuration name="Debug">
506 <Options>
507 <CompilerDefines>DEBUG;TRACE</CompilerDefines>
508 <OptimizeCode>false</OptimizeCode>
509 <AllowUnsafe>false</AllowUnsafe>
510 <OutputPath>bin\Debug</OutputPath>
511 <DebugInformation>true</DebugInformation>
512 <XmlDocFile>SdlDotNet.Particles.xml</XmlDocFile>
513 <WarningLevel>4</WarningLevel>
514 <SuppressWarnings>1595</SuppressWarnings>
515 </Options>
516 </Configuration>
517 <Configuration name="Release">
518 <Options>
519 <CompilerDefines>TRACE</CompilerDefines>
520 <OptimizeCode>true</OptimizeCode>
521 <AllowUnsafe>false</AllowUnsafe>
522 <OutputPath>bin\Release</OutputPath>
523 <DebugInformation>false</DebugInformation>
524 <XmlDocFile>SdlDotNet.Particles.xml</XmlDocFile>
525 <WarningLevel>1</WarningLevel>
526 <SuppressWarnings>1595</SuppressWarnings>
527 </Options>
528 </Configuration>
529 <Reference name="System" />
530 <Reference name="System.Drawing" />
531 <Reference name="SdlDotNet" localCopy="true"/>
532 <Files>
533 <Match path="." pattern="*.cs" recurse="true"/>
534 </Files>
535 </Project>
536 <Project name="ParticlesExample" path="examples\\ParticlesExample" language="C#" type="WinExe" startupObject="SdlDotNet.Examples.ParticlesExample.ParticlesExample" assemblyName="ParticlesExample" rootNamespace="SdlDotNet.Examples.ParticlesExample" icon="App.ico">
537 <Configuration name="Debug">
538 <Options>
539 <CompilerDefines>DEBUG;TRACE</CompilerDefines>
540 <OptimizeCode>false</OptimizeCode>
541 <AllowUnsafe>false</AllowUnsafe>
542 <OutputPath>bin\Debug</OutputPath>
543 <DebugInformation>true</DebugInformation>
544 <XmlDocFile>ParticlesExample.xml</XmlDocFile>
545 <WarningLevel>4</WarningLevel>
546 <SuppressWarnings>1595</SuppressWarnings>
547 </Options>
548 </Configuration>
549 <Configuration name="Release">
550 <Options>
551 <CompilerDefines>TRACE</CompilerDefines>
552 <OptimizeCode>true</OptimizeCode>
553 <AllowUnsafe>false</AllowUnsafe>
554 <OutputPath>bin\Release</OutputPath>
555 <DebugInformation>false</DebugInformation>
556 <XmlDocFile>ParticlesExample.xml</XmlDocFile>
557 <WarningLevel>1</WarningLevel>
558 <SuppressWarnings>1595</SuppressWarnings>
559 </Options>
560 </Configuration>
561 <Reference name="System" />
562 <Reference name="System.Drawing" />
563 <Reference name="SdlDotNet" localCopy="true"/>
564 <Reference name="SdlDotNet.Particles" localCopy="true"/>
565 <Files>
566 <File buildAction="EmbeddedResource">App.ico</File>
567 <Match path="." pattern="*.cs" recurse="true"/>
568 </Files>
569 </Project>
570 <!--<Project name="SdlDotNet.Gui" path="extras\\Gui" language="C#" type="Library" assemblyName="SdlDotNet.Gui" rootNamespace="SdlDotNet.Gui">
571 <Configuration name="Debug">
572 <Options>
573 <CompilerDefines>DEBUG;TRACE</CompilerDefines>
574 <OptimizeCode>false</OptimizeCode>
575 <AllowUnsafe>false</AllowUnsafe>
576 <OutputPath>bin\Debug</OutputPath>
577 <DebugInformation>true</DebugInformation>
578 <XmlDocFile>SdlDotNet.Gui.xml</XmlDocFile>
579 <WarningLevel>4</WarningLevel>
580 </Options>
581 </Configuration>
582 <Configuration name="Release">
583 <Options>
584 <CompilerDefines>TRACE</CompilerDefines>
585 <OptimizeCode>true</OptimizeCode>
586 <AllowUnsafe>false</AllowUnsafe>
587 <OutputPath>bin\Release</OutputPath>
588 <DebugInformation>false</DebugInformation>
589 <XmlDocFile>SdlDotNet.Gui.xml</XmlDocFile>
590 <WarningLevel>1</WarningLevel>
591 </Options>
592 </Configuration>
593 <Reference name="System" />
594 <Reference name="System.Drawing" />
595 <Reference name="SdlDotNet" localCopy="true"/>
596 <Files>
597 <Match path="." pattern="*.cs" recurse="true"/>
598 </Files>
599 </Project>-->
600 <Project name="NeHe" path="examples\\NeHe" language="C#" type="WinExe" startupObject="SdlDotNet.Examples.NeHe.NeHe" assemblyName="NeHe" rootNamespace="SdlDotNet.Examples.NeHe" icon="App.ico">
601 <Configuration name="Debug">
602 <Options>
603 <CompilerDefines>DEBUG;TRACE</CompilerDefines>
604 <OptimizeCode>false</OptimizeCode>
605 <AllowUnsafe>false</AllowUnsafe>
606 <OutputPath>bin\Debug</OutputPath>
607 <DebugInformation>true</DebugInformation>
608 <XmlDocFile>NeHe.xml</XmlDocFile>
609 <WarningLevel>4</WarningLevel>
610 <SuppressWarnings>1595</SuppressWarnings>
611 </Options>
612 </Configuration>
613 <Configuration name="Release">
614 <Options>
615 <CompilerDefines>TRACE</CompilerDefines>
616 <OptimizeCode>true</OptimizeCode>
617 <AllowUnsafe>false</AllowUnsafe>
618 <OutputPath>bin\Release</OutputPath>
619 <DebugInformation>false</DebugInformation>
620 <XmlDocFile>NeHe.xml</XmlDocFile>
621 <WarningLevel>1</WarningLevel>
622 <SuppressWarnings>1595</SuppressWarnings>
623 </Options>
624 </Configuration>
625 <Reference name="System" />
626 <Reference name="System.Drawing" />
627 <Reference name="System.Windows.Forms" />
628 <Reference name="SdlDotNet" localCopy="true"/>
629 <Reference name="Tao.OpenGl" localCopy="true" path="..\\..\\lib"/>
630 <Reference name="Tao.OpenGl.Glu" localCopy="true" path="..\\..\\lib"/>
631 <Reference name="Tao.Platform.Windows" localCopy="true" path="..\\..\\lib"/>
632 <Files>
633 <File buildAction="EmbeddedResource">App.ico</File>
634 <File subType="Form">NeHe.cs</File>
635 <Match path="." pattern="*.cs" recurse="true">
636 <Exclude name="NeHe.cs"/>
637 </Match>
638 </Files>
639 </Project>
640 <Project name="RedBook" path="examples\\RedBook" language="C#" type="WinExe" startupObject="SdlDotNet.Examples.RedBook.RedBook" assemblyName="RedBook" rootNamespace="SdlDotNet.Examples.RedBook" icon="App.ico">
641 <Configuration name="Debug">
642 <Options>
643 <CompilerDefines>DEBUG;TRACE</CompilerDefines>
644 <OptimizeCode>false</OptimizeCode>
645 <AllowUnsafe>false</AllowUnsafe>
646 <OutputPath>bin\Debug</OutputPath>
647 <DebugInformation>true</DebugInformation>
648 <XmlDocFile>RedBook.xml</XmlDocFile>
649 <WarningLevel>4</WarningLevel>
650 <SuppressWarnings>1595</SuppressWarnings>
651 </Options>
652 </Configuration>
653 <Configuration name="Release">
654 <Options>
655 <CompilerDefines>TRACE</CompilerDefines>
656 <OptimizeCode>true</OptimizeCode>
657 <AllowUnsafe>false</AllowUnsafe>
658 <OutputPath>bin\Release</OutputPath>
659 <DebugInformation>false</DebugInformation>
660 <XmlDocFile>RedBook.xml</XmlDocFile>
661 <WarningLevel>1</WarningLevel>
662 <SuppressWarnings>1595</SuppressWarnings>
663 </Options>
664 </Configuration>
665 <Reference name="System" />
666 <Reference name="System.Drawing" />
667 <Reference name="System.Windows.Forms" />
668 <Reference name="SdlDotNet" localCopy="true"/>
669 <Reference name="Tao.OpenGl" localCopy="true" path="..\\..\\lib"/>
670 <Reference name="Tao.OpenGl.Glu" localCopy="true" path="..\\..\\lib"/>
671 <Reference name="Tao.FreeGlut" localCopy="true" path="..\\..\\lib"/>
672 <Files>
673 <File buildAction="EmbeddedResource">App.ico</File>
674 <File subType="Form">RedBook.cs</File>
675 <Match path="." pattern="*.cs" recurse="true">
676 <Exclude name="RedBook.cs" />
677 </Match>
678 </Files>
679 </Project>
680 <Project name="PhysFsTest" path="examples\\PhysFsTest" language="C#" type="WinExe" startupObject="SdlDotNet.Examples.PhysFsTest.PhysFsTest" assemblyName="PhysFsTest" rootNamespace="SdlDotNet.Examples.PhysFsTest" icon="App.ico">
681 <Configuration name="Debug">
682 <Options>
683 <CompilerDefines>DEBUG;TRACE</CompilerDefines>
684 <OptimizeCode>false</OptimizeCode>
685 <AllowUnsafe>false</AllowUnsafe>
686 <OutputPath>bin\Debug</OutputPath>
687 <DebugInformation>true</DebugInformation>
688 <XmlDocFile>PhysFsTest.xml</XmlDocFile>
689 <WarningLevel>4</WarningLevel>
690 <SuppressWarnings>1595</SuppressWarnings>
691 </Options>
692 </Configuration>
693 <Configuration name="Release">
694 <Options>
695 <CompilerDefines>TRACE</CompilerDefines>
696 <OptimizeCode>true</OptimizeCode>
697 <AllowUnsafe>false</AllowUnsafe>
698 <OutputPath>bin\Release</OutputPath>
699 <DebugInformation>false</DebugInformation>
700 <XmlDocFile>PhysFsTest.xml</XmlDocFile>
701 <WarningLevel>1</WarningLevel>
702 <SuppressWarnings>1595</SuppressWarnings>
703 </Options>
704 </Configuration>
705 <Reference name="System" />
706 <Reference name="System.Drawing" />
707 <Reference name="SdlDotNet" localCopy="true"/>
708 <Reference name="Tao.PhysFs" localCopy="true" path="..\\..\\lib"/>
709 <Files>
710 <File buildAction="EmbeddedResource">App.ico</File>
711 <Match path="." pattern="*.cs" recurse="true"/>
712 </Files>
713 </Project>
714 </Solution>
715</Prebuild>
diff --git a/Prebuild/doc/prebuild-example5.xml b/Prebuild/doc/prebuild-example5.xml
new file mode 100644
index 0000000..5221547
--- /dev/null
+++ b/Prebuild/doc/prebuild-example5.xml
@@ -0,0 +1,187 @@
1<?xml version="1.0" encoding="utf-8" ?>
2<Prebuild xmlns="http://dnpb.sourceforge.net/schemas/prebuild-1.6.xsd" version="1.6">
3 <Solution name="Tao.Sdl">
4 <Configuration name="Debug">
5 <Options>
6 <CompilerDefines>DEBUG;TRACE;WIN32</CompilerDefines>
7 <OptimizeCode>false</OptimizeCode>
8 <AllowUnsafe>true</AllowUnsafe>
9 <OutputPath>bin\Debug</OutputPath>
10 <XmlDocFile>Tao.Sdl.xml</XmlDocFile>
11 <DebugInformation>true</DebugInformation>
12 </Options>
13 </Configuration>
14 <Configuration name="Release">
15 <Options>
16 <CompilerDefines>TRACE;WIN32</CompilerDefines>
17 <OptimizeCode>true</OptimizeCode>
18 <AllowUnsafe>true</AllowUnsafe>
19 <OutputPath>bin\Release</OutputPath>
20 <XmlDocFile>Tao.Sdl.xml</XmlDocFile>
21 <DebugInformation>false</DebugInformation>
22 </Options>
23 </Configuration>
24 <Files>
25 <File>Tao.Sdl.License.txt</File>
26 <File>Tao.Sdl.Readme.txt</File>
27 <File>Tao.Sdl.snk</File>
28 <File>Tao.Sdl.dll.config</File>
29 </Files>
30 <Project name="Tao.Sdl" path="." language="C#" type="Library">
31 <Reference name="System" />
32 <Files>
33 <File>AssemblyInfo.cs</File>
34 <File>Sdl.cs</File>
35 <File>SdlImage.cs</File>
36 <File>SdlMixer.cs</File>
37 <File>SdlTtf.cs</File>
38 <File>SdlNet.cs</File>
39 <File>SdlGfx.cs</File>
40 <File>Smpeg.cs</File>
41 <File>DelegateCallingConventionCdeclAttribute.cs</File>
42 </Files>
43 </Project>
44 <Project name="Tao.Sdl.Tests" path="..\\..\\tests\\Sdl\\" language="C#" type="Library">
45 <Configuration name="Debug">
46 <Options>
47 <CompilerDefines>DEBUG;TRACE;WIN32</CompilerDefines>
48 <OptimizeCode>false</OptimizeCode>
49 <AllowUnsafe>false</AllowUnsafe>
50 <OutputPath>bin\Debug</OutputPath>
51 <XmlDocFile>Tao.Sdl.Tests.xml</XmlDocFile>
52 <DebugInformation>true</DebugInformation>
53 </Options>
54 </Configuration>
55 <Configuration name="Release">
56 <Options>
57 <CompilerDefines>TRACE;WIN32</CompilerDefines>
58 <OptimizeCode>true</OptimizeCode>
59 <AllowUnsafe>false</AllowUnsafe>
60 <OutputPath>bin\Release</OutputPath>
61 <XmlDocFile>Tao.Sdl.Tests.xml</XmlDocFile>
62 <DebugInformation>false</DebugInformation>
63 </Options>
64 </Configuration>
65 <Reference name="System" />
66 <Reference name="nunit.framework.dll"/>
67 <Reference name="Tao.Sdl" />
68 <Files>
69 <File>AssemblyInfo.cs</File>
70 <File>SdlTest.cs</File>
71 <File>SdlTestVideo.cs</File>
72 <File>SdlTestImage.cs</File>
73 <File>SdlTestTtf.cs</File>
74 <File>SdlTestMixer.cs</File>
75 <File>SdlTestGfx.cs</File>
76 <File>SmpegTest.cs</File>
77 </Files>
78 </Project>
79 <Project name="SdlExamples.Rectangles" path="..\\..\\examples\\SdlExamples\\Rectangles" language="C#" type="WinExe" startupObject="SdlExamples.Rectangles">
80 <Configuration name="Debug">
81 <Options>
82 <CompilerDefines>DEBUG;TRACE;WIN32</CompilerDefines>
83 <OptimizeCode>false</OptimizeCode>
84 <AllowUnsafe>false</AllowUnsafe>
85 <OutputPath>bin\Debug</OutputPath>
86 <DebugInformation>true</DebugInformation>
87 </Options>
88 </Configuration>
89 <Configuration name="Release">
90 <Options>
91 <CompilerDefines>TRACE;WIN32</CompilerDefines>
92 <OptimizeCode>true</OptimizeCode>
93 <AllowUnsafe>false</AllowUnsafe>
94 <OutputPath>bin\Release</OutputPath>
95 <DebugInformation>false</DebugInformation>
96 </Options>
97 </Configuration>
98 <Reference name="System" />
99 <Reference name="Tao.Sdl" />
100 <Files>
101 <File>AssemblyInfo.cs</File>
102 <File>Rectangles.cs</File>
103 </Files>
104 </Project>
105 <Project name="SdlExamples.SmpegPlayer" path="..\\..\\examples\\SdlExamples\\SmpegPlayer" language="C#" type="WinExe" startupObject="SdlExamples.SmpegPlayer">
106 <Configuration name="Debug">
107 <Options>
108 <CompilerDefines>DEBUG;TRACE;WIN32</CompilerDefines>
109 <OptimizeCode>false</OptimizeCode>
110 <AllowUnsafe>false</AllowUnsafe>
111 <OutputPath>bin\Debug</OutputPath>
112 <DebugInformation>true</DebugInformation>
113 </Options>
114 </Configuration>
115 <Configuration name="Release">
116 <Options>
117 <CompilerDefines>TRACE;WIN32</CompilerDefines>
118 <OptimizeCode>true</OptimizeCode>
119 <AllowUnsafe>false</AllowUnsafe>
120 <OutputPath>bin\Release</OutputPath>
121 <DebugInformation>false</DebugInformation>
122 </Options>
123 </Configuration>
124 <Reference name="System" />
125 <Reference name="Tao.Sdl" />
126 <Files>
127 <File>AssemblyInfo.cs</File>
128 <File>SmpegPlayer.cs</File>
129 </Files>
130 </Project>
131 <Project name="SdlExamples.GfxPrimitives" path="..\\..\\examples\\SdlExamples\\GfxPrimitives" language="C#" type="WinExe" startupObject="SdlExamples.GfxPrimitives">
132 <Configuration name="Debug">
133 <Options>
134 <CompilerDefines>DEBUG;TRACE;WIN32</CompilerDefines>
135 <OptimizeCode>false</OptimizeCode>
136 <AllowUnsafe>false</AllowUnsafe>
137 <OutputPath>bin\Debug</OutputPath>
138 <DebugInformation>true</DebugInformation>
139 </Options>
140 </Configuration>
141 <Configuration name="Release">
142 <Options>
143 <CompilerDefines>TRACE;WIN32</CompilerDefines>
144 <OptimizeCode>true</OptimizeCode>
145 <AllowUnsafe>false</AllowUnsafe>
146 <OutputPath>bin\Release</OutputPath>
147 <DebugInformation>false</DebugInformation>
148 </Options>
149 </Configuration>
150 <Reference name="System" />
151 <Reference name="Tao.Sdl" />
152 <Files>
153 <File>AssemblyInfo.cs</File>
154 <File>GfxPrimitives.cs</File>
155 </Files>
156 </Project>
157 <Project name="Tao.PostProcess" path="..\\Tao.PostProcess\\" language="C#" type="Exe">
158 <Configuration name="Debug">
159 <Options>
160 <CompilerDefines>DEBUG;TRACE;WIN32</CompilerDefines>
161 <OptimizeCode>false</OptimizeCode>
162 <AllowUnsafe>false</AllowUnsafe>
163 <OutputPath>bin\Debug</OutputPath>
164 <DebugInformation>true</DebugInformation>
165 </Options>
166 </Configuration>
167 <Configuration name="Release">
168 <Options>
169 <CompilerDefines>TRACE;WIN32</CompilerDefines>
170 <OptimizeCode>true</OptimizeCode>
171 <AllowUnsafe>false</AllowUnsafe>
172 <OutputPath>bin\Release</OutputPath>
173 <DebugInformation>false</DebugInformation>
174 </Options>
175 </Configuration>
176 <Reference name="System" />
177 <Files>
178 <File>AssemblyInfo.cs</File>
179 <File>AppMain.cs</File>
180 <File>BuildProcessor.cs</File>
181 <File>Options.cs</File>
182 <File>ReleaseBuildProcessor.cs</File>
183 <File>UsageHelp.cs</File>
184 </Files>
185 </Project>
186 </Solution>
187</Prebuild>
diff --git a/Prebuild/prebuild b/Prebuild/prebuild
new file mode 100644
index 0000000..0dc648d
--- /dev/null
+++ b/Prebuild/prebuild
@@ -0,0 +1,2 @@
1#!/bin/sh
2exec mono [PREFIX]/prebuild.exe "$@"
diff --git a/Prebuild/prebuild.xml b/Prebuild/prebuild.xml
new file mode 100644
index 0000000..e1506f3
--- /dev/null
+++ b/Prebuild/prebuild.xml
@@ -0,0 +1,57 @@
1<?xml version="1.0" encoding="utf-8" ?>
2<Prebuild xmlns="http://dnpb.sourceforge.net/schemas/prebuild-1.7.xsd" version="1.7">
3 <Solution name="Prebuild">
4 <Configuration name="Debug">
5 <Options>
6 <CompilerDefines>DEBUG;TRACE</CompilerDefines>
7 <OptimizeCode>false</OptimizeCode>
8 <OutputPath>bin/Debug</OutputPath>
9 <DebugInformation>true</DebugInformation>
10 <SuppressWarnings>1595</SuppressWarnings>
11 </Options>
12 </Configuration>
13 <Configuration name="Release">
14 <Options>
15 <CompilerDefines>TRACE</CompilerDefines>
16 <OutputPath>bin/Release</OutputPath>
17 <OptimizeCode>true</OptimizeCode>
18 <DebugInformation>false</DebugInformation>
19 <SuppressWarnings>1595</SuppressWarnings>
20 </Options>
21 </Configuration>
22 <Files>
23 <File>prebuild.xml</File>
24 <File>prebuild</File>
25 </Files>
26 <Project name="Prebuild" path="src" language="C#" assemblyName="prebuild" icon="App.ico" type="Exe" rootNamespace="Prebuild" startupObject="Prebuild.Prebuild">
27 <Configuration name="Debug">
28 <Options>
29 <CompilerDefines>DEBUG;TRACE</CompilerDefines>
30 <OptimizeCode>false</OptimizeCode>
31 <OutputPath>bin/Debug</OutputPath>
32 <DebugInformation>true</DebugInformation>
33 <KeyFile>Prebuild.snk</KeyFile>
34 <SuppressWarnings>1595</SuppressWarnings>
35 </Options>
36 </Configuration>
37 <Configuration name="Release">
38 <Options>
39 <CompilerDefines>TRACE</CompilerDefines>
40 <OutputPath>bin/Release</OutputPath>
41 <OptimizeCode>true</OptimizeCode>
42 <DebugInformation>false</DebugInformation>
43 <KeyFile>Prebuild.snk</KeyFile>
44 <SuppressWarnings>1595</SuppressWarnings>
45 </Options>
46 </Configuration>
47 <Reference name="System.EnterpriseServices" />
48 <Reference name="System.Xml" />
49 <Reference name="System" />
50 <Files>
51 <Match pattern="App.ico" buildAction="EmbeddedResource"/>
52 <Match path="data" pattern="prebuild-1.7.xsd" buildAction="EmbeddedResource"/>
53 <Match pattern="*.cs" recurse="true"/>
54 </Files>
55 </Project>
56 </Solution>
57</Prebuild>
diff --git a/Prebuild/scripts/Clean.bat b/Prebuild/scripts/Clean.bat
new file mode 100644
index 0000000..39fa685
--- /dev/null
+++ b/Prebuild/scripts/Clean.bat
@@ -0,0 +1,2 @@
1cd ..
2Prebuild.exe /clean /yes /removedir obj /file prebuild.xml /build NET_2_0 /pause
diff --git a/Prebuild/scripts/Help.bat b/Prebuild/scripts/Help.bat
new file mode 100644
index 0000000..a7d3db4
--- /dev/null
+++ b/Prebuild/scripts/Help.bat
@@ -0,0 +1,2 @@
1cd ..
2Prebuild.exe /usage /pause \ No newline at end of file
diff --git a/Prebuild/scripts/MonoDevelop.sh b/Prebuild/scripts/MonoDevelop.sh
new file mode 100644
index 0000000..dae3cf4
--- /dev/null
+++ b/Prebuild/scripts/MonoDevelop.sh
@@ -0,0 +1,2 @@
1#!/bin/sh
2prebuild /target monodev /file ../prebuild.xml /build NET_1_1 /pause
diff --git a/Prebuild/scripts/Prebuild.nsi b/Prebuild/scripts/Prebuild.nsi
new file mode 100644
index 0000000..0c6e2bc
--- /dev/null
+++ b/Prebuild/scripts/Prebuild.nsi
@@ -0,0 +1,231 @@
1!verbose 3
2
3!define PRODUCT_NAME "Prebuild"
4!define PRODUCT_VERSION "1.3.1"
5!define PRODUCT_PUBLISHER "Prebuild"
6!define PRODUCT_PACKAGE "prebuild"
7!define PRODUCT_WEB_SITE "http://dnpb.sourceforge.net"
8!define PRODUCT_DIR_REGKEY "Software\Microsoft\Windows\CurrentVersion\App Paths\Prebuild"
9!define PRODUCT_UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\Prebuild"
10!define PRODUCT_UNINST_ROOT_KEY "HKLM"
11!define PRODUCT_PATH ".."
12
13;!define MUI_WELCOMEFINISHPAGE_BITMAP "PrebuildLogo.bmp"
14;!define MUI_WELCOMEFINISHPAGE_BITMAP_NOSTRETCH
15;!define MUI_UNWELCOMEFINISHPAGE_BITMAP "PrebuildLogo.bmp"
16;!define MUI_UNWELCOMEFINISHPAGE_BITMAP_NOSTRETCH
17
18BrandingText "© 2003-2006 David Hudson, http://dnpb.sourceforge.net/"
19SetCompressor lzma
20CRCCheck on
21
22; File Association defines
23;!include "fileassoc.nsh"
24
25; MUI 1.67 compatible ------
26!include "MUI.nsh"
27
28; MUI Settings
29!define MUI_ABORTWARNING
30!define MUI_ICON "${NSISDIR}\Contrib\Graphics\Icons\modern-install.ico"
31!define MUI_UNICON "${NSISDIR}\Contrib\Graphics\Icons\modern-uninstall.ico"
32
33;--------------------------------
34;Variables
35
36;--------------------------------
37;Installer Pages
38
39; Welcome page
40!insertmacro MUI_PAGE_WELCOME
41; License page
42!insertmacro MUI_PAGE_LICENSE "..\doc\license.txt"
43; Directory page
44!insertmacro MUI_PAGE_DIRECTORY
45
46; Instfiles page
47!insertmacro MUI_PAGE_INSTFILES
48
49; Finish page
50!insertmacro MUI_PAGE_FINISH
51
52;------------------------------------
53; Uninstaller pages
54!insertmacro MUI_UNPAGE_CONFIRM
55!insertmacro MUI_UNPAGE_INSTFILES
56!insertmacro MUI_UNPAGE_FINISH
57;------------------------------------
58
59; Language files
60!insertmacro MUI_LANGUAGE "English"
61
62; Reserve files
63!insertmacro MUI_RESERVEFILE_INSTALLOPTIONS
64
65; MUI end ------
66
67Name "${PRODUCT_NAME} ${PRODUCT_VERSION}"
68OutFile "..\${PRODUCT_PACKAGE}-${PRODUCT_VERSION}-setup.exe"
69InstallDir "$PROGRAMFILES\Prebuild"
70InstallDirRegKey HKLM "${PRODUCT_DIR_REGKEY}" ""
71ShowInstDetails show
72ShowUnInstDetails show
73
74; .NET Framework check
75; http://msdn.microsoft.com/netframework/default.aspx?pull=/library/en-us/dnnetdep/html/redistdeploy1_1.asp
76; Section "Detecting that the .NET Framework 1.1 is installed"
77Function .onInit
78 ReadRegDWORD $R0 HKLM "SOFTWARE\Microsoft\NET Framework Setup\NDP\v1.1.4322" Install
79 StrCmp $R0 "" 0 CheckPreviousVersion
80 MessageBox MB_OK "Microsoft .NET Framework 1.1 was not found on this system.$\r$\n$\r$\nUnable to continue this installation."
81 Abort
82
83 CheckPreviousVersion:
84 ReadRegStr $R0 ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayName"
85 StrCmp $R0 "" CheckOSVersion 0
86 MessageBox MB_OK "An old version of Prebuild is installed on this computer, please uninstall first.$\r$\n$\r$\nUnable to continue this installation."
87 Abort
88
89 CheckOSVersion:
90 Call IsSupportedWindowsVersion
91 Pop $R0
92 StrCmp $R0 "False" NoAbort 0
93 MessageBox MB_OK "The operating system you are using is not supported by Prebuild (95/98/ME/NT3.x/NT4.x)."
94 Abort
95
96 NoAbort:
97FunctionEnd
98
99Section "Source" SecSource
100 SetOverwrite ifnewer
101 SetOutPath "$INSTDIR\src"
102 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\*.*
103
104 ;Store installation folder
105 WriteRegStr HKCU "Software\Prebuild" "" $INSTDIR
106
107SectionEnd
108
109Section "Runtime" SecRuntime
110 SetOverwrite ifnewer
111 SetOutPath "$INSTDIR"
112 File /r /x *.swp /x .svn /x *.nsi /x src /x *.sln /x *.cmbx /x *.mds ${PRODUCT_PATH}\Prebuild.exe ${PRODUCT_PATH}\prebuild.xml
113
114 ;Store installation folder
115 WriteRegStr HKCU "Software\Prebuild" "" $INSTDIR
116
117SectionEnd
118
119Section "Documentation" SecDocs
120 SetOverwrite ifnewer
121 SetOutPath "$INSTDIR\doc"
122 File /r /x *.swp /x .svn /x *.exe ${PRODUCT_PATH}\doc\*.*
123
124 ;Store installation folder
125 WriteRegStr HKCU "Software\Prebuild" "" $INSTDIR
126SectionEnd
127
128Section "Scripts" SecScripts
129 SetOverwrite ifnewer
130 SetOutPath "$INSTDIR\scripts"
131 File /r /x *.swp /x .svn /x *.nsi /x *.exe ${PRODUCT_PATH}\scripts\*.*
132
133 ;Store installation folder
134 WriteRegStr HKCU "Software\Prebuild" "" $INSTDIR
135SectionEnd
136
137;Language strings
138
139Section -AdditionalIcons
140 WriteIniStr "$INSTDIR\${PRODUCT_NAME}.url" "InternetShortcut" "URL" "${PRODUCT_WEB_SITE}"
141SectionEnd
142
143Section -Post
144 WriteUninstaller "$INSTDIR\uninst.exe"
145 WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayName" "$(^Name)"
146 WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "UninstallString" "$INSTDIR\uninst.exe"
147 WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayVersion" "${PRODUCT_VERSION}"
148 WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "URLInfoAbout" "${PRODUCT_WEB_SITE}"
149 WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "Publisher" "${PRODUCT_PUBLISHER}"
150SectionEnd
151
152Section Uninstall
153
154 DeleteRegKey ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}"
155 DeleteRegKey HKLM "${PRODUCT_DIR_REGKEY}"
156 RMDir /r "$INSTDIR"
157
158SectionEnd
159
160; GetWindowsVersion, taken from NSIS help, modified for our purposes
161Function IsSupportedWindowsVersion
162
163 Push $R0
164 Push $R1
165
166 ReadRegStr $R0 HKLM \
167 "SOFTWARE\Microsoft\Windows NT\CurrentVersion" CurrentVersion
168
169 IfErrors 0 lbl_winnt
170
171 ; we are not NT
172 ReadRegStr $R0 HKLM \
173 "SOFTWARE\Microsoft\Windows\CurrentVersion" VersionNumber
174
175 StrCpy $R1 $R0 1
176 StrCmp $R1 '4' 0 lbl_error
177
178 StrCpy $R1 $R0 3
179
180 StrCmp $R1 '4.0' lbl_win32_95
181 StrCmp $R1 '4.9' lbl_win32_ME lbl_win32_98
182
183 lbl_win32_95:
184 StrCpy $R0 'False'
185 Goto lbl_done
186
187 lbl_win32_98:
188 StrCpy $R0 'False'
189 Goto lbl_done
190
191 lbl_win32_ME:
192 StrCpy $R0 'False'
193 Goto lbl_done
194
195 lbl_winnt:
196
197 StrCpy $R1 $R0 1
198
199 StrCmp $R1 '3' lbl_winnt_x
200 StrCmp $R1 '4' lbl_winnt_x
201
202 StrCpy $R1 $R0 3
203
204 StrCmp $R1 '5.0' lbl_winnt_2000
205 StrCmp $R1 '5.1' lbl_winnt_XP
206 StrCmp $R1 '5.2' lbl_winnt_2003 lbl_error
207
208 lbl_winnt_x:
209 StrCpy $R0 'False'
210 Goto lbl_done
211
212 lbl_winnt_2000:
213 Strcpy $R0 'True'
214 Goto lbl_done
215
216 lbl_winnt_XP:
217 Strcpy $R0 'True'
218 Goto lbl_done
219
220 lbl_winnt_2003:
221 Strcpy $R0 'True'
222 Goto lbl_done
223
224 lbl_error:
225 Strcpy $R0 'False'
226 lbl_done:
227
228 Pop $R1
229 Exch $R0
230
231FunctionEnd
diff --git a/Prebuild/scripts/SharpDevelop.bat b/Prebuild/scripts/SharpDevelop.bat
new file mode 100644
index 0000000..483d9c9
--- /dev/null
+++ b/Prebuild/scripts/SharpDevelop.bat
@@ -0,0 +1,4 @@
1@rem Generates a combine (.cmbx) and a set of project files (.prjx)
2@rem for SharpDevelop (http://icsharpcode.net/OpenSource/SD/Default.aspx)
3cd ..
4Prebuild.exe /target sharpdev /file prebuild.xml /build NET_1_1 /pause
diff --git a/Prebuild/scripts/SharpDevelop2.bat b/Prebuild/scripts/SharpDevelop2.bat
new file mode 100644
index 0000000..4ca0272
--- /dev/null
+++ b/Prebuild/scripts/SharpDevelop2.bat
@@ -0,0 +1,4 @@
1@rem Generates a combine (.cmbx) and a set of project files (.prjx)
2@rem for SharpDevelop (http://icsharpcode.net/OpenSource/SD/Default.aspx)
3cd ..
4Prebuild.exe /target sharpdev2 /file prebuild.xml /pause
diff --git a/Prebuild/scripts/VS2002.bat b/Prebuild/scripts/VS2002.bat
new file mode 100644
index 0000000..a11740e
--- /dev/null
+++ b/Prebuild/scripts/VS2002.bat
@@ -0,0 +1,4 @@
1@rem Generates a solution (.sln) and a set of project files (.csproj)
2@rem for Microsoft Visual Studio .NET 2002
3cd ..
4Prebuild.exe /target vs2002 /file prebuild.xml /build NET_1_1 /pause
diff --git a/Prebuild/scripts/VS2003.bat b/Prebuild/scripts/VS2003.bat
new file mode 100644
index 0000000..1be57f8
--- /dev/null
+++ b/Prebuild/scripts/VS2003.bat
@@ -0,0 +1,4 @@
1@rem Generates a solution (.sln) and a set of project files (.csproj)
2@rem for Microsoft Visual Studio .NET 2002
3cd ..
4Prebuild.exe /target vs2003 /file prebuild.xml /build NET_1_1 /pause
diff --git a/Prebuild/scripts/VS2005.bat b/Prebuild/scripts/VS2005.bat
new file mode 100644
index 0000000..86ad3fc
--- /dev/null
+++ b/Prebuild/scripts/VS2005.bat
@@ -0,0 +1,4 @@
1@rem Generates a solution (.sln) and a set of project files (.csproj, .vbproj, etc.)
2@rem for Microsoft Visual Studio .NET 2005
3cd ..
4Prebuild.exe /target vs2005 /file prebuild.xml /build NET_2_0 /pause
diff --git a/Prebuild/scripts/autotools.bat b/Prebuild/scripts/autotools.bat
new file mode 100644
index 0000000..1fd3469
--- /dev/null
+++ b/Prebuild/scripts/autotools.bat
@@ -0,0 +1,4 @@
1@rem Generates Makefiles
2@rem for autotools
3cd ..
4Prebuild.exe /target autotools /file prebuild.xml /pause
diff --git a/Prebuild/scripts/autotools.sh b/Prebuild/scripts/autotools.sh
new file mode 100644
index 0000000..18cd46f
--- /dev/null
+++ b/Prebuild/scripts/autotools.sh
@@ -0,0 +1,2 @@
1#!/bin/sh
2prebuild /target autotools /file ../prebuild.xml /build NET_2_0 /pause
diff --git a/Prebuild/scripts/nant.bat b/Prebuild/scripts/nant.bat
new file mode 100644
index 0000000..2a6ae60
--- /dev/null
+++ b/Prebuild/scripts/nant.bat
@@ -0,0 +1,4 @@
1@rem Generates a .build files
2@rem for NAnt
3cd ..
4Prebuild.exe /target nant /file prebuild.xml /pause
diff --git a/Prebuild/scripts/nant.sh b/Prebuild/scripts/nant.sh
new file mode 100644
index 0000000..54a8254
--- /dev/null
+++ b/Prebuild/scripts/nant.sh
@@ -0,0 +1,2 @@
1#!/bin/sh
2prebuild /target nant /file ../prebuild.xml /pause
diff --git a/Prebuild/src/App.ico b/Prebuild/src/App.ico
new file mode 100644
index 0000000..ac4ea6f
--- /dev/null
+++ b/Prebuild/src/App.ico
Binary files differ
diff --git a/Prebuild/src/Core/Attributes/DataNodeAttribute.cs b/Prebuild/src/Core/Attributes/DataNodeAttribute.cs
new file mode 100644
index 0000000..dbdaf0b
--- /dev/null
+++ b/Prebuild/src/Core/Attributes/DataNodeAttribute.cs
@@ -0,0 +1,81 @@
1#region BSD License
2/*
3Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com)
4
5Redistribution and use in source and binary forms, with or without modification, are permitted
6provided that the following conditions are met:
7
8* Redistributions of source code must retain the above copyright notice, this list of conditions
9 and the following disclaimer.
10* Redistributions in binary form must reproduce the above copyright notice, this list of conditions
11 and the following disclaimer in the documentation and/or other materials provided with the
12 distribution.
13* The name of the author may not be used to endorse or promote products derived from this software
14 without specific prior written permission.
15
16THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
17BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
19EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
21OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
22IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23*/
24#endregion
25
26#region CVS Information
27/*
28 * $Source$
29 * $Author: jendave $
30 * $Date: 2006-01-28 01:49:58 +0100 (lö, 28 jan 2006) $
31 * $Revision: 71 $
32 */
33#endregion
34
35using System;
36using System.Collections.Specialized;
37
38namespace Prebuild.Core.Attributes
39{
40 /// <summary>
41 ///
42 /// </summary>
43 [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct)]
44 public sealed class DataNodeAttribute : Attribute
45 {
46 #region Fields
47
48 private string m_Name = "unknown";
49
50 #endregion
51
52 #region Constructors
53
54 /// <summary>
55 /// Initializes a new instance of the <see cref="DataNodeAttribute"/> class.
56 /// </summary>
57 /// <param name="name">The name.</param>
58 public DataNodeAttribute(string name)
59 {
60 m_Name = name;
61 }
62
63 #endregion
64
65 #region Properties
66
67 /// <summary>
68 /// Gets the name.
69 /// </summary>
70 /// <value>The name.</value>
71 public string Name
72 {
73 get
74 {
75 return m_Name;
76 }
77 }
78
79 #endregion
80 }
81}
diff --git a/Prebuild/src/Core/Attributes/OptionNodeAttribute.cs b/Prebuild/src/Core/Attributes/OptionNodeAttribute.cs
new file mode 100644
index 0000000..edda56d
--- /dev/null
+++ b/Prebuild/src/Core/Attributes/OptionNodeAttribute.cs
@@ -0,0 +1,80 @@
1#region BSD License
2/*
3Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com)
4
5Redistribution and use in source and binary forms, with or without modification, are permitted
6provided that the following conditions are met:
7
8* Redistributions of source code must retain the above copyright notice, this list of conditions
9 and the following disclaimer.
10* Redistributions in binary form must reproduce the above copyright notice, this list of conditions
11 and the following disclaimer in the documentation and/or other materials provided with the
12 distribution.
13* The name of the author may not be used to endorse or promote products derived from this software
14 without specific prior written permission.
15
16THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
17BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
19EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
21OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
22IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23*/
24#endregion
25
26#region CVS Information
27/*
28 * $Source$
29 * $Author: jendave $
30 * $Date: 2006-01-28 01:49:58 +0100 (lö, 28 jan 2006) $
31 * $Revision: 71 $
32 */
33#endregion
34
35using System;
36
37namespace Prebuild.Core.Attributes
38{
39 /// <summary>
40 ///
41 /// </summary>
42 [AttributeUsage(AttributeTargets.Field)]
43 public sealed class OptionNodeAttribute : Attribute
44 {
45 #region Fields
46
47 private string m_NodeName;
48
49 #endregion
50
51 #region Constructors
52
53 /// <summary>
54 /// Initializes a new instance of the <see cref="OptionNodeAttribute"/> class.
55 /// </summary>
56 /// <param name="nodeName">Name of the node.</param>
57 public OptionNodeAttribute(string nodeName)
58 {
59 m_NodeName = nodeName;
60 }
61
62 #endregion
63
64 #region Properties
65
66 /// <summary>
67 /// Gets the name of the node.
68 /// </summary>
69 /// <value>The name of the node.</value>
70 public string NodeName
71 {
72 get
73 {
74 return m_NodeName;
75 }
76 }
77
78 #endregion
79 }
80}
diff --git a/Prebuild/src/Core/Attributes/TargetAttribute.cs b/Prebuild/src/Core/Attributes/TargetAttribute.cs
new file mode 100644
index 0000000..985f180
--- /dev/null
+++ b/Prebuild/src/Core/Attributes/TargetAttribute.cs
@@ -0,0 +1,80 @@
1#region BSD License
2/*
3Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com)
4
5Redistribution and use in source and binary forms, with or without modification, are permitted
6provided that the following conditions are met:
7
8* Redistributions of source code must retain the above copyright notice, this list of conditions
9 and the following disclaimer.
10* Redistributions in binary form must reproduce the above copyright notice, this list of conditions
11 and the following disclaimer in the documentation and/or other materials provided with the
12 distribution.
13* The name of the author may not be used to endorse or promote products derived from this software
14 without specific prior written permission.
15
16THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
17BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
19EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
21OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
22IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23*/
24#endregion
25
26#region CVS Information
27/*
28 * $Source$
29 * $Author: jendave $
30 * $Date: 2006-01-28 01:49:58 +0100 (lö, 28 jan 2006) $
31 * $Revision: 71 $
32 */
33#endregion
34
35using System;
36
37namespace Prebuild.Core.Attributes
38{
39 /// <summary>
40 ///
41 /// </summary>
42 [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct)]
43 public sealed class TargetAttribute : Attribute
44 {
45 #region Fields
46
47 private string m_Name;
48
49 #endregion
50
51 #region Constructors
52
53 /// <summary>
54 /// Initializes a new instance of the <see cref="TargetAttribute"/> class.
55 /// </summary>
56 /// <param name="name">The name.</param>
57 public TargetAttribute(string name)
58 {
59 m_Name = name;
60 }
61
62 #endregion
63
64 #region Properties
65
66 /// <summary>
67 /// Gets the name.
68 /// </summary>
69 /// <value>The name.</value>
70 public string Name
71 {
72 get
73 {
74 return m_Name;
75 }
76 }
77
78 #endregion
79 }
80}
diff --git a/Prebuild/src/Core/FatalException.cs b/Prebuild/src/Core/FatalException.cs
new file mode 100644
index 0000000..92aad3d
--- /dev/null
+++ b/Prebuild/src/Core/FatalException.cs
@@ -0,0 +1,94 @@
1#region BSD License
2/*
3Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com)
4
5Redistribution and use in source and binary forms, with or without modification, are permitted
6provided that the following conditions are met:
7
8* Redistributions of source code must retain the above copyright notice, this list of conditions
9 and the following disclaimer.
10* Redistributions in binary form must reproduce the above copyright notice, this list of conditions
11 and the following disclaimer in the documentation and/or other materials provided with the
12 distribution.
13* The name of the author may not be used to endorse or promote products derived from this software
14 without specific prior written permission.
15
16THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
17BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
19EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
21OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
22IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23*/
24#endregion
25
26#region CVS Information
27/*
28 * $Source$
29 * $Author: jendave $
30 * $Date: 2006-01-28 01:49:58 +0100 (lö, 28 jan 2006) $
31 * $Revision: 71 $
32 */
33#endregion
34
35using System;
36using System.Runtime.Serialization;
37
38namespace Prebuild.Core
39{
40 /// <summary>
41 ///
42 /// </summary>
43 [Serializable()]
44 public class FatalException : Exception
45 {
46 #region Constructors
47
48
49 /// <summary>
50 /// Initializes a new instance of the <see cref="FatalException"/> class.
51 /// </summary>
52 public FatalException()
53 {
54 }
55
56 /// <summary>
57 /// Initializes a new instance of the <see cref="FatalException"/> class.
58 /// </summary>
59 /// <param name="format">The format.</param>
60 /// <param name="args">The args.</param>
61 public FatalException(string format, params object[] args)
62 : base(String.Format(format, args))
63 {
64 }
65
66 /// <summary>
67 /// Exception with specified string
68 /// </summary>
69 /// <param name="message">Exception message</param>
70 public FatalException(string message): base(message)
71 {
72 }
73
74 /// <summary>
75 ///
76 /// </summary>
77 /// <param name="message"></param>
78 /// <param name="exception"></param>
79 public FatalException(string message, Exception exception) : base(message, exception)
80 {
81 }
82
83 /// <summary>
84 ///
85 /// </summary>
86 /// <param name="info"></param>
87 /// <param name="context"></param>
88 protected FatalException(SerializationInfo info, StreamingContext context) : base( info, context )
89 {
90 }
91
92 #endregion
93 }
94}
diff --git a/Prebuild/src/Core/Interfaces/IDataNode.cs b/Prebuild/src/Core/Interfaces/IDataNode.cs
new file mode 100644
index 0000000..0bad97c
--- /dev/null
+++ b/Prebuild/src/Core/Interfaces/IDataNode.cs
@@ -0,0 +1,56 @@
1#region BSD License
2/*
3Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com)
4
5Redistribution and use in source and binary forms, with or without modification, are permitted
6provided that the following conditions are met:
7
8* Redistributions of source code must retain the above copyright notice, this list of conditions
9 and the following disclaimer.
10* Redistributions in binary form must reproduce the above copyright notice, this list of conditions
11 and the following disclaimer in the documentation and/or other materials provided with the
12 distribution.
13* The name of the author may not be used to endorse or promote products derived from this software
14 without specific prior written permission.
15
16THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
17BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
19EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
21OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
22IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23*/
24#endregion
25
26#region CVS Information
27/*
28 * $Source$
29 * $Author: jendave $
30 * $Date: 2006-01-28 01:49:58 +0100 (lö, 28 jan 2006) $
31 * $Revision: 71 $
32 */
33#endregion
34
35using System;
36using System.Xml;
37
38namespace Prebuild.Core.Interfaces
39{
40 /// <summary>
41 ///
42 /// </summary>
43 public interface IDataNode
44 {
45 /// <summary>
46 /// Gets or sets the parent.
47 /// </summary>
48 /// <value>The parent.</value>
49 IDataNode Parent { get; set; }
50 /// <summary>
51 /// Parses the specified node.
52 /// </summary>
53 /// <param name="node">The node.</param>
54 void Parse(XmlNode node);
55 }
56}
diff --git a/Prebuild/src/Core/Interfaces/ITarget.cs b/Prebuild/src/Core/Interfaces/ITarget.cs
new file mode 100644
index 0000000..dac6cd6
--- /dev/null
+++ b/Prebuild/src/Core/Interfaces/ITarget.cs
@@ -0,0 +1,60 @@
1#region BSD License
2/*
3Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com)
4
5Redistribution and use in source and binary forms, with or without modification, are permitted
6provided that the following conditions are met:
7
8* Redistributions of source code must retain the above copyright notice, this list of conditions
9 and the following disclaimer.
10* Redistributions in binary form must reproduce the above copyright notice, this list of conditions
11 and the following disclaimer in the documentation and/or other materials provided with the
12 distribution.
13* The name of the author may not be used to endorse or promote products derived from this software
14 without specific prior written permission.
15
16THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
17BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
19EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
21OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
22IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23*/
24#endregion
25
26#region CVS Information
27/*
28 * $Source$
29 * $Author: jendave $
30 * $Date: 2006-01-28 01:49:58 +0100 (lö, 28 jan 2006) $
31 * $Revision: 71 $
32 */
33#endregion
34
35using System;
36
37namespace Prebuild.Core.Interfaces
38{
39 /// <summary>
40 ///
41 /// </summary>
42 public interface ITarget
43 {
44 /// <summary>
45 /// Writes the specified kern.
46 /// </summary>
47 /// <param name="kern">The kern.</param>
48 void Write(Kernel kern);
49 /// <summary>
50 /// Cleans the specified kern.
51 /// </summary>
52 /// <param name="kern">The kern.</param>
53 void Clean(Kernel kern);
54 /// <summary>
55 /// Gets the name.
56 /// </summary>
57 /// <value>The name.</value>
58 string Name { get; }
59 }
60} \ No newline at end of file
diff --git a/Prebuild/src/Core/Kernel.cs b/Prebuild/src/Core/Kernel.cs
new file mode 100644
index 0000000..3117e7c
--- /dev/null
+++ b/Prebuild/src/Core/Kernel.cs
@@ -0,0 +1,758 @@
1#region BSD License
2/*
3Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com)
4
5Redistribution and use in source and binary forms, with or without modification, are permitted
6provided that the following conditions are met:
7
8* Redistributions of source code must retain the above copyright notice, this list of conditions
9 and the following disclaimer.
10* Redistributions in binary form must reproduce the above copyright notice, this list of conditions
11 and the following disclaimer in the documentation and/or other materials provided with the
12 distribution.
13* The name of the author may not be used to endorse or promote products derived from this software
14 without specific prior written permission.
15
16THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
17BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
19EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
21OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
22IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23*/
24#endregion
25
26#region CVS Information
27/*
28 * $Source$
29 * $Author: robloach $
30 * $Date: 2006-09-26 00:30:53 +0200 (ti, 26 sep 2006) $
31 * $Revision: 165 $
32 */
33#endregion
34
35using System;
36using System.Diagnostics;
37using System.Collections;
38using System.Collections.Specialized;
39using System.IO;
40using System.Reflection;
41using System.Xml;
42using System.Xml.Schema;
43using System.Text;
44
45using Prebuild.Core.Attributes;
46using Prebuild.Core.Interfaces;
47using Prebuild.Core.Nodes;
48using Prebuild.Core.Parse;
49using Prebuild.Core.Utilities;
50
51namespace Prebuild.Core
52{
53 /// <summary>
54 ///
55 /// </summary>
56 public class Kernel : IDisposable
57 {
58 #region Inner Classes
59
60 private struct NodeEntry
61 {
62 public Type Type;
63 public DataNodeAttribute Attribute;
64 }
65
66 #endregion
67
68 #region Fields
69
70 private static Kernel m_Instance = new Kernel();
71
72 /// <summary>
73 /// This must match the version of the schema that is embeeded
74 /// </summary>
75 private static string m_SchemaVersion = "1.7";
76 private static string m_Schema = "prebuild-" + m_SchemaVersion + ".xsd";
77 private static string m_SchemaURI = "http://dnpb.sourceforge.net/schemas/" + m_Schema;
78 bool disposed;
79 private Version m_Version;
80 private string m_Revision = "";
81 private CommandLineCollection m_CommandLine;
82 private Log m_Log;
83 private CurrentDirectory m_CurrentWorkingDirectory;
84 private XmlSchemaCollection m_Schemas;
85
86 private Hashtable m_Targets;
87 private Hashtable m_Nodes;
88
89 ArrayList m_Solutions;
90 string m_Target;
91 string m_Clean;
92 string[] m_RemoveDirectories;
93 string m_CurrentFile;
94 bool m_PauseAfterFinish;
95 string[] m_ProjectGroups;
96 StringCollection m_Refs;
97
98
99 #endregion
100
101 #region Constructors
102
103 private Kernel()
104 {
105 }
106
107 #endregion
108
109 #region Properties
110
111 /// <summary>
112 /// Gets a value indicating whether [pause after finish].
113 /// </summary>
114 /// <value><c>true</c> if [pause after finish]; otherwise, <c>false</c>.</value>
115 public bool PauseAfterFinish
116 {
117 get
118 {
119 return m_PauseAfterFinish;
120 }
121 }
122
123 /// <summary>
124 /// Gets the instance.
125 /// </summary>
126 /// <value>The instance.</value>
127 public static Kernel Instance
128 {
129 get
130 {
131 return m_Instance;
132 }
133 }
134
135 /// <summary>
136 /// Gets the version.
137 /// </summary>
138 /// <value>The version.</value>
139 public string Version
140 {
141 get
142 {
143 return String.Format("{0}.{1}.{2}{3}", m_Version.Major, m_Version.Minor, m_Version.Build, m_Revision);
144 }
145 }
146
147 /// <summary>
148 /// Gets the command line.
149 /// </summary>
150 /// <value>The command line.</value>
151 public CommandLineCollection CommandLine
152 {
153 get
154 {
155 return m_CommandLine;
156 }
157 }
158
159 /// <summary>
160 /// Gets the targets.
161 /// </summary>
162 /// <value>The targets.</value>
163 public Hashtable Targets
164 {
165 get
166 {
167 return m_Targets;
168 }
169 }
170
171 /// <summary>
172 /// Gets the log.
173 /// </summary>
174 /// <value>The log.</value>
175 public Log Log
176 {
177 get
178 {
179 return m_Log;
180 }
181 }
182
183 /// <summary>
184 /// Gets the current working directory.
185 /// </summary>
186 /// <value>The current working directory.</value>
187 public CurrentDirectory CurrentWorkingDirectory
188 {
189 get
190 {
191 return m_CurrentWorkingDirectory;
192 }
193 }
194
195 /// <summary>
196 /// Gets the solutions.
197 /// </summary>
198 /// <value>The solutions.</value>
199 public ArrayList Solutions
200 {
201 get
202 {
203 return m_Solutions;
204 }
205 }
206
207 #endregion
208
209 #region Private Methods
210
211 private void RemoveDirectories(string rootDir, string[] dirNames)
212 {
213 foreach(string dir in Directory.GetDirectories(rootDir))
214 {
215 string simpleName = Path.GetFileName(dir);
216
217 if(Array.IndexOf(dirNames, simpleName) != -1)
218 {
219 //delete if the name matches one of the directory names to delete
220 string fullDirPath = Path.GetFullPath(dir);
221 Directory.Delete(fullDirPath,true);
222 }
223 else//not a match, so check children
224 {
225 RemoveDirectories(dir,dirNames);
226 //recurse, checking children for them
227 }
228 }
229 }
230
231// private void RemoveDirectoryMatches(string rootDir, string dirPattern)
232// {
233// foreach(string dir in Directory.GetDirectories(rootDir))
234// {
235// foreach(string match in Directory.GetDirectories(dir))
236// {//delete all child directories that match
237// Directory.Delete(Path.GetFullPath(match),true);
238// }
239// //recure through the rest checking for nested matches to delete
240// RemoveDirectoryMatches(dir,dirPattern);
241// }
242// }
243
244 private void LoadSchema()
245 {
246 Assembly assembly = this.GetType().Assembly;
247 Stream stream = assembly.GetManifestResourceStream("Prebuild.data." + m_Schema);
248 if(stream == null)
249 {
250 //try without the default namespace prepending to it in case was compiled with SharpDevelop or MonoDevelop instead of Visual Studio .NET
251 stream = assembly.GetManifestResourceStream(m_Schema);
252 if(stream == null)
253 {
254 throw new System.Reflection.TargetException(string.Format("Could not find the scheme embedded resource file '{0}'.", m_Schema));
255 }
256 }
257 XmlReader schema = new XmlTextReader(stream);
258
259 m_Schemas = new XmlSchemaCollection();
260 m_Schemas.Add(m_SchemaURI, schema);
261 }
262
263 private void CacheVersion()
264 {
265 m_Version = Assembly.GetEntryAssembly().GetName().Version;
266 }
267
268 private void CacheTargets(Assembly assm)
269 {
270 foreach(Type t in assm.GetTypes())
271 {
272 TargetAttribute ta = (TargetAttribute)Helper.CheckType(t, typeof(TargetAttribute), typeof(ITarget));
273 if(ta == null)
274 {
275 continue;
276 }
277
278 ITarget target = (ITarget)assm.CreateInstance(t.FullName);
279 if(target == null)
280 {
281 throw new MissingMethodException("Could not create ITarget instance");
282 }
283
284 m_Targets[ta.Name] = target;
285 }
286 }
287
288 private void CacheNodeTypes(Assembly assm)
289 {
290 foreach(Type t in assm.GetTypes())
291 {
292 DataNodeAttribute dna = (DataNodeAttribute)Helper.CheckType(t, typeof(DataNodeAttribute), typeof(IDataNode));
293 if(dna == null)
294 {
295 continue;
296 }
297
298 NodeEntry ne = new NodeEntry();
299 ne.Type = t;
300 ne.Attribute = dna;
301 m_Nodes[dna.Name] = ne;
302 }
303 }
304
305 private void LogBanner()
306 {
307 m_Log.Write("Prebuild v" + this.Version);
308 m_Log.Write("Copyright (c) Matthew Holmes, Dan Moorehead and David Hudson");
309 m_Log.Write("See 'prebuild /usage' for help");
310 m_Log.Write();
311 }
312
313 private void ProcessFile(string file)
314 {
315 m_CurrentWorkingDirectory.Push();
316
317 string path = file;
318 try
319 {
320 try
321 {
322 path = Helper.ResolvePath(path);
323 }
324 catch(ArgumentException)
325 {
326 m_Log.Write("Could not open Prebuild file: " + path);
327 m_CurrentWorkingDirectory.Pop();
328 return;
329 }
330
331 m_CurrentFile = path;
332 Helper.SetCurrentDir(Path.GetDirectoryName(path));
333
334
335 XmlTextReader reader = new XmlTextReader(path);
336
337 Core.Parse.Preprocessor pre = new Core.Parse.Preprocessor();
338
339 //register command line arguments as XML variables
340 IDictionaryEnumerator dict = m_CommandLine.GetEnumerator();
341 while (dict.MoveNext())
342 {
343 string name = dict.Key.ToString().Trim();
344 if (name.Length > 0)
345 pre.RegisterVariable(name, dict.Value.ToString());
346 }
347
348 string xml = pre.Process(reader);//remove script and evaulate pre-proccessing to get schema-conforming XML
349
350
351 XmlDocument doc = new XmlDocument();
352 try
353 {
354 XmlValidatingReader validator = new XmlValidatingReader(new XmlTextReader(new StringReader(xml)));
355
356 //validate while reading from string into XmlDocument DOM structure in memory
357 foreach(XmlSchema schema in m_Schemas)
358 {
359 validator.Schemas.Add(schema);
360 }
361 doc.Load(validator);
362 }
363 catch(XmlException e)
364 {
365 throw new XmlException(e.ToString());
366 }
367
368 //is there a purpose to writing it? An syntax/schema problem would have been found during pre.Process() and reported with details
369 if(m_CommandLine.WasPassed("ppo"))
370 {
371 string ppoFile = m_CommandLine["ppo"];
372 if(ppoFile == null || ppoFile.Trim().Length < 1)
373 {
374 ppoFile = "preprocessed.xml";
375 }
376
377 StreamWriter writer = null;
378 try
379 {
380 writer = new StreamWriter(ppoFile);
381 writer.Write(xml);
382 }
383 catch(IOException ex)
384 {
385 Console.WriteLine("Could not write PPO file '{0}': {1}", ppoFile, ex.Message);
386 }
387 finally
388 {
389 if(writer != null)
390 {
391 writer.Close();
392 }
393 }
394 return;
395 }
396 //start reading the xml config file
397 XmlElement rootNode = doc.DocumentElement;
398 //string suggestedVersion = Helper.AttributeValue(rootNode,"version","1.0");
399 Helper.CheckForOSVariables = Helper.ParseBoolean(rootNode,"checkOsVars",false);
400
401 foreach(XmlNode node in rootNode.ChildNodes)//solutions or if pre-proc instructions
402 {
403 IDataNode dataNode = ParseNode(node, null);
404 if(dataNode is ProcessNode)
405 {
406 ProcessNode proc = (ProcessNode)dataNode;
407 if(proc.IsValid)
408 {
409 ProcessFile(proc.Path);
410 }
411 }
412 else if(dataNode is SolutionNode)
413 {
414 m_Solutions.Add(dataNode);
415 }
416 }
417 }
418 catch(XmlSchemaException xse)
419 {
420 m_Log.Write("XML validation error at line {0} in {1}:\n\n{2}",
421 xse.LineNumber, path, xse.Message);
422 }
423 finally
424 {
425 m_CurrentWorkingDirectory.Pop();
426 }
427 }
428
429 #endregion
430
431 #region Public Methods
432
433 /// <summary>
434 /// Allows the project.
435 /// </summary>
436 /// <param name="projectGroupsFlags">The project groups flags.</param>
437 /// <returns></returns>
438 public bool AllowProject(string projectGroupsFlags)
439 {
440 if(m_ProjectGroups != null && m_ProjectGroups.Length > 0)
441 {
442 if(projectGroupsFlags != null && projectGroupsFlags.Length == 0)
443 {
444 foreach(string group in projectGroupsFlags.Split('|'))
445 {
446 if(Array.IndexOf(m_ProjectGroups, group) != -1) //if included in the filter list
447 {
448 return true;
449 }
450 }
451 }
452 return false;//not included in the list or no groups specified for the project
453 }
454 return true;//no filter specified in the command line args
455 }
456
457 /// <summary>
458 /// Gets the type of the node.
459 /// </summary>
460 /// <param name="node">The node.</param>
461 /// <returns></returns>
462 public Type GetNodeType(XmlNode node)
463 {
464 if( node == null )
465 {
466 throw new ArgumentNullException("node");
467 }
468 if(!m_Nodes.ContainsKey(node.Name))
469 {
470 return null;
471 }
472
473 NodeEntry ne = (NodeEntry)m_Nodes[node.Name];
474 return ne.Type;
475 }
476
477 /// <summary>
478 ///
479 /// </summary>
480 /// <param name="node"></param>
481 /// <param name="parent"></param>
482 /// <returns></returns>
483 public IDataNode ParseNode(XmlNode node, IDataNode parent)
484 {
485 return ParseNode(node, parent, null);
486 }
487
488 //Create an instance of the data node type that is mapped to the name of the xml DOM node
489 /// <summary>
490 /// Parses the node.
491 /// </summary>
492 /// <param name="node">The node.</param>
493 /// <param name="parent">The parent.</param>
494 /// <param name="preNode">The pre node.</param>
495 /// <returns></returns>
496 public IDataNode ParseNode(XmlNode node, IDataNode parent, IDataNode preNode)
497 {
498 IDataNode dataNode = null;
499
500 try
501 {
502 if( node == null )
503 {
504 throw new ArgumentNullException("node");
505 }
506 if(preNode == null)
507 {
508 if(!m_Nodes.ContainsKey(node.Name))
509 {
510 //throw new XmlException("Unknown XML node: " + node.Name);
511 return null;
512 }
513
514 NodeEntry ne = (NodeEntry)m_Nodes[node.Name];
515 Type type = ne.Type;
516 //DataNodeAttribute dna = ne.Attribute;
517
518 dataNode = (IDataNode)type.Assembly.CreateInstance(type.FullName);
519 if(dataNode == null)
520 {
521 throw new System.Reflection.TargetException("Could not create new parser instance: " + type.FullName);
522 }
523 }
524 else
525 dataNode = preNode;
526
527 dataNode.Parent = parent;
528 dataNode.Parse(node);
529 }
530 catch(WarningException wex)
531 {
532 m_Log.Write(LogType.Warning, wex.Message);
533 return null;
534 }
535 catch(FatalException fex)
536 {
537 m_Log.WriteException(LogType.Error, fex);
538 throw;
539 }
540 catch(Exception ex)
541 {
542 m_Log.WriteException(LogType.Error, ex);
543 throw;
544 }
545
546 return dataNode;
547 }
548
549 /// <summary>
550 /// Initializes the specified target.
551 /// </summary>
552 /// <param name="target">The target.</param>
553 /// <param name="args">The args.</param>
554 public void Initialize(LogTargets target, string[] args)
555 {
556 m_Targets = new Hashtable();
557 CacheTargets(this.GetType().Assembly);
558 m_Nodes = new Hashtable();
559 CacheNodeTypes(this.GetType().Assembly);
560 CacheVersion();
561
562 m_CommandLine = new CommandLineCollection(args);
563
564 string logFile = null;
565 if(m_CommandLine.WasPassed("log"))
566 {
567 logFile = m_CommandLine["log"];
568
569 if(logFile != null && logFile.Length == 0)
570 {
571 logFile = "Prebuild.log";
572 }
573 }
574 else
575 {
576 target = target & ~LogTargets.File; //dont output to a file
577 }
578
579 m_Log = new Log(target, logFile);
580 LogBanner();
581
582 m_CurrentWorkingDirectory = new CurrentDirectory();
583
584 m_Target = m_CommandLine["target"];
585 m_Clean = m_CommandLine["clean"];
586 string removeDirs = m_CommandLine["removedir"];
587 if(removeDirs != null && removeDirs.Length == 0)
588 {
589 m_RemoveDirectories = removeDirs.Split('|');
590 }
591
592 string flags = m_CommandLine["allowedgroups"];//allows filtering by specifying a pipe-delimited list of groups to include
593 if(flags != null && flags.Length == 0)
594 {
595 m_ProjectGroups = flags.Split('|');
596 }
597 m_PauseAfterFinish = m_CommandLine.WasPassed("pause");
598
599 LoadSchema();
600
601 m_Solutions = new ArrayList();
602 m_Refs = new StringCollection();
603 }
604
605 /// <summary>
606 /// Processes this instance.
607 /// </summary>
608 public void Process()
609 {
610 bool perfomedOtherTask = false;
611 if(m_RemoveDirectories != null && m_RemoveDirectories.Length > 0)
612 {
613 try
614 {
615 RemoveDirectories(".",m_RemoveDirectories);
616 }
617 catch(IOException e)
618 {
619 m_Log.Write("Failed to remove directories named {0}",m_RemoveDirectories);
620 m_Log.WriteException(LogType.Error,e);
621 }
622 catch(UnauthorizedAccessException e)
623 {
624 m_Log.Write("Failed to remove directories named {0}",m_RemoveDirectories);
625 m_Log.WriteException(LogType.Error,e);
626 }
627 perfomedOtherTask = true;
628 }
629
630 if(m_Target != null && m_Clean != null)
631 {
632 m_Log.Write(LogType.Error, "The options /target and /clean cannot be passed together");
633 return;
634 }
635 else if(m_Target == null && m_Clean == null)
636 {
637 if(perfomedOtherTask) //finished
638 {
639 return;
640 }
641 m_Log.Write(LogType.Error, "Must pass either /target or /clean to process a Prebuild file");
642 return;
643 }
644
645 string file = "./prebuild.xml";
646 if(m_CommandLine.WasPassed("file"))
647 {
648 file = m_CommandLine["file"];
649 }
650
651 ProcessFile(file);
652
653 string target = (m_Target != null ? m_Target.ToLower() : m_Clean.ToLower());
654 bool clean = (m_Target == null);
655 if(clean && target != null && target.Length == 0)
656 {
657 target = "all";
658 }
659 if(clean && target == "all")//default to all if no target was specified for clean
660 {
661 //check if they passed yes
662 if (!m_CommandLine.WasPassed("yes"))
663 {
664 Console.WriteLine("WARNING: This operation will clean ALL project files for all targets, are you sure? (y/n):");
665 string ret = Console.ReadLine();
666 if(ret == null)
667 {
668 return;
669 }
670 ret = ret.Trim().ToLower();
671 if((ret.ToLower() != "y" && ret.ToLower() != "yes"))
672 {
673 return;
674 }
675 }
676 //clean all targets (just cleaning vs2002 target didn't clean nant)
677 foreach(ITarget targ in m_Targets.Values)
678 {
679 targ.Clean(this);
680 }
681 }
682 else
683 {
684 ITarget targ = (ITarget)m_Targets[target];
685
686 if(clean)
687 {
688 targ.Clean(this);
689 }
690 else
691 {
692 targ.Write(this);
693 }
694 }
695
696 m_Log.Flush();
697 }
698
699 #endregion
700
701 #region IDisposable Members
702
703 /// <summary>
704 ///
705 /// </summary>
706 public void Dispose()
707 {
708 Dispose(true);
709 GC.SuppressFinalize(this);
710 }
711
712 /// <summary>
713 /// Dispose objects
714 /// </summary>
715 /// <param name="disposing">
716 /// If true, it will dispose close the handle
717 /// </param>
718 /// <remarks>
719 /// Will dispose managed and unmanaged resources.
720 /// </remarks>
721 protected virtual void Dispose(bool disposing)
722 {
723 if (!this.disposed)
724 {
725 if (disposing)
726 {
727 if (this.m_Log != null)
728 {
729 this.m_Log.Close();
730 this.m_Log = null;
731 }
732 }
733 }
734 this.disposed = true;
735 }
736
737 /// <summary>
738 ///
739 /// </summary>
740 ~Kernel()
741 {
742 this.Dispose(false);
743 }
744
745 /// <summary>
746 /// Closes and destroys this object
747 /// </summary>
748 /// <remarks>
749 /// Same as Dispose(true)
750 /// </remarks>
751 public void Close()
752 {
753 Dispose();
754 }
755
756 #endregion
757 }
758} \ No newline at end of file
diff --git a/Prebuild/src/Core/Nodes/ConfigurationNode.cs b/Prebuild/src/Core/Nodes/ConfigurationNode.cs
new file mode 100644
index 0000000..e1488a7
--- /dev/null
+++ b/Prebuild/src/Core/Nodes/ConfigurationNode.cs
@@ -0,0 +1,177 @@
1#region BSD License
2/*
3Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com)
4
5Redistribution and use in source and binary forms, with or without modification, are permitted
6provided that the following conditions are met:
7
8* Redistributions of source code must retain the above copyright notice, this list of conditions
9 and the following disclaimer.
10* Redistributions in binary form must reproduce the above copyright notice, this list of conditions
11 and the following disclaimer in the documentation and/or other materials provided with the
12 distribution.
13* The name of the author may not be used to endorse or promote products derived from this software
14 without specific prior written permission.
15
16THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
17BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
19EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
21OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
22IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23*/
24#endregion
25
26#region CVS Information
27/*
28 * $Source$
29 * $Author: jendave $
30 * $Date: 2006-01-28 01:49:58 +0100 (lö, 28 jan 2006) $
31 * $Revision: 71 $
32 */
33#endregion
34
35using System;
36using System.Xml;
37
38using Prebuild.Core.Attributes;
39using Prebuild.Core.Interfaces;
40using Prebuild.Core.Utilities;
41
42namespace Prebuild.Core.Nodes
43{
44 /// <summary>
45 ///
46 /// </summary>
47 [DataNode("Configuration")]
48 public class ConfigurationNode : DataNode, ICloneable
49 {
50 #region Fields
51
52 private string m_Name = "unknown";
53 private OptionsNode m_Options;
54
55 #endregion
56
57 #region Constructors
58
59 /// <summary>
60 /// Initializes a new instance of the <see cref="ConfigurationNode"/> class.
61 /// </summary>
62 public ConfigurationNode()
63 {
64 m_Options = new OptionsNode();
65 }
66
67 #endregion
68
69 #region Properties
70
71 /// <summary>
72 /// Gets or sets the parent.
73 /// </summary>
74 /// <value>The parent.</value>
75 public override IDataNode Parent
76 {
77 get
78 {
79 return base.Parent;
80 }
81 set
82 {
83 base.Parent = value;
84 if(base.Parent is SolutionNode)
85 {
86 SolutionNode node = (SolutionNode)base.Parent;
87 if(node != null && node.Options != null)
88 {
89 node.Options.CopyTo(m_Options);
90 }
91 }
92 }
93 }
94
95 /// <summary>
96 /// Gets the name.
97 /// </summary>
98 /// <value>The name.</value>
99 public string Name
100 {
101 get
102 {
103 return m_Name;
104 }
105 }
106
107 /// <summary>
108 /// Gets or sets the options.
109 /// </summary>
110 /// <value>The options.</value>
111 public OptionsNode Options
112 {
113 get
114 {
115 return m_Options;
116 }
117 set
118 {
119 m_Options = value;
120 }
121 }
122
123 #endregion
124
125 #region Public Methods
126
127 /// <summary>
128 /// Parses the specified node.
129 /// </summary>
130 /// <param name="node">The node.</param>
131 public override void Parse(XmlNode node)
132 {
133 m_Name = Helper.AttributeValue(node, "name", m_Name);
134 if( node == null )
135 {
136 throw new ArgumentNullException("node");
137 }
138 foreach(XmlNode child in node.ChildNodes)
139 {
140 IDataNode dataNode = Kernel.Instance.ParseNode(child, this);
141 if(dataNode is OptionsNode)
142 {
143 ((OptionsNode)dataNode).CopyTo(m_Options);
144 }
145 }
146 }
147
148 /// <summary>
149 /// Copies to.
150 /// </summary>
151 /// <param name="conf">The conf.</param>
152 public void CopyTo(ConfigurationNode conf)
153 {
154 m_Options.CopyTo(conf.m_Options);
155 }
156
157 #endregion
158
159 #region ICloneable Members
160
161 /// <summary>
162 /// Creates a new object that is a copy of the current instance.
163 /// </summary>
164 /// <returns>
165 /// A new object that is a copy of this instance.
166 /// </returns>
167 public object Clone()
168 {
169 ConfigurationNode ret = new ConfigurationNode();
170 ret.m_Name = m_Name;
171 m_Options.CopyTo(ret.m_Options);
172 return ret;
173 }
174
175 #endregion
176 }
177}
diff --git a/Prebuild/src/Core/Nodes/DataNode.cs b/Prebuild/src/Core/Nodes/DataNode.cs
new file mode 100644
index 0000000..ef5f7ee
--- /dev/null
+++ b/Prebuild/src/Core/Nodes/DataNode.cs
@@ -0,0 +1,82 @@
1#region BSD License
2/*
3Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com)
4
5Redistribution and use in source and binary forms, with or without modification, are permitted
6provided that the following conditions are met:
7
8* Redistributions of source code must retain the above copyright notice, this list of conditions
9 and the following disclaimer.
10* Redistributions in binary form must reproduce the above copyright notice, this list of conditions
11 and the following disclaimer in the documentation and/or other materials provided with the
12 distribution.
13* The name of the author may not be used to endorse or promote products derived from this software
14 without specific prior written permission.
15
16THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
17BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
19EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
21OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
22IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23*/
24#endregion
25
26#region CVS Information
27/*
28 * $Source$
29 * $Author: jendave $
30 * $Date: 2006-01-28 01:49:58 +0100 (lö, 28 jan 2006) $
31 * $Revision: 71 $
32 */
33#endregion
34
35using System;
36using System.Xml;
37
38using Prebuild.Core.Attributes;
39using Prebuild.Core.Interfaces;
40
41namespace Prebuild.Core.Nodes
42{
43 /// <summary>
44 ///
45 /// </summary>
46 public class DataNode : IDataNode
47 {
48 #region Fields
49
50 private IDataNode parent;
51
52 #endregion
53
54 #region IDataNode Members
55
56 /// <summary>
57 /// Gets or sets the parent.
58 /// </summary>
59 /// <value>The parent.</value>
60 public virtual IDataNode Parent
61 {
62 get
63 {
64 return parent;
65 }
66 set
67 {
68 parent = value;
69 }
70 }
71
72 /// <summary>
73 /// Parses the specified node.
74 /// </summary>
75 /// <param name="node">The node.</param>
76 public virtual void Parse(XmlNode node)
77 {
78 }
79
80 #endregion
81 }
82}
diff --git a/Prebuild/src/Core/Nodes/ExcludeNode.cs b/Prebuild/src/Core/Nodes/ExcludeNode.cs
new file mode 100644
index 0000000..bfcebca
--- /dev/null
+++ b/Prebuild/src/Core/Nodes/ExcludeNode.cs
@@ -0,0 +1,85 @@
1#region BSD License
2/*
3Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com)
4
5Redistribution and use in source and binary forms, with or without modification, are permitted
6provided that the following conditions are met:
7
8* Redistributions of source code must retain the above copyright notice, this list of conditions
9 and the following disclaimer.
10* Redistributions in binary form must reproduce the above copyright notice, this list of conditions
11 and the following disclaimer in the documentation and/or other materials provided with the
12 distribution.
13* The name of the author may not be used to endorse or promote products derived from this software
14 without specific prior written permission.
15
16THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
17BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
19EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
21OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
22IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23*/
24#endregion
25
26#region CVS Information
27/*
28 * $Source$
29 * $Author: jendave $
30 * $Date: 2006-01-31 16:35:39 +0100 (ti, 31 jan 2006) $
31 * $Revision: 74 $
32 */
33#endregion
34
35using System;
36using System.Xml;
37
38using Prebuild.Core.Attributes;
39using Prebuild.Core.Interfaces;
40using Prebuild.Core.Utilities;
41
42namespace Prebuild.Core.Nodes
43{
44 /// <summary>
45 ///
46 /// </summary>
47 [DataNode("Exclude")]
48 public class ExcludeNode : DataNode
49 {
50 #region Fields
51
52 private string m_Name = "unknown";
53
54 #endregion
55
56 #region Properties
57
58 /// <summary>
59 /// Gets the name.
60 /// </summary>
61 /// <value>The name.</value>
62 public string Name
63 {
64 get
65 {
66 return m_Name;
67 }
68 }
69
70 #endregion
71
72 #region Public Methods
73
74 /// <summary>
75 /// Parses the specified node.
76 /// </summary>
77 /// <param name="node">The node.</param>
78 public override void Parse(XmlNode node)
79 {
80 m_Name = Helper.AttributeValue(node, "name", m_Name);
81 }
82
83 #endregion
84 }
85}
diff --git a/Prebuild/src/Core/Nodes/FileNode.cs b/Prebuild/src/Core/Nodes/FileNode.cs
new file mode 100644
index 0000000..de3b69e
--- /dev/null
+++ b/Prebuild/src/Core/Nodes/FileNode.cs
@@ -0,0 +1,238 @@
1#region BSD License
2/*
3Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com)
4
5Redistribution and use in source and binary forms, with or without modification, are permitted
6provided that the following conditions are met:
7
8* Redistributions of source code must retain the above copyright notice, this list of conditions
9 and the following disclaimer.
10* Redistributions in binary form must reproduce the above copyright notice, this list of conditions
11 and the following disclaimer in the documentation and/or other materials provided with the
12 distribution.
13* The name of the author may not be used to endorse or promote products derived from this software
14 without specific prior written permission.
15
16THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
17BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
19EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
21OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
22IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23*/
24#endregion
25
26#region CVS Information
27/*
28 * $Source$
29 * $Author: jendave $
30 * $Date: 2007-01-08 17:55:40 +0100 (må, 08 jan 2007) $
31 * $Revision: 197 $
32 */
33#endregion
34
35using System;
36using System.IO;
37using System.Xml;
38
39using Prebuild.Core.Attributes;
40using Prebuild.Core.Interfaces;
41using Prebuild.Core.Utilities;
42
43namespace Prebuild.Core.Nodes
44{
45 /// <summary>
46 ///
47 /// </summary>
48 public enum BuildAction
49 {
50 /// <summary>
51 ///
52 /// </summary>
53 None,
54 /// <summary>
55 ///
56 /// </summary>
57 Compile,
58 /// <summary>
59 ///
60 /// </summary>
61 Content,
62 /// <summary>
63 ///
64 /// </summary>
65 EmbeddedResource
66 }
67
68 /// <summary>
69 ///
70 /// </summary>
71 public enum SubType
72 {
73 /// <summary>
74 ///
75 /// </summary>
76 Code,
77 /// <summary>
78 ///
79 /// </summary>
80 Component,
81 /// <summary>
82 ///
83 /// </summary>
84 Designer,
85 /// <summary>
86 ///
87 /// </summary>
88 Form,
89 /// <summary>
90 ///
91 /// </summary>
92 Settings,
93 /// <summary>
94 ///
95 /// </summary>
96 UserControl
97 }
98
99 public enum CopyToOutput
100 {
101 Never,
102 Always,
103 PreserveNewest
104 }
105
106 /// <summary>
107 ///
108 /// </summary>
109 [DataNode("File")]
110 public class FileNode : DataNode
111 {
112 #region Fields
113
114 private string m_Path;
115 private string m_ResourceName = "";
116 private BuildAction m_BuildAction = BuildAction.Compile;
117 private bool m_Valid;
118 private SubType m_SubType = SubType.Code;
119 private CopyToOutput m_CopyToOutput = CopyToOutput.Never;
120 private bool m_Link = false;
121
122
123 #endregion
124
125 #region Properties
126
127 /// <summary>
128 ///
129 /// </summary>
130 public string Path
131 {
132 get
133 {
134 return m_Path;
135 }
136 }
137
138 /// <summary>
139 ///
140 /// </summary>
141 public string ResourceName
142 {
143 get
144 {
145 return m_ResourceName;
146 }
147 }
148
149 /// <summary>
150 ///
151 /// </summary>
152 public BuildAction BuildAction
153 {
154 get
155 {
156 return m_BuildAction;
157 }
158 }
159
160 public CopyToOutput CopyToOutput
161 {
162 get
163 {
164 return this.m_CopyToOutput;
165 }
166 }
167
168 public bool IsLink
169 {
170 get
171 {
172 return this.m_Link;
173 }
174 }
175
176 /// <summary>
177 ///
178 /// </summary>
179 public SubType SubType
180 {
181 get
182 {
183 return m_SubType;
184 }
185 }
186
187 /// <summary>
188 ///
189 /// </summary>
190 public bool IsValid
191 {
192 get
193 {
194 return m_Valid;
195 }
196 }
197
198 #endregion
199
200 #region Public Methods
201
202 /// <summary>
203 ///
204 /// </summary>
205 /// <param name="node"></param>
206 public override void Parse(XmlNode node)
207 {
208 m_BuildAction = (BuildAction)Enum.Parse(typeof(BuildAction),
209 Helper.AttributeValue(node, "buildAction", m_BuildAction.ToString()));
210 m_SubType = (SubType)Enum.Parse(typeof(SubType),
211 Helper.AttributeValue(node, "subType", m_SubType.ToString()));
212 m_ResourceName = Helper.AttributeValue(node, "resourceName", m_ResourceName.ToString());
213 this.m_Link = bool.Parse(Helper.AttributeValue(node, "link", bool.FalseString));
214 this.m_CopyToOutput = (CopyToOutput) Enum.Parse(typeof(CopyToOutput), Helper.AttributeValue(node, "copyToOutput", this.m_CopyToOutput.ToString()));
215
216 if( node == null )
217 {
218 throw new ArgumentNullException("node");
219 }
220
221 m_Path = Helper.InterpolateForEnvironmentVariables(node.InnerText);
222 if(m_Path == null)
223 {
224 m_Path = "";
225 }
226
227 m_Path = m_Path.Trim();
228 m_Valid = true;
229 if(!File.Exists(m_Path))
230 {
231 m_Valid = false;
232 Kernel.Instance.Log.Write(LogType.Warning, "File does not exist: {0}", m_Path);
233 }
234 }
235
236 #endregion
237 }
238}
diff --git a/Prebuild/src/Core/Nodes/FilesNode.cs b/Prebuild/src/Core/Nodes/FilesNode.cs
new file mode 100644
index 0000000..442a45f
--- /dev/null
+++ b/Prebuild/src/Core/Nodes/FilesNode.cs
@@ -0,0 +1,222 @@
1#region BSD License
2/*
3Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com)
4
5Redistribution and use in source and binary forms, with or without modification, are permitted
6provided that the following conditions are met:
7
8* Redistributions of source code must retain the above copyright notice, this list of conditions
9 and the following disclaimer.
10* Redistributions in binary form must reproduce the above copyright notice, this list of conditions
11 and the following disclaimer in the documentation and/or other materials provided with the
12 distribution.
13* The name of the author may not be used to endorse or promote products derived from this software
14 without specific prior written permission.
15
16THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
17BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
19EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
21OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
22IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23*/
24#endregion
25
26#region CVS Information
27/*
28 * $Source$
29 * $Author: jendave $
30 * $Date: 2006-09-20 09:42:51 +0200 (on, 20 sep 2006) $
31 * $Revision: 164 $
32 */
33#endregion
34
35using System;
36using System.Collections;
37using System.Collections.Specialized;
38using System.Xml;
39
40using Prebuild.Core.Attributes;
41using Prebuild.Core.Interfaces;
42
43namespace Prebuild.Core.Nodes
44{
45 /// <summary>
46 ///
47 /// </summary>
48 [DataNode("Files")]
49 public class FilesNode : DataNode
50 {
51 #region Fields
52
53 private StringCollection m_Files;
54 private Hashtable m_BuildActions;
55 private Hashtable m_SubTypes;
56 private Hashtable m_ResourceNames;
57 private Hashtable m_CopyToOutputs;
58 private Hashtable m_Links;
59
60
61 #endregion
62
63 #region Constructors
64
65 /// <summary>
66 ///
67 /// </summary>
68 public FilesNode()
69 {
70 m_Files = new StringCollection();
71 m_BuildActions = new Hashtable();
72 m_SubTypes = new Hashtable();
73 m_ResourceNames = new Hashtable();
74 m_CopyToOutputs = new Hashtable();
75 m_Links = new Hashtable();
76 }
77
78 #endregion
79
80 #region Properties
81
82 /// <summary>
83 ///
84 /// </summary>
85 public int Count
86 {
87 get
88 {
89 return m_Files.Count;
90 }
91 }
92
93 #endregion
94
95 #region Public Methods
96
97 /// <summary>
98 ///
99 /// </summary>
100 /// <param name="file"></param>
101 /// <returns></returns>
102 public BuildAction GetBuildAction(string file)
103 {
104 if(!m_BuildActions.ContainsKey(file))
105 {
106 return BuildAction.Compile;
107 }
108
109 return (BuildAction)m_BuildActions[file];
110 }
111
112 public CopyToOutput GetCopyToOutput(string file)
113 {
114 if (!this.m_CopyToOutputs.ContainsKey(file))
115 {
116 return CopyToOutput.Never;
117 }
118 return (CopyToOutput) this.m_CopyToOutputs[file];
119 }
120
121 public bool GetIsLink(string file)
122 {
123 if (!this.m_Links.ContainsKey(file))
124 {
125 return false;
126 }
127 return (bool) this.m_Links[file];
128 }
129
130 /// <summary>
131 ///
132 /// </summary>
133 /// <param name="file"></param>
134 /// <returns></returns>
135 public SubType GetSubType(string file)
136 {
137 if(!m_SubTypes.ContainsKey(file))
138 {
139 return SubType.Code;
140 }
141
142 return (SubType)m_SubTypes[file];
143 }
144
145 /// <summary>
146 ///
147 /// </summary>
148 /// <param name="file"></param>
149 /// <returns></returns>
150 public string GetResourceName(string file)
151 {
152 if(!m_ResourceNames.ContainsKey(file))
153 {
154 return "";
155 }
156
157 return (string)m_ResourceNames[file];
158 }
159
160 /// <summary>
161 ///
162 /// </summary>
163 /// <param name="node"></param>
164 public override void Parse(XmlNode node)
165 {
166 if( node == null )
167 {
168 throw new ArgumentNullException("node");
169 }
170 foreach(XmlNode child in node.ChildNodes)
171 {
172 IDataNode dataNode = Kernel.Instance.ParseNode(child, this);
173 if(dataNode is FileNode)
174 {
175 FileNode fileNode = (FileNode)dataNode;
176 if(fileNode.IsValid)
177 {
178 if (!m_Files.Contains(fileNode.Path))
179 {
180 m_Files.Add(fileNode.Path);
181 m_BuildActions[fileNode.Path] = fileNode.BuildAction;
182 m_SubTypes[fileNode.Path] = fileNode.SubType;
183 m_ResourceNames[fileNode.Path] = fileNode.ResourceName;
184 this.m_Links[fileNode.Path] = fileNode.IsLink;
185 this.m_CopyToOutputs[fileNode.Path] = fileNode.CopyToOutput;
186
187 }
188 }
189 }
190 else if(dataNode is MatchNode)
191 {
192 foreach(string file in ((MatchNode)dataNode).Files)
193 {
194 if (!m_Files.Contains(file))
195 {
196 m_Files.Add(file);
197 m_BuildActions[file] = ((MatchNode)dataNode).BuildAction;
198 m_SubTypes[file] = ((MatchNode)dataNode).SubType;
199 m_ResourceNames[file] = ((MatchNode)dataNode).ResourceName;
200 this.m_Links[file] = ((MatchNode) dataNode).IsLink;
201 this.m_CopyToOutputs[file] = ((MatchNode) dataNode).CopyToOutput;
202
203 }
204 }
205 }
206 }
207 }
208
209 // TODO: Check in to why StringCollection's enumerator doesn't implement
210 // IEnumerator?
211 /// <summary>
212 ///
213 /// </summary>
214 /// <returns></returns>
215 public StringEnumerator GetEnumerator()
216 {
217 return m_Files.GetEnumerator();
218 }
219
220 #endregion
221 }
222}
diff --git a/Prebuild/src/Core/Nodes/MatchNode.cs b/Prebuild/src/Core/Nodes/MatchNode.cs
new file mode 100644
index 0000000..e0d2fa8
--- /dev/null
+++ b/Prebuild/src/Core/Nodes/MatchNode.cs
@@ -0,0 +1,299 @@
1#region BSD License
2/*
3Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com)
4
5Redistribution and use in source and binary forms, with or without modification, are permitted
6provided that the following conditions are met:
7
8* Redistributions of source code must retain the above copyright notice, this list of conditions
9 and the following disclaimer.
10* Redistributions in binary form must reproduce the above copyright notice, this list of conditions
11 and the following disclaimer in the documentation and/or other materials provided with the
12 distribution.
13* The name of the author may not be used to endorse or promote products derived from this software
14 without specific prior written permission.
15
16THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
17BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
19EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
21OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
22IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23*/
24#endregion
25
26#region CVS Information
27/*
28 * $Source$
29 * $Author: jendave $
30 * $Date: 2006-09-20 09:42:51 +0200 (on, 20 sep 2006) $
31 * $Revision: 164 $
32 */
33#endregion
34
35using System;
36using System.Collections.Specialized;
37using System.IO;
38using System.Text.RegularExpressions;
39using System.Xml;
40
41using Prebuild.Core.Attributes;
42using Prebuild.Core.Interfaces;
43using Prebuild.Core.Utilities;
44
45namespace Prebuild.Core.Nodes
46{
47 /// <summary>
48 ///
49 /// </summary>
50 [DataNode("Match")]
51 public class MatchNode : DataNode
52 {
53 #region Fields
54
55 private StringCollection m_Files;
56 private Regex m_Regex;
57 private BuildAction m_BuildAction = BuildAction.Compile;
58 private SubType m_SubType = SubType.Code;
59 string m_ResourceName = "";
60 private CopyToOutput m_CopyToOutput;
61 private bool m_Link;
62
63
64 #endregion
65
66 #region Constructors
67
68 /// <summary>
69 ///
70 /// </summary>
71 public MatchNode()
72 {
73 m_Files = new StringCollection();
74 }
75
76 #endregion
77
78 #region Properties
79
80 /// <summary>
81 ///
82 /// </summary>
83 public StringCollection Files
84 {
85 get
86 {
87 return m_Files;
88 }
89 }
90
91 /// <summary>
92 ///
93 /// </summary>
94 public BuildAction BuildAction
95 {
96 get
97 {
98 return m_BuildAction;
99 }
100 }
101
102 /// <summary>
103 ///
104 /// </summary>
105 public SubType SubType
106 {
107 get
108 {
109 return m_SubType;
110 }
111 }
112
113 public CopyToOutput CopyToOutput
114 {
115 get
116 {
117 return this.m_CopyToOutput;
118 }
119 }
120
121 public bool IsLink
122 {
123 get
124 {
125 return this.m_Link;
126 }
127 }
128
129 /// <summary>
130 ///
131 /// </summary>
132 public string ResourceName
133 {
134 get
135 {
136 return m_ResourceName;
137 }
138 }
139
140
141 #endregion
142
143 #region Private Methods
144
145 /// <summary>
146 /// Recurses the directories.
147 /// </summary>
148 /// <param name="path">The path.</param>
149 /// <param name="pattern">The pattern.</param>
150 /// <param name="recurse">if set to <c>true</c> [recurse].</param>
151 /// <param name="useRegex">if set to <c>true</c> [use regex].</param>
152 private void RecurseDirectories(string path, string pattern, bool recurse, bool useRegex)
153 {
154 try
155 {
156 string[] files;
157
158 if(!useRegex)
159 {
160 files = Directory.GetFiles(path, pattern);
161 if(files != null)
162 {
163 string fileTemp;
164 foreach (string file in files)
165 {
166 if (file.Substring(0,2) == "./" || file.Substring(0,2) == ".\\")
167 {
168 fileTemp = file.Substring(2);
169 }
170 else
171 {
172 fileTemp = file;
173 }
174
175 m_Files.Add(fileTemp);
176 }
177 }
178 else
179 {
180 return;
181 }
182 }
183 else
184 {
185 Match match;
186 files = Directory.GetFiles(path);
187 foreach(string file in files)
188 {
189 match = m_Regex.Match(file);
190 if(match.Success)
191 {
192 m_Files.Add(file);
193 }
194 }
195 }
196
197 if(recurse)
198 {
199 string[] dirs = Directory.GetDirectories(path);
200 if(dirs != null && dirs.Length > 0)
201 {
202 foreach(string str in dirs)
203 {
204 RecurseDirectories(Helper.NormalizePath(str), pattern, recurse, useRegex);
205 }
206 }
207 }
208 }
209 catch(DirectoryNotFoundException)
210 {
211 return;
212 }
213 catch(ArgumentException)
214 {
215 return;
216 }
217 }
218
219 #endregion
220
221 #region Public Methods
222
223 /// <summary>
224 ///
225 /// </summary>
226 /// <param name="node"></param>
227 public override void Parse(XmlNode node)
228 {
229 if( node == null )
230 {
231 throw new ArgumentNullException("node");
232 }
233 string path = Helper.AttributeValue(node, "path", ".");
234 string pattern = Helper.AttributeValue(node, "pattern", "*");
235 bool recurse = (bool)Helper.TranslateValue(typeof(bool), Helper.AttributeValue(node, "recurse", "false"));
236 bool useRegex = (bool)Helper.TranslateValue(typeof(bool), Helper.AttributeValue(node, "useRegex", "false"));
237 m_BuildAction = (BuildAction)Enum.Parse(typeof(BuildAction),
238 Helper.AttributeValue(node, "buildAction", m_BuildAction.ToString()));
239 m_SubType = (SubType)Enum.Parse(typeof(SubType),
240 Helper.AttributeValue(node, "subType", m_SubType.ToString()));
241 m_ResourceName = Helper.AttributeValue(node, "resourceName", m_ResourceName.ToString());
242 this.m_CopyToOutput = (CopyToOutput) Enum.Parse(typeof(CopyToOutput), Helper.AttributeValue(node, "copyToOutput", this.m_CopyToOutput.ToString()));
243 this.m_Link = bool.Parse(Helper.AttributeValue(node, "link", bool.FalseString));
244
245
246 if(path != null && path.Length == 0)
247 {
248 path = ".";//use current directory
249 }
250 //throw new WarningException("Match must have a 'path' attribute");
251
252 if(pattern == null)
253 {
254 throw new WarningException("Match must have a 'pattern' attribute");
255 }
256
257 path = Helper.NormalizePath(path);
258 if(!Directory.Exists(path))
259 {
260 throw new WarningException("Match path does not exist: {0}", path);
261 }
262
263 try
264 {
265 if(useRegex)
266 {
267 m_Regex = new Regex(pattern);
268 }
269 }
270 catch(ArgumentException ex)
271 {
272 throw new WarningException("Could not compile regex pattern: {0}", ex.Message);
273 }
274
275 RecurseDirectories(path, pattern, recurse, useRegex);
276
277 foreach(XmlNode child in node.ChildNodes)
278 {
279 IDataNode dataNode = Kernel.Instance.ParseNode(child, this);
280 if(dataNode is ExcludeNode)
281 {
282 ExcludeNode excludeNode = (ExcludeNode)dataNode;
283 if (m_Files.Contains(Helper.NormalizePath(excludeNode.Name)))
284 {
285 m_Files.Remove(Helper.NormalizePath(excludeNode.Name));
286 }
287 }
288 }
289
290 if(m_Files.Count < 1)
291 {
292 throw new WarningException("Match returned no files: {0}{1}", Helper.EndPath(path), pattern);
293 }
294 m_Regex = null;
295 }
296
297 #endregion
298 }
299}
diff --git a/Prebuild/src/Core/Nodes/OptionsNode.cs b/Prebuild/src/Core/Nodes/OptionsNode.cs
new file mode 100644
index 0000000..b5a2f60
--- /dev/null
+++ b/Prebuild/src/Core/Nodes/OptionsNode.cs
@@ -0,0 +1,655 @@
1#region BSD License
2/*
3Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com)
4
5Redistribution and use in source and binary forms, with or without modification, are permitted
6provided that the following conditions are met:
7
8* Redistributions of source code must retain the above copyright notice, this list of conditions
9 and the following disclaimer.
10* Redistributions in binary form must reproduce the above copyright notice, this list of conditions
11 and the following disclaimer in the documentation and/or other materials provided with the
12 distribution.
13* The name of the author may not be used to endorse or promote products derived from this software
14 without specific prior written permission.
15
16THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
17BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
19EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
21OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
22IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23*/
24#endregion
25
26#region CVS Information
27/*
28 * $Source$
29 * $Author: jendave $
30 * $Date: 2007-01-08 17:55:40 +0100 (må, 08 jan 2007) $
31 * $Revision: 197 $
32 */
33#endregion
34
35
36
37using System;
38using System.Collections;
39using System.Collections.Specialized;
40using System.Reflection;
41using System.Xml;
42
43using Prebuild.Core.Attributes;
44using Prebuild.Core.Interfaces;
45using Prebuild.Core.Utilities;
46
47namespace Prebuild.Core.Nodes
48{
49 /// <summary>
50 ///
51 /// </summary>
52 [DataNode("Options")]
53 public class OptionsNode : DataNode
54 {
55 #region Fields
56
57 private static Hashtable m_OptionFields;
58
59 [OptionNode("CompilerDefines")]
60 private string m_CompilerDefines = "";
61
62 /// <summary>
63 ///
64 /// </summary>
65 public string CompilerDefines
66 {
67 get
68 {
69 return m_CompilerDefines;
70 }
71 set
72 {
73 m_CompilerDefines = value;
74 }
75 }
76
77 [OptionNode("OptimizeCode")]
78 private bool m_OptimizeCode;
79
80 /// <summary>
81 ///
82 /// </summary>
83 public bool OptimizeCode
84 {
85 get
86 {
87 return m_OptimizeCode;
88 }
89 set
90 {
91 m_OptimizeCode = value;
92 }
93 }
94
95 [OptionNode("CheckUnderflowOverflow")]
96 private bool m_CheckUnderflowOverflow;
97
98 /// <summary>
99 ///
100 /// </summary>
101 public bool CheckUnderflowOverflow
102 {
103 get
104 {
105 return m_CheckUnderflowOverflow;
106 }
107 set
108 {
109 m_CheckUnderflowOverflow = value;
110 }
111 }
112
113 [OptionNode("AllowUnsafe")]
114 private bool m_AllowUnsafe;
115
116 /// <summary>
117 ///
118 /// </summary>
119 public bool AllowUnsafe
120 {
121 get
122 {
123 return m_AllowUnsafe;
124 }
125 set
126 {
127 m_AllowUnsafe = value;
128 }
129 }
130
131 [OptionNode("PreBuildEvent")]
132 private string m_PreBuildEvent;
133
134 /// <summary>
135 ///
136 /// </summary>
137 public string PreBuildEvent
138 {
139 get
140 {
141 return m_PreBuildEvent;
142 }
143 set
144 {
145 m_PreBuildEvent = value;
146 }
147 }
148
149 [OptionNode("PostBuildEvent")]
150 private string m_PostBuildEvent;
151
152 /// <summary>
153 ///
154 /// </summary>
155 public string PostBuildEvent
156 {
157 get
158 {
159 return m_PostBuildEvent;
160 }
161 set
162 {
163 m_PostBuildEvent = value;
164 }
165 }
166
167 [OptionNode("PreBuildEventArgs")]
168 private string m_PreBuildEventArgs;
169
170 /// <summary>
171 ///
172 /// </summary>
173 public string PreBuildEventArgs
174 {
175 get
176 {
177 return m_PreBuildEventArgs;
178 }
179 set
180 {
181 m_PreBuildEventArgs = value;
182 }
183 }
184
185 [OptionNode("PostBuildEventArgs")]
186 private string m_PostBuildEventArgs;
187
188 /// <summary>
189 ///
190 /// </summary>
191 public string PostBuildEventArgs
192 {
193 get
194 {
195 return m_PostBuildEventArgs;
196 }
197 set
198 {
199 m_PostBuildEventArgs = value;
200 }
201 }
202
203 [OptionNode("RunPostBuildEvent")]
204 private string m_RunPostBuildEvent;
205
206 /// <summary>
207 ///
208 /// </summary>
209 public string RunPostBuildEvent
210 {
211 get
212 {
213 return m_RunPostBuildEvent;
214 }
215 set
216 {
217 m_RunPostBuildEvent = value;
218 }
219 }
220
221 [OptionNode("RunScript")]
222 private string m_RunScript;
223
224 /// <summary>
225 ///
226 /// </summary>
227 public string RunScript
228 {
229 get
230 {
231 return m_RunScript;
232 }
233 set
234 {
235 m_RunScript = value;
236 }
237 }
238
239 [OptionNode("WarningLevel")]
240 private int m_WarningLevel = 4;
241
242 /// <summary>
243 ///
244 /// </summary>
245 public int WarningLevel
246 {
247 get
248 {
249 return m_WarningLevel;
250 }
251 set
252 {
253 m_WarningLevel = value;
254 }
255 }
256
257 [OptionNode("WarningsAsErrors")]
258 private bool m_WarningsAsErrors;
259
260 /// <summary>
261 ///
262 /// </summary>
263 public bool WarningsAsErrors
264 {
265 get
266 {
267 return m_WarningsAsErrors;
268 }
269 set
270 {
271 m_WarningsAsErrors = value;
272 }
273 }
274
275 [OptionNode("SuppressWarnings")]
276 private string m_SuppressWarnings = "";
277
278 /// <summary>
279 ///
280 /// </summary>
281 public string SuppressWarnings
282 {
283 get
284 {
285 return m_SuppressWarnings;
286 }
287 set
288 {
289 m_SuppressWarnings = value;
290 }
291 }
292
293 [OptionNode("OutputPath")]
294 private string m_OutputPath = "bin/";
295
296 /// <summary>
297 ///
298 /// </summary>
299 public string OutputPath
300 {
301 get
302 {
303 return m_OutputPath;
304 }
305 set
306 {
307 m_OutputPath = value;
308 }
309 }
310
311 [OptionNode("GenerateDocumentation")]
312 private bool m_GenerateDocumentation;
313
314 /// <summary>
315 ///
316 /// </summary>
317 public bool GenerateDocumentation
318 {
319 get
320 {
321 return m_GenerateDocumentation;
322 }
323 set
324 {
325 m_GenerateDocumentation = value;
326 }
327 }
328
329 [OptionNode("GenerateXmlDocFile")]
330 private bool m_GenerateXmlDocFile;
331
332 /// <summary>
333 ///
334 /// </summary>
335 public bool GenerateXmlDocFile
336 {
337 get
338 {
339 return m_GenerateXmlDocFile;
340 }
341 set
342 {
343 m_GenerateXmlDocFile = value;
344 }
345 }
346
347 [OptionNode("XmlDocFile")]
348 private string m_XmlDocFile = "";
349
350 /// <summary>
351 ///
352 /// </summary>
353 public string XmlDocFile
354 {
355 get
356 {
357 return m_XmlDocFile;
358 }
359 set
360 {
361 m_XmlDocFile = value;
362 }
363 }
364
365 [OptionNode("KeyFile")]
366 private string m_KeyFile = "";
367
368 /// <summary>
369 ///
370 /// </summary>
371 public string KeyFile
372 {
373 get
374 {
375 return m_KeyFile;
376 }
377 set
378 {
379 m_KeyFile = value;
380 }
381 }
382
383 [OptionNode("DebugInformation")]
384 private bool m_DebugInformation;
385
386 /// <summary>
387 ///
388 /// </summary>
389 public bool DebugInformation
390 {
391 get
392 {
393 return m_DebugInformation;
394 }
395 set
396 {
397 m_DebugInformation = value;
398 }
399 }
400
401 [OptionNode("RegisterComInterop")]
402 private bool m_RegisterComInterop;
403
404 /// <summary>
405 ///
406 /// </summary>
407 public bool RegisterComInterop
408 {
409 get
410 {
411 return m_RegisterComInterop;
412 }
413 set
414 {
415 m_RegisterComInterop = value;
416 }
417 }
418
419 [OptionNode("RemoveIntegerChecks")]
420 private bool m_RemoveIntegerChecks;
421
422 /// <summary>
423 ///
424 /// </summary>
425 public bool RemoveIntegerChecks
426 {
427 get
428 {
429 return m_RemoveIntegerChecks;
430 }
431 set
432 {
433 m_RemoveIntegerChecks = value;
434 }
435 }
436
437 [OptionNode("IncrementalBuild")]
438 private bool m_IncrementalBuild;
439
440 /// <summary>
441 ///
442 /// </summary>
443 public bool IncrementalBuild
444 {
445 get
446 {
447 return m_IncrementalBuild;
448 }
449 set
450 {
451 m_IncrementalBuild = value;
452 }
453 }
454
455 [OptionNode("BaseAddress")]
456 private string m_BaseAddress = "285212672";
457
458 /// <summary>
459 ///
460 /// </summary>
461 public string BaseAddress
462 {
463 get
464 {
465 return m_BaseAddress;
466 }
467 set
468 {
469 m_BaseAddress = value;
470 }
471 }
472
473 [OptionNode("FileAlignment")]
474 private int m_FileAlignment = 4096;
475
476 /// <summary>
477 ///
478 /// </summary>
479 public int FileAlignment
480 {
481 get
482 {
483 return m_FileAlignment;
484 }
485 set
486 {
487 m_FileAlignment = value;
488 }
489 }
490
491 [OptionNode("NoStdLib")]
492 private bool m_NoStdLib;
493
494 /// <summary>
495 ///
496 /// </summary>
497 public bool NoStdLib
498 {
499 get
500 {
501 return m_NoStdLib;
502 }
503 set
504 {
505 m_NoStdLib = value;
506 }
507 }
508
509 private StringCollection m_FieldsDefined;
510
511 #endregion
512
513 #region Constructors
514
515 /// <summary>
516 /// Initializes the <see cref="OptionsNode"/> class.
517 /// </summary>
518 static OptionsNode()
519 {
520 Type t = typeof(OptionsNode);
521
522 m_OptionFields = new Hashtable();
523 foreach(FieldInfo f in t.GetFields(BindingFlags.NonPublic | BindingFlags.Instance))
524 {
525 object[] attrs = f.GetCustomAttributes(typeof(OptionNodeAttribute), false);
526 if(attrs == null || attrs.Length < 1)
527 {
528 continue;
529 }
530
531 OptionNodeAttribute ona = (OptionNodeAttribute)attrs[0];
532 m_OptionFields[ona.NodeName] = f;
533 }
534 }
535
536 /// <summary>
537 /// Initializes a new instance of the <see cref="OptionsNode"/> class.
538 /// </summary>
539 public OptionsNode()
540 {
541 m_FieldsDefined = new StringCollection();
542 }
543
544 #endregion
545
546 #region Properties
547
548 /// <summary>
549 /// Gets the <see cref="Object"/> at the specified index.
550 /// </summary>
551 /// <value></value>
552 public object this[string index]
553 {
554 get
555 {
556 if(!m_OptionFields.ContainsKey(index))
557 {
558 return null;
559 }
560
561 FieldInfo f = (FieldInfo)m_OptionFields[index];
562 return f.GetValue(this);
563 }
564 }
565
566 /// <summary>
567 /// Gets the <see cref="Object"/> at the specified index.
568 /// </summary>
569 /// <value></value>
570 public object this[string index, object defaultValue]
571 {
572 get
573 {
574 object valueObject = this[index];
575 if(valueObject != null && valueObject is string && ((string)valueObject).Length == 0)
576 {
577 return defaultValue;
578 }
579 return valueObject;
580 }
581 }
582
583
584 #endregion
585
586 #region Private Methods
587
588 private void FlagDefined(string name)
589 {
590 if(!m_FieldsDefined.Contains(name))
591 {
592 m_FieldsDefined.Add(name);
593 }
594 }
595
596 private void SetOption(string nodeName, string val)
597 {
598 lock(m_OptionFields)
599 {
600 if(!m_OptionFields.ContainsKey(nodeName))
601 {
602 return;
603 }
604
605 FieldInfo f = (FieldInfo)m_OptionFields[nodeName];
606 f.SetValue(this, Helper.TranslateValue(f.FieldType, val));
607 FlagDefined(f.Name);
608 }
609 }
610
611 #endregion
612
613 #region Public Methods
614
615 /// <summary>
616 /// Parses the specified node.
617 /// </summary>
618 /// <param name="node">The node.</param>
619 public override void Parse(XmlNode node)
620 {
621 if( node == null )
622 {
623 throw new ArgumentNullException("node");
624 }
625
626 foreach(XmlNode child in node.ChildNodes)
627 {
628 SetOption(child.Name, Helper.InterpolateForEnvironmentVariables(child.InnerText));
629 }
630 }
631
632 /// <summary>
633 /// Copies to.
634 /// </summary>
635 /// <param name="opt">The opt.</param>
636 public void CopyTo(OptionsNode opt)
637 {
638 if(opt == null)
639 {
640 return;
641 }
642
643 foreach(FieldInfo f in m_OptionFields.Values)
644 {
645 if(m_FieldsDefined.Contains(f.Name))
646 {
647 f.SetValue(opt, f.GetValue(this));
648 opt.m_FieldsDefined.Add(f.Name);
649 }
650 }
651 }
652
653 #endregion
654 }
655}
diff --git a/Prebuild/src/Core/Nodes/ProcessNode.cs b/Prebuild/src/Core/Nodes/ProcessNode.cs
new file mode 100644
index 0000000..f546a4b
--- /dev/null
+++ b/Prebuild/src/Core/Nodes/ProcessNode.cs
@@ -0,0 +1,119 @@
1#region BSD License
2/*
3Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com)
4
5Redistribution and use in source and binary forms, with or without modification, are permitted
6provided that the following conditions are met:
7
8* Redistributions of source code must retain the above copyright notice, this list of conditions
9 and the following disclaimer.
10* Redistributions in binary form must reproduce the above copyright notice, this list of conditions
11 and the following disclaimer in the documentation and/or other materials provided with the
12 distribution.
13* The name of the author may not be used to endorse or promote products derived from this software
14 without specific prior written permission.
15
16THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
17BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
19EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
21OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
22IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23*/
24#endregion
25
26#region CVS Information
27/*
28 * $Source$
29 * $Author: jendave $
30 * $Date: 2006-01-28 01:49:58 +0100 (lö, 28 jan 2006) $
31 * $Revision: 71 $
32 */
33#endregion
34
35using System;
36using System.Collections;
37using System.Collections.Specialized;
38using System.Xml;
39
40using Prebuild.Core.Attributes;
41using Prebuild.Core.Interfaces;
42using Prebuild.Core.Utilities;
43
44namespace Prebuild.Core.Nodes
45{
46 /// <summary>
47 ///
48 /// </summary>
49 [DataNode("Process")]
50 public class ProcessNode : DataNode
51 {
52 #region Fields
53
54 private string m_Path;
55 private bool m_IsValid = true;
56
57 #endregion
58
59 #region Properties
60
61 /// <summary>
62 /// Gets the path.
63 /// </summary>
64 /// <value>The path.</value>
65 public string Path
66 {
67 get
68 {
69 return m_Path;
70 }
71 }
72
73 /// <summary>
74 /// Gets a value indicating whether this instance is valid.
75 /// </summary>
76 /// <value><c>true</c> if this instance is valid; otherwise, <c>false</c>.</value>
77 public bool IsValid
78 {
79 get
80 {
81 return m_IsValid;
82 }
83 }
84
85 #endregion
86
87 #region Public Methods
88
89 /// <summary>
90 /// Parses the specified node.
91 /// </summary>
92 /// <param name="node">The node.</param>
93 public override void Parse(XmlNode node)
94 {
95 if( node == null )
96 {
97 throw new ArgumentNullException("node");
98 }
99
100 m_Path = Helper.InterpolateForEnvironmentVariables(node.InnerText);
101 if(m_Path == null)
102 {
103 m_Path = "";
104 }
105
106 try
107 {
108 m_Path = Helper.ResolvePath(m_Path);
109 }
110 catch(ArgumentException)
111 {
112 Kernel.Instance.Log.Write(LogType.Warning, "Could not find prebuild file for processing: {0}", m_Path);
113 m_IsValid = false;
114 }
115 }
116
117 #endregion
118 }
119}
diff --git a/Prebuild/src/Core/Nodes/ProjectNode.cs b/Prebuild/src/Core/Nodes/ProjectNode.cs
new file mode 100644
index 0000000..7ac0a36
--- /dev/null
+++ b/Prebuild/src/Core/Nodes/ProjectNode.cs
@@ -0,0 +1,490 @@
1#region BSD License
2/*
3Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com)
4
5Redistribution and use in source and binary forms, with or without modification, are permitted
6provided that the following conditions are met:
7
8* Redistributions of source code must retain the above copyright notice, this list of conditions
9 and the following disclaimer.
10* Redistributions in binary form must reproduce the above copyright notice, this list of conditions
11 and the following disclaimer in the documentation and/or other materials provided with the
12 distribution.
13* The name of the author may not be used to endorse or promote products derived from this software
14 without specific prior written permission.
15
16THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
17BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
19EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
21OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
22IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23*/
24#endregion
25
26#region CVS Information
27/*
28 * $Source$
29 * $Author: jendave $
30 * $Date: 2006-11-11 05:43:20 +0100 (lö, 11 nov 2006) $
31 * $Revision: 192 $
32 */
33#endregion
34
35using System;
36using System.Collections;
37using System.IO;
38using System.Xml;
39
40using Prebuild.Core.Attributes;
41using Prebuild.Core.Interfaces;
42using Prebuild.Core.Utilities;
43
44namespace Prebuild.Core.Nodes
45{
46 /// <summary>
47 ///
48 /// </summary>
49 public enum ProjectType
50 {
51 /// <summary>
52 ///
53 /// </summary>
54 Exe,
55 /// <summary>
56 ///
57 /// </summary>
58 WinExe,
59 /// <summary>
60 ///
61 /// </summary>
62 Library
63 }
64
65 /// <summary>
66 ///
67 /// </summary>
68 public enum ClrRuntime
69 {
70 /// <summary>
71 ///
72 /// </summary>
73 Microsoft,
74 /// <summary>
75 ///
76 /// </summary>
77 Mono
78 }
79
80 /// <summary>
81 ///
82 /// </summary>
83 [DataNode("Project")]
84 public class ProjectNode : DataNode
85 {
86 #region Fields
87
88 private string m_Name = "unknown";
89 private string m_Path = "";
90 private string m_FullPath = "";
91 private string m_AssemblyName;
92 private string m_AppIcon = "";
93 private string m_DesignerFolder = "";
94 private string m_Language = "C#";
95 private ProjectType m_Type = ProjectType.Exe;
96 private ClrRuntime m_Runtime = ClrRuntime.Microsoft;
97 private string m_StartupObject = "";
98 private string m_RootNamespace;
99 private string m_FilterGroups = "";
100 private Guid m_Guid;
101
102 private Hashtable m_Configurations;
103 private ArrayList m_ReferencePaths;
104 private ArrayList m_References;
105 private FilesNode m_Files;
106
107 #endregion
108
109 #region Constructors
110
111 /// <summary>
112 /// Initializes a new instance of the <see cref="ProjectNode"/> class.
113 /// </summary>
114 public ProjectNode()
115 {
116 m_Configurations = new Hashtable();
117 m_ReferencePaths = new ArrayList();
118 m_References = new ArrayList();
119 }
120
121 #endregion
122
123 #region Properties
124
125 /// <summary>
126 /// Gets the name.
127 /// </summary>
128 /// <value>The name.</value>
129 public string Name
130 {
131 get
132 {
133 return m_Name;
134 }
135 }
136
137 /// <summary>
138 /// Gets the path.
139 /// </summary>
140 /// <value>The path.</value>
141 public string Path
142 {
143 get
144 {
145 return m_Path;
146 }
147 }
148
149 /// <summary>
150 /// Gets the filter groups.
151 /// </summary>
152 /// <value>The filter groups.</value>
153 public string FilterGroups
154 {
155 get
156 {
157 return m_FilterGroups;
158 }
159 }
160
161 /// <summary>
162 /// Gets the full path.
163 /// </summary>
164 /// <value>The full path.</value>
165 public string FullPath
166 {
167 get
168 {
169 return m_FullPath;
170 }
171 }
172
173 /// <summary>
174 /// Gets the name of the assembly.
175 /// </summary>
176 /// <value>The name of the assembly.</value>
177 public string AssemblyName
178 {
179 get
180 {
181 return m_AssemblyName;
182 }
183 }
184
185 /// <summary>
186 /// Gets the app icon.
187 /// </summary>
188 /// <value>The app icon.</value>
189 public string AppIcon
190 {
191 get
192 {
193 return m_AppIcon;
194 }
195 }
196
197 /// <summary>
198 ///
199 /// </summary>
200 public string DesignerFolder
201 {
202 get
203 {
204 return m_DesignerFolder;
205 }
206 }
207
208 /// <summary>
209 /// Gets the language.
210 /// </summary>
211 /// <value>The language.</value>
212 public string Language
213 {
214 get
215 {
216 return m_Language;
217 }
218 }
219
220 /// <summary>
221 /// Gets the type.
222 /// </summary>
223 /// <value>The type.</value>
224 public ProjectType Type
225 {
226 get
227 {
228 return m_Type;
229 }
230 }
231
232 /// <summary>
233 /// Gets the runtime.
234 /// </summary>
235 /// <value>The runtime.</value>
236 public ClrRuntime Runtime
237 {
238 get
239 {
240 return m_Runtime;
241 }
242 }
243
244 private bool m_GenerateAssemblyInfoFile = false;
245
246 /// <summary>
247 ///
248 /// </summary>
249 public bool GenerateAssemblyInfoFile
250 {
251 get
252 {
253 return m_GenerateAssemblyInfoFile;
254 }
255 set
256 {
257 m_GenerateAssemblyInfoFile = value;
258 }
259 }
260
261 /// <summary>
262 /// Gets the startup object.
263 /// </summary>
264 /// <value>The startup object.</value>
265 public string StartupObject
266 {
267 get
268 {
269 return m_StartupObject;
270 }
271 }
272
273 /// <summary>
274 /// Gets the root namespace.
275 /// </summary>
276 /// <value>The root namespace.</value>
277 public string RootNamespace
278 {
279 get
280 {
281 return m_RootNamespace;
282 }
283 }
284
285 /// <summary>
286 /// Gets the configurations.
287 /// </summary>
288 /// <value>The configurations.</value>
289 public ICollection Configurations
290 {
291 get
292 {
293 return m_Configurations.Values;
294 }
295 }
296
297 /// <summary>
298 /// Gets the configurations table.
299 /// </summary>
300 /// <value>The configurations table.</value>
301 public Hashtable ConfigurationsTable
302 {
303 get
304 {
305 return m_Configurations;
306 }
307 }
308
309 /// <summary>
310 /// Gets the reference paths.
311 /// </summary>
312 /// <value>The reference paths.</value>
313 public ArrayList ReferencePaths
314 {
315 get
316 {
317 return m_ReferencePaths;
318 }
319 }
320
321 /// <summary>
322 /// Gets the references.
323 /// </summary>
324 /// <value>The references.</value>
325 public ArrayList References
326 {
327 get
328 {
329 return m_References;
330 }
331 }
332
333 /// <summary>
334 /// Gets the files.
335 /// </summary>
336 /// <value>The files.</value>
337 public FilesNode Files
338 {
339 get
340 {
341 return m_Files;
342 }
343 }
344
345 /// <summary>
346 /// Gets or sets the parent.
347 /// </summary>
348 /// <value>The parent.</value>
349 public override IDataNode Parent
350 {
351 get
352 {
353 return base.Parent;
354 }
355 set
356 {
357 base.Parent = value;
358 if(base.Parent is SolutionNode && m_Configurations.Count < 1)
359 {
360 SolutionNode parent = (SolutionNode)base.Parent;
361 foreach(ConfigurationNode conf in parent.Configurations)
362 {
363 m_Configurations[conf.Name] = conf.Clone();
364 }
365 }
366 }
367 }
368
369 /// <summary>
370 /// Gets the GUID.
371 /// </summary>
372 /// <value>The GUID.</value>
373 public Guid Guid
374 {
375 get
376 {
377 return m_Guid;
378 }
379 }
380
381 #endregion
382
383 #region Private Methods
384
385 private void HandleConfiguration(ConfigurationNode conf)
386 {
387 if(String.Compare(conf.Name, "all", true) == 0) //apply changes to all, this may not always be applied first,
388 //so it *may* override changes to the same properties for configurations defines at the project level
389 {
390 foreach(ConfigurationNode confNode in this.m_Configurations.Values)
391 {
392 conf.CopyTo(confNode);//update the config templates defines at the project level with the overrides
393 }
394 }
395 if(m_Configurations.ContainsKey(conf.Name))
396 {
397 ConfigurationNode parentConf = (ConfigurationNode)m_Configurations[conf.Name];
398 conf.CopyTo(parentConf);//update the config templates defines at the project level with the overrides
399 }
400 else
401 {
402 m_Configurations[conf.Name] = conf;
403 }
404 }
405
406 #endregion
407
408 #region Public Methods
409
410 /// <summary>
411 /// Parses the specified node.
412 /// </summary>
413 /// <param name="node">The node.</param>
414 public override void Parse(XmlNode node)
415 {
416 m_Name = Helper.AttributeValue(node, "name", m_Name);
417 m_Path = Helper.AttributeValue(node, "path", m_Path);
418 m_FilterGroups = Helper.AttributeValue(node, "filterGroups", m_FilterGroups);
419 m_AppIcon = Helper.AttributeValue(node, "icon", m_AppIcon);
420 m_DesignerFolder = Helper.AttributeValue(node, "designerFolder", m_DesignerFolder);
421 m_AssemblyName = Helper.AttributeValue(node, "assemblyName", m_AssemblyName);
422 m_Language = Helper.AttributeValue(node, "language", m_Language);
423 m_Type = (ProjectType)Helper.EnumAttributeValue(node, "type", typeof(ProjectType), m_Type);
424 m_Runtime = (ClrRuntime)Helper.EnumAttributeValue(node, "runtime", typeof(ClrRuntime), m_Runtime);
425 m_StartupObject = Helper.AttributeValue(node, "startupObject", m_StartupObject);
426 m_RootNamespace = Helper.AttributeValue(node, "rootNamespace", m_RootNamespace);
427 m_Guid = Guid.NewGuid();
428 m_GenerateAssemblyInfoFile = Helper.ParseBoolean(node, "generateAssemblyInfoFile", false);
429
430 if(m_AssemblyName == null || m_AssemblyName.Length < 1)
431 {
432 m_AssemblyName = m_Name;
433 }
434
435 if(m_RootNamespace == null || m_RootNamespace.Length < 1)
436 {
437 m_RootNamespace = m_Name;
438 }
439
440 m_FullPath = m_Path;
441 try
442 {
443 m_FullPath = Helper.ResolvePath(m_FullPath);
444 }
445 catch
446 {
447 throw new WarningException("Could not resolve Solution path: {0}", m_Path);
448 }
449
450 Kernel.Instance.CurrentWorkingDirectory.Push();
451 try
452 {
453 Helper.SetCurrentDir(m_FullPath);
454
455 if( node == null )
456 {
457 throw new ArgumentNullException("node");
458 }
459
460 foreach(XmlNode child in node.ChildNodes)
461 {
462 IDataNode dataNode = Kernel.Instance.ParseNode(child, this);
463 if(dataNode is ConfigurationNode)
464 {
465 HandleConfiguration((ConfigurationNode)dataNode);
466 }
467 else if(dataNode is ReferencePathNode)
468 {
469 m_ReferencePaths.Add(dataNode);
470 }
471 else if(dataNode is ReferenceNode)
472 {
473 m_References.Add(dataNode);
474 }
475 else if(dataNode is FilesNode)
476 {
477 m_Files = (FilesNode)dataNode;
478 }
479 }
480 }
481 finally
482 {
483 Kernel.Instance.CurrentWorkingDirectory.Pop();
484 }
485 }
486
487
488 #endregion
489 }
490}
diff --git a/Prebuild/src/Core/Nodes/ReferenceNode.cs b/Prebuild/src/Core/Nodes/ReferenceNode.cs
new file mode 100644
index 0000000..beb50dc
--- /dev/null
+++ b/Prebuild/src/Core/Nodes/ReferenceNode.cs
@@ -0,0 +1,143 @@
1#region BSD License
2/*
3Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com)
4
5Redistribution and use in source and binary forms, with or without modification, are permitted
6provided that the following conditions are met:
7
8* Redistributions of source code must retain the above copyright notice, this list of conditions
9 and the following disclaimer.
10* Redistributions in binary form must reproduce the above copyright notice, this list of conditions
11 and the following disclaimer in the documentation and/or other materials provided with the
12 distribution.
13* The name of the author may not be used to endorse or promote products derived from this software
14 without specific prior written permission.
15
16THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
17BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
19EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
21OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
22IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23*/
24#endregion
25
26#region CVS Information
27/*
28 * $Source$
29 * $Author: jendave $
30 * $Date: 2006-07-25 18:56:49 +0200 (ti, 25 jul 2006) $
31 * $Revision: 132 $
32 */
33#endregion
34
35using System;
36using System.Xml;
37
38using Prebuild.Core.Attributes;
39using Prebuild.Core.Interfaces;
40using Prebuild.Core.Utilities;
41
42namespace Prebuild.Core.Nodes
43{
44 /// <summary>
45 ///
46 /// </summary>
47 [DataNode("Reference")]
48 public class ReferenceNode : DataNode
49 {
50 #region Fields
51
52 private string m_Name = "unknown";
53 private string m_Path;
54 private string m_LocalCopy;
55 private string m_Version;
56
57 #endregion
58
59 #region Properties
60
61 /// <summary>
62 /// Gets the name.
63 /// </summary>
64 /// <value>The name.</value>
65 public string Name
66 {
67 get
68 {
69 return m_Name;
70 }
71 }
72
73 /// <summary>
74 /// Gets the path.
75 /// </summary>
76 /// <value>The path.</value>
77 public string Path
78 {
79 get
80 {
81 return m_Path;
82 }
83 }
84
85 /// <summary>
86 /// Gets a value indicating whether [local copy specified].
87 /// </summary>
88 /// <value><c>true</c> if [local copy specified]; otherwise, <c>false</c>.</value>
89 public bool LocalCopySpecified
90 {
91 get
92 {
93 return ( m_LocalCopy != null && m_LocalCopy.Length == 0);
94 }
95 }
96
97 /// <summary>
98 /// Gets a value indicating whether [local copy].
99 /// </summary>
100 /// <value><c>true</c> if [local copy]; otherwise, <c>false</c>.</value>
101 public bool LocalCopy
102 {
103 get
104 {
105 if( m_LocalCopy == null)
106 {
107 return false;
108 }
109 return bool.Parse(m_LocalCopy);
110 }
111 }
112
113 /// <summary>
114 /// Gets the version.
115 /// </summary>
116 /// <value>The version.</value>
117 public string Version
118 {
119 get
120 {
121 return m_Version;
122 }
123 }
124
125 #endregion
126
127 #region Public Methods
128
129 /// <summary>
130 /// Parses the specified node.
131 /// </summary>
132 /// <param name="node">The node.</param>
133 public override void Parse(XmlNode node)
134 {
135 m_Name = Helper.AttributeValue(node, "name", m_Name);
136 m_Path = Helper.AttributeValue(node, "path", m_Path);
137 m_LocalCopy = Helper.AttributeValue(node, "localCopy", m_LocalCopy);
138 m_Version = Helper.AttributeValue(node, "version", m_Version);
139 }
140
141 #endregion
142 }
143}
diff --git a/Prebuild/src/Core/Nodes/ReferencePathNode.cs b/Prebuild/src/Core/Nodes/ReferencePathNode.cs
new file mode 100644
index 0000000..5d98dda
--- /dev/null
+++ b/Prebuild/src/Core/Nodes/ReferencePathNode.cs
@@ -0,0 +1,98 @@
1#region BSD License
2/*
3Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com)
4
5Redistribution and use in source and binary forms, with or without modification, are permitted
6provided that the following conditions are met:
7
8* Redistributions of source code must retain the above copyright notice, this list of conditions
9 and the following disclaimer.
10* Redistributions in binary form must reproduce the above copyright notice, this list of conditions
11 and the following disclaimer in the documentation and/or other materials provided with the
12 distribution.
13* The name of the author may not be used to endorse or promote products derived from this software
14 without specific prior written permission.
15
16THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
17BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
19EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
21OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
22IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23*/
24#endregion
25
26#region CVS Information
27/*
28 * $Source$
29 * $Author: jendave $
30 * $Date: 2006-01-28 01:49:58 +0100 (lö, 28 jan 2006) $
31 * $Revision: 71 $
32 */
33#endregion
34
35using System;
36using System.Collections;
37using System.Collections.Specialized;
38using System.Xml;
39
40using Prebuild.Core.Attributes;
41using Prebuild.Core.Interfaces;
42using Prebuild.Core.Utilities;
43
44namespace Prebuild.Core.Nodes
45{
46 /// <summary>
47 ///
48 /// </summary>
49 [DataNode("ReferencePath")]
50 public class ReferencePathNode : DataNode
51 {
52 #region Fields
53
54 private string m_Path;
55
56 #endregion
57
58 #region Properties
59
60 /// <summary>
61 /// Gets the path.
62 /// </summary>
63 /// <value>The path.</value>
64 public string Path
65 {
66 get
67 {
68 return m_Path;
69 }
70 }
71
72 #endregion
73
74 #region Public Methods
75
76 /// <summary>
77 /// Parses the specified node.
78 /// </summary>
79 /// <param name="node">The node.</param>
80 public override void Parse(XmlNode node)
81 {
82 if( node == null )
83 {
84 throw new ArgumentNullException("node");
85 }
86
87 m_Path = Helper.InterpolateForEnvironmentVariables(node.InnerText);
88 if(m_Path == null)
89 {
90 m_Path = "";
91 }
92
93 m_Path = m_Path.Trim();
94 }
95
96 #endregion
97 }
98}
diff --git a/Prebuild/src/Core/Nodes/SolutionNode.cs b/Prebuild/src/Core/Nodes/SolutionNode.cs
new file mode 100644
index 0000000..0121075
--- /dev/null
+++ b/Prebuild/src/Core/Nodes/SolutionNode.cs
@@ -0,0 +1,284 @@
1#region BSD License
2/*
3Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com)
4
5Redistribution and use in source and binary forms, with or without modification, are permitted
6provided that the following conditions are met:
7
8* Redistributions of source code must retain the above copyright notice, this list of conditions
9 and the following disclaimer.
10* Redistributions in binary form must reproduce the above copyright notice, this list of conditions
11 and the following disclaimer in the documentation and/or other materials provided with the
12 distribution.
13* The name of the author may not be used to endorse or promote products derived from this software
14 without specific prior written permission.
15
16THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
17BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
19EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
21OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
22IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23*/
24#endregion
25
26#region CVS Information
27/*
28 * $Source$
29 * $Author: jendave $
30 * $Date: 2006-02-28 17:15:42 +0100 (ti, 28 feb 2006) $
31 * $Revision: 92 $
32 */
33#endregion
34
35using System;
36using System.Collections;
37using System.Diagnostics;
38using System.IO;
39using System.Xml;
40
41using Prebuild.Core.Attributes;
42using Prebuild.Core.Interfaces;
43using Prebuild.Core.Utilities;
44
45namespace Prebuild.Core.Nodes
46{
47 /// <summary>
48 ///
49 /// </summary>
50 [DataNode("Solution")]
51 public class SolutionNode : DataNode
52 {
53 #region Fields
54
55 private string m_Name = "unknown";
56 private string m_Path = "";
57 private string m_FullPath = "";
58 private string m_ActiveConfig = "Debug";
59
60 private OptionsNode m_Options;
61 private FilesNode m_Files;
62 private Hashtable m_Configurations;
63 private Hashtable m_Projects;
64 private ArrayList m_ProjectsOrder;
65
66 #endregion
67
68 #region Constructors
69
70 /// <summary>
71 /// Initializes a new instance of the <see cref="SolutionNode"/> class.
72 /// </summary>
73 public SolutionNode()
74 {
75 m_Configurations = new Hashtable();
76 m_Projects = new Hashtable();
77 m_ProjectsOrder = new ArrayList();
78 }
79
80 #endregion
81
82 #region Properties
83
84 /// <summary>
85 /// Gets or sets the active config.
86 /// </summary>
87 /// <value>The active config.</value>
88 public string ActiveConfig
89 {
90 get
91 {
92 return m_ActiveConfig;
93 }
94 set
95 {
96 m_ActiveConfig = value;
97 }
98 }
99
100 /// <summary>
101 /// Gets the name.
102 /// </summary>
103 /// <value>The name.</value>
104 public string Name
105 {
106 get
107 {
108 return m_Name;
109 }
110 }
111
112 /// <summary>
113 /// Gets the path.
114 /// </summary>
115 /// <value>The path.</value>
116 public string Path
117 {
118 get
119 {
120 return m_Path;
121 }
122 }
123
124 /// <summary>
125 /// Gets the full path.
126 /// </summary>
127 /// <value>The full path.</value>
128 public string FullPath
129 {
130 get
131 {
132 return m_FullPath;
133 }
134 }
135
136 /// <summary>
137 /// Gets the options.
138 /// </summary>
139 /// <value>The options.</value>
140 public OptionsNode Options
141 {
142 get
143 {
144 return m_Options;
145 }
146 }
147
148 /// <summary>
149 /// Gets the files.
150 /// </summary>
151 /// <value>The files.</value>
152 public FilesNode Files
153 {
154 get
155 {
156 return m_Files;
157 }
158 }
159
160 /// <summary>
161 /// Gets the configurations.
162 /// </summary>
163 /// <value>The configurations.</value>
164 public ICollection Configurations
165 {
166 get
167 {
168 return m_Configurations.Values;
169 }
170 }
171
172 /// <summary>
173 /// Gets the configurations table.
174 /// </summary>
175 /// <value>The configurations table.</value>
176 public Hashtable ConfigurationsTable
177 {
178 get
179 {
180 return m_Configurations;
181 }
182 }
183
184 /// <summary>
185 /// Gets the projects.
186 /// </summary>
187 /// <value>The projects.</value>
188 public ICollection Projects
189 {
190 get
191 {
192 return m_Projects.Values;
193 }
194 }
195
196 /// <summary>
197 /// Gets the projects table.
198 /// </summary>
199 /// <value>The projects table.</value>
200 public Hashtable ProjectsTable
201 {
202 get
203 {
204 return m_Projects;
205 }
206 }
207
208 /// <summary>
209 /// Gets the projects table.
210 /// </summary>
211 /// <value>The projects table.</value>
212 public ArrayList ProjectsTableOrder
213 {
214 get
215 {
216 return m_ProjectsOrder;
217 }
218 }
219
220 #endregion
221
222 #region Public Methods
223
224 /// <summary>
225 /// Parses the specified node.
226 /// </summary>
227 /// <param name="node">The node.</param>
228 public override void Parse(XmlNode node)
229 {
230 m_Name = Helper.AttributeValue(node, "name", m_Name);
231 m_ActiveConfig = Helper.AttributeValue(node, "activeConfig", m_ActiveConfig);
232 m_Path = Helper.AttributeValue(node, "path", m_Path);
233
234 m_FullPath = m_Path;
235 try
236 {
237 m_FullPath = Helper.ResolvePath(m_FullPath);
238 }
239 catch
240 {
241 throw new WarningException("Could not resolve solution path: {0}", m_Path);
242 }
243
244 Kernel.Instance.CurrentWorkingDirectory.Push();
245 try
246 {
247 Helper.SetCurrentDir(m_FullPath);
248
249 if( node == null )
250 {
251 throw new ArgumentNullException("node");
252 }
253
254 foreach(XmlNode child in node.ChildNodes)
255 {
256 IDataNode dataNode = Kernel.Instance.ParseNode(child, this);
257 if(dataNode is OptionsNode)
258 {
259 m_Options = (OptionsNode)dataNode;
260 }
261 else if(dataNode is FilesNode)
262 {
263 m_Files = (FilesNode)dataNode;
264 }
265 else if(dataNode is ConfigurationNode)
266 {
267 m_Configurations[((ConfigurationNode)dataNode).Name] = dataNode;
268 }
269 else if(dataNode is ProjectNode)
270 {
271 m_Projects[((ProjectNode)dataNode).Name] = dataNode;
272 m_ProjectsOrder.Add(dataNode);
273 }
274 }
275 }
276 finally
277 {
278 Kernel.Instance.CurrentWorkingDirectory.Pop();
279 }
280 }
281
282 #endregion
283 }
284}
diff --git a/Prebuild/src/Core/Parse/IfContext.cs b/Prebuild/src/Core/Parse/IfContext.cs
new file mode 100644
index 0000000..383049d
--- /dev/null
+++ b/Prebuild/src/Core/Parse/IfContext.cs
@@ -0,0 +1,163 @@
1#region BSD License
2/*
3Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com)
4
5Redistribution and use in source and binary forms, with or without modification, are permitted
6provided that the following conditions are met:
7
8* Redistributions of source code must retain the above copyright notice, this list of conditions
9 and the following disclaimer.
10* Redistributions in binary form must reproduce the above copyright notice, this list of conditions
11 and the following disclaimer in the documentation and/or other materials provided with the
12 distribution.
13* The name of the author may not be used to endorse or promote products derived from this software
14 without specific prior written permission.
15
16THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
17BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
19EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
21OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
22IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23*/
24#endregion
25
26#region CVS Information
27/*
28 * $Source$
29 * $Author: jendave $
30 * $Date: 2006-01-28 01:49:58 +0100 (lö, 28 jan 2006) $
31 * $Revision: 71 $
32 */
33#endregion
34
35using System;
36
37namespace Prebuild.Core.Parse
38{
39 /// <summary>
40 ///
41 /// </summary>
42 public enum IfState
43 {
44 /// <summary>
45 ///
46 /// </summary>
47 None,
48 /// <summary>
49 ///
50 /// </summary>
51 If,
52 /// <summary>
53 ///
54 /// </summary>
55 ElseIf,
56 /// <summary>
57 ///
58 /// </summary>
59 Else
60 }
61
62 /// <summary>
63 /// Summary description for IfContext.
64 /// </summary>
65 // Inspired by the equivalent WiX class (see www.sourceforge.net/projects/wix/)
66 public class IfContext
67 {
68 #region Properties
69
70 bool m_Active;
71 bool m_Keep;
72 bool m_EverKept;
73 IfState m_State = IfState.None;
74
75 #endregion
76
77 #region Constructors
78
79 /// <summary>
80 /// Initializes a new instance of the <see cref="IfContext"/> class.
81 /// </summary>
82 /// <param name="active">if set to <c>true</c> [active].</param>
83 /// <param name="keep">if set to <c>true</c> [keep].</param>
84 /// <param name="state">The state.</param>
85 public IfContext(bool active, bool keep, IfState state)
86 {
87 m_Active = active;
88 m_Keep = keep;
89 m_EverKept = keep;
90 m_State = state;
91 }
92
93 #endregion
94
95 #region Properties
96
97 /// <summary>
98 /// Gets or sets a value indicating whether this <see cref="IfContext"/> is active.
99 /// </summary>
100 /// <value><c>true</c> if active; otherwise, <c>false</c>.</value>
101 public bool Active
102 {
103 get
104 {
105 return m_Active;
106 }
107 set
108 {
109 m_Active = value;
110 }
111 }
112
113 /// <summary>
114 /// Gets or sets a value indicating whether this <see cref="IfContext"/> is keep.
115 /// </summary>
116 /// <value><c>true</c> if keep; otherwise, <c>false</c>.</value>
117 public bool Keep
118 {
119 get
120 {
121 return m_Keep;
122 }
123 set
124 {
125 m_Keep = value;
126 if(m_Keep)
127 {
128 m_EverKept = true;
129 }
130 }
131 }
132
133 /// <summary>
134 /// Gets a value indicating whether [ever kept].
135 /// </summary>
136 /// <value><c>true</c> if [ever kept]; otherwise, <c>false</c>.</value>
137 public bool EverKept
138 {
139 get
140 {
141 return m_EverKept;
142 }
143 }
144
145 /// <summary>
146 /// Gets or sets the state.
147 /// </summary>
148 /// <value>The state.</value>
149 public IfState State
150 {
151 get
152 {
153 return m_State;
154 }
155 set
156 {
157 m_State = value;
158 }
159 }
160
161 #endregion
162 }
163}
diff --git a/Prebuild/src/Core/Parse/Preprocessor.cs b/Prebuild/src/Core/Parse/Preprocessor.cs
new file mode 100644
index 0000000..85e92c3
--- /dev/null
+++ b/Prebuild/src/Core/Parse/Preprocessor.cs
@@ -0,0 +1,519 @@
1#region BSD License
2/*
3Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com)
4
5Redistribution and use in source and binary forms, with or without modification, are permitted
6provided that the following conditions are met:
7
8* Redistributions of source code must retain the above copyright notice, this list of conditions
9 and the following disclaimer.
10* Redistributions in binary form must reproduce the above copyright notice, this list of conditions
11 and the following disclaimer in the documentation and/or other materials provided with the
12 distribution.
13* The name of the author may not be used to endorse or promote products derived from this software
14 without specific prior written permission.
15
16THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
17BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
19EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
21OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
22IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23*/
24#endregion
25
26#region CVS Information
27/*
28 * $Source$
29 * $Author: jendave $
30 * $Date: 2006-09-01 19:55:06 +0200 (fr, 01 sep 2006) $
31 * $Revision: 147 $
32 */
33#endregion
34
35using System;
36using System.Collections;
37using System.IO;
38using System.Xml;
39
40namespace Prebuild.Core.Parse
41{
42 /// <summary>
43 ///
44 /// </summary>
45 public enum OperatorSymbol
46 {
47 /// <summary>
48 ///
49 /// </summary>
50 None,
51 /// <summary>
52 ///
53 /// </summary>
54 Equal,
55 /// <summary>
56 ///
57 /// </summary>
58 NotEqual,
59 /// <summary>
60 ///
61 /// </summary>
62 LessThan,
63 /// <summary>
64 ///
65 /// </summary>
66 GreaterThan,
67 /// <summary>
68 ///
69 /// </summary>
70 LessThanEqual,
71 /// <summary>
72 ///
73 /// </summary>
74 GreaterThanEqual
75 }
76
77 /// <summary>
78 ///
79 /// </summary>
80 public class Preprocessor
81 {
82 #region Fields
83
84 XmlDocument m_OutDoc;
85 Stack m_IfStack;
86 Hashtable m_Variables;
87
88 #endregion
89
90 #region Constructors
91
92 /// <summary>
93 /// Initializes a new instance of the <see cref="Preprocessor"/> class.
94 /// </summary>
95 public Preprocessor()
96 {
97 m_OutDoc = new XmlDocument();
98 m_IfStack = new Stack();
99 m_Variables = new Hashtable();
100
101 RegisterVariable("OS", GetOS());
102 RegisterVariable("RuntimeVersion", Environment.Version.Major);
103 RegisterVariable("RuntimeMajor", Environment.Version.Major);
104 RegisterVariable("RuntimeMinor", Environment.Version.Minor);
105 RegisterVariable("RuntimeRevision", Environment.Version.Revision);
106 }
107
108 #endregion
109
110 #region Properties
111
112 /// <summary>
113 /// Gets the processed doc.
114 /// </summary>
115 /// <value>The processed doc.</value>
116 public XmlDocument ProcessedDoc
117 {
118 get
119 {
120 return m_OutDoc;
121 }
122 }
123
124 #endregion
125
126 #region Private Methods
127
128 /// <summary>
129 /// Parts of this code were taken from NAnt and is subject to the GPL
130 /// as per NAnt's license. Thanks to the NAnt guys for this little gem.
131 /// </summary>
132 /// <returns></returns>
133 public static string GetOS()
134 {
135 PlatformID platId = Environment.OSVersion.Platform;
136 if(platId == PlatformID.Win32NT || platId == PlatformID.Win32Windows)
137 {
138 return "Win32";
139 }
140
141 /*
142 * .NET 1.x, under Mono, the UNIX code is 128. Under
143 * .NET 2.x, Mono or MS, the UNIX code is 4
144 */
145 if(Environment.Version.Major == 1)
146 {
147 if((int)platId == 128)
148 {
149 return "UNIX";
150 }
151 }
152 else if((int)platId == 4)
153 {
154 return "UNIX";
155 }
156
157 return "Unknown";
158 }
159
160 private static bool CompareNum(OperatorSymbol oper, int val1, int val2)
161 {
162 switch(oper)
163 {
164 case OperatorSymbol.Equal:
165 return (val1 == val2);
166 case OperatorSymbol.NotEqual:
167 return (val1 != val2);
168 case OperatorSymbol.LessThan:
169 return (val1 < val2);
170 case OperatorSymbol.LessThanEqual:
171 return (val1 <= val2);
172 case OperatorSymbol.GreaterThan:
173 return (val1 > val2);
174 case OperatorSymbol.GreaterThanEqual:
175 return (val1 >= val2);
176 }
177
178 throw new WarningException("Unknown operator type");
179 }
180
181 private static bool CompareStr(OperatorSymbol oper, string val1, string val2)
182 {
183 switch(oper)
184 {
185 case OperatorSymbol.Equal:
186 return (val1 == val2);
187 case OperatorSymbol.NotEqual:
188 return (val1 != val2);
189 case OperatorSymbol.LessThan:
190 return (val1.CompareTo(val2) < 0);
191 case OperatorSymbol.LessThanEqual:
192 return (val1.CompareTo(val2) <= 0);
193 case OperatorSymbol.GreaterThan:
194 return (val1.CompareTo(val2) > 0);
195 case OperatorSymbol.GreaterThanEqual:
196 return (val1.CompareTo(val2) >= 0);
197 }
198
199 throw new WarningException("Unknown operator type");
200 }
201
202 private static char NextChar(int idx, string str)
203 {
204 if((idx + 1) >= str.Length)
205 {
206 return Char.MaxValue;
207 }
208
209 return str[idx + 1];
210 }
211 // Very very simple expression parser. Can only match expressions of the form
212 // <var> <op> <value>:
213 // OS = Windows
214 // OS != Linux
215 // RuntimeMinor > 0
216 private bool ParseExpression(string exp)
217 {
218 if(exp == null)
219 {
220 throw new ArgumentException("Invalid expression, cannot be null");
221 }
222
223 exp = exp.Trim();
224 if(exp.Length < 1)
225 {
226 throw new ArgumentException("Invalid expression, cannot be 0 length");
227 }
228
229 string id = "";
230 string str = "";
231 OperatorSymbol oper = OperatorSymbol.None;
232 bool inStr = false;
233 char c;
234
235 for(int i = 0; i < exp.Length; i++)
236 {
237 c = exp[i];
238 if(Char.IsWhiteSpace(c))
239 {
240 continue;
241 }
242
243 if(Char.IsLetterOrDigit(c) || c == '_')
244 {
245 if(inStr)
246 {
247 str += c;
248 }
249 else
250 {
251 id += c;
252 }
253 }
254 else if(c == '\"')
255 {
256 inStr = !inStr;
257 if(inStr)
258 {
259 str = "";
260 }
261 }
262 else
263 {
264 if(inStr)
265 {
266 str += c;
267 }
268 else
269 {
270 switch(c)
271 {
272 case '=':
273 oper = OperatorSymbol.Equal;
274 break;
275
276 case '!':
277 if(NextChar(i, exp) == '=')
278 {
279 oper = OperatorSymbol.NotEqual;
280 }
281
282 break;
283
284 case '<':
285 if(NextChar(i, exp) == '=')
286 {
287 oper = OperatorSymbol.LessThanEqual;
288 }
289 else
290 {
291 oper = OperatorSymbol.LessThan;
292 }
293
294 break;
295
296 case '>':
297 if(NextChar(i, exp) == '=')
298 {
299 oper = OperatorSymbol.GreaterThanEqual;
300 }
301 else
302 {
303 oper = OperatorSymbol.GreaterThan;
304 }
305
306 break;
307 }
308 }
309 }
310 }
311
312
313 if(inStr)
314 {
315 throw new WarningException("Expected end of string in expression");
316 }
317
318 if(oper == OperatorSymbol.None)
319 {
320 throw new WarningException("Expected operator in expression");
321 }
322 else if(id.Length < 1)
323 {
324 throw new WarningException("Expected identifier in expression");
325 }
326 else if(str.Length < 1)
327 {
328 throw new WarningException("Expected value in expression");
329 }
330
331 bool ret = false;
332 try
333 {
334 object val = m_Variables[id.ToLower()];
335 if(val == null)
336 {
337 throw new WarningException("Unknown identifier '{0}'", id);
338 }
339
340 int numVal, numVal2;
341 string strVal, strVal2;
342 Type t = val.GetType();
343 if(t.IsAssignableFrom(typeof(int)))
344 {
345 numVal = (int)val;
346 numVal2 = Int32.Parse(str);
347 ret = CompareNum(oper, numVal, numVal2);
348 }
349 else
350 {
351 strVal = val.ToString();
352 strVal2 = str;
353 ret = CompareStr(oper, strVal, strVal2);
354 }
355 }
356 catch(ArgumentException ex)
357 {
358 ex.ToString();
359 throw new WarningException("Invalid value type for system variable '{0}', expected int", id);
360 }
361
362 return ret;
363 }
364
365 #endregion
366
367 #region Public Methods
368
369 /// <summary>
370 ///
371 /// </summary>
372 /// <param name="name"></param>
373 /// <param name="variableValue"></param>
374 public void RegisterVariable(string name, object variableValue)
375 {
376 if(name == null || variableValue == null)
377 {
378 return;
379 }
380
381 m_Variables[name.ToLower()] = variableValue;
382 }
383
384 /// <summary>
385 /// Performs validation on the xml source as well as evaluates conditional and flow expresions
386 /// </summary>
387 /// <exception cref="ArgumentException">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</exception>
388 /// <param name="reader"></param>
389 /// <returns>the output xml </returns>
390 public string Process(XmlReader reader)
391 {
392 if(reader == null)
393 {
394 throw new ArgumentException("Invalid XML reader to pre-process");
395 }
396
397 IfContext context = new IfContext(true, true, IfState.None);
398 StringWriter xmlText = new StringWriter();
399 XmlTextWriter writer = new XmlTextWriter(xmlText);
400 writer.Formatting = Formatting.Indented;
401 while(reader.Read())
402 {
403 if(reader.NodeType == XmlNodeType.ProcessingInstruction)
404 {
405 bool ignore = false;
406 switch(reader.LocalName)
407 {
408 case "if":
409 m_IfStack.Push(context);
410 context = new IfContext(context.Keep & context.Active, ParseExpression(reader.Value), IfState.If);
411 ignore = true;
412 break;
413
414 case "elseif":
415 if(m_IfStack.Count == 0)
416 {
417 throw new WarningException("Unexpected 'elseif' outside of 'if'");
418 }
419 else if(context.State != IfState.If && context.State != IfState.ElseIf)
420 {
421 throw new WarningException("Unexpected 'elseif' outside of 'if'");
422 }
423
424 context.State = IfState.ElseIf;
425 if(!context.EverKept)
426 {
427 context.Keep = ParseExpression(reader.Value);
428 }
429 else
430 {
431 context.Keep = false;
432 }
433
434 ignore = true;
435 break;
436
437 case "else":
438 if(m_IfStack.Count == 0)
439 {
440 throw new WarningException("Unexpected 'else' outside of 'if'");
441 }
442 else if(context.State != IfState.If && context.State != IfState.ElseIf)
443 {
444 throw new WarningException("Unexpected 'else' outside of 'if'");
445 }
446
447 context.State = IfState.Else;
448 context.Keep = !context.EverKept;
449 ignore = true;
450 break;
451
452 case "endif":
453 if(m_IfStack.Count == 0)
454 {
455 throw new WarningException("Unexpected 'endif' outside of 'if'");
456 }
457
458 context = (IfContext)m_IfStack.Pop();
459 ignore = true;
460 break;
461 }
462
463 if(ignore)
464 {
465 continue;
466 }
467 }//end pre-proc instruction
468
469 if(!context.Active || !context.Keep)
470 {
471 continue;
472 }
473
474 switch(reader.NodeType)
475 {
476 case XmlNodeType.Element:
477 bool empty = reader.IsEmptyElement;
478 writer.WriteStartElement(reader.Name);
479
480 while (reader.MoveToNextAttribute())
481 {
482 writer.WriteAttributeString(reader.Name, reader.Value);
483 }
484
485 if(empty)
486 {
487 writer.WriteEndElement();
488 }
489
490 break;
491
492 case XmlNodeType.EndElement:
493 writer.WriteEndElement();
494 break;
495
496 case XmlNodeType.Text:
497 writer.WriteString(reader.Value);
498 break;
499
500 case XmlNodeType.CDATA:
501 writer.WriteCData(reader.Value);
502 break;
503
504 default:
505 break;
506 }
507 }
508
509 if(m_IfStack.Count != 0)
510 {
511 throw new WarningException("Mismatched 'if', 'endif' pair");
512 }
513
514 return xmlText.ToString();
515 }
516
517 #endregion
518 }
519}
diff --git a/Prebuild/src/Core/Targets/AutotoolsTarget.cs b/Prebuild/src/Core/Targets/AutotoolsTarget.cs
new file mode 100644
index 0000000..2b4a678
--- /dev/null
+++ b/Prebuild/src/Core/Targets/AutotoolsTarget.cs
@@ -0,0 +1,926 @@
1#region BSD License
2/*
3
4Copyright (c) 2004 - 2006
5Matthew Holmes (matthew@wildfiregames.com),
6Dan Moorehead (dan05a@gmail.com),
7Dave Hudson (jendave@yahoo.com),
8C.J. Adams-Collier (cjcollier@colliertech.org),
9
10Redistribution and use in source and binary forms, with or without
11modification, are permitted provided that the following conditions are
12met:
13
14* Redistributions of source code must retain the above copyright
15notice, this list of conditions and the following disclaimer.
16
17* Redistributions in binary form must reproduce the above copyright
18notice, this list of conditions and the following disclaimer in the
19documentation and/or other materials provided with the distribution.
20
21* The name of the author may not be used to endorse or promote
22products derived from this software without specific prior written
23permission.
24
25THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
26IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
27WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
28DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
29INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
30(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
31SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
32HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
33STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
34IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
35POSSIBILITY OF SUCH DAMAGE.
36
37*/
38#endregion
39
40#region CVS Information
41/*
42 * $Source$
43 * $Author: jendave $
44 * $Date: 2006-07-28 22:43:24 -0700 (Fri, 28 Jul 2006) $
45 * $Revision: 136 $
46 */
47#endregion
48
49using System;
50using System.Collections;
51using System.Collections.Specialized;
52using System.IO;
53using System.Reflection;
54using System.Text;
55using System.Text.RegularExpressions;
56
57using Prebuild.Core.Attributes;
58using Prebuild.Core.Interfaces;
59using Prebuild.Core.Nodes;
60using Prebuild.Core.Parse;
61using Prebuild.Core.Utilities;
62
63namespace Prebuild.Core.Targets
64{
65 /// <summary>
66 ///
67 /// </summary>
68 [Target("autotools")]
69 public class AutotoolsTarget : ITarget
70 {
71 #region Fields
72
73 private Kernel m_Kernel;
74
75 #endregion
76
77 #region Private Methods
78
79 private static string PrependPath(string path)
80 {
81 string tmpPath = Helper.NormalizePath(path, '/');
82 Regex regex = new Regex(@"(\w):/(\w+)");
83 Match match = regex.Match(tmpPath);
84 if(match.Success || tmpPath[0] == '.' || tmpPath[0] == '/')
85 {
86 tmpPath = Helper.NormalizePath(tmpPath);
87 }
88 else
89 {
90 tmpPath = Helper.NormalizePath("./" + tmpPath);
91 }
92
93 return tmpPath;
94 }
95
96 private static string BuildReference(SolutionNode solution, ReferenceNode refr)
97 {
98 string ret = "";
99 if(solution.ProjectsTable.ContainsKey(refr.Name))
100 {
101 ProjectNode project = (ProjectNode)solution.ProjectsTable[refr.Name];
102 string fileRef = FindFileReference(refr.Name, project);
103 string finalPath = Helper.NormalizePath(Helper.MakeFilePath(project.FullPath + "/$(BUILD_DIR)/$(CONFIG)/", refr.Name, "dll"), '/');
104 ret += finalPath;
105 return ret;
106 }
107 else
108 {
109 ProjectNode project = (ProjectNode)refr.Parent;
110 string fileRef = FindFileReference(refr.Name, project);
111
112 if(refr.Path != null || fileRef != null)
113 {
114 string finalPath = (refr.Path != null) ? Helper.NormalizePath(refr.Path + "/" + refr.Name + ".dll", '/') : fileRef;
115 ret += Path.Combine(project.Path, finalPath);
116 return ret;
117 }
118
119 try
120 {
121 //Assembly assem = Assembly.Load(refr.Name);
122 //if (assem != null)
123 //{
124 // int index = refr.Name.IndexOf(",");
125 // if ( index > 0)
126 // {
127 // ret += assem.Location;
128 // //Console.WriteLine("Location1: " + assem.Location);
129 // }
130 // else
131 // {
132 // ret += (refr.Name + ".dll");
133 // //Console.WriteLine("Location2: " + assem.Location);
134 // }
135 //}
136 //else
137 //{
138 int index = refr.Name.IndexOf(",");
139 if ( index > 0)
140 {
141 ret += refr.Name.Substring(0, index) + ".dll";
142 //Console.WriteLine("Location3: " + assem.Location);
143 }
144 else
145 {
146 ret += (refr.Name + ".dll");
147 //Console.WriteLine("Location4: " + assem.Location);
148 }
149 //}
150 }
151 catch (System.NullReferenceException e)
152 {
153 e.ToString();
154 int index = refr.Name.IndexOf(",");
155 if ( index > 0)
156 {
157 ret += refr.Name.Substring(0, index) + ".dll";
158 //Console.WriteLine("Location5: " + assem.Location);
159 }
160 else
161 {
162 ret += (refr.Name + ".dll");
163 //Console.WriteLine("Location6: " + assem.Location);
164 }
165 }
166 }
167 return ret;
168 }
169
170 private static string BuildReferencePath(SolutionNode solution, ReferenceNode refr)
171 {
172 string ret = "";
173 if(solution.ProjectsTable.ContainsKey(refr.Name))
174 {
175 ProjectNode project = (ProjectNode)solution.ProjectsTable[refr.Name];
176 string finalPath = Helper.NormalizePath(Helper.MakeReferencePath(project.FullPath + "/${build.dir}/"), '/');
177 ret += finalPath;
178 return ret;
179 }
180 else
181 {
182 ProjectNode project = (ProjectNode)refr.Parent;
183 string fileRef = FindFileReference(refr.Name, project);
184
185
186 if(refr.Path != null || fileRef != null)
187 {
188 string finalPath = (refr.Path != null) ? Helper.NormalizePath(refr.Path, '/') : fileRef;
189 ret += finalPath;
190 return ret;
191 }
192
193 try
194 {
195 Assembly assem = Assembly.Load(refr.Name);
196 if (assem != null)
197 {
198 ret += "";
199 }
200 else
201 {
202 ret += "";
203 }
204 }
205 catch (System.NullReferenceException e)
206 {
207 e.ToString();
208 ret += "";
209 }
210 }
211 return ret;
212 }
213
214 private static string FindFileReference(string refName, ProjectNode project)
215 {
216 foreach(ReferencePathNode refPath in project.ReferencePaths)
217 {
218 string fullPath = Helper.MakeFilePath(refPath.Path, refName, "dll");
219
220 if(File.Exists(fullPath))
221 {
222 return fullPath;
223 }
224 }
225
226 return null;
227 }
228
229 /// <summary>
230 /// Gets the XML doc file.
231 /// </summary>
232 /// <param name="project">The project.</param>
233 /// <param name="conf">The conf.</param>
234 /// <returns></returns>
235 public static string GetXmlDocFile(ProjectNode project, ConfigurationNode conf)
236 {
237 if( conf == null )
238 {
239 throw new ArgumentNullException("conf");
240 }
241 if( project == null )
242 {
243 throw new ArgumentNullException("project");
244 }
245 string docFile = (string)conf.Options["XmlDocFile"];
246 // if(docFile != null && docFile.Length == 0)//default to assembly name if not specified
247 // {
248 // return Path.GetFileNameWithoutExtension(project.AssemblyName) + ".xml";
249 // }
250 return docFile;
251 }
252
253 /// <summary>
254 /// Normalizes the path.
255 /// </summary>
256 /// <param name="path">The path.</param>
257 /// <returns></returns>
258 public static string NormalizePath(string path)
259 {
260 if(path == null)
261 {
262 return "";
263 }
264
265 StringBuilder tmpPath;
266
267 if (Core.Parse.Preprocessor.GetOS() == "Win32")
268 {
269 tmpPath = new StringBuilder(path.Replace('\\', '/'));
270 tmpPath.Replace("/", @"\\");
271 }
272 else
273 {
274 tmpPath = new StringBuilder(path.Replace('\\', '/'));
275 tmpPath = tmpPath.Replace('/', Path.DirectorySeparatorChar);
276 }
277 return tmpPath.ToString();
278 }
279
280 private void WriteProject(SolutionNode solution, ProjectNode project)
281 {
282 string projFile = Helper.MakeFilePath(project.FullPath, "Include", "am");
283 StreamWriter ss = new StreamWriter(projFile);
284 ss.NewLine = "\n";
285
286 m_Kernel.CurrentWorkingDirectory.Push();
287 Helper.SetCurrentDir(Path.GetDirectoryName(projFile));
288
289 using(ss)
290 {
291 ss.WriteLine(Helper.AssemblyFullName(project.AssemblyName, project.Type) + ":");
292 ss.WriteLine("\tmkdir -p " + Helper.MakePathRelativeTo(solution.FullPath, project.Path) + "/$(BUILD_DIR)/$(CONFIG)/");
293 foreach(string file in project.Files)
294 {
295 if (project.Files.GetSubType(file) != SubType.Code && project.Files.GetSubType(file) != SubType.Settings)
296 {
297 ss.Write("\tresgen ");
298 ss.Write(Helper.NormalizePath(Path.Combine(project.Path, file.Substring(0, file.LastIndexOf('.')) + ".resx "), '/'));
299 if (project.Files.GetResourceName(file) != "")
300 {
301 ss.WriteLine(Helper.NormalizePath(Path.Combine(project.Path, project.RootNamespace + "." + project.Files.GetResourceName(file) + ".resources"), '/'));
302 }
303 else
304 {
305 ss.WriteLine(Helper.NormalizePath(Path.Combine(project.Path, project.RootNamespace + "." + file.Substring(0, file.LastIndexOf('.')) + ".resources"), '/'));
306 }
307 }
308 }
309 ss.WriteLine("\t$(CSC)\t/out:" + Helper.MakePathRelativeTo(solution.FullPath, project.Path) + "/$(BUILD_DIR)/$(CONFIG)/" + Helper.AssemblyFullName(project.AssemblyName, project.Type) + " \\");
310 ss.WriteLine("\t\t/target:" + project.Type.ToString().ToLower() + " \\");
311 if (project.References.Count > 0)
312 {
313 ss.Write("\t\t/reference:");
314 bool firstref = true;
315 foreach(ReferenceNode refr in project.References)
316 {
317 if (firstref)
318 {
319 firstref = false;
320 }
321 else
322 {
323 ss.Write(",");
324 }
325 ss.Write("{0}", Helper.NormalizePath(Helper.MakePathRelativeTo(solution.FullPath, BuildReference(solution, refr)), '/'));
326 }
327 ss.WriteLine(" \\");
328 }
329 //ss.WriteLine("\t\tProperties/AssemblyInfo.cs \\");
330
331 foreach(string file in project.Files)
332 {
333 switch(project.Files.GetBuildAction(file))
334 {
335 case BuildAction.EmbeddedResource:
336 ss.Write("\t\t/resource:");
337 ss.WriteLine(Helper.NormalizePath(Path.Combine(project.Path, file), '/') + " \\");
338 break;
339 default:
340 if (project.Files.GetSubType(file) != SubType.Code && project.Files.GetSubType(file) != SubType.Settings)
341 {
342 ss.Write("\t\t/resource:");
343 if (project.Files.GetResourceName(file) != "")
344 {
345 ss.WriteLine(Helper.NormalizePath(Path.Combine(project.Path, project.RootNamespace + "." + project.Files.GetResourceName(file) + ".resources"), '/') + "," + project.RootNamespace + "." + project.Files.GetResourceName(file) + ".resources" + " \\");
346 }
347 else
348 {
349 ss.WriteLine(Helper.NormalizePath(Path.Combine(project.Path, project.RootNamespace + "." + file.Substring(0, file.LastIndexOf('.')) + ".resources"), '/') + "," + project.RootNamespace + "." + file.Substring(0, file.LastIndexOf('.')) + ".resources" + " \\");
350 }
351 }
352 break;
353 }
354 }
355
356 foreach(ConfigurationNode conf in project.Configurations)
357 {
358 if (conf.Options.KeyFile !="")
359 {
360 ss.WriteLine("\t\t/keyfile:" + Helper.NormalizePath(Path.Combine(project.Path, conf.Options.KeyFile), '/') + " \\");
361 break;
362 }
363 }
364 foreach(ConfigurationNode conf in project.Configurations)
365 {
366 if (conf.Options.AllowUnsafe)
367 {
368 ss.WriteLine("\t\t/unsafe \\");
369 break;
370 }
371 }
372 if (project.AppIcon != "")
373 {
374 ss.WriteLine("\t\t/win32icon:" + Helper.NormalizePath(Path.Combine(project.Path, project.AppIcon), '/') + " \\");
375 }
376
377 foreach(ConfigurationNode conf in project.Configurations)
378 {
379 ss.WriteLine("\t\t/define:{0}", conf.Options.CompilerDefines.Replace(';', ',') + " \\");
380 break;
381 }
382
383 foreach(ConfigurationNode conf in project.Configurations)
384 {
385 if (GetXmlDocFile(project, conf) !="")
386 {
387 ss.WriteLine("\t\t/doc:" + Helper.MakePathRelativeTo(solution.FullPath, project.Path) + "/$(BUILD_DIR)/$(CONFIG)/" + project.Name + ".xml \\");
388 break;
389 }
390 }
391 foreach(string file in project.Files)
392 {
393 switch(project.Files.GetBuildAction(file))
394 {
395 case BuildAction.Compile:
396 ss.WriteLine("\t\t\\");
397 ss.Write("\t\t" + NormalizePath(Path.Combine(Helper.MakePathRelativeTo(solution.FullPath, project.Path), file)));
398 break;
399 default:
400 break;
401 }
402 }
403 ss.WriteLine();
404 ss.WriteLine();
405
406 if (project.Type == ProjectType.Library)
407 {
408 ss.WriteLine("install-data-local:");
409 ss.WriteLine(" echo \"$(GACUTIL) /i bin/Release/" + project.Name + ".dll /f $(GACUTIL_FLAGS)\"; \\");
410 ss.WriteLine(" $(GACUTIL) /i bin/Release/" + project.Name + ".dll /f $(GACUTIL_FLAGS) || exit 1;");
411 ss.WriteLine();
412 ss.WriteLine("uninstall-local:");
413 ss.WriteLine(" echo \"$(GACUTIL) /u " + project.Name + " $(GACUTIL_FLAGS)\"; \\");
414 ss.WriteLine(" $(GACUTIL) /u " + project.Name + " $(GACUTIL_FLAGS) || exit 1;");
415 ss.WriteLine();
416 }
417 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");
418 ss.WriteLine("EXTRA_DIST = \\");
419 ss.Write(" $(FILES)");
420 foreach(ConfigurationNode conf in project.Configurations)
421 {
422 if (conf.Options.KeyFile != "")
423 {
424 ss.Write(" \\");
425 ss.WriteLine("\t" + conf.Options.KeyFile);
426 }
427 break;
428 }
429 }
430 m_Kernel.CurrentWorkingDirectory.Pop();
431 }
432 bool hasLibrary = false;
433
434 private void WriteCombine(SolutionNode solution)
435 {
436
437 /* TODO: These vars should be pulled from the prebuild.xml file */
438 string releaseVersion = "2.0.0";
439 string assemblyVersion = "2.1.0.0";
440 string description =
441 "Tao Framework " + solution.Name + " Binding For .NET";
442
443 hasLibrary = false;
444 m_Kernel.Log.Write("Creating Autotools make files");
445 foreach(ProjectNode project in solution.Projects)
446 {
447 if(m_Kernel.AllowProject(project.FilterGroups))
448 {
449 m_Kernel.Log.Write("...Creating makefile: {0}", project.Name);
450 WriteProject(solution, project);
451 }
452 }
453
454 m_Kernel.Log.Write("");
455 string combFile = Helper.MakeFilePath(solution.FullPath, "Makefile", "am");
456 StreamWriter ss = new StreamWriter(combFile);
457 ss.NewLine = "\n";
458
459 m_Kernel.CurrentWorkingDirectory.Push();
460 Helper.SetCurrentDir(Path.GetDirectoryName(combFile));
461
462 using(ss)
463 {
464 foreach(ProjectNode project in solution.ProjectsTableOrder)
465 {
466 if (project.Type == ProjectType.Library)
467 {
468 hasLibrary = true;
469 break;
470 }
471 }
472
473 if (hasLibrary)
474 {
475 ss.Write("pkgconfig_in_files = ");
476 foreach(ProjectNode project in solution.ProjectsTableOrder)
477 {
478 if (project.Type == ProjectType.Library)
479 {
480 string combFilepc = Helper.MakeFilePath(solution.FullPath, project.Name, "pc.in");
481 ss.Write(" " + project.Name + ".pc.in ");
482 StreamWriter sspc = new StreamWriter(combFilepc);
483 sspc.NewLine = "\n";
484 using(sspc)
485 {
486 sspc.WriteLine("prefix=@prefix@");
487 sspc.WriteLine("exec_prefix=${prefix}");
488 sspc.WriteLine("libdir=${exec_prefix}/lib");
489 sspc.WriteLine();
490 sspc.WriteLine("Name: @PACKAGE_NAME@");
491 sspc.WriteLine("Description: @DESCRIPTION@");
492 sspc.WriteLine("Version: @ASSEMBLY_VERSION@");
493 sspc.WriteLine("Libs: -r:${libdir}/mono/gac/@PACKAGE_NAME@/@ASSEMBLY_VERSION@__@PUBKEY@/@PACKAGE_NAME@.dll");
494 }
495 }
496 }
497
498 ss.WriteLine();
499 ss.WriteLine("pkgconfigdir=$(prefix)/lib/pkgconfig");
500 ss.WriteLine("pkgconfig_DATA=$(pkgconfig_in_files:.pc.in=.pc)");
501 }
502 ss.WriteLine();
503 foreach(ProjectNode project in solution.ProjectsTableOrder)
504 {
505 string path = Helper.MakePathRelativeTo(solution.FullPath, project.FullPath);
506 ss.WriteLine("-include x {0}",
507 Helper.NormalizePath(Helper.MakeFilePath(path, "Include", "am"),'/'));
508 }
509 ss.WriteLine();
510 ss.WriteLine("all: \\");
511 ss.Write("\t");
512 foreach(ProjectNode project in solution.ProjectsTableOrder)
513 {
514 string path = Helper.MakePathRelativeTo(solution.FullPath, project.FullPath);
515 ss.Write(Helper.AssemblyFullName(project.AssemblyName, project.Type) + " ");
516
517 }
518 ss.WriteLine();
519 if (hasLibrary)
520 {
521 ss.WriteLine("EXTRA_DIST = \\");
522 ss.WriteLine("\t$(pkgconfig_in_files)");
523 }
524 else
525 {
526 ss.WriteLine("EXTRA_DIST = ");
527 }
528 ss.WriteLine();
529 ss.WriteLine("DISTCLEANFILES = \\");
530 ss.WriteLine("\tconfigure \\");
531 ss.WriteLine("\tMakefile.in \\");
532 ss.WriteLine("\taclocal.m4");
533 }
534 combFile = Helper.MakeFilePath(solution.FullPath, "configure", "ac");
535 StreamWriter ts = new StreamWriter(combFile);
536 ts.NewLine = "\n";
537 using(ts)
538 {
539 if (this.hasLibrary)
540 {
541 foreach(ProjectNode project in solution.ProjectsTableOrder)
542 {
543 if (project.Type == ProjectType.Library)
544 {
545 ts.WriteLine("AC_INIT(" + project.Name + ".pc.in)");
546 break;
547 }
548 }
549 }
550 else
551 {
552 ts.WriteLine("AC_INIT(Makefile.am)");
553 }
554 ts.WriteLine("AC_PREREQ(2.53)");
555 ts.WriteLine("AC_CANONICAL_SYSTEM");
556
557 ts.WriteLine("PACKAGE_NAME={0}", solution.Name);
558 ts.WriteLine("PACKAGE_VERSION={0}", releaseVersion);
559 ts.WriteLine("DESCRIPTION=\"{0}\"", description);
560 ts.WriteLine("AC_SUBST(DESCRIPTION)");
561 ts.WriteLine("AM_INIT_AUTOMAKE([$PACKAGE_NAME],[$PACKAGE_VERSION],[$DESCRIPTION])");
562
563 ts.WriteLine("ASSEMBLY_VERSION={0}", assemblyVersion);
564 ts.WriteLine("AC_SUBST(ASSEMBLY_VERSION)");
565
566 ts.WriteLine("PUBKEY=`sn -t $PACKAGE_NAME.snk | grep 'Public Key Token' | awk -F: '{print $2}' | sed -e 's/^ //'`");
567 ts.WriteLine("AC_SUBST(PUBKEY)");
568
569 ts.WriteLine();
570 ts.WriteLine("AM_MAINTAINER_MODE");
571 ts.WriteLine();
572 ts.WriteLine("dnl AC_PROG_INTLTOOL([0.25])");
573 ts.WriteLine();
574 ts.WriteLine("AC_PROG_INSTALL");
575 ts.WriteLine();
576 ts.WriteLine("MONO_REQUIRED_VERSION=1.1");
577 ts.WriteLine();
578 ts.WriteLine("AC_MSG_CHECKING([whether we're compiling from CVS])");
579 ts.WriteLine("if test -f \"$srcdir/.cvs_version\" ; then");
580 ts.WriteLine(" from_cvs=yes");
581 ts.WriteLine("else");
582 ts.WriteLine(" if test -f \"$srcdir/.svn\" ; then");
583 ts.WriteLine(" from_cvs=yes");
584 ts.WriteLine(" else");
585 ts.WriteLine(" from_cvs=no");
586 ts.WriteLine(" fi");
587 ts.WriteLine("fi");
588 ts.WriteLine();
589 ts.WriteLine("AC_MSG_RESULT($from_cvs)");
590 ts.WriteLine();
591 ts.WriteLine("AC_PATH_PROG(MONO, mono)");
592 ts.WriteLine("AC_PATH_PROG(GMCS, gmcs)");
593 ts.WriteLine("AC_PATH_PROG(GACUTIL, gacutil)");
594 ts.WriteLine();
595 ts.WriteLine("AC_MSG_CHECKING([for mono])");
596 ts.WriteLine("dnl if test \"x$MONO\" = \"x\" ; then");
597 ts.WriteLine("dnl AC_MSG_ERROR([Can't find \"mono\" in your PATH])");
598 ts.WriteLine("dnl else");
599 ts.WriteLine(" AC_MSG_RESULT([found])");
600 ts.WriteLine("dnl fi");
601 ts.WriteLine();
602 ts.WriteLine("AC_MSG_CHECKING([for gmcs])");
603 ts.WriteLine("dnl if test \"x$GMCS\" = \"x\" ; then");
604 ts.WriteLine("dnl AC_MSG_ERROR([Can't find \"gmcs\" in your PATH])");
605 ts.WriteLine("dnl else");
606 ts.WriteLine(" AC_MSG_RESULT([found])");
607 ts.WriteLine("dnl fi");
608 ts.WriteLine();
609 //ts.WriteLine("AC_MSG_CHECKING([for gacutil])");
610 //ts.WriteLine("if test \"x$GACUTIL\" = \"x\" ; then");
611 //ts.WriteLine(" AC_MSG_ERROR([Can't find \"gacutil\" in your PATH])");
612 //ts.WriteLine("else");
613 //ts.WriteLine(" AC_MSG_RESULT([found])");
614 //ts.WriteLine("fi");
615 ts.WriteLine();
616 ts.WriteLine("AC_SUBST(PATH)");
617 ts.WriteLine("AC_SUBST(LD_LIBRARY_PATH)");
618 ts.WriteLine();
619 ts.WriteLine("dnl CSFLAGS=\"-debug -nowarn:1574\"");
620 ts.WriteLine("CSFLAGS=\"\"");
621 ts.WriteLine("AC_SUBST(CSFLAGS)");
622 ts.WriteLine();
623 // ts.WriteLine("AC_MSG_CHECKING(--disable-sdl argument)");
624 // ts.WriteLine("AC_ARG_ENABLE(sdl,");
625 // ts.WriteLine(" [ --disable-sdl Disable Sdl interface.],");
626 // ts.WriteLine(" [disable_sdl=$disableval],");
627 // ts.WriteLine(" [disable_sdl=\"no\"])");
628 // ts.WriteLine("AC_MSG_RESULT($disable_sdl)");
629 // ts.WriteLine("if test \"$disable_sdl\" = \"yes\"; then");
630 // ts.WriteLine(" AC_DEFINE(FEAT_SDL)");
631 // ts.WriteLine("fi");
632 ts.WriteLine();
633 ts.WriteLine("dnl Find pkg-config");
634 ts.WriteLine("AC_PATH_PROG(PKGCONFIG, pkg-config, no)");
635 ts.WriteLine("if test \"x$PKG_CONFIG\" = \"xno\"; then");
636 ts.WriteLine(" AC_MSG_ERROR([You need to install pkg-config])");
637 ts.WriteLine("fi");
638 ts.WriteLine();
639 ts.WriteLine("PKG_CHECK_MODULES(MONO_DEPENDENCY, mono >= $MONO_REQUIRED_VERSION, has_mono=true, has_mono=false)");
640 ts.WriteLine("BUILD_DIR=\"bin\"");
641 ts.WriteLine("AC_SUBST(BUILD_DIR)");
642 ts.WriteLine("CONFIG=\"Release\"");
643 ts.WriteLine("AC_SUBST(CONFIG)");
644 ts.WriteLine();
645 ts.WriteLine("if test \"x$has_mono\" = \"xtrue\"; then");
646 ts.WriteLine(" AC_PATH_PROG(RUNTIME, mono, no)");
647 ts.WriteLine(" AC_PATH_PROG(CSC, gmcs, no)");
648 ts.WriteLine(" if test `uname -s` = \"Darwin\"; then");
649 ts.WriteLine(" LIB_PREFIX=");
650 ts.WriteLine(" LIB_SUFFIX=.dylib");
651 ts.WriteLine(" else");
652 ts.WriteLine(" LIB_PREFIX=.so");
653 ts.WriteLine(" LIB_SUFFIX=");
654 ts.WriteLine(" fi");
655 ts.WriteLine("else");
656 ts.WriteLine(" AC_PATH_PROG(CSC, csc.exe, no)");
657 ts.WriteLine(" if test x$CSC = \"xno\"; then");
658 ts.WriteLine(" AC_MSG_ERROR([You need to install either mono or .Net])");
659 ts.WriteLine(" else");
660 ts.WriteLine(" RUNTIME=");
661 ts.WriteLine(" LIB_PREFIX=");
662 ts.WriteLine(" LIB_SUFFIX=.dylib");
663 ts.WriteLine(" fi");
664 ts.WriteLine("fi");
665 ts.WriteLine();
666 ts.WriteLine("AC_SUBST(LIB_PREFIX)");
667 ts.WriteLine("AC_SUBST(LIB_SUFFIX)");
668 ts.WriteLine();
669 ts.WriteLine("AC_SUBST(BASE_DEPENDENCIES_CFLAGS)");
670 ts.WriteLine("AC_SUBST(BASE_DEPENDENCIES_LIBS)");
671 ts.WriteLine();
672 ts.WriteLine("dnl Find monodoc");
673 ts.WriteLine("MONODOC_REQUIRED_VERSION=1.0");
674 ts.WriteLine("AC_SUBST(MONODOC_REQUIRED_VERSION)");
675 ts.WriteLine("PKG_CHECK_MODULES(MONODOC_DEPENDENCY, monodoc >= $MONODOC_REQUIRED_VERSION, enable_monodoc=yes, enable_monodoc=no)");
676 ts.WriteLine();
677 ts.WriteLine("if test \"x$enable_monodoc\" = \"xyes\"; then");
678 ts.WriteLine(" AC_PATH_PROG(MONODOC, monodoc, no)");
679 ts.WriteLine(" if test x$MONODOC = xno; then");
680 ts.WriteLine(" enable_monodoc=no");
681 ts.WriteLine(" fi");
682 ts.WriteLine("else");
683 ts.WriteLine(" MONODOC=");
684 ts.WriteLine("fi");
685 ts.WriteLine();
686 ts.WriteLine("AC_SUBST(MONODOC)");
687 ts.WriteLine("AM_CONDITIONAL(ENABLE_MONODOC, test \"x$enable_monodoc\" = \"xyes\")");
688 ts.WriteLine();
689 ts.WriteLine("AC_PATH_PROG(GACUTIL, gacutil, no)");
690 ts.WriteLine("if test \"x$GACUTIL\" = \"xno\" ; then");
691 ts.WriteLine(" AC_MSG_ERROR([No gacutil tool found])");
692 ts.WriteLine("fi");
693 ts.WriteLine();
694 // foreach(ProjectNode project in solution.ProjectsTableOrder)
695 // {
696 // if (project.Type == ProjectType.Library)
697 // {
698 // }
699 // }
700 ts.WriteLine("GACUTIL_FLAGS='/package $(PACKAGE_NAME) /gacdir $(DESTDIR)$(prefix)'");
701 ts.WriteLine("AC_SUBST(GACUTIL_FLAGS)");
702 ts.WriteLine();
703 ts.WriteLine("winbuild=no");
704 ts.WriteLine("case \"$host\" in");
705 ts.WriteLine(" *-*-mingw*|*-*-cygwin*)");
706 ts.WriteLine(" winbuild=yes");
707 ts.WriteLine(" ;;");
708 ts.WriteLine("esac");
709 ts.WriteLine("AM_CONDITIONAL(WINBUILD, test x$winbuild = xyes)");
710 ts.WriteLine();
711 // ts.WriteLine("dnl Check for SDL");
712 // ts.WriteLine();
713 // ts.WriteLine("AC_PATH_PROG([SDL_CONFIG], [sdl-config])");
714 // ts.WriteLine("have_sdl=no");
715 // ts.WriteLine("if test -n \"${SDL_CONFIG}\"; then");
716 // ts.WriteLine(" have_sdl=yes");
717 // ts.WriteLine(" SDL_CFLAGS=`$SDL_CONFIG --cflags`");
718 // ts.WriteLine(" SDL_LIBS=`$SDL_CONFIG --libs`");
719 // ts.WriteLine(" #");
720 // ts.WriteLine(" # sdl-config sometimes emits an rpath flag pointing at its library");
721 // ts.WriteLine(" # installation directory. We don't want this, as it prevents users from");
722 // ts.WriteLine(" # linking sdl-viewer against, for example, a locally compiled libGL when a");
723 // ts.WriteLine(" # version of the library also exists in SDL's library installation");
724 // ts.WriteLine(" # directory, typically /usr/lib.");
725 // ts.WriteLine(" #");
726 // ts.WriteLine(" SDL_LIBS=`echo $SDL_LIBS | sed 's/-Wl,-rpath,[[^ ]]* //'`");
727 // ts.WriteLine("fi");
728 // ts.WriteLine("AC_SUBST([SDL_CFLAGS])");
729 // ts.WriteLine("AC_SUBST([SDL_LIBS])");
730 ts.WriteLine();
731 ts.WriteLine("AC_OUTPUT([");
732 ts.WriteLine("Makefile");
733 // TODO: this does not work quite right.
734 //ts.WriteLine("Properties/AssemblyInfo.cs");
735 foreach(ProjectNode project in solution.ProjectsTableOrder)
736 {
737 if (project.Type == ProjectType.Library)
738 {
739 ts.WriteLine(project.Name + ".pc");
740 }
741 // string path = Helper.MakePathRelativeTo(solution.FullPath, project.FullPath);
742 // ts.WriteLine(Helper.NormalizePath(Helper.MakeFilePath(path, "Include"),'/'));
743 }
744 ts.WriteLine("])");
745 ts.WriteLine();
746 ts.WriteLine("#po/Makefile.in");
747 ts.WriteLine();
748 ts.WriteLine("echo \"---\"");
749 ts.WriteLine("echo \"Configuration summary\"");
750 ts.WriteLine("echo \"\"");
751 ts.WriteLine("echo \" * Installation prefix: $prefix\"");
752 ts.WriteLine("echo \" * compiler: $CSC\"");
753 ts.WriteLine("echo \" * Documentation: $enable_monodoc ($MONODOC)\"");
754 ts.WriteLine("echo \" * Package Name: $PACKAGE_NAME\"");
755 ts.WriteLine("echo \" * Version: $PACKAGE_VERSION\"");
756 ts.WriteLine("echo \" * Public Key: $PUBKEY\"");
757 ts.WriteLine("echo \"\"");
758 ts.WriteLine("echo \"---\"");
759 ts.WriteLine();
760 }
761
762 ts.NewLine = "\n";
763 foreach (ProjectNode project in solution.ProjectsTableOrder)
764 {
765 if (project.GenerateAssemblyInfoFile)
766 {
767 GenerateAssemblyInfoFile(solution, combFile);
768 }
769 }
770 }
771
772 private static void GenerateAssemblyInfoFile(SolutionNode solution, string combFile)
773 {
774 System.IO.Directory.CreateDirectory(Helper.MakePathRelativeTo(solution.FullPath, "Properties"));
775 combFile = Helper.MakeFilePath(solution.FullPath + "/Properties/", "AssemblyInfo.cs", "in");
776 StreamWriter ai = new StreamWriter(combFile);
777
778 using (ai)
779 {
780 ai.WriteLine("#region License");
781 ai.WriteLine("/*");
782 ai.WriteLine("MIT License");
783 ai.WriteLine("Copyright (c)2003-2006 Tao Framework Team");
784 ai.WriteLine("http://www.taoframework.com");
785 ai.WriteLine("All rights reserved.");
786 ai.WriteLine("");
787 ai.WriteLine("Permission is hereby granted, free of charge, to any person obtaining a copy");
788 ai.WriteLine("of this software and associated documentation files (the \"Software\"), to deal");
789 ai.WriteLine("in the Software without restriction, including without limitation the rights");
790 ai.WriteLine("to use, copy, modify, merge, publish, distribute, sublicense, and/or sell");
791 ai.WriteLine("copies of the Software, and to permit persons to whom the Software is");
792 ai.WriteLine("furnished to do so, subject to the following conditions:");
793 ai.WriteLine("");
794 ai.WriteLine("The above copyright notice and this permission notice shall be included in all");
795 ai.WriteLine("copies or substantial portions of the Software.");
796 ai.WriteLine("");
797 ai.WriteLine("THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR");
798 ai.WriteLine("IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,");
799 ai.WriteLine("FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE");
800 ai.WriteLine("AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER");
801 ai.WriteLine("LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,");
802 ai.WriteLine("OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE");
803 ai.WriteLine("SOFTWARE.");
804 ai.WriteLine("*/");
805 ai.WriteLine("#endregion License");
806 ai.WriteLine("");
807 ai.WriteLine("using System;");
808 ai.WriteLine("using System.Reflection;");
809 ai.WriteLine("using System.Runtime.InteropServices;");
810 ai.WriteLine("using System.Security;");
811 ai.WriteLine("using System.Security.Permissions;");
812 ai.WriteLine("");
813 ai.WriteLine("[assembly: AllowPartiallyTrustedCallers]");
814 ai.WriteLine("[assembly: AssemblyCompany(\"Tao Framework -- http://www.taoframework.com\")]");
815 ai.WriteLine("[assembly: AssemblyConfiguration(\"Retail\")]");
816 ai.WriteLine("[assembly: AssemblyCopyright(\"Copyright (c)2003-2006 Tao Framework Team. All rights reserved.\")]");
817 ai.WriteLine("[assembly: AssemblyCulture(\"\")]");
818 ai.WriteLine("[assembly: AssemblyDefaultAlias(\"@PACKAGE_NAME@\")]");
819 ai.WriteLine("[assembly: AssemblyDelaySign(false)]");
820 ai.WriteLine("[assembly: AssemblyDescription(\"@DESCRIPTION@\")]");
821 ai.WriteLine("[assembly: AssemblyFileVersion(\"@ASSEMBLY_VERSION@\")]");
822 ai.WriteLine("[assembly: AssemblyInformationalVersion(\"@ASSEMBLY_VERSION@\")]");
823 ai.WriteLine("[assembly: AssemblyKeyName(\"\")]");
824 ai.WriteLine("[assembly: AssemblyProduct(\"@PACKAGE_NAME@.dll\")]");
825 ai.WriteLine("[assembly: AssemblyTitle(\"@DESCRIPTION@\")]");
826 ai.WriteLine("[assembly: AssemblyTrademark(\"Tao Framework -- http://www.taoframework.com\")]");
827 ai.WriteLine("[assembly: AssemblyVersion(\"@ASSEMBLY_VERSION@\")]");
828 ai.WriteLine("[assembly: CLSCompliant(true)]");
829 ai.WriteLine("[assembly: ComVisible(false)]");
830 ai.WriteLine("[assembly: SecurityPermission(SecurityAction.RequestMinimum, Flags = SecurityPermissionFlag.Execution)]");
831 ai.WriteLine("[assembly: SecurityPermission(SecurityAction.RequestMinimum, Flags = SecurityPermissionFlag.SkipVerification)]");
832 ai.WriteLine("[assembly: SecurityPermission(SecurityAction.RequestMinimum, Flags = SecurityPermissionFlag.UnmanagedCode)]");
833
834 }
835 //return combFile;
836 }
837
838 private void CleanProject(ProjectNode project)
839 {
840 m_Kernel.Log.Write("...Cleaning project: {0}", project.Name);
841 string projectFile = Helper.MakeFilePath(project.FullPath, "Include", "am");
842 Helper.DeleteIfExists(projectFile);
843 }
844
845 private void CleanSolution(SolutionNode solution)
846 {
847 m_Kernel.Log.Write("Cleaning Autotools make files for", solution.Name);
848
849 string slnFile = Helper.MakeFilePath(solution.FullPath, "Makefile", "am");
850 Helper.DeleteIfExists(slnFile);
851
852 slnFile = Helper.MakeFilePath(solution.FullPath, "Makefile", "in");
853 Helper.DeleteIfExists(slnFile);
854
855 slnFile = Helper.MakeFilePath(solution.FullPath, "configure", "ac");
856 Helper.DeleteIfExists(slnFile);
857
858 slnFile = Helper.MakeFilePath(solution.FullPath, "configure");
859 Helper.DeleteIfExists(slnFile);
860
861 slnFile = Helper.MakeFilePath(solution.FullPath, "Makefile");
862 Helper.DeleteIfExists(slnFile);
863
864 foreach(ProjectNode project in solution.Projects)
865 {
866 CleanProject(project);
867 }
868
869 m_Kernel.Log.Write("");
870 }
871
872 #endregion
873
874 #region ITarget Members
875
876 /// <summary>
877 /// Writes the specified kern.
878 /// </summary>
879 /// <param name="kern">The kern.</param>
880 public void Write(Kernel kern)
881 {
882 if( kern == null )
883 {
884 throw new ArgumentNullException("kern");
885 }
886 m_Kernel = kern;
887 foreach(SolutionNode solution in kern.Solutions)
888 {
889 WriteCombine(solution);
890 }
891 m_Kernel = null;
892 }
893
894 /// <summary>
895 /// Cleans the specified kern.
896 /// </summary>
897 /// <param name="kern">The kern.</param>
898 public virtual void Clean(Kernel kern)
899 {
900 if( kern == null )
901 {
902 throw new ArgumentNullException("kern");
903 }
904 m_Kernel = kern;
905 foreach(SolutionNode sol in kern.Solutions)
906 {
907 CleanSolution(sol);
908 }
909 m_Kernel = null;
910 }
911
912 /// <summary>
913 /// Gets the name.
914 /// </summary>
915 /// <value>The name.</value>
916 public string Name
917 {
918 get
919 {
920 return "autotools";
921 }
922 }
923
924 #endregion
925 }
926}
diff --git a/Prebuild/src/Core/Targets/DebugTarget.cs b/Prebuild/src/Core/Targets/DebugTarget.cs
new file mode 100644
index 0000000..6baa623
--- /dev/null
+++ b/Prebuild/src/Core/Targets/DebugTarget.cs
@@ -0,0 +1,102 @@
1#region BSD License
2/*
3Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com)
4
5Redistribution and use in source and binary forms, with or without modification, are permitted
6provided that the following conditions are met:
7
8* Redistributions of source code must retain the above copyright notice, this list of conditions
9 and the following disclaimer.
10* Redistributions in binary form must reproduce the above copyright notice, this list of conditions
11 and the following disclaimer in the documentation and/or other materials provided with the
12 distribution.
13* The name of the author may not be used to endorse or promote products derived from this software
14 without specific prior written permission.
15
16THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
17BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
19EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
21OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
22IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23*/
24#endregion
25
26#region CVS Information
27/*
28 * $Source$
29 * $Author: jendave $
30 * $Date: 2006-09-20 09:42:51 +0200 (on, 20 sep 2006) $
31 * $Revision: 164 $
32 */
33#endregion
34
35using System;
36
37using Prebuild.Core.Attributes;
38using Prebuild.Core.Interfaces;
39using Prebuild.Core.Nodes;
40
41#if (DEBUG && _DEBUG_TARGET)
42namespace Prebuild.Core.Targets
43{
44 [Target("debug")]
45 public class DebugTarget : ITarget
46 {
47#region Fields
48
49 private Kernel m_Kernel = null;
50
51#endregion
52
53#region ITarget Members
54
55 public void Write()
56 {
57 foreach(SolutionNode s in m_Kernel.Solutions)
58 {
59 Console.WriteLine("Solution [ {0}, {1} ]", s.Name, s.Path);
60 foreach(string file in s.Files)
61{
62 Console.WriteLine("\tFile [ {0} ]", file);
63}
64
65 foreach(ProjectNode proj in s.Projects)
66 {
67 Console.WriteLine("\tProject [ {0}, {1}. {2} ]", proj.Name, proj.Path, proj.Language);
68 foreach(string file in proj.Files)
69 Console.WriteLine("\t\tFile [ {0} ]", file);
70 }
71 }
72 }
73
74 public void Clean()
75 {
76 Console.WriteLine("Not implemented");
77 }
78
79 public string Name
80 {
81 get
82 {
83 return "debug";
84 }
85 }
86
87 public Kernel Kernel
88 {
89 get
90 {
91 return m_Kernel;
92 }
93 set
94 {
95 m_Kernel = value;
96 }
97 }
98
99#endregion
100 }
101}
102#endif
diff --git a/Prebuild/src/Core/Targets/MonoDevelopTarget.cs b/Prebuild/src/Core/Targets/MonoDevelopTarget.cs
new file mode 100644
index 0000000..8620e4b
--- /dev/null
+++ b/Prebuild/src/Core/Targets/MonoDevelopTarget.cs
@@ -0,0 +1,458 @@
1#region BSD License
2/*
3Copyright (c) 2004 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com)
4
5Redistribution and use in source and binary forms, with or without modification, are permitted
6provided that the following conditions are met:
7
8* Redistributions of source code must retain the above copyright notice, this list of conditions
9 and the following disclaimer.
10* Redistributions in binary form must reproduce the above copyright notice, this list of conditions
11 and the following disclaimer in the documentation and/or other materials provided with the
12 distribution.
13* The name of the author may not be used to endorse or promote products derived from this software
14 without specific prior written permission.
15
16THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
17BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
19EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
21OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
22IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23*/
24#endregion
25
26#region CVS Information
27/*
28 * $Source$
29 * $Author: jendave $
30 * $Date: 2007-02-13 22:07:07 +0100 (ti, 13 feb 2007) $
31 * $Revision: 206 $
32 */
33#endregion
34
35using System;
36using System.Collections;
37using System.Collections.Specialized;
38using System.IO;
39using System.Reflection;
40using System.Text.RegularExpressions;
41
42using Prebuild.Core.Attributes;
43using Prebuild.Core.Interfaces;
44using Prebuild.Core.Nodes;
45using Prebuild.Core.Utilities;
46
47namespace Prebuild.Core.Targets
48{
49 /// <summary>
50 ///
51 /// </summary>
52 [Target("monodev")]
53 public class MonoDevelopTarget : ITarget
54 {
55 #region Fields
56
57 private Kernel m_Kernel;
58
59 #endregion
60
61 #region Private Methods
62
63 private static string PrependPath(string path)
64 {
65 string tmpPath = Helper.NormalizePath(path, '/');
66 Regex regex = new Regex(@"(\w):/(\w+)");
67 Match match = regex.Match(tmpPath);
68 if(match.Success || tmpPath[0] == '.' || tmpPath[0] == '/')
69 {
70 tmpPath = Helper.NormalizePath(tmpPath);
71 }
72 else
73 {
74 tmpPath = Helper.NormalizePath("./" + tmpPath);
75 }
76
77 return tmpPath;
78 }
79
80 private static string BuildReference(SolutionNode solution, ReferenceNode refr)
81 {
82 string ret = "<ProjectReference type=\"";
83 if(solution.ProjectsTable.ContainsKey(refr.Name))
84 {
85 ret += "Project\"";
86 ret += " localcopy=\"" + refr.LocalCopy.ToString() + "\" refto=\"" + refr.Name + "\" />";
87 }
88 else
89 {
90 ProjectNode project = (ProjectNode)refr.Parent;
91 string fileRef = FindFileReference(refr.Name, project);
92
93 if(refr.Path != null || fileRef != null)
94 {
95 ret += "Assembly\" refto=\"";
96
97 string finalPath = (refr.Path != null) ? Helper.MakeFilePath(refr.Path, refr.Name, "dll") : fileRef;
98
99 ret += finalPath;
100 ret += "\" localcopy=\"" + refr.LocalCopy.ToString() + "\" />";
101 return ret;
102 }
103
104 ret += "Gac\"";
105 ret += " localcopy=\"" + refr.LocalCopy.ToString() + "\"";
106 ret += " refto=\"";
107 try
108 {
109 //Assembly assem = Assembly.Load(refr.Name);
110 //ret += assem.FullName;
111 ret += refr.Name;
112 }
113 catch (System.NullReferenceException e)
114 {
115 e.ToString();
116 ret += refr.Name;
117 }
118 ret += "\" />";
119 }
120
121 return ret;
122 }
123
124 private static string FindFileReference(string refName, ProjectNode project)
125 {
126 foreach(ReferencePathNode refPath in project.ReferencePaths)
127 {
128 string fullPath = Helper.MakeFilePath(refPath.Path, refName, "dll");
129
130 if(File.Exists(fullPath))
131 {
132 return fullPath;
133 }
134 }
135
136 return null;
137 }
138
139 /// <summary>
140 /// Gets the XML doc file.
141 /// </summary>
142 /// <param name="project">The project.</param>
143 /// <param name="conf">The conf.</param>
144 /// <returns></returns>
145 public static string GenerateXmlDocFile(ProjectNode project, ConfigurationNode conf)
146 {
147 if( conf == null )
148 {
149 throw new ArgumentNullException("conf");
150 }
151 if( project == null )
152 {
153 throw new ArgumentNullException("project");
154 }
155 string docFile = (string)conf.Options["XmlDocFile"];
156 if(docFile != null && docFile.Length == 0)//default to assembly name if not specified
157 {
158 return "False";
159 }
160 return "True";
161 }
162
163 private void WriteProject(SolutionNode solution, ProjectNode project)
164 {
165 string csComp = "Mcs";
166 string netRuntime = "Mono";
167 if(project.Runtime == ClrRuntime.Microsoft)
168 {
169 csComp = "Csc";
170 netRuntime = "MsNet";
171 }
172
173 string projFile = Helper.MakeFilePath(project.FullPath, project.Name, "mdp");
174 StreamWriter ss = new StreamWriter(projFile);
175
176 m_Kernel.CurrentWorkingDirectory.Push();
177 Helper.SetCurrentDir(Path.GetDirectoryName(projFile));
178
179 using(ss)
180 {
181 ss.WriteLine(
182 "<Project name=\"{0}\" description=\"\" standardNamespace=\"{1}\" newfilesearch=\"None\" enableviewstate=\"True\" fileversion=\"2.0\" language=\"C#\" clr-version=\"Net_2_0\" ctype=\"DotNetProject\">",
183 project.Name,
184 project.RootNamespace
185 );
186
187 int count = 0;
188
189 ss.WriteLine(" <Configurations active=\"{0}\">", solution.ActiveConfig);
190
191 foreach(ConfigurationNode conf in project.Configurations)
192 {
193 ss.WriteLine(" <Configuration name=\"{0}\" ctype=\"DotNetProjectConfiguration\">", conf.Name);
194 ss.Write(" <Output");
195 ss.Write(" directory=\"{0}\"", Helper.EndPath(Helper.NormalizePath(".\\" + conf.Options["OutputPath"].ToString())));
196 ss.Write(" assembly=\"{0}\"", project.AssemblyName);
197 ss.Write(" executeScript=\"{0}\"", conf.Options["RunScript"]);
198 //ss.Write(" executeBeforeBuild=\"{0}\"", conf.Options["PreBuildEvent"]);
199 //ss.Write(" executeAfterBuild=\"{0}\"", conf.Options["PostBuildEvent"]);
200 if (conf.Options["PreBuildEvent"] != null && conf.Options["PreBuildEvent"].ToString().Length != 0)
201 {
202 ss.Write(" executeBeforeBuild=\"{0}\"", Helper.NormalizePath(conf.Options["PreBuildEvent"].ToString()));
203 }
204 else
205 {
206 ss.Write(" executeBeforeBuild=\"{0}\"", conf.Options["PreBuildEvent"]);
207 }
208 if (conf.Options["PostBuildEvent"] != null && conf.Options["PostBuildEvent"].ToString().Length != 0)
209 {
210 ss.Write(" executeAfterBuild=\"{0}\"", Helper.NormalizePath(conf.Options["PostBuildEvent"].ToString()));
211 }
212 else
213 {
214 ss.Write(" executeAfterBuild=\"{0}\"", conf.Options["PostBuildEvent"]);
215 }
216 ss.Write(" executeBeforeBuildArguments=\"{0}\"", conf.Options["PreBuildEventArgs"]);
217 ss.Write(" executeAfterBuildArguments=\"{0}\"", conf.Options["PreBuildEventArgs"]);
218 ss.WriteLine(" />");
219
220 ss.Write(" <Build");
221 ss.Write(" debugmode=\"True\"");
222 if (project.Type == ProjectType.WinExe)
223 {
224 ss.Write(" target=\"{0}\"", ProjectType.Exe.ToString());
225 }
226 else
227 {
228 ss.Write(" target=\"{0}\"", project.Type);
229 }
230 ss.WriteLine(" />");
231
232 ss.Write(" <Execution");
233 ss.Write(" runwithwarnings=\"True\"");
234 ss.Write(" consolepause=\"True\"");
235 ss.Write(" runtime=\"{0}\"", netRuntime);
236 ss.Write(" clr-version=\"Net_2_0\"");
237 ss.WriteLine(" />");
238
239 ss.Write(" <CodeGeneration");
240 ss.Write(" compiler=\"{0}\"", csComp);
241 ss.Write(" warninglevel=\"{0}\"", conf.Options["WarningLevel"]);
242 ss.Write(" nowarn=\"{0}\"", conf.Options["SuppressWarnings"]);
243 ss.Write(" includedebuginformation=\"{0}\"", conf.Options["DebugInformation"]);
244 ss.Write(" optimize=\"{0}\"", conf.Options["OptimizeCode"]);
245 ss.Write(" unsafecodeallowed=\"{0}\"", conf.Options["AllowUnsafe"]);
246 ss.Write(" generateoverflowchecks=\"{0}\"", conf.Options["CheckUnderflowOverflow"]);
247 ss.Write(" mainclass=\"{0}\"", project.StartupObject);
248 ss.Write(" target=\"{0}\"", project.Type);
249 ss.Write(" definesymbols=\"{0}\"", conf.Options["CompilerDefines"]);
250 ss.Write(" generatexmldocumentation=\"{0}\"", GenerateXmlDocFile(project, conf));
251 ss.Write(" win32Icon=\"{0}\"", project.AppIcon);
252 ss.Write(" ctype=\"CSharpCompilerParameters\"");
253 ss.WriteLine(" />");
254 ss.WriteLine(" </Configuration>");
255
256 count++;
257 }
258 ss.WriteLine(" </Configurations>");
259
260 ss.Write(" <DeploymentInformation");
261 ss.Write(" target=\"\"");
262 ss.Write(" script=\"\"");
263 ss.Write(" strategy=\"File\"");
264 ss.WriteLine(">");
265 ss.WriteLine(" <excludeFiles />");
266 ss.WriteLine(" </DeploymentInformation>");
267
268 ss.WriteLine(" <Contents>");
269 foreach(string file in project.Files)
270 {
271 string buildAction = "Compile";
272 switch(project.Files.GetBuildAction(file))
273 {
274 case BuildAction.None:
275 buildAction = "Nothing";
276 break;
277
278 case BuildAction.Content:
279 buildAction = "Exclude";
280 break;
281
282 case BuildAction.EmbeddedResource:
283 buildAction = "EmbedAsResource";
284 break;
285
286 default:
287 buildAction = "Compile";
288 break;
289 }
290
291 // Sort of a hack, we try and resolve the path and make it relative, if we can.
292 string filePath = PrependPath(file);
293 ss.WriteLine(" <File name=\"{0}\" subtype=\"Code\" buildaction=\"{1}\" dependson=\"\" data=\"\" />", filePath, buildAction);
294 }
295 ss.WriteLine(" </Contents>");
296
297 ss.WriteLine(" <References>");
298 foreach(ReferenceNode refr in project.References)
299 {
300 ss.WriteLine(" {0}", BuildReference(solution, refr));
301 }
302 ss.WriteLine(" </References>");
303
304
305 ss.WriteLine("</Project>");
306 }
307
308 m_Kernel.CurrentWorkingDirectory.Pop();
309 }
310
311 private void WriteCombine(SolutionNode solution)
312 {
313 m_Kernel.Log.Write("Creating MonoDevelop combine and project files");
314 foreach(ProjectNode project in solution.Projects)
315 {
316 if(m_Kernel.AllowProject(project.FilterGroups))
317 {
318 m_Kernel.Log.Write("...Creating project: {0}", project.Name);
319 WriteProject(solution, project);
320 }
321 }
322
323 m_Kernel.Log.Write("");
324 string combFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "mds");
325 StreamWriter ss = new StreamWriter(combFile);
326
327 m_Kernel.CurrentWorkingDirectory.Push();
328 Helper.SetCurrentDir(Path.GetDirectoryName(combFile));
329
330 int count = 0;
331
332 using(ss)
333 {
334 ss.WriteLine("<Combine name=\"{0}\" fileversion=\"2.0\" description=\"\">", solution.Name);
335
336 count = 0;
337 foreach(ConfigurationNode conf in solution.Configurations)
338 {
339 if(count == 0)
340 {
341 ss.WriteLine(" <Configurations active=\"{0}\">", conf.Name);
342 }
343
344 ss.WriteLine(" <Configuration name=\"{0}\" ctype=\"CombineConfiguration\">", conf.Name);
345 foreach(ProjectNode project in solution.Projects)
346 {
347 ss.WriteLine(" <Entry configuration=\"{1}\" build=\"True\" name=\"{0}\" />", project.Name, conf.Name);
348 }
349 ss.WriteLine(" </Configuration>");
350
351 count++;
352 }
353 ss.WriteLine(" </Configurations>");
354
355 count = 0;
356
357 foreach(ProjectNode project in solution.Projects)
358 {
359 if(count == 0)
360 ss.WriteLine(" <StartMode startupentry=\"{0}\" single=\"True\">", project.Name);
361
362 ss.WriteLine(" <Execute type=\"None\" entry=\"{0}\" />", project.Name);
363 count++;
364 }
365 ss.WriteLine(" </StartMode>");
366
367 ss.WriteLine(" <Entries>");
368 foreach(ProjectNode project in solution.Projects)
369 {
370 string path = Helper.MakePathRelativeTo(solution.FullPath, project.FullPath);
371 ss.WriteLine(" <Entry filename=\"{0}\" />",
372 Helper.MakeFilePath(path, project.Name, "mdp"));
373 }
374 ss.WriteLine(" </Entries>");
375
376 ss.WriteLine("</Combine>");
377 }
378
379 m_Kernel.CurrentWorkingDirectory.Pop();
380 }
381
382 private void CleanProject(ProjectNode project)
383 {
384 m_Kernel.Log.Write("...Cleaning project: {0}", project.Name);
385 string projectFile = Helper.MakeFilePath(project.FullPath, project.Name, "mdp");
386 Helper.DeleteIfExists(projectFile);
387 }
388
389 private void CleanSolution(SolutionNode solution)
390 {
391 m_Kernel.Log.Write("Cleaning MonoDevelop combine and project files for", solution.Name);
392
393 string slnFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "mds");
394 Helper.DeleteIfExists(slnFile);
395
396 foreach(ProjectNode project in solution.Projects)
397 {
398 CleanProject(project);
399 }
400
401 m_Kernel.Log.Write("");
402 }
403
404 #endregion
405
406 #region ITarget Members
407
408 /// <summary>
409 /// Writes the specified kern.
410 /// </summary>
411 /// <param name="kern">The kern.</param>
412 public void Write(Kernel kern)
413 {
414 if( kern == null )
415 {
416 throw new ArgumentNullException("kern");
417 }
418 m_Kernel = kern;
419 foreach(SolutionNode solution in kern.Solutions)
420 {
421 WriteCombine(solution);
422 }
423 m_Kernel = null;
424 }
425
426 /// <summary>
427 /// Cleans the specified kern.
428 /// </summary>
429 /// <param name="kern">The kern.</param>
430 public virtual void Clean(Kernel kern)
431 {
432 if( kern == null )
433 {
434 throw new ArgumentNullException("kern");
435 }
436 m_Kernel = kern;
437 foreach(SolutionNode sol in kern.Solutions)
438 {
439 CleanSolution(sol);
440 }
441 m_Kernel = null;
442 }
443
444 /// <summary>
445 /// Gets the name.
446 /// </summary>
447 /// <value>The name.</value>
448 public string Name
449 {
450 get
451 {
452 return "sharpdev";
453 }
454 }
455
456 #endregion
457 }
458}
diff --git a/Prebuild/src/Core/Targets/NAntTarget.cs b/Prebuild/src/Core/Targets/NAntTarget.cs
new file mode 100644
index 0000000..bd366dc
--- /dev/null
+++ b/Prebuild/src/Core/Targets/NAntTarget.cs
@@ -0,0 +1,621 @@
1#region BSD License
2/*
3Copyright (c) 2004 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com)
4
5Redistribution and use in source and binary forms, with or without modification, are permitted
6provided that the following conditions are met:
7
8* Redistributions of source code must retain the above copyright notice, this list of conditions
9 and the following disclaimer.
10* Redistributions in binary form must reproduce the above copyright notice, this list of conditions
11 and the following disclaimer in the documentation and/or other materials provided with the
12 distribution.
13* The name of the author may not be used to endorse or promote products derived from this software
14 without specific prior written permission.
15
16THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
17BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
19EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
21OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
22IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23*/
24#endregion
25
26#region CVS Information
27/*
28 * $Source$
29 * $Author: jendave $
30 * $Date: 2007-02-13 21:58:03 +0100 (ti, 13 feb 2007) $
31 * $Revision: 205 $
32 */
33#endregion
34
35using System;
36using System.Collections;
37using System.Collections.Specialized;
38using System.IO;
39using System.Reflection;
40using System.Text.RegularExpressions;
41
42using Prebuild.Core.Attributes;
43using Prebuild.Core.Interfaces;
44using Prebuild.Core.Nodes;
45using Prebuild.Core.Utilities;
46
47namespace Prebuild.Core.Targets
48{
49 /// <summary>
50 ///
51 /// </summary>
52 [Target("nant")]
53 public class NAntTarget : ITarget
54 {
55 #region Fields
56
57 private Kernel m_Kernel;
58
59 #endregion
60
61 #region Private Methods
62
63 private static string PrependPath(string path)
64 {
65 string tmpPath = Helper.NormalizePath(path, '/');
66 Regex regex = new Regex(@"(\w):/(\w+)");
67 Match match = regex.Match(tmpPath);
68 //if(match.Success || tmpPath[0] == '.' || tmpPath[0] == '/')
69 //{
70 tmpPath = Helper.NormalizePath(tmpPath);
71 //}
72// else
73// {
74// tmpPath = Helper.NormalizePath("./" + tmpPath);
75// }
76
77 return tmpPath;
78 }
79
80 private static string BuildReference(SolutionNode solution, ReferenceNode refr)
81 {
82 string ret = "";
83 if(solution.ProjectsTable.ContainsKey(refr.Name))
84 {
85 ProjectNode project = (ProjectNode)solution.ProjectsTable[refr.Name];
86 string fileRef = FindFileReference(refr.Name, project);
87 string finalPath = Helper.NormalizePath(Helper.MakeFilePath(project.FullPath + "/${build.dir}/", refr.Name, "dll"), '/');
88 ret += finalPath;
89 return ret;
90 }
91 else
92 {
93 ProjectNode project = (ProjectNode)refr.Parent;
94 string fileRef = FindFileReference(refr.Name, project);
95
96 if(refr.Path != null || fileRef != null)
97 {
98 string finalPath = (refr.Path != null) ? Helper.NormalizePath(refr.Path + "/" + refr.Name + ".dll", '/') : fileRef;
99 ret += finalPath;
100 return ret;
101 }
102
103 try
104 {
105 //Assembly assem = Assembly.Load(refr.Name);
106 //if (assem != null)
107 //{
108 //ret += (refr.Name + ".dll");
109 //}
110 //else
111 //{
112 ret += (refr.Name + ".dll");
113 //}
114 }
115 catch (System.NullReferenceException e)
116 {
117 e.ToString();
118 ret += refr.Name + ".dll";
119 }
120 }
121 return ret;
122 }
123
124 private static string BuildReferencePath(SolutionNode solution, ReferenceNode refr)
125 {
126 string ret = "";
127 if(solution.ProjectsTable.ContainsKey(refr.Name))
128 {
129 ProjectNode project = (ProjectNode)solution.ProjectsTable[refr.Name];
130 string fileRef = FindFileReference(refr.Name, project);
131 string finalPath = Helper.NormalizePath(Helper.MakeReferencePath(project.FullPath + "/${build.dir}/"), '/');
132 ret += finalPath;
133 return ret;
134 }
135 else
136 {
137 ProjectNode project = (ProjectNode)refr.Parent;
138 string fileRef = FindFileReference(refr.Name, project);
139
140 if(refr.Path != null || fileRef != null)
141 {
142 string finalPath = (refr.Path != null) ? Helper.NormalizePath(refr.Path, '/') : fileRef;
143 ret += finalPath;
144 return ret;
145 }
146
147 try
148 {
149 Assembly assem = Assembly.Load(refr.Name);
150 if (assem != null)
151 {
152 ret += "";
153 }
154 else
155 {
156 ret += "";
157 }
158 }
159 catch (System.NullReferenceException e)
160 {
161 e.ToString();
162 ret += "";
163 }
164 }
165 return ret;
166 }
167
168 private static string FindFileReference(string refName, ProjectNode project)
169 {
170 foreach(ReferencePathNode refPath in project.ReferencePaths)
171 {
172 string fullPath = Helper.MakeFilePath(refPath.Path, refName, "dll");
173
174 if(File.Exists(fullPath))
175 {
176 return fullPath;
177 }
178 }
179
180 return null;
181 }
182
183 /// <summary>
184 /// Gets the XML doc file.
185 /// </summary>
186 /// <param name="project">The project.</param>
187 /// <param name="conf">The conf.</param>
188 /// <returns></returns>
189 public static string GetXmlDocFile(ProjectNode project, ConfigurationNode conf)
190 {
191 if( conf == null )
192 {
193 throw new ArgumentNullException("conf");
194 }
195 if( project == null )
196 {
197 throw new ArgumentNullException("project");
198 }
199 string docFile = (string)conf.Options["XmlDocFile"];
200 // if(docFile != null && docFile.Length == 0)//default to assembly name if not specified
201 // {
202 // return Path.GetFileNameWithoutExtension(project.AssemblyName) + ".xml";
203 // }
204 return docFile;
205 }
206
207 private void WriteProject(SolutionNode solution, ProjectNode project)
208 {
209 string projFile = Helper.MakeFilePath(project.FullPath, project.Name + (project.Type == ProjectType.Library ? ".dll" : ".exe"), "build");
210 StreamWriter ss = new StreamWriter(projFile);
211
212 m_Kernel.CurrentWorkingDirectory.Push();
213 Helper.SetCurrentDir(Path.GetDirectoryName(projFile));
214 bool hasDoc = false;
215
216 using(ss)
217 {
218 ss.WriteLine("<?xml version=\"1.0\" ?>");
219 ss.WriteLine("<project name=\"{0}\" default=\"build\">", project.Name);
220 ss.WriteLine(" <target name=\"{0}\">", "build");
221 ss.WriteLine(" <echo message=\"Build Directory is ${project::get-base-directory()}/${build.dir}\" />");
222 ss.WriteLine(" <mkdir dir=\"${project::get-base-directory()}/${build.dir}\" />");
223 ss.WriteLine(" <copy todir=\"${project::get-base-directory()}/${build.dir}\">");
224 ss.WriteLine(" <fileset basedir=\"${project::get-base-directory()}\">");
225 foreach(ReferenceNode refr in project.References)
226 {
227 if (refr.LocalCopy)
228 {
229 ss.WriteLine(" <include name=\"{0}", Helper.NormalizePath(Helper.MakePathRelativeTo(project.FullPath, BuildReference(solution, refr))+"\" />", '/'));
230 }
231 }
232 ss.WriteLine(" </fileset>");
233 ss.WriteLine(" </copy>");
234 ss.Write(" <csc");
235 ss.Write(" target=\"{0}\"", project.Type.ToString().ToLower());
236 ss.Write(" debug=\"{0}\"", "${build.debug}");
237 foreach(ConfigurationNode conf in project.Configurations)
238 {
239 if (conf.Options.KeyFile !="")
240 {
241 ss.Write(" keyfile=\"{0}\"", conf.Options.KeyFile);
242 break;
243 }
244 }
245 foreach(ConfigurationNode conf in project.Configurations)
246 {
247 ss.Write(" unsafe=\"{0}\"", conf.Options.AllowUnsafe);
248 break;
249 }
250 foreach(ConfigurationNode conf in project.Configurations)
251 {
252 ss.Write(" define=\"{0}\"", conf.Options.CompilerDefines);
253 break;
254 }
255 foreach(ConfigurationNode conf in project.Configurations)
256 {
257 if (GetXmlDocFile(project, conf) !="")
258 {
259 ss.Write(" doc=\"{0}\"", "${project::get-base-directory()}/${build.dir}/" + GetXmlDocFile(project, conf));
260 hasDoc = true;
261 }
262 break;
263 }
264 ss.Write(" output=\"{0}", "${project::get-base-directory()}/${build.dir}/${project::get-name()}");
265 if (project.Type == ProjectType.Library)
266 {
267 ss.Write(".dll\"");
268 }
269 else
270 {
271 ss.Write(".exe\"");
272 }
273 if(project.AppIcon != null && project.AppIcon.Length != 0)
274 {
275 ss.Write(" win32icon=\"{0}\"", Helper.NormalizePath(project.AppIcon,'/'));
276 }
277 ss.WriteLine(">");
278 ss.WriteLine(" <resources prefix=\"{0}\" dynamicprefix=\"true\" >", project.RootNamespace);
279 foreach (string file in project.Files)
280 {
281 switch (project.Files.GetBuildAction(file))
282 {
283 case BuildAction.EmbeddedResource:
284 ss.WriteLine(" {0}", "<include name=\"" + Helper.NormalizePath(PrependPath(file), '/') + "\" />");
285 break;
286 default:
287 if (project.Files.GetSubType(file) != SubType.Code && project.Files.GetSubType(file) != SubType.Settings)
288 {
289 ss.WriteLine(" <include name=\"{0}\" />", file.Substring(0, file.LastIndexOf('.')) + ".resx");
290 }
291 break;
292 }
293 }
294 //if (project.Files.GetSubType(file).ToString() != "Code")
295 //{
296 // ps.WriteLine(" <EmbeddedResource Include=\"{0}\">", file.Substring(0, file.LastIndexOf('.')) + ".resx");
297
298 ss.WriteLine(" </resources>");
299 ss.WriteLine(" <sources failonempty=\"true\">");
300 foreach(string file in project.Files)
301 {
302 switch(project.Files.GetBuildAction(file))
303 {
304 case BuildAction.Compile:
305 ss.WriteLine(" <include name=\"" + Helper.NormalizePath(PrependPath(file), '/') + "\" />");
306 break;
307 default:
308 break;
309 }
310 }
311 ss.WriteLine(" </sources>");
312 ss.WriteLine(" <references basedir=\"${project::get-base-directory()}\">");
313 ss.WriteLine(" <lib>");
314 ss.WriteLine(" <include name=\"${project::get-base-directory()}\" />");
315 ss.WriteLine(" <include name=\"${project::get-base-directory()}/${build.dir}\" />");
316 ss.WriteLine(" </lib>");
317 foreach(ReferenceNode refr in project.References)
318 {
319 ss.WriteLine(" <include name=\"{0}", Helper.NormalizePath(Helper.MakePathRelativeTo(project.FullPath, BuildReference(solution, refr))+"\" />", '/'));
320 }
321 ss.WriteLine(" </references>");
322
323 ss.WriteLine(" </csc>");
324
325 foreach (ConfigurationNode conf in project.Configurations)
326 {
327 if (!String.IsNullOrEmpty(conf.Options.OutputPath))
328 {
329 string targetDir = Helper.NormalizePath(conf.Options.OutputPath, '/');
330
331 ss.WriteLine(" <echo message=\"Copying from [${project::get-base-directory()}/${build.dir}/] to [${project::get-base-directory()}/" + targetDir + "\" />");
332
333 ss.WriteLine(" <mkdir dir=\"${project::get-base-directory()}/" + targetDir + "\"/>");
334
335 ss.WriteLine(" <copy todir=\"${project::get-base-directory()}/" + targetDir + "\">");
336 ss.WriteLine(" <fileset basedir=\"${project::get-base-directory()}/${build.dir}/\" >");
337 ss.WriteLine(" <include name=\"*.dll\"/>");
338 ss.WriteLine(" <include name=\"*.exe\"/>");
339 ss.WriteLine(" </fileset>");
340 ss.WriteLine(" </copy>");
341 break;
342 }
343 }
344
345 ss.WriteLine(" </target>");
346
347 ss.WriteLine(" <target name=\"clean\">");
348 ss.WriteLine(" <delete dir=\"${bin.dir}\" failonerror=\"false\" />");
349 ss.WriteLine(" <delete dir=\"${obj.dir}\" failonerror=\"false\" />");
350 ss.WriteLine(" </target>");
351
352 ss.WriteLine(" <target name=\"doc\" description=\"Creates documentation.\">");
353 if (hasDoc)
354 {
355 ss.WriteLine(" <property name=\"doc.target\" value=\"\" />");
356 ss.WriteLine(" <if test=\"${platform::is-unix()}\">");
357 ss.WriteLine(" <property name=\"doc.target\" value=\"Web\" />");
358 ss.WriteLine(" </if>");
359 ss.WriteLine(" <ndoc failonerror=\"false\" verbose=\"true\">");
360 ss.WriteLine(" <assemblies basedir=\"${project::get-base-directory()}\">");
361 ss.Write(" <include name=\"${build.dir}/${project::get-name()}");
362 if (project.Type == ProjectType.Library)
363 {
364 ss.WriteLine(".dll\" />");
365 }
366 else
367 {
368 ss.WriteLine(".exe\" />");
369 }
370
371 ss.WriteLine(" </assemblies>");
372 ss.WriteLine(" <summaries basedir=\"${project::get-base-directory()}\">");
373 ss.WriteLine(" <include name=\"${build.dir}/${project::get-name()}.xml\"/>");
374 ss.WriteLine(" </summaries>");
375 ss.WriteLine(" <referencepaths basedir=\"${project::get-base-directory()}\">");
376 ss.WriteLine(" <include name=\"${build.dir}\" />");
377 // foreach(ReferenceNode refr in project.References)
378 // {
379 // string path = Helper.NormalizePath(Helper.MakePathRelativeTo(project.FullPath, BuildReferencePath(solution, refr)), '/');
380 // if (path != "")
381 // {
382 // ss.WriteLine(" <include name=\"{0}\" />", path);
383 // }
384 // }
385 ss.WriteLine(" </referencepaths>");
386 ss.WriteLine(" <documenters>");
387 ss.WriteLine(" <documenter name=\"MSDN\">");
388 ss.WriteLine(" <property name=\"OutputDirectory\" value=\"${project::get-base-directory()}/${build.dir}/doc/${project::get-name()}\" />");
389 ss.WriteLine(" <property name=\"OutputTarget\" value=\"${doc.target}\" />");
390 ss.WriteLine(" <property name=\"HtmlHelpName\" value=\"${project::get-name()}\" />");
391 ss.WriteLine(" <property name=\"IncludeFavorites\" value=\"False\" />");
392 ss.WriteLine(" <property name=\"Title\" value=\"${project::get-name()} SDK Documentation\" />");
393 ss.WriteLine(" <property name=\"SplitTOCs\" value=\"False\" />");
394 ss.WriteLine(" <property name=\"DefaulTOC\" value=\"\" />");
395 ss.WriteLine(" <property name=\"ShowVisualBasic\" value=\"True\" />");
396 ss.WriteLine(" <property name=\"AutoDocumentConstructors\" value=\"True\" />");
397 ss.WriteLine(" <property name=\"ShowMissingSummaries\" value=\"${build.debug}\" />");
398 ss.WriteLine(" <property name=\"ShowMissingRemarks\" value=\"${build.debug}\" />");
399 ss.WriteLine(" <property name=\"ShowMissingParams\" value=\"${build.debug}\" />");
400 ss.WriteLine(" <property name=\"ShowMissingReturns\" value=\"${build.debug}\" />");
401 ss.WriteLine(" <property name=\"ShowMissingValues\" value=\"${build.debug}\" />");
402 ss.WriteLine(" <property name=\"DocumentInternals\" value=\"False\" />");
403 ss.WriteLine(" <property name=\"DocumentPrivates\" value=\"False\" />");
404 ss.WriteLine(" <property name=\"DocumentProtected\" value=\"True\" />");
405 ss.WriteLine(" <property name=\"DocumentEmptyNamespaces\" value=\"${build.debug}\" />");
406 ss.WriteLine(" <property name=\"IncludeAssemblyVersion\" value=\"True\" />");
407 ss.WriteLine(" </documenter>");
408 ss.WriteLine(" </documenters>");
409 ss.WriteLine(" </ndoc>");
410 }
411 ss.WriteLine(" </target>");
412 ss.WriteLine("</project>");
413 }
414 m_Kernel.CurrentWorkingDirectory.Pop();
415 }
416
417 private void WriteCombine(SolutionNode solution)
418 {
419 m_Kernel.Log.Write("Creating NAnt build files");
420 foreach(ProjectNode project in solution.Projects)
421 {
422 if(m_Kernel.AllowProject(project.FilterGroups))
423 {
424 m_Kernel.Log.Write("...Creating project: {0}", project.Name);
425 WriteProject(solution, project);
426 }
427 }
428
429 m_Kernel.Log.Write("");
430 string combFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "build");
431 StreamWriter ss = new StreamWriter(combFile);
432
433 m_Kernel.CurrentWorkingDirectory.Push();
434 Helper.SetCurrentDir(Path.GetDirectoryName(combFile));
435
436 using(ss)
437 {
438 ss.WriteLine("<?xml version=\"1.0\" ?>");
439 ss.WriteLine("<project name=\"{0}\" default=\"build\">", solution.Name);
440 ss.WriteLine(" <echo message=\"Using '${nant.settings.currentframework}' Framework\"/>");
441 ss.WriteLine();
442
443 //ss.WriteLine(" <property name=\"dist.dir\" value=\"dist\" />");
444 //ss.WriteLine(" <property name=\"source.dir\" value=\"source\" />");
445 ss.WriteLine(" <property name=\"bin.dir\" value=\"bin\" />");
446 ss.WriteLine(" <property name=\"obj.dir\" value=\"obj\" />");
447 ss.WriteLine(" <property name=\"doc.dir\" value=\"doc\" />");
448 ss.WriteLine(" <property name=\"project.main.dir\" value=\"${project::get-base-directory()}\" />");
449
450 foreach(ConfigurationNode conf in solution.Configurations)
451 {
452 // Set the project.config to a non-debug configuration
453 if( conf.Options["DebugInformation"].ToString().ToLower() != "true" )
454 {
455 ss.WriteLine(" <property name=\"project.config\" value=\"{0}\" />", conf.Name);
456 }
457 ss.WriteLine();
458 ss.WriteLine(" <target name=\"{0}\" description=\"\">", conf.Name);
459 ss.WriteLine(" <property name=\"project.config\" value=\"{0}\" />", conf.Name);
460 ss.WriteLine(" <property name=\"build.debug\" value=\"{0}\" />", conf.Options["DebugInformation"].ToString().ToLower());
461 ss.WriteLine(" </target>");
462 ss.WriteLine();
463 }
464
465 ss.WriteLine(" <target name=\"net-1.1\" description=\"Sets framework to .NET 1.1\">");
466 ss.WriteLine(" <property name=\"nant.settings.currentframework\" value=\"net-1.1\" />");
467 ss.WriteLine(" </target>");
468 ss.WriteLine();
469
470 ss.WriteLine(" <target name=\"net-2.0\" description=\"Sets framework to .NET 2.0\">");
471 ss.WriteLine(" <property name=\"nant.settings.currentframework\" value=\"net-2.0\" />");
472 ss.WriteLine(" </target>");
473 ss.WriteLine();
474
475 ss.WriteLine(" <target name=\"mono-2.0\" description=\"Sets framework to mono 2.0\">");
476 ss.WriteLine(" <property name=\"nant.settings.currentframework\" value=\"mono-2.0\" />");
477 ss.WriteLine(" </target>");
478 ss.WriteLine();
479
480 ss.WriteLine(" <target name=\"mono-1.0\" description=\"Sets framework to mono 1.0\">");
481 ss.WriteLine(" <property name=\"nant.settings.currentframework\" value=\"mono-1.0\" />");
482 ss.WriteLine(" </target>");
483 ss.WriteLine();
484
485 ss.WriteLine(" <target name=\"init\" description=\"\">");
486 ss.WriteLine(" <call target=\"${project.config}\" />");
487 ss.WriteLine(" <sysinfo />");
488 ss.WriteLine(" <echo message=\"Platform ${sys.os.platform}\" />");
489 ss.WriteLine(" <property name=\"build.dir\" value=\"${bin.dir}/${project.config}\" />");
490 ss.WriteLine(" </target>");
491 ss.WriteLine();
492
493 ss.WriteLine(" <target name=\"clean\" description=\"\">");
494 ss.WriteLine(" <echo message=\"Deleting all builds from all configurations\" />");
495 //ss.WriteLine(" <delete dir=\"${dist.dir}\" failonerror=\"false\" />");
496 ss.WriteLine(" <delete dir=\"${bin.dir}\" failonerror=\"false\" />");
497 ss.WriteLine(" <delete dir=\"${obj.dir}\" failonerror=\"false\" />");
498 foreach(ProjectNode project in solution.Projects)
499 {
500 string path = Helper.MakePathRelativeTo(solution.FullPath, project.FullPath);
501 ss.Write(" <nant buildfile=\"{0}\"",
502 Helper.NormalizePath(Helper.MakeFilePath(path, project.Name + (project.Type == ProjectType.Library ? ".dll" : ".exe"), "build"),'/'));
503 ss.WriteLine(" target=\"clean\" />");
504 }
505 ss.WriteLine(" </target>");
506 ss.WriteLine();
507
508 ss.WriteLine(" <target name=\"build\" depends=\"init\" description=\"\">");
509
510 foreach(ProjectNode project in solution.ProjectsTableOrder)
511 {
512 string path = Helper.MakePathRelativeTo(solution.FullPath, project.FullPath);
513 ss.Write(" <nant buildfile=\"{0}\"",
514 Helper.NormalizePath(Helper.MakeFilePath(path, project.Name + (project.Type == ProjectType.Library ? ".dll" : ".exe"), "build"),'/'));
515 ss.WriteLine(" target=\"build\" />");
516 }
517 ss.WriteLine(" </target>");
518 ss.WriteLine();
519
520 ss.WriteLine(" <target name=\"build-release\" depends=\"Release, init, build\" description=\"Builds in Release mode\" />");
521 ss.WriteLine();
522 ss.WriteLine(" <target name=\"build-debug\" depends=\"Debug, init, build\" description=\"Builds in Debug mode\" />");
523 ss.WriteLine();
524 //ss.WriteLine(" <target name=\"package\" depends=\"clean, doc, copyfiles, zip\" description=\"Builds in Release mode\" />");
525 ss.WriteLine(" <target name=\"package\" depends=\"clean, doc\" description=\"Builds all\" />");
526 ss.WriteLine();
527
528 ss.WriteLine(" <target name=\"doc\" depends=\"build-release\">");
529 ss.WriteLine(" <echo message=\"Generating all documentation from all builds\" />");
530 foreach (ProjectNode project in solution.Projects)
531 {
532 string path = Helper.MakePathRelativeTo(solution.FullPath, project.FullPath);
533 ss.Write(" <nant buildfile=\"{0}\"",
534 Helper.NormalizePath(Helper.MakeFilePath(path, project.Name + (project.Type == ProjectType.Library ? ".dll" : ".exe"), "build"), '/'));
535 ss.WriteLine(" target=\"doc\" />");
536 }
537 ss.WriteLine(" </target>");
538 ss.WriteLine();
539 ss.WriteLine("</project>");
540 }
541
542 m_Kernel.CurrentWorkingDirectory.Pop();
543 }
544
545 private void CleanProject(ProjectNode project)
546 {
547 m_Kernel.Log.Write("...Cleaning project: {0}", project.Name);
548 string projectFile = Helper.MakeFilePath(project.FullPath, project.Name + (project.Type == ProjectType.Library ? ".dll" : ".exe"), "build");
549 Helper.DeleteIfExists(projectFile);
550 }
551
552 private void CleanSolution(SolutionNode solution)
553 {
554 m_Kernel.Log.Write("Cleaning NAnt build files for", solution.Name);
555
556 string slnFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "build");
557 Helper.DeleteIfExists(slnFile);
558
559 foreach(ProjectNode project in solution.Projects)
560 {
561 CleanProject(project);
562 }
563
564 m_Kernel.Log.Write("");
565 }
566
567 #endregion
568
569 #region ITarget Members
570
571 /// <summary>
572 /// Writes the specified kern.
573 /// </summary>
574 /// <param name="kern">The kern.</param>
575 public void Write(Kernel kern)
576 {
577 if( kern == null )
578 {
579 throw new ArgumentNullException("kern");
580 }
581 m_Kernel = kern;
582 foreach(SolutionNode solution in kern.Solutions)
583 {
584 WriteCombine(solution);
585 }
586 m_Kernel = null;
587 }
588
589 /// <summary>
590 /// Cleans the specified kern.
591 /// </summary>
592 /// <param name="kern">The kern.</param>
593 public virtual void Clean(Kernel kern)
594 {
595 if( kern == null )
596 {
597 throw new ArgumentNullException("kern");
598 }
599 m_Kernel = kern;
600 foreach(SolutionNode sol in kern.Solutions)
601 {
602 CleanSolution(sol);
603 }
604 m_Kernel = null;
605 }
606
607 /// <summary>
608 /// Gets the name.
609 /// </summary>
610 /// <value>The name.</value>
611 public string Name
612 {
613 get
614 {
615 return "nant";
616 }
617 }
618
619 #endregion
620 }
621}
diff --git a/Prebuild/src/Core/Targets/SharpDevelop2Target.cs b/Prebuild/src/Core/Targets/SharpDevelop2Target.cs
new file mode 100644
index 0000000..bc84b96
--- /dev/null
+++ b/Prebuild/src/Core/Targets/SharpDevelop2Target.cs
@@ -0,0 +1,90 @@
1#region BSD License
2/*
3Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com)
4
5Redistribution and use in source and binary forms, with or without modification, are permitted
6provided that the following conditions are met:
7
8* Redistributions of source code must retain the above copyright notice, this list of conditions
9 and the following disclaimer.
10* Redistributions in binary form must reproduce the above copyright notice, this list of conditions
11 and the following disclaimer in the documentation and/or other materials provided with the
12 distribution.
13* The name of the author may not be used to endorse or promote products derived from this software
14 without specific prior written permission.
15
16THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
17BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
19EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
21OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
22IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23*/
24#endregion
25
26#region CVS Information
27/*
28 * $Source$
29 * $Author: jendave $
30 * $Date: 2006-01-27 16:49:58 -0800 (Fri, 27 Jan 2006) $
31 * $Revision: 71 $
32 */
33#endregion
34
35using System;
36
37using Prebuild.Core.Attributes;
38
39namespace Prebuild.Core.Targets
40{
41 /// <summary>
42 ///
43 /// </summary>
44 [Target("sharpdev2")]
45 public class SharpDevelop2Target : VS2005Target
46 {
47 #region Private Methods
48 private void SetSharpDevelop2()
49 {
50 this.VersionName = "SharpDevelop2";
51 }
52 #endregion
53
54 #region Public Methods
55
56 /// <summary>
57 /// Writes the specified kern.
58 /// </summary>
59 /// <param name="kern">The kern.</param>
60 public override void Write(Kernel kern)
61 {
62 SetSharpDevelop2();
63 base.Write(kern);
64 }
65
66 /// <summary>
67 /// Cleans the specified kern.
68 /// </summary>
69 /// <param name="kern">The kern.</param>
70 public override void Clean(Kernel kern)
71 {
72 SetSharpDevelop2();
73 base.Clean(kern);
74 }
75
76 /// <summary>
77 /// Gets the name.
78 /// </summary>
79 /// <value>The name.</value>
80 public override string Name
81 {
82 get
83 {
84 return "sharpdev2";
85 }
86 }
87
88 #endregion
89 }
90}
diff --git a/Prebuild/src/Core/Targets/SharpDevelopTarget.cs b/Prebuild/src/Core/Targets/SharpDevelopTarget.cs
new file mode 100644
index 0000000..c725730
--- /dev/null
+++ b/Prebuild/src/Core/Targets/SharpDevelopTarget.cs
@@ -0,0 +1,437 @@
1#region BSD License
2/*
3Copyright (c) 2004 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com)
4
5Redistribution and use in source and binary forms, with or without modification, are permitted
6provided that the following conditions are met:
7
8* Redistributions of source code must retain the above copyright notice, this list of conditions
9 and the following disclaimer.
10* Redistributions in binary form must reproduce the above copyright notice, this list of conditions
11 and the following disclaimer in the documentation and/or other materials provided with the
12 distribution.
13* The name of the author may not be used to endorse or promote products derived from this software
14 without specific prior written permission.
15
16THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
17BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
19EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
21OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
22IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23*/
24#endregion
25
26#region CVS Information
27/*
28 * $Source$
29 * $Author: jendave $
30 * $Date: 2007-02-13 21:58:03 +0100 (ti, 13 feb 2007) $
31 * $Revision: 205 $
32 */
33#endregion
34
35using System;
36using System.Collections;
37using System.Collections.Specialized;
38using System.IO;
39using System.Text.RegularExpressions;
40using System.Reflection;
41
42using Prebuild.Core.Attributes;
43using Prebuild.Core.Interfaces;
44using Prebuild.Core.Nodes;
45using Prebuild.Core.Utilities;
46
47namespace Prebuild.Core.Targets
48{
49 /// <summary>
50 ///
51 /// </summary>
52 [Target("sharpdev")]
53 public class SharpDevelopTarget : ITarget
54 {
55 #region Fields
56
57 private Kernel m_Kernel;
58
59 #endregion
60
61 #region Private Methods
62
63 private static string PrependPath(string path)
64 {
65 string tmpPath = Helper.NormalizePath(path, '/');
66 Regex regex = new Regex(@"(\w):/(\w+)");
67 Match match = regex.Match(tmpPath);
68 if(match.Success || tmpPath[0] == '.' || tmpPath[0] == '/')
69 {
70 tmpPath = Helper.NormalizePath(tmpPath);
71 }
72 else
73 {
74 tmpPath = Helper.NormalizePath("./" + tmpPath);
75 }
76
77 return tmpPath;
78 }
79
80 private static string BuildReference(SolutionNode solution, ReferenceNode refr)
81 {
82 string ret = "<Reference type=\"";
83 if(solution.ProjectsTable.ContainsKey(refr.Name))
84 {
85 ret += "Project\" refto=\"" + refr.Name;
86 ret += "\" localcopy=\"" + refr.LocalCopy.ToString() + "\" />";
87 }
88 else
89 {
90 ProjectNode project = (ProjectNode)refr.Parent;
91 string fileRef = FindFileReference(refr.Name, project);
92
93 if(refr.Path != null || fileRef != null)
94 {
95 ret += "Assembly\" refto=\"";
96
97 string finalPath = (refr.Path != null) ? Helper.MakeFilePath(refr.Path, refr.Name, "dll") : fileRef;
98
99 ret += finalPath;
100 ret += "\" localcopy=\"" + refr.LocalCopy.ToString() + "\" />";
101 return ret;
102 }
103
104 ret += "Gac\" refto=\"";
105 try
106 {
107 //Assembly assem = Assembly.Load(refr.Name);
108 ret += refr.Name;// assem.FullName;
109 }
110 catch (System.NullReferenceException e)
111 {
112 e.ToString();
113 ret += refr.Name;
114 }
115 ret += "\" localcopy=\"" + refr.LocalCopy.ToString() + "\" />";
116 }
117
118 return ret;
119 }
120
121 private static string FindFileReference(string refName, ProjectNode project)
122 {
123 foreach(ReferencePathNode refPath in project.ReferencePaths)
124 {
125 string fullPath = Helper.MakeFilePath(refPath.Path, refName, "dll");
126
127 if(File.Exists(fullPath))
128 {
129 return fullPath;
130 }
131 }
132
133 return null;
134 }
135
136 /// <summary>
137 /// Gets the XML doc file.
138 /// </summary>
139 /// <param name="project">The project.</param>
140 /// <param name="conf">The conf.</param>
141 /// <returns></returns>
142 public static string GenerateXmlDocFile(ProjectNode project, ConfigurationNode conf)
143 {
144 if( conf == null )
145 {
146 throw new ArgumentNullException("conf");
147 }
148 if( project == null )
149 {
150 throw new ArgumentNullException("project");
151 }
152 string docFile = (string)conf.Options["XmlDocFile"];
153 if(docFile != null && docFile.Length == 0)//default to assembly name if not specified
154 {
155 return "False";
156 }
157 return "True";
158 }
159
160 private void WriteProject(SolutionNode solution, ProjectNode project)
161 {
162 string csComp = "Csc";
163 string netRuntime = "MsNet";
164 if(project.Runtime == ClrRuntime.Mono)
165 {
166 csComp = "Mcs";
167 netRuntime = "Mono";
168 }
169
170 string projFile = Helper.MakeFilePath(project.FullPath, project.Name, "prjx");
171 StreamWriter ss = new StreamWriter(projFile);
172
173 m_Kernel.CurrentWorkingDirectory.Push();
174 Helper.SetCurrentDir(Path.GetDirectoryName(projFile));
175
176 using(ss)
177 {
178 ss.WriteLine(
179 "<Project name=\"{0}\" standardNamespace=\"{1}\" description=\"\" newfilesearch=\"None\" enableviewstate=\"True\" version=\"1.1\" projecttype=\"C#\">",
180 project.Name,
181 project.RootNamespace
182 );
183
184 ss.WriteLine(" <Contents>");
185 foreach(string file in project.Files)
186 {
187 string buildAction = "Compile";
188 switch(project.Files.GetBuildAction(file))
189 {
190 case BuildAction.None:
191 buildAction = "Nothing";
192 break;
193
194 case BuildAction.Content:
195 buildAction = "Exclude";
196 break;
197
198 case BuildAction.EmbeddedResource:
199 buildAction = "EmbedAsResource";
200 break;
201
202 default:
203 buildAction = "Compile";
204 break;
205 }
206
207 // Sort of a hack, we try and resolve the path and make it relative, if we can.
208 string filePath = PrependPath(file);
209 ss.WriteLine(" <File name=\"{0}\" subtype=\"Code\" buildaction=\"{1}\" dependson=\"\" data=\"\" />", filePath, buildAction);
210 }
211 ss.WriteLine(" </Contents>");
212
213 ss.WriteLine(" <References>");
214 foreach(ReferenceNode refr in project.References)
215 {
216 ss.WriteLine(" {0}", BuildReference(solution, refr));
217 }
218 ss.WriteLine(" </References>");
219
220 ss.Write(" <DeploymentInformation");
221 ss.Write(" target=\"\"");
222 ss.Write(" script=\"\"");
223 ss.Write(" strategy=\"File\"");
224 ss.WriteLine(" />");
225
226 int count = 0;
227
228 ss.WriteLine(" <Configurations active=\"{0}\">", solution.ActiveConfig);
229
230 foreach(ConfigurationNode conf in project.Configurations)
231 {
232 ss.Write(" <Configuration");
233 ss.Write(" runwithwarnings=\"True\"");
234 ss.Write(" name=\"{0}\"", conf.Name);
235 ss.WriteLine(">");
236 ss.Write(" <CodeGeneration");
237 ss.Write(" runtime=\"{0}\"", netRuntime);
238 ss.Write(" compiler=\"{0}\"", csComp);
239 ss.Write(" compilerversion=\"\"");
240 ss.Write(" warninglevel=\"{0}\"", conf.Options["WarningLevel"]);
241 ss.Write(" nowarn=\"{0}\"", conf.Options["SuppressWarnings"]);
242 ss.Write(" includedebuginformation=\"{0}\"", conf.Options["DebugInformation"]);
243 ss.Write(" optimize=\"{0}\"", conf.Options["OptimizeCode"]);
244 ss.Write(" unsafecodeallowed=\"{0}\"", conf.Options["AllowUnsafe"]);
245 ss.Write(" generateoverflowchecks=\"{0}\"", conf.Options["CheckUnderflowOverflow"]);
246 ss.Write(" mainclass=\"{0}\"", project.StartupObject);
247 ss.Write(" target=\"{0}\"", project.Type);
248 ss.Write(" definesymbols=\"{0}\"", conf.Options["CompilerDefines"]);
249 ss.Write(" generatexmldocumentation=\"{0}\"", GenerateXmlDocFile(project, conf));
250 ss.Write(" win32Icon=\"{0}\"", Helper.NormalizePath(".\\" + project.AppIcon));
251 ss.Write(" noconfig=\"{0}\"", "False");
252 ss.Write(" nostdlib=\"{0}\"", conf.Options["NoStdLib"]);
253 ss.WriteLine(" />");
254
255 ss.Write(" <Execution");
256 ss.Write(" commandlineparameters=\"\"");
257 ss.Write(" consolepause=\"True\"");
258 ss.WriteLine(" />");
259
260 ss.Write(" <Output");
261 ss.Write(" directory=\".\\{0}\"", Helper.NormalizePath(conf.Options["OutputPath"].ToString()));
262 ss.Write(" assembly=\"{0}\"", project.AssemblyName);
263 ss.Write(" executeScript=\"{0}\"", conf.Options["RunScript"]);
264 if (conf.Options["PreBuildEvent"] != null && conf.Options["PreBuildEvent"].ToString().Length != 0)
265 {
266 ss.Write(" executeBeforeBuild=\"{0}\"", Helper.NormalizePath(conf.Options["PreBuildEvent"].ToString()));
267 }
268 else
269 {
270 ss.Write(" executeBeforeBuild=\"{0}\"", conf.Options["PreBuildEvent"]);
271 }
272 if (conf.Options["PostBuildEvent"] != null && conf.Options["PostBuildEvent"].ToString().Length != 0)
273 {
274 ss.Write(" executeAfterBuild=\"{0}\"", Helper.NormalizePath(conf.Options["PostBuildEvent"].ToString()));
275 }
276 else
277 {
278 ss.Write(" executeAfterBuild=\"{0}\"", conf.Options["PostBuildEvent"]);
279 }
280 ss.Write(" executeBeforeBuildArguments=\"{0}\"", conf.Options["PreBuildEventArgs"]);
281 ss.Write(" executeAfterBuildArguments=\"{0}\"", conf.Options["PreBuildEventArgs"]);
282 ss.WriteLine(" />");
283 ss.WriteLine(" </Configuration>");
284
285 count++;
286 }
287 ss.WriteLine(" </Configurations>");
288 ss.WriteLine("</Project>");
289 }
290
291 m_Kernel.CurrentWorkingDirectory.Pop();
292 }
293
294 private void WriteCombine(SolutionNode solution)
295 {
296 m_Kernel.Log.Write("Creating SharpDevelop combine and project files");
297 foreach(ProjectNode project in solution.Projects)
298 {
299 if(m_Kernel.AllowProject(project.FilterGroups))
300 {
301 m_Kernel.Log.Write("...Creating project: {0}", project.Name);
302 WriteProject(solution, project);
303 }
304 }
305
306 m_Kernel.Log.Write("");
307 string combFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "cmbx");
308 StreamWriter ss = new StreamWriter(combFile);
309
310 m_Kernel.CurrentWorkingDirectory.Push();
311 Helper.SetCurrentDir(Path.GetDirectoryName(combFile));
312
313 using(ss)
314 {
315 ss.WriteLine("<Combine fileversion=\"1.0\" name=\"{0}\" description=\"\">", solution.Name);
316
317 int count = 0;
318 foreach(ProjectNode project in solution.Projects)
319 {
320 if(count == 0)
321 ss.WriteLine(" <StartMode startupentry=\"{0}\" single=\"True\">", project.Name);
322
323 ss.WriteLine(" <Execute entry=\"{0}\" type=\"None\" />", project.Name);
324 count++;
325 }
326 ss.WriteLine(" </StartMode>");
327
328 ss.WriteLine(" <Entries>");
329 foreach(ProjectNode project in solution.Projects)
330 {
331 string path = Helper.MakePathRelativeTo(solution.FullPath, project.FullPath);
332 ss.WriteLine(" <Entry filename=\"{0}\" />",
333 Helper.MakeFilePath(path, project.Name, "prjx"));
334 }
335 ss.WriteLine(" </Entries>");
336
337 count = 0;
338 foreach(ConfigurationNode conf in solution.Configurations)
339 {
340 if(count == 0)
341 {
342 ss.WriteLine(" <Configurations active=\"{0}\">", conf.Name);
343 }
344
345 ss.WriteLine(" <Configuration name=\"{0}\">", conf.Name);
346 foreach(ProjectNode project in solution.Projects)
347 {
348 ss.WriteLine(" <Entry name=\"{0}\" configurationname=\"{1}\" build=\"True\" />", project.Name, conf.Name);
349 }
350 ss.WriteLine(" </Configuration>");
351
352 count++;
353 }
354 ss.WriteLine(" </Configurations>");
355 ss.WriteLine("</Combine>");
356 }
357
358 m_Kernel.CurrentWorkingDirectory.Pop();
359 }
360
361 private void CleanProject(ProjectNode project)
362 {
363 m_Kernel.Log.Write("...Cleaning project: {0}", project.Name);
364 string projectFile = Helper.MakeFilePath(project.FullPath, project.Name, "prjx");
365 Helper.DeleteIfExists(projectFile);
366 }
367
368 private void CleanSolution(SolutionNode solution)
369 {
370 m_Kernel.Log.Write("Cleaning SharpDevelop combine and project files for", solution.Name);
371
372 string slnFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "cmbx");
373 Helper.DeleteIfExists(slnFile);
374
375 foreach(ProjectNode project in solution.Projects)
376 {
377 CleanProject(project);
378 }
379
380 m_Kernel.Log.Write("");
381 }
382
383 #endregion
384
385 #region ITarget Members
386
387 /// <summary>
388 /// Writes the specified kern.
389 /// </summary>
390 /// <param name="kern">The kern.</param>
391 public void Write(Kernel kern)
392 {
393 if( kern == null )
394 {
395 throw new ArgumentNullException("kern");
396 }
397 m_Kernel = kern;
398 foreach(SolutionNode solution in kern.Solutions)
399 {
400 WriteCombine(solution);
401 }
402 m_Kernel = null;
403 }
404
405 /// <summary>
406 /// Cleans the specified kern.
407 /// </summary>
408 /// <param name="kern">The kern.</param>
409 public virtual void Clean(Kernel kern)
410 {
411 if( kern == null )
412 {
413 throw new ArgumentNullException("kern");
414 }
415 m_Kernel = kern;
416 foreach(SolutionNode sol in kern.Solutions)
417 {
418 CleanSolution(sol);
419 }
420 m_Kernel = null;
421 }
422
423 /// <summary>
424 /// Gets the name.
425 /// </summary>
426 /// <value>The name.</value>
427 public string Name
428 {
429 get
430 {
431 return "sharpdev";
432 }
433 }
434
435 #endregion
436 }
437}
diff --git a/Prebuild/src/Core/Targets/VS2002Target.cs b/Prebuild/src/Core/Targets/VS2002Target.cs
new file mode 100644
index 0000000..66216dc
--- /dev/null
+++ b/Prebuild/src/Core/Targets/VS2002Target.cs
@@ -0,0 +1,96 @@
1#region BSD License
2/*
3Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com)
4
5Redistribution and use in source and binary forms, with or without modification, are permitted
6provided that the following conditions are met:
7
8* Redistributions of source code must retain the above copyright notice, this list of conditions
9 and the following disclaimer.
10* Redistributions in binary form must reproduce the above copyright notice, this list of conditions
11 and the following disclaimer in the documentation and/or other materials provided with the
12 distribution.
13* The name of the author may not be used to endorse or promote products derived from this software
14 without specific prior written permission.
15
16THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
17BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
19EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
21OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
22IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23*/
24#endregion
25
26#region CVS Information
27/*
28 * $Source$
29 * $Author: jendave $
30 * $Date: 2006-01-28 01:49:58 +0100 (lö, 28 jan 2006) $
31 * $Revision: 71 $
32 */
33#endregion
34
35using System;
36
37using Prebuild.Core.Attributes;
38
39namespace Prebuild.Core.Targets
40{
41 /// <summary>
42 ///
43 /// </summary>
44 [Target("vs2002")]
45 public class VS2002Target : VS2003Target
46 {
47 #region Private Methods
48
49 private void SetVS2002()
50 {
51 this.SolutionVersion = "7.00";
52 this.ProductVersion = "7.0.9254";
53 this.SchemaVersion = "1.0";
54 this.VersionName = "2002";
55 this.Version = VSVersion.VS70;
56 }
57
58 #endregion
59
60 #region Public Methods
61
62 /// <summary>
63 /// Writes the specified kern.
64 /// </summary>
65 /// <param name="kern">The kern.</param>
66 public override void Write(Kernel kern)
67 {
68 SetVS2002();
69 base.Write(kern);
70 }
71
72 /// <summary>
73 /// Cleans the specified kern.
74 /// </summary>
75 /// <param name="kern">The kern.</param>
76 public override void Clean(Kernel kern)
77 {
78 SetVS2002();
79 base.Clean(kern);
80 }
81
82 /// <summary>
83 /// Gets the name.
84 /// </summary>
85 /// <value>The name.</value>
86 public override string Name
87 {
88 get
89 {
90 return "vs2002";
91 }
92 }
93
94 #endregion
95 }
96}
diff --git a/Prebuild/src/Core/Targets/VS2003Target.cs b/Prebuild/src/Core/Targets/VS2003Target.cs
new file mode 100644
index 0000000..b3236a8
--- /dev/null
+++ b/Prebuild/src/Core/Targets/VS2003Target.cs
@@ -0,0 +1,633 @@
1#region BSD License
2/*
3Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com)
4
5Redistribution and use in source and binary forms, with or without modification, are permitted
6provided that the following conditions are met:
7
8* Redistributions of source code must retain the above copyright notice, this list of conditions
9 and the following disclaimer.
10* Redistributions in binary form must reproduce the above copyright notice, this list of conditions
11 and the following disclaimer in the documentation and/or other materials provided with the
12 distribution.
13* The name of the author may not be used to endorse or promote products derived from this software
14 without specific prior written permission.
15
16THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
17BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
19EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
21OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
22IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23*/
24#endregion
25
26#region CVS Information
27/*
28 * $Source$
29 * $Author: jendave $
30 * $Date: 2006-09-29 21:11:40 +0200 (fr, 29 sep 2006) $
31 * $Revision: 177 $
32 */
33#endregion
34
35using System;
36using System.Collections;
37using System.Collections.Specialized;
38using System.IO;
39
40using Prebuild.Core.Attributes;
41using Prebuild.Core.Interfaces;
42using Prebuild.Core.Nodes;
43using Prebuild.Core.Utilities;
44
45namespace Prebuild.Core.Targets
46{
47 /// <summary>
48 ///
49 /// </summary>
50 public enum VSVersion
51 {
52 /// <summary>
53 ///
54 /// </summary>
55 VS70,
56 /// <summary>
57 ///
58 /// </summary>
59 VS71,
60 /// <summary>
61 ///
62 /// </summary>
63 VS80
64 }
65
66 /// <summary>
67 ///
68 /// </summary>
69 [Target("vs2003")]
70 public class VS2003Target : ITarget
71 {
72
73 #region Fields
74
75 string solutionVersion = "8.00";
76 string productVersion = "7.10.3077";
77 string schemaVersion = "2.0";
78 string versionName = "2003";
79 VSVersion version = VSVersion.VS71;
80
81 Hashtable m_Tools;
82 Kernel m_Kernel;
83
84 /// <summary>
85 /// Gets or sets the solution version.
86 /// </summary>
87 /// <value>The solution version.</value>
88 protected string SolutionVersion
89 {
90 get
91 {
92 return this.solutionVersion;
93 }
94 set
95 {
96 this.solutionVersion = value;
97 }
98 }
99 /// <summary>
100 /// Gets or sets the product version.
101 /// </summary>
102 /// <value>The product version.</value>
103 protected string ProductVersion
104 {
105 get
106 {
107 return this.productVersion;
108 }
109 set
110 {
111 this.productVersion = value;
112 }
113 }
114 /// <summary>
115 /// Gets or sets the schema version.
116 /// </summary>
117 /// <value>The schema version.</value>
118 protected string SchemaVersion
119 {
120 get
121 {
122 return this.schemaVersion;
123 }
124 set
125 {
126 this.schemaVersion = value;
127 }
128 }
129 /// <summary>
130 /// Gets or sets the name of the version.
131 /// </summary>
132 /// <value>The name of the version.</value>
133 protected string VersionName
134 {
135 get
136 {
137 return this.versionName;
138 }
139 set
140 {
141 this.versionName = value;
142 }
143 }
144 /// <summary>
145 /// Gets or sets the version.
146 /// </summary>
147 /// <value>The version.</value>
148 protected VSVersion Version
149 {
150 get
151 {
152 return this.version;
153 }
154 set
155 {
156 this.version = value;
157 }
158 }
159
160 #endregion
161
162 #region Constructors
163
164 /// <summary>
165 /// Initializes a new instance of the <see cref="VS2003Target"/> class.
166 /// </summary>
167 public VS2003Target()
168 {
169 m_Tools = new Hashtable();
170
171 m_Tools["C#"] = new ToolInfo("C#", "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}", "csproj", "CSHARP");
172 m_Tools["VB.NET"] = new ToolInfo("VB.NET", "{F184B08F-C81C-45F6-A57F-5ABD9991F28F}", "vbproj", "VisualBasic");
173 }
174
175 #endregion
176
177 #region Private Methods
178
179 private string MakeRefPath(ProjectNode project)
180 {
181 string ret = "";
182 foreach(ReferencePathNode node in project.ReferencePaths)
183 {
184 try
185 {
186 string fullPath = Helper.ResolvePath(node.Path);
187 if(ret.Length < 1)
188 {
189 ret = fullPath;
190 }
191 else
192 {
193 ret += ";" + fullPath;
194 }
195 }
196 catch(ArgumentException)
197 {
198 m_Kernel.Log.Write(LogType.Warning, "Could not resolve reference path: {0}", node.Path);
199 }
200 }
201
202 return ret;
203 }
204
205 private void WriteProject(SolutionNode solution, ProjectNode project)
206 {
207 if(!m_Tools.ContainsKey(project.Language))
208 {
209 throw new UnknownLanguageException("Unknown .NET language: " + project.Language);
210 }
211
212 ToolInfo toolInfo = (ToolInfo)m_Tools[project.Language];
213 string projectFile = Helper.MakeFilePath(project.FullPath, project.Name, toolInfo.FileExtension);
214 StreamWriter ps = new StreamWriter(projectFile);
215
216 m_Kernel.CurrentWorkingDirectory.Push();
217 Helper.SetCurrentDir(Path.GetDirectoryName(projectFile));
218
219 IEnumerator enumerator;
220 //ConfigurationNode scripts;
221
222 using(ps)
223 {
224 ps.WriteLine("<VisualStudioProject>");
225 ps.WriteLine(" <{0}", toolInfo.XmlTag);
226 ps.WriteLine("\t\t\t\tProjectType = \"Local\"");
227 ps.WriteLine("\t\t\t\tProductVersion = \"{0}\"", this.ProductVersion);
228 ps.WriteLine("\t\t\t\tSchemaVersion = \"{0}\"", this.SchemaVersion);
229 ps.WriteLine("\t\t\t\tProjectGuid = \"{{{0}}}\"", project.Guid.ToString().ToUpper());
230 ps.WriteLine("\t\t>");
231
232 ps.WriteLine("\t\t\t\t<Build>");
233 ps.WriteLine(" <Settings");
234 ps.WriteLine("\t\t\t\t ApplicationIcon = \"{0}\"",project.AppIcon);
235 ps.WriteLine("\t\t\t\t AssemblyKeyContainerName = \"\"");
236 ps.WriteLine("\t\t\t\t AssemblyName = \"{0}\"", project.AssemblyName);
237 ps.WriteLine("\t\t\t\t AssemblyOriginatorKeyFile = \"\"");
238 ps.WriteLine("\t\t\t\t DefaultClientScript = \"JScript\"");
239 ps.WriteLine("\t\t\t\t DefaultHTMLPageLayout = \"Grid\"");
240 ps.WriteLine("\t\t\t\t DefaultTargetSchema = \"IE50\"");
241 ps.WriteLine("\t\t\t\t DelaySign = \"false\"");
242
243 if(this.Version == VSVersion.VS70)
244 {
245 ps.WriteLine("\t\t\t\t NoStandardLibraries = \"false\"");
246 }
247
248 ps.WriteLine("\t\t\t\t OutputType = \"{0}\"", project.Type.ToString());
249
250 enumerator = project.Configurations.GetEnumerator();
251 enumerator.Reset();
252 enumerator.MoveNext();
253 foreach(ConfigurationNode conf in project.Configurations)
254 {
255 if (conf.Options["PreBuildEvent"] != null && conf.Options["PreBuildEvent"].ToString().Length != 0)
256 {
257 ps.WriteLine("\t\t\t\t PreBuildEvent = \"{0}\"", Helper.NormalizePath(conf.Options["PreBuildEvent"].ToString()));
258 }
259 else
260 {
261 ps.WriteLine("\t\t\t\t PreBuildEvent = \"{0}\"", conf.Options["PreBuildEvent"]);
262 }
263 if (conf.Options["PostBuildEvent"] != null && conf.Options["PostBuildEvent"].ToString().Length != 0)
264 {
265 ps.WriteLine("\t\t\t\t PostBuildEvent = \"{0}\"", Helper.NormalizePath(conf.Options["PostBuildEvent"].ToString()));
266 }
267 else
268 {
269 ps.WriteLine("\t\t\t\t PostBuildEvent = \"{0}\"", conf.Options["PostBuildEvent"]);
270 }
271 if (conf.Options["RunPostBuildEvent"] == null)
272 {
273 ps.WriteLine("\t\t\t\t RunPostBuildEvent = \"{0}\"", "OnBuildSuccess");
274 }
275 else
276 {
277 ps.WriteLine("\t\t\t\t RunPostBuildEvent = \"{0}\"", conf.Options["RunPostBuildEvent"]);
278 }
279 break;
280 }
281
282 ps.WriteLine("\t\t\t\t RootNamespace = \"{0}\"", project.RootNamespace);
283 ps.WriteLine("\t\t\t\t StartupObject = \"{0}\"", project.StartupObject);
284 ps.WriteLine("\t\t >");
285
286 foreach(ConfigurationNode conf in project.Configurations)
287 {
288 ps.WriteLine("\t\t\t\t <Config");
289 ps.WriteLine("\t\t\t\t Name = \"{0}\"", conf.Name);
290 ps.WriteLine("\t\t\t\t AllowUnsafeBlocks = \"{0}\"", conf.Options["AllowUnsafe"].ToString().ToLower());
291 ps.WriteLine("\t\t\t\t BaseAddress = \"{0}\"", conf.Options["BaseAddress"]);
292 ps.WriteLine("\t\t\t\t CheckForOverflowUnderflow = \"{0}\"", conf.Options["CheckUnderflowOverflow"].ToString().ToLower());
293 ps.WriteLine("\t\t\t\t ConfigurationOverrideFile = \"\"");
294 ps.WriteLine("\t\t\t\t DefineConstants = \"{0}\"", conf.Options["CompilerDefines"]);
295 ps.WriteLine("\t\t\t\t DocumentationFile = \"{0}\"", GetXmlDocFile(project, conf));//default to the assembly name
296 ps.WriteLine("\t\t\t\t DebugSymbols = \"{0}\"", conf.Options["DebugInformation"].ToString().ToLower());
297 ps.WriteLine("\t\t\t\t FileAlignment = \"{0}\"", conf.Options["FileAlignment"]);
298 ps.WriteLine("\t\t\t\t IncrementalBuild = \"{0}\"", conf.Options["IncrementalBuild"].ToString().ToLower());
299
300 if(this.Version == VSVersion.VS71)
301 {
302 ps.WriteLine("\t\t\t\t NoStdLib = \"{0}\"", conf.Options["NoStdLib"].ToString().ToLower());
303 ps.WriteLine("\t\t\t\t NoWarn = \"{0}\"", conf.Options["SuppressWarnings"].ToString().ToLower());
304 }
305
306 ps.WriteLine("\t\t\t\t Optimize = \"{0}\"", conf.Options["OptimizeCode"].ToString().ToLower());
307 ps.WriteLine(" OutputPath = \"{0}\"",
308 Helper.EndPath(Helper.NormalizePath(conf.Options["OutputPath"].ToString())));
309 ps.WriteLine(" RegisterForComInterop = \"{0}\"", conf.Options["RegisterComInterop"].ToString().ToLower());
310 ps.WriteLine(" RemoveIntegerChecks = \"{0}\"", conf.Options["RemoveIntegerChecks"].ToString().ToLower());
311 ps.WriteLine(" TreatWarningsAsErrors = \"{0}\"", conf.Options["WarningsAsErrors"].ToString().ToLower());
312 ps.WriteLine(" WarningLevel = \"{0}\"", conf.Options["WarningLevel"]);
313 ps.WriteLine(" />");
314 }
315
316 ps.WriteLine(" </Settings>");
317
318 ps.WriteLine(" <References>");
319 foreach(ReferenceNode refr in project.References)
320 {
321 ps.WriteLine(" <Reference");
322 ps.WriteLine(" Name = \"{0}\"", refr.Name);
323 ps.WriteLine(" AssemblyName = \"{0}\"", refr.Name);
324
325 if(solution.ProjectsTable.ContainsKey(refr.Name))
326 {
327 ProjectNode refProject = (ProjectNode)solution.ProjectsTable[refr.Name];
328 ps.WriteLine(" Project = \"{{{0}}}\"", refProject.Guid.ToString().ToUpper());
329 ps.WriteLine(" Package = \"{0}\"", toolInfo.Guid.ToString().ToUpper());
330 }
331 else
332 {
333 if(refr.Path != null)
334 {
335 ps.WriteLine(" HintPath = \"{0}\"", Helper.MakeFilePath(refr.Path, refr.Name, "dll"));
336 }
337
338 }
339
340 if(refr.LocalCopySpecified)
341 {
342 ps.WriteLine(" Private = \"{0}\"",refr.LocalCopy);
343 }
344
345 ps.WriteLine(" />");
346 }
347 ps.WriteLine(" </References>");
348
349 ps.WriteLine(" </Build>");
350 ps.WriteLine(" <Files>");
351
352 ps.WriteLine(" <Include>");
353
354 foreach(string file in project.Files)
355 {
356 string fileName = file.Replace(".\\", "");
357 ps.WriteLine(" <File");
358 ps.WriteLine(" RelPath = \"{0}\"", fileName);
359 ps.WriteLine(" SubType = \"{0}\"", project.Files.GetSubType(file));
360 ps.WriteLine(" BuildAction = \"{0}\"", project.Files.GetBuildAction(file));
361 ps.WriteLine(" />");
362
363 if (project.Files.GetSubType(file) != SubType.Code && project.Files.GetSubType(file) != SubType.Settings)
364 {
365 ps.WriteLine(" <File");
366 ps.WriteLine(" RelPath = \"{0}\"", fileName.Substring(0, fileName.LastIndexOf('.')) + ".resx");
367 int slash = fileName.LastIndexOf('\\');
368 if (slash == -1)
369 {
370 ps.WriteLine(" DependentUpon = \"{0}\"", fileName);
371 }
372 else
373 {
374 ps.WriteLine(" DependentUpon = \"{0}\"", fileName.Substring(slash + 1, fileName.Length - slash - 1));
375 }
376 ps.WriteLine(" BuildAction = \"{0}\"", "EmbeddedResource");
377 ps.WriteLine(" />");
378
379 }
380 }
381 ps.WriteLine(" </Include>");
382
383 ps.WriteLine(" </Files>");
384 ps.WriteLine(" </{0}>", toolInfo.XmlTag);
385 ps.WriteLine("</VisualStudioProject>");
386 }
387
388 ps = new StreamWriter(projectFile + ".user");
389 using(ps)
390 {
391 ps.WriteLine("<VisualStudioProject>");
392 ps.WriteLine(" <{0}>", toolInfo.XmlTag);
393 ps.WriteLine(" <Build>");
394
395 ps.WriteLine(" <Settings ReferencePath=\"{0}\">", MakeRefPath(project));
396 foreach(ConfigurationNode conf in project.Configurations)
397 {
398 ps.WriteLine(" <Config");
399 ps.WriteLine(" Name = \"{0}\"", conf.Name);
400 ps.WriteLine(" />");
401 }
402 ps.WriteLine(" </Settings>");
403
404 ps.WriteLine(" </Build>");
405 ps.WriteLine(" </{0}>", toolInfo.XmlTag);
406 ps.WriteLine("</VisualStudioProject>");
407 }
408
409 m_Kernel.CurrentWorkingDirectory.Pop();
410 }
411
412 /// <summary>
413 /// Gets the XML doc file.
414 /// </summary>
415 /// <param name="project">The project.</param>
416 /// <param name="conf">The conf.</param>
417 /// <returns></returns>
418 public static string GetXmlDocFile(ProjectNode project, ConfigurationNode conf)
419 {
420 if( conf == null )
421 {
422 throw new ArgumentNullException("conf");
423 }
424 if( project == null )
425 {
426 throw new ArgumentNullException("project");
427 }
428 // if(!(bool)conf.Options["GenerateXmlDocFile"]) //default to none, if the generate option is false
429 // {
430 // return string.Empty;
431 // }
432
433 //default to "AssemblyName.xml"
434 //string defaultValue = Path.GetFileNameWithoutExtension(project.AssemblyName) + ".xml";
435 //return (string)conf.Options["XmlDocFile", defaultValue];
436
437 //default to no XmlDocFile file
438 return (string)conf.Options["XmlDocFile", ""];
439 }
440
441 private void WriteSolution(SolutionNode solution)
442 {
443 m_Kernel.Log.Write("Creating Visual Studio {0} solution and project files", this.VersionName);
444
445 foreach(ProjectNode project in solution.Projects)
446 {
447 if(m_Kernel.AllowProject(project.FilterGroups))
448 {
449 m_Kernel.Log.Write("...Creating project: {0}", project.Name);
450 WriteProject(solution, project);
451 }
452 }
453
454 m_Kernel.Log.Write("");
455 string solutionFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "sln");
456 StreamWriter ss = new StreamWriter(solutionFile);
457
458 m_Kernel.CurrentWorkingDirectory.Push();
459 Helper.SetCurrentDir(Path.GetDirectoryName(solutionFile));
460
461 using(ss)
462 {
463 ss.WriteLine("Microsoft Visual Studio Solution File, Format Version {0}", this.SolutionVersion);
464 foreach(ProjectNode project in solution.Projects)
465 {
466 if(!m_Tools.ContainsKey(project.Language))
467 {
468 throw new UnknownLanguageException("Unknown .NET language: " + project.Language);
469 }
470
471 ToolInfo toolInfo = (ToolInfo)m_Tools[project.Language];
472
473 string path = Helper.MakePathRelativeTo(solution.FullPath, project.FullPath);
474 ss.WriteLine("Project(\"{0}\") = \"{1}\", \"{2}\", \"{{{3}}}\"",
475 toolInfo.Guid, project.Name, Helper.MakeFilePath(path, project.Name,
476 toolInfo.FileExtension), project.Guid.ToString().ToUpper());
477
478 ss.WriteLine("\tProjectSection(ProjectDependencies) = postProject");
479 ss.WriteLine("\tEndProjectSection");
480
481 ss.WriteLine("EndProject");
482 }
483
484 ss.WriteLine("Global");
485
486 ss.WriteLine("\tGlobalSection(SolutionConfiguration) = preSolution");
487 foreach(ConfigurationNode conf in solution.Configurations)
488 {
489 ss.WriteLine("\t\t{0} = {0}", conf.Name);
490 }
491 ss.WriteLine("\tEndGlobalSection");
492
493 ss.WriteLine("\tGlobalSection(ProjectDependencies) = postSolution");
494 foreach(ProjectNode project in solution.Projects)
495 {
496 for(int i = 0; i < project.References.Count; i++)
497 {
498 ReferenceNode refr = (ReferenceNode)project.References[i];
499 if(solution.ProjectsTable.ContainsKey(refr.Name))
500 {
501 ProjectNode refProject = (ProjectNode)solution.ProjectsTable[refr.Name];
502 ss.WriteLine("\t\t({{{0}}}).{1} = ({{{2}}})",
503 project.Guid.ToString().ToUpper()
504 , i,
505 refProject.Guid.ToString().ToUpper()
506 );
507 }
508 }
509 }
510 ss.WriteLine("\tEndGlobalSection");
511
512 ss.WriteLine("\tGlobalSection(ProjectConfiguration) = postSolution");
513 foreach(ProjectNode project in solution.Projects)
514 {
515 foreach(ConfigurationNode conf in solution.Configurations)
516 {
517 ss.WriteLine("\t\t{{{0}}}.{1}.ActiveCfg = {1}|.NET",
518 project.Guid.ToString().ToUpper(),
519 conf.Name);
520
521 ss.WriteLine("\t\t{{{0}}}.{1}.Build.0 = {1}|.NET",
522 project.Guid.ToString().ToUpper(),
523 conf.Name);
524 }
525 }
526 ss.WriteLine("\tEndGlobalSection");
527
528 if(solution.Files != null)
529 {
530 ss.WriteLine("\tGlobalSection(SolutionItems) = postSolution");
531 foreach(string file in solution.Files)
532 {
533 ss.WriteLine("\t\t{0} = {0}", file);
534 }
535 ss.WriteLine("\tEndGlobalSection");
536 }
537
538 ss.WriteLine("\tGlobalSection(ExtensibilityGlobals) = postSolution");
539 ss.WriteLine("\tEndGlobalSection");
540 ss.WriteLine("\tGlobalSection(ExtensibilityAddIns) = postSolution");
541 ss.WriteLine("\tEndGlobalSection");
542
543 ss.WriteLine("EndGlobal");
544 }
545
546 m_Kernel.CurrentWorkingDirectory.Pop();
547 }
548
549 private void CleanProject(ProjectNode project)
550 {
551 m_Kernel.Log.Write("...Cleaning project: {0}", project.Name);
552
553 ToolInfo toolInfo = (ToolInfo)m_Tools[project.Language];
554 string projectFile = Helper.MakeFilePath(project.FullPath, project.Name, toolInfo.FileExtension);
555 string userFile = projectFile + ".user";
556
557 Helper.DeleteIfExists(projectFile);
558 Helper.DeleteIfExists(userFile);
559 }
560
561 private void CleanSolution(SolutionNode solution)
562 {
563 m_Kernel.Log.Write("Cleaning Visual Studio {0} solution and project files", this.VersionName, solution.Name);
564
565 string slnFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "sln");
566 string suoFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "suo");
567
568 Helper.DeleteIfExists(slnFile);
569 Helper.DeleteIfExists(suoFile);
570
571 foreach(ProjectNode project in solution.Projects)
572 {
573 CleanProject(project);
574 }
575
576 m_Kernel.Log.Write("");
577 }
578
579 #endregion
580
581 #region ITarget Members
582
583 /// <summary>
584 /// Writes the specified kern.
585 /// </summary>
586 /// <param name="kern">The kern.</param>
587 public virtual void Write(Kernel kern)
588 {
589 if( kern == null )
590 {
591 throw new ArgumentNullException("kern");
592 }
593 m_Kernel = kern;
594 foreach(SolutionNode sol in m_Kernel.Solutions)
595 {
596 WriteSolution(sol);
597 }
598 m_Kernel = null;
599 }
600
601 /// <summary>
602 /// Cleans the specified kern.
603 /// </summary>
604 /// <param name="kern">The kern.</param>
605 public virtual void Clean(Kernel kern)
606 {
607 if( kern == null )
608 {
609 throw new ArgumentNullException("kern");
610 }
611 m_Kernel = kern;
612 foreach(SolutionNode sol in m_Kernel.Solutions)
613 {
614 CleanSolution(sol);
615 }
616 m_Kernel = null;
617 }
618
619 /// <summary>
620 /// Gets the name.
621 /// </summary>
622 /// <value>The name.</value>
623 public virtual string Name
624 {
625 get
626 {
627 return "vs2003";
628 }
629 }
630
631 #endregion
632 }
633}
diff --git a/Prebuild/src/Core/Targets/VS2005Target.cs b/Prebuild/src/Core/Targets/VS2005Target.cs
new file mode 100644
index 0000000..3cfc8cd
--- /dev/null
+++ b/Prebuild/src/Core/Targets/VS2005Target.cs
@@ -0,0 +1,869 @@
1#region BSD License
2/*
3Copyright (c) 2004 Matthew Holmes (matthew@wildfiregames.com)
4
5Redistribution and use in source and binary forms, with or without modification, are permitted
6provided that the following conditions are met:
7
8* Redistributions of source code must retain the above copyright notice, this list of conditions
9 and the following disclaimer.
10* Redistributions in binary form must reproduce the above copyright notice, this list of conditions
11 and the following disclaimer in the documentation and/or other materials provided with the
12 distribution.
13* The name of the author may not be used to endorse or promote products derived from this software
14 without specific prior written permission.
15
16THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
17BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
19EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
21OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
22IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23*/
24#endregion
25
26#region CVS Information
27/*
28 * $Source$
29 * $Author: robloach $
30 * $Date: 2007-02-27 19:52:34 +0100 (ti, 27 feb 2007) $
31 * $Revision: 207 $
32 */
33#endregion
34
35using System;
36using System.Collections;
37using System.Collections.Specialized;
38using System.IO;
39
40using Prebuild.Core.Attributes;
41using Prebuild.Core.Interfaces;
42using Prebuild.Core.Nodes;
43using Prebuild.Core.Utilities;
44
45namespace Prebuild.Core.Targets
46{
47 /// <summary>
48 ///
49 /// </summary>
50 public struct ToolInfo
51 {
52 string name;
53 string guid;
54 string fileExtension;
55 string xmlTag;
56 string importProject;
57
58 /// <summary>
59 /// Gets or sets the name.
60 /// </summary>
61 /// <value>The name.</value>
62 public string Name
63 {
64 get
65 {
66 return name;
67 }
68 set
69 {
70 name = value;
71 }
72 }
73
74 /// <summary>
75 /// Gets or sets the GUID.
76 /// </summary>
77 /// <value>The GUID.</value>
78 public string Guid
79 {
80 get
81 {
82 return guid;
83 }
84 set
85 {
86 guid = value;
87 }
88 }
89
90 /// <summary>
91 /// Gets or sets the file extension.
92 /// </summary>
93 /// <value>The file extension.</value>
94 public string FileExtension
95 {
96 get
97 {
98 return fileExtension;
99 }
100 set
101 {
102 fileExtension = value;
103 }
104 }
105 /// <summary>
106 /// Gets or sets the XML tag.
107 /// </summary>
108 /// <value>The XML tag.</value>
109 public string XmlTag
110 {
111 get
112 {
113 return xmlTag;
114 }
115 set
116 {
117 xmlTag = value;
118 }
119 }
120
121 /// <summary>
122 /// Gets or sets the import project property.
123 /// </summary>
124 /// <value>The ImportProject tag.</value>
125 public string ImportProject
126 {
127 get
128 {
129 return importProject;
130 }
131 set
132 {
133 importProject = value;
134 }
135 }
136
137 /// <summary>
138 /// Initializes a new instance of the <see cref="ToolInfo"/> class.
139 /// </summary>
140 /// <param name="name">The name.</param>
141 /// <param name="guid">The GUID.</param>
142 /// <param name="fileExtension">The file extension.</param>
143 /// <param name="xml">The XML.</param>
144 /// <param name="importProject">The import project.</param>
145 public ToolInfo(string name, string guid, string fileExtension, string xml, string importProject)
146 {
147 this.name = name;
148 this.guid = guid;
149 this.fileExtension = fileExtension;
150 this.xmlTag = xml;
151 this.importProject = importProject;
152 }
153
154 /// <summary>
155 /// Initializes a new instance of the <see cref="ToolInfo"/> class.
156 /// </summary>
157 /// <param name="name">The name.</param>
158 /// <param name="guid">The GUID.</param>
159 /// <param name="fileExtension">The file extension.</param>
160 /// <param name="xml">The XML.</param>
161 public ToolInfo(string name, string guid, string fileExtension, string xml)
162 {
163 this.name = name;
164 this.guid = guid;
165 this.fileExtension = fileExtension;
166 this.xmlTag = xml;
167 this.importProject = "$(MSBuildBinPath)\\Microsoft." + xml + ".Targets";
168 }
169
170 /// <summary>
171 /// Equals operator
172 /// </summary>
173 /// <param name="obj">ToolInfo to compare</param>
174 /// <returns>true if toolInfos are equal</returns>
175 public override bool Equals(object obj)
176 {
177 if (obj == null)
178 {
179 throw new ArgumentNullException("obj");
180 }
181 if (obj.GetType() != typeof(ToolInfo))
182 return false;
183
184 ToolInfo c = (ToolInfo)obj;
185 return ((this.name == c.name) && (this.guid == c.guid) && (this.fileExtension == c.fileExtension) && (this.importProject == c.importProject));
186 }
187
188 /// <summary>
189 /// Equals operator
190 /// </summary>
191 /// <param name="c1">ToolInfo to compare</param>
192 /// <param name="c2">ToolInfo to compare</param>
193 /// <returns>True if toolInfos are equal</returns>
194 public static bool operator ==(ToolInfo c1, ToolInfo c2)
195 {
196 return ((c1.name == c2.name) && (c1.guid == c2.guid) && (c1.fileExtension == c2.fileExtension) && (c1.importProject == c2.importProject) && (c1.xmlTag == c2.xmlTag));
197 }
198
199 /// <summary>
200 /// Not equals operator
201 /// </summary>
202 /// <param name="c1">ToolInfo to compare</param>
203 /// <param name="c2">ToolInfo to compare</param>
204 /// <returns>True if toolInfos are not equal</returns>
205 public static bool operator !=(ToolInfo c1, ToolInfo c2)
206 {
207 return !(c1 == c2);
208 }
209
210 /// <summary>
211 /// Hash Code
212 /// </summary>
213 /// <returns>Hash code</returns>
214 public override int GetHashCode()
215 {
216 return name.GetHashCode() ^ guid.GetHashCode() ^ this.fileExtension.GetHashCode() ^ this.importProject.GetHashCode() ^ this.xmlTag.GetHashCode();
217
218 }
219 }
220
221 /// <summary>
222 ///
223 /// </summary>
224 [Target("vs2005")]
225 public class VS2005Target : ITarget
226 {
227 #region Inner Classes
228
229 #endregion
230
231 #region Fields
232
233 string solutionVersion = "9.00";
234 string productVersion = "8.0.50727";
235 string schemaVersion = "2.0";
236 string versionName = "Visual C# 2005";
237 VSVersion version = VSVersion.VS80;
238
239 Hashtable tools;
240 Kernel kernel;
241
242 /// <summary>
243 /// Gets or sets the solution version.
244 /// </summary>
245 /// <value>The solution version.</value>
246 protected string SolutionVersion
247 {
248 get
249 {
250 return this.solutionVersion;
251 }
252 set
253 {
254 this.solutionVersion = value;
255 }
256 }
257 /// <summary>
258 /// Gets or sets the product version.
259 /// </summary>
260 /// <value>The product version.</value>
261 protected string ProductVersion
262 {
263 get
264 {
265 return this.productVersion;
266 }
267 set
268 {
269 this.productVersion = value;
270 }
271 }
272 /// <summary>
273 /// Gets or sets the schema version.
274 /// </summary>
275 /// <value>The schema version.</value>
276 protected string SchemaVersion
277 {
278 get
279 {
280 return this.schemaVersion;
281 }
282 set
283 {
284 this.schemaVersion = value;
285 }
286 }
287 /// <summary>
288 /// Gets or sets the name of the version.
289 /// </summary>
290 /// <value>The name of the version.</value>
291 protected string VersionName
292 {
293 get
294 {
295 return this.versionName;
296 }
297 set
298 {
299 this.versionName = value;
300 }
301 }
302 /// <summary>
303 /// Gets or sets the version.
304 /// </summary>
305 /// <value>The version.</value>
306 protected VSVersion Version
307 {
308 get
309 {
310 return this.version;
311 }
312 set
313 {
314 this.version = value;
315 }
316 }
317
318 #endregion
319
320 #region Constructors
321
322 /// <summary>
323 /// Initializes a new instance of the <see cref="VS2005Target"/> class.
324 /// </summary>
325 public VS2005Target()
326 {
327 this.tools = new Hashtable();
328
329 this.tools["C#"] = new ToolInfo("C#", "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}", "csproj", "CSHARP", "$(MSBuildBinPath)\\Microsoft.CSHARP.Targets");
330 this.tools["Boo"] = new ToolInfo("Boo", "{45CEA7DC-C2ED-48A6-ACE0-E16144C02365}", "booproj", "Boo", "$(BooBinPath)\\Boo.Microsoft.Build.targets");
331 this.tools["VisualBasic"] = new ToolInfo("VisualBasic", "{F184B08F-C81C-45F6-A57F-5ABD9991F28F}", "vbproj", "VisualBasic", "$(MSBuildBinPath)\\Microsoft.VisualBasic.Targets");
332 }
333
334 #endregion
335
336 #region Private Methods
337
338 private string MakeRefPath(ProjectNode project)
339 {
340 string ret = "";
341 foreach (ReferencePathNode node in project.ReferencePaths)
342 {
343 try
344 {
345 string fullPath = Helper.ResolvePath(node.Path);
346 if (ret.Length < 1)
347 {
348 ret = fullPath;
349 }
350 else
351 {
352 ret += ";" + fullPath;
353 }
354 }
355 catch (ArgumentException)
356 {
357 this.kernel.Log.Write(LogType.Warning, "Could not resolve reference path: {0}", node.Path);
358 }
359 }
360
361 return ret;
362 }
363
364 private void WriteProject(SolutionNode solution, ProjectNode project)
365 {
366 if (!tools.ContainsKey(project.Language))
367 {
368 throw new UnknownLanguageException("Unknown .NET language: " + project.Language);
369 }
370
371 ToolInfo toolInfo = (ToolInfo)tools[project.Language];
372 string projectFile = Helper.MakeFilePath(project.FullPath, project.Name, toolInfo.FileExtension);
373 StreamWriter ps = new StreamWriter(projectFile);
374
375 kernel.CurrentWorkingDirectory.Push();
376 Helper.SetCurrentDir(Path.GetDirectoryName(projectFile));
377
378 #region Project File
379 using (ps)
380 {
381 ps.WriteLine("<Project DefaultTargets=\"Build\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">");
382 //ps.WriteLine(" <{0}", toolInfo.XMLTag);
383 ps.WriteLine(" <PropertyGroup>");
384 ps.WriteLine(" <ProjectType>Local</ProjectType>");
385 ps.WriteLine(" <ProductVersion>{0}</ProductVersion>", this.ProductVersion);
386 ps.WriteLine(" <SchemaVersion>{0}</SchemaVersion>", this.SchemaVersion);
387 ps.WriteLine(" <ProjectGuid>{{{0}}}</ProjectGuid>", project.Guid.ToString().ToUpper());
388
389 ps.WriteLine(" <Configuration Condition=\" '$(Configuration)' == '' \">Debug</Configuration>");
390 ps.WriteLine(" <Platform Condition=\" '$(Platform)' == '' \">AnyCPU</Platform>");
391 //ps.WriteLine(" <Build>");
392
393 //ps.WriteLine(" <Settings");
394 ps.WriteLine(" <ApplicationIcon>{0}</ApplicationIcon>", project.AppIcon);
395 ps.WriteLine(" <AssemblyKeyContainerName>");
396 ps.WriteLine(" </AssemblyKeyContainerName>");
397 ps.WriteLine(" <AssemblyName>{0}</AssemblyName>", project.AssemblyName);
398 foreach (ConfigurationNode conf in project.Configurations)
399 {
400 if (conf.Options.KeyFile != "")
401 {
402 ps.WriteLine(" <AssemblyOriginatorKeyFile>{0}</AssemblyOriginatorKeyFile>", conf.Options.KeyFile);
403 ps.WriteLine(" <SignAssembly>true</SignAssembly>");
404 break;
405 }
406 }
407 ps.WriteLine(" <DefaultClientScript>JScript</DefaultClientScript>");
408 ps.WriteLine(" <DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout>");
409 ps.WriteLine(" <DefaultTargetSchema>IE50</DefaultTargetSchema>");
410 ps.WriteLine(" <DelaySign>false</DelaySign>");
411
412 //if(m_Version == VSVersion.VS70)
413 // ps.WriteLine(" NoStandardLibraries = \"false\"");
414
415 ps.WriteLine(" <OutputType>{0}</OutputType>", project.Type.ToString());
416 ps.WriteLine(" <AppDesignerFolder>{0}</AppDesignerFolder>", project.DesignerFolder);
417 ps.WriteLine(" <RootNamespace>{0}</RootNamespace>", project.RootNamespace);
418 ps.WriteLine(" <StartupObject>{0}</StartupObject>", project.StartupObject);
419 //ps.WriteLine(" >");
420 ps.WriteLine(" <FileUpgradeFlags>");
421 ps.WriteLine(" </FileUpgradeFlags>");
422
423 ps.WriteLine(" </PropertyGroup>");
424
425 foreach (ConfigurationNode conf in project.Configurations)
426 {
427 ps.Write(" <PropertyGroup ");
428 ps.WriteLine("Condition=\" '$(Configuration)|$(Platform)' == '{0}|AnyCPU' \">", conf.Name);
429 ps.WriteLine(" <AllowUnsafeBlocks>{0}</AllowUnsafeBlocks>", conf.Options["AllowUnsafe"]);
430 ps.WriteLine(" <BaseAddress>{0}</BaseAddress>", conf.Options["BaseAddress"]);
431 ps.WriteLine(" <CheckForOverflowUnderflow>{0}</CheckForOverflowUnderflow>", conf.Options["CheckUnderflowOverflow"]);
432 ps.WriteLine(" <ConfigurationOverrideFile>");
433 ps.WriteLine(" </ConfigurationOverrideFile>");
434 ps.WriteLine(" <DefineConstants>{0}</DefineConstants>", conf.Options["CompilerDefines"]);
435 ps.WriteLine(" <DocumentationFile>{0}</DocumentationFile>", conf.Options["XmlDocFile"]);
436 ps.WriteLine(" <DebugSymbols>{0}</DebugSymbols>", conf.Options["DebugInformation"]);
437 ps.WriteLine(" <FileAlignment>{0}</FileAlignment>", conf.Options["FileAlignment"]);
438 // ps.WriteLine(" <IncrementalBuild = \"{0}\"", conf.Options["IncrementalBuild"]);
439
440 // if(m_Version == VSVersion.VS71)
441 // {
442 // ps.WriteLine(" NoStdLib = \"{0}\"", conf.Options["NoStdLib"]);
443 // ps.WriteLine(" NoWarn = \"{0}\"", conf.Options["SuppressWarnings"]);
444 // }
445
446 ps.WriteLine(" <Optimize>{0}</Optimize>", conf.Options["OptimizeCode"]);
447 ps.WriteLine(" <OutputPath>{0}</OutputPath>",
448 Helper.EndPath(Helper.NormalizePath(conf.Options["OutputPath"].ToString())));
449 ps.WriteLine(" <RegisterForComInterop>{0}</RegisterForComInterop>", conf.Options["RegisterComInterop"]);
450 ps.WriteLine(" <RemoveIntegerChecks>{0}</RemoveIntegerChecks>", conf.Options["RemoveIntegerChecks"]);
451 ps.WriteLine(" <TreatWarningsAsErrors>{0}</TreatWarningsAsErrors>", conf.Options["WarningsAsErrors"]);
452 ps.WriteLine(" <WarningLevel>{0}</WarningLevel>", conf.Options["WarningLevel"]);
453 ps.WriteLine(" <NoWarn>{0}</NoWarn>", conf.Options["SuppressWarnings"]);
454 ps.WriteLine(" </PropertyGroup>");
455 }
456
457 //ps.WriteLine(" </Settings>");
458
459 // Assembly References
460 ps.WriteLine(" <ItemGroup>");
461 foreach (ReferenceNode refr in project.References)
462 {
463 if (!solution.ProjectsTable.ContainsKey(refr.Name))
464 {
465 ps.Write(" <Reference");
466 ps.Write(" Include=\"");
467 ps.Write(refr.Name);
468
469 if (!string.IsNullOrEmpty(refr.Version))
470 {
471 ps.Write(", Version=");
472 ps.Write(refr.Version);
473 }
474
475 ps.WriteLine("\" >");
476
477 // TODO: Allow reference to *.exe files
478 ps.WriteLine(" <HintPath>{0}</HintPath>", Helper.MakePathRelativeTo(project.FullPath, refr.Path + "\\" + refr.Name + ".dll"));
479 ps.WriteLine(" <Private>{0}</Private>", refr.LocalCopy);
480 ps.WriteLine(" </Reference>");
481 }
482 }
483 ps.WriteLine(" </ItemGroup>");
484
485 //Project References
486 ps.WriteLine(" <ItemGroup>");
487 foreach (ReferenceNode refr in project.References)
488 {
489 if (solution.ProjectsTable.ContainsKey(refr.Name))
490 {
491 ProjectNode refProject = (ProjectNode)solution.ProjectsTable[refr.Name];
492 // TODO: Allow reference to visual basic projects
493 ps.WriteLine(" <ProjectReference Include=\"{0}\">", Helper.MakePathRelativeTo(project.FullPath, Helper.MakeFilePath(refProject.FullPath, refProject.Name, "csproj")));
494 //<ProjectReference Include="..\..\RealmForge\Utility\RealmForge.Utility.csproj">
495 ps.WriteLine(" <Name>{0}</Name>", refProject.Name);
496 // <Name>RealmForge.Utility</Name>
497 ps.WriteLine(" <Project>{{{0}}}</Project>", refProject.Guid.ToString().ToUpper());
498 // <Project>{6880D1D3-69EE-461B-B841-5319845B20D3}</Project>
499 ps.WriteLine(" <Package>{0}</Package>", toolInfo.Guid.ToString().ToUpper());
500 // <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
501 ps.WriteLine("\t\t\t<Private>{0}</Private>", refr.LocalCopy);
502 ps.WriteLine(" </ProjectReference>");
503 //</ProjectReference>
504 }
505 else
506 {
507 }
508 }
509 ps.WriteLine(" </ItemGroup>");
510
511 // ps.WriteLine(" </Build>");
512 ps.WriteLine(" <ItemGroup>");
513
514 // ps.WriteLine(" <Include>");
515 ArrayList list = new ArrayList();
516 foreach (string file in project.Files)
517 {
518 // if (file == "Properties\\Bind.Designer.cs")
519 // {
520 // Console.WriteLine("Wait a minute!");
521 // Console.WriteLine(project.Files.GetSubType(file).ToString());
522 // }
523
524 if (project.Files.GetSubType(file) != SubType.Code && project.Files.GetSubType(file) != SubType.Settings && project.Files.GetSubType(file) != SubType.Designer)
525 {
526 ps.WriteLine(" <EmbeddedResource Include=\"{0}\">", file.Substring(0, file.LastIndexOf('.')) + ".resx");
527
528 int slash = file.LastIndexOf('\\');
529 if (slash == -1)
530 {
531 ps.WriteLine(" <DependentUpon>{0}</DependentUpon>", file);
532 }
533 else
534 {
535 ps.WriteLine(" <DependentUpon>{0}</DependentUpon>", file.Substring(slash + 1, file.Length - slash - 1));
536 }
537 ps.WriteLine(" <SubType>Designer</SubType>");
538 ps.WriteLine(" </EmbeddedResource>");
539 //
540 }
541
542 if (project.Files.GetSubType(file) != SubType.Code && project.Files.GetSubType(file) == SubType.Designer)
543 {
544 ps.WriteLine(" <EmbeddedResource Include=\"{0}\">", file.Substring(0, file.LastIndexOf('.')) + ".resx");
545 ps.WriteLine(" <SubType>" + project.Files.GetSubType(file) + "</SubType>");
546 ps.WriteLine(" <Generator>ResXFileCodeGenerator</Generator>");
547 ps.WriteLine(" <LastGenOutput>Resources.Designer.cs</LastGenOutput>");
548 ps.WriteLine(" </EmbeddedResource>");
549 ps.WriteLine(" <Compile Include=\"{0}\">", file.Substring(0, file.LastIndexOf('.')) + ".Designer.cs");
550 ps.WriteLine(" <AutoGen>True</AutoGen>");
551 ps.WriteLine(" <DesignTime>True</DesignTime>");
552 ps.WriteLine(" <DependentUpon>Resources.resx</DependentUpon>");
553 ps.WriteLine(" </Compile>");
554 list.Add(file.Substring(0, file.LastIndexOf('.')) + ".Designer.cs");
555 }
556 if (project.Files.GetSubType(file).ToString() == "Settings")
557 {
558 //Console.WriteLine("File: " + file);
559 //Console.WriteLine("Last index: " + file.LastIndexOf('.'));
560 //Console.WriteLine("Length: " + file.Length);
561 ps.Write(" <{0} ", project.Files.GetBuildAction(file));
562 ps.WriteLine("Include=\"{0}\">", file);
563 int slash = file.LastIndexOf('\\');
564 string fileName = file.Substring(slash + 1, file.Length - slash - 1);
565 if (project.Files.GetBuildAction(file) == BuildAction.None)
566 {
567 ps.WriteLine(" <Generator>SettingsSingleFileGenerator</Generator>");
568
569 //Console.WriteLine("FileName: " + fileName);
570 //Console.WriteLine("FileNameMain: " + fileName.Substring(0, fileName.LastIndexOf('.')));
571 //Console.WriteLine("FileNameExt: " + fileName.Substring(fileName.LastIndexOf('.'), fileName.Length - fileName.LastIndexOf('.')));
572 if (slash == -1)
573 {
574 ps.WriteLine(" <LastGenOutput>{0}</LastGenOutput>", fileName.Substring(0, fileName.LastIndexOf('.')) + ".Designer.cs");
575 }
576 else
577 {
578 ps.WriteLine(" <LastGenOutput>{0}</LastGenOutput>", fileName.Substring(0, fileName.LastIndexOf('.')) + ".Designer.cs");
579 }
580 }
581 else
582 {
583 ps.WriteLine(" <SubType>Code</SubType>");
584 ps.WriteLine(" <AutoGen>True</AutoGen>");
585 ps.WriteLine(" <DesignTimeSharedInput>True</DesignTimeSharedInput>");
586 string fileNameShort = fileName.Substring(0, fileName.LastIndexOf('.'));
587 string fileNameShorter = fileNameShort.Substring(0, fileNameShort.LastIndexOf('.'));
588 ps.WriteLine(" <DependentUpon>{0}</DependentUpon>", fileNameShorter + ".settings");
589 }
590 ps.WriteLine(" </{0}>", project.Files.GetBuildAction(file));
591 }
592 else if (project.Files.GetSubType(file) != SubType.Designer)
593 {
594 if (!list.Contains(file))
595 {
596 ps.Write(" <{0} ", project.Files.GetBuildAction(file));
597 ps.WriteLine("Include=\"{0}\">", file);
598
599
600 if (file.Contains("Designer.cs"))
601 {
602 ps.WriteLine(" <DependentUpon>{0}</DependentUpon>", file.Substring(0, file.IndexOf(".Designer.cs")) + ".cs");
603 }
604
605 if (project.Files.GetIsLink(file))
606 {
607 ps.WriteLine(" <Link>{0}</Link>", Path.GetFileName(file));
608 }
609 else if (project.Files.GetBuildAction(file) != BuildAction.None)
610 {
611 if (project.Files.GetBuildAction(file) != BuildAction.EmbeddedResource)
612 {
613 ps.WriteLine(" <SubType>{0}</SubType>", project.Files.GetSubType(file));
614 }
615 }
616 if (project.Files.GetCopyToOutput(file) != CopyToOutput.Never)
617 {
618 ps.WriteLine(" <CopyToOutputDirectory>{0}</CopyToOutputDirectory>", project.Files.GetCopyToOutput(file));
619 }
620
621 ps.WriteLine(" </{0}>", project.Files.GetBuildAction(file));
622 }
623 }
624 }
625 // ps.WriteLine(" </Include>");
626
627 ps.WriteLine(" </ItemGroup>");
628 ps.WriteLine(" <Import Project=\"" + toolInfo.ImportProject + "\" />");
629 ps.WriteLine(" <PropertyGroup>");
630 ps.WriteLine(" <PreBuildEvent>");
631 ps.WriteLine(" </PreBuildEvent>");
632 ps.WriteLine(" <PostBuildEvent>");
633 ps.WriteLine(" </PostBuildEvent>");
634 ps.WriteLine(" </PropertyGroup>");
635 // ps.WriteLine(" </{0}>", toolInfo.XMLTag);
636 ps.WriteLine("</Project>");
637 }
638 #endregion
639
640 #region User File
641
642 ps = new StreamWriter(projectFile + ".user");
643 using (ps)
644 {
645 ps.WriteLine("<Project xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">");
646 //ps.WriteLine( "<VisualStudioProject>" );
647 //ps.WriteLine(" <{0}>", toolInfo.XMLTag);
648 //ps.WriteLine(" <Build>");
649 ps.WriteLine(" <PropertyGroup>");
650 //ps.WriteLine(" <Settings ReferencePath=\"{0}\">", MakeRefPath(project));
651 ps.WriteLine(" <Configuration Condition=\" '$(Configuration)' == '' \">Debug</Configuration>");
652 ps.WriteLine(" <Platform Condition=\" '$(Platform)' == '' \">AnyCPU</Platform>");
653 ps.WriteLine(" <ReferencePath>{0}</ReferencePath>", MakeRefPath(project));
654 ps.WriteLine(" <LastOpenVersion>{0}</LastOpenVersion>", this.ProductVersion);
655 ps.WriteLine(" <ProjectView>ProjectFiles</ProjectView>");
656 ps.WriteLine(" <ProjectTrust>0</ProjectTrust>");
657 ps.WriteLine(" </PropertyGroup>");
658 foreach (ConfigurationNode conf in project.Configurations)
659 {
660 ps.Write(" <PropertyGroup");
661 ps.Write(" Condition = \" '$(Configuration)|$(Platform)' == '{0}|AnyCPU' \"", conf.Name);
662 ps.WriteLine(" />");
663 }
664 //ps.WriteLine(" </Settings>");
665
666 //ps.WriteLine(" </Build>");
667 //ps.WriteLine(" </{0}>", toolInfo.XMLTag);
668 //ps.WriteLine("</VisualStudioProject>");
669 ps.WriteLine("</Project>");
670 }
671 #endregion
672
673 kernel.CurrentWorkingDirectory.Pop();
674 }
675
676 private void WriteSolution(SolutionNode solution)
677 {
678 kernel.Log.Write("Creating {0} solution and project files", this.VersionName);
679
680 foreach (ProjectNode project in solution.Projects)
681 {
682 kernel.Log.Write("...Creating project: {0}", project.Name);
683 WriteProject(solution, project);
684 }
685
686 kernel.Log.Write("");
687 string solutionFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "sln");
688 StreamWriter ss = new StreamWriter(solutionFile);
689
690 kernel.CurrentWorkingDirectory.Push();
691 Helper.SetCurrentDir(Path.GetDirectoryName(solutionFile));
692
693 using (ss)
694 {
695 ss.WriteLine("Microsoft Visual Studio Solution File, Format Version {0}", this.SolutionVersion);
696 ss.WriteLine("# Visual Studio 2005");
697 foreach (ProjectNode project in solution.Projects)
698 {
699 if (!tools.ContainsKey(project.Language))
700 {
701 throw new UnknownLanguageException("Unknown .NET language: " + project.Language);
702 }
703
704 ToolInfo toolInfo = (ToolInfo)tools[project.Language];
705
706 string path = Helper.MakePathRelativeTo(solution.FullPath, project.FullPath);
707 ss.WriteLine("Project(\"{0}\") = \"{1}\", \"{2}\", \"{{{3}}}\"",
708 toolInfo.Guid, project.Name, Helper.MakeFilePath(path, project.Name,
709 toolInfo.FileExtension), project.Guid.ToString().ToUpper());
710
711 //ss.WriteLine(" ProjectSection(ProjectDependencies) = postProject");
712 //ss.WriteLine(" EndProjectSection");
713
714 ss.WriteLine("EndProject");
715 }
716
717 if (solution.Files != null)
718 {
719 ss.WriteLine("Project(\"{0}\") = \"Solution Items\", \"Solution Items\", \"{1}\"", "{2150E333-8FDC-42A3-9474-1A3956D46DE8}", "{468F1D07-AD17-4CC3-ABD0-2CA268E4E1A6}");
720 ss.WriteLine("\tProjectSection(SolutionItems) = preProject");
721 foreach (string file in solution.Files)
722 ss.WriteLine("\t\t{0} = {0}", file);
723 ss.WriteLine("\tEndProjectSection");
724 ss.WriteLine("EndProject");
725 }
726
727 ss.WriteLine("Global");
728
729 ss.WriteLine(" GlobalSection(SolutionConfigurationPlatforms) = preSolution");
730 foreach (ConfigurationNode conf in solution.Configurations)
731 {
732 ss.WriteLine(" {0}|Any CPU = {0}|Any CPU", conf.Name);
733 }
734 ss.WriteLine(" EndGlobalSection");
735
736 if (solution.Projects.Count > 1)
737 {
738 ss.WriteLine(" GlobalSection(ProjectDependencies) = postSolution");
739 }
740 foreach (ProjectNode project in solution.Projects)
741 {
742 for (int i = 0; i < project.References.Count; i++)
743 {
744 ReferenceNode refr = (ReferenceNode)project.References[i];
745 if (solution.ProjectsTable.ContainsKey(refr.Name))
746 {
747 ProjectNode refProject = (ProjectNode)solution.ProjectsTable[refr.Name];
748 ss.WriteLine(" ({{{0}}}).{1} = ({{{2}}})",
749 project.Guid.ToString().ToUpper()
750 , i,
751 refProject.Guid.ToString().ToUpper()
752 );
753 }
754 }
755 }
756 if (solution.Projects.Count > 1)
757 {
758 ss.WriteLine(" EndGlobalSection");
759 }
760 ss.WriteLine(" GlobalSection(ProjectConfigurationPlatforms) = postSolution");
761 foreach (ProjectNode project in solution.Projects)
762 {
763 foreach (ConfigurationNode conf in solution.Configurations)
764 {
765 ss.WriteLine(" {{{0}}}.{1}|Any CPU.ActiveCfg = {1}|Any CPU",
766 project.Guid.ToString().ToUpper(),
767 conf.Name);
768
769 ss.WriteLine(" {{{0}}}.{1}|Any CPU.Build.0 = {1}|Any CPU",
770 project.Guid.ToString().ToUpper(),
771 conf.Name);
772 }
773 }
774 ss.WriteLine(" EndGlobalSection");
775 ss.WriteLine(" GlobalSection(SolutionProperties) = preSolution");
776 ss.WriteLine(" HideSolutionNode = FALSE");
777 ss.WriteLine(" EndGlobalSection");
778
779 ss.WriteLine("EndGlobal");
780 }
781
782 kernel.CurrentWorkingDirectory.Pop();
783 }
784
785 private void CleanProject(ProjectNode project)
786 {
787 kernel.Log.Write("...Cleaning project: {0}", project.Name);
788
789 ToolInfo toolInfo = (ToolInfo)tools[project.Language];
790 string projectFile = Helper.MakeFilePath(project.FullPath, project.Name, toolInfo.FileExtension);
791 string userFile = projectFile + ".user";
792
793 Helper.DeleteIfExists(projectFile);
794 Helper.DeleteIfExists(userFile);
795 }
796
797 private void CleanSolution(SolutionNode solution)
798 {
799 kernel.Log.Write("Cleaning {0} solution and project files", this.VersionName, solution.Name);
800
801 string slnFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "sln");
802 string suoFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "suo");
803
804 Helper.DeleteIfExists(slnFile);
805 Helper.DeleteIfExists(suoFile);
806
807 foreach (ProjectNode project in solution.Projects)
808 {
809 CleanProject(project);
810 }
811
812 kernel.Log.Write("");
813 }
814
815 #endregion
816
817 #region ITarget Members
818
819 /// <summary>
820 /// Writes the specified kern.
821 /// </summary>
822 /// <param name="kern">The kern.</param>
823 public virtual void Write(Kernel kern)
824 {
825 if (kern == null)
826 {
827 throw new ArgumentNullException("kern");
828 }
829 kernel = kern;
830 foreach (SolutionNode sol in kernel.Solutions)
831 {
832 WriteSolution(sol);
833 }
834 kernel = null;
835 }
836
837 /// <summary>
838 /// Cleans the specified kern.
839 /// </summary>
840 /// <param name="kern">The kern.</param>
841 public virtual void Clean(Kernel kern)
842 {
843 if (kern == null)
844 {
845 throw new ArgumentNullException("kern");
846 }
847 kernel = kern;
848 foreach (SolutionNode sol in kernel.Solutions)
849 {
850 CleanSolution(sol);
851 }
852 kernel = null;
853 }
854
855 /// <summary>
856 /// Gets the name.
857 /// </summary>
858 /// <value>The name.</value>
859 public virtual string Name
860 {
861 get
862 {
863 return "vs2005";
864 }
865 }
866
867 #endregion
868 }
869}
diff --git a/Prebuild/src/Core/UnknownLanguageException.cs b/Prebuild/src/Core/UnknownLanguageException.cs
new file mode 100644
index 0000000..cbd1dc1
--- /dev/null
+++ b/Prebuild/src/Core/UnknownLanguageException.cs
@@ -0,0 +1,63 @@
1/*
2 * $RCSfile$
3 * Copyright (C) 2004, 2005 David Hudson (jendave@yahoo.com)
4 *
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
9 *
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
14 *
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 */
19
20using System;
21using System.Runtime.Serialization;
22
23namespace Prebuild.Core
24{
25 /// <summary>
26 /// </summary>
27 [Serializable()]
28 public class UnknownLanguageException : Exception
29 {
30 /// <summary>
31 /// Basic exception.
32 /// </summary>
33 public UnknownLanguageException()
34 {
35 }
36
37 /// <summary>
38 /// Exception with specified string
39 /// </summary>
40 /// <param name="message">Exception message</param>
41 public UnknownLanguageException(string message): base(message)
42 {
43 }
44
45 /// <summary>
46 ///
47 /// </summary>
48 /// <param name="message"></param>
49 /// <param name="exception"></param>
50 public UnknownLanguageException(string message, Exception exception) : base(message, exception)
51 {
52 }
53
54 /// <summary>
55 ///
56 /// </summary>
57 /// <param name="info"></param>
58 /// <param name="context"></param>
59 protected UnknownLanguageException(SerializationInfo info, StreamingContext context) : base( info, context )
60 {
61 }
62 }
63}
diff --git a/Prebuild/src/Core/Utilities/CommandLineCollection.cs b/Prebuild/src/Core/Utilities/CommandLineCollection.cs
new file mode 100644
index 0000000..496731f
--- /dev/null
+++ b/Prebuild/src/Core/Utilities/CommandLineCollection.cs
@@ -0,0 +1,162 @@
1#region BSD License
2/*
3Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com)
4
5Redistribution and use in source and binary forms, with or without modification, are permitted
6provided that the following conditions are met:
7
8* Redistributions of source code must retain the above copyright notice, this list of conditions
9 and the following disclaimer.
10* Redistributions in binary form must reproduce the above copyright notice, this list of conditions
11 and the following disclaimer in the documentation and/or other materials provided with the
12 distribution.
13* The name of the author may not be used to endorse or promote products derived from this software
14 without specific prior written permission.
15
16THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
17BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
19EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
21OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
22IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23*/
24#endregion
25
26#region CVS Information
27/*
28 * $Source$
29 * $Author: robloach $
30 * $Date: 2006-09-26 00:30:53 +0200 (ti, 26 sep 2006) $
31 * $Revision: 165 $
32 */
33#endregion
34
35using System;
36using System.Collections;
37using System.Collections.Specialized;
38using System.Diagnostics;
39
40namespace Prebuild.Core.Utilities
41{
42 /// <summary>
43 /// The CommandLine class parses and interprets the command-line arguments passed to
44 /// prebuild.
45 /// </summary>
46 public class CommandLineCollection
47 {
48 #region Fields
49
50 // The raw OS arguments
51 private string[] m_RawArgs;
52
53 // Command-line argument storage
54 private Hashtable m_Arguments;
55
56 #endregion
57
58 #region Constructors
59
60 /// <summary>
61 /// Create a new CommandLine instance and set some internal variables.
62 /// </summary>
63 public CommandLineCollection(string[] args)
64 {
65 m_RawArgs = args;
66 m_Arguments = new Hashtable();
67
68 Parse();
69 }
70
71 #endregion
72
73 #region Private Methods
74
75 private void Parse()
76 {
77 if(m_RawArgs.Length < 1)
78 return;
79
80 int idx = 0;
81 string arg = null, lastArg = null;
82
83 while(idx <m_RawArgs.Length)
84 {
85 arg = m_RawArgs[idx];
86
87 if(arg.Length > 2 && arg[0] == '/')
88 {
89 arg = arg.Substring(1);
90 lastArg = arg;
91 m_Arguments[arg] = "";
92 }
93 else
94 {
95 if(lastArg != null)
96 {
97 m_Arguments[lastArg] = arg;
98 lastArg = null;
99 }
100 }
101
102 idx++;
103 }
104 }
105
106 #endregion
107
108 #region Public Methods
109
110 /// <summary>
111 /// Wases the passed.
112 /// </summary>
113 /// <param name="arg">The arg.</param>
114 /// <returns></returns>
115 public bool WasPassed(string arg)
116 {
117 return (m_Arguments.ContainsKey(arg));
118 }
119
120 #endregion
121
122 #region Properties
123
124 /// <summary>
125 /// Gets the parameter associated with the command line option
126 /// </summary>
127 /// <remarks>Returns null if option was not specified,
128 /// null string if no parameter was specified, and the value if a parameter was specified</remarks>
129 public string this[string index]
130 {
131 get
132 {
133 if(m_Arguments.ContainsKey(index))
134 {
135 return (string)(m_Arguments[index]);
136 }
137 else
138 {
139 return null;
140 }
141 }
142 }
143
144 #endregion
145
146 #region IEnumerable Members
147
148 /// <summary>
149 /// Returns an enumerator that can iterate through a collection.
150 /// </summary>
151 /// <returns>
152 /// An <see cref="T:System.Collections.IDictionaryEnumerator"/>
153 /// that can be used to iterate through the collection.
154 /// </returns>
155 public IDictionaryEnumerator GetEnumerator()
156 {
157 return m_Arguments.GetEnumerator();
158 }
159
160 #endregion
161 }
162}
diff --git a/Prebuild/src/Core/Utilities/CurrentDirectory.cs b/Prebuild/src/Core/Utilities/CurrentDirectory.cs
new file mode 100644
index 0000000..a76d844
--- /dev/null
+++ b/Prebuild/src/Core/Utilities/CurrentDirectory.cs
@@ -0,0 +1,89 @@
1#region BSD License
2/*
3Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com)
4
5Redistribution and use in source and binary forms, with or without modification, are permitted
6provided that the following conditions are met:
7
8* Redistributions of source code must retain the above copyright notice, this list of conditions
9 and the following disclaimer.
10* Redistributions in binary form must reproduce the above copyright notice, this list of conditions
11 and the following disclaimer in the documentation and/or other materials provided with the
12 distribution.
13* The name of the author may not be used to endorse or promote products derived from this software
14 without specific prior written permission.
15
16THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
17BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
19EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
21OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
22IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23*/
24#endregion
25
26#region CVS Information
27/*
28 * $Source$
29 * $Author: jendave $
30 * $Date: 2006-01-28 01:49:58 +0100 (lö, 28 jan 2006) $
31 * $Revision: 71 $
32 */
33#endregion
34
35using System;
36using System.Collections;
37
38namespace Prebuild.Core.Utilities
39{
40 /// <summary>
41 ///
42 /// </summary>
43 public class CurrentDirectory
44 {
45 #region Fields
46
47 private Stack m_Stack;
48
49 #endregion
50
51 #region Constructors
52
53 /// <summary>
54 /// Initializes a new instance of the <see cref="CurrentDirectory"/> class.
55 /// </summary>
56 public CurrentDirectory()
57 {
58 m_Stack = new Stack();
59 }
60
61 #endregion
62
63 #region Public Methods
64
65 /// <summary>
66 /// Pushes this instance.
67 /// </summary>
68 public void Push()
69 {
70 m_Stack.Push(Environment.CurrentDirectory);
71 }
72
73 /// <summary>
74 /// Pops this instance.
75 /// </summary>
76 public void Pop()
77 {
78 if(m_Stack.Count < 1)
79 {
80 return;
81 }
82
83 string cwd = (string)m_Stack.Pop();
84 Helper.SetCurrentDir(cwd);
85 }
86
87 #endregion
88 }
89}
diff --git a/Prebuild/src/Core/Utilities/Helper.cs b/Prebuild/src/Core/Utilities/Helper.cs
new file mode 100644
index 0000000..33c9618
--- /dev/null
+++ b/Prebuild/src/Core/Utilities/Helper.cs
@@ -0,0 +1,661 @@
1#region BSD License
2/*
3Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com)
4
5Redistribution and use in source and binary forms, with or without modification, are permitted
6provided that the following conditions are met:
7
8* Redistributions of source code must retain the above copyright notice, this list of conditions
9 and the following disclaimer.
10* Redistributions in binary form must reproduce the above copyright notice, this list of conditions
11 and the following disclaimer in the documentation and/or other materials provided with the
12 distribution.
13* The name of the author may not be used to endorse or promote products derived from this software
14 without specific prior written permission.
15
16THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
17BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
19EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
21OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
22IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23*/
24#endregion
25
26#region CVS Information
27/*
28 * $Source$
29 * $Author: jendave $
30 * $Date: 2007-02-13 21:58:03 +0100 (ti, 13 feb 2007) $
31 * $Revision: 205 $
32 */
33#endregion
34
35using System;
36using System.Collections;
37using System.Diagnostics;
38using System.IO;
39using System.Runtime.InteropServices;
40using System.Text.RegularExpressions;
41using System.Collections.Specialized;
42using System.Xml;
43using Prebuild.Core.Nodes;
44
45namespace Prebuild.Core.Utilities
46{
47 /// <summary>
48 ///
49 /// </summary>
50 public class Helper
51 {
52 #region Fields
53
54 private static Stack dirStack;
55 private static Regex varRegex;
56 static bool checkForOSVariables;
57
58 /// <summary>
59 ///
60 /// </summary>
61 public static bool CheckForOSVariables
62 {
63 get
64 {
65 return checkForOSVariables;
66 }
67 set
68 {
69 checkForOSVariables = value;
70 }
71 }
72
73 #endregion
74
75 #region Constructors
76
77 /// <summary>
78 /// Initializes the <see cref="Helper"/> class.
79 /// </summary>
80 static Helper()
81 {
82 dirStack = new Stack();
83 //m_VarRegex = new Regex(@"\${(?<var>[\w|_]+)}");
84 }
85
86 #endregion
87
88 #region Properties
89
90 /// <summary>
91 ///
92 /// </summary>
93 public static Stack DirStack
94 {
95 get
96 {
97 return dirStack;
98 }
99 }
100
101 /// <summary>
102 ///
103 /// </summary>
104 public static Regex VarRegex
105 {
106 get
107 {
108 return varRegex;
109 }
110 set
111 {
112 varRegex = value;
113 }
114 }
115
116 #endregion
117
118 #region Public Methods
119
120 #region String Parsing
121 #region Inner Classes and Delegates
122 /// <summary>
123 ///
124 /// </summary>
125 public delegate string StringLookup(string key);
126
127 #endregion
128
129 /// <summary>
130 /// Gets a collection of StringLocationPair objects that represent the matches
131 /// </summary>
132 /// <param name="target">The target.</param>
133 /// <param name="beforeGroup">The before group.</param>
134 /// <param name="afterGroup">The after group.</param>
135 /// <param name="includeDelimitersInSubstrings">if set to <c>true</c> [include delimiters in substrings].</param>
136 /// <returns></returns>
137 public static StringCollection FindGroups(string target, string beforeGroup, string afterGroup, bool includeDelimitersInSubstrings)
138 {
139 if( beforeGroup == null )
140 {
141 throw new ArgumentNullException("beforeGroup");
142 }
143 if( afterGroup == null )
144 {
145 throw new ArgumentNullException("afterGroup");
146 }
147 StringCollection results = new StringCollection();
148 if(target == null || target.Length == 0)
149 {
150 return results;
151 }
152
153 int beforeMod = 0;
154 int afterMod = 0;
155 if(includeDelimitersInSubstrings)
156 {
157 //be sure to not exlude the delims
158 beforeMod = beforeGroup.Length;
159 afterMod = afterGroup.Length;
160 }
161 int startIndex = 0;
162 while((startIndex = target.IndexOf(beforeGroup,startIndex)) != -1) {
163 int endIndex = target.IndexOf(afterGroup,startIndex);//the index of the char after it
164 if(endIndex == -1)
165 {
166 break;
167 }
168 int length = endIndex - startIndex - beforeGroup.Length;//move to the first char in the string
169 string substring = substring = target.Substring(startIndex + beforeGroup.Length - beforeMod,
170 length - afterMod);
171
172 results.Add(substring);
173 //results.Add(new StringLocationPair(substring,startIndex));
174 startIndex = endIndex + 1;
175 //the Interpolate*() methods will not work if expressions are expandded inside expression due to an optimization
176 //so start after endIndex
177
178 }
179 return results;
180 }
181
182 /// <summary>
183 /// Replaces the groups.
184 /// </summary>
185 /// <param name="target">The target.</param>
186 /// <param name="beforeGroup">The before group.</param>
187 /// <param name="afterGroup">The after group.</param>
188 /// <param name="lookup">The lookup.</param>
189 /// <returns></returns>
190 public static string ReplaceGroups(string target, string beforeGroup, string afterGroup, StringLookup lookup) {
191 if( target == null )
192 {
193 throw new ArgumentNullException("target");
194 }
195 //int targetLength = target.Length;
196 StringCollection strings = FindGroups(target,beforeGroup,afterGroup,false);
197 if( lookup == null )
198 {
199 throw new ArgumentNullException("lookup");
200 }
201 foreach(string substring in strings)
202 {
203 target = target.Replace(beforeGroup + substring + afterGroup, lookup(substring) );
204 }
205 return target;
206 }
207
208 /// <summary>
209 /// Replaces ${var} statements in a string with the corresonding values as detirmined by the lookup delegate
210 /// </summary>
211 /// <param name="target">The target.</param>
212 /// <param name="lookup">The lookup.</param>
213 /// <returns></returns>
214 public static string InterpolateForVariables(string target, StringLookup lookup)
215 {
216 return ReplaceGroups(target, "${" , "}" , lookup);
217 }
218
219 /// <summary>
220 /// Replaces ${var} statements in a string with the corresonding environment variable with name var
221 /// </summary>
222 /// <param name="target"></param>
223 /// <returns></returns>
224 public static string InterpolateForEnvironmentVariables(string target)
225 {
226 return InterpolateForVariables(target, new StringLookup(Environment.GetEnvironmentVariable));
227 }
228
229 #endregion
230
231 /// <summary>
232 /// Translates the value.
233 /// </summary>
234 /// <param name="translateType">Type of the translate.</param>
235 /// <param name="translationItem">The translation item.</param>
236 /// <returns></returns>
237 public static object TranslateValue(Type translateType, string translationItem)
238 {
239 if(translationItem == null)
240 {
241 return null;
242 }
243
244 try
245 {
246 string lowerVal = translationItem.ToLower();
247 if(translateType == typeof(bool))
248 {
249 return (lowerVal == "true" || lowerVal == "1" || lowerVal == "y" || lowerVal == "yes" || lowerVal == "on");
250 }
251 else if(translateType == typeof(int))
252 {
253 return (Int32.Parse(translationItem));
254 }
255 else
256 {
257 return translationItem;
258 }
259 }
260 catch(FormatException)
261 {
262 return null;
263 }
264 }
265
266 /// <summary>
267 /// Deletes if exists.
268 /// </summary>
269 /// <param name="file">The file.</param>
270 /// <returns></returns>
271 public static bool DeleteIfExists(string file)
272 {
273 string resFile = null;
274 try
275 {
276 resFile = ResolvePath(file);
277 }
278 catch(ArgumentException)
279 {
280 return false;
281 }
282
283 if(!File.Exists(resFile))
284 {
285 return false;
286 }
287
288 File.Delete(resFile);
289 return true;
290 }
291
292 // This little gem was taken from the NeL source, thanks guys!
293 /// <summary>
294 /// Makes a relative path
295 /// </summary>
296 /// <param name="startPath">Path to start from</param>
297 /// <param name="endPath">Path to end at</param>
298 /// <returns>Path that will get from startPath to endPath</returns>
299 public static string MakePathRelativeTo(string startPath, string endPath)
300 {
301 string tmp = NormalizePath(startPath, '/');
302 string src = NormalizePath(endPath, '/');
303 string prefix = "";
304
305 while(true)
306 {
307 if((String.Compare(tmp, 0, src, 0, tmp.Length) == 0))
308 {
309 string ret;
310 int size = tmp.Length;
311 if(size == src.Length)
312 {
313 return "./";
314 }
315 if ((src.Length > tmp.Length) && src[tmp.Length-1] != '/' && src[tmp.Length-1] != '\\')
316 {
317 }
318 else
319 {
320 ret = prefix + endPath.Substring(size, endPath.Length - size);
321 ret = ret.Trim();
322 if(ret[0] == '/' || ret[0] == '\\')
323 {
324 ret = "." + ret;
325 }
326
327 return NormalizePath(ret);
328 }
329
330 }
331
332 if(tmp.Length < 2)
333 {
334 break;
335 }
336
337 int lastPos = tmp.LastIndexOf('/', tmp.Length - 2);
338 int prevPos = tmp.IndexOf('/');
339
340 if((lastPos == prevPos) || (lastPos == -1))
341 {
342 break;
343 }
344
345 tmp = tmp.Substring(0, lastPos + 1);
346 prefix += "../";
347 }
348
349 return endPath;
350 }
351
352 /// <summary>
353 /// Resolves the path.
354 /// </summary>
355 /// <param name="path">The path.</param>
356 /// <returns></returns>
357 public static string ResolvePath(string path)
358 {
359 string tmpPath = NormalizePath(path);
360 if(tmpPath.Length < 1)
361 {
362 tmpPath = ".";
363 }
364
365 tmpPath = Path.GetFullPath(tmpPath);
366 if(!File.Exists(tmpPath) && !Directory.Exists(tmpPath))
367 {
368 throw new ArgumentException("Path could not be resolved: " + tmpPath);
369 }
370
371 return tmpPath;
372 }
373
374 /// <summary>
375 /// Normalizes the path.
376 /// </summary>
377 /// <param name="path">The path.</param>
378 /// <param name="separatorCharacter">The separator character.</param>
379 /// <returns></returns>
380 public static string NormalizePath(string path, char separatorCharacter)
381 {
382 if(path == null || path == "" || path.Length < 1)
383 {
384 return "";
385 }
386
387 string tmpPath = path.Replace('\\', '/');
388 tmpPath = tmpPath.Replace('/', separatorCharacter);
389 return tmpPath;
390 }
391
392 /// <summary>
393 /// Normalizes the path.
394 /// </summary>
395 /// <param name="path">The path.</param>
396 /// <returns></returns>
397 public static string NormalizePath(string path)
398 {
399 return NormalizePath(path, Path.DirectorySeparatorChar);
400 }
401
402 /// <summary>
403 /// Ends the path.
404 /// </summary>
405 /// <param name="path">The path.</param>
406 /// <param name="separatorCharacter">The separator character.</param>
407 /// <returns></returns>
408 public static string EndPath(string path, char separatorCharacter)
409 {
410 if(path == null || path == "" || path.Length < 1)
411 {
412 return "";
413 }
414
415 if(!path.EndsWith(separatorCharacter.ToString()))
416 {
417 return (path + separatorCharacter);
418 }
419
420 return path;
421 }
422
423 /// <summary>
424 /// Ends the path.
425 /// </summary>
426 /// <param name="path">The path.</param>
427 /// <returns></returns>
428 public static string EndPath(string path)
429 {
430 return EndPath(path, Path.DirectorySeparatorChar);
431 }
432
433 /// <summary>
434 /// Makes the file path.
435 /// </summary>
436 /// <param name="path">The path.</param>
437 /// <param name="name">The name.</param>
438 /// <param name="ext">The ext.</param>
439 /// <returns></returns>
440 public static string MakeFilePath(string path, string name, string ext)
441 {
442 string ret = EndPath(NormalizePath(path));
443
444 if( name == null )
445 {
446 throw new ArgumentNullException("name");
447 }
448
449 ret += name;
450 if(!name.EndsWith("." + ext))
451 {
452 ret += "." + ext;
453 }
454
455 //foreach(char c in Path.GetInvalidPathChars())
456 //{
457 // ret = ret.Replace(c, '_');
458 //}
459
460 return ret;
461 }
462
463 /// <summary>
464 /// Makes the file path.
465 /// </summary>
466 /// <param name="path">The path.</param>
467 /// <param name="name">The name.</param>
468 /// <returns></returns>
469 public static string MakeFilePath(string path, string name)
470 {
471 string ret = EndPath(NormalizePath(path));
472
473 if( name == null )
474 {
475 throw new ArgumentNullException("name");
476 }
477
478 ret += name;
479
480 //foreach (char c in Path.GetInvalidPathChars())
481 //{
482 // ret = ret.Replace(c, '_');
483 //}
484
485 return ret;
486 }
487
488 /// <summary>
489 ///
490 /// </summary>
491 /// <param name="path"></param>
492 /// <returns></returns>
493 public static string MakeReferencePath(string path)
494 {
495 string ret = EndPath(NormalizePath(path));
496
497 //foreach (char c in Path.GetInvalidPathChars())
498 //{
499 // ret = ret.Replace(c, '_');
500 //}
501
502 return ret;
503 }
504
505 /// <summary>
506 /// Sets the current dir.
507 /// </summary>
508 /// <param name="path">The path.</param>
509 public static void SetCurrentDir(string path)
510 {
511 if( path == null )
512 {
513 throw new ArgumentNullException("path");
514 }
515 if(path.Length < 1)
516 {
517 return;
518 }
519
520 Environment.CurrentDirectory = path;
521 }
522
523 /// <summary>
524 /// Checks the type.
525 /// </summary>
526 /// <param name="typeToCheck">The type to check.</param>
527 /// <param name="attr">The attr.</param>
528 /// <param name="inter">The inter.</param>
529 /// <returns></returns>
530 public static object CheckType(Type typeToCheck, Type attr, Type inter)
531 {
532 if(typeToCheck == null || attr == null)
533 {
534 return null;
535 }
536
537 object[] attrs = typeToCheck.GetCustomAttributes(attr, false);
538 if(attrs == null || attrs.Length < 1)
539 {
540 return null;
541 }
542 if( inter == null )
543 {
544 throw new ArgumentNullException("inter");
545 }
546
547 if(typeToCheck.GetInterface(inter.FullName) == null)
548 {
549 return null;
550 }
551
552 return attrs[0];
553 }
554
555 /* A bit of overhead for simple group parsing, there are problems with Regex in Mono
556 public static string ParseValue(string val)
557 {
558 if(val == null || val.Length < 1 || !CheckForOSVariables)
559 return val;
560
561 string tmp = val;
562 Match m = m_VarRegex.Match(val);
563 while(m.Success)
564 {
565 if(m.Groups["var"] == null)
566 continue;
567
568 Capture c = m.Groups["var"].Captures[0];
569 if(c == null)
570 continue;
571
572 string var = c.Value;
573 string envVal = Environment.GetEnvironmentVariable(var);
574 if(envVal == null)
575 envVal = "";
576
577 tmp = tmp.Replace("${" + var + "}", envVal);
578 m = m.NextMatch();
579 }
580
581 return tmp;
582 }*/
583
584 /// <summary>
585 /// Attributes the value.
586 /// </summary>
587 /// <param name="node">The node.</param>
588 /// <param name="attr">The attr.</param>
589 /// <param name="def">The def.</param>
590 /// <returns></returns>
591 public static string AttributeValue(XmlNode node, string attr, string def)
592 {
593 if( node == null )
594 {
595 throw new ArgumentNullException("node");
596 }
597 if(node.Attributes[attr] == null)
598 {
599 return def;
600 }
601 string val = node.Attributes[attr].Value;
602 if(!CheckForOSVariables)
603 {
604 return val;
605 }
606
607 return InterpolateForEnvironmentVariables(val);
608 }
609
610 /// <summary>
611 /// Parses the boolean.
612 /// </summary>
613 /// <param name="node">The node.</param>
614 /// <param name="attr">The attr.</param>
615 /// <param name="defaultValue">if set to <c>true</c> [default value].</param>
616 /// <returns></returns>
617 public static bool ParseBoolean(XmlNode node, string attr, bool defaultValue)
618 {
619 if( node == null )
620 {
621 throw new ArgumentNullException("node");
622 }
623 if(node.Attributes[attr] == null)
624 {
625 return defaultValue;
626 }
627 return bool.Parse(node.Attributes[attr].Value);
628 }
629
630 /// <summary>
631 /// Enums the attribute value.
632 /// </summary>
633 /// <param name="node">The node.</param>
634 /// <param name="attr">The attr.</param>
635 /// <param name="enumType">Type of the enum.</param>
636 /// <param name="def">The def.</param>
637 /// <returns></returns>
638 public static object EnumAttributeValue(XmlNode node, string attr, Type enumType, object def)
639 {
640 if( def == null )
641 {
642 throw new ArgumentNullException("def");
643 }
644 string val = AttributeValue(node, attr, def.ToString());
645 return Enum.Parse(enumType, val, true);
646 }
647
648 /// <summary>
649 ///
650 /// </summary>
651 /// <param name="assemblyName"></param>
652 /// <param name="projectType"></param>
653 /// <returns></returns>
654 public static string AssemblyFullName(string assemblyName, ProjectType projectType)
655 {
656 return assemblyName + (projectType == ProjectType.Library ? ".dll" : ".exe");
657 }
658
659 #endregion
660 }
661}
diff --git a/Prebuild/src/Core/Utilities/Log.cs b/Prebuild/src/Core/Utilities/Log.cs
new file mode 100644
index 0000000..da2cc96
--- /dev/null
+++ b/Prebuild/src/Core/Utilities/Log.cs
@@ -0,0 +1,279 @@
1#region BSD License
2/*
3Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com)
4
5Redistribution and use in source and binary forms, with or without modification, are permitted
6provided that the following conditions are met:
7
8* Redistributions of source code must retain the above copyright notice, this list of conditions
9 and the following disclaimer.
10* Redistributions in binary form must reproduce the above copyright notice, this list of conditions
11 and the following disclaimer in the documentation and/or other materials provided with the
12 distribution.
13* The name of the author may not be used to endorse or promote products derived from this software
14 without specific prior written permission.
15
16THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
17BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
19EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
21OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
22IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23*/
24#endregion
25
26#region CVS Information
27/*
28 * $Source$
29 * $Author: jendave $
30 * $Date: 2006-01-28 01:49:58 +0100 (lö, 28 jan 2006) $
31 * $Revision: 71 $
32 */
33#endregion
34
35using System;
36using System.IO;
37
38namespace Prebuild.Core.Utilities
39{
40 /// <summary>
41 ///
42 /// </summary>
43 public enum LogType
44 {
45 /// <summary>
46 ///
47 /// </summary>
48 None,
49 /// <summary>
50 ///
51 /// </summary>
52 Info,
53 /// <summary>
54 ///
55 /// </summary>
56 Warning,
57 /// <summary>
58 ///
59 /// </summary>
60 Error
61 }
62
63 /// <summary>
64 ///
65 /// </summary>
66 [Flags]
67 public enum LogTargets
68 {
69 /// <summary>
70 ///
71 /// </summary>
72 None = 0,
73 /// <summary>
74 ///
75 /// </summary>
76 Null = 1,
77 /// <summary>
78 ///
79 /// </summary>
80 File = 2,
81 /// <summary>
82 ///
83 /// </summary>
84 Console = 4
85 }
86
87 /// <summary>
88 /// Summary description for Log.
89 /// </summary>
90 public class Log : IDisposable
91 {
92 #region Fields
93
94 private StreamWriter m_Writer;
95 private LogTargets m_Target = LogTargets.Null;
96 bool disposed;
97
98 #endregion
99
100 #region Constructors
101
102 /// <summary>
103 /// Initializes a new instance of the <see cref="Log"/> class.
104 /// </summary>
105 /// <param name="target">The target.</param>
106 /// <param name="fileName">Name of the file.</param>
107 public Log(LogTargets target, string fileName)
108 {
109 m_Target = target;
110
111 if((m_Target & LogTargets.File) != 0)
112 {
113 m_Writer = new StreamWriter(fileName, false);
114 }
115 }
116
117 #endregion
118
119 #region Public Methods
120
121 /// <summary>
122 /// Writes this instance.
123 /// </summary>
124 public void Write()
125 {
126 Write(string.Empty);
127 }
128
129 /// <summary>
130 /// Writes the specified MSG.
131 /// </summary>
132 /// <param name="msg">The MSG.</param>
133 public void Write(string msg)
134 {
135 if((m_Target & LogTargets.Null) != 0)
136 {
137 return;
138 }
139
140 if((m_Target & LogTargets.Console) != 0)
141 {
142 Console.WriteLine(msg);
143 }
144 if((m_Target & LogTargets.File) != 0 && m_Writer != null)
145 {
146 m_Writer.WriteLine(msg);
147 }
148 }
149
150 /// <summary>
151 /// Writes the specified format.
152 /// </summary>
153 /// <param name="format">The format.</param>
154 /// <param name="args">The args.</param>
155 public void Write(string format, params object[] args)
156 {
157 Write(string.Format(format,args));
158 }
159
160 /// <summary>
161 /// Writes the specified type.
162 /// </summary>
163 /// <param name="type">The type.</param>
164 /// <param name="format">The format.</param>
165 /// <param name="args">The args.</param>
166 public void Write(LogType type, string format, params object[] args)
167 {
168 if((m_Target & LogTargets.Null) != 0)
169 {
170 return;
171 }
172
173 string str = "";
174 switch(type)
175 {
176 case LogType.Info:
177 str = "[I] ";
178 break;
179 case LogType.Warning:
180 str = "[!] ";
181 break;
182 case LogType.Error:
183 str = "[X] ";
184 break;
185 }
186
187 Write(str + format,args);
188 }
189
190 /// <summary>
191 /// Writes the exception.
192 /// </summary>
193 /// <param name="type">The type.</param>
194 /// <param name="ex">The ex.</param>
195 public void WriteException(LogType type, Exception ex)
196 {
197 if(ex != null)
198 {
199 Write(type, ex.Message);
200 //#if DEBUG
201 m_Writer.WriteLine("Exception @{0} stack trace [[", ex.TargetSite.Name);
202 m_Writer.WriteLine(ex.StackTrace);
203 m_Writer.WriteLine("]]");
204 //#endif
205 }
206 }
207
208 /// <summary>
209 /// Flushes this instance.
210 /// </summary>
211 public void Flush()
212 {
213 if(m_Writer != null)
214 {
215 m_Writer.Flush();
216 }
217 }
218
219 #endregion
220
221 #region IDisposable Members
222
223 /// <summary>
224 /// Performs application-defined tasks associated with freeing, releasing, or
225 /// resetting unmanaged resources.
226 /// </summary>
227 public void Dispose()
228 {
229 Dispose(true);
230 GC.SuppressFinalize(this);
231 }
232
233 /// <summary>
234 /// Dispose objects
235 /// </summary>
236 /// <param name="disposing">
237 /// If true, it will dispose close the handle
238 /// </param>
239 /// <remarks>
240 /// Will dispose managed and unmanaged resources.
241 /// </remarks>
242 protected virtual void Dispose(bool disposing)
243 {
244 if (!this.disposed)
245 {
246 if (disposing)
247 {
248 if (m_Writer != null)
249 {
250 m_Writer.Close();
251 m_Writer = null;
252 }
253 }
254 }
255 this.disposed = true;
256 }
257
258 /// <summary>
259 ///
260 /// </summary>
261 ~Log()
262 {
263 this.Dispose(false);
264 }
265
266 /// <summary>
267 /// Closes and destroys this object
268 /// </summary>
269 /// <remarks>
270 /// Same as Dispose(true)
271 /// </remarks>
272 public void Close()
273 {
274 Dispose();
275 }
276
277 #endregion
278 }
279}
diff --git a/Prebuild/src/Core/WarningException.cs b/Prebuild/src/Core/WarningException.cs
new file mode 100644
index 0000000..a200bdc
--- /dev/null
+++ b/Prebuild/src/Core/WarningException.cs
@@ -0,0 +1,93 @@
1#region BSD License
2/*
3Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com)
4
5Redistribution and use in source and binary forms, with or without modification, are permitted
6provided that the following conditions are met:
7
8* Redistributions of source code must retain the above copyright notice, this list of conditions
9 and the following disclaimer.
10* Redistributions in binary form must reproduce the above copyright notice, this list of conditions
11 and the following disclaimer in the documentation and/or other materials provided with the
12 distribution.
13* The name of the author may not be used to endorse or promote products derived from this software
14 without specific prior written permission.
15
16THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
17BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
19EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
21OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
22IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23*/
24#endregion
25
26#region CVS Information
27/*
28 * $Source$
29 * $Author: jendave $
30 * $Date: 2006-01-28 01:49:58 +0100 (lö, 28 jan 2006) $
31 * $Revision: 71 $
32 */
33#endregion
34
35using System;
36using System.Runtime.Serialization;
37
38namespace Prebuild.Core
39{
40 /// <summary>
41 ///
42 /// </summary>
43 [Serializable()]
44 public class WarningException : Exception
45 {
46 #region Constructors
47
48 /// <summary>
49 ///
50 /// </summary>
51 public WarningException()
52 {
53 }
54
55 /// <summary>
56 ///
57 /// </summary>
58 /// <param name="format"></param>
59 /// <param name="args"></param>
60 public WarningException(string format, params object[] args)
61 : base(String.Format(format, args))
62 {
63 }
64
65 /// <summary>
66 /// Exception with specified string
67 /// </summary>
68 /// <param name="message">Exception message</param>
69 public WarningException(string message): base(message)
70 {
71 }
72
73 /// <summary>
74 ///
75 /// </summary>
76 /// <param name="message"></param>
77 /// <param name="exception"></param>
78 public WarningException(string message, Exception exception) : base(message, exception)
79 {
80 }
81
82 /// <summary>
83 ///
84 /// </summary>
85 /// <param name="info"></param>
86 /// <param name="context"></param>
87 protected WarningException(SerializationInfo info, StreamingContext context) : base( info, context )
88 {
89 }
90
91 #endregion
92 }
93}
diff --git a/Prebuild/src/Prebuild.cs b/Prebuild/src/Prebuild.cs
new file mode 100644
index 0000000..597db68
--- /dev/null
+++ b/Prebuild/src/Prebuild.cs
@@ -0,0 +1,165 @@
1#region BSD License
2/*
3Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com)
4
5Redistribution and use in source and binary forms, with or without modification, are permitted
6provided that the following conditions are met:
7
8* Redistributions of source code must retain the above copyright notice, this list of conditions
9 and the following disclaimer.
10* Redistributions in binary form must reproduce the above copyright notice, this list of conditions
11 and the following disclaimer in the documentation and/or other materials provided with the
12 distribution.
13* The name of the author may not be used to endorse or promote products derived from this software
14 without specific prior written permission.
15
16THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
17BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
19EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
21OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
22IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23*/
24#endregion
25
26#region CVS Information
27/*
28 * $Source$
29 * $Author: jendave $
30 * $Date: 2006-09-26 23:43:35 +0200 (ti, 26 sep 2006) $
31 * $Revision: 168 $
32 */
33#endregion
34
35using System;
36using System.Collections.Specialized;
37using System.IO;
38using System.Reflection;
39using System.Runtime.InteropServices;
40using System.EnterpriseServices.Internal;
41
42using Prebuild.Core;
43using Prebuild.Core.Utilities;
44
45namespace Prebuild
46{
47 /// <summary>
48 ///
49 /// </summary>
50 class Prebuild
51 {
52 #region Main
53
54 [STAThread]
55 static void Main(string[] args)
56 {
57 Kernel kernel = null;
58 try
59 {
60 kernel = Kernel.Instance;
61 kernel.Initialize(LogTargets.File | LogTargets.Console, args);
62 bool exit = false;
63
64 if(kernel.CommandLine.WasPassed("usage"))
65 {
66 exit = true;
67 OutputUsage();
68 }
69 if(kernel.CommandLine.WasPassed("showtargets"))
70 {
71 exit = true;
72 OutputTargets(kernel);
73 }
74 if(kernel.CommandLine.WasPassed("install"))
75 {
76 exit = true;
77 InstallAssembly(kernel);
78 }
79 if(kernel.CommandLine.WasPassed("remove"))
80 {
81 exit = true;
82 RemoveAssembly(kernel);
83 }
84
85 if(!exit)
86 {
87 kernel.Process();
88 }
89 }
90 catch(Exception ex)
91 {
92 Console.WriteLine("Unhandled error: {0}", ex.Message);
93 //#if DEBUG
94 Console.WriteLine("{0}", ex.StackTrace);
95 //#endif
96 }
97 finally
98 {
99 if(kernel.PauseAfterFinish)
100 {
101 Console.WriteLine("\nPress enter to continue...");
102 Console.ReadLine();
103 }
104 }
105 }
106
107 #endregion
108
109 #region Private Methods
110
111 private static void InstallAssembly(Kernel kernel)
112 {
113 Publish publish = new Publish();
114 string file = kernel.CommandLine["install"];
115 //Console.WriteLine(".."+file+"..");
116 publish.GacInstall(file);
117 }
118
119 private static void RemoveAssembly(Kernel kernel)
120 {
121 Publish publish = new Publish();
122 string file = kernel.CommandLine["remove"];
123 publish.GacRemove(file);
124 }
125
126 private static void OutputUsage()
127 {
128 Console.WriteLine("Usage: prebuild /target <target> [options]");
129 Console.WriteLine("Available command-line switches:");
130 Console.WriteLine();
131 Console.WriteLine("/target Target for Prebuild");
132 Console.WriteLine("/clean Clean the build files for the given target");
133 Console.WriteLine("/file XML file to process");
134 Console.WriteLine("/log Log file to write to");
135 Console.WriteLine("/ppo Pre-process the file, but perform no other processing");
136 Console.WriteLine("/pause Pauses the application after execution to view the output");
137 Console.WriteLine("/yes Default to yes to any questions asked");
138 Console.WriteLine("/install Install assembly into the GAC");
139 Console.WriteLine("/remove Remove assembly from the GAC");
140 Console.WriteLine();
141 Console.WriteLine("See 'prebuild /showtargets for a list of available targets");
142 Console.WriteLine("See readme.txt or check out http://dnpb.sourceforge.net for more information");
143 Console.WriteLine();
144 }
145
146 private static void OutputTargets(Kernel kern)
147 {
148 Console.WriteLine("Targets available in Prebuild:");
149 Console.WriteLine("");
150 if(kern.Targets.Keys.Count > 0)
151 {
152 string[] targs = new string[kern.Targets.Keys.Count];
153 kern.Targets.Keys.CopyTo(targs, 0);
154 Array.Sort(targs);
155 foreach(string target in targs)
156 {
157 Console.WriteLine(target);
158 }
159 }
160 Console.WriteLine("");
161 }
162
163 #endregion
164 }
165}
diff --git a/Prebuild/src/Prebuild.csproj b/Prebuild/src/Prebuild.csproj
new file mode 100644
index 0000000..82589c2
--- /dev/null
+++ b/Prebuild/src/Prebuild.csproj
@@ -0,0 +1,199 @@
1<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
2 <PropertyGroup>
3 <ProjectType>Local</ProjectType>
4 <ProductVersion>8.0.50727</ProductVersion>
5 <SchemaVersion>2.0</SchemaVersion>
6 <ProjectGuid>{A5CC8344-BEE4-442E-92F1-FBCB05D6AB78}</ProjectGuid>
7 <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
8 <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
9 <ApplicationIcon>App.ico</ApplicationIcon>
10 <AssemblyKeyContainerName>
11 </AssemblyKeyContainerName>
12 <AssemblyName>prebuild</AssemblyName>
13 <AssemblyOriginatorKeyFile>Prebuild.snk</AssemblyOriginatorKeyFile>
14 <SignAssembly>true</SignAssembly>
15 <DefaultClientScript>JScript</DefaultClientScript>
16 <DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout>
17 <DefaultTargetSchema>IE50</DefaultTargetSchema>
18 <DelaySign>false</DelaySign>
19 <OutputType>Exe</OutputType>
20 <AppDesignerFolder>
21 </AppDesignerFolder>
22 <RootNamespace>Prebuild</RootNamespace>
23 <StartupObject>Prebuild.Prebuild</StartupObject>
24 <FileUpgradeFlags>
25 </FileUpgradeFlags>
26 </PropertyGroup>
27 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
28 <AllowUnsafeBlocks>False</AllowUnsafeBlocks>
29 <BaseAddress>285212672</BaseAddress>
30 <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
31 <ConfigurationOverrideFile>
32 </ConfigurationOverrideFile>
33 <DefineConstants>DEBUG;TRACE</DefineConstants>
34 <DocumentationFile>
35 </DocumentationFile>
36 <DebugSymbols>True</DebugSymbols>
37 <FileAlignment>4096</FileAlignment>
38 <Optimize>False</Optimize>
39 <OutputPath>..\bin\</OutputPath>
40 <RegisterForComInterop>False</RegisterForComInterop>
41 <RemoveIntegerChecks>False</RemoveIntegerChecks>
42 <TreatWarningsAsErrors>False</TreatWarningsAsErrors>
43 <WarningLevel>4</WarningLevel>
44 <NoWarn>1595</NoWarn>
45 </PropertyGroup>
46 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
47 <AllowUnsafeBlocks>False</AllowUnsafeBlocks>
48 <BaseAddress>285212672</BaseAddress>
49 <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
50 <ConfigurationOverrideFile>
51 </ConfigurationOverrideFile>
52 <DefineConstants>TRACE</DefineConstants>
53 <DocumentationFile>
54 </DocumentationFile>
55 <DebugSymbols>False</DebugSymbols>
56 <FileAlignment>4096</FileAlignment>
57 <Optimize>True</Optimize>
58 <OutputPath>..\bin\</OutputPath>
59 <RegisterForComInterop>False</RegisterForComInterop>
60 <RemoveIntegerChecks>False</RemoveIntegerChecks>
61 <TreatWarningsAsErrors>False</TreatWarningsAsErrors>
62 <WarningLevel>4</WarningLevel>
63 <NoWarn>1595</NoWarn>
64 </PropertyGroup>
65 <ItemGroup>
66 </ItemGroup>
67 <ItemGroup>
68 <EmbeddedResource Include="App.ico">
69 </EmbeddedResource>
70 <EmbeddedResource Include="data\prebuild-1.7.xsd">
71 </EmbeddedResource>
72 <Compile Include="Prebuild.cs">
73 <SubType>Code</SubType>
74 </Compile>
75 <Compile Include="Core\FatalException.cs">
76 <SubType>Code</SubType>
77 </Compile>
78 <Compile Include="Core\Kernel.cs">
79 <SubType>Code</SubType>
80 </Compile>
81 <Compile Include="Core\UnknownLanguageException.cs">
82 <SubType>Code</SubType>
83 </Compile>
84 <Compile Include="Core\WarningException.cs">
85 <SubType>Code</SubType>
86 </Compile>
87 <Compile Include="Core\Attributes\DataNodeAttribute.cs">
88 <SubType>Code</SubType>
89 </Compile>
90 <Compile Include="Core\Attributes\OptionNodeAttribute.cs">
91 <SubType>Code</SubType>
92 </Compile>
93 <Compile Include="Core\Attributes\TargetAttribute.cs">
94 <SubType>Code</SubType>
95 </Compile>
96 <Compile Include="Core\Interfaces\IDataNode.cs">
97 <SubType>Code</SubType>
98 </Compile>
99 <Compile Include="Core\Interfaces\ITarget.cs">
100 <SubType>Code</SubType>
101 </Compile>
102 <Compile Include="Core\Nodes\ConfigurationNode.cs">
103 <SubType>Code</SubType>
104 </Compile>
105 <Compile Include="Core\Nodes\DataNode.cs">
106 <SubType>Code</SubType>
107 </Compile>
108 <Compile Include="Core\Nodes\ExcludeNode.cs">
109 <SubType>Code</SubType>
110 </Compile>
111 <Compile Include="Core\Nodes\FileNode.cs">
112 <SubType>Code</SubType>
113 </Compile>
114 <Compile Include="Core\Nodes\FilesNode.cs">
115 <SubType>Code</SubType>
116 </Compile>
117 <Compile Include="Core\Nodes\MatchNode.cs">
118 <SubType>Code</SubType>
119 </Compile>
120 <Compile Include="Core\Nodes\OptionsNode.cs">
121 <SubType>Code</SubType>
122 </Compile>
123 <Compile Include="Core\Nodes\ProcessNode.cs">
124 <SubType>Code</SubType>
125 </Compile>
126 <Compile Include="Core\Nodes\ProjectNode.cs">
127 <SubType>Code</SubType>
128 </Compile>
129 <Compile Include="Core\Nodes\ReferenceNode.cs">
130 <SubType>Code</SubType>
131 </Compile>
132 <Compile Include="Core\Nodes\ReferencePathNode.cs">
133 <SubType>Code</SubType>
134 </Compile>
135 <Compile Include="Core\Nodes\SolutionNode.cs">
136 <SubType>Code</SubType>
137 </Compile>
138 <Compile Include="Core\Parse\IfContext.cs">
139 <SubType>Code</SubType>
140 </Compile>
141 <Compile Include="Core\Parse\Preprocessor.cs">
142 <SubType>Code</SubType>
143 </Compile>
144 <Compile Include="Core\Targets\AutotoolsTarget.cs">
145 <SubType>Code</SubType>
146 </Compile>
147 <Compile Include="Core\Targets\DebugTarget.cs">
148 <SubType>Code</SubType>
149 </Compile>
150 <Compile Include="Core\Targets\MonoDevelopTarget.cs">
151 <SubType>Code</SubType>
152 </Compile>
153 <Compile Include="Core\Targets\NAntTarget.cs">
154 <SubType>Code</SubType>
155 </Compile>
156 <Compile Include="Core\Targets\SharpDevelop2Target.cs">
157 <SubType>Code</SubType>
158 </Compile>
159 <Compile Include="Core\Targets\SharpDevelopTarget.cs">
160 <SubType>Code</SubType>
161 </Compile>
162 <Compile Include="Core\Targets\VS2002Target.cs">
163 <SubType>Code</SubType>
164 </Compile>
165 <Compile Include="Core\Targets\VS2003Target.cs">
166 <SubType>Code</SubType>
167 </Compile>
168 <Compile Include="Core\Targets\VS2005Target.cs">
169 <SubType>Code</SubType>
170 </Compile>
171 <Compile Include="Core\Utilities\CommandLineCollection.cs">
172 <SubType>Code</SubType>
173 </Compile>
174 <Compile Include="Core\Utilities\CurrentDirectory.cs">
175 <SubType>Code</SubType>
176 </Compile>
177 <Compile Include="Core\Utilities\Helper.cs">
178 <SubType>Code</SubType>
179 </Compile>
180 <Compile Include="Core\Utilities\Log.cs">
181 <SubType>Code</SubType>
182 </Compile>
183 <Compile Include="Properties\AssemblyInfo.cs">
184 <SubType>Code</SubType>
185 </Compile>
186 </ItemGroup>
187 <ItemGroup>
188 <Reference Include="System" />
189 <Reference Include="System.EnterpriseServices" />
190 <Reference Include="System.XML" />
191 </ItemGroup>
192 <Import Project="$(MSBuildBinPath)\Microsoft.CSHARP.Targets" />
193 <PropertyGroup>
194 <PreBuildEvent>
195 </PreBuildEvent>
196 <PostBuildEvent>
197 </PostBuildEvent>
198 </PropertyGroup>
199</Project> \ No newline at end of file
diff --git a/Prebuild/src/Prebuild.exe.build b/Prebuild/src/Prebuild.exe.build
new file mode 100644
index 0000000..fda34b9
--- /dev/null
+++ b/Prebuild/src/Prebuild.exe.build
@@ -0,0 +1,80 @@
1<?xml version="1.0" ?>
2<project name="Prebuild" default="build">
3 <target name="build">
4 <echo message="Build Directory is ${project::get-base-directory()}/${build.dir}" />
5 <mkdir dir="${project::get-base-directory()}/${build.dir}" />
6 <copy todir="${project::get-base-directory()}/${build.dir}">
7 <fileset basedir="${project::get-base-directory()}">
8 </fileset>
9 </copy>
10 <csc target="exe" debug="${build.debug}" keyfile="Prebuild.snk" unsafe="False" define="DEBUG;TRACE" output="${project::get-base-directory()}/${build.dir}/${project::get-name()}.exe" win32icon="App.ico">
11 <resources prefix="Prebuild" dynamicprefix="true" >
12 <include name="App.ico" />
13 <include name="data/prebuild-1.7.xsd" />
14 </resources>
15 <sources failonempty="true">
16 <include name="Prebuild.cs" />
17 <include name="Core/FatalException.cs" />
18 <include name="Core/Kernel.cs" />
19 <include name="Core/UnknownLanguageException.cs" />
20 <include name="Core/WarningException.cs" />
21 <include name="Core/Attributes/DataNodeAttribute.cs" />
22 <include name="Core/Attributes/OptionNodeAttribute.cs" />
23 <include name="Core/Attributes/TargetAttribute.cs" />
24 <include name="Core/Interfaces/IDataNode.cs" />
25 <include name="Core/Interfaces/ITarget.cs" />
26 <include name="Core/Nodes/ConfigurationNode.cs" />
27 <include name="Core/Nodes/DataNode.cs" />
28 <include name="Core/Nodes/ExcludeNode.cs" />
29 <include name="Core/Nodes/FileNode.cs" />
30 <include name="Core/Nodes/FilesNode.cs" />
31 <include name="Core/Nodes/MatchNode.cs" />
32 <include name="Core/Nodes/OptionsNode.cs" />
33 <include name="Core/Nodes/ProcessNode.cs" />
34 <include name="Core/Nodes/ProjectNode.cs" />
35 <include name="Core/Nodes/ReferenceNode.cs" />
36 <include name="Core/Nodes/ReferencePathNode.cs" />
37 <include name="Core/Nodes/SolutionNode.cs" />
38 <include name="Core/Parse/IfContext.cs" />
39 <include name="Core/Parse/Preprocessor.cs" />
40 <include name="Core/Targets/AutotoolsTarget.cs" />
41 <include name="Core/Targets/DebugTarget.cs" />
42 <include name="Core/Targets/MonoDevelopTarget.cs" />
43 <include name="Core/Targets/NAntTarget.cs" />
44 <include name="Core/Targets/SharpDevelop2Target.cs" />
45 <include name="Core/Targets/SharpDevelopTarget.cs" />
46 <include name="Core/Targets/VS2002Target.cs" />
47 <include name="Core/Targets/VS2003Target.cs" />
48 <include name="Core/Targets/VS2005Target.cs" />
49 <include name="Core/Utilities/CommandLineCollection.cs" />
50 <include name="Core/Utilities/CurrentDirectory.cs" />
51 <include name="Core/Utilities/Helper.cs" />
52 <include name="Core/Utilities/Log.cs" />
53 <include name="Properties/AssemblyInfo.cs" />
54 </sources>
55 <references basedir="${project::get-base-directory()}">
56 <lib>
57 <include name="${project::get-base-directory()}" />
58 <include name="${project::get-base-directory()}/${build.dir}" />
59 </lib>
60 <include name="System.EnterpriseServices.dll" />
61 <include name="System.Xml.dll" />
62 <include name="System.dll" />
63 </references>
64 </csc>
65 <echo message="Copying from [${project::get-base-directory()}/${build.dir}/] to [${project::get-base-directory()}/../bin/" />
66 <mkdir dir="${project::get-base-directory()}/../bin/"/>
67 <copy todir="${project::get-base-directory()}/../bin/">
68 <fileset basedir="${project::get-base-directory()}/${build.dir}/" >
69 <include name="*.dll"/>
70 <include name="*.exe"/>
71 </fileset>
72 </copy>
73 </target>
74 <target name="clean">
75 <delete dir="${bin.dir}" failonerror="false" />
76 <delete dir="${obj.dir}" failonerror="false" />
77 </target>
78 <target name="doc" description="Creates documentation.">
79 </target>
80</project>
diff --git a/Prebuild/src/Prebuild.snk b/Prebuild/src/Prebuild.snk
new file mode 100644
index 0000000..f9dce05
--- /dev/null
+++ b/Prebuild/src/Prebuild.snk
Binary files differ
diff --git a/Prebuild/src/Properties/AssemblyInfo.cs b/Prebuild/src/Properties/AssemblyInfo.cs
new file mode 100644
index 0000000..bfa9829
--- /dev/null
+++ b/Prebuild/src/Properties/AssemblyInfo.cs
@@ -0,0 +1,101 @@
1#region BSD License
2/*
3Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com)
4
5Redistribution and use in source and binary forms, with or without modification, are permitted
6provided that the following conditions are met:
7
8* Redistributions of source code must retain the above copyright notice, this list of conditions
9 and the following disclaimer.
10* Redistributions in binary form must reproduce the above copyright notice, this list of conditions
11 and the following disclaimer in the documentation and/or other materials provided with the
12 distribution.
13* The name of the author may not be used to endorse or promote products derived from this software
14 without specific prior written permission.
15
16THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
17BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
19EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
21OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
22IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23*/
24#endregion
25
26#region CVS Information
27/*
28 * $Source$
29 * $Author: jendave $
30 * $Date: 2007-01-26 19:31:34 +0100 (fr, 26 jan 2007) $
31 * $Revision: 203 $
32 */
33#endregion
34
35using System;
36using System.Reflection;
37using System.Runtime.CompilerServices;
38using System.Runtime.InteropServices;
39using System.Security.Permissions;
40using System.Resources;
41
42
43// FxCop recommended attributes
44[assembly: ComVisible(false)]
45[assembly: FileIOPermission(SecurityAction.RequestMinimum, Unrestricted=true)]
46[assembly: CLSCompliant(true)]
47
48//
49// General Information about an assembly is controlled through the following
50// set of attributes. Change these attribute values to modify the information
51// associated with an assembly.
52//
53[assembly: AssemblyTitle(".NET Prebuild")]
54[assembly: AssemblyDescription("A .NET project file build tool")]
55[assembly: AssemblyConfiguration(".NET CLR")]
56[assembly: AssemblyCompany("The Prebuild Project")]
57[assembly: AssemblyProduct("")]
58[assembly: AssemblyCopyright("Copyright 2004-2006 Matthew Holmes, Dan Moorehead and David Hudson")]
59[assembly: AssemblyTrademark("")]
60[assembly: AssemblyCulture("")]
61[assembly: NeutralResourcesLanguageAttribute("en-US")]
62[assembly: AssemblyVersion("2.0.0.*")]
63
64//
65// Version information for an assembly consists of the following four values:
66//
67// Major Version
68// Minor Version
69// Build Number
70// Revision
71//
72// You can specify all the values or you can default the Revision and Build Numbers
73// by using the '*' as shown below:
74
75//
76// In order to sign your assembly you must specify a key to use. Refer to the
77// Microsoft .NET Framework documentation for more information on assembly signing.
78//
79// Use the attributes below to control which key is used for signing.
80//
81// Notes:
82// (*) If no key is specified, the assembly is not signed.
83// (*) KeyName refers to a key that has been installed in the Crypto Service
84// Provider (CSP) on your machine. KeyFile refers to a file which contains
85// a key.
86// (*) If the KeyFile and the KeyName values are both specified, the
87// following processing occurs:
88// (1) If the KeyName can be found in the CSP, that key is used.
89// (2) If the KeyName does not exist and the KeyFile does exist, the key
90// in the KeyFile is installed into the CSP and used.
91// (*) In order to create a KeyFile, you can use the sn.exe (Strong Name) utility.
92// When specifying the KeyFile, the location of the KeyFile should be
93// relative to the project output directory which is
94// %Project Directory%\obj\<configuration>. For example, if your KeyFile is
95// located in the project directory, you would specify the AssemblyKeyFile
96// attribute as [assembly: AssemblyKeyFile("..\\..\\mykey.snk")]
97// (*) Delay Signing is an advanced option - see the Microsoft .NET Framework
98// documentation for more information on this.
99//
100[assembly: AssemblyDelaySign(false)]
101[assembly: AssemblyKeyName("")]
diff --git a/Prebuild/src/data/dnpb-1.0.xsd b/Prebuild/src/data/dnpb-1.0.xsd
new file mode 100644
index 0000000..45cab86
--- /dev/null
+++ b/Prebuild/src/data/dnpb-1.0.xsd
@@ -0,0 +1,183 @@
1<?xml version="1.0" encoding="utf-8" ?>
2<xs:schema elementFormDefault="qualified"
3 xmlns:xs="http://www.w3.org/2001/XMLSchema"
4 targetNamespace="http://dnpb.sourceforge.net/schemas/dnpb-1.0.xsd"
5 xmlns="http://dnpb.sourceforge.net/schemas/dnpb-1.0.xsd"
6>
7 <xs:annotation>
8 <xs:documentation>
9 Copyright (c) 2004 Matthew Holmes (kerion@houston.rr.com)
10
11 Redistribution and use in source and binary forms, with or without modification, are permitted
12 provided that the following conditions are met:
13
14 * Redistributions of source code must retain the above copyright notice, this list of conditions
15 and the following disclaimer.
16 * Redistributions in binary form must reproduce the above copyright notice, this list of conditions
17 and the following disclaimer in the documentation and/or other materials provided with the
18 distribution.
19 * The name of the author may not be used to endorse or promote products derived from this software
20 without specific prior written permission.
21
22 THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
23 BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25 EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26 OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
27 OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
28 IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 </xs:documentation>
30 </xs:annotation>
31
32 <xs:element name="DNPreBuild">
33 <xs:complexType>
34 <xs:sequence>
35 <xs:element ref="Process" minOccurs="0" maxOccurs="unbounded" />
36 <xs:element ref="Solution" minOccurs="1" maxOccurs="unbounded" />
37 </xs:sequence>
38
39 <xs:attribute name="version" use="required" />
40 </xs:complexType>
41 </xs:element>
42
43 <xs:element name="Process" type="xs:string" />
44
45 <xs:element name="Solution">
46 <xs:complexType>
47 <xs:sequence>
48 <xs:element ref="Options" minOccurs="0" />
49 <xs:element ref="Configuration" minOccurs="1" maxOccurs="unbounded" />
50 <xs:element ref="Files" minOccurs="0" />
51 <xs:element ref="Project" minOccurs="1" maxOccurs="unbounded" />
52 </xs:sequence>
53
54 <xs:attribute name="name" type="xs:string" use="required" />
55 <xs:attribute name="path" type="xs:string" default="" />
56 </xs:complexType>
57 </xs:element>
58
59 <xs:element name="Project">
60 <xs:complexType>
61 <xs:sequence>
62 <xs:element name="Reference" maxOccurs="unbounded">
63 <xs:complexType>
64 <xs:attribute name="name" type="xs:string" use="required" />
65 <xs:attribute name="path" type="xs:string" />
66 <xs:attribute name="localCopy" type="xs:boolean" />
67 <xs:attribute name="version" type="xs:string" />
68 </xs:complexType>
69 </xs:element>
70
71 <xs:element ref="Files" />
72 </xs:sequence>
73
74 <xs:attribute name="name" type="xs:string" use="required" />
75 <xs:attribute name="path" type="xs:string" default="" />
76
77 <xs:attribute name="language" default="C#">
78 <xs:simpleType>
79 <xs:restriction base="xs:string">
80 <xs:enumeration value="C#" />
81 <xs:enumeration value="VB.NET" />
82 </xs:restriction>
83 </xs:simpleType>
84 </xs:attribute>
85
86 <xs:attribute name="type" default="Exe">
87 <xs:simpleType>
88 <xs:restriction base="xs:string">
89 <xs:enumeration value="Exe" />
90 <xs:enumeration value="WinExe" />
91 <xs:enumeration value="Library" />
92 </xs:restriction>
93 </xs:simpleType>
94 </xs:attribute>
95
96 <xs:attribute name="runtime" default="Microsoft">
97 <xs:simpleType>
98 <xs:restriction base="xs:string">
99 <xs:enumeration value="Microsoft" />
100 <xs:enumeration value="Mono" />
101 </xs:restriction>
102 </xs:simpleType>
103 </xs:attribute>
104
105 <xs:attribute name="startupObject" type="xs:string" default="" />
106 </xs:complexType>
107 </xs:element>
108
109 <xs:element name="Configuration">
110 <xs:complexType>
111 <xs:all>
112 <xs:element ref="Options" minOccurs="0" />
113 </xs:all>
114
115 <xs:attribute name="name" type="xs:string" use="required" />
116 </xs:complexType>
117 </xs:element>
118
119 <xs:element name="Options">
120 <xs:complexType>
121 <xs:sequence>
122 <xs:element name="CompilerDefines" type="xs:string" minOccurs="0" />
123 <xs:element name="OptimizeCode" type="xs:boolean" minOccurs="0" />
124 <xs:element name="CheckUnderflowOverflow" type="xs:boolean" minOccurs="0" />
125 <xs:element name="AllowUnsafe" type="xs:boolean" minOccurs="0" />
126 <xs:element name="WarningLevel" minOccurs="0">
127 <xs:simpleType>
128 <xs:restriction base="xs:integer">
129 <xs:minInclusive value="0" />
130 <xs:maxInclusive value="4"/>
131 </xs:restriction>
132 </xs:simpleType>
133 </xs:element>
134 <xs:element name="WarningsAsErrors" type="xs:boolean" minOccurs="0" />
135 <xs:element name="SupressWarnings" type="xs:string" minOccurs="0" />
136 <xs:element name="OutputPath" type="xs:string" minOccurs="0" />
137 <xs:element name="XmlDocFile" type="xs:string" minOccurs="0" />
138 <xs:element name="DebugInformation" type="xs:boolean" minOccurs="0" />
139 <xs:element name="RegisterCOMInterop" type="xs:boolean" minOccurs="0" />
140 <xs:element name="IncrementalBuild" type="xs:boolean" minOccurs="0" />
141 <xs:element name="BaseAddress" type="xs:string" minOccurs="0" />
142 <xs:element name="FileAlignment" type="xs:integer" minOccurs="0" />
143 <xs:element name="NoStdLib" type="xs:boolean" minOccurs="0" />
144 <xs:element name="ReferencePath" type="xs:string" minOccurs="0" maxOccurs="unbounded" />
145 </xs:sequence>
146 </xs:complexType>
147 </xs:element>
148
149 <xs:element name="Files">
150 <xs:complexType>
151 <xs:sequence>
152 <xs:element ref="File" minOccurs="0" maxOccurs="unbounded" />
153 <xs:element ref="Match" minOccurs="0" maxOccurs="unbounded" />
154 </xs:sequence>
155 </xs:complexType>
156 </xs:element>
157
158 <xs:element name="File">
159 <xs:complexType>
160 <xs:simpleContent>
161 <xs:extension base="xs:string">
162 <xs:attribute name="buildAction" default="Compile">
163 <xs:simpleType>
164 <xs:restriction base="xs:string">
165 <xs:enumeration value="Compile" />
166 <xs:enumeration value="Content" />
167 <xs:enumeration value="EmbeddedResource" />
168 </xs:restriction>
169 </xs:simpleType>
170 </xs:attribute>
171 </xs:extension>
172 </xs:simpleContent>
173 </xs:complexType>
174 </xs:element>
175
176 <xs:element name="Match">
177 <xs:complexType>
178 <xs:attribute name="path" type="xs:string" use="required" />
179 <xs:attribute name="pattern" type="xs:string" use="required" />
180 <xs:attribute name="recurse" type="xs:boolean" default="false" />
181 </xs:complexType>
182 </xs:element>
183</xs:schema> \ 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..c402ceb
--- /dev/null
+++ b/Prebuild/src/data/dnpb-1.1.xsd
@@ -0,0 +1,184 @@
1<?xml version="1.0" encoding="utf-8" ?>
2<xs:schema elementFormDefault="qualified"
3 xmlns:xs="http://www.w3.org/2001/XMLSchema"
4 targetNamespace="http://dnpb.sourceforge.net/schemas/dnpb-1.1.xsd"
5 xmlns="http://dnpb.sourceforge.net/schemas/dnpb-1.1.xsd"
6>
7 <xs:annotation>
8 <xs:documentation>
9 Copyright (c) 2004 Matthew Holmes (kerion@houston.rr.com)
10
11 Redistribution and use in source and binary forms, with or without modification, are permitted
12 provided that the following conditions are met:
13
14 * Redistributions of source code must retain the above copyright notice, this list of conditions
15 and the following disclaimer.
16 * Redistributions in binary form must reproduce the above copyright notice, this list of conditions
17 and the following disclaimer in the documentation and/or other materials provided with the
18 distribution.
19 * The name of the author may not be used to endorse or promote products derived from this software
20 without specific prior written permission.
21
22 THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
23 BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25 EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26 OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
27 OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
28 IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 </xs:documentation>
30 </xs:annotation>
31
32 <xs:element name="DNPreBuild">
33 <xs:complexType>
34 <xs:sequence>
35 <xs:element ref="Process" minOccurs="0" maxOccurs="unbounded" />
36 <xs:element ref="Solution" minOccurs="1" maxOccurs="unbounded" />
37 </xs:sequence>
38
39 <xs:attribute name="version" use="required" />
40 </xs:complexType>
41 </xs:element>
42
43 <xs:element name="Process" type="xs:string" />
44
45 <xs:element name="Solution">
46 <xs:complexType>
47 <xs:sequence>
48 <xs:element ref="Options" minOccurs="0" />
49 <xs:element ref="Configuration" minOccurs="1" maxOccurs="unbounded" />
50 <xs:element ref="Files" minOccurs="0" />
51 <xs:element ref="Project" minOccurs="1" maxOccurs="unbounded" />
52 </xs:sequence>
53
54 <xs:attribute name="name" type="xs:string" use="required" />
55 <xs:attribute name="path" type="xs:string" default="" />
56 </xs:complexType>
57 </xs:element>
58
59 <xs:element name="Project">
60 <xs:complexType>
61 <xs:sequence>
62 <xs:element name="ReferencePath" type="xs:string" minOccurs="0" maxOccurs="unbounded" />
63
64 <xs:element name="Reference" maxOccurs="unbounded">
65 <xs:complexType>
66 <xs:attribute name="name" type="xs:string" use="required" />
67 <xs:attribute name="path" type="xs:string" />
68 <xs:attribute name="localCopy" type="xs:boolean" />
69 <xs:attribute name="version" type="xs:string" />
70 </xs:complexType>
71 </xs:element>
72
73 <xs:element ref="Files" />
74 </xs:sequence>
75
76 <xs:attribute name="name" type="xs:string" use="required" />
77 <xs:attribute name="path" type="xs:string" default="" />
78
79 <xs:attribute name="language" default="C#">
80 <xs:simpleType>
81 <xs:restriction base="xs:string">
82 <xs:enumeration value="C#" />
83 <xs:enumeration value="VB.NET" />
84 </xs:restriction>
85 </xs:simpleType>
86 </xs:attribute>
87
88 <xs:attribute name="type" default="Exe">
89 <xs:simpleType>
90 <xs:restriction base="xs:string">
91 <xs:enumeration value="Exe" />
92 <xs:enumeration value="WinExe" />
93 <xs:enumeration value="Library" />
94 </xs:restriction>
95 </xs:simpleType>
96 </xs:attribute>
97
98 <xs:attribute name="runtime" default="Microsoft">
99 <xs:simpleType>
100 <xs:restriction base="xs:string">
101 <xs:enumeration value="Microsoft" />
102 <xs:enumeration value="Mono" />
103 </xs:restriction>
104 </xs:simpleType>
105 </xs:attribute>
106
107 <xs:attribute name="startupObject" type="xs:string" default="" />
108 </xs:complexType>
109 </xs:element>
110
111 <xs:element name="Configuration">
112 <xs:complexType>
113 <xs:all>
114 <xs:element ref="Options" minOccurs="0" />
115 </xs:all>
116
117 <xs:attribute name="name" type="xs:string" use="required" />
118 </xs:complexType>
119 </xs:element>
120
121 <xs:element name="Options">
122 <xs:complexType>
123 <xs:sequence>
124 <xs:element name="CompilerDefines" type="xs:string" minOccurs="0" />
125 <xs:element name="OptimizeCode" type="xs:boolean" minOccurs="0" />
126 <xs:element name="CheckUnderflowOverflow" type="xs:boolean" minOccurs="0" />
127 <xs:element name="AllowUnsafe" type="xs:boolean" minOccurs="0" />
128 <xs:element name="WarningLevel" minOccurs="0">
129 <xs:simpleType>
130 <xs:restriction base="xs:integer">
131 <xs:minInclusive value="0" />
132 <xs:maxInclusive value="4"/>
133 </xs:restriction>
134 </xs:simpleType>
135 </xs:element>
136 <xs:element name="WarningsAsErrors" type="xs:boolean" minOccurs="0" />
137 <xs:element name="SupressWarnings" type="xs:string" minOccurs="0" />
138 <xs:element name="OutputPath" type="xs:string" minOccurs="0" />
139 <xs:element name="XmlDocFile" type="xs:string" minOccurs="0" />
140 <xs:element name="DebugInformation" type="xs:boolean" minOccurs="0" />
141 <xs:element name="RegisterCOMInterop" type="xs:boolean" minOccurs="0" />
142 <xs:element name="IncrementalBuild" type="xs:boolean" minOccurs="0" />
143 <xs:element name="BaseAddress" type="xs:string" minOccurs="0" />
144 <xs:element name="FileAlignment" type="xs:integer" minOccurs="0" />
145 <xs:element name="NoStdLib" type="xs:boolean" minOccurs="0" />
146 </xs:sequence>
147 </xs:complexType>
148 </xs:element>
149
150 <xs:element name="Files">
151 <xs:complexType>
152 <xs:sequence>
153 <xs:element ref="File" minOccurs="0" maxOccurs="unbounded" />
154 <xs:element ref="Match" minOccurs="0" maxOccurs="unbounded" />
155 </xs:sequence>
156 </xs:complexType>
157 </xs:element>
158
159 <xs:element name="File">
160 <xs:complexType>
161 <xs:simpleContent>
162 <xs:extension base="xs:string">
163 <xs:attribute name="buildAction" default="Compile">
164 <xs:simpleType>
165 <xs:restriction base="xs:string">
166 <xs:enumeration value="Compile" />
167 <xs:enumeration value="Content" />
168 <xs:enumeration value="EmbeddedResource" />
169 </xs:restriction>
170 </xs:simpleType>
171 </xs:attribute>
172 </xs:extension>
173 </xs:simpleContent>
174 </xs:complexType>
175 </xs:element>
176
177 <xs:element name="Match">
178 <xs:complexType>
179 <xs:attribute name="path" type="xs:string" use="required" />
180 <xs:attribute name="pattern" type="xs:string" use="required" />
181 <xs:attribute name="recurse" type="xs:boolean" default="false" />
182 </xs:complexType>
183 </xs:element>
184</xs:schema> \ 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..8004af7
--- /dev/null
+++ b/Prebuild/src/data/dnpb-1.2.xsd
@@ -0,0 +1,198 @@
1<?xml version="1.0" encoding="utf-8" ?>
2<xs:schema elementFormDefault="qualified"
3 xmlns:xs="http://www.w3.org/2001/XMLSchema"
4 targetNamespace="http://dnpb.sourceforge.net/schemas/dnpb-1.2.xsd"
5 xmlns="http://dnpb.sourceforge.net/schemas/dnpb-1.2.xsd"
6>
7 <xs:annotation>
8 <xs:documentation>
9 Copyright (c) 2004 Matthew Holmes (calefaction _at_ houston _._ rr _._ com)
10
11 Redistribution and use in source and binary forms, with or without modification, are permitted
12 provided that the following conditions are met:
13
14 * Redistributions of source code must retain the above copyright notice, this list of conditions
15 and the following disclaimer.
16 * Redistributions in binary form must reproduce the above copyright notice, this list of conditions
17 and the following disclaimer in the documentation and/or other materials provided with the
18 distribution.
19 * The name of the author may not be used to endorse or promote products derived from this software
20 without specific prior written permission.
21
22 THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
23 BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25 EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26 OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
27 OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
28 IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 </xs:documentation>
30 </xs:annotation>
31
32 <xs:element name="DNPreBuild">
33 <xs:complexType>
34 <xs:sequence>
35 <xs:element ref="Process" minOccurs="0" maxOccurs="unbounded" />
36 <xs:element ref="Solution" minOccurs="0" maxOccurs="unbounded" />
37 </xs:sequence>
38
39 <xs:attribute name="version" use="required" />
40 </xs:complexType>
41 </xs:element>
42
43 <xs:element name="Process" type="xs:string" />
44
45 <xs:element name="Solution">
46 <xs:complexType>
47 <xs:sequence>
48 <xs:element ref="Options" minOccurs="0" />
49 <xs:element ref="Configuration" minOccurs="1" maxOccurs="unbounded" />
50 <xs:element ref="Files" minOccurs="0" />
51 <xs:element ref="Project" minOccurs="1" maxOccurs="unbounded" />
52 </xs:sequence>
53
54 <xs:attribute name="name" type="xs:string" use="required" />
55 <xs:attribute name="path" type="xs:string" default="" />
56 </xs:complexType>
57 </xs:element>
58
59 <xs:element name="Project">
60 <xs:complexType>
61 <xs:sequence>
62 <xs:element ref="Configuration" minOccurs="0" maxOccurs="unbounded" />
63
64 <xs:element name="ReferencePath" type="xs:string" minOccurs="0" maxOccurs="unbounded" />
65
66 <xs:element name="Reference" minOccurs="0" maxOccurs="unbounded">
67 <xs:complexType>
68 <xs:attribute name="name" type="xs:string" use="required" />
69 <xs:attribute name="path" type="xs:string" />
70 <xs:attribute name="localCopy" type="xs:boolean" />
71 <xs:attribute name="version" type="xs:string" />
72 </xs:complexType>
73 </xs:element>
74
75 <xs:element ref="Files" />
76 </xs:sequence>
77
78 <xs:attribute name="name" type="xs:string" use="required" />
79 <xs:attribute name="path" type="xs:string" default="" />
80
81 <xs:attribute name="language" default="C#">
82 <xs:simpleType>
83 <xs:restriction base="xs:string">
84 <xs:enumeration value="C#" />
85 <xs:enumeration value="VB.NET" />
86 </xs:restriction>
87 </xs:simpleType>
88 </xs:attribute>
89
90 <xs:attribute name="type" default="Exe">
91 <xs:simpleType>
92 <xs:restriction base="xs:string">
93 <xs:enumeration value="Exe" />
94 <xs:enumeration value="WinExe" />
95 <xs:enumeration value="Library" />
96 </xs:restriction>
97 </xs:simpleType>
98 </xs:attribute>
99
100 <xs:attribute name="runtime" default="Microsoft">
101 <xs:simpleType>
102 <xs:restriction base="xs:string">
103 <xs:enumeration value="Microsoft" />
104 <xs:enumeration value="Mono" />
105 </xs:restriction>
106 </xs:simpleType>
107 </xs:attribute>
108
109 <xs:attribute name="startupObject" type="xs:string" default="" />
110 <xs:attribute name="rootNamespace" type="xs:string" />
111 <xs:attribute name="assemblyName" type="xs:string" />
112 </xs:complexType>
113 </xs:element>
114
115 <xs:element name="Configuration">
116 <xs:complexType>
117 <xs:all>
118 <xs:element ref="Options" minOccurs="0" />
119 </xs:all>
120
121 <xs:attribute name="name" type="xs:string" use="required" />
122 </xs:complexType>
123 </xs:element>
124
125 <xs:element name="Options">
126 <xs:complexType>
127 <xs:all>
128 <xs:element name="CompilerDefines" type="xs:string" minOccurs="0" />
129 <xs:element name="OptimizeCode" type="xs:boolean" minOccurs="0" />
130 <xs:element name="CheckUnderflowOverflow" type="xs:boolean" minOccurs="0" />
131 <xs:element name="AllowUnsafe" type="xs:boolean" minOccurs="0" />
132 <xs:element name="WarningLevel" minOccurs="0">
133 <xs:simpleType>
134 <xs:restriction base="xs:integer">
135 <xs:minInclusive value="0" />
136 <xs:maxInclusive value="4"/>
137 </xs:restriction>
138 </xs:simpleType>
139 </xs:element>
140 <xs:element name="WarningsAsErrors" type="xs:boolean" minOccurs="0" />
141 <xs:element name="SupressWarnings" type="xs:string" minOccurs="0" />
142 <xs:element name="OutputPath" type="xs:string" minOccurs="0" />
143 <xs:element name="XmlDocFile" type="xs:string" minOccurs="0" />
144 <xs:element name="DebugInformation" type="xs:boolean" minOccurs="0" />
145 <xs:element name="RegisterCOMInterop" type="xs:boolean" minOccurs="0" />
146 <xs:element name="IncrementalBuild" type="xs:boolean" minOccurs="0" />
147 <xs:element name="BaseAddress" type="xs:string" minOccurs="0" />
148 <xs:element name="FileAlignment" type="xs:integer" minOccurs="0" />
149 <xs:element name="NoStdLib" type="xs:boolean" minOccurs="0" />
150 </xs:all>
151 </xs:complexType>
152 </xs:element>
153
154 <xs:element name="Files">
155 <xs:complexType>
156 <xs:sequence>
157 <xs:element ref="File" minOccurs="0" maxOccurs="unbounded" />
158 <xs:element ref="Match" minOccurs="0" maxOccurs="unbounded" />
159 </xs:sequence>
160 </xs:complexType>
161 </xs:element>
162
163 <xs:element name="File">
164 <xs:complexType>
165 <xs:simpleContent>
166 <xs:extension base="xs:string">
167 <xs:attribute name="buildAction" default="Compile">
168 <xs:simpleType>
169 <xs:restriction base="xs:string">
170 <xs:enumeration value="Compile" />
171 <xs:enumeration value="Content" />
172 <xs:enumeration value="EmbeddedResource" />
173 </xs:restriction>
174 </xs:simpleType>
175 </xs:attribute>
176 </xs:extension>
177 </xs:simpleContent>
178 </xs:complexType>
179 </xs:element>
180
181 <xs:element name="Match">
182 <xs:complexType>
183 <xs:attribute name="path" type="xs:string" use="required" />
184 <xs:attribute name="pattern" type="xs:string" use="required" />
185 <xs:attribute name="recurse" type="xs:boolean" default="false" />
186 <xs:attribute name="useRegex" type="xs:boolean" default="false" />
187 <xs:attribute name="buildAction" default="Compile">
188 <xs:simpleType>
189 <xs:restriction base="xs:string">
190 <xs:enumeration value="Compile" />
191 <xs:enumeration value="Content" />
192 <xs:enumeration value="EmbeddedResource" />
193 </xs:restriction>
194 </xs:simpleType>
195 </xs:attribute>
196 </xs:complexType>
197 </xs:element>
198</xs:schema> \ 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..5f8ada1
--- /dev/null
+++ b/Prebuild/src/data/dnpb-1.3.xsd
@@ -0,0 +1,206 @@
1<?xml version="1.0" encoding="utf-8" ?>
2<xs:schema elementFormDefault="qualified"
3 xmlns:xs="http://www.w3.org/2001/XMLSchema"
4 targetNamespace="http://dnpb.sourceforge.net/schemas/dnpb-1.3.xsd"
5 xmlns="http://dnpb.sourceforge.net/schemas/dnpb-1.3.xsd"
6>
7 <xs:annotation>
8 <xs:documentation>
9 Copyright (c) 2004-2005 Matthew Holmes (calefaction at houston . rr . com), Dan Moorehead (dan05a at gmail . com)
10
11 .NET Pre-Build is an XML-driven pre-build tool allowing developers to
12 easily generate project or make files for major IDE's and .NET
13 development tools including: Visual Studio 2003, Visual Studio 2002,
14 SharpDevelop, MonoDevelop, and NAnt.
15
16 BSD License:
17
18 Redistribution and use in source and binary forms, with or without modification, are permitted
19 provided that the following conditions are met:
20
21 * Redistributions of source code must retain the above copyright notice, this list of conditions
22 and the following disclaimer.
23 * Redistributions in binary form must reproduce the above copyright notice, this list of conditions
24 and the following disclaimer in the documentation and/or other materials provided with the
25 distribution.
26 * The name of the author may not be used to endorse or promote products derived from this software
27 without specific prior written permission.
28
29 THIS SOFTWARE IS PROVIDED BY THE AUTHOR 'AS IS' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
30 BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
31 ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
32 EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
33 OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
34 OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
35 IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36 </xs:documentation>
37 </xs:annotation>
38
39 <xs:element name="DNPreBuild">
40 <xs:complexType>
41 <xs:sequence>
42 <xs:element ref="Process" minOccurs="0" maxOccurs="unbounded" />
43 <xs:element ref="Solution" minOccurs="0" maxOccurs="unbounded" />
44 </xs:sequence>
45
46 <xs:attribute name="version" use="required" />
47 </xs:complexType>
48 </xs:element>
49
50 <xs:element name="Process" type="xs:string" />
51
52 <xs:element name="Solution">
53 <xs:complexType>
54 <xs:sequence>
55 <xs:element ref="Options" minOccurs="0" />
56 <xs:element ref="Configuration" minOccurs="1" maxOccurs="unbounded" />
57 <xs:element ref="Files" minOccurs="0" />
58 <xs:element ref="Project" minOccurs="1" maxOccurs="unbounded" />
59 </xs:sequence>
60
61 <xs:attribute name="name" type="xs:string" use="required" />
62 <xs:attribute name="path" type="xs:string" default="" />
63 </xs:complexType>
64 </xs:element>
65
66 <xs:element name="Project">
67 <xs:complexType>
68 <xs:sequence>
69 <xs:element ref="Configuration" minOccurs="0" maxOccurs="unbounded" />
70
71 <xs:element name="ReferencePath" type="xs:string" minOccurs="0" maxOccurs="unbounded" />
72
73 <xs:element name="Reference" minOccurs="0" maxOccurs="unbounded">
74 <xs:complexType>
75 <xs:attribute name="name" type="xs:string" use="required" />
76 <xs:attribute name="path" type="xs:string" />
77 <xs:attribute name="localCopy" type="xs:boolean" />
78 <xs:attribute name="version" type="xs:string" />
79 </xs:complexType>
80 </xs:element>
81
82 <xs:element ref="Files" />
83 </xs:sequence>
84
85 <xs:attribute name="name" type="xs:string" use="required" />
86 <xs:attribute name="path" type="xs:string" default="" />
87 <xs:attribute name="icon" type="xs:string" default="" />
88
89 <xs:attribute name="language" default="C#">
90 <xs:simpleType>
91 <xs:restriction base="xs:string">
92 <xs:enumeration value="C#" />
93 <xs:enumeration value="VB.NET" />
94 </xs:restriction>
95 </xs:simpleType>
96 </xs:attribute>
97
98 <xs:attribute name="type" default="Exe">
99 <xs:simpleType>
100 <xs:restriction base="xs:string">
101 <xs:enumeration value="Exe" />
102 <xs:enumeration value="WinExe" />
103 <xs:enumeration value="Library" />
104 </xs:restriction>
105 </xs:simpleType>
106 </xs:attribute>
107
108 <xs:attribute name="runtime" default="Microsoft">
109 <xs:simpleType>
110 <xs:restriction base="xs:string">
111 <xs:enumeration value="Microsoft" />
112 <xs:enumeration value="Mono" />
113 </xs:restriction>
114 </xs:simpleType>
115 </xs:attribute>
116
117 <xs:attribute name="startupObject" type="xs:string" default="" />
118 <xs:attribute name="rootNamespace" type="xs:string" />
119 <xs:attribute name="assemblyName" type="xs:string" />
120 </xs:complexType>
121 </xs:element>
122
123 <xs:element name="Configuration">
124 <xs:complexType>
125 <xs:all>
126 <xs:element ref="Options" minOccurs="0" />
127 </xs:all>
128
129 <xs:attribute name="name" type="xs:string" use="required" />
130 </xs:complexType>
131 </xs:element>
132
133 <xs:element name="Options">
134 <xs:complexType>
135 <xs:all>
136 <xs:element name="CompilerDefines" type="xs:string" minOccurs="0" />
137 <xs:element name="OptimizeCode" type="xs:boolean" minOccurs="0" />
138 <xs:element name="CheckUnderflowOverflow" type="xs:boolean" minOccurs="0" />
139 <xs:element name="AllowUnsafe" type="xs:boolean" minOccurs="0" />
140 <xs:element name="WarningLevel" minOccurs="0">
141 <xs:simpleType>
142 <xs:restriction base="xs:integer">
143 <xs:minInclusive value="0" />
144 <xs:maxInclusive value="4"/>
145 </xs:restriction>
146 </xs:simpleType>
147 </xs:element>
148 <xs:element name="WarningsAsErrors" type="xs:boolean" minOccurs="0" />
149 <xs:element name="SupressWarnings" type="xs:string" minOccurs="0" />
150 <xs:element name="OutputPath" type="xs:string" minOccurs="0" />
151 <xs:element name="XmlDocFile" type="xs:string" minOccurs="0" />
152 <xs:element name="DebugInformation" type="xs:boolean" minOccurs="0" />
153 <xs:element name="RegisterCOMInterop" type="xs:boolean" minOccurs="0" />
154 <xs:element name="IncrementalBuild" type="xs:boolean" minOccurs="0" />
155 <xs:element name="BaseAddress" type="xs:string" minOccurs="0" />
156 <xs:element name="FileAlignment" type="xs:integer" minOccurs="0" />
157 <xs:element name="NoStdLib" type="xs:boolean" minOccurs="0" />
158 </xs:all>
159 </xs:complexType>
160 </xs:element>
161
162 <xs:element name="Files">
163 <xs:complexType>
164 <xs:sequence>
165 <xs:element ref="File" minOccurs="0" maxOccurs="unbounded" />
166 <xs:element ref="Match" minOccurs="0" maxOccurs="unbounded" />
167 </xs:sequence>
168 </xs:complexType>
169 </xs:element>
170
171 <xs:element name="File">
172 <xs:complexType>
173 <xs:simpleContent>
174 <xs:extension base="xs:string">
175 <xs:attribute name="buildAction" default="Compile">
176 <xs:simpleType>
177 <xs:restriction base="xs:string">
178 <xs:enumeration value="Compile" />
179 <xs:enumeration value="Content" />
180 <xs:enumeration value="EmbeddedResource" />
181 </xs:restriction>
182 </xs:simpleType>
183 </xs:attribute>
184 </xs:extension>
185 </xs:simpleContent>
186 </xs:complexType>
187 </xs:element>
188
189 <xs:element name="Match">
190 <xs:complexType>
191 <xs:attribute name="path" type="xs:string" />
192 <xs:attribute name="pattern" type="xs:string" use="required" />
193 <xs:attribute name="recurse" type="xs:boolean" default="false" />
194 <xs:attribute name="useRegex" type="xs:boolean" default="false" />
195 <xs:attribute name="buildAction" default="Compile">
196 <xs:simpleType>
197 <xs:restriction base="xs:string">
198 <xs:enumeration value="Compile" />
199 <xs:enumeration value="Content" />
200 <xs:enumeration value="EmbeddedResource" />
201 </xs:restriction>
202 </xs:simpleType>
203 </xs:attribute>
204 </xs:complexType>
205 </xs:element>
206</xs:schema> \ 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..54f9ac0
--- /dev/null
+++ b/Prebuild/src/data/dnpb-1.4.xsd
@@ -0,0 +1,212 @@
1<?xml version="1.0" encoding="utf-8" ?>
2<xs:schema elementFormDefault="qualified"
3 xmlns:xs="http://www.w3.org/2001/XMLSchema"
4 targetNamespace="http://dnpb.sourceforge.net/schemas/dnpb-1.4.xsd"
5 xmlns="http://dnpb.sourceforge.net/schemas/dnpb-1.4.xsd"
6>
7 <xs:annotation>
8 <xs:documentation>
9 Copyright (c) 2004-2005 Matthew Holmes (calefaction at houston . rr . com), Dan Moorehead (dan05a at gmail . com)
10
11 .NET Prebuild is a cross-platform XML-driven pre-build tool which
12 allows developers to easily generate project or make files for major
13 IDE's and .NET development tools including: Visual Studio .NET 2002 and
14 2003, SharpDevelop, MonoDevelop, and NAnt.
15
16 BSD License:
17
18 Redistribution and use in source and binary forms, with or without modification, are permitted
19 provided that the following conditions are met:
20
21 * Redistributions of source code must retain the above copyright notice, this list of conditions
22 and the following disclaimer.
23 * Redistributions in binary form must reproduce the above copyright notice, this list of conditions
24 and the following disclaimer in the documentation and/or other materials provided with the
25 distribution.
26 * The name of the author may not be used to endorse or promote products derived from this software
27 without specific prior written permission.
28
29 THIS SOFTWARE IS PROVIDED BY THE AUTHOR 'AS IS' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
30 BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
31 ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
32 EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
33 OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
34 OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
35 IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36 </xs:documentation>
37 </xs:annotation>
38
39 <xs:element name="DNPreBuild">
40 <xs:complexType>
41 <xs:sequence>
42 <xs:element ref="Process" minOccurs="0" maxOccurs="unbounded" />
43 <xs:element ref="Solution" minOccurs="0" maxOccurs="unbounded" />
44 </xs:sequence>
45
46 <xs:attribute name="version" />
47 <xs:attribute name="checkOsVars" />
48 </xs:complexType>
49 </xs:element>
50
51 <xs:element name="Process" type="xs:string" />
52
53 <xs:element name="Solution">
54 <xs:complexType>
55 <xs:sequence>
56 <xs:element ref="Options" minOccurs="0" />
57 <xs:element ref="Configuration" minOccurs="1" maxOccurs="unbounded" />
58 <xs:element ref="Files" minOccurs="0" />
59 <xs:element ref="Project" minOccurs="1" maxOccurs="unbounded" />
60 </xs:sequence>
61
62 <xs:attribute name="name" type="xs:string" use="required" />
63 <xs:attribute name="activeConfig" type="xs:string" default="Debug" />
64 <xs:attribute name="path" type="xs:string" default="" />
65 </xs:complexType>
66 </xs:element>
67
68 <xs:element name="Project">
69 <xs:complexType>
70 <xs:sequence>
71 <xs:element ref="Configuration" minOccurs="0" maxOccurs="unbounded" />
72
73 <xs:element name="ReferencePath" type="xs:string" minOccurs="0" maxOccurs="unbounded" />
74
75 <xs:element name="Reference" minOccurs="0" maxOccurs="unbounded">
76 <xs:complexType>
77 <xs:attribute name="name" type="xs:string" use="required" />
78 <xs:attribute name="path" type="xs:string" />
79 <xs:attribute name="localCopy" type="xs:boolean" />
80 <xs:attribute name="version" type="xs:string" />
81 </xs:complexType>
82 </xs:element>
83
84 <xs:element ref="Files" />
85 </xs:sequence>
86
87 <xs:attribute name="name" type="xs:string" use="required" />
88 <xs:attribute name="path" type="xs:string" default="" />
89 <xs:attribute name="icon" type="xs:string" default="" />
90
91 <xs:attribute name="language" default="C#">
92 <xs:simpleType>
93 <xs:restriction base="xs:string">
94 <xs:enumeration value="C#" />
95 <xs:enumeration value="VB.NET" />
96 </xs:restriction>
97 </xs:simpleType>
98 </xs:attribute>
99
100 <xs:attribute name="type" default="Exe">
101 <xs:simpleType>
102 <xs:restriction base="xs:string">
103 <xs:enumeration value="Exe" />
104 <xs:enumeration value="WinExe" />
105 <xs:enumeration value="Library" />
106 </xs:restriction>
107 </xs:simpleType>
108 </xs:attribute>
109
110 <xs:attribute name="runtime" default="Microsoft">
111 <xs:simpleType>
112 <xs:restriction base="xs:string">
113 <xs:enumeration value="Microsoft" />
114 <xs:enumeration value="Mono" />
115 </xs:restriction>
116 </xs:simpleType>
117 </xs:attribute>
118
119 <xs:attribute name="startupObject" type="xs:string" default="" />
120 <xs:attribute name="rootNamespace" type="xs:string" />
121 <xs:attribute name="assemblyName" type="xs:string" />
122 </xs:complexType>
123 </xs:element>
124
125 <xs:element name="Configuration">
126 <xs:complexType>
127 <xs:sequence>
128 <xs:element ref="Options" minOccurs="0" />
129 </xs:sequence>
130
131 <xs:attribute name="name" type="xs:string" use="required" />
132 </xs:complexType>
133 </xs:element>
134
135 <xs:element name="Options">
136 <xs:complexType>
137 <xs:all>
138 <xs:element name="CompilerDefines" type="xs:string" minOccurs="0" />
139 <xs:element name="OptimizeCode" type="xs:boolean" minOccurs="0" />
140 <xs:element name="CheckUnderflowOverflow" type="xs:boolean" minOccurs="0" />
141 <xs:element name="AllowUnsafe" type="xs:boolean" minOccurs="0" />
142 <xs:element name="WarningLevel" minOccurs="0">
143 <xs:simpleType>
144 <xs:restriction base="xs:integer">
145 <xs:minInclusive value="0" />
146 <xs:maxInclusive value="4"/>
147 </xs:restriction>
148 </xs:simpleType>
149 </xs:element>
150 <xs:element name="WarningsAsErrors" type="xs:boolean" minOccurs="0" />
151 <xs:element name="SupressWarnings" type="xs:string" minOccurs="0" />
152 <xs:element name="OutputPath" type="xs:string" minOccurs="0" />
153 <xs:element name="XmlDocFile" type="xs:string" minOccurs="0" />
154 <xs:element name="DebugInformation" type="xs:boolean" minOccurs="0" />
155 <xs:element name="RegisterCOMInterop" type="xs:boolean" minOccurs="0" />
156 <xs:element name="IncrementalBuild" type="xs:boolean" minOccurs="0" />
157 <xs:element name="BaseAddress" type="xs:string" minOccurs="0" />
158 <xs:element name="FileAlignment" type="xs:integer" minOccurs="0" />
159 <xs:element name="NoStdLib" type="xs:boolean" minOccurs="0" />
160 </xs:all>
161 </xs:complexType>
162 </xs:element>
163
164 <xs:element name="Files">
165 <xs:complexType>
166 <xs:sequence>
167 <xs:element ref="File" minOccurs="0" maxOccurs="unbounded" />
168 <xs:element ref="Match" minOccurs="0" maxOccurs="unbounded" />
169 </xs:sequence>
170 </xs:complexType>
171 </xs:element>
172
173 <xs:element name="File">
174 <xs:complexType>
175 <xs:simpleContent>
176 <xs:extension base="xs:string">
177 <xs:attribute name="buildAction" default="Compile">
178 <xs:simpleType>
179 <xs:restriction base="xs:string">
180 <xs:enumeration value="None" />
181 <xs:enumeration value="Compile" />
182 <xs:enumeration value="Content" />
183 <xs:enumeration value="EmbeddedResource" />
184 </xs:restriction>
185 </xs:simpleType>
186 </xs:attribute>
187 </xs:extension>
188 </xs:simpleContent>
189 </xs:complexType>
190 </xs:element>
191
192 <xs:element name="Match">
193 <xs:complexType>
194 <xs:attribute name="path" type="xs:string" />
195 <xs:attribute name="pattern" type="xs:string" use="required" />
196 <xs:attribute name="recurse" type="xs:boolean" default="false" />
197 <xs:attribute name="useRegex" type="xs:boolean" default="false" />
198 <xs:attribute name="buildAction" default="Compile">
199 <xs:simpleType>
200 <xs:restriction base="xs:string">
201 <xs:enumeration value="None" />
202 <xs:enumeration value="Compile" />
203 <xs:enumeration value="Content" />
204 <xs:enumeration value="EmbeddedResource" />
205 </xs:restriction>
206 </xs:simpleType>
207 </xs:attribute>
208 </xs:complexType>
209 </xs:element>
210</xs:schema>
211
212
diff --git a/Prebuild/src/data/dnpb-1.5.xsd b/Prebuild/src/data/dnpb-1.5.xsd
new file mode 100644
index 0000000..2270e83
--- /dev/null
+++ b/Prebuild/src/data/dnpb-1.5.xsd
@@ -0,0 +1,215 @@
1<?xml version="1.0" encoding="utf-8" ?>
2<xs:schema elementFormDefault="qualified"
3 xmlns:xs="http://www.w3.org/2001/XMLSchema"
4 targetNamespace="http://dnpb.sourceforge.net/schemas/dnpb-1.5.xsd"
5 xmlns="http://dnpb.sourceforge.net/schemas/dnpb-1.5.xsd"
6>
7 <xs:annotation>
8 <xs:documentation>
9 Copyright (c) 2004-2005 Matthew Holmes (calefaction at houston . rr . com), Dan Moorehead (dan05a at gmail . com)
10
11 .NET Prebuild is a cross-platform XML-driven pre-build tool which
12 allows developers to easily generate project or make files for major
13 IDE's and .NET development tools including: Visual Studio .NET 2002 and
14 2003, SharpDevelop, MonoDevelop, and NAnt.
15
16 BSD License:
17
18 Redistribution and use in source and binary forms, with or without modification, are permitted
19 provided that the following conditions are met:
20
21 * Redistributions of source code must retain the above copyright notice, this list of conditions
22 and the following disclaimer.
23 * Redistributions in binary form must reproduce the above copyright notice, this list of conditions
24 and the following disclaimer in the documentation and/or other materials provided with the
25 distribution.
26 * The name of the author may not be used to endorse or promote products derived from this software
27 without specific prior written permission.
28
29 THIS SOFTWARE IS PROVIDED BY THE AUTHOR 'AS IS' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
30 BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
31 ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
32 EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
33 OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
34 OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
35 IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36 </xs:documentation>
37 </xs:annotation>
38
39 <xs:element name="DNPreBuild">
40 <xs:complexType>
41 <xs:sequence>
42 <xs:element ref="Process" minOccurs="0" maxOccurs="unbounded" />
43 <xs:element ref="Solution" minOccurs="0" maxOccurs="unbounded" />
44 </xs:sequence>
45
46 <xs:attribute name="version" />
47 <xs:attribute name="checkOsVars" />
48 </xs:complexType>
49 </xs:element>
50
51 <xs:element name="Process" type="xs:string" />
52
53 <xs:element name="Solution">
54 <xs:complexType>
55 <xs:sequence>
56 <xs:element ref="Options" minOccurs="0" />
57 <xs:element ref="Configuration" minOccurs="1" maxOccurs="unbounded" />
58 <xs:element ref="Files" minOccurs="0" />
59 <xs:element ref="Project" minOccurs="1" maxOccurs="unbounded" />
60 </xs:sequence>
61
62 <xs:attribute name="name" type="xs:string" use="required" />
63 <xs:attribute name="activeConfig" type="xs:string" default="Debug" />
64 <xs:attribute name="path" type="xs:string" default="" />
65 </xs:complexType>
66 </xs:element>
67
68 <xs:element name="Project">
69 <xs:complexType>
70 <xs:sequence>
71 <xs:element ref="Configuration" minOccurs="0" maxOccurs="unbounded" />
72
73 <xs:element name="ReferencePath" type="xs:string" minOccurs="0" maxOccurs="unbounded" />
74
75 <xs:element name="Reference" minOccurs="0" maxOccurs="unbounded">
76 <xs:complexType>
77 <xs:attribute name="name" type="xs:string" use="required" />
78 <xs:attribute name="path" type="xs:string" />
79 <xs:attribute name="localCopy" type="xs:boolean" />
80 <xs:attribute name="version" type="xs:string" />
81 </xs:complexType>
82 </xs:element>
83
84 <xs:element ref="Files" />
85 </xs:sequence>
86
87 <xs:attribute name="name" type="xs:string" use="required" />
88 <xs:attribute name="filterGroups" type="xs:string" default="" />
89 <xs:attribute name="path" type="xs:string" default="" />
90 <xs:attribute name="icon" type="xs:string" default="" />
91
92 <xs:attribute name="language" default="C#">
93 <xs:simpleType>
94 <xs:restriction base="xs:string">
95 <xs:enumeration value="C#" />
96 <xs:enumeration value="VB.NET" />
97 </xs:restriction>
98 </xs:simpleType>
99 </xs:attribute>
100
101 <xs:attribute name="type" default="Exe">
102 <xs:simpleType>
103 <xs:restriction base="xs:string">
104 <xs:enumeration value="Exe" />
105 <xs:enumeration value="WinExe" />
106 <xs:enumeration value="Library" />
107 </xs:restriction>
108 </xs:simpleType>
109 </xs:attribute>
110
111 <xs:attribute name="runtime" default="Microsoft">
112 <xs:simpleType>
113 <xs:restriction base="xs:string">
114 <xs:enumeration value="Microsoft" />
115 <xs:enumeration value="Mono" />
116 </xs:restriction>
117 </xs:simpleType>
118 </xs:attribute>
119
120 <xs:attribute name="startupObject" type="xs:string" default="" />
121 <xs:attribute name="rootNamespace" type="xs:string" />
122 <xs:attribute name="assemblyName" type="xs:string" />
123 </xs:complexType>
124 </xs:element>
125
126 <xs:element name="Configuration">
127 <xs:complexType>
128 <xs:sequence>
129 <xs:element ref="Options" minOccurs="0" />
130 </xs:sequence>
131
132 <xs:attribute name="name" type="xs:string" use="required" />
133 </xs:complexType>
134 </xs:element>
135
136 <xs:element name="Options">
137 <xs:complexType>
138 <xs:all>
139 <xs:element name="CompilerDefines" type="xs:string" minOccurs="0" />
140 <xs:element name="OptimizeCode" type="xs:boolean" minOccurs="0" />
141 <xs:element name="CheckUnderflowOverflow" type="xs:boolean" minOccurs="0" />
142 <xs:element name="AllowUnsafe" type="xs:boolean" minOccurs="0" />
143 <xs:element name="WarningLevel" minOccurs="0">
144 <xs:simpleType>
145 <xs:restriction base="xs:integer">
146 <xs:minInclusive value="0" />
147 <xs:maxInclusive value="4"/>
148 </xs:restriction>
149 </xs:simpleType>
150 </xs:element>
151 <xs:element name="WarningsAsErrors" type="xs:boolean" minOccurs="0" />
152 <xs:element name="SupressWarnings" type="xs:string" minOccurs="0" />
153 <xs:element name="OutputPath" type="xs:string" minOccurs="0" />
154 <xs:element name="GenerateXmlDocFile" type="xs:boolean" minOccurs="0" />
155 <xs:element name="XmlDocFile" type="xs:string" minOccurs="0" />
156 <xs:element name="DebugInformation" type="xs:boolean" minOccurs="0" />
157 <xs:element name="RegisterCOMInterop" type="xs:boolean" minOccurs="0" />
158 <xs:element name="RemoveIntegerChecks" type="xs:boolean" minOccurs="0" />
159 <xs:element name="IncrementalBuild" type="xs:boolean" minOccurs="0" />
160 <xs:element name="BaseAddress" type="xs:string" minOccurs="0" />
161 <xs:element name="FileAlignment" type="xs:integer" minOccurs="0" />
162 <xs:element name="NoStdLib" type="xs:boolean" minOccurs="0" />
163 </xs:all>
164 </xs:complexType>
165 </xs:element>
166
167 <xs:element name="Files">
168 <xs:complexType>
169 <xs:sequence>
170 <xs:element ref="File" minOccurs="0" maxOccurs="unbounded" />
171 <xs:element ref="Match" minOccurs="0" maxOccurs="unbounded" />
172 </xs:sequence>
173 </xs:complexType>
174 </xs:element>
175
176 <xs:element name="File">
177 <xs:complexType>
178 <xs:simpleContent>
179 <xs:extension base="xs:string">
180 <xs:attribute name="buildAction" default="Compile">
181 <xs:simpleType>
182 <xs:restriction base="xs:string">
183 <xs:enumeration value="None" />
184 <xs:enumeration value="Compile" />
185 <xs:enumeration value="Content" />
186 <xs:enumeration value="EmbeddedResource" />
187 </xs:restriction>
188 </xs:simpleType>
189 </xs:attribute>
190 </xs:extension>
191 </xs:simpleContent>
192 </xs:complexType>
193 </xs:element>
194
195 <xs:element name="Match">
196 <xs:complexType>
197 <xs:attribute name="path" type="xs:string" />
198 <xs:attribute name="pattern" type="xs:string" use="required" />
199 <xs:attribute name="recurse" type="xs:boolean" default="false" />
200 <xs:attribute name="useRegex" type="xs:boolean" default="false" />
201 <xs:attribute name="buildAction" default="Compile">
202 <xs:simpleType>
203 <xs:restriction base="xs:string">
204 <xs:enumeration value="None" />
205 <xs:enumeration value="Compile" />
206 <xs:enumeration value="Content" />
207 <xs:enumeration value="EmbeddedResource" />
208 </xs:restriction>
209 </xs:simpleType>
210 </xs:attribute>
211 </xs:complexType>
212 </xs:element>
213</xs:schema>
214
215
diff --git a/Prebuild/src/data/prebuild-1.6.xsd b/Prebuild/src/data/prebuild-1.6.xsd
new file mode 100644
index 0000000..f944faf
--- /dev/null
+++ b/Prebuild/src/data/prebuild-1.6.xsd
@@ -0,0 +1,231 @@
1<?xml version="1.0" encoding="utf-8" ?>
2<xs:schema elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="http://dnpb.sourceforge.net/schemas/prebuild-1.6.xsd"
3 xmlns="http://dnpb.sourceforge.net/schemas/prebuild-1.6.xsd">
4 <xs:annotation>
5 <xs:documentation>
6 Copyright (c) 2004-2005 Matthew Holmes (calefaction at houston . rr . com), Dan Moorehead (dan05a at gmail . com)
7
8 .NET Prebuild is a cross-platform XML-driven pre-build tool which
9 allows developers to easily generate project or make files for major
10 IDE's and .NET development tools including: Visual Studio .NET 2002 and
11 2003, SharpDevelop, MonoDevelop, and NAnt.
12
13 BSD License:
14
15 Redistribution and use in source and binary forms, with or without modification, are permitted
16 provided that the following conditions are met:
17
18 * Redistributions of source code must retain the above copyright notice, this list of conditions
19 and the following disclaimer.
20 * Redistributions in binary form must reproduce the above copyright notice, this list of conditions
21 and the following disclaimer in the documentation and/or other materials provided with the
22 distribution.
23 * The name of the author may not be used to endorse or promote products derived from this software
24 without specific prior written permission.
25
26 THIS SOFTWARE IS PROVIDED BY THE AUTHOR 'AS IS' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
27 BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
28 ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
29 EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
30 OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
31 OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
32 IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 </xs:documentation>
34 </xs:annotation>
35 <xs:element name="Prebuild">
36 <xs:complexType>
37 <xs:sequence>
38 <xs:element ref="Process" minOccurs="0" maxOccurs="unbounded" />
39 <xs:element ref="Solution" minOccurs="0" maxOccurs="unbounded" />
40 </xs:sequence>
41 <xs:attribute name="version" />
42 <xs:attribute name="checkOsVars" />
43 </xs:complexType>
44 </xs:element>
45 <xs:element name="Process" type="xs:string" />
46 <xs:element name="Solution">
47 <xs:complexType>
48 <xs:sequence>
49 <xs:element ref="Options" minOccurs="0" />
50 <xs:element ref="Configuration" minOccurs="1" maxOccurs="unbounded" />
51 <xs:element ref="Files" minOccurs="0" />
52 <xs:element ref="Project" minOccurs="1" maxOccurs="unbounded" />
53 </xs:sequence>
54 <xs:attribute name="name" type="xs:string" use="required" />
55 <xs:attribute name="activeConfig" type="xs:string" default="Debug" />
56 <xs:attribute name="path" type="xs:string" default="" />
57 </xs:complexType>
58 </xs:element>
59 <xs:element name="Project">
60 <xs:complexType>
61 <xs:sequence>
62 <xs:element ref="Configuration" minOccurs="0" maxOccurs="unbounded" />
63 <xs:element name="ReferencePath" type="xs:string" minOccurs="0" maxOccurs="unbounded" />
64 <xs:element name="Reference" minOccurs="0" maxOccurs="unbounded">
65 <xs:complexType>
66 <xs:attribute name="name" type="xs:string" use="required" />
67 <xs:attribute name="path" type="xs:string" />
68 <xs:attribute name="localCopy" type="xs:boolean" />
69 <xs:attribute name="version" type="xs:string" />
70 </xs:complexType>
71 </xs:element>
72 <xs:element ref="Files" />
73 </xs:sequence>
74 <xs:attribute name="name" type="xs:string" use="required" />
75 <xs:attribute name="filterGroups" type="xs:string" default="" />
76 <xs:attribute name="path" type="xs:string" default="" />
77 <xs:attribute name="icon" type="xs:string" default="" />
78 <xs:attribute name="language" default="C#">
79 <xs:simpleType>
80 <xs:restriction base="xs:string">
81 <xs:enumeration value="C#" />
82 <xs:enumeration value="VB.NET" />
83 </xs:restriction>
84 </xs:simpleType>
85 </xs:attribute>
86 <xs:attribute name="type" default="Exe">
87 <xs:simpleType>
88 <xs:restriction base="xs:string">
89 <xs:enumeration value="Exe" />
90 <xs:enumeration value="WinExe" />
91 <xs:enumeration value="Library" />
92 </xs:restriction>
93 </xs:simpleType>
94 </xs:attribute>
95 <xs:attribute name="runtime" default="Microsoft">
96 <xs:simpleType>
97 <xs:restriction base="xs:string">
98 <xs:enumeration value="Microsoft" />
99 <xs:enumeration value="Mono" />
100 </xs:restriction>
101 </xs:simpleType>
102 </xs:attribute>
103 <xs:attribute name="startupObject" type="xs:string" default="" />
104 <xs:attribute name="rootNamespace" type="xs:string" />
105 <xs:attribute name="assemblyName" type="xs:string" />
106 </xs:complexType>
107 </xs:element>
108 <xs:element name="Configuration">
109 <xs:complexType>
110 <xs:sequence>
111 <xs:element ref="Options" minOccurs="0" />
112 </xs:sequence>
113 <xs:attribute name="name" type="xs:string" use="required" />
114 </xs:complexType>
115 </xs:element>
116 <xs:element name="Options">
117 <xs:complexType>
118 <xs:all>
119 <xs:element name="CompilerDefines" type="xs:string" minOccurs="0" />
120 <xs:element name="OptimizeCode" type="xs:boolean" minOccurs="0" />
121 <xs:element name="CheckUnderflowOverflow" type="xs:boolean" minOccurs="0" />
122 <xs:element name="AllowUnsafe" type="xs:boolean" minOccurs="0" />
123 <xs:element name="PreBuildEvent" type="xs:string" minOccurs="0" />
124 <xs:element name="PostBuildEvent" type="xs:string" minOccurs="0" />
125 <xs:element name="RunPostBuildEvent" minOccurs="0" default="OnBuildSuccess">
126 <xs:simpleType>
127 <xs:restriction base="xs:string">
128 <xs:enumeration value="OnBuildSuccess" />
129 <xs:enumeration value="Always" />
130 <xs:enumeration value="OnOutputUpdated" />
131 </xs:restriction>
132 </xs:simpleType>
133 </xs:element>
134 <xs:element name="RunScript" type="xs:string" minOccurs="0" />
135 <xs:element name="PreBuildEventArgs" type="xs:string" minOccurs="0" />
136 <xs:element name="PostBuildEventArgs" type="xs:string" minOccurs="0" />
137 <xs:element name="WarningLevel" minOccurs="0">
138 <xs:simpleType>
139 <xs:restriction base="xs:integer">
140 <xs:minInclusive value="0" />
141 <xs:maxInclusive value="4" />
142 </xs:restriction>
143 </xs:simpleType>
144 </xs:element>
145 <xs:element name="WarningsAsErrors" type="xs:boolean" minOccurs="0" />
146 <xs:element name="SuppressWarnings" type="xs:string" minOccurs="0" />
147 <xs:element name="OutputPath" type="xs:string" minOccurs="0" />
148 <xs:element name="XmlDocFile" type="xs:string" minOccurs="0" />
149 <xs:element name="DebugInformation" type="xs:boolean" minOccurs="0" />
150 <xs:element name="RegisterComInterop" type="xs:boolean" minOccurs="0" />
151 <xs:element name="RemoveIntegerChecks" type="xs:boolean" minOccurs="0" />
152 <xs:element name="IncrementalBuild" type="xs:boolean" minOccurs="0" />
153 <xs:element name="BaseAddress" type="xs:string" minOccurs="0" />
154 <xs:element name="FileAlignment" type="xs:integer" minOccurs="0" />
155 <xs:element name="NoStdLib" type="xs:boolean" minOccurs="0" />
156 </xs:all>
157 </xs:complexType>
158 </xs:element>
159 <xs:element name="Files">
160 <xs:complexType>
161 <xs:sequence>
162 <xs:element ref="File" minOccurs="0" maxOccurs="unbounded" />
163 <xs:element ref="Match" minOccurs="0" maxOccurs="unbounded" />
164 </xs:sequence>
165 </xs:complexType>
166 </xs:element>
167 <xs:element name="File">
168 <xs:complexType>
169 <xs:simpleContent>
170 <xs:extension base="xs:string">
171 <xs:attribute name="buildAction" default="Compile">
172 <xs:simpleType>
173 <xs:restriction base="xs:string">
174 <xs:enumeration value="None" />
175 <xs:enumeration value="Compile" />
176 <xs:enumeration value="Content" />
177 <xs:enumeration value="EmbeddedResource" />
178 </xs:restriction>
179 </xs:simpleType>
180 </xs:attribute>
181 <xs:attribute name="subType" default="Code">
182 <xs:simpleType>
183 <xs:restriction base="xs:string">
184 <xs:enumeration value="Code" />
185 <xs:enumeration value="Component" />
186 <xs:enumeration value="Form" />
187 <xs:enumeration value="UserControl" />
188 </xs:restriction>
189 </xs:simpleType>
190 </xs:attribute>
191 </xs:extension>
192 </xs:simpleContent>
193 </xs:complexType>
194 </xs:element>
195 <xs:element name="Match">
196 <xs:complexType>
197 <xs:sequence>
198 <xs:element ref="Exclude" minOccurs="0" />
199 </xs:sequence>
200 <xs:attribute name="path" type="xs:string" />
201 <xs:attribute name="pattern" type="xs:string" use="required" />
202 <xs:attribute name="recurse" type="xs:boolean" default="false" />
203 <xs:attribute name="useRegex" type="xs:boolean" default="false" />
204 <xs:attribute name="buildAction" default="Compile">
205 <xs:simpleType>
206 <xs:restriction base="xs:string">
207 <xs:enumeration value="None" />
208 <xs:enumeration value="Compile" />
209 <xs:enumeration value="Content" />
210 <xs:enumeration value="EmbeddedResource" />
211 </xs:restriction>
212 </xs:simpleType>
213 </xs:attribute>
214 <xs:attribute name="subType" default="Code">
215 <xs:simpleType>
216 <xs:restriction base="xs:string">
217 <xs:enumeration value="Code" />
218 <xs:enumeration value="Component" />
219 <xs:enumeration value="Form" />
220 <xs:enumeration value="UserControl" />
221 </xs:restriction>
222 </xs:simpleType>
223 </xs:attribute>
224 </xs:complexType>
225 </xs:element>
226 <xs:element name="Exclude">
227 <xs:complexType>
228 <xs:attribute name="name" type="xs:string" use="required" />
229 </xs:complexType>
230 </xs:element>
231</xs:schema>
diff --git a/Prebuild/src/data/prebuild-1.7.xsd b/Prebuild/src/data/prebuild-1.7.xsd
new file mode 100644
index 0000000..9d63ce6
--- /dev/null
+++ b/Prebuild/src/data/prebuild-1.7.xsd
@@ -0,0 +1,261 @@
1<?xml version="1.0" encoding="utf-8" ?>
2<xs:schema elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="http://dnpb.sourceforge.net/schemas/prebuild-1.7.xsd"
3 xmlns="http://dnpb.sourceforge.net/schemas/prebuild-1.7.xsd">
4 <xs:annotation>
5 <xs:documentation>
6 Copyright (c) 2004-2005 Matthew Holmes (calefaction at houston . rr . com), Dan Moorehead (dan05a at gmail . com), David Hudson (jendave at yahoo dot com)
7
8 .NET Prebuild is a cross-platform XML-driven pre-build tool which
9 allows developers to easily generate project or make files for major
10 IDE's and .NET development tools including: Visual Studio .NET 2002 and
11 2003, SharpDevelop, MonoDevelop, and NAnt.
12
13 BSD License:
14
15 Redistribution and use in source and binary forms, with or without modification, are permitted
16 provided that the following conditions are met:
17
18 * Redistributions of source code must retain the above copyright notice, this list of conditions
19 and the following disclaimer.
20 * Redistributions in binary form must reproduce the above copyright notice, this list of conditions
21 and the following disclaimer in the documentation and/or other materials provided with the
22 distribution.
23 * The name of the author may not be used to endorse or promote products derived from this software
24 without specific prior written permission.
25
26 THIS SOFTWARE IS PROVIDED BY THE AUTHOR 'AS IS' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
27 BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
28 ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
29 EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
30 OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
31 OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
32 IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 </xs:documentation>
34 </xs:annotation>
35 <xs:element name="Prebuild">
36 <xs:complexType>
37 <xs:sequence>
38 <xs:element ref="Process" minOccurs="0" maxOccurs="unbounded" />
39 <xs:element ref="Solution" minOccurs="0" maxOccurs="unbounded" />
40 </xs:sequence>
41 <xs:attribute name="version" />
42 <xs:attribute name="checkOsVars" />
43 </xs:complexType>
44 </xs:element>
45 <xs:element name="Process" type="xs:string" />
46 <xs:element name="Solution">
47 <xs:complexType>
48 <xs:sequence>
49 <xs:element ref="Options" minOccurs="0" />
50 <xs:element ref="Configuration" minOccurs="1" maxOccurs="unbounded" />
51 <xs:element ref="Files" minOccurs="0" />
52 <xs:element ref="Project" minOccurs="1" maxOccurs="unbounded" />
53 </xs:sequence>
54 <xs:attribute name="name" type="xs:string" use="required" />
55 <xs:attribute name="activeConfig" type="xs:string" default="Debug" />
56 <xs:attribute name="path" type="xs:string" default="" />
57 <xs:attribute name="version" type="xs:string" default="1.0.0" />
58 </xs:complexType>
59 </xs:element>
60 <xs:element name="Project">
61 <xs:complexType>
62 <xs:sequence>
63 <xs:element ref="Configuration" minOccurs="0" maxOccurs="unbounded" />
64 <xs:element name="ReferencePath" type="xs:string" minOccurs="0" maxOccurs="unbounded" />
65 <xs:element name="Reference" minOccurs="0" maxOccurs="unbounded">
66 <xs:complexType>
67 <xs:attribute name="name" type="xs:string" use="required" />
68 <xs:attribute name="path" type="xs:string" />
69 <xs:attribute name="localCopy" type="xs:boolean" />
70 <xs:attribute name="version" type="xs:string" default="1.0.0"/>
71 </xs:complexType>
72 </xs:element>
73 <xs:element ref="Files" />
74 </xs:sequence>
75 <xs:attribute name="name" type="xs:string" use="required" />
76 <xs:attribute name="designerFolder" type="xs:string" default="" />
77 <xs:attribute name="filterGroups" type="xs:string" default="" />
78 <xs:attribute name="path" type="xs:string" default="" />
79 <xs:attribute name="icon" type="xs:string" default="" />
80 <xs:attribute name="language" default="C#">
81 <xs:simpleType>
82 <xs:restriction base="xs:string">
83 <xs:enumeration value="C#" />
84 <xs:enumeration value="VB.NET" />
85 </xs:restriction>
86 </xs:simpleType>
87 </xs:attribute>
88 <xs:attribute name="type" default="Exe">
89 <xs:simpleType>
90 <xs:restriction base="xs:string">
91 <xs:enumeration value="Exe" />
92 <xs:enumeration value="WinExe" />
93 <xs:enumeration value="Library" />
94 </xs:restriction>
95 </xs:simpleType>
96 </xs:attribute>
97 <xs:attribute name="runtime" default="Microsoft">
98 <xs:simpleType>
99 <xs:restriction base="xs:string">
100 <xs:enumeration value="Microsoft" />
101 <xs:enumeration value="Mono" />
102 </xs:restriction>
103 </xs:simpleType>
104 </xs:attribute>
105 <xs:attribute name="startupObject" type="xs:string" default="" />
106 <xs:attribute name="rootNamespace" type="xs:string" />
107 <xs:attribute name="assemblyName" type="xs:string" />
108 <xs:attribute name="generateAssemblyInfoFile" type="xs:boolean" default="false"/>
109 </xs:complexType>
110 </xs:element>
111 <xs:element name="Configuration">
112 <xs:complexType>
113 <xs:sequence>
114 <xs:element ref="Options" minOccurs="0" />
115 </xs:sequence>
116 <xs:attribute name="name" type="xs:string" use="required" />
117 </xs:complexType>
118 </xs:element>
119 <xs:element name="Options">
120 <xs:complexType>
121 <xs:all>
122 <xs:element name="CompilerDefines" type="xs:string" minOccurs="0" />
123 <xs:element name="OptimizeCode" type="xs:boolean" minOccurs="0" />
124 <xs:element name="CheckUnderflowOverflow" type="xs:boolean" minOccurs="0" />
125 <xs:element name="AllowUnsafe" type="xs:boolean" minOccurs="0" />
126 <xs:element name="PreBuildEvent" type="xs:string" minOccurs="0" />
127 <xs:element name="PostBuildEvent" type="xs:string" minOccurs="0" />
128 <xs:element name="RunPostBuildEvent" minOccurs="0" default="OnBuildSuccess">
129 <xs:simpleType>
130 <xs:restriction base="xs:string">
131 <xs:enumeration value="OnBuildSuccess" />
132 <xs:enumeration value="Always" />
133 <xs:enumeration value="OnOutputUpdated" />
134 </xs:restriction>
135 </xs:simpleType>
136 </xs:element>
137 <xs:element name="RunScript" type="xs:string" minOccurs="0" />
138 <xs:element name="PreBuildEventArgs" type="xs:string" minOccurs="0" />
139 <xs:element name="PostBuildEventArgs" type="xs:string" minOccurs="0" />
140 <xs:element name="WarningLevel" minOccurs="0">
141 <xs:simpleType>
142 <xs:restriction base="xs:integer">
143 <xs:minInclusive value="0" />
144 <xs:maxInclusive value="4" />
145 </xs:restriction>
146 </xs:simpleType>
147 </xs:element>
148 <xs:element name="WarningsAsErrors" type="xs:boolean" minOccurs="0" />
149 <xs:element name="SuppressWarnings" type="xs:string" minOccurs="0" />
150 <xs:element name="OutputPath" type="xs:string" minOccurs="0" />
151 <xs:element name="GenerateDocumentation" type="xs:boolean" minOccurs="0" />
152 <xs:element name="XmlDocFile" type="xs:string" minOccurs="0" />
153 <xs:element name="DebugInformation" type="xs:boolean" minOccurs="0" />
154 <xs:element name="RegisterComInterop" type="xs:boolean" minOccurs="0" />
155 <xs:element name="RemoveIntegerChecks" type="xs:boolean" minOccurs="0" />
156 <xs:element name="IncrementalBuild" type="xs:boolean" minOccurs="0" />
157 <xs:element name="BaseAddress" type="xs:string" minOccurs="0" />
158 <xs:element name="FileAlignment" type="xs:integer" minOccurs="0" />
159 <xs:element name="NoStdLib" type="xs:boolean" minOccurs="0" />
160 <xs:element name="KeyFile" type="xs:string" minOccurs="0" />
161 </xs:all>
162 </xs:complexType>
163 </xs:element>
164 <xs:element name="Files">
165 <xs:complexType>
166 <xs:sequence>
167 <xs:element ref="File" minOccurs="0" maxOccurs="unbounded" />
168 <xs:element ref="Match" minOccurs="0" maxOccurs="unbounded" />
169 </xs:sequence>
170 </xs:complexType>
171 </xs:element>
172 <xs:element name="File">
173 <xs:complexType>
174 <xs:simpleContent>
175 <xs:extension base="xs:string">
176 <xs:attribute name="resourceName" type="xs:string" default="" />
177 <xs:attribute name="buildAction" default="Compile">
178 <xs:simpleType>
179 <xs:restriction base="xs:string">
180 <xs:enumeration value="None" />
181 <xs:enumeration value="Compile" />
182 <xs:enumeration value="Content" />
183 <xs:enumeration value="EmbeddedResource" />
184 </xs:restriction>
185 </xs:simpleType>
186 </xs:attribute>
187 <xs:attribute name="subType" default="Code">
188 <xs:simpleType>
189 <xs:restriction base="xs:string">
190 <xs:enumeration value="Code" />
191 <xs:enumeration value="Component" />
192 <xs:enumeration value="Form" />
193 <xs:enumeration value="Settings" />
194 <xs:enumeration value="UserControl" />
195 </xs:restriction>
196 </xs:simpleType>
197 </xs:attribute>
198 <xs:attribute name="link" type="xs:boolean" />
199 <xs:attribute name="copyToOutput" default="Never">
200 <xs:simpleType>
201 <xs:restriction base="xs:string">
202 <xs:enumeration value="Never" />
203 <xs:enumeration value="Always" />
204 <xs:enumeration value="PreserveNewest" />
205 </xs:restriction>
206 </xs:simpleType>
207 </xs:attribute>
208 </xs:extension>
209 </xs:simpleContent>
210 </xs:complexType>
211 </xs:element>
212 <xs:element name="Match">
213 <xs:complexType>
214 <xs:sequence>
215 <xs:element ref="Exclude" minOccurs="0" maxOccurs="unbounded" />
216 </xs:sequence>
217 <xs:attribute name="path" type="xs:string" />
218 <xs:attribute name="pattern" type="xs:string" use="required" />
219 <xs:attribute name="recurse" type="xs:boolean" default="false" />
220 <xs:attribute name="useRegex" type="xs:boolean" default="false" />
221 <xs:attribute name="buildAction" default="Compile">
222 <xs:simpleType>
223 <xs:restriction base="xs:string">
224 <xs:enumeration value="None" />
225 <xs:enumeration value="Compile" />
226 <xs:enumeration value="Content" />
227 <xs:enumeration value="EmbeddedResource" />
228 </xs:restriction>
229 </xs:simpleType>
230 </xs:attribute>
231 <xs:attribute name="resourceName" type="xs:string" default="" />
232 <xs:attribute name="subType" default="Code">
233 <xs:simpleType>
234 <xs:restriction base="xs:string">
235 <xs:enumeration value="Code" />
236 <xs:enumeration value="Component" />
237 <xs:enumeration value="Designer" />
238 <xs:enumeration value="Form" />
239 <xs:enumeration value="Settings" />
240 <xs:enumeration value="UserControl" />
241 </xs:restriction>
242 </xs:simpleType>
243 </xs:attribute>
244 <xs:attribute name="link" type="xs:boolean" />
245 <xs:attribute name="copyToOutput" default="Never">
246 <xs:simpleType>
247 <xs:restriction base="xs:string">
248 <xs:enumeration value="Never" />
249 <xs:enumeration value="Always" />
250 <xs:enumeration value="PreserveNewest" />
251 </xs:restriction>
252 </xs:simpleType>
253 </xs:attribute>
254 </xs:complexType>
255 </xs:element>
256 <xs:element name="Exclude">
257 <xs:complexType>
258 <xs:attribute name="name" type="xs:string" use="required" />
259 </xs:complexType>
260 </xs:element>
261</xs:schema>
diff --git a/README.txt b/README.txt
index 8182086..c7c5a93 100644
--- a/README.txt
+++ b/README.txt
@@ -4,7 +4,7 @@ Build Instructions
4 4
5* Check out the trunk code 5* Check out the trunk code
6 6
7* Build the /src/opensim.sln solution 7* Build the /OpenSim.sln solution
8 8
9* open cmd window, go to /bin and launch 9* open cmd window, go to /bin and launch
10OpenSim.exe -sandbox -loginserver 10OpenSim.exe -sandbox -loginserver
@@ -23,12 +23,33 @@ secondlife.exe -loginuri http://localhost:8080/
23 23
24* ensure you have nant (http://nant.sf.net) installed 24* ensure you have nant (http://nant.sf.net) installed
25 25
26* cd to the right directory and type "nant" 26* cd to the trunk root directory and type "nant"
27 27
28* cd to bin/ and run "mono OpenSim.exe -sandbox -loginserver" 28* cd to bin/ and run "mono OpenSim.exe -sandbox -loginserver"
29 29
30=== Windows Nant Build === 30=== Prebuild ===
31
32We use Prebuild to generate vs2005 solutions and nant build scripts.
33
34The Prebuild master project is /prebuild.xml
35
36To build it with vs2005 :
37
38* build the solution /Prebuild/Prebuild.sln
39
40To build it with nant :
41
42* cd to /Prebuild/
43* type 'nant'
44
45After you've built it, move it from /Prebuild/src/bin to /bin/ directory,
46
47after that you just modify the prebuild.xml and then execute
48
49bin/Prebuild.exe /target {target}
50
51where target is either
52vs2005 - to generate new vs2005 solutions and projects
53nant - to generate new nant build scripts
54
31 55
32* same as Linux/mono build, but use
33nant nogenvers
34to cicumvent bash invokation
diff --git a/STATE_OF_PREBUILD.txt b/STATE_OF_PREBUILD.txt
new file mode 100644
index 0000000..5f763ca
--- /dev/null
+++ b/STATE_OF_PREBUILD.txt
@@ -0,0 +1,15 @@
1These are the issues we have with Prebuild:
2
3* vs2005 target
4 * does not honour localCopy=False - fairly easy to add <Private> node on ref. ** fixed **
5 * screws up solution file projects references by miscalculating relative dir (it walks one level too high up then back) **fixed**
6* Nant target
7 * doesn't honour Output redirection at all, which causes everything to land in {project}/bin/Debug **fixed**
8
9Both targets
10 * Have problems with refs
11 * 'System.Xml' will have to csc ref as 'System.Xml.dll' to work on Windows
12 * but if you add dll, you end up with stuff like 'System.Xml.dll.dll.'
13
14These things need fixing in the Prebuild source. Now, the good news is that prebuild is very straight forward, so we should be able to fix what we need in the tool and submit the changes to the Prebuild team.
15
diff --git a/VERSION b/VERSION
deleted file mode 100644
index 153b50b..0000000
--- a/VERSION
+++ /dev/null
@@ -1 +0,0 @@
10.1.0.240 \ No newline at end of file
diff --git a/genvers.sh b/genvers.sh
deleted file mode 100755
index 9bd8eff..0000000
--- a/genvers.sh
+++ /dev/null
@@ -1,9 +0,0 @@
1#!/bin/bash
2
3MAJOR=0
4MINOR=1
5BUILD=`date +%s`
6REVISION=`svnversion . | sed s/:// | sed s/M//`
7REALREVISION=`svnversion`
8cat src/VersionInfo.cs.template | sed s/@@VERSION/"$MAJOR.$MINOR, Build $BUILD, Revision $REALREVISION"/g >src/VersionInfo.cs
9echo -n $MAJOR.$MINOR.0.$REVISION >VERSION
diff --git a/ogs/assetserver/assets/00000000000000005005000000000005/data b/ogs/assetserver/assets/00000000000000005005000000000005/data
deleted file mode 100644
index e6840e2..0000000
--- a/ogs/assetserver/assets/00000000000000005005000000000005/data
+++ /dev/null
Binary files differ
diff --git a/ogs/assetserver/assets/00000000000000007007000000000006/data b/ogs/assetserver/assets/00000000000000007007000000000006/data
deleted file mode 100644
index 5ad1fd0..0000000
--- a/ogs/assetserver/assets/00000000000000007007000000000006/data
+++ /dev/null
Binary files differ
diff --git a/ogs/assetserver/assets/00000000000000007009000000000008/data b/ogs/assetserver/assets/00000000000000007009000000000008/data
deleted file mode 100644
index cd2fd94..0000000
--- a/ogs/assetserver/assets/00000000000000007009000000000008/data
+++ /dev/null
Binary files differ
diff --git a/ogs/assetserver/assets/66c41e3938f9f75a024e585989bfab73/data b/ogs/assetserver/assets/66c41e3938f9f75a024e585989bfab73/data
deleted file mode 100644
index 920c775..0000000
--- a/ogs/assetserver/assets/66c41e3938f9f75a024e585989bfab73/data
+++ /dev/null
@@ -1,105 +0,0 @@
1LLWearable version 22
2Female Shape and Outfit 3 Shape
3Created by system from avatar's appearance.
4 permissions 0
5 {
6 base_mask 00082000
7 owner_mask 00082000
8 group_mask 00082000
9 everyone_mask 00082000
10 next_owner_mask 00082000
11 creator_id 3d924400-038e-6ad9-920b-cfbb9b40585c
12 owner_id 542ffb8e-8932-49b9-8664-58f53e442797
13 last_owner_id 3d924400-038e-6ad9-920b-cfbb9b40585c
14 group_id 00000000-0000-0000-0000-000000000000
15 }
16 sale_info 0
17 {
18 sale_type not
19 sale_price 0
20 }
21type 0
22parameters 82
231 .21
242 -.5
254 -.11
265 -.1
276 -.3
287 -.4
298 -.5
3010 .7
3111 .34
3212 -.5
3313 0
3414 .04
3515 .58
3617 .56
3718 -.26
3819 -.73
3920 -.34
4021 -.01
4122 1
4223 -.5
4324 -.63
4425 .44
4527 .05
4633 -.24
4734 -.7
4835 -.16
4936 -.2
5037 -.98
5138 -.5
5280 0
53105 .07
54155 -.22
55157 0
56185 -1
57193 .86
58196 -.74
59505 .65
60506 .12
61507 -1.5
62515 0
63517 .16
64518 .8
65629 0
66637 0
67646 .4
68647 1
69649 .36
70650 .85
71652 .49
72653 -1
73656 0
74659 .65
75662 .5
76663 0
77664 0
78665 0
79675 -.15
80676 .26
81678 .28
82682 .27
83683 -.19
84684 -.09
85685 0
86690 .45
87692 .4
88693 -0
89753 -.5
90756 -.08
91758 .24
92759 .6
93760 .11
94764 -.38
95765 -.3
96769 .42
97773 .51
98795 .16
99796 .11
100799 .36
101841 0
102842 -.82
103879 0
104880 0
105textures 0
diff --git a/ogs/assetserver/assets/e0ee49b5a4184df8d3c9a65361fe7f49/data b/ogs/assetserver/assets/e0ee49b5a4184df8d3c9a65361fe7f49/data
deleted file mode 100644
index 95cc683..0000000
--- a/ogs/assetserver/assets/e0ee49b5a4184df8d3c9a65361fe7f49/data
+++ /dev/null
@@ -1,52 +0,0 @@
1LLWearable version 22
2Sexy - Female Skin
3
4 permissions 0
5 {
6 base_mask 00086000
7 owner_mask 00086000
8 group_mask 00000000
9 everyone_mask 00000000
10 next_owner_mask 00086000
11 creator_id 3b659a92-dbf0-4301-8fdc-208d78f00d77
12 owner_id 3d924400-038e-6ad9-920b-cfbb9b40585c
13 last_owner_id 101358d5-469d-4b24-9b85-4dc3c05e635d
14 group_id 00000000-0000-0000-0000-000000000000
15 }
16 sale_info 0
17 {
18 sale_type not
19 sale_price 10
20 }
21type 1
22parameters 26
23108 0
24110 0
25111 0
26116 0
27117 1
28150 0
29162 0
30163 0
31165 0
32700 .01
33701 .5
34702 .26
35703 0
36704 0
37705 .5
38706 .6
39707 0
40708 0
41709 0
42710 0
43711 .5
44712 0
45713 .7
46714 0
47715 0
48775 0
49textures 3
500 f9261672-5058-9ef8-c0c4-48f43a0b16d4
515 b6ba53be-b5bf-9a1f-2e19-21daf998429c
526 703f6e24-a1fb-1980-acaf-6ab8a99a5bd5
diff --git a/ogs/common/src/Util.cs b/ogs/common/src/Util.cs
deleted file mode 100644
index 1efa471..0000000
--- a/ogs/common/src/Util.cs
+++ /dev/null
@@ -1,87 +0,0 @@
1/*
2Copyright (c) OpenSim project, http://osgrid.org/
3
4* Copyright (c) <year>, <copyright holder>
5* All rights reserved.
6*
7* Redistribution and use in source and binary forms, with or without
8* modification, are permitted provided that the following conditions are met:
9* * Redistributions of source code must retain the above copyright
10* notice, this list of conditions and the following disclaimer.
11* * Redistributions in binary form must reproduce the above copyright
12* notice, this list of conditions and the following disclaimer in the
13* documentation and/or other materials provided with the distribution.
14* * Neither the name of the <organization> nor the
15* names of its contributors may be used to endorse or promote products
16* derived from this software without specific prior written permission.
17*
18* THIS SOFTWARE IS PROVIDED BY <copyright holder> ``AS IS'' AND ANY
19* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
20* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21* DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY
22* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
24* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
25* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
27* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28*/
29
30using System;
31using System.Collections.Generic;
32using System.Threading;
33using libsecondlife;
34using libsecondlife.Packets;
35
36namespace OpenGridServices
37{
38 /// <summary>
39 /// </summary>
40 ///
41 public class Util
42 {
43 public static ulong UIntsToLong(uint X, uint Y)
44 {
45 return Helpers.UIntsToLong(X,Y);
46 }
47 public Util()
48 {
49
50 }
51 }
52
53 public class QueItem {
54 public QueItem()
55 {
56 }
57
58 public Packet Packet;
59 public bool Incoming;
60 }
61
62
63 public class BlockingQueue< T > {
64 private Queue< T > _queue = new Queue< T >();
65 private object _queueSync = new object();
66
67 public void Enqueue(T value)
68 {
69 lock(_queueSync)
70 {
71 _queue.Enqueue(value);
72 Monitor.Pulse(_queueSync);
73 }
74 }
75
76 public T Dequeue()
77 {
78 lock(_queueSync)
79 {
80 if( _queue.Count < 1)
81 Monitor.Wait(_queueSync);
82
83 return _queue.Dequeue();
84 }
85 }
86 }
87}
diff --git a/ogs/genvers.sh b/ogs/genvers.sh
deleted file mode 100644
index 8d8007c..0000000
--- a/ogs/genvers.sh
+++ /dev/null
@@ -1,9 +0,0 @@
1#!/bin/bash
2
3MAJOR=0
4MINOR=1
5BUILD=`date +%s`
6REVISION=`svnversion . | sed s/:// | sed s/M//`
7REALREVISION=`svnversion`
8cat common/src/VersionInfo.cs.template | sed s/@@VERSION/"$MAJOR.$MINOR, Build $BUILD, Revision $REALREVISION"/g >common/src/VersionInfo.cs
9echo -n $MAJOR.$MINOR.*.$REVISION >VERSION
diff --git a/ogs/ogs.build b/ogs/ogs.build
deleted file mode 100644
index 303b1bf..0000000
--- a/ogs/ogs.build
+++ /dev/null
@@ -1,38 +0,0 @@
1<?xml version="1.0"?>
2 <project name="OGS" default="build" basedir=".">
3 <description>nant buildfile for OpenSim</description>
4 <property name="debug" value="true" overwrite="false" />
5 <target name="clean" description="remove all generated files">
6 <nant target="clean">
7 <buildfiles>
8 <include name="ServerConsole/default.build" />
9 <include name="gridserver/default.build" />
10 </buildfiles>
11 </nant>
12
13 </target>
14
15 <target name="svnupdate" description="updates to latest SVN">
16 <exec program="svn">
17 <arg value="update" />
18 </exec>
19 </target>
20
21 <target name="upgrade" description="updates from SVN and then builds" depends="clean,svnupdate,build">
22
23 </target>
24
25 <target name="build" description="compiles the source code">
26
27 <exec program="genvers.sh" />
28 <loadfile file="VERSION" property="svnver"/>
29
30 <nant>
31 <buildfiles>
32 <include name="ServerConsole/default.build" />
33 <include name="gridserver/default.build" />
34 </buildfiles>
35 </nant>
36
37 </target>
38</project>
diff --git a/ogs/userserver/default.build b/ogs/userserver/default.build
deleted file mode 100644
index a56f925..0000000
--- a/ogs/userserver/default.build
+++ /dev/null
@@ -1,63 +0,0 @@
1<?xml version="1.0"?>
2 <project name="UserServer" default="build" basedir="./">
3 <property name="debug" value="true" overwrite="false" />
4 <target name="clean" description="remove all generated files">
5 <delete>
6 <fileset failonempty="false">
7 <include name="bin/*.dll" />
8 <include name="bin/*.exe" />
9 <include name="bin/*.mdb" />
10 </fileset>
11 </delete>
12 </target>
13
14 <target name="svnupdate" description="updates to latest SVN">
15 <exec program="svn">
16 <arg value="update" />
17 </exec>
18 </target>
19
20 <target name="upgrade" description="updates from SVN and then builds" depends="clean,svnupdate,build">
21
22 </target>
23
24 <target name="build" description="compiles the source code">
25
26 <loadfile file="../VERSION" property="svnver"/>
27 <asminfo output="src/AssemblyInfo.cs" language="CSharp">
28 <imports>
29 <import namespace="System" />
30 <import namespace="System.Reflection" />
31 <import namespace="System.Runtime.InteropServices" />
32 </imports>
33 <attributes>
34 <attribute type="ComVisibleAttribute" value="false" />
35 <attribute type="CLSCompliantAttribute" value="false" />
36 <attribute type="AssemblyVersionAttribute" value="${svnver}" />
37 <attribute type="AssemblyTitleAttribute" value="ogs-UserServer" />
38 <attribute type="AssemblyDescriptionAttribute" value="The core OGS User Server" />
39 <attribute type="AssemblyCopyrightAttribute" value="Copyright © OGS development team 2007"/>
40 </attributes>
41 </asminfo>
42
43 <csc target="exe" output="bin/UserServer.exe" debug="${debug}" verbose="true" warninglevel="4">
44 <references failonempty="true">
45 <include name="System" />
46 <include name="System.Xml" />
47 <include name="../common/bin/ServerConsole.dll" />
48 <include name="../common/bin/libsecondlife.dll" />
49 </references>
50 <sources>
51 <include name="../common/src/VersionInfo.cs" />
52 <include name="../common/src/OGS-Console.cs" />
53 <include name="src/*.cs" />
54 </sources>
55 </csc>
56
57 <copy todir="bin/">
58 <fileset basedir="../common/bin">
59 <include name="*.*" />
60 </fileset>
61 </copy>
62 </target>
63</project>
diff --git a/ogs/userserver/src/UserHttp.cs b/ogs/userserver/src/UserHttp.cs
deleted file mode 100644
index bc232fb..0000000
--- a/ogs/userserver/src/UserHttp.cs
+++ /dev/null
@@ -1,287 +0,0 @@
1/*
2Copyright (c) OpenGrid project, http://osgrid.org/
3
4
5* All rights reserved.
6*
7* Redistribution and use in source and binary forms, with or without
8* modification, are permitted provided that the following conditions are met:
9* * Redistributions of source code must retain the above copyright
10* notice, this list of conditions and the following disclaimer.
11* * Redistributions in binary form must reproduce the above copyright
12* notice, this list of conditions and the following disclaimer in the
13* documentation and/or other materials provided with the distribution.
14* * Neither the name of the <organization> nor the
15* names of its contributors may be used to endorse or promote products
16* derived from this software without specific prior written permission.
17*
18* THIS SOFTWARE IS PROVIDED BY <copyright holder> ``AS IS'' AND ANY
19* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
20* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21* DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY
22* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
24* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
25* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
27* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28*/
29
30using System;
31using System.Text;
32using Nwc.XmlRpc;
33using System.Threading;
34using System.Text.RegularExpressions;
35using System.Net;
36using System.IO;
37using System.Collections;
38using System.Collections.Generic;
39using libsecondlife;
40using ServerConsole;
41
42namespace OpenGridServices
43{
44 public class UserHTTPServer {
45 public Thread HTTPD;
46 public HttpListener Listener;
47
48 public UserHTTPServer() {
49 ServerConsole.MainConsole.Instance.WriteLine("Starting up HTTP Server");
50 HTTPD = new Thread(new ThreadStart(StartHTTP));
51 HTTPD.Start();
52 }
53
54 public void StartHTTP() {
55 ServerConsole.MainConsole.Instance.WriteLine("UserHttp.cs:StartHTTP() - Spawned main thread OK");
56 Listener = new HttpListener();
57
58 Listener.Prefixes.Add("http://+:8002/userserver/");
59 Listener.Prefixes.Add("http://+:8002/usersessions/");
60 Listener.Start();
61
62 HttpListenerContext context;
63 while(true) {
64 context = Listener.GetContext();
65 ThreadPool.QueueUserWorkItem(new WaitCallback(HandleRequest), context);
66 }
67 }
68
69 static string ParseXMLRPC(string requestBody) {
70 XmlRpcRequest request = (XmlRpcRequest)(new XmlRpcRequestDeserializer()).Deserialize(requestBody);
71
72 Hashtable requestData = (Hashtable)request.Params[0];
73 switch(request.MethodName) {
74 case "login_to_simulator":
75 bool GoodXML= (requestData.Contains("first") && requestData.Contains("last") && requestData.Contains("passwd"));
76 bool GoodLogin=false;
77 string firstname="";
78 string lastname="";
79 string passwd="";
80
81 if(GoodXML) {
82 firstname=(string)requestData["first"];
83 lastname=(string)requestData["last"];
84 passwd=(string)requestData["passwd"];
85 GoodLogin=OpenUser_Main.userserver._profilemanager.AuthenticateUser(firstname,lastname,passwd);
86 }
87
88
89 if(!(GoodXML && GoodLogin)) {
90 XmlRpcResponse LoginErrorResp = new XmlRpcResponse();
91 Hashtable ErrorRespData = new Hashtable();
92 ErrorRespData["reason"]="key";
93 ErrorRespData["message"]="Error connecting to grid. Please double check your login details and check with the grid owner if you are sure these are correct";
94 ErrorRespData["login"]="false";
95 LoginErrorResp.Value=ErrorRespData;
96 return(Regex.Replace(XmlRpcResponseSerializer.Singleton.Serialize(LoginErrorResp)," encoding=\"utf-16\"","" ));
97 }
98
99 UserProfile TheUser=OpenUser_Main.userserver._profilemanager.GetProfileByName(firstname,lastname);
100
101 if(!((TheUser.CurrentSessionID==null) && (TheUser.CurrentSecureSessionID==null))) {
102 XmlRpcResponse PresenceErrorResp = new XmlRpcResponse();
103 Hashtable PresenceErrorRespData = new Hashtable();
104 PresenceErrorRespData["reason"]="presence";
105 PresenceErrorRespData["message"]="You appear to be already logged in, if this is not the case please wait for your session to timeout, if this takes longer than a few minutes please contact the grid owner";
106 PresenceErrorRespData["login"]="false";
107 PresenceErrorResp.Value=PresenceErrorRespData;
108 return(Regex.Replace(XmlRpcResponseSerializer.Singleton.Serialize(PresenceErrorResp)," encoding=\"utf-16\"","" ));
109
110 }
111
112 try {
113 LLUUID AgentID = TheUser.UUID;
114 TheUser.InitSessionData();
115 SimProfile SimInfo = new SimProfile();
116 SimInfo = SimInfo.LoadFromGrid(TheUser.homeregionhandle,OpenUser_Main.userserver.GridURL,OpenUser_Main.userserver.GridSendKey,OpenUser_Main.userserver.GridRecvKey);
117
118 XmlRpcResponse LoginGoodResp = new XmlRpcResponse();
119 Hashtable LoginGoodData = new Hashtable();
120
121 Hashtable GlobalT = new Hashtable();
122 GlobalT["sun_texture_id"] = "cce0f112-878f-4586-a2e2-a8f104bba271";
123 GlobalT["cloud_texture_id"] = "fc4b9f0b-d008-45c6-96a4-01dd947ac621";
124 GlobalT["moon_texture_id"] = "fc4b9f0b-d008-45c6-96a4-01dd947ac621";
125 ArrayList GlobalTextures = new ArrayList();
126 GlobalTextures.Add(GlobalT);
127
128 Hashtable LoginFlagsHash = new Hashtable();
129 LoginFlagsHash["daylight_savings"]="N";
130 LoginFlagsHash["stipend_since_login"]="N";
131 LoginFlagsHash["gendered"]="Y";
132 LoginFlagsHash["ever_logged_in"]="Y";
133 ArrayList LoginFlags=new ArrayList();
134 LoginFlags.Add(LoginFlagsHash);
135
136 Hashtable uiconfig = new Hashtable();
137 uiconfig["allow_first_life"]="Y";
138 ArrayList ui_config=new ArrayList();
139 ui_config.Add(uiconfig);
140
141 Hashtable ClassifiedCategoriesHash = new Hashtable();
142 ClassifiedCategoriesHash["category_name"]="bla bla";
143 ClassifiedCategoriesHash["category_id"]=(Int32)1;
144 ArrayList ClassifiedCategories = new ArrayList();
145 ClassifiedCategories.Add(ClassifiedCategoriesHash);
146
147 ArrayList AgentInventory = new ArrayList();
148 foreach(InventoryFolder InvFolder in TheUser.InventoryFolders.Values) {
149 Hashtable TempHash = new Hashtable();
150 TempHash["name"]=InvFolder.FolderName;
151 TempHash["parent_id"]=InvFolder.ParentID.ToStringHyphenated();
152 TempHash["version"]=(Int32)InvFolder.Version;
153 TempHash["type_default"]=(Int32)InvFolder.DefaultType;
154 TempHash["folder_id"]=InvFolder.FolderID.ToStringHyphenated();
155 AgentInventory.Add(TempHash);
156 }
157
158 Hashtable InventoryRootHash = new Hashtable();
159 InventoryRootHash["folder_id"]=TheUser.InventoryRoot.FolderID.ToStringHyphenated();
160 ArrayList InventoryRoot = new ArrayList();
161 InventoryRoot.Add(InventoryRootHash);
162
163 Hashtable InitialOutfitHash = new Hashtable();
164 InitialOutfitHash["folder_name"]="Nightclub Female";
165 InitialOutfitHash["gender"]="female";
166 ArrayList InitialOutfit = new ArrayList();
167 InitialOutfit.Add(InitialOutfitHash);
168
169 uint circode = (uint)(new Random()).Next();
170 TheUser.AddSimCircuit(circode, SimInfo.UUID);
171
172 LoginGoodData["last_name"]="\"" + TheUser.firstname + "\"";
173 LoginGoodData["ui-config"]=ui_config;
174 LoginGoodData["sim_ip"]=SimInfo.sim_ip.ToString();
175 LoginGoodData["login-flags"]=LoginFlags;
176 LoginGoodData["global-textures"]=GlobalTextures;
177 LoginGoodData["classified_categories"]=ClassifiedCategories;
178 LoginGoodData["event_categories"]=new ArrayList();
179 LoginGoodData["inventory-skeleton"]=AgentInventory;
180 LoginGoodData["inventory-skel-lib"]=new ArrayList();
181 LoginGoodData["inventory-root"]=InventoryRoot;
182 LoginGoodData["event_notifications"]=new ArrayList();
183 LoginGoodData["gestures"]=new ArrayList();
184 LoginGoodData["inventory-lib-owner"]=new ArrayList();
185 LoginGoodData["initial-outfit"]=InitialOutfit;
186 LoginGoodData["seconds_since_epoch"]=(Int32)(DateTime.UtcNow - new DateTime(1970,1,1)).TotalSeconds;
187 LoginGoodData["start_location"]="last";
188 LoginGoodData["home"]="{'region_handle':[r" + (SimInfo.RegionLocX*256).ToString() + ",r" + (SimInfo.RegionLocY*256).ToString() + "], 'position':[r" + TheUser.homepos.X.ToString() + ",r" + TheUser.homepos.Y.ToString() + ",r" + TheUser.homepos.Z.ToString() + "], 'look_at':[r" + TheUser.homelookat.X.ToString() + ",r" + TheUser.homelookat.Y.ToString() + ",r" + TheUser.homelookat.Z.ToString() + "]}";
189 LoginGoodData["message"]=OpenUser_Main.userserver.DefaultStartupMsg;
190 LoginGoodData["first_name"]="\"" + firstname + "\"";
191 LoginGoodData["circuit_code"]=(Int32)circode;
192 LoginGoodData["sim_port"]=(Int32)SimInfo.sim_port;
193 LoginGoodData["secure_session_id"]=TheUser.CurrentSecureSessionID.ToStringHyphenated();
194 LoginGoodData["look_at"]="\n[r" + TheUser.homelookat.X.ToString() + ",r" + TheUser.homelookat.Y.ToString() + ",r" + TheUser.homelookat.Z.ToString() + "]\n";
195 LoginGoodData["agent_id"]=AgentID.ToStringHyphenated();
196 LoginGoodData["region_y"]=(Int32)SimInfo.RegionLocY*256;
197 LoginGoodData["region_x"]=(Int32)SimInfo.RegionLocX*256;
198 LoginGoodData["seed_capability"]=null;
199 LoginGoodData["agent_access"]="M";
200 LoginGoodData["session_id"]=TheUser.CurrentSessionID.ToStringHyphenated();
201 LoginGoodData["login"]="true";
202
203 LoginGoodResp.Value=LoginGoodData;
204 TheUser.SendDataToSim(SimInfo);
205 return(Regex.Replace(XmlRpcResponseSerializer.Singleton.Serialize(LoginGoodResp),"utf-16","utf-8" ));
206
207 } catch (Exception E) {
208 Console.WriteLine(E.ToString());
209 }
210
211 break;
212 }
213
214 return "";
215 }
216
217 static string ParseREST(HttpListenerRequest www_req) {
218 Console.WriteLine("INCOMING REST - " + www_req.RawUrl);
219
220 char[] splitter = {'/'};
221 string[] rest_params = www_req.RawUrl.Split(splitter);
222 string req_type = rest_params[1]; // First part of the URL is the type of request - usersessions/userprofiles/inventory/blabla
223 switch(req_type) {
224 case "usersessions":
225 LLUUID sessionid = new LLUUID(rest_params[2]); // get usersessions/sessionid
226 if(www_req.HttpMethod=="DELETE") {
227 foreach (libsecondlife.LLUUID UUID in OpenUser_Main.userserver._profilemanager.UserProfiles.Keys) {
228 if(OpenUser_Main.userserver._profilemanager.UserProfiles[UUID].CurrentSessionID==sessionid) {
229 OpenUser_Main.userserver._profilemanager.UserProfiles[UUID].CurrentSessionID=null;
230 OpenUser_Main.userserver._profilemanager.UserProfiles[UUID].CurrentSecureSessionID=null;
231 OpenUser_Main.userserver._profilemanager.UserProfiles[UUID].Circuits.Clear();
232 }
233 }
234
235 }
236 return "OK";
237 break;
238 }
239
240 return "";
241 }
242
243
244 static void HandleRequest(Object stateinfo) {
245 HttpListenerContext context=(HttpListenerContext)stateinfo;
246
247 HttpListenerRequest request = context.Request;
248 HttpListenerResponse response = context.Response;
249
250 response.KeepAlive=false;
251 response.SendChunked=false;
252
253 System.IO.Stream body = request.InputStream;
254 System.Text.Encoding encoding = System.Text.Encoding.UTF8;
255 System.IO.StreamReader reader = new System.IO.StreamReader(body, encoding);
256
257 string requestBody = reader.ReadToEnd();
258 body.Close();
259 reader.Close();
260
261 string responseString="";
262 switch(request.ContentType) {
263 case "text/xml":
264 // must be XML-RPC, so pass to the XML-RPC parser
265
266 responseString=ParseXMLRPC(requestBody);
267 response.AddHeader("Content-type","text/xml");
268 break;
269
270 case "text/plaintext":
271 responseString=ParseREST(request);
272 response.AddHeader("Content-type","text/plaintext");
273 break;
274 }
275
276
277 byte[] buffer = System.Text.Encoding.UTF8.GetBytes(responseString);
278 System.IO.Stream output = response.OutputStream;
279 response.SendChunked=false;
280 response.ContentLength64=buffer.Length;
281 output.Write(buffer,0,buffer.Length);
282 output.Close();
283 }
284 }
285
286
287}
diff --git a/ogs/userserver/src/UserProfiles.cs b/ogs/userserver/src/UserProfiles.cs
deleted file mode 100644
index 4586ab3..0000000
--- a/ogs/userserver/src/UserProfiles.cs
+++ /dev/null
@@ -1,223 +0,0 @@
1/*
2Copyright (c) OpenGrid project, http://osgrid.org/
3
4
5* All rights reserved.
6*
7* Redistribution and use in source and binary forms, with or without
8* modification, are permitted provided that the following conditions are met:
9* * Redistributions of source code must retain the above copyright
10* notice, this list of conditions and the following disclaimer.
11* * Redistributions in binary form must reproduce the above copyright
12* notice, this list of conditions and the following disclaimer in the
13* documentation and/or other materials provided with the distribution.
14* * Neither the name of the <organization> nor the
15* names of its contributors may be used to endorse or promote products
16* derived from this software without specific prior written permission.
17*
18* THIS SOFTWARE IS PROVIDED BY <copyright holder> ``AS IS'' AND ANY
19* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
20* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21* DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY
22* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
24* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
25* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
27* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28*/
29
30using System;
31using System.Text;
32using System.Collections;
33using System.Collections.Generic;
34using libsecondlife;
35using Nwc.XmlRpc;
36using ServerConsole;
37
38namespace OpenGridServices
39{
40 /// <summary>
41 /// </summary>
42 public class UserProfileManager {
43
44 public Dictionary<LLUUID, UserProfile> UserProfiles = new Dictionary<LLUUID, UserProfile>();
45
46 public UserProfileManager() {
47 }
48
49 public void InitUserProfiles() {
50 // TODO: need to load from database
51 }
52
53 public UserProfile GetProfileByName(string firstname, string lastname) {
54 foreach (libsecondlife.LLUUID UUID in UserProfiles.Keys) {
55 if((UserProfiles[UUID].firstname==firstname) && (UserProfiles[UUID].lastname==lastname)) return UserProfiles[UUID];
56 }
57 return null;
58 }
59
60 public UserProfile GetProfileByLLUUID(LLUUID ProfileLLUUID) {
61 return UserProfiles[ProfileLLUUID];
62 }
63
64 public bool AuthenticateUser(string firstname, string lastname, string passwd) {
65 UserProfile TheUser=GetProfileByName(firstname, lastname);
66 if(TheUser != null)
67 if(TheUser.MD5passwd==passwd) {
68 return true;
69 } else {
70 return false;
71 } else return false;
72
73 }
74
75 public void SetGod(LLUUID GodID) {
76 this.UserProfiles[GodID].IsGridGod=true;
77 }
78
79 public UserProfile CreateNewProfile(string firstname, string lastname, string MD5passwd) {
80 UserProfile newprofile = new UserProfile();
81 newprofile.homeregionhandle=Util.UIntsToLong((997*256), (996*256));
82 newprofile.firstname=firstname;
83 newprofile.lastname=lastname;
84 newprofile.MD5passwd=MD5passwd;
85 newprofile.UUID=LLUUID.Random();
86 this.UserProfiles.Add(newprofile.UUID,newprofile);
87 return newprofile;
88 }
89
90 }
91
92 public class UserProfile {
93
94 public string firstname;
95 public string lastname;
96 public ulong homeregionhandle;
97 public LLVector3 homepos;
98 public LLVector3 homelookat;
99
100 public bool IsGridGod=false;
101 public bool IsLocal=true; // will be used in future for visitors from foreign grids
102 public string AssetURL;
103 public string MD5passwd;
104
105 public LLUUID CurrentSessionID;
106 public LLUUID CurrentSecureSessionID;
107 public LLUUID UUID;
108 public Dictionary<LLUUID, uint> Circuits = new Dictionary<LLUUID, uint>(); // tracks circuit codes
109
110 public InventoryFolder InventoryRoot;
111 public Dictionary<LLUUID, InventoryFolder> InventoryFolders;
112 public Dictionary<LLUUID, InventoryItem> InventoryItems;
113
114 public UserProfile() {
115 Circuits = new Dictionary<LLUUID, uint>();
116 InventoryFolders = new Dictionary<LLUUID, InventoryFolder>();
117 InventoryItems = new Dictionary<LLUUID, InventoryItem>();
118 InventoryRoot=new InventoryFolder();
119 InventoryRoot.FolderID = LLUUID.Random();
120 InventoryRoot.ParentID=new LLUUID();
121 InventoryRoot.Version=1;
122 InventoryRoot.DefaultType=8;
123 InventoryRoot.FolderName="My Inventory";
124 InventoryFolders.Add(InventoryRoot.FolderID, InventoryRoot);
125 homeregionhandle=Util.UIntsToLong((997*256), (996*256));;
126 }
127
128 public void InitSessionData() {
129 CurrentSessionID=LLUUID.Random();
130 CurrentSecureSessionID=LLUUID.Random();
131 }
132
133 public void AddSimCircuit(uint circuit_code, LLUUID region_UUID) {
134 if(this.Circuits.ContainsKey(region_UUID)== false)
135 this.Circuits.Add(region_UUID, circuit_code);
136 }
137
138 public void SendDataToSim(SimProfile TheSim) {
139 Console.WriteLine(TheSim.caps_url);
140 Hashtable SimParams = new Hashtable();
141 SimParams["session_id"]=this.CurrentSessionID.ToString();
142 SimParams["secure_session_id"]=this.CurrentSecureSessionID.ToString();
143 SimParams["firstname"]=this.firstname;
144 SimParams["lastname"]=this.lastname;
145 SimParams["agent_id"]=this.UUID.ToString();
146 SimParams["circuit_code"]=(Int32)this.Circuits[TheSim.UUID];
147 ArrayList SendParams = new ArrayList();
148 SendParams.Add(SimParams);
149
150 XmlRpcRequest GridReq = new XmlRpcRequest("expect_user",SendParams);
151 XmlRpcResponse GridResp = GridReq.Send(TheSim.caps_url,3000);
152 }
153 }
154
155 public class InventoryFolder {
156 public LLUUID FolderID;
157 public LLUUID ParentID;
158 public string FolderName;
159 public ushort DefaultType;
160 public ushort Version;
161 }
162
163 public class InventoryItem { //TODO: Fixup this and add full permissions etc
164 public LLUUID FolderID;
165 public LLUUID OwnerID;
166 public LLUUID ItemID;
167 public LLUUID AssetID;
168 public LLUUID CreatorID = LLUUID.Zero;
169 public sbyte InvType;
170 public sbyte Type;
171 public string Name;
172 public string Description;
173 }
174
175 public class SimProfile {
176 public LLUUID UUID;
177 public ulong regionhandle;
178 public string regionname;
179 public string sim_ip;
180 public uint sim_port;
181 public string caps_url;
182 public uint RegionLocX;
183 public uint RegionLocY;
184 public string sendkey;
185 public string recvkey;
186
187
188 public SimProfile LoadFromGrid(ulong region_handle, string GridURL, string SendKey, string RecvKey) {
189 try {
190 Hashtable GridReqParams = new Hashtable();
191 GridReqParams["region_handle"]=region_handle.ToString();
192 GridReqParams["caller"]="userserver";
193 GridReqParams["authkey"]=SendKey;
194 ArrayList SendParams = new ArrayList();
195 SendParams.Add(GridReqParams);
196 XmlRpcRequest GridReq = new XmlRpcRequest("get_sim_info",SendParams);
197
198 XmlRpcResponse GridResp = GridReq.Send(GridURL,3000);
199
200 Hashtable RespData=(Hashtable)GridResp.Value;
201 this.UUID = new LLUUID((string)RespData["UUID"]);
202 this.regionhandle = (ulong)Convert.ToUInt64(RespData["regionhandle"]);
203 this.regionname=(string)RespData["regionname"];
204 this.sim_ip=(string)RespData["sim_ip"];
205 this.sim_port=(uint)Convert.ToUInt16(RespData["sim_port"]);
206 this.caps_url=(string)RespData["caps_url"];
207 this.RegionLocX=(uint)Convert.ToUInt32(RespData["RegionLocX"]);
208 this.RegionLocY=(uint)Convert.ToUInt32(RespData["RegionLocY"]);
209 this.sendkey=(string)RespData["sendkey"];
210 this.recvkey=(string)RespData["recvkey"];
211 } catch(Exception e) {
212 Console.WriteLine(e.ToString());
213 }
214 return this;
215 }
216
217 public SimProfile() {
218 }
219
220
221 }
222
223}
diff --git a/ogs/userserver/src/Util.cs b/ogs/userserver/src/Util.cs
deleted file mode 100644
index 1efa471..0000000
--- a/ogs/userserver/src/Util.cs
+++ /dev/null
@@ -1,87 +0,0 @@
1/*
2Copyright (c) OpenSim project, http://osgrid.org/
3
4* Copyright (c) <year>, <copyright holder>
5* All rights reserved.
6*
7* Redistribution and use in source and binary forms, with or without
8* modification, are permitted provided that the following conditions are met:
9* * Redistributions of source code must retain the above copyright
10* notice, this list of conditions and the following disclaimer.
11* * Redistributions in binary form must reproduce the above copyright
12* notice, this list of conditions and the following disclaimer in the
13* documentation and/or other materials provided with the distribution.
14* * Neither the name of the <organization> nor the
15* names of its contributors may be used to endorse or promote products
16* derived from this software without specific prior written permission.
17*
18* THIS SOFTWARE IS PROVIDED BY <copyright holder> ``AS IS'' AND ANY
19* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
20* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21* DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY
22* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
24* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
25* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
27* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28*/
29
30using System;
31using System.Collections.Generic;
32using System.Threading;
33using libsecondlife;
34using libsecondlife.Packets;
35
36namespace OpenGridServices
37{
38 /// <summary>
39 /// </summary>
40 ///
41 public class Util
42 {
43 public static ulong UIntsToLong(uint X, uint Y)
44 {
45 return Helpers.UIntsToLong(X,Y);
46 }
47 public Util()
48 {
49
50 }
51 }
52
53 public class QueItem {
54 public QueItem()
55 {
56 }
57
58 public Packet Packet;
59 public bool Incoming;
60 }
61
62
63 public class BlockingQueue< T > {
64 private Queue< T > _queue = new Queue< T >();
65 private object _queueSync = new object();
66
67 public void Enqueue(T value)
68 {
69 lock(_queueSync)
70 {
71 _queue.Enqueue(value);
72 Monitor.Pulse(_queueSync);
73 }
74 }
75
76 public T Dequeue()
77 {
78 lock(_queueSync)
79 {
80 if( _queue.Count < 1)
81 Monitor.Wait(_queueSync);
82
83 return _queue.Dequeue();
84 }
85 }
86 }
87}
diff --git a/opensim.build b/opensim.build
deleted file mode 100644
index 41c2e66..0000000
--- a/opensim.build
+++ /dev/null
@@ -1,82 +0,0 @@
1<?xml version="1.0"?>
2 <project name="OpenSim" default="build" basedir=".">
3 <description>nant buildfile for OpenSim</description>
4 <property name="debug" value="true" overwrite="false" />
5 <target name="clean" description="remove all generated files">
6 <delete file="bin/OpenSim.exe" failonerror="false" />
7 <delete file="bin/OpenSim.pdb" failonerror="false" />
8 </target>
9
10 <target name="svnupdate" description="updates to latest SVN">
11 <exec program="svn">
12 <arg value="update" />
13 </exec>
14 </target>
15
16 <target name="upgrade" description="updates from SVN and then builds" depends="clean,svnupdate,build">
17
18 </target>
19
20 <target name="genvers">
21 <exec program="genvers.sh" />
22 <loadfile file="VERSION" property="svnver"/>
23 </target>
24
25 <target name="setvers">
26 <property name="svnver" value="0.0.0.1" />
27 </target>
28
29 <target name="build" description="compiles the source code" depends="genvers, core_build">
30 </target>
31
32 <target name="nogenvers" description="compiles the source code" depends="setvers, core_build">
33 </target>
34
35 <target name="core_build" description="compiles the source code">
36
37
38 <nant>
39 <buildfiles>
40 <include name="src/GridInterfaces/default.build" />
41 <include name="src/OpenSim.Framework/default.build" />
42 <include name="src/ServerConsole/default.build" />
43 <include name="src/LocalServers/default.build" />
44 <include name="src/RemoteServers/default.build" />
45 <include name="src/physics/default.build" />
46 <include name="src/physics/plugins/default.build" />
47 <include name="src/LocalStorage/default.build" />
48 <include name="src/OpenSim.Framework/default.build" />
49 </buildfiles>
50 </nant>
51
52 <csc target="exe" output="bin/OpenSim.exe" debug="${debug}" verbose="true" warninglevel="4">
53 <references basedir="bin/" failonempty="true">
54 <include name="System.dll" />
55 <include name="System.Data.dll" />
56 <include name="System.Xml.dll" />
57 <include name="Axiom.MathLib.dll" />
58 <include name="libsecondlife.dll" />
59 <include name="log4net.dll" />
60 <include name="Db4objects.Db4o.dll" />
61 <include name="ServerConsole.dll" />
62 <include name="GridInterfaces.dll" />
63 <include name="PhysicsManager.dll" />
64 <include name="OpenSim.Framework.dll" />
65 </references>
66 <sources basedir="src/">
67 <include name="*.cs" />
68 <include name="types/*.cs" />
69 <include name="world/*.cs" />
70 <include name="GridServers/*.cs" />
71 <include name="Assets/*.cs" />
72 <include name="CAPS/*.cs" />
73 </sources>
74 </csc>
75
76 <nant>
77 <buildfiles>
78 <include name="src/Config/default.build" />
79 </buildfiles>
80 </nant>
81 </target>
82</project>
diff --git a/prebuild.xml b/prebuild.xml
new file mode 100644
index 0000000..ca3ac2f
--- /dev/null
+++ b/prebuild.xml
@@ -0,0 +1,326 @@
1<?xml version="1.0" encoding="utf-8" ?>
2<Prebuild xmlns="http://dnpb.sourceforge.net/schemas/prebuild-1.7.xsd" version="1.7">
3 <Solution name="OpenSim" activeConfig="Debug" path="./">
4 <Configuration name="Debug">
5 <Options>
6 <CompilerDefines>TRACE;DEBUG</CompilerDefines>
7 <OptimizeCode>false</OptimizeCode>
8 <CheckUnderflowOverflow>false</CheckUnderflowOverflow>
9 <AllowUnsafe>false</AllowUnsafe>
10 <WarningLevel>4</WarningLevel>
11 <WarningsAsErrors>false</WarningsAsErrors>
12 <SuppressWarnings></SuppressWarnings>
13 <OutputPath>bin</OutputPath>
14 <DebugInformation>true</DebugInformation>
15 <IncrementalBuild>true</IncrementalBuild>
16 <NoStdLib>false</NoStdLib>
17 </Options>
18 </Configuration>
19 <Configuration name="Release">
20 <Options>
21 <CompilerDefines>TRACE</CompilerDefines>
22 <OptimizeCode>true</OptimizeCode>
23 <CheckUnderflowOverflow>false</CheckUnderflowOverflow>
24 <AllowUnsafe>false</AllowUnsafe>
25 <WarningLevel>4</WarningLevel>
26 <WarningsAsErrors>false</WarningsAsErrors>
27 <SuppressWarnings></SuppressWarnings>
28 <OutputPath>bin</OutputPath>
29 <DebugInformation>false</DebugInformation>
30 <IncrementalBuild>true</IncrementalBuild>
31 <NoStdLib>false</NoStdLib>
32 </Options>
33 </Configuration>
34
35 <!-- Core OpenSim Projects -->
36
37 <Project name="OpenSim.Framework" path="./OpenSim.Framework" type="Library">
38 <Configuration name="Debug">
39 <Options>
40 <OutputPath>../bin/</OutputPath>
41 </Options>
42 </Configuration>
43 <Configuration name="Release">
44 <Options>
45 <OutputPath>../bin/</OutputPath>
46 </Options>
47 </Configuration>
48
49 <ReferencePath>../bin/</ReferencePath>
50 <Reference name="System.dll"/>
51 <Reference name="System.Xml.dll"/>
52 <Reference name="libsecondlife.dll"/>
53 <Files>
54 <Match pattern="*.cs" recurse="true"/>
55 </Files>
56 </Project>
57
58 <Project name="OpenSim.Framework.Console" path="./OpenSim.Framework.Console" type="Library">
59 <Configuration name="Debug">
60 <Options>
61 <OutputPath>../bin/</OutputPath>
62 </Options>
63 </Configuration>
64 <Configuration name="Release">
65 <Options>
66 <OutputPath>../bin/</OutputPath>
67 </Options>
68 </Configuration>
69
70 <ReferencePath>../bin/</ReferencePath>
71 <Reference name="System" localCopy="false"/>
72 <Files>
73 <Match pattern="*.cs" recurse="true"/>
74 </Files>
75 </Project>
76
77 <Project name="OpenSim.Physics.Manager" path="./OpenSim.Physics/Manager" type="Library">
78 <Configuration name="Debug">
79 <Options>
80 <OutputPath>../../bin/</OutputPath>
81 </Options>
82 </Configuration>
83 <Configuration name="Release">
84 <Options>
85 <OutputPath>../../bin/</OutputPath>
86 </Options>
87 </Configuration>
88
89 <ReferencePath>../../bin/</ReferencePath>
90 <Reference name="System" localCopy="false"/>
91 <Reference name="System.Xml.dll" localCopy="false" />
92 <Reference name="Axiom.MathLib.dll" localCopy="false"/>
93 <Reference name="OpenSim.Framework.Console" localCopy="false"/>
94 <Files>
95 <Match pattern="*.cs" recurse="false"/>
96 </Files>
97 </Project>
98
99 <!-- Config Plug-ins -->
100 <Project name="OpenSim.Config.SimConfigDb4o" path="./OpenSim.Config/SimConfigDb4o" type="Library">
101 <Configuration name="Debug">
102 <Options>
103 <OutputPath>../../bin/</OutputPath>
104 </Options>
105 </Configuration>
106 <Configuration name="Release">
107 <Options>
108 <OutputPath>../../bin/</OutputPath>
109 </Options>
110 </Configuration>
111
112 <ReferencePath>../../bin/</ReferencePath>
113 <Reference name="System" localCopy="false"/>
114 <Reference name="System.Data.dll"/>
115 <Reference name="System.Xml.dll"/>
116 <Reference name="libsecondlife.dll"/>
117 <Reference name="Db4objects.Db4o.dll"/>
118 <Reference name="OpenSim.Framework"/>
119 <Reference name="OpenSim.Framework.Console"/>
120 <Files>
121 <Match pattern="*.cs" recurse="true"/>
122 </Files>
123 </Project>
124
125 <!-- Grid Server Plug-ins -->
126 <Project name="OpenSim.GridInterfaces.Local" path="OpenSim.GridInterfaces/Local" type="Library">
127 <Configuration name="Debug">
128 <Options>
129 <OutputPath>../../bin/</OutputPath>
130 </Options>
131 </Configuration>
132 <Configuration name="Release">
133 <Options>
134 <OutputPath>../../bin/</OutputPath>
135 </Options>
136 </Configuration>
137
138 <ReferencePath>../../bin/</ReferencePath>
139 <Reference name="System" localCopy="false"/>
140 <Reference name="System.Xml.dll"/>
141 <Reference name="Db4objects.Db4o.dll"/>
142 <Reference name="libsecondlife.dll"/>
143 <Reference name="OpenSim.Framework"/>
144 <Reference name="OpenSim.Framework.Console"/>
145 <Files>
146 <Match pattern="*.cs" recurse="true"/>
147 </Files>
148 </Project>
149
150 <Project name="OpenSim.GridInterfaces.Remote" path="OpenSim.GridInterfaces/Remote" type="Library">
151 <Configuration name="Debug">
152 <Options>
153 <OutputPath>../../bin/</OutputPath>
154 </Options>
155 </Configuration>
156 <Configuration name="Release">
157 <Options>
158 <OutputPath>../../bin/</OutputPath>
159 </Options>
160 </Configuration>
161
162 <ReferencePath>../../bin/</ReferencePath>
163 <Reference name="System" localCopy="false"/>
164 <Reference name="System.Xml.dll"/>
165 <Reference name="libsecondlife.dll"/>
166 <Reference name="OpenSim.Framework"/>
167 <Reference name="OpenSim.Framework.Console"/>
168 <Files>
169 <Match pattern="*.cs" recurse="true"/>
170 </Files>
171 </Project>
172
173 <!-- Physics Plug-ins -->
174 <Project name="OpenSim.Physics.BasicPhysicsPlugin" path="OpenSim.Physics/BasicPhysicsPlugin" type="Library">
175 <Configuration name="Debug">
176 <Options>
177 <OutputPath>../../bin/Physics/</OutputPath>
178 </Options>
179 </Configuration>
180 <Configuration name="Release">
181 <Options>
182 <OutputPath>../../bin/Physics/</OutputPath>
183 </Options>
184 </Configuration>
185
186 <ReferencePath>../../bin/</ReferencePath>
187 <Reference name="System" localCopy="false"/>
188 <Reference name="Axiom.MathLib.dll" localCopy="false"/>
189 <Reference name="OpenSim.Physics.Manager" localCopy="false"/>
190 <Files>
191 <Match pattern="*.cs" recurse="true"/>
192 </Files>
193 </Project>
194
195 <Project name="OpenSim.Physics.PhysXPlugin" path="OpenSim.Physics/PhysXPlugin" type="Library">
196 <Configuration name="Debug">
197 <Options>
198 <OutputPath>../../bin/Physics/</OutputPath>
199 </Options>
200 </Configuration>
201 <Configuration name="Release">
202 <Options>
203 <OutputPath>../../bin/Physics/</OutputPath>
204 </Options>
205 </Configuration>
206
207 <ReferencePath>../../bin/</ReferencePath>
208 <Reference name="System" localCopy="false"/>
209 <Reference name="Axiom.MathLib.dll" localCopy="false"/>
210 <Reference name="PhysX_Wrapper_Dotnet.dll" localCopy="false"/>
211 <Reference name="OpenSim.Physics.Manager" localCopy="false"/>
212 <Files>
213 <Match pattern="*.cs" recurse="true"/>
214 </Files>
215 </Project>
216
217 <!-- OpenSim app -->
218 <Project name="OpenSim.RegionServer" path="OpenSim.RegionServer" type="Exe" startupObject="OpenSim.RegionServer">
219 <Configuration name="Debug">
220 <Options>
221 <OutputPath>../bin/</OutputPath>
222 </Options>
223 </Configuration>
224 <Configuration name="Release">
225 <Options>
226 <OutputPath>../bin/</OutputPath>
227 </Options>
228 </Configuration>
229
230 <ReferencePath>../bin/</ReferencePath>
231 <Reference name="System" localCopy="false"/>
232 <Reference name="System.Xml.dll"/>
233 <Reference name="libsecondlife.dll"/>
234 <Reference name="Axiom.MathLib.dll"/>
235 <Reference name="Db4objects.Db4o.dll"/>
236 <Reference name="OpenSim.Framework.Console"/>
237 <Reference name="OpenSim.Physics.Manager"/>
238 <Reference name="OpenSim.Framework"/>
239
240 <Files>
241 <Match pattern="*.cs" recurse="true"/>
242 </Files>
243 </Project>
244
245 <!-- Storage Plug-ins -->
246 <Project name="OpenSim.Storage.LocalStorageDb4o" path="OpenSim.Storage/LocalStorageDb4o" type="Library">
247 <Configuration name="Debug">
248 <Options>
249 <OutputPath>../../bin/</OutputPath>
250 </Options>
251 </Configuration>
252 <Configuration name="Release">
253 <Options>
254 <OutputPath>../../bin/</OutputPath>
255 </Options>
256 </Configuration>
257
258 <ReferencePath>../../bin/</ReferencePath>
259 <Reference name="System" localCopy="false"/>
260 <Reference name="System.Xml.dll"/>
261 <Reference name="Db4objects.Db4o.dll"/>
262 <Reference name="libsecondlife.dll"/>
263 <Reference name="OpenSim.Framework"/>
264 <Reference name="OpenSim.Framework.Console"/>
265 <Files>
266 <Match pattern="*.cs" recurse="true"/>
267 </Files>
268 </Project>
269 </Solution>
270 <Solution name="Prebuild" path="./Prebuild/" >
271 <Configuration name="Debug">
272 <Options>
273 <CompilerDefines>DEBUG;TRACE</CompilerDefines>
274 <OptimizeCode>false</OptimizeCode>
275 <OutputPath>bin/Debug</OutputPath>
276 <DebugInformation>true</DebugInformation>
277 <SuppressWarnings>1595</SuppressWarnings>
278 </Options>
279 </Configuration>
280 <Configuration name="Release">
281 <Options>
282 <CompilerDefines>TRACE</CompilerDefines>
283 <OutputPath>bin/Release</OutputPath>
284 <OptimizeCode>true</OptimizeCode>
285 <DebugInformation>false</DebugInformation>
286 <SuppressWarnings>1595</SuppressWarnings>
287 </Options>
288 </Configuration>
289 <Files>
290 <File>prebuild.xml</File>
291 <File>prebuild</File>
292 </Files>
293 <Project name="Prebuild" path="src/" language="C#" assemblyName="prebuild" icon="App.ico" type="Exe" rootNamespace="Prebuild" startupObject="Prebuild.Prebuild">
294 <Configuration name="Debug">
295 <Options>
296 <CompilerDefines>DEBUG;TRACE</CompilerDefines>
297 <OptimizeCode>false</OptimizeCode>
298 <OutputPath>..\bin\</OutputPath>
299 <DebugInformation>true</DebugInformation>
300 <KeyFile>Prebuild.snk</KeyFile>
301 <SuppressWarnings>1595</SuppressWarnings>
302 </Options>
303 </Configuration>
304 <Configuration name="Release">
305 <Options>
306 <CompilerDefines>TRACE</CompilerDefines>
307 <OutputPath>..\bin\</OutputPath>
308 <OptimizeCode>true</OptimizeCode>
309 <DebugInformation>false</DebugInformation>
310 <KeyFile>Prebuild.snk</KeyFile>
311 <SuppressWarnings>1595</SuppressWarnings>
312 </Options>
313 </Configuration>
314 <Reference name="System.EnterpriseServices" />
315 <Reference name="System.Xml" />
316 <Reference name="System" />
317 <Files>
318 <Match pattern="App.ico" buildAction="EmbeddedResource"/>
319 <Match path="data" pattern="prebuild-1.7.xsd" buildAction="EmbeddedResource"/>
320 <Match pattern="*.cs" recurse="true"/>
321 </Files>
322 </Project>
323 </Solution>
324</Prebuild>
325
326
diff --git a/src/AssemblyInfo.cs b/src/AssemblyInfo.cs
deleted file mode 100644
index b88eb75..0000000
--- a/src/AssemblyInfo.cs
+++ /dev/null
@@ -1,21 +0,0 @@
1using System;
2using System.Reflection;
3using System.Runtime.InteropServices;
4
5//------------------------------------------------------------------------------
6// <auto-generated>
7// This code was generated by a tool.
8// Runtime Version:2.0.50727.42
9//
10// Changes to this file may cause incorrect behavior and will be lost if
11// the code is regenerated.
12// </auto-generated>
13//------------------------------------------------------------------------------
14
15[assembly: ComVisibleAttribute(false)]
16[assembly: CLSCompliantAttribute(false)]
17[assembly: AssemblyVersionAttribute("0.0.0.1")]
18[assembly: AssemblyTitleAttribute("opensim")]
19[assembly: AssemblyDescriptionAttribute("The C# implementation of the simulator portion of OGS")]
20[assembly: AssemblyCopyrightAttribute("Copyright © OGS development team 2007")]
21
diff --git a/src/Assets/AssetCache.cs b/src/Assets/AssetCache.cs
deleted file mode 100644
index d35b482..0000000
--- a/src/Assets/AssetCache.cs
+++ /dev/null
@@ -1,436 +0,0 @@
1/*
2* Copyright (c) OpenSim project, http://sim.opensecondlife.org/
3*
4* Redistribution and use in source and binary forms, with or without
5* modification, are permitted provided that the following conditions are met:
6* * Redistributions of source code must retain the above copyright
7* notice, this list of conditions and the following disclaimer.
8* * Redistributions in binary form must reproduce the above copyright
9* notice, this list of conditions and the following disclaimer in the
10* documentation and/or other materials provided with the distribution.
11* * Neither the name of the <organization> nor the
12* names of its contributors may be used to endorse or promote products
13* derived from this software without specific prior written permission.
14*
15* THIS SOFTWARE IS PROVIDED BY <copyright holder> ``AS IS'' AND ANY
16* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
18* DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY
19* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
20* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
21* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
22* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
24* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25*
26*/
27
28using System;
29using System.Collections.Generic;
30using System.Threading;
31using libsecondlife;
32using libsecondlife.Packets;
33using OpenSim;
34using OpenSim.GridServers;
35
36namespace OpenSim.Assets
37{
38 /// <summary>
39 /// Manages local cache of assets and their sending to viewers.
40 /// </summary>
41 public class AssetCache : IAssetReceiver
42 {
43 public Dictionary<libsecondlife.LLUUID, AssetInfo> Assets;
44 public Dictionary<libsecondlife.LLUUID, TextureImage> Textures;
45
46 public List<AssetRequest> AssetRequests = new List<AssetRequest>(); //assets ready to be sent to viewers
47 public List<AssetRequest> TextureRequests = new List<AssetRequest>(); //textures ready to be sent
48
49 public Dictionary<LLUUID, AssetRequest> RequestedAssets = new Dictionary<LLUUID, AssetRequest>(); //Assets requested from the asset server
50 public Dictionary<LLUUID, AssetRequest> RequestedTextures = new Dictionary<LLUUID, AssetRequest>(); //Textures requested from the asset server
51
52 private IAssetServer _assetServer;
53 private Thread _assetCacheThread;
54
55 /// <summary>
56 ///
57 /// </summary>
58 public AssetCache( IAssetServer assetServer)
59 {
60 _assetServer = assetServer;
61 _assetServer.SetReceiver(this);
62 Assets = new Dictionary<libsecondlife.LLUUID, AssetInfo> ();
63 Textures = new Dictionary<libsecondlife.LLUUID, TextureImage> ();
64 this._assetCacheThread = new Thread( new ThreadStart(RunAssetManager));
65 this._assetCacheThread.IsBackground = true;
66 this._assetCacheThread.Start();
67 }
68
69 /// <summary>
70 ///
71 /// </summary>
72 private void RunAssetManager()
73 {
74 this.ProcessAssetQueue();
75 this.ProcessTextureQueue();
76 Thread.Sleep(100);
77 }
78
79 /// <summary>
80 ///
81 /// </summary>
82 private void ProcessTextureQueue()
83 {
84 if(this.TextureRequests.Count == 0)
85 {
86 //no requests waiting
87 return;
88 }
89 int num;
90
91 if(this.TextureRequests.Count < 5)
92 {
93 //lower than 5 so do all of them
94 num = this.TextureRequests.Count;
95 }
96 else
97 {
98 num=5;
99 }
100 AssetRequest req;
101 for(int i = 0; i < num; i++)
102 {
103 req=(AssetRequest)this.TextureRequests[i];
104
105 if(req.PacketCounter == 0)
106 {
107 //first time for this request so send imagedata packet
108 if(req.NumPackets == 1)
109 {
110 //only one packet so send whole file
111 ImageDataPacket im = new ImageDataPacket();
112 im.ImageID.Packets = 1;
113 im.ImageID.ID = req.ImageInfo.FullID;
114 im.ImageID.Size = (uint)req.ImageInfo.Data.Length;
115 im.ImageData.Data = req.ImageInfo.Data;
116 im.ImageID.Codec = 2;
117 req.RequestUser.OutPacket(im);
118 req.PacketCounter++;
119 //req.ImageInfo.l= time;
120 //System.Console.WriteLine("sent texture: "+req.image_info.FullID);
121 }
122 else
123 {
124 //more than one packet so split file up
125 ImageDataPacket im = new ImageDataPacket();
126 im.ImageID.Packets = (ushort)req.NumPackets;
127 im.ImageID.ID = req.ImageInfo.FullID;
128 im.ImageID.Size = (uint)req.ImageInfo.Data.Length;
129 im.ImageData.Data = new byte[600];
130 Array.Copy(req.ImageInfo.Data, 0, im.ImageData.Data, 0, 600);
131 im.ImageID.Codec = 2;
132 req.RequestUser.OutPacket(im);
133 req.PacketCounter++;
134 //req.ImageInfo.last_used = time;
135 //System.Console.WriteLine("sent first packet of texture:
136 }
137 }
138 else
139 {
140 //send imagepacket
141 //more than one packet so split file up
142 ImagePacketPacket im = new ImagePacketPacket();
143 im.ImageID.Packet = (ushort)req.PacketCounter;
144 im.ImageID.ID = req.ImageInfo.FullID;
145 int size = req.ImageInfo.Data.Length - 600 - 1000*(req.PacketCounter - 1);
146 if(size > 1000) size = 1000;
147 im.ImageData.Data = new byte[size];
148 Array.Copy(req.ImageInfo.Data, 600 + 1000*(req.PacketCounter - 1), im.ImageData.Data, 0, size);
149 req.RequestUser.OutPacket(im);
150 req.PacketCounter++;
151 //req.ImageInfo.last_used = time;
152 //System.Console.WriteLine("sent a packet of texture: "+req.image_info.FullID);
153 }
154 }
155
156 //remove requests that have been completed
157 int count = 0;
158 for(int i = 0; i < num; i++)
159 {
160 req=(AssetRequest)this.TextureRequests[count];
161 if(req.PacketCounter == req.NumPackets)
162 {
163 this.TextureRequests.Remove(req);
164 }
165 else
166 {
167 count++;
168 }
169 }
170
171 }
172 public void AssetReceived(AssetBase asset, bool IsTexture)
173 {
174 //check if it is a texture or not
175 //then add to the correct cache list
176 //then check for waiting requests for this asset/texture (in the Requested lists)
177 //and move those requests into the Requests list.
178 if(IsTexture)
179 {
180 TextureImage image = new TextureImage(asset);
181 this.Textures.Add(image.FullID, image);
182 if(this.RequestedTextures.ContainsKey(image.FullID))
183 {
184 AssetRequest req = this.RequestedTextures[image.FullID];
185 req.ImageInfo = image;
186 this.RequestedTextures.Remove(image.FullID);
187 this.TextureRequests.Add(req);
188 }
189 }
190 else
191 {
192 AssetInfo assetInf = new AssetInfo(asset);
193 this.Assets.Add(assetInf.FullID, assetInf);
194 if(this.RequestedAssets.ContainsKey(assetInf.FullID))
195 {
196 AssetRequest req = this.RequestedAssets[assetInf.FullID];
197 req.AssetInf = assetInf;
198 this.RequestedAssets.Remove(assetInf.FullID);
199 this.AssetRequests.Add(req);
200 }
201 }
202 }
203
204 public void AssetNotFound(AssetBase asset)
205 {
206 //the asset server had no knowledge of requested asset
207
208 }
209
210 #region Assets
211 /// <summary>
212 ///
213 /// </summary>
214 /// <param name="userInfo"></param>
215 /// <param name="transferRequest"></param>
216 public void AddAssetRequest(OpenSimClient userInfo, TransferRequestPacket transferRequest)
217 {
218 LLUUID requestID = new LLUUID(transferRequest.TransferInfo.Params, 0);
219 //check to see if asset is in local cache, if not we need to request it from asset server.
220 if(!this.Assets.ContainsKey(requestID))
221 {
222 //not found asset
223 // so request from asset server
224 AssetRequest request = new AssetRequest();
225 request.RequestUser = userInfo;
226 request.RequestAssetID = requestID;
227 request.TransferRequestID = transferRequest.TransferInfo.TransferID;
228 this.RequestedAssets.Add(requestID,request);
229 this._assetServer.RequestAsset(requestID, false);
230 return;
231 }
232 //it is in our cache
233 AssetInfo asset = this.Assets[requestID];
234
235 //work out how many packets it should be sent in
236 // and add to the AssetRequests list
237 AssetRequest req = new AssetRequest();
238 req.RequestUser = userInfo;
239 req.RequestAssetID = requestID;
240 req.TransferRequestID = transferRequest.TransferInfo.TransferID;
241 req.AssetInf = asset;
242
243 if(asset.Data.LongLength>600)
244 {
245 //over 600 bytes so split up file
246 req.NumPackets = 1 + (int)(asset.Data.Length-600+999)/1000;
247 }
248 else
249 {
250 req.NumPackets = 1;
251 }
252
253 this.AssetRequests.Add(req);
254 }
255
256 /// <summary>
257 ///
258 /// </summary>
259 private void ProcessAssetQueue()
260 {
261 if(this.AssetRequests.Count == 0)
262 {
263 //no requests waiting
264 return;
265 }
266 int num;
267
268 if(this.AssetRequests.Count < 5)
269 {
270 //lower than 5 so do all of them
271 num = this.AssetRequests.Count;
272 }
273 else
274 {
275 num=5;
276 }
277 AssetRequest req;
278 for(int i = 0; i < num; i++)
279 {
280 req=(AssetRequest)this.AssetRequests[i];
281
282 TransferInfoPacket Transfer = new TransferInfoPacket();
283 Transfer.TransferInfo.ChannelType = 2;
284 Transfer.TransferInfo.Status = 0;
285 Transfer.TransferInfo.TargetType = 0;
286 Transfer.TransferInfo.Params = req.RequestAssetID.GetBytes();
287 Transfer.TransferInfo.Size = (int)req.AssetInf.Data.Length;
288 Transfer.TransferInfo.TransferID = req.TransferRequestID;
289 req.RequestUser.OutPacket(Transfer);
290
291 if(req.NumPackets == 1)
292 {
293 TransferPacketPacket TransferPacket = new TransferPacketPacket();
294 TransferPacket.TransferData.Packet = 0;
295 TransferPacket.TransferData.ChannelType = 2;
296 TransferPacket.TransferData.TransferID=req.TransferRequestID;
297 TransferPacket.TransferData.Data = req.AssetInf.Data;
298 TransferPacket.TransferData.Status = 1;
299 req.RequestUser.OutPacket(TransferPacket);
300 }
301 else
302 {
303 //more than one packet so split file up , for now it can't be bigger than 2000 bytes
304 TransferPacketPacket TransferPacket = new TransferPacketPacket();
305 TransferPacket.TransferData.Packet = 0;
306 TransferPacket.TransferData.ChannelType = 2;
307 TransferPacket.TransferData.TransferID=req.TransferRequestID;
308 byte[] chunk = new byte[1000];
309 Array.Copy(req.AssetInf.Data,chunk,1000);
310 TransferPacket.TransferData.Data = chunk;
311 TransferPacket.TransferData.Status = 0;
312 req.RequestUser.OutPacket(TransferPacket);
313
314 TransferPacket = new TransferPacketPacket();
315 TransferPacket.TransferData.Packet = 1;
316 TransferPacket.TransferData.ChannelType = 2;
317 TransferPacket.TransferData.TransferID = req.TransferRequestID;
318 byte[] chunk1 = new byte[(req.AssetInf.Data.Length-1000)];
319 Array.Copy(req.AssetInf.Data, 1000, chunk1, 0, chunk1.Length);
320 TransferPacket.TransferData.Data = chunk1;
321 TransferPacket.TransferData.Status = 1;
322 req.RequestUser.OutPacket(TransferPacket);
323 }
324
325 }
326
327 //remove requests that have been completed
328 for(int i = 0; i < num; i++)
329 {
330 this.AssetRequests.RemoveAt(0);
331 }
332
333 }
334
335 #endregion
336
337 #region Textures
338 /// <summary>
339 ///
340 /// </summary>
341 /// <param name="userInfo"></param>
342 /// <param name="imageID"></param>
343 public void AddTextureRequest(OpenSimClient userInfo, LLUUID imageID)
344 {
345 //check to see if texture is in local cache, if not request from asset server
346 if(!this.Textures.ContainsKey(imageID))
347 {
348 //not is cache so request from asset server
349 AssetRequest request = new AssetRequest();
350 request.RequestUser = userInfo;
351 request.RequestAssetID = imageID;
352 request.IsTextureRequest = true;
353 this.RequestedTextures.Add(imageID, request);
354 this._assetServer.RequestAsset(imageID, true);
355 return;
356 }
357 TextureImage imag = this.Textures[imageID];
358 AssetRequest req = new AssetRequest();
359 req.RequestUser = userInfo;
360 req.RequestAssetID = imageID;
361 req.IsTextureRequest = true;
362 req.ImageInfo = imag;
363
364 if(imag.Data.LongLength>600)
365 {
366 //over 600 bytes so split up file
367 req.NumPackets = 1 + (int)(imag.Data.Length-600+999)/1000;
368 }
369 else
370 {
371 req.NumPackets = 1;
372 }
373
374 this.TextureRequests.Add(req);
375 }
376 #endregion
377
378 }
379
380 public class AssetRequest
381 {
382 public OpenSimClient RequestUser;
383 public LLUUID RequestAssetID;
384 public AssetInfo AssetInf;
385 public TextureImage ImageInfo;
386 public LLUUID TransferRequestID;
387 public long DataPointer = 0;
388 public int NumPackets = 0;
389 public int PacketCounter = 0;
390 public bool IsTextureRequest;
391 //public bool AssetInCache;
392 //public int TimeRequested;
393
394 public AssetRequest()
395 {
396
397 }
398 }
399
400 public class AssetInfo : AssetBase
401 {
402 public AssetInfo()
403 {
404
405 }
406
407 public AssetInfo(AssetBase aBase)
408 {
409 Data= aBase.Data;
410 FullID = aBase.FullID;
411 Type = aBase.Type;
412 InvType = aBase.InvType;
413 Name= aBase.Name;
414 Description = aBase.Description;
415 }
416 }
417
418 public class TextureImage : AssetBase
419 {
420 public TextureImage()
421 {
422
423 }
424
425 public TextureImage(AssetBase aBase)
426 {
427 Data= aBase.Data;
428 FullID = aBase.FullID;
429 Type = aBase.Type;
430 InvType = aBase.InvType;
431 Name= aBase.Name;
432 Description = aBase.Description;
433 }
434 }
435
436}
diff --git a/src/CAPS/SimHttp.cs b/src/CAPS/SimHttp.cs
deleted file mode 100644
index c0373de..0000000
--- a/src/CAPS/SimHttp.cs
+++ /dev/null
@@ -1,165 +0,0 @@
1/*
2Copyright (c) OpenSimCAPS project, http://osgrid.org/
3
4
5* All rights reserved.
6*
7* Redistribution and use in source and binary forms, with or without
8* modification, are permitted provided that the following conditions are met:
9* * Redistributions of source code must retain the above copyright
10* notice, this list of conditions and the following disclaimer.
11* * Redistributions in binary form must reproduce the above copyright
12* notice, this list of conditions and the following disclaimer in the
13* documentation and/or other materials provided with the distribution.
14* * Neither the name of the <organization> nor the
15* names of its contributors may be used to endorse or promote products
16* derived from this software without specific prior written permission.
17*
18* THIS SOFTWARE IS PROVIDED BY <copyright holder> ``AS IS'' AND ANY
19* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
20* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21* DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY
22* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
24* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
25* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
27* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28*/
29
30using System;
31using System.Text;
32using Nwc.XmlRpc;
33using System.Threading;
34using System.Text.RegularExpressions;
35using System.Net;
36using System.IO;
37using System.Collections;
38using System.Collections.Generic;
39using libsecondlife;
40using ServerConsole;
41using OpenSim.GridServers;
42
43namespace OpenSim
44{
45 // Dummy HTTP server, does nothing useful for now
46
47 public class SimCAPSHTTPServer {
48 public Thread HTTPD;
49 public HttpListener Listener;
50
51 public SimCAPSHTTPServer() {
52 ServerConsole.MainConsole.Instance.WriteLine("Starting up HTTP Server");
53 HTTPD = new Thread(new ThreadStart(StartHTTP));
54 HTTPD.Start();
55 }
56
57 public void StartHTTP() {
58 try
59 {
60 ServerConsole.MainConsole.Instance.WriteLine("SimHttp.cs:StartHTTP() - Spawned main thread OK");
61 Listener = new HttpListener();
62
63 Listener.Prefixes.Add("http://+:" + OpenSim_Main.cfg.IPListenPort + "/");
64 Listener.Start();
65
66 HttpListenerContext context;
67 while(true) {
68 context = Listener.GetContext();
69 ThreadPool.QueueUserWorkItem(new WaitCallback(HandleRequest), context);
70 }
71 }
72 catch (Exception e)
73 {
74 ServerConsole.MainConsole.Instance.WriteLine(e.Message);
75 }
76 }
77
78 static string ParseXMLRPC(string requestBody) {
79 try
80 {
81 XmlRpcRequest request = (XmlRpcRequest)(new XmlRpcRequestDeserializer()).Deserialize(requestBody);
82
83 Hashtable requestData = (Hashtable)request.Params[0];
84 switch(request.MethodName) {
85 case "expect_user":
86 GridServers.agentcircuitdata agent_data = new GridServers.agentcircuitdata();
87 agent_data.SessionID = new LLUUID((string)requestData["session_id"]);
88 agent_data.SecureSessionID = new LLUUID((string)requestData["secure_session_id"]);
89 agent_data.firstname = (string)requestData["firstname"];
90 agent_data.lastname = (string)requestData["lastname"];
91 agent_data.AgentID = new LLUUID((string)requestData["agent_id"]);
92 agent_data.circuitcode = Convert.ToUInt32(requestData["circuit_code"]);
93 if (OpenSim_Main.gridServers.GridServer.GetName() == "Remote")
94 {
95 ((RemoteGridBase) OpenSim_Main.gridServers.GridServer).agentcircuits.Add((uint)agent_data.circuitcode,agent_data);
96 }
97 return "<?xml version=\"1.0\"?><methodResponse><params /></methodResponse>";
98 break;
99 }
100 }
101 catch(Exception e)
102 {
103 Console.WriteLine(e.ToString());
104 }
105 return "";
106 }
107
108 static string ParseREST(string requestBody, string requestURL) {
109 return "";
110 }
111
112 static string ParseLLSDXML(string requestBody) {
113 // dummy function for now - IMPLEMENT ME!
114 return "";
115 }
116
117 static void HandleRequest(Object stateinfo) {
118 HttpListenerContext context=(HttpListenerContext)stateinfo;
119
120 HttpListenerRequest request = context.Request;
121 HttpListenerResponse response = context.Response;
122
123 response.KeepAlive=false;
124 response.SendChunked=false;
125
126 System.IO.Stream body = request.InputStream;
127 System.Text.Encoding encoding = System.Text.Encoding.UTF8;
128 System.IO.StreamReader reader = new System.IO.StreamReader(body, encoding);
129
130 string requestBody = reader.ReadToEnd();
131 body.Close();
132 reader.Close();
133
134 string responseString="";
135 switch(request.ContentType) {
136 case "text/xml":
137 // must be XML-RPC, so pass to the XML-RPC parser
138
139 responseString=ParseXMLRPC(requestBody);
140 response.AddHeader("Content-type","text/xml");
141 break;
142
143 case "application/xml":
144 // probably LLSD we hope, otherwise it should be ignored by the parser
145 responseString=ParseLLSDXML(requestBody);
146 response.AddHeader("Content-type","application/xml");
147 break;
148
149 case null:
150 // must be REST or invalid crap, so pass to the REST parser
151 responseString=ParseREST(request.Url.OriginalString,requestBody);
152 break;
153 }
154
155 byte[] buffer = System.Text.Encoding.UTF8.GetBytes(responseString);
156 System.IO.Stream output = response.OutputStream;
157 response.SendChunked=false;
158 response.ContentLength64=buffer.Length;
159 output.Write(buffer,0,buffer.Length);
160 output.Close();
161 }
162 }
163
164
165}
diff --git a/src/Config/SimConfig/AssemblyInfo.cs b/src/Config/SimConfig/AssemblyInfo.cs
deleted file mode 100644
index 7fabd63..0000000
--- a/src/Config/SimConfig/AssemblyInfo.cs
+++ /dev/null
@@ -1,21 +0,0 @@
1using System;
2using System.Reflection;
3using System.Runtime.InteropServices;
4
5// ------------------------------------------------------------------------------
6// <autogenerated>
7// This code was generated by a tool.
8// Mono Runtime Version: 2.0.50727.42
9//
10// Changes to this file may cause incorrect behavior and will be lost if
11// the code is regenerated.
12// </autogenerated>
13// ------------------------------------------------------------------------------
14
15[assembly: ComVisibleAttribute(false)]
16[assembly: CLSCompliantAttribute(false)]
17[assembly: AssemblyVersionAttribute("0.1.0.240")]
18[assembly: AssemblyTitleAttribute("opensim-simconfig")]
19[assembly: AssemblyDescriptionAttribute("The default configuration handler")]
20[assembly: AssemblyCopyrightAttribute("Copyright © OGS development team 2007")]
21
diff --git a/src/Config/SimConfig/Db4SimConfig.cs b/src/Config/SimConfig/Db4SimConfig.cs
deleted file mode 100644
index 1b696fe..0000000
--- a/src/Config/SimConfig/Db4SimConfig.cs
+++ /dev/null
@@ -1,177 +0,0 @@
1/*
2* Copyright (c) OpenSim project, http://sim.opensecondlife.org/
3*
4* Redistribution and use in source and binary forms, with or without
5* modification, are permitted provided that the following conditions are met:
6* * Redistributions of source code must retain the above copyright
7* notice, this list of conditions and the following disclaimer.
8* * Redistributions in binary form must reproduce the above copyright
9* notice, this list of conditions and the following disclaimer in the
10* documentation and/or other materials provided with the distribution.
11* * Neither the name of the <organization> nor the
12* names of its contributors may be used to endorse or promote products
13* derived from this software without specific prior written permission.
14*
15* THIS SOFTWARE IS PROVIDED BY <copyright holder> ``AS IS'' AND ANY
16* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
18* DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY
19* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
20* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
21* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
22* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
24* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25*
26*/
27using System;
28using System.Collections.Generic;
29using OpenSim;
30using OpenSim.world;
31using Db4objects.Db4o;
32
33namespace Db40SimConfig
34{
35 public class Db40ConfigPlugin: ISimConfig
36 {
37 public SimConfig GetConfigObject()
38 {
39 ServerConsole.MainConsole.Instance.WriteLine("Loading Db40Config dll");
40 return ( new DbSimConfig());
41 }
42 }
43
44 public class DbSimConfig :SimConfig
45 {
46 private IObjectContainer db;
47
48 public void LoadDefaults() {
49 ServerConsole.MainConsole.Instance.WriteLine("Config.cs:LoadDefaults() - Please press enter to retain default or enter new settings");
50
51 this.RegionName=ServerConsole.MainConsole.Instance.CmdPrompt("Name [OpenSim test]: ","OpenSim test");
52 this.RegionLocX=(uint)Convert.ToInt32(ServerConsole.MainConsole.Instance.CmdPrompt("Grid Location X [997]: ","997"));
53 this.RegionLocY=(uint)Convert.ToInt32(ServerConsole.MainConsole.Instance.CmdPrompt("Grid Location Y [996]: ","996"));
54 this.IPListenPort=Convert.ToInt32(ServerConsole.MainConsole.Instance.CmdPrompt("UDP port for client connections [9000]: ","9000"));
55 this.IPListenAddr=ServerConsole.MainConsole.Instance.CmdPrompt("IP Address to listen on for client connections [127.0.0.1]: ","127.0.0.1");
56
57 if(!OpenSim_Main.sim.sandbox)
58 {
59 this.AssetURL=ServerConsole.MainConsole.Instance.CmdPrompt("Asset server URL: ");
60 this.AssetSendKey=ServerConsole.MainConsole.Instance.CmdPrompt("Asset server key: ");
61 this.GridURL=ServerConsole.MainConsole.Instance.CmdPrompt("Grid server URL: ");
62 this.GridSendKey=ServerConsole.MainConsole.Instance.CmdPrompt("Key to send to grid server: ");
63 this.GridRecvKey=ServerConsole.MainConsole.Instance.CmdPrompt("Key to expect from grid server: ");
64 this.UserURL=ServerConsole.MainConsole.Instance.CmdPrompt("User server URL: ");
65 this.UserSendKey=ServerConsole.MainConsole.Instance.CmdPrompt("Key to send to user server: ");
66 this.UserRecvKey=ServerConsole.MainConsole.Instance.CmdPrompt("Key to expect from user server: ");
67 }
68 this.RegionHandle = Util.UIntsToLong((RegionLocX*256), (RegionLocY*256));
69 }
70
71 public override void InitConfig() {
72 try {
73 db = Db4oFactory.OpenFile("opensim.yap");
74 IObjectSet result = db.Get(typeof(DbSimConfig));
75 if(result.Count==1) {
76 ServerConsole.MainConsole.Instance.WriteLine("Config.cs:InitConfig() - Found a SimConfig object in the local database, loading");
77 foreach (DbSimConfig cfg in result) {
78 this.RegionName = cfg.RegionName;
79 this.RegionLocX = cfg.RegionLocX;
80 this.RegionLocY = cfg.RegionLocY;
81 this.RegionHandle = Util.UIntsToLong((RegionLocX*256), (RegionLocY*256));
82 this.IPListenPort = cfg.IPListenPort;
83 this.IPListenAddr = cfg.IPListenAddr;
84 this.AssetURL = cfg.AssetURL;
85 this.AssetSendKey = cfg.AssetSendKey;
86 this.GridURL = cfg.GridURL;
87 this.GridSendKey = cfg.GridSendKey;
88 }
89 } else {
90 ServerConsole.MainConsole.Instance.WriteLine("Config.cs:InitConfig() - Could not find object in database, loading precompiled defaults");
91 LoadDefaults();
92 ServerConsole.MainConsole.Instance.WriteLine("Writing out default settings to local database");
93 db.Set(this);
94 }
95 } catch(Exception e) {
96 db.Close();
97 ServerConsole.MainConsole.Instance.WriteLine("Config.cs:InitConfig() - Exception occured");
98 ServerConsole.MainConsole.Instance.WriteLine(e.ToString());
99 }
100
101 ServerConsole.MainConsole.Instance.WriteLine("Sim settings loaded:");
102 ServerConsole.MainConsole.Instance.WriteLine("Name: " + this.RegionName);
103 ServerConsole.MainConsole.Instance.WriteLine("Region Location: [" + this.RegionLocX.ToString() + "," + this.RegionLocY + "]");
104 ServerConsole.MainConsole.Instance.WriteLine("Region Handle: " + this.RegionHandle.ToString());
105 ServerConsole.MainConsole.Instance.WriteLine("Listening on IP: " + this.IPListenAddr + ":" + this.IPListenPort);
106 ServerConsole.MainConsole.Instance.WriteLine("Sandbox Mode? " + OpenSim_Main.sim.sandbox.ToString());
107 ServerConsole.MainConsole.Instance.WriteLine("Asset URL: " + this.AssetURL);
108 ServerConsole.MainConsole.Instance.WriteLine("Asset key: " + this.AssetSendKey);
109 ServerConsole.MainConsole.Instance.WriteLine("Grid URL: " + this.GridURL);
110 ServerConsole.MainConsole.Instance.WriteLine("Grid key: " + this.GridSendKey);
111 }
112
113 public override World LoadWorld()
114 {
115 ServerConsole.MainConsole.Instance.WriteLine("Config.cs:LoadWorld() - Loading world....");
116 World blank = new World();
117 ServerConsole.MainConsole.Instance.WriteLine("Config.cs:LoadWorld() - Looking for a heightmap in local DB");
118 IObjectSet world_result = db.Get(typeof(MapStorage));
119 if(world_result.Count>0) {
120 ServerConsole.MainConsole.Instance.WriteLine("Config.cs:LoadWorld() - Found a heightmap in local database, loading");
121 MapStorage map=(MapStorage)world_result.Next();
122 blank.LandMap = map.Map;
123 } else {
124 ServerConsole.MainConsole.Instance.WriteLine("Config.cs:LoadWorld() - No heightmap found, generating new one");
125 HeightmapGenHills hills = new HeightmapGenHills();
126 blank.LandMap = hills.GenerateHeightmap(200, 4.0f, 80.0f, false);
127 ServerConsole.MainConsole.Instance.WriteLine("Config.cs:LoadWorld() - Saving heightmap to local database");
128 MapStorage map= new MapStorage();
129 map.Map = blank.LandMap;
130 db.Set(map);
131 db.Commit();
132 }
133 return blank;
134 }
135
136 public override void SaveMap()
137 {
138 IObjectSet world_result = db.Get(typeof(MapStorage));
139 if(world_result.Count>0) {
140 ServerConsole.MainConsole.Instance.WriteLine("Config.cs:LoadWorld() - updating saved copy of heightmap in local database");
141 MapStorage map=(MapStorage)world_result.Next();
142 db.Delete(map);
143 }
144 MapStorage map1= new MapStorage();
145 map1.Map = OpenSim_Main.local_world.LandMap;
146 db.Set(map1);
147 db.Commit();
148 }
149
150 public override void LoadFromGrid() {
151 ServerConsole.MainConsole.Instance.WriteLine("Config.cs:LoadFromGrid() - dummy function, DOING ABSOLUTELY NOTHING AT ALL!!!");
152 // TODO: Make this crap work
153 /* WebRequest GridLogin = WebRequest.Create(this.GridURL + "regions/" + this.RegionHandle.ToString() + "/login");
154 WebResponse GridResponse = GridLogin.GetResponse();
155 byte[] idata = new byte[(int)GridResponse.ContentLength];
156 BinaryReader br = new BinaryReader(GridResponse.GetResponseStream());
157
158 br.Close();
159 GridResponse.Close();
160 */
161 }
162
163 public void Shutdown() {
164 db.Close();
165 }
166 }
167
168 public class MapStorage
169 {
170 public float[] Map;
171
172 public MapStorage()
173 {
174
175 }
176 }
177}
diff --git a/src/Config/SimConfig/SimConfig.csproj b/src/Config/SimConfig/SimConfig.csproj
deleted file mode 100644
index 43e9499..0000000
--- a/src/Config/SimConfig/SimConfig.csproj
+++ /dev/null
@@ -1,52 +0,0 @@
1<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
2 <PropertyGroup>
3 <OutputType>Library</OutputType>
4 <RootNamespace>SimConfig</RootNamespace>
5 <AssemblyName>SimConfig</AssemblyName>
6 <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
7 <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
8 <ProjectGuid>{B063760D-DB8D-4F64-B6FE-335FAD1E650A}</ProjectGuid>
9 </PropertyGroup>
10 <PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
11 <OutputPath>..\..\..\bin\</OutputPath>
12 <Optimize>False</Optimize>
13 <DefineConstants>DEBUG;TRACE</DefineConstants>
14 <DebugSymbols>True</DebugSymbols>
15 <DebugType>Full</DebugType>
16 <CheckForOverflowUnderflow>True</CheckForOverflowUnderflow>
17 </PropertyGroup>
18 <PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
19 <OutputPath>..\..\..\bin\</OutputPath>
20 <Optimize>True</Optimize>
21 <DefineConstants>TRACE</DefineConstants>
22 <DebugSymbols>False</DebugSymbols>
23 <DebugType>None</DebugType>
24 <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
25 </PropertyGroup>
26 <ItemGroup>
27 <Reference Include="System" />
28 <Reference Include="System.Xml" />
29 <Reference Include="Db4objects.Db4o">
30 <HintPath>..\..\..\bin\Db4objects.Db4o.dll</HintPath>
31 <SpecificVersion>False</SpecificVersion>
32 </Reference>
33 </ItemGroup>
34 <ItemGroup>
35 <Compile Include="Db4SimConfig.cs" />
36 </ItemGroup>
37 <ItemGroup>
38 <ProjectReference Include="..\..\ServerConsole\ServerConsole\ServerConsole.csproj">
39 <Project>{C9A6026D-8E0C-4FE4-8691-FB2A566AA245}</Project>
40 <Name>ServerConsole</Name>
41 </ProjectReference>
42 <ProjectReference Include="..\..\Second-server.csproj">
43 <Project>{132A6E3E-8F2D-4BF5-BDFB-8555F53F334E}</Project>
44 <Name>Second-server</Name>
45 </ProjectReference>
46 <ProjectReference Include="..\..\GridInterfaces\GridInterfaces.csproj">
47 <Project>{5DA3174D-42F9-416D-9F0B-AF41FA2BE2F9}</Project>
48 <Name>GridInterfaces</Name>
49 </ProjectReference>
50 </ItemGroup>
51 <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.Targets" />
52</Project> \ No newline at end of file
diff --git a/src/Config/default.build b/src/Config/default.build
deleted file mode 100644
index 9e13ca6..0000000
--- a/src/Config/default.build
+++ /dev/null
@@ -1,53 +0,0 @@
1<?xml version="1.0"?>
2 <project name="OpenSim" default="build" basedir=".">
3 <description>nant buildfile for OpenSim</description>
4 <property name="debug" value="true" overwrite="false" />
5 <target name="clean" description="remove all generated files">
6 <delete file="../bin/SimConfig.dll" failonerror="false" />
7 </target>
8
9 <target name="svnupdate" description="updates to latest SVN">
10 <exec program="svn">
11 <arg value="update" />
12 </exec>
13 </target>
14
15 <target name="upgrade" description="updates from SVN and then builds" depends="clean,svnupdate,build">
16
17 </target>
18
19 <target name="build" description="compiles the source code">
20
21 <loadfile file="../../VERSION" property="svnver"/>
22 <asminfo output="SimConfig/AssemblyInfo.cs" language="CSharp">
23 <imports>
24 <import namespace="System" />
25 <import namespace="System.Reflection" />
26 <import namespace="System.Runtime.InteropServices" />
27 </imports>
28 <attributes>
29 <attribute type="ComVisibleAttribute" value="false" />
30 <attribute type="CLSCompliantAttribute" value="false" />
31 <attribute type="AssemblyVersionAttribute" value="${svnver}" />
32 <attribute type="AssemblyTitleAttribute" value="opensim-simconfig" />
33 <attribute type="AssemblyDescriptionAttribute" value="The default configuration handler" />
34 <attribute type="AssemblyCopyrightAttribute" value="Copyright © OGS development team 2007"/>
35 </attributes>
36 </asminfo>
37
38 <csc target="library" output="../../bin/SimConfig.dll" debug="${debug}" verbose="true" warninglevel="4">
39 <references basedir="../../bin/" failonempty="true">
40 <include name="System.dll" />
41 <include name="System.Data.dll" />
42 <include name="System.Xml.dll" />
43 <include name="ServerConsole.dll" />
44 <include name="GridInterfaces.dll" />
45 <include name="OpenSim.exe" />
46 <include name="Db4objects.Db4o.dll" />
47 </references>
48 <sources basedir="SimConfig/">
49 <include name="*.cs" />
50 </sources>
51 </csc>
52 </target>
53</project>
diff --git a/src/GridInterfaces/AssemblyInfo.cs b/src/GridInterfaces/AssemblyInfo.cs
deleted file mode 100644
index 32f1380..0000000
--- a/src/GridInterfaces/AssemblyInfo.cs
+++ /dev/null
@@ -1,21 +0,0 @@
1using System;
2using System.Reflection;
3using System.Runtime.InteropServices;
4
5// ------------------------------------------------------------------------------
6// <autogenerated>
7// This code was generated by a tool.
8// Mono Runtime Version: 2.0.50727.42
9//
10// Changes to this file may cause incorrect behavior and will be lost if
11// the code is regenerated.
12// </autogenerated>
13// ------------------------------------------------------------------------------
14
15[assembly: ComVisibleAttribute(false)]
16[assembly: CLSCompliantAttribute(false)]
17[assembly: AssemblyVersionAttribute("0.1.0.240")]
18[assembly: AssemblyTitleAttribute("opensim-gridinterfaces")]
19[assembly: AssemblyDescriptionAttribute("Definitions for OGS interface")]
20[assembly: AssemblyCopyrightAttribute("Copyright © OGS development team 2007")]
21
diff --git a/src/GridInterfaces/GridInterfaces.csproj b/src/GridInterfaces/GridInterfaces.csproj
deleted file mode 100644
index 197994f..0000000
--- a/src/GridInterfaces/GridInterfaces.csproj
+++ /dev/null
@@ -1,40 +0,0 @@
1<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
2 <PropertyGroup>
3 <OutputType>Library</OutputType>
4 <RootNamespace>GridInterfaces</RootNamespace>
5 <AssemblyName>GridInterfaces</AssemblyName>
6 <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
7 <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
8 <ProjectGuid>{5DA3174D-42F9-416D-9F0B-AF41FA2BE2F9}</ProjectGuid>
9 </PropertyGroup>
10 <PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
11 <OutputPath>bin\Debug\</OutputPath>
12 <Optimize>False</Optimize>
13 <DefineConstants>DEBUG;TRACE</DefineConstants>
14 <DebugSymbols>True</DebugSymbols>
15 <DebugType>Full</DebugType>
16 <CheckForOverflowUnderflow>True</CheckForOverflowUnderflow>
17 </PropertyGroup>
18 <PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
19 <OutputPath>bin\Release\</OutputPath>
20 <Optimize>True</Optimize>
21 <DefineConstants>TRACE</DefineConstants>
22 <DebugSymbols>False</DebugSymbols>
23 <DebugType>None</DebugType>
24 <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
25 </PropertyGroup>
26 <ItemGroup>
27 <Reference Include="System" />
28 <Reference Include="System.Xml" />
29 <Reference Include="libsecondlife">
30 <HintPath>..\..\bin\libsecondlife.dll</HintPath>
31 <SpecificVersion>False</SpecificVersion>
32 </Reference>
33 </ItemGroup>
34 <ItemGroup>
35 <Compile Include="IAssetServer.cs" />
36 <Compile Include="IGridServer.cs" />
37 <Compile Include="ILocalStorage.cs" />
38 </ItemGroup>
39 <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.Targets" />
40</Project> \ No newline at end of file
diff --git a/src/GridInterfaces/IGridServer.cs b/src/GridInterfaces/IGridServer.cs
deleted file mode 100644
index dcb8ef2..0000000
--- a/src/GridInterfaces/IGridServer.cs
+++ /dev/null
@@ -1,145 +0,0 @@
1/*
2* Copyright (c) OpenSim project, http://sim.opensecondlife.org/
3*
4* Redistribution and use in source and binary forms, with or without
5* modification, are permitted provided that the following conditions are met:
6* * Redistributions of source code must retain the above copyright
7* notice, this list of conditions and the following disclaimer.
8* * Redistributions in binary form must reproduce the above copyright
9* notice, this list of conditions and the following disclaimer in the
10* documentation and/or other materials provided with the distribution.
11* * Neither the name of the <organization> nor the
12* names of its contributors may be used to endorse or promote products
13* derived from this software without specific prior written permission.
14*
15* THIS SOFTWARE IS PROVIDED BY <copyright holder> ``AS IS'' AND ANY
16* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
18* DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY
19* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
20* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
21* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
22* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
24* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25*
26*/
27
28
29using System;
30using System.Collections.Generic;
31using System.Net;
32using System.Net.Sockets;
33using System.IO;
34using libsecondlife;
35using OpenSim;
36
37namespace OpenSim.GridServers
38{
39 /// <summary>
40 /// Handles connection to Grid Servers.
41 /// also Sim to Sim connections?
42 /// </summary>
43
44
45
46
47 public interface IGridServer
48 {
49 UUIDBlock RequestUUIDBlock();
50 neighbourinfo[] RequestNeighbours(ulong regionhandle); //should return a array of neighbouring regions
51 AuthenticateResponse AuthenticateSession(LLUUID sessionID, LLUUID agentID, uint circuitCode);
52 bool LogoutSession(LLUUID sessionID, LLUUID agentID, uint circuitCode);
53 string GetName();
54 bool RequestConnection();
55 void SetServerInfo(string GridServerUrl, string GridSendKey, string GridRecvKey, string UserServerUrl, string UserSendKey, string UserRecvKey);
56 }
57
58 public abstract class RemoteGridBase : IGridServer
59 {
60 public abstract Dictionary<uint, agentcircuitdata> agentcircuits {
61 get;
62 set;
63 }
64
65 public abstract UUIDBlock RequestUUIDBlock();
66 public abstract neighbourinfo[] RequestNeighbours(ulong regionhandle);
67 public abstract AuthenticateResponse AuthenticateSession(LLUUID sessionID, LLUUID agentID, uint circuitCode);
68 public abstract bool LogoutSession(LLUUID sessionID, LLUUID agentID, uint circuitCode);
69 public abstract string GetName();
70 public abstract bool RequestConnection();
71 public abstract void SetServerInfo(string GridServerUrl, string GridSendKey, string GridRecvKey, string UserServerUrl, string UserSendKey, string UserRecvKey);
72 }
73
74 public abstract class LocalGridBase : IGridServer
75 {
76 public abstract UUIDBlock RequestUUIDBlock();
77 public abstract neighbourinfo[] RequestNeighbours(ulong regionhandle);
78 public abstract AuthenticateResponse AuthenticateSession(LLUUID sessionID, LLUUID agentID, uint circuitCode);
79 public abstract bool LogoutSession(LLUUID sessionID, LLUUID agentID, uint circuitCode);
80 public abstract string GetName();
81 public abstract bool RequestConnection();
82 public abstract void SetServerInfo(string GridServerUrl, string GridSendKey, string GridRecvKey, string UserServerUrl, string UserSendKey, string UserRecvKey);
83 public abstract void AddNewSession(Login session);
84 }
85
86 public struct UUIDBlock
87 {
88 public LLUUID BlockStart;
89 public LLUUID BlockEnd;
90 }
91
92 public class AuthenticateResponse
93 {
94 public bool Authorised;
95 public Login LoginInfo;
96
97 public AuthenticateResponse()
98 {
99
100 }
101
102 }
103
104 public class Login
105 {
106 public string First = "Test";
107 public string Last = "User";
108 public LLUUID Agent;
109 public LLUUID Session;
110 public LLUUID InventoryFolder;
111 public LLUUID BaseFolder;
112 public Login()
113 {
114
115 }
116 }
117
118 public interface IGridPlugin
119 {
120 IGridServer GetGridServer();
121 }
122
123 public class agentcircuitdata
124 {
125 public agentcircuitdata() { }
126 public LLUUID AgentID;
127 public LLUUID SessionID;
128 public LLUUID SecureSessionID;
129 public string firstname;
130 public string lastname;
131 public uint circuitcode;
132 public bool child_agent;
133 }
134
135 public class neighbourinfo
136 {
137 public neighbourinfo() { }
138 public ulong regionhandle;
139 public uint RegionLocX;
140 public uint RegionLocY;
141 public string sim_ip;
142 public uint sim_port;
143 }
144
145}
diff --git a/src/GridInterfaces/default.build b/src/GridInterfaces/default.build
deleted file mode 100644
index dd02448..0000000
--- a/src/GridInterfaces/default.build
+++ /dev/null
@@ -1,50 +0,0 @@
1<?xml version="1.0"?>
2 <project name="OpenSim" default="build" basedir=".">
3 <description>nant buildfile for OpenSim</description>
4 <property name="debug" value="true" overwrite="false" />
5 <target name="clean" description="remove all generated files">
6 <delete file="../../bin/GridInterfaces.dll" failonerror="false" />
7 </target>
8
9 <target name="svnupdate" description="updates to latest SVN">
10 <exec program="svn">
11 <arg value="update" />
12 </exec>
13 </target>
14
15 <target name="upgrade" description="updates from SVN and then builds" depends="clean,svnupdate,build">
16
17 </target>
18
19 <target name="build" description="compiles the source code">
20
21 <loadfile file="../../VERSION" property="svnver"/>
22 <asminfo output="AssemblyInfo.cs" language="CSharp">
23 <imports>
24 <import namespace="System" />
25 <import namespace="System.Reflection" />
26 <import namespace="System.Runtime.InteropServices" />
27 </imports>
28 <attributes>
29 <attribute type="ComVisibleAttribute" value="false" />
30 <attribute type="CLSCompliantAttribute" value="false" />
31 <attribute type="AssemblyVersionAttribute" value="${svnver}" />
32 <attribute type="AssemblyTitleAttribute" value="opensim-gridinterfaces" />
33 <attribute type="AssemblyDescriptionAttribute" value="Definitions for OGS interface" />
34 <attribute type="AssemblyCopyrightAttribute" value="Copyright © OGS development team 2007"/>
35 </attributes>
36 </asminfo>
37
38 <csc target="library" output="../../bin/GridInterfaces.dll" debug="${debug}" verbose="true" warninglevel="4">
39 <references basedir="../../bin" failonempty="true">
40 <include name="System.dll" />
41 <include name="System.Xml.dll" />
42 <include name="OpenSim.Framework.dll" />
43 <include name="libsecondlife.dll" />
44 </references>
45 <sources basedir="./">
46 <include name="*.cs" />
47 </sources>
48 </csc>
49 </target>
50</project>
diff --git a/src/GridServers/LoginServer.cs b/src/GridServers/LoginServer.cs
deleted file mode 100644
index dbf211d..0000000
--- a/src/GridServers/LoginServer.cs
+++ /dev/null
@@ -1,350 +0,0 @@
1/*
2* Copyright (c) OpenSim project, http://sim.opensecondlife.org/
3*
4* Redistribution and use in source and binary forms, with or without
5* modification, are permitted provided that the following conditions are met:
6* * Redistributions of source code must retain the above copyright
7* notice, this list of conditions and the following disclaimer.
8* * Redistributions in binary form must reproduce the above copyright
9* notice, this list of conditions and the following disclaimer in the
10* documentation and/or other materials provided with the distribution.
11* * Neither the name of the <organization> nor the
12* names of its contributors may be used to endorse or promote products
13* derived from this software without specific prior written permission.
14*
15* THIS SOFTWARE IS PROVIDED BY <copyright holder> ``AS IS'' AND ANY
16* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
18* DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY
19* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
20* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
21* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
22* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
24* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25*
26*/
27
28using Nwc.XmlRpc;
29using System;
30using System.IO;
31using System.Net;
32using System.Net.Sockets;
33using System.Text;
34using System.Text.RegularExpressions;
35using System.Threading;
36using System.Collections;
37using System.Security.Cryptography;
38using System.Xml;
39using libsecondlife;
40using OpenSim;
41using OpenSim.Framework;
42
43namespace OpenSim.GridServers
44{
45
46 /// <summary>
47 /// When running in local (default) mode , handles client logins.
48 /// </summary>
49 public class LoginServer : LoginService
50 {
51 public LoginServer(IGridServer gridServer)
52 {
53 _gridServer = gridServer;
54 }
55
56 private IGridServer _gridServer;
57 private ushort _loginPort = 8080;
58 public IPAddress clientAddress = IPAddress.Loopback;
59 public IPAddress remoteAddress = IPAddress.Any;
60 private Socket loginServer;
61 private int NumClients;
62 private string _defaultResponse;
63
64 private string _mpasswd;
65 private bool _needPasswd=false;
66
67 // InitializeLogin: initialize the login
68 private void InitializeLogin() {
69 loginServer = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
70 loginServer.Bind(new IPEndPoint(remoteAddress, _loginPort));
71 loginServer.Listen(1);
72
73 this._needPasswd=false;
74 //read in default response string
75 StreamReader SR;
76 string lines;
77 SR=File.OpenText("new-login.dat");
78
79 //lines=SR.ReadLine();
80
81 while(!SR.EndOfStream)
82 {
83 lines = SR.ReadLine();
84 _defaultResponse += lines;
85 //lines = SR.ReadLine();
86 }
87 SR.Close();
88 this._mpasswd = EncodePassword("testpass");
89 }
90
91 public void Startup()
92 {
93 this.InitializeLogin();
94 Thread runLoginProxy = new Thread(new ThreadStart(RunLogin));
95 runLoginProxy.IsBackground = true;
96 runLoginProxy.Start();
97 }
98
99 private void RunLogin()
100 {
101 Console.WriteLine("Starting Login Server");
102 try
103 {
104 for (;;)
105 {
106 Socket client = loginServer.Accept();
107 IPEndPoint clientEndPoint = (IPEndPoint)client.RemoteEndPoint;
108
109
110 NetworkStream networkStream = new NetworkStream(client);
111 StreamReader networkReader = new StreamReader(networkStream);
112 StreamWriter networkWriter = new StreamWriter(networkStream);
113
114 try
115 {
116 LoginRequest(networkReader, networkWriter);
117 }
118 catch (Exception e)
119 {
120 Console.WriteLine(e.Message);
121 }
122
123 networkWriter.Close();
124 networkReader.Close();
125 networkStream.Close();
126
127 client.Close();
128
129 // send any packets queued for injection
130
131 }
132 }
133 catch (Exception e)
134 {
135 Console.WriteLine(e.Message);
136 Console.WriteLine(e.StackTrace);
137 }
138 }
139
140 // ProxyLogin: proxy a login request
141 private void LoginRequest(StreamReader reader, StreamWriter writer)
142 {
143 lock(this)
144 {
145 string line;
146 int contentLength = 0;
147 // read HTTP header
148 do
149 {
150 // read one line of the header
151 line = reader.ReadLine();
152
153 // check for premature EOF
154 if (line == null)
155 throw new Exception("EOF in client HTTP header");
156
157 // look for Content-Length
158 Match match = (new Regex(@"Content-Length: (\d+)$")).Match(line);
159 if (match.Success)
160 contentLength = Convert.ToInt32(match.Groups[1].Captures[0].ToString());
161 } while (line != "");
162
163 // read the HTTP body into a buffer
164 char[] content = new char[contentLength];
165 reader.Read(content, 0, contentLength);
166
167 XmlRpcRequest request = (XmlRpcRequest)(new XmlRpcRequestDeserializer()).Deserialize(new String(content));
168 if(request.MethodName == "login_to_simulator")
169 {
170 XmlRpcResponse response = ProcessRequest(request);
171
172 // forward the XML-RPC response to the client
173 writer.WriteLine("HTTP/1.0 200 OK");
174 writer.WriteLine("Content-type: text/xml");
175 writer.WriteLine();
176
177 XmlTextWriter responseWriter = new XmlTextWriter(writer);
178 XmlRpcResponseSerializer.Singleton.Serialize(responseWriter, response);
179 responseWriter.Close();
180 }
181 else
182 {
183 writer.WriteLine("HTTP/1.0 403 Authentication Forbidden");
184 writer.WriteLine();
185 }
186 }
187 }
188
189 private XmlRpcResponse ProcessRequest(XmlRpcRequest request)
190 {
191 XmlRpcResponse response = (XmlRpcResponse)(new XmlRpcResponseDeserializer()).Deserialize(this._defaultResponse);
192
193 Hashtable responseData = (Hashtable)response.Value;
194 Hashtable requestData = (Hashtable)request.Params[0];
195
196 string first;
197 string last;
198 string passwd;
199 LLUUID Agent;
200 LLUUID Session;
201
202 //get login name
203 if(requestData.Contains("first"))
204 {
205 first = (string)requestData["first"];
206 }
207 else
208 {
209 first = "test";
210 }
211
212 if(requestData.Contains("last"))
213 {
214 last = (string)requestData["last"];
215 }
216 else
217 {
218 last = "User"+NumClients.ToString();
219 }
220
221 if(requestData.Contains("passwd"))
222 {
223 passwd = (string)requestData["passwd"];
224 }
225 else
226 {
227 passwd = "notfound";
228 }
229
230 if( !Authenticate(first, last, passwd))
231 {
232 responseData["reason"] = "key";
233 responseData["message"] = "You have entered an invalid name/password combination. Check Caps/lock.";
234 responseData["login"] = "false";
235 }
236 else
237 {
238 NumClients++;
239
240 //create a agent and session LLUUID
241 Agent = GetAgentId( first, last );
242 Session = LLUUID.Random();
243
244 //create some login info
245 Hashtable LoginFlagsHash = new Hashtable();
246 LoginFlagsHash["daylight_savings"]="N";
247 LoginFlagsHash["stipend_since_login"]="N";
248 LoginFlagsHash["gendered"]="Y";
249 LoginFlagsHash["ever_logged_in"]="Y";
250 ArrayList LoginFlags=new ArrayList();
251 LoginFlags.Add(LoginFlagsHash);
252
253 Hashtable GlobalT = new Hashtable();
254 GlobalT["sun_texture_id"] = "cce0f112-878f-4586-a2e2-a8f104bba271";
255 GlobalT["cloud_texture_id"] = "fc4b9f0b-d008-45c6-96a4-01dd947ac621";
256 GlobalT["moon_texture_id"] = "fc4b9f0b-d008-45c6-96a4-01dd947ac621";
257 ArrayList GlobalTextures = new ArrayList();
258 GlobalTextures.Add(GlobalT);
259
260 responseData["sim_port"] = OpenSim_Main.cfg.IPListenPort;
261 responseData["sim_ip"] = OpenSim_Main.cfg.IPListenAddr;
262 responseData["agent_id"] = Agent.ToStringHyphenated();
263 responseData["session_id"] = Session.ToStringHyphenated();
264 responseData["seconds_since_epoch"]=(Int32)(DateTime.UtcNow - new DateTime(1970,1,1)).TotalSeconds;
265 responseData["login-flags"]=LoginFlags;
266 responseData["global-textures"]=GlobalTextures;
267
268 //inventory
269 ArrayList InventoryList = (ArrayList) responseData["inventory-skeleton"];
270 Hashtable Inventory1 = (Hashtable)InventoryList[0];
271 Hashtable Inventory2 = (Hashtable)InventoryList[1];
272 LLUUID BaseFolderID = LLUUID.Random();
273 LLUUID InventoryFolderID = LLUUID.Random();
274 Inventory2["name"] = "Base";
275 Inventory2["folder_id"] = BaseFolderID.ToStringHyphenated();
276 Inventory2["type_default"] =6;
277 Inventory1["folder_id"] = InventoryFolderID.ToStringHyphenated();
278
279 ArrayList InventoryRoot = (ArrayList) responseData["inventory-root"];
280 Hashtable Inventoryroot = (Hashtable)InventoryRoot[0];
281 Inventoryroot["folder_id"] = InventoryFolderID.ToStringHyphenated();
282
283 CustomiseLoginResponse( responseData, first, last );
284
285 Login _login = new Login();
286 //copy data to login object
287 _login.First = first;
288 _login.Last = last;
289 _login.Agent = Agent;
290 _login.Session = Session;
291 _login.BaseFolder = BaseFolderID;
292 _login.InventoryFolder = InventoryFolderID;
293
294 //working on local computer if so lets add to the gridserver's list of sessions?
295 if(OpenSim_Main.gridServers.GridServer.GetName() == "Local")
296 {
297 ((LocalGridBase)this._gridServer).AddNewSession(_login);
298 }
299 }
300 return response;
301 }
302
303 protected virtual void CustomiseLoginResponse( Hashtable responseData, string first, string last )
304 {
305 }
306
307 protected virtual LLUUID GetAgentId(string firstName, string lastName)
308 {
309 return LLUUID.Random();
310 }
311
312 protected virtual bool Authenticate(string first, string last, string passwd)
313 {
314 if(this._needPasswd)
315 {
316 //every user needs the password to login
317 string encodedPass = passwd.Remove(0,3); //remove $1$
318 if(encodedPass == this._mpasswd)
319 {
320 return true;
321 }
322 else
323 {
324 return false;
325 }
326 }
327 else
328 {
329 //do not need password to login
330 return true;
331 }
332 }
333
334 private static string EncodePassword(string passwd)
335 {
336 Byte[] originalBytes;
337 Byte[] encodedBytes;
338 MD5 md5;
339
340 md5 = new MD5CryptoServiceProvider();
341 originalBytes = ASCIIEncoding.Default.GetBytes(passwd);
342 encodedBytes = md5.ComputeHash(originalBytes);
343
344 return Regex.Replace(BitConverter.ToString(encodedBytes), "-", "").ToLower();
345 }
346
347 }
348
349
350}
diff --git a/src/LocalServers/LocalGridServers/AssemblyInfo.cs b/src/LocalServers/LocalGridServers/AssemblyInfo.cs
deleted file mode 100644
index 4b17ba2..0000000
--- a/src/LocalServers/LocalGridServers/AssemblyInfo.cs
+++ /dev/null
@@ -1,21 +0,0 @@
1using System;
2using System.Reflection;
3using System.Runtime.InteropServices;
4
5// ------------------------------------------------------------------------------
6// <autogenerated>
7// This code was generated by a tool.
8// Mono Runtime Version: 2.0.50727.42
9//
10// Changes to this file may cause incorrect behavior and will be lost if
11// the code is regenerated.
12// </autogenerated>
13// ------------------------------------------------------------------------------
14
15[assembly: ComVisibleAttribute(false)]
16[assembly: CLSCompliantAttribute(false)]
17[assembly: AssemblyVersionAttribute("0.1.0.240")]
18[assembly: AssemblyTitleAttribute("opensim-localservers")]
19[assembly: AssemblyDescriptionAttribute("local grid servers")]
20[assembly: AssemblyCopyrightAttribute("Copyright © OGS development team 2007")]
21
diff --git a/src/LocalServers/LocalGridServers/LocalGridServers.csproj b/src/LocalServers/LocalGridServers/LocalGridServers.csproj
deleted file mode 100644
index 7a5ce3d..0000000
--- a/src/LocalServers/LocalGridServers/LocalGridServers.csproj
+++ /dev/null
@@ -1,48 +0,0 @@
1<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
2 <PropertyGroup>
3 <OutputType>Library</OutputType>
4 <RootNamespace>LocalGridServers</RootNamespace>
5 <AssemblyName>LocalGridServers</AssemblyName>
6 <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
7 <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
8 <ProjectGuid>{D7F0395B-FADC-4936-80A0-D95AACE92F62}</ProjectGuid>
9 </PropertyGroup>
10 <PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
11 <OutputPath>bin\Debug\</OutputPath>
12 <Optimize>False</Optimize>
13 <DefineConstants>DEBUG;TRACE</DefineConstants>
14 <DebugSymbols>True</DebugSymbols>
15 <DebugType>Full</DebugType>
16 <CheckForOverflowUnderflow>True</CheckForOverflowUnderflow>
17 </PropertyGroup>
18 <PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
19 <OutputPath>bin\Release\</OutputPath>
20 <Optimize>True</Optimize>
21 <DefineConstants>TRACE</DefineConstants>
22 <DebugSymbols>False</DebugSymbols>
23 <DebugType>None</DebugType>
24 <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
25 </PropertyGroup>
26 <ItemGroup>
27 <Reference Include="System" />
28 <Reference Include="System.Xml" />
29 <Reference Include="libsecondlife">
30 <HintPath>..\..\..\bin\libsecondlife.dll</HintPath>
31 <SpecificVersion>False</SpecificVersion>
32 </Reference>
33 </ItemGroup>
34 <ItemGroup>
35 <Compile Include="LocalGrid.cs" />
36 </ItemGroup>
37 <ItemGroup>
38 <ProjectReference Include="..\..\ServerConsole\ServerConsole\ServerConsole.csproj">
39 <Project>{C9A6026D-8E0C-4FE4-8691-FB2A566AA245}</Project>
40 <Name>ServerConsole</Name>
41 </ProjectReference>
42 <ProjectReference Include="..\..\GridInterfaces\GridInterfaces.csproj">
43 <Project>{5DA3174D-42F9-416D-9F0B-AF41FA2BE2F9}</Project>
44 <Name>GridInterfaces</Name>
45 </ProjectReference>
46 </ItemGroup>
47 <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.Targets" />
48</Project> \ No newline at end of file
diff --git a/src/LocalServers/default.build b/src/LocalServers/default.build
deleted file mode 100644
index 14c52cd..0000000
--- a/src/LocalServers/default.build
+++ /dev/null
@@ -1,51 +0,0 @@
1<?xml version="1.0"?>
2 <project name="OpenSim" default="build" basedir=".">
3 <description>nant buildfile for OpenSim</description>
4 <property name="debug" value="true" overwrite="false" />
5 <target name="clean" description="remove all generated files">
6 <delete file="../../bin/LocalGridServers.dll" failonerror="false" />
7 </target>
8
9 <target name="svnupdate" description="updates to latest SVN">
10 <exec program="svn">
11 <arg value="update" />
12 </exec>
13 </target>
14
15 <target name="upgrade" description="updates from SVN and then builds" depends="clean,svnupdate,build">
16
17 </target>
18
19 <target name="build" description="compiles the source code">
20
21 <loadfile file="../../VERSION" property="svnver"/>
22 <asminfo output="LocalGridServers/AssemblyInfo.cs" language="CSharp">
23 <imports>
24 <import namespace="System" />
25 <import namespace="System.Reflection" />
26 <import namespace="System.Runtime.InteropServices" />
27 </imports>
28 <attributes>
29 <attribute type="ComVisibleAttribute" value="false" />
30 <attribute type="CLSCompliantAttribute" value="false" />
31 <attribute type="AssemblyVersionAttribute" value="${svnver}" />
32 <attribute type="AssemblyTitleAttribute" value="opensim-localservers" />
33 <attribute type="AssemblyDescriptionAttribute" value="local grid servers" />
34 <attribute type="AssemblyCopyrightAttribute" value="Copyright © OGS development team 2007"/>
35 </attributes>
36 </asminfo>
37
38 <csc target="library" output="../../bin/LocalGridServers.dll" debug="${debug}" verbose="true" warninglevel="4">
39 <references basedir="../../bin" failonempty="true">
40 <include name="System.dll" />
41 <include name="System.Xml.dll" />
42 <include name="libsecondlife.dll" />
43 <include name="GridInterfaces.dll" />
44 <include name="ServerConsole.dll" />
45 </references>
46 <sources basedir="LocalGridServers/">
47 <include name="*.cs" />
48 </sources>
49 </csc>
50 </target>
51</project>
diff --git a/src/LocalStorage/Db4LocalStorage/AssemblyInfo.cs b/src/LocalStorage/Db4LocalStorage/AssemblyInfo.cs
deleted file mode 100644
index 0c5ff75..0000000
--- a/src/LocalStorage/Db4LocalStorage/AssemblyInfo.cs
+++ /dev/null
@@ -1,21 +0,0 @@
1using System;
2using System.Reflection;
3using System.Runtime.InteropServices;
4
5// ------------------------------------------------------------------------------
6// <autogenerated>
7// This code was generated by a tool.
8// Mono Runtime Version: 2.0.50727.42
9//
10// Changes to this file may cause incorrect behavior and will be lost if
11// the code is regenerated.
12// </autogenerated>
13// ------------------------------------------------------------------------------
14
15[assembly: ComVisibleAttribute(false)]
16[assembly: CLSCompliantAttribute(false)]
17[assembly: AssemblyVersionAttribute("0.1.0.240")]
18[assembly: AssemblyTitleAttribute("opensim-localstorage")]
19[assembly: AssemblyDescriptionAttribute("The local storage handler")]
20[assembly: AssemblyCopyrightAttribute("Copyright © OGS development team 2007")]
21
diff --git a/src/LocalStorage/Db4LocalStorage/Db4LocalStorage.csproj b/src/LocalStorage/Db4LocalStorage/Db4LocalStorage.csproj
deleted file mode 100644
index c00771c..0000000
--- a/src/LocalStorage/Db4LocalStorage/Db4LocalStorage.csproj
+++ /dev/null
@@ -1,52 +0,0 @@
1<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
2 <PropertyGroup>
3 <OutputType>Library</OutputType>
4 <RootNamespace>Db4LocalStorage</RootNamespace>
5 <AssemblyName>Db4LocalStorage</AssemblyName>
6 <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
7 <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
8 <ProjectGuid>{74784F23-B0FD-484C-82C1-96C0215733DC}</ProjectGuid>
9 </PropertyGroup>
10 <PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
11 <OutputPath>bin\Debug\</OutputPath>
12 <Optimize>False</Optimize>
13 <DefineConstants>DEBUG;TRACE</DefineConstants>
14 <DebugSymbols>True</DebugSymbols>
15 <DebugType>Full</DebugType>
16 <CheckForOverflowUnderflow>True</CheckForOverflowUnderflow>
17 </PropertyGroup>
18 <PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
19 <OutputPath>bin\Release\</OutputPath>
20 <Optimize>True</Optimize>
21 <DefineConstants>TRACE</DefineConstants>
22 <DebugSymbols>False</DebugSymbols>
23 <DebugType>None</DebugType>
24 <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
25 </PropertyGroup>
26 <ItemGroup>
27 <Reference Include="System" />
28 <Reference Include="System.Xml" />
29 <Reference Include="libsecondlife">
30 <HintPath>..\..\..\bin\libsecondlife.dll</HintPath>
31 <SpecificVersion>False</SpecificVersion>
32 </Reference>
33 <Reference Include="Db4objects.Db4o">
34 <HintPath>..\..\..\bin\Db4objects.Db4o.dll</HintPath>
35 <SpecificVersion>False</SpecificVersion>
36 </Reference>
37 </ItemGroup>
38 <ItemGroup>
39 <Compile Include="Db4LocalStorage.cs" />
40 </ItemGroup>
41 <ItemGroup>
42 <ProjectReference Include="..\..\ServerConsole\ServerConsole\ServerConsole.csproj">
43 <Project>{C9A6026D-8E0C-4FE4-8691-FB2A566AA245}</Project>
44 <Name>ServerConsole</Name>
45 </ProjectReference>
46 <ProjectReference Include="..\..\GridInterfaces\GridInterfaces.csproj">
47 <Project>{5DA3174D-42F9-416D-9F0B-AF41FA2BE2F9}</Project>
48 <Name>GridInterfaces</Name>
49 </ProjectReference>
50 </ItemGroup>
51 <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.Targets" />
52</Project> \ No newline at end of file
diff --git a/src/LocalStorage/default.build b/src/LocalStorage/default.build
deleted file mode 100644
index 5ed183e..0000000
--- a/src/LocalStorage/default.build
+++ /dev/null
@@ -1,53 +0,0 @@
1<?xml version="1.0"?>
2 <project name="OpenSim" default="build" basedir=".">
3 <description>nant buildfile for OpenSim</description>
4 <property name="debug" value="true" overwrite="false" />
5 <target name="clean" description="remove all generated files">
6 <delete file="../bin/Db4LocalStorage.dll" failonerror="false" />
7 </target>
8
9 <target name="svnupdate" description="updates to latest SVN">
10 <exec program="svn">
11 <arg value="update" />
12 </exec>
13 </target>
14
15 <target name="upgrade" description="updates from SVN and then builds" depends="clean,svnupdate,build">
16
17 </target>
18
19 <target name="build" description="compiles the source code">
20
21 <loadfile file="../../VERSION" property="svnver"/>
22 <asminfo output="Db4LocalStorage/AssemblyInfo.cs" language="CSharp">
23 <imports>
24 <import namespace="System" />
25 <import namespace="System.Reflection" />
26 <import namespace="System.Runtime.InteropServices" />
27 </imports>
28 <attributes>
29 <attribute type="ComVisibleAttribute" value="false" />
30 <attribute type="CLSCompliantAttribute" value="false" />
31 <attribute type="AssemblyVersionAttribute" value="${svnver}" />
32 <attribute type="AssemblyTitleAttribute" value="opensim-localstorage" />
33 <attribute type="AssemblyDescriptionAttribute" value="The local storage handler" />
34 <attribute type="AssemblyCopyrightAttribute" value="Copyright © OGS development team 2007"/>
35 </attributes>
36 </asminfo>
37
38 <csc target="library" output="../../bin/Db4LocalStorage.dll" debug="${debug}" verbose="true" warninglevel="4">
39 <references basedir="../../bin/" failonempty="true">
40 <include name="System.dll" />
41 <include name="System.Data.dll" />
42 <include name="System.Xml.dll" />
43 <include name="libsecondlife.dll" />
44 <include name="GridInterfaces.dll" />
45 <include name="ServerConsole.dll" />
46 <include name="Db4objects.Db4o.dll" />
47 </references>
48 <sources basedir="Db4LocalStorage/">
49 <include name="*.cs" />
50 </sources>
51 </csc>
52 </target>
53</project>
diff --git a/src/Main.cs b/src/Main.cs
deleted file mode 100644
index a738d03..0000000
--- a/src/Main.cs
+++ /dev/null
@@ -1,338 +0,0 @@
1/*
2Copyright (c) OpenSim project, http://osgrid.org/
3
4
5* All rights reserved.
6*
7* Redistribution and use in source and binary forms, with or without
8* modification, are permitted provided that the following conditions are met:
9* * Redistributions of source code must retain the above copyright
10* notice, this list of conditions and the following disclaimer.
11* * Redistributions in binary form must reproduce the above copyright
12* notice, this list of conditions and the following disclaimer in the
13* documentation and/or other materials provided with the distribution.
14* * Neither the name of the <organization> nor the
15* names of its contributors may be used to endorse or promote products
16* derived from this software without specific prior written permission.
17*
18* THIS SOFTWARE IS PROVIDED BY <copyright holder> ``AS IS'' AND ANY
19* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
20* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21* DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY
22* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
24* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
25* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
27* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28*/
29
30using System;
31using System.Text;
32using System.IO;
33using System.Threading;
34using System.Net;
35using System.Net.Sockets;
36using System.Timers;
37using System.Reflection;
38using System.Collections;
39using System.Collections.Generic;
40using libsecondlife;
41using libsecondlife.Packets;
42using OpenSim.world;
43using OpenSim.GridServers;
44using OpenSim.Assets;
45using ServerConsole;
46using PhysicsSystem;
47
48namespace OpenSim
49{
50 /// <summary>
51 /// Description of MainForm.
52 /// </summary>
53 public class OpenSim_Main
54 {
55 public static OpenSim_Main sim;
56 public static SimConfig cfg;
57 public static World local_world;
58 public static Grid gridServers;
59 public static SimCAPSHTTPServer http_server;
60
61 public static Socket Server;
62 private static IPEndPoint ServerIncoming;
63 private static byte[] RecvBuffer = new byte[4096];
64 private byte[] ZeroBuffer = new byte[8192];
65 private static IPEndPoint ipeSender;
66 private static EndPoint epSender;
67 private static AsyncCallback ReceivedData;
68
69 public AssetCache assetCache;
70 public DateTime startuptime;
71 public Dictionary<EndPoint, OpenSimClient> ClientThreads = new Dictionary<EndPoint, OpenSimClient>();
72 private PhysicsManager physManager;
73 private System.Timers.Timer timer1 = new System.Timers.Timer();
74 private string ConfigDll = "SimConfig.dll";
75 private string _physicsEngine = "PhysX";
76 public bool sandbox = false;
77 public bool loginserver = false;
78
79 [STAThread]
80 public static void Main( string[] args )
81 {
82 Console.WriteLine("OpenSim " + VersionInfo.Version + "\n");
83 Console.WriteLine("Starting...\n");
84 ServerConsole.MainConsole.Instance = new MServerConsole(ServerConsole.ConsoleBase.ConsoleType.Local,"",0);
85
86 sim = new OpenSim_Main();
87
88 sim.sandbox = false;
89 sim.loginserver = false;
90 sim._physicsEngine = "PhysX";
91
92 for (int i = 0; i < args.Length; i++)
93 {
94 if(args[i] == "-sandbox")
95 {
96 sim.sandbox = true;
97 }
98
99 if(args[i] == "-loginserver")
100 {
101 sim.loginserver = true;
102 }
103 if(args[i] == "-realphysx")
104 {
105 sim._physicsEngine = "RealPhysX";
106 OpenSim.world.Avatar.PhysicsEngineFlying = true;
107 }
108 }
109
110 OpenSim_Main.gridServers = new Grid();
111 if(sim.sandbox)
112 {
113 OpenSim_Main.gridServers.AssetDll = "LocalGridServers.dll";
114 OpenSim_Main.gridServers.GridDll = "LocalGridServers.dll";
115 OpenSim_Main.gridServers.LoadPlugins();
116 ServerConsole.MainConsole.Instance.WriteLine("Starting in Sandbox mode");
117 }
118 else
119 {
120 OpenSim_Main.gridServers.AssetDll = "RemoteGridServers.dll";
121 OpenSim_Main.gridServers.GridDll = "RemoteGridServers.dll";
122 OpenSim_Main.gridServers.LoadPlugins();
123 ServerConsole.MainConsole.Instance.WriteLine("Starting in Grid mode");
124 }
125
126 if(sim.loginserver && sim.sandbox)
127 {
128 LoginServer loginServer = new LoginServer(OpenSim_Main.gridServers.GridServer);
129 loginServer.Startup();
130 }
131 sim.assetCache = new AssetCache(OpenSim_Main.gridServers.AssetServer);
132
133 sim.Startup();
134
135 while(true) {
136 ServerConsole.MainConsole.Instance.MainConsolePrompt();
137 }
138 }
139
140 private OpenSim_Main() {
141 }
142
143 private void Startup() {
144 startuptime=DateTime.Now;
145
146 // We check our local database first, then the grid for config options
147 ServerConsole.MainConsole.Instance.WriteLine("Main.cs:Startup() - Loading configuration");
148 cfg = this.LoadConfigDll(this.ConfigDll);
149 cfg.InitConfig();
150 ServerConsole.MainConsole.Instance.WriteLine("Main.cs:Startup() - Contacting gridserver");
151 cfg.LoadFromGrid();
152
153 ServerConsole.MainConsole.Instance.WriteLine("Main.cs:Startup() - We are " + cfg.RegionName + " at " + cfg.RegionLocX.ToString() + "," + cfg.RegionLocY.ToString());
154 ServerConsole.MainConsole.Instance.WriteLine("Initialising world");
155 local_world = cfg.LoadWorld();
156
157 this.physManager = new PhysicsSystem.PhysicsManager();
158 this.physManager.LoadPlugins();
159 ServerConsole.MainConsole.Instance.WriteLine("Main.cs:Startup() - Starting up messaging system");
160 local_world.PhysScene = this.physManager.GetPhysicsScene(this._physicsEngine); //should be reading from the config file what physics engine to use
161 local_world.PhysScene.SetTerrain(local_world.LandMap);
162
163 OpenSim_Main.gridServers.AssetServer.SetServerInfo(OpenSim_Main.cfg.AssetURL, OpenSim_Main.cfg.AssetSendKey);
164 OpenSim_Main.gridServers.GridServer.SetServerInfo(OpenSim_Main.cfg.GridURL, OpenSim_Main.cfg.GridSendKey, OpenSim_Main.cfg.GridRecvKey, OpenSim_Main.cfg.UserURL, OpenSim_Main.cfg.UserSendKey, OpenSim_Main.cfg.UserRecvKey);
165
166 local_world.LoadStorageDLL("Db4LocalStorage.dll"); //all these dll names shouldn't be hard coded.
167 local_world.LoadPrimsFromStorage();
168
169 ServerConsole.MainConsole.Instance.WriteLine("Main.cs:Startup() - Starting CAPS HTTP server");
170 http_server = new SimCAPSHTTPServer();
171
172 timer1.Enabled = true;
173 timer1.Interval = 100;
174 timer1.Elapsed += new ElapsedEventHandler(this.Timer1Tick);
175
176 MainServerListener();
177
178 }
179
180 private SimConfig LoadConfigDll(string dllName)
181 {
182 Assembly pluginAssembly = Assembly.LoadFrom(dllName);
183 SimConfig config = null;
184
185 foreach (Type pluginType in pluginAssembly.GetTypes())
186 {
187 if (pluginType.IsPublic)
188 {
189 if (!pluginType.IsAbstract)
190 {
191 Type typeInterface = pluginType.GetInterface("ISimConfig", true);
192
193 if (typeInterface != null)
194 {
195 ISimConfig plug = (ISimConfig)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString()));
196 config = plug.GetConfigObject();
197 break;
198 }
199
200 typeInterface = null;
201 }
202 }
203 }
204 pluginAssembly = null;
205 return config;
206 }
207
208 private void OnReceivedData(IAsyncResult result) {
209 ipeSender = new IPEndPoint(IPAddress.Any, 0);
210 epSender = (EndPoint)ipeSender;
211 Packet packet = null;
212 int numBytes = Server.EndReceiveFrom(result, ref epSender);
213 int packetEnd = numBytes - 1;
214 packet = Packet.BuildPacket(RecvBuffer, ref packetEnd, ZeroBuffer);
215
216 // This is either a new client or a packet to send to an old one
217 if(ClientThreads.ContainsKey(epSender)) {
218 ClientThreads[epSender].InPacket(packet);
219 } else if( packet.Type == PacketType.UseCircuitCode ) { // new client
220 OpenSimClient newuser = new OpenSimClient(epSender,(UseCircuitCodePacket)packet);
221 ClientThreads.Add(epSender, newuser);
222 } else { // invalid client
223 Console.Error.WriteLine("Main.cs:OnReceivedData() - WARNING: Got a packet from an invalid client - " + epSender.ToString());
224 }
225 Server.BeginReceiveFrom(RecvBuffer, 0, RecvBuffer.Length, SocketFlags.None, ref epSender, ReceivedData, null);
226 }
227
228 private void MainServerListener() {
229 ServerConsole.MainConsole.Instance.WriteLine("Main.cs:MainServerListener() - New thread started");
230 ServerConsole.MainConsole.Instance.WriteLine("Main.cs:MainServerListener() - Opening UDP socket on " + cfg.IPListenAddr + ":" + cfg.IPListenPort);
231
232 ServerIncoming = new IPEndPoint(IPAddress.Any, cfg.IPListenPort);
233 Server = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
234 Server.Bind(ServerIncoming);
235
236 ServerConsole.MainConsole.Instance.WriteLine("Main.cs:MainServerListener() - UDP socket bound, getting ready to listen");
237
238 ipeSender = new IPEndPoint(IPAddress.Any, 0);
239 epSender = (EndPoint) ipeSender;
240 ReceivedData = new AsyncCallback(this.OnReceivedData);
241 Server.BeginReceiveFrom(RecvBuffer, 0, RecvBuffer.Length, SocketFlags.None, ref epSender, ReceivedData, null);
242
243 ServerConsole.MainConsole.Instance.WriteLine("Main.cs:MainServerListener() - Listening...");
244
245 }
246
247 public static void Shutdown() {
248 ServerConsole.MainConsole.Instance.WriteLine("Main.cs:Shutdown() - Closing all threads");
249 ServerConsole.MainConsole.Instance.WriteLine("Main.cs:Shutdown() - Killing listener thread");
250 ServerConsole.MainConsole.Instance.WriteLine("Main.cs:Shutdown() - Killing clients");
251 // IMPLEMENT THIS
252 ServerConsole.MainConsole.Instance.WriteLine("Main.cs:Shutdown() - Closing console and terminating");
253 OpenSim_Main.local_world.Close();
254 ServerConsole.MainConsole.Instance.Close();
255 Environment.Exit(0);
256 }
257
258 void Timer1Tick( object sender, System.EventArgs e )
259 {
260
261 local_world.Update();
262 }
263 }
264
265 public class Grid
266 {
267 public IAssetServer AssetServer;
268 public IGridServer GridServer;
269 public string AssetDll = "";
270 public string GridDll = "";
271
272 public Grid()
273 {
274 }
275
276 public void LoadPlugins()
277 {
278 this.AssetServer = this.LoadAssetDll(this.AssetDll);
279 this.GridServer = this.LoadGridDll(this.GridDll);
280 }
281
282 private IAssetServer LoadAssetDll(string dllName)
283 {
284 Assembly pluginAssembly = Assembly.LoadFrom(dllName);
285 IAssetServer server = null;
286
287 foreach (Type pluginType in pluginAssembly.GetTypes())
288 {
289 if (pluginType.IsPublic)
290 {
291 if (!pluginType.IsAbstract)
292 {
293 Type typeInterface = pluginType.GetInterface("IAssetPlugin", true);
294
295 if (typeInterface != null)
296 {
297 IAssetPlugin plug = (IAssetPlugin)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString()));
298 server = plug.GetAssetServer();
299 break;
300 }
301
302 typeInterface = null;
303 }
304 }
305 }
306 pluginAssembly = null;
307 return server;
308 }
309
310 private IGridServer LoadGridDll(string dllName)
311 {
312 Assembly pluginAssembly = Assembly.LoadFrom(dllName);
313 IGridServer server = null;
314
315 foreach (Type pluginType in pluginAssembly.GetTypes())
316 {
317 if (pluginType.IsPublic)
318 {
319 if (!pluginType.IsAbstract)
320 {
321 Type typeInterface = pluginType.GetInterface("IGridPlugin", true);
322
323 if (typeInterface != null)
324 {
325 IGridPlugin plug = (IGridPlugin)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString()));
326 server = plug.GetGridServer();
327 break;
328 }
329
330 typeInterface = null;
331 }
332 }
333 }
334 pluginAssembly = null;
335 return server;
336 }
337 }
338}
diff --git a/src/OpenSim.Framework/AssemblyInfo.cs b/src/OpenSim.Framework/AssemblyInfo.cs
deleted file mode 100644
index 32f1380..0000000
--- a/src/OpenSim.Framework/AssemblyInfo.cs
+++ /dev/null
@@ -1,21 +0,0 @@
1using System;
2using System.Reflection;
3using System.Runtime.InteropServices;
4
5// ------------------------------------------------------------------------------
6// <autogenerated>
7// This code was generated by a tool.
8// Mono Runtime Version: 2.0.50727.42
9//
10// Changes to this file may cause incorrect behavior and will be lost if
11// the code is regenerated.
12// </autogenerated>
13// ------------------------------------------------------------------------------
14
15[assembly: ComVisibleAttribute(false)]
16[assembly: CLSCompliantAttribute(false)]
17[assembly: AssemblyVersionAttribute("0.1.0.240")]
18[assembly: AssemblyTitleAttribute("opensim-gridinterfaces")]
19[assembly: AssemblyDescriptionAttribute("Definitions for OGS interface")]
20[assembly: AssemblyCopyrightAttribute("Copyright © OGS development team 2007")]
21
diff --git a/src/OpenSim.Framework/OpenSim.Framework.csproj b/src/OpenSim.Framework/OpenSim.Framework.csproj
deleted file mode 100644
index ec586c3..0000000
--- a/src/OpenSim.Framework/OpenSim.Framework.csproj
+++ /dev/null
@@ -1,49 +0,0 @@
1<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
2 <PropertyGroup>
3 <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
4 <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
5 <ProductVersion>8.0.50727</ProductVersion>
6 <SchemaVersion>2.0</SchemaVersion>
7 <ProjectGuid>{407CE85B-628C-4788-9DBC-49BCEFC3A84F}</ProjectGuid>
8 <OutputType>Library</OutputType>
9 <AppDesignerFolder>Properties</AppDesignerFolder>
10 <RootNamespace>OpenSim.Framework</RootNamespace>
11 <AssemblyName>OpenGrid.Framework</AssemblyName>
12 </PropertyGroup>
13 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
14 <DebugSymbols>true</DebugSymbols>
15 <DebugType>full</DebugType>
16 <Optimize>false</Optimize>
17 <OutputPath>bin\Debug\</OutputPath>
18 <DefineConstants>DEBUG;TRACE</DefineConstants>
19 <ErrorReport>prompt</ErrorReport>
20 <WarningLevel>4</WarningLevel>
21 </PropertyGroup>
22 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
23 <DebugType>pdbonly</DebugType>
24 <Optimize>true</Optimize>
25 <OutputPath>bin\Release\</OutputPath>
26 <DefineConstants>TRACE</DefineConstants>
27 <ErrorReport>prompt</ErrorReport>
28 <WarningLevel>4</WarningLevel>
29 </PropertyGroup>
30 <ItemGroup>
31 <Reference Include="libsecondlife, Version=0.9.0.0, Culture=neutral, processorArchitecture=MSIL">
32 <SpecificVersion>False</SpecificVersion>
33 <HintPath>..\..\bin\libsecondlife.dll</HintPath>
34 </Reference>
35 <Reference Include="System" />
36 <Reference Include="System.Data" />
37 <Reference Include="System.Xml" />
38 </ItemGroup>
39 <ItemGroup>
40 <Compile Include="LoginService.cs" />
41 </ItemGroup>
42 <ItemGroup>
43 <ProjectReference Include="..\GridInterfaces\GridInterfaces.csproj">
44 <Project>{5DA3174D-42F9-416D-9F0B-AF41FA2BE2F9}</Project>
45 <Name>GridInterfaces</Name>
46 </ProjectReference>
47 </ItemGroup>
48 <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
49</Project> \ No newline at end of file
diff --git a/src/OpenSim.Framework/Properties/AssemblyInfo.cs b/src/OpenSim.Framework/Properties/AssemblyInfo.cs
deleted file mode 100644
index 72e55b9..0000000
--- a/src/OpenSim.Framework/Properties/AssemblyInfo.cs
+++ /dev/null
@@ -1,35 +0,0 @@
1using System.Reflection;
2using System.Runtime.CompilerServices;
3using System.Runtime.InteropServices;
4
5// General Information about an assembly is controlled through the following
6// set of attributes. Change these attribute values to modify the information
7// associated with an assembly.
8[assembly: AssemblyTitle("OpenGrid.Framework")]
9[assembly: AssemblyDescription("")]
10[assembly: AssemblyConfiguration("")]
11[assembly: AssemblyCompany("Playahead AB")]
12[assembly: AssemblyProduct("OpenGrid.Framework")]
13[assembly: AssemblyCopyright("Copyright © Playahead AB 2007")]
14[assembly: AssemblyTrademark("")]
15[assembly: AssemblyCulture("")]
16
17// Setting ComVisible to false makes the types in this assembly not visible
18// to COM components. If you need to access a type in this assembly from
19// COM, set the ComVisible attribute to true on that type.
20[assembly: ComVisible(false)]
21
22// The following GUID is for the ID of the typelib if this project is exposed to COM
23[assembly: Guid("67d2b810-0969-4550-ab2b-d2f5ac191191")]
24
25// Version information for an assembly consists of the following four values:
26//
27// Major Version
28// Minor Version
29// Build Number
30// Revision
31//
32// You can specify all the values or you can default the Revision and Build Numbers
33// by using the '*' as shown below:
34[assembly: AssemblyVersion("1.0.0.0")]
35[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/src/OpenSim.Framework/default.build b/src/OpenSim.Framework/default.build
deleted file mode 100644
index 57dfee8..0000000
--- a/src/OpenSim.Framework/default.build
+++ /dev/null
@@ -1,50 +0,0 @@
1<?xml version="1.0"?>
2 <project name="OpenSim.Framework" default="build" basedir=".">
3 <description>nant buildfile for OpenSim.Framework</description>
4 <property name="debug" value="true" overwrite="false" />
5 <target name="clean" description="remove all generated files">
6 <delete file="../../bin/OpenSim.Framework.dll" failonerror="false" />
7 </target>
8
9 <target name="svnupdate" description="updates to latest SVN">
10 <exec program="svn">
11 <arg value="update" />
12 </exec>
13 </target>
14
15 <target name="upgrade" description="updates from SVN and then builds" depends="clean,svnupdate,build">
16
17 </target>
18
19 <target name="build" description="compiles the source code">
20
21 <loadfile file="../../VERSION" property="svnver"/>
22 <asminfo output="AssemblyInfo.cs" language="CSharp">
23 <imports>
24 <import namespace="System" />
25 <import namespace="System.Reflection" />
26 <import namespace="System.Runtime.InteropServices" />
27 </imports>
28 <attributes>
29 <attribute type="ComVisibleAttribute" value="false" />
30 <attribute type="CLSCompliantAttribute" value="false" />
31 <attribute type="AssemblyVersionAttribute" value="${svnver}" />
32 <attribute type="AssemblyTitleAttribute" value="opensim-gridinterfaces" />
33 <attribute type="AssemblyDescriptionAttribute" value="Definitions for OGS interface" />
34 <attribute type="AssemblyCopyrightAttribute" value="Copyright © OGS development team 2007"/>
35 </attributes>
36 </asminfo>
37
38 <csc target="library" output="../../bin/OpenSim.Framework.dll" debug="${debug}" verbose="true" warninglevel="4">
39 <references basedir="../../bin" failonempty="true">
40 <include name="System.dll" />
41 <include name="System.Xml.dll" />
42 <include name="libsecondlife.dll" />
43 <include name="GridInterfaces.dll" />
44 </references>
45 <sources basedir="./">
46 <include name="*.cs" />
47 </sources>
48 </csc>
49 </target>
50</project>
diff --git a/src/OpenSimClient.cs b/src/OpenSimClient.cs
deleted file mode 100644
index dd698e4..0000000
--- a/src/OpenSimClient.cs
+++ /dev/null
@@ -1,471 +0,0 @@
1/*
2Copyright (c) OpenSim project, http://osgrid.org/
3*
4* Redistribution and use in source and binary forms, with or without
5* modification, are permitted provided that the following conditions are met:
6* * Redistributions of source code must retain the above copyright
7* notice, this list of conditions and the following disclaimer.
8* * Redistributions in binary form must reproduce the above copyright
9* notice, this list of conditions and the following disclaimer in the
10* documentation and/or other materials provided with the distribution.
11* * Neither the name of the <organization> nor the
12* names of its contributors may be used to endorse or promote products
13* derived from this software without specific prior written permission.
14*
15* THIS SOFTWARE IS PROVIDED BY <copyright holder> ``AS IS'' AND ANY
16* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
18* DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY
19* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
20* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
21* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
22* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
24* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25*/
26
27using System;
28using System.Collections;
29using System.Collections.Generic;
30using libsecondlife;
31using libsecondlife.Packets;
32using System.Net;
33using System.Net.Sockets;
34using System.IO;
35using System.Threading;
36using System.Timers;
37using OpenSim.GridServers;
38using OpenSim.world;
39
40namespace OpenSim
41{
42 /// <summary>
43 /// Handles new client connections
44 /// Constructor takes a single Packet and authenticates everything
45 /// </summary>
46 public class OpenSimClient {
47
48 public LLUUID AgentID;
49 public LLUUID SessionID;
50 public uint CircuitCode;
51 public world.Avatar ClientAvatar;
52 private UseCircuitCodePacket cirpack;
53 private Thread ClientThread;
54 public EndPoint userEP;
55 private BlockingQueue<QueItem> PacketQueue;
56 private Dictionary<uint, uint> PendingAcks = new Dictionary<uint, uint>();
57 private Dictionary<uint, Packet> NeedAck = new Dictionary<uint, Packet>();
58 private System.Timers.Timer AckTimer;
59 private uint Sequence = 0;
60 private object SequenceLock = new object();
61 private const int MAX_APPENDED_ACKS = 10;
62 private const int RESEND_TIMEOUT = 4000;
63 private const int MAX_SEQUENCE = 0xFFFFFF;
64
65 public void ack_pack(Packet Pack) {
66 //libsecondlife.Packets.PacketAckPacket ack_it = new PacketAckPacket();
67 //ack_it.Packets = new PacketAckPacket.PacketsBlock[1];
68 //ack_it.Packets[0] = new PacketAckPacket.PacketsBlock();
69 //ack_it.Packets[0].ID = Pack.Header.ID;
70 //ack_it.Header.Reliable = false;
71
72 //OutPacket(ack_it);
73
74 if (Pack.Header.Reliable) {
75 lock (PendingAcks) {
76 uint sequence = (uint)Pack.Header.Sequence;
77 if (!PendingAcks.ContainsKey(sequence)) { PendingAcks[sequence] = sequence; }
78 }
79 }
80 }
81
82 public void ProcessInPacket(Packet Pack) {
83 ack_pack(Pack);
84 switch(Pack.Type) {
85 case PacketType.CompleteAgentMovement:
86 ClientAvatar.CompleteMovement(OpenSim_Main.local_world);
87 ClientAvatar.SendInitialPosition();
88 break;
89 case PacketType.RegionHandshakeReply:
90 OpenSim_Main.local_world.SendLayerData(this);
91 break;
92 case PacketType.AgentWearablesRequest:
93 ClientAvatar.SendInitialAppearance();
94 foreach(OpenSimClient client in OpenSim_Main.sim.ClientThreads.Values) {
95 if(client.AgentID != this.AgentID)
96 {
97 ObjectUpdatePacket objupdate = client.ClientAvatar.CreateUpdatePacket();
98 this.OutPacket(objupdate);
99 client.ClientAvatar.SendAppearanceToOtherAgent(this);
100 }
101 }
102 OpenSim_Main.local_world.GetInitialPrims(this);
103 break;
104 case PacketType.ObjectAdd:
105 OpenSim_Main.local_world.AddNewPrim((ObjectAddPacket)Pack, this);
106 break;
107 case PacketType.ObjectLink:
108 ServerConsole.MainConsole.Instance.WriteLine(Pack.ToString());
109 break;
110 case PacketType.ObjectScale:
111 ServerConsole.MainConsole.Instance.WriteLine(Pack.ToString());
112 break;
113 case PacketType.ObjectShape:
114 ObjectShapePacket shape = (ObjectShapePacket)Pack;
115 for(int i =0; i <shape.ObjectData.Length; i++)
116 {
117 foreach (Entity ent in OpenSim_Main.local_world.Entities.Values)
118 {
119 if(ent.localid == shape.ObjectData[i].ObjectLocalID)
120 {
121 ((OpenSim.world.Primitive)ent).UpdateShape(shape.ObjectData[i]);
122 }
123 }
124 }
125 break;
126 case PacketType.MultipleObjectUpdate :
127 MultipleObjectUpdatePacket multipleupdate = (MultipleObjectUpdatePacket)Pack;
128
129 for( int i = 0; i < multipleupdate.ObjectData.Length; i++ )
130 {
131 if( multipleupdate.ObjectData[ i ].Type == 9 ) //change position
132 {
133 libsecondlife.LLVector3 pos = new LLVector3(multipleupdate.ObjectData[ i ].Data, 0 );
134 foreach (Entity ent in OpenSim_Main.local_world.Entities.Values)
135 {
136 if(ent.localid == multipleupdate.ObjectData[ i ].ObjectLocalID)
137 {
138 ((OpenSim.world.Primitive)ent).UpdatePosition( pos);
139
140 }
141 }
142
143 //should update stored position of the prim
144 }
145 else if(multipleupdate.ObjectData[i].Type == 10 )//rotation
146 {
147 libsecondlife.LLQuaternion rot = new LLQuaternion(multipleupdate.ObjectData[i].Data, 0, true);
148 foreach (Entity ent in OpenSim_Main.local_world.Entities.Values)
149 {
150 if(ent.localid == multipleupdate.ObjectData[ i ].ObjectLocalID)
151 {
152 ent.rotation = new Axiom.MathLib.Quaternion(rot.W, rot.X, rot.Y, rot.W);
153 ((OpenSim.world.Primitive)ent).UpdateFlag = true;
154 }
155 }
156 }
157 else if(multipleupdate.ObjectData[i].Type == 13 )//scale
158 {
159
160 libsecondlife.LLVector3 scale = new LLVector3(multipleupdate.ObjectData[ i ].Data, 12 );
161 foreach (Entity ent in OpenSim_Main.local_world.Entities.Values)
162 {
163 if(ent.localid == multipleupdate.ObjectData[ i ].ObjectLocalID)
164 {
165 ((OpenSim.world.Primitive)ent).Scale = scale;
166 }
167 }
168 }
169 }
170 break;
171 case PacketType.TransferRequest:
172 //Console.WriteLine("OpenSimClient.cs:ProcessInPacket() - Got transfer request");
173 TransferRequestPacket transfer = (TransferRequestPacket)Pack;
174 OpenSim_Main.sim.assetCache.AddAssetRequest(this, transfer);
175 break;
176 case PacketType.AgentUpdate:
177 ClientAvatar.HandleUpdate((AgentUpdatePacket)Pack);
178 break;
179 case PacketType.LogoutRequest:
180 ServerConsole.MainConsole.Instance.WriteLine("OpenSimClient.cs:ProcessInPacket() - Got a logout request");
181 //tell all clients to kill our object
182 KillObjectPacket kill = new KillObjectPacket();
183 kill.ObjectData = new KillObjectPacket.ObjectDataBlock[1];
184 kill.ObjectData[0] = new KillObjectPacket.ObjectDataBlock();
185 kill.ObjectData[0].ID = this.ClientAvatar.localid;
186 foreach(OpenSimClient client in OpenSim_Main.sim.ClientThreads.Values) {
187 client.OutPacket(kill);
188 }
189 OpenSim_Main.gridServers.GridServer.LogoutSession(this.SessionID, this.AgentID, this.CircuitCode);
190 lock(OpenSim_Main.local_world.Entities) {
191 OpenSim_Main.local_world.Entities.Remove(this.AgentID);
192 }
193 //need to do other cleaning up here too
194 OpenSim_Main.sim.ClientThreads.Remove(this.userEP);
195 this.ClientThread.Abort();
196 break;
197 case PacketType.ChatFromViewer:
198 ChatFromViewerPacket inchatpack = (ChatFromViewerPacket)Pack;
199 if(Helpers.FieldToString(inchatpack.ChatData.Message)=="") break;
200
201 System.Text.Encoding _enc = System.Text.Encoding.ASCII;
202 libsecondlife.Packets.ChatFromSimulatorPacket reply = new ChatFromSimulatorPacket();
203 reply.ChatData.Audible = 1;
204 reply.ChatData.Message = inchatpack.ChatData.Message;
205 reply.ChatData.ChatType = 1;
206 reply.ChatData.SourceType = 1;
207 reply.ChatData.Position = this.ClientAvatar.position;
208 reply.ChatData.FromName = _enc.GetBytes(this.ClientAvatar.firstname + " " + this.ClientAvatar.lastname + "\0");
209 reply.ChatData.OwnerID = this.AgentID;
210 reply.ChatData.SourceID = this.AgentID;
211 foreach(OpenSimClient client in OpenSim_Main.sim.ClientThreads.Values) {
212 client.OutPacket(reply);
213 }
214 break;
215 }
216 }
217
218 private void ResendUnacked()
219 {
220 int now = Environment.TickCount;
221
222 lock (NeedAck)
223 {
224 foreach (Packet packet in NeedAck.Values)
225 {
226 if ((now - packet.TickCount > RESEND_TIMEOUT) && (!packet.Header.Resent))
227 {
228 ServerConsole.MainConsole.Instance.WriteLine("Resending " + packet.Type.ToString() + " packet, " +
229 (now - packet.TickCount) + "ms have passed");
230
231 packet.Header.Resent = true;
232 OutPacket(packet);
233 }
234 }
235 }
236 }
237
238 private void SendAcks()
239 {
240 lock (PendingAcks)
241 {
242 if (PendingAcks.Count > 0)
243 {
244 if (PendingAcks.Count > 250)
245 {
246 // FIXME: Handle the odd case where we have too many pending ACKs queued up
247 ServerConsole.MainConsole.Instance.WriteLine("Too many ACKs queued up!");
248 return;
249 }
250
251 ServerConsole.MainConsole.Instance.WriteLine("Sending PacketAck");
252
253
254 int i = 0;
255 PacketAckPacket acks = new PacketAckPacket();
256 acks.Packets = new PacketAckPacket.PacketsBlock[PendingAcks.Count];
257
258 foreach (uint ack in PendingAcks.Values)
259 {
260 acks.Packets[i] = new PacketAckPacket.PacketsBlock();
261 acks.Packets[i].ID = ack;
262 i++;
263 }
264
265 acks.Header.Reliable = false;
266 OutPacket(acks);
267
268 PendingAcks.Clear();
269 }
270 }
271 }
272
273 private void AckTimer_Elapsed(object sender, ElapsedEventArgs ea)
274 {
275 SendAcks();
276 ResendUnacked();
277 }
278
279 public void ProcessOutPacket(Packet Pack) {
280
281 // Keep track of when this packet was sent out
282 Pack.TickCount = Environment.TickCount;
283
284 if (!Pack.Header.Resent)
285 {
286 // Set the sequence number
287 lock (SequenceLock)
288 {
289 if (Sequence >= MAX_SEQUENCE)
290 Sequence = 1;
291 else
292 Sequence++;
293 Pack.Header.Sequence = Sequence;
294 }
295
296 if (Pack.Header.Reliable) //DIRTY HACK
297 {
298 lock (NeedAck)
299 {
300 if (!NeedAck.ContainsKey(Pack.Header.Sequence))
301 {
302 NeedAck.Add(Pack.Header.Sequence, Pack);
303 }
304 else
305 {
306 // Client.Log("Attempted to add a duplicate sequence number (" +
307 // packet.Header.Sequence + ") to the NeedAck dictionary for packet type " +
308 // packet.Type.ToString(), Helpers.LogLevel.Warning);
309 }
310 }
311
312 // Don't append ACKs to resent packets, in case that's what was causing the
313 // delivery to fail
314 if (!Pack.Header.Resent)
315 {
316 // Append any ACKs that need to be sent out to this packet
317 lock (PendingAcks)
318 {
319 if (PendingAcks.Count > 0 && PendingAcks.Count < MAX_APPENDED_ACKS &&
320 Pack.Type != PacketType.PacketAck &&
321 Pack.Type != PacketType.LogoutRequest)
322 {
323 Pack.Header.AckList = new uint[PendingAcks.Count];
324 int i = 0;
325
326 foreach (uint ack in PendingAcks.Values)
327 {
328 Pack.Header.AckList[i] = ack;
329 i++;
330 }
331
332 PendingAcks.Clear();
333 Pack.Header.AppendedAcks = true;
334 }
335 }
336 }
337 }
338 }
339
340 //ServerConsole.MainConsole.Instance.WriteLine("OUT: \n" + Pack.ToString());
341
342 byte[] ZeroOutBuffer = new byte[4096];
343 byte[] sendbuffer;
344 sendbuffer = Pack.ToBytes();
345
346 try {
347 if (Pack.Header.Zerocoded) {
348 int packetsize = Helpers.ZeroEncode(sendbuffer, sendbuffer.Length, ZeroOutBuffer);
349 OpenSim_Main.Server.SendTo(ZeroOutBuffer, packetsize, SocketFlags.None,userEP);
350 } else {
351 OpenSim_Main.Server.SendTo(sendbuffer, sendbuffer.Length, SocketFlags.None,userEP);
352 }
353 } catch (Exception) {
354 ServerConsole.MainConsole.Instance.WriteLine("OpenSimClient.cs:ProcessOutPacket() - WARNING: Socket exception occurred on connection " + userEP.ToString() + " - killing thread");
355 ClientThread.Abort();
356 }
357
358 }
359
360 public void InPacket(Packet NewPack) {
361 // Handle appended ACKs
362 if (NewPack.Header.AppendedAcks)
363 {
364 lock (NeedAck)
365 {
366 foreach (uint ack in NewPack.Header.AckList)
367 {
368 NeedAck.Remove(ack);
369 }
370 }
371 }
372
373 // Handle PacketAck packets
374 if (NewPack.Type == PacketType.PacketAck)
375 {
376 PacketAckPacket ackPacket = (PacketAckPacket)NewPack;
377
378 lock (NeedAck)
379 {
380 foreach (PacketAckPacket.PacketsBlock block in ackPacket.Packets)
381 {
382 NeedAck.Remove(block.ID);
383 }
384 }
385 } else if( ( NewPack.Type == PacketType.StartPingCheck ) ) {
386 //reply to pingcheck
387 libsecondlife.Packets.StartPingCheckPacket startPing = (libsecondlife.Packets.StartPingCheckPacket)NewPack;
388 libsecondlife.Packets.CompletePingCheckPacket endPing = new CompletePingCheckPacket();
389 endPing.PingID.PingID = startPing.PingID.PingID;
390 OutPacket(endPing);
391 }
392 else
393 {
394 QueItem item = new QueItem();
395 item.Packet = NewPack;
396 item.Incoming = true;
397 this.PacketQueue.Enqueue(item);
398 }
399
400 }
401
402 public void OutPacket(Packet NewPack) {
403 QueItem item = new QueItem();
404 item.Packet = NewPack;
405 item.Incoming = false;
406 this.PacketQueue.Enqueue(item);
407 }
408
409 public OpenSimClient(EndPoint remoteEP, UseCircuitCodePacket initialcirpack) {
410 ServerConsole.MainConsole.Instance.WriteLine("OpenSimClient.cs - Started up new client thread to handle incoming request");
411 cirpack = initialcirpack;
412 userEP = remoteEP;
413 PacketQueue = new BlockingQueue<QueItem>();
414 AckTimer = new System.Timers.Timer(500);
415 AckTimer.Elapsed += new ElapsedEventHandler(AckTimer_Elapsed);
416 AckTimer.Start();
417
418 ClientThread = new Thread(new ThreadStart(AuthUser));
419 ClientThread.IsBackground = true;
420 ClientThread.Start();
421 }
422
423 private void ClientLoop() {
424 ServerConsole.MainConsole.Instance.WriteLine("OpenSimClient.cs:ClientLoop() - Entered loop");
425 while(true) {
426 QueItem nextPacket = PacketQueue.Dequeue();
427 if(nextPacket.Incoming)
428 {
429 //is a incoming packet
430 ProcessInPacket(nextPacket.Packet);
431 }
432 else
433 {
434 //is a out going packet
435 ProcessOutPacket(nextPacket.Packet);
436 }
437 }
438 }
439
440 private void InitNewClient() {
441 ServerConsole.MainConsole.Instance.WriteLine("OpenSimClient.cs:InitNewClient() - Adding viewer agent to world");
442 OpenSim_Main.local_world.AddViewerAgent(this);
443 world.Entity tempent=OpenSim_Main.local_world.Entities[this.AgentID];
444 this.ClientAvatar=(world.Avatar)tempent;
445 }
446
447 private void AuthUser()
448 {
449 AuthenticateResponse sessionInfo = OpenSim_Main.gridServers.GridServer.AuthenticateSession(cirpack.CircuitCode.SessionID, cirpack.CircuitCode.ID, cirpack.CircuitCode.Code);
450 if(!sessionInfo.Authorised)
451 {
452 //session/circuit not authorised
453 ServerConsole.MainConsole.Instance.WriteLine("OpenSimClient.cs:AuthUser() - New user request denied to " + userEP.ToString());
454 ClientThread.Abort();
455 }
456 else
457 {
458 ServerConsole.MainConsole.Instance.WriteLine("OpenSimClient.cs:AuthUser() - Got authenticated connection from " + userEP.ToString());
459 //session is authorised
460 this.AgentID=cirpack.CircuitCode.ID;
461 this.SessionID=cirpack.CircuitCode.SessionID;
462 this.CircuitCode=cirpack.CircuitCode.Code;
463 InitNewClient();
464 this.ClientAvatar.firstname = sessionInfo.LoginInfo.First;
465 this.ClientAvatar.lastname = sessionInfo.LoginInfo.Last;
466 ClientLoop();
467 }
468 }
469 }
470
471}
diff --git a/src/RemoteServers/RemoteGridServers/AssemblyInfo.cs b/src/RemoteServers/RemoteGridServers/AssemblyInfo.cs
deleted file mode 100644
index 7d3f314..0000000
--- a/src/RemoteServers/RemoteGridServers/AssemblyInfo.cs
+++ /dev/null
@@ -1,21 +0,0 @@
1using System;
2using System.Reflection;
3using System.Runtime.InteropServices;
4
5// ------------------------------------------------------------------------------
6// <autogenerated>
7// This code was generated by a tool.
8// Mono Runtime Version: 2.0.50727.42
9//
10// Changes to this file may cause incorrect behavior and will be lost if
11// the code is regenerated.
12// </autogenerated>
13// ------------------------------------------------------------------------------
14
15[assembly: ComVisibleAttribute(false)]
16[assembly: CLSCompliantAttribute(false)]
17[assembly: AssemblyVersionAttribute("0.1.0.240")]
18[assembly: AssemblyTitleAttribute("opensim-remoteservers")]
19[assembly: AssemblyDescriptionAttribute("Connects to remote OGS installation")]
20[assembly: AssemblyCopyrightAttribute("Copyright © OGS development team 2007")]
21
diff --git a/src/RemoteServers/RemoteGridServers/RemoteGrid.cs b/src/RemoteServers/RemoteGridServers/RemoteGrid.cs
deleted file mode 100644
index adb3d0f..0000000
--- a/src/RemoteServers/RemoteGridServers/RemoteGrid.cs
+++ /dev/null
@@ -1,279 +0,0 @@
1/*
2* Copyright (c) OpenSim project, http://sim.opensecondlife.org/
3*
4* Redistribution and use in source and binary forms, with or without
5* modification, are permitted provided that the following conditions are met:
6* * Redistributions of source code must retain the above copyright
7* notice, this list of conditions and the following disclaimer.
8* * Redistributions in binary form must reproduce the above copyright
9* notice, this list of conditions and the following disclaimer in the
10* documentation and/or other materials provided with the distribution.
11* * Neither the name of the <organization> nor the
12* names of its contributors may be used to endorse or promote products
13* derived from this software without specific prior written permission.
14*
15* THIS SOFTWARE IS PROVIDED BY <copyright holder> ``AS IS'' AND ANY
16* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
18* DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY
19* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
20* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
21* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
22* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
24* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25*
26*/
27using System;
28using System.Collections;
29using System.Collections.Generic;
30using System.Threading;
31using System.Net;
32using System.Net.Sockets;
33using System.IO;
34using System.Xml;
35using libsecondlife;
36using OpenSim.GridServers;
37
38namespace RemoteGridServers
39{
40 /// <summary>
41 ///
42 /// </summary>
43 ///
44
45 public class RemoteGridPlugin : IGridPlugin
46 {
47 public RemoteGridPlugin()
48 {
49
50 }
51
52 public IGridServer GetGridServer()
53 {
54 return(new RemoteGridServer());
55 }
56 }
57
58 public class RemoteAssetPlugin : IAssetPlugin
59 {
60 public RemoteAssetPlugin()
61 {
62
63 }
64
65 public IAssetServer GetAssetServer()
66 {
67 return(new RemoteAssetServer());
68 }
69 }
70 public class RemoteGridServer : RemoteGridBase
71 {
72 private string GridServerUrl;
73 private string GridSendKey;
74 private string GridRecvKey;
75 private string UserServerUrl;
76 private string UserSendKey;
77 private string UserRecvKey;
78
79 private Dictionary<uint, agentcircuitdata> AgentCircuits = new Dictionary<uint, agentcircuitdata>();
80
81 public override Dictionary<uint, agentcircuitdata> agentcircuits {
82 get {return AgentCircuits;}
83 set {AgentCircuits=value;}
84 }
85
86 public RemoteGridServer()
87 {
88 ServerConsole.MainConsole.Instance.WriteLine("Remote Grid Server class created");
89 }
90
91 public override bool RequestConnection()
92 {
93 return true;
94 }
95
96 public override AuthenticateResponse AuthenticateSession(LLUUID sessionID, LLUUID agentID, uint circuitcode)
97 {
98 agentcircuitdata validcircuit=this.AgentCircuits[circuitcode];
99 AuthenticateResponse user = new AuthenticateResponse();
100 if((sessionID==validcircuit.SessionID) && (agentID==validcircuit.AgentID))
101 {
102 // YAY! Valid login
103 user.Authorised = true;
104 user.LoginInfo = new Login();
105 user.LoginInfo.Agent = agentID;
106 user.LoginInfo.Session = sessionID;
107 user.LoginInfo.First = validcircuit.firstname;
108 user.LoginInfo.Last = validcircuit.lastname;
109 }
110 else
111 {
112 // Invalid
113 user.Authorised = false;
114 }
115
116 return(user);
117 }
118
119 public override bool LogoutSession(LLUUID sessionID, LLUUID agentID, uint circuitCode)
120 {
121 WebRequest DeleteSession = WebRequest.Create(UserServerUrl + "/usersessions/" + sessionID.ToString());
122 DeleteSession.Method="DELETE";
123 DeleteSession.ContentType="text/plaintext";
124 DeleteSession.ContentLength=0;
125
126 StreamWriter stOut = new StreamWriter (DeleteSession.GetRequestStream(), System.Text.Encoding.ASCII);
127 stOut.Write("");
128 stOut.Close();
129
130 StreamReader stIn = new StreamReader(DeleteSession.GetResponse().GetResponseStream());
131 string GridResponse = stIn.ReadToEnd();
132 stIn.Close();
133 return(true);
134 }
135
136 public override UUIDBlock RequestUUIDBlock()
137 {
138 UUIDBlock uuidBlock = new UUIDBlock();
139 return(uuidBlock);
140 }
141
142 public override neighbourinfo[] RequestNeighbours(ulong regionhandle)
143 {
144 ArrayList neighbourlist = new ArrayList();
145
146 WebRequest FindNeighbours = WebRequest.Create(GridServerUrl + "/regions/" + regionhandle.ToString() + "/neighbours");
147 FindNeighbours.ContentType="text/plaintext";
148 FindNeighbours.ContentLength=0;
149
150 StreamWriter stOut = new StreamWriter (FindNeighbours.GetRequestStream(), System.Text.Encoding.ASCII);
151 stOut.Write("");
152 stOut.Close();
153
154
155 XmlDocument GridRespXml = new XmlDocument();
156 GridRespXml.Load(FindNeighbours.GetResponse().GetResponseStream());
157
158
159 XmlNode NeighboursRoot = GridRespXml.FirstChild;
160 if(NeighboursRoot.Name != "neighbours") {
161 return new neighbourinfo[0];
162 }
163
164 FindNeighbours.GetResponse().GetResponseStream().Close();
165
166 return new neighbourinfo[0];
167 }
168
169 public override void SetServerInfo(string UserServerUrl, string UserSendKey, string UserRecvKey, string GridServerUrl, string GridSendKey, string GridRecvKey)
170 {
171 this.UserServerUrl = UserServerUrl;
172 this.UserSendKey = UserSendKey;
173 this.UserRecvKey = UserRecvKey;
174 this.GridServerUrl = GridServerUrl;
175 this.GridSendKey = GridSendKey;
176 this.GridRecvKey = GridRecvKey;
177 }
178
179 public override string GetName()
180 {
181 return "Remote";
182 }
183 }
184
185
186 public class RemoteAssetServer : IAssetServer
187 {
188 private IAssetReceiver _receiver;
189 private BlockingQueue<ARequest> _assetRequests;
190 private Thread _remoteAssetServerThread;
191 private string AssetServerUrl;
192 private string AssetSendKey;
193
194 public RemoteAssetServer()
195 {
196 this._assetRequests = new BlockingQueue<ARequest>();
197 this._remoteAssetServerThread = new Thread(new ThreadStart(RunRequests));
198 this._remoteAssetServerThread.IsBackground = true;
199 this._remoteAssetServerThread.Start();
200 ServerConsole.MainConsole.Instance.WriteLine("Remote Asset Server class created");
201 }
202
203 public void SetReceiver(IAssetReceiver receiver)
204 {
205 this._receiver = receiver;
206 }
207
208 public void RequestAsset(LLUUID assetID, bool isTexture)
209 {
210 ARequest req = new ARequest();
211 req.AssetID = assetID;
212 req.IsTexture = isTexture;
213 this._assetRequests.Enqueue(req);
214 }
215
216 public void UpdateAsset(AssetBase asset)
217 {
218
219 }
220
221 public void UploadNewAsset(AssetBase asset)
222 {
223
224 }
225
226 public void SetServerInfo(string ServerUrl, string ServerKey)
227 {
228 this.AssetServerUrl = ServerUrl;
229 this.AssetSendKey = ServerKey;
230 }
231
232 private void RunRequests()
233 {
234 while(true)
235 {
236 //we need to add support for the asset server not knowing about a requested asset
237 ARequest req = this._assetRequests.Dequeue();
238 LLUUID assetID = req.AssetID;
239 ServerConsole.MainConsole.Instance.WriteLine(" RemoteAssetServer- Got a AssetServer request, processing it");
240 WebRequest AssetLoad = WebRequest.Create(this.AssetServerUrl + "getasset/" + AssetSendKey + "/" + assetID + "/data");
241 WebResponse AssetResponse = AssetLoad.GetResponse();
242 byte[] idata = new byte[(int)AssetResponse.ContentLength];
243 BinaryReader br = new BinaryReader(AssetResponse.GetResponseStream());
244 idata = br.ReadBytes((int)AssetResponse.ContentLength);
245 br.Close();
246
247 AssetBase asset = new AssetBase();
248 asset.FullID = assetID;
249 asset.Data = idata;
250 _receiver.AssetReceived(asset, req.IsTexture );
251 }
252 }
253 }
254
255 public class BlockingQueue< T > {
256 private Queue< T > _queue = new Queue< T >();
257 private object _queueSync = new object();
258
259 public void Enqueue(T value)
260 {
261 lock(_queueSync)
262 {
263 _queue.Enqueue(value);
264 Monitor.Pulse(_queueSync);
265 }
266 }
267
268 public T Dequeue()
269 {
270 lock(_queueSync)
271 {
272 if( _queue.Count < 1)
273 Monitor.Wait(_queueSync);
274
275 return _queue.Dequeue();
276 }
277 }
278 }
279}
diff --git a/src/RemoteServers/RemoteGridServers/RemoteGridServers.csproj b/src/RemoteServers/RemoteGridServers/RemoteGridServers.csproj
deleted file mode 100644
index f1c5649..0000000
--- a/src/RemoteServers/RemoteGridServers/RemoteGridServers.csproj
+++ /dev/null
@@ -1,48 +0,0 @@
1<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
2 <PropertyGroup>
3 <OutputType>Library</OutputType>
4 <RootNamespace>RemoteGridServers</RootNamespace>
5 <AssemblyName>RemoteGridServers</AssemblyName>
6 <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
7 <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
8 <ProjectGuid>{CF0E7E62-34F4-4AB2-BDBD-AFC63224A7E5}</ProjectGuid>
9 </PropertyGroup>
10 <PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
11 <OutputPath>bin\Debug\</OutputPath>
12 <Optimize>False</Optimize>
13 <DefineConstants>DEBUG;TRACE</DefineConstants>
14 <DebugSymbols>True</DebugSymbols>
15 <DebugType>Full</DebugType>
16 <CheckForOverflowUnderflow>True</CheckForOverflowUnderflow>
17 </PropertyGroup>
18 <PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
19 <OutputPath>bin\Release\</OutputPath>
20 <Optimize>True</Optimize>
21 <DefineConstants>TRACE</DefineConstants>
22 <DebugSymbols>False</DebugSymbols>
23 <DebugType>None</DebugType>
24 <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
25 </PropertyGroup>
26 <ItemGroup>
27 <Reference Include="System" />
28 <Reference Include="System.Xml" />
29 <Reference Include="libsecondlife">
30 <HintPath>..\..\..\bin\libsecondlife.dll</HintPath>
31 <SpecificVersion>False</SpecificVersion>
32 </Reference>
33 </ItemGroup>
34 <ItemGroup>
35 <Compile Include="RemoteGrid.cs" />
36 </ItemGroup>
37 <ItemGroup>
38 <ProjectReference Include="..\..\ServerConsole\ServerConsole\ServerConsole.csproj">
39 <Project>{C9A6026D-8E0C-4FE4-8691-FB2A566AA245}</Project>
40 <Name>ServerConsole</Name>
41 </ProjectReference>
42 <ProjectReference Include="..\..\GridInterfaces\GridInterfaces.csproj">
43 <Project>{5DA3174D-42F9-416D-9F0B-AF41FA2BE2F9}</Project>
44 <Name>GridInterfaces</Name>
45 </ProjectReference>
46 </ItemGroup>
47 <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.Targets" />
48</Project> \ No newline at end of file
diff --git a/src/RemoteServers/default.build b/src/RemoteServers/default.build
deleted file mode 100644
index f8e6977..0000000
--- a/src/RemoteServers/default.build
+++ /dev/null
@@ -1,51 +0,0 @@
1<?xml version="1.0"?>
2 <project name="OpenSim" default="build" basedir=".">
3 <description>nant buildfile for OpenSim</description>
4 <property name="debug" value="true" overwrite="false" />
5 <target name="clean" description="remove all generated files">
6 <delete file="../../bin/RemoteGridServers.dll" failonerror="false" />
7 </target>
8
9 <target name="svnupdate" description="updates to latest SVN">
10 <exec program="svn">
11 <arg value="update" />
12 </exec>
13 </target>
14
15 <target name="upgrade" description="updates from SVN and then builds" depends="clean,svnupdate,build">
16
17 </target>
18
19 <target name="build" description="compiles the source code">
20
21 <loadfile file="../../VERSION" property="svnver"/>
22 <asminfo output="RemoteGridServers/AssemblyInfo.cs" language="CSharp">
23 <imports>
24 <import namespace="System" />
25 <import namespace="System.Reflection" />
26 <import namespace="System.Runtime.InteropServices" />
27 </imports>
28 <attributes>
29 <attribute type="ComVisibleAttribute" value="false" />
30 <attribute type="CLSCompliantAttribute" value="false" />
31 <attribute type="AssemblyVersionAttribute" value="${svnver}" />
32 <attribute type="AssemblyTitleAttribute" value="opensim-remoteservers" />
33 <attribute type="AssemblyDescriptionAttribute" value="Connects to remote OGS installation" />
34 <attribute type="AssemblyCopyrightAttribute" value="Copyright © OGS development team 2007"/>
35 </attributes>
36 </asminfo>
37
38 <csc target="library" output="../../bin/RemoteGridServers.dll" debug="${debug}" verbose="true" warninglevel="4">
39 <references basedir="../../bin" failonempty="true">
40 <include name="System.dll" />
41 <include name="System.Xml.dll" />
42 <include name="libsecondlife.dll" />
43 <include name="GridInterfaces.dll" />
44 <include name="ServerConsole.dll" />
45 </references>
46 <sources basedir="RemoteGridServers/">
47 <include name="*.cs" />
48 </sources>
49 </csc>
50 </target>
51</project>
diff --git a/src/Second-server.csproj b/src/Second-server.csproj
deleted file mode 100644
index 7c0d17c..0000000
--- a/src/Second-server.csproj
+++ /dev/null
@@ -1,110 +0,0 @@
1<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
2 <PropertyGroup>
3 <OutputType>Exe</OutputType>
4 <RootNamespace>OpenSim</RootNamespace>
5 <AssemblyName>OpenSim</AssemblyName>
6 <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
7 <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
8 <ProjectGuid>{132A6E3E-8F2D-4BF5-BDFB-8555F53F334E}</ProjectGuid>
9 <StartupObject>OpenSim.OpenSim_Main</StartupObject>
10 <AllowUnsafeBlocks>False</AllowUnsafeBlocks>
11 <NoStdLib>False</NoStdLib>
12 <WarningLevel>4</WarningLevel>
13 <TreatWarningsAsErrors>false</TreatWarningsAsErrors>
14 </PropertyGroup>
15 <PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
16 <OutputPath>bin\</OutputPath>
17 <Optimize>False</Optimize>
18 <DefineConstants>DEBUG;TRACE</DefineConstants>
19 <DebugSymbols>true</DebugSymbols>
20 <DebugType>Full</DebugType>
21 <CheckForOverflowUnderflow>True</CheckForOverflowUnderflow>
22 </PropertyGroup>
23 <PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
24 <OutputPath>..\bin\</OutputPath>
25 <Optimize>True</Optimize>
26 <DefineConstants>TRACE</DefineConstants>
27 <DebugSymbols>False</DebugSymbols>
28 <DebugType>None</DebugType>
29 <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
30 </PropertyGroup>
31 <PropertyGroup Condition=" '$(Platform)' == 'AnyCPU' ">
32 <RegisterForComInterop>False</RegisterForComInterop>
33 <GenerateSerializationAssemblies>Auto</GenerateSerializationAssemblies>
34 <BaseAddress>4194304</BaseAddress>
35 <PlatformTarget>AnyCPU</PlatformTarget>
36 <FileAlignment>4096</FileAlignment>
37 </PropertyGroup>
38 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
39 <OutputPath>..\bin\</OutputPath>
40 </PropertyGroup>
41 <ItemGroup>
42 <Reference Include="System" />
43 <Reference Include="System.Data" />
44 <Reference Include="System.Xml" />
45 <Reference Include="libsecondlife">
46 <HintPath>..\bin\libsecondlife.dll</HintPath>
47 <SpecificVersion>False</SpecificVersion>
48 </Reference>
49 <Reference Include="Axiom.MathLib">
50 <HintPath>..\bin\Axiom.MathLib.dll</HintPath>
51 <SpecificVersion>False</SpecificVersion>
52 </Reference>
53 <Reference Include="log4net">
54 <HintPath>..\bin\log4net.dll</HintPath>
55 <SpecificVersion>False</SpecificVersion>
56 </Reference>
57 </ItemGroup>
58 <ItemGroup>
59 <Compile Include="Config.cs" />
60 <Compile Include="Main.cs" />
61 <Compile Include="OpenSimClient.cs" />
62 <Compile Include="types\Mesh.cs" />
63 <Compile Include="types\Triangle.cs" />
64 <Compile Include="Util.cs" />
65 <Compile Include="world\Avatar.cs" />
66 <Compile Include="world\Entity.cs" />
67 <Compile Include="world\Primitive.cs" />
68 <Compile Include="world\ScriptEngine.cs" />
69 <Compile Include="world\scripting\IScript.cs" />
70 <Compile Include="world\SurfacePatch.cs" />
71 <Compile Include="world\World.cs" />
72 <Compile Include="GridServers\LoginServer.cs" />
73 <Compile Include="Assets\AssetCache.cs" />
74 <Compile Include="OpenSimConsole.cs" />
75 <Compile Include="HeightMapGenHills.cs" />
76 <Compile Include="VersionInfo.cs" />
77 <Compile Include="CAPS\SimHttp.cs" />
78 </ItemGroup>
79 <ItemGroup>
80 <ProjectReference Include="GridInterfaces\GridInterfaces.csproj">
81 <Project>{5DA3174D-42F9-416D-9F0B-AF41FA2BE2F9}</Project>
82 <Name>GridInterfaces</Name>
83 </ProjectReference>
84 <ProjectReference Include="LocalServers\LocalGridServers\LocalGridServers.csproj">
85 <Project>{D7F0395B-FADC-4936-80A0-D95AACE92F62}</Project>
86 <Name>LocalGridServers</Name>
87 </ProjectReference>
88 <ProjectReference Include="LocalStorage\Db4LocalStorage\Db4LocalStorage.csproj">
89 <Project>{74784F23-B0FD-484C-82C1-96C0215733DC}</Project>
90 <Name>Db4LocalStorage</Name>
91 </ProjectReference>
92 <ProjectReference Include="OpenSim.Framework\OpenSim.Framework.csproj">
93 <Project>{407CE85B-628C-4788-9DBC-49BCEFC3A84F}</Project>
94 <Name>OpenSim.Framework</Name>
95 </ProjectReference>
96 <ProjectReference Include="physics\PhysicsManager.csproj">
97 <Project>{3C86A846-7977-4EE7-A8DC-DD487FA5DC2B}</Project>
98 <Name>PhysicsManager</Name>
99 </ProjectReference>
100 <ProjectReference Include="RemoteServers\RemoteGridServers\RemoteGridServers.csproj">
101 <Project>{CF0E7E62-34F4-4AB2-BDBD-AFC63224A7E5}</Project>
102 <Name>RemoteGridServers</Name>
103 </ProjectReference>
104 <ProjectReference Include="ServerConsole\ServerConsole\ServerConsole.csproj">
105 <Project>{C9A6026D-8E0C-4FE4-8691-FB2A566AA245}</Project>
106 <Name>ServerConsole</Name>
107 </ProjectReference>
108 </ItemGroup>
109 <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.Targets" />
110</Project> \ No newline at end of file
diff --git a/src/ServerConsole/ServerConsole/AssemblyInfo.cs b/src/ServerConsole/ServerConsole/AssemblyInfo.cs
deleted file mode 100644
index e6b64d6..0000000
--- a/src/ServerConsole/ServerConsole/AssemblyInfo.cs
+++ /dev/null
@@ -1,21 +0,0 @@
1using System;
2using System.Reflection;
3using System.Runtime.InteropServices;
4
5// ------------------------------------------------------------------------------
6// <autogenerated>
7// This code was generated by a tool.
8// Mono Runtime Version: 2.0.50727.42
9//
10// Changes to this file may cause incorrect behavior and will be lost if
11// the code is regenerated.
12// </autogenerated>
13// ------------------------------------------------------------------------------
14
15[assembly: ComVisibleAttribute(false)]
16[assembly: CLSCompliantAttribute(false)]
17[assembly: AssemblyVersionAttribute("0.1.0.240")]
18[assembly: AssemblyTitleAttribute("opensim-serverconsole")]
19[assembly: AssemblyDescriptionAttribute("The default server console")]
20[assembly: AssemblyCopyrightAttribute("Copyright © OGS development team 2007")]
21
diff --git a/src/ServerConsole/ServerConsole/ServerConsole.cs b/src/ServerConsole/ServerConsole/ServerConsole.cs
deleted file mode 100644
index 27d97e5..0000000
--- a/src/ServerConsole/ServerConsole/ServerConsole.cs
+++ /dev/null
@@ -1,87 +0,0 @@
1/*
2* Copyright (c) OpenSim project, http://sim.opensecondlife.org/
3*
4* Redistribution and use in source and binary forms, with or without
5* modification, are permitted provided that the following conditions are met:
6* * Redistributions of source code must retain the above copyright
7* notice, this list of conditions and the following disclaimer.
8* * Redistributions in binary form must reproduce the above copyright
9* notice, this list of conditions and the following disclaimer in the
10* documentation and/or other materials provided with the distribution.
11* * Neither the name of the <organization> nor the
12* names of its contributors may be used to endorse or promote products
13* derived from this software without specific prior written permission.
14*
15* THIS SOFTWARE IS PROVIDED BY <copyright holder> ``AS IS'' AND ANY
16* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
18* DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY
19* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
20* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
21* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
22* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
24* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25*
26*/
27using System;
28
29namespace ServerConsole
30{
31 public class MainConsole {
32
33 private static ConsoleBase instance;
34
35 public static ConsoleBase Instance
36 {
37 get
38 {
39 return instance;
40 }
41 set
42 {
43 instance = value;
44 }
45 }
46 }
47
48 public abstract class ConsoleBase
49 {
50
51 public enum ConsoleType {
52 Local, // Use stdio
53 TCP, // Use TCP/telnet
54 SimChat // Use in-world chat (for gods)
55 }
56
57 public abstract void Close();
58
59 public abstract void Write(string format, params object[] args);
60
61 public abstract void WriteLine(string format, params object[] args);
62
63 public abstract string ReadLine();
64
65 public abstract int Read() ;
66
67 // Displays a command prompt and waits for the user to enter a string, then returns that string
68 public abstract string CmdPrompt(string prompt) ;
69
70 // Displays a command prompt and returns a default value if the user simply presses enter
71 public abstract string CmdPrompt(string prompt, string defaultresponse);
72
73 // Displays a command prompt and returns a default value, user may only enter 1 of 2 options
74 public abstract string CmdPrompt(string prompt, string defaultresponse, string OptionA, string OptionB) ;
75
76 // Runs a command with a number of parameters
77 public abstract Object RunCmd(string Cmd, string[] cmdparams) ;
78
79 // Shows data about something
80 public abstract void ShowCommands(string ShowWhat) ;
81
82 // Displays a prompt to the user and then runs the command they entered
83 public abstract void MainConsolePrompt() ;
84
85 public abstract void SetStatus( string status );
86 }
87}
diff --git a/src/ServerConsole/ServerConsole/ServerConsole.csproj b/src/ServerConsole/ServerConsole/ServerConsole.csproj
deleted file mode 100644
index d1094de..0000000
--- a/src/ServerConsole/ServerConsole/ServerConsole.csproj
+++ /dev/null
@@ -1,34 +0,0 @@
1<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
2 <PropertyGroup>
3 <OutputType>Library</OutputType>
4 <RootNamespace>ServerConsole</RootNamespace>
5 <AssemblyName>ServerConsole</AssemblyName>
6 <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
7 <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
8 <ProjectGuid>{C9A6026D-8E0C-4FE4-8691-FB2A566AA245}</ProjectGuid>
9 </PropertyGroup>
10 <PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
11 <OutputPath>bin\Debug\</OutputPath>
12 <Optimize>False</Optimize>
13 <DefineConstants>DEBUG;TRACE</DefineConstants>
14 <DebugSymbols>True</DebugSymbols>
15 <DebugType>Full</DebugType>
16 <CheckForOverflowUnderflow>True</CheckForOverflowUnderflow>
17 </PropertyGroup>
18 <PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
19 <OutputPath>bin\Release\</OutputPath>
20 <Optimize>True</Optimize>
21 <DefineConstants>TRACE</DefineConstants>
22 <DebugSymbols>False</DebugSymbols>
23 <DebugType>None</DebugType>
24 <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
25 </PropertyGroup>
26 <ItemGroup>
27 <Reference Include="System" />
28 <Reference Include="System.Xml" />
29 </ItemGroup>
30 <ItemGroup>
31 <Compile Include="ServerConsole.cs" />
32 </ItemGroup>
33 <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.Targets" />
34</Project> \ No newline at end of file
diff --git a/src/ServerConsole/default.build b/src/ServerConsole/default.build
deleted file mode 100644
index 0de930a..0000000
--- a/src/ServerConsole/default.build
+++ /dev/null
@@ -1,48 +0,0 @@
1<?xml version="1.0"?>
2 <project name="OpenSim" default="build" basedir=".">
3 <description>nant buildfile for OpenSim</description>
4 <property name="debug" value="true" overwrite="false" />
5 <target name="clean" description="remove all generated files">
6 <delete file="../../bin/ServerConsole.dll" failonerror="false" />
7 </target>
8
9 <target name="svnupdate" description="updates to latest SVN">
10 <exec program="svn">
11 <arg value="update" />
12 </exec>
13 </target>
14
15 <target name="upgrade" description="updates from SVN and then builds" depends="clean,svnupdate,build">
16
17 </target>
18
19 <target name="build" description="compiles the source code">
20
21 <loadfile file="../../VERSION" property="svnver"/>
22 <asminfo output="ServerConsole/AssemblyInfo.cs" language="CSharp">
23 <imports>
24 <import namespace="System" />
25 <import namespace="System.Reflection" />
26 <import namespace="System.Runtime.InteropServices" />
27 </imports>
28 <attributes>
29 <attribute type="ComVisibleAttribute" value="false" />
30 <attribute type="CLSCompliantAttribute" value="false" />
31 <attribute type="AssemblyVersionAttribute" value="${svnver}" />
32 <attribute type="AssemblyTitleAttribute" value="opensim-serverconsole" />
33 <attribute type="AssemblyDescriptionAttribute" value="The default server console" />
34 <attribute type="AssemblyCopyrightAttribute" value="Copyright © OGS development team 2007"/>
35 </attributes>
36 </asminfo>
37
38 <csc target="library" output="../../bin/ServerConsole.dll" debug="${debug}" verbose="true" warninglevel="4">
39 <references>
40 <include name="System.dll" />
41 <include name="System.Xml.dll" />
42 </references>
43 <sources basedir="ServerConsole/">
44 <include name="*.cs" />
45 </sources>
46 </csc>
47 </target>
48</project>
diff --git a/src/Util.cs b/src/Util.cs
deleted file mode 100644
index 477390e..0000000
--- a/src/Util.cs
+++ /dev/null
@@ -1,99 +0,0 @@
1/*
2Copyright (c) OpenSim project, http://osgrid.org/
3
4* Copyright (c) <year>, <copyright holder>
5* All rights reserved.
6*
7* Redistribution and use in source and binary forms, with or without
8* modification, are permitted provided that the following conditions are met:
9* * Redistributions of source code must retain the above copyright
10* notice, this list of conditions and the following disclaimer.
11* * Redistributions in binary form must reproduce the above copyright
12* notice, this list of conditions and the following disclaimer in the
13* documentation and/or other materials provided with the distribution.
14* * Neither the name of the <organization> nor the
15* names of its contributors may be used to endorse or promote products
16* derived from this software without specific prior written permission.
17*
18* THIS SOFTWARE IS PROVIDED BY <copyright holder> ``AS IS'' AND ANY
19* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
20* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21* DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY
22* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
24* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
25* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
27* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28*/
29
30using System;
31using System.Collections.Generic;
32using System.Threading;
33using libsecondlife;
34using libsecondlife.Packets;
35
36namespace OpenSim
37{
38 /// <summary>
39 /// </summary>
40 ///
41 public class Util
42 {
43 public static ulong UIntsToLong(uint X, uint Y)
44 {
45 return Helpers.UIntsToLong(X,Y);
46 }
47 public Util()
48 {
49
50 }
51 }
52
53 public class QueItem {
54 public QueItem()
55 {
56 }
57
58 public Packet Packet;
59 public bool Incoming;
60 }
61
62 /* this is in IGridServer.cs, so there should be no reason for it to be here as well
63 public class agentcircuitdata
64 {
65 public agentcircuitdata() { }
66 public LLUUID AgentID;
67 public LLUUID SessionID;
68 public LLUUID SecureSessionID;
69 public string firstname;
70 public string lastname;
71 public uint circuitcode;
72 }
73 */
74
75 public class BlockingQueue< T > {
76 private Queue< T > _queue = new Queue< T >();
77 private object _queueSync = new object();
78
79 public void Enqueue(T value)
80 {
81 lock(_queueSync)
82 {
83 _queue.Enqueue(value);
84 Monitor.Pulse(_queueSync);
85 }
86 }
87
88 public T Dequeue()
89 {
90 lock(_queueSync)
91 {
92 if( _queue.Count < 1)
93 Monitor.Wait(_queueSync);
94
95 return _queue.Dequeue();
96 }
97 }
98 }
99}
diff --git a/src/opensim.sln b/src/opensim.sln
deleted file mode 100644
index c4be551..0000000
--- a/src/opensim.sln
+++ /dev/null
@@ -1,80 +0,0 @@
1
2Microsoft Visual Studio Solution File, Format Version 9.00
3# Visual Studio 2005
4Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Second-server", "Second-server.csproj", "{132A6E3E-8F2D-4BF5-BDFB-8555F53F334E}"
5EndProject
6Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GridInterfaces", "GridInterfaces\GridInterfaces.csproj", "{5DA3174D-42F9-416D-9F0B-AF41FA2BE2F9}"
7EndProject
8Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PhysicsManager", "physics\PhysicsManager.csproj", "{3C86A846-7977-4EE7-A8DC-DD487FA5DC2B}"
9EndProject
10Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ServerConsole", "ServerConsole\ServerConsole\ServerConsole.csproj", "{C9A6026D-8E0C-4FE4-8691-FB2A566AA245}"
11EndProject
12Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LocalGridServers", "LocalServers\LocalGridServers\LocalGridServers.csproj", "{D7F0395B-FADC-4936-80A0-D95AACE92F62}"
13EndProject
14Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RemoteGridServers", "RemoteServers\RemoteGridServers\RemoteGridServers.csproj", "{CF0E7E62-34F4-4AB2-BDBD-AFC63224A7E5}"
15EndProject
16Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SimConfig", "Config\SimConfig\SimConfig.csproj", "{B063760D-DB8D-4F64-B6FE-335FAD1E650A}"
17EndProject
18Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Db4LocalStorage", "LocalStorage\Db4LocalStorage\Db4LocalStorage.csproj", "{74784F23-B0FD-484C-82C1-96C0215733DC}"
19EndProject
20Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BasicPhysicsplugin", "physics\plugins\BasicPhysicsplugin.csproj", "{52BCCE7B-69EA-4AC3-9DBC-D571B96C2EA1}"
21EndProject
22Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RealPhysXplugin", "physics\RealPhysX\RealPhysXplugin\RealPhysXplugin.csproj", "{56C1D214-F389-4228-921A-0A3A0712C159}"
23EndProject
24Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenSim.Framework", "OpenSim.Framework\OpenSim.Framework.csproj", "{407CE85B-628C-4788-9DBC-49BCEFC3A84F}"
25EndProject
26Global
27 GlobalSection(SolutionConfigurationPlatforms) = preSolution
28 Debug|Any CPU = Debug|Any CPU
29 Release|Any CPU = Release|Any CPU
30 EndGlobalSection
31 GlobalSection(ProjectConfigurationPlatforms) = postSolution
32 {132A6E3E-8F2D-4BF5-BDFB-8555F53F334E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
33 {132A6E3E-8F2D-4BF5-BDFB-8555F53F334E}.Debug|Any CPU.Build.0 = Debug|Any CPU
34 {132A6E3E-8F2D-4BF5-BDFB-8555F53F334E}.Release|Any CPU.ActiveCfg = Release|Any CPU
35 {132A6E3E-8F2D-4BF5-BDFB-8555F53F334E}.Release|Any CPU.Build.0 = Release|Any CPU
36 {5DA3174D-42F9-416D-9F0B-AF41FA2BE2F9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
37 {5DA3174D-42F9-416D-9F0B-AF41FA2BE2F9}.Debug|Any CPU.Build.0 = Debug|Any CPU
38 {5DA3174D-42F9-416D-9F0B-AF41FA2BE2F9}.Release|Any CPU.ActiveCfg = Release|Any CPU
39 {5DA3174D-42F9-416D-9F0B-AF41FA2BE2F9}.Release|Any CPU.Build.0 = Release|Any CPU
40 {3C86A846-7977-4EE7-A8DC-DD487FA5DC2B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
41 {3C86A846-7977-4EE7-A8DC-DD487FA5DC2B}.Debug|Any CPU.Build.0 = Debug|Any CPU
42 {3C86A846-7977-4EE7-A8DC-DD487FA5DC2B}.Release|Any CPU.ActiveCfg = Release|Any CPU
43 {3C86A846-7977-4EE7-A8DC-DD487FA5DC2B}.Release|Any CPU.Build.0 = Release|Any CPU
44 {C9A6026D-8E0C-4FE4-8691-FB2A566AA245}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
45 {C9A6026D-8E0C-4FE4-8691-FB2A566AA245}.Debug|Any CPU.Build.0 = Debug|Any CPU
46 {C9A6026D-8E0C-4FE4-8691-FB2A566AA245}.Release|Any CPU.ActiveCfg = Release|Any CPU
47 {C9A6026D-8E0C-4FE4-8691-FB2A566AA245}.Release|Any CPU.Build.0 = Release|Any CPU
48 {D7F0395B-FADC-4936-80A0-D95AACE92F62}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
49 {D7F0395B-FADC-4936-80A0-D95AACE92F62}.Debug|Any CPU.Build.0 = Debug|Any CPU
50 {D7F0395B-FADC-4936-80A0-D95AACE92F62}.Release|Any CPU.ActiveCfg = Release|Any CPU
51 {D7F0395B-FADC-4936-80A0-D95AACE92F62}.Release|Any CPU.Build.0 = Release|Any CPU
52 {CF0E7E62-34F4-4AB2-BDBD-AFC63224A7E5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
53 {CF0E7E62-34F4-4AB2-BDBD-AFC63224A7E5}.Debug|Any CPU.Build.0 = Debug|Any CPU
54 {CF0E7E62-34F4-4AB2-BDBD-AFC63224A7E5}.Release|Any CPU.ActiveCfg = Release|Any CPU
55 {CF0E7E62-34F4-4AB2-BDBD-AFC63224A7E5}.Release|Any CPU.Build.0 = Release|Any CPU
56 {B063760D-DB8D-4F64-B6FE-335FAD1E650A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
57 {B063760D-DB8D-4F64-B6FE-335FAD1E650A}.Debug|Any CPU.Build.0 = Debug|Any CPU
58 {B063760D-DB8D-4F64-B6FE-335FAD1E650A}.Release|Any CPU.ActiveCfg = Release|Any CPU
59 {B063760D-DB8D-4F64-B6FE-335FAD1E650A}.Release|Any CPU.Build.0 = Release|Any CPU
60 {74784F23-B0FD-484C-82C1-96C0215733DC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
61 {74784F23-B0FD-484C-82C1-96C0215733DC}.Debug|Any CPU.Build.0 = Debug|Any CPU
62 {74784F23-B0FD-484C-82C1-96C0215733DC}.Release|Any CPU.ActiveCfg = Release|Any CPU
63 {74784F23-B0FD-484C-82C1-96C0215733DC}.Release|Any CPU.Build.0 = Release|Any CPU
64 {52BCCE7B-69EA-4AC3-9DBC-D571B96C2EA1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
65 {52BCCE7B-69EA-4AC3-9DBC-D571B96C2EA1}.Debug|Any CPU.Build.0 = Debug|Any CPU
66 {52BCCE7B-69EA-4AC3-9DBC-D571B96C2EA1}.Release|Any CPU.ActiveCfg = Release|Any CPU
67 {52BCCE7B-69EA-4AC3-9DBC-D571B96C2EA1}.Release|Any CPU.Build.0 = Release|Any CPU
68 {56C1D214-F389-4228-921A-0A3A0712C159}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
69 {56C1D214-F389-4228-921A-0A3A0712C159}.Debug|Any CPU.Build.0 = Debug|Any CPU
70 {56C1D214-F389-4228-921A-0A3A0712C159}.Release|Any CPU.ActiveCfg = Release|Any CPU
71 {56C1D214-F389-4228-921A-0A3A0712C159}.Release|Any CPU.Build.0 = Release|Any CPU
72 {407CE85B-628C-4788-9DBC-49BCEFC3A84F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
73 {407CE85B-628C-4788-9DBC-49BCEFC3A84F}.Debug|Any CPU.Build.0 = Debug|Any CPU
74 {407CE85B-628C-4788-9DBC-49BCEFC3A84F}.Release|Any CPU.ActiveCfg = Release|Any CPU
75 {407CE85B-628C-4788-9DBC-49BCEFC3A84F}.Release|Any CPU.Build.0 = Release|Any CPU
76 EndGlobalSection
77 GlobalSection(SolutionProperties) = preSolution
78 HideSolutionNode = FALSE
79 EndGlobalSection
80EndGlobal
diff --git a/src/physics/AssemblyInfo.cs b/src/physics/AssemblyInfo.cs
deleted file mode 100644
index c6a4efa..0000000
--- a/src/physics/AssemblyInfo.cs
+++ /dev/null
@@ -1,21 +0,0 @@
1using System;
2using System.Reflection;
3using System.Runtime.InteropServices;
4
5// ------------------------------------------------------------------------------
6// <autogenerated>
7// This code was generated by a tool.
8// Mono Runtime Version: 2.0.50727.42
9//
10// Changes to this file may cause incorrect behavior and will be lost if
11// the code is regenerated.
12// </autogenerated>
13// ------------------------------------------------------------------------------
14
15[assembly: ComVisibleAttribute(false)]
16[assembly: CLSCompliantAttribute(false)]
17[assembly: AssemblyVersionAttribute("0.1.0.240")]
18[assembly: AssemblyTitleAttribute("opensim-physicsmanager")]
19[assembly: AssemblyDescriptionAttribute("Handles physics plugins")]
20[assembly: AssemblyCopyrightAttribute("Copyright © OGS development team 2007")]
21
diff --git a/src/physics/PhysicsManager.cs b/src/physics/PhysicsManager.cs
deleted file mode 100644
index 1fee628..0000000
--- a/src/physics/PhysicsManager.cs
+++ /dev/null
@@ -1,285 +0,0 @@
1/*
2* Copyright (c) OpenSim project, http://sim.opensecondlife.org/
3*
4* Redistribution and use in source and binary forms, with or without
5* modification, are permitted provided that the following conditions are met:
6* * Redistributions of source code must retain the above copyright
7* notice, this list of conditions and the following disclaimer.
8* * Redistributions in binary form must reproduce the above copyright
9* notice, this list of conditions and the following disclaimer in the
10* documentation and/or other materials provided with the distribution.
11* * Neither the name of the <organization> nor the
12* names of its contributors may be used to endorse or promote products
13* derived from this software without specific prior written permission.
14*
15* THIS SOFTWARE IS PROVIDED BY <copyright holder> ``AS IS'' AND ANY
16* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
18* DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY
19* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
20* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
21* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
22* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
24* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25*
26*/
27using System;
28using System.Collections.Generic;
29using System.Collections;
30using System.IO;
31using System.Reflection;
32
33namespace PhysicsSystem
34{
35 /// <summary>
36 /// Description of MyClass.
37 /// </summary>
38 public class PhysicsManager
39 {
40 private Dictionary<string, IPhysicsPlugin> _plugins=new Dictionary<string, IPhysicsPlugin>();
41
42 public PhysicsManager()
43 {
44
45 }
46
47 public PhysicsScene GetPhysicsScene(string engineName)
48 {
49 if( String.IsNullOrEmpty( engineName ) )
50 {
51 return new NullPhysicsScene();
52 }
53
54 if(_plugins.ContainsKey(engineName))
55 {
56 ServerConsole.MainConsole.Instance.WriteLine("creating "+engineName);
57 return _plugins[engineName].GetScene();
58 }
59 else
60 {
61 string error = String.Format("couldn't find physicsEngine: {0}", engineName);
62 ServerConsole.MainConsole.Instance.WriteLine( error );
63 throw new ArgumentException( error );
64 }
65 }
66
67 public void LoadPlugins()
68 {
69 string path = Path.Combine(System.AppDomain.CurrentDomain.BaseDirectory ,"Physics");
70 string[] pluginFiles = Directory.GetFiles(path, "*.dll");
71
72
73 for(int i= 0; i<pluginFiles.Length; i++)
74 {
75 this.AddPlugin(pluginFiles[i]);
76 }
77 }
78
79 private void AddPlugin(string FileName)
80 {
81 Assembly pluginAssembly = Assembly.LoadFrom(FileName);
82
83 foreach (Type pluginType in pluginAssembly.GetTypes())
84 {
85 if (pluginType.IsPublic)
86 {
87 if (!pluginType.IsAbstract)
88 {
89 Type typeInterface = pluginType.GetInterface("IPhysicsPlugin", true);
90
91 if (typeInterface != null)
92 {
93 IPhysicsPlugin plug = (IPhysicsPlugin)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString()));
94 plug.Init();
95 this._plugins.Add(plug.GetName(),plug);
96
97 }
98
99 typeInterface = null;
100 }
101 }
102 }
103
104 pluginAssembly = null;
105 }
106 }
107 public interface IPhysicsPlugin
108 {
109 bool Init();
110 PhysicsScene GetScene();
111 string GetName();
112 void Dispose();
113 }
114
115 public abstract class PhysicsScene
116 {
117 public static PhysicsScene Null
118 {
119 get
120 {
121 return new NullPhysicsScene();
122 }
123 }
124
125 public abstract PhysicsActor AddAvatar(PhysicsVector position);
126
127 public abstract PhysicsActor AddPrim(PhysicsVector position, PhysicsVector size);
128
129 public abstract void Simulate(float timeStep);
130
131 public abstract void GetResults();
132
133 public abstract void SetTerrain(float[] heightMap);
134
135 public abstract bool IsThreaded
136 {
137 get;
138 }
139 }
140
141 public class NullPhysicsScene : PhysicsScene
142 {
143 private static int m_workIndicator;
144
145 public override PhysicsActor AddAvatar(PhysicsVector position)
146 {
147 ServerConsole.MainConsole.Instance.WriteLine("NullPhysicsScene : AddAvatar({0})", position );
148 return PhysicsActor.Null;
149 }
150
151 public override PhysicsActor AddPrim(PhysicsVector position, PhysicsVector size)
152 {
153 ServerConsole.MainConsole.Instance.WriteLine("NullPhysicsScene : AddPrim({0},{1})", position, size );
154 return PhysicsActor.Null;
155 }
156
157 public override void Simulate(float timeStep)
158 {
159 m_workIndicator = ( m_workIndicator + 1 ) % 10;
160
161 ServerConsole.MainConsole.Instance.SetStatus( m_workIndicator.ToString() );
162 }
163
164 public override void GetResults()
165 {
166 ServerConsole.MainConsole.Instance.WriteLine("NullPhysicsScene : GetResults()" );
167 }
168
169 public override void SetTerrain(float[] heightMap)
170 {
171 ServerConsole.MainConsole.Instance.WriteLine("NullPhysicsScene : SetTerrain({0} items)", heightMap.Length );
172 }
173
174 public override bool IsThreaded
175 {
176 get { return false; }
177 }
178 }
179
180 public abstract class PhysicsActor
181 {
182 public static readonly PhysicsActor Null = new NullPhysicsActor();
183
184 public abstract PhysicsVector Position
185 {
186 get;
187 set;
188 }
189
190 public abstract PhysicsVector Velocity
191 {
192 get;
193 set;
194 }
195
196 public abstract PhysicsVector Acceleration
197 {
198 get;
199 }
200 public abstract bool Flying
201 {
202 get;
203 set;
204 }
205
206 public abstract void AddForce(PhysicsVector force);
207
208 public abstract void SetMomentum(PhysicsVector momentum);
209 }
210
211 public class NullPhysicsActor : PhysicsActor
212 {
213 public override PhysicsVector Position
214 {
215 get
216 {
217 return PhysicsVector.Zero;
218 }
219 set
220 {
221 return;
222 }
223 }
224
225 public override PhysicsVector Velocity
226 {
227 get
228 {
229 return PhysicsVector.Zero;
230 }
231 set
232 {
233 return;
234 }
235 }
236
237 public override PhysicsVector Acceleration
238 {
239 get { return PhysicsVector.Zero; }
240 }
241
242 public override bool Flying
243 {
244 get
245 {
246 return false;
247 }
248 set
249 {
250 return;
251 }
252 }
253
254 public override void AddForce(PhysicsVector force)
255 {
256 return;
257 }
258
259 public override void SetMomentum(PhysicsVector momentum)
260 {
261 return;
262 }
263 }
264
265 public class PhysicsVector
266 {
267 public float X;
268 public float Y;
269 public float Z;
270
271 public PhysicsVector()
272 {
273
274 }
275
276 public PhysicsVector(float x, float y, float z)
277 {
278 X = x;
279 Y = y;
280 Z = z;
281 }
282
283 public static readonly PhysicsVector Zero = new PhysicsVector(0f, 0f, 0f);
284 }
285}
diff --git a/src/physics/PhysicsManager.csproj b/src/physics/PhysicsManager.csproj
deleted file mode 100644
index 3eadfe7..0000000
--- a/src/physics/PhysicsManager.csproj
+++ /dev/null
@@ -1,40 +0,0 @@
1<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
2 <PropertyGroup>
3 <OutputType>Library</OutputType>
4 <RootNamespace>PhysicsManager</RootNamespace>
5 <AssemblyName>PhysicsManager</AssemblyName>
6 <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
7 <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
8 <ProjectGuid>{3C86A846-7977-4EE7-A8DC-DD487FA5DC2B}</ProjectGuid>
9 </PropertyGroup>
10 <PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
11 <OutputPath>bin\Debug\</OutputPath>
12 <Optimize>False</Optimize>
13 <DefineConstants>DEBUG;TRACE</DefineConstants>
14 <DebugSymbols>True</DebugSymbols>
15 <DebugType>Full</DebugType>
16 <CheckForOverflowUnderflow>True</CheckForOverflowUnderflow>
17 </PropertyGroup>
18 <PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
19 <OutputPath>bin\Release\</OutputPath>
20 <Optimize>True</Optimize>
21 <DefineConstants>TRACE</DefineConstants>
22 <DebugSymbols>False</DebugSymbols>
23 <DebugType>None</DebugType>
24 <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
25 </PropertyGroup>
26 <ItemGroup>
27 <Reference Include="System" />
28 <Reference Include="System.Xml" />
29 </ItemGroup>
30 <ItemGroup>
31 <Compile Include="PhysicsManager.cs" />
32 </ItemGroup>
33 <ItemGroup>
34 <ProjectReference Include="..\ServerConsole\ServerConsole\ServerConsole.csproj">
35 <Project>{C9A6026D-8E0C-4FE4-8691-FB2A566AA245}</Project>
36 <Name>ServerConsole</Name>
37 </ProjectReference>
38 </ItemGroup>
39 <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.Targets" />
40</Project> \ No newline at end of file
diff --git a/src/physics/RealPhysX/RealPhysXplugin/RealPhysXplugin.csproj b/src/physics/RealPhysX/RealPhysXplugin/RealPhysXplugin.csproj
deleted file mode 100644
index 554df5e..0000000
--- a/src/physics/RealPhysX/RealPhysXplugin/RealPhysXplugin.csproj
+++ /dev/null
@@ -1,46 +0,0 @@
1<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
2 <PropertyGroup>
3 <OutputType>Library</OutputType>
4 <RootNamespace>RealPhysXplugin</RootNamespace>
5 <AssemblyName>RealPhysXplugin</AssemblyName>
6 <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
7 <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
8 <ProjectGuid>{56C1D214-F389-4228-921A-0A3A0712C159}</ProjectGuid>
9 </PropertyGroup>
10 <PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
11 <OutputPath>..\..\..\..\bin\Physics\</OutputPath>
12 <Optimize>False</Optimize>
13 <DefineConstants>DEBUG;TRACE</DefineConstants>
14 <DebugSymbols>True</DebugSymbols>
15 <DebugType>Full</DebugType>
16 <CheckForOverflowUnderflow>True</CheckForOverflowUnderflow>
17 </PropertyGroup>
18 <PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
19 <OutputPath>..\..\..\..\bin\Physics\</OutputPath>
20 <Optimize>True</Optimize>
21 <DefineConstants>TRACE</DefineConstants>
22 <DebugSymbols>False</DebugSymbols>
23 <DebugType>None</DebugType>
24 <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
25 </PropertyGroup>
26 <ItemGroup>
27 <Reference Include="System" />
28 <Reference Include="System.Xml" />
29 <Reference Include="PhysX_Wrapper_Dotnet">
30 <HintPath>..\..\..\..\bin\PhysX_Wrapper_Dotnet.dll</HintPath>
31 <SpecificVersion>False</SpecificVersion>
32 <Private>False</Private>
33 </Reference>
34 </ItemGroup>
35 <ItemGroup>
36 <Compile Include="RealPhysX.cs" />
37 </ItemGroup>
38 <ItemGroup>
39 <ProjectReference Include="..\..\PhysicsManager.csproj">
40 <Project>{3C86A846-7977-4EE7-A8DC-DD487FA5DC2B}</Project>
41 <Name>PhysicsManager</Name>
42 <Private>False</Private>
43 </ProjectReference>
44 </ItemGroup>
45 <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.Targets" />
46</Project> \ No newline at end of file
diff --git a/src/physics/default.build b/src/physics/default.build
deleted file mode 100644
index 01d2415..0000000
--- a/src/physics/default.build
+++ /dev/null
@@ -1,49 +0,0 @@
1<?xml version="1.0"?>
2 <project name="OpenSim" default="build" basedir=".">
3 <description>nant buildfile for OpenSim</description>
4 <property name="debug" value="true" overwrite="false" />
5 <target name="clean" description="remove all generated files">
6 <delete file="../../bin/PhysicsManager.dll" failonerror="false" />
7 </target>
8
9 <target name="svnupdate" description="updates to latest SVN">
10 <exec program="svn">
11 <arg value="update" />
12 </exec>
13 </target>
14
15 <target name="upgrade" description="updates from SVN and then builds" depends="clean,svnupdate,build">
16
17 </target>
18
19 <target name="build" description="compiles the source code">
20
21 <loadfile file="../../VERSION" property="svnver"/>
22 <asminfo output="AssemblyInfo.cs" language="CSharp">
23 <imports>
24 <import namespace="System" />
25 <import namespace="System.Reflection" />
26 <import namespace="System.Runtime.InteropServices" />
27 </imports>
28 <attributes>
29 <attribute type="ComVisibleAttribute" value="false" />
30 <attribute type="CLSCompliantAttribute" value="false" />
31 <attribute type="AssemblyVersionAttribute" value="${svnver}" />
32 <attribute type="AssemblyTitleAttribute" value="opensim-physicsmanager" />
33 <attribute type="AssemblyDescriptionAttribute" value="Handles physics plugins" />
34 <attribute type="AssemblyCopyrightAttribute" value="Copyright © OGS development team 2007"/>
35 </attributes>
36 </asminfo>
37
38 <csc target="library" output="../../bin/PhysicsManager.dll" debug="${debug}" verbose="true" warninglevel="4">
39 <references basedir="../../bin" failonempty="true">
40 <include name="System.dll" />
41 <include name="System.Xml.dll" />
42 <include name="ServerConsole.dll" />
43 </references>
44 <sources basedir="./">
45 <include name="*.cs" />
46 </sources>
47 </csc>
48 </target>
49</project>
diff --git a/src/physics/plugins/AssemblyInfo.cs b/src/physics/plugins/AssemblyInfo.cs
deleted file mode 100644
index 4cd5558..0000000
--- a/src/physics/plugins/AssemblyInfo.cs
+++ /dev/null
@@ -1,21 +0,0 @@
1using System;
2using System.Reflection;
3using System.Runtime.InteropServices;
4
5// ------------------------------------------------------------------------------
6// <autogenerated>
7// This code was generated by a tool.
8// Mono Runtime Version: 2.0.50727.42
9//
10// Changes to this file may cause incorrect behavior and will be lost if
11// the code is regenerated.
12// </autogenerated>
13// ------------------------------------------------------------------------------
14
15[assembly: ComVisibleAttribute(false)]
16[assembly: CLSCompliantAttribute(false)]
17[assembly: AssemblyVersionAttribute("0.1.0.240")]
18[assembly: AssemblyTitleAttribute("opensim-physicsmanager-physx")]
19[assembly: AssemblyDescriptionAttribute("PhysX plugin for OpenSim")]
20[assembly: AssemblyCopyrightAttribute("Copyright © OGS development team 2007")]
21
diff --git a/src/physics/plugins/BasicPhysicsplugin.csproj b/src/physics/plugins/BasicPhysicsplugin.csproj
deleted file mode 100644
index b3f47d3..0000000
--- a/src/physics/plugins/BasicPhysicsplugin.csproj
+++ /dev/null
@@ -1,51 +0,0 @@
1<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
2 <PropertyGroup>
3 <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
4 <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
5 <ProductVersion>8.0.50727</ProductVersion>
6 <SchemaVersion>2.0</SchemaVersion>
7 <ProjectGuid>{52BCCE7B-69EA-4AC3-9DBC-D571B96C2EA1}</ProjectGuid>
8 <OutputType>Library</OutputType>
9 <AppDesignerFolder>Properties</AppDesignerFolder>
10 <RootNamespace>BasicPhysicsplugin</RootNamespace>
11 <AssemblyName>BasicPhysicsplugin</AssemblyName>
12 </PropertyGroup>
13 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
14 <DebugSymbols>true</DebugSymbols>
15 <DebugType>full</DebugType>
16 <Optimize>false</Optimize>
17 <OutputPath>..\..\..\bin\Physics\</OutputPath>
18 <DefineConstants>DEBUG;TRACE</DefineConstants>
19 <ErrorReport>prompt</ErrorReport>
20 <WarningLevel>4</WarningLevel>
21 </PropertyGroup>
22 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
23 <DebugType>pdbonly</DebugType>
24 <Optimize>true</Optimize>
25 <OutputPath>..\..\..\bin\Physics\</OutputPath>
26 <DefineConstants>TRACE</DefineConstants>
27 <ErrorReport>prompt</ErrorReport>
28 <WarningLevel>4</WarningLevel>
29 </PropertyGroup>
30 <ItemGroup>
31 <Reference Include="Axiom.MathLib, Version=0.7.0.25497, Culture=neutral">
32 <SpecificVersion>False</SpecificVersion>
33 <HintPath>..\..\..\bin\Axiom.MathLib.dll</HintPath>
34 <Private>False</Private>
35 </Reference>
36 <Reference Include="System" />
37 <Reference Include="System.Data" />
38 <Reference Include="System.Xml" />
39 </ItemGroup>
40 <ItemGroup>
41 <Compile Include="PhysXplugin.cs" />
42 </ItemGroup>
43 <ItemGroup>
44 <ProjectReference Include="..\PhysicsManager.csproj">
45 <Project>{3C86A846-7977-4EE7-A8DC-DD487FA5DC2B}</Project>
46 <Name>PhysicsManager</Name>
47 <Private>False</Private>
48 </ProjectReference>
49 </ItemGroup>
50 <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
51</Project> \ No newline at end of file
diff --git a/src/physics/plugins/default.build b/src/physics/plugins/default.build
deleted file mode 100644
index 66056a5..0000000
--- a/src/physics/plugins/default.build
+++ /dev/null
@@ -1,51 +0,0 @@
1<?xml version="1.0"?>
2 <project name="OpenSim" default="build" basedir=".">
3 <description>nant buildfile for OpenSim</description>
4 <property name="debug" value="true" overwrite="false" />
5 <target name="clean" description="remove all generated files">
6 <delete file="../../../bin/Physics/PhysXplugin.dll" failonerror="false" />
7 </target>
8
9 <target name="svnupdate" description="updates to latest SVN">
10 <exec program="svn">
11 <arg value="update" />
12 </exec>
13 </target>
14
15 <target name="upgrade" description="updates from SVN and then builds" depends="clean,svnupdate,build">
16
17 </target>
18
19 <target name="build" description="compiles the source code">
20
21 <loadfile file="../../../VERSION" property="svnver"/>
22 <asminfo output="AssemblyInfo.cs" language="CSharp">
23 <imports>
24 <import namespace="System" />
25 <import namespace="System.Reflection" />
26 <import namespace="System.Runtime.InteropServices" />
27 </imports>
28 <attributes>
29 <attribute type="ComVisibleAttribute" value="false" />
30 <attribute type="CLSCompliantAttribute" value="false" />
31 <attribute type="AssemblyVersionAttribute" value="${svnver}" />
32 <attribute type="AssemblyTitleAttribute" value="opensim-physicsmanager-physx" />
33 <attribute type="AssemblyDescriptionAttribute" value="PhysX plugin for OpenSim" />
34 <attribute type="AssemblyCopyrightAttribute" value="Copyright © OGS development team 2007"/>
35 </attributes>
36 </asminfo>
37
38 <mkdir dir="../../../bin/Physics"/>
39
40 <csc target="library" output="../../../bin/Physics/PhysXplugin.dll" debug="${debug}" verbose="true" warninglevel="4">
41 <references basedir="../../../bin" failonempty="true">
42 <include name="System.dll" />
43 <include name="System.Xml.dll" />
44 <include name="PhysicsManager.dll" />
45 </references>
46 <sources basedir="./">
47 <include name="*.cs" />
48 </sources>
49 </csc>
50 </target>
51</project>
diff --git a/src/world/Avatar.cs b/src/world/Avatar.cs
deleted file mode 100644
index facfeee..0000000
--- a/src/world/Avatar.cs
+++ /dev/null
@@ -1,487 +0,0 @@
1using System;
2using System.Collections.Generic;
3using System.IO;
4using System.Text;
5using libsecondlife;
6using libsecondlife.Packets;
7using PhysicsSystem;
8using Axiom.MathLib;
9
10namespace OpenSim.world
11{
12 public class Avatar : Entity
13 {
14 public static bool PhysicsEngineFlying;
15 public string firstname;
16 public string lastname;
17 public OpenSimClient ControllingClient;
18 private PhysicsActor _physActor;
19 private static libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock AvatarTemplate;
20 private bool updateflag;
21 private byte movementflag;
22 private List<NewForce> forcesList = new List<NewForce>();
23 private short _updateCount;
24 private Axiom.MathLib.Quaternion bodyRot;
25
26 public Avatar(OpenSimClient TheClient) {
27 ServerConsole.MainConsole.Instance.WriteLine("Avatar.cs - Loading details from grid (DUMMY)");
28 ControllingClient=TheClient;
29 position = new LLVector3(100.0f,100.0f,30.0f);
30 position.Z = OpenSim_Main.local_world.LandMap[(int)position.Y * 256 + (int)position.X]+1;
31 }
32
33 public PhysicsActor PhysActor
34 {
35 set
36 {
37 this._physActor = value;
38 }
39 }
40 public override void addForces()
41 {
42 lock(this.forcesList)
43 {
44 if(this.forcesList.Count>0)
45 {
46 for(int i=0 ; i < this.forcesList.Count; i++)
47 {
48 NewForce force = this.forcesList[i];
49 PhysicsVector phyVector = new PhysicsVector(force.X, force.Y, force.Z);
50 this._physActor.Velocity = phyVector;
51 this.updateflag = true;
52 this.velocity = new LLVector3(force.X, force.Y, force.Z); //shouldn't really be doing this
53 // but as we are setting the velocity (rather than using real forces) at the moment it is okay.
54 }
55 for(int i=0 ; i < this.forcesList.Count; i++)
56 {
57 this.forcesList.RemoveAt(0);
58 }
59 }
60 }
61 }
62
63 public override void update()
64 {
65
66 if(this.updateflag)
67 {
68 //need to send movement info
69 //so create the improvedterseobjectupdate packet
70 //use CreateTerseBlock()
71 ImprovedTerseObjectUpdatePacket.ObjectDataBlock terseBlock = CreateTerseBlock();
72 ImprovedTerseObjectUpdatePacket terse = new ImprovedTerseObjectUpdatePacket();
73 terse.RegionData.RegionHandle = OpenSim_Main.cfg.RegionHandle; // FIXME
74 terse.RegionData.TimeDilation = 64096;
75 terse.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[1];
76 terse.ObjectData[0] = terseBlock;
77 foreach(OpenSimClient client in OpenSim_Main.sim.ClientThreads.Values) {
78 client.OutPacket(terse);
79 }
80
81 updateflag =false;
82 //this._updateCount = 0;
83 }
84 else
85 {
86 //if((movementflag & 1) !=0)
87 //{
88 _updateCount++;
89 if(( (!PhysicsEngineFlying) && (_updateCount>3)) || (_updateCount>0))
90 {
91 //It has been a while since last update was sent so lets send one.
92 ImprovedTerseObjectUpdatePacket.ObjectDataBlock terseBlock = CreateTerseBlock();
93 ImprovedTerseObjectUpdatePacket terse = new ImprovedTerseObjectUpdatePacket();
94 terse.RegionData.RegionHandle = OpenSim_Main.cfg.RegionHandle; // FIXME
95 terse.RegionData.TimeDilation = 64096;
96 terse.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[1];
97 terse.ObjectData[0] = terseBlock;
98 foreach(OpenSimClient client in OpenSim_Main.sim.ClientThreads.Values) {
99 client.OutPacket(terse);
100 }
101 _updateCount = 0;
102 }
103 //}
104 }
105 }
106
107 public static void SetupTemplate(string name)
108 {
109 int i = 0;
110 FileInfo fInfo = new FileInfo(name);
111 long numBytes = fInfo.Length;
112 FileStream fStream = new FileStream(name, FileMode.Open, FileAccess.Read);
113 BinaryReader br = new BinaryReader(fStream);
114 byte [] data1 = br.ReadBytes((int)numBytes);
115 br.Close();
116 fStream.Close();
117
118 libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock objdata = new libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock(data1, ref i);
119
120 System.Text.Encoding enc = System.Text.Encoding.ASCII;
121 libsecondlife.LLVector3 pos = new LLVector3(objdata.ObjectData, 16);
122 pos.X = 100f;
123 objdata.ID = 8880000;
124 objdata.NameValue = enc.GetBytes("FirstName STRING RW SV Test \nLastName STRING RW SV User \0");
125 libsecondlife.LLVector3 pos2 = new LLVector3(100f,100f,23f);
126 //objdata.FullID=user.AgentID;
127 byte[] pb = pos.GetBytes();
128 Array.Copy(pb, 0, objdata.ObjectData, 16, pb.Length);
129
130 Avatar.AvatarTemplate = objdata;
131 }
132
133 public void CompleteMovement(World RegionInfo) {
134 ServerConsole.MainConsole.Instance.WriteLine("Avatar.cs:CompleteMovement() - Constructing AgentMovementComplete packet");
135 AgentMovementCompletePacket mov = new AgentMovementCompletePacket();
136 mov.AgentData.SessionID = this.ControllingClient.SessionID;
137 mov.AgentData.AgentID = this.ControllingClient.AgentID;
138 mov.Data.RegionHandle = OpenSim_Main.cfg.RegionHandle;
139 // TODO - dynamicalise this stuff
140 mov.Data.Timestamp = 1172750370;
141 mov.Data.Position = new LLVector3(100f, 100f, 23f);
142 mov.Data.LookAt = new LLVector3(0.99f, 0.042f, 0);
143
144 ControllingClient.OutPacket(mov);
145 }
146
147 public void SendInitialPosition() {
148
149 System.Text.Encoding _enc = System.Text.Encoding.ASCII;
150 //send a objectupdate packet with information about the clients avatar
151 ObjectUpdatePacket objupdate = new ObjectUpdatePacket();
152 objupdate.RegionData.RegionHandle = OpenSim_Main.cfg.RegionHandle;
153 objupdate.RegionData.TimeDilation = 64096;
154 objupdate.ObjectData = new libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock[1];
155
156 objupdate.ObjectData[0] = AvatarTemplate;
157 //give this avatar object a local id and assign the user a name
158 objupdate.ObjectData[0].ID = this.localid;
159 objupdate.ObjectData[0].FullID = ControllingClient.AgentID;
160 objupdate.ObjectData[0].NameValue = _enc.GetBytes("FirstName STRING RW SV " + firstname + "\nLastName STRING RW SV " + lastname + " \0");
161
162 libsecondlife.LLVector3 pos2 = new LLVector3((float)this.position.X, (float)this.position.Y, (float)this.position.Z);
163
164 byte[] pb = pos2.GetBytes();
165
166 Array.Copy(pb, 0, objupdate.ObjectData[0].ObjectData, 16, pb.Length);
167 OpenSim_Main.local_world._localNumber++;
168
169 foreach(OpenSimClient client in OpenSim_Main.sim.ClientThreads.Values)
170 {
171 client.OutPacket(objupdate);
172 if(client.AgentID != ControllingClient.AgentID)
173 {
174 SendAppearanceToOtherAgent(client);
175 }
176 }
177 //this.ControllingClient.OutPacket(objupdate);
178 }
179
180 public void SendInitialAppearance() {
181 AgentWearablesUpdatePacket aw = new AgentWearablesUpdatePacket();
182 aw.AgentData.AgentID = this.ControllingClient.AgentID;
183 aw.AgentData.SerialNum = 0;
184 aw.AgentData.SessionID = ControllingClient.SessionID;
185
186 aw.WearableData = new AgentWearablesUpdatePacket.WearableDataBlock[13];
187 AgentWearablesUpdatePacket.WearableDataBlock awb = new AgentWearablesUpdatePacket.WearableDataBlock();
188 awb.WearableType = (byte)0;
189 awb.AssetID = new LLUUID("66c41e39-38f9-f75a-024e-585989bfab73");
190 awb.ItemID = LLUUID.Random();
191 aw.WearableData[0] = awb;
192
193 for(int i=1; i<13; i++)
194 {
195 awb = new AgentWearablesUpdatePacket.WearableDataBlock();
196 awb.WearableType = (byte)i;
197 awb.AssetID = new LLUUID("00000000-0000-0000-0000-000000000000");
198 awb.ItemID = new LLUUID("00000000-0000-0000-0000-000000000000");
199 aw.WearableData[i] = awb;
200 }
201
202 ControllingClient.OutPacket(aw);
203 }
204
205 public ObjectUpdatePacket CreateUpdatePacket()
206 {
207 System.Text.Encoding _enc = System.Text.Encoding.ASCII;
208 //send a objectupdate packet with information about the clients avatar
209 ObjectUpdatePacket objupdate = new ObjectUpdatePacket();
210 objupdate.RegionData.RegionHandle = OpenSim_Main.cfg.RegionHandle;
211 objupdate.RegionData.TimeDilation = 64096;
212 objupdate.ObjectData = new libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock[1];
213
214 objupdate.ObjectData[0] = AvatarTemplate;
215 //give this avatar object a local id and assign the user a name
216 objupdate.ObjectData[0].ID = this.localid;
217 objupdate.ObjectData[0].FullID = ControllingClient.AgentID;
218 objupdate.ObjectData[0].NameValue = _enc.GetBytes("FirstName STRING RW SV " + firstname + "\nLastName STRING RW SV " + lastname + " \0");
219
220 libsecondlife.LLVector3 pos2 = new LLVector3((float)this._physActor.Position.X, (float)this._physActor.Position.Y, (float)this._physActor.Position.Z);
221
222 byte[] pb = pos2.GetBytes();
223
224 Array.Copy(pb, 0, objupdate.ObjectData[0].ObjectData, 16, pb.Length);
225 return objupdate;
226 }
227
228 public void SendAppearanceToOtherAgent(OpenSimClient userInfo)
229 {
230 AvatarAppearancePacket avp = new AvatarAppearancePacket();
231
232
233 avp.VisualParam = new AvatarAppearancePacket.VisualParamBlock[218];
234 //avp.ObjectData.TextureEntry=this.avatar_template.TextureEntry;// br.ReadBytes((int)numBytes);
235
236 LLObject.TextureEntry ntex = new LLObject.TextureEntry(new LLUUID("00000000-0000-0000-0000-000000000005"));
237 avp.ObjectData.TextureEntry = ntex.ToBytes();
238
239 AvatarAppearancePacket.VisualParamBlock avblock = null;
240 for(int i = 0; i < 218; i++)
241 {
242 avblock = new AvatarAppearancePacket.VisualParamBlock();
243 avblock.ParamValue = (byte)100;
244 avp.VisualParam[i] = avblock;
245 }
246
247 avp.Sender.IsTrial = false;
248 avp.Sender.ID = ControllingClient.AgentID;
249 userInfo.OutPacket(avp);
250
251 }
252
253 public void HandleUpdate(AgentUpdatePacket pack) {
254 if(((uint)pack.AgentData.ControlFlags & (uint)MainAvatar.AgentUpdateFlags.AGENT_CONTROL_FLY) !=0)
255 {
256 this._physActor.Flying = true;
257 }
258 else
259 {
260 this._physActor.Flying = false;
261 }
262 if(((uint)pack.AgentData.ControlFlags & (uint)MainAvatar.AgentUpdateFlags.AGENT_CONTROL_AT_POS) !=0) {
263 Axiom.MathLib.Quaternion q = new Axiom.MathLib.Quaternion(pack.AgentData.BodyRotation.W, pack.AgentData.BodyRotation.X, pack.AgentData.BodyRotation.Y, pack.AgentData.BodyRotation.Z);
264 if(((movementflag & 1) ==0) || (q!= this.bodyRot))
265 {
266 //we should add a new force to the list
267 // but for now we will deal with velocities
268 NewForce newVelocity = new NewForce();
269 Axiom.MathLib.Vector3 v3 = new Axiom.MathLib.Vector3(1, 0, 0);
270 Axiom.MathLib.Vector3 direc = q * v3;
271 direc.Normalize();
272
273 //work out velocity for sim physics system
274 direc = direc * ((0.03f) * 128f);
275 if(this._physActor.Flying)
276 direc *=2;
277
278 newVelocity.X = direc.x;
279 newVelocity.Y = direc.y;
280 newVelocity.Z = direc.z;
281 this.forcesList.Add(newVelocity);
282 movementflag = 1;
283 this.bodyRot = q;
284 }
285 }
286 else if((((uint)pack.AgentData.ControlFlags & (uint)MainAvatar.AgentUpdateFlags.AGENT_CONTROL_UP_POS) !=0) &&(PhysicsEngineFlying)) {
287 if(((movementflag & 2) ==0) && this._physActor.Flying)
288 {
289 //we should add a new force to the list
290 // but for now we will deal with velocities
291 NewForce newVelocity = new NewForce();
292 Axiom.MathLib.Vector3 v3 = new Axiom.MathLib.Vector3(0, 0, 1);
293 Axiom.MathLib.Vector3 direc = v3;
294 direc.Normalize();
295
296 //work out velocity for sim physics system
297 direc = direc * ((0.03f) * 128f *2);
298 newVelocity.X = direc.x;
299 newVelocity.Y = direc.y;
300 newVelocity.Z = direc.z;
301 this.forcesList.Add(newVelocity);
302 movementflag = 2;
303 }
304 }
305 else if((((uint)pack.AgentData.ControlFlags & (uint)MainAvatar.AgentUpdateFlags.AGENT_CONTROL_UP_NEG) !=0) && (PhysicsEngineFlying)) {
306 if(((movementflag & 4) ==0) && this._physActor.Flying)
307 {
308 //we should add a new force to the list
309 // but for now we will deal with velocities
310 NewForce newVelocity = new NewForce();
311 Axiom.MathLib.Vector3 v3 = new Axiom.MathLib.Vector3(0, 0, -1);
312 //Axiom.MathLib.Quaternion q = new Axiom.MathLib.Quaternion(pack.AgentData.BodyRotation.W, pack.AgentData.BodyRotation.X, pack.AgentData.BodyRotation.Y, pack.AgentData.BodyRotation.Z);
313 Axiom.MathLib.Vector3 direc = v3;
314 direc.Normalize();
315
316 //work out velocity for sim physics system
317 direc = direc * ((0.03f) * 128f *2);
318 newVelocity.X = direc.x;
319 newVelocity.Y = direc.y;
320 newVelocity.Z = direc.z;
321 this.forcesList.Add(newVelocity);
322 movementflag = 4;
323 }
324 }
325 else if(((uint)pack.AgentData.ControlFlags & (uint)MainAvatar.AgentUpdateFlags.AGENT_CONTROL_AT_NEG) !=0) {
326 Axiom.MathLib.Quaternion q = new Axiom.MathLib.Quaternion(pack.AgentData.BodyRotation.W, pack.AgentData.BodyRotation.X, pack.AgentData.BodyRotation.Y, pack.AgentData.BodyRotation.Z);
327 if(((movementflag & 8) ==0) || (q!= this.bodyRot))
328 {
329 //we should add a new force to the list
330 // but for now we will deal with velocities
331 NewForce newVelocity = new NewForce();
332 Axiom.MathLib.Vector3 v3 = new Axiom.MathLib.Vector3(-1, 0, 0);
333 Axiom.MathLib.Vector3 direc = q * v3;
334 direc.Normalize();
335
336 //work out velocity for sim physics system
337 direc = direc * ((0.03f) * 128f);
338 if(this._physActor.Flying)
339 direc *=2;
340
341 newVelocity.X = direc.x;
342 newVelocity.Y = direc.y;
343 newVelocity.Z = direc.z;
344 this.forcesList.Add(newVelocity);
345 movementflag = 8;
346 this.bodyRot = q;
347 }
348 }
349 else
350 {
351 if((movementflag) !=0)
352 {
353 NewForce newVelocity = new NewForce();
354 newVelocity.X = 0;
355 newVelocity.Y = 0;
356 newVelocity.Z = 0;
357 this.forcesList.Add(newVelocity);
358 movementflag = 0;
359 }
360 }
361 }
362
363 //should be moved somewhere else
364 public void SendRegionHandshake(World RegionInfo) {
365 ServerConsole.MainConsole.Instance.WriteLine("Avatar.cs:SendRegionHandshake() - Creating empty RegionHandshake packet");
366 System.Text.Encoding _enc = System.Text.Encoding.ASCII;
367 RegionHandshakePacket handshake = new RegionHandshakePacket();
368
369 ServerConsole.MainConsole.Instance.WriteLine("Avatar.cs:SendRegionhandshake() - Filling in RegionHandshake details");
370 handshake.RegionInfo.BillableFactor = 0;
371 handshake.RegionInfo.IsEstateManager = false;
372 handshake.RegionInfo.TerrainHeightRange00 = 60;
373 handshake.RegionInfo.TerrainHeightRange01 = 60;
374 handshake.RegionInfo.TerrainHeightRange10 = 60;
375 handshake.RegionInfo.TerrainHeightRange11 = 60;
376 handshake.RegionInfo.TerrainStartHeight00 = 10;
377 handshake.RegionInfo.TerrainStartHeight01 = 10;
378 handshake.RegionInfo.TerrainStartHeight10 = 10;
379 handshake.RegionInfo.TerrainStartHeight11 = 10;
380 handshake.RegionInfo.SimAccess = 13;
381 handshake.RegionInfo.WaterHeight = 20;
382 handshake.RegionInfo.RegionFlags = 72458694;
383 handshake.RegionInfo.SimName = _enc.GetBytes(OpenSim_Main.cfg.RegionName + "\0");
384 handshake.RegionInfo.SimOwner = new LLUUID("00000000-0000-0000-0000-000000000000");
385 handshake.RegionInfo.TerrainBase0 = new LLUUID("b8d3965a-ad78-bf43-699b-bff8eca6c975");
386 handshake.RegionInfo.TerrainBase1 = new LLUUID("abb783e6-3e93-26c0-248a-247666855da3");
387 handshake.RegionInfo.TerrainBase2 = new LLUUID("179cdabd-398a-9b6b-1391-4dc333ba321f");
388 handshake.RegionInfo.TerrainBase3 = new LLUUID("beb169c7-11ea-fff2-efe5-0f24dc881df2");
389 handshake.RegionInfo.TerrainDetail0 = new LLUUID("00000000-0000-0000-0000-000000000000");
390 handshake.RegionInfo.TerrainDetail1 = new LLUUID("00000000-0000-0000-0000-000000000000");
391 handshake.RegionInfo.TerrainDetail2 = new LLUUID("00000000-0000-0000-0000-000000000000");
392 handshake.RegionInfo.TerrainDetail3 = new LLUUID("00000000-0000-0000-0000-000000000000");
393 handshake.RegionInfo.CacheID = new LLUUID("545ec0a5-5751-1026-8a0b-216e38a7ab37");
394
395 ServerConsole.MainConsole.Instance.WriteLine("Avatar.cs:SendRegionHandshake() - Sending RegionHandshake packet");
396 this.ControllingClient.OutPacket(handshake);
397 }
398
399 public ImprovedTerseObjectUpdatePacket.ObjectDataBlock CreateTerseBlock()
400 {
401 byte[] bytes = new byte[60];
402 int i=0;
403 ImprovedTerseObjectUpdatePacket.ObjectDataBlock dat = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock();
404
405 dat.TextureEntry = AvatarTemplate.TextureEntry;
406 libsecondlife.LLVector3 pos2 = new LLVector3(this._physActor.Position.X, this._physActor.Position.Y, this._physActor.Position.Z);
407
408 uint ID = this.localid;
409
410 bytes[i++] = (byte)(ID % 256);
411 bytes[i++] = (byte)((ID >> 8) % 256);
412 bytes[i++] = (byte)((ID >> 16) % 256);
413 bytes[i++] = (byte)((ID >> 24) % 256);
414 bytes[i++] = 0;
415 bytes[i++] = 1;
416 i += 14;
417 bytes[i++] = 128;
418 bytes[i++] = 63;
419
420 byte[] pb = pos2.GetBytes();
421 Array.Copy(pb, 0, bytes, i, pb.Length);
422 i += 12;
423 ushort InternVelocityX;
424 ushort InternVelocityY;
425 ushort InternVelocityZ;
426
427 Axiom.MathLib.Vector3 internDirec = new Axiom.MathLib.Vector3(this._physActor.Velocity.X, this._physActor.Velocity.Y, this._physActor.Velocity.Z);
428 internDirec = internDirec /128.0f;
429 internDirec.x += 1;
430 internDirec.y += 1;
431 internDirec.z += 1;
432
433 InternVelocityX = (ushort)(32768 * internDirec.x);
434 InternVelocityY = (ushort)(32768 * internDirec.y);
435 InternVelocityZ = (ushort)(32768 * internDirec.z);
436
437 ushort ac = 32767;
438 bytes[i++] = (byte)(InternVelocityX % 256);
439 bytes[i++] = (byte)((InternVelocityX >> 8) % 256);
440 bytes[i++] = (byte)(InternVelocityY % 256);
441 bytes[i++] = (byte)((InternVelocityY>> 8) % 256);
442 bytes[i++] = (byte)(InternVelocityZ % 256);
443 bytes[i++] = (byte)((InternVelocityZ >> 8) % 256);
444
445 //accel
446 bytes[i++] = (byte)(ac % 256);
447 bytes[i++] = (byte)((ac >> 8) % 256);
448 bytes[i++] = (byte)(ac % 256);
449 bytes[i++] = (byte)((ac >> 8) % 256);
450 bytes[i++] = (byte)(ac % 256);
451 bytes[i++] = (byte)((ac >> 8) % 256);
452
453 //rot
454 bytes[i++] = (byte)(ac % 256);
455 bytes[i++] = (byte)((ac >> 8) % 256);
456 bytes[i++] = (byte)(ac % 256);
457 bytes[i++] = (byte)((ac >> 8) % 256);
458 bytes[i++] = (byte)(ac % 256);
459 bytes[i++] = (byte)((ac >> 8) % 256);
460 bytes[i++] = (byte)(ac % 256);
461 bytes[i++] = (byte)((ac >> 8) % 256);
462
463 //rotation vel
464 bytes[i++] = (byte)(ac % 256);
465 bytes[i++] = (byte)((ac >> 8) % 256);
466 bytes[i++] = (byte)(ac % 256);
467 bytes[i++] = (byte)((ac >> 8) % 256);
468 bytes[i++] = (byte)(ac % 256);
469 bytes[i++] = (byte)((ac >> 8) % 256);
470
471 dat.Data=bytes;
472 return(dat);
473 }
474 }
475
476 public class NewForce
477 {
478 public float X;
479 public float Y;
480 public float Z;
481
482 public NewForce()
483 {
484
485 }
486 }
487}
diff --git a/src/world/Primitive.cs b/src/world/Primitive.cs
deleted file mode 100644
index 6be33ef..0000000
--- a/src/world/Primitive.cs
+++ /dev/null
@@ -1,429 +0,0 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4using OpenSim.types;
5using libsecondlife;
6using libsecondlife.Packets;
7using GridInterfaces;
8using PhysicsSystem;
9
10namespace OpenSim.world
11{
12 public class Primitive : Entity
13 {
14 protected float mesh_cutbegin;
15 protected float mesh_cutend;
16 protected PrimData primData;
17 protected bool newPrimFlag;
18 protected bool updateFlag;
19 protected bool dirtyFlag;
20 private ObjectUpdatePacket OurPacket;
21 private PhysicsActor _physActor;
22 private bool physicsEnabled;
23
24 public bool PhysicsEnabled
25 {
26 get
27 {
28 return physicsEnabled;
29 }
30 set
31 {
32 physicsEnabled = value;
33 }
34 }
35 public bool UpdateFlag
36 {
37 get
38 {
39 return updateFlag;
40 }
41 set
42 {
43 updateFlag = value;
44 }
45 }
46 public LLVector3 Scale
47 {
48 set
49 {
50 this.primData.Scale = value;
51 this.dirtyFlag = true;
52 }
53 get
54 {
55 return this.primData.Scale;
56 }
57 }
58 public PhysicsActor PhysActor
59 {
60 set
61 {
62 this._physActor = value;
63 }
64 }
65
66 public Primitive()
67 {
68 mesh_cutbegin = 0.0f;
69 mesh_cutend = 1.0f;
70 }
71
72 public override Mesh getMesh()
73 {
74 Mesh mesh = new Mesh();
75 Triangle tri = new Triangle(
76 new Axiom.MathLib.Vector3(0.0f, 1.0f, 1.0f),
77 new Axiom.MathLib.Vector3(1.0f, 0.0f, 1.0f),
78 new Axiom.MathLib.Vector3(1.0f, 1.0f, 0.0f));
79
80 mesh.AddTri(tri);
81 mesh += base.getMesh();
82
83 return mesh;
84 }
85
86 public void UpdatePosition( LLVector3 pos)
87 {
88 this.position = pos;
89 if(this._physActor != null && this.physicsEnabled)
90 {
91 this._physActor.Position = new PhysicsVector(pos.X, pos.Y, pos.Z);
92 }
93 this.updateFlag = true;
94 }
95
96 public override void update()
97 {
98 if(this.newPrimFlag)
99 {
100 foreach(OpenSimClient client in OpenSim_Main.sim.ClientThreads.Values) {
101 client.OutPacket(OurPacket);
102 }
103 this.newPrimFlag = false;
104 }
105 else if(this.updateFlag)
106 {
107 ImprovedTerseObjectUpdatePacket terse = new ImprovedTerseObjectUpdatePacket();
108 terse.RegionData.RegionHandle = OpenSim_Main.cfg.RegionHandle; // FIXME
109 terse.RegionData.TimeDilation = 64096;
110 terse.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[1];
111 terse.ObjectData[0] = this.CreateImprovedBlock();
112 foreach(OpenSimClient client in OpenSim_Main.sim.ClientThreads.Values) {
113 client.OutPacket(terse);
114 }
115 this.updateFlag = false;
116 }
117 else if(this.dirtyFlag)
118 {
119 foreach(OpenSimClient client in OpenSim_Main.sim.ClientThreads.Values) {
120 UpdateClient(client);
121 }
122 this.dirtyFlag = false;
123 }
124 else
125 {
126 if(this._physActor != null && this.physicsEnabled)
127 {
128 ImprovedTerseObjectUpdatePacket terse = new ImprovedTerseObjectUpdatePacket();
129 terse.RegionData.RegionHandle = OpenSim_Main.cfg.RegionHandle; // FIXME
130 terse.RegionData.TimeDilation = 64096;
131 terse.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[1];
132 terse.ObjectData[0] = this.CreateImprovedBlock();
133 foreach(OpenSimClient client in OpenSim_Main.sim.ClientThreads.Values) {
134 client.OutPacket(terse);
135 }
136 }
137 }
138 }
139
140 public void UpdateClient(OpenSimClient RemoteClient)
141 {
142
143 LLVector3 lPos;
144 if( this._physActor != null && this.physicsEnabled)
145 {
146 PhysicsVector pPos = this._physActor.Position;
147 lPos = new LLVector3( pPos.X, pPos.Y, pPos.Z);
148 }
149 else
150 {
151 lPos = this.position;
152 }
153 byte[] pb = lPos.GetBytes();
154 Array.Copy(pb, 0, OurPacket.ObjectData[0].ObjectData, 0, pb.Length);
155
156 // OurPacket should be update with the follwing in updateShape() rather than having to do it here
157 OurPacket.ObjectData[0].OwnerID = this.primData.OwnerID;
158 OurPacket.ObjectData[0].PCode = this.primData.PCode;
159 OurPacket.ObjectData[0].PathBegin = this.primData.PathBegin;
160 OurPacket.ObjectData[0].PathEnd = this.primData.PathEnd;
161 OurPacket.ObjectData[0].PathScaleX = this.primData.PathScaleX;
162 OurPacket.ObjectData[0].PathScaleY = this.primData.PathScaleY;
163 OurPacket.ObjectData[0].PathShearX = this.primData.PathShearX;
164 OurPacket.ObjectData[0].PathShearY = this.primData.PathShearY;
165 OurPacket.ObjectData[0].PathSkew = this.primData.PathSkew;
166 OurPacket.ObjectData[0].ProfileBegin = this.primData.ProfileBegin;
167 OurPacket.ObjectData[0].ProfileEnd = this.primData.ProfileEnd;
168 OurPacket.ObjectData[0].Scale = this.primData.Scale;
169 OurPacket.ObjectData[0].PathCurve = this.primData.PathCurve;
170 OurPacket.ObjectData[0].ProfileCurve = this.primData.ProfileCurve;
171 OurPacket.ObjectData[0].ParentID = 0;
172 OurPacket.ObjectData[0].ProfileHollow = this.primData.ProfileHollow;
173 //finish off copying rest of shape data
174 OurPacket.ObjectData[0].PathRadiusOffset = this.primData.PathRadiusOffset;
175 OurPacket.ObjectData[0].PathRevolutions = this.primData.PathRevolutions;
176 OurPacket.ObjectData[0].PathTaperX = this.primData.PathTaperX;
177 OurPacket.ObjectData[0].PathTaperY = this.primData.PathTaperY;
178 OurPacket.ObjectData[0].PathTwist = this.primData.PathTwist;
179 OurPacket.ObjectData[0].PathTwistBegin= this.primData.PathTwistBegin;
180
181 RemoteClient.OutPacket(OurPacket);
182 }
183
184 public void UpdateShape(ObjectShapePacket.ObjectDataBlock addPacket)
185 {
186 this.primData.PathBegin = addPacket.PathBegin;
187 this.primData.PathEnd = addPacket.PathEnd;
188 this.primData.PathScaleX = addPacket.PathScaleX;
189 this.primData.PathScaleY = addPacket.PathScaleY;
190 this.primData.PathShearX = addPacket.PathShearX;
191 this.primData.PathShearY = addPacket.PathShearY;
192 this.primData.PathSkew = addPacket.PathSkew;
193 this.primData.ProfileBegin = addPacket.ProfileBegin;
194 this.primData.ProfileEnd = addPacket.ProfileEnd;
195 this.primData.PathCurve = addPacket.PathCurve;
196 this.primData.ProfileCurve = addPacket.ProfileCurve;
197 this.primData.ProfileHollow = addPacket.ProfileHollow;
198 this.primData.PathRadiusOffset = addPacket.PathRadiusOffset;
199 this.primData.PathRevolutions = addPacket.PathRevolutions;
200 this.primData.PathTaperX = addPacket.PathTaperX;
201 this.primData.PathTaperY = addPacket.PathTaperY;
202 this.primData.PathTwist = addPacket.PathTwist;
203 this.primData.PathTwistBegin =addPacket.PathTwistBegin;
204 this.dirtyFlag = true;
205 }
206
207 public void CreateFromPacket( ObjectAddPacket addPacket, LLUUID agentID, uint localID)
208 {
209 ObjectUpdatePacket objupdate = new ObjectUpdatePacket();
210 objupdate.RegionData.RegionHandle = OpenSim_Main.cfg.RegionHandle;
211 objupdate.RegionData.TimeDilation = 64096;
212
213 objupdate.ObjectData = new libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock[1];
214 PrimData PData = new PrimData();
215 this.primData = PData;
216 objupdate.ObjectData[0] = new ObjectUpdatePacket.ObjectDataBlock();
217 objupdate.ObjectData[0].PSBlock = new byte[0];
218 objupdate.ObjectData[0].ExtraParams = new byte[1];
219 objupdate.ObjectData[0].MediaURL = new byte[0];
220 objupdate.ObjectData[0].NameValue = new byte[0];
221 objupdate.ObjectData[0].Text = new byte[0];
222 objupdate.ObjectData[0].TextColor = new byte[4];
223 objupdate.ObjectData[0].JointAxisOrAnchor = new LLVector3(0,0,0);
224 objupdate.ObjectData[0].JointPivot = new LLVector3(0,0,0);
225 objupdate.ObjectData[0].Material = 3;
226 objupdate.ObjectData[0].UpdateFlags=32+65536+131072+256+4+8+2048+524288+268435456;
227 objupdate.ObjectData[0].TextureAnim = new byte[0];
228 objupdate.ObjectData[0].Sound = LLUUID.Zero;
229 LLObject.TextureEntry ntex = new LLObject.TextureEntry(new LLUUID("00000000-0000-0000-5005-000000000005"));
230 objupdate.ObjectData[0].TextureEntry = ntex.ToBytes();
231 objupdate.ObjectData[0].State = 0;
232 objupdate.ObjectData[0].Data = new byte[0];
233 PData.OwnerID = objupdate.ObjectData[0].OwnerID = agentID;
234 PData.PCode = objupdate.ObjectData[0].PCode = addPacket.ObjectData.PCode;
235 PData.PathBegin = objupdate.ObjectData[0].PathBegin = addPacket.ObjectData.PathBegin;
236 PData.PathEnd = objupdate.ObjectData[0].PathEnd = addPacket.ObjectData.PathEnd;
237 PData.PathScaleX = objupdate.ObjectData[0].PathScaleX = addPacket.ObjectData.PathScaleX;
238 PData.PathScaleY = objupdate.ObjectData[0].PathScaleY = addPacket.ObjectData.PathScaleY;
239 PData.PathShearX = objupdate.ObjectData[0].PathShearX = addPacket.ObjectData.PathShearX;
240 PData.PathShearY = objupdate.ObjectData[0].PathShearY = addPacket.ObjectData.PathShearY;
241 PData.PathSkew = objupdate.ObjectData[0].PathSkew = addPacket.ObjectData.PathSkew;
242 PData.ProfileBegin = objupdate.ObjectData[0].ProfileBegin = addPacket.ObjectData.ProfileBegin;
243 PData.ProfileEnd = objupdate.ObjectData[0].ProfileEnd = addPacket.ObjectData.ProfileEnd;
244 PData.Scale = objupdate.ObjectData[0].Scale = addPacket.ObjectData.Scale;
245 PData.PathCurve = objupdate.ObjectData[0].PathCurve = addPacket.ObjectData.PathCurve;
246 PData.ProfileCurve = objupdate.ObjectData[0].ProfileCurve = addPacket.ObjectData.ProfileCurve;
247 PData.ParentID = objupdate.ObjectData[0].ParentID = 0;
248 PData.ProfileHollow = objupdate.ObjectData[0].ProfileHollow = addPacket.ObjectData.ProfileHollow;
249
250 PData.PathRadiusOffset = objupdate.ObjectData[0].PathRadiusOffset = addPacket.ObjectData.PathRadiusOffset;
251 PData.PathRevolutions = objupdate.ObjectData[0].PathRevolutions = addPacket.ObjectData.PathRevolutions;
252 PData.PathTaperX = objupdate.ObjectData[0].PathTaperX = addPacket.ObjectData.PathTaperX;
253 PData.PathTaperY = objupdate.ObjectData[0].PathTaperY = addPacket.ObjectData.PathTaperY;
254 PData.PathTwist = objupdate.ObjectData[0].PathTwist = addPacket.ObjectData.PathTwist;
255 PData.PathTwistBegin = objupdate.ObjectData[0].PathTwistBegin = addPacket.ObjectData.PathTwistBegin;
256
257 //finish off copying rest of shape data
258
259 objupdate.ObjectData[0].ID = (uint)(localID);
260 objupdate.ObjectData[0].FullID = new LLUUID("edba7151-5857-acc5-b30b-f01efef" + (localID- 702000).ToString("00000"));
261 objupdate.ObjectData[0].ObjectData = new byte[60];
262 objupdate.ObjectData[0].ObjectData[46] = 128;
263 objupdate.ObjectData[0].ObjectData[47] = 63;
264 LLVector3 pos1= addPacket.ObjectData.RayEnd;
265 //update position
266 byte[] pb = pos1.GetBytes();
267 Array.Copy(pb, 0, objupdate.ObjectData[0].ObjectData, 0, pb.Length);
268
269 this.newPrimFlag = true;
270 this.uuid = objupdate.ObjectData[0].FullID;
271 this.localid = objupdate.ObjectData[0].ID;
272 this.position = pos1;
273 this.OurPacket = objupdate;
274 }
275
276 public void CreateFromStorage(PrimData store)
277 {
278 //need to clean this up as it shares a lot of code with CreateFromPacket()
279 ObjectUpdatePacket objupdate = new ObjectUpdatePacket();
280 objupdate.RegionData.RegionHandle = OpenSim_Main.cfg.RegionHandle;
281 objupdate.RegionData.TimeDilation = 64096;
282 objupdate.ObjectData = new libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock[1];
283
284 this.primData = store;
285 objupdate.ObjectData[0] = new ObjectUpdatePacket.ObjectDataBlock();
286 objupdate.ObjectData[0].PSBlock = new byte[0];
287 objupdate.ObjectData[0].ExtraParams = new byte[1];
288 objupdate.ObjectData[0].MediaURL = new byte[0];
289 objupdate.ObjectData[0].NameValue = new byte[0];
290 objupdate.ObjectData[0].Text = new byte[0];
291 objupdate.ObjectData[0].TextColor = new byte[4];
292 objupdate.ObjectData[0].JointAxisOrAnchor = new LLVector3(0,0,0);
293 objupdate.ObjectData[0].JointPivot = new LLVector3(0,0,0);
294 objupdate.ObjectData[0].Material = 3;
295 objupdate.ObjectData[0].UpdateFlags=32+65536+131072+256+4+8+2048+524288+268435456;
296 objupdate.ObjectData[0].TextureAnim = new byte[0];
297 objupdate.ObjectData[0].Sound = LLUUID.Zero;
298 LLObject.TextureEntry ntex = new LLObject.TextureEntry(new LLUUID("00000000-0000-0000-5005-000000000005"));
299 objupdate.ObjectData[0].TextureEntry = ntex.ToBytes();
300 objupdate.ObjectData[0].State = 0;
301 objupdate.ObjectData[0].Data = new byte[0];
302 objupdate.ObjectData[0].OwnerID = this.primData.OwnerID;
303 objupdate.ObjectData[0].PCode = this.primData.PCode;
304 objupdate.ObjectData[0].PathBegin = this.primData.PathBegin;
305 objupdate.ObjectData[0].PathEnd = this.primData.PathEnd;
306 objupdate.ObjectData[0].PathScaleX = this.primData.PathScaleX;
307 objupdate.ObjectData[0].PathScaleY = this.primData.PathScaleY;
308 objupdate.ObjectData[0].PathShearX = this.primData.PathShearX;
309 objupdate.ObjectData[0].PathShearY = this.primData.PathShearY;
310 objupdate.ObjectData[0].PathSkew = this.primData.PathSkew;
311 objupdate.ObjectData[0].ProfileBegin = this.primData.ProfileBegin;
312 objupdate.ObjectData[0].ProfileEnd = this.primData.ProfileEnd;
313 objupdate.ObjectData[0].Scale = this.primData.Scale;
314 objupdate.ObjectData[0].PathCurve = this.primData.PathCurve;
315 objupdate.ObjectData[0].ProfileCurve = this.primData.ProfileCurve;
316 objupdate.ObjectData[0].ParentID = 0;
317 objupdate.ObjectData[0].ProfileHollow = this.primData.ProfileHollow;
318 //finish off copying rest of shape data
319 objupdate.ObjectData[0].PathRadiusOffset = this.primData.PathRadiusOffset;
320 objupdate.ObjectData[0].PathRevolutions = this.primData.PathRevolutions;
321 objupdate.ObjectData[0].PathTaperX = this.primData.PathTaperX;
322 objupdate.ObjectData[0].PathTaperY = this.primData.PathTaperY;
323 objupdate.ObjectData[0].PathTwist = this.primData.PathTwist;
324 objupdate.ObjectData[0].PathTwistBegin= this.primData.PathTwistBegin;
325
326 objupdate.ObjectData[0].ID = (uint)store.LocalID;
327 objupdate.ObjectData[0].FullID = store.FullID;
328
329 objupdate.ObjectData[0].ObjectData = new byte[60];
330 objupdate.ObjectData[0].ObjectData[46] = 128;
331 objupdate.ObjectData[0].ObjectData[47] = 63;
332 LLVector3 pos1= store.Position;
333 //update position
334 byte[] pb = pos1.GetBytes();
335 Array.Copy(pb, 0, objupdate.ObjectData[0].ObjectData, 0, pb.Length);
336
337 this.uuid = objupdate.ObjectData[0].FullID;
338 this.localid = objupdate.ObjectData[0].ID;
339 this.position = pos1;
340 this.OurPacket = objupdate;
341
342 }
343 public ImprovedTerseObjectUpdatePacket.ObjectDataBlock CreateImprovedBlock()
344 {
345 uint ID = this.localid;
346 byte[] bytes = new byte[60];
347
348 int i = 0;
349 ImprovedTerseObjectUpdatePacket.ObjectDataBlock dat = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock();
350 dat.TextureEntry = this.OurPacket.ObjectData[0].TextureEntry;
351
352 bytes[i++] = (byte)(ID % 256);
353 bytes[i++] = (byte)((ID >> 8) % 256);
354 bytes[i++] = (byte)((ID >> 16) % 256);
355 bytes[i++] = (byte)((ID >> 24) % 256);
356 bytes[i++]= 0;
357 bytes[i++]= 0;
358
359 LLVector3 lPos;
360 if( this._physActor != null && this.physicsEnabled)
361 {
362 PhysicsVector pPos = this._physActor.Position;
363 lPos = new LLVector3( pPos.X, pPos.Y, pPos.Z);
364 }
365 else
366 {
367 lPos = this.position;
368 }
369 byte[] pb = lPos.GetBytes();
370 Array.Copy(pb, 0, bytes, i, pb.Length);
371 i += 12;
372 ushort ac = 32767;
373
374 //vel
375 bytes[i++] = (byte)(ac % 256);
376 bytes[i++] = (byte)((ac >> 8) % 256);
377 bytes[i++] = (byte)(ac % 256);
378 bytes[i++] = (byte)((ac >> 8) % 256);
379 bytes[i++] = (byte)(ac % 256);
380 bytes[i++] = (byte)((ac >> 8) % 256);
381
382 //accel
383 bytes[i++] = (byte)(ac % 256);
384 bytes[i++] = (byte)((ac >> 8) % 256);
385 bytes[i++] = (byte)(ac % 256);
386 bytes[i++] = (byte)((ac >> 8) % 256);
387 bytes[i++] = (byte)(ac % 256);
388 bytes[i++] = (byte)((ac >> 8) % 256);
389
390 ushort rw, rx,ry,rz;
391 rw = (ushort)(32768 * (this.rotation.w+1));
392 rx = (ushort)(32768 * (this.rotation.x+1));
393 ry = (ushort)(32768 * (this.rotation.y+1));
394 rz = (ushort)(32768 * (this.rotation.z+1));
395
396 //rot
397 bytes[i++] = (byte)(rx % 256);
398 bytes[i++] = (byte)((rx >> 8) % 256);
399 bytes[i++] = (byte)(ry % 256);
400 bytes[i++] = (byte)((ry >> 8) % 256);
401 bytes[i++] = (byte)(rz % 256);
402 bytes[i++] = (byte)((rz >> 8) % 256);
403 bytes[i++] = (byte)(rw % 256);
404 bytes[i++] = (byte)((rw >> 8) % 256);
405
406 //rotation vel
407 bytes[i++] = (byte)(ac % 256);
408 bytes[i++] = (byte)((ac >> 8) % 256);
409 bytes[i++] = (byte)(ac % 256);
410 bytes[i++] = (byte)((ac >> 8) % 256);
411 bytes[i++] = (byte)(ac % 256);
412 bytes[i++] = (byte)((ac >> 8) % 256);
413
414 dat.Data=bytes;
415 return dat;
416 }
417
418 public override void BackUp()
419 {
420
421 this.primData.FullID = this.uuid;
422 this.primData.LocalID = this.localid;
423 this.primData.Position = this.position;
424 this.primData.Rotation = new LLQuaternion(this.rotation.x, this.rotation.y, this.rotation.z , this.rotation.w);
425 OpenSim_Main.local_world.localStorage.StorePrim(this.primData);
426 }
427 }
428
429}