diff options
author | Jeff Ames | 2009-02-20 02:33:54 +0000 |
---|---|---|
committer | Jeff Ames | 2009-02-20 02:33:54 +0000 |
commit | 7d4846462bf5f3c7fe862c7466d0461b6c5d228f (patch) | |
tree | 5edbd1f773a8a2a291de31b46a98a8086b0cac96 | |
parent | * Another stab at removing AssetServer.exe dependencies (diff) | |
download | opensim-SC-7d4846462bf5f3c7fe862c7466d0461b6c5d228f.zip opensim-SC-7d4846462bf5f3c7fe862c7466d0461b6c5d228f.tar.gz opensim-SC-7d4846462bf5f3c7fe862c7466d0461b6c5d228f.tar.bz2 opensim-SC-7d4846462bf5f3c7fe862c7466d0461b6c5d228f.tar.xz |
Update svn properties, add copyright headers, minor formatting cleanup.
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Data/NHibernate/EstateRegionLink.cs | 27 | ||||
-rw-r--r-- | OpenSim/Data/Tests/DataTestUtil.cs | 33 | ||||
-rw-r--r-- | OpenSim/Region/Application/OpenSimBase.cs | 2 | ||||
-rw-r--r-- | OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs | 92 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/ChildAgentDataUpdate.cs | 1012 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | 1 | ||||
-rw-r--r-- | OpenSim/Region/OptionalModules/Avatar/Concierge/ConciergeModule.cs | 6 | ||||
-rwxr-xr-x[-rw-r--r--] | Prebuild/scripts/VS2008.bat | 8 | ||||
-rw-r--r-- | Prebuild/src/Core/Nodes/DatabaseProjectNode.cs | 188 | ||||
-rw-r--r-- | Prebuild/src/Core/Nodes/DatabaseReferenceNode.cs | 126 | ||||
-rw-r--r-- | Prebuild/src/Core/Targets/VSGenericTarget.cs | 1768 |
11 files changed, 1654 insertions, 1609 deletions
diff --git a/OpenSim/Data/NHibernate/EstateRegionLink.cs b/OpenSim/Data/NHibernate/EstateRegionLink.cs index e666c3a..4b83fa5 100644 --- a/OpenSim/Data/NHibernate/EstateRegionLink.cs +++ b/OpenSim/Data/NHibernate/EstateRegionLink.cs | |||
@@ -1,3 +1,30 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
1 | using System; | 28 | using System; |
2 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
3 | using System.Text; | 30 | using System.Text; |
diff --git a/OpenSim/Data/Tests/DataTestUtil.cs b/OpenSim/Data/Tests/DataTestUtil.cs index 37d1443..f781ea6 100644 --- a/OpenSim/Data/Tests/DataTestUtil.cs +++ b/OpenSim/Data/Tests/DataTestUtil.cs | |||
@@ -1,4 +1,31 @@ | |||
1 | using System; | 1 | /* |
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
2 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
3 | using System.Text; | 30 | using System.Text; |
4 | using OpenMetaverse; | 31 | using OpenMetaverse; |
@@ -6,13 +33,11 @@ using NUnit.Framework; | |||
6 | 33 | ||
7 | namespace OpenSim.Data.Tests | 34 | namespace OpenSim.Data.Tests |
8 | { | 35 | { |
9 | |||
10 | /// <summary> | 36 | /// <summary> |
11 | /// Shared constants and methods for database unit tests. | 37 | /// Shared constants and methods for database unit tests. |
12 | /// </summary> | 38 | /// </summary> |
13 | public class DataTestUtil | 39 | public class DataTestUtil |
14 | { | 40 | { |
15 | |||
16 | public const uint UNSIGNED_INTEGER_MIN = uint.MinValue; | 41 | public const uint UNSIGNED_INTEGER_MIN = uint.MinValue; |
17 | public const uint UNSIGNED_INTEGER_MAX = uint.MaxValue / 2; // NHibernate does not support unsigned integer range. | 42 | public const uint UNSIGNED_INTEGER_MAX = uint.MaxValue / 2; // NHibernate does not support unsigned integer range. |
18 | 43 | ||
@@ -57,6 +82,6 @@ namespace OpenSim.Data.Tests | |||
57 | Assert.GreaterOrEqual(actualValue, expectedValue - Math.Abs(expectedValue) * DOUBLE_PRECISSION); | 82 | Assert.GreaterOrEqual(actualValue, expectedValue - Math.Abs(expectedValue) * DOUBLE_PRECISSION); |
58 | Assert.LessOrEqual(actualValue, expectedValue + Math.Abs(expectedValue) * DOUBLE_PRECISSION); | 83 | Assert.LessOrEqual(actualValue, expectedValue + Math.Abs(expectedValue) * DOUBLE_PRECISSION); |
59 | } | 84 | } |
60 | |||
61 | } | 85 | } |
62 | } | 86 | } |
87 | |||
diff --git a/OpenSim/Region/Application/OpenSimBase.cs b/OpenSim/Region/Application/OpenSimBase.cs index 69ff2bd..54822d0 100644 --- a/OpenSim/Region/Application/OpenSimBase.cs +++ b/OpenSim/Region/Application/OpenSimBase.cs | |||
@@ -437,7 +437,7 @@ namespace OpenSim | |||
437 | private IAssetServer loadAssetServer(string id, PluginInitialiserBase pi) | 437 | private IAssetServer loadAssetServer(string id, PluginInitialiserBase pi) |
438 | { | 438 | { |
439 | 439 | ||
440 | if(id != null && id != String.Empty) | 440 | if (id != null && id != String.Empty) |
441 | { | 441 | { |
442 | m_log.DebugFormat("[OPENSIMBASE] Attempting to load asset server id={0}", id); | 442 | m_log.DebugFormat("[OPENSIMBASE] Attempting to load asset server id={0}", id); |
443 | 443 | ||
diff --git a/OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs b/OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs index 86f836c..7cee0cf 100644 --- a/OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs +++ b/OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs | |||
@@ -147,7 +147,7 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender | |||
147 | int width = 256; | 147 | int width = 256; |
148 | int height = 256; | 148 | int height = 256; |
149 | int alpha = 255; // 0 is transparent | 149 | int alpha = 255; // 0 is transparent |
150 | Color bgColour = Color.White; // Default background color | 150 | Color bgColour = Color.White; // Default background color |
151 | 151 | ||
152 | char[] paramDelimiter = { ',' }; | 152 | char[] paramDelimiter = { ',' }; |
153 | char[] nvpDelimiter = { ':' }; | 153 | char[] nvpDelimiter = { ':' }; |
@@ -230,18 +230,17 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender | |||
230 | } | 230 | } |
231 | } | 231 | } |
232 | break; | 232 | break; |
233 | case "bgcolour": | 233 | case "bgcolour": |
234 | int hex = 0; | 234 | int hex = 0; |
235 | if (Int32.TryParse(value, NumberStyles.HexNumber, CultureInfo.InvariantCulture, out hex)) | 235 | if (Int32.TryParse(value, NumberStyles.HexNumber, CultureInfo.InvariantCulture, out hex)) |
236 | { | 236 | { |
237 | bgColour = Color.FromArgb(hex); | 237 | bgColour = Color.FromArgb(hex); |
238 | } | 238 | } |
239 | else | 239 | else |
240 | { | 240 | { |
241 | 241 | bgColour = Color.FromName(value); | |
242 | bgColour = Color.FromName(value); | 242 | } |
243 | } | 243 | break; |
244 | break; | ||
245 | case "": | 244 | case "": |
246 | // blank string has been passed do nothing just use defaults | 245 | // blank string has been passed do nothing just use defaults |
247 | break; | 246 | break; |
@@ -271,7 +270,6 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender | |||
271 | } | 270 | } |
272 | break; | 271 | break; |
273 | } | 272 | } |
274 | |||
275 | } | 273 | } |
276 | 274 | ||
277 | Bitmap bitmap = new Bitmap(width, height, PixelFormat.Format32bppArgb); | 275 | Bitmap bitmap = new Bitmap(width, height, PixelFormat.Format32bppArgb); |
@@ -282,8 +280,7 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender | |||
282 | // background color in their scripts, only do when fully opaque | 280 | // background color in their scripts, only do when fully opaque |
283 | if (alpha == 255) | 281 | if (alpha == 255) |
284 | { | 282 | { |
285 | graph.FillRectangle(new SolidBrush(bgColour), 0, 0, width, height); | 283 | graph.FillRectangle(new SolidBrush(bgColour), 0, 0, width, height); |
286 | |||
287 | } | 284 | } |
288 | 285 | ||
289 | for (int w = 0; w < bitmap.Width; w++) | 286 | for (int w = 0; w < bitmap.Width; w++) |
@@ -294,7 +291,6 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender | |||
294 | } | 291 | } |
295 | } | 292 | } |
296 | 293 | ||
297 | |||
298 | GDIDraw(data, graph); | 294 | GDIDraw(data, graph); |
299 | 295 | ||
300 | byte[] imageJ2000 = new byte[0]; | 296 | byte[] imageJ2000 = new byte[0]; |
@@ -326,10 +322,8 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender | |||
326 | } | 322 | } |
327 | 323 | ||
328 | return parsed; | 324 | return parsed; |
329 | |||
330 | } | 325 | } |
331 | 326 | ||
332 | |||
333 | /* | 327 | /* |
334 | private void CairoDraw(string data, System.Drawing.Graphics graph) | 328 | private void CairoDraw(string data, System.Drawing.Graphics graph) |
335 | { | 329 | { |
@@ -462,38 +456,38 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender | |||
462 | fontSize = Convert.ToSingle(nextLine, CultureInfo.InvariantCulture); | 456 | fontSize = Convert.ToSingle(nextLine, CultureInfo.InvariantCulture); |
463 | myFont = new Font(fontName, fontSize); | 457 | myFont = new Font(fontName, fontSize); |
464 | } | 458 | } |
465 | else if (nextLine.StartsWith("FontProp")) | 459 | else if (nextLine.StartsWith("FontProp")) |
466 | { | 460 | { |
467 | nextLine = nextLine.Remove(0, 8); | 461 | nextLine = nextLine.Remove(0, 8); |
468 | nextLine = nextLine.Trim(); | 462 | nextLine = nextLine.Trim(); |
469 | 463 | ||
470 | string [] fprops = nextLine.Split(partsDelimiter); | 464 | string [] fprops = nextLine.Split(partsDelimiter); |
471 | foreach (string prop in fprops) { | 465 | foreach (string prop in fprops) { |
472 | 466 | ||
473 | switch (prop) | 467 | switch (prop) |
474 | { | 468 | { |
475 | case "B": | 469 | case "B": |
476 | if(!(myFont.Bold)) | 470 | if (!(myFont.Bold)) |
477 | myFont = new Font(myFont, myFont.Style | FontStyle.Bold); | 471 | myFont = new Font(myFont, myFont.Style | FontStyle.Bold); |
478 | break; | 472 | break; |
479 | case "I": | 473 | case "I": |
480 | if(!(myFont.Italic)) | 474 | if (!(myFont.Italic)) |
481 | myFont = new Font(myFont, myFont.Style | FontStyle.Italic); | 475 | myFont = new Font(myFont, myFont.Style | FontStyle.Italic); |
482 | break; | 476 | break; |
483 | case "U": | 477 | case "U": |
484 | if(!(myFont.Underline)) | 478 | if (!(myFont.Underline)) |
485 | myFont = new Font(myFont, myFont.Style | FontStyle.Underline); | 479 | myFont = new Font(myFont, myFont.Style | FontStyle.Underline); |
486 | break; | 480 | break; |
487 | case "S": | 481 | case "S": |
488 | if(!(myFont.Strikeout)) | 482 | if (!(myFont.Strikeout)) |
489 | myFont = new Font(myFont, myFont.Style | FontStyle.Strikeout); | 483 | myFont = new Font(myFont, myFont.Style | FontStyle.Strikeout); |
490 | break; | 484 | break; |
491 | case "R": | 485 | case "R": |
492 | myFont = new Font(myFont, FontStyle.Regular); | 486 | myFont = new Font(myFont, FontStyle.Regular); |
493 | break; | 487 | break; |
494 | } | 488 | } |
495 | } | 489 | } |
496 | } | 490 | } |
497 | else if (nextLine.StartsWith("FontName")) | 491 | else if (nextLine.StartsWith("FontName")) |
498 | { | 492 | { |
499 | nextLine = nextLine.Remove(0, 8); | 493 | nextLine = nextLine.Remove(0, 8); |
diff --git a/OpenSim/Region/Framework/Scenes/ChildAgentDataUpdate.cs b/OpenSim/Region/Framework/Scenes/ChildAgentDataUpdate.cs index e181b91..6bfa73b 100644 --- a/OpenSim/Region/Framework/Scenes/ChildAgentDataUpdate.cs +++ b/OpenSim/Region/Framework/Scenes/ChildAgentDataUpdate.cs | |||
@@ -1,506 +1,506 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) Contributors, http://opensimulator.org/ | 2 | * Copyright (c) Contributors, http://opensimulator.org/ |
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | 3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. |
4 | * | 4 | * |
5 | * Redistribution and use in source and binary forms, with or without | 5 | * Redistribution and use in source and binary forms, with or without |
6 | * modification, are permitted provided that the following conditions are met: | 6 | * modification, are permitted provided that the following conditions are met: |
7 | * * Redistributions of source code must retain the above copyright | 7 | * * Redistributions of source code must retain the above copyright |
8 | * notice, this list of conditions and the following disclaimer. | 8 | * notice, this list of conditions and the following disclaimer. |
9 | * * Redistributions in binary form must reproduce the above copyright | 9 | * * Redistributions in binary form must reproduce the above copyright |
10 | * notice, this list of conditions and the following disclaimer in the | 10 | * notice, this list of conditions and the following disclaimer in the |
11 | * documentation and/or other materials provided with the distribution. | 11 | * documentation and/or other materials provided with the distribution. |
12 | * * Neither the name of the OpenSim Project nor the | 12 | * * Neither the name of the OpenSim Project nor the |
13 | * names of its contributors may be used to endorse or promote products | 13 | * names of its contributors may be used to endorse or promote products |
14 | * derived from this software without specific prior written permission. | 14 | * derived from this software without specific prior written permission. |
15 | * | 15 | * |
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | 16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY |
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | 17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | 19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY |
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | 20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | 21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | 22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | */ | 26 | */ |
27 | 27 | ||
28 | using System; | 28 | using System; |
29 | using System.Collections; | 29 | using System.Collections; |
30 | using System.Collections.Generic; | 30 | using System.Collections.Generic; |
31 | using OpenSim.Framework; | 31 | using OpenSim.Framework; |
32 | using OpenMetaverse; | 32 | using OpenMetaverse; |
33 | using OpenMetaverse.StructuredData; | 33 | using OpenMetaverse.StructuredData; |
34 | 34 | ||
35 | namespace OpenSim.Region.Framework.Scenes | 35 | namespace OpenSim.Region.Framework.Scenes |
36 | { | 36 | { |
37 | public interface IAgentData | 37 | public interface IAgentData |
38 | { | 38 | { |
39 | UUID AgentID { get; set; } | 39 | UUID AgentID { get; set; } |
40 | 40 | ||
41 | OSDMap PackUpdateMessage(); | 41 | OSDMap PackUpdateMessage(); |
42 | void UnpackUpdateMessage(OSDMap map); | 42 | void UnpackUpdateMessage(OSDMap map); |
43 | } | 43 | } |
44 | 44 | ||
45 | /// <summary> | 45 | /// <summary> |
46 | /// Replacement for ChildAgentDataUpdate. Used over RESTComms and LocalComms. | 46 | /// Replacement for ChildAgentDataUpdate. Used over RESTComms and LocalComms. |
47 | /// </summary> | 47 | /// </summary> |
48 | public class AgentPosition : IAgentData | 48 | public class AgentPosition : IAgentData |
49 | { | 49 | { |
50 | private UUID m_id; | 50 | private UUID m_id; |
51 | public UUID AgentID | 51 | public UUID AgentID |
52 | { | 52 | { |
53 | get { return m_id; } | 53 | get { return m_id; } |
54 | set { m_id = value; } | 54 | set { m_id = value; } |
55 | } | 55 | } |
56 | 56 | ||
57 | public ulong RegionHandle; | 57 | public ulong RegionHandle; |
58 | public uint CircuitCode; | 58 | public uint CircuitCode; |
59 | public UUID SessionID; | 59 | public UUID SessionID; |
60 | 60 | ||
61 | public float Far; | 61 | public float Far; |
62 | public Vector3 Position; | 62 | public Vector3 Position; |
63 | public Vector3 Velocity; | 63 | public Vector3 Velocity; |
64 | public Vector3 Center; | 64 | public Vector3 Center; |
65 | public Vector3 Size; | 65 | public Vector3 Size; |
66 | public Vector3 AtAxis; | 66 | public Vector3 AtAxis; |
67 | public Vector3 LeftAxis; | 67 | public Vector3 LeftAxis; |
68 | public Vector3 UpAxis; | 68 | public Vector3 UpAxis; |
69 | public bool ChangedGrid; | 69 | public bool ChangedGrid; |
70 | 70 | ||
71 | // This probably shouldn't be here | 71 | // This probably shouldn't be here |
72 | public byte[] Throttles; | 72 | public byte[] Throttles; |
73 | 73 | ||
74 | 74 | ||
75 | public OSDMap PackUpdateMessage() | 75 | public OSDMap PackUpdateMessage() |
76 | { | 76 | { |
77 | OSDMap args = new OSDMap(); | 77 | OSDMap args = new OSDMap(); |
78 | args["message_type"] = OSD.FromString("AgentPosition"); | 78 | args["message_type"] = OSD.FromString("AgentPosition"); |
79 | 79 | ||
80 | args["region_handle"] = OSD.FromString(RegionHandle.ToString()); | 80 | args["region_handle"] = OSD.FromString(RegionHandle.ToString()); |
81 | args["circuit_code"] = OSD.FromString(CircuitCode.ToString()); | 81 | args["circuit_code"] = OSD.FromString(CircuitCode.ToString()); |
82 | args["agent_uuid"] = OSD.FromUUID(AgentID); | 82 | args["agent_uuid"] = OSD.FromUUID(AgentID); |
83 | args["session_uuid"] = OSD.FromUUID(SessionID); | 83 | args["session_uuid"] = OSD.FromUUID(SessionID); |
84 | 84 | ||
85 | args["position"] = OSD.FromString(Position.ToString()); | 85 | args["position"] = OSD.FromString(Position.ToString()); |
86 | args["velocity"] = OSD.FromString(Velocity.ToString()); | 86 | args["velocity"] = OSD.FromString(Velocity.ToString()); |
87 | args["center"] = OSD.FromString(Center.ToString()); | 87 | args["center"] = OSD.FromString(Center.ToString()); |
88 | args["size"] = OSD.FromString(Size.ToString()); | 88 | args["size"] = OSD.FromString(Size.ToString()); |
89 | args["at_axis"] = OSD.FromString(AtAxis.ToString()); | 89 | args["at_axis"] = OSD.FromString(AtAxis.ToString()); |
90 | args["left_axis"] = OSD.FromString(LeftAxis.ToString()); | 90 | args["left_axis"] = OSD.FromString(LeftAxis.ToString()); |
91 | args["up_axis"] = OSD.FromString(UpAxis.ToString()); | 91 | args["up_axis"] = OSD.FromString(UpAxis.ToString()); |
92 | 92 | ||
93 | args["far"] = OSD.FromReal(Far); | 93 | args["far"] = OSD.FromReal(Far); |
94 | args["changed_grid"] = OSD.FromBoolean(ChangedGrid); | 94 | args["changed_grid"] = OSD.FromBoolean(ChangedGrid); |
95 | 95 | ||
96 | if ((Throttles != null) && (Throttles.Length > 0)) | 96 | if ((Throttles != null) && (Throttles.Length > 0)) |
97 | args["throttles"] = OSD.FromBinary(Throttles); | 97 | args["throttles"] = OSD.FromBinary(Throttles); |
98 | 98 | ||
99 | return args; | 99 | return args; |
100 | } | 100 | } |
101 | 101 | ||
102 | public void UnpackUpdateMessage(OSDMap args) | 102 | public void UnpackUpdateMessage(OSDMap args) |
103 | { | 103 | { |
104 | if (args.ContainsKey("region_handle")) | 104 | if (args.ContainsKey("region_handle")) |
105 | UInt64.TryParse(args["region_handle"].AsString(), out RegionHandle); | 105 | UInt64.TryParse(args["region_handle"].AsString(), out RegionHandle); |
106 | 106 | ||
107 | if (args["circuit_code"] != null) | 107 | if (args["circuit_code"] != null) |
108 | UInt32.TryParse((string)args["circuit_code"].AsString(), out CircuitCode); | 108 | UInt32.TryParse((string)args["circuit_code"].AsString(), out CircuitCode); |
109 | 109 | ||
110 | if (args["agent_uuid"] != null) | 110 | if (args["agent_uuid"] != null) |
111 | AgentID = args["agent_uuid"].AsUUID(); | 111 | AgentID = args["agent_uuid"].AsUUID(); |
112 | 112 | ||
113 | if (args["session_uuid"] != null) | 113 | if (args["session_uuid"] != null) |
114 | SessionID = args["session_uuid"].AsUUID(); | 114 | SessionID = args["session_uuid"].AsUUID(); |
115 | 115 | ||
116 | if (args["position"] != null) | 116 | if (args["position"] != null) |
117 | Vector3.TryParse(args["position"].AsString(), out Position); | 117 | Vector3.TryParse(args["position"].AsString(), out Position); |
118 | 118 | ||
119 | if (args["velocity"] != null) | 119 | if (args["velocity"] != null) |
120 | Vector3.TryParse(args["velocity"].AsString(), out Velocity); | 120 | Vector3.TryParse(args["velocity"].AsString(), out Velocity); |
121 | 121 | ||
122 | if (args["center"] != null) | 122 | if (args["center"] != null) |
123 | Vector3.TryParse(args["center"].AsString(), out Center); | 123 | Vector3.TryParse(args["center"].AsString(), out Center); |
124 | 124 | ||
125 | if (args["size"] != null) | 125 | if (args["size"] != null) |
126 | Vector3.TryParse(args["size"].AsString(), out Size); | 126 | Vector3.TryParse(args["size"].AsString(), out Size); |
127 | 127 | ||
128 | if (args["at_axis"] != null) | 128 | if (args["at_axis"] != null) |
129 | Vector3.TryParse(args["at_axis"].AsString(), out AtAxis); | 129 | Vector3.TryParse(args["at_axis"].AsString(), out AtAxis); |
130 | 130 | ||
131 | if (args["left_axis"] != null) | 131 | if (args["left_axis"] != null) |
132 | Vector3.TryParse(args["left_axis"].AsString(), out AtAxis); | 132 | Vector3.TryParse(args["left_axis"].AsString(), out AtAxis); |
133 | 133 | ||
134 | if (args["up_axis"] != null) | 134 | if (args["up_axis"] != null) |
135 | Vector3.TryParse(args["up_axis"].AsString(), out AtAxis); | 135 | Vector3.TryParse(args["up_axis"].AsString(), out AtAxis); |
136 | 136 | ||
137 | if (args["changed_grid"] != null) | 137 | if (args["changed_grid"] != null) |
138 | ChangedGrid = args["changed_grid"].AsBoolean(); | 138 | ChangedGrid = args["changed_grid"].AsBoolean(); |
139 | 139 | ||
140 | if (args["far"] != null) | 140 | if (args["far"] != null) |
141 | Far = (float)(args["far"].AsReal()); | 141 | Far = (float)(args["far"].AsReal()); |
142 | 142 | ||
143 | if (args["throttles"] != null) | 143 | if (args["throttles"] != null) |
144 | Throttles = args["throttles"].AsBinary(); | 144 | Throttles = args["throttles"].AsBinary(); |
145 | } | 145 | } |
146 | 146 | ||
147 | /// <summary> | 147 | /// <summary> |
148 | /// Soon to be decommissioned | 148 | /// Soon to be decommissioned |
149 | /// </summary> | 149 | /// </summary> |
150 | /// <param name="cAgent"></param> | 150 | /// <param name="cAgent"></param> |
151 | public void CopyFrom(ChildAgentDataUpdate cAgent) | 151 | public void CopyFrom(ChildAgentDataUpdate cAgent) |
152 | { | 152 | { |
153 | AgentID = new UUID(cAgent.AgentID); | 153 | AgentID = new UUID(cAgent.AgentID); |
154 | 154 | ||
155 | // next: ??? | 155 | // next: ??? |
156 | Size = new Vector3(); | 156 | Size = new Vector3(); |
157 | Size.Z = cAgent.AVHeight; | 157 | Size.Z = cAgent.AVHeight; |
158 | 158 | ||
159 | Center = new Vector3(cAgent.cameraPosition.x, cAgent.cameraPosition.y, cAgent.cameraPosition.z); | 159 | Center = new Vector3(cAgent.cameraPosition.x, cAgent.cameraPosition.y, cAgent.cameraPosition.z); |
160 | Far = cAgent.drawdistance; | 160 | Far = cAgent.drawdistance; |
161 | Position = new Vector3(cAgent.Position.x, cAgent.Position.y, cAgent.Position.z); | 161 | Position = new Vector3(cAgent.Position.x, cAgent.Position.y, cAgent.Position.z); |
162 | RegionHandle = cAgent.regionHandle; | 162 | RegionHandle = cAgent.regionHandle; |
163 | Throttles = cAgent.throttles; | 163 | Throttles = cAgent.throttles; |
164 | Velocity = new Vector3(cAgent.Velocity.x, cAgent.Velocity.y, cAgent.Velocity.z); | 164 | Velocity = new Vector3(cAgent.Velocity.x, cAgent.Velocity.y, cAgent.Velocity.z); |
165 | } | 165 | } |
166 | 166 | ||
167 | } | 167 | } |
168 | 168 | ||
169 | public class AgentGroupData | 169 | public class AgentGroupData |
170 | { | 170 | { |
171 | public UUID GroupID; | 171 | public UUID GroupID; |
172 | public ulong GroupPowers; | 172 | public ulong GroupPowers; |
173 | public bool AcceptNotices; | 173 | public bool AcceptNotices; |
174 | 174 | ||
175 | public AgentGroupData(UUID id, ulong powers, bool notices) | 175 | public AgentGroupData(UUID id, ulong powers, bool notices) |
176 | { | 176 | { |
177 | GroupID = id; | 177 | GroupID = id; |
178 | GroupPowers = powers; | 178 | GroupPowers = powers; |
179 | AcceptNotices = notices; | 179 | AcceptNotices = notices; |
180 | } | 180 | } |
181 | 181 | ||
182 | public AgentGroupData(OSDMap args) | 182 | public AgentGroupData(OSDMap args) |
183 | { | 183 | { |
184 | UnpackUpdateMessage(args); | 184 | UnpackUpdateMessage(args); |
185 | } | 185 | } |
186 | 186 | ||
187 | public OSDMap PackUpdateMessage() | 187 | public OSDMap PackUpdateMessage() |
188 | { | 188 | { |
189 | OSDMap groupdata = new OSDMap(); | 189 | OSDMap groupdata = new OSDMap(); |
190 | groupdata["group_id"] = OSD.FromUUID(GroupID); | 190 | groupdata["group_id"] = OSD.FromUUID(GroupID); |
191 | groupdata["group_powers"] = OSD.FromString(GroupPowers.ToString()); | 191 | groupdata["group_powers"] = OSD.FromString(GroupPowers.ToString()); |
192 | groupdata["accept_notices"] = OSD.FromBoolean(AcceptNotices); | 192 | groupdata["accept_notices"] = OSD.FromBoolean(AcceptNotices); |
193 | 193 | ||
194 | return groupdata; | 194 | return groupdata; |
195 | } | 195 | } |
196 | 196 | ||
197 | public void UnpackUpdateMessage(OSDMap args) | 197 | public void UnpackUpdateMessage(OSDMap args) |
198 | { | 198 | { |
199 | if (args["group_id"] != null) | 199 | if (args["group_id"] != null) |
200 | GroupID = args["group_id"].AsUUID(); | 200 | GroupID = args["group_id"].AsUUID(); |
201 | if (args["group_powers"] != null) | 201 | if (args["group_powers"] != null) |
202 | UInt64.TryParse((string)args["group_powers"].AsString(), out GroupPowers); | 202 | UInt64.TryParse((string)args["group_powers"].AsString(), out GroupPowers); |
203 | if (args["accept_notices"] != null) | 203 | if (args["accept_notices"] != null) |
204 | AcceptNotices = args["accept_notices"].AsBoolean(); | 204 | AcceptNotices = args["accept_notices"].AsBoolean(); |
205 | } | 205 | } |
206 | } | 206 | } |
207 | 207 | ||
208 | //public class AgentAnimationData | 208 | //public class AgentAnimationData |
209 | //{ | 209 | //{ |
210 | // public UUID Animation; | 210 | // public UUID Animation; |
211 | // public UUID ObjectID; | 211 | // public UUID ObjectID; |
212 | 212 | ||
213 | // public AgentAnimationData(UUID anim, UUID obj) | 213 | // public AgentAnimationData(UUID anim, UUID obj) |
214 | // { | 214 | // { |
215 | // Animation = anim; | 215 | // Animation = anim; |
216 | // ObjectID = obj; | 216 | // ObjectID = obj; |
217 | // } | 217 | // } |
218 | 218 | ||
219 | // public AgentAnimationData(OSDMap args) | 219 | // public AgentAnimationData(OSDMap args) |
220 | // { | 220 | // { |
221 | // UnpackUpdateMessage(args); | 221 | // UnpackUpdateMessage(args); |
222 | // } | 222 | // } |
223 | 223 | ||
224 | // public OSDMap PackUpdateMessage() | 224 | // public OSDMap PackUpdateMessage() |
225 | // { | 225 | // { |
226 | // OSDMap anim = new OSDMap(); | 226 | // OSDMap anim = new OSDMap(); |
227 | // anim["animation"] = OSD.FromUUID(Animation); | 227 | // anim["animation"] = OSD.FromUUID(Animation); |
228 | // anim["object_id"] = OSD.FromUUID(ObjectID); | 228 | // anim["object_id"] = OSD.FromUUID(ObjectID); |
229 | // return anim; | 229 | // return anim; |
230 | // } | 230 | // } |
231 | 231 | ||
232 | // public void UnpackUpdateMessage(OSDMap args) | 232 | // public void UnpackUpdateMessage(OSDMap args) |
233 | // { | 233 | // { |
234 | // if (args["animation"] != null) | 234 | // if (args["animation"] != null) |
235 | // Animation = args["animation"].AsUUID(); | 235 | // Animation = args["animation"].AsUUID(); |
236 | // if (args["object_id"] != null) | 236 | // if (args["object_id"] != null) |
237 | // ObjectID = args["object_id"].AsUUID(); | 237 | // ObjectID = args["object_id"].AsUUID(); |
238 | // } | 238 | // } |
239 | //} | 239 | //} |
240 | 240 | ||
241 | public class AgentData : IAgentData | 241 | public class AgentData : IAgentData |
242 | { | 242 | { |
243 | private UUID m_id; | 243 | private UUID m_id; |
244 | public UUID AgentID | 244 | public UUID AgentID |
245 | { | 245 | { |
246 | get { return m_id; } | 246 | get { return m_id; } |
247 | set { m_id = value; } | 247 | set { m_id = value; } |
248 | } | 248 | } |
249 | public ulong RegionHandle; | 249 | public ulong RegionHandle; |
250 | public uint CircuitCode; | 250 | public uint CircuitCode; |
251 | public UUID SessionID; | 251 | public UUID SessionID; |
252 | 252 | ||
253 | public Vector3 Position; | 253 | public Vector3 Position; |
254 | public Vector3 Velocity; | 254 | public Vector3 Velocity; |
255 | public Vector3 Center; | 255 | public Vector3 Center; |
256 | public Vector3 Size; | 256 | public Vector3 Size; |
257 | public Vector3 AtAxis; | 257 | public Vector3 AtAxis; |
258 | public Vector3 LeftAxis; | 258 | public Vector3 LeftAxis; |
259 | public Vector3 UpAxis; | 259 | public Vector3 UpAxis; |
260 | public bool ChangedGrid; | 260 | public bool ChangedGrid; |
261 | 261 | ||
262 | public float Far; | 262 | public float Far; |
263 | public float Aspect; | 263 | public float Aspect; |
264 | //public int[] Throttles; | 264 | //public int[] Throttles; |
265 | public byte[] Throttles; | 265 | public byte[] Throttles; |
266 | 266 | ||
267 | public uint LocomotionState; | 267 | public uint LocomotionState; |
268 | public Quaternion HeadRotation; | 268 | public Quaternion HeadRotation; |
269 | public Quaternion BodyRotation; | 269 | public Quaternion BodyRotation; |
270 | public uint ControlFlags; | 270 | public uint ControlFlags; |
271 | public float EnergyLevel; | 271 | public float EnergyLevel; |
272 | public Byte GodLevel; | 272 | public Byte GodLevel; |
273 | public bool AlwaysRun; | 273 | public bool AlwaysRun; |
274 | public UUID PreyAgent; | 274 | public UUID PreyAgent; |
275 | public Byte AgentAccess; | 275 | public Byte AgentAccess; |
276 | public UUID[] AgentTextures; | 276 | public UUID[] AgentTextures; |
277 | public UUID ActiveGroupID; | 277 | public UUID ActiveGroupID; |
278 | 278 | ||
279 | public AgentGroupData[] Groups; | 279 | public AgentGroupData[] Groups; |
280 | public Animation[] Anims; | 280 | public Animation[] Anims; |
281 | 281 | ||
282 | public UUID GranterID; | 282 | public UUID GranterID; |
283 | public Dictionary<string, string> NVPairs; | 283 | public Dictionary<string, string> NVPairs; |
284 | 284 | ||
285 | public byte[] VisualParams; | 285 | public byte[] VisualParams; |
286 | 286 | ||
287 | public string CallbackURI; | 287 | public string CallbackURI; |
288 | 288 | ||
289 | public OSDMap PackUpdateMessage() | 289 | public OSDMap PackUpdateMessage() |
290 | { | 290 | { |
291 | OSDMap args = new OSDMap(); | 291 | OSDMap args = new OSDMap(); |
292 | args["message_type"] = OSD.FromString("AgentData"); | 292 | args["message_type"] = OSD.FromString("AgentData"); |
293 | 293 | ||
294 | args["region_handle"] = OSD.FromString(RegionHandle.ToString()); | 294 | args["region_handle"] = OSD.FromString(RegionHandle.ToString()); |
295 | args["circuit_code"] = OSD.FromString(CircuitCode.ToString()); | 295 | args["circuit_code"] = OSD.FromString(CircuitCode.ToString()); |
296 | args["agent_uuid"] = OSD.FromUUID(AgentID); | 296 | args["agent_uuid"] = OSD.FromUUID(AgentID); |
297 | args["session_uuid"] = OSD.FromUUID(SessionID); | 297 | args["session_uuid"] = OSD.FromUUID(SessionID); |
298 | 298 | ||
299 | args["position"] = OSD.FromString(Position.ToString()); | 299 | args["position"] = OSD.FromString(Position.ToString()); |
300 | args["velocity"] = OSD.FromString(Velocity.ToString()); | 300 | args["velocity"] = OSD.FromString(Velocity.ToString()); |
301 | args["center"] = OSD.FromString(Center.ToString()); | 301 | args["center"] = OSD.FromString(Center.ToString()); |
302 | args["size"] = OSD.FromString(Size.ToString()); | 302 | args["size"] = OSD.FromString(Size.ToString()); |
303 | args["at_axis"] = OSD.FromString(AtAxis.ToString()); | 303 | args["at_axis"] = OSD.FromString(AtAxis.ToString()); |
304 | args["left_axis"] = OSD.FromString(LeftAxis.ToString()); | 304 | args["left_axis"] = OSD.FromString(LeftAxis.ToString()); |
305 | args["up_axis"] = OSD.FromString(UpAxis.ToString()); | 305 | args["up_axis"] = OSD.FromString(UpAxis.ToString()); |
306 | 306 | ||
307 | args["changed_grid"] = OSD.FromBoolean(ChangedGrid); | 307 | args["changed_grid"] = OSD.FromBoolean(ChangedGrid); |
308 | args["far"] = OSD.FromReal(Far); | 308 | args["far"] = OSD.FromReal(Far); |
309 | args["aspect"] = OSD.FromReal(Aspect); | 309 | args["aspect"] = OSD.FromReal(Aspect); |
310 | 310 | ||
311 | if ((Throttles != null) && (Throttles.Length > 0)) | 311 | if ((Throttles != null) && (Throttles.Length > 0)) |
312 | args["throttles"] = OSD.FromBinary(Throttles); | 312 | args["throttles"] = OSD.FromBinary(Throttles); |
313 | 313 | ||
314 | args["locomotion_state"] = OSD.FromString(LocomotionState.ToString()); | 314 | args["locomotion_state"] = OSD.FromString(LocomotionState.ToString()); |
315 | args["head_rotation"] = OSD.FromString(HeadRotation.ToString()); | 315 | args["head_rotation"] = OSD.FromString(HeadRotation.ToString()); |
316 | args["body_rotation"] = OSD.FromString(BodyRotation.ToString()); | 316 | args["body_rotation"] = OSD.FromString(BodyRotation.ToString()); |
317 | args["control_flags"] = OSD.FromString(ControlFlags.ToString()); | 317 | args["control_flags"] = OSD.FromString(ControlFlags.ToString()); |
318 | 318 | ||
319 | args["energy_level"] = OSD.FromReal(EnergyLevel); | 319 | args["energy_level"] = OSD.FromReal(EnergyLevel); |
320 | args["god_level"] = OSD.FromString(GodLevel.ToString()); | 320 | args["god_level"] = OSD.FromString(GodLevel.ToString()); |
321 | args["always_run"] = OSD.FromBoolean(AlwaysRun); | 321 | args["always_run"] = OSD.FromBoolean(AlwaysRun); |
322 | args["prey_agent"] = OSD.FromUUID(PreyAgent); | 322 | args["prey_agent"] = OSD.FromUUID(PreyAgent); |
323 | args["agent_access"] = OSD.FromString(AgentAccess.ToString()); | 323 | args["agent_access"] = OSD.FromString(AgentAccess.ToString()); |
324 | 324 | ||
325 | if ((AgentTextures != null) && (AgentTextures.Length > 0)) | 325 | if ((AgentTextures != null) && (AgentTextures.Length > 0)) |
326 | { | 326 | { |
327 | OSDArray textures = new OSDArray(AgentTextures.Length); | 327 | OSDArray textures = new OSDArray(AgentTextures.Length); |
328 | foreach (UUID uuid in AgentTextures) | 328 | foreach (UUID uuid in AgentTextures) |
329 | textures.Add(OSD.FromUUID(uuid)); | 329 | textures.Add(OSD.FromUUID(uuid)); |
330 | args["agent_textures"] = textures; | 330 | args["agent_textures"] = textures; |
331 | } | 331 | } |
332 | 332 | ||
333 | args["active_group_id"] = OSD.FromUUID(ActiveGroupID); | 333 | args["active_group_id"] = OSD.FromUUID(ActiveGroupID); |
334 | 334 | ||
335 | if ((Groups != null) && (Groups.Length > 0)) | 335 | if ((Groups != null) && (Groups.Length > 0)) |
336 | { | 336 | { |
337 | OSDArray groups = new OSDArray(Groups.Length); | 337 | OSDArray groups = new OSDArray(Groups.Length); |
338 | foreach (AgentGroupData agd in Groups) | 338 | foreach (AgentGroupData agd in Groups) |
339 | groups.Add(agd.PackUpdateMessage()); | 339 | groups.Add(agd.PackUpdateMessage()); |
340 | args["groups"] = groups; | 340 | args["groups"] = groups; |
341 | } | 341 | } |
342 | 342 | ||
343 | if ((Anims != null) && (Anims.Length > 0)) | 343 | if ((Anims != null) && (Anims.Length > 0)) |
344 | { | 344 | { |
345 | OSDArray anims = new OSDArray(Anims.Length); | 345 | OSDArray anims = new OSDArray(Anims.Length); |
346 | foreach (Animation aanim in Anims) | 346 | foreach (Animation aanim in Anims) |
347 | anims.Add(aanim.PackUpdateMessage()); | 347 | anims.Add(aanim.PackUpdateMessage()); |
348 | args["animations"] = anims; | 348 | args["animations"] = anims; |
349 | } | 349 | } |
350 | 350 | ||
351 | if ((VisualParams != null) && (VisualParams.Length > 0)) | 351 | if ((VisualParams != null) && (VisualParams.Length > 0)) |
352 | args["visual_params"] = OSD.FromBinary(VisualParams); | 352 | args["visual_params"] = OSD.FromBinary(VisualParams); |
353 | 353 | ||
354 | // Last few fields are still missing: granter and NVPais | 354 | // Last few fields are still missing: granter and NVPais |
355 | 355 | ||
356 | if ((CallbackURI != null) && (!CallbackURI.Equals(""))) | 356 | if ((CallbackURI != null) && (!CallbackURI.Equals(""))) |
357 | args["callback_uri"] = OSD.FromString(CallbackURI); | 357 | args["callback_uri"] = OSD.FromString(CallbackURI); |
358 | 358 | ||
359 | return args; | 359 | return args; |
360 | } | 360 | } |
361 | 361 | ||
362 | /// <summary> | 362 | /// <summary> |
363 | /// Deserialization of agent data. | 363 | /// Deserialization of agent data. |
364 | /// Avoiding reflection makes it painful to write, but that's the price! | 364 | /// Avoiding reflection makes it painful to write, but that's the price! |
365 | /// </summary> | 365 | /// </summary> |
366 | /// <param name="hash"></param> | 366 | /// <param name="hash"></param> |
367 | public void UnpackUpdateMessage(OSDMap args) | 367 | public void UnpackUpdateMessage(OSDMap args) |
368 | { | 368 | { |
369 | if (args.ContainsKey("region_handle")) | 369 | if (args.ContainsKey("region_handle")) |
370 | UInt64.TryParse(args["region_handle"].AsString(), out RegionHandle); | 370 | UInt64.TryParse(args["region_handle"].AsString(), out RegionHandle); |
371 | 371 | ||
372 | if (args["circuit_code"] != null) | 372 | if (args["circuit_code"] != null) |
373 | UInt32.TryParse((string)args["circuit_code"].AsString(), out CircuitCode); | 373 | UInt32.TryParse((string)args["circuit_code"].AsString(), out CircuitCode); |
374 | 374 | ||
375 | if (args["agent_uuid"] != null) | 375 | if (args["agent_uuid"] != null) |
376 | AgentID = args["agent_uuid"].AsUUID(); | 376 | AgentID = args["agent_uuid"].AsUUID(); |
377 | 377 | ||
378 | if (args["session_uuid"] != null) | 378 | if (args["session_uuid"] != null) |
379 | SessionID = args["session_uuid"].AsUUID(); | 379 | SessionID = args["session_uuid"].AsUUID(); |
380 | 380 | ||
381 | if (args["position"] != null) | 381 | if (args["position"] != null) |
382 | Vector3.TryParse(args["position"].AsString(), out Position); | 382 | Vector3.TryParse(args["position"].AsString(), out Position); |
383 | 383 | ||
384 | if (args["velocity"] != null) | 384 | if (args["velocity"] != null) |
385 | Vector3.TryParse(args["velocity"].AsString(), out Velocity); | 385 | Vector3.TryParse(args["velocity"].AsString(), out Velocity); |
386 | 386 | ||
387 | if (args["center"] != null) | 387 | if (args["center"] != null) |
388 | Vector3.TryParse(args["center"].AsString(), out Center); | 388 | Vector3.TryParse(args["center"].AsString(), out Center); |
389 | 389 | ||
390 | if (args["size"] != null) | 390 | if (args["size"] != null) |
391 | Vector3.TryParse(args["size"].AsString(), out Size); | 391 | Vector3.TryParse(args["size"].AsString(), out Size); |
392 | 392 | ||
393 | if (args["at_axis"] != null) | 393 | if (args["at_axis"] != null) |
394 | Vector3.TryParse(args["at_axis"].AsString(), out AtAxis); | 394 | Vector3.TryParse(args["at_axis"].AsString(), out AtAxis); |
395 | 395 | ||
396 | if (args["left_axis"] != null) | 396 | if (args["left_axis"] != null) |
397 | Vector3.TryParse(args["left_axis"].AsString(), out AtAxis); | 397 | Vector3.TryParse(args["left_axis"].AsString(), out AtAxis); |
398 | 398 | ||
399 | if (args["up_axis"] != null) | 399 | if (args["up_axis"] != null) |
400 | Vector3.TryParse(args["up_axis"].AsString(), out AtAxis); | 400 | Vector3.TryParse(args["up_axis"].AsString(), out AtAxis); |
401 | 401 | ||
402 | if (args["changed_grid"] != null) | 402 | if (args["changed_grid"] != null) |
403 | ChangedGrid = args["changed_grid"].AsBoolean(); | 403 | ChangedGrid = args["changed_grid"].AsBoolean(); |
404 | 404 | ||
405 | if (args["far"] != null) | 405 | if (args["far"] != null) |
406 | Far = (float)(args["far"].AsReal()); | 406 | Far = (float)(args["far"].AsReal()); |
407 | 407 | ||
408 | if (args["aspect"] != null) | 408 | if (args["aspect"] != null) |
409 | Aspect = (float)args["aspect"].AsReal(); | 409 | Aspect = (float)args["aspect"].AsReal(); |
410 | 410 | ||
411 | if (args["throttles"] != null) | 411 | if (args["throttles"] != null) |
412 | Throttles = args["throttles"].AsBinary(); | 412 | Throttles = args["throttles"].AsBinary(); |
413 | 413 | ||
414 | if (args["locomotion_state"] != null) | 414 | if (args["locomotion_state"] != null) |
415 | UInt32.TryParse(args["locomotion_state"].AsString(), out LocomotionState); | 415 | UInt32.TryParse(args["locomotion_state"].AsString(), out LocomotionState); |
416 | 416 | ||
417 | if (args["head_rotation"] != null) | 417 | if (args["head_rotation"] != null) |
418 | Quaternion.TryParse(args["head_rotation"].AsString(), out HeadRotation); | 418 | Quaternion.TryParse(args["head_rotation"].AsString(), out HeadRotation); |
419 | 419 | ||
420 | if (args["body_rotation"] != null) | 420 | if (args["body_rotation"] != null) |
421 | Quaternion.TryParse(args["body_rotation"].AsString(), out BodyRotation); | 421 | Quaternion.TryParse(args["body_rotation"].AsString(), out BodyRotation); |
422 | 422 | ||
423 | if (args["control_flags"] != null) | 423 | if (args["control_flags"] != null) |
424 | UInt32.TryParse(args["control_flags"].AsString(), out ControlFlags); | 424 | UInt32.TryParse(args["control_flags"].AsString(), out ControlFlags); |
425 | 425 | ||
426 | if (args["energy_level"] != null) | 426 | if (args["energy_level"] != null) |
427 | EnergyLevel = (float)(args["energy_level"].AsReal()); | 427 | EnergyLevel = (float)(args["energy_level"].AsReal()); |
428 | 428 | ||
429 | if (args["god_level"] != null) | 429 | if (args["god_level"] != null) |
430 | Byte.TryParse(args["god_level"].AsString(), out GodLevel); | 430 | Byte.TryParse(args["god_level"].AsString(), out GodLevel); |
431 | 431 | ||
432 | if (args["always_run"] != null) | 432 | if (args["always_run"] != null) |
433 | AlwaysRun = args["always_run"].AsBoolean(); | 433 | AlwaysRun = args["always_run"].AsBoolean(); |
434 | 434 | ||
435 | if (args["prey_agent"] != null) | 435 | if (args["prey_agent"] != null) |
436 | PreyAgent = args["prey_agent"].AsUUID(); | 436 | PreyAgent = args["prey_agent"].AsUUID(); |
437 | 437 | ||
438 | if (args["agent_access"] != null) | 438 | if (args["agent_access"] != null) |
439 | Byte.TryParse(args["agent_access"].AsString(), out AgentAccess); | 439 | Byte.TryParse(args["agent_access"].AsString(), out AgentAccess); |
440 | 440 | ||
441 | if ((args["agent_textures"] != null) && (args["agent_textures"]).Type == OSDType.Array) | 441 | if ((args["agent_textures"] != null) && (args["agent_textures"]).Type == OSDType.Array) |
442 | { | 442 | { |
443 | OSDArray textures = (OSDArray)(args["agent_textures"]); | 443 | OSDArray textures = (OSDArray)(args["agent_textures"]); |
444 | AgentTextures = new UUID[textures.Count]; | 444 | AgentTextures = new UUID[textures.Count]; |
445 | int i = 0; | 445 | int i = 0; |
446 | foreach (OSD o in textures) | 446 | foreach (OSD o in textures) |
447 | AgentTextures[i++] = o.AsUUID(); | 447 | AgentTextures[i++] = o.AsUUID(); |
448 | } | 448 | } |
449 | 449 | ||
450 | if (args["active_group_id"] != null) | 450 | if (args["active_group_id"] != null) |
451 | ActiveGroupID = args["active_group_id"].AsUUID(); | 451 | ActiveGroupID = args["active_group_id"].AsUUID(); |
452 | 452 | ||
453 | if ((args["groups"] != null) && (args["groups"]).Type == OSDType.Array) | 453 | if ((args["groups"] != null) && (args["groups"]).Type == OSDType.Array) |
454 | { | 454 | { |
455 | OSDArray groups = (OSDArray)(args["groups"]); | 455 | OSDArray groups = (OSDArray)(args["groups"]); |
456 | Groups = new AgentGroupData[groups.Count]; | 456 | Groups = new AgentGroupData[groups.Count]; |
457 | int i = 0; | 457 | int i = 0; |
458 | foreach (OSD o in groups) | 458 | foreach (OSD o in groups) |
459 | { | 459 | { |
460 | if (o.Type == OSDType.Map) | 460 | if (o.Type == OSDType.Map) |
461 | { | 461 | { |
462 | Groups[i++] = new AgentGroupData((OSDMap)o); | 462 | Groups[i++] = new AgentGroupData((OSDMap)o); |
463 | } | 463 | } |
464 | } | 464 | } |
465 | } | 465 | } |
466 | 466 | ||
467 | if ((args["animations"] != null) && (args["animations"]).Type == OSDType.Array) | 467 | if ((args["animations"] != null) && (args["animations"]).Type == OSDType.Array) |
468 | { | 468 | { |
469 | OSDArray anims = (OSDArray)(args["animations"]); | 469 | OSDArray anims = (OSDArray)(args["animations"]); |
470 | Anims = new Animation[anims.Count]; | 470 | Anims = new Animation[anims.Count]; |
471 | int i = 0; | 471 | int i = 0; |
472 | foreach (OSD o in anims) | 472 | foreach (OSD o in anims) |
473 | { | 473 | { |
474 | if (o.Type == OSDType.Map) | 474 | if (o.Type == OSDType.Map) |
475 | { | 475 | { |
476 | Anims[i++] = new Animation((OSDMap)o); | 476 | Anims[i++] = new Animation((OSDMap)o); |
477 | } | 477 | } |
478 | } | 478 | } |
479 | } | 479 | } |
480 | 480 | ||
481 | if (args["visual_params"] != null) | 481 | if (args["visual_params"] != null) |
482 | VisualParams = args["visual_params"].AsBinary(); | 482 | VisualParams = args["visual_params"].AsBinary(); |
483 | 483 | ||
484 | if (args["callback_uri"] != null) | 484 | if (args["callback_uri"] != null) |
485 | CallbackURI = args["callback_uri"].AsString(); | 485 | CallbackURI = args["callback_uri"].AsString(); |
486 | } | 486 | } |
487 | 487 | ||
488 | public AgentData() | 488 | public AgentData() |
489 | { | 489 | { |
490 | } | 490 | } |
491 | 491 | ||
492 | public AgentData(Hashtable hash) | 492 | public AgentData(Hashtable hash) |
493 | { | 493 | { |
494 | //UnpackUpdateMessage(hash); | 494 | //UnpackUpdateMessage(hash); |
495 | } | 495 | } |
496 | 496 | ||
497 | public void Dump() | 497 | public void Dump() |
498 | { | 498 | { |
499 | System.Console.WriteLine("------------ AgentData ------------"); | 499 | System.Console.WriteLine("------------ AgentData ------------"); |
500 | System.Console.WriteLine("UUID: " + AgentID); | 500 | System.Console.WriteLine("UUID: " + AgentID); |
501 | System.Console.WriteLine("Region: " + RegionHandle); | 501 | System.Console.WriteLine("Region: " + RegionHandle); |
502 | System.Console.WriteLine("Position: " + Position); | 502 | System.Console.WriteLine("Position: " + Position); |
503 | } | 503 | } |
504 | } | 504 | } |
505 | 505 | ||
506 | } | 506 | } |
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index f5d7b32..4eb8a28 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | |||
@@ -1379,7 +1379,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
1379 | 1379 | ||
1380 | if (part != null) | 1380 | if (part != null) |
1381 | { | 1381 | { |
1382 | |||
1383 | TaskInventoryItem currentItem = part.Inventory.GetInventoryItem(itemID); | 1382 | TaskInventoryItem currentItem = part.Inventory.GetInventoryItem(itemID); |
1384 | bool allowInventoryDrop = (part.GetEffectiveObjectFlags() | 1383 | bool allowInventoryDrop = (part.GetEffectiveObjectFlags() |
1385 | & (uint)PrimFlags.AllowInventoryDrop) != 0; | 1384 | & (uint)PrimFlags.AllowInventoryDrop) != 0; |
diff --git a/OpenSim/Region/OptionalModules/Avatar/Concierge/ConciergeModule.cs b/OpenSim/Region/OptionalModules/Avatar/Concierge/ConciergeModule.cs index 51aa8f8..604b21d 100644 --- a/OpenSim/Region/OptionalModules/Avatar/Concierge/ConciergeModule.cs +++ b/OpenSim/Region/OptionalModules/Avatar/Concierge/ConciergeModule.cs | |||
@@ -282,7 +282,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Concierge | |||
282 | { | 282 | { |
283 | m_log.DebugFormat("[Concierge]: {0} logs off from {1}", client.Name, client.Scene.RegionInfo.RegionName); | 283 | m_log.DebugFormat("[Concierge]: {0} logs off from {1}", client.Name, client.Scene.RegionInfo.RegionName); |
284 | RemoveFromAttendeeList(client.AgentId, client.Name, client.Scene); | 284 | RemoveFromAttendeeList(client.AgentId, client.Name, client.Scene); |
285 | lock(m_sceneAttendees) | 285 | lock (m_sceneAttendees) |
286 | { | 286 | { |
287 | AnnounceToAgentsRegion(client.Scene, String.Format(m_announceLeaving, client.Name, client.Scene.RegionInfo.RegionName, | 287 | AnnounceToAgentsRegion(client.Scene, String.Format(m_announceLeaving, client.Name, client.Scene.RegionInfo.RegionName, |
288 | m_sceneAttendees[client.Scene].Count)); | 288 | m_sceneAttendees[client.Scene].Count)); |
@@ -406,7 +406,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Concierge | |||
406 | attendees.Count, scene.RegionInfo.RegionName, | 406 | attendees.Count, scene.RegionInfo.RegionName, |
407 | scene.RegionInfo.RegionID, | 407 | scene.RegionInfo.RegionID, |
408 | DateTime.UtcNow.ToString("s"))); | 408 | DateTime.UtcNow.ToString("s"))); |
409 | lock(m_sceneAttendees) | 409 | lock (m_sceneAttendees) |
410 | { | 410 | { |
411 | foreach (UUID uuid in attendees) | 411 | foreach (UUID uuid in attendees) |
412 | { | 412 | { |
@@ -458,7 +458,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Concierge | |||
458 | string payload = bs.Payload; | 458 | string payload = bs.Payload; |
459 | HttpWebRequest updatePost = bs.Poster; | 459 | HttpWebRequest updatePost = bs.Poster; |
460 | 460 | ||
461 | using(StreamWriter payloadStream = new StreamWriter(updatePost.EndGetRequestStream(result))) | 461 | using (StreamWriter payloadStream = new StreamWriter(updatePost.EndGetRequestStream(result))) |
462 | { | 462 | { |
463 | payloadStream.Write(payload); | 463 | payloadStream.Write(payload); |
464 | payloadStream.Close(); | 464 | payloadStream.Close(); |
diff --git a/Prebuild/scripts/VS2008.bat b/Prebuild/scripts/VS2008.bat index b465668..eb51a82 100644..100755 --- a/Prebuild/scripts/VS2008.bat +++ b/Prebuild/scripts/VS2008.bat | |||
@@ -1,4 +1,4 @@ | |||
1 | @rem Generates a solution (.sln) and a set of project files (.csproj, .vbproj, etc.) | 1 | @rem Generates a solution (.sln) and a set of project files (.csproj, .vbproj, etc.) |
2 | @rem for Microsoft Visual Studio .NET 2008 | 2 | @rem for Microsoft Visual Studio .NET 2008 |
3 | cd .. | 3 | cd .. |
4 | Prebuild.exe /target vs2008 /file prebuild.xml /pause | 4 | Prebuild.exe /target vs2008 /file prebuild.xml /pause |
diff --git a/Prebuild/src/Core/Nodes/DatabaseProjectNode.cs b/Prebuild/src/Core/Nodes/DatabaseProjectNode.cs index 8696a79..27c2051 100644 --- a/Prebuild/src/Core/Nodes/DatabaseProjectNode.cs +++ b/Prebuild/src/Core/Nodes/DatabaseProjectNode.cs | |||
@@ -1,94 +1,94 @@ | |||
1 | using System; | 1 | using System; |
2 | using System.Collections; | 2 | using System.Collections; |
3 | using System.Collections.Generic; | 3 | using System.Collections.Generic; |
4 | using System.Text; | 4 | using System.Text; |
5 | using System.Xml; | 5 | using System.Xml; |
6 | 6 | ||
7 | using Prebuild.Core.Attributes; | 7 | using Prebuild.Core.Attributes; |
8 | using Prebuild.Core.Interfaces; | 8 | using Prebuild.Core.Interfaces; |
9 | using Prebuild.Core.Utilities; | 9 | using Prebuild.Core.Utilities; |
10 | 10 | ||
11 | namespace Prebuild.Core.Nodes | 11 | namespace Prebuild.Core.Nodes |
12 | { | 12 | { |
13 | [DataNode("DatabaseProject")] | 13 | [DataNode("DatabaseProject")] |
14 | public class DatabaseProjectNode : DataNode | 14 | public class DatabaseProjectNode : DataNode |
15 | { | 15 | { |
16 | string name; | 16 | string name; |
17 | string path; | 17 | string path; |
18 | string fullpath; | 18 | string fullpath; |
19 | Guid guid = Guid.NewGuid(); | 19 | Guid guid = Guid.NewGuid(); |
20 | readonly List<AuthorNode> authors = new List<AuthorNode>(); | 20 | readonly List<AuthorNode> authors = new List<AuthorNode>(); |
21 | readonly List<DatabaseReferenceNode> references = new List<DatabaseReferenceNode>(); | 21 | readonly List<DatabaseReferenceNode> references = new List<DatabaseReferenceNode>(); |
22 | 22 | ||
23 | public Guid Guid | 23 | public Guid Guid |
24 | { | 24 | { |
25 | get { return guid; } | 25 | get { return guid; } |
26 | } | 26 | } |
27 | 27 | ||
28 | public string Name | 28 | public string Name |
29 | { | 29 | { |
30 | get { return name; } | 30 | get { return name; } |
31 | } | 31 | } |
32 | 32 | ||
33 | public string Path | 33 | public string Path |
34 | { | 34 | { |
35 | get { return path; } | 35 | get { return path; } |
36 | } | 36 | } |
37 | 37 | ||
38 | public string FullPath | 38 | public string FullPath |
39 | { | 39 | { |
40 | get { return fullpath; } | 40 | get { return fullpath; } |
41 | } | 41 | } |
42 | 42 | ||
43 | public IEnumerable<DatabaseReferenceNode> References | 43 | public IEnumerable<DatabaseReferenceNode> References |
44 | { | 44 | { |
45 | get { return references; } | 45 | get { return references; } |
46 | } | 46 | } |
47 | 47 | ||
48 | public override void Parse(XmlNode node) | 48 | public override void Parse(XmlNode node) |
49 | { | 49 | { |
50 | name = Helper.AttributeValue(node, "name", name); | 50 | name = Helper.AttributeValue(node, "name", name); |
51 | path = Helper.AttributeValue(node, "path", name); | 51 | path = Helper.AttributeValue(node, "path", name); |
52 | 52 | ||
53 | try | 53 | try |
54 | { | 54 | { |
55 | fullpath = Helper.ResolvePath(path); | 55 | fullpath = Helper.ResolvePath(path); |
56 | } | 56 | } |
57 | catch | 57 | catch |
58 | { | 58 | { |
59 | throw new WarningException("Could not resolve Solution path: {0}", path); | 59 | throw new WarningException("Could not resolve Solution path: {0}", path); |
60 | } | 60 | } |
61 | 61 | ||
62 | Kernel.Instance.CurrentWorkingDirectory.Push(); | 62 | Kernel.Instance.CurrentWorkingDirectory.Push(); |
63 | 63 | ||
64 | try | 64 | try |
65 | { | 65 | { |
66 | Helper.SetCurrentDir(fullpath); | 66 | Helper.SetCurrentDir(fullpath); |
67 | 67 | ||
68 | if (node == null) | 68 | if (node == null) |
69 | { | 69 | { |
70 | throw new ArgumentNullException("node"); | 70 | throw new ArgumentNullException("node"); |
71 | } | 71 | } |
72 | 72 | ||
73 | foreach (XmlNode child in node.ChildNodes) | 73 | foreach (XmlNode child in node.ChildNodes) |
74 | { | 74 | { |
75 | IDataNode dataNode = Kernel.Instance.ParseNode(child, this); | 75 | IDataNode dataNode = Kernel.Instance.ParseNode(child, this); |
76 | 76 | ||
77 | if (dataNode == null) | 77 | if (dataNode == null) |
78 | continue; | 78 | continue; |
79 | 79 | ||
80 | if (dataNode is AuthorNode) | 80 | if (dataNode is AuthorNode) |
81 | authors.Add((AuthorNode)dataNode); | 81 | authors.Add((AuthorNode)dataNode); |
82 | else if (dataNode is DatabaseReferenceNode) | 82 | else if (dataNode is DatabaseReferenceNode) |
83 | references.Add((DatabaseReferenceNode)dataNode); | 83 | references.Add((DatabaseReferenceNode)dataNode); |
84 | } | 84 | } |
85 | } | 85 | } |
86 | finally | 86 | finally |
87 | { | 87 | { |
88 | Kernel.Instance.CurrentWorkingDirectory.Pop(); | 88 | Kernel.Instance.CurrentWorkingDirectory.Pop(); |
89 | } | 89 | } |
90 | 90 | ||
91 | base.Parse(node); | 91 | base.Parse(node); |
92 | } | 92 | } |
93 | } | 93 | } |
94 | } | 94 | } |
diff --git a/Prebuild/src/Core/Nodes/DatabaseReferenceNode.cs b/Prebuild/src/Core/Nodes/DatabaseReferenceNode.cs index 97c3964..845db24 100644 --- a/Prebuild/src/Core/Nodes/DatabaseReferenceNode.cs +++ b/Prebuild/src/Core/Nodes/DatabaseReferenceNode.cs | |||
@@ -1,63 +1,63 @@ | |||
1 | using System; | 1 | using System; |
2 | using Prebuild.Core.Attributes; | 2 | using Prebuild.Core.Attributes; |
3 | using Prebuild.Core.Utilities; | 3 | using Prebuild.Core.Utilities; |
4 | 4 | ||
5 | namespace Prebuild.Core.Nodes | 5 | namespace Prebuild.Core.Nodes |
6 | { | 6 | { |
7 | [DataNode("DatabaseReference")] | 7 | [DataNode("DatabaseReference")] |
8 | public class DatabaseReferenceNode : DataNode | 8 | public class DatabaseReferenceNode : DataNode |
9 | { | 9 | { |
10 | string name; | 10 | string name; |
11 | Guid providerId; | 11 | Guid providerId; |
12 | string connectionString; | 12 | string connectionString; |
13 | 13 | ||
14 | public string Name | 14 | public string Name |
15 | { | 15 | { |
16 | get { return name; } | 16 | get { return name; } |
17 | } | 17 | } |
18 | 18 | ||
19 | public Guid ProviderId | 19 | public Guid ProviderId |
20 | { | 20 | { |
21 | get { return providerId; } | 21 | get { return providerId; } |
22 | } | 22 | } |
23 | 23 | ||
24 | public string ConnectionString | 24 | public string ConnectionString |
25 | { | 25 | { |
26 | get { return connectionString; } | 26 | get { return connectionString; } |
27 | } | 27 | } |
28 | 28 | ||
29 | public override void Parse(System.Xml.XmlNode node) | 29 | public override void Parse(System.Xml.XmlNode node) |
30 | { | 30 | { |
31 | name = Helper.AttributeValue(node, "name", name); | 31 | name = Helper.AttributeValue(node, "name", name); |
32 | 32 | ||
33 | string providerName = Helper.AttributeValue(node, "providerName", string.Empty); | 33 | string providerName = Helper.AttributeValue(node, "providerName", string.Empty); |
34 | if (providerName != null) | 34 | if (providerName != null) |
35 | { | 35 | { |
36 | switch (providerName) | 36 | switch (providerName) |
37 | { | 37 | { |
38 | // digitaljeebus: pulled from HKLM\SOFTWARE\Microsoft\VisualStudio\9.0\DataProviders\* | 38 | // digitaljeebus: pulled from HKLM\SOFTWARE\Microsoft\VisualStudio\9.0\DataProviders\* |
39 | // Not sure if these will help other operating systems, or if there's a better way. | 39 | // Not sure if these will help other operating systems, or if there's a better way. |
40 | case "Microsoft.SqlServerCe.Client.3.5": | 40 | case "Microsoft.SqlServerCe.Client.3.5": |
41 | providerId = new Guid("7C602B5B-ACCB-4acd-9DC0-CA66388C1533"); break; | 41 | providerId = new Guid("7C602B5B-ACCB-4acd-9DC0-CA66388C1533"); break; |
42 | case "System.Data.OleDb": | 42 | case "System.Data.OleDb": |
43 | providerId = new Guid("7F041D59-D76A-44ed-9AA2-FBF6B0548B80"); break; | 43 | providerId = new Guid("7F041D59-D76A-44ed-9AA2-FBF6B0548B80"); break; |
44 | case "System.Data.OracleClient": | 44 | case "System.Data.OracleClient": |
45 | providerId = new Guid("8F5C5018-AE09-42cf-B2CC-2CCCC7CFC2BB"); break; | 45 | providerId = new Guid("8F5C5018-AE09-42cf-B2CC-2CCCC7CFC2BB"); break; |
46 | case "System.Data.SqlClient": | 46 | case "System.Data.SqlClient": |
47 | providerId = new Guid("91510608-8809-4020-8897-FBA057E22D54"); break; | 47 | providerId = new Guid("91510608-8809-4020-8897-FBA057E22D54"); break; |
48 | case "System.Data.Odbc": | 48 | case "System.Data.Odbc": |
49 | providerId = new Guid("C3D4F4CE-2C48-4381-B4D6-34FA50C51C86"); break; | 49 | providerId = new Guid("C3D4F4CE-2C48-4381-B4D6-34FA50C51C86"); break; |
50 | 50 | ||
51 | default: | 51 | default: |
52 | throw new ArgumentOutOfRangeException("providerName", providerName, "Could not provider name to an id."); | 52 | throw new ArgumentOutOfRangeException("providerName", providerName, "Could not provider name to an id."); |
53 | } | 53 | } |
54 | } | 54 | } |
55 | else | 55 | else |
56 | providerId = new Guid(Helper.AttributeValue(node, "providerId", Guid.Empty.ToString("B"))); | 56 | providerId = new Guid(Helper.AttributeValue(node, "providerId", Guid.Empty.ToString("B"))); |
57 | 57 | ||
58 | connectionString = Helper.AttributeValue(node, "connectionString", connectionString); | 58 | connectionString = Helper.AttributeValue(node, "connectionString", connectionString); |
59 | 59 | ||
60 | base.Parse(node); | 60 | base.Parse(node); |
61 | } | 61 | } |
62 | } | 62 | } |
63 | } | 63 | } |
diff --git a/Prebuild/src/Core/Targets/VSGenericTarget.cs b/Prebuild/src/Core/Targets/VSGenericTarget.cs index a05f6b3..60cc803 100644 --- a/Prebuild/src/Core/Targets/VSGenericTarget.cs +++ b/Prebuild/src/Core/Targets/VSGenericTarget.cs | |||
@@ -1,884 +1,884 @@ | |||
1 | #region BSD License | 1 | #region BSD License |
2 | /* | 2 | /* |
3 | Copyright (c) 2008 Matthew Holmes (matthew@wildfiregames.com), John Anderson (sontek@gmail.com) | 3 | Copyright (c) 2008 Matthew Holmes (matthew@wildfiregames.com), John Anderson (sontek@gmail.com) |
4 | 4 | ||
5 | Redistribution and use in source and binary forms, with or without modification, are permitted | 5 | Redistribution and use in source and binary forms, with or without modification, are permitted |
6 | provided that the following conditions are met: | 6 | provided that the following conditions are met: |
7 | 7 | ||
8 | * Redistributions of source code must retain the above copyright notice, this list of conditions | 8 | * Redistributions of source code must retain the above copyright notice, this list of conditions |
9 | and the following disclaimer. | 9 | and the following disclaimer. |
10 | * Redistributions in binary form must reproduce the above copyright notice, this list of conditions | 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 | 11 | and the following disclaimer in the documentation and/or other materials provided with the |
12 | distribution. | 12 | distribution. |
13 | * The name of the author may not be used to endorse or promote products derived from this software | 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. | 14 | without specific prior written permission. |
15 | 15 | ||
16 | THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, | 16 | THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, |
17 | BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | 17 | BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
18 | ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | 18 | ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
19 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | 19 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
20 | OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY | 20 | OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY |
21 | OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING | 21 | OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING |
22 | IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 22 | IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
23 | */ | 23 | */ |
24 | #endregion | 24 | #endregion |
25 | 25 | ||
26 | using System; | 26 | using System; |
27 | using System.Collections; | 27 | using System.Collections; |
28 | using System.Collections.Generic; | 28 | using System.Collections.Generic; |
29 | using System.Collections.Specialized; | 29 | using System.Collections.Specialized; |
30 | using System.IO; | 30 | using System.IO; |
31 | using System.Text; | 31 | using System.Text; |
32 | 32 | ||
33 | using Prebuild.Core.Attributes; | 33 | using Prebuild.Core.Attributes; |
34 | using Prebuild.Core.Interfaces; | 34 | using Prebuild.Core.Interfaces; |
35 | using Prebuild.Core.Nodes; | 35 | using Prebuild.Core.Nodes; |
36 | using Prebuild.Core.Utilities; | 36 | using Prebuild.Core.Utilities; |
37 | using System.CodeDom.Compiler; | 37 | using System.CodeDom.Compiler; |
38 | 38 | ||
39 | namespace Prebuild.Core.Targets | 39 | namespace Prebuild.Core.Targets |
40 | { | 40 | { |
41 | 41 | ||
42 | /// <summary> | 42 | /// <summary> |
43 | /// | 43 | /// |
44 | /// </summary> | 44 | /// </summary> |
45 | public abstract class VSGenericTarget : ITarget | 45 | public abstract class VSGenericTarget : ITarget |
46 | { | 46 | { |
47 | #region Fields | 47 | #region Fields |
48 | 48 | ||
49 | readonly Hashtable tools = new Hashtable(); | 49 | readonly Hashtable tools = new Hashtable(); |
50 | Kernel kernel; | 50 | Kernel kernel; |
51 | #endregion | 51 | #endregion |
52 | 52 | ||
53 | #region Properties | 53 | #region Properties |
54 | /// <summary> | 54 | /// <summary> |
55 | /// Gets or sets the solution version. | 55 | /// Gets or sets the solution version. |
56 | /// </summary> | 56 | /// </summary> |
57 | /// <value>The solution version.</value> | 57 | /// <value>The solution version.</value> |
58 | public abstract string SolutionVersion { get; } | 58 | public abstract string SolutionVersion { get; } |
59 | /// <summary> | 59 | /// <summary> |
60 | /// Gets or sets the product version. | 60 | /// Gets or sets the product version. |
61 | /// </summary> | 61 | /// </summary> |
62 | /// <value>The product version.</value> | 62 | /// <value>The product version.</value> |
63 | public abstract string ProductVersion { get; } | 63 | public abstract string ProductVersion { get; } |
64 | /// <summary> | 64 | /// <summary> |
65 | /// Gets or sets the schema version. | 65 | /// Gets or sets the schema version. |
66 | /// </summary> | 66 | /// </summary> |
67 | /// <value>The schema version.</value> | 67 | /// <value>The schema version.</value> |
68 | public abstract string SchemaVersion { get; } | 68 | public abstract string SchemaVersion { get; } |
69 | /// <summary> | 69 | /// <summary> |
70 | /// Gets or sets the name of the version. | 70 | /// Gets or sets the name of the version. |
71 | /// </summary> | 71 | /// </summary> |
72 | /// <value>The name of the version.</value> | 72 | /// <value>The name of the version.</value> |
73 | public abstract string VersionName { get; } | 73 | public abstract string VersionName { get; } |
74 | /// <summary> | 74 | /// <summary> |
75 | /// Gets or sets the version. | 75 | /// Gets or sets the version. |
76 | /// </summary> | 76 | /// </summary> |
77 | /// <value>The version.</value> | 77 | /// <value>The version.</value> |
78 | public abstract VSVersion Version { get; } | 78 | public abstract VSVersion Version { get; } |
79 | /// <summary> | 79 | /// <summary> |
80 | /// Gets the name. | 80 | /// Gets the name. |
81 | /// </summary> | 81 | /// </summary> |
82 | /// <value>The name.</value> | 82 | /// <value>The name.</value> |
83 | public abstract string Name { get; } | 83 | public abstract string Name { get; } |
84 | 84 | ||
85 | protected abstract string GetToolsVersionXml(FrameworkVersion version); | 85 | protected abstract string GetToolsVersionXml(FrameworkVersion version); |
86 | public abstract string SolutionTag { get; } | 86 | public abstract string SolutionTag { get; } |
87 | 87 | ||
88 | #endregion | 88 | #endregion |
89 | 89 | ||
90 | #region Constructors | 90 | #region Constructors |
91 | 91 | ||
92 | /// <summary> | 92 | /// <summary> |
93 | /// Initializes a new instance of the <see cref="VSGenericTarget"/> class. | 93 | /// Initializes a new instance of the <see cref="VSGenericTarget"/> class. |
94 | /// </summary> | 94 | /// </summary> |
95 | protected VSGenericTarget() | 95 | protected VSGenericTarget() |
96 | { | 96 | { |
97 | this.tools["C#"] = new ToolInfo("C#", "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}", "csproj", "CSHARP", "$(MSBuildBinPath)\\Microsoft.CSHARP.Targets"); | 97 | this.tools["C#"] = new ToolInfo("C#", "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}", "csproj", "CSHARP", "$(MSBuildBinPath)\\Microsoft.CSHARP.Targets"); |
98 | this.tools["Database"] = new ToolInfo("Database", "{4F174C21-8C12-11D0-8340-0000F80270F8}", "dbp", "UNKNOWN"); | 98 | this.tools["Database"] = new ToolInfo("Database", "{4F174C21-8C12-11D0-8340-0000F80270F8}", "dbp", "UNKNOWN"); |
99 | this.tools["Boo"] = new ToolInfo("Boo", "{45CEA7DC-C2ED-48A6-ACE0-E16144C02365}", "booproj", "Boo", "$(BooBinPath)\\Boo.Microsoft.Build.targets"); | 99 | this.tools["Boo"] = new ToolInfo("Boo", "{45CEA7DC-C2ED-48A6-ACE0-E16144C02365}", "booproj", "Boo", "$(BooBinPath)\\Boo.Microsoft.Build.targets"); |
100 | this.tools["VisualBasic"] = new ToolInfo("VisualBasic", "{F184B08F-C81C-45F6-A57F-5ABD9991F28F}", "vbproj", "VisualBasic", "$(MSBuildBinPath)\\Microsoft.VisualBasic.Targets"); | 100 | this.tools["VisualBasic"] = new ToolInfo("VisualBasic", "{F184B08F-C81C-45F6-A57F-5ABD9991F28F}", "vbproj", "VisualBasic", "$(MSBuildBinPath)\\Microsoft.VisualBasic.Targets"); |
101 | this.tools["Folder"] = new ToolInfo("Folder", "{2150E333-8FDC-42A3-9474-1A3956D46DE8}", null, null); | 101 | this.tools["Folder"] = new ToolInfo("Folder", "{2150E333-8FDC-42A3-9474-1A3956D46DE8}", null, null); |
102 | } | 102 | } |
103 | 103 | ||
104 | #endregion | 104 | #endregion |
105 | 105 | ||
106 | #region Private Methods | 106 | #region Private Methods |
107 | 107 | ||
108 | private string MakeRefPath(ProjectNode project) | 108 | private string MakeRefPath(ProjectNode project) |
109 | { | 109 | { |
110 | string ret = ""; | 110 | string ret = ""; |
111 | foreach (ReferencePathNode node in project.ReferencePaths) | 111 | foreach (ReferencePathNode node in project.ReferencePaths) |
112 | { | 112 | { |
113 | try | 113 | try |
114 | { | 114 | { |
115 | string fullPath = Helper.ResolvePath(node.Path); | 115 | string fullPath = Helper.ResolvePath(node.Path); |
116 | if (ret.Length < 1) | 116 | if (ret.Length < 1) |
117 | { | 117 | { |
118 | ret = fullPath; | 118 | ret = fullPath; |
119 | } | 119 | } |
120 | else | 120 | else |
121 | { | 121 | { |
122 | ret += ";" + fullPath; | 122 | ret += ";" + fullPath; |
123 | } | 123 | } |
124 | } | 124 | } |
125 | catch (ArgumentException) | 125 | catch (ArgumentException) |
126 | { | 126 | { |
127 | this.kernel.Log.Write(LogType.Warning, "Could not resolve reference path: {0}", node.Path); | 127 | this.kernel.Log.Write(LogType.Warning, "Could not resolve reference path: {0}", node.Path); |
128 | } | 128 | } |
129 | } | 129 | } |
130 | 130 | ||
131 | return ret; | 131 | return ret; |
132 | } | 132 | } |
133 | 133 | ||
134 | private static ProjectNode FindProjectInSolution(string name, SolutionNode solution) | 134 | private static ProjectNode FindProjectInSolution(string name, SolutionNode solution) |
135 | { | 135 | { |
136 | SolutionNode node = solution; | 136 | SolutionNode node = solution; |
137 | 137 | ||
138 | while (node.Parent is SolutionNode) | 138 | while (node.Parent is SolutionNode) |
139 | node = node.Parent as SolutionNode; | 139 | node = node.Parent as SolutionNode; |
140 | 140 | ||
141 | return FindProjectInSolutionRecursively(name, node); | 141 | return FindProjectInSolutionRecursively(name, node); |
142 | } | 142 | } |
143 | 143 | ||
144 | private static ProjectNode FindProjectInSolutionRecursively(string name, SolutionNode solution) | 144 | private static ProjectNode FindProjectInSolutionRecursively(string name, SolutionNode solution) |
145 | { | 145 | { |
146 | if (solution.ProjectsTable.ContainsKey(name)) | 146 | if (solution.ProjectsTable.ContainsKey(name)) |
147 | return (ProjectNode)solution.ProjectsTable[name]; | 147 | return (ProjectNode)solution.ProjectsTable[name]; |
148 | 148 | ||
149 | foreach (SolutionNode child in solution.Solutions) | 149 | foreach (SolutionNode child in solution.Solutions) |
150 | { | 150 | { |
151 | ProjectNode node = FindProjectInSolutionRecursively(name, child); | 151 | ProjectNode node = FindProjectInSolutionRecursively(name, child); |
152 | if (node != null) | 152 | if (node != null) |
153 | return node; | 153 | return node; |
154 | } | 154 | } |
155 | 155 | ||
156 | return null; | 156 | return null; |
157 | } | 157 | } |
158 | 158 | ||
159 | private void WriteProject(SolutionNode solution, ProjectNode project) | 159 | private void WriteProject(SolutionNode solution, ProjectNode project) |
160 | { | 160 | { |
161 | if (!tools.ContainsKey(project.Language)) | 161 | if (!tools.ContainsKey(project.Language)) |
162 | { | 162 | { |
163 | throw new UnknownLanguageException("Unknown .NET language: " + project.Language); | 163 | throw new UnknownLanguageException("Unknown .NET language: " + project.Language); |
164 | } | 164 | } |
165 | 165 | ||
166 | ToolInfo toolInfo = (ToolInfo)tools[project.Language]; | 166 | ToolInfo toolInfo = (ToolInfo)tools[project.Language]; |
167 | string projectFile = Helper.MakeFilePath(project.FullPath, project.Name, toolInfo.FileExtension); | 167 | string projectFile = Helper.MakeFilePath(project.FullPath, project.Name, toolInfo.FileExtension); |
168 | StreamWriter ps = new StreamWriter(projectFile); | 168 | StreamWriter ps = new StreamWriter(projectFile); |
169 | 169 | ||
170 | kernel.CurrentWorkingDirectory.Push(); | 170 | kernel.CurrentWorkingDirectory.Push(); |
171 | Helper.SetCurrentDir(Path.GetDirectoryName(projectFile)); | 171 | Helper.SetCurrentDir(Path.GetDirectoryName(projectFile)); |
172 | 172 | ||
173 | #region Project File | 173 | #region Project File |
174 | using (ps) | 174 | using (ps) |
175 | { | 175 | { |
176 | ps.WriteLine("<Project DefaultTargets=\"Build\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\" {0}>", GetToolsVersionXml(project.FrameworkVersion)); | 176 | ps.WriteLine("<Project DefaultTargets=\"Build\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\" {0}>", GetToolsVersionXml(project.FrameworkVersion)); |
177 | ps.WriteLine(" <PropertyGroup>"); | 177 | ps.WriteLine(" <PropertyGroup>"); |
178 | ps.WriteLine(" <ProjectType>Local</ProjectType>"); | 178 | ps.WriteLine(" <ProjectType>Local</ProjectType>"); |
179 | ps.WriteLine(" <ProductVersion>{0}</ProductVersion>", this.ProductVersion); | 179 | ps.WriteLine(" <ProductVersion>{0}</ProductVersion>", this.ProductVersion); |
180 | ps.WriteLine(" <SchemaVersion>{0}</SchemaVersion>", this.SchemaVersion); | 180 | ps.WriteLine(" <SchemaVersion>{0}</SchemaVersion>", this.SchemaVersion); |
181 | ps.WriteLine(" <ProjectGuid>{{{0}}}</ProjectGuid>", project.Guid.ToString().ToUpper()); | 181 | ps.WriteLine(" <ProjectGuid>{{{0}}}</ProjectGuid>", project.Guid.ToString().ToUpper()); |
182 | 182 | ||
183 | // Visual Studio has a hard coded guid for the project type | 183 | // Visual Studio has a hard coded guid for the project type |
184 | if (project.Type == ProjectType.Web) | 184 | if (project.Type == ProjectType.Web) |
185 | ps.WriteLine(" <ProjectTypeGuids>{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>"); | 185 | ps.WriteLine(" <ProjectTypeGuids>{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>"); |
186 | ps.WriteLine(" <Configuration Condition=\" '$(Configuration)' == '' \">Debug</Configuration>"); | 186 | ps.WriteLine(" <Configuration Condition=\" '$(Configuration)' == '' \">Debug</Configuration>"); |
187 | ps.WriteLine(" <Platform Condition=\" '$(Platform)' == '' \">AnyCPU</Platform>"); | 187 | ps.WriteLine(" <Platform Condition=\" '$(Platform)' == '' \">AnyCPU</Platform>"); |
188 | ps.WriteLine(" <ApplicationIcon>{0}</ApplicationIcon>", project.AppIcon); | 188 | ps.WriteLine(" <ApplicationIcon>{0}</ApplicationIcon>", project.AppIcon); |
189 | ps.WriteLine(" <AssemblyKeyContainerName>"); | 189 | ps.WriteLine(" <AssemblyKeyContainerName>"); |
190 | ps.WriteLine(" </AssemblyKeyContainerName>"); | 190 | ps.WriteLine(" </AssemblyKeyContainerName>"); |
191 | ps.WriteLine(" <AssemblyName>{0}</AssemblyName>", project.AssemblyName); | 191 | ps.WriteLine(" <AssemblyName>{0}</AssemblyName>", project.AssemblyName); |
192 | foreach (ConfigurationNode conf in project.Configurations) | 192 | foreach (ConfigurationNode conf in project.Configurations) |
193 | { | 193 | { |
194 | if (conf.Options.KeyFile != "") | 194 | if (conf.Options.KeyFile != "") |
195 | { | 195 | { |
196 | ps.WriteLine(" <AssemblyOriginatorKeyFile>{0}</AssemblyOriginatorKeyFile>", conf.Options.KeyFile); | 196 | ps.WriteLine(" <AssemblyOriginatorKeyFile>{0}</AssemblyOriginatorKeyFile>", conf.Options.KeyFile); |
197 | ps.WriteLine(" <SignAssembly>true</SignAssembly>"); | 197 | ps.WriteLine(" <SignAssembly>true</SignAssembly>"); |
198 | break; | 198 | break; |
199 | } | 199 | } |
200 | } | 200 | } |
201 | ps.WriteLine(" <DefaultClientScript>JScript</DefaultClientScript>"); | 201 | ps.WriteLine(" <DefaultClientScript>JScript</DefaultClientScript>"); |
202 | ps.WriteLine(" <DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout>"); | 202 | ps.WriteLine(" <DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout>"); |
203 | ps.WriteLine(" <DefaultTargetSchema>IE50</DefaultTargetSchema>"); | 203 | ps.WriteLine(" <DefaultTargetSchema>IE50</DefaultTargetSchema>"); |
204 | ps.WriteLine(" <DelaySign>false</DelaySign>"); | 204 | ps.WriteLine(" <DelaySign>false</DelaySign>"); |
205 | ps.WriteLine(" <TargetFrameworkVersion>{0}</TargetFrameworkVersion>", project.FrameworkVersion.ToString().Replace("_", ".")); | 205 | ps.WriteLine(" <TargetFrameworkVersion>{0}</TargetFrameworkVersion>", project.FrameworkVersion.ToString().Replace("_", ".")); |
206 | 206 | ||
207 | ps.WriteLine(" <OutputType>{0}</OutputType>", project.Type == ProjectType.Web ? ProjectType.Library.ToString() : project.Type.ToString()); | 207 | ps.WriteLine(" <OutputType>{0}</OutputType>", project.Type == ProjectType.Web ? ProjectType.Library.ToString() : project.Type.ToString()); |
208 | ps.WriteLine(" <AppDesignerFolder>{0}</AppDesignerFolder>", project.DesignerFolder); | 208 | ps.WriteLine(" <AppDesignerFolder>{0}</AppDesignerFolder>", project.DesignerFolder); |
209 | ps.WriteLine(" <RootNamespace>{0}</RootNamespace>", project.RootNamespace); | 209 | ps.WriteLine(" <RootNamespace>{0}</RootNamespace>", project.RootNamespace); |
210 | ps.WriteLine(" <StartupObject>{0}</StartupObject>", project.StartupObject); | 210 | ps.WriteLine(" <StartupObject>{0}</StartupObject>", project.StartupObject); |
211 | if (string.IsNullOrEmpty(project.DebugStartParameters)) | 211 | if (string.IsNullOrEmpty(project.DebugStartParameters)) |
212 | { | 212 | { |
213 | ps.WriteLine(" <StartArguments>{0}</StartArguments>", project.DebugStartParameters); | 213 | ps.WriteLine(" <StartArguments>{0}</StartArguments>", project.DebugStartParameters); |
214 | } | 214 | } |
215 | ps.WriteLine(" <FileUpgradeFlags>"); | 215 | ps.WriteLine(" <FileUpgradeFlags>"); |
216 | ps.WriteLine(" </FileUpgradeFlags>"); | 216 | ps.WriteLine(" </FileUpgradeFlags>"); |
217 | 217 | ||
218 | ps.WriteLine(" </PropertyGroup>"); | 218 | ps.WriteLine(" </PropertyGroup>"); |
219 | 219 | ||
220 | foreach (ConfigurationNode conf in project.Configurations) | 220 | foreach (ConfigurationNode conf in project.Configurations) |
221 | { | 221 | { |
222 | ps.Write(" <PropertyGroup "); | 222 | ps.Write(" <PropertyGroup "); |
223 | ps.WriteLine("Condition=\" '$(Configuration)|$(Platform)' == '{0}|AnyCPU' \">", conf.Name); | 223 | ps.WriteLine("Condition=\" '$(Configuration)|$(Platform)' == '{0}|AnyCPU' \">", conf.Name); |
224 | ps.WriteLine(" <AllowUnsafeBlocks>{0}</AllowUnsafeBlocks>", conf.Options["AllowUnsafe"]); | 224 | ps.WriteLine(" <AllowUnsafeBlocks>{0}</AllowUnsafeBlocks>", conf.Options["AllowUnsafe"]); |
225 | ps.WriteLine(" <BaseAddress>{0}</BaseAddress>", conf.Options["BaseAddress"]); | 225 | ps.WriteLine(" <BaseAddress>{0}</BaseAddress>", conf.Options["BaseAddress"]); |
226 | ps.WriteLine(" <CheckForOverflowUnderflow>{0}</CheckForOverflowUnderflow>", conf.Options["CheckUnderflowOverflow"]); | 226 | ps.WriteLine(" <CheckForOverflowUnderflow>{0}</CheckForOverflowUnderflow>", conf.Options["CheckUnderflowOverflow"]); |
227 | ps.WriteLine(" <ConfigurationOverrideFile>"); | 227 | ps.WriteLine(" <ConfigurationOverrideFile>"); |
228 | ps.WriteLine(" </ConfigurationOverrideFile>"); | 228 | ps.WriteLine(" </ConfigurationOverrideFile>"); |
229 | ps.WriteLine(" <DefineConstants>{0}</DefineConstants>", conf.Options["CompilerDefines"]); | 229 | ps.WriteLine(" <DefineConstants>{0}</DefineConstants>", conf.Options["CompilerDefines"]); |
230 | ps.WriteLine(" <DocumentationFile>{0}</DocumentationFile>", Helper.NormalizePath(conf.Options["XmlDocFile"].ToString())); | 230 | ps.WriteLine(" <DocumentationFile>{0}</DocumentationFile>", Helper.NormalizePath(conf.Options["XmlDocFile"].ToString())); |
231 | ps.WriteLine(" <DebugSymbols>{0}</DebugSymbols>", conf.Options["DebugInformation"]); | 231 | ps.WriteLine(" <DebugSymbols>{0}</DebugSymbols>", conf.Options["DebugInformation"]); |
232 | ps.WriteLine(" <FileAlignment>{0}</FileAlignment>", conf.Options["FileAlignment"]); | 232 | ps.WriteLine(" <FileAlignment>{0}</FileAlignment>", conf.Options["FileAlignment"]); |
233 | ps.WriteLine(" <Optimize>{0}</Optimize>", conf.Options["OptimizeCode"]); | 233 | ps.WriteLine(" <Optimize>{0}</Optimize>", conf.Options["OptimizeCode"]); |
234 | if (project.Type != ProjectType.Web) | 234 | if (project.Type != ProjectType.Web) |
235 | ps.WriteLine(" <OutputPath>{0}</OutputPath>", | 235 | ps.WriteLine(" <OutputPath>{0}</OutputPath>", |
236 | Helper.EndPath(Helper.NormalizePath(conf.Options["OutputPath"].ToString()))); | 236 | Helper.EndPath(Helper.NormalizePath(conf.Options["OutputPath"].ToString()))); |
237 | else | 237 | else |
238 | ps.WriteLine(" <OutputPath>{0}</OutputPath>", | 238 | ps.WriteLine(" <OutputPath>{0}</OutputPath>", |
239 | Helper.EndPath(Helper.NormalizePath("bin\\"))); | 239 | Helper.EndPath(Helper.NormalizePath("bin\\"))); |
240 | 240 | ||
241 | ps.WriteLine(" <RegisterForComInterop>{0}</RegisterForComInterop>", conf.Options["RegisterComInterop"]); | 241 | ps.WriteLine(" <RegisterForComInterop>{0}</RegisterForComInterop>", conf.Options["RegisterComInterop"]); |
242 | ps.WriteLine(" <RemoveIntegerChecks>{0}</RemoveIntegerChecks>", conf.Options["RemoveIntegerChecks"]); | 242 | ps.WriteLine(" <RemoveIntegerChecks>{0}</RemoveIntegerChecks>", conf.Options["RemoveIntegerChecks"]); |
243 | ps.WriteLine(" <TreatWarningsAsErrors>{0}</TreatWarningsAsErrors>", conf.Options["WarningsAsErrors"]); | 243 | ps.WriteLine(" <TreatWarningsAsErrors>{0}</TreatWarningsAsErrors>", conf.Options["WarningsAsErrors"]); |
244 | ps.WriteLine(" <WarningLevel>{0}</WarningLevel>", conf.Options["WarningLevel"]); | 244 | ps.WriteLine(" <WarningLevel>{0}</WarningLevel>", conf.Options["WarningLevel"]); |
245 | ps.WriteLine(" <NoStdLib>{0}</NoStdLib>", conf.Options["NoStdLib"]); | 245 | ps.WriteLine(" <NoStdLib>{0}</NoStdLib>", conf.Options["NoStdLib"]); |
246 | ps.WriteLine(" <NoWarn>{0}</NoWarn>", conf.Options["SuppressWarnings"]); | 246 | ps.WriteLine(" <NoWarn>{0}</NoWarn>", conf.Options["SuppressWarnings"]); |
247 | ps.WriteLine(" </PropertyGroup>"); | 247 | ps.WriteLine(" </PropertyGroup>"); |
248 | } | 248 | } |
249 | 249 | ||
250 | //ps.WriteLine(" </Settings>"); | 250 | //ps.WriteLine(" </Settings>"); |
251 | 251 | ||
252 | List<ProjectNode> projectReferences = new List<ProjectNode>(); | 252 | List<ProjectNode> projectReferences = new List<ProjectNode>(); |
253 | List<ReferenceNode> otherReferences = new List<ReferenceNode>(); | 253 | List<ReferenceNode> otherReferences = new List<ReferenceNode>(); |
254 | 254 | ||
255 | foreach (ReferenceNode refr in project.References) | 255 | foreach (ReferenceNode refr in project.References) |
256 | { | 256 | { |
257 | ProjectNode projectNode = FindProjectInSolution(refr.Name, solution); | 257 | ProjectNode projectNode = FindProjectInSolution(refr.Name, solution); |
258 | 258 | ||
259 | if (projectNode == null) | 259 | if (projectNode == null) |
260 | otherReferences.Add(refr); | 260 | otherReferences.Add(refr); |
261 | else | 261 | else |
262 | projectReferences.Add(projectNode); | 262 | projectReferences.Add(projectNode); |
263 | } | 263 | } |
264 | // Assembly References | 264 | // Assembly References |
265 | ps.WriteLine(" <ItemGroup>"); | 265 | ps.WriteLine(" <ItemGroup>"); |
266 | 266 | ||
267 | foreach (ReferenceNode refr in otherReferences) | 267 | foreach (ReferenceNode refr in otherReferences) |
268 | { | 268 | { |
269 | ps.Write(" <Reference"); | 269 | ps.Write(" <Reference"); |
270 | ps.Write(" Include=\""); | 270 | ps.Write(" Include=\""); |
271 | ps.Write(refr.Name); | 271 | ps.Write(refr.Name); |
272 | ps.WriteLine("\" >"); | 272 | ps.WriteLine("\" >"); |
273 | ps.Write(" <Name>"); | 273 | ps.Write(" <Name>"); |
274 | ps.Write(refr.Name); | 274 | ps.Write(refr.Name); |
275 | ps.WriteLine("</Name>"); | 275 | ps.WriteLine("</Name>"); |
276 | // TODO: Allow reference to *.exe files | 276 | // TODO: Allow reference to *.exe files |
277 | ps.WriteLine(" <Private>{0}</Private>", refr.LocalCopy); | 277 | ps.WriteLine(" <Private>{0}</Private>", refr.LocalCopy); |
278 | ps.WriteLine(" </Reference>"); | 278 | ps.WriteLine(" </Reference>"); |
279 | } | 279 | } |
280 | ps.WriteLine(" </ItemGroup>"); | 280 | ps.WriteLine(" </ItemGroup>"); |
281 | 281 | ||
282 | //Project References | 282 | //Project References |
283 | ps.WriteLine(" <ItemGroup>"); | 283 | ps.WriteLine(" <ItemGroup>"); |
284 | foreach (ProjectNode projectReference in projectReferences) | 284 | foreach (ProjectNode projectReference in projectReferences) |
285 | { | 285 | { |
286 | ToolInfo tool = (ToolInfo)tools[projectReference.Language]; | 286 | ToolInfo tool = (ToolInfo)tools[projectReference.Language]; |
287 | if (tools == null) | 287 | if (tools == null) |
288 | throw new UnknownLanguageException(); | 288 | throw new UnknownLanguageException(); |
289 | 289 | ||
290 | string path = | 290 | string path = |
291 | Helper.MakePathRelativeTo(project.FullPath, | 291 | Helper.MakePathRelativeTo(project.FullPath, |
292 | Helper.MakeFilePath(projectReference.FullPath, projectReference.Name, tool.FileExtension)); | 292 | Helper.MakeFilePath(projectReference.FullPath, projectReference.Name, tool.FileExtension)); |
293 | ps.WriteLine(" <ProjectReference Include=\"{0}\">", path); | 293 | ps.WriteLine(" <ProjectReference Include=\"{0}\">", path); |
294 | 294 | ||
295 | // TODO: Allow reference to visual basic projects | 295 | // TODO: Allow reference to visual basic projects |
296 | ps.WriteLine(" <Name>{0}</Name>", projectReference.Name); | 296 | ps.WriteLine(" <Name>{0}</Name>", projectReference.Name); |
297 | ps.WriteLine(" <Project>{0}</Project>", projectReference.Guid.ToString("B").ToUpper()); | 297 | ps.WriteLine(" <Project>{0}</Project>", projectReference.Guid.ToString("B").ToUpper()); |
298 | ps.WriteLine(" <Package>{0}</Package>", tool.Guid.ToUpper()); | 298 | ps.WriteLine(" <Package>{0}</Package>", tool.Guid.ToUpper()); |
299 | 299 | ||
300 | ps.WriteLine(" <Private>False</Private>" ); | 300 | ps.WriteLine(" <Private>False</Private>" ); |
301 | 301 | ||
302 | ps.WriteLine(" </ProjectReference>"); | 302 | ps.WriteLine(" </ProjectReference>"); |
303 | } | 303 | } |
304 | ps.WriteLine(" </ItemGroup>"); | 304 | ps.WriteLine(" </ItemGroup>"); |
305 | 305 | ||
306 | // ps.WriteLine(" </Build>"); | 306 | // ps.WriteLine(" </Build>"); |
307 | ps.WriteLine(" <ItemGroup>"); | 307 | ps.WriteLine(" <ItemGroup>"); |
308 | 308 | ||
309 | // ps.WriteLine(" <Include>"); | 309 | // ps.WriteLine(" <Include>"); |
310 | List<string> list = new List<string>(); | 310 | List<string> list = new List<string>(); |
311 | 311 | ||
312 | foreach (string path in project.Files) | 312 | foreach (string path in project.Files) |
313 | { | 313 | { |
314 | string lower = path.ToLower(); | 314 | string lower = path.ToLower(); |
315 | if (lower.EndsWith(".resx")) | 315 | if (lower.EndsWith(".resx")) |
316 | { | 316 | { |
317 | string codebehind = String.Format("{0}.Designer{1}", path.Substring(0, path.LastIndexOf('.')), toolInfo.LanguageExtension); | 317 | string codebehind = String.Format("{0}.Designer{1}", path.Substring(0, path.LastIndexOf('.')), toolInfo.LanguageExtension); |
318 | if (!list.Contains(codebehind)) | 318 | if (!list.Contains(codebehind)) |
319 | list.Add(codebehind); | 319 | list.Add(codebehind); |
320 | } | 320 | } |
321 | } | 321 | } |
322 | 322 | ||
323 | foreach (string file in project.Files) | 323 | foreach (string file in project.Files) |
324 | { | 324 | { |
325 | // if (file == "Properties\\Bind.Designer.cs") | 325 | // if (file == "Properties\\Bind.Designer.cs") |
326 | // { | 326 | // { |
327 | // Console.WriteLine("Wait a minute!"); | 327 | // Console.WriteLine("Wait a minute!"); |
328 | // Console.WriteLine(project.Files.GetSubType(file).ToString()); | 328 | // Console.WriteLine(project.Files.GetSubType(file).ToString()); |
329 | // } | 329 | // } |
330 | 330 | ||
331 | SubType subType = project.Files.GetSubType(file); | 331 | SubType subType = project.Files.GetSubType(file); |
332 | 332 | ||
333 | if (subType != SubType.Code && subType != SubType.Settings && subType != SubType.Designer | 333 | if (subType != SubType.Code && subType != SubType.Settings && subType != SubType.Designer |
334 | && subType != SubType.CodeBehind) | 334 | && subType != SubType.CodeBehind) |
335 | { | 335 | { |
336 | ps.WriteLine(" <EmbeddedResource Include=\"{0}\">", file.Substring(0, file.LastIndexOf('.')) + ".resx"); | 336 | ps.WriteLine(" <EmbeddedResource Include=\"{0}\">", file.Substring(0, file.LastIndexOf('.')) + ".resx"); |
337 | ps.WriteLine(" <DependentUpon>{0}</DependentUpon>", Path.GetFileName(file)); | 337 | ps.WriteLine(" <DependentUpon>{0}</DependentUpon>", Path.GetFileName(file)); |
338 | ps.WriteLine(" <SubType>Designer</SubType>"); | 338 | ps.WriteLine(" <SubType>Designer</SubType>"); |
339 | ps.WriteLine(" </EmbeddedResource>"); | 339 | ps.WriteLine(" </EmbeddedResource>"); |
340 | // | 340 | // |
341 | } | 341 | } |
342 | 342 | ||
343 | if (subType == SubType.Designer) | 343 | if (subType == SubType.Designer) |
344 | { | 344 | { |
345 | ps.WriteLine(" <EmbeddedResource Include=\"{0}\">", file); | 345 | ps.WriteLine(" <EmbeddedResource Include=\"{0}\">", file); |
346 | ps.WriteLine(" <SubType>" + subType + "</SubType>"); | 346 | ps.WriteLine(" <SubType>" + subType + "</SubType>"); |
347 | ps.WriteLine(" <Generator>ResXFileCodeGenerator</Generator>"); | 347 | ps.WriteLine(" <Generator>ResXFileCodeGenerator</Generator>"); |
348 | 348 | ||
349 | string autogen_name = file.Substring(0, file.LastIndexOf('.')) + ".Designer.cs"; | 349 | string autogen_name = file.Substring(0, file.LastIndexOf('.')) + ".Designer.cs"; |
350 | string dependent_name = file.Substring(0, file.LastIndexOf('.')) + ".cs"; | 350 | string dependent_name = file.Substring(0, file.LastIndexOf('.')) + ".cs"; |
351 | 351 | ||
352 | ps.WriteLine(" <LastGenOutput>{0}</LastGenOutput>", autogen_name); | 352 | ps.WriteLine(" <LastGenOutput>{0}</LastGenOutput>", autogen_name); |
353 | 353 | ||
354 | // Check for a parent .cs file with the same name as this designer file | 354 | // Check for a parent .cs file with the same name as this designer file |
355 | if (File.Exists(dependent_name)) | 355 | if (File.Exists(dependent_name)) |
356 | ps.WriteLine(" <DependentUpon>{0}</DependentUpon>", Path.GetFileName(dependent_name)); | 356 | ps.WriteLine(" <DependentUpon>{0}</DependentUpon>", Path.GetFileName(dependent_name)); |
357 | 357 | ||
358 | ps.WriteLine(" </EmbeddedResource>"); | 358 | ps.WriteLine(" </EmbeddedResource>"); |
359 | if (File.Exists(autogen_name)) | 359 | if (File.Exists(autogen_name)) |
360 | { | 360 | { |
361 | ps.WriteLine(" <Compile Include=\"{0}\">", autogen_name); | 361 | ps.WriteLine(" <Compile Include=\"{0}\">", autogen_name); |
362 | ps.WriteLine(" <AutoGen>True</AutoGen>"); | 362 | ps.WriteLine(" <AutoGen>True</AutoGen>"); |
363 | ps.WriteLine(" <DesignTime>True</DesignTime>"); | 363 | ps.WriteLine(" <DesignTime>True</DesignTime>"); |
364 | 364 | ||
365 | // If a parent .cs file exists, link this autogen file to it. Otherwise link | 365 | // If a parent .cs file exists, link this autogen file to it. Otherwise link |
366 | // to the designer file | 366 | // to the designer file |
367 | if (File.Exists(dependent_name)) | 367 | if (File.Exists(dependent_name)) |
368 | ps.WriteLine(" <DependentUpon>{0}</DependentUpon>", Path.GetFileName(dependent_name)); | 368 | ps.WriteLine(" <DependentUpon>{0}</DependentUpon>", Path.GetFileName(dependent_name)); |
369 | else | 369 | else |
370 | ps.WriteLine(" <DependentUpon>{0}</DependentUpon>", Path.GetFileName(file)); | 370 | ps.WriteLine(" <DependentUpon>{0}</DependentUpon>", Path.GetFileName(file)); |
371 | 371 | ||
372 | ps.WriteLine(" </Compile>"); | 372 | ps.WriteLine(" </Compile>"); |
373 | } | 373 | } |
374 | list.Add(autogen_name); | 374 | list.Add(autogen_name); |
375 | } | 375 | } |
376 | if (subType == SubType.Settings) | 376 | if (subType == SubType.Settings) |
377 | { | 377 | { |
378 | ps.Write(" <{0} ", project.Files.GetBuildAction(file)); | 378 | ps.Write(" <{0} ", project.Files.GetBuildAction(file)); |
379 | ps.WriteLine("Include=\"{0}\">", file); | 379 | ps.WriteLine("Include=\"{0}\">", file); |
380 | string fileName = Path.GetFileName(file); | 380 | string fileName = Path.GetFileName(file); |
381 | if (project.Files.GetBuildAction(file) == BuildAction.None) | 381 | if (project.Files.GetBuildAction(file) == BuildAction.None) |
382 | { | 382 | { |
383 | ps.WriteLine(" <Generator>SettingsSingleFileGenerator</Generator>"); | 383 | ps.WriteLine(" <Generator>SettingsSingleFileGenerator</Generator>"); |
384 | ps.WriteLine(" <LastGenOutput>{0}</LastGenOutput>", fileName.Substring(0, fileName.LastIndexOf('.')) + ".Designer.cs"); | 384 | ps.WriteLine(" <LastGenOutput>{0}</LastGenOutput>", fileName.Substring(0, fileName.LastIndexOf('.')) + ".Designer.cs"); |
385 | } | 385 | } |
386 | else | 386 | else |
387 | { | 387 | { |
388 | ps.WriteLine(" <SubType>Code</SubType>"); | 388 | ps.WriteLine(" <SubType>Code</SubType>"); |
389 | ps.WriteLine(" <AutoGen>True</AutoGen>"); | 389 | ps.WriteLine(" <AutoGen>True</AutoGen>"); |
390 | ps.WriteLine(" <DesignTimeSharedInput>True</DesignTimeSharedInput>"); | 390 | ps.WriteLine(" <DesignTimeSharedInput>True</DesignTimeSharedInput>"); |
391 | string fileNameShort = fileName.Substring(0, fileName.LastIndexOf('.')); | 391 | string fileNameShort = fileName.Substring(0, fileName.LastIndexOf('.')); |
392 | string fileNameShorter = fileNameShort.Substring(0, fileNameShort.LastIndexOf('.')); | 392 | string fileNameShorter = fileNameShort.Substring(0, fileNameShort.LastIndexOf('.')); |
393 | ps.WriteLine(" <DependentUpon>{0}</DependentUpon>", Path.GetFileName(fileNameShorter + ".settings")); | 393 | ps.WriteLine(" <DependentUpon>{0}</DependentUpon>", Path.GetFileName(fileNameShorter + ".settings")); |
394 | } | 394 | } |
395 | ps.WriteLine(" </{0}>", project.Files.GetBuildAction(file)); | 395 | ps.WriteLine(" </{0}>", project.Files.GetBuildAction(file)); |
396 | } | 396 | } |
397 | else if (subType != SubType.Designer) | 397 | else if (subType != SubType.Designer) |
398 | { | 398 | { |
399 | string path = Helper.NormalizePath(file); | 399 | string path = Helper.NormalizePath(file); |
400 | string path_lower = path.ToLower(); | 400 | string path_lower = path.ToLower(); |
401 | 401 | ||
402 | if (!list.Contains(file)) | 402 | if (!list.Contains(file)) |
403 | { | 403 | { |
404 | ps.Write(" <{0} ", project.Files.GetBuildAction(path)); | 404 | ps.Write(" <{0} ", project.Files.GetBuildAction(path)); |
405 | 405 | ||
406 | int startPos = 0; | 406 | int startPos = 0; |
407 | if (project.Files.GetPreservePath(file)) | 407 | if (project.Files.GetPreservePath(file)) |
408 | { | 408 | { |
409 | while ((@"./\").IndexOf(file.Substring(startPos, 1)) != -1) | 409 | while ((@"./\").IndexOf(file.Substring(startPos, 1)) != -1) |
410 | startPos++; | 410 | startPos++; |
411 | 411 | ||
412 | } | 412 | } |
413 | else | 413 | else |
414 | { | 414 | { |
415 | startPos = file.LastIndexOf(Path.GetFileName(path)); | 415 | startPos = file.LastIndexOf(Path.GetFileName(path)); |
416 | } | 416 | } |
417 | 417 | ||
418 | ps.WriteLine("Include=\"{0}\">", path); | 418 | ps.WriteLine("Include=\"{0}\">", path); |
419 | 419 | ||
420 | int last_period_index = file.LastIndexOf('.'); | 420 | int last_period_index = file.LastIndexOf('.'); |
421 | string short_file_name = file.Substring(0, last_period_index); | 421 | string short_file_name = file.Substring(0, last_period_index); |
422 | string extension = Path.GetExtension(path); | 422 | string extension = Path.GetExtension(path); |
423 | string designer_format = string.Format(".designer{0}", extension); | 423 | string designer_format = string.Format(".designer{0}", extension); |
424 | 424 | ||
425 | if (path_lower.EndsWith(designer_format)) | 425 | if (path_lower.EndsWith(designer_format)) |
426 | { | 426 | { |
427 | int designer_index = path_lower.IndexOf(designer_format); | 427 | int designer_index = path_lower.IndexOf(designer_format); |
428 | string file_name = path.Substring(0, designer_index); | 428 | string file_name = path.Substring(0, designer_index); |
429 | 429 | ||
430 | if (File.Exists(file_name)) | 430 | if (File.Exists(file_name)) |
431 | ps.WriteLine(" <DependentUpon>{0}</DependentUpon>", Path.GetFileName(file_name)); | 431 | ps.WriteLine(" <DependentUpon>{0}</DependentUpon>", Path.GetFileName(file_name)); |
432 | else if (File.Exists(file_name + ".resx")) | 432 | else if (File.Exists(file_name + ".resx")) |
433 | ps.WriteLine(" <DependentUpon>{0}</DependentUpon>", Path.GetFileName(file_name + ".resx")); | 433 | ps.WriteLine(" <DependentUpon>{0}</DependentUpon>", Path.GetFileName(file_name + ".resx")); |
434 | } | 434 | } |
435 | else if (subType == SubType.CodeBehind) | 435 | else if (subType == SubType.CodeBehind) |
436 | { | 436 | { |
437 | ps.WriteLine(" <DependentUpon>{0}</DependentUpon>", Path.GetFileName(short_file_name)); | 437 | ps.WriteLine(" <DependentUpon>{0}</DependentUpon>", Path.GetFileName(short_file_name)); |
438 | } | 438 | } |
439 | if (project.Files.GetIsLink(file)) | 439 | if (project.Files.GetIsLink(file)) |
440 | { | 440 | { |
441 | string alias = project.Files.GetLinkPath(file); | 441 | string alias = project.Files.GetLinkPath(file); |
442 | alias += file.Substring(startPos); | 442 | alias += file.Substring(startPos); |
443 | alias = Helper.NormalizePath(alias); | 443 | alias = Helper.NormalizePath(alias); |
444 | ps.WriteLine(" <Link>{0}</Link>", alias); | 444 | ps.WriteLine(" <Link>{0}</Link>", alias); |
445 | } | 445 | } |
446 | else if (project.Files.GetBuildAction(file) != BuildAction.None) | 446 | else if (project.Files.GetBuildAction(file) != BuildAction.None) |
447 | { | 447 | { |
448 | if (project.Files.GetBuildAction(file) != BuildAction.EmbeddedResource) | 448 | if (project.Files.GetBuildAction(file) != BuildAction.EmbeddedResource) |
449 | { | 449 | { |
450 | ps.WriteLine(" <SubType>{0}</SubType>", subType); | 450 | ps.WriteLine(" <SubType>{0}</SubType>", subType); |
451 | } | 451 | } |
452 | } | 452 | } |
453 | 453 | ||
454 | if (project.Files.GetCopyToOutput(file) != CopyToOutput.Never) | 454 | if (project.Files.GetCopyToOutput(file) != CopyToOutput.Never) |
455 | { | 455 | { |
456 | ps.WriteLine(" <CopyToOutputDirectory>{0}</CopyToOutputDirectory>", project.Files.GetCopyToOutput(file)); | 456 | ps.WriteLine(" <CopyToOutputDirectory>{0}</CopyToOutputDirectory>", project.Files.GetCopyToOutput(file)); |
457 | } | 457 | } |
458 | 458 | ||
459 | ps.WriteLine(" </{0}>", project.Files.GetBuildAction(file)); | 459 | ps.WriteLine(" </{0}>", project.Files.GetBuildAction(file)); |
460 | } | 460 | } |
461 | } | 461 | } |
462 | } | 462 | } |
463 | 463 | ||
464 | ps.WriteLine(" </ItemGroup>"); | 464 | ps.WriteLine(" </ItemGroup>"); |
465 | ps.WriteLine(" <Import Project=\"" + toolInfo.ImportProject + "\" />"); | 465 | ps.WriteLine(" <Import Project=\"" + toolInfo.ImportProject + "\" />"); |
466 | ps.WriteLine(" <PropertyGroup>"); | 466 | ps.WriteLine(" <PropertyGroup>"); |
467 | ps.WriteLine(" <PreBuildEvent>"); | 467 | ps.WriteLine(" <PreBuildEvent>"); |
468 | ps.WriteLine(" </PreBuildEvent>"); | 468 | ps.WriteLine(" </PreBuildEvent>"); |
469 | ps.WriteLine(" <PostBuildEvent>"); | 469 | ps.WriteLine(" <PostBuildEvent>"); |
470 | ps.WriteLine(" </PostBuildEvent>"); | 470 | ps.WriteLine(" </PostBuildEvent>"); |
471 | ps.WriteLine(" </PropertyGroup>"); | 471 | ps.WriteLine(" </PropertyGroup>"); |
472 | ps.WriteLine("</Project>"); | 472 | ps.WriteLine("</Project>"); |
473 | } | 473 | } |
474 | #endregion | 474 | #endregion |
475 | 475 | ||
476 | #region User File | 476 | #region User File |
477 | 477 | ||
478 | ps = new StreamWriter(projectFile + ".user"); | 478 | ps = new StreamWriter(projectFile + ".user"); |
479 | using (ps) | 479 | using (ps) |
480 | { | 480 | { |
481 | ps.WriteLine("<Project xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">"); | 481 | ps.WriteLine("<Project xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">"); |
482 | //ps.WriteLine( "<VisualStudioProject>" ); | 482 | //ps.WriteLine( "<VisualStudioProject>" ); |
483 | //ps.WriteLine(" <{0}>", toolInfo.XMLTag); | 483 | //ps.WriteLine(" <{0}>", toolInfo.XMLTag); |
484 | //ps.WriteLine(" <Build>"); | 484 | //ps.WriteLine(" <Build>"); |
485 | ps.WriteLine(" <PropertyGroup>"); | 485 | ps.WriteLine(" <PropertyGroup>"); |
486 | //ps.WriteLine(" <Settings ReferencePath=\"{0}\">", MakeRefPath(project)); | 486 | //ps.WriteLine(" <Settings ReferencePath=\"{0}\">", MakeRefPath(project)); |
487 | ps.WriteLine(" <Configuration Condition=\" '$(Configuration)' == '' \">Debug</Configuration>"); | 487 | ps.WriteLine(" <Configuration Condition=\" '$(Configuration)' == '' \">Debug</Configuration>"); |
488 | ps.WriteLine(" <Platform Condition=\" '$(Platform)' == '' \">AnyCPU</Platform>"); | 488 | ps.WriteLine(" <Platform Condition=\" '$(Platform)' == '' \">AnyCPU</Platform>"); |
489 | ps.WriteLine(" <ReferencePath>{0}</ReferencePath>", MakeRefPath(project)); | 489 | ps.WriteLine(" <ReferencePath>{0}</ReferencePath>", MakeRefPath(project)); |
490 | ps.WriteLine(" <LastOpenVersion>{0}</LastOpenVersion>", this.ProductVersion); | 490 | ps.WriteLine(" <LastOpenVersion>{0}</LastOpenVersion>", this.ProductVersion); |
491 | ps.WriteLine(" <ProjectView>ProjectFiles</ProjectView>"); | 491 | ps.WriteLine(" <ProjectView>ProjectFiles</ProjectView>"); |
492 | ps.WriteLine(" <ProjectTrust>0</ProjectTrust>"); | 492 | ps.WriteLine(" <ProjectTrust>0</ProjectTrust>"); |
493 | ps.WriteLine(" </PropertyGroup>"); | 493 | ps.WriteLine(" </PropertyGroup>"); |
494 | foreach (ConfigurationNode conf in project.Configurations) | 494 | foreach (ConfigurationNode conf in project.Configurations) |
495 | { | 495 | { |
496 | ps.Write(" <PropertyGroup"); | 496 | ps.Write(" <PropertyGroup"); |
497 | ps.Write(" Condition = \" '$(Configuration)|$(Platform)' == '{0}|AnyCPU' \"", conf.Name); | 497 | ps.Write(" Condition = \" '$(Configuration)|$(Platform)' == '{0}|AnyCPU' \"", conf.Name); |
498 | ps.WriteLine(" />"); | 498 | ps.WriteLine(" />"); |
499 | } | 499 | } |
500 | ps.WriteLine("</Project>"); | 500 | ps.WriteLine("</Project>"); |
501 | } | 501 | } |
502 | #endregion | 502 | #endregion |
503 | 503 | ||
504 | kernel.CurrentWorkingDirectory.Pop(); | 504 | kernel.CurrentWorkingDirectory.Pop(); |
505 | } | 505 | } |
506 | 506 | ||
507 | private void WriteSolution(SolutionNode solution, bool writeSolutionToDisk) | 507 | private void WriteSolution(SolutionNode solution, bool writeSolutionToDisk) |
508 | { | 508 | { |
509 | kernel.Log.Write("Creating {0} solution and project files", this.VersionName); | 509 | kernel.Log.Write("Creating {0} solution and project files", this.VersionName); |
510 | 510 | ||
511 | foreach (SolutionNode child in solution.Solutions) | 511 | foreach (SolutionNode child in solution.Solutions) |
512 | { | 512 | { |
513 | kernel.Log.Write("...Creating folder: {0}", child.Name); | 513 | kernel.Log.Write("...Creating folder: {0}", child.Name); |
514 | WriteSolution(child, false); | 514 | WriteSolution(child, false); |
515 | } | 515 | } |
516 | 516 | ||
517 | foreach (ProjectNode project in solution.Projects) | 517 | foreach (ProjectNode project in solution.Projects) |
518 | { | 518 | { |
519 | kernel.Log.Write("...Creating project: {0}", project.Name); | 519 | kernel.Log.Write("...Creating project: {0}", project.Name); |
520 | WriteProject(solution, project); | 520 | WriteProject(solution, project); |
521 | } | 521 | } |
522 | 522 | ||
523 | foreach (DatabaseProjectNode project in solution.DatabaseProjects) | 523 | foreach (DatabaseProjectNode project in solution.DatabaseProjects) |
524 | { | 524 | { |
525 | kernel.Log.Write("...Creating database project: {0}", project.Name); | 525 | kernel.Log.Write("...Creating database project: {0}", project.Name); |
526 | WriteDatabaseProject(solution, project); | 526 | WriteDatabaseProject(solution, project); |
527 | } | 527 | } |
528 | 528 | ||
529 | if (writeSolutionToDisk) // only write main solution | 529 | if (writeSolutionToDisk) // only write main solution |
530 | { | 530 | { |
531 | kernel.Log.Write(""); | 531 | kernel.Log.Write(""); |
532 | string solutionFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "sln"); | 532 | string solutionFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "sln"); |
533 | 533 | ||
534 | using (StreamWriter ss = new StreamWriter(solutionFile)) | 534 | using (StreamWriter ss = new StreamWriter(solutionFile)) |
535 | { | 535 | { |
536 | kernel.CurrentWorkingDirectory.Push(); | 536 | kernel.CurrentWorkingDirectory.Push(); |
537 | Helper.SetCurrentDir(Path.GetDirectoryName(solutionFile)); | 537 | Helper.SetCurrentDir(Path.GetDirectoryName(solutionFile)); |
538 | 538 | ||
539 | ss.WriteLine("Microsoft Visual Studio Solution File, Format Version {0}", this.SolutionVersion); | 539 | ss.WriteLine("Microsoft Visual Studio Solution File, Format Version {0}", this.SolutionVersion); |
540 | ss.WriteLine(SolutionTag); | 540 | ss.WriteLine(SolutionTag); |
541 | 541 | ||
542 | WriteProjectDeclarations(ss, solution, solution); | 542 | WriteProjectDeclarations(ss, solution, solution); |
543 | 543 | ||
544 | ss.WriteLine("Global"); | 544 | ss.WriteLine("Global"); |
545 | 545 | ||
546 | ss.WriteLine("\tGlobalSection(SolutionConfigurationPlatforms) = preSolution"); | 546 | ss.WriteLine("\tGlobalSection(SolutionConfigurationPlatforms) = preSolution"); |
547 | foreach (ConfigurationNode conf in solution.Configurations) | 547 | foreach (ConfigurationNode conf in solution.Configurations) |
548 | { | 548 | { |
549 | ss.WriteLine("\t\t{0}|Any CPU = {0}|Any CPU", conf.Name); | 549 | ss.WriteLine("\t\t{0}|Any CPU = {0}|Any CPU", conf.Name); |
550 | } | 550 | } |
551 | ss.WriteLine("\tEndGlobalSection"); | 551 | ss.WriteLine("\tEndGlobalSection"); |
552 | 552 | ||
553 | ss.WriteLine("\tGlobalSection(ProjectConfigurationPlatforms) = postSolution"); | 553 | ss.WriteLine("\tGlobalSection(ProjectConfigurationPlatforms) = postSolution"); |
554 | WriteConfigurationLines(solution.Configurations, solution, ss); | 554 | WriteConfigurationLines(solution.Configurations, solution, ss); |
555 | ss.WriteLine("\tEndGlobalSection"); | 555 | ss.WriteLine("\tEndGlobalSection"); |
556 | 556 | ||
557 | if (solution.Solutions.Count > 0) | 557 | if (solution.Solutions.Count > 0) |
558 | { | 558 | { |
559 | ss.WriteLine("\tGlobalSection(NestedProjects) = preSolution"); | 559 | ss.WriteLine("\tGlobalSection(NestedProjects) = preSolution"); |
560 | foreach (SolutionNode embeddedSolution in solution.Solutions) | 560 | foreach (SolutionNode embeddedSolution in solution.Solutions) |
561 | { | 561 | { |
562 | WriteNestedProjectMap(ss, embeddedSolution); | 562 | WriteNestedProjectMap(ss, embeddedSolution); |
563 | } | 563 | } |
564 | ss.WriteLine("\tEndGlobalSection"); | 564 | ss.WriteLine("\tEndGlobalSection"); |
565 | } | 565 | } |
566 | 566 | ||
567 | ss.WriteLine("EndGlobal"); | 567 | ss.WriteLine("EndGlobal"); |
568 | } | 568 | } |
569 | 569 | ||
570 | kernel.CurrentWorkingDirectory.Pop(); | 570 | kernel.CurrentWorkingDirectory.Pop(); |
571 | } | 571 | } |
572 | } | 572 | } |
573 | 573 | ||
574 | private void WriteProjectDeclarations(StreamWriter writer, SolutionNode actualSolution, SolutionNode embeddedSolution) | 574 | private void WriteProjectDeclarations(StreamWriter writer, SolutionNode actualSolution, SolutionNode embeddedSolution) |
575 | { | 575 | { |
576 | foreach (SolutionNode childSolution in embeddedSolution.Solutions) | 576 | foreach (SolutionNode childSolution in embeddedSolution.Solutions) |
577 | { | 577 | { |
578 | WriteEmbeddedSolution(writer, childSolution); | 578 | WriteEmbeddedSolution(writer, childSolution); |
579 | WriteProjectDeclarations(writer, actualSolution, childSolution); | 579 | WriteProjectDeclarations(writer, actualSolution, childSolution); |
580 | } | 580 | } |
581 | 581 | ||
582 | foreach (ProjectNode project in embeddedSolution.Projects) | 582 | foreach (ProjectNode project in embeddedSolution.Projects) |
583 | { | 583 | { |
584 | WriteProject(actualSolution, writer, project); | 584 | WriteProject(actualSolution, writer, project); |
585 | } | 585 | } |
586 | 586 | ||
587 | foreach (DatabaseProjectNode dbProject in embeddedSolution.DatabaseProjects) | 587 | foreach (DatabaseProjectNode dbProject in embeddedSolution.DatabaseProjects) |
588 | { | 588 | { |
589 | WriteProject(actualSolution, writer, dbProject); | 589 | WriteProject(actualSolution, writer, dbProject); |
590 | } | 590 | } |
591 | 591 | ||
592 | if (actualSolution.Guid == embeddedSolution.Guid) | 592 | if (actualSolution.Guid == embeddedSolution.Guid) |
593 | { | 593 | { |
594 | WriteSolutionFiles(actualSolution, writer); | 594 | WriteSolutionFiles(actualSolution, writer); |
595 | } | 595 | } |
596 | } | 596 | } |
597 | 597 | ||
598 | private static void WriteNestedProjectMap(StreamWriter writer, SolutionNode embeddedSolution) | 598 | private static void WriteNestedProjectMap(StreamWriter writer, SolutionNode embeddedSolution) |
599 | { | 599 | { |
600 | foreach (ProjectNode project in embeddedSolution.Projects) | 600 | foreach (ProjectNode project in embeddedSolution.Projects) |
601 | { | 601 | { |
602 | WriteNestedProject(writer, embeddedSolution, project.Guid); | 602 | WriteNestedProject(writer, embeddedSolution, project.Guid); |
603 | } | 603 | } |
604 | 604 | ||
605 | foreach (DatabaseProjectNode dbProject in embeddedSolution.DatabaseProjects) | 605 | foreach (DatabaseProjectNode dbProject in embeddedSolution.DatabaseProjects) |
606 | { | 606 | { |
607 | WriteNestedProject(writer, embeddedSolution, dbProject.Guid); | 607 | WriteNestedProject(writer, embeddedSolution, dbProject.Guid); |
608 | } | 608 | } |
609 | 609 | ||
610 | foreach (SolutionNode child in embeddedSolution.Solutions) | 610 | foreach (SolutionNode child in embeddedSolution.Solutions) |
611 | { | 611 | { |
612 | WriteNestedProject(writer, embeddedSolution, child.Guid); | 612 | WriteNestedProject(writer, embeddedSolution, child.Guid); |
613 | WriteNestedProjectMap(writer, child); | 613 | WriteNestedProjectMap(writer, child); |
614 | } | 614 | } |
615 | } | 615 | } |
616 | 616 | ||
617 | private static void WriteNestedProject(StreamWriter writer, SolutionNode solution, Guid projectGuid) | 617 | private static void WriteNestedProject(StreamWriter writer, SolutionNode solution, Guid projectGuid) |
618 | { | 618 | { |
619 | WriteNestedFolder(writer, solution.Guid, projectGuid); | 619 | WriteNestedFolder(writer, solution.Guid, projectGuid); |
620 | } | 620 | } |
621 | 621 | ||
622 | private static void WriteNestedFolder(StreamWriter writer, Guid parentGuid, Guid childGuid) | 622 | private static void WriteNestedFolder(StreamWriter writer, Guid parentGuid, Guid childGuid) |
623 | { | 623 | { |
624 | writer.WriteLine("\t\t{0} = {1}", | 624 | writer.WriteLine("\t\t{0} = {1}", |
625 | childGuid.ToString("B").ToUpper(), | 625 | childGuid.ToString("B").ToUpper(), |
626 | parentGuid.ToString("B").ToUpper()); | 626 | parentGuid.ToString("B").ToUpper()); |
627 | } | 627 | } |
628 | 628 | ||
629 | private static void WriteConfigurationLines(ICollection configurations, SolutionNode solution, StreamWriter ss) | 629 | private static void WriteConfigurationLines(ICollection configurations, SolutionNode solution, StreamWriter ss) |
630 | { | 630 | { |
631 | foreach (ProjectNode project in solution.Projects) | 631 | foreach (ProjectNode project in solution.Projects) |
632 | { | 632 | { |
633 | foreach (ConfigurationNode conf in configurations) | 633 | foreach (ConfigurationNode conf in configurations) |
634 | { | 634 | { |
635 | ss.WriteLine("\t\t{0}.{1}|Any CPU.ActiveCfg = {1}|Any CPU", | 635 | ss.WriteLine("\t\t{0}.{1}|Any CPU.ActiveCfg = {1}|Any CPU", |
636 | project.Guid.ToString("B").ToUpper(), | 636 | project.Guid.ToString("B").ToUpper(), |
637 | conf.Name); | 637 | conf.Name); |
638 | 638 | ||
639 | ss.WriteLine("\t\t{0}.{1}|Any CPU.Build.0 = {1}|Any CPU", | 639 | ss.WriteLine("\t\t{0}.{1}|Any CPU.Build.0 = {1}|Any CPU", |
640 | project.Guid.ToString("B").ToUpper(), | 640 | project.Guid.ToString("B").ToUpper(), |
641 | conf.Name); | 641 | conf.Name); |
642 | } | 642 | } |
643 | } | 643 | } |
644 | 644 | ||
645 | foreach (SolutionNode child in solution.Solutions) | 645 | foreach (SolutionNode child in solution.Solutions) |
646 | { | 646 | { |
647 | WriteConfigurationLines(configurations, child, ss); | 647 | WriteConfigurationLines(configurations, child, ss); |
648 | } | 648 | } |
649 | } | 649 | } |
650 | 650 | ||
651 | private void WriteSolutionFiles(SolutionNode solution, StreamWriter ss) | 651 | private void WriteSolutionFiles(SolutionNode solution, StreamWriter ss) |
652 | { | 652 | { |
653 | WriteProject(ss, "Folder", solution.Guid, "Solution Files", "Solution Files", solution.Files); | 653 | WriteProject(ss, "Folder", solution.Guid, "Solution Files", "Solution Files", solution.Files); |
654 | } | 654 | } |
655 | 655 | ||
656 | private void WriteEmbeddedSolution(StreamWriter writer, SolutionNode embeddedSolution) | 656 | private void WriteEmbeddedSolution(StreamWriter writer, SolutionNode embeddedSolution) |
657 | { | 657 | { |
658 | WriteProject(writer, "Folder", embeddedSolution.Guid, embeddedSolution.Name, embeddedSolution.Name, embeddedSolution.Files); | 658 | WriteProject(writer, "Folder", embeddedSolution.Guid, embeddedSolution.Name, embeddedSolution.Name, embeddedSolution.Files); |
659 | } | 659 | } |
660 | 660 | ||
661 | private void WriteProject(SolutionNode solution, StreamWriter ss, ProjectNode project) | 661 | private void WriteProject(SolutionNode solution, StreamWriter ss, ProjectNode project) |
662 | { | 662 | { |
663 | WriteProject(ss, solution, project.Language, project.Guid, project.Name, project.FullPath); | 663 | WriteProject(ss, solution, project.Language, project.Guid, project.Name, project.FullPath); |
664 | } | 664 | } |
665 | 665 | ||
666 | private void WriteProject(SolutionNode solution, StreamWriter ss, DatabaseProjectNode dbProject) | 666 | private void WriteProject(SolutionNode solution, StreamWriter ss, DatabaseProjectNode dbProject) |
667 | { | 667 | { |
668 | if (solution.Files != null && solution.Files.Count > 0) | 668 | if (solution.Files != null && solution.Files.Count > 0) |
669 | WriteProject(ss, solution, "Database", dbProject.Guid, dbProject.Name, dbProject.FullPath); | 669 | WriteProject(ss, solution, "Database", dbProject.Guid, dbProject.Name, dbProject.FullPath); |
670 | } | 670 | } |
671 | 671 | ||
672 | private static bool ExtensionSpecified(string refName) | 672 | private static bool ExtensionSpecified(string refName) |
673 | { | 673 | { |
674 | return refName.EndsWith(".dll") || refName.EndsWith(".exe"); | 674 | return refName.EndsWith(".dll") || refName.EndsWith(".exe"); |
675 | } | 675 | } |
676 | 676 | ||
677 | private static string GetProjectExtension(ProjectNode project) | 677 | private static string GetProjectExtension(ProjectNode project) |
678 | { | 678 | { |
679 | string extension = ".dll"; | 679 | string extension = ".dll"; |
680 | if (project.Type == ProjectType.Exe) | 680 | if (project.Type == ProjectType.Exe) |
681 | { | 681 | { |
682 | extension = ".exe"; | 682 | extension = ".exe"; |
683 | } | 683 | } |
684 | return extension; | 684 | return extension; |
685 | } | 685 | } |
686 | 686 | ||
687 | const string ProjectDeclarationBeginFormat = "Project(\"{0}\") = \"{1}\", \"{2}\", \"{3}\""; | 687 | const string ProjectDeclarationBeginFormat = "Project(\"{0}\") = \"{1}\", \"{2}\", \"{3}\""; |
688 | const string ProjectDeclarationEndFormat = "EndProject"; | 688 | const string ProjectDeclarationEndFormat = "EndProject"; |
689 | 689 | ||
690 | private void WriteProject(StreamWriter ss, SolutionNode solution, string language, Guid guid, string name, string projectFullPath) | 690 | private void WriteProject(StreamWriter ss, SolutionNode solution, string language, Guid guid, string name, string projectFullPath) |
691 | { | 691 | { |
692 | if (!tools.ContainsKey(language)) | 692 | if (!tools.ContainsKey(language)) |
693 | throw new UnknownLanguageException("Unknown .NET language: " + language); | 693 | throw new UnknownLanguageException("Unknown .NET language: " + language); |
694 | 694 | ||
695 | ToolInfo toolInfo = (ToolInfo)tools[language]; | 695 | ToolInfo toolInfo = (ToolInfo)tools[language]; |
696 | 696 | ||
697 | string path = Helper.MakePathRelativeTo(solution.FullPath, projectFullPath); | 697 | string path = Helper.MakePathRelativeTo(solution.FullPath, projectFullPath); |
698 | 698 | ||
699 | path = Helper.MakeFilePath(path, name, toolInfo.FileExtension); | 699 | path = Helper.MakeFilePath(path, name, toolInfo.FileExtension); |
700 | 700 | ||
701 | WriteProject(ss, language, guid, name, path); | 701 | WriteProject(ss, language, guid, name, path); |
702 | } | 702 | } |
703 | 703 | ||
704 | private void WriteProject(StreamWriter writer, string language, Guid projectGuid, string name, string location) | 704 | private void WriteProject(StreamWriter writer, string language, Guid projectGuid, string name, string location) |
705 | { | 705 | { |
706 | WriteProject(writer, language, projectGuid, name, location, null); | 706 | WriteProject(writer, language, projectGuid, name, location, null); |
707 | } | 707 | } |
708 | 708 | ||
709 | private void WriteProject(StreamWriter writer, string language, Guid projectGuid, string name, string location, FilesNode files) | 709 | private void WriteProject(StreamWriter writer, string language, Guid projectGuid, string name, string location, FilesNode files) |
710 | { | 710 | { |
711 | if (!tools.ContainsKey(language)) | 711 | if (!tools.ContainsKey(language)) |
712 | throw new UnknownLanguageException("Unknown .NET language: " + language); | 712 | throw new UnknownLanguageException("Unknown .NET language: " + language); |
713 | 713 | ||
714 | ToolInfo toolInfo = (ToolInfo)tools[language]; | 714 | ToolInfo toolInfo = (ToolInfo)tools[language]; |
715 | 715 | ||
716 | writer.WriteLine(ProjectDeclarationBeginFormat, | 716 | writer.WriteLine(ProjectDeclarationBeginFormat, |
717 | toolInfo.Guid, | 717 | toolInfo.Guid, |
718 | name, | 718 | name, |
719 | location, | 719 | location, |
720 | projectGuid.ToString("B").ToUpper()); | 720 | projectGuid.ToString("B").ToUpper()); |
721 | 721 | ||
722 | if (files != null) | 722 | if (files != null) |
723 | { | 723 | { |
724 | writer.WriteLine("\tProjectSection(SolutionItems) = preProject"); | 724 | writer.WriteLine("\tProjectSection(SolutionItems) = preProject"); |
725 | 725 | ||
726 | foreach (string file in files) | 726 | foreach (string file in files) |
727 | writer.WriteLine("\t\t{0} = {0}", file); | 727 | writer.WriteLine("\t\t{0} = {0}", file); |
728 | 728 | ||
729 | writer.WriteLine("\tEndProjectSection"); | 729 | writer.WriteLine("\tEndProjectSection"); |
730 | } | 730 | } |
731 | 731 | ||
732 | writer.WriteLine(ProjectDeclarationEndFormat); | 732 | writer.WriteLine(ProjectDeclarationEndFormat); |
733 | } | 733 | } |
734 | 734 | ||
735 | private void WriteDatabaseProject(SolutionNode solution, DatabaseProjectNode project) | 735 | private void WriteDatabaseProject(SolutionNode solution, DatabaseProjectNode project) |
736 | { | 736 | { |
737 | string projectFile = Helper.MakeFilePath(project.FullPath, project.Name, "dbp"); | 737 | string projectFile = Helper.MakeFilePath(project.FullPath, project.Name, "dbp"); |
738 | IndentedTextWriter ps = new IndentedTextWriter(new StreamWriter(projectFile), " "); | 738 | IndentedTextWriter ps = new IndentedTextWriter(new StreamWriter(projectFile), " "); |
739 | 739 | ||
740 | kernel.CurrentWorkingDirectory.Push(); | 740 | kernel.CurrentWorkingDirectory.Push(); |
741 | 741 | ||
742 | Helper.SetCurrentDir(Path.GetDirectoryName(projectFile)); | 742 | Helper.SetCurrentDir(Path.GetDirectoryName(projectFile)); |
743 | 743 | ||
744 | using (ps) | 744 | using (ps) |
745 | { | 745 | { |
746 | ps.WriteLine("# Microsoft Developer Studio Project File - Database Project"); | 746 | ps.WriteLine("# Microsoft Developer Studio Project File - Database Project"); |
747 | ps.WriteLine("Begin DataProject = \"{0}\"", project.Name); | 747 | ps.WriteLine("Begin DataProject = \"{0}\"", project.Name); |
748 | ps.Indent++; | 748 | ps.Indent++; |
749 | ps.WriteLine("MSDTVersion = \"80\""); | 749 | ps.WriteLine("MSDTVersion = \"80\""); |
750 | // TODO: Use the project.Files property | 750 | // TODO: Use the project.Files property |
751 | if (ContainsSqlFiles(Path.GetDirectoryName(projectFile))) | 751 | if (ContainsSqlFiles(Path.GetDirectoryName(projectFile))) |
752 | WriteDatabaseFoldersAndFiles(ps, Path.GetDirectoryName(projectFile)); | 752 | WriteDatabaseFoldersAndFiles(ps, Path.GetDirectoryName(projectFile)); |
753 | 753 | ||
754 | ps.WriteLine("Begin DBRefFolder = \"Database References\""); | 754 | ps.WriteLine("Begin DBRefFolder = \"Database References\""); |
755 | ps.Indent++; | 755 | ps.Indent++; |
756 | foreach (DatabaseReferenceNode reference in project.References) | 756 | foreach (DatabaseReferenceNode reference in project.References) |
757 | { | 757 | { |
758 | ps.WriteLine("Begin DBRefNode = \"{0}\"", reference.Name); | 758 | ps.WriteLine("Begin DBRefNode = \"{0}\"", reference.Name); |
759 | ps.Indent++; | 759 | ps.Indent++; |
760 | ps.WriteLine("ConnectStr = \"{0}\"", reference.ConnectionString); | 760 | ps.WriteLine("ConnectStr = \"{0}\"", reference.ConnectionString); |
761 | ps.WriteLine("Provider = \"{0}\"", reference.ProviderId.ToString("B").ToUpper()); | 761 | ps.WriteLine("Provider = \"{0}\"", reference.ProviderId.ToString("B").ToUpper()); |
762 | //ps.WriteLine("Colorizer = 5"); | 762 | //ps.WriteLine("Colorizer = 5"); |
763 | ps.Indent--; | 763 | ps.Indent--; |
764 | ps.WriteLine("End"); | 764 | ps.WriteLine("End"); |
765 | } | 765 | } |
766 | ps.Indent--; | 766 | ps.Indent--; |
767 | ps.WriteLine("End"); | 767 | ps.WriteLine("End"); |
768 | ps.Indent--; | 768 | ps.Indent--; |
769 | ps.WriteLine("End"); | 769 | ps.WriteLine("End"); |
770 | 770 | ||
771 | ps.Flush(); | 771 | ps.Flush(); |
772 | } | 772 | } |
773 | 773 | ||
774 | kernel.CurrentWorkingDirectory.Pop(); | 774 | kernel.CurrentWorkingDirectory.Pop(); |
775 | } | 775 | } |
776 | 776 | ||
777 | private bool ContainsSqlFiles(string folder) | 777 | private bool ContainsSqlFiles(string folder) |
778 | { | 778 | { |
779 | foreach (string file in Directory.GetFiles(folder, "*.sql")) | 779 | foreach (string file in Directory.GetFiles(folder, "*.sql")) |
780 | { | 780 | { |
781 | return true; // if the folder contains 1 .sql file, that's good enough | 781 | return true; // if the folder contains 1 .sql file, that's good enough |
782 | } | 782 | } |
783 | 783 | ||
784 | foreach (string child in Directory.GetDirectories(folder)) | 784 | foreach (string child in Directory.GetDirectories(folder)) |
785 | { | 785 | { |
786 | if (ContainsSqlFiles(child)) | 786 | if (ContainsSqlFiles(child)) |
787 | return true; // if 1 child folder contains a .sql file, still good enough | 787 | return true; // if 1 child folder contains a .sql file, still good enough |
788 | } | 788 | } |
789 | 789 | ||
790 | return false; | 790 | return false; |
791 | } | 791 | } |
792 | 792 | ||
793 | private void WriteDatabaseFoldersAndFiles(IndentedTextWriter writer, string folder) | 793 | private void WriteDatabaseFoldersAndFiles(IndentedTextWriter writer, string folder) |
794 | { | 794 | { |
795 | foreach (string child in Directory.GetDirectories(folder)) | 795 | foreach (string child in Directory.GetDirectories(folder)) |
796 | { | 796 | { |
797 | if (ContainsSqlFiles(child)) | 797 | if (ContainsSqlFiles(child)) |
798 | { | 798 | { |
799 | writer.WriteLine("Begin Folder = \"{0}\"", Path.GetFileName(child)); | 799 | writer.WriteLine("Begin Folder = \"{0}\"", Path.GetFileName(child)); |
800 | writer.Indent++; | 800 | writer.Indent++; |
801 | WriteDatabaseFoldersAndFiles(writer, child); | 801 | WriteDatabaseFoldersAndFiles(writer, child); |
802 | writer.Indent--; | 802 | writer.Indent--; |
803 | writer.WriteLine("End"); | 803 | writer.WriteLine("End"); |
804 | } | 804 | } |
805 | } | 805 | } |
806 | foreach (string file in Directory.GetFiles(folder, "*.sql")) | 806 | foreach (string file in Directory.GetFiles(folder, "*.sql")) |
807 | { | 807 | { |
808 | writer.WriteLine("Script = \"{0}\"", Path.GetFileName(file)); | 808 | writer.WriteLine("Script = \"{0}\"", Path.GetFileName(file)); |
809 | } | 809 | } |
810 | } | 810 | } |
811 | 811 | ||
812 | private void CleanProject(ProjectNode project) | 812 | private void CleanProject(ProjectNode project) |
813 | { | 813 | { |
814 | kernel.Log.Write("...Cleaning project: {0}", project.Name); | 814 | kernel.Log.Write("...Cleaning project: {0}", project.Name); |
815 | 815 | ||
816 | ToolInfo toolInfo = (ToolInfo)tools[project.Language]; | 816 | ToolInfo toolInfo = (ToolInfo)tools[project.Language]; |
817 | string projectFile = Helper.MakeFilePath(project.FullPath, project.Name, toolInfo.FileExtension); | 817 | string projectFile = Helper.MakeFilePath(project.FullPath, project.Name, toolInfo.FileExtension); |
818 | string userFile = projectFile + ".user"; | 818 | string userFile = projectFile + ".user"; |
819 | 819 | ||
820 | Helper.DeleteIfExists(projectFile); | 820 | Helper.DeleteIfExists(projectFile); |
821 | Helper.DeleteIfExists(userFile); | 821 | Helper.DeleteIfExists(userFile); |
822 | } | 822 | } |
823 | 823 | ||
824 | private void CleanSolution(SolutionNode solution) | 824 | private void CleanSolution(SolutionNode solution) |
825 | { | 825 | { |
826 | kernel.Log.Write("Cleaning {0} solution and project files", this.VersionName, solution.Name); | 826 | kernel.Log.Write("Cleaning {0} solution and project files", this.VersionName, solution.Name); |
827 | 827 | ||
828 | string slnFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "sln"); | 828 | string slnFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "sln"); |
829 | string suoFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "suo"); | 829 | string suoFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "suo"); |
830 | 830 | ||
831 | Helper.DeleteIfExists(slnFile); | 831 | Helper.DeleteIfExists(slnFile); |
832 | Helper.DeleteIfExists(suoFile); | 832 | Helper.DeleteIfExists(suoFile); |
833 | 833 | ||
834 | foreach (ProjectNode project in solution.Projects) | 834 | foreach (ProjectNode project in solution.Projects) |
835 | { | 835 | { |
836 | CleanProject(project); | 836 | CleanProject(project); |
837 | } | 837 | } |
838 | 838 | ||
839 | kernel.Log.Write(""); | 839 | kernel.Log.Write(""); |
840 | } | 840 | } |
841 | 841 | ||
842 | #endregion | 842 | #endregion |
843 | 843 | ||
844 | #region ITarget Members | 844 | #region ITarget Members |
845 | 845 | ||
846 | /// <summary> | 846 | /// <summary> |
847 | /// Writes the specified kern. | 847 | /// Writes the specified kern. |
848 | /// </summary> | 848 | /// </summary> |
849 | /// <param name="kern">The kern.</param> | 849 | /// <param name="kern">The kern.</param> |
850 | public virtual void Write(Kernel kern) | 850 | public virtual void Write(Kernel kern) |
851 | { | 851 | { |
852 | if (kern == null) | 852 | if (kern == null) |
853 | { | 853 | { |
854 | throw new ArgumentNullException("kern"); | 854 | throw new ArgumentNullException("kern"); |
855 | } | 855 | } |
856 | kernel = kern; | 856 | kernel = kern; |
857 | foreach (SolutionNode sol in kernel.Solutions) | 857 | foreach (SolutionNode sol in kernel.Solutions) |
858 | { | 858 | { |
859 | WriteSolution(sol, true); | 859 | WriteSolution(sol, true); |
860 | } | 860 | } |
861 | kernel = null; | 861 | kernel = null; |
862 | } | 862 | } |
863 | 863 | ||
864 | /// <summary> | 864 | /// <summary> |
865 | /// Cleans the specified kern. | 865 | /// Cleans the specified kern. |
866 | /// </summary> | 866 | /// </summary> |
867 | /// <param name="kern">The kern.</param> | 867 | /// <param name="kern">The kern.</param> |
868 | public virtual void Clean(Kernel kern) | 868 | public virtual void Clean(Kernel kern) |
869 | { | 869 | { |
870 | if (kern == null) | 870 | if (kern == null) |
871 | { | 871 | { |
872 | throw new ArgumentNullException("kern"); | 872 | throw new ArgumentNullException("kern"); |
873 | } | 873 | } |
874 | kernel = kern; | 874 | kernel = kern; |
875 | foreach (SolutionNode sol in kernel.Solutions) | 875 | foreach (SolutionNode sol in kernel.Solutions) |
876 | { | 876 | { |
877 | CleanSolution(sol); | 877 | CleanSolution(sol); |
878 | } | 878 | } |
879 | kernel = null; | 879 | kernel = null; |
880 | } | 880 | } |
881 | 881 | ||
882 | #endregion | 882 | #endregion |
883 | } | 883 | } |
884 | } | 884 | } |